# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1261032947 -7200 # Node ID a2952bb97e6877e7f0ece862bff4af34249f3985 Revision: 200949 Kit: 200951 diff -r 000000000000 -r a2952bb97e68 group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007 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 for mmappservices domain +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../mpx/sis/mpxstub.sis /epoc32/data/z/system/install/mpxstub.sis + + +PRJ_MMPFILES +#include "../mmappfw_plat/group/bld.inf" +#include "../mpx/group/bld.inf" +#include "../mmappcomponents/group/bld.inf" + diff -r 000000000000 -r a2952bb97e68 group/mmappservices_stub.sis Binary file group/mmappservices_stub.sis has changed diff -r 000000000000 -r a2952bb97e68 inc/mmappfwbldvariant.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/mmappfwbldvariant.hrh Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2006 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: bldvariant headers for project mmappfw +* +*/ + + + +#ifndef MMAPPFWBLDVARIANT_HRH +#define MMAPPFWBLDVARIANT_HRH + +#define IAD_INCLUDE_BACKSTEPPING +#define IAD_INCLUDE_AUDIOFETCHER + +#endif // MMAPPFWBLDVARIANT_HRH + +// End of File + diff -r 000000000000 -r a2952bb97e68 layers.sysdef.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/layers.sysdef.xml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,34 @@ + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/asxparser/bwins/asxparser.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/asxparser/bwins/asxparser.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,10 @@ +EXPORTS + ??1CAsxParser@@UAE@XZ @ 1 NONAME ; CAsxParser::~CAsxParser(void) + ?FileVersion@CAsxParser@@QAEHXZ @ 2 NONAME ; int CAsxParser::FileVersion(void) + ?GetUrl@CAsxParser@@QAEHIAAVTPtrC8@@@Z @ 3 NONAME ; int CAsxParser::GetUrl(unsigned int, class TPtrC8 &) + ?GetUrlCount@CAsxParser@@QAEXAAI@Z @ 4 NONAME ; void CAsxParser::GetUrlCount(unsigned int &) + ?NewL@CAsxParser@@SAPAV1@ABVTDesC16@@@Z @ 5 NONAME ; class CAsxParser * CAsxParser::NewL(class TDesC16 const &) + ?NewL@CAsxParser@@SAPAV1@AAVRFile@@@Z @ 6 NONAME ; class CAsxParser * CAsxParser::NewL(class RFile &) + ?PrintUrl@CAsxParser@@QAEXAAVTPtrC8@@AAVTPtr16@@@Z @ 7 NONAME ; void CAsxParser::PrintUrl(class TPtrC8 &, class TPtr16 &) + ?GetUrl@CAsxParser@@QAEPAUAsxStruct@@I@Z @ 8 NONAME ; struct AsxStruct * CAsxParser::GetUrl(unsigned int) + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/asxparser/eabi/asxparser.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/asxparser/eabi/asxparser.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,14 @@ +EXPORTS + _ZN10CAsxParser11FileVersionEv @ 1 NONAME + _ZN10CAsxParser11GetUrlCountERj @ 2 NONAME + _ZN10CAsxParser4NewLERK7TDesC16 @ 3 NONAME + _ZN10CAsxParser6GetUrlEjR6TPtrC8 @ 4 NONAME + _ZN10CAsxParserD0Ev @ 5 NONAME + _ZN10CAsxParserD1Ev @ 6 NONAME + _ZN10CAsxParserD2Ev @ 7 NONAME + _ZTI10CAsxParser @ 8 NONAME ; ## + _ZTV10CAsxParser @ 9 NONAME ; ## + _ZN10CAsxParser4NewLER5RFile @ 10 NONAME + _ZN10CAsxParser8PrintUrlER6TPtrC8R6TPtr16 @ 11 NONAME + _ZN10CAsxParser6GetUrlEj @ 12 NONAME + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/asxparser/group/asxparser.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/asxparser/group/asxparser.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -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: Makefile for Asx Parser. + * +*/ + +// Version : %version: 9.1.2 % + + +#include +#include + +TARGET asxparser.dll +TARGETTYPE DLL + +UID 0x1000008d 0x1028254E + +CAPABILITY CAP_ECOM_PLUGIN + +MW_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc + +SOURCEPATH ../src + +SOURCE asxparser.cpp + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY xmlenginedom.lib +LIBRARY xmlparser.lib +LIBRARY xmldom.lib +LIBRARY flogger.lib +LIBRARY charconv.lib + +NOSTRICTDEF + +DEFFILE asxparser.def diff -r 000000000000 -r a2952bb97e68 mmappcomponents/asxparser/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/asxparser/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2008 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 build file for AsxParser + * +*/ + +// Version : %version: 5.1.2 % + + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +#ifdef __WINDOWS_MEDIA +../sis/asxparser_stub.sis /epoc32/data/z/system/install/asxparser_stub.sis +../rom/asxparser.iby CORE_MW_LAYER_IBY_EXPORT_PATH(asxparser.iby) +#endif + +PRJ_MMPFILES +asxparser.mmp + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/asxparser/inc/AsxParser_debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/asxparser/inc/AsxParser_debug.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2008 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: Defines macro for debug output +* +*/ + +// Version : %version: 4.1.1 % + + + +#ifndef __MP_DEBUG_H__ +#define __MP_DEBUG_H__ + +#include +#include +#include + +// +// Forward declaration +// +class AsxParserDebug; + +// #ifdef __MARM__ +// #define _ASX_PARSER_FILE_LOGGING_ +// #endif + +#ifdef _ASX_PARSER_FILE_LOGGING_ + #define ASX_DEBUG AsxParserDebug::FileLog +#else + #ifdef _DEBUG + #define ASX_DEBUG RDebug::Print + #else + #define ASX_DEBUG AsxParserDebug::NullLog + #endif +#endif + +class AsxParserDebug +{ + public: + inline static void NullLog(TRefByValue /*aFmt*/,...) + { + } + + inline static void FileLog(TRefByValue aFmt,...) + { + VA_LIST list; + VA_START(list,aFmt); + RFileLogger::WriteFormat(_L("AsxParser"), _L("ap.log"),EFileLoggingModeAppend,aFmt,list); + } +}; + +#endif // __MP_DEBUG_H__ diff -r 000000000000 -r a2952bb97e68 mmappcomponents/asxparser/rom/asxparser.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/asxparser/rom/asxparser.iby Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2008 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: IBY file for Asx Parser component +* +*/ + +// Version : %version: 4.1.1 % + + +#ifndef __ASXPARSER_IBY__ +#define __ASXPARSER_IBY__ + +REM AsxParser + +#ifdef __WINDOWS_MEDIA +data = ZSYSTEM\install\AsxParser_stub.SIS system\install\AsxParser_stub.SIS +file=ABI_DIR\BUILD_DIR\AsxParser.dll SHARED_LIB_DIR\AsxParser.dll +#endif + +#endif // __ASXPARSER_IBY diff -r 000000000000 -r a2952bb97e68 mmappcomponents/asxparser/sis/AsxParser.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/asxparser/sis/AsxParser.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,30 @@ +; +; 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: Package file for AsxParser component +; +; Version : %version: % +; Languages +&EN + +; Header +# {"AsxParser"}, (0x1028254E), 1, 0, 0, TYPE=SA, RU + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +;Files +"\epoc32\release\armv5\urel\asxparser.dll" - "!:\sys\bin\asxparser.dll" diff -r 000000000000 -r a2952bb97e68 mmappcomponents/asxparser/sis/asxparser.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/asxparser/sis/asxparser.xml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,31 @@ + + + + + 1 + AsxParser + AsxParser + + + + S60 + + 5 + 0 + + 2008 + 24 + + + + 5 + 0 + + 2010 + 1 + + + + + + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/asxparser/sis/asxparser_stub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/asxparser/sis/asxparser_stub.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,30 @@ +; +; 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: Stub Package file for AsxParser component +; +; Version : %version: % +;Language +&EN + +; Header +# {"AsxParser"}, (0x1028254E), 1, 0, 0, TYPE=SA + +; Localised Vendor Name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +;Files +"" - "z:\sys\bin\asxparser.dll" \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/asxparser/sis/asxparser_stub.sis Binary file mmappcomponents/asxparser/sis/asxparser_stub.sis has changed diff -r 000000000000 -r a2952bb97e68 mmappcomponents/asxparser/src/asxparser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/asxparser/src/asxparser.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,487 @@ +/* +* Copyright (c) 2006 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: Simple v2/v3 ASX-fileparser +* +*/ + +// Version : %version: 10.1.5 % + + + +// INCLUDE FILES +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "AsxParser_debug.h" + +// CONSTANTS +#define KMaxAsxFileSize 5192 +_LIT8( KNoSkip, "no" ); + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CAsxParser::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +EXPORT_C CAsxParser* CAsxParser::NewL( const TDesC& aFileName ) +{ + ASX_DEBUG(_L("#MP# CAsxParser::NewL(%S)"), &aFileName); + + CAsxParser* self = new( ELeave ) CAsxParser(); + + CleanupStack::PushL( self ); + self->ConstructL( aFileName ); + CleanupStack::Pop( self ); + return self; +} + +// ----------------------------------------------------------------------------- +// CAsxParser::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +EXPORT_C CAsxParser* CAsxParser::NewL( RFile& aFile ) +{ + ASX_DEBUG(_L("#MP# CAsxParser::NewL(aFile)")); + + CAsxParser* self = new( ELeave ) CAsxParser(); + + CleanupStack::PushL( self ); + self->ConstructL( aFile ); + CleanupStack::Pop( self ); + return self; +} + +// ----------------------------------------------------------------------------- +// CAsxParser::~CAsxParser() +// Destructor +// ----------------------------------------------------------------------------- +EXPORT_C CAsxParser::~CAsxParser() +{ + ASX_DEBUG(_L("#MP# CAsxParser::~CAsxParser()")); + + for ( TInt i = 0 ; i < iAsxArray.Count() ; i++ ) + { + delete iAsxArray[i]->url; + } + + iAsxArray.ResetAndDestroy(); +} + +// ----------------------------------------------------------------------------- +// CAsxParser::CAsxParser +// C++ default constructor can NOT contain any code, that might leave. +// ----------------------------------------------------------------------------- +CAsxParser::CAsxParser() +{ + ASX_DEBUG(_L("#MP# CAsxParser::CAsxParser()")); +} + +// ----------------------------------------------------------------------------- +// CAsxParser::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +void CAsxParser::ConstructL( const TDesC& aFileName ) +{ + ASX_DEBUG(_L("#MP# CAsxParser::CAsxParser(%S)"), &aFileName); + + RFs rFs; + RFile asxFile; + + User::LeaveIfError( rFs.Connect() ); + CleanupClosePushL( rFs ); + + if ( ! BaflUtils::FileExists( rFs, aFileName ) ) + { + ASX_DEBUG(_L("#MP# CAsxParser::ConstructL() file not found")); + User::Leave( KErrNotFound ); + } + + User::LeaveIfError( asxFile.Open( rFs, aFileName, EFileShareAny ) ); + CleanupClosePushL( asxFile ); + HandleFileParsingL( asxFile ); + CleanupStack::PopAndDestroy( 2 ); // rFs, asxFile + +} + + +// ----------------------------------------------------------------------------- +// CAsxParser::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +void CAsxParser::ConstructL( RFile& aFile ) +{ + ASX_DEBUG(_L("#MP# CAsxParser::ConstructL(aFile)")); + RFile asxFile; + + if( ! aFile.SubSessionHandle() ) + { + ASX_DEBUG(_L("#MP# CAsxParser::ConstructL(aFile) file handle not found")); + User::Leave( KErrNotFound ); + } + + User::LeaveIfError( asxFile.Duplicate( aFile ) ); + CleanupClosePushL( asxFile ); + HandleFileParsingL( asxFile ); + asxFile.Close(); + CleanupStack::PopAndDestroy( ); // asxFile +} + +// ----------------------------------------------------------------------------- +// CAsxParser::ParseAsxV2HeaderL +// ----------------------------------------------------------------------------- +void CAsxParser::ParseAsxV2HeaderL( TPtr8 aPtr ) +{ + ASX_DEBUG(_L("#MP# CAsxParser::ParseAsxV2HeaderL()")); + + iVersion = 2; + TInt location = 0; + + // + // Find all RefX= string and the URLs + // + // v2 ASX file has simple Ref-strings for URLs, one URL per line + // File starts with [Reference] + // Example: + // [Reference] + // Ref1=http://server.com:8888/wm/file.wmv?MSWMExt=.asf + // Ref2=http://server2.com:8888/wm/file.wmv?MSWMExt=.asf + // + for ( TInt refNumber = 1 ; location >= 0 ; refNumber++ ) + { + HBufC8* refString = HBufC8::NewLC(10); + TPtr8 refPtr = refString->Des(); + + refPtr.Append(_L("Ref")); + refPtr.AppendNum(refNumber); + refPtr.Append(_L("=")); + + location = aPtr.FindF( refPtr ); + + if ( location != KErrNotFound ) + { + location += refPtr.Length(); + TPtrC8 mid = aPtr.Mid(location); + TInt length = mid.Locate(EKeyEnter); + + if ( length == KErrNotFound ) + { + length = mid.Length(); + } + + AsxStruct* asxItem = new( ELeave ) AsxStruct ; + CleanupStack::PushL( asxItem ); + + // default the seek to true + asxItem->seek = ETrue; + TPtrC8 urlStr = mid.Left(length); + asxItem->url = urlStr.AllocL(); + iAsxArray.Append(asxItem); + + CleanupStack::Pop(); // pop the asxItem + } + + CleanupStack::PopAndDestroy( refString ); + } +} + + +// ----------------------------------------------------------------------------- +// CAsxParser::ParseAsxV3HeaderL +// ----------------------------------------------------------------------------- +void CAsxParser::ParseAsxV3HeaderL( TPtr8 aPtr ) +{ + ASX_DEBUG(_L("#MP# CAsxParser::ParseAsxV3HeaderL()")); + + RXmlEngDOMImplementation DOM_impl; + DOM_impl.OpenL(); + + RXmlEngDOMParser parser; + TInt error = parser.Open( DOM_impl ); + + if (error == KErrNone) + { + RXmlEngDocument doc; + + // + // Parse the xml data stream + // + TRAPD( err, doc = parser.ParseL(aPtr) ); + + if ( ! err ) + { + iVersion = 3; + TXmlEngElement element; + TXmlEngNode node; + RXmlEngNodeList nodelist1; + RXmlEngNodeList nodelist2; + node = doc.DocumentElement(); + node.AsElement().GetChildElements(nodelist1); + + CleanupClosePushL(nodelist1); + CleanupClosePushL(nodelist2); + + _LIT8(KEntry,"ENTRY"); + _LIT8(KRef,"REF"); + _LIT8(KHRef,"HREF"); + _LIT8(KClientSkip,"CLIENTSKIP"); + + while ( nodelist1.HasNext() ) + { + element = nodelist1.Next(); + element.GetChildElements(nodelist2); + + // + // In v3 ASX file the streaming URLs are REF tags under + // ENTRY-element + // + // Search for all ENTRYs and REFs under them + // Example + // + // + // + // + // This is the description for this clip. + // + // + // + TPtrC8 name = element.Name(); + + if ( ! element.Name().CompareF(KEntry) ) + { + AsxStruct* asxItem = new( ELeave ) AsxStruct; + CleanupStack::PushL( asxItem ); + + // init to True + asxItem->seek = ETrue; + + TBool entryHasAttributes = element.HasAttributes(); + if ( entryHasAttributes ) + { + RXmlEngNodeList attributeList; + element.GetAttributes(attributeList); + CleanupClosePushL(attributeList); + + while ( attributeList.HasNext() ) + { + TXmlEngAttr attr = attributeList.Next(); + + if ( ! attr.Name().CompareF(KClientSkip) ) + { + TPtrC8 attrData = attr.Value(); + + if ( ! attrData.CompareF(KNoSkip) ) + { + asxItem->seek = EFalse; + } + } + } + CleanupStack::PopAndDestroy(); //attributeList + } + + while( nodelist2.HasNext() ) + { + element = nodelist2.Next(); + + if ( ! element.IsNull() ) + { + TPtrC8 name = element.Name(); + + if ( ! element.Name().CompareF(KRef) ) + { + TBool hasAttributes = element.HasAttributes(); + + RXmlEngNodeList attributeList; + + element.GetAttributes(attributeList); + + CleanupClosePushL(attributeList); + + while ( attributeList.HasNext() ) + { + TXmlEngAttr attr = attributeList.Next(); + + if ( ! attr.Name().CompareF(KHRef) ) + { + TPtrC8 attrData = attr.Value(); + asxItem->url = attrData.AllocL(); + iAsxArray.Append(asxItem); + } + } + + CleanupStack::PopAndDestroy(); //attributeList + } + } + } + CleanupStack::Pop(); // pop the asxItem + } + } + + CleanupStack::PopAndDestroy(); //nodelist2 + CleanupStack::PopAndDestroy(); //nodelist1 + } + + doc.Close(); + parser.Close(); + DOM_impl.Close(); + + } +} + +// ----------------------------------------------------------------------------- +// CAsxParser::GetUrl +// First URL at position 1 +// ----------------------------------------------------------------------------- +EXPORT_C TInt CAsxParser::GetUrl( const TUint aUrlIndex, TPtrC8& aUrl ) +{ + ASX_DEBUG(_L("#MP# CAsxParser::GetUrl(%d)"), aUrlIndex); + + TInt retVal = KErrNone; + + if ( aUrlIndex - 1 > iAsxArray.Count() || iAsxArray.Count() == 0 ) + { + ASX_DEBUG(_L("#MP# CAsxParser::GetUrl() Bad index")); + retVal = KErrArgument; + } + else + { + aUrl.Set( (iAsxArray[aUrlIndex - 1]->url)->Des() ); + } + + return retVal; +} + +// ----------------------------------------------------------------------------- +// CAsxParser::GetUrl +// First URL at position 1 +// ----------------------------------------------------------------------------- +EXPORT_C AsxStruct* CAsxParser::GetUrl( const TUint aUrlIndex ) +{ + ASX_DEBUG(_L("#MP# CAsxParser::GetUrl(%d)"), aUrlIndex); + + AsxStruct* retVal = NULL; + + if ( aUrlIndex <= iAsxArray.Count() ) + { + retVal = iAsxArray[aUrlIndex - 1]; + } + + return retVal; +} + + +// ----------------------------------------------------------------------------- +// CAsxParser::GetUrlCount +// ----------------------------------------------------------------------------- +EXPORT_C void CAsxParser::GetUrlCount( TUint &aHowManyUrls ) +{ + aHowManyUrls = iAsxArray.Count(); + + ASX_DEBUG(_L("#MP# CAsxParser::GetUrlCount(%d)"), aHowManyUrls); +} + +// ----------------------------------------------------------------------------- +// CAsxParser::IsValid +// ----------------------------------------------------------------------------- +EXPORT_C TInt CAsxParser::FileVersion() +{ + ASX_DEBUG(_L("#MP# CAsxParser::FileVersion(%d)"), iVersion); + + return iVersion; +} + +// ----------------------------------------------------------------------------- +// CAsxParser::HandleFileParsingL +// ----------------------------------------------------------------------------- +// +void CAsxParser::HandleFileParsingL( RFile& aFile ) +{ + iVersion = KErrNotFound; + + TInt size; + User::LeaveIfError( aFile.Size( size ) ); + + if ( size > KMaxAsxFileSize ) + { + ASX_DEBUG(_L("#MP# CAsxParser::HandleFileParsingL() file size > max size")); + User::Leave( KErrNotSupported ); + } + + HBufC8* urlBuf = HBufC8::NewLC( size ); + TPtr8 ptr = urlBuf->Des(); + + // + // Read ASX-file to urlBuf + // + User::LeaveIfError( aFile.Read( ptr ) ); + + // + // V2 file will start with [Reference] + // + _LIT8(KAsxV2Start,"[Reference]"); + TInt location = ptr.FindF( KAsxV2Start ); + + if ( location == 0 ) + { + // + // Found V2 ASX file header + // + ParseAsxV2HeaderL( ptr ); + } + else + { + // + // Did not find V2 ASX file, V3 will start with + This text will show up as a Tooltip and in the Properties dialog box. + Global title of the show + The name of the author + 2004 by Your Company + + + + + + This is the description for this clip. + + + + Markers Discussion + 2004 Microsoft Corporation + + + + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/asxparser/test/AsxFiles/test.asx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/asxparser/test/AsxFiles/test.asx Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +[Reference] +Ref1=http://172.19.59.81:8888/wm/kill_kevin_01_us_s.wmv?MSWMExt=.asf +Ref2=http://172.19.59.81:8888/wm/kill_kevin_01_us_s.wmv?MSWMExt=.asf diff -r 000000000000 -r a2952bb97e68 mmappcomponents/asxparser/test/AsxFiles/test2.asx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/asxparser/test/AsxFiles/test2.asx Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,20 @@ + + This text will show up as a Tooltip and in the Properties dialog box. + Global title of the show + The name of the author + 2004 by Your Company + + + + + + This is the description for this clip. + + + + Markers Discussion + 2004 Microsoft Corporation + + + + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/asxparser/test/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/asxparser/test/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2006 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 build file for BrowserAudioVideoPlugin +* +*/ + +// Version : %version: 4 % + + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +test.mmp // Plugin mmp file + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/asxparser/test/test.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/asxparser/test/test.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2008 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: Simple v2/v3 ASX-fileparser + * +*/ + +// Version : %version: 5 % + + + +#include +#include +#include + +#include +#include +#include + +#include + +void PrintUrl( TPtrC8 aUrl ) +{ + HBufC16* urlBuffer = HBufC16::NewL(100); + TPtr16 url = urlBuffer->Des(); + + CnvUtfConverter::ConvertToUnicodeFromUtf8(url,aUrl); + RDebug::Print(_L("#MP# TestAsx url=%S"),&url); + + delete urlBuffer; +} + + +void DoTest( CConsoleBase* /*aConsole*/ ) +{ + CAsxParser* parser; + + RDebug::Print(_L("#MP# TestAsx Test 1")); + { + _LIT(KFile,"c:\\test.asx"); + parser = CAsxParser::NewL(KFile); + TUint i = 0; + parser->GetUrlCount(i); + __ASSERT_DEBUG(i == 2,1); + TPtrC8 url; + parser->GetUrl(1,url); + PrintUrl(url); + parser->GetUrl(2,url); + PrintUrl(url); + delete parser; + } + + RDebug::Print(_L("#MP# TestAsx Test 2")); + { + _LIT(KFile,"c:\\test2.asx"); + parser = CAsxParser::NewL(KFile); + TUint i = 0; + parser->GetUrlCount(i); + __ASSERT_DEBUG(i == 2,1); + TPtrC8 url; + TPtrC16 url2; + parser->GetUrl(1,url); + PrintUrl(url); + parser->GetUrl(2,url); + PrintUrl(url); + delete parser; + } + + RDebug::Print(_L("#MP# TestAsx Test 3")); + { + _LIT(KFile,"c:\\Corrupttest.asx"); + parser = CAsxParser::NewL(KFile); + TUint i = 0; + parser->GetUrlCount(i); + __ASSERT_DEBUG(i == 0,1); + TPtrC8 url; + TPtrC16 url2; + parser->GetUrl(1,url); + PrintUrl(url); + delete parser; + } + + RDebug::Print(_L("#MP# TestAsx Test 4")); + { + _LIT(KFile,"c:\\Corrupttest2.asx"); + parser = CAsxParser::NewL(KFile); + TUint i = 0; + parser->GetUrlCount(i); + __ASSERT_DEBUG(i == 1,1); + TPtrC8 url; + TPtrC16 url2; + parser->GetUrl(1,url); + PrintUrl(url); + delete parser; + } +} + +void DoExampleL() +{ + CConsoleBase* console; + + // + // Make the console and push it on the cleanup stack. + // + console = Console::NewL(_L("Console"), TSize( KConsFullScreen, KConsFullScreen)); + CleanupStack::PushL(console); + DoTest(console); + CleanupStack::PopAndDestroy(console); +} + +TInt E32Main() +{ + __UHEAP_MARK; + //Create a cleanup stack + CTrapCleanup* cleanup = CTrapCleanup::New(); + //Call some Leaving methods inside TRAP + TRAPD(error, DoExampleL()); + __ASSERT_ALWAYS(!error, User::Panic(_L("Hello"), error)); + //Destroy cleanup stack + delete cleanup; + __UHEAP_MARKEND; + return 0; +} diff -r 000000000000 -r a2952bb97e68 mmappcomponents/asxparser/test/test.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/asxparser/test/test.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2008 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: Makefile for file details dialog. + * +*/ + +// Version : %version: 9 % + + + +#include + +TARGET testasx.exe + +TARGETTYPE exe + +UID 0 + +SOURCEPATH . + +SOURCE Test.cpp + +USERINCLUDE . +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY asxparser.lib + +LIBRARY bafl.lib +LIBRARY efsrv.lib +LIBRARY flogger.lib +LIBRARY charconv.lib diff -r 000000000000 -r a2952bb97e68 mmappcomponents/audiofetcher/data/20021213.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/audiofetcher/data/20021213.rss Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,53 @@ +/* +* 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: Resource definitions for project AudioFetcher +* +*/ + +// INCLUDES +#include "audiofetcher.hrh" +#include +#include + + +// ----------------------------------------------------------------------------- +// theInfo +// Info resource of the ECOM plugin +// ----------------------------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + // use resource format version 2 to enable ROM only plugins + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = KAudioFetcherDllUid; + interfaces = + { + INTERFACE_INFO + { + interface_uid = MEDIAFETCH_ECOM_INTERFACE; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KAudioFetcherImplementationUid; + version_no = 1; + display_name = ""; + default_data = "ffffffff"; + opaque_data = ""; + rom_only = 0; + } + }; + } + }; + } diff -r 000000000000 -r a2952bb97e68 mmappcomponents/audiofetcher/data/audiofetcherdialog.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/audiofetcher/data/audiofetcherdialog.rss Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,241 @@ +/* +* 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: Resource definitions for project AudioFetcher +* +*/ + +// RESOURCE IDENTIFIER +NAME MGFP // 4 letter ID + + +// INCLUDES +#include +#include +#include +#include +#include + +#include "audiofetcher.hrh" +#include + + +// RESOURCE DEFINITIONS +// ----------------------------------------------------------------------------- +// +// Define the resource file signature +// This resource should be empty. +// +// ----------------------------------------------------------------------------- +// +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf="MGFP"; } + +RESOURCE AVKON_VIEW r_audiofetcher_dialog + { + menubar = r_audiofetcher_menubar; + } + +RESOURCE MENU_BAR r_audiofetcher_menubar + { + titles = + { + MENU_TITLE {menu_pane=r_audiofetcher_menu; txt="";} + }; + } + +RESOURCE MENU_PANE r_audiofetcher_menu + { + items= + { + }; + } + +RESOURCE TBUF r_audiofetcher_dialog_title_audio + { + buf = qtn_audiofetcher_select_audio; + } + +RESOURCE TBUF r_audiofetcher_dialog_title_any_file + { + buf = qtn_audiofetcher_select_any_file; + } + +//MultiSelect +/* +RESOURCE MENU_BAR r_multiselect_audiofetcher_menubar + { + titles = + { + MENU_TITLE {menu_pane=r_multiselect_audiofetcher_menu; txt="";} + }; + } + +RESOURCE MENU_PANE r_multiselect_audiofetcher_menu + { + items= + { + MENU_ITEM + { + command=EAknSoftkeySelect; + txt = qtn_cffh_options_select; + }, + + MENU_ITEM + { + command=ECmdSelectMarked; + txt = qtn_cffh_select_marked; + }, + + MENU_ITEM + { + command=ECmdMarkingSubmenu; + txt = qtn_options_list; + cascade = r_multiselect_marking_submenu; + }, + + MENU_ITEM + { + command=EAknCmdHelp; + txt = qtn_options_help; + } + }; + } +*/ +/* +RESOURCE MENU_PANE r_multiselect_marking_submenu + { + items= + { + MENU_ITEM + { + command = EAknCmdMark; + txt = qtn_options_list_mark_one; + }, + MENU_ITEM + { + command = EAknMarkAll; + txt = qtn_options_list_mark_all; + }, + MENU_ITEM + { + command = EAknCmdUnmark; + txt = qtn_options_list_unmark_one; + }, + MENU_ITEM + { + command = EAknUnmarkAll; + txt = qtn_options_list_unmark_all; + } + }; + } + +RESOURCE MENU_BAR r_multiselect_ok_menubar + { + titles= + { + MENU_TITLE { menu_pane=r_multiselect_ok_menu; txt=""; } + }; + } + + +RESOURCE MENU_PANE r_multiselect_ok_menu + { + items= + { + MENU_ITEM + { + command=EAknSoftkeySelect; + txt = qtn_cffh_options_select; + }, + + MENU_ITEM + { + command=ECmdSelectMarked; + txt = qtn_cffh_select_marked; + }, + MENU_ITEM + { + command = ECmdStartMultipleMarking; + txt = qtn_audiofetcher_options_mark_multi; + }, + MENU_ITEM + { + command=ECmdMarkingSubmenu; + txt = qtn_options_list; + cascade = r_multiselect_marking_submenu; + } + }; + } +*/ + +//End of MultiSelect + +//RESOURCE DIALOG r_modal_multi_dialog + //{ + // blocking dialog with CBA and no border please + //flags=EEikDialogFlagNoDrag | EEikDialogFlagFillAppClientRect | + //EEikDialogFlagCbaButtons | EEikDialogFlagWait |EEikDialogFlagNoBackgroundFade |EEikDialogFlagNoBorder; + // softkeys: left options, middle select, right cancel + //buttons = R_AVKON_SOFTKEYS_OK_CANCEL__MARK; + // Do not add any items + //} + +// ----------------------------------------------------------------------------- +// mediafetch plug-in dialog resource. +// ----------------------------------------------------------------------------- +// +RESOURCE DIALOG r_modal_single_dialog + { + flags=EEikDialogFlagWait | EEikDialogFlagFillAppClientRect | EEikDialogFlagNotifyEsc | EEikDialogFlagNoBackup; + buttons = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT; + items= + { + DLG_LINE + { + type=EAknCtSingleGraphicListBox; + itemflags=EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + id=1; + control=LISTBOX + { + flags = EAknListBoxSelectionList; + }; + } + }; + } + + +RESOURCE TBUF r_audiofetcher_empty_list_text_no_audio + { + buf = qtn_audiofetcher_empty_list_no_audio; + } + +RESOURCE TBUF r_audiofetcher_empty_list_text_no_media + { + buf = qtn_audiofetcher_empty_list_no_media; + } + + +// custom CBA resource for options - ok options menu - cancel +/* +RESOURCE CBA r_glx_softkeys_options_cancel_context + { + buttons = + { + CBA_BUTTON { id=EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON { id=EAknSoftkeyCancel; txt = text_softkey_cancel; }, + CBA_BUTTON { id=EAknSoftkeyContextOptions; txt = text_softkey_option; } + }; + } +*/ diff -r 000000000000 -r a2952bb97e68 mmappcomponents/audiofetcher/group/audiofetcher.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/audiofetcher/group/audiofetcher.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -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: Project definition file for project mgfecthplugin +* +*/ + + +#include +#include + +TARGET audiofetcher.dll +TARGETTYPE PLUGIN +UID 0x10009d8d 0x20021213 +#ifndef WINSCW +EPOCALLOWDLLDATA +#endif + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE audiofetcher.cpp +SOURCE audiofetcherproxy.cpp +SOURCE audiofetcherdialog.cpp +SOURCE audiofetcherfilehandler.cpp +SOURCE audiofetcherlisthandler.cpp +SOURCE audiofetcherdialogutils.cpp + +// ECom resource file +START RESOURCE ../data/20021213.rss + TARGET audiofetcher.rsc + TARGETPATH ECOM_RESOURCE_DIR +END + +START RESOURCE ../data/audiofetcherdialog.rss +TARGET audiofetcherdialog.rsc +HEADER +TARGETPATH APP_RESOURCE_DIR +LANGUAGE_IDS +END + +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY aknicon.lib +LIBRARY aknskins.lib +LIBRARY apgrfx.lib // RApaLsSession +LIBRARY apmime.lib // TDataType +LIBRARY avkon.lib +LIBRARY bafl.lib // For BaflUtils +LIBRARY bitgdi.lib +LIBRARY commonengine.lib +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY cone.lib // TParser +LIBRARY efsrv.lib +LIBRARY egul.lib // CGulIcon +LIBRARY eikdlg.lib +LIBRARY eikctl.lib +LIBRARY eikcoctl.lib +LIBRARY eikcore.lib +LIBRARY fbscli.lib +LIBRARY WS32.lib // For Rwindow + +LIBRARY mdccommon.lib // mds +LIBRARY mdeclient.lib // mds +LIBRARY harvesterclient.lib // mds +LIBRARY PlatformEnv.lib // DriveInfo + +COMPRESSTARGET + +// End of File + + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/audiofetcher/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/audiofetcher/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,62 @@ +/* +* 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: Build information file for project audiofetcher.dll +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../rom/audiofetcher.iby CORE_MW_LAYER_IBY_EXPORT_PATH(audiofetcher.iby) +../rom/audiofetcher_resources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(audiofetcher_resources.iby) + +// export localised loc file +../loc/audiofetcher.loc MW_LAYER_LOC_EXPORT_PATH(audiofetcher.loc) + + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv + OPTION TARGETFILE audiofetcher.mif + OPTION HEADERFILE audiofetcher.mbg + OPTION SOURCES \ + -c8,8 qgn_indi_ai_nt_music.svg \ + -c8,8 qgn_prop_mup_audio.svg \ + -c8,8 qgn_prop_fmgr_file_video.svg \ + -c8,8 qgn_prop_fmgr_file_voicerec.svg \ + -c8,8 qgn_prop_mup_artist.svg \ + -c8,8 qgn_prop_mup_album.svg \ + -c8,8 qgn_prop_mup_genre.svg \ + -c8,8 qgn_prop_mup_composer.svg \ + -c8,8 qgn_prop_link_embd_small.svg \ + -c8,8 qgn_prop_folder_small.svg \ + -c8,8 qgn_prop_sml_sync_off.svg \ + -c8,8 qgn_indi_fmgr_ms_add.svg \ + -c8,8 qgn_indi_mmc_add.svg \ + -c8,8 qgn_prop_mce_unknown_read \ + -c8,8 qgn_prop_fmgr_file_image.svg +END + +PRJ_MMPFILES + +audiofetcher.mmp + +// End of File + + + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/audiofetcher/inc/audiofetcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/audiofetcher/inc/audiofetcher.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,190 @@ +/* +* 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: Media Fetch plug-in for audio files +* +*/ + +#ifndef AUDIOFETCHER_H +#define AUDIOFETCHER_H + + +// INCLUDES +#include +#include +#include +#include // MMGFetchCanceler + + +// CLASS DECLARATION + +/** + * Media Fetch plug-in for audio files + * + * Implements the Media Fetch Implementation API + * + * @lib AudioFetcher.lib + * @since S60 5.0 + */ +NONSHARABLE_CLASS( CAudioFetcher ) : public CMediaFetchImplementation, + public MMGFetchCanceler + + { + + public: //constructor and desctructor + + /** + * Two-phased constructor. + * + * @since 5.0 + * @return Pointer to newly created object. + */ + static CAudioFetcher* NewL(); + + /** + * Destructor. + */ + virtual ~CAudioFetcher(); + + protected: // from CMediaFetchImplementation + + /** + * By default fetcher is single selection fetcher. + * If multi-selection is enabled then plug-in should display a + * multi-selection fetcher and allow user to select several items. + * @param aMultiSelect if ETrue then multiselection fetcher is enabled + */ + void SetMultiSelectionL( TBool aMultiSelect ); + + /** + * Not in requirement + * @param aMimeTypes plug-in should show only files with given Mime types + */ + void SetMimeTypesL( const MDesCArray& aMimeTypes ); + + /** + * Plug-in should use given text as selection key (SK1) label + * @param aSelectionSoftkey Custom selection softkey label + */ + void SetSelectionSoftkeyL( const TDesC& aSelectionSoftkey ); + + /** + * Plug-in should use given text as heading + * @param aTitle Custom title text for fetcher + */ + void SetHeadingL( const TDesC& aTitle ); + + /** + * Plug-in should call this interface before selection is done. + * if MMGFetchVerifier::VerifySelectionL() returns ETrue + * then the user's selection should be accepted and the fetcher + * closed. If EFalse is returned then user should change the current + * selection before it can be accepted and the fetcher closed. + * @param aVerifier See MMGFetchVerifier.h + */ + void SetVerifierL( MMGFetchVerifier& aVerifier ); + + /** + * Plug-in should return canceler interface. + * @param aCanceler See MMGFetchCanceler.h + */ + void GetCancelerL( MMGFetchCanceler*& aCanceler ); + + /** + * Plug-in should launch fetcher popup for given media type. + * @param aSelectedFiles plug-in appends selected files to this array + * @param aMediaType plug-in should display only files with this media type + * return ETrue if user selected file(s), EFalse if use cancelled. + */ + TBool LaunchL( CDesCArray& aSelectedFiles, TMediaFileType aMediaType ); + + + private : // Constructor and desctructor + + /** + * C++ default constructor. + */ + CAudioFetcher(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // New Functions + + /** + * Gets the resource filename + */ + void GetResourceFilenameL( TFileName& aResFile ); + + /** + * @return view title when fetcher is opened for selecting audio + */ + HBufC* TitleForAudioFetcherL() const; + + /** + * @return view title when fetcher is opened for selecting any media files + */ + HBufC* TitleForAnyMediaFileFetcherL() const; + + /** + * @param aSingleSelectionTitleResourceId Resource id for view title when + * single selection is active + * @param aMultiSelectionTitleResourceId Resource id for view title when + * multiselection is active + * @return view title depending whether fetcher is in multiselection or + * single selection mode, and whether client has defined the title + */ + HBufC* TitleL( TInt aSingleSelectionTitleResourceId ) const; + + + private: // From MMGFetchCanceler + + /** + * @see MMGFetchCanceler + */ + void CancelFetcherL(); + + private: // Data + + // Resource offset + TInt iResourceOffset; + + // media type + TMediaFileType iMediaType; + + TBool iIsMultiSelection; + + /** + * Left softkey label + * Own. + */ + HBufC* iSelectionSoftkey; + + /** + * Popup heading text + * Own. + */ + HBufC* iTitle; + + /** + * Verifier + */ + MMGFetchVerifier* iVerifier; + }; + +#endif // AUDIOFETCHER_H + +// End of File + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/audiofetcher/inc/audiofetcher.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/audiofetcher/inc/audiofetcher.hrh Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,62 @@ +/* +* 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: Resource headers +* +*/ + +#ifndef AUDIOFETCHER_HRH +#define AUDIOFETCHER_HRH + +// CONSTANTS + +#define KAudioFetcherDllUid 0x20021213 //dll uid +#define KAudioFetcherImplementationUid 0x20021214 //implementation uid + +enum TAudioFetcherControlId + { + EFetcherControl = 2300// any arbitary value + }; + + +enum TTAudioFetcherCommandId + { + ECmdSelectMarked, + ECmdMarkingSubmenu, + ECmdStartMultipleMarking, + ECmdEndMultipleMarking + }; + +enum TListIcons + { + EEIconMusic = 0, + EEIconTone = 1, + EEIconVideo = 2, + EEIconRecording = 3, + EEIconArtist = 4, + EEIconAlbum = 5, + EEIconGenre = 6, + EEIconComposer = 7, + EEIconFolder = 8, + EEIconUnknown = 9, + EEIconFolderDownload = 10, + EEIconNullItemOff = 11, + EEIconMemoryCard = 12, + EEIconMassStorage = 13, + EEIconEmpty = 14, + EEIconImage + }; + +#endif // AUDIOFETCHER_HRH + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/audiofetcher/inc/audiofetcherdialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/audiofetcher/inc/audiofetcherdialog.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,249 @@ +/* +* 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 AUDIOFETCHERDIALOG_H +#define AUDIOFETCHERDIALOG_H + +// INCLUDES +#include +#include +#include +#include +#include +#include + +#include "audiofetcherlisthandler.h" +#include "audiofetcherfilehandler.h" +#include "audiofetcherdialogutils.h" + +// FORWARD DECLARATIONS +class MMGFetchVerifier; +class CAknInputBlock; + +/** +* CAudioFetcherDialog +* +* CAudioFetcherDialog provides UI for selecting audio files. +*/ +NONSHARABLE_CLASS ( CAudioFetcherDialog ) : public CAknDialog, + public MEikListBoxObserver,/* + public MCoeForegroundObserver,*/ + public MEikCommandObserver, + public MAudioFetcherListHandlerObserver, + public MAudioFetcherFileHandlerObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @param reference to an array where the selected files are set + * @param selection verifier interface + * @param the title for the dialog + */ + static CAudioFetcherDialog* NewL( + CDesCArray& aSelectedFiles, + MMGFetchVerifier* aVerifier, + const TDesC& aTitle, + TBool aMultiSelectionEnabled, + TMediaFileType aMediaType ); + + /** + * Destructor. + */ + virtual ~CAudioFetcherDialog(); + + private: // Constructors + + /** + * Symbian 2nd phase constructor + */ + void ConstructL(); + + /** + * C++ default constructor. + */ + CAudioFetcherDialog( + CDesCArray& aSelectedFiles, MMGFetchVerifier* aVerifier, const TDesC& aTitle, + TBool aMultiSelectionEnabled, TMediaFileType aMediaType); + + private: + + /** + * @ref CCoeControl::SizeChanged + */ + void SizeChanged(); + + /** + * From the base class. + * Handles menu events. + * @param aCommandId Command id. + * @return None. + */ + void ProcessCommandL( TInt aCommandId ); + + //void HandleGainingForeground() {}; + //void HandleLosingForeground(){}; + + /** + * From MEikListBoxObserver, called by framework. + * @param aListBox. + * @param aEventType. + * @return None + */ + void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ); + + /** + * Initializes the dialog's controls before the dialog is sized and + * layed out. + */ + void PreLayoutDynInitL(); + + /** + * Initializes the dialog's controls after the dialog has been sized + * but before it has been activated. + */ + void PostLayoutDynInitL(); + + TInt CurrentItemListIndex(); + + void GetListItemText( TInt aListboxIndex, TDes& aText ); + + void SetIconsL(); + + void SetIconFileNameL( const TDesC& aName, TDes& aFullName ); + + TInt StorageTypeIcon( TInt aListboxIndex ); + + TInt MediaTypeIcon( TInt aListboxIndex ); + + CGulIcon* IconL(TAknsItemID aId, const TDesC& aFileName, + TInt aFileIndex, TInt aFileMaskIndex); + + void UpdateListBoxL(); + + /** + * From the base class. + * Called by framework before exiting the dialog. + * @param aButtonId Button id. + * @return ETrue to exit\ EFalse to not to exit. + */ + TBool OkToExitL( TInt aButtonId ); + + /** + * From the base class. + * Called by framework when dialog is activated. + * @param None. + * @return None. + */ + void ActivateL(); + + /** + * From the base class. + * Called by framework before menu is shown. + * @param aResourceId Menu resource id. + * @param aMenuPane Pointer to the menu. + * @return None. + */ + void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane) ; + + /** + * From the base class. + * Called by framework for key event handling. + * @param aKeyEvent. + * @param aType. + * @return Return code. + */ + TKeyResponse OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/); + + /** + * From base class. + * Called when UI layout changes. + * @param aType. + * @return None. + */ + void HandleResourceChange( TInt aType ); + + virtual CCoeControl* ComponentControl( TInt aIndex ) const; + virtual TInt CountComponentControls() const; + + private: // from MAudioFetcherFileHandlerObserver + + void HandleFileEventL( TInt aEvent, TInt aError ); + + TPtrC ConstructListboxItem( TInt aListboxIndex ); + TInt ListboxItemCount(); + + private: + + /** + * Query audio files from MdS + */ + void QueryL(); + TBool HandleListSelectionL(); + static TInt CloseDialog( TAny *aObj ); + void CloseDialogWithDelayL(); + + private: + + // listbox + CAknSingleGraphicStyleListBox* iListBox; + + // long buffers for listbox items + TBuf<128> iListboxItemText1; + TBuf<256> iListboxItemText2; + + // long buffers for icon file names + TFileName iIconFileName; + + // for title and icon handling + CStatusPaneHandler* iStatusPaneHandler; + TBuf<128> iDialogTitle; + + // metadata engine wrapper + CAudioFetcherFileHandler* iFileHandler; + + CAudioFetcherListHandler* iListHandler; + + // Selected items array + // Not Own. Owned by the client + CDesCArray& iSelectedFiles; + + MMGFetchVerifier* iVerifier; + + // is metadata databse open + TBool iDatabaseOpen; + + /// Ref: the title + const TDesC& iTitle; + + HBufC* iEmptyListText; + + // Holds the status pane layout resource ID + TInt iCurrentLayoutResId; + TBool iMultiSelectionEnabled; + + // for closing dialog + CIdle* iIdle; + CAknInputBlock* iInputBlock; + + TMediaFileType iMediaType; + }; + +#endif // AUDIOFETCHERDIALOG_H + +// End of File + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/audiofetcher/inc/audiofetcherdialogutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/audiofetcher/inc/audiofetcherdialogutils.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,303 @@ +/* +* 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: Utils class for Media Fetch plug-in +* +*/ + + +#ifndef AUDIOFETCHERDIALOGUTILS_H +#define AUDIOFETCHERDIALOGUTILS_H + + +// INCLUDES + +#include +#include // RReadStream RWriteStream +#include // RFs + +#include // CEikStatusPane +#include // CAknNavigationControlContainer +#include // CEikImage + + + +// CONSTANTS + +const TInt KBufSize64 = 64; +const TInt KBufSize128 = 128; +const TInt KBufSize256 = 256; +const TInt KBufSize512 = 512; + + +// FORWARD DECLARATIONS + +class CAknAppUi; +class CRepository; + +/** +* MMFActiveCallerObserver +* +* MMFActiveCallerObserver is for observing CActiveCaller. +*/ +NONSHARABLE_CLASS (MActiveCallerObserver) + { + public: + virtual void HandleActiveCallL( TInt aCallId ) = 0; + }; + + + + +/** +* CActiveCaller +* +* CActiveCaller is used for generating a call from active scheduler. +* Typical use is to start some operation after a short delay. +*/ +NONSHARABLE_CLASS (CActiveCaller) : public CActive + { + public: + static CActiveCaller* NewL( MActiveCallerObserver* aObserver ); + virtual ~CActiveCaller(); + + private: + CActiveCaller( MActiveCallerObserver* aObserver ); + void ConstructL(); + + public: + void Start( TInt aCallId, TInt aMilliseconds ); + void Stop(); + void Request(); + + private: + void RunL(); + void DoCancel(); + + private: + // call that is passed to observer + TInt iCallId; + + // timer + RTimer iTimer; + + // observer that gets called + MActiveCallerObserver* iObserver; + }; + + + +/** +* CNaviPaneHandler +* +* This class is used for changing navipane title. +*/ +NONSHARABLE_CLASS (CNaviPaneHandler) : public CBase + { + public: + /** + * Destructor. + */ + virtual ~CNaviPaneHandler(); + + /** + * C++ default constructor. + */ + CNaviPaneHandler(CEikStatusPane* aStatusPane); + + public: + + /** + * Sets navi pane title. + * @param aTitle. + * @return None. + */ + void SetNaviPaneTitleL(const TDesC& aTitle); + + /** + * Store navi pane. + * @param None. + * @return None. + */ + void StoreNavipaneL(); + + private: + // status pane + CEikStatusPane* iStatusPane; + + // navi Pane + CAknNavigationControlContainer* iNaviPane; + + // navi decorator + CAknNavigationDecorator* iNaviDecorator; + + // has Navidecorator been pushed into navi pane + TBool iNavidecoratorPushed; + + // has navi pane been pushed into navigation pane's object stack + TBool iNavipanePushed; + }; + + + +/** +* CStatusPaneHandler +* +* This class is used for changing dialog title and image. +*/ +NONSHARABLE_CLASS (CStatusPaneHandler) : public CBase + { + public: + /** + * Two-phased constructor. + */ + static CStatusPaneHandler* NewL( CAknAppUi* aAppUi ); + + /** + * Destructor. + */ + virtual ~CStatusPaneHandler(); + + private: + /** + * By default Symbian OS constructor is private. + */ + void ConstructL(); + + /** + * C++ default constructor. + */ + CStatusPaneHandler( CAknAppUi* aAppUi ); + + public: + /** + * Stores original title so it can be restored when dialog closes. + * @param None. + * @return None. + */ + void StoreOriginalTitleL(); + + /** + * Restores original title. + * @param None. + * @return None. + */ + void RestoreOriginalTitleL(); + + /** + * Sets dialog title. + * @param aText. + * @return None. + */ + void SetTitleL( const TDesC& aText ); + + /** + * Sets dialog title. + * @param aResourceId. + * @return None. + */ + void SetTitleL( TInt aResourceId ); + + public: + /** + * Sets dialog title. + * @param aAppUi. + * @param aText. + * @return Return code. + */ + static TBool SetTitleL( CAknAppUi* aAppUi, const TDesC& aText ); + + /** + * Gets dialog title. + * @param aAppUi. + * @param aText. + * @return Return code. + */ + static TBool GetTitleL( CAknAppUi* aAppUi, TDes& aText ); + + /** + * Sets navi pane title. + * @param aTitle. + * @return None. + */ + void SetNaviPaneTitleL( const TDesC& aTitle ); + + /** + * Sets navi pane title. + * @param aTitle. + * @return None. + */ + void SetNaviPaneTitle( const TDesC& aTitle ); + + /** + * Sets navi pane title. + * @param aTitle. + * @return None. + */ + void SetNaviPaneTitleL( TInt aResource ); + + /** + * Store navi pane. + * @param None. + * @return None. + */ + void StoreNavipaneL(); + + static void StrCopy( TDes& aTarget, const TDesC& aSource ); + + private: + // access to app ui + CAknAppUi* iAppUi; + + // original status pane title + TBuf iOriginalTitle; + + // is original status pane title stored + TBool iOriginalTitleStored; + + // original context pane image + CEikImage* iOriginalImage; + + CNaviPaneHandler* iNaviPaneHandler; + }; + + + + +/** +* CDriveUtil +* +* CDriveUtil is used for getting drive information. +*/ +NONSHARABLE_CLASS (CDriveUtil) : public CBase + { + public: + static CDriveUtil* NewL(); + virtual ~CDriveUtil(); + + private: + CDriveUtil(); + void ConstructL(); + + public: + TBool IsMemoryCard( const TDesC& aFullPath ); + TBool IsMassStorage( const TDesC& aFullPath ); + TBool IsRom( const TDesC& aFullPath ); + + private: + RFs iFsSession; + }; + +#endif // AUDIOFETCHERDIALOGUTILS_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/audiofetcher/inc/audiofetcherfilehandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/audiofetcher/inc/audiofetcherfilehandler.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,352 @@ +/* +* 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: File handlder for Media Fetch plug-in +* +*/ + +#ifndef AUDIOFETCHERFILEHANDLER_H +#define AUDIOFETCHERFILEHANDLER_H + + +// INCLUDES + +#include "audiofetcherdialogutils.h" + + +#include +#include +#include +#include +#include +#include +#include +#include + + +// FORWARD DECLARATIONS +class CSearchList; + +// CONSTANTS + +_LIT( KMimeTypeAMR, "audio/amr" ); +_LIT( KMimeTypeWAV, "audio/wav" ); +_LIT( KMimeMp3, "mp3" ); +_LIT( KDriveZ, "z:\\" ); +_LIT( KSpace, " " ); + +/** +* MMediaFileHandlerObserver +* +* For observing CMediaFileHandler events. +*/ +NONSHARABLE_CLASS (MAudioFetcherFileHandlerObserver) + { + public: + enum TFileHandlerEvent + { + EInitComplete, + EQueryComplete, + EQueryCanceled, + EUnknownQueryComplete, + EMediaFileChanged, + EError + }; + + public: + virtual void HandleFileEventL( TInt aEvent, TInt aError ) = 0; + }; + + + +/** +* CAudioFetcherFileHandler +* +* Used for making media file queries. For example get all songs for +* one artist. Uses metadata engine. +*/ +NONSHARABLE_CLASS (CAudioFetcherFileHandler) : public CBase, + public MMdESessionObserver, + public MMdEQueryObserver, + public MMdEObjectObserver, + public MMdEObjectPresentObserver, + public MActiveCallerObserver + { + public: + enum TMediaType + { + EMediaTypeTone = 0, + EMediaTypeVideo, + EMediaTypeRecording, + EMediaTypeMusic, + EMediaTypeImage, + EMediaTypeAny, + }; + + enum TStorageType + { + EPhoneMemory = 0, + EMassStorage, + EMemoryCard + }; + + enum TQueryAttribute + { + EAttrMediaType = 20, // integer + EAttrFileSize, // integer + EAttrStorageType, // integer + EAttrMediaFileId, // integer + EAttrFileName, // string + EAttrFullName, // string + EAttrSongName, // string + EAttrArtist, // string + EAttrAlbum, // string + EAttrGenre, // string + EAttrComposer // string + }; + + enum TQueryType + { + EQueryNone = 0, + EQueryAudio, + EQueryMusic, + EQueryVideo, + EQueryRecording, + EQueryTone, + EQueryRomFile, + EQueryImage, + ESearchAudio, + ESearchVideo, + ESearchMusic, + ESearchTones, + EQueryEmpty, + EQueryUnknown, + + EQueryArtist, + EQueryArtistAlbum, + EQueryArtistAll, + EQueryArtistUnknown, + EQueryArtistEmpty, + }; + + public: + static CAudioFetcherFileHandler* NewL(); + virtual ~CAudioFetcherFileHandler(); + + private: + CAudioFetcherFileHandler(); + void ConstructL(); + + public: + void QueryAudioL(); + void QueryImageL(); + void QueryVideoL(); + TInt QueryType(); + + + public: + TInt ResultCount(); + TBool QueryReady(); + TInt Attribute( TInt aIndex, TInt aAttr, TInt aQueryId ); + void GetAttributeL( TInt aIndex, TInt aAttr, TDes& aValue, TInt aQueryId ); + void GetAttribute( TInt aIndex, TInt aAttr, TDes& aValue, TInt aQueryId ); + void CancelQuery(); + + public: + void SetObserver( MAudioFetcherFileHandlerObserver* aObserver ); + void SetQueryId( TInt aId ); + void EnableObserverCall( TBool aEnable ); + + public: + TInt RomFileAttribute( TInt aIndex, TInt aAttr ); + void GetRomFileAttribute( TInt aIndex, TInt aAttr, TDes& aValue ); + + private: + CMdEPropertyDef& PropertyDefL( TInt aAttr ); + void StrCopy( TDes& aTarget, const TDesC& aSource ); + void CheckAttrL( TInt aAttr ); + void CallObserverWithDelay(); + void CallObserver( TInt aEvent, TInt aError ); + void AddObjectObserverL(); + + public: + static CMdEPropertyDef& PropertyDefL( CMdESession* aSession, TInt aAttr ); + + private: + + void ExcludeRomFilesL( CMdELogicCondition& aCondition ); + + private: + void LeaveIfSessionClosedL(); + void Panic( TInt aReason ); + TInt MediaType( TInt aQueryType ); + + private: // from MMdESessionObserver + void HandleSessionOpened(CMdESession& aSession, TInt aError); + void HandleSessionError(CMdESession& aSession, TInt aError); + + + private: // from MMdEQueryObserver (mdequery.h) + void HandleQueryNewResults( CMdEQuery& aQuery, TInt aFirstNewItemIndex, + TInt aNewItemCount ); + void HandleQueryCompleted( CMdEQuery& aQuery, TInt aError ); + void HandleQueryCompletedL( CMdEQuery& aQuery, TInt aError ); + + private: // from MMdEObjectObserver + void HandleObjectNotification( CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aObjectIdArray); + + private: // from MMdEObjectPresentObserver + void HandleObjectPresentNotification( CMdESession& aSession, + TBool aPresent, const RArray& aObjectIdArray); + + private: // from MActiveCallerObserver + void HandleActiveCallL( TInt aCallId ); + + private: + + // media file event observer + MAudioFetcherFileHandlerObserver* iObserver; + + // session to metadata engine + CMdESession* iSession; + + // metadata query + CMdEObjectQuery* iQuery; + + // search result list - ui shows items from this list + CSearchList* iSearchList; + + // metadata search text + TBuf<128> iSearchText; + + // for generating active object calls + CActiveCaller* iQueryCaller; + // for generating active object calls + CActiveCaller* iObjectNotificationCaller; + + // for finding out file drive type + CDriveUtil* iDriveUtil; + + // used to prevent observer call when query is canceled fro ui + TBool iObserverCallEnabled; + + // query id from UI, not used in this class + TInt iQueryId; + + // max audio file file size + TInt iMaxFileSize; + + // is metadata session open + TBool iSessionOpen; + + // query type + TInt iQueryType; + + // query error + TInt iQueryError; + + // query event + TInt iQueryEvent; + + }; + + + + +/** +* CSearchListItem +* +* Data for one media file item CSearchList. +*/ +NONSHARABLE_CLASS (CSearchListItem) : public CBase + { + public: + static CSearchListItem* NewLC(); + virtual ~CSearchListItem(); + + private: + CSearchListItem(); + void ConstructL(); + + public: + void SetTitleL( const TDesC& aText, TBool aFullName ); + const TDesC& Title() const; + + public: + TInt iId; + TInt iMediaType; + TInt iStorageType; + private: + HBufC* iTitle; + }; + + +/** +* CSearchList +* +* List for storing search result for one (most recent) metadata query. +*/ +NONSHARABLE_CLASS (CSearchList) : public CBase + { + public: + static CSearchList* NewL(); + virtual ~CSearchList(); + + private: + CSearchList(); + void ConstructL(); + + public: + void SetSession( CMdESession* aSession ); + void TakeResultL( CMdEObjectQuery* aQuery, TInt aMediaType ); + //void TakeArtistResultL( CArtistQuery* aArtistQuery ); + void TakeDistinctResultL( CMdEObjectQuery* aQuery, TInt aMediaType ); + + void AddAlbumItemL( const TDesC& aAlbum ); + void AddItemL( CMdEObject& aObject, TInt aMediaType ); + void AddArtistItemL( CMdEObject& aObject, TInt aQueryType, const TDesC& aAlbum ); + + void Reset(); + void Sort(); + TInt Count(); + void GetAttributeL( TInt aIndex, TInt aAttr, TDes& aValue ); + TInt Attribute( TInt aIndex, TInt aAttr ); + void SetSearchId( TInt aId ); + TInt SearchId(); + + private: + static TInt Compare( const CSearchListItem& aFirst, + const CSearchListItem& aSecond ); + + static void StrCopy( TDes& aTarget, const TDesC& aSource ); + void Panic( TInt aReason ); + const TDesC& TextL( CMdEObject& aObject, TInt aId ); + + private: + CMdESession* iSession; // does not own + + // list of search results + RPointerArray iList; + + // for finding out drive type (eg memory card) + CDriveUtil* iDriveUtil; + + // search id - not used in this class + TInt iSearchId; + }; + +#endif // AUDIOFETCHERFILEHANDLER_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/audiofetcher/inc/audiofetcherlisthandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/audiofetcher/inc/audiofetcherlisthandler.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,66 @@ +/* +* 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: Media Fetch plug-in list handler +* +*/ + +// INCLUDES +#include +#include + +/** +* MAudioFetcherListHandlerObserver +* +* CAudioFetcherListHandler uses MAudioFetcherListHandlerObserver to get listbox item texts. +*/ +class MAudioFetcherListHandlerObserver + { + public: + virtual TPtrC ConstructListboxItem( TInt aListIndex ) = 0; + virtual TInt ListboxItemCount() = 0; + }; + +/** +* CMFListHandler +* +* This class is used as listbox model's item array. Listbox uses it to draw +* list items. CAudioFetcherListHandler gets list item texts from CAudioFetcherFileHandler +* (metadata query result). This way there is no need to copy all list items +* into listbox model. +*/ +class CAudioFetcherListHandler : public CBase, public MDesCArray + { + public: + static CAudioFetcherListHandler* NewL(); + virtual ~CAudioFetcherListHandler(); + + private: + + void ConstructL(); + CAudioFetcherListHandler(); + + public: // from MDesCArray + + TInt MdcaCount() const; + TPtrC16 MdcaPoint(TInt aIndex) const; + + public: + + void SetObserver( MAudioFetcherListHandlerObserver* aObserver ); + static void Panic( TInt aReason ); + + private: + + MAudioFetcherListHandlerObserver* iObserver; // does not own + }; diff -r 000000000000 -r a2952bb97e68 mmappcomponents/audiofetcher/inc/audiofetcherlog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/audiofetcher/inc/audiofetcherlog.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,59 @@ +/* +* 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: Log commands +* +*/ + + +#ifndef FETCHLOG_H +#define FETCHLOG_H + +// INCLUDES +#include +#include + +#ifdef _DEBUG + +#define WLOG(a) RDebug::Print(_L(a)) +#define WLOG1(a,b) RDebug::Print(_L(a),(b)) +#define WLOG2(a,b,c) RDebug::Print(_L(a),(b),(c)) +#define WLOG3(a,b,c,d) RDebug::Print(_L(a),(b),(c),(d)) + +#define HLOG(a) RDebug::Print((a)) +#define HLOG1(a, b) RDebug::Print((a), (b)) +#define HLOG2(a, b, c) RDebug::Print((a), (b), (c)) +#define HLOG3(a, b, c, d) RDebug::Print((a), (b), (c), (d)) +#define HLOG4(a, b, c, d, e) RDebug::Print((a), (b), (c), (d), (e)) +#define HLOG5(a, b, c, d, e, f) RDebug::Print((a), (b), (c), (d), (e), (f)) + +#else + +#define WLOG(a) +#define WLOG1(a,b) +#define WLOG2(a,b,c) +#define WLOG3(a,b,c,d) + +#define HLOG(a) +#define HLOG1(a, b) +#define HLOG2(a, b, c) +#define HLOG3(a, b, c, d) +#define HLOG4(a, b, c, d, e) +#define HLOG5(a, b, c, d, e, f) + +#endif + +#endif // FETCHLOG_H + +// End of File + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/audiofetcher/inc/audiofetchertitleobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/audiofetcher/inc/audiofetchertitleobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,32 @@ +/* +* 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: +* +*/ + +/** + * MAudioFetcherTitleObserver + * + * List event notification interface + */ +class MAudioFetcherTitleObserver + { +public: + /** + * Called when title need to be updated. + */ + virtual void UpdateTitleL() = 0; + }; + +// End oF File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/audiofetcher/loc/audiofetcher.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/audiofetcher/loc/audiofetcher.loc Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,36 @@ +/* +* 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: Localization strings for Media Fetch plug-in +* +*/ + +// LOCALISATION STRINGS + +// d:The default title for popup from which user can select one audio file +// l:title_pane_t2/opt12 +#define qtn_audiofetcher_select_audio "Select file:" + +// d:The default title for popup from which user can select any media file +// l:title_pane_t2/opt12 +#define qtn_audiofetcher_select_any_file "Select file:" + +// audio fetcher +// d:If there are no items to show in the audio fetcher view, this text is displayed. +// l:main_list_empty_pane +// +#define qtn_audiofetcher_empty_list_no_audio "No audio files to display" + +#define qtn_audiofetcher_empty_list_no_media "No media files to display" + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/audiofetcher/rom/audiofetcher.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/audiofetcher/rom/audiofetcher.iby Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,28 @@ +/* +* 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: AudioFetcher iby file. +* +*/ + +#ifndef AUDIOFETCHER_IBY +#define AUDIOFETCHER_IBY + + +ECOM_PLUGIN( audiofetcher.dll, audiofetcher.rsc ) + +data=DATAZ_\BITMAP_DIR\audiofetcher.mif BITMAP_DIR\audiofetcher.mif + +#endif // AUDIOFETCHER_IBY + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/audiofetcher/rom/audiofetcher_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/audiofetcher/rom/audiofetcher_resources.iby Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,25 @@ +/* +* 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 AUDIOFETCHER_RESOURSES_IBY +#define AUDIOFETCHER_RESOURSES_IBY + +data=DATAZ_\APP_RESOURCE_DIR\audiofetcherdialog.rsc APP_RESOURCE_DIR\audiofetcherdialog.rsc + +#endif // AUDIOFETCHER_RESOURSES_IBY + +// End of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/audiofetcher/src/audiofetcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/audiofetcher/src/audiofetcher.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,292 @@ +/* +* 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: provide synchronized access to file system and metadata source +* +*/ + +// INCLUDE FILES +#include // CAknViewAppUi +#include +#include // KDC_APP_RESOURCE_DIR +#include // CEikApplication +#include +#include +#include +#include +#include + +#include "audiofetcher.hrh" // For implementation id +#include "audiofetcher.h" +#include "audiofetcherlog.h" +#include "audiofetcherdialog.h" +#include + +_LIT(KAudioFetcherDialogResource, "AudioFetcherdialog.rsc" ); // AudioFetcherDialog Resource File + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CAudioFetcher* CAudioFetcher::NewL() + { + WLOG("CAudioFetcher::NewL"); + CAudioFetcher* self = new( ELeave ) CAudioFetcher(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CAudioFetcher::ConstructL() + { + WLOG("CAudioFetcher::ConstructL"); + // No implementation required + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that might leave. +// --------------------------------------------------------------------------- +// +CAudioFetcher::CAudioFetcher() + { + WLOG("CAudioFetcher::CAudioFetcher"); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CAudioFetcher::~CAudioFetcher() + { + WLOG("CAudioFetcher::~CAudioFetcher >"); + + + if ( iResourceOffset ) + { + CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); + } + + delete iSelectionSoftkey; + delete iTitle; + + WLOG("CAudioFetcher::~CAudioFetcher <"); + } + +// --------------------------------------------------------------------------- +// SetMultiSelectionL +// --------------------------------------------------------------------------- +// +void CAudioFetcher::SetMultiSelectionL( TBool aMultiSelect ) + { + WLOG("CAudioFetcher::SetMultiSelectionL"); + iIsMultiSelection = aMultiSelect; + } + +// --------------------------------------------------------------------------- +// SetMimeTypesL +// --------------------------------------------------------------------------- +// +void CAudioFetcher::SetMimeTypesL( const MDesCArray& /*aMimeTypes*/ ) + { + WLOG("CAudioFetcher::SetMimeTypesL (not supported)"); + // No implementation required (not supported) + } + +// --------------------------------------------------------------------------- +// SetSelectionSoftkeyL +// --------------------------------------------------------------------------- +// +void CAudioFetcher::SetSelectionSoftkeyL( const TDesC& aSelectionSoftkey ) + { + WLOG("CAudioFetcher::SetSelectionSoftkeyL"); + + HBufC* tmp = aSelectionSoftkey.AllocL(); + delete iSelectionSoftkey; + iSelectionSoftkey = tmp; + } + +// --------------------------------------------------------------------------- +// SetHeadingL +// --------------------------------------------------------------------------- +// +void CAudioFetcher::SetHeadingL( const TDesC& aTitle ) + { + WLOG("CAudioFetcher::SetHeadingL"); + + HBufC* tmp = aTitle.AllocL(); + delete iTitle; + iTitle = tmp; + } + +// --------------------------------------------------------------------------- +// SetVerifierL +// --------------------------------------------------------------------------- +// +void CAudioFetcher::SetVerifierL( MMGFetchVerifier& aVerifier ) + { + WLOG("CAudioFetcher::SetVerifierL"); + + iVerifier = &aVerifier; + } + +// --------------------------------------------------------------------------- +// GetCancelerL +// --------------------------------------------------------------------------- +// +void CAudioFetcher::GetCancelerL( MMGFetchCanceler*& aCanceler ) + { + WLOG("CAudioFetcher::GetCancelerL"); + + aCanceler = this; + } + + +// --------------------------------------------------------------------------- +// LaunchL +// --------------------------------------------------------------------------- +// +TBool CAudioFetcher::LaunchL( CDesCArray& aSelectedFiles, + TMediaFileType aMediaType ) + { + WLOG("CAudioFetcher::LaunchL >"); + + TInt buttonId; + TFileName resFile; + TParse parse; + parse.Set( KAudioFetcherDialogResource, &KDC_APP_RESOURCE_DIR, NULL ); + + resFile.Append(parse.FullName()); + GetResourceFilenameL( resFile ); + iResourceOffset = CCoeEnv::Static()->AddResourceFileL( resFile ); + + // Configure heading and filter type + switch ( aMediaType ) + { + case EAudioFile: + case EMusicFile: + { + iTitle = TitleForAudioFetcherL(); + break; + } + case EAnyMediaFile: + { + iTitle = TitleForAnyMediaFileFetcherL(); + break; + } + default: + { + WLOG("CAudioFetcher::LaunchL - Error: Unsupported media type, Leaving"); + User::Leave( KErrNotSupported ); + } + } + + // create the dialog first + CAudioFetcherDialog* dialog = + CAudioFetcherDialog::NewL( aSelectedFiles, iVerifier, *iTitle, iIsMultiSelection, aMediaType ); + + // Returns zero when Fetcher is cancelled by User. + buttonId = dialog->ExecuteLD( R_MODAL_SINGLE_DIALOG ); + + dialog = NULL; + WLOG("CAudioFetcher::LaunchL <"); + // Return false if the fetcher was canceled by user + return ( 0 != buttonId && aSelectedFiles.Count() != 0 ); + } + +// --------------------------------------------------------------------------- +// Return nearest resource file +// --------------------------------------------------------------------------- +// +void CAudioFetcher::GetResourceFilenameL( TFileName& aResFile ) + { + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + + // don't use AknUtils CompleteWithAppPath + aResFile.Insert( 0, TDriveUnit( EDriveC).Name() ); + // try to locate the localised resource + BaflUtils::NearestLanguageFile( fs, aResFile ); + // if the localised resource is found, the file name is changed to + // the localised name (z:\apps\resources\xxx.r001) + if( !BaflUtils::FileExists( fs, aResFile ) ) + { + // not found on c drive, try z + aResFile.Replace( 0, KMaxDriveName, TDriveUnit( EDriveZ ).Name() ); + // try to locate the localised resource again + BaflUtils::NearestLanguageFile( fs, aResFile ); + // if file was not found this time, there is no localised + // resource with the name + if (!BaflUtils::FileExists( fs, aResFile ) ) + { + User::Leave( KErrNotFound ); + } + } + + CleanupStack::PopAndDestroy( &fs ); + } + +// --------------------------------------------------------------------------- +// Return Dialog title +// --------------------------------------------------------------------------- +// +HBufC* CAudioFetcher::TitleForAudioFetcherL() const + { + WLOG("CAudioFetcher::TitleForAudioFetcherL()"); + return TitleL( R_AUDIOFETCHER_DIALOG_TITLE_AUDIO ); + } + +// --------------------------------------------------------------------------- +// Return Dialog title +// --------------------------------------------------------------------------- +// +HBufC* CAudioFetcher::TitleForAnyMediaFileFetcherL() const + { + WLOG("CAudioFetcher::TitleForAudioFetcherL()"); + return TitleL( R_AUDIOFETCHER_DIALOG_TITLE_ANY_FILE ); + } + +// --------------------------------------------------------------------------- +// Return Dialog title +// --------------------------------------------------------------------------- +// +HBufC* CAudioFetcher::TitleL( TInt aSingleSelectionTitleResourceId ) const + { + WLOG("CAudioFetcher::TitleL()"); + + if( !iTitle ) + { + TInt resourceId = aSingleSelectionTitleResourceId; + return CCoeEnv::Static()->AllocReadResourceL( resourceId ); + } + return iTitle; + } + +// ----------------------------------------------------------------------------- +// From MMGFetchCanceler +// ----------------------------------------------------------------------------- +// +void CAudioFetcher::CancelFetcherL() + { + WLOG("CAudioFetcher::CancelFetcherL"); + + } + +// End of File + + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/audiofetcher/src/audiofetcherdialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/audiofetcher/src/audiofetcherdialog.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,915 @@ +/* +* 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: creates fetcher plugin dialog +* +*/ + + +// INCLUDES +#include // for CColumnListBoxData +#include // MCoeControlObserver +#include // AknTextUtils AknFind +#include // for GulArray +#include +#include +#include +#include // CAknInputBlock +#include + +#include +#include +#include +#include +#include // AknSelectionList.cpp +#include // CAknSearchField +#include // CEikCaptionedControl + +#include // KAvkonBitmapFile, KAvkonVariatedBitmapsFile +#include // icon constants +#include // memory card icon +#include +#include + +#include // For VerifySelectionL() + +#include +#include +#include "audiofetcherdialog.h" +#include "audiofetcherfilehandler.h" + +#include "audiofetcher.hrh" +#include "audiofetcherlog.h" + +#include // KDC_APP_RESOURCE_DIR + + +//----------------------------------------------------------------------------- +// C++ default constructor. +//----------------------------------------------------------------------------- +// +inline CAudioFetcherDialog::CAudioFetcherDialog( + CDesCArray& aSelectedFiles, + MMGFetchVerifier* aVerifier, + const TDesC& aTitle, + TBool aMultiSelectionEnabled, + TMediaFileType aMediaType) + : iSelectedFiles( aSelectedFiles ), + iVerifier( aVerifier ), + iTitle( aTitle ), + iMultiSelectionEnabled(aMultiSelectionEnabled), + iMediaType(aMediaType) + { + WLOG("CAudioFetcherDialog::CAudioFetcherDialog"); + // No implementation required + } + +//----------------------------------------------------------------------------- +// Two-phased constructor. +//----------------------------------------------------------------------------- +// +CAudioFetcherDialog* CAudioFetcherDialog::NewL(CDesCArray& aSelectedFiles, + MMGFetchVerifier* aVerifier, const TDesC& aTitle, TBool aMultiSelectionEnabled, + TMediaFileType aMediaType) + { + WLOG("CAudioFetcherDialog::NewL"); + CAudioFetcherDialog* self= + new( ELeave ) CAudioFetcherDialog( + aSelectedFiles, aVerifier, aTitle, aMultiSelectionEnabled, aMediaType ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +//----------------------------------------------------------------------------- +// Destructor +//----------------------------------------------------------------------------- +// +CAudioFetcherDialog::~CAudioFetcherDialog() + { + WLOG("CAudioFetcherDialog::~CAudioFetcherDialog >"); + + delete iStatusPaneHandler; + delete iListHandler; + delete iFileHandler; + delete iListBox; + delete iEmptyListText; + delete iIdle; + delete iInputBlock; + + // Restore the Toolbar as it was in the Calling application + if( iAvkonAppUi->CurrentFixedToolbar() ) // there is Hardware Specific Output for Fixed ToolBar + { + iAvkonAppUi->CurrentFixedToolbar()->SetToolbarVisibility( ETrue ); + } + + if ( iAvkonAppUi ) + { + iAvkonAppUi->RemoveFromStack( this ); + } + + WLOG("CAudioFetcherDialog::~CAudioFetcherDialog <"); + } + +//----------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// Create the alfscreenbuffer with a generic buffer screen id +//----------------------------------------------------------------------------- +// +void CAudioFetcherDialog::ConstructL() + { + WLOG("CAudioFetcherDialog::ConstructL >"); + // always first call the base class + CAknDialog::ConstructL( R_AUDIOFETCHER_MENUBAR ); //R_MULTISELECT_AUDIOFETCHER_MENUBAR ); + + // Get the Instance of the toolbar and disable it as it is not required in the fetcher dialog + if( iAvkonAppUi->CurrentFixedToolbar() ) // there is hardware specific output for fixed toolBar + { + iAvkonAppUi->CurrentFixedToolbar()->SetToolbarVisibility( EFalse ); + } + + // get previous title so it can be restored + iStatusPaneHandler = CStatusPaneHandler::NewL( iAvkonAppUi ); + iStatusPaneHandler->StoreOriginalTitleL(); + + // MdS query handler + iFileHandler = CAudioFetcherFileHandler::NewL(); + iFileHandler->SetObserver( this ); + + // List model + iListHandler = CAudioFetcherListHandler::NewL(); + iListHandler->SetObserver( this ); + + WLOG("CAudioFetcherDialog::ConstructL <"); + } + +//----------------------------------------------------------------------------- +// CAudioFetcherDialog::ProcessCommandL +// This processes the events to the OkToExitL +//----------------------------------------------------------------------------- +// +void CAudioFetcherDialog::ProcessCommandL(TInt aCommandId) + { + WLOG("CAudioFetcherDialog::ProcessCommandL"); + switch( aCommandId ) + { + case EAknSoftkeyCancel : + { + TryExitL( aCommandId ); + break; + } + case EAknSoftkeySelect : + case ECmdSelectMarked : + case EAknSoftkeyOk : + { + TryExitL( aCommandId ); + break; + } + default : + { + break; + } + } + } +//----------------------------------------------------------------------------- +// CAudioFetcherDialog::OkToExitL +//----------------------------------------------------------------------------- +// +TBool CAudioFetcherDialog::OkToExitL(TInt aKeycode) + { + WLOG("CAudioFetcherDialog::OkToExitL"); + TBool retVal = EFalse; + + switch( aKeycode ) + { + case EAknSoftkeySelect : + { + TInt index = CurrentItemListIndex(); + TBuf<128> fileName; + + iFileHandler->GetAttribute( index, CAudioFetcherFileHandler::EAttrFullName, fileName, 0 ); + iSelectedFiles.AppendL( fileName ); + + // Retreives the uri's of the selected files and verifies if it is a + // supported format + if ( iVerifier && !iVerifier->VerifySelectionL( &iSelectedFiles ) ) + { + iSelectedFiles.Reset(); + retVal = EFalse; + } + else + { + retVal = ETrue; + } + break; + } + case EAknSoftkeyOk: + { + retVal = ETrue; + } + case EAknSoftkeyCancel : // exit dialog + case EAknCmdExit : + { + retVal = ETrue; + break; + } + default : + break; + } + return retVal; + } + +//----------------------------------------------------------------------------- +// CAudioFetcherDialog::SizeChanged +//----------------------------------------------------------------------------- +// +void CAudioFetcherDialog::SizeChanged() + { + WLOG("CAudioFetcherDialog::SizeChanged"); + // Can be implemented based on the use. + CAknDialog::SizeChanged(); + + TRect parentRect( Rect() ); + if ( iListBox ) + { + iListBox->SetRect( parentRect ); + } + } + +//----------------------------------------------------------------------------- +// CAudioFetcherDialog::PreLayoutDynInitL +//----------------------------------------------------------------------------- +// +void CAudioFetcherDialog::PreLayoutDynInitL() + { + WLOG("CAudioFetcherDialog::PreLayoutDynInitL >"); + + iListBox = new ( ELeave ) CAknSingleGraphicStyleListBox; + iListBox->ConstructL( this, EAknListBoxSelectionList ); + + iListBox->Model()->SetItemTextArray( iListHandler ); + iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + + iListBox->SetListBoxObserver( this ); + iListBox->CreateScrollBarFrameL( ETrue ); + iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( + CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto ); + + iListBox->SetListBoxObserver( this ); + + SetIconsL(); + + iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); + + if ( iMediaType == EAnyMediaFile ) + { + iEmptyListText = StringLoader::LoadL( R_AUDIOFETCHER_EMPTY_LIST_TEXT_NO_MEDIA ); + } + else + { + iEmptyListText = StringLoader::LoadL( R_AUDIOFETCHER_EMPTY_LIST_TEXT_NO_AUDIO ); + } + + + + iListBox->View()->SetListEmptyTextL( *iEmptyListText ); + + iStatusPaneHandler->SetTitleL( iTitle ); + iStatusPaneHandler->SetNaviPaneTitleL( KNullDesC ); + + CEikButtonGroupContainer& dialogCba = ButtonGroupContainer(); + dialogCba.MakeCommandVisible(EAknSoftkeySelect, EFalse); + + WLOG("CAudioFetcherDialog::PreLayoutDynInitL <"); + } + +//----------------------------------------------------------------------------- +// CAudioFetcherDialog::PostLayoutDynInitL +//----------------------------------------------------------------------------- +// +void CAudioFetcherDialog::PostLayoutDynInitL() + { + WLOG("CAudioFetcherDialog::PostLayoutDynInitL"); + } + +// ---------------------------------------------------------------------------- +// CAudioFetcherDialog::SetIconsL +// ---------------------------------------------------------------------------- +// +void CAudioFetcherDialog::SetIconsL() + { + WLOG("CAudioFetcherDialog::SetIconsL >"); + + _LIT( KBitmapFile, "AudioFetcher.mbm" ); + + + if ( !iListBox ) + { + return; + } + + SetIconFileNameL( KBitmapFile, iIconFileName ); + + CArrayPtr* icons = new (ELeave) CAknIconArray(1); + CleanupStack::PushL( icons ); + + // NOTE: append order must match TListIcons + // + + // music item icon + icons->AppendL( IconL( KAknsIIDQgnIndiAiNtMusic, iIconFileName, + EMbmAudiofetcherQgn_indi_ai_nt_music, + EMbmAudiofetcherQgn_indi_ai_nt_music_mask ) ); + + // tone item icon, default tone icon + icons->AppendL( IconL( KAknsIIDQgnPropMupAudio, iIconFileName, + EMbmAudiofetcherQgn_prop_mup_audio, + EMbmAudiofetcherQgn_prop_mup_audio_mask ) ); + + // video item icon + icons->AppendL( IconL( KAknsIIDQgnPropFmgrFileVideo, iIconFileName, + EMbmAudiofetcherQgn_prop_fmgr_file_video, + EMbmAudiofetcherQgn_prop_fmgr_file_video_mask ) ); + + // recording item icon + icons->AppendL( IconL( KAknsIIDQgnPropFmgrFileVoicerec, iIconFileName, + EMbmAudiofetcherQgn_prop_fmgr_file_voicerec, + EMbmAudiofetcherQgn_prop_fmgr_file_voicerec_mask ) ); + + // artist icon + icons->AppendL( IconL( KAknsIIDQgnPropMupArtist, iIconFileName, + EMbmAudiofetcherQgn_prop_mup_artist, + EMbmAudiofetcherQgn_prop_mup_artist_mask ) ); + + // album icon + icons->AppendL( IconL( KAknsIIDQgnPropMupAlbum, iIconFileName, + EMbmAudiofetcherQgn_prop_mup_album, + EMbmAudiofetcherQgn_prop_mup_album_mask ) ); + + // genre icon + icons->AppendL( IconL( KAknsIIDQgnPropMupGenre, iIconFileName, + EMbmAudiofetcherQgn_prop_mup_genre, + EMbmAudiofetcherQgn_prop_mup_genre_mask ) ); + + // composer icon + icons->AppendL( IconL( KAknsIIDQgnPropMupComposer, iIconFileName, + EMbmAudiofetcherQgn_prop_mup_composer, + EMbmAudiofetcherQgn_prop_mup_composer_mask ) ); + + // folder icon (tones, music, videos, recordings, all music, artist, + // album, genre, composer, artist all) + icons->AppendL( IconL( KAknsIIDQgnPropFolderSmall, iIconFileName, + EMbmAudiofetcherQgn_prop_folder_small, + EMbmAudiofetcherQgn_prop_folder_small_mask ) ); + + // unknown folder icon + icons->AppendL( IconL( KAknsIIDQgnPropMceUnknownRead, iIconFileName, + EMbmAudiofetcherQgn_prop_mce_unknown_read, + EMbmAudiofetcherQgn_prop_mce_unknown_read ) ); + + // download item icon (null item) + icons->AppendL( IconL( KAknsIIDQgnPropLinkEmbdSmall, iIconFileName, + EMbmAudiofetcherQgn_prop_link_embd_small, + EMbmAudiofetcherQgn_prop_link_embd_small_mask ) ); + + // off item icon (null item) + icons->AppendL( IconL( KAknsIIDQgnPropSmlSyncOff, iIconFileName, + EMbmAudiofetcherQgn_prop_sml_sync_off, + EMbmAudiofetcherQgn_prop_sml_sync_off_mask ) ); + + // memory card icon + icons->AppendL( IconL( KAknsIIDQgnIndiMmcAdd, iIconFileName, + EMbmAudiofetcherQgn_indi_mmc_add, + EMbmAudiofetcherQgn_indi_mmc_add_mask ) ); + + // mass storage icon + icons->AppendL( IconL( KAknsIIDQgnPropLinkEmbdSmall, iIconFileName, + EMbmAudiofetcherQgn_indi_fmgr_ms_add, + EMbmAudiofetcherQgn_indi_fmgr_ms_add_mask ) ); + + // empty icon + icons->AppendL( IconL( KAknsIIDQgnPropEmpty, KAvkonBitmapFile, + EMbmAvkonQgn_prop_empty, + EMbmAvkonQgn_prop_empty_mask ) ); + + // image item icon + icons->AppendL( IconL( KAknsIIDQgnPropFmgrFileImage, iIconFileName, + EMbmAudiofetcherQgn_prop_fmgr_file_image, + EMbmAudiofetcherQgn_prop_fmgr_file_image_mask ) ); + + // delete old icons + CArrayPtr* arr = iListBox->ItemDrawer()->ColumnData()->IconArray(); + if ( arr ) + { + arr->ResetAndDestroy(); + delete arr; + arr = NULL; + } + + iListBox->ItemDrawer()->ColumnData()->SetIconArray( icons ); + CleanupStack::Pop( icons ); + + WLOG("CAudioFetcherDialog::SetIconsL <"); + } + +// ---------------------------------------------------------------------------- +// CAudioFetcherDialog::SetIconFileNameL +// +// ---------------------------------------------------------------------------- +// +void CAudioFetcherDialog::SetIconFileNameL( const TDesC& aName, TDes& aFullName ) + { + WLOG("CAudioFetcherDialog::SetIconFileNameL >"); + _LIT( KDriveZ, "z:" ); + + aFullName = KNullDesC; + + aFullName.Append( KDriveZ ); + aFullName.Append( KDC_APP_RESOURCE_DIR ); + aFullName.Append( aName ); + + WLOG("CAudioFetcherDialog::SetIconFileNameL <"); + } + +// ----------------------------------------------------------------------------- +// CMediaFileDialog::IconL +// +// ----------------------------------------------------------------------------- +// +CGulIcon* CAudioFetcherDialog::IconL(TAknsItemID aId, const TDesC& aFileName, + TInt aFileIndex, TInt aFileMaskIndex) + { + WLOG("CAudioFetcherDialog::IconL"); + CGulIcon* icon = AknsUtils::CreateGulIconL(AknsUtils::SkinInstance(), aId, + aFileName, aFileIndex, aFileMaskIndex); + return icon; + } + + +// ----------------------------------------------------------------------------- +// CMediaFileDialog::UpdateListBoxL +// ----------------------------------------------------------------------------- +// +void CAudioFetcherDialog::UpdateListBoxL() + { + WLOG("CAudioFetcherDialog::UpdateListBoxL >"); + + if ( !iListBox ) + { + return; + } + + TInt resultCount = iFileHandler->ResultCount(); + + if(resultCount > 0){ + CEikButtonGroupContainer& dialogCba = ButtonGroupContainer(); + dialogCba.MakeCommandVisible(EAknSoftkeySelect, ETrue); + } + iListBox->HandleItemAdditionL(); + iListBox->SetCurrentItemIndex( 0 ); + DrawNow(); + + WLOG("CAudioFetcherDialog::UpdateListBoxL <"); + } + +//------------------------------------------------------------------------------ +// CAudioFetcherDialog::ActivateL +// +// Called by system when dialog is activated. +//------------------------------------------------------------------------------ +// +void CAudioFetcherDialog::ActivateL() + { + WLOG("CAudioFetcherDialog::ActivateL >"); + CAknDialog::ActivateL(); + + // this cannot be in ConstructL which is executed before dialog is launched + iAvkonAppUi->AddToStackL( this ); + WLOG("CAudioFetcherDialog::ActivateL <"); + } + +//----------------------------------------------------------------------------- +// CAudioFetcherDialog::DynInitMenuPaneL +//----------------------------------------------------------------------------- +void CAudioFetcherDialog::DynInitMenuPaneL( + TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/ ) + { + WLOG("CAudioFetcherDialog::DynInitMenuPaneL"); + // No Implementation + } + + +// --------------------------------------------------------------------------- +// CAudioFetcherDialog::CountComponentControls +// +// Gets the number of controls contained in a compound control. +// --------------------------------------------------------------------------- +// +TInt CAudioFetcherDialog::CountComponentControls() const + { + return iListBox ? 1 : 0; + } + + +// --------------------------------------------------------------------------- +// CAudioFetcherDialog::CountComponentControls +// +// --------------------------------------------------------------------------- +// +CCoeControl* CAudioFetcherDialog::ComponentControl( TInt /*aIndex*/ ) const + { + return iListBox; + } + +//----------------------------------------------------------------------------- +// CAudioFetcherDialog::OfferKeyEventL +//----------------------------------------------------------------------------- +TKeyResponse CAudioFetcherDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) + { + WLOG("CAudioFetcherDialog::OfferKeyEventL"); + TKeyResponse keyResponse( EKeyWasNotConsumed ); + + // Escape key was pressed and dialog needs to close + if ( aKeyEvent.iCode == EKeyEscape && aType == EEventKey ) + { + TryExitL( EAknSoftkeyCancel ); + keyResponse = EKeyWasConsumed; + } + else + { + keyResponse = iListBox->OfferKeyEventL( aKeyEvent, aType ); + } + return keyResponse; + } + +// ----------------------------------------------------------------------------- +// CAudioFetcherDialog::HandleListBoxEventL (from MEikListBoxObserver) +// ----------------------------------------------------------------------------- +// +void CAudioFetcherDialog::HandleListBoxEventL( CEikListBox* /*aListBox*/, + TListBoxEvent aEventType ) + { + WLOG("CAudioFetcherDialog::HandleListBoxEventL"); + + switch ( aEventType ) + { + case EEventItemDoubleClicked: // fallthrough + case EEventEnterKeyPressed: + { + TBool closeDialog = HandleListSelectionL(); + if ( closeDialog ) + { + // close after short delay (dialog cannot be closed from this function) + CloseDialogWithDelayL(); + } + break; + } + default: + break; + } + } + +// ----------------------------------------------------------------------------- +// CAudioFetcherDialog::CloseDialogWithDelayL +// ----------------------------------------------------------------------------- +// +void CAudioFetcherDialog::CloseDialogWithDelayL() + { + delete iIdle; + iIdle = NULL; + iIdle = CIdle::NewL( CActive::EPriorityIdle ); + + if ( iIdle ) + { + iIdle->Start( TCallBack( CloseDialog, this ) ); + } + delete iInputBlock; + iInputBlock = NULL; + iInputBlock = CAknInputBlock::NewLC(); + CleanupStack::Pop( iInputBlock ); + } + +// ----------------------------------------------------------------------------- +// CAudioFetcherDialog::CloseDialog +// ----------------------------------------------------------------------------- +// +TInt CAudioFetcherDialog::CloseDialog( TAny *aObj ) + { + CAudioFetcherDialog *dlg = (CAudioFetcherDialog*) aObj; + delete dlg->iInputBlock; + dlg->iInputBlock = NULL; + + TRAP_IGNORE( dlg->TryExitL( EAknSoftkeyOk ) ); + + return 0; + } + +// ----------------------------------------------------------------------------- +// CAudioFetcherDialog::ConstructListboxItem +// ----------------------------------------------------------------------------- +// +TPtrC CAudioFetcherDialog::ConstructListboxItem( TInt aListboxIndex ) + { + WLOG("CAudioFetcherDialog::ConstructListboxItem"); + _LIT( KFormat2, "%d\t%S\t%d" ); + + TInt mediaTypeIcon = EEIconEmpty; + TInt storageTypeIcon = EEIconEmpty; + + GetListItemText( aListboxIndex, iListboxItemText1 ); + mediaTypeIcon = MediaTypeIcon( aListboxIndex ); + storageTypeIcon = StorageTypeIcon( aListboxIndex ); + + iListboxItemText2.Format( KFormat2, mediaTypeIcon, &iListboxItemText1, storageTypeIcon ); + return iListboxItemText2; + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherDialog::StorageTypeIcon +// ----------------------------------------------------------------------------- +// +TInt CAudioFetcherDialog::StorageTypeIcon( TInt aListboxIndex ) + { + WLOG("CAudioFetcherDialog::StorageTypeIcon"); + if ( aListboxIndex < 0 ) + { + return EEIconEmpty; + } + + TInt storageType = iFileHandler->Attribute( aListboxIndex, + CAudioFetcherFileHandler::EAttrStorageType, 0 ); + TInt iconId = EEIconEmpty; + + if ( storageType == CAudioFetcherFileHandler::EMemoryCard ) + { + iconId = EEIconMemoryCard; + } + else if ( storageType == CAudioFetcherFileHandler::EMassStorage ) + { + iconId = EEIconMassStorage; + } + + return iconId; + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherDialog::MediaTypeIcon +// ----------------------------------------------------------------------------- +// +TInt CAudioFetcherDialog::MediaTypeIcon( TInt aListboxIndex ) + { + WLOG("CAudioFetcherDialog::MediaTypeIcon"); + if ( aListboxIndex < 0 ) + { + return EEIconEmpty; + } + + TInt mediaType = iFileHandler->Attribute( aListboxIndex, + CAudioFetcherFileHandler::EAttrMediaType, 0 ); + + TInt iconId = EEIconEmpty; + + switch ( mediaType ) + { + case CAudioFetcherFileHandler::EMediaTypeImage: + { + iconId = EEIconImage; + break; + } + case CAudioFetcherFileHandler::EMediaTypeVideo: + { + iconId = EEIconVideo; + break; + } + case CAudioFetcherFileHandler::EMediaTypeTone: + { + iconId = EEIconTone; + break; + } + case CAudioFetcherFileHandler::EMediaTypeRecording: + { + iconId = EEIconRecording; + break; + } + case CAudioFetcherFileHandler::EMediaTypeMusic: + { + iconId = EEIconMusic; + break; + } + default: + break; + } + + return iconId; + } + +// ----------------------------------------------------------------------------- +// CAudioFetcherDialog::ListboxItemCount (from MAudioFetcherListHandlerObserver) +// ----------------------------------------------------------------------------- +// +TInt CAudioFetcherDialog::ListboxItemCount() + { + WLOG("CAudioFetcherDialog::ListboxItemCount"); + return iFileHandler->ResultCount(); + } + + + +// ----------------------------------------------------------------------------- +// CAudioFetcherDialog::HandleFileEventL (from MAudioFetcherFileHandlerObserver) +// ----------------------------------------------------------------------------- +// +void CAudioFetcherDialog::HandleFileEventL( TInt aEvent, TInt aError ) + { + WLOG("CAudioFetcherDialog::HandleFileEventL >"); + // handle cancel button + if ( aEvent == MAudioFetcherFileHandlerObserver::EQueryCanceled ) + { + WLOG("CAudioFetcherDialog::HandleFileEventL == EQueryCanceled"); + UpdateListBoxL(); + return; + } + + // handle error + if ( aError != KErrNone ) + { + WLOG1("### CAudioFetcherDialog::HandleFileEventL (%d) ###", aError ); + return; + } + + if ( aEvent != MAudioFetcherFileHandlerObserver::EUnknownQueryComplete ) + { + WLOG("CAudioFetcherDialog::HandleFileEventL != EUnknownQueryComplete"); + } + + if ( aEvent == MAudioFetcherFileHandlerObserver::EUnknownQueryComplete ) + { + WLOG("CAudioFetcherDialog::HandleFileEventL == EUnknownQueryComplete"); + } + + if ( aEvent == MAudioFetcherFileHandlerObserver::EQueryComplete ) + { + WLOG("CAudioFetcherDialog::HandleFileEventL == EQueryComplete"); + + + if ( iMediaType == EAnyMediaFile ) + { + // in case of all media files, fetch video files next + if ( iFileHandler->QueryType() == CAudioFetcherFileHandler::EMediaTypeMusic ) + { + iFileHandler->QueryVideoL(); + } + else if ( iFileHandler->QueryType() == CAudioFetcherFileHandler::EMediaTypeVideo ) + { + iFileHandler->QueryImageL(); + } + else + { + UpdateListBoxL(); + } + + } + else + { + UpdateListBoxL(); + } + } + + if ( aEvent == MAudioFetcherFileHandlerObserver::EMediaFileChanged ) + { + WLOG("CAudioFetcherDialog::HandleFileEventL == EMediaFileChanged"); + } + + if ( aEvent == MAudioFetcherFileHandlerObserver::EInitComplete ) + { + WLOG("CAudioFetcherDialog::HandleFileEventL == EInitComplete"); + iDatabaseOpen = ETrue; + QueryL(); + } + + WLOG("CAudioFetcherDialog::HandleFileEventL <"); + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherDialog::GetListItemText +// +// ----------------------------------------------------------------------------- +// +void CAudioFetcherDialog::GetListItemText( TInt aListboxIndex, TDes& aText ) + { + WLOG("CAudioFetcherDialog::GetListItemText"); + iFileHandler->GetAttribute( aListboxIndex, + CAudioFetcherFileHandler::EAttrSongName, aText, 0 ); + } + + + +// ----------------------------------------------------------------------------- +// CAudioFetcherDialog::CurrentItemListIndex +// +// ----------------------------------------------------------------------------- +// +TInt CAudioFetcherDialog::CurrentItemListIndex() + { + WLOG("CAudioFetcherDialog::CurrentItemListIndex"); + TInt itemCount = iListBox->Model()->NumberOfItems(); + TInt currentIndex = iListBox->CurrentItemIndex(); + + if ( itemCount == 0 || currentIndex < 0 ) + { + return KErrNotFound; // list or find box is empty + } + return currentIndex; + } + + +//------------------------------------------------------------------------------ +// CMediaFileDialog::QueryL +// +//------------------------------------------------------------------------------ +// +void CAudioFetcherDialog::QueryL() + { + WLOG("CAudioFetcherDialog::QueryL >"); + if ( !iFileHandler->QueryReady() || !iDatabaseOpen ) + { + WLOG("CAudioFetcherDialog::QueryL: query in progress"); + return; + } + + iFileHandler->EnableObserverCall( ETrue ); + iFileHandler->SetQueryId( 0 ); + iFileHandler->QueryAudioL(); + + WLOG("CAudioFetcherDialog::QueryL <"); + } + +// ---------------------------------------------------------------------------- +// CAudioFetcherDialog::HandleResourceChange +// ---------------------------------------------------------------------------- +// +void CAudioFetcherDialog::HandleResourceChange(TInt aType) + { + WLOG("CAudioFetcherDialog::HandleResourceChange"); + if (aType == KAknsMessageSkinChange) + { + TRAP_IGNORE( SetIconsL() ); + } + else if ( aType == KEikDynamicLayoutVariantSwitch ) + { + TRect mainPaneRect; + AknLayoutUtils::LayoutMetricsRect( + AknLayoutUtils::EMainPane, mainPaneRect ); + SetRect( mainPaneRect ); + TRAP_IGNORE( iStatusPaneHandler->SetTitleL( iTitle ) ); + TRAP_IGNORE( iStatusPaneHandler->SetNaviPaneTitleL( KNullDesC ) ); + DrawDeferred(); + } + + CCoeControl::HandleResourceChange( aType ); + } + + +// ---------------------------------------------------------------------------- +// CAudioFetcherDialog::HandleListSelection +// ---------------------------------------------------------------------------- +// +TBool CAudioFetcherDialog::HandleListSelectionL() + { + TBool closeDialog = EFalse; + + TInt index = CurrentItemListIndex(); + TBuf<128> fileName; + + iFileHandler->GetAttribute( index, CAudioFetcherFileHandler::EAttrFullName, fileName, 0 ); + iSelectedFiles.AppendL( fileName ); + + // Retreives the uri's of the selected files and verifies if it is a + // supported format + if ( iVerifier && !iVerifier->VerifySelectionL( &iSelectedFiles ) ) + { + iSelectedFiles.Reset(); + closeDialog = EFalse; + } + else + { + closeDialog = ETrue; + } + return closeDialog; + } + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/audiofetcher/src/audiofetcherdialogutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/audiofetcher/src/audiofetcherdialogutils.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,652 @@ +/* +* 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 FILES + +#include "audiofetcherdialogutils.h" +#include "audiofetcherlog.h" + +#include // bafl.lib +#include +#include +#include + +#include // CAknNavigationDecorator +#include // CAknNaviLabel +#include // CAknTitlePane +#include +#include +#include // AknsUtils + +#include // KDC_APP_RESOURCE_DIR + + +/****************************************************************************** + * class CActiveCaller + ******************************************************************************/ + + +// ----------------------------------------------------------------------------- +// CActiveCaller::NewL +// +// ----------------------------------------------------------------------------- +// +CActiveCaller* CActiveCaller::NewL( MActiveCallerObserver* aObserver ) + { + CActiveCaller* self = new (ELeave) CActiveCaller( aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +// ----------------------------------------------------------------------------- +// Destructor +// +// ----------------------------------------------------------------------------- +// +CActiveCaller::~CActiveCaller() + { + WLOG("CActiveCaller::~CActiveCaller >"); + Cancel(); + iTimer.Close(); + WLOG("CActiveCaller::~CActiveCaller <"); + } + + +// ----------------------------------------------------------------------------- +// CActiveCaller::CActiveCaller +// +// ----------------------------------------------------------------------------- +// +CActiveCaller::CActiveCaller(MActiveCallerObserver* aObserver) : CActive(CActive::EPriorityStandard) + { + iObserver = aObserver; + } + + +// ----------------------------------------------------------------------------- +// CActiveCaller::ConstructL +// +// ----------------------------------------------------------------------------- +// +void CActiveCaller::ConstructL() + { + WLOG("CActiveCaller::ConstructL >"); + User::LeaveIfError( iTimer.CreateLocal() ); + CActiveScheduler::Add( this ); + WLOG("CActiveCaller::ConstructL <"); + } + + +// ----------------------------------------------------------------------------- +// CActiveCaller::DoCancel +// +// ----------------------------------------------------------------------------- +// +void CActiveCaller::DoCancel() + { + WLOG("CActiveCaller::DoCancel >"); + iTimer.Cancel(); + WLOG("CActiveCaller::DoCancel <"); + } + + +// ----------------------------------------------------------------------------- +// CActiveCaller::RunL +// +// ----------------------------------------------------------------------------- +// +void CActiveCaller::RunL() + { + WLOG("CActiveCaller::RunL >"); + TRAP_IGNORE( iObserver->HandleActiveCallL( iCallId ) ); + WLOG("CActiveCaller::RunL <"); + } + + +// ----------------------------------------------------------------------------- +// CActiveCaller::Request +// +// This function calls this class RunL. +// ----------------------------------------------------------------------------- +// +void CActiveCaller::Request() + { + Cancel(); + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + + +// ----------------------------------------------------------------------------- +// CActiveCaller::Start +// +// ----------------------------------------------------------------------------- +// +void CActiveCaller::Start( TInt aCallId, TInt aMilliseconds ) + { + WLOG("CActiveCaller::Start >"); + const TInt KThousand = 1000; + Cancel(); + + iCallId = aCallId; + + if ( aMilliseconds <= 0 ) + { + Request(); // no delay - complete asap + } + else + { + iTimer.After( iStatus, aMilliseconds*KThousand ); + SetActive(); + } + WLOG("CActiveCaller::Start <"); + } + + +// ----------------------------------------------------------------------------- +// CActiveCaller::Stop +// +// ----------------------------------------------------------------------------- +// +void CActiveCaller::Stop() + { + WLOG("CActiveCaller::Stop >"); + Cancel(); + WLOG("CActiveCaller::Stop <"); + } + + + + +/******************************************************************************* + * class CNaviPaneHandler + *******************************************************************************/ + + +// ----------------------------------------------------------------------------- +// Destructor +// +// ----------------------------------------------------------------------------- +// +CNaviPaneHandler::~CNaviPaneHandler() + { + WLOG("CNaviPaneHandler::~CNaviPaneHandler >"); + if ( iNaviDecorator ) + { + if ( iNaviPane && iNavidecoratorPushed ) + { + iNaviPane->Pop( iNaviDecorator ); + } + + delete iNaviDecorator; + } + + if ( iNaviPane && iNavipanePushed ) + { + iNaviPane->Pop(); // restore previous navi pane + } + WLOG("CNaviPaneHandler::~CNaviPaneHandler <"); + } + + +// ----------------------------------------------------------------------------- +// CNaviPaneHandler::CNaviPaneHandler +// +// ----------------------------------------------------------------------------- +// +CNaviPaneHandler::CNaviPaneHandler( CEikStatusPane* aStatusPane ) : iStatusPane( aStatusPane ) + { + iNavidecoratorPushed = EFalse; + iNavipanePushed = EFalse; + + if ( iStatusPane ) + { + TRAP_IGNORE( iNaviPane = (CAknNavigationControlContainer*)iStatusPane->ControlL(TUid::Uid(EEikStatusPaneUidNavi)) ); + } + } + + +// ---------------------------------------------------------------------------- +// CNaviPaneHandler::SetNaviPaneTitleL +// +// ---------------------------------------------------------------------------- +// +void CNaviPaneHandler::SetNaviPaneTitleL(const TDesC& aTitle) + { + if ( !iStatusPane || !iNaviPane ) + { + return; + } + + if ( iNaviDecorator ) + { + CAknNaviLabel* naviLabel = static_cast(iNaviDecorator->DecoratedControl()); + if ( naviLabel ) + { + naviLabel->SetTextL( aTitle ); + iNaviDecorator->DrawDeferred(); + } + } + else + { + iNaviDecorator = iNaviPane->CreateNavigationLabelL( aTitle ) ; + iNaviPane->PushL( *iNaviDecorator ); // activate navi label in navi pane + iNavidecoratorPushed = ETrue; + } + } + + +// ---------------------------------------------------------------------------- +// CNaviPaneHandler::StoreNavipaneL +// +// ---------------------------------------------------------------------------- +// +void CNaviPaneHandler::StoreNavipaneL() + { + if ( !iNaviPane || !iStatusPane || iNavipanePushed ) + { + return; + } + + if ( iStatusPane->PaneCapabilities(TUid::Uid(EEikStatusPaneUidTitle)).IsPresent() ) + { + iNaviPane->PushDefaultL(); + iNavipanePushed = ETrue; + } + } + + + + +/******************************************************************************* + * class CStatusPaneHandler + *******************************************************************************/ + +// ----------------------------------------------------------------------------- +// CStatusPaneHandler::NewL +// +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CStatusPaneHandler* CStatusPaneHandler::NewL( CAknAppUi* aAppUi ) + { + CStatusPaneHandler* self = new (ELeave) CStatusPaneHandler( aAppUi ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// ----------------------------------------------------------------------------- +// Destructor +// +// ----------------------------------------------------------------------------- +// +CStatusPaneHandler::~CStatusPaneHandler() + { + WLOG("CStatusPaneHandler::~CStatusPaneHandler >"); + TRAP_IGNORE( RestoreOriginalTitleL() ); + + delete iNaviPaneHandler; + WLOG("CStatusPaneHandler::~CStatusPaneHandler <"); + } + + +// ----------------------------------------------------------------------------- +// CStatusPaneHandler::ConstructL +// +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CStatusPaneHandler::ConstructL() + { + WLOG("CStatusPaneHandler::ConstructL >"); + iNaviPaneHandler = new (ELeave) CNaviPaneHandler( iAppUi->StatusPane() ); + WLOG("CStatusPaneHandler::ConstructL <"); + } + + +// ----------------------------------------------------------------------------- +// CStatusPaneHandler::CStatusPaneHandler +// +// ----------------------------------------------------------------------------- +// +CStatusPaneHandler::CStatusPaneHandler( CAknAppUi* aAppUi ) : iAppUi(aAppUi ) + { + //__ASSERT_ALWAYS( iAppUi, User::Panic( KErrGeneral ) ); + + iOriginalTitleStored = EFalse; + iOriginalTitle = KNullDesC; + } + + +// ---------------------------------------------------------------------------- +// CStatusPaneHandler::GetTitleL +// +// ---------------------------------------------------------------------------- +// +TBool CStatusPaneHandler::GetTitleL( CAknAppUi* aAppUi, TDes& aTitle ) + { + aTitle = KNullDesC; + + CEikStatusPane* statusPane = aAppUi->StatusPane(); + if (statusPane && statusPane->PaneCapabilities( TUid::Uid( EEikStatusPaneUidTitle ) ).IsPresent() ) + { + CAknTitlePane* titlePane = static_cast + ( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); + if ( titlePane->Text() ) + { + StrCopy( aTitle, *titlePane->Text() ); + return ETrue; + } + } + + return EFalse; + } + + +// ---------------------------------------------------------------------------- +// CStatusPaneHandler::SetTitleL +// +// ---------------------------------------------------------------------------- +// +TBool CStatusPaneHandler::SetTitleL( CAknAppUi* aAppUi, const TDesC& aTitle ) + { + CEikStatusPane* statusPane = aAppUi->StatusPane(); + if ( statusPane && statusPane->PaneCapabilities( TUid::Uid( EEikStatusPaneUidTitle ) ).IsPresent() ) + { + CAknTitlePane* titlePane = static_cast + ( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); + if ( titlePane->Text() ) + { + titlePane->SetTextL( aTitle ); + return ETrue; + } + } + return EFalse; + } + + +// ---------------------------------------------------------------------------- +// CStatusPaneHandler::SetNaviPaneTitleL +// +// ---------------------------------------------------------------------------- +// +void CStatusPaneHandler::SetNaviPaneTitleL( const TDesC& aTitle ) + { + iNaviPaneHandler->SetNaviPaneTitleL( aTitle ); + } + + +// ---------------------------------------------------------------------------- +// CStatusPaneHandler::SetNaviPaneTitle +// +// ---------------------------------------------------------------------------- +// +void CStatusPaneHandler::SetNaviPaneTitle( const TDesC& aTitle ) + { + TRAP_IGNORE( iNaviPaneHandler->SetNaviPaneTitleL( aTitle ) ); + } + + +// ---------------------------------------------------------------------------- +// CStatusPaneHandler::SetNaviPaneTitleL +// +// ---------------------------------------------------------------------------- +// +void CStatusPaneHandler::SetNaviPaneTitleL( TInt aResource ) + { + HBufC* hBuf = StringLoader::LoadLC( aResource) ; + SetNaviPaneTitleL( hBuf->Des() ); + CleanupStack::PopAndDestroy( hBuf ); + } + + +// ---------------------------------------------------------------------------- +// CStatusPaneHandler::StoreNavipaneL +// +// ---------------------------------------------------------------------------- +// +void CStatusPaneHandler::StoreNavipaneL() + { + iNaviPaneHandler->StoreNavipaneL(); + } + + +// ---------------------------------------------------------------------------- +// CStatusPaneHandler::StoreOriginalTitleL +// +// ---------------------------------------------------------------------------- +// +void CStatusPaneHandler::StoreOriginalTitleL() + { + TBool ret = GetTitleL( iAppUi, iOriginalTitle ); + + if ( ret ) + { + iOriginalTitleStored = ETrue; + } + } + + +// ---------------------------------------------------------------------------- +// CStatusPaneHandler::RestoreOriginalTitleL +// +// ---------------------------------------------------------------------------- +// +void CStatusPaneHandler::RestoreOriginalTitleL() + { + if ( iOriginalTitleStored ) + { + SetTitleL( iAppUi, iOriginalTitle ); + } + } + + +// ---------------------------------------------------------------------------- +// CStatusPaneHandler::SetTitleL +// +// ---------------------------------------------------------------------------- +// +void CStatusPaneHandler::SetTitleL( const TDesC& aText ) + { + if ( iOriginalTitleStored ) + { + SetTitleL( iAppUi, aText ); + } + } + + +// ---------------------------------------------------------------------------- +// CStatusPaneHandler::SetTitleL +// +// ---------------------------------------------------------------------------- +// +void CStatusPaneHandler::SetTitleL( TInt aResourceId ) + { + HBufC* hBuf = StringLoader::LoadLC( aResourceId ); + SetTitleL( hBuf->Des() ); + CleanupStack::PopAndDestroy( hBuf ); + } + + +// ----------------------------------------------------------------------------- +// CStatusPaneHandler::StrCopy +// +// ----------------------------------------------------------------------------- +// +void CStatusPaneHandler::StrCopy( TDes& aTarget, const TDesC& aSource ) + { + WLOG("CStatusPaneHandler::StrCopy >"); + TInt len = aTarget.MaxLength(); + if( len < aSource.Length() ) + { + aTarget.Copy( aSource.Left(len) ); + return; + } + aTarget.Copy( aSource ); + WLOG("CStatusPaneHandler::StrCopy <"); + } + + + +/****************************************************************************** + * class CDriveUtil + ******************************************************************************/ + + +// ----------------------------------------------------------------------------- +// CDriveUtil::NewL +// +// ----------------------------------------------------------------------------- +// +CDriveUtil* CDriveUtil::NewL() + { + CDriveUtil* self = new (ELeave) CDriveUtil(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +// ----------------------------------------------------------------------------- +// Destructor +// +// ----------------------------------------------------------------------------- +// +CDriveUtil::~CDriveUtil() + { + WLOG("CDriveUtil::~CDriveUtil >"); + iFsSession.Close(); + WLOG("CDriveUtil::~CDriveUtil <"); + } + + +// ----------------------------------------------------------------------------- +// CDriveUtil::CDriveUtil +// +// ----------------------------------------------------------------------------- +// +CDriveUtil::CDriveUtil() + { + } + + +// ----------------------------------------------------------------------------- +// CDriveUtil::ConstructL +// +// ----------------------------------------------------------------------------- +// +void CDriveUtil::ConstructL() + { + WLOG("CDriveUtil::ConstructL >"); + User::LeaveIfError( iFsSession.Connect() ); + WLOG("CDriveUtil::ConstructL <"); + } + + +// ----------------------------------------------------------------------------- +// CDriveUtil::IsRom +// +// ----------------------------------------------------------------------------- +// +TBool CDriveUtil::IsRom( const TDesC& aFullPath ) + { + const TUint KMassStorageBits = DriveInfo::EDriveRom; + + TDriveUnit drive( aFullPath ); + TUint driveStatus( 0 ); + + TInt err = DriveInfo::GetDriveStatus( iFsSession, drive, driveStatus ); + if ( err != KErrNone ) + { + return EFalse; + } + + if ( (driveStatus & KMassStorageBits) == KMassStorageBits ) + { + return ETrue; + } + + return EFalse; + } + + +// ----------------------------------------------------------------------------- +// CDriveUtil::IsMassStorage +// +// ----------------------------------------------------------------------------- +// +TBool CDriveUtil::IsMassStorage( const TDesC& aFullPath ) + { + const TUint KMassStorageBits = DriveInfo::EDriveInternal | + DriveInfo::EDriveExternallyMountable; + + TDriveUnit drive( aFullPath ); + TUint driveStatus( 0 ); + + TInt err = DriveInfo::GetDriveStatus( iFsSession, drive, driveStatus ); + if ( err != KErrNone ) + { + return EFalse; + } + + if ( (driveStatus & KMassStorageBits) == KMassStorageBits ) + { + return ETrue; + } + + return EFalse; + } + + +// ----------------------------------------------------------------------------- +// CDriveUtil::IsMemoryCard +// +// ----------------------------------------------------------------------------- +// +TBool CDriveUtil::IsMemoryCard( const TDesC& aFullPath ) + { + const TUint KMemoryCardBits = DriveInfo::EDriveRemovable | + DriveInfo::EDriveExternallyMountable; + + TDriveUnit drive( aFullPath ); + TUint driveStatus( 0 ); + + TInt err = DriveInfo::GetDriveStatus( iFsSession, drive, driveStatus ); + if ( err != KErrNone ) + { + return EFalse; + } + + if ( (driveStatus & KMemoryCardBits) == KMemoryCardBits ) + { + return ETrue; + } + + return EFalse; + } + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/audiofetcher/src/audiofetcherfilehandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/audiofetcher/src/audiofetcherfilehandler.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,1419 @@ +/* +* Copyright (c) 2007 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 "audiofetcherfilehandler.h" +#include "audiofetcherlog.h" + +#include +#include + + +/****************************************************************************** + * class CAudioFetcherFileHandler + ******************************************************************************/ + + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::NewL +// +// ----------------------------------------------------------------------------- +// +CAudioFetcherFileHandler* CAudioFetcherFileHandler::NewL() + { + CAudioFetcherFileHandler* self = new (ELeave) CAudioFetcherFileHandler(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +// ----------------------------------------------------------------------------- +// Destructor +// +// ----------------------------------------------------------------------------- +// +CAudioFetcherFileHandler::~CAudioFetcherFileHandler() + { + WLOG("CAudioFetcherFileHandler::~CAudioFetcherFileHandler >"); + + if ( iSearchList ) + { + iSearchList->Reset(); + } + delete iSearchList; + delete iQueryCaller; + delete iObjectNotificationCaller; + + delete iDriveUtil; + WLOG("CAudioFetcherFileHandler::~CAudioFetcherFileHandler before iQuery"); + if ( iQuery ) + { + iQuery->Cancel(); + } + delete iQuery; + WLOG("CAudioFetcherFileHandler::~CAudioFetcherFileHandler after iQuery"); + delete iSession; + WLOG("CAudioFetcherFileHandler::~CAudioFetcherFileHandler <"); + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::CAudioFetcherFileHandler +// +// ----------------------------------------------------------------------------- +// +CAudioFetcherFileHandler::CAudioFetcherFileHandler() + { + iSessionOpen = EFalse; + iObserverCallEnabled = ETrue; + + iMaxFileSize = KErrNotFound; + iQueryId = KErrNotFound; + iQueryType = KErrNotFound; + iQueryError = KErrNone; + iQueryEvent = KErrNotFound; + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::ConstructL +// +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::ConstructL() + { + WLOG("CAudioFetcherFileHandler::ConstructL >"); + + iSession = CMdESession::NewL( *this ); + iSearchList = CSearchList::NewL(); + + iQueryCaller = CActiveCaller::NewL( this ); + iObjectNotificationCaller = CActiveCaller::NewL( this ); + + iDriveUtil = CDriveUtil::NewL(); + + WLOG("CAudioFetcherFileHandler::ConstructL <"); + } + + + + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::HandleSessionOpened (from MMdESessionObserver) +// +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::HandleSessionOpened( CMdESession& /*aSession*/, TInt aError ) + { + WLOG("CAudioFetcherFileHandler::HandleSessionOpened >"); + if ( aError != KErrNone ) + { + delete iSession; + iSession = NULL; + iSessionOpen = EFalse; + } + else + { + iSessionOpen = ETrue; + + TRAP_IGNORE( AddObjectObserverL() ); + } + + CallObserver( MAudioFetcherFileHandlerObserver::EInitComplete, aError ); + WLOG("CAudioFetcherFileHandler::HandleSessionOpened <"); + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::AddObjectObserverL +// +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::AddObjectObserverL() + { + WLOG("CAudioFetcherFileHandler::AddObjectObserverL >"); + if ( iSessionOpen ) + { + TUint32 notificationType = ENotifyAdd | ENotifyModify | ENotifyRemove; + CMdENamespaceDef& defNS = iSession->GetDefaultNamespaceDefL(); + iSession->AddObjectObserverL( *this, NULL, notificationType, &defNS ); + + iSession->AddObjectPresentObserverL( *this ); + } + WLOG("CAudioFetcherFileHandler::AddObjectObserverL <"); + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::HandleSessionError (from MMdESessionObserver) +// +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::HandleSessionError( CMdESession& /*aSession*/, TInt aError ) + { + WLOG("CAudioFetcherFileHandler::HandleSessionError >"); + if ( aError == KErrNone ) + { + return; + } + + delete iSession; + iSession = NULL; + iSessionOpen = EFalse; + + CallObserver( MAudioFetcherFileHandlerObserver::EError, aError ); + WLOG("CAudioFetcherFileHandler::HandleSessionError <"); + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::HandleQueryNewResults (from MMdEQueryObserver) +// +// This observer function is called during query. Calling frequency is defined +// in second parameter of CMdEQuery::FindL. +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::HandleQueryNewResults( CMdEQuery& /*aQuery*/, + TInt /*aFirstNewItemIndex*/, + TInt /*aNewItemCount*/ ) + { + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::HandleObjectNotification (MMdEObjectObserver) +// +// Called when metadata database changes. +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::HandleObjectNotification( CMdESession& /*aSession*/, + TObserverNotificationType aType, + const RArray& aObjectIdArray ) + { + WLOG("CAudioFetcherFileHandler::HandleObjectNotification >"); + if ( aType == ENotifyAdd || aType == ENotifyModify || aType == ENotifyRemove ) + { + if ( iObserver ) + { + TInt count = aObjectIdArray.Count(); + WLOG1("CAudioFetcherFileHandler::HandleObjectNotification: count is %d", count ); + + // delayed call to avoid many consecutive observer calls + CallObserverWithDelay(); + } + } + WLOG("CAudioFetcherFileHandler::HandleObjectNotification <"); + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::HandleObjectPresentNotification (MMdEObjectPresentObserver) +// +// Called when previously used memory card is inserted and hidden +// metadata files are made present again. +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::HandleObjectPresentNotification( CMdESession& /*aSession*/, + TBool /*aPresent*/, const RArray& aObjectIdArray ) + { + WLOG("CAudioFetcherFileHandler::HandleObjectPresentNotification >"); + if ( iObserver ) + { + TInt count = aObjectIdArray.Count(); + WLOG1("CAudioFetcherFileHandler::HandleObjectPresentNotification: count is %d", count ); + + // delayed call to avoid many consecutive observer calls + CallObserverWithDelay(); + } + WLOG("CAudioFetcherFileHandler::HandleObjectPresentNotification <"); + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::HandleQueryCompleted (MMdEQueryObserver) +// +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::HandleQueryCompleted( CMdEQuery& aQuery, TInt aError ) + { + WLOG("CAudioFetcherFileHandler::HandleQueryCompleted >"); + TInt err = KErrNone; + TRAP( err, HandleQueryCompletedL( aQuery, aError ) ); + + if ( err == KErrCancel ) + { + CallObserver( MAudioFetcherFileHandlerObserver::EQueryCanceled, KErrNone ); + } + else if ( err != KErrNone ) + { + iSearchList->Reset(); + CallObserver( MAudioFetcherFileHandlerObserver::EError, err ); + } + WLOG("CAudioFetcherFileHandler::HandleQueryCompleted <"); + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::HandleQueryCompletedL +// +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::HandleQueryCompletedL( CMdEQuery& /*aQuery*/, TInt aError ) + { + WLOG("CAudioFetcherFileHandler::HandleQueryCompletedL >"); + TInt err = aError; + + if ( !iQuery ) + { + err = KErrGeneral; + } + if ( err == KErrCancel ) + { + iSearchList->Reset(); + return; +// User::Leave( err ); + } + if ( err != KErrNone ) + { + User::Leave( err ); + } + + iSearchList->SetSession( iSession ); + TQueryResultMode resultMode = iQuery->ResultMode(); + + if ( resultMode == EQueryResultModeCount ) + { + // EQueryResultModeCount currently not used + CallObserver( MAudioFetcherFileHandlerObserver::EUnknownQueryComplete, KErrNone ); + } + else if ( resultMode == EQueryResultModeItem ) + { + if ( iQueryType == ESearchAudio ) + { + // ESearchAudio currently not used + iSearchList->Reset(); + iSearchList->TakeResultL( iQuery, EMediaTypeMusic ); + } + else if ( iQueryType == ESearchMusic ) + { + // search is done in 3 steps (music, tones and videos) + iSearchList->Reset(); + iSearchList->TakeResultL( iQuery, EMediaTypeMusic ); + } + else if ( iQueryType == ESearchTones ) + { + iSearchList->TakeResultL( iQuery, EMediaTypeTone ); + } + else if ( iQueryType == EQueryUnknown ) + { + iSearchList->Reset(); + iSearchList->TakeResultL( iQuery, EMediaTypeMusic ); + iSearchList->SetSearchId( iQueryId ); + + CallObserver( MAudioFetcherFileHandlerObserver::EUnknownQueryComplete, KErrNone ); + } + else + { + TInt mediaType = MediaType( iQueryType ); + iSearchList->TakeResultL( iQuery, mediaType ); + iSearchList->SetSearchId( iQueryId ); + iSearchList->Sort(); + + CallObserver( MAudioFetcherFileHandlerObserver::EQueryComplete, KErrNone ); + } + } + else + { + CallObserver( MAudioFetcherFileHandlerObserver::EError, KErrNotSupported ); + } + WLOG("CAudioFetcherFileHandler::HandleQueryCompletedL <"); + } + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::EQueryImage +// +// Finds image files. +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::QueryImageL() + { + WLOG("CAudioFetcherFileHandler::EQueryImageL >"); + + LeaveIfSessionClosedL(); + + CMdENamespaceDef& defNS = iSession->GetDefaultNamespaceDefL(); + CMdEObjectDef& imageObjectDef = + defNS.GetObjectDefL( MdeConstants::Image::KImageObject ); + + delete iQuery; + iQuery = NULL; + iQuery = iSession->NewObjectQueryL( defNS, imageObjectDef, this ); + + // set attributes that are included in query result + CMdEPropertyDef& namePropertyDef = PropertyDefL( EAttrSongName ); + iQuery->AddPropertyFilterL( &namePropertyDef ); + CMdEPropertyDef& fileTypePropertyDef = PropertyDefL( EAttrMediaType ); + iQuery->AddPropertyFilterL( &fileTypePropertyDef ); + + CMdELogicCondition& conditions = iQuery->Conditions(); + ExcludeRomFilesL( conditions ); + + iQuery->SetResultMode( EQueryResultModeItem ); + iQuery->FindL(); + + iQueryType = EMediaTypeImage; + + WLOG("CAudioFetcherFileHandler::QueryImageL <"); + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::QueryAudioL +// +// Finds music files. +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::QueryAudioL() + { + WLOG("CAudioFetcherFileHandler::QueryAudioL >"); + + LeaveIfSessionClosedL(); + + CMdENamespaceDef& defNS = iSession->GetDefaultNamespaceDefL(); + CMdEObjectDef& musicObjectDef = + defNS.GetObjectDefL( MdeConstants::Audio::KAudioObject ); + + delete iQuery; + iQuery = NULL; + iQuery = iSession->NewObjectQueryL( defNS, musicObjectDef, this ); + + // set attributes that are included in query result + CMdEPropertyDef& namePropertyDef = PropertyDefL( EAttrSongName ); + iQuery->AddPropertyFilterL( &namePropertyDef ); + CMdEPropertyDef& fileTypePropertyDef = PropertyDefL( EAttrMediaType ); + iQuery->AddPropertyFilterL( &fileTypePropertyDef ); + + CMdELogicCondition& conditions = iQuery->Conditions(); + ExcludeRomFilesL( conditions ); + + // define sort order + // iQuery->AppendOrderRuleL( TMdEOrderRule( namePropertyDef, ESortAscending ) ); + + iQuery->SetResultMode( EQueryResultModeItem ); + iQuery->FindL(); + + iQueryType = EMediaTypeMusic; + + WLOG("CAudioFetcherFileHandler::QueryAudioL <"); + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::QueryAudioL +// +// Finds music files. +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::QueryVideoL() + { + WLOG("CAudioFetcherFileHandler::QueryVideoL >"); + + LeaveIfSessionClosedL(); + + CMdENamespaceDef& defNS = iSession->GetDefaultNamespaceDefL(); + CMdEObjectDef& videoObjectDef = + defNS.GetObjectDefL( MdeConstants::Video::KVideoObject ); + + delete iQuery; + iQuery = NULL; + iQuery = iSession->NewObjectQueryL( defNS, videoObjectDef, this ); + + // set attributes that are included in query result + CMdEPropertyDef& namePropertyDef = PropertyDefL( EAttrSongName ); + iQuery->AddPropertyFilterL( &namePropertyDef ); + CMdEPropertyDef& fileTypePropertyDef = PropertyDefL( EAttrMediaType ); + iQuery->AddPropertyFilterL( &fileTypePropertyDef ); + + CMdELogicCondition& conditions = iQuery->Conditions(); + ExcludeRomFilesL( conditions ); + + iQuery->SetResultMode( EQueryResultModeItem ); + iQuery->FindL(); + + iQueryType = EMediaTypeVideo; + + WLOG("CAudioFetcherFileHandler::QueryVideoL <"); + } + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::ResultCount +// +// ----------------------------------------------------------------------------- +// +TInt CAudioFetcherFileHandler::ResultCount() + { + WLOG("CAudioFetcherFileHandler::ResultCount"); + if ( !iSessionOpen ) + { + return 0; + } + + return iSearchList->Count(); + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::CancelQuery +// +// Cancels ongoing query. +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::CancelQuery() + { + WLOG("CAudioFetcherFileHandler::CancelQuery >"); + if ( !iSessionOpen || !iQuery ) + { + return; + } + + if ( !iQuery->IsComplete() ) + { + iQuery->Cancel(); // this calls HandleQueryCompleted synchronously + } + WLOG("CAudioFetcherFileHandler::CancelQuery <"); + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::LeaveIfSessionClosedL +// +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::LeaveIfSessionClosedL() + { + WLOG("CAudioFetcherFileHandler::LeaveIfSessionClosedL >"); + if ( !iSession || !iSessionOpen ) + { + User::Leave( KErrDisconnected ); + } + WLOG("CAudioFetcherFileHandler::LeaveIfSessionClosedL <"); + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::SetObserver +// +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::SetObserver( MAudioFetcherFileHandlerObserver* aObserver ) + { + iObserver = aObserver; + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::GetAttributeL +// +// NOTE: GetAttributeL only gets full name or file name +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::GetAttributeL( TInt aIndex, TInt aAttr, + TDes& aValue, TInt aQueryId ) + { + WLOG("CAudioFetcherFileHandler::GetAttributeL"); + aValue = KNullDesC; + + if ( !iSessionOpen ) + { + return; + } + + TInt id = iSearchList->SearchId(); + if ( id != aQueryId ) + { + return; // search list and UI do not match + } + + iSearchList->SetSession( iSession ); + iSearchList->GetAttributeL( aIndex, aAttr, aValue ); + } + + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::GetAttribute +// +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::GetAttribute( TInt aIndex, TInt aAttr, + TDes& aValue, TInt aQueryId ) + { + WLOG("CAudioFetcherFileHandler::GetAttribute"); + TRAP_IGNORE( GetAttributeL( aIndex, aAttr, aValue, aQueryId ) ); + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::Attribute +// +// ----------------------------------------------------------------------------- +// +TInt CAudioFetcherFileHandler::Attribute( TInt aIndex, TInt aAttr, TInt aQueryId ) + { + WLOG("CAudioFetcherFileHandler::Attribute"); + if ( !iSessionOpen ) + { + return KErrNotFound; + } + + TInt id = iSearchList->SearchId(); + if ( id != aQueryId ) + { + return KErrNotFound; + } + + return iSearchList->Attribute( aIndex, aAttr ); + } + + + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::PropertyDefL +// +// ----------------------------------------------------------------------------- +// +CMdEPropertyDef& CAudioFetcherFileHandler::PropertyDefL( TInt aAttr ) + { + WLOG("CAudioFetcherFileHandler::PropertyDefL"); + return PropertyDefL( iSession, aAttr ); + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::PropertyDefL +// +// ----------------------------------------------------------------------------- +// +CMdEPropertyDef& CAudioFetcherFileHandler::PropertyDefL( CMdESession* aSession, TInt aAttr ) + { + WLOG("CAudioFetcherFileHandler::PropertyDefL"); + CMdENamespaceDef& defNS = aSession->GetDefaultNamespaceDefL(); + + CMdEObjectDef& objectDef = + defNS.GetObjectDefL( MdeConstants::Audio::KAudioObject ); + + if ( aAttr == EAttrFileSize ) + { + return objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty ); + } + else if ( aAttr == EAttrMediaType ) + { + return objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty ); + } + else if ( aAttr == EAttrSongName || aAttr == EAttrFileName ) + { + return objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty ); + } + else if ( aAttr == EAttrArtist ) + { + return objectDef.GetPropertyDefL( MdeConstants::MediaObject::KArtistProperty ); + } + else if ( aAttr == EAttrAlbum ) + { + return objectDef.GetPropertyDefL( MdeConstants::Audio::KAlbumProperty ); + } + else if ( aAttr == EAttrGenre ) + { + return objectDef.GetPropertyDefL( MdeConstants::MediaObject::KGenreProperty ); + } + else if ( aAttr == EAttrComposer ) + { + return objectDef.GetPropertyDefL( MdeConstants::Audio::KComposerProperty ); + } + else + { + User::Leave( KErrNotSupported ); + } + + return objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty ); + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::QueryReady +// +// ----------------------------------------------------------------------------- +// +TBool CAudioFetcherFileHandler::QueryReady() + { + WLOG("CAudioFetcherFileHandler::QueryReady"); + + TBool isWaitingObserverCall = iQueryCaller->IsActive(); + if ( isWaitingObserverCall ) + { + return EFalse; // query is ready but observer not called yet + } + + if ( iQuery ) + { + return iQuery->IsComplete(); + } + + return ETrue; + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::ExcludeRomFilesL +// +// Exclude audio files that are in rom (default tones). +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::ExcludeRomFilesL( CMdELogicCondition& aCondition ) + { + WLOG("CAudioFetcherFileHandler::ExcludeRomFilesL"); + _LIT( KDriveZ, "z:\\" ); + + CMdEObjectCondition& cond = aCondition.AddObjectConditionL( + EObjectConditionCompareUriBeginsWith, KDriveZ ); + cond.SetNegate( ETrue ); + } + + +// ------------------------------------------------------------------------------- +// CAudioFetcherFileHandler::StrCopy +// +// String copy with lenght check. +// ------------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::StrCopy( TDes& aTarget, const TDesC& aSource ) + { + WLOG("CAudioFetcherFileHandler::StrCopy"); + TInt len = aTarget.MaxLength(); + if( len < aSource.Length() ) + { + aTarget.Copy( aSource.Left( len ) ); + return; + } + aTarget.Copy( aSource ); + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::EnableObserverCall +// +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::EnableObserverCall( TBool aEnable ) + { + iObserverCallEnabled = aEnable; + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::CallObserver +// +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::CallObserver( TInt aEvent, TInt aError ) + { + WLOG("CAudioFetcherFileHandler::CallObserver"); + const TInt KDelay = 100; // milliseconds + + if ( !iObserverCallEnabled ) + { + return; + } + + iQueryError = aError; + iQueryEvent = aEvent; + + iQueryCaller->Start( 0, KDelay ); + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::CallObserverWithDelay +// +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::CallObserverWithDelay() + { + WLOG("CAudioFetcherFileHandler::CallObserverWithDelay"); + const TInt KOneSecond = 1000; + + if ( !iObserverCallEnabled ) + { + return; + } + + iObjectNotificationCaller->Start( 1, KOneSecond ); + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::HandleActiveCallL (from MActiveCallerObserver) +// +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::HandleActiveCallL( TInt aCallId ) + { + WLOG("CAudioFetcherFileHandler::HandleActiveCallL"); + if ( !iObserver ) + { + return; + } + + // inform observer that query is ready + if ( aCallId == 0 ) + { + TRAP_IGNORE( iObserver->HandleFileEventL( iQueryEvent, iQueryError ) ); + } + + // inform observer that database has changed + if ( aCallId == 1 ) + { + if ( QueryReady() ) + { + TRAP_IGNORE( iObserver->HandleFileEventL( MAudioFetcherFileHandlerObserver::EMediaFileChanged, KErrNone ) ); + } + } + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::SetQueryId +// +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::SetQueryId( TInt aId ) + { + // this id is passed to CSearchList after successful database search + iQueryId = aId; + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::Panic +// +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::Panic( TInt aReason ) + { + _LIT( KPanicCategory, "CAudioFetcherFileHandler" ); + + User::Panic( KPanicCategory, aReason ); + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::MediaType +// +// ----------------------------------------------------------------------------- +// +TInt CAudioFetcherFileHandler::MediaType( TInt aQueryType ) + { + TInt mediaType = EMediaTypeAny; + + if ( aQueryType == EMediaTypeMusic ) + { + mediaType = EMediaTypeMusic; + } + else if ( aQueryType == EMediaTypeImage ) + { + mediaType = EMediaTypeImage; + } + else if ( aQueryType == EMediaTypeVideo ) + { + mediaType = EMediaTypeVideo; + } + return mediaType; + } + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::QueryType +// +// ----------------------------------------------------------------------------- +// +TInt CAudioFetcherFileHandler::QueryType() + { + return iQueryType; + } + + +/****************************************************************************** + * class CSearchListItem + ******************************************************************************/ + + +// ----------------------------------------------------------------------------- +// CSearchListItem::NewL +// +// ----------------------------------------------------------------------------- +// +CSearchListItem* CSearchListItem::NewLC() + { + CSearchListItem* self = new (ELeave) CSearchListItem(); + CleanupStack::PushL( self ); + self->ConstructL(); + + return self; + } + + +// ----------------------------------------------------------------------------- +// Destructor +// +// ----------------------------------------------------------------------------- +// +CSearchListItem::~CSearchListItem() + { + delete iTitle; + } + + +// ----------------------------------------------------------------------------- +// CSearchListItem::CSearchListItem +// +// ----------------------------------------------------------------------------- +// +CSearchListItem::CSearchListItem() + { + iId = KErrNotFound; + iMediaType = KErrNotFound; + iStorageType = KErrNotFound; + iTitle = NULL; + } + + +// ----------------------------------------------------------------------------- +// CSearchListItem::ConstructL +// +// ----------------------------------------------------------------------------- +// +void CSearchListItem::ConstructL() + { + } + +// ----------------------------------------------------------------------------- +// CSearchListItem::SetTitleL +// +// ----------------------------------------------------------------------------- +// + +void CSearchListItem::SetTitleL( const TDesC& aText, TBool aFullName ) + { + delete iTitle; + iTitle = NULL; + + if ( aFullName ) + { + TParsePtrC parse( aText ); + iTitle = parse.Name().AllocL(); + } + else + { + iTitle = aText.AllocL(); + } + } + + +// ----------------------------------------------------------------------------- +// CSearchListItem::Title +// +// ----------------------------------------------------------------------------- +// + +const TDesC& CSearchListItem::Title() const + { + return *iTitle; + } + + + + +/****************************************************************************** + * class CSearchList + ******************************************************************************/ + + +// ----------------------------------------------------------------------------- +// CSearchList::NewL +// +// ----------------------------------------------------------------------------- +// +CSearchList* CSearchList::NewL() + { + CSearchList* self = new (ELeave) CSearchList(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +// ----------------------------------------------------------------------------- +// Destructor +// +// ----------------------------------------------------------------------------- +// +CSearchList::~CSearchList() + { + WLOG("CSearchList::~CSearchList >"); + iList.ResetAndDestroy(); + delete iDriveUtil; + WLOG("CSearchList::~CSearchList <"); + } + + +// ----------------------------------------------------------------------------- +// CSearchList::CSearchList +// +// ----------------------------------------------------------------------------- +// +CSearchList::CSearchList() + { + iSearchId = KErrNotFound; + } + + +// ----------------------------------------------------------------------------- +// CSearchList::ConstructL +// +// ----------------------------------------------------------------------------- +// +void CSearchList::ConstructL() + { + WLOG("CSearchList::ConstructL >"); + iDriveUtil = CDriveUtil::NewL(); + WLOG("CSearchList::ConstructL"); + } + + +// ----------------------------------------------------------------------------- +// CSearchList::SetSession +// +// ----------------------------------------------------------------------------- +// +void CSearchList::SetSession( CMdESession* aSession ) + { + iSession = aSession; + } + + +// ----------------------------------------------------------------------------- +// CSearchList::SetSearchId +// +// ----------------------------------------------------------------------------- +// +void CSearchList::SetSearchId( TInt aSearchId ) + { + iSearchId = aSearchId; + } + + +// ----------------------------------------------------------------------------- +// CSearchList::SearchId +// +// ----------------------------------------------------------------------------- +// +TInt CSearchList::SearchId() + { + return iSearchId; + } + + +// ----------------------------------------------------------------------------- +// CSearchList::TakeResultL +// +// ----------------------------------------------------------------------------- +// +void CSearchList::TakeResultL( CMdEObjectQuery* aQuery, TInt aMediaType ) + { + WLOG("CSearchList::TakeResultL >"); + if ( !aQuery ) + { + return; + } + + TInt count = aQuery->Count(); + + for ( TInt i=0; iTakeOwnershipOfResult( i ); + CleanupStack::PushL( object ); + AddItemL( *object, aMediaType ); + CleanupStack::PopAndDestroy( object ); + } + WLOG("CSearchList::TakeResultL <"); + } + +// ----------------------------------------------------------------------------- +// CSearchList::TakeDistinctResultL +// +// ----------------------------------------------------------------------------- +// +void CSearchList::TakeDistinctResultL( CMdEObjectQuery* aQuery, + TInt /*aMediaType*/ ) + { + if ( !aQuery ) + { + return; + } + + TInt count = aQuery->Count(); + + for ( TInt i=0; iResultDistinctValue( i ); + + CSearchListItem* item = CSearchListItem::NewLC(); + + item->SetTitleL( ptr, EFalse ); + item->iMediaType = KErrNotFound; + item->iStorageType = KErrNotFound; + + iList.AppendL( item ); + + CleanupStack::Pop( item ); + } + } + + +// ----------------------------------------------------------------------------- +// CSearchList::AddItemL +// +// ----------------------------------------------------------------------------- +// +void CSearchList::AddItemL( CMdEObject& aObject, TInt aMediaType ) + { + WLOG("CSearchList::AddItemL >"); + CSearchListItem* item = CSearchListItem::NewLC(); + + TPtrC songName = TextL( aObject, CAudioFetcherFileHandler::EAttrSongName ); + + if ( songName.Length() > 0 ) + { + item->SetTitleL( songName, EFalse ); + } + else + { + item->SetTitleL( aObject.Uri(), ETrue ); + } + + + item->iId = aObject.Id(); + item->iMediaType = aMediaType; + + TInt storageType = CAudioFetcherFileHandler::EPhoneMemory; + if ( iDriveUtil->IsMemoryCard( aObject.Uri() ) ) + { + storageType = CAudioFetcherFileHandler::EMemoryCard; + } + else if ( iDriveUtil->IsMassStorage( aObject.Uri() ) ) + { + storageType = CAudioFetcherFileHandler::EMassStorage; + } + item->iStorageType = storageType; + + iList.AppendL( item ); + + CleanupStack::Pop( item ); + WLOG("CSearchList::AddItemL <"); + } + + +// ----------------------------------------------------------------------------- +// CSearchList::AddAlbumItemL +// +// ----------------------------------------------------------------------------- +// +void CSearchList::AddAlbumItemL( const TDesC& aAlbum ) + { + TLinearOrder sortFunction( CSearchList::Compare ); + + CSearchListItem* item = CSearchListItem::NewLC(); + + item->SetTitleL( aAlbum, EFalse ); + + CleanupStack::Pop( item ); + + item->iMediaType = KErrNotFound; + item->iStorageType = KErrNotFound; + item->iId = KErrNotFound; + + TInt err = iList.InsertInOrder( item, sortFunction ); + if ( err != KErrNone ) + { + delete item; + } + if ( err != KErrNone && err != KErrAlreadyExists ) + { + User::Leave( err ); + } + } + + +// ----------------------------------------------------------------------------- +// CSearchList::AddArtistItemL +// +// ----------------------------------------------------------------------------- +// +void CSearchList::AddArtistItemL( CMdEObject& aObject, + TInt aQueryType, const TDesC& aAlbum ) + { + // all songs for one artist + if ( aQueryType == CAudioFetcherFileHandler::EQueryArtistAll ) + { + AddItemL( aObject, CAudioFetcherFileHandler::EMediaTypeMusic ); + return; + } + + TPtrC album = TextL( aObject, CAudioFetcherFileHandler::EAttrAlbum ); + + // unknown songs (no album metadata) for one artist + if ( aQueryType == CAudioFetcherFileHandler::EQueryArtistUnknown ) + { + if ( album.Length() == 0 ) + { + AddItemL( aObject, CAudioFetcherFileHandler::EMediaTypeMusic ); + } + } + + // all albums for one artist + if ( aQueryType == CAudioFetcherFileHandler::EQueryArtist ) + { + if ( album.Length() > 0 ) + { + AddAlbumItemL( album ); + } + } + + // songs in one album + if ( aQueryType == CAudioFetcherFileHandler::EQueryArtistAlbum ) + { + if ( album.Length() > 0 ) + { + if ( album.Compare( aAlbum ) == 0 ) + { + AddItemL( aObject, CAudioFetcherFileHandler::EMediaTypeMusic ); + } + } + } + } + + +// ----------------------------------------------------------------------------- +// CSearchList::Sort +// +// ----------------------------------------------------------------------------- +// +void CSearchList::Sort() + { + iList.Sort( TLinearOrder(CSearchList::Compare) ); + } + + +// ----------------------------------------------------------------------------- +// CSearchList::Reset +// +// ----------------------------------------------------------------------------- +// +void CSearchList::Reset() + { + iSearchId = KErrNotFound; + iList.ResetAndDestroy(); + } + + +// ----------------------------------------------------------------------------- +// CSearchList::Count +// +// ----------------------------------------------------------------------------- +// +TInt CSearchList::Count() + { + WLOG("CSearchList::Count"); + return iList.Count(); + } + + +// ----------------------------------------------------------------------------- +// CSearchList::GetAttributeL +// +// ----------------------------------------------------------------------------- +// +void CSearchList::GetAttributeL( TInt aIndex, TInt aAttr, TDes& aValue ) + { + WLOG("CSearchList::GetAttributeL"); + aValue = KNullDesC; + + if ( !iSession ) + { + return; + } + + if ( aIndex == KErrNotFound ) + { + return; + } + + TInt count = iList.Count(); + __ASSERT_ALWAYS( aIndex >= 0 && aIndex < count, Panic( KErrGeneral ) ); + + if ( aAttr == CAudioFetcherFileHandler::EAttrFullName ) + { + CSearchListItem* item = iList[aIndex]; + CMdEObject* object = iSession->GetFullObjectL( item->iId ); + CleanupStack::PushL( object ); + StrCopy( aValue, object->Uri() ); + CleanupStack::PopAndDestroy( object ); + } + + else if ( aAttr == CAudioFetcherFileHandler::EAttrSongName || + aAttr == CAudioFetcherFileHandler::EAttrFileName ) + { + CSearchListItem* item = iList[aIndex]; + StrCopy( aValue, item->Title() ); + if ( aValue.Length() == 0 ) + { + CMdEObject* object = iSession->GetFullObjectL( item->iId ); + CleanupStack::PushL( object ); + TParsePtrC parse( object->Uri() ); + StrCopy( aValue, parse.Name() ); + CleanupStack::PopAndDestroy( object ); + } + } + } + + +// ----------------------------------------------------------------------------- +// CSearchList::Attribute +// +// ----------------------------------------------------------------------------- +// +TInt CSearchList::Attribute( TInt aIndex, TInt aAttr ) + { + WLOG("CSearchList::Attribute"); + if ( aIndex == KErrNotFound ) + { + return KErrNotFound; + } + + TInt count = iList.Count(); + __ASSERT_ALWAYS( aIndex >= 0 && aIndex < count, Panic( KErrGeneral ) ); + + + TInt ret = KErrNotFound; + if ( aAttr == CAudioFetcherFileHandler::EAttrMediaType ) + { + CSearchListItem* item = iList[aIndex]; + ret = item->iMediaType; + } + + else if ( aAttr == CAudioFetcherFileHandler::EAttrStorageType ) + { + CSearchListItem* item = iList[aIndex]; + ret = item->iStorageType; + } + else if ( aAttr == CAudioFetcherFileHandler::EAttrMediaFileId ) + { + CSearchListItem* item = iList[aIndex]; + ret = item->iId; + } + + return ret; + } + + +// ----------------------------------------------------------------------------- +// CSearchList::Compare +// +// ----------------------------------------------------------------------------- +// +TInt CSearchList::Compare( const CSearchListItem& aFirst, + const CSearchListItem& aSecond ) + { + TPtrC first = aFirst.Title(); + TPtrC second = aSecond.Title(); + + return first.Compare( second ); + } + +// ----------------------------------------------------------------------------- +// CSearchList::StrCopy +// +// ----------------------------------------------------------------------------- +// +void CSearchList::StrCopy( TDes& aTarget, const TDesC& aSource ) + { + WLOG("CSearchList::StrCopy >"); + TInt len = aTarget.MaxLength(); + if( len < aSource.Length() ) + { + aTarget.Copy( aSource.Left(len) ); + return; + } + aTarget.Copy( aSource ); + WLOG("CSearchList::StrCopy <"); + } + +// ----------------------------------------------------------------------------- +// CSearchList::Panic +// +// ----------------------------------------------------------------------------- +// +void CSearchList::Panic( TInt aReason ) + { + _LIT( KPanicCategory, "CSearchList" ); + + User::Panic( KPanicCategory, aReason ); + } + + +// ----------------------------------------------------------------------------- +// CSearchList::TextL +// +// ----------------------------------------------------------------------------- +// +const TDesC& CSearchList::TextL( CMdEObject& aObject, TInt aId ) + { + WLOG("CSearchList::TextL"); + CMdEPropertyDef& propDef = + CAudioFetcherFileHandler::PropertyDefL( iSession, aId ); + + CMdEProperty* property = NULL; + TInt err = aObject.Property( propDef, property, 0 ); + + if ( err != KErrNotFound && property ) + { + return property->TextValueL(); + } + + return KNullDesC; + } + + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/audiofetcher/src/audiofetcherlisthandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/audiofetcher/src/audiofetcherlisthandler.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,101 @@ +/* +* 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 "audiofetcherlisthandler.h" +#include "audiofetcherlog.h" + +// ----------------------------------------------------------------------------- +// CAudioFetcherListHandler::NewL +// ----------------------------------------------------------------------------- +// +CAudioFetcherListHandler* CAudioFetcherListHandler::NewL() + { + CAudioFetcherListHandler* self = new (ELeave) CAudioFetcherListHandler(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +// ----------------------------------------------------------------------------- +// CAudioFetcherListHandler::~CMFListHandler +// ----------------------------------------------------------------------------- +// +CAudioFetcherListHandler::~CAudioFetcherListHandler() + { + WLOG("CAudioFetcherListHandler::~CAudioFetcherListHandler"); + } + +// ----------------------------------------------------------------------------- +// CAudioFetcherListHandler::ConstructL +// ----------------------------------------------------------------------------- +// +void CAudioFetcherListHandler::ConstructL() + { + WLOG("CAudioFetcherListHandler::ConstructL"); + } + +// ----------------------------------------------------------------------------- +// CAudioFetcherListHandler::CAudioFetcherListHandler +// ----------------------------------------------------------------------------- +// +CAudioFetcherListHandler::CAudioFetcherListHandler() + { + } + +// ----------------------------------------------------------------------------- +// CAudioFetcherListHandler::SetObserver +// ----------------------------------------------------------------------------- +// +void CAudioFetcherListHandler::SetObserver( MAudioFetcherListHandlerObserver* aObserver ) + { + iObserver = aObserver; + } + +// ----------------------------------------------------------------------------- +// CAudioFetcherListHandler::MdcaCount (from MDesCArray) +// ----------------------------------------------------------------------------- +// +TInt CAudioFetcherListHandler::MdcaCount() const + { + WLOG("CAudioFetcherListHandler::MdcaCount"); + return iObserver->ListboxItemCount(); + } + +// ----------------------------------------------------------------------------- +// CAudioFetcherListHandler::MdcaPoint (from MDesCArray) +// CEikListBox calls this function just before it draws list box item. +// ----------------------------------------------------------------------------- +// +TPtrC16 CAudioFetcherListHandler::MdcaPoint( TInt aIndex ) const + { + WLOG("CAudioFetcherListHandler::MdcaPoint"); + return iObserver->ConstructListboxItem( aIndex ); + } + +// ----------------------------------------------------------------------------- +// CAudioFetcherListHandler::Panic +// ----------------------------------------------------------------------------- +// +void CAudioFetcherListHandler::Panic( TInt aReason ) + { + _LIT( KPanicCategory, "CAudioFetcherListHandler" ); + User::Panic( KPanicCategory, aReason ); + } + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/audiofetcher/src/audiofetcherproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/audiofetcher/src/audiofetcherproxy.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,48 @@ +/* +* 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: Standard proxy of the ECOM plugin +* +*/ + +// INCLUDE FILES +#include + +#include "audiofetcher.hrh" // to get UID's +#include "audiofetcher.h" // pluigin + +#if ( !defined IMPLEMENTATION_PROXY_ENTRY ) +typedef TAny* TProxyNewLPtr; +#define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( TProxyNewLPtr )( aFuncPtr ) } +#endif + +// ---------------------------------------------------------------------------- +// The list of implementations +// ---------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KAudioFetcherImplementationUid,CAudioFetcher::NewL) + }; + +// --------------------------------------------------------------------------- +// The proxy of implementations +// ---------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/collectionhelper/bwinscw/mpxcollectionhelperU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/collectionhelper/bwinscw/mpxcollectionhelperU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,5 @@ +EXPORTS + ?NewCollectionHelperL@CMPXCollectionHelperFactory@@SAPAVMMPXCollectionHelper@@XZ @ 1 NONAME ; class MMPXCollectionHelper * CMPXCollectionHelperFactory::NewCollectionHelperL(void) + ?NewCollectionUiHelperL@CMPXCollectionHelperFactory@@SAPAVMMPXCollectionUiHelper@@ABVTUid@@@Z @ 2 NONAME ; class MMPXCollectionUiHelper * CMPXCollectionHelperFactory::NewCollectionUiHelperL(class TUid const &) + ?NewCollectionCachedHelperL@CMPXCollectionHelperFactory@@SAPAVMMPXCollectionHelper@@XZ @ 3 NONAME ; class MMPXCollectionHelper * CMPXCollectionHelperFactory::NewCollectionCachedHelperL(void) + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/collectionhelper/eabi/mpxcollectionhelperU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/collectionhelper/eabi/mpxcollectionhelperU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _ZN27CMPXCollectionHelperFactory20NewCollectionHelperLEv @ 1 NONAME + _ZN27CMPXCollectionHelperFactory22NewCollectionUiHelperLERK4TUid @ 2 NONAME + _ZN27CMPXCollectionHelperFactory26NewCollectionCachedHelperLEv @ 3 NONAME + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/collectionhelper/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/collectionhelper/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2006 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: Collection Helper +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../rom/mpxcollectionhelper.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mpxcollectionhelper.iby) + +PRJ_MMPFILES +mpxcollectionhelper.mmp \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/collectionhelper/group/mpxcollectionhelper.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/collectionhelper/group/mpxcollectionhelper.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2006 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 for project ?myapp +* +*/ + + +#include +#include + +TARGET mpxcollectionhelper.dll +TARGETTYPE dll +UID 0x1000006C 0x101FFCAB + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +MACRO RD_MPX_TNM_INTEGRATION +#define RD_MPX_TNM_INTEGRATION + +//MACRO RD_MPX_COLLECTION_CACHE +SOURCEPATH ../src +SOURCE mpxcollectionhelperfactory.cpp +SOURCE mpxcollectionhelperimp.cpp +SOURCE mpxcollectionuihelperimp.cpp +SOURCE mpxcollectionhelpercommon.cpp +SOURCE mpxdeletehelper.cpp +SOURCE mpxcollectioncachedhelper.cpp + +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY estor.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY mpxcommon.lib +LIBRARY mpxcollectionmediator.lib +LIBRARY mpxcollectionutility.lib +LIBRARY mpxharvesterutility.lib +LIBRARY mpxplaybackutility.lib +LIBRARY usbman.lib +LIBRARY apgrfx.lib +LIBRARY mpxmetadataextractor.lib +#ifdef RD_MPX_TNM_INTEGRATION +LIBRARY thumbnailmanager.lib + +#endif //RD_MPX_TNM_INTEGRATION + +#if defined(ARMCC) +deffile ../eabi/ +#elif defined(WINSCW) +deffile ../bwinscw/ +#endif diff -r 000000000000 -r a2952bb97e68 mmappcomponents/collectionhelper/inc/mpxcollectioncachedhelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/collectionhelper/inc/mpxcollectioncachedhelper.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,716 @@ +/* +* Copyright (c) 2006 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: Collection Helper with Caching +* +*/ + + +#ifndef CMPXCOLLECTIONCACHEDHELPER_H +#define CMPXCOLLECTIONCACHEDHELPER_H + +#include +#include +#include "mpxcollectionhelperimp.h" +#include "mpxitemid.h" +#include + +// FORWARD DECLARATION +class CMPXMediaArray; +class CMPXMetadataExtractor; + +/** + * Extended collection helper with caching capabilities + * + * @lib mpxcollectionhelper + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( CMPXCollectionCachedHelper ) : public CMPXCollectionHelperImp + { + +public: + + static CMPXCollectionCachedHelper* NewL(); + + static CMPXCollectionCachedHelper* NewLC(); + + virtual ~CMPXCollectionCachedHelper(); + +protected: + + /** + * Add a song or a playlist to the cache. This method will leave if + * failed to add it to the cache. If this song or playlist fails to + * be added to the collection when the cache is committed, client is + * NOT notified. Failure to provide the required attributes will + * result in such a failure. + * + * @param aMedia, media to be added. + * + * To add a song to the collection, the media provided MUST + * contain the following attributes: + * KMPXMediaGeneralType: + * must be EMPXItem + * + * KMPXMediaGeneralCategory: + * must be EMPXSong + * + * KMPXMediaGeneralUri: + * full path of the song. Only supporting local path, i.e. path + * must starts with a drive letter. + * + * Client must provide the metadata by filling other attributes. This + * song will be registered with Harvester so that it will not be + * unnecessarily scanned during the next scan/refresh. + * + * To add a playlist to the collection, the media provided MUST + * contain the following attributes: + * KMPXMediaGeneralType: + * must be EMPXItem + * + * KMPXMediaGeneralCategory: + * must be EMPXPlaylist + * + * KMPXMediaGeneralUri: + * Provide full path of the playlist if there is an associated + * physical playlist file.; otherwise, provide the path and + * directory where the playlist should be located (e.g. e:\playlists\). + * In the later case, playlist will be created in the collection + * as a virtual playlist and URI will be generated. If client is + * interested in this generated URI, client can perform a search + * based on the returned Id. Only supporting local path, i.e. path + * must starts with a drive letter. + * + * KMPXMediaGeneralTitle: + * Title of the playlist is NOT enforced be unique within the + * music collection. + * + * KMPXMediaArrayCount: + * KMPXMediaArrayContents: + * This playlist can be an empty playlist. If this is the case, + * KMPXMediaArrayContents will be a CMPXMediaArray that doesn't + * contain any media and KMPXMediaArrayCount will be 0. + * + * Each CMPXMedia contained in the media array represents + * a song. Each song must contain the following attributes: + * KMPXMediaGeneralType: + * must be EMPXItem + * + * KMPXMediaGeneralCategory: + * must be EMPXSong + * + * For songs that already exist in the collection, client + * must provide either KMPXMediaGeneralId or KMPXMediaGeneralUri. + * + * For songs that do not exist in the collection, client + * must provide KMPXMediaGeneralUri and its metadata. + * These songs will be added to the music collection when + * the playlist is added. These songs added to the collection + * are NOT registered with Harvester; hence, during next + * scan/refresh, these songs will be scanned and updated in + * the collection unnecessarily and cause scan/refresh + * performance degradation. If any metadata of these songs is + * changed in the collection before next scan/refresh, it will + * be lost after scan/refresh. + * + * WARNING: + * Client must add the songs to the collection prior to adding + * the playlist. + * + * WARNING: + * This playlist is NOT registered with Harvester. If client + * creates a physical playlist file, Harvester will re-parse + * and update the playlist in the collection during the next + * scan/refresh unnecessarily and cause scan/refresh performance + * degradation. If this playlist is edited, the physical + * playlist file is NOT updated to reflect the changes. + * + * This API does not support adding songs to a saved playlist. + * + */ + void AddL( CMPXMedia* aMedia ); + + /** + * Remove a song or a playlist from the collection. The correlating + * file is not removed from the file system but this file is + * de-registered with Harvester; hence, if the file isn't deleted + * from the file system before the next scan/refresh, it will be + * added back to the collection when scan/refresh is performed. + * + * This API implementation is dedicated to MTP. Records in the + * collection will be deleted instead of being marked as deleted. + * + * @param aFile, file to remove. + * @param aItemCat, category of the media to be removed. Either + * EMPXSong or EMPXPlaylist. Other categories, e.g. EMPXArtist, + * EMPXAlbum, EMPXGenre, and EMPXComposer cannot be removed + * from the collection with this method, they need to be removed + * from the collection via collection path. + */ + void RemoveL( const TDesC& aFile, TMPXGeneralCategory aItemCat = EMPXSong ); //lint !e1735 + + /** + * Delete all records that have been marked as deleted. + * + * This API implementation is dedicated to MTP. + */ + void CleanupDeletedMediasL(); + + /** + * Add an updated song or playlist to the cache. This method will leave if + * failed to add it to the cache. If this song or playlist fails to + * be updated in the collection when the cache is committed, client is + * NOT notified. Failure to provide the required attributes will + * result in such a failure. + * + * For performance consideration, it is recommended that client only + * sets the attribute that needs to be updated. + * + * @param aMedia, media to be updated. + * + * To update a song in the collection, the media provided MUST + * contain the following attributes: + * KMPXMediaGeneralType: + * must be EMPXItem + * + * KMPXMediaGeneralCategory: + * must be EMPXSong + * + * KMPXMediaGeneralUri: + * full path of the song. Only supporting local path, + * i.e. path must starts with a drive letter. + * + * Additionally, this media should provide one or more of the + * following attributes for update: + * KMPXMediaGeneralTitle + * KMPXMediaGeneralComment + * KMPXMediaGeneralSynchronized + * KMPXMediaGeneralDeleted + * KMPXMediaGeneralModified + * KMPXMediaGeneralCopyright + * KMPXMediaGeneralDuration + * KMPXMediaGeneralFlags + * KMPXMediaGeneralPlayCount + * KMPXMediaGeneralLastPlaybackTime + * KMPXMediaIdMusic: + * KMPXMediaMusicArtist + * KMPXMediaMusicAlbum + * KMPXMediaMusicAlbumTrack + * KMPXMediaMusicGenre + * KMPXMediaMusicComposer + * KMPXMediaMusicYear + * KMPXMediaMusicRating + * KMPXMediaMusicAlbumArtFileName + * KMPXMediaMusicURL + * KMPXMediaIdAudio: + * KMPXMediaAudioSamplerate + * KMPXMediaAudioBitrate + * KMPXMediaAudioNumberOfChannels + * KMPXMediaIdDrm: + * KMPXMediaDrmType + * KMPXMediaIdMTP: + * KMPXMediaMTPDrmStatus + * + * To update a playlist in the collection, the media provided MUST + * contain the following attributes: + * KMPXMediaGeneralType: + * must be EMPXItem + * + * KMPXMediaGeneralCategory: + * must be EMPXPlaylist + * + * KMPXMediaGeneralUri: + * full path of the playlist. Only supporting local path, + * i.e. path must starts with a drive letter. + * + * If the media contains KMPXMediaArrayContents attribute, the + * content of the playlist will be overwritten with the new media + * array. If this attribute contains a CMPXMediaArray of 0 element, + * all songs in this playlist will be removed from the playlist + * (songs will remain in the collection and file system). + * e.g. + * 1) "Playlist" originally contains "Song1", "Song2", and "Song3". + * If KMPXMediaArrayContents contains a CMPXMediaArray that + * contains "Song3" and "Song4", "Playlist" will be updated to + * contain "Song3" and "Song4". + * 2) "Playlist" originally contains "Song1", "Song2", and "Song3". + * If KMPXMediaArrayContents contains a CMPXMediaArray that + * contains 0 element, "Playlist" will be updated so that it + * doesn't contain any songs. "Song1", "Song2", and "Song3" + * will remain in the collection. + * + * If the media contains any of the following attributes, the + * playlist will be updated accordingly: + * KMPXMediaGeneralTitle + * KMPXMediaGeneralSynchronized + * KMPXMediaGeneralDeleted (DEPRECATED) + * KMPXMediaGeneralModified (DEPRECATED) + * + * NOTE: If a client wishes to change the playlist title and modify + * its contents (i.e. the songs it includes), client needs to + * perform two separate SetL operations; one to update the + * playlist title providing KMPXMediaGeneralTitle attribute + * and the other to update its contents by providing + * KMPXMediaArrayContents. + * + */ + void SetL( CMPXMedia*& aMedia ); + + /** + * Changes the URI of a song or a playlist. + * + * @param aOldUri exiting URI of the song or playlist + * @param aNewUri of the song or playlist + * + * If a client requests the URI of a song to be changed, the corresponding + * song file will NOT be moved to the new location. Harvester's file registration + * will be updated, as well as the collection. Client MUST ensure that there + * is not already a file at the specified new location in the file system + * (Same restrictions as RFs::Rename) and the collection. + * + * WARNING: For virtual playlists (i.e. playlists created from the device. + * They are referred to as virtual because there is no physical + * playlist file created), client MUST ensure the new URI doesn't + * clash with any existing playlist in the collection, as well as + * in the file system. Changing their filenames is NOT recommended. + * If a client wishes to change the extension of the virtual playlist, + * it's recommended the extension is changed to an extension that's + * not supported by any playlist plugin exists in the system. + * + * Upon successful completion of this operation, the Id of the song/playlist + * will be changed in the collection. If client is interested in the Id of + * this media hereafter, GetL or FindAllL can be performed (search by new URI). + * + * @param aItemCat category of the file, either EMPXSong or EMPXPlaylist; + * otherwise, this method leaves with KErrArgument if the media + * isn't currently in the cache. If the media is currently in the + * cache, the media will fail to be added/updated in the collection + * and client is NOT notified. + */ + void RenameL( const TDesC& aOldUri, + const TDesC& aNewUri, + TMPXGeneralCategory aItemCat ); + + /** + * Gets the media for the song or playlist via its URI + * + * WARNING: Subsequent calls to this method will void the + * returned object reference. For example, client + * should avoid the following: + * CMPXMedia& song1 = GetL(***); + * CMPXMedia& song2 = GetL(***); + * song1.IsSupported(***); + * song2.IsSupported(***); + * + * @param aFile, path of the song/playlist + * + * @param aItemCat category of the file, either EMPXSong or + * EMPXPlaylist; otherwise, this method leaves with + * KErrArgument. + * + * @return media object representing the given file with + * the following attributes: + * KMPXMediaGeneralTitle + * KMPXMediaGeneralDate + * KMPXMediaGeneralDuration + * KMPXMediaGeneralComment + * KMPXMediaMusicArtist + * KMPXMediaMusicAlbum + * KMPXMediaMusicAlbumTrack + * KMPXMediaMusicComposer + * KMPXMediaMusicYear + * KMPXMediaMusicGenre + * KMPXMediaMTPDrmStatus + * KMPXMediaAudioNumberOfChannels + * KMPXMediaAudioBitrate + * KMPXMediaAudioSamplerate + * KMPXMediaAudioAudioCodec + * + * Note that the playlist media object does not + * contain songs included in the playlist. If client + * is interested in finding the songs in the playlist, + * FindAllL can be used (please see #2 in FindAllL). + */ + const CMPXMedia& GetL( const TDesC& aFile, + TMPXGeneralCategory aItemCat ); + + /** + * Find media(s) in music collection. + * + * @param aCriteria, criteria to search upon + * + * 1) To find all songs in the collection, here are the mandatory attributes: + * KMPXMediaGeneralType: + * must be EMPXGroup + * + * KMPXMediaGeneralCategory: + * must be EMPXSong + * + * If the following optional attributes are provided, the search results + * are narrowed down further: (these attributes can be combined) + * KMPXMediaGeneralTitle + * ==> songs with the specified title + * KMPXMediaGeneralDrive + * ==> songs in the specified drive + * KMPXMediaGeneralSynchronized + * ==> songs that are/are not synchronized through MTP + * KMPXMediaGeneralDeleted + * ==> songs that are/are not marked as deleted since the last MTP + * session + * KMPXMediaGeneralModified + * ==> songs that are/are not modified since the last MTP session + * + * 2) To find all songs for a particular artist/album/genre/composer/playlist + * in the collection, here are the mandatory attributes: + * KMPXMediaGeneralType: + * must be EMPXGroup + * + * KMPXMediaGeneralCategory: + * must be EMPXSong + * + * KMPXMediaIdGeneralId: + * the Id of the artist/album/genre/composer/playlist + * + * NOTE: Songs in an album are sorted by album track, then title, except + * for songs in the unknown album. Songs in the unknown album are + * sorted by title. + * + * 3) To find all songs for a particular album of an artist in the collection, + * here are the mandatory attributes: + * KMPXMediaGeneralType: + * must be EMPXGroup + * + * KMPXMediaGeneralCategory: + * must be EMPXSong + * + * KMPXMediaIdGeneralId: + * the Id of the album + * + * KMPXMediaGeneralContainerId: + * the Id of the artist + * + * NOTE: These songs are sorted by album track, then title, except + * for songs in the unknown album. Songs in the unknown album are + * sorted by title. + * + * 4)To find a particular song, here are the mandatory attributes: + * KMPXMediaGeneralType: + * must be EMPXItem + * + * KMPXMediaGeneralCategory: + * must be EMPXSong + * + * And one or all of the following attributes: + * KMPXMediaGeneralUri + * KPXMediaIdGeneralId + * + * 5) To find all artists/albums/genres/composers/playlists in the + * collection, here are the mandatory attributes: + * KMPXMediaGeneralType: + * must be EMPXGroup + * + * KMPXMediaGeneralCategory: + * must be EMPXArtist for artists + * EMPXAlbum for albums + * EMPXGenre for genres + * EMPXComposer for composers + * EMPXPlaylist for playlists + * + * If the following optional attributes are provided for playlists, + * the search results are narrowed down further: (these attributes + * can be combined) + * KMPXMediaGeneralDrive + * ==> playlists in the specified drive + * KMPXMediaGeneralSynchronized + * ==> playlists that are/are not synchronized through MTP + * KMPXMediaGeneralDeleted (DEPRECATED) + * ==> playlists that are/are not marked as deleted since the last MTP + * session + * KMPXMediaGeneralModified (DEPRECATED) + * ==> playlists that are/are not modified since the last MTP session + * + * NOTE: results returned do not contain songs included in + * the category. To obtain songs included in the category, + * please refer to 2 and/or 3. + * + * 6) To find a particular playlist in the collection, here are the mandatory + * attributes: + * KMPXMediaGeneralType: + * must be EMPXItem + * + * KMPXMediaGeneralCategory: + * must be EMPXPlaylist + * + * And one or all of the following attributes: + * KMPXMediaGeneralUri + * KMPXMediaGeneralTitle + * KMPXMediaIdGeneralId + * + * NOTE: results returned do not contain songs included in the playlist. + * To obtain songs included in the playlist, please refer to 2. + * + * 7) To find a particular artist/album/genre/composer in the collection, here + * are the mandatory attributes: + * KMPXMediaGeneralType: + * must be EMPXItem + * + * KMPXMediaGeneralCategory: + * must be EMPXArtist for artist + * EMPXAlbum for album + * EMPXGenre for genre + * EMPXComposer for composer + * + * And one or all of the following attributes: + * KMPXMediaGeneralTitle + * KMPXMediaIdGeneralId + * + * NOTE: + * a) results returned do not contain songs included in the category. + * To obtain songs included in the category, please refer to 2. + * b) unknown artist/album/genre/composer will be the last item in + * the result array + * + * @param aAttrs, attributes to return + * Supported attributes for songs are: + * KMPXMediaIdGeneral: + * KMPXMediaGeneralId + * KMPXMediaGeneralTitle + * KMPXMediaGeneralUri + * KMPXMediaGeneralDrive + * KMPXMediaGeneralDuration + * KMPXMediaGeneralDate + * KMPXMediaGeneralComment + * KMPXMediaGeneralMimeType + * KMPXMediaGeneralSynchronized + * KMPXMediaGeneralDeleted + * KMPXMediaGeneralModified + * KMPXMediaGeneralCopyright + * KMPXMediaGeneralFlags + * KMPXMediaGeneralPlayCount + * KMPXMediaGeneralLastPlaybackTime + * KMPXMediaIdMusic: + * KMPXMediaMusicArtist + * KMPXMediaMusicAlbum + * KMPXMediaMusicAlbumTrack + * KMPXMediaMusicGenre + * KMPXMediaMusicComposer + * KMPXMediaMusicYear + * KMPXMediaMusicRating + * KMPXMediaMusicAlbumArtFileName + * KMPXMediaMusicURL + * KMPXMediaIdAudio: + * KMPXMediaAudioSamplerate + * KMPXMediaAudioBitrate + * KMPXMediaAudioNumberOfChannels + * KMPXMediaAudioCodec + * KMPXMediaIdMTP: + * KMPXMediaMTPDrmStatus + * + * Supported attributes for playlists are: + * KMPXMediaIdGeneral: + * KMPXMediaGeneralId + * KMPXMediaGeneralCollectionId + * KMPXMediaGeneralTitle + * KMPXMediaGeneralUri + * KMPXMediaGeneralDrive + * KMPXMediaGeneralSynchronized + * KMPXMediaGeneralDeleted (DEPRECATED) + * KMPXMediaGeneralModified (DEPRECATED) + * KMPXMediaGeneralFlags + * KMPXMediaGeneralCount + * KMPXMediaGeneralDate + * + * Supported attributes for artists/albums/genres/composers are: + * KMPXMediaIdGeneral: + * KMPXMediaGeneralId + * KMPXMediaGeneralTitle + * + * @return search results. The returned media contains the following + * attributes: + * KMPXMediaGeneralType: + * EMPXGroup + * + * KMPXMediaGeneralCategory: + * the category of the found media(s), e.g. EMPXSong for + * scenarios 1-4. + * + * KMPXMediaArrayCount: + * the number of matching media(s). 0 if no match found. + * + * KMPXMediaArrayContents: + * this array contains the found media(s). If client + * was looking for songs, each media in the array + * represents a song, similarly for artists, albums, genres, + * composers, and playlists. Each media contains + * KMPXMediaGeneralType: + * EMPXItem + * KMPXMediaGeneralCategory: + * category of the found media + * + * The rest of the attributes returned are as specified + * by the aAttrs parameter. + */ + CMPXMedia* FindAllL( CMPXMedia& aCriteria, + const TArray& aAttrs ); + + /** + * Frees this object + */ + void Close(); + +protected: + + /** + * Commits the transactions still left in the caching array + */ + void Commit(); + +private: + + /** + * Appends General Media Type information + * @param aSrc source media to copy attributes from + * @param aDestination destination media to copt attributes to + */ + void DoAppendGeneralL( CMPXMedia& aSrc, CMPXMedia& aDestination ); + + /** + * Appends Music Type information + * @param aSrc source media to copy attributes from + * @param aDestination destination media to copt attributes to + */ + void DoAppendMusicL( CMPXMedia& aSrc, CMPXMedia& aDestination ); + + /** + * Appends Audio Type information + * @param aSrc source media to copy attributes from + * @param aDestination destination media to copt attributes to + */ + void DoAppendAudioL( CMPXMedia& aSrc, CMPXMedia& aDestination ); + + /** + * Appends DRM Type information + * @param aSrc source media to copy attributes from + * @param aDestination destination media to copt attributes to + */ + void DoAppendDRML( CMPXMedia& aSrc, CMPXMedia& aDestination ); + + /** + * Appends array information + * @param aSrc source media to copy attributes from + * @param aDestination destination media to copt attributes to + */ + void DoAppendContainerL( CMPXMedia& aSrc, CMPXMedia& aDestination ); + + /** + * Appends MTP information + * @param aSrc source media to copy attributes from + * @param aDestination destination media to copt attributes to + */ + void DoAppendMTPL( CMPXMedia& aSrc, CMPXMedia& aDestination ); + +#ifdef RD_MPX_COLLECTION_CACHE + + /* + * Gets the media for the song or playlist via its URI + * Note. This is used in conjunction with exported GetL + * This method does not perform cache capability but only returns + * the media object requested. + * + * @param aFile, path of the song/playlist + * + * @param aItemCat category of the file, either EMPXSong or + * EMPXPlaylist; otherwise, this method leaves with + * KErrArgument. + * + * @return void + * the result of iFoundMedia media object representing the given file with + * the following attributes: + * KMPXMediaGeneralTitle + * KMPXMediaGeneralDate + * KMPXMediaGeneralDuration + * KMPXMediaGeneralComment + * KMPXMediaMusicArtist + * KMPXMediaMusicAlbum + * KMPXMediaMusicAlbumTrack + * KMPXMediaMusicComposer + * KMPXMediaMusicYear + * KMPXMediaMusicGenre + * KMPXMediaMTPDrmStatus + * KMPXMediaAudioNumberOfChannels + * KMPXMediaAudioBitrate + * KMPXMediaAudioSamplerate + */ + void GetSongL( const TDesC& aFile, TMPXGeneralCategory aItemCat, TUid aCollectionUId ); + + /* + * Gets the artist id of the media object inthe currect context (result of GetL()) + * + * @param aCollectionUid TUid + * + * @return void + * the result of iFoundMedia media object representing the given file with + */ + TMPXItemId GetArtistIdL( const TDesC& aArtist, TUid aCollectionUId ); + + + /* + * Gets all the songs that are belongs to the same artist id supplied + * + * @param id TMPXItemId indicates the id for requesting artist + * @param aCollectionUid TUid + * @param aUnknownArtist TBool indicates if this is for unknown artist or not + * + * @return void + * the result of iCachedArtistArray media object + */ + void GetSongsL( TMPXItemId id, TUid aCollectionUId, TBool aUnknownArtist ); + +#endif //RD_MPX_COLLECTION_CACHE + + +private: + + enum TCachedOp + { + EAdd, + ESet + }; + +private: + + CMPXCollectionCachedHelper(); + + void ConstructL(); + +private: // data + + CMPXMedia* iFoundMedia; + CMPXMediaArray* iCache; + RArray iOp; +#ifdef RD_MPX_COLLECTION_CACHE + CMPXMediaArray* iCachedArtistArray; + CMPXMediaArray* iCachedUnknownArtistArray; + TBool iNotInCache; + TInt iHitFoundMedia; + TInt iNotHitInCache; + TInt iLookingInCache; + TInt iLookingInUnknowCache; +#endif //RD_MPX_COLLECTION_CACHE + CMPXMetadataExtractor* iMetadataExtractor; + RFs iFs; + RApaLsSession iAppArc; + RPointerArray iSupportedTypes; + }; + +#endif // C_MPXCOLLECTIONCACHEDHELPER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/collectionhelper/inc/mpxcollectionhelpercommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/collectionhelper/inc/mpxcollectionhelpercommon.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2006 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 functions for the collection helper +* +*/ + + +#ifndef CMPXCOLLECTIONHELPERCOMMON_H +#define CMPXCOLLECTIONHELPERCOMMON_H + +/** +* Initialize collection plugins +* @param aCollectionUtil interface to initialize plugins +*/ +void InitializeCollectionPluginsL( MMPXCollectionUtility& aCollectionUtil ); + +#endif // CMPXCOLLECTIONHELPERCOMMON_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/collectionhelper/inc/mpxcollectionhelperimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/collectionhelper/inc/mpxcollectionhelperimp.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,729 @@ +/* +* Copyright (c) 2006 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: Collection helper implementation +* +*/ + + +#ifndef CMPXCOLLECTIONHELPERIMP_H +#define CMPXCOLLECTIONHELPERIMP_H + +#include "mpxcollectionhelper.h" +#include "mpxharvesterutilityobserver.h" +#include "mpxmediatorobserver.h" + +// FOWARD DECLARATION +class MMPXHarvesterUtility; +class MMPXCollectionUtility; +class CMPXCollectionPath; +class CMPXMedia; +class CMPXCollectionMediator; + +/** + * CMPXCollectionHelperImp + * + * Wrapper implementation around collection utility + * + * @lib mpxcollectionhelper.lib + * @since S60 3.1 + */ +NONSHARABLE_CLASS( CMPXCollectionHelperImp ): public CBase, + public MMPXCollectionHelper, + public MMPXHarvesterUtilityObserver, + public MMPXMediatorObserver + { +public: + + /** + * Two phased constructor + */ + static CMPXCollectionHelperImp* NewL(); + + /** + * Two phased constructor + */ + static CMPXCollectionHelperImp* NewLC(); + + /** + * Virtual destructor + */ + virtual ~CMPXCollectionHelperImp(); + +protected: // From MMPXCollectionHelper + + /** + * Asynchronously adds supported song file or a playlist file to the + * collection and registers it with Harvester so it won't be re-parsed + * unnecessarily during next scan/refresh. + * + * For a song file, its metadata will be extracted stored in the collection. + * + * For a playlist file, it will be parsed and added to the collection. If + * the playlist refers to songs that already exist in the collection, any + * song metadata provided in the playlist file will be ignored. If the + * playlist refers to songs that do not exist in the collection, they + * will be added to the collection with the metadata provided in the + * playlist file, if any. However, these songs are NOT registered with + * Harvester; hence, during next scan/refresh, these songs will be scanned + * and updated in the collection unnecessarily and cause scan/refresh + * performance degradation. If any metadata of these songs is changed in + * the collection before next scan/refresh, it will be lost after + * scan/refresh. + * + * WARNING: + * Client must add the songs to the collection prior to adding the + * playlist. + * + * @param aFile, full path and name of the file which is a supported media + * type. KErrNotSupported if file type is not supported. + * + * @aObserver observer for the callback, HandleAddFileCompleteL. If NULL, + * no callback is issued. + * + * If client is interested in the id of the song/playlist added, client + * can retrieve it via GetL or FindAllL. + */ + void AddL( const TDesC& aFile, MMPXCollectionHelperObserver* aObserver ); + + /** + * Add a song or a playlist synchronously + * + * @param aMedia, media to be added. + * + * To add a song to the collection, the media provided MUST + * contain the following attributes: + * KMPXMediaGeneralType: + * must be EMPXItem + * + * KMPXMediaGeneralCategory: + * must be EMPXSong + * + * KMPXMediaGeneralUri: + * full path of the song. Only supporting local path, i.e. path + * must starts with a drive letter. + * + * Client must provide the metadata by filling other attributes. This + * song will be registered with Harvester so that it will not be + * unnecessarily scanned during the next scan/refresh. + * + * To add a playlist to the collection, the media provided MUST + * contain the following attributes: + * KMPXMediaGeneralType: + * must be EMPXItem + * + * KMPXMediaGeneralCategory: + * must be EMPXPlaylist + * + * KMPXMediaGeneralUri: + * Provide full path of the playlist if there is an associated + * physical playlist file.; otherwise, provide the path and + * directory where the playlist should be located (e.g. e:\playlists\). + * In the later case, playlist will be created in the collection + * as a virtual playlist and URI will be generated. If client is + * interested in this generated URI, client can perform a search + * based on the returned Id. Only supporting local path, i.e. path + * must starts with a drive letter. + * + * KMPXMediaGeneralTitle: + * Title of the playlist is NOT enforced be unique within the + * music collection. + * + * KMPXMediaArrayCount: + * KMPXMediaArrayContents: + * This playlist can be an empty playlist. If this is the case, + * KMPXMediaArrayContents will be a CMPXMediaArray that doesn't + * contain any media and KMPXMediaArrayCount will be 0. + * + * Each CMPXMedia contained in the media array represents + * a song. Each song must contain the following attributes: + * KMPXMediaGeneralType: + * must be EMPXItem + * + * KMPXMediaGeneralCategory: + * must be EMPXSong + * + * For songs that already exist in the collection, client + * must provide either KMPXMediaGeneralId or KMPXMediaGeneralUri. + * + * For songs that do not exist in the collection, client + * must provide KMPXMediaGeneralUri and its metadata. + * These songs will be added to the music collection when + * the playlist is added. These songs added to the collection + * are NOT registered with Harvester; hence, during next + * scan/refresh, these songs will be scanned and updated in + * the collection unnecessarily and cause scan/refresh + * performance degradation. If any metadata of these songs is + * changed in the collection before next scan/refresh, it will + * be lost after scan/refresh. + * + * WARNING: + * Client must add the songs to the collection prior to adding + * the playlist. + * + * WARNING: + * This playlist is NOT registered with Harvester. If client + * creates a physical playlist file, Harvester will re-parse + * and update the playlist in the collection during the next + * scan/refresh unnecessarily and cause scan/refresh performance + * degradation. If this playlist is edited, the physical + * playlist file is NOT updated to reflect the changes. + * + * This API does not support adding songs to a saved playlist. + * + * This method will leave with KErrArgument if any mandatory + * is missing. + * + * If client is interested in the id of the song/playlist added, + * client can retrieve it via this aMedia upon return of this + * method. e.g. + * + * TMPXItemId mediaId = aMedia->ValueTObjectL(KMPXMediaGeneralId); + */ + void AddL( CMPXMedia* aMedia ); + + /** + * Remove a song or a playlist from the collection. The correlating + * file is not removed from the file system but this file is + * de-registered with Harvester; hence, if the file isn't deleted + * from the file system before the next scan/refresh, it will be + * added back to the collection when scan/refresh is performed. + * + * @param aFile, file to remove. + * @param aItemCat, category of the media to be removed. Either + * EMPXSong or EMPXPlaylist. Other categories, e.g. EMPXArtist, + * EMPXAlbum, EMPXGenre, and EMPXComposer cannot be removed + * from the collection with this method, they need to be removed + * from the collection via collection path. + */ + void RemoveL( const TDesC& aFile, TMPXGeneralCategory aItemCat = EMPXSong ); //lint !e1735 + + /** + * Remove all medias from the music collection regardless which drive + * the medias are located and clear harvester's file registry. If the + * media correlates to a file, the correlating file is not deleted from + * the file system. If the file still exist during the next scan/refresh, + * it will be added back to the collection. + * + * + */ + void RemoveAllL(); + + /** + * Delete all records that have been marked as deleted. + * + * This API is dedicated to MTP and will leave with KErrNotSupported for + * this implementation. + */ + void CleanupDeletedMediasL(); + + /** + * Updates a media in the collection synchronously. For performance + * consideration, it is recommended that client only sets the attribute + * that needs to be updated. + * + * @param aMedia, media to be updated. + * + * To update a song in the collection, the media provided MUST + * contain the following attributes: + * KMPXMediaGeneralType: + * must be EMPXItem + * + * KMPXMediaGeneralCategory: + * must be EMPXSong + * + * KMPXMediaGeneralUri: + * full path of the song. Only supporting local path, + * i.e. path must starts with a drive letter. + * + * Additionally, this media should provide one or more of the + * following attributes for update: + * KMPXMediaGeneralTitle + * KMPXMediaGeneralComment + * KMPXMediaGeneralSynchronized + * KMPXMediaGeneralDeleted + * KMPXMediaGeneralModified + * KMPXMediaGeneralCopyright + * KMPXMediaGeneralDuration + * KMPXMediaGeneralFlags + * KMPXMediaGeneralPlayCount + * KMPXMediaGeneralLastPlaybackTime + * KMPXMediaIdMusic: + * KMPXMediaMusicArtist + * KMPXMediaMusicAlbum + * KMPXMediaMusicAlbumTrack + * KMPXMediaMusicGenre + * KMPXMediaMusicComposer + * KMPXMediaMusicYear + * KMPXMediaMusicRating + * KMPXMediaMusicAlbumArtFileName + * KMPXMediaMusicURL + * KMPXMediaIdAudio: + * KMPXMediaAudioSamplerate + * KMPXMediaAudioBitrate + * KMPXMediaAudioNumberOfChannels + * KMPXMediaIdDrm: + * KMPXMediaDrmType + * KMPXMediaIdMTP: + * KMPXMediaMTPDrmStatus + * + * To update a playlist in the collection, the media provided MUST + * contain the following attributes: + * KMPXMediaGeneralType: + * must be EMPXItem + * + * KMPXMediaGeneralCategory: + * must be EMPXPlaylist + * + * KMPXMediaGeneralUri: + * full path of the playlist. Only supporting local path, + * i.e. path must starts with a drive letter. + * + * If the media contains KMPXMediaArrayContents attribute, the + * content of the playlist will be overwritten with the new media + * array. If this attribute contains a CMPXMediaArray of 0 element, + * all songs in this playlist will be removed from the playlist + * (songs will remain in the collection and file system). + * e.g. + * 1) "Playlist" originally contains "Song1", "Song2", and "Song3". + * If KMPXMediaArrayContents contains a CMPXMediaArray that + * contains "Song3" and "Song4", "Playlist" will be updated to + * contain "Song3" and "Song4". + * 2) "Playlist" originally contains "Song1", "Song2", and "Song3". + * If KMPXMediaArrayContents contains a CMPXMediaArray that + * contains 0 element, "Playlist" will be updated so that it + * doesn't contain any songs. "Song1", "Song2", and "Song3" + * will remain in the collection. + * + * If the media contains any of the following attributes, the + * playlist will be updated accordingly: + * KMPXMediaGeneralTitle + * KMPXMediaGeneralSynchronized + * KMPXMediaGeneralDeleted (DEPRECATED) + * KMPXMediaGeneralModified (DEPRECATED) + * + * NOTE: If a client wishes to change the playlist title and modify + * its contents (i.e. the songs it includes), client needs to + * perform two separate SetL operations; one to update the + * playlist title providing KMPXMediaGeneralTitle attribute + * and the other to update its contents by providing + * KMPXMediaArrayContents. + * + */ + void SetL( CMPXMedia*& aMedia ); + + /** + * Changes the URI of a song or a playlist. + * + * @param aOldUri exiting URI of the song or playlist + * @param aNewUri of the song or playlist + * + * If a client requests the URI of a song to be changed, the corresponding + * song file will NOT be moved to the new location. Harvester's file registration + * will be updated, as well as the collection. Client MUST ensure that there + * is not already a file at the specified new location in the file system + * (Same restrictions as RFs::Rename) and the collection. + * + * WARNING: For virtual playlists (i.e. playlists created from the device. + * They are referred to as virtual because there is no physical + * playlist file created), client MUST ensure the new URI doesn't + * clash with any existing playlist in the collection, as well as + * in the file system. Changing their filenames is NOT recommended. + * If a client wishes to change the extension of the virtual playlist, + * it's recommended the extension is changed to an extension that's + * not supported by any playlist plugin exists in the system. + * + * Upon successful completion of this operation, the Id of the song/playlist + * will be changed in the collection. If client is interested in the Id of + * this media hereafter, GetL or FindAllL can be performed (search by new URI). + * + * @param aItemCat category of the file, either EMPXSong or EMPXPlaylist; + * otherwise, this method leaves with KErrArgument. + */ + void RenameL( const TDesC& aOldUri, + const TDesC& aNewUri, + TMPXGeneralCategory aItemCat ); + + /** + * Gets the media for the song or playlist via its URI + * + * @param aFile, path of the song/playlist + * @param aAttrs, what attributes to get back. + * Supported attributes for songs are: + * KMPXMediaIdGeneral: + * KMPXMediaGeneralId + * KMPXMediaGeneralTitle + * KMPXMediaGeneralUri + * KMPXMediaGeneralDrive + * KMPXMediaGeneralDuration + * KMPXMediaGeneralDate + * KMPXMediaGeneralComment + * KMPXMediaGeneralMimeType + * KMPXMediaGeneralSynchronized + * KMPXMediaGeneralDeleted + * KMPXMediaGeneralModified + * KMPXMediaGeneralCopyright + * KMPXMediaGeneralFlags + * KMPXMediaGeneralPlayCount + * KMPXMediaGeneralLastPlaybackTime + * KMPXMediaIdMusic: + * KMPXMediaMusicArtist + * KMPXMediaMusicAlbum + * KMPXMediaMusicAlbumTrack + * KMPXMediaMusicGenre + * KMPXMediaMusicComposer + * KMPXMediaMusicYear + * KMPXMediaMusicRating + * KMPXMediaMusicAlbumArtFileName + * KMPXMediaMusicURL + * KMPXMediaIdAudio: + * KMPXMediaAudioSamplerate + * KMPXMediaAudioBitrate + * KMPXMediaAudioNumberOfChannels + * KMPXMediaAudioCodec + * KMPXMediaIdMTP: + * KMPXMediaMTPDrmStatus + * + * Supported attributes for playlists are: + * KMPXMediaIdGeneral: + * KMPXMediaGeneralId + * KMPXMediaGeneralCollectionId + * KMPXMediaGeneralTitle + * KMPXMediaGeneralUri + * KMPXMediaGeneralDrive + * KMPXMediaGeneralSynchronized + * KMPXMediaGeneralDeleted (DEPRECATED) + * KMPXMediaGeneralModified (DEPRECATED) + * KMPXMediaGeneralFlags + * KMPXMediaGeneralCount + * KMPXMediaGeneralDate + * + * @param aItemCat category of the file, either EMPXSong or + * EMPXPlaylist; otherwise, this method leaves with + * KErrArgument. + * + * @return media object representing the given file with + * the requested attributes. Note that the playlist + * media object does not contain songs included in + * the playlist. If client is interested in finding + * the songs in the playlist, FindAllL can be used + * (please see #2 in FindAllL). + */ + CMPXMedia* GetL( const TDesC& aFile, + const TArray& aAttrs, + TMPXGeneralCategory aItemCat ); + + /** + * Gets the media for the song or playlist via its URI + * + * This implementation do not support this method. + */ + const CMPXMedia& GetL( const TDesC& aFile, + TMPXGeneralCategory aItemCat ); + + /** + * Find media(s) in music collection. + * + * @param aCriteria, criteria to search upon + * + * 1) To find all songs in the collection, here are the mandatory attributes: + * KMPXMediaGeneralType: + * must be EMPXGroup + * + * KMPXMediaGeneralCategory: + * must be EMPXSong + * + * If the following optional attributes are provided, the search results + * are narrowed down further: (these attributes can be combined) + * KMPXMediaGeneralTitle + * ==> songs with the specified title + * KMPXMediaGeneralDrive + * ==> songs in the specified drive + * KMPXMediaGeneralSynchronized + * ==> songs that are/are not synchronized through MTP + * KMPXMediaGeneralDeleted + * ==> songs that are/are not marked as deleted since the last MTP + * session + * KMPXMediaGeneralModified + * ==> songs that are/are not modified since the last MTP session + * + * 2) To find all songs for a particular artist/album/genre/composer/playlist + * in the collection, here are the mandatory attributes: + * KMPXMediaGeneralType: + * must be EMPXGroup + * + * KMPXMediaGeneralCategory: + * must be EMPXSong + * + * KMPXMediaIdGeneralId: + * the Id of the artist/album/genre/composer/playlist + * + * NOTE: Songs in an album are sorted by album track, then title, except + * for songs in the unknown album. Songs in the unknown album are + * sorted by title. + * + * 3) To find all songs for a particular album of an artist in the collection, + * here are the mandatory attributes: + * KMPXMediaGeneralType: + * must be EMPXGroup + * + * KMPXMediaGeneralCategory: + * must be EMPXSong + * + * KMPXMediaIdGeneralId: + * the Id of the album + * + * KMPXMediaGeneralContainerId: + * the Id of the artist + * + * NOTE: These songs are sorted by album track, then title, except + * for songs in the unknown album. Songs in the unknown album are + * sorted by title. + * + * 4)To find a particular song, here are the mandatory attributes: + * KMPXMediaGeneralType: + * must be EMPXItem + * + * KMPXMediaGeneralCategory: + * must be EMPXSong + * + * And one or all of the following attributes: + * KMPXMediaGeneralUri + * KPXMediaIdGeneralId + * + * 5) To find all artists/albums/genres/composers/playlists in the + * collection, here are the mandatory attributes: + * KMPXMediaGeneralType: + * must be EMPXGroup + * + * KMPXMediaGeneralCategory: + * must be EMPXArtist for artists + * EMPXAlbum for albums + * EMPXGenre for genres + * EMPXComposer for composers + * EMPXPlaylist for playlists + * + * If the following optional attributes are provided for playlists, + * the search results are narrowed down further: (these attributes + * can be combined) + * KMPXMediaGeneralDrive + * ==> playlists in the specified drive + * KMPXMediaGeneralSynchronized + * ==> playlists that are/are not synchronized through MTP + * KMPXMediaGeneralDeleted (DEPRECATED) + * ==> playlists that are/are not marked as deleted since the last MTP + * session + * KMPXMediaGeneralModified (DEPRECATED) + * ==> playlists that are/are not modified since the last MTP session + * + * NOTE: results returned do not contain songs included in + * the category. To obtain songs included in the category, + * please refer to 2 and/or 3. + * + * 6) To find a particular playlist in the collection, here are the mandatory + * attributes: + * KMPXMediaGeneralType: + * must be EMPXItem + * + * KMPXMediaGeneralCategory: + * must be EMPXPlaylist + * + * And one or all of the following attributes: + * KMPXMediaGeneralUri + * KMPXMediaGeneralTitle + * KMPXMediaIdGeneralId + * + * NOTE: results returned do not contain songs included in the playlist. + * To obtain songs included in the playlist, please refer to 2. + * + * 7) To find a particular artist/album/genre/composer in the collection, here + * are the mandatory attributes: + * KMPXMediaGeneralType: + * must be EMPXItem + * + * KMPXMediaGeneralCategory: + * must be EMPXArtist for artist + * EMPXAlbum for album + * EMPXGenre for genre + * EMPXComposer for composer + * + * And one or all of the following attributes: + * KMPXMediaGeneralTitle + * KMPXMediaIdGeneralId + * + * NOTE: + * a) results returned do not contain songs included in the category. + * To obtain songs included in the category, please refer to 2. + * b) unknown artist/album/genre/composer will be the last item in + * the result array + * + * @param aAttrs, attributes to return + * Supported attributes for songs are: + * KMPXMediaIdGeneral: + * KMPXMediaGeneralId + * KMPXMediaGeneralTitle + * KMPXMediaGeneralUri + * KMPXMediaGeneralDrive + * KMPXMediaGeneralDuration + * KMPXMediaGeneralDate + * KMPXMediaGeneralComment + * KMPXMediaGeneralMimeType + * KMPXMediaGeneralSynchronized + * KMPXMediaGeneralDeleted + * KMPXMediaGeneralModified + * KMPXMediaGeneralCopyright + * KMPXMediaGeneralFlags + * KMPXMediaGeneralPlayCount + * KMPXMediaGeneralLastPlaybackTime + * KMPXMediaIdMusic: + * KMPXMediaMusicArtist + * KMPXMediaMusicAlbum + * KMPXMediaMusicAlbumTrack + * KMPXMediaMusicGenre + * KMPXMediaMusicComposer + * KMPXMediaMusicYear + * KMPXMediaMusicRating + * KMPXMediaMusicAlbumArtFileName + * KMPXMediaMusicURL + * KMPXMediaIdAudio: + * KMPXMediaAudioSamplerate + * KMPXMediaAudioBitrate + * KMPXMediaAudioNumberOfChannels + * KMPXMediaAudioCodec + * KMPXMediaIdMTP: + * KMPXMediaMTPDrmStatus + * + * Supported attributes for playlists are: + * KMPXMediaIdGeneral: + * KMPXMediaGeneralId + * KMPXMediaGeneralCollectionId + * KMPXMediaGeneralTitle + * KMPXMediaGeneralUri + * KMPXMediaGeneralDrive + * KMPXMediaGeneralSynchronized + * KMPXMediaGeneralDeleted (DEPRECATED) + * KMPXMediaGeneralModified (DEPRECATED) + * KMPXMediaGeneralFlags + * KMPXMediaGeneralCount + * KMPXMediaGeneralDate + * + * Supported attributes for artists/albums/genres/composers are: + * KMPXMediaIdGeneral: + * KMPXMediaGeneralId + * KMPXMediaGeneralTitle + * + * @return search results. The returned media contains the following + * attributes: + * KMPXMediaGeneralType: + * EMPXGroup + * + * KMPXMediaGeneralCategory: + * the category of the found media(s), e.g. EMPXSong for + * scenarios 1-4. + * + * KMPXMediaArrayCount: + * the number of matching media(s). 0 if no match found. + * + * KMPXMediaArrayContents: + * this array contains the found media(s). If client + * was looking for songs, each media in the array + * represents a song, similarly for artists, albums, genres, + * composers, and playlists. Each media contains + * KMPXMediaGeneralType: + * EMPXItem + * KMPXMediaGeneralCategory: + * category of the found media + * + * The rest of the attributes returned are as specified + * by the aAttrs parameter. + */ + CMPXMedia* FindAllL( CMPXMedia& aCriteria, + const TArray& aAttrs ); + + /** + * Frees this object + */ + void Close(); + +protected: // From Base Class + + /** + * From MMPXHarvesterUtilityObserver + */ + void HandlePlaylistExportCompletedL( CMPXMedia* aProp, + TInt aErr ); + + /** + * From MMPXHarvesterUtilityObserver + */ + void HandlePlaylistImportCompletedL( CMPXMedia* aProp, + TInt aErr ); + + /** + * From MMPXHarvesterUtilityObserver + */ + void HandleFileAddCompletedL( CMPXMedia* aProp, + TInt aErr ); + + /** + * From MMPXHarvesterUtilityObserver + */ + void HandleDeleteCompletedL( TInt aErr ); + + /** + * From MMPXMediatorObserver + */ + void HandleMediatorPathUpdatedL( CMPXMedia*& aMedia, + TUid aOldPath ); + /** + * From MMPXHarvesterUtilityObserver + */ + void HandleFileImportCompletedL( CMPXMedia* aMedia, TInt aErr ); + + /** + * From MMPXHarvesterUtilityObserver + */ + void HandleFileGetMediaCompletedL( CMPXMedia* aMedia, TInt aErr ); + +private: + + /** + * Adds the file to the collection, constructs the collection path + * @param aMedia media item to add to the collection + */ + void DoAddToCollectionL( CMPXMedia* aMedia ); + +protected: + + /** + * Private Constructor + */ + CMPXCollectionHelperImp(); + + /** + * 2nd Phased constructor + */ + void ConstructL(); + +protected: // data + + MMPXHarvesterUtility* iHvsUtility; + MMPXCollectionUtility* iCollectionUtil; + CMPXCollectionMediator* iMediator; + + MMPXCollectionHelperObserver* iObserver; // not owned + TUid iMusicCollectionId; + TBool iInitialized; + }; + +#endif // CMPXCOLLECTIONHELPERIMP_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/collectionhelper/inc/mpxcollectionuihelperimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/collectionhelper/inc/mpxcollectionuihelperimp.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,853 @@ +/* +* Copyright (c) 2006 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: Collection Ui helper implementation +* +*/ + + +#ifndef CMPX_COLLECTION_UI_HELPER_H +#define CMPX_COLLECTION_UI_HELPER_H + +#include +#include +#include +#include +#include "mpxcollectionuihelper.h" +#include "mpxmediatorobserver.h" +#include "mpxmoveobserver.h" +#include "mpxharvesterutilityobserver.h" + +// FOWARD DECLARATION +class MMPXCollectionUtility; +class CMPXCollectionMediator; +class MMPXHarvesterUtility; +class CMPXMedia; +class TMPXCollectionMessage; +class CMPXActiveTaskQueue; +class CMPXDeleteHelper; + +/** + * CMPXCollectionUiHelper + * + * Implementation of the collection ui helper interface + * for system specific changes + * + * @lib collectionhelper.lib + * @since S60 3.0 + */ +NONSHARABLE_CLASS( CMPXCollectionUiHelperImp ): public CBase, + public MMPXCollectionUiHelper, + public MMPXMediatorObserver, + public MMPXHarvesterUtilityObserver, + public MMPXCollectionObserver, + public MMPXTaskQueueObserver, + public MMPXMoveItemObserver, + public MMPXCHelperObserver + + { +public: + + /** + * Standard 2-phased constructor + * @param aModeId collection mode id. see mpxcollectionutility.h + * for details. + * @return new instance of the collection ui helper + */ + static CMPXCollectionUiHelperImp* NewL(const TUid& aModeId); + + /** + * Standard 2-phased constructor + * @param aModeId collection mode id. see mpxcollectionutility.h + * for details. + * @return new instance of the collection ui helper + */ + static CMPXCollectionUiHelperImp* NewLC(const TUid& aModeId); + + /** + * Virtual Destructor + */ + virtual ~CMPXCollectionUiHelperImp(); + +protected: + + /** + * From MMPXCollectionUiHelper + * + * This is an async call to create a playlist or add songs to + * a saved playlist. In the case of creating a new playlist, + * no physical playlist files will be created. This type of + * playlists is referred to as virtual playlists. In the case + * of adding songs to a saved playlist, if the playlist + * corresponds to a playlist file, the playlist file is NOT + * updated. + * + * Upon completion of this request, HandleAddCompletedL is called. + * + * To add a playlist to the collection, the media provided MUST + * contain the following attributes: + * KMPXMediaGeneralType: + * must be EMPXItem + * + * KMPXMediaGeneralCategory: + * must be EMPXPlaylist + * + * KMPXMediaGeneralUri: + * This is the path where the playlist should be located. + * e.g. c:\data\playlists\ or e:\playlists\. When the playlist + * is successfully added to the collection, its URI will be + * generated. If client is interested its URI, client can + * perform a search based on the returned Id of the playlist. + * Currently only supporting local path, i.e. the path provided + * must contain starts with a drive letter. + * + * KMPXMediaGeneralTitle: + * Title of the playlist is NOT enforced be unique within the + * music collection. + * + * KMPXMediaArrayCount: + * KMPXMediaArrayContents: + * This playlist can be an empty playlist. If this is the case, + * KMPXMediaArrayContents will be a CMPXMediaArray that doesn't + * contain any media and KMPXMediaArrayCount will be 0. + * + * Each CMPXMedia contained in the media array represents + * a song. Each song must contain the following attributes: + * KMPXMediaGeneralType: + * must be EMPXItem + * + * KMPXMediaGeneralCategory: + * must be EMPXSong + * + * For songs that already exist in the collection, client + * must provide either KMPXMediaGeneralId or KMPXMediaGeneralUri. + * + * For songs that do not exist in the collection, client must + * provide KMPXMediaGeneralUri and its metadata. These songs + * will be added to the music collection when the playlist is + * added. These songs added to the collection are NOT registered + * with Harvester; hence, during next scan/refresh, these songs + * will be scanned and updated in the collection unnecessarily + * and cause scan/refresh performance degradation. If any + * metadata of these songs is changed in the collection before + * next scan/refresh, it will be lost after scan/refresh. + * + * WARNING: + * Client must add the songs to the collection prior to adding + * the playlist. + * + * WARNING: + * This playlist is NOT registered with Harvester. If client + * creates a physical playlist file, Harvester will re-parse + * and update the playlist in the collection during the next + * scan/refresh unnecessarily and cause scan/refresh performance + * degradation. If this playlist is edited, the physical + * playlist file is NOT updated to reflect the changes. + * + * If the playlist is successfully added to the collection, + * the media returned in the callback will contain the Id + * of the playlist. + * + * To add songs to a saved playlist, the media provided MUST + * contain the following attributes: + * KMPXMediaGeneralType: + * must be EMPXItem + * + * KMPXMediaGeneralCategory: + * must be EMPXPlaylist + * + * This playlist must already exist in the collection, client + * must provide either KMPXMediaGeneralId or KMPXMediaGeneralUri + * for locating which playlist to add the songs to. + * + * KMPXMediaArrayCount: + * indicates the number of songs to be added to the playlist + * + * KMPXMediaArrayContents: + * This contains an array of songs to be added/appended + * to the playlist. Each media in the array represents + * a song. Each song must contain the following attributes: + * KMPXMediaGeneralType: + * must be EMPXItem + * + * KMPXMediaGeneralCategory: + * must be EMPXSong + * + * These songs must already exist in the collection. Client + * must provide either KMPXMediaGeneralId or KMPXMediaGeneralUri. + * + * This method will leave with KErrArgument if any mandatory + * is missing. + * + * @param aMedia, a media to be added to the system + * @param aObserver, an observer for callback when + * operation is compelte. Leaves with KErrArgument if + * observer provided is NULL. The Id of playlist will + * be accessible via the KMPXMediaGeneralId of the media + * returned in the callback. + * + */ + void AddL( const CMPXMedia& aMedia, + MMPXCHelperObserver* aObserver ); + + + /** + * From MMPXCollectionUiHelper + * + * This is exactly the same as AddL except that songs in aMedia + * is added incrementally (in chunks). + * It should accept the same input and the same output as if AddL + * is used. + * @param aMedia, a media to be added to the system + * @param aObserver, an observer for callback when + * operation is compelte. Leaves with KErrArgument if + * observer provided is NULL. The Id of playlist will + * be accessible via the KMPXMediaGeneralId of the media + * returned in the callback. + * @param aSize, the number of songs to be added in each chunk + */ + void IncAddL( const CMPXMedia& aMedia, + MMPXCHelperObserver* aObserver, + const TInt aSize ); + + /** + * From MMPXCollectionUiHelper + * + * Asynchronously updates a media in the collection. For performance + * consideration, it is recommended that client only sets the attribute + * that needs to be updated. + * + * @param aMedia, media to be updated. + * + * To update a song in the collection, the media provided MUST + * contain the following attributes: + * KMPXMediaGeneralType: + * must be EMPXItem + * + * KMPXMediaGeneralCategory: + * must be EMPXSong + * + * KMPXMediaGeneralId or KMPXMediaGeneralUri: + * for identifying which song to update + * + * Additionally, this media should provide one or more of the + * following attributes for update: + * KMPXMediaGeneralTitle + * KMPXMediaGeneralComment + * KMPXMediaGeneralSynchronized + * KMPXMediaGeneralDeleted + * KMPXMediaGeneralModified + * KMPXMediaGeneralCopyright + * KMPXMediaGeneralDuration + * KMPXMediaGeneralFlags + * KMPXMediaGeneralPlayCount + * KMPXMediaGeneralLastPlaybackTime + * KMPXMediaIdMusic: + * KMPXMediaMusicArtist + * KMPXMediaMusicAlbum + * KMPXMediaMusicAlbumTrack + * KMPXMediaMusicGenre + * KMPXMediaMusicComposer + * KMPXMediaMusicYear + * KMPXMediaMusicRating + * KMPXMediaMusicAlbumArtFileName + * KMPXMediaMusicURL + * KMPXMediaIdAudio: + * KMPXMediaAudioSamplerate + * KMPXMediaAudioBitrate + * KMPXMediaAudioNumberOfChannels + * KMPXMediaIdDrm: + * KMPXMediaDrmType + * KMPXMediaIdMTP: + * KMPXMediaMTPDrmStatus + * + * To update a playlist in the collection, the media provided MUST + * contain the following attributes: + * KMPXMediaGeneralType: + * must be EMPXItem + * + * KMPXMediaGeneralCategory: + * must be EMPXPlaylist + * + * KMPXMediaGeneralId or KMPXMediaGeneralUri: + * for identifying which playlist to update + * + * If the media contains KMPXMediaArrayContents attribute, the + * content of the playlist will be overwritten with the new media + * array. If this attribute contains a CMPXMediaArray of 0 element, + * all songs in this playlist will be removed from the playlist + * (songs will remain in the collection and file system). + * e.g. + * 1) "Playlist" originally contains "Song1", "Song2", and "Song3". + * If KMPXMediaArrayContents contains a CMPXMediaArray that + * contains "Song3" and "Song4", "Playlist" will be updated to + * contain "Song3" and "Song4". + * 2) "Playlist" originally contains "Song1", "Song2", and "Song3". + * If KMPXMediaArrayContents contains a CMPXMediaArray that + * contains 0 element, "Playlist" will be updated so that it + * doesn't contain any songs. "Song1", "Song2", and "Song3" + * will remain in the collection. + * + * If the media contains any of the following attributes, the + * playlist will be updated accordingly: + * KMPXMediaGeneralTitle + * KMPXMediaGeneralSynchronized + * KMPXMediaGeneralDeleted (DEPRECATED) + * KMPXMediaGeneralModified (DEPRECATED) + * + * NOTE: If a client wishes to change the playlist title and modify + * its contents (i.e. the songs it includes), client needs to + * perform two separate SetL operations; one to update the + * playlist title providing KMPXMediaGeneralTitle attribute + * and the other to update its contents by providing + * KMPXMediaArrayContents. + * + * @param aObserver, an observer for callback when operation is complete. + * KErrArgument if NULL. + */ + void SetL( CMPXMedia*& aMedia, + MMPXCHelperObserver* aObserver ); + + /** + * From MMPXCollectionUiHelper + * + * Asynchronously updates a list of medias in the collection. This is + * NOT currently implemented. + * + * @param aMediaArray, list of medias + * @param aPath, collection path + * @param aIndices, array of indicies to collection path + */ + void SetL( TArray& aMediaArray, + CMPXCollectionPath& aPath, + RArray& aIndices); + + /** + * From MMPXCollectionUiHelper + * + * Asynchronously renames a media. This method will be DEPRECATED as client + * can use SetL to update the title of a song or a playlist. + * + * @param aMedia media to be renamed + * + * Currently only supporting renaming of a playlist. This media + * MUST contain the following attributes: + * KMPXMediaGeneralType: + * must be EMPXItem + * + * KMPXMediaGeneralCategory: + * must be EMPXPlaylist + * + * KMPXMediaGeneralId: + * for identifying which playlist to rename + * + * KMPXMediaGeneralTitle: + * new title of the playlist + * + * This method will leave with KErrArgument if any mandatory is + * missing. URI of the playlist remains unchanged when its title + * is changed. + * + * @param aObserver an observer for callback when operation is complete. + * KErrArgument if NULL. + */ + void RenameL( const CMPXMedia& aMedia, + MMPXCHelperObserver* aObserver ); + + /** + * From MMPXCollectionUiHelper + * + * Asynchronously deletes a media or medias based on the collection path. + * If this collection path refers to multiple medias, the referred medias + * are deleted one by one. If the media correlates to a file in the file + * system, the correlating file is deleted from the file system. If the + * file is in use, operation will proceed to the next media and upon + * operation completion, KErrInUse is returned via callback. + * If the file has already been deleted from the file system, operation + * will also proceed to the next media as normal. + * + * This operation is cancelable via Cancel(), + * + * @param aPath collection path to the media to be removed + * @param aObserver an observer for callback when operation is complete. + * KErrArgument if NULL. + */ + void DeleteL( CMPXCollectionPath& aPath, + MMPXCHelperObserver* aObserver ); + + /** + * From MMPXCollectionUiHelper + * + * Move an item from one collection to another + * + * @param aMedia media to be moved. + * @param aNewCollection uid of the collection defined in collectionplugins.hrh + * @param aObserver observer for the event. if aObs is NULL, sync, not NULL async. + */ + void MoveL( CMPXMedia*& aMedia, + TUid aNewCollection, + MMPXCHelperObserver* aObserver = NULL ); //lint !e1735 + + /** + * From MMPXCollectionUiHelper + * Open the collection in embedded mode with a Media Object + * @param aHostId Host Process UID to identify this embedded instance + * @param aMedia Media Object to open + * @param aObserver observer to handle errors + * @param aPluginInfo additional argument to pass to the plugin resolver + */ + void OpenL( const TUid& aHostId, CMPXMedia& aMedia, + MMPXCHelperEmbeddedOpenObserver* aObserver, + TInt aPluginInfo = 0 ); //lint !e1735 + + /** + * From MMPXCollectionUiHelper + * Open the collection in embedded mode with a File Handle + * @param aHostId Host Process UID to identify this embedded instance + * @param aFile File handle that we have to process + * @param aObserver observer to handle errors + + */ + void OpenL( const TUid& aHostId, const TDesC& aFile, + MMPXCHelperEmbeddedOpenObserver* aObserver, + TInt aPluginInfo = 0 ); //lint !e1735 + + /** + * From MMPXCollectionUiHelper + * Open the collection in embedded mode with a File Handle + * @param aFile File handle that we have to process + * @param aObserver, observer to the open operation + */ + void OpenL( RFile& aFile, MMPXCHelperEmbeddedOpenObserver* aObserver ); + + /** + * From MMPXCollectionUiHelper + * Queries about the playlist file extension of the currently selected playlist + * plugin + * @return file extension of the playlist type which includes the period + */ + HBufC* PlaylistFileExtensionLC(); + + /** + * From MMPXCollectionUiHelper + * Export the specified playlist to a file + * @param aPlaylistId, id of the playlist to be exported + * @param aDestinationDriveAndPath, specifies where the playlist file should + * be created. If the file already exists, it will be overwritten. + * @param aObs observer for the callback. URI of the exported playlist + * will be returned as a HBufC* which client takes over the + * ownership + */ + void ExportPlaylistL(TMPXItemId aPlaylistId, + const TDesC& aDestinationDriveAndPath, + MMPXCHelperObserver* aObserver); + + /** + * From MMPXCollectionUiHelper + * Reorder a song in the playlist + * @param aPlaylistId id of the playlist which contains the song to be reordered + * @param aSongId id of the song to be reordered + * @param aOriginalOrdinal the original ordinal of the song within the playlist. + * Ordinal starts from 0. + * @param aNewOrdinal the new ordinal of the song within the playlist. Ordinal + * starts from 0. + * @param aObs observer for the callback + */ + void ReorderPlaylistL(const TMPXItemId& aPlaylistId, + const TMPXItemId& aSongId, + TUint aOriginalOrdinal, + TUint aNewOrdinal, + MMPXCHelperObserver* aObserver); + + /** + * From MMPXCollectionUiHelper + * Gets the collection path to the main music menu + * Call OpenL() with this path to open music menu + * @return CMPXCollectionPath*, ownership transferred + */ + CMPXCollectionPath* MusicMenuPathL(); + + /** + * From MMPXCollectionUiHelper + * Gets the collection path to the podcast menu + * Call OpenL() with this path to open podcast menu + * @return CMPXCollectionPath*, ownership transferred + */ + CMPXCollectionPath* PodCastMenuPathL(); + + /** + * From MMPXCollectionUiHelper + * Gets the collection path to the main all songs view + * Call OpenL() with this path to open music all songs view + * @return CMPXCollectionPath*, ownership transferred + */ + CMPXCollectionPath* MusicAllSongsPathL(); + + /** + * From MMPXCollectionUiHelper + * Gets the collection path to the music playlist + * Call OpenL() with this path to open music playlist menu + * @return CMPXCollectionPath*, ownership transferred + */ + CMPXCollectionPath* MusicPlaylistPathL(); + + /** + * From MMPXCollectionUiHelper + * Gets the collection path to the music playlist + * Call OpenL() with this path to open music playlist menu + * @param aPlaylistType type of auto playlist + * @return CMPXCollectionPath*, ownership transferred + */ + CMPXCollectionPath* MusicPlaylistPathL(TMPXAutoPlaylistType aPlaylistType); + + /** + * From MMPXCollectionUiHelper + * Creates a default playlist path to open. Hardcoded to Music Collection / All songs + * @return CollectionPath*, ownership transferred. + */ + CMPXCollectionPath* CreateDefaultPlaylistPathLC(); + + /** + * From MMPXCollectionUiHelper + * Cancels current async request + * NOTE: Currently only Cancelling DeleteL() is supported + */ + void Cancel(); + + /** + * From MMPXCollectionUiHelper + * Frees this object + */ + void Close(); + + /** + * From MMPXCollectionUiHelper + * Test if the specified title exists in the specified category + * @param aCategory specifies the category for testing + * @param aTitle specifies the title for testing + * @return ETrue if the specified title exists in the specified + * category; otherwise, EFalse + */ + TBool TitleExistsL( TMPXGeneralCategory aCategory, + const TDesC& aTitle, TMPXGeneralType aType = EMPXItem ); + + /** + * From MMPXCollectionUiHelper + * Returns the file name used for virtual playlist handling + * @return the file name to be used to externalize collection path for the playlist + * that needs to be handled. ownership transfered + */ + HBufC* ExternalCollectionPathHandlingFileNameLC(); + +private: // from base class + + /** + * From MMPXMediatorObserver + * @param aMedia, properties of the object + * @param aOldPath, old collection path + */ + void HandleMediatorPathUpdatedL( CMPXMedia*& aMedia, + TUid aOldPath ); + + /** + * From MMPXHarvesterUtilityObserver + * Handles completion of playlist export + * @param aMedia, media that has been exported to a playlist file + * @param aErr, error encountered during playlist export + */ + void HandlePlaylistExportCompletedL( CMPXMedia* aMedia, TInt aErr ); + + /** + * From MMPXHarvesterUtilityObserver + * Handles completion of playlist import + * @param aMedia, media imported from a playlist file. + * @param aErr, error encountered during playlist import + */ + void HandlePlaylistImportCompletedL( CMPXMedia* aMedia, TInt aErr ); + + /** + * From MMPXHarvesterUtilityObserver + * Handle asynchronous file addition by file name + * @param aMedia, media added to the system + * @param aErr, error encountered during AddL operation + */ + void HandleFileAddCompletedL( CMPXMedia* aMedia, TInt aErr ); + + /** + * From MMPXHarvesterUtilityObserver + * Handle asynchronous file addition by file name + * @param aMedia, media imported from file + * @param aErr, error encountered during the operation + */ + void HandleFileImportCompletedL( CMPXMedia* aMedia, TInt aErr ); + + /** + * From MMPXHarvesterUtilityObserver + * Handle file delete completion + * @param aErr, error encountered during delete operation + */ + void HandleDeleteCompletedL( TInt aErr ); + + /** + * From MMPXHarvesterUtilityObserver + * Handle media retrieving completion + * @param aErr, error encountered during delete operation + */ + void HandleFileGetMediaCompletedL( CMPXMedia* aMedia, TInt aErr ); + + /** + * From MMPXCollectionMediaObserver + * Handle extended media properties + * + * @param aMedia media + * @param aError error code + */ + void HandleCollectionMediaL(const CMPXMedia& aMedia, + TInt aError); + + /** + * From MMPXCollectionObserver + * Handle collection message + * @param aMessage collection message + * @param aErr error + */ + void HandleCollectionMessage(CMPXMessage* aMsg, TInt aErr); + + /** + * From MMPXCollectionObserver + * Handles the collection entries being opened. Typically called + * when client has Open()'d a folder + * + * @param aEntries collection entries opened + * @param aIndex focused entry + * @param aComplete ETrue no more entries. EFalse more entries + * expected + * @param aError error code + */ + void HandleOpenL(const CMPXMedia& aEntries, + TInt aIndex,TBool aComplete,TInt aError); + + /** + * From MMPXCollectionObserver + * Handles the item being opened. Typically called + * when client has Open()'d an item. Client typically responds by + * 'playing' the item via the playlist + * + * @param aPlaylist collection playlist + * @param aError error code + */ + void HandleOpenL(const CMPXCollectionPlaylist& aPlaylist,TInt aError); + + /** + * From MMPXMoveItemObserver + * @param aErr, error for the operation + */ + void HandleMoveCompleteL( TInt aErr ); + + /** + * From MMPXCHelperObserver + * Handle callback for delete operation + * @param aOperation operation type that is completed + * @param aErr error code for the operation + * @param aArgument a pointer to any data to retun + */ + void HandleOperationCompleteL( TCHelperOperation aOperation, + TInt aErr, + void* aArgument ); + + /** + * From MMPXTaskQueueObserver + * Execute a task + * @param aTask task number + * @param aParamData, parameter + * @param aPtrData, any object + * @param aBuf, buffer containing externalized parameters for the task. + * @param aCallback call back function pointer + * @param aCObject1 object 1 owned by task queue + * @param aCObject2 object 2 owned by task queue + */ + void ExecuteTask(TInt aTask, + TInt aParamData, + TAny* aPtrData, + const CBufBase& aBuf, + TAny* aCallback, + CBase* aCObject1, + CBase* aCObject2); + + /** + * @see MMPXTaskQueueObserver + */ + void HandleTaskError( + TInt aTask, + TAny* aPtrData, + TAny* aCallback, + TInt aError); + +private: + + /** + * Constructor + */ + CMPXCollectionUiHelperImp(); + + /** + * 2nd-phase constructor + * @param aModeId collection mode id + */ + void ConstructL(const TUid& aModeId); + + /** + * Execute a task + * @param aTask task number + * @param aBuf, externalized parameters for the task + * @param aCallback, callback for the task + */ + void ExecuteTaskL(TInt aTask, const CBufBase& aBuf, TAny* aCallback); + + /** + * Completes the current task + * + * @param aTask task number + * @param aError error code + */ + void CompleteTask(TInt aTask, TInt aError); + + /** + * Notify client of the task results + * + * @param aTask task number + * @param aError error code + */ + void NotifyClientL(TInt aTask, TInt aError); + + /** + * Cleanup before processing the next task + */ + void Cleanup(); + + /** + * Performs AddL task from the task queue + */ + void DoAddL(); + + /** + * Performs IncAddMedialL task from the task queue + */ + void DoIncAddMediaL(); + + /** + * Performs IncAppendMedialL task from the task queue + */ + void DoIncAppendMediaL(); + + /** + * Performs SetL task from the task queue + */ + void DoSetL(); + + /** + * Performs RenameL task from the task queue + */ + void DoRenameL(); + + /** + * Export the specified playlist to a file + * @param aPlaylistId, id of the playlist to be exported + * @param aDestinationDriveAndPath, specifies where the playlist file should + * be created. If the file already exists, it will be overwritten. + */ + void DoExportPlaylistL(TMPXItemId aPlaylistId, + const TDesC& aDestinationDriveAndPath); + + /** + * Reorder a song in the playlist + * @param aCommand command to reorder a song in the playlist + */ + void DoReorderPlaylistL(CMPXCommand& aCommand); + + /** + * Fill in details for the playlist itself for playlist export + * @param aMedia, a playlist media whose information is to be + * filled. + */ + void FillInPlaylistDetailsL(CMPXMedia& aMedia); + + /** + * Handles completion of playlist export + * @param aMedia, media that has been exported to a playlist file + * @param aErr, error encountered during playlist export + */ + void DoHandlePlaylistExportCompletedL( CMPXMedia* aMedia, TInt aErr ); + + /** + * Looks for collection Id from the given URI through its extension. + * This method is able to determine the collection Id without the media + * being in the harvester's database. + * @param aUri URI of a media + * @return collection Id. KErrNotFound if unable to find a collection + * that supports the type of extension + */ + TInt FindCollectionIdL(const TDesC& aUri); + + +private: + + // tasks + enum TMPXCollectionUiHelperTask + { + ETaskNone, + ETaskAddMedia, + ETaskAppendMedia, + ETaskSetMedia, + ETaskRemoveMedia, + ETaskRenameMedia, + ETaskExportPlaylist, + ETaskReorderPlaylist, + ETaskIncAddMedia, + ETaskIncAppendMedia, + ETaskIncFinish + }; + +private: // data + + MMPXCollectionUtility* iCollection; + CMPXCollectionMediator* iMediator; + MMPXHarvesterUtility* iHarvester; + CMPXActiveTaskQueue* iTaskQueue; + TInt iTask; + + CMPXDeleteHelper* iDeleteHelper; + + // parameters for async commands + CMPXMedia* iMedia; + + // parameters used for incremental adding of songs + CMPXMedia* iInputMedia; + TInt iRemainder; + TInt iTotalChunkNumber; + TInt iChunkNumber; // used as ID of current chunk + TInt iChunkSize; + TInt iArrayIndex; + + + MMPXCHelperEmbeddedOpenObserver* iOpenObserver; // not owned, transient + + MMPXCHelperObserver* iHelperObserver; // not owned, transient + // Embedded Mode handling + TUid iEmbeddedModeID; + TInt iEmbeddedPluginInfo; + TBool iInitialized; // collection db merging + TBool iIncAdding; // Incremental adding guard + }; + +#endif // CMPX_COLLECTION_UI_HELPER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/collectionhelper/inc/mpxdeletehelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/collectionhelper/inc/mpxdeletehelper.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,220 @@ +/* +* Copyright (c) 2006 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: Delete helper +* +*/ + + +#ifndef C_MPX_DELETE_HELPER_H +#define C_MPX_DELETE_HELPER_H + +#include +#include +#include +#include +#include +#include +#include +#include + +// FORWARD DECLARATIONS +class MMPXCollectionUtility; +class MMPXPlaybackUtility; +class MMPXHarvesterUtility; +class MMPXCHelperObserver; +class CMPXCollectionPath; + + +/** + * Delete Helper + * + * @lib mpxcollectionhelper.lib + * @since S60 3.0 + */ +NONSHARABLE_CLASS( CMPXDeleteHelper ) : public CActive, + public MThumbnailManagerObserver + { +public: + + /** + * Two-Phased Constructor + * @param aCollectionUtility reference to a collection utility + * @param aHarvesterUtility reference to a harvester utility + * @param aObserver observer to callback upon completion of the operation + * @return new instance of CMPXDeleteHelper + */ + static CMPXDeleteHelper* NewL(MMPXCollectionUtility& aCollectionUtility, + MMPXHarvesterUtility& aHarvesterUtility, + MMPXCHelperObserver& aObserver); + + /** + * Virtual Destructor + */ + virtual ~CMPXDeleteHelper(); + +public: // New functions + + /** + * Delete all items in a collection path + * @param aPath, collection path to delete + */ + void DeleteL( CMPXCollectionPath& aPath ); + + /** + * Handles any collection message callbacks from collection helper + */ + void HandleCollectionMessage(CMPXMessage* aMessage, TInt aErr); + + /** + * Stop deleting + * + */ + void Stop(); + +private: + + /** + * From CActive + * Handles an active object's request completion event + */ + void RunL(); + + /** + * From CActive + * Implements cancellation of an outstanding request. + */ + void DoCancel(); + + /** + * Performs incremental delete operation + */ + void DoTaskStep(); + + /** + * Performs incremental delete operation + */ + void DoTaskStepL(); + + /** + * Completes delete operation request and notifies the client + */ + void CompleteDelete( TInt aErr ); + + /** + * Finish the delete operation + * @param aErr error + */ + void DoCompleteDeleteL( TInt aErr ); + + /** + * Resets members to get ready for the next client request + */ + void Reset(); + + /** + * Retrieves a list of file URIs associated with the path + */ + void RetrieveFileListL(); + + /** + * Perfoms cleanup of all unused data before delete + */ + void StartDeleteL(); + + /** + * Deletes one file from the file system then removes it from the + * collection + */ + void DeleteL(); + + /** + * Deletes the file from the file system and harvester's database + * @return ETrue if the file has been deleted from the file system; + * otherwise EFalse. + */ + TBool DeleteFileL(); + + /** + * Connect to usbman. + */ + void ConnectUsbMan(); + + // MThumbnailManagerObserver for getting thumbnails + void ThumbnailPreviewReady( + MThumbnailData& aThumbnail, TThumbnailRequestId aId ); + + void ThumbnailReady( + TInt aError, + MThumbnailData& aThumbnail, TThumbnailRequestId aId ); + +private: + + /** + * Constructor + * @param aCollectionUtility reference to a collection utility + * @param aHarvesterUtility reference to a harvester utility + * @param aObserver observer to callback upon completion of the operation + */ + CMPXDeleteHelper(MMPXCollectionUtility& aCollectionUtility, + MMPXHarvesterUtility& aHarvesterUtility, + MMPXCHelperObserver& aObserver); + + /** + * 2nd phase constructor + */ + void ConstructL(); + + private: + + /* + * state for deleting one item + */ + enum TMPXDeleteState + { + EMPXIdle, + EMPXInitDelete, + EMPXPreparation, + EMPXDelete + }; + +private: // data + MMPXCollectionUtility& iCollectionUtil; + MMPXHarvesterUtility& iHarvester; + MMPXCHelperObserver& iObserver; + + MMPXPlaybackUtility* iPbUtil; + + CMPXCollectionPath* iDeletePath; + CDesCArray* iFiles; + + TBool iMoreToDo; + TBool iHadInUse; + TBool iCancelled; + + TMPXDeleteState iState; + + CMPXMessageArray* iMessageArray; + TInt iItemsCount; + TInt iRetrievedItemsCount; + TInt iDeletePercent; + TInt iDeleteIncFactor; + TInt iDeleteCount; + RFs iFs; // FsSession (owned) + CThumbnailManager* iTNManager; + RUsb iUsbMan; + TBool iUsbManConnected; + + }; + +#endif // C_MPX_DELETE_HELPER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/collectionhelper/rom/mpxcollectionhelper.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/collectionhelper/rom/mpxcollectionhelper.iby Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2006 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: IBY file for the collection helper component +* +*/ + + +#ifndef MPX_COLLECTIONHELPER_IBY +#define MPX_COLLECTIONHELPER_IBY + +#include + +file=ABI_DIR\BUILD_DIR\mpxcollectionhelper.dll SHARED_LIB_DIR\mpxcollectionhelper.dll + +#endif // MPX_COLLECTIONHELPERR_IBY diff -r 000000000000 -r a2952bb97e68 mmappcomponents/collectionhelper/src/mpxcollectioncachedhelper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/collectionhelper/src/mpxcollectioncachedhelper.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,1116 @@ +/* +* Copyright (c) 2006 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: Extended collection helper with an internal caching array +* Version : %version: da1mmcf#27.1.12 % +* +*/ + + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include "mpxcollectioncachedhelper.h" +#include "mpxcollectionhelpercommon.h" +#include + +// CONSTANTS +const TInt KCacheCount = 10; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CMPXCollectionCachedHelper::CMPXCollectionCachedHelper() : +#ifdef RD_MPX_COLLECTION_CACHE + CMPXCollectionHelperImp(EFalse),iNotInCache(ETrue), iHitFoundMedia(0), + iNotHitInCache(0), iLookingInCache(0),iLookingInUnknowCache(0), +#endif //RD_MPX_COLLECTION_CACHE + iMetadataExtractor(NULL) + { + } + + +// --------------------------------------------------------------------------- +// 2nd Phase Constructor +// --------------------------------------------------------------------------- +// +void CMPXCollectionCachedHelper::ConstructL() + { + MPX_DEBUG1("CMPXCollectionCachedHelper::ConstructL <--"); + iCache = CMPXMediaArray::NewL(); + CMPXCollectionHelperImp::ConstructL(); + +#ifdef RD_MPX_COLLECTION_CACHE + MPX_DEBUG1("CMPXCollectionCachedHelper::ConstructL Todd advancedcache"); + // cache for unknown artist + TMPXItemId artistId = NULL; + TRAPD(err, artistId = GetArtistIdL( KNullDesC(), iMusicCollectionId )); + if ( err || artistId == (TMPXItemId)0 ) + { + MPX_DEBUG2("CMPXCollectionCachedHelper::ConstructL no known artist id %d", err); + } + else + { + // Get songs that belong to the unknown artist + GetSongsL( artistId, iMusicCollectionId, ETrue ); + } +#endif //RD_MPX_COLLECTION_CACHE + User::LeaveIfError( iFs.Connect() ); + User::LeaveIfError( iAppArc.Connect() ); + iMetadataExtractor = CMPXMetadataExtractor::NewL( iFs, iAppArc, iSupportedTypes); + MPX_DEBUG1("CMPXCollectionCachedHelper::ConstructL -->"); + } + + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXCollectionCachedHelper* CMPXCollectionCachedHelper::NewL() + { + CMPXCollectionCachedHelper* self = CMPXCollectionCachedHelper::NewLC(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXCollectionCachedHelper* CMPXCollectionCachedHelper::NewLC() + { + CMPXCollectionCachedHelper* self = new( ELeave ) CMPXCollectionCachedHelper(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CMPXCollectionCachedHelper::~CMPXCollectionCachedHelper() + { + Commit(); + delete iFoundMedia; +#ifdef RD_MPX_COLLECTION_CACHE + if ( iCachedArtistArray ) + { + delete iCachedArtistArray; + } + if ( iCachedUnknownArtistArray ) + { + delete iCachedUnknownArtistArray; + } +#endif //RD_MPX_COLLECTION_CACHE + delete iCache; + iOp.Close(); + if (iMetadataExtractor) + { + delete iMetadataExtractor; + } + iFs.Close(); + iAppArc.Close(); + iSupportedTypes.ResetAndDestroy(); + } + +// --------------------------------------------------------------------------- +// Add a media object +// --------------------------------------------------------------------------- +// +void CMPXCollectionCachedHelper::AddL( CMPXMedia* aMedia ) + { + MPX_FUNC("CMPXCollectionCachedHelper::::AddL"); + // Commit when we have cached more than a set amount + // + if( iCache->Count() >= KCacheCount) + { + Commit(); + } + + // Extract album art from the file + iMetadataExtractor->ExtractAlbumArtL( aMedia ); + + CMPXMedia* copy = CMPXMedia::NewL( *aMedia ); + CleanupStack::PushL( copy ); + iCache->AppendL( copy ); // ownership x-fer + CleanupStack::Pop( copy ); + iOp.AppendL( EAdd ); + } + +// --------------------------------------------------------------------------- +// Remove a media object +// --------------------------------------------------------------------------- +// +void CMPXCollectionCachedHelper::RemoveL( const TDesC& aFile, + TMPXGeneralCategory aItemCat ) + { + MPX_FUNC("CMPXCollectionCachedHelper::RemoveL"); + MPX_DEBUG3("aFile %S, category %d", &aFile, aItemCat); + + Commit(); + + ::InitializeCollectionPluginsL( *iCollectionUtil ); + + // + // ask harvester to remove the file if any of the following is true: + // 1) removing a song + // 2) removing a playlist scanned through file system. + // + // There are 3 types of playlists. The ones created from the device + // are virtual playlists which have file extension .vir. There are + // no physical playlist files associated with them; hence not + // registered with harvester. For virtual playlists, IsPlaylistL + // will return EFalse because there is not a playlist plugin that + // deals with .vir playlist files. + // + // The ones synced from PC through MTP have file extension .pla. + // There are 0-byte .pla files associated with them but they + // are not registered with harvester either. IsPlaylistL will also + // return EFalse because there is not a playlist plugin that deals + // with .pla. + // + // The 3rd type of playlists is .m3u on the file system. They are + // added to the collection through file scan and registered with + // harvester. IsPlaylistL will return ETrue. + // + // For now virtual playlists and synced playlists are assumed to + // be in the music collection for now until there is a generic way + // resolving collections aside from using file extension or UID. + // + TInt collection(iMusicCollectionId.iUid); + if (aItemCat == EMPXSong || iHvsUtility->IsPlaylistL(aFile)) + { + // Remove from the harvester + collection = iHvsUtility->RemoveFileL( aFile ); + } + + // Remove from the collection + // Construct a CMPXMedia object with URI and collection + // + RArray contID; + CleanupClosePushL( contID ); + contID.AppendL( KMPXMediaIdGeneral ); + CMPXMedia* media = CMPXMedia::NewL( contID.Array() ); + CleanupStack::PopAndDestroy(&contID); + CleanupStack::PushL( media ); + + media->SetTextValueL( KMPXMediaGeneralUri, aFile ); + media->SetTObjectValueL( KMPXMediaGeneralCollectionId, TUid::Uid( collection ) ); + media->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem ); + media->SetTObjectValueL( KMPXMediaGeneralCategory, aItemCat ); + + // set up remove media command + CMPXCommand* command = CMPXMedia::NewL(); + CleanupStack::PushL(command); + + command->SetTObjectValueL( + KMPXCommandGeneralId, KMPXCommandIdCollectionRemoveMedia); + command->SetTObjectValueL( + KMPXCommandGeneralDoSync, ETrue); + command->SetTObjectValueL( + KMPXCommandGeneralCollectionId, collection); + command->SetCObjectValueL( + TMPXAttribute(KMPXCommandIdCollectionRemoveMedia, EMPXCommandCollectionRemoveMedia), + media); + command->SetTObjectValueL( + TMPXAttribute(KMPXCommandIdCollectionRemoveMedia, EMPXCommandCollectionRemoveMediaDeleteRecord), ETrue); + + // send sync remove media command + iCollectionUtil->Collection().CommandL(*command); + + // + // return command should contain error attribute + // + if (!command->IsSupported(TMPXAttribute(KMPXCommandIdCollectionRemoveMedia, EMPXCommandCollectionRemoveMediaError))) + { + User::Leave(KErrAbort); + } + + // + // abandon operation if an error occured cleaning up deleted medias from the collection + // + TInt error = + command->ValueTObjectL( + TMPXAttribute(KMPXCommandIdCollectionRemoveMedia, EMPXCommandCollectionRemoveMediaError)); + User::LeaveIfError(error); + + // + // reset found media if it's been deleted + // + if (iFoundMedia && + iFoundMedia->ValueText(KMPXMediaGeneralUri).CompareF(aFile) == 0) + { + delete iFoundMedia; + iFoundMedia = NULL; + } + + CleanupStack::PopAndDestroy(2, media ); // command and media + } + +// --------------------------------------------------------------------------- +// Remove a media object +// --------------------------------------------------------------------------- +// +void CMPXCollectionCachedHelper::CleanupDeletedMediasL() + { + MPX_FUNC("CMPXCollectionCachedHelper::CleanupDeletedMediasL"); + + Commit(); + + ::InitializeCollectionPluginsL( *iCollectionUtil ); + + // + // set up the command to send to the collection + // + CMPXCommand* command = CMPXMedia::NewL(); + CleanupStack::PushL(command); + + command->SetTObjectValueL( + KMPXCommandGeneralId, KMPXCommandIdCollectionCleanupDeletedMedias); + command->SetTObjectValueL( + KMPXCommandGeneralDoSync, ETrue); + command->SetTObjectValueL( + KMPXCommandGeneralCollectionId, iMusicCollectionId.iUid); + + // send sync cleanup command + iCollectionUtil->Collection().CommandL(*command); + + // + // return command should contain error attribute + // + if (!command->IsSupported(TMPXAttribute(KMPXCommandIdCollectionCleanupDeletedMedias, EMPXCommandCollectionCleanupError))) + { + User::Leave(KErrAbort); + } + + // + // abandon operation if an error occured cleaning up deleted medias from the collection + // + TInt error = + command->ValueTObjectL( + TMPXAttribute(KMPXCommandIdCollectionCleanupDeletedMedias, EMPXCommandCollectionCleanupError)); + User::LeaveIfError(error); + + CleanupStack::PopAndDestroy(command); + } + +// --------------------------------------------------------------------------- +// Update a media object +// --------------------------------------------------------------------------- +// +void CMPXCollectionCachedHelper::SetL( CMPXMedia*& aMedia ) + { + MPX_DEBUG1("CMPXCollectionCachedHelper::::SetL <--"); + + const TDesC& newUri = aMedia->ValueText( KMPXMediaGeneralUri ); + TInt count( iCache->Count() ); + + // Take advantage that MTP always try to access the most recent item + // + CMPXMedia* media( NULL ); + for( TInt i=count-1; i>=0; --i ) + { + const TDesC& uri = iCache->AtL(i)->ValueText( KMPXMediaGeneralUri ); + if( newUri.CompareF( uri ) == 0 ) + { + MPX_DEBUG2("Found existing media, index %i", i); + media = iCache->AtL(i); + break; + } + } + + // Not found in the array + if( !media ) + { + CMPXMedia* copy = CMPXMedia::NewL( *aMedia ); + CleanupStack::PushL( copy ); + iCache->AppendL( copy ); // ownership x-fer + CleanupStack::Pop( copy ); + iOp.AppendL( ESet ); + } + else + { + // Update existing media object already in the array + // + DoAppendGeneralL( *aMedia, *media ); + DoAppendMusicL( *aMedia, *media ); + DoAppendAudioL( *aMedia, *media ); + DoAppendDRML( *aMedia, *media ); + DoAppendContainerL( *aMedia, *media ); + DoAppendMTPL( *aMedia, *media ); + } + MPX_DEBUG1("CMPXCollectionCachedHelper::::SetL -->"); + } + +// --------------------------------------------------------------------------- +// Renames a file +// --------------------------------------------------------------------------- +// +void CMPXCollectionCachedHelper::RenameL( const TDesC& aOldUri, + const TDesC& aNewUri, + TMPXGeneralCategory aItemCat ) + { + TInt count = iCache->Count(); + + // Take advantage that MTP always try to access the most recent item + // + CMPXMedia* media( NULL ); + for( TInt i=count-1; i>=0; --i ) + { + const TDesC& uri = iCache->AtL(i)->ValueText( KMPXMediaGeneralUri ); + if( aOldUri.CompareF( uri ) == 0 ) + { + MPX_DEBUG2("Found existing media, index %i", i); + media = iCache->AtL(i); + break; + } + } + + // Not found in the array + if( !media ) + { + Commit(); + CMPXCollectionHelperImp::RenameL(aOldUri, aNewUri, aItemCat); + } + else + { + // Update existing media object already in the array + // + media->SetTextValueL(KMPXMediaGeneralUri, aNewUri); + } + + if (iFoundMedia && + iFoundMedia->ValueText(KMPXMediaGeneralUri).CompareF(aOldUri) == 0) + { + iFoundMedia->SetTextValueL(KMPXMediaGeneralUri, aNewUri); + } + } + + +#ifdef RD_MPX_COLLECTION_CACHE +// --------------------------------------------------------------------------- +// Gets the media object of the supplied attributes +// --------------------------------------------------------------------------- +// +void CMPXCollectionCachedHelper::GetSongL( const TDesC& aFile, + TMPXGeneralCategory aItemCat, TUid aCollectionUId ) + { + MPX_DEBUG1("CMPXCollectionCachedHelper::GetSongL <--"); + RArray attributes; + CleanupClosePushL(attributes); + + attributes.AppendL( + TMPXAttribute(KMPXMediaIdGeneral, + EMPXMediaGeneralTitle | EMPXMediaGeneralDate | + EMPXMediaGeneralDuration | EMPXMediaGeneralComment | + EMPXMediaGeneralUri )); + attributes.AppendL( + TMPXAttribute(KMPXMediaIdMusic, + EMPXMediaMusicArtist | EMPXMediaMusicAlbum | + EMPXMediaMusicAlbumTrack | EMPXMediaMusicComposer | + EMPXMediaMusicYear | EMPXMediaMusicGenre)); + + attributes.AppendL(KMPXMediaAudioAudioAll); + attributes.AppendL(KMPXMediaMTPAll); + + delete iFoundMedia; + iFoundMedia = NULL; + iFoundMedia = CMPXCollectionHelperImp::GetL( aFile, attributes.Array(), aItemCat ); + if ( !iFoundMedia ) + { + User::Leave(KErrNotFound); + } + iFoundMedia->SetTObjectValueL( + KMPXMediaGeneralCollectionId, aCollectionUId ); + + CleanupStack::PopAndDestroy(&attributes); + //MPX_DEBUG1("Artist name ="); + //RDebug::RawPrint(iFoundMedia->ValueText( KMPXMediaMusicArtist)); + MPX_DEBUG1("CMPXCollectionCachedHelper::GetSongL -->"); + } + + + + +// --------------------------------------------------------------------------- +// Gets the artist id for the media object +// --------------------------------------------------------------------------- +// +TMPXItemId CMPXCollectionCachedHelper::GetArtistIdL( const TDesC& aArtist, + TUid aCollectionUId ) + { + MPX_DEBUG1("CMPXCollectionCachedHelper::GetArtistIdL <--"); + CMPXMedia* search = CMPXMedia::NewL(); + CleanupStack::PushL(search); + search->SetTObjectValueL(KMPXMediaGeneralType, EMPXItem); + search->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXArtist); + search->SetTObjectValueL( KMPXMediaGeneralCollectionId, aCollectionUId ); + search->SetTextValueL( KMPXMediaGeneralTitle, aArtist ); + + RArray attributes; + CleanupClosePushL(attributes); + attributes.AppendL(KMPXMediaGeneralId); + + CMPXMedia* result = + CMPXCollectionHelperImp::FindAllL(*search, attributes.Array()); + CleanupStack::PopAndDestroy(&attributes); + CleanupStack::PopAndDestroy(search); + CleanupStack::PushL(result); + const CMPXMediaArray* results = + result->Value(KMPXMediaArrayContents); + if( !results ) + { + User::Leave( KErrNoMemory ); + } + + TMPXItemId artistId = 0; + if ( !results->Count() || aArtist == KNullDesC ) + { + CleanupStack::PopAndDestroy(result); + return TMPXItemId(0); + } + + artistId = results->AtL(0)->ValueTObjectL(KMPXMediaGeneralId); + CleanupStack::PopAndDestroy(result); + + + MPX_DEBUG1("CMPXCollectionCachedHelper::GetArtistIdL -->"); + return artistId; + } + + + +// --------------------------------------------------------------------------- +// Gets the artist id for the media object +// --------------------------------------------------------------------------- +// +void CMPXCollectionCachedHelper::GetSongsL( TMPXItemId aArtistId, + TUid aCollectionUId, TBool aUnknownArtist ) + { + MPX_DEBUG1("CMPXCollectionCachedHelper::GetSongsLL <--"); + + RArray attributes; + CleanupClosePushL(attributes); + + if ((aArtistId == (TMPXItemId)0) || aUnknownArtist ) + { + CleanupStack::PopAndDestroy(&attributes); + return; + } + + attributes.AppendL( + TMPXAttribute(KMPXMediaIdGeneral, + EMPXMediaGeneralTitle | EMPXMediaGeneralDate | + EMPXMediaGeneralDuration | EMPXMediaGeneralComment | + EMPXMediaGeneralUri )); + attributes.AppendL( + TMPXAttribute(KMPXMediaIdMusic, + EMPXMediaMusicArtist | EMPXMediaMusicAlbum | + EMPXMediaMusicAlbumTrack | EMPXMediaMusicComposer | + EMPXMediaMusicYear | EMPXMediaMusicGenre)); + + attributes.AppendL(KMPXMediaAudioAudioAll); + attributes.AppendL(KMPXMediaMTPAll); + + CMPXMedia* search = CMPXMedia::NewL(); + CleanupStack::PushL( search ); + search->SetTObjectValueL( KMPXMediaGeneralType, EMPXGroup); + search->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXSong ); + search->SetTObjectValueL( KMPXMediaGeneralCollectionId, aCollectionUId ); + search->SetTObjectValueL( KMPXMediaGeneralId, aArtistId ); + + // Search in synch mode + CMPXMedia* result = CMPXCollectionHelperImp::FindAllL( *search, attributes.Array() ); + CleanupStack::PopAndDestroy( search ); + CleanupStack::PopAndDestroy(&attributes); + + CleanupStack::PushL(result); + if( result->IsSupported( KMPXMediaArrayContents ) ) + { + if ( !aUnknownArtist ) + { // cache for known artist + if ( iCachedArtistArray ) + { + delete iCachedArtistArray; + iCachedArtistArray = NULL; + } + CMPXMediaArray* ary = result->Value(KMPXMediaArrayContents); + iCachedArtistArray = CMPXMediaArray::NewL(*ary); + MPX_DEBUG2("Known Artist Array count()=%d", iCachedArtistArray->Count()); + } + else // cache for unknown artist + { + if ( iCachedUnknownArtistArray ) + { + delete iCachedUnknownArtistArray; + iCachedUnknownArtistArray = NULL; + } + CMPXMediaArray* ary = result->Value(KMPXMediaArrayContents); + iCachedUnknownArtistArray = CMPXMediaArray::NewL(*ary); + MPX_DEBUG2("Unknown Artist Array count()=%d", iCachedUnknownArtistArray->Count()); + } + } + + + CleanupStack::PopAndDestroy(result); + + MPX_DEBUG1("CMPXCollectionCachedHelper::GetSongsLL -->"); + } + +#endif //RD_MPX_COLLECTION_CACHE + + +// --------------------------------------------------------------------------- +// Gets the attributes of some media object +// --------------------------------------------------------------------------- +// +const CMPXMedia& CMPXCollectionCachedHelper::GetL( const TDesC& aFile, + TMPXGeneralCategory aItemCat ) + { + +#ifdef RD_MPX_COLLECTION_CACHE + Commit(); + + if (aItemCat != EMPXSong && aItemCat != EMPXPlaylist) + { + User::Leave(KErrArgument); + } + + MPX_DEBUG1("CMPXCollectionCachedHelper::GetL (advanced cache version) <--"); + MPX_DEBUG2("aFile %S", &aFile); + + // If the iFoundMedia is cached + if ( iFoundMedia ) + { + // and if asking for the same file, just return. + if ( iFoundMedia->ValueText(KMPXMediaGeneralUri).CompareF(aFile) == 0 ) + { + iHitFoundMedia++; + return *iFoundMedia; + } + // and if not asking for the same file, seach through cacahed array. + // It probably cached in the cached artist array + else if ( iCachedArtistArray && iCachedArtistArray->Count() ) + { + TInt count( iCachedArtistArray->Count() ); + iNotInCache = ETrue; + iLookingInCache++; + MPX_DEBUG1("CMPXCollectionCachedHelper::GetL looking into cache <--"); + for( TInt i=0; iAtL(i); + //RDebug::Printf("Checking... begin"); + //RDebug::RawPrint(m.ValueText(KMPXMediaGeneralUri)); + if ( m.ValueText(KMPXMediaGeneralUri).CompareF(aFile) == 0 ) + { + delete iFoundMedia; + iFoundMedia = NULL; + iFoundMedia = CMPXMedia::NewL( m ); + iNotInCache = EFalse; + MPX_DEBUG1("CMPXCollectionCachedHelper::GetL found in cache <--"); + break; + } + } + // if not in cached artist array, try with unknown array + if ( iNotInCache && iCachedUnknownArtistArray && iCachedUnknownArtistArray->Count() ) + { + MPX_DEBUG1("CMPXCollectionCachedHelper::GetL looking into unknown cache <--"); + iLookingInUnknowCache++; + count = iCachedUnknownArtistArray->Count(); + for( TInt i=0; iAtL(i); + if ( m.ValueText(KMPXMediaGeneralUri).CompareF(aFile) == 0 ) + { + MPX_DEBUG1("CMPXCollectionCachedHelper::GetL found unknown cache <--"); + delete iFoundMedia; + iFoundMedia = NULL; + iFoundMedia = CMPXMedia::NewL( m ); + iNotInCache = EFalse; + break; + } + } + } + } + } + + + + // No cache or not finding anything in the cached artist arraies + // it got to search the song in db and also create cache for the new artist + if ( !iFoundMedia || !iCachedArtistArray || iNotInCache ) + { + MPX_DEBUG4("CMPXCollectionCachedHelper::GetL looking in db <-- iFoundMedia=%x iCachedArtistArray=%x, iNotInCache=%d", iFoundMedia, iCachedArtistArray, iNotInCache); + TInt col(iMusicCollectionId.iUid); + if (aItemCat == EMPXSong || iHvsUtility->IsPlaylistL(aFile)) + { + TRAPD(err, col = iHvsUtility->FindCollectionIdL( aFile )); + if (err != KErrNone) + { + MPX_DEBUG2("CMPXCollectionCachedHelper::GetL error $", err); + } + } + // to get single song that matches the supplied URI + + GetSongL(aFile, aItemCat, TUid::Uid(col)); + + if ( aItemCat == EMPXPlaylist ) + { + return *iFoundMedia; // no need to cache for playlist request + } + + iNotHitInCache++; + + // Get Artist Id + TMPXItemId artistId = (TMPXItemId)0; + if ( iFoundMedia->IsSupported(KMPXMediaMusicArtist) + && iFoundMedia->ValueText(KMPXMediaMusicArtist).Length() ) + { + TRAPD(err, artistId = GetArtistIdL( + iFoundMedia->ValueText(KMPXMediaMusicArtist), TUid::Uid(col) )); + if ( err ) + { + artistId = GetArtistIdL( KNullDesC(), TUid::Uid(col) ); + } + } + else + { + artistId = GetArtistIdL( KNullDesC(), TUid::Uid(col) ); + } + // Get songs that belongs to the same artist id + GetSongsL( artistId, TUid::Uid(col), EFalse ); + } + + MPX_DEBUG1("CMPXCollectionCachedHelper::GetL -->"); + return *iFoundMedia; + +#else //RD_MPX_COLLECTION_CACHE + + MPX_DEBUG1("CMPXCollectionCachedHelper::GetL <--"); + + if (aItemCat != EMPXSong && aItemCat != EMPXPlaylist) + { + User::Leave(KErrArgument); + } + + // Do reverse search on cache + for( TInt i = iCache->Count()-1; i >= 0; --i ) + { + CMPXMedia* media = iCache->AtL(i); + if( media && + media->ValueText(KMPXMediaGeneralUri).CompareF(aFile) == 0 ) + { + return *media; + } + } + + if (!iFoundMedia || + iFoundMedia->ValueText(KMPXMediaGeneralUri).CompareF(aFile) != 0) + { + delete iFoundMedia; + iFoundMedia = NULL; + + Commit(); + + RArray attributes; + CleanupClosePushL(attributes); + + attributes.AppendL( + TMPXAttribute(KMPXMediaIdGeneral, + EMPXMediaGeneralTitle | EMPXMediaGeneralDate | + EMPXMediaGeneralDuration | EMPXMediaGeneralComment | + EMPXMediaGeneralUri )); + attributes.AppendL( + TMPXAttribute(KMPXMediaIdMusic, + EMPXMediaMusicArtist | EMPXMediaMusicAlbum | + EMPXMediaMusicAlbumTrack | EMPXMediaMusicComposer | + EMPXMediaMusicYear | EMPXMediaMusicGenre)); + attributes.AppendL(KMPXMediaAudioAudioAll); + attributes.AppendL(KMPXMediaMTPAll); + + iFoundMedia = CMPXCollectionHelperImp::GetL( aFile, attributes.Array(), aItemCat ); + + CleanupStack::PopAndDestroy(&attributes); + } + MPX_DEBUG1("CMPXCollectionCachedHelper::GetL -->"); + return *iFoundMedia; + +#endif //RD_MPX_COLLECTION_CACHE + + } + +// --------------------------------------------------------------------------- +// Find some media +// --------------------------------------------------------------------------- +// +CMPXMedia* CMPXCollectionCachedHelper::FindAllL( CMPXMedia& aCriteria, + const TArray& aAttrs ) + { + Commit(); + + return CMPXCollectionHelperImp::FindAllL( aCriteria, aAttrs ); + } + +// --------------------------------------------------------------------------- +// Close function to destroy this object +// --------------------------------------------------------------------------- +// +void CMPXCollectionCachedHelper::Close() + { +#ifdef RD_MPX_COLLECTION_CACHE + MPX_DEBUG2("mpx perf result iHitFoundMedia=%d", iHitFoundMedia); + MPX_DEBUG2("mpx pref result iNotHitInCache=%d", iNotHitInCache); + MPX_DEBUG2("mpx perf result iLookingInCache=%d", iLookingInCache); + MPX_DEBUG2("mpx perf result iLookingInUnknowCache=%d", iLookingInUnknowCache); +#endif //RD_MPX_COLLECTION_CACHE + delete this; + } + +// --------------------------------------------------------------------------- +// Commits all transactions left in the helper +// --------------------------------------------------------------------------- +// +void CMPXCollectionCachedHelper::Commit() + { + MPX_DEBUG2("CMPXCollectionCachedHelper::Commit %d <--", iCache->Count()); + TInt error( KErrNotFound ); + TInt count( iCache->Count() ); + + for( TInt i=0; iValueText(KMPXMediaGeneralUri).CompareF(media->ValueText(KMPXMediaGeneralUri)) == 0) + { + TRAP_IGNORE( + DoAppendGeneralL( *media, *iFoundMedia ); + DoAppendMusicL( *media, *iFoundMedia ); + DoAppendAudioL( *media, *iFoundMedia ); + DoAppendDRML( *media, *iFoundMedia ); + DoAppendContainerL( *media, *iFoundMedia ); + DoAppendMTPL( *media, *iFoundMedia ); + ); + } + + iCache->Remove(0); + iOp.Remove(0); + } + + MPX_DEBUG1("CMPXCollectionCachedHelper::Commit -->"); + } + +// --------------------------------------------------------------------------- +// Copies general media information +// --------------------------------------------------------------------------- +// +void CMPXCollectionCachedHelper::DoAppendGeneralL( CMPXMedia& aSrc, + CMPXMedia& aDestination ) + { + MPX_DEBUG1("CMPXCollectionCachedHelper::DoAppendGeneralL <--"); + + // Note: Only a subset used by MTP... + // + TUint atts = aSrc.AttributesSet( KMPXMediaIdGeneral ); + if( atts&EMPXMediaGeneralUri ) // text + { + aDestination.SetTextValueL( KMPXMediaGeneralUri, + aSrc.ValueText(KMPXMediaGeneralUri ) + ); + } + if( atts&EMPXMediaGeneralDrive ) // text + { + aDestination.SetTextValueL( KMPXMediaGeneralDrive, + aSrc.ValueText(KMPXMediaGeneralDrive ) + ); + } + if( atts&EMPXMediaGeneralTitle ) // text + { + aDestination.SetTextValueL( KMPXMediaGeneralTitle, + aSrc.ValueText(KMPXMediaGeneralTitle ) + ); + } + if( atts&EMPXMediaGeneralComment ) //text + { + aDestination.SetTextValueL( KMPXMediaGeneralComment, + aSrc.ValueText(KMPXMediaGeneralComment ) + ); + } + if( atts&EMPXMediaGeneralMimeType ) //text + { + aDestination.SetTextValueL( KMPXMediaGeneralMimeType, + aSrc.ValueText(KMPXMediaGeneralMimeType ) + ); + } + if( atts&EMPXMediaGeneralDate ) // TInt64 + { + aDestination.SetTObjectValueL( KMPXMediaGeneralDate, + aSrc.ValueTObjectL(KMPXMediaGeneralDate ) + ); + } + if( atts&EMPXMediaGeneralDuration ) // TInt + { + aDestination.SetTObjectValueL( KMPXMediaGeneralDuration, + aSrc.ValueTObjectL( KMPXMediaGeneralDuration ) + ); + } + if( atts&EMPXMediaGeneralSynchronized ) // TBool + { + aDestination.SetTObjectValueL( KMPXMediaGeneralSynchronized, + aSrc.ValueTObjectL( KMPXMediaGeneralSynchronized ) + ); + } + if( atts&EMPXMediaGeneralDeleted ) // TBool + { + aDestination.SetTObjectValueL( KMPXMediaGeneralDeleted, + aSrc.ValueTObjectL( KMPXMediaGeneralDeleted ) + ); + } + if( atts&EMPXMediaGeneralModified ) // TBool + { + aDestination.SetTObjectValueL( KMPXMediaGeneralModified, + aSrc.ValueTObjectL( KMPXMediaGeneralModified ) + ); + } + if( atts&KMPXMediaGeneralFlags.iAttributeId ) // TUint + { + aDestination.SetTObjectValueL( KMPXMediaGeneralFlags, + aSrc.ValueTObjectL( KMPXMediaGeneralFlags ) + ); + } + MPX_DEBUG1("CMPXCollectionCachedHelper::DoAppendGeneralL -->"); + } + +// --------------------------------------------------------------------------- +// Copies music media information +// --------------------------------------------------------------------------- +// +void CMPXCollectionCachedHelper::DoAppendMusicL( CMPXMedia& aSrc, + CMPXMedia& aDestination ) + { + MPX_DEBUG1("CMPXCollectionCachedHelper::DoAppendMusicL <--"); + TUint atts = aSrc.AttributesSet( KMPXMediaIdMusic ); + + // Note: Only a subset used by MTP... + // + if( atts&EMPXMediaMusicArtist ) // Text + { + aDestination.SetTextValueL( KMPXMediaMusicArtist, + aSrc.ValueText(KMPXMediaMusicArtist ) + ); + } + if( atts&EMPXMediaMusicAlbum ) // Text + { + aDestination.SetTextValueL( KMPXMediaMusicAlbum, + aSrc.ValueText(KMPXMediaMusicAlbum ) + ); + } + if( atts&EMPXMediaMusicAlbumTrack ) // Text + { + aDestination.SetTextValueL( KMPXMediaMusicAlbumTrack, + aSrc.ValueText(KMPXMediaMusicAlbumTrack ) + ); + } + if( atts&EMPXMediaMusicComposer ) // Text + { + aDestination.SetTextValueL( KMPXMediaMusicComposer, + aSrc.ValueText(KMPXMediaMusicComposer ) + ); + } + if( atts&EMPXMediaMusicYear ) // TInt64 + { + aDestination.SetTObjectValueL( KMPXMediaMusicYear, + aSrc.ValueTObjectL( KMPXMediaMusicYear ) + ); + } + if( atts&EMPXMediaMusicGenre ) // Text + { + aDestination.SetTextValueL( KMPXMediaMusicGenre, + aSrc.ValueText(KMPXMediaMusicGenre ) + ); + } + if( atts&EMPXMediaMusicRating ) // TInt + { + aDestination.SetTObjectValueL( KMPXMediaMusicRating, + aSrc.ValueTObjectL( KMPXMediaMusicRating ) + ); + } + MPX_DEBUG1("CMPXCollectionCachedHelper::DoAppendMusicL -->"); + } + +// --------------------------------------------------------------------------- +// Copies Audio media information +// --------------------------------------------------------------------------- +// +void CMPXCollectionCachedHelper::DoAppendAudioL( CMPXMedia& aSrc, + CMPXMedia& aDestination ) + { + MPX_DEBUG1("CMPXCollectionCachedHelper::DoAppendAudioL <--"); + TUint atts = aSrc.AttributesSet( KMPXMediaIdAudio ); + if( atts&EMPXMediaAudioBitrate ) // TInt + { + aDestination.SetTObjectValueL( KMPXMediaAudioBitrate, + aSrc.ValueTObjectL( KMPXMediaAudioBitrate ) + ); + } + if( atts&EMPXMediaAudioSamplerate ) // TInt + { + aDestination.SetTObjectValueL( KMPXMediaAudioSamplerate, + aSrc.ValueTObjectL( KMPXMediaAudioSamplerate ) + ); + } + if( atts&EMPXMediaAudioNumberOfChannels ) // TInt + { + aDestination.SetTObjectValueL( KMPXMediaAudioNumberOfChannels, + aSrc.ValueTObjectL( KMPXMediaAudioNumberOfChannels ) + ); + } + if( atts&EMPXMediaAudioCodec ) // TInt + { + aDestination.SetTObjectValueL( KMPXMediaAudioAudioCodec, + aSrc.ValueTObjectL( KMPXMediaAudioAudioCodec ) + ); + } + MPX_DEBUG1("CMPXCollectionCachedHelper::DoAppendAudioL -->"); + } + +// --------------------------------------------------------------------------- +// Copies DRM media information +// --------------------------------------------------------------------------- +// +void CMPXCollectionCachedHelper::DoAppendDRML( CMPXMedia& aSrc, + CMPXMedia& aDestination ) + { + MPX_DEBUG1("CMPXCollectionCachedHelper::DoAppendDRML <--"); + TUint atts = aSrc.AttributesSet( KMPXMediaIdDrm ); + + // Note: Only a subset used by MTP... + // + if( atts&EMPXMediaDrmProtected ) // TBool + { + aDestination.SetTObjectValueL( KMPXMediaDrmProtected, + aSrc.ValueTObjectL( KMPXMediaDrmProtected ) + ); + } + if( atts&EMPXMediaDrmRightsStatus ) // TInt + { + aDestination.SetTObjectValueL( KMPXMediaDrmRightsStatus, + aSrc.ValueTObjectL( KMPXMediaDrmRightsStatus ) + ); + } + MPX_DEBUG1("CMPXCollectionCachedHelper::DoAppendDRML -->"); + } + +// --------------------------------------------------------------------------- +// Copies array information +// --------------------------------------------------------------------------- +// +void CMPXCollectionCachedHelper::DoAppendContainerL( CMPXMedia& aSrc, + CMPXMedia& aDestination ) + { + MPX_FUNC("CMPXCollectionCachedHelper::DoAppendContainerL"); + + TUint atts = aSrc.AttributesSet( KMPXMediaIdContainer ); + + if( atts&EMPXMediaArrayContents ) + { + const CMPXMediaArray* medias = + aSrc.Value( KMPXMediaArrayContents ); + if( !medias ) + { + User::Leave( KErrNoMemory ); + } + + aDestination.SetCObjectValueL( + KMPXMediaArrayContents, + const_cast(medias)); + } + if( atts&EMPXMediaArrayCount ) // TInt + { + aDestination.SetTObjectValueL( KMPXMediaArrayCount, + aSrc.ValueTObjectL( KMPXMediaArrayCount ) + ); + } + } + +// --------------------------------------------------------------------------- +// Copies mtp information +// --------------------------------------------------------------------------- +// +void CMPXCollectionCachedHelper::DoAppendMTPL( CMPXMedia& aSrc, + CMPXMedia& aDestination ) + { + MPX_FUNC("CMPXCollectionCachedHelper::DoAppendMTPL"); + + TUint atts = aSrc.AttributesSet( KMPXMediaIdMTP ); + + if( atts&KMPXMediaMTPDrmStatus.iAttributeId) + { + TUint16 val = aSrc.ValueTObjectL(KMPXMediaMTPDrmStatus); + aDestination.SetTObjectValueL( KMPXMediaMTPDrmStatus, val ); + } + } + +// END OF FILE diff -r 000000000000 -r a2952bb97e68 mmappcomponents/collectionhelper/src/mpxcollectionhelpercommon.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/collectionhelper/src/mpxcollectionhelpercommon.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2006 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 helper functions for collection helper +* +*/ + + +#include +#include +#include +#include +#include "mpxcollectionhelpercommon.h" + +// ======== LOCAL FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Send initialize command to plugins +// --------------------------------------------------------------------------- +// +void InitializeCollectionPluginsL( MMPXCollectionUtility& aCollectionUtil ) + { + RArray uid; + CleanupClosePushL( uid ); + + // Initialize/Merge music collection databases + TInt err = KErrNone; + + uid.AppendL( TUid::Uid(EMPXCollectionPluginMusic) ); + TUid collection = aCollectionUtil.CollectionIDL( uid.Array() ); + // Cannot guarantee that KLocalCollection plugin always exists, therefore, + // ignore the case error is KErrNotSupported + TRAP(err, aCollectionUtil.Collection().CommandL( EMcCmdCollectionInit, + collection.iUid ) ); + if( err != KErrNone && err != KErrNotSupported) + { + User::Leave( err ); + } + + // Initialize/Merge podcast databases + uid.Reset(); + uid.AppendL( TUid::Uid(EMPXCollectionPluginPodCast) ); + collection = aCollectionUtil.CollectionIDL( uid.Array() ); + // Cannot guarantee that KPodcastCollection plugin always exists, + // therefore, ignore the case error is KErrNotSupported + TRAP(err, aCollectionUtil.Collection().CommandL( EMcCmdCollectionInit, + collection.iUid ) ); + if( err != KErrNone && err != KErrNotSupported) + { + User::Leave( err ); + } + CleanupStack::PopAndDestroy( &uid ); + } + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/collectionhelper/src/mpxcollectionhelperfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/collectionhelper/src/mpxcollectionhelperfactory.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2006 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: Factory functions to create the update and delete utilities +* +*/ + + +#include +#include "mpxcollectionhelperimp.h" +#include "mpxcollectioncachedhelper.h" + +#include "mpxcollectionuihelperimp.h" +#include "mpxcollectionhelperfactory.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Factory method to create the collection ui helper +// --------------------------------------------------------------------------- +// +EXPORT_C MMPXCollectionUiHelper* CMPXCollectionHelperFactory::NewCollectionUiHelperL(const TUid& aModeId) + { + return CMPXCollectionUiHelperImp::NewL(aModeId); + } + +// --------------------------------------------------------------------------- +// Factory method to create the collection helper +// --------------------------------------------------------------------------- +// +EXPORT_C MMPXCollectionHelper* CMPXCollectionHelperFactory::NewCollectionHelperL() + { + return CMPXCollectionHelperImp::NewL(); + } + +// --------------------------------------------------------------------------- +// Factory method to create the cached collection helper +// --------------------------------------------------------------------------- +// +EXPORT_C MMPXCollectionHelper* CMPXCollectionHelperFactory::NewCollectionCachedHelperL() + { + return CMPXCollectionCachedHelper::NewL(); + } diff -r 000000000000 -r a2952bb97e68 mmappcomponents/collectionhelper/src/mpxcollectionhelperimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/collectionhelper/src/mpxcollectionhelperimp.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,725 @@ +/* +* Copyright (c) 2006 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: Main collection helper interface +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "mpxcollectionhelperfactory.h" +#include "mpxcollectionhelperimp.h" +#include "mpxcollectionhelpercommon.h" +#include "mpxcollectionmediator.h" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CMPXCollectionHelperImp::CMPXCollectionHelperImp() + { + } + + +// --------------------------------------------------------------------------- +// 2nd Phased Constructor +// --------------------------------------------------------------------------- +// +void CMPXCollectionHelperImp::ConstructL() + { + iHvsUtility = CMPXHarvesterFactory::NewL(); + iCollectionUtil = MMPXCollectionUtility::NewL(); + iMediator = CMPXCollectionMediator::NewL( iCollectionUtil->Collection(), + this ); + + RArray ary; + CleanupClosePushL( ary ); + ary.AppendL( TUid::Uid(EMPXCollectionPluginMusic) ); + iMusicCollectionId = iCollectionUtil->CollectionIDL( ary.Array() ); + CleanupStack::PopAndDestroy( &ary ); + } + + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXCollectionHelperImp* CMPXCollectionHelperImp::NewL() + { + CMPXCollectionHelperImp* self = new( ELeave ) CMPXCollectionHelperImp(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXCollectionHelperImp* CMPXCollectionHelperImp::NewLC() + { + CMPXCollectionHelperImp* self = new( ELeave ) CMPXCollectionHelperImp(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// Virtual Destructor +// --------------------------------------------------------------------------- +// +CMPXCollectionHelperImp::~CMPXCollectionHelperImp() + { + if( iHvsUtility ) + { + iHvsUtility->Close(); + } + + if( iCollectionUtil ) + { + iCollectionUtil->Close(); + } + delete iMediator; + } + + +// --------------------------------------------------------------------------- +// Issue collection initialization command to collection framework. +// This is necessary when collection helper serves as an intermediator +// between collection framework and Podcast App or MTP, etc. +// There is, currently, no way to check the merge status of the collections +// through the collection utility API. Therefore, collectionhelper issue +// an EMcCmdCollectionInit(or merge) command before any collectionhelper +// functionality, which expects collection is in valid state, is excuted. +// --------------------------------------------------------------------------- +// + +// --------------------------------------------------------------------------- +// Add a File to the collection +// --------------------------------------------------------------------------- +// +void CMPXCollectionHelperImp::AddL( const TDesC& aFile, + MMPXCollectionHelperObserver* aObserver ) + { + MPX_FUNC("CMPXCollectionHelperImp::AddL"); + MPX_DEBUG2("aFile %S", &aFile); + + // Since this is a file, we must get the harvester to parse the file + // On callback, add the file to collection + // + iObserver = aObserver; + iHvsUtility->GetMediaForFileL(aFile,this); + } + +// --------------------------------------------------------------------------- +// Add a Media Property to the collection +// --------------------------------------------------------------------------- +// +void CMPXCollectionHelperImp::AddL( CMPXMedia* aMedia ) + { + MPX_DEBUG1("CMPXCollectionHelperImp::AddL <--"); + + // + // leave if the given media doesn't contain the following attributes + // + if (!aMedia->IsSupported(KMPXMediaGeneralType) || + !aMedia->IsSupported(KMPXMediaGeneralCategory) || + !aMedia->IsSupported(KMPXMediaGeneralUri)) + { + User::Leave( KErrArgument ); + } + + const TDesC& path = aMedia->ValueText(KMPXMediaGeneralUri); + + // + // For now, the default collection to add this playlist is + // EMPXCollectionPluginMusic. This will be revised later when there is a + // generic way of resolving collections aside from using file extension + // or UID. + // + if ( aMedia->ValueTObjectL(KMPXMediaGeneralType) == EMPXItem && + aMedia->ValueTObjectL(KMPXMediaGeneralCategory) == EMPXPlaylist ) + { + aMedia->SetTObjectValueL( KMPXMediaGeneralCollectionId, + iMusicCollectionId ); + } + + // + // Adding a song + // + else + { + TInt colUid = iHvsUtility->GetColUidForFileL(path); + + MPX_DEBUG2("CMPXCollectionHelperImp::AddL: collection id = %i",colUid); + // Add to collection, make sure we set the collection ID + // + aMedia->SetTObjectValueL(KMPXMediaGeneralCollectionId, + TUid::Uid( colUid ) ); + } + + MPX_DEBUG1("CMPXCollectionHelperImp::AddL: calling DoAddToCollectionL( aMedia )"); + TRAPD(err,DoAddToCollectionL( aMedia )); + MPX_DEBUG2("CMPXCollectionHelperImp::AddL: DoAddToCollectionL( aMedia ); called error %d", err); + + // + // When MTP adds a playlist, the playlist content is represented by the + // given CMPXMedia and a 0-length .pla file is added to the file system + // for syncing with WMP. The URI of the playlist CMPXMedia will contain + // .pla extension. This file will not be added to the harvester database + // because there is no pla playlist plugin supplied and harvester does + // not scan .pla files. It is intentional not to have a pla playlist + // plugin to prevent users from transferring real .pla files to the + // device's file system through USB and have them shown with music icons + // when they cannot be understood by the system. + // + if (err == KErrNone && + aMedia->ValueTObjectL(KMPXMediaGeneralCategory) != EMPXPlaylist) + { + // Add to harvester + iHvsUtility->AddFileL(aMedia); + MPX_DEBUG2(" successfully registered %S with harvester", &path); + } + + MPX_DEBUG1("CMPXCollectionHelperImp::AddL -->"); + } + +// --------------------------------------------------------------------------- +// Remove a file from the collection +// --------------------------------------------------------------------------- +// +void CMPXCollectionHelperImp::RemoveL( const TDesC& aFile, + TMPXGeneralCategory aItemCat ) + { + MPX_FUNC("CMPXCollectionHelperImp::RemoveL"); + MPX_DEBUG3("aFile %S, category %d", &aFile, aItemCat); + + if (aItemCat != EMPXSong && aItemCat != EMPXPlaylist) + { + User::Leave(KErrArgument); + } + + // + // ask harvester to remove the file if any of the following is true: + // 1) removing a song + // 2) removing a playlist scanned through file system. + // + // There are 3 types of playlists. The ones created from the device + // are virtual playlists which have file extension .vir. There are + // no physical playlist files associated with them; hence not + // registered with harvester. For virtual playlists, IsPlaylistL + // will return EFalse because there is not a playlist plugin that + // deals with .vir playlist files. + // + // The ones synced from PC through MTP have file extension .pla. + // There are 0-byte .pla files associated with them but they + // are not registered with harvester either. IsPlaylistL will also + // return EFalse because there is not a playlist plugin that deals + // with .pla. + // + // The 3rd type of playlists is .m3u on the file system. They are + // added to the collection through file scan and registered with + // harvester. IsPlaylistL will return ETrue. + // + // For now virtual playlists and synced playlists are assumed to + // be in the music collection for now until there is a generic way + // resolving collections aside from using file extension or UID. + // + TInt collection(iMusicCollectionId.iUid); + if (aItemCat == EMPXSong || iHvsUtility->IsPlaylistL(aFile)) + { + // Remove from the harvester + collection = iHvsUtility->RemoveFileL( aFile ); + } + + // Remove from the collection + // Construct a CMPXMedia object with URI, collection id, type and category + // + RArray contID; + CleanupClosePushL( contID ); + contID.AppendL( KMPXMediaIdGeneral ); + CMPXMedia* media = CMPXMedia::NewL( contID.Array() ); + CleanupStack::PushL( media ); + + media->SetTextValueL( KMPXMediaGeneralUri, aFile ); + media->SetTObjectValueL( KMPXMediaGeneralCollectionId, TUid::Uid( collection ) ); + media->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem ); + media->SetTObjectValueL( KMPXMediaGeneralCategory, aItemCat ); + + // Remove the item via CMPXCommand + // + CMPXCommand* cmd = CMPXCommand::NewL(); + CleanupStack::PushL( cmd ); + cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, + collection ); + cmd->SetTObjectValueL( KMPXCommandGeneralId, + KMPXCommandIdCollectionRemoveMedia ); + cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue ); + cmd->SetCObjectValueL( KMPXCommandCollectionRemoveMedia, media ); + cmd->SetTObjectValueL( KMPXCommandCollectionRemoveMediaDeleteRecord, + ETrue ); + iCollectionUtil->Collection().CommandL( *cmd ); + CleanupStack::PopAndDestroy( cmd ); + + CleanupStack::PopAndDestroy( media ); + CleanupStack::PopAndDestroy( &contID ); + } + +// --------------------------------------------------------------------------- +// Remove all files from harvester, music and podcast db +// --------------------------------------------------------------------------- +// +void CMPXCollectionHelperImp::RemoveAllL() + { + MPX_FUNC("CMPXCollectionHelperImp::RemoveAllL"); + + // Remove all from harvester + iHvsUtility->RemoveAllFilesL(); + + // Remove all from music collection + iCollectionUtil->Collection().CommandL( EMcCmdRemoveAll, + iMusicCollectionId.iUid ); + + // Remove all from podcast collection + //iCollectionUtil->Collection().CommandL( EMcCmdRemoveAll, + // KPodCastCollecionID); + } + +// --------------------------------------------------------------------------- +// Delete all records marked as deleted +// --------------------------------------------------------------------------- +// +void CMPXCollectionHelperImp::CleanupDeletedMediasL() + { + User::Leave(KErrNotSupported); + } + +// --------------------------------------------------------------------------- +// update the media property based on file path +// --------------------------------------------------------------------------- +// +void CMPXCollectionHelperImp::SetL( CMPXMedia*& aMedia ) + { + MPX_FUNC("CMPXCollectionHelperImp::SetL"); + + // + // leave if the given media doesn't contain the following attributes + // + if (!aMedia->IsSupported(KMPXMediaGeneralType) || + !aMedia->IsSupported(KMPXMediaGeneralCategory) || + !aMedia->IsSupported(KMPXMediaGeneralUri)) + { + User::Leave( KErrArgument ); + } + + // + // leave if not updating a song or a playlist + // + TMPXGeneralCategory category = + aMedia->ValueTObjectL(KMPXMediaGeneralCategory); + + if ((aMedia->ValueTObjectL(KMPXMediaGeneralType) != EMPXItem) || + (category != EMPXSong && category != EMPXPlaylist)) + { + User::Leave( KErrArgument ); + } + + // + // Playlists synced from MTP were not added to harvester's database; + // hence we cannot look up the collection Id through harvester. These + // playlists contain .pla extension when there is no pla playlist + // plugin, so we cannot resolve the collection plugins by extensions + // either. For now, the default collection to add this playlist is + // EMPXCollectionPluginMusic for playlists. This will be revised later + // when there is a generic way of resolving collections aside from using + // file extension or UID. Same for virtual playlists. + // + // Fetch collection id from harvester for songs or scanned playlist + // files. + // + TInt col(iMusicCollectionId.iUid); + const TDesC& path = aMedia->ValueText(KMPXMediaGeneralUri); + + // Fetch collection id from harvester + if (category == EMPXSong || iHvsUtility->IsPlaylistL(path)) + { + col = iHvsUtility->FindCollectionIdL( path ); + } + + // Proxy to collection after we get the correct collection ID + // + aMedia->SetTObjectValueL(KMPXMediaGeneralCollectionId, + TUid::Uid( col ) ); + + // update collection + iMediator->SetItemL( aMedia ); + } + +// --------------------------------------------------------------------------- +// rename a media object +// --------------------------------------------------------------------------- +// +void CMPXCollectionHelperImp::RenameL( const TDesC& aOldUri, + const TDesC& aNewUri, + TMPXGeneralCategory aItemCat ) + { + MPX_FUNC("CMPXCollectionHelperImp::RenameL"); + MPX_DEBUG3("aOldUri = %S, aNewUri = %S", &aOldUri, &aNewUri); + + if (aItemCat != EMPXSong && aItemCat != EMPXPlaylist) + { + User::Leave(KErrArgument); + } + + // find the media using the old URI + RArray attributes; + CleanupClosePushL( attributes ); + attributes.AppendL(KMPXMediaGeneralId); + + CMPXMedia* media = GetL(aOldUri, attributes.Array(), aItemCat); + CleanupStack::PopAndDestroy(&attributes); + CleanupStack::PushL(media); + + // change file path to the new file path + media->SetTextValueL(KMPXMediaGeneralUri, aNewUri); + + // ask harvester to rename the file if any of the following is true: + // 1) renaming a song + // 2) renaming a playlist scanned through file system. + // + // There are 3 types of playlists. The ones created from the device + // are virtual playlists which have file extension .vir. There are + // no physical playlist files associated with them; hence not + // registered with harvester. For virtual playlists, IsPlaylistL + // will return EFalse because there is not a playlist plugin that + // deals with .vir playlist files. + // + // The ones synced from PC through MTP have file extension .pla. + // There are 0-byte .pla files associated with them but they + // are not registered with harvester either. IsPlaylistL will also + // return EFalse because there is not a playlist plugin that deals + // with .pla. + // + // The 3rd type of playlists is .m3u on the file system. They are + // added to the collection through file scan and registered with + // harvester. IsPlaylistL will return ETrue. + if (aItemCat == EMPXSong || iHvsUtility->IsPlaylistL(aOldUri)) + { + const TUid& collection = + media->ValueTObjectL(KMPXMediaGeneralCollectionId); + iHvsUtility->RenameFileL( aOldUri, aNewUri, collection.iUid ); + } + + // Update collection via CMPXCommand + // + CMPXCommand* cmd = CMPXCommand::NewL(); + CleanupStack::PushL( cmd ); + cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdCollectionSet ); + TUid colId (media->ValueTObjectL(KMPXMediaGeneralCollectionId) ); + cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, colId.iUid ); + cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue ); + cmd->SetCObjectValueL( KMPXCommandColSetMedia, media ); + iCollectionUtil->Collection().CommandL( *cmd ); + CleanupStack::PopAndDestroy( cmd ); + + CleanupStack::PopAndDestroy(media); + } + +// --------------------------------------------------------------------------- +// Retrieve a media object based on file path +// --------------------------------------------------------------------------- +// +CMPXMedia* CMPXCollectionHelperImp::GetL( const TDesC& aFile, + const TArray& aAttrs, + TMPXGeneralCategory aItemCat ) + { + MPX_FUNC("CMPXCollectionHelperImp::GetL"); + MPX_DEBUG2("aFile %S", &aFile); + + if (aItemCat != EMPXSong && aItemCat != EMPXPlaylist) + { + User::Leave(KErrArgument); + } + + // Playlists synced through MTP contains .pla extension and there + // is no pla playlist plugin. We can no longer reply on harvester + // utility's IsPlaylistL to determine if this is a playlist. + // For now, the default collection to get this playlist is + // EMPXCollectionPluginMusic for playlists. This will be revised + // later when there is a generic way of resolving collections aside + // from using file extension or UID. Same for virtual playlists. + // + // Find the collection Id from harvester for songs or playlists + // scanned from the file system + TInt col(iMusicCollectionId.iUid); + if (aItemCat == EMPXSong || iHvsUtility->IsPlaylistL(aFile)) + { + col = iHvsUtility->FindCollectionIdL( aFile ); + } + + // Search criteria + // + CMPXMedia* search = CMPXMedia::NewL(); + CleanupStack::PushL( search ); + search->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem ); + search->SetTObjectValueL( KMPXMediaGeneralCategory, aItemCat ); + search->SetTObjectValueL( KMPXMediaGeneralCollectionId, TUid::Uid(col) ); + search->SetTextValueL( KMPXMediaGeneralUri, aFile ); + + // Search in synch mode + // + CMPXMedia* result = iCollectionUtil->Collection().FindAllL( *search, aAttrs ); + CleanupStack::PopAndDestroy( search ); + CleanupStack::PushL(result); + + const CMPXMediaArray* ary(NULL); + if( result->IsSupported( KMPXMediaArrayContents ) ) + { + ary = result->Value(KMPXMediaArrayContents); + if( !ary ) + { + User::Leave(KErrNoMemory); + } + } + + CMPXMedia* foundMedia(NULL); + + switch ( ary && ary->Count() ) //lint !e961 + { + case 0: + User::Leave(KErrNotFound); + case 1: + { + foundMedia = CMPXMedia::NewL(*ary->AtL(0)); + CleanupStack::PushL(foundMedia); + foundMedia->SetTObjectValueL( + KMPXMediaGeneralCollectionId, TUid::Uid(col) ); + CleanupStack::Pop(foundMedia); + break; + } + default: + User::Leave(KErrCorrupt); + } + + CleanupStack::PopAndDestroy(result); + + return foundMedia; + } + +// --------------------------------------------------------------------------- +// Gets the attributes of some media object +// --------------------------------------------------------------------------- +// +const CMPXMedia& CMPXCollectionHelperImp::GetL( const TDesC& /*aFile*/, + TMPXGeneralCategory /*aItemCat*/ ) + { + User::Leave(KErrNotSupported); + + /* avoid compilation warnings */ + CMPXMedia* dummy(NULL); + return *dummy; + } + +// --------------------------------------------------------------------------- +// Find function to return a list of songs +// --------------------------------------------------------------------------- +// +CMPXMedia* CMPXCollectionHelperImp::FindAllL( CMPXMedia& aCriteria, + const TArray& aAttrs ) + { + MPX_FUNC("CMPXCollectionHelperImp::FindAllL"); + + // Search criteria, add the collection to search from + // + aCriteria.SetTObjectValueL( KMPXMediaGeneralCollectionId, + iMusicCollectionId ); + + // Search in synch mode + // + return iCollectionUtil->Collection().FindAllL( aCriteria, aAttrs ); + } + +// --------------------------------------------------------------------------- +// Handles completion of playlist export +// to-do: this should be changed to HandlePlaylistExportCompleted +// --------------------------------------------------------------------------- +// +void CMPXCollectionHelperImp::HandlePlaylistExportCompletedL( CMPXMedia* aMedia, + TInt /*aErr*/ ) + { + // Not used + delete aMedia; + } + +// --------------------------------------------------------------------------- +// From MMPXHarvesterUtilityObserver +// --------------------------------------------------------------------------- +// +void CMPXCollectionHelperImp::HandlePlaylistImportCompletedL( CMPXMedia* aMedia, + TInt /*aErr*/ ) + { + // Not used + delete aMedia; + } + +// --------------------------------------------------------------------------- +// From MMPXHarvesterUtilityObserver +// --------------------------------------------------------------------------- +// +void CMPXCollectionHelperImp::HandleFileAddCompletedL( CMPXMedia* aMedia, + TInt aErr ) + { + MPX_FUNC("CMPXCollectionHelperImp::HandleFileAddCompletedL"); + MPX_DEBUG2("err = %d", aErr); + + CleanupStack::PushL( aMedia ); + + // Add to collection + // + TInt err( aErr ); + if( aErr == KErrNone ) + { + TRAP( err, DoAddToCollectionL( aMedia ) ); + } + + // Callback to the observer + // + if( iObserver ) + { + iObserver->HandleAddFileCompleteL( err ); + iObserver = NULL; + } + CleanupStack::PopAndDestroy( aMedia ); + } + +// --------------------------------------------------------------------------- +// From MMPXHarvesterUtilityObserver +// --------------------------------------------------------------------------- +// +void CMPXCollectionHelperImp::HandleDeleteCompletedL( TInt /*aErr*/ ) + { + // not used. + } + +// --------------------------------------------------------------------------- +// From MMPXHarvesterUtilityObserver +// --------------------------------------------------------------------------- +// +void CMPXCollectionHelperImp::HandleFileImportCompletedL( CMPXMedia* aMedia, + TInt /*aErr*/ ) + { + delete aMedia; + // not used + } + +// --------------------------------------------------------------------------- +// From MMPXHarvesterUtilityObserver +// --------------------------------------------------------------------------- +// +void CMPXCollectionHelperImp::HandleFileGetMediaCompletedL( CMPXMedia* aMedia, + TInt aErr ) + { + MPX_FUNC("CMPXCollectionHelperImp::HandleFileGetMediaCompletedL"); + MPX_DEBUG2("err = %d", aErr); + + CleanupStack::PushL( aMedia ); + + // Add to collection + TInt err(aErr); + if( err == KErrNone ) + { + if (!aMedia->IsSupported(KMPXMediaGeneralCollectionId)) + { + if (aMedia->IsSupported(KMPXMediaGeneralUri)) + { + TRAP(err, + aMedia->SetTObjectValueL(KMPXMediaGeneralCollectionId, + TUid::Uid(iHvsUtility->GetColUidForFileL(aMedia->ValueText(KMPXMediaGeneralUri)))); + ); + } + else + { + err = KErrArgument; + } + } + } + if ( err == KErrNone ) + { + TRAP(err, DoAddToCollectionL( aMedia )); + } + if( err == KErrNone ) + { + // Add to harvester + TRAP(err,iHvsUtility->AddFileL(aMedia)); + } + + // Callback to the observer + // + if( iObserver ) + { + iObserver->HandleAddFileCompleteL( err ); + iObserver = NULL; + } + CleanupStack::PopAndDestroy( aMedia ); + } + +// --------------------------------------------------------------------------- +// From MMPXMediatorObserver +// --------------------------------------------------------------------------- +// +void CMPXCollectionHelperImp::HandleMediatorPathUpdatedL( CMPXMedia*& aMedia, + TUid /*aOldPath*/ ) + { + iHvsUtility->UpdateFileL( aMedia ); + } + +// --------------------------------------------------------------------------- +// Add a file to the collection through the mediator +// --------------------------------------------------------------------------- +// +void CMPXCollectionHelperImp::DoAddToCollectionL( CMPXMedia* aMedia ) + { + iMediator->AddItemL( aMedia ); + } + +// --------------------------------------------------------------------------- +// Frees this object +// --------------------------------------------------------------------------- +// +void CMPXCollectionHelperImp::Close() + { + delete this; + } + +// End of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/collectionhelper/src/mpxcollectionuihelperimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/collectionhelper/src/mpxcollectionuihelperimp.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,2070 @@ +/* +* Copyright (c) 2006 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: Collection Ui Helper implementation +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mpxcollectionuihelperobserver.h" +#include "mpxcollectionuihelperimp.h" +#include "mpxcollectionhelpercommon.h" +#include "mpxdeletehelper.h" + +// CONSTANTS +const TInt KMPXAllSongsViewIndex = 0; +const TInt KMPXPlaylistViewIndex = 1; +const TInt KMPXRecentlyPlayedIndex = 0x20000000; +const TInt KMPXMostPlayedIndex = 0x20000001; +const TInt KMPXRecentlyAddedIndex = 0x20000002; + +_LIT( KPathVirtualPlaylistHandling, "openpath.dat"); + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Private Constructor +// --------------------------------------------------------------------------- +// +CMPXCollectionUiHelperImp::CMPXCollectionUiHelperImp() + { + } + + +// --------------------------------------------------------------------------- +// 2nd Phase Constructor +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::ConstructL(const TUid& aModeId) + { + iCollection = MMPXCollectionUtility::NewL(this,aModeId); + iMediator = CMPXCollectionMediator::NewL( iCollection->Collection(), + this ); + iHarvester = CMPXHarvesterFactory::NewL(); + iTaskQueue = CMPXActiveTaskQueue::NewL(); + iDeleteHelper = CMPXDeleteHelper::NewL(*iCollection, *iHarvester, *this); + + iRemainder = 0; + iTotalChunkNumber = 0; + iChunkNumber = 0; + iChunkSize = 0; + iArrayIndex = 0; + } + + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXCollectionUiHelperImp* CMPXCollectionUiHelperImp::NewL(const TUid& aModeId) + { + CMPXCollectionUiHelperImp* self = CMPXCollectionUiHelperImp::NewLC(aModeId); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXCollectionUiHelperImp* CMPXCollectionUiHelperImp::NewLC(const TUid& aModeId) + { + CMPXCollectionUiHelperImp* self = new( ELeave ) CMPXCollectionUiHelperImp(); + CleanupStack::PushL( self ); + self->ConstructL(aModeId); + return self; + } + +// --------------------------------------------------------------------------- +// Virtual Destructor +// --------------------------------------------------------------------------- +// +CMPXCollectionUiHelperImp::~CMPXCollectionUiHelperImp() + { + delete iMediator; + if( iCollection ) + { + iCollection->Close(); + } + if( iHarvester ) + { + iHarvester->Close(); + } + delete iTaskQueue; + delete iMedia; + delete iDeleteHelper; + + delete iInputMedia; + } + + +// --------------------------------------------------------------------------- +// Issue collection initialization command to collection framework. +// This is necessary when collection helper serves as an intermediator +// between collection framework and Podcast App or MTP, etc. +// There is, currently, no way to check the merge status of the collections +// through the collection utility API. Therefore, collectionhelper issue +// an EMcCmdCollectionInit(or merge) command before any collectionhelper +// functionality, which expects collection is in valid state, is excuted. +// --------------------------------------------------------------------------- +// + +// --------------------------------------------------------------------------- +// Add a Media to the collection +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::AddL( const CMPXMedia& aMedia, + MMPXCHelperObserver* aObserver ) + { + if (!aObserver) + { + User::Leave( KErrArgument ); + } + + // + // leave if the given media doesn't contain the following attributes + // + if (!aMedia.IsSupported(KMPXMediaGeneralType) || + !aMedia.IsSupported(KMPXMediaGeneralCategory)) + { + User::Leave( KErrArgument ); + } + + // + // leave if the given media isn't a playlist (i.e. type must be EMPXItem and category + // must be EMPXPlaylist + // + TMPXGeneralType mediaType = + aMedia.ValueTObjectL(KMPXMediaGeneralType); + + TMPXGeneralCategory mediaCategory = + aMedia.ValueTObjectL(KMPXMediaGeneralCategory); + + // + // currently only supporting playlists + // + if ( mediaType != EMPXItem || + mediaCategory != EMPXPlaylist ) + { + User::Leave( KErrNotSupported ); + } + + // + // leave if the media doesn't contain mandatory attributes for adding a playlist + // or adding (appending) tracks to an existing playlist. + // Required attributes for adding a new playlist are: + // type, category, array contents, array counts, title, and path for playlist + // Required attributes for adding tracks to an existing playlist are: + // type, category, array contents, array counts, and playlist Id + // + if (!aMedia.IsSupported(KMPXMediaArrayContents) || + !aMedia.IsSupported(KMPXMediaArrayCount)) + { + User::Leave( KErrArgument ); + } + + TInt task(ETaskNone); + if (!aMedia.IsSupported(KMPXMediaGeneralId)) + { + if (!aMedia.IsSupported(KMPXMediaGeneralTitle) || + !aMedia.IsSupported(KMPXMediaGeneralUri)) + { + User::Leave( KErrArgument ); + } + else + { + task = ETaskAddMedia; + } + } + else + { + task = ETaskAppendMedia; + } + + // + // externalize parameters + // + CBufBase* taskParam(NULL); + ::CreateBufferL( aMedia, taskParam ); + CleanupStack::PushL(taskParam); + + // Increase reference count for task queue + CMPXMedia* ref = CMPXMedia::NewL( aMedia ); + CleanupStack::PushL(ref); + + // + // add request to the task queue + // + iTaskQueue->AddTaskL( task, + aObserver, // callback when task completed + this, // task queue observer + 0, // Integer paramter, not used + taskParam, // task queue assumes ownership of taskParam + NULL, // Ptr data + ref ); // ownership transferred + + CleanupStack::Pop(2, taskParam); // ref & task Param + } + +// --------------------------------------------------------------------------- +// Increment Addition +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::IncAddL( const CMPXMedia& aMedia, + MMPXCHelperObserver* aObserver, + const TInt aSize ) + { + if (!aObserver) + { + User::Leave( KErrArgument ); + } + + // + // leave if the given media doesn't contain the following attributes + // + if (!aMedia.IsSupported(KMPXMediaGeneralType) || + !aMedia.IsSupported(KMPXMediaGeneralCategory)) + { + User::Leave( KErrArgument ); + } + + // + // leave if the given media isn't a playlist (i.e. type must be EMPXItem and category + // must be EMPXPlaylist + // + TMPXGeneralType mediaType = + aMedia.ValueTObjectL(KMPXMediaGeneralType); + + TMPXGeneralCategory mediaCategory = + aMedia.ValueTObjectL(KMPXMediaGeneralCategory); + + // + // currently only supporting playlists + // + if ( mediaType != EMPXItem || + mediaCategory != EMPXPlaylist ) + { + User::Leave( KErrNotSupported ); + } + + // + // leave if the media doesn't contain mandatory attributes for adding a playlist + // or adding (appending) tracks to an existing playlist. + // Required attributes for adding a new playlist are: + // type, category, array contents, array counts, title, and path for playlist + // Required attributes for adding tracks to an existing playlist are: + // type, category, array contents, array counts, and playlist Id + // + if (!aMedia.IsSupported(KMPXMediaArrayContents) || + !aMedia.IsSupported(KMPXMediaArrayCount)) + { + User::Leave( KErrArgument ); + } + + TInt task(ETaskNone); + if (!aMedia.IsSupported(KMPXMediaGeneralId)) + { + if (!aMedia.IsSupported(KMPXMediaGeneralTitle) || + !aMedia.IsSupported(KMPXMediaGeneralUri)) + { + User::Leave( KErrArgument ); + } + else + { + task = ETaskAddMedia; + } + } + else + { + task = ETaskAppendMedia; + } + + // get tracks from input media + // since using Value instead of ValueCObject, no Push/Pop + CMPXMediaArray* tracksArray = + aMedia.Value( KMPXMediaArrayContents ); + + // use incremental add only if number of songs > aSize + // this is needed as IncAdd does not deal w/ the case when tracksArray->Count() == aSize + if( tracksArray->Count() <= aSize || aSize <= 0 ) + { + // + // externalize parameters + // + CBufBase* taskParam(NULL); + ::CreateBufferL( aMedia, taskParam ); + CleanupStack::PushL(taskParam); + + // Increase reference count for task queue + CMPXMedia* ref = CMPXMedia::NewL( aMedia ); + CleanupStack::PushL(ref); + + // + // add request to the task queue + // + iTaskQueue->AddTaskL( task, + aObserver, // callback when task completed + this, // task queue observer + 0, // Integer paramter, not used + taskParam, // task queue assumes ownership of taskParam + NULL, // Ptr data + ref ); // ownership transferred + + CleanupStack::Pop(2, taskParam); // ref & task Param + } + else // Inc Add + { + // calculate number of songs in the last chunk + iRemainder = tracksArray->Count() % aSize; + + // calculate the number of iterations/chunks needed to divide the songs + // each chunk contians aSize number of songs + if( iRemainder == 0 ) + { + iTotalChunkNumber = tracksArray->Count() / aSize; + } + else + { + iTotalChunkNumber = tracksArray->Count() / aSize + 1; + } + + iChunkNumber = 0; // initialize chunk number + iChunkSize = aSize; + + // need this in the case multiple Inc Add is called (if something leaves and + // iInputMedia was not cleaned up properly) + if( iInputMedia ) + { + delete iInputMedia; + iInputMedia = NULL; + } + + // save needed info for subsequent processing + iInputMedia = CMPXMedia::CopyL(aMedia); + iArrayIndex = 0; // index on tracksArray of the input media + + for( int i = 0; i < iTotalChunkNumber; i++ ) + { + if( task == ETaskAddMedia ) + { + // schedule the adding requests to the task queue + iTaskQueue->AddTaskL( ETaskIncAddMedia, + aObserver, // callback when task completed + this ); // task queue observer + } + else // ETaskAppendMedia + { + // schedule the appending requests to the task queue + iTaskQueue->AddTaskL( ETaskIncAppendMedia, + aObserver, // callback when task completed + this ); // task queue observer + } + } + } + + } + + + + +// --------------------------------------------------------------------------- +// Update a single media property +// Checks for podcast changes in gendre +// Checks for "PodCast" gendre +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::SetL( CMPXMedia*& aMedia, + MMPXCHelperObserver* aObserver ) + { + MPX_FUNC("CMPXCollectionUiHelperImp::SetL"); + + if (!aObserver) + { + User::Leave( KErrArgument ); + } + + // + // leave if the given media doesn't contain the following attributes + // + if (!aMedia->IsSupported(KMPXMediaGeneralType) || + !aMedia->IsSupported(KMPXMediaGeneralCategory)) + { + User::Leave( KErrArgument ); + } + + // + // externalize parameters + // + CBufBase* taskParam(NULL); + ::CreateBufferL( *aMedia, taskParam ); + CleanupStack::PushL(taskParam); + + // + // add request to the task queue + // + CMPXMedia* ref = CMPXMedia::NewL( *aMedia ); // ownership transferred + CleanupStack::PushL(ref); + + iTaskQueue->AddTaskL( ETaskSetMedia, + aObserver, // callback when task completed + this, // task queue observer + 0, // Integer paramter, not used + taskParam, // task queue assumes ownership of taskParam + NULL, // ptr data + ref ); // keep reference count alive + + CleanupStack::Pop(2, taskParam); // ref & taskParam + } + +// --------------------------------------------------------------------------- +// Update a list of medias, checks for podcast changes in genre +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::SetL( TArray& aMediaArray, + CMPXCollectionPath& aPath, + RArray& aIndices ) + { + iMediator->SetItemL( aMediaArray, aPath, aIndices ); + } + +// --------------------------------------------------------------------------- +// rename a media +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::RenameL( const CMPXMedia& aMedia, + MMPXCHelperObserver* aObserver ) + { + if (!aObserver) + { + User::Leave( KErrArgument ); + } + + // + // leave if the given media doesn't contain the following attributes + // + if (!aMedia.IsSupported(KMPXMediaGeneralType) || + !aMedia.IsSupported(KMPXMediaGeneralCategory)) + { + User::Leave( KErrArgument ); + } + + // + // leave if the given media isn't a playlist + // + TMPXGeneralType mediaType = + aMedia.ValueTObjectL(KMPXMediaGeneralType); + + TMPXGeneralCategory mediaCategory = + aMedia.ValueTObjectL(KMPXMediaGeneralCategory); + + // + // currently only supporting playlists + // + if ( mediaType != EMPXItem || + mediaCategory != EMPXPlaylist ) + { + User::Leave( KErrNotSupported ); + } + + // + // leave if the media doesn't contain mandatory attributes for renaming a playlist + // + if (!aMedia.IsSupported(KMPXMediaGeneralTitle) || + !aMedia.IsSupported(KMPXMediaGeneralId)) + { + User::Leave( KErrArgument ); + } + + // + // externalize parameters + // + CBufBase* taskParam(NULL); + ::CreateBufferL( aMedia, taskParam ); + CleanupStack::PushL(taskParam); + + // Keep media alive + CMPXMedia* ref = CMPXMedia::NewL( aMedia ); + CleanupStack::PushL(ref); + + // + // add request to the task queue + // + iTaskQueue->AddTaskL( ETaskRenameMedia, + aObserver, // callback when task completed + this, // task queue observer + 0, // Integer paramter, not used + taskParam, // task queue assumes ownership of taskParam + NULL, // ptr data + ref ); // ownership transferred + + CleanupStack::Pop(2, taskParam); // ref & taskParam + } + +// --------------------------------------------------------------------------- +// Delete a collection path and the files +// associated with each leaf node in the path +// 1: Removes the file from Collection db +// 2: Deletes the file from FS +// 3: Removes the file from Harvester db +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::DeleteL( CMPXCollectionPath& aPath, + MMPXCHelperObserver* aObs ) + { + if (!aObs) + { + User::Leave(KErrArgument); + } + + MPX_DEBUG_PATH(aPath); + + // + // externalize parameters + // + CBufBase* taskParam(NULL); + ::CreateBufferL( aPath, taskParam ); + CleanupStack::PushL(taskParam); + + // + // add request to the task queue + // + iTaskQueue->AddTaskL( ETaskRemoveMedia, + aObs, // callback when task completed + this, // task queue observer + 0, // Integer paramter, not used + taskParam); // task queue assumes ownership of taskParam + + CleanupStack::Pop(taskParam); + } + +// --------------------------------------------------------------------------- +// Move an item from one collection to another +// 0: Convert enum to collection lookup UID +// 1: Removes the item from the old collection +// 2: Adds the item to the new collection using mediator +// (Mediator sets genre "Podcast" to "Unknown" if we move from Music -> Podcast +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::MoveL( CMPXMedia*& aMedia, + TUid aNewCollection, + MMPXCHelperObserver* aObs ) + { + if (!aMedia->IsSupported(KMPXMediaGeneralCollectionId)) + { + User::Leave(KErrArgument); + } + + // Lookup the collection + // + RArray ary; + CleanupClosePushL( ary ); + ary.AppendL( aNewCollection ); + TUid newuid = iCollection->CollectionIDL( ary.Array() ); + CleanupStack::PopAndDestroy( &ary ); + + // Move with mediator + // + const TUid& olduid = aMedia->ValueTObjectL( KMPXMediaGeneralCollectionId ); + + iHelperObserver = aObs; + if( !aObs ) + { + iMediator->MoveItemL( aMedia, olduid, newuid ); + } + else + { + // Should i add this to the task queue? need to think about it + iMediator->MoveItemL( aMedia, olduid, newuid, this ); + } + + // Notify harvester of the explicit move in collection + // + aMedia->SetTObjectValueL(KMPXMediaGeneralCollectionId, newuid); + iHarvester->UpdateFileL( aMedia ); + } + +// --------------------------------------------------------------------------- +// Open the collection in embedded mode for a media +// Cannot cleanup aObs because UPnP is using this. +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::OpenL( const TUid& aHostId, CMPXMedia& aMedia, + MMPXCHelperEmbeddedOpenObserver* /*aObs*/, + TInt aPluginInfo ) + { + // Grab the in memory collection plugin UID + // aPluginInfo provides additional resolution to find the plugin + // + RArray ary; + CleanupClosePushL( ary ); + ary.AppendL( TUid::Uid(EMPXCollectionPluginHidden) ); + ary.AppendL( TUid::Uid(EMPXCollectionPluginTemporary) ); + if( aPluginInfo ) + { + ary.AppendL( TUid::Uid(aPluginInfo) ); + } + + TUid inMemCollection = iCollection->CollectionIDL( ary.Array() ); + CleanupStack::PopAndDestroy( &ary ); + + // First step is to add this media to the in memory plugin + // Set the item id to be the host ID + // + aMedia.SetTObjectValueL( KMPXMediaGeneralCollectionId, inMemCollection ); + aMedia.SetTObjectValueL( KMPXMediaGeneralId, aHostId.iUid ); + + // Add the media via CMPXCommand + CMPXCommand* cmd = CMPXCommand::NewL(); + CleanupStack::PushL( cmd ); + cmd->SetTObjectValueL( KMPXCommandGeneralId, + KMPXCommandIdCollectionAdd ); + cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, + ETrue ); + cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, + inMemCollection.iUid ); + cmd->SetCObjectValueL( KMPXCommandColAddMedia, + &aMedia ); + iCollection->Collection().CommandL( *cmd ); + CleanupStack::PopAndDestroy( cmd ); + + // Second Step is to construct collection path + // | collection id | host id | + // + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL( path ); + path->AppendL( inMemCollection.iUid ); + path->AppendL( aHostId.iUid ); + + // Last step is to open this path + // + iCollection->Collection().OpenL( *path ); + CleanupStack::PopAndDestroy( path ); + } + +// --------------------------------------------------------------------------- +// Open the collection in embedded mode for a file handle +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::OpenL( const TUid& aHostId, const TDesC& aFile, + MMPXCHelperEmbeddedOpenObserver* aObs, + TInt aPluginInfo ) + { + + // Open in embedded mode, no database merge necessary + if( !aObs ) + { + User::LeaveIfError( KErrArgument ); + } + + iEmbeddedModeID = aHostId; + iEmbeddedPluginInfo = aPluginInfo; + iOpenObserver = aObs; + + iHarvester->ImportFileL( aFile, this ); + } + +// --------------------------------------------------------------------------- +// Open the collection in embedded mode for a file handle +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::OpenL( RFile& aFile, + MMPXCHelperEmbeddedOpenObserver* aObs ) + { + MPX_FUNC( "CMPXCollectionUiHelperImp::OpenL (file handle, observer)" ); + // Open in embedded mode, no database merge necessary + if( !aObs ) + { + User::Leave( KErrArgument ); + } + + iOpenObserver = aObs; + TMPXGeneralCategory category( EMPXNoCategory ); + + CFileStore* store( NULL ); + MPX_TRAPD( error, store = CDirectFileStore::FromL( aFile ); ); + + if ( error == KErrNone ) + { + CleanupStack::PushL( store ); + + RStoreReadStream stream; + stream.OpenLC( *store, store->Root() ); + + // Recreate the collection path that we were browsing + CMPXCollectionPath* collectionPath = CMPXCollectionPath::NewL( stream ); + CleanupStack::PopAndDestroy( 2, store ); // stream, store + CleanupStack::PushL( collectionPath ); + + MPX_DEBUG_PATH( *collectionPath ); + + if ( collectionPath->Levels() != 3 || + ( collectionPath->Id(1) != KMPXAllSongsViewIndex && + collectionPath->Id(1) != KMPXPlaylistViewIndex ) ) + { + error = KErrNotSupported; + } + else + { + category = collectionPath->Id( 1 ) == + KMPXAllSongsViewIndex ? EMPXSong : EMPXPlaylist; + TRAP( error, iCollection->Collection().OpenL( *collectionPath ) ); + } + CleanupStack::PopAndDestroy( collectionPath ); + } + + // Callback to observer for err handling + ( ( MMPXCHelperEmbeddedOpenObserver* )iOpenObserver )->HandleEmbeddedOpenL( error, category ); + } + +// --------------------------------------------------------------------------- +// Queries about the playlist file extension of the currently selected playlist +// plugin +// --------------------------------------------------------------------------- +HBufC* CMPXCollectionUiHelperImp::PlaylistFileExtensionLC() + { + // default to M3U playlist type for now + return iHarvester->PlaylistFileExtensionLC(EMPXPlaylistTypeM3U); + } + +// --------------------------------------------------------------------------- +// Export a playlist +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::ExportPlaylistL(TMPXItemId aPlaylistId, + const TDesC& aDestinationDriveAndPath, + MMPXCHelperObserver* aObs) + { + if (!aObs) + { + User::Leave(KErrArgument); + } + + CMPXMedia* media = CMPXMedia::NewL(); + CleanupStack::PushL(media); + + media->SetTObjectValueL(KMPXMediaGeneralId, aPlaylistId); + media->SetTextValueL(KMPXMediaGeneralUri, aDestinationDriveAndPath); + + // + // externalize parameters + // + CBufBase* taskParam(NULL); + ::CreateBufferL( *media, taskParam ); + CleanupStack::PushL(taskParam); + + // + // add request to the task queue + // + iTaskQueue->AddTaskL( ETaskExportPlaylist, + aObs, // callback when task completed + this, // task queue observer + 0, // Integer paramter, not used + taskParam, // task queue assumes ownership of taskParam + NULL, + media ); // keep media alive, ownership transferred + + CleanupStack::Pop(2, media); // taskParam & media + } + +// --------------------------------------------------------------------------- +// Reorder a song in a playlist +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::ReorderPlaylistL(const TMPXItemId& aPlaylistId, + const TMPXItemId& aSongId, + TUint aOriginalOrdinal, + TUint aNewOrdinal, + MMPXCHelperObserver* aObs) + { + if (!aObs) + { + User::Leave(KErrArgument); + } + + CMPXMedia* command = CMPXMedia::NewL(); + CleanupStack::PushL(command); + + command->SetTObjectValueL(KMPXCommandReorderPlaylistId, aPlaylistId); + command->SetTObjectValueL(KMPXCommandReorderSongId, aSongId); + command->SetTObjectValueL(KMPXCommandReorderOriginalOrdinal, aOriginalOrdinal); + command->SetTObjectValueL(KMPXCommandReorderNewOrdinal, aNewOrdinal); + + // + // externalize parameters + // + CBufBase* taskParam(NULL); + ::CreateBufferL( *command, taskParam ); + CleanupStack::PushL(taskParam); + + // + // add request to the task queue + // + iTaskQueue->AddTaskL( ETaskReorderPlaylist, + aObs, // callback when task completed + this, // task queue observer + 0, // Integer paramter, not used + taskParam, // task queue assumes ownership of taskParam + NULL, + command ); // keep media alive, ownership transferred + + CleanupStack::Pop(2, command); // taskParam & media + } + +// --------------------------------------------------------------------------- +// Creates a default collection path to the music menu +// --------------------------------------------------------------------------- +// +CMPXCollectionPath* CMPXCollectionUiHelperImp::MusicMenuPathL() + { + // Get top level path only, no database merge necessary + + // Convert the Virtual UID to the real UID + RArray ary; + CleanupClosePushL( ary ); + ary.AppendL( TUid::Uid(EMPXCollectionPluginMusic) ); + TUid musicCollection = iCollection->CollectionIDL( ary.Array() ); + CleanupStack::PopAndDestroy( &ary ); + + // Second Step is to construct collection path + // | collection id | + // + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL( path ); + path->AppendL( musicCollection.iUid ); + CleanupStack::Pop( path ); + + return path; + } + +// --------------------------------------------------------------------------- +// Creates a default collection path to the podcast menu +// --------------------------------------------------------------------------- +// +CMPXCollectionPath* CMPXCollectionUiHelperImp::PodCastMenuPathL() + { + // Get top level path only, no database merge necessary + + // Convert the Virtual UID to the real UID + RArray ary; + CleanupClosePushL( ary ); + ary.AppendL( TUid::Uid(EMPXCollectionPluginPodCast) ); + TUid pcCollection = iCollection->CollectionIDL( ary.Array() ); + CleanupStack::PopAndDestroy( &ary ); + + // Second Step is to construct collection path + // | collection id | + // + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL( path ); + path->AppendL( pcCollection.iUid ); + CleanupStack::Pop( path ); + + return path; + } + +// --------------------------------------------------------------------------- +// Creates a default collection path to the music all songs +// --------------------------------------------------------------------------- +// +CMPXCollectionPath* CMPXCollectionUiHelperImp::MusicAllSongsPathL() + { + CMPXCollectionPath* path = MusicMenuPathL(); + CleanupStack::PushL( path ); + path->AppendL( KMPXAllSongsViewIndex ); + CleanupStack::Pop( path ); + + return path; + } + +// --------------------------------------------------------------------------- +// Creates a default collection path to the music playlist +// --------------------------------------------------------------------------- +// +CMPXCollectionPath* CMPXCollectionUiHelperImp::MusicPlaylistPathL() + { + CMPXCollectionPath* path = MusicMenuPathL(); + CleanupStack::PushL( path ); + path->AppendL( KMPXPlaylistViewIndex ); + CleanupStack::Pop( path ); + + return path; + } + +// --------------------------------------------------------------------------- +// Creates a default collection path to the music auto playlist +// --------------------------------------------------------------------------- +// +CMPXCollectionPath* CMPXCollectionUiHelperImp::MusicPlaylistPathL(TMPXAutoPlaylistType aPlaylistType) + { + CMPXCollectionPath* path = MusicPlaylistPathL(); + CleanupStack::PushL( path ); + if ( aPlaylistType == EMPXRecentlyPlayedPlaylist ) + { + path->AppendL( KMPXRecentlyPlayedIndex ); + } + else if ( aPlaylistType == EMPXMostPlayedPlaylist ) + { + path->AppendL( KMPXMostPlayedIndex ); + } + else if ( aPlaylistType == EMPXRecentlyAddedPlaylist) + { + path->AppendL( KMPXRecentlyAddedIndex ); + } + CleanupStack::Pop( path ); + + return path; + } + +// --------------------------------------------------------------------------- +// Creates a default collection playlist hard coded to all songs of +// music database +// --------------------------------------------------------------------------- +// +CMPXCollectionPath* CMPXCollectionUiHelperImp::CreateDefaultPlaylistPathLC() + { + // Get top level path only, no database merge necessary + + // Convert the Virtual UID to the real UID + RArray ary; + CleanupClosePushL( ary ); + ary.AppendL( TUid::Uid(EMPXCollectionPluginMusic) ); + TUid musicCollection = iCollection->CollectionIDL( ary.Array() ); + CleanupStack::PopAndDestroy( &ary ); + + // Second Step is to construct collection path + // | collection id | all songs id | + // + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL( path ); + path->AppendL( musicCollection.iUid ); + path->AppendL( 0 ); // MAGIC, all songs, cannot have dependency to plugin in MPXMusicPlayer + + return path; + } + +// --------------------------------------------------------------------------- +// Returns the file name used for virtual playlist handling +// --------------------------------------------------------------------------- +// +HBufC* CMPXCollectionUiHelperImp::ExternalCollectionPathHandlingFileNameLC() + { + MPX_FUNC( "CMPXCollectionUiHelperImp::ExternalCollectionPathHandlingFileNameLC" ); + return KPathVirtualPlaylistHandling().AllocLC(); + } + +// --------------------------------------------------------------------------- +// Cancel current op +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::Cancel() + { + if( iTask == ETaskRemoveMedia ) + { + iDeleteHelper->Cancel(); + } + else + { + // currently only used by incremental add + iTaskQueue->CancelRequests(); + + // clean up iInputMedia + if( iInputMedia ) + { + delete iInputMedia; + iInputMedia = NULL; + } + } + } + +// --------------------------------------------------------------------------- +// Frees this object +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::Close() + { + delete this; + } + +// --------------------------------------------------------------------------- +// Test if the specified title already exists for the category +// --------------------------------------------------------------------------- +// +TBool CMPXCollectionUiHelperImp::TitleExistsL(TMPXGeneralCategory aCategory, + const TDesC& aTitle, + TMPXGeneralType aType) + { + CMPXMedia* query = CMPXMedia::NewL(); + CleanupStack::PushL(query); + query->SetTObjectValueL(KMPXMediaGeneralType, aType); + query->SetTObjectValueL(KMPXMediaGeneralCategory, aCategory); + query->SetTextValueL(KMPXMediaGeneralTitle, aTitle); + + // Look up collection UID and set to criteria + // + RArray ary; + CleanupClosePushL( ary ); + ary.AppendL( TUid::Uid(EMPXCollectionPluginMusic) ); + TUid musicCollection = iCollection->CollectionIDL( ary.Array() ); + CleanupStack::PopAndDestroy( &ary ); + + query->SetTObjectValueL( KMPXMediaGeneralCollectionId, musicCollection ); + + RArray attributes; + CleanupClosePushL(attributes); + attributes.AppendL(KMPXMediaGeneralId); + + CMPXMedia* result = + iCollection->Collection().FindAllL(*query, attributes.Array()); + CleanupStack::PopAndDestroy(&attributes); + CleanupStack::PopAndDestroy(query); + CleanupStack::PushL(result); + + TInt count = result->ValueTObjectL(KMPXMediaArrayCount); + CleanupStack::PopAndDestroy(result); + + return count; + } + +// --------------------------------------------------------------------------- +// Updates the harvester with the up to date collection <-> file mapping +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::HandleMediatorPathUpdatedL( CMPXMedia*& aProperty, + TUid /*aOldPath*/ ) + { + iHarvester->UpdateFileL( aProperty ); + } + +// --------------------------------------------------------------------------- +// Handles completion of playlist export +// to-do: this should be changed to HandlePlaylistExportCompleted +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::HandlePlaylistExportCompletedL( CMPXMedia* aMedia, TInt aErr ) + { + TRAPD(error, DoHandlePlaylistExportCompletedL(aMedia, aErr)); + + CompleteTask(iTask, aErr==KErrNone?error:aErr); + } + +// --------------------------------------------------------------------------- +// Handles completion of playlist export +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::DoHandlePlaylistExportCompletedL( CMPXMedia* aMedia, TInt aErr ) + { + if (aErr == KErrNone) + { + CleanupStack::PushL(aMedia); + iMedia->SetTextValueL( + KMPXMediaGeneralUri, aMedia->ValueText(KMPXMediaGeneralUri)); + CleanupStack::PopAndDestroy(aMedia); + } + } + +// --------------------------------------------------------------------------- +// Handles completion of playlist import +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::HandlePlaylistImportCompletedL( CMPXMedia* aMedia, TInt aErr ) + { + if (aErr == KErrNone) + { + delete aMedia; + } + // Should never come here + ASSERT(0); + } + +// --------------------------------------------------------------------------- +// Handle asynchronous file addition by file name +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::HandleFileAddCompletedL( CMPXMedia* aMedia, TInt aErr ) + { + // to-do + if (aErr == KErrNone) + { + delete aMedia; + } + // Should never come here + ASSERT(0); + } + +// --------------------------------------------------------------------------- +// Handle file delete completion +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::HandleDeleteCompletedL( TInt /*aErr*/ ) + { + } + +// --------------------------------------------------------------------------- +// From MMPXHarvesterUtilityObserver +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::HandleFileImportCompletedL( CMPXMedia* aMedia, + TInt aErr ) + { + // Only do this if we are embedded mode + // + CleanupStack::PushL( aMedia ); + if( iEmbeddedModeID.iUid ) + { + TInt err( aErr ); + TMPXGeneralCategory cat( EMPXNoCategory ); + if( aErr == KErrNone ) + { + TRAP( err, OpenL( iEmbeddedModeID, + *aMedia, + (MMPXCHelperEmbeddedOpenObserver*)iOpenObserver , + iEmbeddedPluginInfo ) ); + cat = aMedia->ValueTObjectL(KMPXMediaGeneralCategory); + } + + // Callback to observer for err handling + ((MMPXCHelperEmbeddedOpenObserver*)iOpenObserver)->HandleEmbeddedOpenL( err, cat ); + } + CleanupStack::PopAndDestroy( aMedia ); + } + +// --------------------------------------------------------------------------- +// From MMPXHarvesterUtilityObserver +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::HandleFileGetMediaCompletedL( CMPXMedia* /*aMedia*/, + TInt /*aErr*/ ) + { + // Not used + ASSERT(0); + } + +// --------------------------------------------------------------------------- +// From MMPXCollectionMediaObserver +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::HandleCollectionMediaL(const CMPXMedia& /*aMedia*/, + TInt /*aError*/) + { + // Not used + ASSERT(0); + } + +// --------------------------------------------------------------------------- +// From MMPXCollectionObserver +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::HandleCollectionMessage(CMPXMessage* aMsg, TInt aErr) + { + iDeleteHelper->HandleCollectionMessage( aMsg, aErr ); + } + +// --------------------------------------------------------------------------- +// From MMPXCollectionObserver +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::HandleOpenL(const CMPXMedia& /*aEntries*/, TInt /*aIndex*/, TBool /*aComplete*/, TInt /*aError*/) + { + // Not used + ASSERT(0); + } + +// --------------------------------------------------------------------------- +// From MMPXCollectionObserver +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::HandleOpenL(const CMPXCollectionPlaylist& /*aPlaylist*/, TInt /*aError*/) + { + // Not used + ASSERT(0); + } + +// ---------------------------------------------------------------------------- +// Handles completion of moving an object, just a proxy +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::HandleMoveCompleteL( TInt aErr ) + { + if( iHelperObserver ) + { + iHelperObserver->HandleOperationCompleteL( EMoveOp, aErr, NULL ); + } + } + +// ---------------------------------------------------------------------------- +// Handles completion of removing a collection path +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::HandleOperationCompleteL( TCHelperOperation aOperation, + TInt aErr, + void* aArgument ) + { + if (aOperation == EDeleteOp && iTask == ETaskRemoveMedia) + { + CompleteTask(iTask, aErr); + } + else if ( aOperation == EDeleteStatusOp ) + { + iHelperObserver->HandleOperationCompleteL( aOperation, aErr, aArgument ); + } + } + +// ---------------------------------------------------------------------------- +// Execute an async task +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::ExecuteTask( + TInt aTask, + TInt /*aParamData*/, + TAny* /*aPtrData*/, + const CBufBase& aBuf, + TAny* aCallback, + CBase* /*aCObject1*/, + CBase* /*aCObject2*/) + { + TRAPD(err, ExecuteTaskL(aTask, aBuf, aCallback)); + if (err != KErrNone) + { + CompleteTask(aTask, err); + } + } + +// ---------------------------------------------------------------------------- +// Indicates that a task was terminated with an error +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::HandleTaskError( + TInt /* aTask */, + TAny* /*aPtrData*/, + TAny* /*aCallback*/, + TInt /* aError */) + { + // Do nothing + } + +// ---------------------------------------------------------------------------- +// Execute an async task. Leaves when an error is encountered. +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::ExecuteTaskL(TInt aTask, const CBufBase& aBuf, TAny* aCallback) + { + iTask = aTask; + MPX_DEBUG2("CMPXCollectionUiHelperImp::ExecuteTaskL, aTask = %d", aTask); + + // cenrep key need to be checked whether USB cable is connected in MTP/Combined Mode + // prevent any general add, general delete, and any moficiation of playlist + if ((iTask == ETaskAddMedia) + || (iTask == ETaskAppendMedia) + || (iTask == ETaskIncAddMedia) + || (iTask == ETaskIncAppendMedia) + || (iTask == ETaskRemoveMedia) + || (iTask == ETaskReorderPlaylist) + || (iTask == ETaskRenameMedia)) + { + TInt usbStatus; + RProperty::Get(KPSUidUsbWatcher, KUsbWatcherSelectedPersonality, usbStatus); + + if ((usbStatus == KUsbPersonalityIdMTP) || (usbStatus == KUsbPersonalityIdPCSuiteMTP) + || (usbStatus == KUsbPersonalityIdMS) ) + { + MPX_DEBUG1("USB is active, Leave with KErrLocked"); + // need to call back even if it leaves here + iHelperObserver = (MMPXCHelperObserver*)aCallback; + CompleteTask( aTask, KErrLocked ); + //User::Leave(KErrLocked); + if ((iTaskQueue->Task() != ETaskIncAddMedia)&&(iTaskQueue->Task() != ETaskIncAppendMedia)) + { + iIncAdding = EFalse; + } + return; + } + } + + switch( aTask ) + { + case ETaskAddMedia: // fall through + case ETaskAppendMedia: + { + delete iMedia; + iMedia = NULL; + ::NewFromBufferL( aBuf, iMedia ); + iHelperObserver = (MMPXCHelperObserver*)aCallback; + DoAddL(); + } + break; + + case ETaskIncAddMedia: + { + iHelperObserver = (MMPXCHelperObserver*)aCallback; + DoIncAddMediaL(); + } + break; + + case ETaskIncAppendMedia: + { + iHelperObserver = (MMPXCHelperObserver*)aCallback; + DoIncAppendMediaL(); + } + break; + + case ETaskSetMedia: + { + delete iMedia; + iMedia = NULL; + ::NewFromBufferL( aBuf, iMedia ); + iHelperObserver = (MMPXCHelperObserver*)aCallback; + DoSetL(); + } + break; + + case ETaskRenameMedia: + { + delete iMedia; + iMedia = NULL; + ::NewFromBufferL( aBuf, iMedia ); + iHelperObserver = (MMPXCHelperObserver*)aCallback; + DoRenameL(); + } + break; + + case ETaskRemoveMedia: + { + CMPXCollectionPath* path(NULL); + ::NewFromBufferL( aBuf, path ); + CleanupStack::PushL(path); + MPX_DEBUG_PATH(*path); + + iHelperObserver = (MMPXCHelperObserver*) aCallback; + iDeleteHelper->DeleteL(*path); + CleanupStack::PopAndDestroy(path); + } + break; + + case ETaskExportPlaylist: + { + delete iMedia; + iMedia = NULL; + + CMPXMedia* params(NULL); + ::NewFromBufferL( aBuf, params ); + CleanupStack::PushL(params); + + iHelperObserver = (MMPXCHelperObserver*)aCallback; + + DoExportPlaylistL( + params->ValueTObjectL(KMPXMediaGeneralId), + params->ValueText(KMPXMediaGeneralUri)); + + CleanupStack::PopAndDestroy(params); + } + break; + + case ETaskReorderPlaylist: + { + delete iMedia; + iMedia = NULL; + + CMPXCommand* params(NULL); + ::NewFromBufferL( aBuf, params ); + CleanupStack::PushL(params); + + iHelperObserver = (MMPXCHelperObserver*)aCallback; + + DoReorderPlaylistL(*params); + + CleanupStack::PopAndDestroy(params); + } + break; + + // + // command not supported + // + default: + { + User::Leave( KErrNotSupported ); + } + } + } + +// ---------------------------------------------------------------------------- +// Completes the currently executing task +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::CompleteTask(TInt aTask, TInt aError) + { + MPX_FUNC("CMPXCollectionUiHelperImp::CompleteTask"); + + MPX_DEBUG3("task %d, error %d", aTask, aError); + + TRAP_IGNORE(NotifyClientL(aTask, aError)); + + if ( iTask != ETaskNone ) + { + // clean up data set during processing of the current task + Cleanup(); + + // Complete current task and move on to the next + iTaskQueue->CompleteTask(); + } + } + +// ---------------------------------------------------------------------------- +// Notifies the client of the completion of a collection helper request +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::NotifyClientL(TInt aTask, TInt aError) + { + MPX_DEBUG3("CMPXCollectionUiHelperImp::NotifyClientL(task %d, error %d)", aTask, aError); + + switch (aTask) + { + case ETaskAddMedia: // fall through + case ETaskAppendMedia: + { + if ( aError >= KErrNone ) + { + // make a copy of iMedia to hand over to the client which takes ownership + // of the copied media. if we failed to make a copy, client is not notified. + iHelperObserver->HandleOperationCompleteL(EAddOp, + KErrNone, + CMPXMedia::NewL(*iMedia) ); + } + else + { + iHelperObserver->HandleOperationCompleteL( EAddOp, + aError, + NULL ); + } + } + break; + case ETaskIncAddMedia: + case ETaskIncAppendMedia: + { + if ( KErrLocked == aError ) + { + if( EFalse == iIncAdding ) + { + iIncAdding = ETrue; + iHelperObserver->HandleOperationCompleteL( EAddOp, aError, NULL ); + } + } + } + break; + case ETaskIncFinish: + { + if ( aError >= KErrNone ) + { + // input media is handed over to observer + iHelperObserver->HandleOperationCompleteL(EAddOp, + KErrNone, + CMPXMedia::NewL(*iInputMedia) ); + } + else + { + iHelperObserver->HandleOperationCompleteL( EAddOp, + aError, + NULL ); + } + // clean up input media + delete iInputMedia; + iInputMedia = NULL; + } + break; + + case ETaskSetMedia: + { + if ( aError >= KErrNone ) + { + // make a copy of iMedia to hand over to the client which takes ownership + // of the copied media. if we failed to make a copy, client is not notified. + iHelperObserver->HandleOperationCompleteL( ESetOp, + KErrNone, + CMPXMedia::NewL(*iMedia) ); + } + else + { + iHelperObserver->HandleOperationCompleteL( ESetOp, + aError, + NULL ); + } + } + break; + + case ETaskRenameMedia: + { + if ( aError >= KErrNone ) + { + // make a copy of iMedia to hand over to the client which takes ownership + // of the copied media. if we failed to make a copy, client is not notified. + iHelperObserver->HandleOperationCompleteL( ERenameOp, + KErrNone, + CMPXMedia::NewL(*iMedia) ); + } + else + { + iHelperObserver->HandleOperationCompleteL( ERenameOp, + aError, + NULL ); + } + } + break; + + case ETaskRemoveMedia: + { + iHelperObserver->HandleOperationCompleteL( EDeleteOp, + aError >= KErrNone? KErrNone : aError, + NULL ); + } + break; + + case ETaskExportPlaylist: + { + HBufC* buf( NULL ); + if( aError == KErrNone ) + { + const TDesC& uri = + iMedia->ValueText(KMPXMediaGeneralUri); + buf = uri.AllocL(); + } + + // client assumes ownership of HBufC copied from title + iHelperObserver->HandleOperationCompleteL(EExportPlaylistOp, aError, buf); + } + break; + + case ETaskReorderPlaylist: + { + iHelperObserver->HandleOperationCompleteL( EReorderPlaylistOp, + aError >= KErrNone? KErrNone : aError, + NULL ); + } + break; + + default: + break; + } + } + +// ---------------------------------------------------------------------------- +// Cleanup async task variables +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::Cleanup() + { + MPX_DEBUG1("-->CMPXCollectionUiHelperImp::Cleanup"); + iTask = ETaskNone; + iHelperObserver = NULL; + delete iMedia; + iMedia = NULL; + MPX_DEBUG1("<--CMPXCollectionUiHelperImp::Cleanup"); + } + +// --------------------------------------------------------------------------- +// Add a Media to the collection +// +// For playlists: +// 1) add to collection +// 2) when successfully added to collection, AddItemL returns; otherwise, +// AddItemL leaves. +// 3) complete task upon successfully addition to the collection. If a leave +// occurs, it's trapped by ExecuteTask and task is completed by ExecuteTask +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::DoAddL() + { + // creating a new playlist + if (iTask == ETaskAddMedia) + { + // find the collection Id + HBufC* playlistExtension = PlaylistFileExtensionLC(); + + TInt collectionId = FindCollectionIdL(*playlistExtension); + + // Add to collection, make sure we set the collection ID. + iMedia->SetTObjectValueL( + KMPXMediaGeneralCollectionId, TUid::Uid( collectionId )); + + CleanupStack::PopAndDestroy(playlistExtension); + } + + // adding/appending tracks to a saved playlist + else + { + FillInPlaylistDetailsL(*iMedia); + } + + // when playlist is successfully added to the collection, its + // KMPXMediaGeneralId is automatically updated by mediator + iMediator->AddItemL( iMedia ); + + CompleteTask(iTask, KErrNone); + } + +// --------------------------------------------------------------------------- +// Add media to the collection incrementally +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::DoIncAddMediaL() + { + /***** include only aSize/iChunkSize number of songs *****/ + + // copy media + CMPXMedia* media = CMPXMedia::CopyL(*iInputMedia); + CleanupStack::PushL(media); + + CMPXMediaArray* tracksArray = iInputMedia->Value( KMPXMediaArrayContents ); + + CMPXMediaArray* cArray = CMPXMediaArray::NewL(); + CleanupStack::PushL(cArray); + + // last interation/chunk + // for the case when aSize/iChunkSize evenly devides number of songs, the else clause takes care of it + if( (iChunkNumber == iTotalChunkNumber-1) && iRemainder != 0 ) + { + // add remaining songs to the array + for(int j = 0; j < iRemainder; j++ ) + { + cArray->AppendL(*tracksArray->AtL(iArrayIndex)); + iArrayIndex++; + } + } + else + { + // adding next aSize/iChunkSize elements + for(int j = 0; j < iChunkSize; j++) + { + cArray->AppendL(*tracksArray->AtL(iArrayIndex)); + iArrayIndex++; + } + } + + // update media w/ new array + media->SetCObjectValueL(KMPXMediaArrayContents, cArray); + media->SetTObjectValueL(KMPXMediaArrayCount, cArray->Count() ); + + + /***** logic to see which chunk this code is in *****/ + + // first chunk + // for the case that there is only one chunk (first & last chunk at the same + // time), Inc Add is not used + if ( iChunkNumber == 0 ) + { + // find the collection Id + HBufC* playlistExtension = PlaylistFileExtensionLC(); + + TInt collectionId = FindCollectionIdL(*playlistExtension); + + // Add to collection, make sure we set the collection ID. + media->SetTObjectValueL( + KMPXMediaGeneralCollectionId, TUid::Uid( collectionId )); + + // save collectionId for adding subsequent chunks + iInputMedia->SetTObjectValueL( + KMPXMediaGeneralCollectionId, TUid::Uid( collectionId )); + + CleanupStack::PopAndDestroy(playlistExtension); + + iMediator->AddItemL( media ); // this creates the new playlist + + // save playlistId in input media & use it for subsequent appending operations + TMPXItemId playlistId = media->ValueTObjectL(KMPXMediaGeneralId); + iInputMedia->SetTObjectValueL(KMPXMediaGeneralId, playlistId); + + iChunkNumber++; // move on to next chunk + + CompleteTask(iTask, KErrNone); + } + else if ( iChunkNumber == iTotalChunkNumber-1 ) // last chunk + { + // get saved collection id from input media & set it in current media + TUid id = iInputMedia->ValueTObjectL(KMPXMediaGeneralCollectionId); + media->SetTObjectValueL(KMPXMediaGeneralCollectionId, id); + + // get playlistId from input media & set it in current media + TMPXItemId playlistId = iInputMedia->ValueTObjectL(KMPXMediaGeneralId); + media->SetTObjectValueL(KMPXMediaGeneralId, playlistId); + + iMediator->AddItemL( media ); + + CompleteTask(ETaskIncFinish, KErrNone); // finish inc task + } + else // intermedia chunks + { + // get saved collection id from input media & set it in current media + TUid id = iInputMedia->ValueTObjectL(KMPXMediaGeneralCollectionId); + media->SetTObjectValueL(KMPXMediaGeneralCollectionId, id); + + // get playlistId from original media & set it in current media + TMPXItemId playlistId = iInputMedia->ValueTObjectL(KMPXMediaGeneralId); + media->SetTObjectValueL(KMPXMediaGeneralId, playlistId); + + iMediator->AddItemL( media ); + + iChunkNumber++; // move on to next chunk + + CompleteTask(iTask, KErrNone); + } + + CleanupStack::PopAndDestroy(cArray); + CleanupStack::PopAndDestroy(media); + } + +// --------------------------------------------------------------------------- +// Append media to the collection incrementally +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::DoIncAppendMediaL() + { + /***** include only aSize/iChunkSize number of songs *****/ + + // copy media + CMPXMedia* media = CMPXMedia::CopyL(*iInputMedia); + CleanupStack::PushL(media); + + CMPXMediaArray* tracksArray = iInputMedia->Value( KMPXMediaArrayContents ); + + CMPXMediaArray* cArray = CMPXMediaArray::NewL(); + CleanupStack::PushL(cArray); + + // last interation/chunk + // for the case when aSize/iChunkSize evenly devides number of tracks, the else clause takes care of it + if( (iChunkNumber == iTotalChunkNumber-1) && iRemainder != 0 ) + { + for(int j = 0; j < iRemainder; j++ ) + { + cArray->AppendL(*tracksArray->AtL(iArrayIndex)); + iArrayIndex++; + } + } + else + { + // adding next aSize/iChunkSize elements + for(int j = 0; j < iChunkSize; j++) + { + cArray->AppendL(*tracksArray->AtL(iArrayIndex)); + iArrayIndex++; + } + } + + // update media w/ new array + media->SetCObjectValueL(KMPXMediaArrayContents, cArray); + media->SetTObjectValueL(KMPXMediaArrayCount, cArray->Count() ); + + + /***** logic to see which chunk this code is in *****/ + + // update media then append to playlist + FillInPlaylistDetailsL(*media); + iMediator->AddItemL( media ); + + // last chunk + // for the case that there is only one chunk (first & last chunk at the same + // time), Inc Add is not used + if( iChunkNumber == iTotalChunkNumber-1 ) + { + // update input media as well + FillInPlaylistDetailsL(*iInputMedia); + CompleteTask(ETaskIncFinish, KErrNone); + } + else // intermediate chunks, including first chunk + { + iChunkNumber++; + CompleteTask(iTask, KErrNone); + } + + CleanupStack::PopAndDestroy(cArray); + CleanupStack::PopAndDestroy(media); + } + +// --------------------------------------------------------------------------- +// Update a media in the collection +// +// For updating (overwriting) a playlist, or updating a song/artist/album/genre/ +// composer: +// 1) update collection +// 2) when successfully updated the collection, SetItemL is returned; otherwise +// a leave occurs. +// 3) complete task upon successfully updating the collection. If a leave +// occurs, it's trapped by ExecuteTask and task is completed by ExecuteTask +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::DoSetL() + { + MPX_FUNC("CMPXCollectionUiHelperImp::DoSetL"); + + // fill in playlist details + TMPXGeneralCategory category = + iMedia->ValueTObjectL(KMPXMediaGeneralCategory); + if ( category == EMPXPlaylist ) + { + FillInPlaylistDetailsL(*iMedia); + } + + // find the collection Id + if (!iMedia->IsSupported(KMPXMediaGeneralCollectionId) && + iMedia->IsSupported(KMPXMediaGeneralUri)) + { + TInt collectionId = + FindCollectionIdL(iMedia->ValueText(KMPXMediaGeneralUri)); + + if (collectionId) + { + iMedia->SetTObjectValueL( + KMPXMediaGeneralCollectionId , TUid::Uid(collectionId)); + } + } + + // update collection. + iMediator->SetItemL( iMedia ); + + CompleteTask(iTask, KErrNone); + } + +// --------------------------------------------------------------------------- +// Rename a media in the collection +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::DoRenameL() + { + // find the collection Id of the playlist from playlist Id + // iMedia isn't used as the search criteria because it + // contains the new title of the playlist; calling + // FillInPlaylistDetailsL(*iMedia) will result in playlist + // not found. + if (!iMedia->IsSupported(KMPXMediaGeneralCollectionId)) + { + CMPXMedia* media = CMPXMedia::NewL(); + CleanupStack::PushL(media); + + media->SetTObjectValueL(KMPXMediaGeneralType, EMPXItem); + media->SetTObjectValueL(KMPXMediaGeneralCategory,EMPXPlaylist); + media->SetTObjectValueL(KMPXMediaGeneralId, iMedia->ValueTObjectL(KMPXMediaGeneralId)); + + FillInPlaylistDetailsL(*media); + + if (media->IsSupported(KMPXMediaGeneralCollectionId)) + { + iMedia->SetTObjectValueL( + KMPXMediaGeneralCollectionId, media->ValueTObjectL(KMPXMediaGeneralCollectionId)); + } + else + { + User::Leave(KErrNotFound); + } + CleanupStack::PopAndDestroy(media); + } + + // Update collection via command + // + CMPXCommand* cmd = CMPXCommand::NewL(); + CleanupStack::PushL( cmd ); + cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdCollectionSet ); + cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue ); + TUid colId = iMedia->ValueTObjectL(KMPXMediaGeneralCollectionId); + cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, colId.iUid ); + cmd->SetCObjectValueL( KMPXCommandColSetMedia, iMedia ); + + iCollection->Collection().CommandL( *cmd ); + CleanupStack::PopAndDestroy( cmd ); + + CompleteTask(iTask, KErrNone); + } + +// --------------------------------------------------------------------------- +// Export a playlist +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::DoExportPlaylistL(TMPXItemId aPlaylistId, + const TDesC& aDestinationDriveAndPath) + { + // + // fill in playlist info + // + iMedia = CMPXMedia::NewL(); + + iMedia->SetTObjectValueL(KMPXMediaGeneralType, EMPXItem); + iMedia->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXPlaylist); + iMedia->SetTObjectValueL(KMPXMediaGeneralId, aPlaylistId); + + FillInPlaylistDetailsL(*iMedia); + + // + // find songs that are in the specified playlist + // + CMPXMedia* songQuery = CMPXMedia::NewL(); + CleanupStack::PushL(songQuery); + songQuery->SetTObjectValueL(KMPXMediaGeneralType, EMPXGroup); + songQuery->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXSong); + songQuery->SetTObjectValueL(KMPXMediaGeneralId, aPlaylistId); + + RArray songAttributes; + CleanupClosePushL(songAttributes); + iHarvester->RequiredAttributesL( EMPXPlaylistTypeM3U, songAttributes ); + songAttributes.AppendL(KMPXMediaGeneralTitle); + + CMPXMedia* songQueryResult = + iCollection->Collection().FindAllL(*songQuery, songAttributes.Array()); + CleanupStack::PopAndDestroy(&songAttributes); + CleanupStack::PopAndDestroy(songQuery); + CleanupStack::PushL(songQueryResult); + + // medias contains tracks currently in the playlist + const CMPXMediaArray* medias = + songQueryResult->Value(KMPXMediaArrayContents); + if( !medias ) + { + User::Leave( KErrNoMemory ); + } + + // add media array to iMedia + iMedia->SetCObjectValueL( + KMPXMediaArrayContents, const_cast(medias)); + iMedia->SetTObjectValueL( + KMPXMediaArrayCount, medias->Count()); + + CleanupStack::PopAndDestroy(songQueryResult); + + // export playlist, default to M3U file type. When ExportPlaylistL completes, + // HandlePlaylistExportCompletedL will be called + iHarvester->ExportPlaylistL( *iMedia, aDestinationDriveAndPath, EMPXPlaylistTypeM3U, this ); + } + +// --------------------------------------------------------------------------- +// Reorder a song in a playlist +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::DoReorderPlaylistL(CMPXCommand& aCommand) + { + // Update collection via command + // + aCommand.SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdReorderPlaylist ); + aCommand.SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue ); + + iCollection->Collection().CommandL( aCommand ); + + CompleteTask(iTask, KErrNone); + } + +// --------------------------------------------------------------------------- +// retrieve information for the required attributes +// --------------------------------------------------------------------------- +// +void CMPXCollectionUiHelperImp::FillInPlaylistDetailsL(CMPXMedia& aMedia) + { + MPX_FUNC("CMPXCollectionUiHelperImp::FillInPlaylistDetailsL"); + + // + // retrieve info about the playlist itself + // + RArray playlistAttributes; + CleanupClosePushL(playlistAttributes); + playlistAttributes.AppendL(KMPXMediaGeneralId); + playlistAttributes.AppendL(KMPXMediaGeneralTitle); + playlistAttributes.AppendL(KMPXMediaGeneralUri); + playlistAttributes.AppendL(KMPXMediaGeneralCollectionId); + + CMPXMedia* playlistSearchResult = + iCollection->Collection().FindAllL(aMedia, playlistAttributes.Array()); + CleanupStack::PopAndDestroy(&playlistAttributes); + CleanupStack::PushL(playlistSearchResult); + + const CMPXMediaArray* results = + playlistSearchResult->Value(KMPXMediaArrayContents); + if( !results ) + { + User::Leave( KErrNoMemory ); + } + + if ( results->Count() != 1 ) + { + User::Leave(KErrArgument); + } + + MPX_DEBUG1("playlist found"); + + aMedia.SetTObjectValueL( + KMPXMediaGeneralId, results->AtL(0)->ValueTObjectL(KMPXMediaGeneralId)); + aMedia.SetTextValueL( + KMPXMediaGeneralTitle, results->AtL(0)->ValueText(KMPXMediaGeneralTitle)); + aMedia.SetTextValueL( + KMPXMediaGeneralUri, results->AtL(0)->ValueText(KMPXMediaGeneralUri)); + aMedia.SetTObjectValueL( + KMPXMediaGeneralCollectionId, results->AtL(0)->ValueTObjectL(KMPXMediaGeneralCollectionId)); + + CleanupStack::PopAndDestroy(playlistSearchResult); + } + +// --------------------------------------------------------------------------- +// retrieve collection from URI +// ResolvePlugin should be able to resolve the plugin without +// the client looking for the collection Id +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionUiHelperImp::FindCollectionIdL(const TDesC& aUri) + { + MPX_FUNC("CMPXCollectionUiHelperImp::FindCollectionIdL"); + + TInt collectionId(KErrNotFound); + + TParsePtrC parser( aUri ); + + RPointerArray collectionType; + iCollection->Collection().GetSupportedTypesL(collectionType); + + TInt index(KErrNotFound); + TInt count( collectionType.Count() ); + + for (TInt i = 0; i < count; i++) + { + const CDesCArray& extensions = collectionType[i]->Extensions(); + + if (extensions.FindIsq(parser.Ext(), index) == 0) + { + collectionId = collectionType[i]->Uid().iUid; + break; + } + } + + collectionType.ResetAndDestroy(); + + MPX_DEBUG3("Uid 0x%x for %S", collectionId, &aUri); + + return collectionId; + } + +// End of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/collectionhelper/src/mpxdeletehelper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/collectionhelper/src/mpxdeletehelper.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,818 @@ +/* +* Copyright (c) 2006 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: MPX delete helper +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef RD_MPX_TNM_INTEGRATION +#include +#include +#include +#include +#include +#endif //RD_MPX_TNM_INTEGRATION +// cenrep key need to be checked whether USB cable is connected in MTP/Combined Mode +#include +#include +#include +#include "mpxcollectionuihelperobserver.h" +#include "mpxcollectionhelpercommon.h" + +#include "mpxdeletehelper.h" + +// Constants +const TInt KSQLErrGeneral = -311; // SQL General error. Don't want to include sql header here +const TInt KDeleteUpdateCount = 50; // Max # of times to update delete status during a group delete. Value (1-100) +#ifdef RD_MPX_TNM_INTEGRATION +_LIT( KImageFileType, "image/jpeg" ); +#endif //RD_MPX_TNM_INTEGRATION + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CMPXDeleteHelper::CMPXDeleteHelper(MMPXCollectionUtility& aCollectionUtility, + MMPXHarvesterUtility& aHarvesterUtility, + MMPXCHelperObserver& aObserver) +: CActive(CActive::EPriorityLow), + iCollectionUtil(aCollectionUtility), + iHarvester(aHarvesterUtility), + iObserver(aObserver), + iMoreToDo(ETrue), + iHadInUse(EFalse), + iState(EMPXIdle), + iDeletePercent(0), + iDeleteIncFactor(1), + iDeleteCount(0), + iUsbManConnected( EFalse ) + { + CActiveScheduler::Add(this); + } + +// --------------------------------------------------------------------------- +// 2nd Phase Constructor +// --------------------------------------------------------------------------- +// +void CMPXDeleteHelper::ConstructL() + { + iFiles = new(ELeave)CDesCArrayFlat(4); + iMessageArray = CMPXMessageArray::NewL(); + // Connect to usbman + ConnectUsbMan(); + +#ifdef __USE_MESSAGE_SUBSCRIPTION + // Subscribe to only a few messages from collection utility + CMPXSubscription* subscription( CMPXSubscription::NewL() ); + CleanupStack::PushL( subscription ); + CMPXSubscriptionItem* subItem1( CMPXSubscriptionItem::NewL() ); + CleanupStack::PushL( subItem1 ); + subItem1->SetTObjectValueL( KMPXMessageGeneralId, KMPXMessageGeneral ); + subItem1->SetTObjectValueL( KMPXMessageGeneralEvent, TMPXCollectionMessage::EBroadcastEvent ); + subItem1->SetTObjectValueL( KMPXMessageGeneralType, EMcMsgFormatStart ); + subscription->AddItemL( *subItem1 ); + CMPXSubscriptionItem* subItem2( CMPXSubscriptionItem::CopyL( *subItem1 )); + CleanupStack::PushL( subItem2 ); + subItem2->SetTObjectValueL( KMPXMessageGeneralType, EMcMsgDiskRemoved ); + subscription->AddItemL( *subItem2 ); + CMPXSubscriptionItem* subItem3( CMPXSubscriptionItem::CopyL( *subItem1 )); + CleanupStack::PushL( subItem3 ); + subItem3->SetTObjectValueL( KMPXMessageGeneralType, EMcMsgUSBMassStorageStart ); + subscription->AddItemL( *subItem3 ); + CMPXSubscriptionItem* subItem4( CMPXSubscriptionItem::CopyL( *subItem1 )); + CleanupStack::PushL( subItem4 ); + subItem4->SetTObjectValueL( KMPXMessageGeneralType, EMcMsgUSBMTPStart ); + subscription->AddItemL( *subItem4 ); + CMPXSubscriptionItem* subItem5( CMPXSubscriptionItem::CopyL( *subItem1 )); + CleanupStack::PushL( subItem5 ); + iCollectionUtil.Collection().AddSubscriptionL( *subscription ); + CleanupStack::PopAndDestroy( subItem5 ); + CleanupStack::PopAndDestroy( subItem4 ); + CleanupStack::PopAndDestroy( subItem3 ); + CleanupStack::PopAndDestroy( subItem2 ); + CleanupStack::PopAndDestroy( subItem1 ); + CleanupStack::PopAndDestroy( subscription ); +#endif + +#ifdef RD_MPX_TNM_INTEGRATION + + // Create Thumbnail Manager instance. This object is the observer. + iTNManager = CThumbnailManager::NewL( *this ); +#endif //RD_MPX_TNM_INTEGRATION + } + + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXDeleteHelper* CMPXDeleteHelper::NewL(MMPXCollectionUtility& aCollectionUtility, + MMPXHarvesterUtility& aHarvesterUtility, + MMPXCHelperObserver& aObserver) + { + CMPXDeleteHelper* self = + new(ELeave)CMPXDeleteHelper( aCollectionUtility, + aHarvesterUtility, + aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CMPXDeleteHelper::~CMPXDeleteHelper() + { + if( iPbUtil ) + { + iPbUtil->Close(); + } + delete iDeletePath; + delete iFiles; + delete iMessageArray; +#ifdef RD_MPX_TNM_INTEGRATION + + delete iTNManager; +#endif //RD_MPX_TNM_INTEGRATION + if ( iUsbManConnected ) + { + iUsbMan.Close(); + } + } + +// --------------------------------------------------------------------------- +// Start the delete operation +// --------------------------------------------------------------------------- +// +void CMPXDeleteHelper::DeleteL( CMPXCollectionPath& aPath ) + { + MPX_DEBUG1("CMPXDeleteHelper::DeleteL()"); + MPX_DEBUG_PATH(aPath); + TInt deletePercentFactor = 100 / KDeleteUpdateCount; + + if( iPbUtil ) + { + iPbUtil->Close(); + iPbUtil = NULL; + } + iPbUtil = MMPXPlaybackUtility::UtilityL(); + + iDeletePath = CMPXCollectionPath::NewL( aPath ); + iState = EMPXInitDelete; + iDeleteCount = 0; + iMessageArray->Reset(); + RArray selections; + CleanupClosePushL(selections); + iDeletePath->SelectionL(selections); + iItemsCount = selections.Count(); + CleanupStack::PopAndDestroy(&selections); + iRetrievedItemsCount = 0; + + // Calculate percent increment factor used during a delete. + if ( (iItemsCount > 0) && (iItemsCount < KDeleteUpdateCount) ) + { + TReal factor = (KDeleteUpdateCount/iItemsCount) * deletePercentFactor; + iDeleteIncFactor = factor; + } + else + { + iDeleteIncFactor = deletePercentFactor; + } + + TRequestStatus* status = &iStatus; + *status = KRequestPending; + User::RequestComplete(status, KErrNone); + + SetActive(); + } + +// --------------------------------------------------------------------------- +// From MMPXCollectionObserver +// to-do: this should be changed to HandleCollectionMessage +// --------------------------------------------------------------------------- +// +void CMPXDeleteHelper::HandleCollectionMessage(CMPXMessage* aMessage, TInt /*aErr*/) + { + if( aMessage && + aMessage->IsSupported(KMPXMessageGeneralEvent) && + aMessage->IsSupported(KMPXMessageGeneralType) ) + { + TInt event( aMessage->ValueTObjectL( KMPXMessageGeneralEvent ) ); + TInt op( aMessage->ValueTObjectL( KMPXMessageGeneralType ) ); + + MPX_DEBUG3( "CMPXDeleteHelper::HandleCollectionMessageL event = %d, type = %d", + event, op ); + + if( event == TMPXCollectionMessage::EBroadcastEvent ) + { + if( op == EMcMsgFormatStart || + op == EMcMsgDiskRemoved || + op == EMcMsgUSBMassStorageStart || + op == EMcMsgUSBMTPStart ) + { + iCancelled = ETrue; + Cancel(); + } + } + + } + } + +// --------------------------------------------------------------------------- +// Start the delete operation +// --------------------------------------------------------------------------- +// +void CMPXDeleteHelper::DoTaskStep() + { + MPX_DEBUG1("CMPXDeleteHelper::DoTaskStep()"); + + TRequestStatus* status = &iStatus; + *status = KRequestPending; + + TRAPD( error, DoTaskStepL() ); + + User::RequestComplete( status, error ); + } + +// --------------------------------------------------------------------------- +// Start the delete operation +// to-do: delete file first before removing it from the collection +// --------------------------------------------------------------------------- +// +void CMPXDeleteHelper::DoTaskStepL() + { + MPX_DEBUG1("CMPXDeleteHelper::DoTaskStepL()"); + + switch(iState) + { + case EMPXInitDelete: + { + StartDeleteL(); + iState = EMPXPreparation; + break; + } + case EMPXPreparation: + { + RetrieveFileListL(); + iState = EMPXDelete; + break; + } + + case EMPXDelete: + { + DeleteL(); + break; + } + + default: + break; + } + } + +// ---------------------------------------------------------------------------- +// Handles request completion event +// ---------------------------------------------------------------------------- +// +void CMPXDeleteHelper::RunL() + { + MPX_DEBUG3("CMPXDeleteHelper::RunL. [iMoreToDo %d] [iStatus %d]", iMoreToDo, iStatus.Int()); + + // cenrep key need to be checked whether USB cable is connected in MTP/Combined Mode + TUsbDeviceState deviceState = EUsbDeviceStateConfigured; + if ( !iUsbManConnected ) + { + ConnectUsbMan(); + } + + if ( iUsbManConnected ) + { + if ( iUsbMan.GetDeviceState( deviceState ) != KErrNone ) + { + deviceState = EUsbDeviceStateConfigured; + } + } + + if ( deviceState == EUsbDeviceStateAddress || + deviceState == EUsbDeviceStateConfigured ) + { + TInt usbStatus; + RProperty::Get(KPSUidUsbWatcher, KUsbWatcherSelectedPersonality, usbStatus); + if ((usbStatus == KUsbPersonalityIdMTP) || (usbStatus == KUsbPersonalityIdPCSuiteMTP)) + { + MPX_DEBUG1("USB is active, Stop Delete"); + CompleteDelete( KErrLocked ); + return; + } + } + + if (iMoreToDo && iStatus.Int() == KErrNone) + { + DoTaskStep(); + SetActive(); + } + else + { + CompleteDelete(iStatus.Int()); + } + } + +// --------------------------------------------------------------------------- +// Cancel the delete operation +// --------------------------------------------------------------------------- +// +void CMPXDeleteHelper::DoCancel() + { + MPX_DEBUG3("CMPXDeleteHelper::DoCancel iStatus %d, iState %d", iStatus.Int(), iState); + + CompleteDelete(iStatus.Int()); + } + +// --------------------------------------------------------------------------- +// End state for a delete operation +// --------------------------------------------------------------------------- +// +void CMPXDeleteHelper::CompleteDelete( TInt aErr ) + { + MPX_DEBUG2("CMPXDeleteHelper::CompleteDelete %d", aErr); + + TRAP_IGNORE( DoCompleteDeleteL( aErr ) ); + } + +// --------------------------------------------------------------------------- +// End state for a delete operation +// --------------------------------------------------------------------------- +// +void CMPXDeleteHelper::DoCompleteDeleteL( TInt aErr ) + { + MPX_DEBUG3("CMPXDeleteHelper::CompleteDeleteL error %d cancelled %d", aErr, iCancelled); + if( iState != EMPXIdle ) + { + // Finally callback to observer and complete task queue event + // to-do: change HandleOperationCompletedL to HandleOperationComplete + TInt error = iHadInUse ? KErrInUse : aErr; + // Error cases that need to be ignored when mmc card is removed + if( error == KErrBadName || + error == KErrNotReady || + error == KErrAbort || + error == KSQLErrGeneral || + (iCancelled && error == KErrNotFound) ) + { + error = KErrNone; + } + + // Reset all states + Reset(); + + // Close Harvester database transaction + TRAP_IGNORE(iHarvester.CloseTransactionL() ); + + // Send a complete delete command to finish off the delete operation + // + CMPXCommand* cmd = CMPXCommand::NewL(); + CleanupStack::PushL( cmd ); + cmd->SetTObjectValueL(KMPXCommandGeneralId,KMPXCommandIdCollectionCompleteDelete); + cmd->SetTObjectValueL(KMPXCommandGeneralDoSync, ETrue); + cmd->SetTObjectValueL(KMPXCommandCollectionDeleteCompactDb, ETrue); + cmd->SetCObjectValueL(KMPXCommandCollectionDeleteMsgArray, iMessageArray); + iCollectionUtil.Collection().CommandL(*cmd); + CleanupStack::PopAndDestroy( cmd ); + + TRAP_IGNORE(iObserver.HandleOperationCompleteL( EDeleteOp, error, NULL ) ); + + // Message array ownership passed to engine + delete iMessageArray; + iMessageArray = NULL; + iMessageArray = CMPXMessageArray::NewL(); + + if( iPbUtil ) + { + iPbUtil->Close(); + iPbUtil = NULL; + } + iCancelled = EFalse; + } + } + +// --------------------------------------------------------------------------- +// Resets members to get ready for the next client request +// +// --------------------------------------------------------------------------- +// +void CMPXDeleteHelper::Reset() + { + MPX_DEBUG1("CMPXDeleteHelper::Reset"); + iMoreToDo = ETrue; + iHadInUse = EFalse; + iDeleteCount = 0; + iDeletePercent = 0; + iDeleteIncFactor = 1; + + iState = EMPXIdle; + + delete iDeletePath; + iDeletePath = NULL; + + iFiles->Reset(); + } + +// --------------------------------------------------------------------------- +// Perfom cleanup of all unused data before delete +// +// --------------------------------------------------------------------------- +// +void CMPXDeleteHelper::StartDeleteL() + { + // + // set up the command to send to the collection + // + CMPXCommand* command = CMPXCommand::NewL(); + CleanupStack::PushL(command); + + command->SetTObjectValueL( + TMPXAttribute(KMPXCommandContentIdGeneral, EMPXCommandGeneralId), KMPXCommandIdCollectionPrepareDelete); + command->SetTObjectValueL( + TMPXAttribute(KMPXCommandContentIdGeneral, EMPXCommandGeneralDoSync), ETrue); + command->SetCObjectValueL( + TMPXAttribute(KMPXCommandIdCollectionPrepareDelete, EMPXCommandCollectionRetrievePath), + iDeletePath); + + // send sync prepare delete URI command + iCollectionUtil.Collection().CommandL(*command); + CleanupStack::PopAndDestroy(command); +} + +// +// Retrieve files associated with the path +// +// --------------------------------------------------------------------------- +// +void CMPXDeleteHelper::RetrieveFileListL() + { + // + // set up the command to send to the collection + // + CMPXCommand* command = CMPXCommand::NewL(); + CleanupStack::PushL(command); + + command->SetTObjectValueL( + TMPXAttribute(KMPXCommandContentIdGeneral, EMPXCommandGeneralId), KMPXCommandIdCollectionRetrieveUriForDeletion); + command->SetTObjectValueL( + TMPXAttribute(KMPXCommandContentIdGeneral, EMPXCommandGeneralDoSync), ETrue); + command->SetCObjectValueL( + TMPXAttribute(KMPXCommandIdCollectionRetrieveUriForDeletion, EMPXCommandCollectionRetrievePath), + iDeletePath); + + // send sync retrieve URI command + iCollectionUtil.Collection().CommandL(*command); + + // + // return command should contain error and URI array + // + if (!command->IsSupported(TMPXAttribute(KMPXCommandIdCollectionRetrieveUriForDeletion, EMPXCommandCollectionRetrieveUriError)) || + !command->IsSupported(TMPXAttribute(KMPXCommandIdCollectionRetrieveUriForDeletion, EMPXCommandCollectionRetrieveMediaUriArray))) + { + User::Leave(KErrAbort); + } + + // + // abandon operation if an error occured removing a media from the collection + // + TInt error = + command->ValueTObjectL( + TMPXAttribute(KMPXCommandIdCollectionRetrieveUriForDeletion, EMPXCommandCollectionRetrieveUriError)); + User::LeaveIfError(error); + + // + // retrieve the list of files to be deleted + // + CDesCArray* files = + command->ValueNoNewLCObjectL( + TMPXAttribute(KMPXCommandIdCollectionRetrieveUriForDeletion, EMPXCommandCollectionRetrieveMediaUriArray)); + CleanupStack::PushL(files); + ::CopyArrayL(*files, *iFiles); + iRetrievedItemsCount +=files->MdcaCount(); + CleanupStack::PopAndDestroy(files); + // + // retrieve the updated path. If the original path ends at a particular artist, + // album, genre, or composer, the path will have been expended to include the + // songs under that category + // + delete iDeletePath; + iDeletePath = NULL; + iDeletePath = + command->ValueCObjectL( + TMPXAttribute(KMPXCommandIdCollectionRetrieveUriForDeletion, EMPXCommandCollectionRetrievePath)); + + CleanupStack::PopAndDestroy(command); + } + +// --------------------------------------------------------------------------- +// Deletes the file from the file system then deletes it from the collection +// --------------------------------------------------------------------------- +// +void CMPXDeleteHelper::DeleteL() + { + MPX_FUNC("CMPXDeleteHelper::DeleteL()"); + // Close the item that we are about to delete + // + RArray selections; + CleanupClosePushL(selections); + iDeletePath->SelectionL(selections); + + TMPXItemId mediaId(0); + if (selections.Count()) + { + // If more than one item + mediaId = selections[0]; + } + else + { + mediaId = iDeletePath->Id(iDeletePath->Levels() - 1); + } + + CleanupStack::PopAndDestroy(&selections); + + // Send the real id to playback engine for deletion + iPbUtil->CommandL( EPbCmdCloseItem, mediaId ); + + // + // delete the media file from the file system and harvester's database first + // before deleting it from the collection + // + if (DeleteFileL()) + { + // + // set up the command to send to the collection + // + CMPXCommand* command = CMPXMedia::NewL(); + CleanupStack::PushL(command); + + command->SetTObjectValueL( + TMPXAttribute(KMPXCommandContentIdGeneral, EMPXCommandGeneralId), KMPXCommandIdCollectionRemove); + command->SetTObjectValueL( + TMPXAttribute(KMPXCommandContentIdGeneral, EMPXCommandGeneralDoSync), ETrue); + command->SetCObjectValueL( + TMPXAttribute(KMPXCommandIdCollectionRemove,EMPXCommandCollectionRemovePath), + iDeletePath); + command->SetTObjectValueL( + TMPXAttribute(KMPXCommandIdCollectionRemove, EMPXCommandCollectionRemoveMediaCount), 1); + command->SetTObjectValueL(KMPXCommandCollectionRemoveSuppressMsgs,ETrue); + command->SetCObjectValueL(KMPXCommandCollectionChangeMsgs, iMessageArray); + // send sync remove command + MPX_PERF_START( MPX_PERF_DELETE_COLLECTION ); + iCollectionUtil.Collection().CommandL(*command); + MPX_PERF_END( MPX_PERF_DELETE_COLLECTION ); + + // + // return command should contain error, completed and media Id information + // + if (!command->IsSupported(TMPXAttribute(KMPXCommandIdCollectionRemove, EMPXCommandCollectionRemoveError)) || + !command->IsSupported(TMPXAttribute(KMPXCommandIdCollectionRemove, EMPXCommandCollectionRemoveCompleted))) + { + User::Leave(KErrAbort); + } + + // + // abandon operation if an error occured removing a media from the collection + // + TInt error = + command->ValueTObjectL( + TMPXAttribute(KMPXCommandIdCollectionRemove, EMPXCommandCollectionRemoveError)); + User::LeaveIfError(error); + + // + // require to send async remove command again if command completed is EFalse + // + TBool completed = + command->ValueTObjectL( + TMPXAttribute(KMPXCommandIdCollectionRemove, EMPXCommandCollectionRemoveCompleted)); + iMoreToDo = !completed; + + // + // retrieve the updated path with the removed media deselected and use this + // path for the next remove command + // + delete iDeletePath; + iDeletePath = NULL; + iDeletePath = + command->ValueCObjectL( + TMPXAttribute(KMPXCommandIdCollectionRemove, EMPXCommandCollectionRemovePath)); + + CleanupStack::PopAndDestroy(command); + + if (iFiles->MdcaCount()) + { + iFiles->Delete(0); + } + + // Commit every 100 items deleted, message array ownership passed to engine + // + iDeleteCount++; + if( iDeleteCount%KBatchCommit == 0 ) + { + // Commit Harvester DB + TRAP_IGNORE( iHarvester.CloseTransactionL() ); + + // Commit Collection DB + CMPXCommand* cmd = CMPXCommand::NewL(); + CleanupStack::PushL( cmd ); + cmd->SetTObjectValueL(KMPXCommandGeneralId,KMPXCommandIdCollectionCompleteDelete); + cmd->SetTObjectValueL(KMPXCommandGeneralDoSync, ETrue); + cmd->SetTObjectValueL(KMPXCommandCollectionDeleteCompactDb, ETrue); + cmd->SetCObjectValueL(KMPXCommandCollectionDeleteMsgArray, iMessageArray); + iCollectionUtil.Collection().CommandL(*cmd); + + delete iMessageArray; + iMessageArray = NULL; + iMessageArray = CMPXMessageArray::NewL(); + CleanupStack::PopAndDestroy( cmd ); + } + } + // + // File not deleted from the file system, skip to the next + // + else + { + TArray selectionIndices = iDeletePath->Selection(); + if (selectionIndices.Count()) + { + iDeletePath->Deselect(selectionIndices[0]); + } + + iFiles->Delete(0); + } + + if (iFiles->MdcaCount() == 0) + { + if (iRetrievedItemsCount >= iItemsCount) + { + iMoreToDo = EFalse; + iRetrievedItemsCount = 0; + } + else + { + iState = EMPXPreparation; + } + } + + // Send delete status when necessary. + TInt deleteThreshold = ((iDeletePercent+iDeleteIncFactor)*iItemsCount)/100; + if ( deleteThreshold > iItemsCount ) + { + deleteThreshold = iItemsCount; + } + if ( iDeleteCount >= deleteThreshold ) + { + iDeletePercent += iDeleteIncFactor; + if ( (iDeletePercent > 100) || (iDeleteCount == iItemsCount) ) + { + iDeletePercent = 100; + } + CMPXMedia* media = CMPXMedia::NewL(); + CleanupStack::PushL( media ); + media->SetTObjectValueL( KMPXMediaGeneralCount, iDeletePercent ); + iObserver.HandleOperationCompleteL( EDeleteStatusOp, KErrNone, media ); + CleanupStack::Pop( media ); + } + } + +// --------------------------------------------------------------------------- +// Deletes the file from the file system and harvester's database +// --------------------------------------------------------------------------- +// +TBool CMPXDeleteHelper::DeleteFileL() + { + TBool deleted(ETrue); + + if (iFiles->MdcaCount() > 0) + { + TPtrC uri = iFiles->MdcaPoint(0); + + if( uri.Length() > 0 ) + { + // For playlist files, it's possible that we are deleting the file which + // is not where the playlist is originated from. e.g. Playlist has been + // renamed to Playlist(01) in the collection, after deleting Playlist(01) + // from the collection, we are now attempting to delete Playlist(01).m3u + // which is not the originating file. This is a known risk. + CDesCArrayFlat* files = new (ELeave)CDesCArrayFlat(1); + CleanupStack::PushL(files); + files->AppendL(uri); + + MPX_PERF_START( MPX_PERF_DELHELPER_HARVESTER_DELETE ); + TRAPD(err, iHarvester.DeleteFilesL(*files, EFalse)); // to-do: create a sync DeleteFileL in harvester + MPX_PERF_END( MPX_PERF_DELHELPER_HARVESTER_DELETE ); + + // if the file cannot be found or is currently in use, skip to the next + // media removal, but inform the client at the end that one of the files + // is in use should that be the case + if (err == KErrInUse) + { + iHadInUse = ETrue; + deleted = EFalse; + } + else if ( err == KErrNotFound || + err == KErrPathNotFound ) + { + // Cleanup harvester for broken links + // Have to trap ignore because .vir virtual playlists + // do not exist and we do not know the file is a playlist + // Since it is already KErrNotFound or KErrPathNotFound, + // + TRAP_IGNORE(iHarvester.RemoveFilesL(*files)); + } + else + { + User::LeaveIfError(err); + } + + CleanupStack::PopAndDestroy(files); //lint !e961 +#ifdef RD_MPX_TNM_INTEGRATION + const TDesC& file = iFiles->MdcaPoint(0); + // remove from thumbnail manager + CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC( + file, KImageFileType ); + iTNManager->DeleteThumbnails( *source ); + CleanupStack::PopAndDestroy( source ); + // remove from local drive +#endif //RD_MPX_TNM_INTEGRATION + } + } + return deleted; + } + +// --------------------------------------------------------------------------- +// Stop deleting +// --------------------------------------------------------------------------- +// +void CMPXDeleteHelper::Stop() + { + if ( iState != EMPXIdle ) + { + iMoreToDo = EFalse; + } + } + +// --------------------------------------------------------------------------- +// Callback but not used here +// --------------------------------------------------------------------------- +void CMPXDeleteHelper::ThumbnailPreviewReady( + MThumbnailData& /*aThumbnail*/, TThumbnailRequestId /*aId*/ ) + { + } + + +// --------------------------------------------------------------------------- +// Callback but not used here +// --------------------------------------------------------------------------- +void CMPXDeleteHelper::ThumbnailReady( TInt /*aError*/, + MThumbnailData& /*aThumbnail*/, TThumbnailRequestId /*aId*/ ) + { + } + +// --------------------------------------------------------------------------- +// CMPXDeleteHelper::ConnectUsbMan +// --------------------------------------------------------------------------- +void CMPXDeleteHelper::ConnectUsbMan() + { + MPX_FUNC("CMPXDeleteHelper::ConnectUsbMan()"); + if ( iUsbMan.Connect() == KErrNone ) + { + iUsbManConnected = ETrue; + } + } + +// END OF FILE diff -r 000000000000 -r a2952bb97e68 mmappcomponents/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -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: Build information file for Multimedia App Components. +* Version : %version: 7.2.2.8 % +* +*/ + +#include "../../inc/mmappfwbldvariant.hrh" + +#include "../collectionhelper/group/bld.inf" +#include "../playlistengine/group/bld.inf" +#include "../harvester/group/bld.inf" +#include "../mmappcommonui/group/bld.inf" +#include "../mediaplayersettingsengine/group/bld.inf" +#ifdef IAD_INCLUDE_AUDIOFETCHER +#include "../audiofetcher/group/bld.inf" +#endif + +#ifdef __WINDOWS_MEDIA +#include "../asxparser/group/bld.inf" +#endif + +#include "../playbackhelper/group/bld.inf" +#include "../videoplaylistutility/group/bld.inf" +#include "../mmmtpdataprovider/group/bld.inf" +PRJ_EXPORTS + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/collectionmediator/bwinscw/mpxcollectionmediatorU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/collectionmediator/bwinscw/mpxcollectionmediatorU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,18 @@ +EXPORTS + ?AddItemL@CMPXCollectionMediator@@QAEXAAPAVCMPXMedia@@@Z @ 1 NONAME ; void CMPXCollectionMediator::AddItemL(class CMPXMedia * &) + ?AddItemL@CMPXCollectionMediator@@QAEXAAVCMPXMediaArray@@@Z @ 2 NONAME ; void CMPXCollectionMediator::AddItemL(class CMPXMediaArray &) + ?CheckItemL@CMPXCollectionMediator@@QAEXAAVCMPXMedia@@@Z @ 3 NONAME ; void CMPXCollectionMediator::CheckItemL(class CMPXMedia &) + ?FetchAndMoveItemL@CMPXMoveItemHelper@@QAEXABVCMPXMedia@@VTUid@@@Z @ 4 NONAME ; void CMPXMoveItemHelper::FetchAndMoveItemL(class CMPXMedia const &, class TUid) + ?FetchAndMoveItemSyncL@CMPXMoveItemHelper@@QAEXABVCMPXMedia@@VTUid@@@Z @ 5 NONAME ; void CMPXMoveItemHelper::FetchAndMoveItemSyncL(class CMPXMedia const &, class TUid) + ?MoveItemL@CMPXCollectionMediator@@QAEXAAPAVCMPXMedia@@VTUid@@1@Z @ 6 NONAME ; void CMPXCollectionMediator::MoveItemL(class CMPXMedia * &, class TUid, class TUid) + ?MoveItemL@CMPXCollectionMediator@@QAEXAAPAVCMPXMedia@@VTUid@@1PAVMMPXMoveItemObserver@@@Z @ 7 NONAME ; void CMPXCollectionMediator::MoveItemL(class CMPXMedia * &, class TUid, class TUid, class MMPXMoveItemObserver *) + ?MoveItemL@CMPXMoveItemHelper@@QAEXAAVCMPXMedia@@VTUid@@@Z @ 8 NONAME ; void CMPXMoveItemHelper::MoveItemL(class CMPXMedia &, class TUid) + ?NewL@CMPXCollectionMediator@@SAPAV1@AAVMMPXCollection@@PAVMMPXMediatorObserver@@@Z @ 9 NONAME ; class CMPXCollectionMediator * CMPXCollectionMediator::NewL(class MMPXCollection &, class MMPXMediatorObserver *) + ?NewL@CMPXCollectionMediator@@SAPAV1@XZ @ 10 NONAME ; class CMPXCollectionMediator * CMPXCollectionMediator::NewL(void) + ?NewL@CMPXMoveItemHelper@@SAPAV1@PAVMMPXMoveItemObserver@@@Z @ 11 NONAME ; class CMPXMoveItemHelper * CMPXMoveItemHelper::NewL(class MMPXMoveItemObserver *) + ?NewLC@CMPXCollectionMediator@@SAPAV1@AAVMMPXCollection@@PAVMMPXMediatorObserver@@@Z @ 12 NONAME ; class CMPXCollectionMediator * CMPXCollectionMediator::NewLC(class MMPXCollection &, class MMPXMediatorObserver *) + ?NewLC@CMPXMoveItemHelper@@SAPAV1@PAVMMPXMoveItemObserver@@@Z @ 13 NONAME ; class CMPXMoveItemHelper * CMPXMoveItemHelper::NewLC(class MMPXMoveItemObserver *) + ?SetItemL@CMPXCollectionMediator@@QAEXAAPAVCMPXMedia@@@Z @ 14 NONAME ; void CMPXCollectionMediator::SetItemL(class CMPXMedia * &) + ?SetItemL@CMPXCollectionMediator@@QAEXAAV?$TArray@PAVCMPXMedia@@@@AAVCMPXCollectionPath@@AAV?$RArray@H@@@Z @ 15 NONAME ; void CMPXCollectionMediator::SetItemL(class TArray &, class CMPXCollectionPath &, class RArray &) + ?SetItemL@CMPXCollectionMediator@@QAEXAAVCMPXMediaArray@@@Z @ 16 NONAME ; void CMPXCollectionMediator::SetItemL(class CMPXMediaArray &) + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/collectionmediator/data/mpxmediator.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/collectionmediator/data/mpxmediator.rss Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2006 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: Resource definitions for MPX Mediator +* +*/ + + +NAME MPXM + +#include +#include +#include "mpxmediator.loc" + + +RESOURCE BA_RSS_SIGNATURE { } + +RESOURCE TBUF + { + buf = "MPXM"; + } + +// --------------------------------------------------------------------------- +// r_genre_podcast +// String used for genre comparison. Localized version of the word "podcast" +// --------------------------------------------------------------------------- +// +RESOURCE LBUF r_genre_podcast + { + txt=qtn_nmp_genre_podcast; + } + +// --------------------------------------------------------------------------- +// r_genre_podcast_english +// String used for genre comparison. This string is always in English and +// doesn't require any localization. +// --------------------------------------------------------------------------- +// +RESOURCE LBUF r_genre_podcast_english + { + txt = "Podcast"; + } + +// --------------------------------------------------------------------------- +// r_genre_unknown +// Localized string for the genre "Unknown" +// --------------------------------------------------------------------------- +// +RESOURCE LBUF r_genre_unknown + { + txt=qtn_nmp_genre_unknown; + } diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/collectionmediator/eabi/mpxcollectionmediatorU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/collectionmediator/eabi/mpxcollectionmediatorU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,22 @@ +EXPORTS + _ZN18CMPXMoveItemHelper17FetchAndMoveItemLERK9CMPXMedia4TUid @ 1 NONAME + _ZN18CMPXMoveItemHelper21FetchAndMoveItemSyncLERK9CMPXMedia4TUid @ 2 NONAME + _ZN18CMPXMoveItemHelper4NewLEP20MMPXMoveItemObserver @ 3 NONAME + _ZN18CMPXMoveItemHelper5NewLCEP20MMPXMoveItemObserver @ 4 NONAME + _ZN18CMPXMoveItemHelper9MoveItemLER9CMPXMedia4TUid @ 5 NONAME + _ZN22CMPXCollectionMediator10CheckItemLER9CMPXMedia @ 6 NONAME + _ZN22CMPXCollectionMediator4NewLER14MMPXCollectionP20MMPXMediatorObserver @ 7 NONAME + _ZN22CMPXCollectionMediator4NewLEv @ 8 NONAME + _ZN22CMPXCollectionMediator5NewLCER14MMPXCollectionP20MMPXMediatorObserver @ 9 NONAME + _ZN22CMPXCollectionMediator8AddItemLER14CMPXMediaArray @ 10 NONAME + _ZN22CMPXCollectionMediator8AddItemLERP9CMPXMedia @ 11 NONAME + _ZN22CMPXCollectionMediator8SetItemLER14CMPXMediaArray @ 12 NONAME + _ZN22CMPXCollectionMediator8SetItemLER6TArrayIP9CMPXMediaER18CMPXCollectionPathR6RArrayIiE @ 13 NONAME + _ZN22CMPXCollectionMediator8SetItemLERP9CMPXMedia @ 14 NONAME + _ZN22CMPXCollectionMediator9MoveItemLERP9CMPXMedia4TUidS3_ @ 15 NONAME + _ZN22CMPXCollectionMediator9MoveItemLERP9CMPXMedia4TUidS3_P20MMPXMoveItemObserver @ 16 NONAME + _ZTI18CMPXMoveItemHelper @ 17 NONAME ; ## + _ZTI22CMPXCollectionMediator @ 18 NONAME ; ## + _ZTV18CMPXMoveItemHelper @ 19 NONAME ; ## + _ZTV22CMPXCollectionMediator @ 20 NONAME ; ## + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/collectionmediator/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/collectionmediator/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2006 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: Collection Mediator +* +*/ + + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +PRJ_MMPFILES +mpxcollectionmediator.mmp \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/collectionmediator/group/mpxcollectionmediator.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/collectionmediator/group/mpxcollectionmediator.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2006 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: Mediator logic to check for special exceptions +* +*/ + + +#include +#include + +TARGET mpxcollectionmediator.dll +TARGETTYPE dll +UID 0x1000006C 0x101FFCAC + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE mpxcollectionmediator.cpp +SOURCE mpxmoveitemhelper.cpp + +START RESOURCE ../data/mpxmediator.rss +TARGETPATH APP_RESOURCE_DIR +HEADER +LANGUAGE_IDS +END + +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY bafl.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY mpxcommon.lib +LIBRARY mpxcollectionutility.lib +LIBRARY mpxplaybackutility.lib +LIBRARY centralrepository.lib + +#if defined(ARMCC) +deffile ../eabi/ +#elif defined(WINSCW) +deffile ../bwinscw/ +#endif \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/collectionmediator/inc/mpxmediator.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/collectionmediator/inc/mpxmediator.loc Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2006 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: Localization strings for Mediator +* +*/ + + +// d:The genre Podcast +// d:This text is used to compare with item's genre to determine which library +// d:should be added to. +// d:Not for UI display. No layout information is needed. +// l:N/A +// r:3.1 +// +#define qtn_nmp_genre_podcast "Podcast" + +// d:"Unknown" Genre text +// d:Text to be used for genre when an item is being moved from podcast +// d:to music library. +// d:Not for UI display. No layout information is needed. +// l:N/A +// r:3.1 +// +#define qtn_nmp_genre_unknown "Unknown" + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/collectionmediator/inc/mpxmoveitemhelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/collectionmediator/inc/mpxmoveitemhelper.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,156 @@ +/* +* Copyright (c) 2006 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: Class to help with moving items between collections +* +*/ + + +#ifndef CMPXMOVEITEMHELPER_H +#define CMPXMOVEITEMHELPER_H + +#include +#include + +class CMPXMedia; +class MMPXCollectionUtility; +class MMPXMoveItemObserver; + +/** + * Class to help move items between collections + * + * @lib mpxcollectionmediator.lib + * @since S60 3.0 + */ +class CMPXMoveItemHelper : public CBase, + public MMPXCollectionFindObserver + { + +public: + + /** + * Two-phase constructor + * @param aObs observer to the move item helper + */ + IMPORT_C static CMPXMoveItemHelper* NewL( MMPXMoveItemObserver* aObs ); + + /** + * Two-phase construcotr + * @param aObs observer to the move item helper + */ + IMPORT_C static CMPXMoveItemHelper* NewLC( MMPXMoveItemObserver* aObs ); + + /** + * Virtual destructor + */ + virtual ~CMPXMoveItemHelper(); + +public: // New Functions + + /** + * Move an item from one collection to another, asynchronous + * @param aMedia Source item, must contain item id or uri and original collection + * @param aNewCollection Destinaton collection to move the item to + */ + IMPORT_C void MoveItemL( CMPXMedia& aMedia, TUid aNewCollection ); + + /** + * Gets the full details of an item then + * move an item from one collection to another, asynchronous + * @param aMedia Source item, must contain item id or uri and original collection + * @param aNewCollection Destinaton collection to move the item to + */ + IMPORT_C void FetchAndMoveItemL( const CMPXMedia& aMedia, TUid aNewCollection ); + + /** + * Gets the full details of an item then + * move an item from one collection to another, synchronous + * @param aMedia Source item, must contain item id or uri and original collection + * @param aNewCollection Destinaton collection to move the item to + */ + IMPORT_C void FetchAndMoveItemSyncL( const CMPXMedia& aMedia, TUid aNewCollection ); + +private: // New functions + + /** + * Updates a media with any special move requirements + * ie: move from podcast -> music will set genre to "unknown" + * @param aMedia, media to update + * @param aOldCollection, old collection + * @param aNewCollection, new collection + */ + void UpdateMediaForMoveL( CMPXMedia& aMedia, + TUid& aOldCollection, + TUid& aNewCollection ); + + /** + * Handles the completion of a FindAllL() + * @param aResult result of the find + */ + void DoHandleFindAllL( const CMPXMedia& aResult ); + + /** + * Add an item to a collection + * @param aMedia, media to add + * @param aCollectionId, collection UID + */ + void DoAddL( CMPXMedia* aMedia, TUid aCollectionId ); + + /** + * Remove an item to a collection + * @param aMedia, media to add + * @param aCollectionId, collection UID + */ + void DoRemoveL( CMPXMedia* aMedia, TUid aCollectionId ); + +protected: + + /** + * From MMPXCollectionFindObserver + */ + void HandleFindAllL(const CMPXMedia& aResults, + TBool aComplete,TInt aError); + +private: + /* State representation for the move event */ + enum TMoveState + { + EIdle, // Not moving + EFind // Fetching full details + }; + +private: + + /** + * Private constructor + * @param aObs observer to the move helper + */ + CMPXMoveItemHelper( MMPXMoveItemObserver* aObs ); + + /** + * 2nd phase constructor + */ + void ConstructL(); + +private: // data + MMPXMoveItemObserver* iObs; + MMPXCollectionUtility* iCollection; + + // Cache the async state + TMoveState iMoveState; + TUid iMoveTarget; + TUid iMusicCollectionID; // Music Collection ID + TUid iPodCastCollectionID; // PodCast Collection ID + }; + +#endif // CMPXMOVEITEMHELPER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/collectionmediator/src/mpxcollectionmediator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/collectionmediator/src/mpxcollectionmediator.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,602 @@ +/* +* Copyright (c) 2006 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: mediator class to handle music specific collection requirements +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // to get podcasting cenrep key + +#include +#include +#include "mpxcollectionmediator.h" +#include "mpxmediatorobserver.h" +#include "mpxmoveitemhelper.h" + +// CONSTANTS +_LIT( KPodCastPath, "\\podcasts\\"); + +_LIT( KMediatorResource, "mpxmediator.rsc" ); + +const TUid KCRUIDHarvesterFeatures = { 0x101FFCD2 }; +const TInt KDisablePodcasting = 5; + +// --------------------------------------------------------------------------- +// Default Constructor +// --------------------------------------------------------------------------- +// +CMPXCollectionMediator::CMPXCollectionMediator( MMPXCollection& aColUtil, + MMPXMediatorObserver* aObs ) : + iObserver( aObs ) + { + iColUtil = &aColUtil; + } + +// --------------------------------------------------------------------------- +// Default Constructor +// --------------------------------------------------------------------------- +// +CMPXCollectionMediator::CMPXCollectionMediator() + { + + } + +// --------------------------------------------------------------------------- +// 2nd Phase Constructor +// --------------------------------------------------------------------------- +// +void CMPXCollectionMediator::ConstructL() + { + User::LeaveIfError( iFs.Connect() ); + + TParse parse; + TFileName resFile; + parse.Set( KMediatorResource, &KDC_APP_RESOURCE_DIR, NULL ); + resFile.Copy(parse.FullName()); + User::LeaveIfError( MPXUser::CompleteWithDllPath( resFile ) ); + + BaflUtils::NearestLanguageFile(iFs, resFile); + RResourceFile resourceFile; + resourceFile.OpenL(iFs, resFile); + resourceFile.ConfirmSignatureL(0); // magic + + TResourceReader resReader; + + // Get the first podcast buf + HBufC8* buf = resourceFile.AllocReadLC( R_GENRE_PODCAST ); + resReader.SetBuffer( buf ); + iPodCastBuf = resReader.ReadHBufCL(); + CleanupStack::PopAndDestroy( buf ); + buf = NULL; + + // Get the second podcast buf + buf = resourceFile.AllocReadLC( R_GENRE_PODCAST_ENGLISH ); + resReader.SetBuffer( buf ); + iPodCastEngBuf = resReader.ReadHBufCL(); + CleanupStack::PopAndDestroy( buf ); + + // Get the unknwon podcast buf + buf = resourceFile.AllocReadLC( R_GENRE_UNKNOWN ); + resReader.SetBuffer( buf ); + iUnknownBuf = resReader.ReadHBufCL(); + CleanupStack::PopAndDestroy( buf ); + + // Fetch the real implementation ID for collection plugins + RArray ary; + CleanupClosePushL( ary ); + + MMPXCollectionUtility* temp = MMPXCollectionUtility::NewL(); + CleanupClosePushL( *temp ); + ary.AppendL( TUid::Uid(EMPXCollectionPluginPodCast) ); + iPodCastCollectionID = temp->CollectionIDL( ary.Array() ); + + ary.Reset(); + ary.AppendL( TUid::Uid(EMPXCollectionPluginMusic) ); + iMusicCollectionID = temp->CollectionIDL( ary.Array() ); + CleanupStack::PopAndDestroy( temp ); + + CleanupStack::PopAndDestroy( &ary ); + + resourceFile.Close(); + } + + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXCollectionMediator* CMPXCollectionMediator::NewL( + MMPXCollection& aColUtil, + MMPXMediatorObserver* aObs ) + { + CMPXCollectionMediator* self = CMPXCollectionMediator::NewLC( aColUtil, + aObs ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXCollectionMediator* CMPXCollectionMediator::NewL() + { + CMPXCollectionMediator* self = new( ELeave ) CMPXCollectionMediator(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXCollectionMediator* CMPXCollectionMediator::NewLC( + MMPXCollection& aColUtil, + MMPXMediatorObserver* aObs ) + { + CMPXCollectionMediator* self = new( ELeave ) CMPXCollectionMediator + ( aColUtil, + aObs ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CMPXCollectionMediator::~CMPXCollectionMediator() + { + iFs.Close(); + + delete iPodCastBuf; + delete iPodCastEngBuf; + delete iUnknownBuf; + delete iMoveHelper; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionMediator::AddItemL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionMediator::AddItemL( CMPXMedia*& aMedia ) + { + ASSERT( iColUtil ); + + // If this is a podcast, change the collection id + if( IsPodcastL( *aMedia ) ) + { + UpdatePathToPodcastL( *aMedia ); + } + + // Add it to the collection + CMPXCommand* cmd = CMPXMedia::NewL(); + CleanupStack::PushL( cmd ); + + cmd->SetTObjectValueL(KMPXCommandGeneralId, KMPXCommandIdCollectionAdd ); + cmd->SetTObjectValueL(KMPXCommandGeneralDoSync, ETrue ); + cmd->SetCObjectValueL(KMPXCommandColAddMedia, aMedia); // copied + + if (aMedia->IsSupported(KMPXMediaGeneralCollectionId)) + { + TUid collectionId = aMedia->ValueTObjectL(KMPXMediaGeneralCollectionId); + cmd->SetTObjectValueL(KMPXCommandGeneralCollectionId, collectionId.iUid); + } + else + { + User::Leave( KErrArgument ); + } + + iColUtil->CommandL(*cmd); + + TMPXItemId mediaId = cmd->ValueTObjectL(KMPXCommandColAddRtnId); + CleanupStack::PopAndDestroy(cmd); + + // put mediaId in aMedia + aMedia->SetTObjectValueL(KMPXMediaGeneralId, mediaId); + } + +// --------------------------------------------------------------------------- +// CMPXCollectionMediator::AddItemL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionMediator::AddItemL( CMPXMediaArray& aMPArray ) + { + ASSERT( iColUtil ); + + // Check each media property and update as needed + // + CMPXMediaArray* musicArray = CMPXMediaArray::NewL(); + CleanupStack::PushL( musicArray ); + CMPXMediaArray* podcastArray = CMPXMediaArray::NewL(); + CleanupStack::PushL( podcastArray ); + + TInt count( aMPArray.Count() ); + for( TInt i=0; iIsSupported(KMPXMediaGeneralCollectionId) ) + { + User::Leave( KErrArgument ); + } + + const TUid& oldCol = curMP->ValueTObjectL( KMPXMediaGeneralCollectionId ); + + UpdatePathToPodcastL( *curMP ); + if( iObserver ) + { + TRAP_IGNORE(iObserver->HandleMediatorPathUpdatedL( curMP, oldCol ) ); + } + + // Add this to podcast collection + curMP->SetTObjectValueL( KMPXMediaGeneralCollectionId, + iPodCastCollectionID ); + // Make a copy reference + podcastArray->AppendL(*curMP); + } + else + { + // Make a copy reference + musicArray->AppendL(*curMP); + } + } + // Package it as a CMPXMediaContainer class, then send to collection + // + if( musicArray->Count() ) + { + RArray contId; + CleanupClosePushL( contId ); + contId.AppendL( KMPXMediaIdGeneral ); + contId.AppendL( KMPXMediaIdContainer ); + + CMPXMedia* container = CMPXMedia::NewL( contId.Array() ); + CleanupStack::PushL( container ); + container->SetTObjectValueL( KMPXMediaGeneralType, + EMPXGroup ); + container->SetTObjectValueL( KMPXMediaGeneralCategory, + EMPXCollection ); + + container->SetCObjectValueL( KMPXMediaArrayContents, + musicArray ); + container->SetTObjectValueL(KMPXMediaArrayCount, musicArray->Count() ); + + // Add remainder to music collection + DoAddToCollectionL( container, iMusicCollectionID ); + CleanupStack::PopAndDestroy( container ); + CleanupStack::PopAndDestroy( &contId ); + contId.Close(); + } + if( podcastArray->Count() ) + { + RArray contId; + CleanupClosePushL( contId ); + contId.AppendL( KMPXMediaIdGeneral ); + contId.AppendL( KMPXMediaIdContainer ); + + CMPXMedia* container = CMPXMedia::NewL( contId.Array() ); + CleanupStack::PushL( container ); + container->SetTObjectValueL( KMPXMediaGeneralType, + EMPXGroup ); + container->SetTObjectValueL( KMPXMediaGeneralCategory, + EMPXCollection ); + + container->SetCObjectValueL( KMPXMediaArrayContents, + podcastArray ); + container->SetTObjectValueL(KMPXMediaArrayCount, podcastArray->Count() ); + + // Add remainder to podcast collection + DoAddToCollectionL( container, iPodCastCollectionID ); + CleanupStack::PopAndDestroy( container ); + CleanupStack::PopAndDestroy( &contId ); + contId.Close(); + } + CleanupStack::PopAndDestroy( podcastArray ); + CleanupStack::PopAndDestroy( musicArray ); + } + +// --------------------------------------------------------------------------- +// CMPXCollectionMediator::SetItemL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionMediator::SetItemL( CMPXMediaArray& aMPArray ) + { + ASSERT( iColUtil ); + + // Set each item + // + TInt count( aMPArray.Count() ); + for( TInt i=0; iValueTObjectL( KMPXMediaGeneralCollectionId ); + + // No need to move it is already in podcast + if( oldCol != iPodCastCollectionID ) + { + TRAPD( err, DoMoveItemL( aMedia, iPodCastCollectionID ) ); + + if( err == KErrNone ) + { + if( iObserver ) + { + iObserver->HandleMediatorPathUpdatedL( aMedia, oldCol ); + } + } + else + { + DoSetToCollectionL( aMedia, iPodCastCollectionID ); + } + } + else + { + DoSetToCollectionL( aMedia, iPodCastCollectionID ); + } + } + else + { + // Update as usual + // + DoSetToCollectionL( aMedia, + aMedia->ValueTObjectL(KMPXMediaGeneralCollectionId) ); + } + } + +// --------------------------------------------------------------------------- +// CMPXCollectionMediator::SetItemL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionMediator::SetItemL( + TArray& /*aArray*/, + CMPXCollectionPath& /*aPath*/, + RArray& /*aIndices*/ ) + { + // Not necessary for Increment 8 timeframe + ASSERT( iColUtil ); + ASSERT( 0 ); + } + +// --------------------------------------------------------------------------- +// CMPXCollectionMediator::CheckItemL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionMediator::CheckItemL( CMPXMedia& aMedia ) + { + MPX_DEBUG1( "CMPXCollectionMediator::CheckItemL <---" ); + if( IsPodcastL( aMedia ) ) + { + MPX_DEBUG1( "CMPXCollectionMediator::CheckItemL - changing collection id" ); + UpdatePathToPodcastL( aMedia ); + } + } + +// --------------------------------------------------------------------------- +// CMPXCollectionMediator::MoveItemL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionMediator::MoveItemL( + CMPXMedia*& aMedia, + TUid aOldCollection, + TUid aNewCollection ) + { + ASSERT( iColUtil ); + + // If we are moving from podcast collection -> local audio, we strip the + // podcast genre + // + if( aNewCollection == iMusicCollectionID && + aOldCollection == iPodCastCollectionID ) + { + aMedia->SetTextValueL(KMPXMediaMusicGenre, + *iUnknownBuf ); + DoSetToCollectionL( aMedia, iPodCastCollectionID ); + } + + // Do the actual move operation + // + DoMoveItemL( aMedia, aNewCollection ); + } + +// --------------------------------------------------------------------------- +// CMPXCollectionMediator::MoveItemL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionMediator::MoveItemL( + CMPXMedia*& aMedia, + TUid aOldCollection, + TUid aNewCollection, + MMPXMoveItemObserver* aObs ) + { + ASSERT( iColUtil ); + + // If we are moving from podcast collection -> local audio, we strip the + // podcast genre + // + if( aNewCollection == iMusicCollectionID && + aOldCollection == iPodCastCollectionID ) + { + aMedia->SetTextValueL(KMPXMediaMusicGenre, + *iUnknownBuf ); + DoSetToCollectionL( aMedia, iPodCastCollectionID ); + } + + // Do the actual move operation + // + delete iMoveHelper; + iMoveHelper = NULL; + iMoveHelper = CMPXMoveItemHelper::NewL(aObs); + iMoveHelper->FetchAndMoveItemL( *aMedia, aNewCollection ); + } + +// --------------------------------------------------------------------------- +// CMPXCollectionMediator::IsPodcast() +// --------------------------------------------------------------------------- +// +TBool CMPXCollectionMediator::IsPodcastL( CMPXMedia& aMedia ) + { + MPX_DEBUG1( "CMPXCollectionMediator::IsPodcast <---" ); + + ASSERT(aMedia.IsSupported(KMPXMediaGeneralCategory)); + + TBool isPodCast( EFalse ); + + // Get podcasting key + TBool disablePodcast( EFalse ); + CRepository* repository = CRepository::NewL( KCRUIDHarvesterFeatures ); + repository->Get( KDisablePodcasting, disablePodcast ); + delete repository; + + if ( !disablePodcast ) + { + const TDesC& genre = aMedia.ValueText(KMPXMediaMusicGenre); + const TDesC& path = aMedia.ValueText(KMPXMediaGeneralUri); + if ( aMedia.ValueTObjectL( KMPXMediaGeneralCategory ) != EMPXPlaylist ) + { + if( genre.Length() ) + { + // Make everything lower case for easy comparison + // + HBufC* buf = genre.AllocL(); + TPtr ptr = buf->Des(); + ptr.LowerCase(); + + if( !ptr.CompareF( *iPodCastBuf ) || + !ptr.CompareF( *iPodCastEngBuf ) ) + { + isPodCast = ETrue; + } + delete buf; + } + if( path.Length() ) // also check podcast + { + HBufC* buf = path.AllocL(); + TPtr ptr = buf->Des(); + ptr.LowerCase(); + + if( KErrNotFound != buf->Find( KPodCastPath ) ) + { + isPodCast = ETrue; + } + delete buf; + } + } + } + MPX_DEBUG2( "CMPXCollectionMediator::IsPodcast %i --->", isPodCast ); + + return isPodCast; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionMediator::UpdatePathToPodcastL() +// --------------------------------------------------------------------------- +// +void CMPXCollectionMediator::UpdatePathToPodcastL( CMPXMedia& aMedia ) + { + aMedia.SetTObjectValueL(KMPXMediaGeneralCollectionId, + iPodCastCollectionID ); + } + +// --------------------------------------------------------------------------- +// CMPXCollectionMediator::DoMoveItemL() +// --------------------------------------------------------------------------- +// +void CMPXCollectionMediator::DoMoveItemL( CMPXMedia*& aMedia, + TUid aNewCollection ) + { + CMPXMoveItemHelper* mHelper = CMPXMoveItemHelper::NewL(NULL); + CleanupStack::PushL( mHelper ); + mHelper->FetchAndMoveItemSyncL( *aMedia, aNewCollection ); + CleanupStack::PopAndDestroy( mHelper ); + } + +// --------------------------------------------------------------------------- +// Add an item to the collection +// --------------------------------------------------------------------------- +// +void CMPXCollectionMediator::DoAddToCollectionL( CMPXMedia* aMedia, + TUid aCollectionId ) + { + CMPXCommand* cmd = CMPXCommand::NewL(); + CleanupStack::PushL( cmd ); + + cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdCollectionAdd ); + cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue ); + cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, aCollectionId.iUid ); + cmd->SetCObjectValueL( KMPXCommandColAddMedia, aMedia ); + + iColUtil->CommandL( *cmd ); + CleanupStack::PopAndDestroy( cmd ); + } + +// --------------------------------------------------------------------------- +// Set an item to the collection +// --------------------------------------------------------------------------- +// +void CMPXCollectionMediator::DoSetToCollectionL( CMPXMedia* aMedia, + TUid aCollectionId ) + { + CMPXCommand* cmd = CMPXCommand::NewL(); + CleanupStack::PushL( cmd ); + + cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdCollectionSet ); + cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue ); + cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, aCollectionId.iUid ); + cmd->SetCObjectValueL( KMPXCommandColSetMedia, aMedia ); + + iColUtil->CommandL( *cmd ); + CleanupStack::PopAndDestroy( cmd ); + } + +// END OF FILE + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/collectionmediator/src/mpxmoveitemhelper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/collectionmediator/src/mpxmoveitemhelper.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,342 @@ +/* +* Copyright (c) 2006 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: Helper class to move items to different collections +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mpxmediatorobserver.h" +#include "mpxmoveobserver.h" +#include "mpxmoveitemhelper.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CMPXMoveItemHelper::CMPXMoveItemHelper( MMPXMoveItemObserver* aObs ) + : iObs(aObs), + iMoveState(EIdle ) + { + } + + +// --------------------------------------------------------------------------- +// 2nd phased constructor +// --------------------------------------------------------------------------- +// +void CMPXMoveItemHelper::ConstructL() + { + iCollection = MMPXCollectionUtility::NewL( NULL ); + + RArray ary; + CleanupClosePushL( ary ); + + ary.AppendL( TUid::Uid(EMPXCollectionPluginPodCast) ); + iPodCastCollectionID = iCollection->CollectionIDL( ary.Array() ); + + ary.Reset(); + ary.AppendL( TUid::Uid(EMPXCollectionPluginMusic) ); + iMusicCollectionID = iCollection->CollectionIDL( ary.Array() ); + + CleanupStack::PopAndDestroy( &ary ); + } + + +// --------------------------------------------------------------------------- +// Two phase constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXMoveItemHelper* CMPXMoveItemHelper::NewL( MMPXMoveItemObserver* aObs ) + { + CMPXMoveItemHelper* self = CMPXMoveItemHelper::NewLC(aObs); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// Two phased constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXMoveItemHelper* CMPXMoveItemHelper::NewLC( MMPXMoveItemObserver* aObs ) + { + CMPXMoveItemHelper* self = new( ELeave ) CMPXMoveItemHelper(aObs); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// virtual destructor +// --------------------------------------------------------------------------- +// +CMPXMoveItemHelper::~CMPXMoveItemHelper() + { + if( iCollection ) + { + iCollection->Close(); + } + } + +// --------------------------------------------------------------------------- +// Move an item synchronously +// Three things to do to move an item +// 1: Remove item from old db +// 2: Udpdate media with new collection id +// 3: Add item into new db +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXMoveItemHelper::MoveItemL( CMPXMedia& aMedia, TUid aNewCollection ) + { + MMPXPlaybackUtility* pbUtil = MMPXPlaybackUtility::UtilityL( KPbModeActivePlayer ); + CleanupClosePushL(*pbUtil); + + // Media as a container or item + // + TMPXGeneralType type = + aMedia.ValueTObjectL( TMPXAttribute( KMPXMediaIdGeneral, + EMPXMediaGeneralType ) ); + + if ( type == EMPXGroup ) + { + const CMPXMediaArray* array = aMedia.Value( + TMPXAttribute( KMPXMediaIdContainer, + EMPXMediaArrayContents ) ); + if( !array ) + { + User::Leave( KErrNoMemory ); + } + + TInt count( array->Count() ); + if( count == 0 ) + { + User::Leave( KErrNotFound ); + } + for( TInt i=0; iAtL(i); + + // Notify the playback utility before removing the media item + if(entry->IsSupported(KMPXMediaGeneralId)) + { + TMPXItemId mediaId(entry->ValueTObjectL(KMPXMediaGeneralId)); + TRAP_IGNORE(pbUtil->CommandL( EPbCmdCloseItem, mediaId)); + } + + TUid oldCollection = entry->ValueTObjectL(TMPXAttribute(KMPXMediaIdGeneral, + EMPXMediaGeneralCollectionId)); + + DoRemoveL( entry, oldCollection ); + + entry->SetTObjectValueL(TMPXAttribute(KMPXMediaIdGeneral, + EMPXMediaGeneralCollectionId), + aNewCollection); + + UpdateMediaForMoveL( *entry, oldCollection, aNewCollection ); + DoAddL( entry, aNewCollection ); + } + } + else + { + TUid oldCollection = aMedia.ValueTObjectL(TMPXAttribute(KMPXMediaIdGeneral, + EMPXMediaGeneralCollectionId)); + + aMedia.SetTObjectValueL(TMPXAttribute(KMPXMediaIdGeneral, + EMPXMediaGeneralCollectionId), + aNewCollection); + + if(aMedia.IsSupported(KMPXMediaGeneralId)) + { + TMPXItemId mediaId(aMedia.ValueTObjectL(KMPXMediaGeneralId)); + TRAP_IGNORE(pbUtil->CommandL( EPbCmdCloseItem, mediaId)); + } + + DoRemoveL( &aMedia, oldCollection ); + + UpdateMediaForMoveL( aMedia, oldCollection, aNewCollection ); + DoAddL( &aMedia, aNewCollection ); + } + + CleanupStack::PopAndDestroy(pbUtil); + } + +// --------------------------------------------------------------------------- +// Fetch an item then move it async +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXMoveItemHelper::FetchAndMoveItemL( const CMPXMedia& aMedia, + TUid aNewCollection ) + { + ASSERT( iMoveState == EIdle ); + ASSERT( iObs ); + // Fetch item from collection asynchronously + // + // Look for the item, and fetch all relavant info + // + RArray atts; + CleanupClosePushL( atts ); + atts.Append(KMPXMediaGeneralAll); + atts.Append(KMPXMediaAudioAudioAll); + atts.Append(KMPXMediaMusicAll); + + iCollection->Collection().FindAllL( aMedia, atts.Array(), *this ); + CleanupStack::PopAndDestroy( &atts ); + iMoveState = EFind; + iMoveTarget = aNewCollection; + } + +// --------------------------------------------------------------------------- +// Fetch an item then move it sync +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXMoveItemHelper::FetchAndMoveItemSyncL( const CMPXMedia& aMedia, + TUid aNewCollection ) + { + // Look for the item, and fetch all relavant info + // + RArray atts; + CleanupClosePushL( atts ); + atts.Append(KMPXMediaGeneralAll); + atts.Append(KMPXMediaAudioAudioAll); + atts.Append(KMPXMediaMusicAll); + + CMPXMedia* result = iCollection->Collection().FindAllL( aMedia, + atts.Array() ); + CleanupStack::PopAndDestroy( &atts ); + CleanupStack::PushL( result ); + + // Move the item as normal + MoveItemL( *result, aNewCollection ); + CleanupStack::PopAndDestroy( result ); + } + +// --------------------------------------------------------------------------- +// Updates a media object for collection specific detail +// --------------------------------------------------------------------------- +// +void CMPXMoveItemHelper::UpdateMediaForMoveL( CMPXMedia& aMedia, + TUid& aOldCollection, + TUid& aNewCollection ) + { + // If we are moving from podcast collection -> local audio + // + if( aNewCollection == iMusicCollectionID && + aOldCollection == iPodCastCollectionID ) + { + aMedia.SetTObjectValueL(TMPXAttribute(KMPXMediaIdGeneral, + EMPXMediaGeneralCategory), + EMPXSong); + } + // Move from local collection -> podcast + // + else if( aOldCollection == iMusicCollectionID && + aNewCollection == iPodCastCollectionID ) + { + aMedia.SetTObjectValueL(TMPXAttribute(KMPXMediaIdGeneral, + EMPXMediaGeneralCategory), + EMPXPodcast); + } + } //lint !e961 + +// --------------------------------------------------------------------------- +// Add an item to the collection +// --------------------------------------------------------------------------- +// +void CMPXMoveItemHelper::DoAddL( CMPXMedia* aMedia, TUid aCollectionId ) + { + CMPXCommand* cmd = CMPXCommand::NewL(); + CleanupStack::PushL( cmd ); + + cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdCollectionAdd ); + cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue ); + cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, aCollectionId.iUid ); + cmd->SetCObjectValueL( KMPXCommandColAddMedia, aMedia ); + + iCollection->Collection().CommandL( *cmd ); + CleanupStack::PopAndDestroy( cmd ); + } + +// --------------------------------------------------------------------------- +// Set an item to the collection +// --------------------------------------------------------------------------- +// +void CMPXMoveItemHelper::DoRemoveL( CMPXMedia* aMedia, TUid aCollectionId ) + { + CMPXCommand* cmd = CMPXCommand::NewL(); + CleanupStack::PushL( cmd ); + + cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdCollectionRemoveMedia ); + cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue ); + cmd->SetTObjectValueL( KMPXCommandCollectionRemoveMediaDeleteRecord, ETrue ); + cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, aCollectionId.iUid ); + cmd->SetCObjectValueL( KMPXCommandCollectionRemoveMedia, aMedia ); + + iCollection->Collection().CommandL( *cmd ); + CleanupStack::PopAndDestroy( cmd ); + } + +// --------------------------------------------------------------------------- +// Handle find all callback +// --------------------------------------------------------------------------- +// +void CMPXMoveItemHelper::HandleFindAllL( const CMPXMedia& aResults, + TBool /*aComplete*/,TInt aError) + { + // Make sure the mode is correct + ASSERT( iMoveState == EFind ); + + TInt err ( aError ); + if( err == KErrNone ) + { + TRAP( err, DoHandleFindAllL( aResults ) ); + } + + // Find all is the most time consuming part. + // + iObs->HandleMoveCompleteL( err ); + iMoveState = EIdle; + } + +// --------------------------------------------------------------------------- +// Handle find all callback +// --------------------------------------------------------------------------- +// +void CMPXMoveItemHelper::DoHandleFindAllL( const CMPXMedia& aResult ) + { + // Need to make a tmp copy because we have to modify collection id + // + CMPXMedia* tmp = CMPXMedia::NewL(); + CleanupStack::PushL( tmp ); + *tmp = aResult; + MoveItemL( *tmp, iMoveTarget ); + CleanupStack::PopAndDestroy( tmp ); + } + +// End of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/bwinscw/mpxfilehandlerU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/bwinscw/mpxfilehandlerU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?NewL@CMPXHarvesterFileHandler@@SAPAV1@AAVRFs@@@Z @ 1 NONAME ; class CMPXHarvesterFileHandler * CMPXHarvesterFileHandler::NewL(class RFs &) + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/eabi/mpxfilehandlerU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/eabi/mpxfilehandlerU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _ZN24CMPXHarvesterFileHandler4NewLER3RFs @ 1 NONAME + _ZTI24CMPXHarvesterFileHandler @ 2 NONAME ; ## + _ZTV24CMPXHarvesterFileHandler @ 3 NONAME ; ## + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2006 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 File Handler +* +*/ + + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +mpxfilehandler.mmp \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/group/mpxfilehandler.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/group/mpxfilehandler.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2006 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 for the harvester file handler +* +*/ + + + +#include +#include +#include + +TARGET mpxfilehandler.dll +TARGETTYPE dll +UID 0x1000006C 0x10282939 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE mpxharvesterfilehandler.cpp +SOURCE mpxharvesterfilehandlerimp.cpp +SOURCE mpxharvesterdbmanager.cpp +SOURCE mpxharvesterdb.cpp +SOURCE mpxharvesterdbtable.cpp +SOURCE mpxfolderscanner.cpp +SOURCE mpxdbsynchronizer.cpp +SOURCE mpxfoldermonitor.cpp +SOURCE mpxmetadatascanner.cpp +SOURCE mpxplaylistscanner.cpp +SOURCE mpxdiskspacewatcher.cpp +SOURCE mpxbrokenlinkcleanup.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../inc + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY edbms.lib +LIBRARY estor.lib +LIBRARY hash.lib +LIBRARY ecom.lib +LIBRARY apgrfx.lib +LIBRARY apmime.lib +LIBRARY centralrepository.lib +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib +LIBRARY mpxcollectionmediator.lib +LIBRARY mpxplaylistengine.lib +LIBRARY mpxmetadataextractor.lib +LIBRARY caf.lib +LIBRARY DrmServerInterfaces.lib +#ifdef RD_MULTIPLE_DRIVE +LIBRARY PlatformEnv.lib +#endif //RD_MULTIPLE_DRIVE + +#if defined(ARMCC) +deffile ../eabi/ +#elif defined(WINSCW) +deffile ../bwinscw/ +#endif + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/group/mpxfilehandler.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/group/mpxfilehandler.xml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,2121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]> + + + + + WINSCW UDEB + + + + UserSourceTrees + + + AlwaysSearchUserPathstrue + InterpretDOSAndUnixPathsfalse + RequireFrameworkStyleIncludesfalse + SourceRelativeIncludesfalse + UserSearchPaths + +SearchPath +Paths60\mw\mmappservices\mmappcomponents\harvester\filehandler\inc +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Paths60\mw\mmappservices\mmappcomponents\harvester\inc +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Paths60\mw\mmappservices\mmappcomponents\harvester\filehandler\bwinscw +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Paths60\mw\mmappservices\mmappcomponents\harvester\filehandler\group +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Paths60\mw\mmappservices\mmappcomponents\harvester\filehandler\src +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + + SystemSearchPaths + +SearchPath +Pathepoc32\include +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Pathepoc32\include\oem +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Pathepoc32\include\middleware +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Pathepoc32\include\domain\middleware +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Pathepoc32\include\osextensions +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Pathepoc32\include\domain\osextensions +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Pathepoc32\include\internal +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Pathepoc32\include\mmf +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Pathepoc32\include\mmf\common +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Pathepoc32\include\mmf\server +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Pathepoc32\release\WINSCW\UDEB +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +PathSymbian_Support\Win32-x86 Support\Libraries\Win32 SDK +PathFormatWindows +PathRootCodeWarrior +Recursivefalse +FrameworkPathfalse +HostFlagsAll + + + + MWRuntimeSettings_WorkingDirectory + MWRuntimeSettings_CommandLine + MWRuntimeSettings_HostApplication + Pathepoc32\release\WINSCW\UDEB\epoc.exe +PathFormatWindows +PathRoots60 V drive + + MWRuntimeSettings_EnvVars + + + LinkerSymbian Linker v2 + PreLinker + PostLinkerSymbian Installer v2 + TargetnameWINSCW UDEB + OutputDirectory + Pathepoc32\release\WINSCW\UDEB +PathFormatWindows +PathRoots60 V drive + + SaveEntriesUsingRelativePathsfalse + + + FileMappings + + FileTypeTEXT + FileExtension._i + CompilerSymbian Compiler v2 + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension._ii + CompilerSymbian Compiler v2 + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.c + CompilerSymbian Compiler v2 + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.cc + CompilerSymbian Compiler v2 + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.cfg + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.cia + CompilerSymbian Compiler v2 + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.cpp + CompilerSymbian Compiler v2 + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.cwlink + Compiler + EditLanguageXML + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.cxx + CompilerSymbian Compiler v2 + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.def + Compiler + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.h + CompilerSymbian Compiler v2 + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.hrh + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.i + CompilerSymbian Compiler v2 + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.iby + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.ii + CompilerSymbian Compiler v2 + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.inf + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.ini + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.inl + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.loc + Compiler + EditLanguageC/C++ + Precompiletrue + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.mmpi + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.pch++ + CompilerSymbian Compiler v2 + EditLanguageC/C++ + Precompiletrue + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.pkg + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.policy + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.ra + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.resources + CompilerSymbian Resource v2 + EditLanguageXML + Precompiletrue + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.rh + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.rls + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.rss + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.rsg + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.s + CompilerSymbian Compiler v2 + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.script + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.txt + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileExtension.a + CompilerSymbian Object Importer v2 + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileExtension.lib + CompilerSymbian Object Importer v2 + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileExtension.dso + CompilerSymbian Object Importer v2 + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileExtension.o + CompilerSymbian Object Importer v2 + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + + + CacheModDatestrue + DumpBrowserInfofalse + CacheSubprojectstrue + UseThirdPartyDebuggerfalse + BrowserGenerator2 + DebuggerAppPath + Path + PathFormatGeneric + PathRootAbsolute + + DebuggerCmdLineArgs + DebuggerWorkingDir + Path + PathFormatGeneric + PathRootAbsolute + + CodeCompletionPrefixFileName + CodeCompletionMacroFileName + + + ConsoleEncoding0 + LogSystemMessagestrue + AutoTargetDLLsPopUp1 + StopAtWatchpointstrue + PauseWhileRunningfalse + PauseInterval5 + PauseUIFlags0 + AltExePath + Path + PathFormatWindows + PathRootAbsolute + + StopAtTempBPOnLaunchfalse + CacheSymbolicstrue + TempBPFunctionNameE32Main + TempBPType1 + + + Enabledfalse + ConnectionName + DownloadPath + LaunchRemoteAppfalse + RemoteAppPath + CoreID0 + JTAGClockSpeed8000 + IsMultiCorefalse + OSDownloadfalse + UseGlobalOSDownloadfalse + OSDownloadConnectionName + OSDownloadPath + AltDownloadfalse + AltDownloadConnectionName + + + MWDebugger_X86_Exceptions + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + OtherExecutables + + + AnalyzerConnectionName + + + CustomColor1 + Red0 + Green32767 + Blue0 + + CustomColor2 + Red0 + Green32767 + Blue0 + + CustomColor3 + Red0 + Green32767 + Blue0 + + CustomColor4 + Red0 + Green32767 + Blue0 + + + + ProcessorGeneric + BraekPoinType_II0 + UseInitFile0 + UseConfigFile0 + IDexecutable1 + IDinitialized1 + IDuninitialized0 + IDconstant1 + SDexecutable1 + SDinitialized1 + SDuninitialized0 + SDconstant1 + VerifyMemWrites0 + ShowMPC107regs0 + InitializationFile + ConfigurationFile + BreakpointType1 + WatchpointType1 + TargetOS1 + RTOSPluginName + ByteOrderType0 + CodeTest SYMBIAN Instrumenter + 0200020000000100000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000433A5C0000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000637466696C657300000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000636F6465746573742E6964620000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000 + + + + SymbianInstallationOutputFilenameApplication.sis + SymbianInstallationOutputLocation + Path + PathFormatWindows + PathRootProject + + SymbianInstallationContentSearchLocation + Pathepoc32\release\WINSCW\UDEB +PathFormatWindows +PathRoots60 V drive + + SymbianInstallationPassword + SymbianInstallationCreateStubFilefalse + + + SymbianInstallationOutputFilenameApplication.sis + SymbianInstallationOutputLocation + Path + PathFormatWindows + PathRootProject + + SymbianInstallationContentSearchLocation + Pathepoc32\release\WINSCW\UDEB +PathFormatWindows +PathRoots60 V drive + + SymbianInstallationPassword + SymbianInstallationCreateStubFilefalse + + + SymbianResourcesMMPFileLocation + Paths60\mw\mmappservices\mmappcomponents\harvester\filehandler\group +PathFormatWindows +PathRoots60 V drive + + SymbianResourcesBinaryOutputLocation + Pathepoc32\release\WINSCW\UDEB +PathFormatWindows +PathRoots60 V drive + + SymbianResourcesHeaderFileOutputLocation + Pathepoc32\include +PathFormatWindows +PathRoots60 V drive + + + + SymbianResourcesMMPFileLocation + Paths60\mw\mmappservices\mmappcomponents\harvester\filehandler\group +PathFormatWindows +PathRoots60 V drive + + SymbianResourcesBinaryOutputLocation + Pathepoc32\release\WINSCW\UDEB +PathFormatWindows +PathRoots60 V drive + + SymbianResourcesHeaderFileOutputLocation + Pathepoc32\include +PathFormatWindows +PathRoots60 V drive + + + + FileList + + + ProcessorGeneric + UseInitFile0 + UseConfigFile0 + ResetTarget1 + InitializationFile + Path + PathFormatGeneric + PathRootAbsolute + + ConfigurationFile + Path + PathFormatGeneric + PathRootAbsolute + + TargetOS1 + RTOSPluginName + + + ShowCommandLinefalse + SymbianEpocToolsPath + Path +PathFormatWindows +PathRoots60 V drive + + + + PrefixFilefeature_settings.hrh + CompilerXMLDescriptorMetrowerks x86 Compiler + Macros__SYMBIAN32__,__CW32__,__WINS__,__WINSCW__,__DLL__,_DEBUG,_UNICODE,__SUPPORT_CPP_EXCEPTIONS__ + CodeTESTfalse + EnableSWICfalse + Arguments-wchar_t off -align 4 -warnings on -w nohidevirtual, nounusedexpr -msgstyle gcc -enum int -str pool -exc ms -trigraphs on -O0 -inline off -nostdinc + CIAArgs + + + Parse Log Filefalse + Log File Path + Path + PathFormatWindows + PathRootAbsolute + + Symbian SDK Folder + Path + PathFormatWindows + PathRootAbsolute + + Log Unresolved Modulesfalse + Log Unresolved Sym Filesfalse + Debug Non-XIP Executablesfalse + + + Start Address0x00000000 + Run From Start Addressfalse + Download Imagefalse + OS Image Path + Path + PathFormatWindows + PathRootAbsolute + + Download Address0x00000000 + Ask Firstfalse + Debug Bootromfalse + Bootrom Sym File + Path + PathFormatWindows + PathRootAbsolute + + + + LinkOutputFilempxfilehandler.dll + LinkCmdLine + SymbianImportLibrarympxfilehandler.lib + canDebugfalse + canRunfalse + + + CommandLinebuildrom -D_DEBUG devkit lubbock techview -olubbock_gui.img + OutputPath + PathC:\ + PathFormatWindows + PathRootAbsolute + + DisplayMessagestrue + + + TargetArchitectureWINSCW + LogMessagesfalse + SuppressWarningsfalse + GenerateSymbolicsfalse + CompilerPrefix + CompilerCmdLine + SymbianImportLibraryPath + PathC:\ + PathFormatWindows + PathRootAbsolute + + + + Gnu Tools Path + PathC:\ + PathFormatWindows + PathRootAbsolute + + Epoc32 Tools Path + PathC:\ + PathFormatWindows + PathRootAbsolute + + + +Namempxfilehandler.mmpWindowsText +Namempxfilehandleru.defWindowsText +NameEDLL.LIBWindowsLibraryDebug +Namempxharvesterfilehandler.cppWindowsTextDebug +Namempxharvesterfilehandlerimp.cppWindowsTextDebug +Namempxharvesterdbmanager.cppWindowsTextDebug +Namempxharvesterdb.cppWindowsTextDebug +Namempxharvesterdbtable.cppWindowsTextDebug +Namempxfolderscanner.cppWindowsTextDebug +Namempxfoldermonitor.cppWindowsTextDebug +Namempxmetadatascanner.cppWindowsTextDebug +Namempxplaylistscanner.cppWindowsTextDebug +Namempxdiskspacewatcher.cppWindowsTextDebug +Namempxfilehandler_UID_.cppWindowsText +Nameeuser.libWindowsLibraryDebug +Nameefsrv.libWindowsLibraryDebug +Namebafl.libWindowsLibraryDebug +Nameedbms.libWindowsLibraryDebug +Nameestor.libWindowsLibraryDebug +Namehash.libWindowsLibraryDebug +Nameecom.libWindowsLibraryDebug +Nameapgrfx.libWindowsLibraryDebug +Nameapmime.libWindowsLibraryDebug +Namecentralrepository.libWindowsLibraryDebug +Namempxcollectionutility.libWindowsLibraryDebug +Namempxcommon.libWindowsLibraryDebug +Namempxcollectionmediator.libWindowsLibraryDebug +Namempxplaylistengine.libWindowsLibraryDebug +Namempxmetadataextractor.libWindowsLibraryDebug +NamePlatformEnv.libWindowsLibraryDebug +Namempxdbcommon.hWindowsText +Namempxdiskspacewatcher.hWindowsText +Namempxdiskspacewatcherobserver.hWindowsText +Namempxfhcommon.hWindowsText +Namempxfhcommon.inlWindowsText +Namempxfileadditionobserver.hWindowsText +Namempxfilescanstateobserver.hWindowsText +Namempxfoldermonitor.hWindowsText +Namempxfoldermonitorobserver.hWindowsText +Namempxfolderscanner.hWindowsText +Namempxharvesterdb.hWindowsText +Namempxharvesterdbitem.hWindowsText +Namempxharvesterdbmanager.hWindowsText +Namempxharvesterdbtable.hWindowsText +Namempxharvesterfilehandler.hWindowsText +Namempxharvesterfilehandlerimp.hWindowsText +Namempxmetadatascanner.hWindowsText +Namempxmetadatascanobserver.hWindowsText +Namempxplaylistscanner.hWindowsText +Namempxplaylistscanobserver.hWindowsText +NamempxfilehandlerWINSCWUDEB.cwlinkWindowsText + + +Namempxfilehandler.mmpWindows +Namempxfilehandleru.defWindows +NameEDLL.LIBWindows +Namempxharvesterfilehandler.cppWindows +Namempxharvesterfilehandlerimp.cppWindows +Namempxharvesterdbmanager.cppWindows +Namempxharvesterdb.cppWindows +Namempxharvesterdbtable.cppWindows +Namempxfolderscanner.cppWindows +Namempxfoldermonitor.cppWindows +Namempxmetadatascanner.cppWindows +Namempxplaylistscanner.cppWindows +Namempxdiskspacewatcher.cppWindows +Namempxfilehandler_UID_.cppWindows +Nameeuser.libWindows +Nameefsrv.libWindows +Namebafl.libWindows +Nameedbms.libWindows +Nameestor.libWindows +Namehash.libWindows +Nameecom.libWindows +Nameapgrfx.libWindows +Nameapmime.libWindows +Namecentralrepository.libWindows +Namempxcollectionutility.libWindows +Namempxcommon.libWindows +Namempxcollectionmediator.libWindows +Namempxplaylistengine.libWindows +Namempxmetadataextractor.libWindows +NamePlatformEnv.libWindows +Namempxdbcommon.hWindows +Namempxdiskspacewatcher.hWindows +Namempxdiskspacewatcherobserver.hWindows +Namempxfhcommon.hWindows +Namempxfhcommon.inlWindows +Namempxfileadditionobserver.hWindows +Namempxfilescanstateobserver.hWindows +Namempxfoldermonitor.hWindows +Namempxfoldermonitorobserver.hWindows +Namempxfolderscanner.hWindows +Namempxharvesterdb.hWindows +Namempxharvesterdbitem.hWindows +Namempxharvesterdbmanager.hWindows +Namempxharvesterdbtable.hWindows +Namempxharvesterfilehandler.hWindows +Namempxharvesterfilehandlerimp.hWindows +Namempxmetadatascanner.hWindows +Namempxmetadatascanobserver.hWindows +Namempxplaylistscanner.hWindows +Namempxplaylistscanobserver.hWindows +NamempxfilehandlerWINSCWUDEB.cwlinkWindows + + + WINSCW UREL + + + + UserSourceTrees + + + AlwaysSearchUserPathstrue + InterpretDOSAndUnixPathsfalse + RequireFrameworkStyleIncludesfalse + SourceRelativeIncludesfalse + UserSearchPaths + +SearchPath +Paths60\mw\mmappservices\mmappcomponents\harvester\filehandler\inc +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Paths60\mw\mmappservices\mmappcomponents\harvester\inc +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Paths60\mw\mmappservices\mmappcomponents\harvester\filehandler\bwinscw +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Paths60\mw\mmappservices\mmappcomponents\harvester\filehandler\group +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Paths60\mw\mmappservices\mmappcomponents\harvester\filehandler\src +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + + SystemSearchPaths + +SearchPath +Pathepoc32\include +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Pathepoc32\include\oem +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Pathepoc32\include\middleware +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Pathepoc32\include\domain\middleware +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Pathepoc32\include\osextensions +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Pathepoc32\include\domain\osextensions +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Pathepoc32\include\internal +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Pathepoc32\include\mmf +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Pathepoc32\include\mmf\common +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Pathepoc32\include\mmf\server +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Pathepoc32\release\WINSCW\UREL +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +Pathepoc32\release\WINSCW\UDEB +PathFormatWindows +PathRoots60 V drive +Recursivefalse +FrameworkPathfalse +HostFlagsAll + +SearchPath +PathSymbian_Support\Win32-x86 Support\Libraries\Win32 SDK +PathFormatWindows +PathRootCodeWarrior +Recursivefalse +FrameworkPathfalse +HostFlagsAll + + + + MWRuntimeSettings_WorkingDirectory + MWRuntimeSettings_CommandLine + MWRuntimeSettings_HostApplication + Pathepoc32\release\WINSCW\UREL\epoc.exe +PathFormatWindows +PathRoots60 V drive + + MWRuntimeSettings_EnvVars + + + LinkerSymbian Linker v2 + PreLinker + PostLinkerSymbian Installer v2 + TargetnameWINSCW UREL + OutputDirectory + Pathepoc32\release\WINSCW\UREL +PathFormatWindows +PathRoots60 V drive + + SaveEntriesUsingRelativePathsfalse + + + FileMappings + + FileTypeTEXT + FileExtension._i + CompilerSymbian Compiler v2 + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension._ii + CompilerSymbian Compiler v2 + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.c + CompilerSymbian Compiler v2 + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.cc + CompilerSymbian Compiler v2 + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.cfg + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.cia + CompilerSymbian Compiler v2 + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.cpp + CompilerSymbian Compiler v2 + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.cwlink + Compiler + EditLanguageXML + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.cxx + CompilerSymbian Compiler v2 + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.def + Compiler + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.h + CompilerSymbian Compiler v2 + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.hrh + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.i + CompilerSymbian Compiler v2 + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.iby + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.ii + CompilerSymbian Compiler v2 + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.inf + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.ini + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.inl + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.loc + Compiler + EditLanguageC/C++ + Precompiletrue + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.mmpi + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.pch++ + CompilerSymbian Compiler v2 + EditLanguageC/C++ + Precompiletrue + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.pkg + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.policy + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.ra + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.resources + CompilerSymbian Resource v2 + EditLanguageXML + Precompiletrue + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.rh + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.rls + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.rss + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.rsg + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.s + CompilerSymbian Compiler v2 + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.script + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.txt + Compiler + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileExtension.a + CompilerSymbian Object Importer v2 + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileExtension.lib + CompilerSymbian Object Importer v2 + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileExtension.dso + CompilerSymbian Object Importer v2 + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileExtension.o + CompilerSymbian Object Importer v2 + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + + + CacheModDatestrue + DumpBrowserInfofalse + CacheSubprojectstrue + UseThirdPartyDebuggerfalse + BrowserGenerator2 + DebuggerAppPath + Path + PathFormatGeneric + PathRootAbsolute + + DebuggerCmdLineArgs + DebuggerWorkingDir + Path + PathFormatGeneric + PathRootAbsolute + + CodeCompletionPrefixFileName + CodeCompletionMacroFileName + + + ConsoleEncoding0 + LogSystemMessagestrue + AutoTargetDLLsPopUp1 + StopAtWatchpointstrue + PauseWhileRunningfalse + PauseInterval5 + PauseUIFlags0 + AltExePath + Path + PathFormatWindows + PathRootAbsolute + + StopAtTempBPOnLaunchfalse + CacheSymbolicstrue + TempBPFunctionNameE32Main + TempBPType1 + + + Enabledfalse + ConnectionName + DownloadPath + LaunchRemoteAppfalse + RemoteAppPath + CoreID0 + JTAGClockSpeed8000 + IsMultiCorefalse + OSDownloadfalse + UseGlobalOSDownloadfalse + OSDownloadConnectionName + OSDownloadPath + AltDownloadfalse + AltDownloadConnectionName + + + MWDebugger_X86_Exceptions + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + OtherExecutables + + + AnalyzerConnectionName + + + CustomColor1 + Red0 + Green32767 + Blue0 + + CustomColor2 + Red0 + Green32767 + Blue0 + + CustomColor3 + Red0 + Green32767 + Blue0 + + CustomColor4 + Red0 + Green32767 + Blue0 + + + + ProcessorGeneric + BraekPoinType_II0 + UseInitFile0 + UseConfigFile0 + IDexecutable1 + IDinitialized1 + IDuninitialized0 + IDconstant1 + SDexecutable1 + SDinitialized1 + SDuninitialized0 + SDconstant1 + VerifyMemWrites0 + ShowMPC107regs0 + InitializationFile + ConfigurationFile + BreakpointType1 + WatchpointType1 + TargetOS1 + RTOSPluginName + ByteOrderType0 + CodeTest SYMBIAN Instrumenter + 0200020000000100000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000433A5C0000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000637466696C657300000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000636F6465746573742E6964620000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000 + + + + SymbianInstallationOutputFilenameApplication.sis + SymbianInstallationOutputLocation + Path + PathFormatWindows + PathRootProject + + SymbianInstallationContentSearchLocation + Pathepoc32\release\WINSCW\UREL +PathFormatWindows +PathRoots60 V drive + + SymbianInstallationPassword + SymbianInstallationCreateStubFilefalse + + + SymbianInstallationOutputFilenameApplication.sis + SymbianInstallationOutputLocation + Path + PathFormatWindows + PathRootProject + + SymbianInstallationContentSearchLocation + Pathepoc32\release\WINSCW\UREL +PathFormatWindows +PathRoots60 V drive + + SymbianInstallationPassword + SymbianInstallationCreateStubFilefalse + + + SymbianResourcesMMPFileLocation + Paths60\mw\mmappservices\mmappcomponents\harvester\filehandler\group +PathFormatWindows +PathRoots60 V drive + + SymbianResourcesBinaryOutputLocation + Pathepoc32\release\WINSCW\UREL +PathFormatWindows +PathRoots60 V drive + + SymbianResourcesHeaderFileOutputLocation + Pathepoc32\include +PathFormatWindows +PathRoots60 V drive + + + + SymbianResourcesMMPFileLocation + Paths60\mw\mmappservices\mmappcomponents\harvester\filehandler\group +PathFormatWindows +PathRoots60 V drive + + SymbianResourcesBinaryOutputLocation + Pathepoc32\release\WINSCW\UREL +PathFormatWindows +PathRoots60 V drive + + SymbianResourcesHeaderFileOutputLocation + Pathepoc32\include +PathFormatWindows +PathRoots60 V drive + + + + FileList + + + ProcessorGeneric + UseInitFile0 + UseConfigFile0 + ResetTarget1 + InitializationFile + Path + PathFormatGeneric + PathRootAbsolute + + ConfigurationFile + Path + PathFormatGeneric + PathRootAbsolute + + TargetOS1 + RTOSPluginName + + + ShowCommandLinefalse + SymbianEpocToolsPath + Path +PathFormatWindows +PathRoots60 V drive + + + + PrefixFilefeature_settings.hrh + CompilerXMLDescriptorMetrowerks x86 Compiler + Macros__SYMBIAN32__,__CW32__,__WINS__,__WINSCW__,__DLL__,NDEBUG,_UNICODE,__SUPPORT_CPP_EXCEPTIONS__ + CodeTESTfalse + EnableSWICfalse + Arguments-wchar_t off -align 4 -warnings on -w nohidevirtual, nounusedexpr -msgstyle gcc -enum int -str pool -exc ms -trigraphs on -O4,s -nostdinc + CIAArgs + + + Parse Log Filefalse + Log File Path + Path + PathFormatWindows + PathRootAbsolute + + Symbian SDK Folder + Path + PathFormatWindows + PathRootAbsolute + + Log Unresolved Modulesfalse + Log Unresolved Sym Filesfalse + Debug Non-XIP Executablesfalse + + + Start Address0x00000000 + Run From Start Addressfalse + Download Imagefalse + OS Image Path + Path + PathFormatWindows + PathRootAbsolute + + Download Address0x00000000 + Ask Firstfalse + Debug Bootromfalse + Bootrom Sym File + Path + PathFormatWindows + PathRootAbsolute + + + + LinkOutputFilempxfilehandler.dll + LinkCmdLine + SymbianImportLibrarympxfilehandler.lib + canDebugfalse + canRunfalse + + + CommandLinebuildrom -D_DEBUG devkit lubbock techview -olubbock_gui.img + OutputPath + PathC:\ + PathFormatWindows + PathRootAbsolute + + DisplayMessagestrue + + + TargetArchitectureWINSCW + LogMessagesfalse + SuppressWarningsfalse + GenerateSymbolicsfalse + CompilerPrefix + CompilerCmdLine + SymbianImportLibraryPath + PathC:\ + PathFormatWindows + PathRootAbsolute + + + + Gnu Tools Path + PathC:\ + PathFormatWindows + PathRootAbsolute + + Epoc32 Tools Path + PathC:\ + PathFormatWindows + PathRootAbsolute + + + +Namempxfilehandler.mmpWindowsText +Namempxfilehandleru.defWindowsText +NameEDLL.LIBWindowsLibrary +Namempxharvesterfilehandler.cppWindowsText +Namempxharvesterfilehandlerimp.cppWindowsText +Namempxharvesterdbmanager.cppWindowsText +Namempxharvesterdb.cppWindowsText +Namempxharvesterdbtable.cppWindowsText +Namempxfolderscanner.cppWindowsText +Namempxfoldermonitor.cppWindowsText +Namempxmetadatascanner.cppWindowsText +Namempxplaylistscanner.cppWindowsText +Namempxdiskspacewatcher.cppWindowsText +Namempxfilehandler_UID_.cppWindowsText +Nameeuser.libWindowsLibrary +Nameefsrv.libWindowsLibrary +Namebafl.libWindowsLibrary +Nameedbms.libWindowsLibrary +Nameestor.libWindowsLibrary +Namehash.libWindowsLibrary +Nameecom.libWindowsLibrary +Nameapgrfx.libWindowsLibrary +Nameapmime.libWindowsLibrary +Namecentralrepository.libWindowsLibrary +Namempxcollectionutility.libWindowsLibrary +Namempxcommon.libWindowsLibrary +Namempxcollectionmediator.libWindowsLibrary +Namempxplaylistengine.libWindowsLibrary +Namempxmetadataextractor.libWindowsLibrary +NamePlatformEnv.libWindowsLibrary +NamempxfilehandlerWINSCWUREL.cwlinkWindowsText + + +Namempxfilehandler.mmpWindows +Namempxfilehandleru.defWindows +NameEDLL.LIBWindows +Namempxharvesterfilehandler.cppWindows +Namempxharvesterfilehandlerimp.cppWindows +Namempxharvesterdbmanager.cppWindows +Namempxharvesterdb.cppWindows +Namempxharvesterdbtable.cppWindows +Namempxfolderscanner.cppWindows +Namempxfoldermonitor.cppWindows +Namempxmetadatascanner.cppWindows +Namempxplaylistscanner.cppWindows +Namempxdiskspacewatcher.cppWindows +Namempxfilehandler_UID_.cppWindows +Nameeuser.libWindows +Nameefsrv.libWindows +Namebafl.libWindows +Nameedbms.libWindows +Nameestor.libWindows +Namehash.libWindows +Nameecom.libWindows +Nameapgrfx.libWindows +Nameapmime.libWindows +Namecentralrepository.libWindows +Namempxcollectionutility.libWindows +Namempxcommon.libWindows +Namempxcollectionmediator.libWindows +Namempxplaylistengine.libWindows +Namempxmetadataextractor.libWindows +NamePlatformEnv.libWindows +NamempxfilehandlerWINSCWUREL.cwlinkWindows + + +Build AllLinkerNone +TargetnameBuild All + + + +WINSCW UDEB +WINSCW UREL + + + +WINSCW UDEB +WINSCW UREL +Build All + + + WINSCW UDEBNamempxfilehandler.mmpWindows +Source +WINSCW UDEBNamempxfilehandleru.defWindows +WINSCW UDEBNamempxharvesterfilehandler.cppWindows +WINSCW UDEBNamempxharvesterfilehandlerimp.cppWindows +WINSCW UDEBNamempxharvesterdbmanager.cppWindows +WINSCW UDEBNamempxharvesterdb.cppWindows +WINSCW UDEBNamempxharvesterdbtable.cppWindows +WINSCW UDEBNamempxfolderscanner.cppWindows +WINSCW UDEBNamempxfoldermonitor.cppWindows +WINSCW UDEBNamempxmetadatascanner.cppWindows +WINSCW UDEBNamempxplaylistscanner.cppWindows +WINSCW UDEBNamempxdiskspacewatcher.cppWindows +WINSCW UDEBNamempxfilehandler_UID_.cppWindows + +Headers +WINSCW UDEBNamempxdbcommon.hWindows +WINSCW UDEBNamempxdiskspacewatcher.hWindows +WINSCW UDEBNamempxdiskspacewatcherobserver.hWindows +WINSCW UDEBNamempxfhcommon.hWindows +WINSCW UDEBNamempxfhcommon.inlWindows +WINSCW UDEBNamempxfileadditionobserver.hWindows +WINSCW UDEBNamempxfilescanstateobserver.hWindows +WINSCW UDEBNamempxfoldermonitor.hWindows +WINSCW UDEBNamempxfoldermonitorobserver.hWindows +WINSCW UDEBNamempxfolderscanner.hWindows +WINSCW UDEBNamempxharvesterdb.hWindows +WINSCW UDEBNamempxharvesterdbitem.hWindows +WINSCW UDEBNamempxharvesterdbmanager.hWindows +WINSCW UDEBNamempxharvesterdbtable.hWindows +WINSCW UDEBNamempxharvesterfilehandler.hWindows +WINSCW UDEBNamempxharvesterfilehandlerimp.hWindows +WINSCW UDEBNamempxmetadatascanner.hWindows +WINSCW UDEBNamempxmetadatascanobserver.hWindows +WINSCW UDEBNamempxplaylistscanner.hWindows +WINSCW UDEBNamempxplaylistscanobserver.hWindows + +Link +WINSCW UDEBNamempxfilehandlerWINSCWUDEB.cwlinkWindows +WINSCW URELNamempxfilehandlerWINSCWUREL.cwlinkWindows + +Libraries +WINSCW +WINSCW UDEBNameEDLL.LIBWindows +WINSCW UDEBNameeuser.libWindows +WINSCW UDEBNameefsrv.libWindows +WINSCW UDEBNamebafl.libWindows +WINSCW UDEBNameedbms.libWindows +WINSCW UDEBNameestor.libWindows +WINSCW UDEBNamehash.libWindows +WINSCW UDEBNameecom.libWindows +WINSCW UDEBNameapgrfx.libWindows +WINSCW UDEBNameapmime.libWindows +WINSCW UDEBNamecentralrepository.libWindows +WINSCW UDEBNamempxcollectionutility.libWindows +WINSCW UDEBNamempxcommon.libWindows +WINSCW UDEBNamempxcollectionmediator.libWindows +WINSCW UDEBNamempxplaylistengine.libWindows +WINSCW UDEBNamempxmetadataextractor.libWindows +WINSCW UDEBNamePlatformEnv.libWindows +WINSCW URELNameEDLL.LIBWindows + + + + + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/group/mpxfilehandler_UID_.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/group/mpxfilehandler_UID_.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2008 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 File Handler UID +* +*/ + + +// Makmake-generated uid source file +#include +#pragma data_seg(".SYMBIAN") +__EMULATOR_IMAGE_HEADER2(0x10000079,0x1000006c,0x10282939,EPriorityForeground,0x000ffffeu,0x00000000u,0x10282939,0x101fb657,0x00010000,0) +#pragma data_seg() diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxbrokenlinkcleanup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxbrokenlinkcleanup.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,112 @@ +/* +* Copyright (c) 2007 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: Active object to cleanup broken links +* +*/ + + +#ifndef C_CMPXBROKENLINKCLEANUP_H +#define C_CMPXBROKENLINKCLEANUP_H + + +// FOWARD DECLARATION +class MMPXFileScanStateObserver; +class MMPXBrokenLinkObserver; + +/** + * Active Object to cleanup broken links + * + * @lib mpxfilehandler.lib + * @since S60 3.1 + */ +NONSHARABLE_CLASS( CMPXBrokenLinkCleanup ) : public CActive + { +public: + + static CMPXBrokenLinkCleanup* NewL( MMPXFileScanStateObserver& aObserver, + MMPXBrokenLinkObserver& aBrokenLinkObserver ); + + virtual ~CMPXBrokenLinkCleanup(); + +public: // New functions + + /** + * Start the cleanup operation + */ + void Start(); + + /** + * Reset the object + */ + void Reset(); + + /** + * Add a broken link for cleanup + * @param aFile file to remove + * @param aColid collection id of the file + * @param aDb database of the item, ownership not xfer + */ + void AddBrokenLinkL( const TDesC& aFile, + TInt aColId, + CMPXHarvesterDB* aDb ); + +protected: // From Base Class + + /** + * From CActive + */ + void DoCancel(); + + /** + * From CActive + */ + void RunL(); + + /** + * From CActive + */ + TInt RunError(TInt aError); + +private: // New functions + + /** + * Performs one iteration of the broken link check + * @return ETrue if all done, EFalse otherwise + */ + TBool DoBrokenLinkL(); + +private: + + /** + * Private constructor + */ + CMPXBrokenLinkCleanup( MMPXFileScanStateObserver& aObserver, + MMPXBrokenLinkObserver& aBrokenLinkObserver ); + + /** + * Two Phased Constructor + */ + void ConstructL(); + +private: // data + TBool iCleaningUp; // Currently cleaning up + + MMPXFileScanStateObserver& iStateObserver; // Observer for the state + MMPXBrokenLinkObserver& iBrokenLinkObserver; + CDesCArray* iBrokenLinks; + RArray iColIds; + RPointerArray iDBRefs; // objects not owned. + }; + +#endif // C_CMPXBROKENLINKCLEANUP_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxbrokenlinkcleanupobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxbrokenlinkcleanupobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2007 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: Broken link cleanup observer +* +*/ + + +#ifndef M_MMPXBROKENLINKOBSERVER_H +#define M_MMPXBROKENLINKOBSERVER_H + +class CMPXHarvesterDB; + +/** + * Broken link observer + * + * @lib mpxfilehandler.lib + * @since S60 v3.0 + */ +class MMPXBrokenLinkObserver + { + +public: + + /** + * Virtual function to call back and delete n elements from the aFileArray + * @param aFileArray file array to find the list of files + * @param aColdIds list of collection ids of each item + * @param aDbs list of dbs assocaited with each item + * @param aCount number of items to delete from array[0] to array[aCount-1] + */ + virtual void HandleBrokenLinkL( MDesCArray& aFileArray, + RArray& aColIds, + RPointerArray& aDbs, + TInt aCount ) = 0; + + }; + + +#endif // M_MMPXBROKENLINKOBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxdbcommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxdbcommon.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2006 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 Literals for the harvester db +* +*/ + + +#ifndef MPXDBCOMMON_H +#define MPXDBCOMMON_H + +_LIT( KHarvesterDBPath, "\\private\\101ffca9\\"); +// Harvester db increment 9 v1 +// Please update the increment number for each increment +// Please update the version number for each schema change +_LIT( KHarvesterDBName, "harvesterdbv9_5.dat" ); +_LIT( KHarvesterDBPattern, "harvesterdbv*.dat" ); + +const TInt KDbMaxTableCreationSQLLength = 1024; + +// Files table name +_LIT(KHarvesterMainTable, "Files"); + +// Column names +_LIT(KHarPathName, "FilePath" ); // Drive and Folder for an item +_LIT(KHarFileName, "FileName" ); // File name for an item +_LIT(KHarLastModTime, "ModTime" ); // Last modified time stamp +_LIT(KHarCollectionDB, "DBID" ); // Collection database ID +_LIT(KHarItemDRM, "DRM" ); // DRM file flag + +// Column numbers +const TInt KHarPathNameColumn = 1; +const TInt KHarFileNameColumn = 2; +const TInt KHarModTimeColumn = 3; +const TInt KHarColDBIDColumn = 4; +const TInt KHarDRMColumn = 5; + +// Column types +_LIT(KHarPathNameType, " LONG VARCHAR"); +_LIT(KHarFileNameType, " LONG VARCHAR"); +_LIT(KHarLastModTimeType, " TIME"); +_LIT(KHarColDBIDType, " INTEGER"); +_LIT(KHarItemDRMType, " BIT"); + +// AUX table name +_LIT(KHarvesterAuxTable, "Aux"); + +// AUX Column names +_LIT(KAuxVolumeId, "VolumeId"); +_LIT(KAuxVolumeIdType, " UNSIGNED INTEGER"); + +// AUX Column number +const TInt KHarAuxVolumeIdColumn = 1; + + +// SQL query strings +_LIT(KStartCreateTable, "CREATE TABLE "); +_LIT(KSelectAll, "SELECT * FROM "); +_LIT(KSelect, "SELECT "); +_LIT(KUpdate, "UPDATE "); +_LIT(KDelete, "DELETE "); +_LIT(KAll, "* "); +_LIT(KFrom, "FROM "); +_LIT(KWhere, " WHERE "); +_LIT(KAnd, " AND "); +_LIT(KSet, " SET "); +_LIT(KItemBracket, "'"); +_LIT(KItemHash, "#"); +_LIT(KEquals, " = "); +_LIT(KOpenBracket, "("); +_LIT(KCloseBracket, ")"); +_LIT(KCommaSign, ","); +_LIT(KAuxVolumeIdQuery, "INSERT INTO Aux(VolumeId) VALUES (%u)"); +_LIT(KLike, " LIKE "); +_LIT(KWildcard, "*"); +_LIT(KOn, "1"); +#endif // MPXDBCOMMON_H \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxdbsynchronizer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxdbsynchronizer.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,158 @@ +/* +* Copyright (c) 2006-2007 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: sync collection and harvester db contents +* +*/ + + +#ifndef CMPXDBSYNCHRONIZER_H +#define CMPXDBSYNCHRONIZER_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class RFs; +class MMPXDbSyncObserver; +class MMPXCollectionUtility; +class CMPXHarvesterDatabaseManager; +class CMPXHarvesterDatabaseTable; + +/** + * CMPXDbSynchronizer + * + * Sync collection and harvester databases + * + * @lib mpxfilehandler + * @since S60 3.0 + */ +NONSHARABLE_CLASS( CMPXDbSynchronizer ) : public CActive + { + enum ESyncState + { + ESyncStopped, + ESyncMusic, + ESyncPlaylist, + ESyncPodcast + }; + +public: + /** + * Two-phased constructor + * @param aObs synchronization observer + * @param aDbMng reference to the database manager + * @param aMusic reference to the music collection uid + * @param aPodcast reference to the podcast collection uid + * @param aFs file session + */ + static CMPXDbSynchronizer* NewL(MMPXDbSyncObserver& aStateObs, + CMPXHarvesterDatabaseManager& aDbMng, + const TUid& aMusic, + const TUid& aPodcast, + RFs& aFs, + TBool aDisablePodcast ); + + /** + * Virtual destructor + */ + virtual ~CMPXDbSynchronizer(); + + /** + * Check databases on these drives for sync issues, result within a callback to observer + * @param aDrives the drives to be used + * @param aColUtil collection utility reference + */ + void Synchronize(RArray& aDbIndexes, MMPXCollectionUtility* aColUtil); + +protected: // From Base Class + /** + * From CActive + */ + void RunL(); + + /** + * From CActive + */ + void DoCancel(); + + /** + * From CActive + */ + TInt RunError(TInt aError); + +private: // New Functions + /** + * Sync a portion of data to avoid blocking thread for long + * @return ETrue if there is more data to process + * EFalse if the sync process is complete + */ + TBool DoSynchronizeStepL(); + + /** + * Handles what to do when synchronization is done + * @param aErr error to return to the client + */ + void DoSynchronizeComplete(TInt aErr); + + //Helper functions used inside DoSynchronizeStepL + void DoMusicTableSyncL(CMPXHarvesterDatabaseTable& aTable); + void DoPlaylistTableSyncL(CMPXHarvesterDatabaseTable& aTable); + void DoPodcastTableSyncL(CMPXHarvesterDatabaseTable& aTable); + //Misc helper functions for internal use + inline void CompleteSelf(); + inline void GetTableCountL(TInt aDbId, TInt aTable); + inline TInt CopyTableRecordsL(CMPXHarvesterDatabaseTable& aTable, + TInt aColDbId, TInt aColTable); + +private: + /** + * Private constructor + * @param aObs synchronization observer + * @param aDbMng reference to the database manager + * @param aMusic reference to the music collection uid + * @param aPodcast reference to the podcast collection uid + * @param aFs file session + */ + CMPXDbSynchronizer(MMPXDbSyncObserver& aObs, + CMPXHarvesterDatabaseManager& aDbMng, + const TUid& aMusic, + const TUid& aPodcast, + RFs& aFs, + TBool aDisablePodcast ); + + /** + * 2nd Phase constructor + */ + void ConstructL(); + +private: // data + MMPXDbSyncObserver& iSyncObserver; + CMPXHarvesterDatabaseManager& iDBManager; // Not owned + MMPXCollectionUtility* iColUtil; //Not owned + const TUid& iMusicUid; + const TUid& iPodcastUid; + RFs& iFs; // Not owned + + // Databases on these drives to be synchronized + RArray iDbDrives; + + ESyncState iSyncState; + TInt iCurDrive; + TInt iDbRecTotalCount; + TInt iCurDbRecCount; + TInt iLastID; + TBool iDisablePodcasting; + }; + +#endif // CMPXDBSYNCHRONIZER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxdbsyncobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxdbsyncobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2006-2007 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: db synchronization process observer +* +*/ + + +#ifndef MPXDBSYNCOBSERVER_H +#define MPXDBSYNCOBSERVER_H + +//INCLUDES +#include + +/** + * MMPXDbSyncObserver + * + * Interface class to handle synchronization messages + * + * @lib mpxfilehandler.lib + * @since S60 3.0 + */ +class MMPXDbSyncObserver + { +public: + /** + * Handle a synchronization notification message + * + * @since S60 3.0 + * @param aErr, any error + */ + virtual void HandleSynchronizationComplete( TInt aErr ) = 0; + }; + + +#endif // MPXDBSYNCOBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxdiskspacewatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxdiskspacewatcher.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2006 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: MPX Low Disk Space Watcher class +* +*/ + + +#ifndef CMPXDISKWATCHER_H +#define CMPXDISKWATCHER_H + +#include + +class MMPXDiskSpaceObserver; + +/** + * Low disk space watcher for monitoring disk space + * + * @lib mpxfilehandler.lib + * @since S60 3.0 + */ +NONSHARABLE_CLASS( CMPXDiskSpaceWatcher ) : public CActive + { +public: + + /** + * Two-phase constructor + * @param aFs File system session + * @param aDrive aDrive to monitor + * @param aObs Observer to the monitor class + */ + static CMPXDiskSpaceWatcher* NewL( RFs& aFs, TInt aDrive, + MMPXDiskSpaceObserver& aObs ); + + /** + * destructor + */ + virtual ~CMPXDiskSpaceWatcher(); + + /** + * Start monitoring for low disk events + */ + void StartL(); + + /** + * Check if we are low on disk space + * @return ETrue if low on disk + */ + TBool IsLowOnDisk(); + + /** + * Gets the currently monitored drive number + * + * @return Currectly monitored drive number + */ + TInt CurrentDrive(); + +protected: + + /** + * Handle cancelling of active object request + */ + void DoCancel(); + + /** + * Handle a change in event + */ + void RunL(); + +private: + + /** + * Default Constructor + */ + CMPXDiskSpaceWatcher( RFs& aFs, TInt aDrive, + MMPXDiskSpaceObserver& aObs ); + + /** + * Standard two-phase constructor + */ + void ConstructL(); + +private: // data + RFs& iFs; // Not owned + TInt iDriveToMonitor; // Drive to monitor + MMPXDiskSpaceObserver& iObs; + }; + +#endif //CMPXDISKWATCHER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxdiskspacewatcherobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxdiskspacewatcherobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2007 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: Disk Space watcher observer +* +*/ + + + +#ifndef MMPXDISKSPACEOBSERVER_H +#define MMPXDISKSPACEOBSERVER_H + +/** +* Observer to the disk space watcher +* @lib mpxfilehandler.lib +*/ +NONSHARABLE_CLASS( MMPXDiskSpaceObserver ) + { +public: + /** + * Callback to the observer + * @param aDrive, drive to handle low disk space + */ + virtual void HandleLowDiskEvent( TInt aDrive ) = 0; + }; + + +#endif // MMPXDISKSPACEOBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxfhcommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxfhcommon.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2006 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 utility functions that have been factored out +* +*/ + + +#ifndef CMPXHARVESTERCOMMON_H +#define CMPXHARVESTERCOMMON_H + +#include + +/* +* Extract tokens +* @param aString to Parse +* @param aArray On return, will be filled with the tokens separated by | +*/ +inline void ExtractTokensL( const TDesC& aString, RArray& aArray ); + +/* +* Extract tokens +* @param aString to Parse +* @param aArray On return, will be filled with the tokens seperated by | +*/ +inline void ExtractTokensL( const TDesC& aString, CDesCArray& aArray ); + +/* +* Returns the drive for a file +*/ +inline TDriveNumber ExtractDrive( const TDesC& aPath ); + +#include "mpxfhcommon.inl" + +#endif // CMPXHARVESTERCOMMON_H + \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxfhcommon.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxfhcommon.inl Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2006 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: inline functions +* +*/ + + +// --------------------------------------------------------------------------- +// Parses a string for tokens separated by | +// --------------------------------------------------------------------------- +// +inline void ExtractTokensL( const TDesC& aString, RArray& aArray ) + { + // Parse the string and add it into array + // + TBool done(EFalse); + TLex lex( aString ); + lex.Mark(); + while( !done ) + { + // Found a token + if( lex.Peek() =='|' || lex.Eos() ) + { + TPtrC token = lex.MarkedToken(); + + // Ignore null length tokens + if( token.Length() ) + { + aArray.AppendL( token ); + } + + // Next token + if( lex.Eos() ) + { + done = ETrue; + } + else + { + lex.Inc(); + lex.Mark(); + } + } + else + { + // Next character + lex.Inc(); + } + } + } + +// --------------------------------------------------------------------------- +// Parses a string for tokens separated by | +// --------------------------------------------------------------------------- +// +inline void ExtractTokensL( const TDesC& aString, CDesCArray& aArray ) + { + // Parse the string and add it into array + // + TBool done(EFalse); + TLex lex( aString ); + lex.Mark(); + while( !done ) + { + // Found a token + if( lex.Peek() =='|' || lex.Eos() ) + { + TPtrC token = lex.MarkedToken(); + + // Ignore null length tokens + if( token.Length() ) + { + aArray.InsertIsqL( token ); + } + + // Next token + if( lex.Eos() ) + { + done = ETrue; + } + else + { + lex.Inc(); + lex.Mark(); + } + } + else + { + // Next character + lex.Inc(); + } + } + } + +// --------------------------------------------------------------------------- +// Finds the drive number for a path +// --------------------------------------------------------------------------- +// +inline TDriveNumber ExtractDrive( const TDesC& aPath ) + { + TParsePtrC parse( aPath ); + TDriveUnit drive( parse.Drive() ); + TInt num = drive; + return TDriveNumber(num); + } \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxfileadditionobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxfileadditionobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2006 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 addition Observer +* +*/ + + +#ifndef MMPXFILEADDITIONOBSERVER_H +#define MMPXFILEADDITIONOBSERVER_H + +/** + * Abstract interface for file addition + * + * @lib mpxfilehandler.lib + * @since S60 3.0 + */ +NONSHARABLE_CLASS( MMPXFileAdditionObserver ) + { + +public: + + /** + * Indicates that a new media file has + * been detected by the folder scanner + * + * @param aFileName file name + * @param aColIndex mime type look up index + * @param aPlaylist is this item a playlist + */ + virtual void HandleFileAdditionL( const TDesC& aFileName, + TInt aColIndex, + TBool aPlaylist = EFalse ) = 0; //lint !e1735 + /** + * Callback from scanner that it is moving onto next folder + * @param aDrive a drive to open + * @param aFolder folder that we are opening + */ + virtual void HandleOpenDriveL( TDriveNumber aDrive, const TDesC& aFolder ) = 0; + + /** + * Checks whether a file is a media file + * @param aFile file to check + * @return ETrue if it is a media file + */ + virtual TInt IsMediaFileL( const TDesC& aFile ) = 0; + + /** + * Checks whether a file is a playlist file + * @param aFile, file to check + * @return ETrue if this is a playlist file. + */ + virtual TInt IsPlaylistFileL( const TDesC& aFile ) = 0; + + /** + * Checks if a certain path is blocked + * @param aPath, path to check + * @return ETrue if the path is on the blocked list + */ + virtual TBool IsPathBlockedL( const TDesC& aPath ) = 0; + }; + + +#endif // MMPXFILEADDITIONOBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxfilescanstateobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxfilescanstateobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2006 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: Generic file scanning state change observer +* +*/ + + +#ifndef MMPXFILESCANSTATEOBSERVER_H +#define MMPXFILESCANSTATEOBSERVER_H + +/** + * MMPXFileScanStateObserver + * + * Interface class to handle changes in the scanning state + * + * @lib mpxfilehandler.lib + * @since S60 3.0 + */ +class MMPXFileScanStateObserver + { +public: + + // ENUMS + enum TScanState + { + EScanNone, + EScanFiles, + ECleanupBrokenLink, + EScanPlaylists, + EScanMetadata + }; +public: + + /** + * Handle a change in the scanning state + * + * @since S60 3.0 + * @param aState, state we are on + * @param aErr, any error + */ + virtual void HandleScanStateCompleteL( TScanState aState, TInt aErr ) = 0; + + }; + + +#endif // MMPXFILESCANSTATEOBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxfoldermonitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxfoldermonitor.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2006 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: Monitors for new or deleted files +* +*/ + + +#ifndef CMPXFOLDERMONITOR_H +#define CMPXFOLDERMONITOR_H + +#include +#include + +class MMPXFileAdditionObserver; +class MMPXFolderMonitorObserver; + +/** + * Folder monitor class + * + * @lib mpxfilehandler + * @since S60 3.0 + */ +NONSHARABLE_CLASS( CMPXFolderMonitor ) : public CActive + { + +public: + + /** + * Two-phased constructor + */ + static CMPXFolderMonitor* NewL( MMPXFolderMonitorObserver& aObserver, + RFs& aFs ); + + /** + * Virtual destructor + */ + virtual ~CMPXFolderMonitor(); + + /** + * Start monitoring a particular drive + * @param aDrive drive to monitor + */ + void StartL( TDriveNumber aDrive ); + + /** + * Start monitoring a particular folder + * @param aFolder folder to monitor + */ + void StartL( const TDesC& aFolder ); + +protected: + + /** + * From CActive + */ + void RunL(); + + /** + * From CActive + */ + void DoCancel(); + + /** + * From CActive + */ + TInt RunError(TInt aError); + +private: + + /** + * Private constructor + */ + CMPXFolderMonitor( MMPXFolderMonitorObserver& aObserver, + RFs& aFs ); + + /** + * 2nd phased constructor + */ + void ConstructL(); + +private: // data + MMPXFolderMonitorObserver& iObserver; + RFs& iFs; + HBufC* iFolderName; // drive name, always "?:\\" + }; + +#endif // CMPXFOLDERMONITOR_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxfoldermonitorobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxfoldermonitorobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2007 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: Observer class to the folder monitor +* +*/ + + +#ifndef MMPXFOLDERMONITOROBSERVER_H +#define MMPXFOLDERMONITOROBSERVER_H + + +/** +* Interface class to monitor to get callbacks to folder changes +*/ +NONSHARABLE_CLASS( MMPXFolderMonitorObserver ) + { +public: + /** + * Handle a file system change notification + * + * @param aPath path to the folder tha changed + */ + virtual void HandleDirectoryChangedL( const TDesC& aPath ) = 0; + + }; + +#endif // MMPXFOLDERMONITOROBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxfolderscanner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxfolderscanner.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,138 @@ +/* +* Copyright (c) 2006 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: Scans folders for media files +* +*/ + + +#ifndef CMPXFOLDERSCANNER_H +#define CMPXFOLDERSCANNER_H + +#include +#include +#include + +// FORWARD DECLARATIONS +class MMPXFileAdditionObserver; +class MMPXFileScanStateObserver; + +/** + * CMPXFolderScanner + * + * Scans a particular drive for files + * + * @lib mpxfilehandler + * @since S60 3.0 + */ +NONSHARABLE_CLASS( CMPXFolderScanner ) : public CActive + { + +public: + + /** + * Two-phased constructor + * @param aObserver file addition observer + * @param aStateObserver scanning state observer + * @param aFs file session + */ + static CMPXFolderScanner* NewL( MMPXFileAdditionObserver& aObserver, + MMPXFileScanStateObserver& aStateObs, + RFs& aFs ); + + /** + * Virtual destructor + */ + virtual ~CMPXFolderScanner(); + + /** + * Scan a particular drive for files + * @param aDrive the drive to scan + */ + void ScanL( RArray& aDrive ); + +protected: // From Base Class + + /** + * From CActive + */ + void RunL(); + + /** + * From CActive + */ + void DoCancel(); + + /** + * From CActive + */ + TInt RunError(TInt aError); + +private: // New Functions + + /** + * Continues the scanning procedure + * @return ETrue if it is done, EFalse if there is more work to do + */ + TBool DoScanL(); + + /** + * Setup the object to scan the next drive + * @return ETrue if there are more folders to scan + * EFalse if the scanning process is complete + */ + TBool SetupNextDriveToScanL(); + + /** + * Handles what to do when scanning is done + * @param aErr error to return to the client + */ + void DoScanCompleteL( TInt aErr ); + +private: + + /** + * Private constructor + * @param aObserver file addition observer + * @param aStateObserver scanning state observer + * @param aFs file session + */ + CMPXFolderScanner( MMPXFileAdditionObserver& aObserver, + MMPXFileScanStateObserver& aStateObs, + RFs& aFs ); + + /** + * 2nd Phase constructor + */ + void ConstructL(); + +private: // data + + MMPXFileAdditionObserver& iObserver; + MMPXFileScanStateObserver& iStateObserver; + + RFs& iFs; // Not owned + + // Droves or folders that we want to scan + RArray iDrivesToScan; + + // Flag to indicate if we are scanning or not + TBool iScanning; + + // Scanner objects + CDirScan* iDirScan; + CDir* iDir; + TInt iCount; + }; + +#endif // CMPXFOLDERSCANNER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxharvesterdb.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxharvesterdb.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,187 @@ +/* +* Copyright (c) 2006 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 internal database +* +*/ + + +#ifndef CMPXHARVESTERDB_H +#define CMPXHARVESTERDB_H + +#include +#include + +// FORWARD DECLARATIONS +class CMPXHarvesterDatabaseTable; + +/** + * Database class for the Harvester Component + * + * @lib mpxfilehandler.lib + * @since S60 3.0 + */ +NONSHARABLE_CLASS( CMPXHarvesterDB ) : public CBase + { + +public: + + /** + * Two-phased constructor + * @param aDrive drive of the database + * @param aFs file session + * @return new instance of CMPXHarvesterDB + */ + static CMPXHarvesterDB* NewL( TDriveNumber aDrive, RFs& aFs ); + + /** + * Virtual destructor + */ + virtual ~CMPXHarvesterDB(); + + /** + * Open the database + */ + TInt OpenL(); + + /** + * Close the database + */ + void Close(); + + /** + * Gets what drive this db object represents + * @return TDriveNumber + */ + TDriveNumber GetDbDrive(); + + /** + * Creates a table to open all files + * @return CMPXHarvesterDatabaseTable instance, ownership x-fer + */ + CMPXHarvesterDatabaseTable* OpenAllFilesTableL(); + + /** + * Creates a table to open to a specific directory + * @return CMPXHarvesterDatabaseTable instance, ownership x-fer + */ + CMPXHarvesterDatabaseTable* OpenDirectoryL( const TDesC& aDir ); + + /** + * Creates a table to open to a specific file + * @return CMPXHarvesterDatabaseTable instance, ownership x-fer + */ + CMPXHarvesterDatabaseTable* OpenFileL( const TDesC& aFile ); + + /** + * Creates a table to open to all files with DRM flag set + * @return CMPXHarvesterDatabaseTable instance, ownership x-fer + */ + CMPXHarvesterDatabaseTable* OpenDrmFileL(); + + /** + * Delete a file using SQL + * @param aFile file to remove + */ + void DeleteFileL( const TDesC& aFile ); + + /** + * Removes ALL files from this db + */ + void RemoveAllFilesL(); + + /** + * Deletes the physical database file + * Call Close() before calling delete! + * If Close() isn't called KErrInUse will be returned + * @return error for the operation + */ + TInt DeleteDatabase(); + + /** + * Retrieve the unique ID of this db + * The unique id is set as the volume id of the drive from + * which the database was created + */ + TUint UniqueIdL(); + + /** + * Count ALL files from this db + * @return count for the operation + */ + TInt CountAllFilesL(); + + /** + * Begin transaction on this db + */ + void BeginL(); + + /** + * Check if the db is in transaction + */ + TBool InTransaction(); + + /** + * Commit all changes in the transaction on this db + */ + void CommitL(); + + /** + * Rollbacks the current transaction + */ + void Rollback(); + + +private: // private functions + + /** + * Create a database + */ + void CreateDBL(); + + /** + * Opens a database + * @return error for the operation + */ + TInt OpenDBL(); + + /** + * Replace quotes + * @param aSrc source + * @param aTrg destination + */ + void FindAndReplaceSingleQuote(const TDesC& aSrc, + TDes& aTrg); + +private: + + /** + * Default constructor + */ + CMPXHarvesterDB( TDriveNumber aDrive, RFs& aFs ); + + /** + * 2nd phase constructor + */ + void ConstructL(); + +private: // data + TDriveNumber iDrive; + RFs& iFs; + // Internal database + CFileStore* iStore; + RDbStoreDatabase* iDatabase; // Local single client db + TBool iDBOpen; // Is the db open and ready + }; + +#endif // CMPXHARVESTERDB_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxharvesterdbitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxharvesterdbitem.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2006 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 each item in the database +* +*/ + + +#ifndef CMPXHARVESTERDBITEM_H +#define CMPXHARVESTERDBITEM_H + +/** + * Representation of each item in the db + * + * @lib mpxfilehandler + * @since S60 3.0 + */ +NONSHARABLE_CLASS( CMPXHarvesterDbItem ) : public CBase + { +public: + + virtual ~CMPXHarvesterDbItem() + { + delete iFile; + }; + + /** + * Compares two CMPXHarvesterDbItem objects. + * @param aFirst Reference to the first instance for comparison + * @param aSecond Reference to the second instance for comparison + * @return 0 if the compared instances are equal + */ + static TInt Compare(const CMPXHarvesterDbItem& aFirst, + const CMPXHarvesterDbItem& aSecond) + { + return aFirst.iFile->CompareF( *( aSecond.iFile ) ); + } + +public: // Member variables + HBufC* iFile; + TTime iLastModifiedTime; + TInt iColId; + TBool iDrm; + }; + + +#endif // CMPXHARVESTERDBITEM_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxharvesterdbmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxharvesterdbmanager.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,146 @@ +/* +* Copyright (c) 2006 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 database manager +* +*/ + + +#ifndef CMPXHARVESTERDBMANAGER_H +#define CMPXHARVESTERDBMANAGER_H + +#include +#include +#include "mpxharvesterdb.h" + +/** + * CMPXHarvesterDatabaseManager + * + * Harvester database manager + * + * @lib harvesterfilehandler.lib + * @since S60 3.0 + */ +NONSHARABLE_CLASS( CMPXHarvesterDatabaseManager ) : public CBase + { + +public: + + /** + * Two phased constructor + * @param aFs file session + * @return CMPXHarvesterDatabasemanager session + */ + static CMPXHarvesterDatabaseManager* NewL( RFs& aFs ); + + /** + * Virtual destructor + */ + virtual ~CMPXHarvesterDatabaseManager(); + + /** + * Open All databases + */ + TInt OpenAllDatabasesL(); + + /** + * Reopen a particular database + * (For MMC events) + * @param TDriveNumber aDrive + */ + void OpenDatabaseL( TDriveNumber aDrive ); + + /** + * Close all databases + */ + void CloseAllDatabase(); + + /** + * Close a particular DB + * (For MMC events) + * @param TDriveNumber the Drive + */ + void CloseDatabase( TDriveNumber aDrive ); + + /** + * Get a particular database + * @param TDriveNumber the Drive + */ + CMPXHarvesterDB& GetDatabaseL( TDriveNumber aDrive ); + + /** + * Remove a particular database from the array + * @param TDriveNumber the Drive + */ + void RemoveDatabaseL( TDriveNumber aDrive ); + + /** + * Return the number of databases + * @return number of databases + */ + TInt Count(); + + /** + * Get the n'th database + * @param aDb index to the database + * @return CMPXHarvesterDB reference + */ + CMPXHarvesterDB& GetDatabaseL( TInt aDb ); + + /** + * Recreate all databases + * Deletes old ones and re-creates + */ + void RecreateDatabases(); + + /** + * Begin transaction on all databases + */ + void BeginL(); + + /** + * Commit transaction on all databases + */ + void CommitL(); + + /** + * Rollbacks the current transaction on all databases + */ + void Rollback(); + + /** + * Checks if the spefified drive is a remove drive + */ + TBool IsRemoteDrive(TDriveNumber aDrive); + +private: + + /** + * Private constructor + */ + CMPXHarvesterDatabaseManager( RFs& aFs ); + + /** + * Second phase constructor + */ + void ConstructL(); + +private: // data + RDbs iDBSession; + RPointerArray iDatabases; + + RFs& iFs; // Not Owned + }; + + +#endif // CMPXHARVESTERDBMANAGER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxharvesterdbtable.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxharvesterdbtable.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,181 @@ +/* +* Copyright (c) 2006 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: Encapsulates db operations on a table +* +*/ + + +#ifndef CMPXHARVESTERDBTABLE_H +#define CMPXHARVESTERDBTABLE_H + +#include +#include + +//#define __PRINTDB__ + +// Forward Declarations +// +class CMPXHarvesterDbItem; + +/** + * CMPXHarvesterDatabaseTable + * Encapsulates operations on the database + * + * @lib mpxfilehandler.lib + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CMPXHarvesterDatabaseTable ): public CBase + { + +public: + + /** + * Two-Phased Constructor + * @param aDb database to create the table from + * @return CMPXHarvesterDatabaseTable instance + */ + static CMPXHarvesterDatabaseTable* NewLC( RDbStoreDatabase& aDB ); + + /** + * Virtual Destructor + */ + virtual ~CMPXHarvesterDatabaseTable(); + +public: + + /** + * Open a table to list all files + */ + void OpenAllFilesTableL(); + + /** + * Opens a table to a specific directory + * @param aDirectory directory to list the files + */ + void OpenDirectoryL( const TDesC& aDirectory ); + + /** + * Open a table to a specific song + * @param aSongName song to open + */ + void OpenItemL( const TDesC& aSongName ); + + /** + * Open a table to list of files with DRM flag set. + * @param aSongName song to open + */ + void OpenDrmL(); + + /** + * Add an item + * @param aPath path of the file + * @param aFileName file to add + * @param aLastModTime last modified time + * @param aDRM is the file a drm file + */ + void AddItemL( const TDesC& aPath, const TDesC& aFileName, + const TTime aLastModTime, const TInt aColId, + const TBool aDRM ); + + /** + * Updates an item + * @param aPath, file path + * @paran aLastModTime, last modified time + * @param aColID, collection id + * @param aDrm, is this file drm'd? + * @param aNewTransaction create new transaction for operation + */ + void UpdateItemL( const TDesC& aPath, const TTime aLastModTime, + const TInt aColID, const TBool aDRM, + TBool aNewTransaction = ETrue); + + /** + * Updates an item (don't care about drm) + * @paran aLastModTime, last modified time + * @param aColID, collection id + * @param aNewTransaction create new transaction for operation + * @param aPath, path of the item + */ + void UpdateItemL( const TTime aLastModTime, + const TInt aColID = KNullUid.iUid, + TBool aNewTransaction = ETrue, + const TDesC& aPath = KNullDesC ); + + /** + * Delete the current song + */ + void DeleteItemL(TBool aEndTransaction); + + /** + * Return the count of the current view + */ + TInt CountL(); + + /** + * Generates a RPointerArray to represent the table + * @return pointer array containing the list of items + */ + RPointerArray* CreateTableRepresentationL(); + +#ifdef __PRINTDB__ + /** + * Debug function to print out all of the elements + */ + void PrintItemsInTableL(); +#endif + +private: // New Functions + + /** + * Read a long text string from db at the specified column + * @param aColumn + * @return string left on cleanup stack + */ + HBufC* ReadLongTextLC( TInt aColumn ); + + /** + * Replaces single quotes with two single quotes + * @param aSrc source descriptor + * @param aTrg destination descriptor + */ + void FindAndReplaceSingleQuote(const TDesC& aSrc, TDes& aTrg); + +private: + + /** + * Private Constructor + * @param aDb database to create the table from + */ + CMPXHarvesterDatabaseTable( RDbStoreDatabase& aDB ); + +private: + + // Enumeration of what state this table is + // + enum TTableState + { + EInvalidState, + EAllItems, // Listing all items + EDirectory, // Listing only a directory + EFile, // Listing only a file + EDrm // Listing files with DRM flag + }; + +private: // data + RDbStoreDatabase& iDb; + RDbView iView; + TTableState iState; + }; + +#endif // CMPXHARVESTERDBTABLE_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxharvesterfilehandlerimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxharvesterfilehandlerimp.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,440 @@ +/* +* Copyright (c) 2006 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 handler class to handle all file related requests +* +*/ + + +#ifndef CMPXHARVESTERFILEHANDLERIMP_H +#define CMPXHARVESTERFILEHANDLERIMP_H + +#include +#include +#include +#include +#include + +#include "mpxfilescanstateobserver.h" +#include "mpxdbsyncobserver.h" +#include "mpxfileadditionobserver.h" +#include "mpxharvesterfilehandler.h" +#include "mpxmetadatascanobserver.h" +#include "mpxplaylistscanobserver.h" +#include "mpxmediatorobserver.h" +#include "mpxdiskspacewatcher.h" +#include "mpxdiskspacewatcherobserver.h" +#include "mpxfoldermonitor.h" +#include "mpxfoldermonitorobserver.h" +#include "mpxbrokenlinkcleanupobserver.h" + +// FORWARD DECLARATIONS +class CMPXFolderScanner; +class CMPXDbSynchronizer; +class CMPXMetadataScanner; +class CMPXPlaylistScanner; +class CMPXBrokenLinkCleanup; +class CMPXDiskSpaceWatcher; +class CMPXFolderMonitor; +class CMPXHarvesterDatabaseManager; +class CMPXHarvesterDB; +class CMPXHarvesterDatabaseTable; +class CMPXHarvesterDbItem; +class CMPXCollectionType; +class MMPXCollectionUtility; +class MMPXCollection; +class CDRMNotifier; + +/** + * File handler class to take care of all file related operations + * + * @lib mpxfilehandler + * @since S60 3.0 + */ +NONSHARABLE_CLASS( CMPXHarvesterFileHandlerImp ) : public CMPXHarvesterFileHandler, + public MMPXFileScanStateObserver, + public MMPXDbSyncObserver, + public MMPXFileAdditionObserver, + public MMPXPlaylistScanObserver, + public MMPXMetadataScanObserver, + public MMPXMediatorObserver, + public MMPXDiskSpaceObserver, + public MMPXFolderMonitorObserver, + public MMPXBrokenLinkObserver, + public MDRMEventObserver + { +public: + + /** + * Two-Phased Constructor + * @param aFs file server session + */ + static CMPXHarvesterFileHandlerImp* NewL( RFs& aFs ); + + /** + * Virtual destructor + */ + virtual ~CMPXHarvesterFileHandlerImp(); + +protected: // From Base Class + + /** + * From CMPXHarvesterFileHandler + */ + void ScanL(); + + /** + * From CMPXHarvesterFileHandler + */ + void CancelScan(); + + /** + * From CMPXHarvesterFileHandler + */ + void HandleSystemEventL( TSystemEvent aEvent, + TInt aData ); + + /** + * From CMPXHarvesterFileHandler + */ + CMPXMedia* AddFileL( const TDesC& aPath ); + + /** + * From CMPXHarvesterFileHandler + */ + TInt AddFileL( CMPXMedia& aMediaProp ); + + /** + * From CMPXHarvesterFileHandler + */ + TInt RemoveFileL( const TDesC& aPath, TBool aEndTransaction ); + + /** + * From CMPXHarvesterFileHandler + */ + void RemoveFilesL( const MDesCArray& aFilePaths ); + + /** + * From CMPXHarvesterFileHandler + */ + void RemoveAllFilesL(); + + /** + * From CMPXHarvesterFileHandler + */ + void UpdateFileL( const TDesC& aFile, TInt aCollection ); + + /** + * From CMPXHarvesterFileHandler + */ + void RenameFileL( const TDesC& aOldPath, const TDesC& aNewPath, TInt aCollection ); + + /** + * From CMPXHarvesterFileHandler + */ + TInt FindCollectionIdL( const TDesC& aFile ); + + /** + * From CMPXHarvesterFileHandler + */ + void RecreateDatabases(); + + /** + * From CMPXHarvesterFileHandler + */ + void CloseTransactionL(); + + /** + * Get a media object for the file + * @param aPath File to add + * @return CMPXMedia object for the item pointed to by aPath + * ownership transferred + */ + virtual CMPXMedia* GetMediaForFileL( const TDesC& aPath ); + + /** + * Get Collection Uid for the file + * @param aMediaProp Media Property to add + * @return TInt collection ID for the item added + */ + virtual TInt GetColUidForFileL( const TDesC& aPath ); + + /** + * From MMPXFileScanStateObserver + */ + void HandleScanStateCompleteL( TScanState aState, TInt aErr ); + + /** + * From MMPXDbSyncObserver + */ + void HandleSynchronizationComplete( TInt aErr ); + + /** + * From MMPXFileAdditionObserver + */ + void HandleFileAdditionL( const TDesC& aFileName, + TInt aColIndex, + TBool aPlaylist = EFalse ); //lint !e1735 + + /** + * From MMPXFileAdditionObserver + */ + void HandleOpenDriveL( TDriveNumber aDrive, const TDesC& aFolder ); + + /** + * From MMPXFIleAdditionObserver + */ + void HandleDirectoryChangedL( const TDesC& aPath ); + + /** + * From MMPXFileAdditionObserver + */ + TInt IsMediaFileL( const TDesC& aFile ); + + /** + * From MMPXFileAdditionObserver + */ + TInt IsPlaylistFileL( const TDesC& aFile ); + + /** + * From MMPXFileAdditionObserver + */ + TBool IsPathBlockedL( const TDesC& aPath ); + + /** + * From MMPXMetadataScanObserver + */ + void AddFilesToCollectionL( CMPXMediaArray& aMediaArray ); + + /** + * From MMPXMetadataScanObserver + */ + void UpdatesFilesInCollectionL( CMPXMediaArray& aMediaArray ); + + /** + * From MMPXMediatorObserver + */ + void HandleMediatorPathUpdatedL( CMPXMedia*& aProperty, + TUid aOldPath ); + + /** + * From MMPXPlaylistScanObserver + */ + void AddPlaylistToCollectionL( CMPXMediaArray& aMediaArray ); + + /** + * From MMPXPlaylistScanObserver + */ + void UpdatePlaylistToCollectionL( CMPXMediaArray& aMediaArray ); + + /** + * From MMPXDiskSpaceObserver + */ + void HandleLowDiskEvent( TInt aDrive ); + + /** + * From MMPXBrokenLinkObserver + */ + void HandleBrokenLinkL( MDesCArray& aFileArray, + RArray& aColId , + RPointerArray& aDb, + TInt aCount ); + + /** + * From MDRMEventObserver + */ + void HandleEventL( MDRMEvent* aEvent ); + +private: // New Functions + + /** + * Parses cenrep string (KHarvesterScanPathKey) + * to get a list of scan paths + */ + void ParseScanPathL(); + + /** + * Parse cenrep string (KHarvesterContainerKey) + * for a list of containers + */ + void ParseContainersL(); + + /** + * Parses the auto scan cenrep key + * for a list of folders to automatically scan + */ + void ParseAutoScanL(); + + /*** + * Resets the current scan directory and frees memory + */ + void Reset(); + + /** + * Handles a new item + * @param aFileName new file to add + */ + void HandleNewItemL( const TDesC& aFileName ); + + /** + * Handles broken items + */ + void HandleBrokenItemsL(); + + /** + * Handles updated items + * @param aFile file to update + */ + void HandleUpdatedItemL( const TDesC& aFile ); + + /** + * Resolves the collection UID for a file + * @param aFile file and path to a file for resolution + * @return TInt collection ID on return + */ + TInt CollectionForExtensionL( const TDesC& aFile ); + + /** + * Sets up the internal DB variables for a path + * @param aPath path to open a view to the database + */ + void OpenDBForPathL( const TDesC& aPath ); + + /** + * Final step for the refresh operation + * @param aErr error code to complete with + */ + void DoCompleteRefreshL( TInt aErr ); + + /** + * Perform a command on the collection + * @param aCommandId Id of the command + * @param aMediaAttribute TMPXAttriubte for the media payload + * @param aCollectionId collection to perform the command on + * @param aMedia the Media for the command + * @param aSync Sync operation or not. (Default ETrue) + */ + void DoCommandL( TInt aCommandId, + TUid aCollectionId, + const TMPXAttribute& aMediaAttribute, + CMPXMedia* aMedia = NULL, + TBool aSync = ETrue ); + + /** + * Remove an item to a collection + * @param aMedia, media to add + * @param aCollectionId, collection UID + */ + void DoRemoveL( CMPXMedia* aMedia, TUid aCollectionId ); + + /** + * Verifies if harvester and collection databases are in sync by comparing the number of records + * if records counts are different delete harvester db and repopulate it from collection + * @return TBool ETrue if synchronization is started, EFalse otherwise + */ + TBool CheckDbInSyncL(); + + /** + * Get a list of files with DRM flag set from the Harvester DB. + * @return list of files + */ + RPointerArray* GetDrmFilesL(); + + /** + * Verifies if aDrive is ready. + * @param aDrive, certain drive name, such as EDRIVEE + * @return TBool ETrue if aDrive is ready,otherwise EFalse + */ + TBool IsDriveReady( TDriveNumber aDrive ); + +public: + + /** + * Delayed callback function + */ + static TInt Callback( TAny* aPtr ); + + /** + * Perform the auto scan + */ + TBool DoAutoScanL(); + +private: + + /** + * Private Constructor + */ + CMPXHarvesterFileHandlerImp( RFs& aFs ); + + /** + * 2nd Phased Constructor + */ + void ConstructL(); + + //helper function used inside CheckDbInSyncL + inline TInt GetTrackCountL(TDriveNumber aDrive,TInt aColDbId, TInt aColTable); + +private: // data + // File scanning related + CMPXFolderScanner* iFolderScanner; + CMPXDbSynchronizer* iDbSynchronizer; + RPointerArray iDiskMonitors; + RPointerArray iFolderMonitors; // Multiple drives + RPointerArray iSupportedTypes; + CDesCArray* iContainerTypes; + RArray iDrivesToScan; + RArray iFilteredDrivesToScan; + RArray iPathsToBlock; + TBool iOutOfDisk; +#ifdef RD_MULTIPLE_DRIVE + TInt iRemovedDrive; +#endif // RD_MULTIPLE_DRIVE + + // Metadata related + CMPXMetadataScanner* iMetadataScanner; + CMPXPlaylistScanner* iPlaylistScanner; + CMPXBrokenLinkCleanup* iBrokenLink; + + // Session to the collection + // Only valid during a scan + // + MMPXCollectionUtility* iCollectionUtil; + + // Database related + CMPXHarvesterDatabaseManager* iDBManager; // DB manager + + CMPXHarvesterDB* iCurDB; // Current db reference + CMPXHarvesterDatabaseTable* iCurTable; // owned, must delete + RPointerArray* iCurList; // owned, must delete + + // Misc + RFs& iFs; + RApaLsSession iAppArc; + TInt iAddedCount; + + TBool iRefreshing; // Are we currently refreshing + TBool iSynchronizing; // Are we currently synchronizing + TInt iRefreshCount; // refresh reference count + CPeriodic* iIdle; // Delayed callback + RArray iAutoScanPaths; // list of auto scanning paths + + TUid iMusicCollectionId; + TUid iPodcastCollectionId; + + TBool iDisablePodcasting; + + // DRM + CDRMNotifier* iDrmNotifier; + }; + +#endif // CMPXHARVESTERFILEHANDLERIMP_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxmetadatascanner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxmetadatascanner.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,176 @@ +/* +* Copyright (c) 2006 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: Scans metadata for new files, updated files +* +*/ + + +#ifndef CMPXMETADATASCANNER_H +#define CMPXMETADATASCANNER_H + +#include + +class CMPXMedia; +class CMPXMediaArray; +class CMPXCollectionType; +class CMPXMetadataExtractor; +class MMPXMetadataScanObserver; +class MMPXFileScanStateObserver; + +enum TExtractType + { + ENewFiles = 0, + EModFiles = 1, + EMaxFile = 2 + }; +/** + * CMPXMetadataScanner + * + * Extracts metadata from a list of files + * + * @lib mpxfilehandler.lib + * @since S60 3.0 + */ +NONSHARABLE_CLASS( CMPXMetadataScanner ): public CActive + { +public: + + /** + * Two phased constructor + * @param aFs file server session + * @param aAppArc apparc session + * @param aTypesAry supported file types array + * @param aObs metadata scanning observer + * @param aStateObs scanning state observer + * @return new instance of CMPXMetadataScanner + */ + static CMPXMetadataScanner* NewL( RFs& aFs, + RApaLsSession& aAppArc, + RPointerArray& aTypesAry, + MMPXMetadataScanObserver& aObs, + MMPXFileScanStateObserver& aStateObs ); + + /** + * Two phased constructor + * @param aFs file server session + * @param aAppArc apparc session + * @param aTypesAry supported file types array + * @param aObs metadata scanning observer + * @param aStateObs scanning state observer + * @return new instance of CMPXMetadataScanner + */ + static CMPXMetadataScanner* NewLC( RFs& aFs, + RApaLsSession& aAppArc, + RPointerArray& aTypesAry, + MMPXMetadataScanObserver& aObs, + MMPXFileScanStateObserver& aStateObs ); + + /** + * Virtual destructor + */ + virtual ~CMPXMetadataScanner(); + +public: // New Functions + + /** + * Frees all memory allocated + */ + void Reset(); + + /** + * Extracts metadata for the files in the file list + */ + void Start(); + + /** + * Stops extraction of metadata for the files in the file list + */ + void Stop(); + + /** + * Adds a new file to the scanning list + * @param aFile file path to add to scan + */ + void AddNewFileToScanL( const TDesC& aFile ); + + /** + * Adds a modified file to the scanning list + * @param aFile file path to add to scan + */ + void AddModifiedFileToScanL( const TDesC& aFile ); + + /** + * Extract the Media properties for a file + * @param aFile file path to extract metadata + * @return CMPXMedia* media for the file, ownership transferred + */ + CMPXMedia* ExtractFileL( const TDesC& aFile ); + +protected: // From base class + + /** + * From CActive + */ + void DoCancel(); + + /** + * From CActive + */ + void RunL(); + +private: // New Functions + + /** + * Extract metadata from a few files + * @return ETrue if there are no more files to extract + * EFalse otherwise + */ + TBool DoExtractL(); + +private: + + /** + * Private Constructor + * @param aObs metadata scanning observer + * @param aStateObs scanning state observer + */ + CMPXMetadataScanner( MMPXMetadataScanObserver& aObs, + MMPXFileScanStateObserver& aStateObs ); + + /** + * 2nd phase constructor + * @param aAppArc apparc session + * @param aTypesAry supported file types array + */ + void ConstructL( RFs& aFs, RApaLsSession& aAppArc, + RPointerArray& aTypesAry ); + +private: // data + RPointerArray iNewFiles; + RPointerArray iModifiedFiles; + + CMPXMediaArray* iNewFileProps; + CMPXMediaArray* iModifiedFileProps; + + TBool iExtracting; // Are we extracting + TInt iExtractType; // What are we extracting + TInt iAryPos; // Current array position + + CMPXMetadataExtractor* iExtractor; // Metadata Utilities wrapper + + MMPXMetadataScanObserver& iObserver; + MMPXFileScanStateObserver& iStateObserver; + }; + +#endif // CMPXMETADATASCANNER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxmetadatascanobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxmetadatascanobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2006 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: Observer class for extracting metadata +* +*/ + + +#ifndef MMPXMETADATASCANOBSERVER_H +#define MMPXMETADATASCANOBSERVER_H + +class CMPXMediaArray; + +/** + * Metadata Scan observer + * + * @lib mpxfilehandler.lib + * @since S60 v3.0 + */ +class MMPXMetadataScanObserver + { + +public: + + /** + * Handles a few files to be added to the collection + * @param aMediaArray list of new medias to add + */ + virtual void AddFilesToCollectionL( CMPXMediaArray& aMediaArray ) = 0; + + /** + * Handles a few files to be updated to the collection + * @param aMediaArray list of updated medias + */ + virtual void UpdatesFilesInCollectionL( CMPXMediaArray& aMediaArray ) = 0; + }; + +#endif // MMPXMETADATASCANOBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxplaylistscanner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxplaylistscanner.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,154 @@ +/* +* Copyright (c) 2006 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: Class to handle playlist parsing +* +*/ + + +#ifndef CMPXPLAYLISTSCANNER_H +#define CMPXPLAYLISTSCANNER_H + +#include +#include + +// FOWARD DECLARATIONS +class MMPXPlaylistScanObserver; +class MMPXFileScanStateObserver; +class CMPXMedia; +class CMPXMediaArray; +class CMPXPlaylistEngine; +class CMPXCollectionType; + +/** + * CMPXPlaylistScanner + * Playlist extraction class + * + * @lib mpxfilehandler.lib + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CMPXPlaylistScanner ): public CBase, + public MMPXPlaylistEngineObserver + { + +public: + + /** + * Two-phase constructor + * @param aObs observer to the playlist scan + * @param aStateObs observer to state changes in scanning + * @param aTypes supported collection files + */ + static CMPXPlaylistScanner* NewL( MMPXPlaylistScanObserver& aObs, + MMPXFileScanStateObserver& aStateObs, + RPointerArray& aTypes ); + + /** + * Destructor + */ + virtual ~CMPXPlaylistScanner(); + +public: + + /** + * Initiates the scanning of the list of playlists + */ + void ScanL(); + + /** + * Cancels scanning + */ + void Cancel(); + + /** + * Resets any internal variables + */ + void Reset(); + + /** + * Add a file to the list for scanning + * @param aFile file to add to the new scan list + */ + void AddPlaylistToScanL( const TDesC& aFile ); + + /** + * Add a file to the list for update + * @param aFile file to add to the update scan list + */ + void AddUpdatedPlaylistToScanL( const TDesC& aFile ); + + /** + * Is aFile a playlist file? + * @param aFile, file to check + * @return ETrue if the file is a playlist, EFalse otherwise + */ + TBool IsPlaylistFileL( const TDesC& aFile ); + +protected: + + /** + * From MMPXPlaylistEngineObserver + */ + void HandlePlaylistL(CMPXMedia* aPlaylist, + const TInt aError, + const TBool aCompleted ); + + /** + * From MMPXPlaylistEngineObserver + */ + void HandlePlaylistL(const TDesC& aPlaylistUri, + const TInt aError); + +private: + + /** + * Adds/Updates files to the collection + */ + void CompleteFilesL(); + +private: + + /** + * Constructor + * @param aObs observer to the playlist scan + * @param aStateObs observer to state changes in scanning + * @param aTypes supported collection files + */ + CMPXPlaylistScanner( MMPXPlaylistScanObserver& aObs, + MMPXFileScanStateObserver& aStateObs, + RPointerArray& aTypes ); + + /** + * 2nd Phase constructor + */ + void ConstructL(); + +private: // data + MMPXPlaylistScanObserver& iObserver; + MMPXFileScanStateObserver& iStateObserver; + TBool iExtracting; // is this object busy? + TInt iNewPlPending; + TInt iUpdatePlPending; + + CDesCArray* iPlList; // list of playlist files to scan + CDesCArray* iPlUpdateList; // list of updated playlists; + + CMPXMediaArray* iPropArray; + CMPXMediaArray* iUpdatePropArray; + + CMPXPlaylistEngine* iPlEngine; + RPointerArray& iSupportedTypes; // not owned + }; + + +#endif // CMPXPLAYLISTSCANNER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/inc/mpxplaylistscanobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/inc/mpxplaylistscanobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2006 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: Observer class to the playlist scanner object +* +*/ + + +#ifndef MMPXPLAYLISTSCANOBSERVER_H +#define MMPXPLAYLISTSCANOBSERVER_H + +class CMPXMediaArray; + +/** + * MMPXPlaylistScanObserver + * + * Abstract interface for handling playlist scanning + * + * @lib mpxfilehandler.lib + * @since S60 3.0 + */ +class MMPXPlaylistScanObserver + { + +public: + + /** + * Notification of a list of extracted playlist media properties + * @param aMediaArray, list of playlist objects + */ + virtual void AddPlaylistToCollectionL( CMPXMediaArray& aMediaArray ) = 0; + + /** + * Notification of a list of extracted playlist media properties + * @param aMediaArray, list of playlist objects + */ + virtual void UpdatePlaylistToCollectionL( CMPXMediaArray& aMediaArray ) = 0; + + }; + + +#endif // MMPXPLAYLISTSCANOBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/src/mpxbrokenlinkcleanup.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/src/mpxbrokenlinkcleanup.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,223 @@ +/* +* Copyright (c) 2007 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: Active object to cleanup broken links +* +*/ + + +#include +#include +#include + +#include "mpxfilescanstateobserver.h" +#include "mpxbrokenlinkcleanupobserver.h" +#include "mpxbrokenlinkcleanup.h" + +// CONSTANTS +const TInt KDeleteGranularity = 10; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CMPXBrokenLinkCleanup::CMPXBrokenLinkCleanup( MMPXFileScanStateObserver& aObserver, + MMPXBrokenLinkObserver& aBrokenLinkObserver ) + : CActive( EPriorityNull ), + iStateObserver( aObserver ), + iBrokenLinkObserver( aBrokenLinkObserver ) + { + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------------------------- +// 2nd Phase Constructor +// --------------------------------------------------------------------------- +// +void CMPXBrokenLinkCleanup::ConstructL() + { + iBrokenLinks = new(ELeave) CDesCArrayFlat(2); // magic + } + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXBrokenLinkCleanup* CMPXBrokenLinkCleanup::NewL( MMPXFileScanStateObserver& aObserver, + MMPXBrokenLinkObserver& aBrokenLinkObserver ) + { + CMPXBrokenLinkCleanup* self = new( ELeave ) CMPXBrokenLinkCleanup( aObserver, + aBrokenLinkObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// Virtual destructor +// --------------------------------------------------------------------------- +// +CMPXBrokenLinkCleanup::~CMPXBrokenLinkCleanup() + { + Cancel(); + Reset(); + delete iBrokenLinks; + iColIds.Close(); + iDBRefs.Close(); + } + +// --------------------------------------------------------------------------- +// Start the broken link cleanup +// --------------------------------------------------------------------------- +// +void CMPXBrokenLinkCleanup::Start() + { + MPX_DEBUG1("CMPXBrokenLinkCleanup::Start <---"); + + // If this isn't already running + // + if( !IsActive() ) + { + iCleaningUp = ETrue; + + // Set Active + iStatus = KRequestPending; + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + MPX_DEBUG1("CMPXBrokenLinkCleanup::Started"); + } + } + +// --------------------------------------------------------------------------- +// Reset this object's state +// --------------------------------------------------------------------------- +// +void CMPXBrokenLinkCleanup::Reset() + { + iBrokenLinks->Reset(); + iColIds.Reset(); + iDBRefs.Reset(); + } + +// --------------------------------------------------------------------------- +// Adds a broken link for cleanup +// --------------------------------------------------------------------------- +// +void CMPXBrokenLinkCleanup::AddBrokenLinkL( const TDesC& aFile, + TInt aColId, + CMPXHarvesterDB* aDb ) + { + iBrokenLinks->AppendL( aFile ); + iColIds.AppendL( aColId ); + iDBRefs.AppendL( aDb ); + } + +// --------------------------------------------------------------------------- +// From CActive +// --------------------------------------------------------------------------- +// +void CMPXBrokenLinkCleanup::DoCancel() + { + if( iCleaningUp ) + { + MPX_DEBUG1("CMPXBrokenLinkCleanup::DoCancel <---"); + // Callback to observer + Reset(); + TRAP_IGNORE( iStateObserver.HandleScanStateCompleteL( MMPXFileScanStateObserver::ECleanupBrokenLink, + KErrCancel ) ); + iCleaningUp = EFalse; + } + } + + +// --------------------------------------------------------------------------- +// From CActive +// --------------------------------------------------------------------------- +// +void CMPXBrokenLinkCleanup::RunL() + { + TBool done(EFalse); + TRAPD( err, done = DoBrokenLinkL() ); + if( KErrNone != err || done ) + { + // Callback to observer + MPX_DEBUG1("CMPXBrokenLinkCleanup::RunL -- Done"); + TRAP_IGNORE( iStateObserver.HandleScanStateCompleteL( MMPXFileScanStateObserver::ECleanupBrokenLink, + err ) ); + iCleaningUp = EFalse; + } + else + { + MPX_DEBUG1("CMPXBrokenLinkCleanup::RunL -- Run again"); + iStatus = KRequestPending; + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + } + +// --------------------------------------------------------------------------- +// From CActive +// --------------------------------------------------------------------------- +// +TInt CMPXBrokenLinkCleanup::RunError(TInt aError) + { + MPX_DEBUG1("CMPXBrokenLinkCleanup::RunError <---"); + Reset(); + TRAP_IGNORE( iStateObserver.HandleScanStateCompleteL( MMPXFileScanStateObserver::ECleanupBrokenLink, + aError ) ); + iCleaningUp = EFalse; + return KErrNone; + } + +// --------------------------------------------------------------------------- +// Perform one iteration of the broken link check +// --------------------------------------------------------------------------- +// +TBool CMPXBrokenLinkCleanup::DoBrokenLinkL() + { + MPX_DEBUG1("CMPXBrokenLinkCleanup::DoBrokenLinkL <---"); + TBool done(EFalse); + + // Call back to observer to perform the cleanup + TInt count(iBrokenLinks->Count()); + iBrokenLinkObserver.HandleBrokenLinkL( *iBrokenLinks, + iColIds, + iDBRefs, + countDelete(0); + count--; + } + MPX_DEBUG1("CMPXBrokenLinkCleanup::DoBrokenLinkL --->"); + return done; + } +// END OF FILE diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/src/mpxdbsynchronizer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/src/mpxdbsynchronizer.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,450 @@ +/* +* Copyright (c) 2006-2007 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: Class for synchronization collection and harvester databases +* +*/ + +#include +#include +#include +#include +#include + +#include "mpxcommand.h" +#include "mpxharvesterdbmanager.h" +#include "mpxharvesterdbtable.h" +#include "mpxdbsynchronizer.h" +#include "mpxdbsyncobserver.h" + +#include +#include // to get podcasting cenrep key +// CONSTANTS +const TInt KRecStepCount = 100; + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CMPXDbSynchronizer::CMPXDbSynchronizer(MMPXDbSyncObserver& aObserver, + CMPXHarvesterDatabaseManager& aDbMng, + const TUid& aMusic, + const TUid& aPodcast, + RFs& aFs, + TBool aDisablePodcast ) + : CActive(EPriorityNull), //using the same priority as folder scanner + iSyncObserver(aObserver), + iDBManager(aDbMng), + iColUtil(NULL), + iMusicUid(aMusic), + iPodcastUid(aPodcast), + iFs(aFs), + iSyncState(ESyncStopped), + iCurDrive(-1), + iDbRecTotalCount(0), + iCurDbRecCount(0), + iLastID(0), + iDisablePodcasting( aDisablePodcast ) + { + CActiveScheduler::Add(this); + } + +// --------------------------------------------------------------------------- +// 2nd Phase Constructor +// --------------------------------------------------------------------------- +// +void CMPXDbSynchronizer::ConstructL() + { + } + +// --------------------------------------------------------------------------- +// Two Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXDbSynchronizer* CMPXDbSynchronizer::NewL(MMPXDbSyncObserver& aObserver, + CMPXHarvesterDatabaseManager& aDbMng, + const TUid& aMusic, + const TUid& aPodcast, + RFs& aFs, + TBool aDisablePodcast ) + { + CMPXDbSynchronizer* self = new(ELeave) CMPXDbSynchronizer(aObserver,aDbMng,aMusic, + aPodcast,aFs,aDisablePodcast); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CMPXDbSynchronizer::~CMPXDbSynchronizer() + { + Cancel(); + iDbDrives.Close(); + } + +// --------------------------------------------------------------------------- +// Scans a list of drives for files +// --------------------------------------------------------------------------- +// +void CMPXDbSynchronizer::Synchronize(RArray& aDrives, MMPXCollectionUtility* aColUtil) + { + MPX_DEBUG1("---> CMPXDbSynchronizer::Synchronize"); + ASSERT(aColUtil != NULL); //internal call, should be always ok + + iColUtil = aColUtil; + + //check if synchronization is already active then ignore request + if(iSyncState == ESyncStopped) + { + TInt dbCount(iDBManager.Count()); + TInt count(aDrives.Count()); + + if(dbCount >= count && count != 0) + { + for(TInt i=0; i CMPXDbSynchronizer::DoSynchronizeStepL"); + + TBool ret(EFalse); + + if(iDbDrives.Count() != 0) + { + TBool clear(EFalse); + //first time for a database on this drive + if(iCurDrive == -1) + { + iCurDrive = iDbDrives[0]; + clear = ETrue; + } + + CMPXHarvesterDB& db = iDBManager.GetDatabaseL((TDriveNumber)iCurDrive); + CMPXHarvesterDatabaseTable* table = db.OpenAllFilesTableL(); + CleanupStack::PushL(table); + + if(clear) + { + db.RemoveAllFilesL(); + iDbRecTotalCount = 0; + iCurDbRecCount = 0; + iLastID = 0; + } + + switch(iSyncState) + { + case ESyncMusic: //now getting music table content from curr drive's db + { + DoMusicTableSyncL(*table); + break; + } + case ESyncPlaylist: //now getting playlist table content (music db) + { + DoPlaylistTableSyncL(*table); + break; + } + case ESyncPodcast: //now getting podcast table content (podcast db) + { + DoPodcastTableSyncL(*table); + break; + } + default: + { + User::Leave(KErrAbort); + } + } + + CleanupStack::PopAndDestroy(table); + } + else + { + ret = ETrue; //sync complete + } + + MPX_DEBUG1("<--- CMPXDbSynchronizer::SetupNextDriveToScanL return"); + return ret; + } + +// --------------------------------------------------------------------------- +// Handle when synchronization is complete +// --------------------------------------------------------------------------- +// +void CMPXDbSynchronizer::DoSynchronizeComplete(TInt aErr) + { + MPX_DEBUG1("---> CMPXDbSynchronizer::DoSynchronizeComplete"); + + iDbDrives.Reset(); // Reset drives + iSyncState = ESyncStopped; + + iCurDrive = -1; + iDbRecTotalCount = 0; + iCurDbRecCount = 0; + + // Notify observer + iSyncObserver.HandleSynchronizationComplete(aErr); + + MPX_DEBUG1("<--- CMPXDbSynchronizer::DoSynchronizeComplete"); + } + +// --------------------------------------------------------------------------- +// From CActive +// --------------------------------------------------------------------------- +// +void CMPXDbSynchronizer::RunL() + { + MPX_DEBUG1("---> CMPXDbSynchronizer::RunL"); + + TBool done(EFalse); + done = DoSynchronizeStepL(); + + if(done) + { + DoSynchronizeComplete(KErrNone); + } + else // if( !done ) + { + MPX_DEBUG1("CMPXDbSynchronizer::RunL -- Schedule next run"); + CompleteSelf(); + } + MPX_DEBUG1("<--- CMPXDbSynchronizer::RunL"); + } + +// --------------------------------------------------------------------------- +// From CActive +// --------------------------------------------------------------------------- +// +void CMPXDbSynchronizer::DoCancel() + { + ASSERT(iSyncState != ESyncStopped); + DoSynchronizeComplete(KErrCancel); + } + +// ---------------------------------------------------------------------------- +// Handles a leave occurring in the request completion event handler RunL() +// ---------------------------------------------------------------------------- +// +TInt CMPXDbSynchronizer::RunError(TInt aError) + { + MPX_DEBUG2("CMPXDbSynchronizer::RunError(%d)", aError ); + + DoSynchronizeComplete(aError); + + return KErrNone; + } + +//Helper functions implementation +void CMPXDbSynchronizer::DoMusicTableSyncL(CMPXHarvesterDatabaseTable& aTable) + { + if(iDbRecTotalCount == 0) + { + //get total number of records from music db for music table + GetTableCountL(iMusicUid.iUid,EMPXCollectionCountTrack); + if (iDbRecTotalCount == 0) + { + iSyncState = ESyncPlaylist; + } + } + else + { + //get number of records from music table + TInt count = CopyTableRecordsL(aTable,iMusicUid.iUid,EMPXCollectionURITrack); + + //continue with music or switch to playlist + if(iCurDbRecCount >= iDbRecTotalCount || count == 0) + { + iDbRecTotalCount = 0; + iCurDbRecCount = 0; + iLastID = 0; + iSyncState = ESyncPlaylist; + } + } + } + +void CMPXDbSynchronizer::DoPlaylistTableSyncL(CMPXHarvesterDatabaseTable& aTable) + { + if(iDbRecTotalCount == 0) + { + //get total number of records from music db for playlist table + GetTableCountL(iMusicUid.iUid,EMPXCollectionCountPlaylist); + if (iDbRecTotalCount == 0) + { + iSyncState = ESyncPodcast; + } + } + else + { + //get number of records from playlist table + TInt count = CopyTableRecordsL(aTable,iMusicUid.iUid,EMPXCollectionURIPlaylist); + + //continue with music or switch to playlist + if(iCurDbRecCount >= iDbRecTotalCount || count == 0) + { + iDbRecTotalCount = 0; + iCurDbRecCount = 0; + iLastID = 0; + iSyncState = ESyncPodcast; + } + } + } + +void CMPXDbSynchronizer::DoPodcastTableSyncL(CMPXHarvesterDatabaseTable& aTable) + { + if( iDisablePodcasting ) + { + iDbDrives.Remove(0); + iCurDrive = -1; + iSyncState = ESyncMusic; + } + else + { + if(iDbRecTotalCount == 0) + { + //get total number of records from podcast db for podcast table + GetTableCountL(iPodcastUid.iUid,EMPXCollectionCountTrack); + if (iDbRecTotalCount == 0) + { + iDbDrives.Remove(0); + iCurDrive = -1; + iSyncState = ESyncMusic; + } + } + else + { + //get number of records from podcast table + TInt count = CopyTableRecordsL(aTable,iPodcastUid.iUid,EMPXCollectionURITrack); + + //continue with music or switch to playlist + if(iCurDbRecCount >= iDbRecTotalCount || count == 0) + { + iDbDrives.Remove(0); + iCurDrive = -1; + iSyncState = ESyncMusic; + } + } + } + } + +void CMPXDbSynchronizer::CompleteSelf() + { + iStatus = KRequestPending; + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + +void CMPXDbSynchronizer::GetTableCountL(TInt aDbId, TInt aTable) + { + //get total number of records from given Db for a given table + CMPXCommand* cmdCount = CMPXMedia::NewL(); + CleanupStack::PushL(cmdCount); + cmdCount->SetTObjectValueL(KMPXCommandGeneralId, KMPXCommandCollectionGetCount); + cmdCount->SetTObjectValueL(KMPXCommandGeneralDoSync, ETrue); + cmdCount->SetTObjectValueL(KMPXCommandGeneralCollectionId, aDbId); + cmdCount->SetTObjectValueL(KMPXCommandCollectionCountTable, aTable); + cmdCount->SetTObjectValueL(KMPXCommandCollectionCountDrive, iCurDrive); + + iColUtil->Collection().CommandL(*cmdCount); + + // returned command should contain count + if (!cmdCount->IsSupported(KMPXCommandCollectionCountValue)) + { + User::Leave(KErrAbort); + } + + iDbRecTotalCount = cmdCount->ValueTObjectL(KMPXCommandCollectionCountValue); + + CleanupStack::PopAndDestroy(cmdCount); + } + +TInt CMPXDbSynchronizer::CopyTableRecordsL(CMPXHarvesterDatabaseTable& aTable, + TInt aColDbId, TInt aColTable) + { + //get number of records from given db and table + CMPXCommand* cmdUri = CMPXMedia::NewL(); + CleanupStack::PushL(cmdUri); + cmdUri->SetTObjectValueL(KMPXCommandGeneralId, KMPXCommandCollectionGetURIs); + cmdUri->SetTObjectValueL(KMPXCommandGeneralDoSync, ETrue); + cmdUri->SetTObjectValueL(KMPXCommandGeneralCollectionId, aColDbId); + cmdUri->SetTObjectValueL(KMPXCommandCollectionURIDrive, iCurDrive); + cmdUri->SetTObjectValueL(KMPXCommandCollectionURITable, aColTable); + cmdUri->SetTObjectValueL(KMPXCommandCollectionURIRecords, KRecStepCount); //number of records + cmdUri->SetTObjectValueL(KMPXCommandCollectionURIFromID, iLastID); //from last record + + // send sync retrieve count command + iColUtil->Collection().CommandL(*cmdUri); + + // return command should contain Uri list and last item ID + if (!cmdUri->IsSupported(KMPXCommandCollectionURIList) && + !cmdUri->IsSupported(KMPXCommandCollectionURILastID) ) + { + User::Leave(KErrAbort); + } + + //populate harvester db using received values; + // retrieve the list of URIs + CDesCArray* files = cmdUri->ValueNoNewLCObjectL(KMPXCommandCollectionURIList); + CleanupStack::PushL(files); + + TInt uriCount = files->Count(); + for(TInt j=0; jValueTObjectL(KMPXCommandCollectionURILastID); + CleanupStack::PopAndDestroy(cmdUri); + + return uriCount; + } diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/src/mpxdiskspacewatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/src/mpxdiskspacewatcher.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,154 @@ +/* +* Copyright (c) 2006 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: Low disk space watcher +* +*/ + + +#include +#include +#include "mpxdiskspacewatcher.h" +#include "mpxdiskspacewatcherobserver.h" + +// CONSTANTS +const TInt KLowDiskThreshold = 131072 * 4; // 128k *4 + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CMPXDiskSpaceWatcher::CMPXDiskSpaceWatcher( RFs& aFs, TInt aDrive, + MMPXDiskSpaceObserver& aObs ) + : CActive( CActive::EPriorityHigh ), + iFs( aFs ), + iDriveToMonitor( aDrive ), + iObs( aObs ) + + { + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------------------------- +// ConstructL +// --------------------------------------------------------------------------- +// +void CMPXDiskSpaceWatcher::ConstructL() + { + } + + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXDiskSpaceWatcher* CMPXDiskSpaceWatcher::NewL( RFs& aFs, TInt aDrive, + MMPXDiskSpaceObserver& aObs ) + { + CMPXDiskSpaceWatcher* self = new( ELeave ) CMPXDiskSpaceWatcher( aFs, + aDrive, + aObs ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// destructor +// --------------------------------------------------------------------------- +// +CMPXDiskSpaceWatcher::~CMPXDiskSpaceWatcher() + { + Cancel(); + } + +// --------------------------------------------------------------------------- +// Start the watcher +// --------------------------------------------------------------------------- +// +void CMPXDiskSpaceWatcher::StartL() + { + TVolumeInfo volInfo; + TInt err = iFs.Volume( volInfo, iDriveToMonitor ); + + // Only start if the disk is actually working + // + if (!IsActive() && err == KErrNone ) + { + MPX_DEBUG2("CMPXDiskSpaceWatcher::Start monitor drive %d", + iDriveToMonitor); + iFs.NotifyDiskSpace( KLowDiskThreshold, iDriveToMonitor, iStatus ); //lint !e747 + SetActive(); + } + } + +// --------------------------------------------------------------------------- +// Check if the disk is low on memory +// --------------------------------------------------------------------------- +// +TBool CMPXDiskSpaceWatcher::IsLowOnDisk() + { + TVolumeInfo volInfo; + TInt err = iFs.Volume( volInfo, iDriveToMonitor ); + + MPX_DEBUG3("CMPXDiskSpaceWatcher::IsLowOnDisk disk %i free %i", + iDriveToMonitor, volInfo.iFree ); + + // Can only trust disk space amount if we could get volume info + // + if( (volInfo.iFree < KLowDiskThreshold) && err == KErrNone ) + { + MPX_DEBUG1("LOW DISK SPACE"); + return ETrue; + } + else + { + MPX_DEBUG1("DISK SPACE OK"); + return EFalse; + } + + } + +// --------------------------------------------------------------------------- +// Gets the currently monitored drive number +// --------------------------------------------------------------------------- +// +TInt CMPXDiskSpaceWatcher::CurrentDrive() + { + return iDriveToMonitor; + } + +// --------------------------------------------------------------------------- +// Cancel the disk notification +// --------------------------------------------------------------------------- +// +void CMPXDiskSpaceWatcher::DoCancel() + { + // Cancel the disk space monitoring + iFs.NotifyDiskSpaceCancel(); + } + +// --------------------------------------------------------------------------- +// Active Object callback +// --------------------------------------------------------------------------- +// +void CMPXDiskSpaceWatcher::RunL() + { + // Callback to observer about which drive is low on disk space + // + iObs.HandleLowDiskEvent( iDriveToMonitor ); + } + +// END OF FILE diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/src/mpxfoldermonitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/src/mpxfoldermonitor.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,257 @@ +/* +* Copyright (c) 2007 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: Monitors a folder in the file system for file changes +* +*/ + + +#include +#ifdef RD_MULTIPLE_DRIVE +#include +#include +#endif //RD_MULTIPLE_DRIVE +#include +#include "mpxfoldermonitor.h" +#include "mpxfileadditionobserver.h" +#include "mpxfoldermonitorobserver.h" + +// CONSTANTS +#ifdef RD_MULTIPLE_DRIVE +_LIT( KMPXMusicPath, "\\Music\\"); +#else +_LIT( KMPXMusicPath, "\\Music\\"); +_LIT( KMPXDataPath, "\\Data\\"); +#endif //RD_MULTIPLE_DRIVE + + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CMPXFolderMonitor::CMPXFolderMonitor( MMPXFolderMonitorObserver& aObserver, + RFs& aFs ) : CActive( EPriorityNormal ), + iObserver( aObserver ), + iFs( aFs ) + + { + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------------------------- +// Second Phase Constructor +// --------------------------------------------------------------------------- +// +void CMPXFolderMonitor::ConstructL() + { + } + +// --------------------------------------------------------------------------- +// Two-phased constructor +// --------------------------------------------------------------------------- +// +CMPXFolderMonitor* CMPXFolderMonitor::NewL( MMPXFolderMonitorObserver& aObserver, + RFs& aFs ) + { + CMPXFolderMonitor* self = new( ELeave ) CMPXFolderMonitor( aObserver, aFs ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CMPXFolderMonitor::~CMPXFolderMonitor() + { + Cancel(); + delete iFolderName; + } + +// --------------------------------------------------------------------------- +// Starts monitoring a particular drive +// --------------------------------------------------------------------------- +// +void CMPXFolderMonitor::StartL( TDriveNumber aDrive ) + { + MPX_DEBUG1("CMPXFolderMonitor::Start <---"); + + // What is the drive name? + delete iFolderName; + iFolderName = NULL; + +#ifdef RD_MULTIPLE_DRIVE + switch( aDrive ) + { + case EDriveC: + { + // Use the default path for the phone memory + iFolderName = + PathInfo::PhoneMemoryRootPath().AllocL(); + break; + } + default: + { + // Ensure that the drive is available + // Get the drive status + TUint driveStatus(0); + const TInt err = DriveInfo::GetDriveStatus( + iFs, aDrive, driveStatus ); + + if ( ( err == KErrNone ) && + (driveStatus & DriveInfo::EDriveUserVisible ) ) + { + // Use the music path for the drive + iFolderName = HBufC::NewL(KMaxFileName); + TPtr folderPtr( iFolderName->Des() ); + User::LeaveIfError( + PathInfo::GetRootPath( folderPtr, aDrive ) ); + folderPtr.Append( KMPXMusicPath() ); + } + else + { + TChar driveChar; + User::LeaveIfError( + iFs.DriveToChar( aDrive, driveChar ) ); + MPX_DEBUG2("CMPXFolderMonitor::Start: Drive %c: not supported!", + driveChar ); + User::Leave( KErrNotSupported ); + } + break; + } + } + MPX_DEBUG2("CMPXFolderMonitor::Start: Use %S path", iFolderName); +#else + switch( aDrive ) + { + case EDriveC: + { + TDriveName driveName = TDriveUnit( aDrive ).Name(); + TInt length = KMPXDataPath().Length() + driveName.Length(); + + iFolderName = HBufC::NewL(length); + + TPtr folderPtr( iFolderName->Des() ); + folderPtr.Append( driveName ); + folderPtr.Append( KMPXDataPath ); + + break; + } + case EDriveE: + // deliberate fall through, same actions for E & F drive + + case EDriveF: + { + + TDriveName driveName = TDriveUnit( aDrive ).Name(); + TInt length = KMPXMusicPath().Length() + driveName.Length(); + + iFolderName = HBufC::NewL(length); + + TPtr folderPtr( iFolderName->Des() ); + folderPtr.Append( driveName ); + folderPtr.Append( KMPXMusicPath ); + + break; + } + + default: + { + User::Leave( KErrNotSupported ); + } + } +#endif // RD_MULTIPLE_DRIVE + + // Start listening + // + TNotifyType notType = ENotifyFile; + iFs.NotifyChange( notType, iStatus, *iFolderName ); + SetActive(); + + MPX_DEBUG1("CMPXFolderMonitor::Start --->"); + } + +// --------------------------------------------------------------------------- +// Start monitoring a particular folder +// --------------------------------------------------------------------------- +// +void CMPXFolderMonitor::StartL( const TDesC& aFolder ) + { + MPX_DEBUG1("CMPXFolderMonitor::StartL <---"); + + // Copy folder + // + delete iFolderName; + iFolderName = NULL; + iFolderName = aFolder.AllocL(); + + // Start listening + // + TNotifyType notType = ENotifyFile; + iFs.NotifyChange( notType, iStatus, *iFolderName ); + SetActive(); + + MPX_DEBUG1("CMPXFolderMonitor::StartL --->"); + } + +// --------------------------------------------------------------------------- +// RunL callback +// --------------------------------------------------------------------------- +// +void CMPXFolderMonitor::RunL() + { + MPX_DEBUG1("CMPXFolderMonitor::RunL <---"); + + // Tell the observer that this folder has changed + // It should go and scan it for files? + iObserver.HandleDirectoryChangedL( *iFolderName ); + + // Listen again + TNotifyType notType(ENotifyFile); + iFs.NotifyChange( notType, iStatus, *iFolderName ); + SetActive(); + MPX_DEBUG1("CMPXFolderMonitor::RunL --->"); + } + +// --------------------------------------------------------------------------- +// Handle Cancelling +// --------------------------------------------------------------------------- +// +void CMPXFolderMonitor::DoCancel() + { + MPX_DEBUG1("CMPXFolderMonitor::DoCancel <---"); + + // Stop monitoring + iFs.NotifyChangeCancel(); + } + +// ---------------------------------------------------------------------------- +// Handles a leave occurring in the request completion event handler RunL() +// ---------------------------------------------------------------------------- +// +TInt CMPXFolderMonitor::RunError(TInt aError) + { + MPX_DEBUG2("CMPXFolderMonitor::RunError(%d)", aError ); + (void)aError; + + // Listen again + TNotifyType notType(ENotifyFile); + iFs.NotifyChange( notType, iStatus, *iFolderName ); + SetActive(); + + return KErrNone; + } diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/src/mpxfolderscanner.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/src/mpxfolderscanner.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,356 @@ +/* +* Copyright (c) 2006 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: Folder scanning class to scan files in the file system +* +*/ + +#include +#include +#include "mpxfolderscanner.h" +#include "mpxfileadditionobserver.h" +#include "mpxfilescanstateobserver.h" +#include "mpxfhcommon.h" + +// CONSTANTS +const TInt KFileNumBreakCount = 5; + +// ======== LOCAL FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// RArray compare function to compare strings +// --------------------------------------------------------------------------- +// +static TInt CompareString(const TPath& aFirst, + const TPath& aSecond) + { + return aFirst.Compare( aSecond ); + } + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CMPXFolderScanner::CMPXFolderScanner( MMPXFileAdditionObserver& aObserver, + MMPXFileScanStateObserver& aStateObs, + RFs& aFs ) : CActive(EPriorityNull), + iObserver( aObserver ), + iStateObserver( aStateObs ), + iFs( aFs ) + + { + CActiveScheduler::Add(this); + } + +// --------------------------------------------------------------------------- +// 2nd Phase Constructor +// --------------------------------------------------------------------------- +// +void CMPXFolderScanner::ConstructL() + { + iDirScan = CDirScan::NewL(iFs); + } + +// --------------------------------------------------------------------------- +// Two Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXFolderScanner* CMPXFolderScanner::NewL( MMPXFileAdditionObserver& aObserver, + MMPXFileScanStateObserver& aStateObs, + RFs& aFs ) + { + CMPXFolderScanner* self = new( ELeave ) CMPXFolderScanner( aObserver, + aStateObs, + aFs ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CMPXFolderScanner::~CMPXFolderScanner() + { + Cancel(); + + delete iDirScan; + delete iDir; + + iDrivesToScan.Close(); + } + +// --------------------------------------------------------------------------- +// Scans a list of drives for files +// --------------------------------------------------------------------------- +// +void CMPXFolderScanner::ScanL( RArray& aDrives ) + { + MPX_DEBUG1("CMPXFolderScanner::ScanL <---"); + + // Copy all the other drives we want to scan + // + TInt count( aDrives.Count() ); + for( TInt i=0; i"); + } + +// --------------------------------------------------------------------------- +// Continue Scanning for more files +// --------------------------------------------------------------------------- +// +TBool CMPXFolderScanner::DoScanL() + { + MPX_DEBUG1("CMPXFolderScanner::DoScanL <---"); + TBool done (EFalse); + + // Check each file in each directory + TInt numFiles( iDir->Count() ); + while( iCount < numFiles ) + { + TEntry entry = (*iDir)[iCount]; + + // Construct the full path and file name + TParse fullEntry; + TPtrC dirPath(iDirScan->FullPath()); + fullEntry.Set(entry.iName, &dirPath, NULL); + + TPtrC fullname = fullEntry.FullName(); + TInt index = iObserver.IsMediaFileL( fullname ); + if( KErrNotFound != index ) + { + iObserver.HandleFileAdditionL( fullname, index ); + } + + // Break if we have scanned enough files + // + ++iCount; + if( iCount%KFileNumBreakCount == 0 ) + { + return EFalse; + } + } + + // All files from this directory scanned, so move onto next + // + TInt err( KErrNone ); + TBool blocked (EFalse); + if( iCount == numFiles ) + { + // Get next Folder + // + iCount = 0; + delete iDir; + iDir = NULL; + do + { + TRAP(err, iDirScan->NextL(iDir)); + blocked = iObserver.IsPathBlockedL( iDirScan->FullPath() ); + if( blocked ) + { + delete iDir; + iDir = NULL; + } + if( err == KErrNotReady ) + { + delete iDir; + iDir = NULL; + break; + } + } + while ( err == KErrPathNotFound || blocked ); + + // No more directories to scan on this drive + // + if( !iDir ) + { + done = SetupNextDriveToScanL(); + } + } + + MPX_DEBUG1("CMPXFolderScanner::DoScanL --->"); + return done; + } + +// --------------------------------------------------------------------------- +// Setup the object to scan the next directory +// --------------------------------------------------------------------------- +// +TBool CMPXFolderScanner::SetupNextDriveToScanL() + { + MPX_DEBUG1("CMPXFolderScanner::SetupNextDriveToScanL <---"); + + TBool done(EFalse); + TBool blocked(EFalse); + // Scan next drive + while( iDir == NULL && !done ) + { + if( !iDrivesToScan.Count() ) + { + // No more drives or folders that we are interested in + done = ETrue; + } + else + { + iDirScan->SetScanDataL(iDrivesToScan[0], KEntryAttNormal, ESortNone); + iCount = 0; + TInt err(KErrNone); + do + { + MPX_DEBUG1("CMPXFolderScanner::SetupNextDriveToScanL iDirScan->NexL()"); + TRAP(err, iDirScan->NextL(iDir)); + MPX_DEBUG1("CMPXFolderScanner::SetupNextDriveToScanL path blocked?"); + blocked = iObserver.IsPathBlockedL( iDirScan->FullPath() ); + MPX_DEBUG2("CMPXFolderScanner::SetupNextDriveToScanL path blocked %i", blocked); + if( blocked ) + { + delete iDir; + iDir = NULL; + } + } + while (err == KErrPathNotFound || blocked ); + + // If there was something to scan + // + if( iDir != NULL ) + { + // Inform Observer of the new drive that we are scanning + iObserver.HandleOpenDriveL( ::ExtractDrive(iDrivesToScan[0]), + iDrivesToScan[0] ); + } + + // Remove the 0th element + iDrivesToScan.Remove(0); + iDrivesToScan.Compress(); + } + } + + + MPX_DEBUG1("CMPXFolderScanner::SetupNextDriveToScanL --->"); + return done; + } + +// --------------------------------------------------------------------------- +// Handle when scanning is complete +// --------------------------------------------------------------------------- +// +void CMPXFolderScanner::DoScanCompleteL( TInt aErr ) + { + MPX_DEBUG1("CMPXFolderScanner::DoScanCompleteL <---"); + + // Reset all arrays and data + iDrivesToScan.Reset(); + + // All done! + iScanning = EFalse; + + delete iDir; + iDir = NULL; + + // Callback to observer + iStateObserver.HandleScanStateCompleteL( MMPXFileScanStateObserver::EScanFiles, + aErr ); + + MPX_DEBUG1("CMPXFolderScanner::DoScanCompleteL --->"); + } + +// --------------------------------------------------------------------------- +// From CActive +// --------------------------------------------------------------------------- +// +void CMPXFolderScanner::RunL() + { + MPX_DEBUG1("CMPXFolderScanner::RunL <---"); + + // Do more scanning + TBool done(EFalse); + TRAPD( err, done = DoScanL() ); + + // We are all done + // + if( KErrNone != err || done ) + { + DoScanCompleteL( err ); + } + else // if( !done ) + { + MPX_DEBUG1("CMPXFolderScanner::RunL -- Run again"); + iStatus = KRequestPending; + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + } + +// --------------------------------------------------------------------------- +// From CActive +// --------------------------------------------------------------------------- +// +void CMPXFolderScanner::DoCancel() + { + if( iScanning ) + { + // Callback to observer with the partial list? + TRAP_IGNORE( DoScanCompleteL( KErrCancel ) ); + } + } + +// ---------------------------------------------------------------------------- +// Handles a leave occurring in the request completion event handler RunL() +// ---------------------------------------------------------------------------- +// +TInt CMPXFolderScanner::RunError(TInt aError) + { + MPX_DEBUG2("CMPXFolderScanner::RunError(%d)", aError ); + + TRAP_IGNORE( DoScanCompleteL( aError ) ); + + return KErrNone; + } diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/src/mpxharvesterdb.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/src/mpxharvesterdb.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,610 @@ +/* +* Copyright (c) 2006 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: Database Class to the harvester db +* +*/ + + +#include +#include +#include +#include "mpxharvesterdb.h" +#include "mpxdbcommon.h" +#include "mpxharvesterdbtable.h" + +// unlikely to have 50 quotes in a string +const TInt KAdditionalStringLength = 50; + +// --------------------------------------------------------------------------- +// C++ Constructor +// --------------------------------------------------------------------------- +// +CMPXHarvesterDB::CMPXHarvesterDB( TDriveNumber aDrive, RFs& aFs ) : + iDrive( aDrive), + iFs( aFs ) + { + } + + +// --------------------------------------------------------------------------- +// 2nd Phase constructor +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDB::ConstructL() + { + // Nothing, have to call "OpenL()" + } + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXHarvesterDB* CMPXHarvesterDB::NewL( TDriveNumber aDrive, RFs& aFs ) + { + CMPXHarvesterDB* self = new( ELeave ) CMPXHarvesterDB( aDrive, aFs ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CMPXHarvesterDB::~CMPXHarvesterDB() + { + Close(); + } + +// --------------------------------------------------------------------------- +// Open a database +// --------------------------------------------------------------------------- +// +TInt CMPXHarvesterDB::OpenL() + { + MPX_DEBUG1("CMPXHarvesterDB::OpenL <---"); + + // There is no need to re-open if it was already open + if( iDBOpen ) + { + return KErrNone; + } + + TInt rtn( KErrNone ); + TDriveUnit drive( iDrive ); + TFileName fileName; + fileName.Append( drive.Name() ); + fileName.Append( KHarvesterDBPath ); + + // Make sure Path exists + if (!BaflUtils::PathExists(iFs, fileName)) + { + iFs.MkDirAll(fileName); + } + + fileName.Append( KHarvesterDBName ); + + // Try to open the stream + TRAPD( err, + iStore = CPermanentFileStore::OpenL(iFs, fileName ,EFileRead|EFileWrite); + ); + + // DB doesn't exist or error, replace it and recreate DB + // + if( err ) + { + MPX_DEBUG2("CMPXHarvesterDB::OpenL -- New database %i", err); + + TRAPD( openErr, + iStore = CPermanentFileStore::ReplaceL(iFs, fileName ,EFileRead|EFileWrite); + iStore->SetTypeL(iStore->Layout()); + CreateDBL(); + iDBOpen = ETrue; + ); + + if( KErrNone != openErr ) + { + iDBOpen = EFalse; + User::Leave( openErr ); + } + + // If the open stream error was not found, that is fine + // because it is a new db, other errors means the stream + // is corrupted + // + rtn = err!=KErrNotFound ? KErrCorrupt : KErrNone; + } + else + { + MPX_DEBUG1("CMPXHarvesterDB::OpenL -- Opening database" ); + rtn = OpenDBL(); + iDBOpen = ETrue; + } + + + // Check volume Id + // + TVolumeInfo volInfo; + iFs.Volume(volInfo, iDrive); + TUint volId(volInfo.iUniqueID); + + TUint uniqueId(0); + TRAPD( idErr, uniqueId = UniqueIdL() ); + if( idErr != KErrNone ) + { + // Delete the database because this is not readable + Close(); + User::LeaveIfError(DeleteDatabase()); + rtn = KErrCorrupt; + } + else if( volId != uniqueId ) + { + // Recreate if volId doesn't match + // + MPX_DEBUG1("CMPXHarvesterDB::OpenL unmatched unique ID"); + Close(); + User::LeaveIfError(DeleteDatabase()); + rtn = OpenL(); + } + + MPX_DEBUG1("CMPXHarvesterDB::OpenL --->"); + return rtn; + } + +// --------------------------------------------------------------------------- +// Close a database +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDB::Close() + { + MPX_DEBUG1("CMPXHarvesterDB::Close <---"); + + // Close the database and close the stream + if( iDatabase ) + { + iDatabase->Close(); + delete iDatabase; + iDatabase = NULL; + } + + delete iStore; + iStore = NULL; + + iDBOpen = EFalse; + MPX_DEBUG1("CMPXHarvesterDB::Close --->"); + } + +// --------------------------------------------------------------------------- +// Create a new database +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDB::CreateDBL() + { + MPX_DEBUG1("CMPXHarvesterDB::CreateDBL <---"); + + // remove old databases before creating/replacing new database + + TFileName dbFileName; + TDriveUnit drive( iDrive ); + dbFileName.Append( drive.Name() ); + dbFileName.Append( KHarvesterDBPath ); + dbFileName.Append( KHarvesterDBPattern ); + + CFileMan* fileManager = CFileMan::NewL(iFs); + TInt ret = fileManager->Delete(dbFileName); + delete fileManager; + fileManager = NULL; + + + //Create the database + // + iDatabase = new( ELeave ) RDbStoreDatabase(); + TStreamId id(0); + id = iDatabase->CreateL( iStore ); + + iStore->SetRootL(id); + iStore->CommitL(); + + // Define the columns + // "Create table files ( PathName, FileName, LastModTime, Col ID )" + // + TBuf query; + query.Append( KStartCreateTable ); + query.Append( KHarvesterMainTable ); + + query.Append(KOpenBracket); + + query.Append(KHarPathName); + query.Append(KHarPathNameType); + query.Append(KCommaSign); + + query.Append(KHarFileName); + query.Append(KHarFileNameType); + query.Append(KCommaSign); + + query.Append(KHarLastModTime); + query.Append(KHarLastModTimeType); + query.Append(KCommaSign); + + query.Append(KHarCollectionDB); + query.Append(KHarColDBIDType); + query.Append(KCommaSign); + + query.Append(KHarItemDRM); + query.Append(KHarItemDRMType); + + query.Append(KCloseBracket); + + // Execute the query + User::LeaveIfError( iDatabase->Execute( query ) ); + + // Add an auxiliary table with the volume id + // This is to make sure the user doesn't copy a db from another phone + // "Create table aux { volumeid }" + // + query = KNullDesC; + query.Append( KStartCreateTable ); + query.Append( KHarvesterAuxTable); + + query.Append(KOpenBracket); + query.Append(KAuxVolumeId); + query.Append(KAuxVolumeIdType); + query.Append(KCloseBracket); + + User::LeaveIfError( iDatabase->Execute( query ) ); + + // Default aux volume id entry + // + TVolumeInfo volInfo; + iFs.Volume(volInfo, iDrive); + TUint volId(volInfo.iUniqueID); + + query = KNullDesC; + query.AppendFormat(KAuxVolumeIdQuery, volId); + User::LeaveIfError( iDatabase->Execute( query ) ); + MPX_DEBUG2("CMPXHarvesterDB::CreateDBL 4a %S", &query); + + MPX_DEBUG1("CMPXHarvesterDB::CreateDBL --->"); + } + +// --------------------------------------------------------------------------- +// Open an existing database +// --------------------------------------------------------------------------- +// +TInt CMPXHarvesterDB::OpenDBL() + { + MPX_DEBUG1("CMPXHarvesterDB::OpenDBL <---"); + TInt rtn( KErrNone ); + + // Open the database + if( !iDBOpen ) + { + iDatabase = new( ELeave ) RDbStoreDatabase(); //lint !e423 + + // Unable to open db, so try to re-create + // + TRAPD(err, iDatabase->OpenL( iStore, iStore->Root() ) ); + if( err != KErrNone ) + { + delete iDatabase; + iDatabase = NULL; + CreateDBL(); + rtn = KErrCorrupt; + } + } + + MPX_DEBUG1("CMPXHarvesterDB::OpenDBL --->"); + return rtn; + } + +// --------------------------------------------------------------------------- +// Get the current drive +// --------------------------------------------------------------------------- +// +TDriveNumber CMPXHarvesterDB::GetDbDrive() + { + return iDrive; + } + +// --------------------------------------------------------------------------- +// Creates a table to all items +// --------------------------------------------------------------------------- +// +CMPXHarvesterDatabaseTable* CMPXHarvesterDB::OpenAllFilesTableL() + { + // Database isn't opened, leave + if( iDBOpen == EFalse ) + { + User::Leave(KErrNotReady); + } + + // Open the table + CMPXHarvesterDatabaseTable* table = + CMPXHarvesterDatabaseTable::NewLC( *iDatabase ); + table->OpenAllFilesTableL(); + CleanupStack::Pop( table ); + return table; + } + +// --------------------------------------------------------------------------- +// Creates a table to a directory +// --------------------------------------------------------------------------- +// +CMPXHarvesterDatabaseTable* CMPXHarvesterDB::OpenDirectoryL( const TDesC& aDir ) + { + // Database isn't opened, leave + if( iDBOpen == EFalse ) + { + User::Leave(KErrNotReady); + } + + // Open the table + CMPXHarvesterDatabaseTable* table = + CMPXHarvesterDatabaseTable::NewLC( *iDatabase ); + table->OpenDirectoryL( aDir ); + CleanupStack::Pop( table ); + return table; + } + +// --------------------------------------------------------------------------- +// Creates a table to a specific song +// --------------------------------------------------------------------------- +// +CMPXHarvesterDatabaseTable* CMPXHarvesterDB::OpenFileL( const TDesC& aFile ) + { + // Database isn't opened, leave + if( iDBOpen == EFalse ) + { + User::Leave(KErrNotReady); + } + + // Open the table + CMPXHarvesterDatabaseTable* table = + CMPXHarvesterDatabaseTable::NewLC( *iDatabase ); + table->OpenItemL( aFile ); + CleanupStack::Pop( table ); + return table; + } + +// --------------------------------------------------------------------------- +// Creates a table to open to all files with DRM flag set +// --------------------------------------------------------------------------- +// +CMPXHarvesterDatabaseTable* CMPXHarvesterDB::OpenDrmFileL() + { + // Database isn't opened, leave + if( iDBOpen == EFalse ) + { + User::Leave(KErrNotReady); + } + + // Open the table + CMPXHarvesterDatabaseTable* table = + CMPXHarvesterDatabaseTable::NewLC( *iDatabase ); + table->OpenDrmL(); + CleanupStack::Pop( table ); + return table; + } + +// --------------------------------------------------------------------------- +// Delete a particular file from the database +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDB::DeleteFileL( const TDesC& aFile ) + { + HBufC* buf = HBufC::NewLC( aFile.Length() + KAdditionalStringLength ); + TPtr ptr = buf->Des(); + + TParsePtrC parse( aFile ); + TBuf query; + query += KDelete; + query += KFrom; + query += KHarvesterMainTable; + query += KWhere; + query += KHarFileName; + query += KEquals; + query += KItemBracket; + ptr.Copy( KNullDesC ); + FindAndReplaceSingleQuote( parse.NameAndExt(), ptr ); + query += ptr; + query += KItemBracket; + query += KAnd; + query += KHarPathName; + query += KEquals; + query += KItemBracket; + ptr.Copy( KNullDesC ); + FindAndReplaceSingleQuote( parse.DriveAndPath(), ptr ); + query += ptr; + query += KItemBracket; + + // Execute + User::LeaveIfError( iDatabase->Execute( query, EDbCompareFolded ) ); + + CleanupStack::PopAndDestroy( buf ); + } + +// --------------------------------------------------------------------------- +// Removes all files from this database +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDB::RemoveAllFilesL() + { + + // Only delete all if db is opened (ie media present) + // + if( iDBOpen ) + { + // SQL Statement is "DELETE FROM 'tablename'" + // + TBuf query; + query += KDelete; + query += KFrom; + query += KHarvesterMainTable; + User::LeaveIfError( iDatabase->Execute( query ) ); + + #ifdef __PRINTDB__ + CMPXHarvesterDatabaseTable* curTable = OpenAllFilesTableL(); + if( curTable ) + { + CleanupStack::PushL( curTable ); + curTable->PrintItemsInTableL(); + CleanupStack::PopAndDestroy( curTable ); + } + #endif //__PRINTDB__ + + } + } + +// --------------------------------------------------------------------------- +// Deletes the database file, the user should call Close() before hand +// --------------------------------------------------------------------------- +// +TInt CMPXHarvesterDB::DeleteDatabase() + { + TDriveUnit drive( iDrive ); + TFileName fileName; + fileName.Append( drive.Name() ); + fileName.Append( KHarvesterDBPath ); + fileName.Append( KHarvesterDBName ); + + return iFs.Delete( fileName ); + } + +// --------------------------------------------------------------------------- +// Read the unique id of the database file +// --------------------------------------------------------------------------- +// +TUint CMPXHarvesterDB::UniqueIdL() + { + TBuf query; + query.Append( KSelectAll ); + query.Append( KHarvesterAuxTable ); + + RDbView view; + User::LeaveIfError( view.Prepare( *iDatabase, query ) ); + User::LeaveIfError( view.Evaluate() ); + + TBool found = view.FirstL(); + if( !found ) + { + User::Leave( KErrCorrupt ); + } + + view.GetL(); + TUint id = view.ColUint(KHarAuxVolumeIdColumn); + view.Close(); + return id; + } + +// --------------------------------------------------------------------------- +// Counts all files from this database +// --------------------------------------------------------------------------- +// +TInt CMPXHarvesterDB::CountAllFilesL() + { + TInt count = 0; + // Only count if db is opened (ie media present) + if( iDBOpen ) + { + // Open the table + CMPXHarvesterDatabaseTable* table = CMPXHarvesterDatabaseTable::NewLC( *iDatabase ); + table->OpenAllFilesTableL(); + count = table->CountL(); + CleanupStack::PopAndDestroy(table); + } + return count; + } + +// --------------------------------------------------------------------------- +// Fixes single quote query issues +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDB::FindAndReplaceSingleQuote(const TDesC& aSrc, + TDes& aTrg) + { + TPtrC ch; + + TInt srcLen = aSrc.Length(); + + for (TInt i = 0; i < srcLen; ++i) + { + ch.Set(&aSrc[i], 1); + aTrg.Append(ch); + if ( ch.CompareF(_L("'")) == 0) + { + aTrg.Append(ch); + } + } + } + +// --------------------------------------------------------------------------- +// Begin transaction on this database +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDB::BeginL() + { + TInt err = iDatabase->Begin(); + + if(err != KErrNone) + { + User::Leave(err); + } + } + +// --------------------------------------------------------------------------- +// Check if the database is in transaction +// --------------------------------------------------------------------------- +// +TBool CMPXHarvesterDB::InTransaction() + { + MPX_DEBUG1("CMPXHarvesterDB::InTransaction <---"); + TBool inTrans = EFalse; + if ( iDatabase != NULL ) + { + inTrans = iDatabase->InTransaction(); + } + MPX_DEBUG1("CMPXHarvesterDB::InTransaction --->"); + return inTrans; + } + +// --------------------------------------------------------------------------- +// Commit all changes in the transaction on this database +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDB::CommitL() + { + MPX_DEBUG1("CMPXHarvesterDB::CommitL <---"); + if ( iDatabase != NULL ) + { + TInt err = iDatabase->Commit(); + + if(err != KErrNone) + { + User::Leave(err); + } + } + } + +// --------------------------------------------------------------------------- +// Rollbacks the current transaction +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDB::Rollback() + { + iDatabase->Rollback(); + } + +// End of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/src/mpxharvesterdbmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/src/mpxharvesterdbmanager.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,419 @@ +/* +* Copyright (c) 2006 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 database manager +* +*/ + + +#include +#ifdef RD_MULTIPLE_DRIVE +#include +#include +#endif //RD_MULTIPLE_DRIVE +#include +#include "mpxharvesterdbmanager.h" +#include "mpxharvesterdb.h" +#include "mpxharvesterdbtable.h" + +// --------------------------------------------------------------------------- +// C++ Constructor +// --------------------------------------------------------------------------- +// +CMPXHarvesterDatabaseManager::CMPXHarvesterDatabaseManager( RFs& aFs ) + : iFs( aFs ) + { + + } + + +// --------------------------------------------------------------------------- +// 2nd Phase Constructor +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDatabaseManager::ConstructL() + { + User::LeaveIfError( iDBSession.Connect() ); + } + + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXHarvesterDatabaseManager* CMPXHarvesterDatabaseManager::NewL( RFs& aFs ) + { + CMPXHarvesterDatabaseManager* self = + new( ELeave ) CMPXHarvesterDatabaseManager( aFs ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CMPXHarvesterDatabaseManager::~CMPXHarvesterDatabaseManager() + { + iDatabases.ResetAndDestroy(); + iDatabases.Close(); + iDBSession.Close(); + } + +// --------------------------------------------------------------------------- +// CMPXHarvesterDatabaseManager::OpenAllDatabasesL +// --------------------------------------------------------------------------- +// +TInt CMPXHarvesterDatabaseManager::OpenAllDatabasesL() + { + MPX_DEBUG1("CMPXHarvesterDatabaseManager::OpenAllDatabasesL <---"); + + TInt rtn (KErrNone); + + // Open drives we are interested in. + // +#ifdef RD_MULTIPLE_DRIVE + TDriveList driveList; + TInt driveCount(0); + User::LeaveIfError( DriveInfo::GetUserVisibleDrives( + iFs, driveList, driveCount ) ); + + TInt check(KErrNone); + for( TInt driveNum = EDriveA; driveNum <= EDriveZ; driveNum++ ) + { + if (driveList[driveNum] && !IsRemoteDrive(static_cast(driveNum))) + { + TFileName drivePath; + User::LeaveIfError( + PathInfo::GetRootPath( drivePath, driveNum ) ); + MPX_DEBUG2("CMPXHarvesterDatabaseManager::OpenAllDatabasesL: opening database in %S drive", + &drivePath); + TRAP( check, GetDatabaseL(static_cast(driveNum)) ); + if( check == KErrNotFound ) + { + CMPXHarvesterDB* dB = CMPXHarvesterDB::NewL( + static_cast(driveNum), iFs ); + CleanupStack::PushL( dB ); + TRAPD(openError, rtn |= dB->OpenL() ); //lint !e665 + if(openError == KErrNone) + { + iDatabases.AppendL( dB ); + CleanupStack::Pop( dB ); + } + else + { + CleanupStack::PopAndDestroy( dB ); + } + } + else if( check == KErrNone ) + { + TRAPD(openError, GetDatabaseL(static_cast(driveNum)).OpenL() ); + if(openError != KErrNone) + { + TRAP_IGNORE( RemoveDatabaseL(static_cast(driveNum))); + } + } + } + } +#else + TInt check(KErrNone); + TRAP( check, GetDatabaseL(EDriveC) ); + if( check == KErrNotFound ) + { + CMPXHarvesterDB* dB = CMPXHarvesterDB::NewL( EDriveC, iFs ); + CleanupStack::PushL( dB ); + iDatabases.AppendL( dB ); + CleanupStack::Pop( dB ); + TRAP_IGNORE( rtn = dB->OpenL() ); //lint !e665 + } + else if( check == KErrNone ) + { + TRAPD(openError, GetDatabaseL(EDriveC).OpenL() ); + if(openError != KErrNone) + { + TRAP_IGNORE( RemoveDatabaseL(EDriveC)); + } + } + TRAP( check, GetDatabaseL(EDriveE) ); //lint !e961 + if( check == KErrNotFound ) + { + CMPXHarvesterDB* dB = CMPXHarvesterDB::NewL( EDriveE, iFs ); + CleanupStack::PushL( dB ); + TRAPD(openError, rtn |= dB->OpenL() ); //lint !e665 + if(openError == KErrNone) + { + iDatabases.AppendL( dB ); + CleanupStack::Pop( dB ); + } + else + { + CleanupStack::PopAndDestroy( dB ); + } + } + else if( check == KErrNone ) + { + TRAPD(openError,GetDatabaseL(EDriveE).OpenL() ); + if(openError != KErrNone) + { + TRAP_IGNORE( RemoveDatabaseL(EDriveE)); + } + } +#endif // RD_MULTIPLE_DRIVE + + MPX_DEBUG1("CMPXHarvesterDatabaseManager::OpenAllDatabasesL --->"); //lint !e961 + return rtn; + } + +// --------------------------------------------------------------------------- +// CMPXHarvesterDatabaseManager::OpenDatabaseL +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDatabaseManager::OpenDatabaseL( TDriveNumber aDrive ) + { + MPX_DEBUG1("CMPXHarvesterDatabaseManager::OpenDatabaseL <---"); + + // Re-open a specific database + // + if (!IsRemoteDrive(aDrive)) + { + TInt count( iDatabases.Count() ); + for( TInt i=0; iGetDbDrive() == aDrive ) + { + db->OpenL(); + break; + } + } + } + MPX_DEBUG1("CMPXHarvesterDatabaseManager::OpenDatabaseL --->"); + } + +// --------------------------------------------------------------------------- +// CMPXHarvesterDatabaseManager::CloseAllDatabase +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDatabaseManager::CloseAllDatabase() + { + // Close all databases for shutdown + iDatabases.ResetAndDestroy(); + } + +// --------------------------------------------------------------------------- +// CMPXHarvesterDatabaseManager::CloseDatabase +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDatabaseManager::CloseDatabase( TDriveNumber aDrive ) + { + if (!IsRemoteDrive(aDrive)) + { + MPX_DEBUG2("CMPXHarvesterDatabaseManager::CloseDatabase drive %d <---", aDrive ); + TInt count = iDatabases.Count(); + for ( TInt i=0; iGetDbDrive() == aDrive) + { + db->Close(); + break; + } + } + } + MPX_DEBUG1("CMPXHarvesterDatabaseManager::CloseDatabase --->"); + } + +// --------------------------------------------------------------------------- +// CMPXHarvesterDatabaseManager::GetDatabase +// --------------------------------------------------------------------------- +// +CMPXHarvesterDB& CMPXHarvesterDatabaseManager::GetDatabaseL( TDriveNumber aDrive ) + { + CMPXHarvesterDB* db( NULL ); + + // Find the database + TInt count = iDatabases.Count(); + for( TInt i=0; iGetDbDrive() == aDrive ) + { + db = tmp; + break; + } + } + + // Not found, so we leave + if( db == NULL ) + { + User::Leave( KErrNotFound ); + } + return *db; + } + +// --------------------------------------------------------------------------- +// CMPXHarvesterDatabaseManager::RemoveDatabase +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDatabaseManager::RemoveDatabaseL( TDriveNumber aDrive ) + { + + TBool bFound(EFalse); + // Find the database + TInt count = iDatabases.Count(); + for(TInt index=0; indexGetDbDrive() == aDrive )) + { + bFound = ETrue; + delete iDatabases[index]; + iDatabases.Remove(index); + break; + } + } + + // Not found, so we leave + if( !bFound ) + { + User::Leave( KErrNotFound ); + } + } + +// --------------------------------------------------------------------------- +// CMPXHarvesterDatabaseManager::Count +// --------------------------------------------------------------------------- +// +TInt CMPXHarvesterDatabaseManager::Count() + { + return iDatabases.Count(); + } + +// --------------------------------------------------------------------------- +// CMPXHarvesterDatabaseManager::GetDatabaseL +// --------------------------------------------------------------------------- +// +CMPXHarvesterDB& CMPXHarvesterDatabaseManager::GetDatabaseL( TInt aDb ) + { + if( aDb > iDatabases.Count() ) + { + User::Leave(KErrNotFound/*KErrArgument*/); + } + return *iDatabases[aDb]; + } + +// --------------------------------------------------------------------------- +// CMPXHarvesterDatabaseManager::RecreateDatabase +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDatabaseManager::RecreateDatabases() + { + MPX_DEBUG1("CMPXHarvesterDatabaseManager::RecreateDatabases <--"); + TInt count( iDatabases.Count() ); + for( TInt i=0; iClose(); + cur->DeleteDatabase(); + // trap leave just in case 1 db had err + // + TRAP_IGNORE( cur->OpenL() ); + } + } + + +// --------------------------------------------------------------------------- +// CMPXHarvesterDatabaseManager::IsRemoteDrive +// --------------------------------------------------------------------------- +// +TBool CMPXHarvesterDatabaseManager::IsRemoteDrive(TDriveNumber aDrive) + { + TDriveInfo driveInfo; + TBool isRemoteDrive(EFalse); + if (iFs.Drive(driveInfo, aDrive) == KErrNone) + { + isRemoteDrive = driveInfo.iDriveAtt & KDriveAttRemote; + } + return isRemoteDrive; + } + +// --------------------------------------------------------------------------- +// CMPXHarvesterDatabaseManager::BeginL +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDatabaseManager::BeginL() + { + MPX_DEBUG1("CMPXHarvesterDatabaseManager::BeginL <--"); + TInt count( iDatabases.Count() ); + for( TInt i=0; iInTransaction()) + { + TRAPD(err, db->BeginL()); + User::LeaveIfError(err); + } + } + MPX_DEBUG1("CMPXHarvesterDatabaseManager::BeginL -->"); + } + +// --------------------------------------------------------------------------- +// CMPXHarvesterDatabaseManager::CommitL +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDatabaseManager::CommitL() + { + MPX_DEBUG1("CMPXHarvesterDatabaseManager::CommitL <--"); + TInt count( iDatabases.Count() ); + for( TInt i=0; iInTransaction()) + { + TRAPD(err, db->CommitL()); + User::LeaveIfError(err); + } + } + MPX_DEBUG1("CMPXHarvesterDatabaseManager::CommitL -->"); + } + +// --------------------------------------------------------------------------- +// CMPXHarvesterDatabaseManager::Rollback +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDatabaseManager::Rollback() + { + MPX_DEBUG1("CMPXHarvesterDatabaseManager::Rollback <--"); + TInt count( iDatabases.Count() ); + for( TInt i=0; iInTransaction()) + { + db->Rollback(); + } + } + MPX_DEBUG1("CMPXHarvesterDatabaseManager::Rollback -->"); + } + +// END OF FILE + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/src/mpxharvesterdbtable.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/src/mpxharvesterdbtable.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,554 @@ +/* +* Copyright (c) 2006 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: Encapsulates operations on a table in the db +* +*/ + + +#include +#include +#include "mpxharvesterdbtable.h" +#include "mpxdbcommon.h" +#include "mpxharvesterdbitem.h" + +const TInt KStringLength = 300; + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CMPXHarvesterDatabaseTable::CMPXHarvesterDatabaseTable( RDbStoreDatabase& aDb ) + : iDb( aDb ), + iState( EInvalidState ) + { + } + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXHarvesterDatabaseTable* CMPXHarvesterDatabaseTable::NewLC( + RDbStoreDatabase& aDb ) + { + CMPXHarvesterDatabaseTable* self = + new( ELeave ) CMPXHarvesterDatabaseTable( aDb ); + CleanupStack::PushL( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// destructor +// --------------------------------------------------------------------------- +// +CMPXHarvesterDatabaseTable::~CMPXHarvesterDatabaseTable() + { + iView.Close(); + } + +// --------------------------------------------------------------------------- +// Open the Table to list all files in the db +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDatabaseTable::OpenAllFilesTableL() + { + MPX_DEBUG1("CMPXHarvesterDatabaseTable::OpenAllFilesTableL <---"); + + // Close old view just in case + iView.Close(); + + // Open all files query + // select * from files + // + TBuf query; + query.Append( KSelectAll ); + query.Append( KHarvesterMainTable ); + + // Open the view + User::LeaveIfError( iView.Prepare( iDb, query ) ); + User::LeaveIfError( iView.Evaluate() ); + + iState = EAllItems; + + MPX_DEBUG1("CMPXHarvesterDatabaseTable::OpenAllFilesTableL --->"); + } + +// --------------------------------------------------------------------------- +// Open the Table to a specific directory ( drive:\\path ) +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDatabaseTable::OpenDirectoryL( const TDesC& aDirectory ) + { + MPX_DEBUG1("CMPXHarvesterDatabaseTable::OpenDirectoryL <---"); + + // Close old view just in case + iView.Close(); + + HBufC* buffer = HBufC::NewLC(KStringLength); // 255 file path + 45 for single quotes + // magic, this would break if we have > + // 45 single quotes in a file name. + TParsePtrC parse( aDirectory ); + TPtr ptr = buffer->Des(); + FindAndReplaceSingleQuote( parse.DriveAndPath(), ptr ); + + // Open all files query + // select * from files where filepath='aDirectory' + // + TBuf query; + query += KSelectAll; + query += KHarvesterMainTable; + query += KWhere; + query += KHarPathName; + query += KLike; + query += KItemBracket; + query += ptr; + query += KWildcard; + query += KItemBracket; + + // Open the view + TDbQuery sqlQuery( query, EDbCompareFolded ); + User::LeaveIfError( iView.Prepare( iDb, sqlQuery ) ); + User::LeaveIfError( iView.Evaluate() ); + + iState = EDirectory; + CleanupStack::PopAndDestroy(buffer); + MPX_DEBUG1("CMPXHarvesterDatabaseTable::OpenDirectoryL --->"); + } + +// --------------------------------------------------------------------------- +// Open the Table to a specific song view +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDatabaseTable::OpenItemL( const TDesC& aSongName ) + { + MPX_DEBUG1("CMPXHarvesterDatabaseTable::OpenItemL <---"); + + // Close old view just in case + iView.Close(); + + HBufC* buffer = HBufC::NewLC(KStringLength); // 255 file path + 45 for single quotes + // magic, this would break if we have > 45 single quotes in a file name. + TPtr ptr = buffer->Des(); + // Open all files query + // select * from files where path='path' AND filename='aSongName' + // + TParsePtrC parse( aSongName ); + TBuf query; + query += KSelectAll; + query += KHarvesterMainTable; + query += KWhere; + query += KHarFileName; + query += KEquals; + query += KItemBracket; + ptr.Copy( KNullDesC ); + FindAndReplaceSingleQuote( parse.NameAndExt(), ptr ); + query += ptr; + query += KItemBracket; + query += KAnd; + query += KHarPathName; + query += KEquals; + query += KItemBracket; + ptr.Copy( KNullDesC ); + FindAndReplaceSingleQuote( parse.DriveAndPath(), ptr ); + query += ptr; + query += KItemBracket; + + // Open the view + TDbQuery sqlQuery( query, EDbCompareFolded ); + User::LeaveIfError( iView.Prepare( iDb, sqlQuery ) ); + User::LeaveIfError( iView.Evaluate() ); + + iState = EFile; + CleanupStack::PopAndDestroy( buffer ); + MPX_DEBUG1("CMPXHarvesterDatabaseTable::OpenItemL --->"); + } + +// --------------------------------------------------------------------------- +// Open a table to list of files with DRM flag set. +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDatabaseTable::OpenDrmL() + { + MPX_DEBUG1("CMPXHarvesterDatabaseTable::OpenDrmL <---"); + + // Close old view just in case + iView.Close(); + + HBufC* buffer = HBufC::NewLC(KStringLength); // 255 file path + 45 for single quotes + // magic, this would break if we have > 45 single quotes in a file name. + TPtr ptr = buffer->Des(); + // Open all files query + // select * from files where path='path' AND filename='aSongName' + // + TBuf query; + query += KSelectAll; + query += KHarvesterMainTable; + query += KWhere; + query += KHarItemDRM; + query += KEquals; + query += KOn; + + // Open the view + TDbQuery sqlQuery( query, EDbCompareFolded ); + User::LeaveIfError( iView.Prepare( iDb, sqlQuery ) ); + User::LeaveIfError( iView.Evaluate() ); + + iState = EDrm; + CleanupStack::PopAndDestroy( buffer ); + MPX_DEBUG1("CMPXHarvesterDatabaseTable::OpenDrmL --->"); + } + +// --------------------------------------------------------------------------- +// Delete the item pointed to at the current row +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDatabaseTable::DeleteItemL(TBool aEndTransaction) + { + MPX_DEBUG1("CMPXHarvesterDatabaseTable::DeleteItemL <---"); + +#ifdef __PRINTDB__ + PrintItemsInTableL(); +#endif //__PRINTDB__ + + if (!iDb.InTransaction()) + { + iDb.Begin(); + } + // Safe row update + TBool found = iView.FirstL(); + if( !found ) + { + if ( aEndTransaction ) + { + iDb.Commit(); + } + User::Leave(KErrNotFound); + } + iView.GetL(); + + TRAPD( err, iView.DeleteL() ); + if( err != KErrNone ) + { + iView.Cancel(); + if ( aEndTransaction ) + { + iDb.Commit(); + } + User::Leave( err ); + } + if ( aEndTransaction ) + { + iDb.Commit(); + } + // DB Compaction + struct RDbDatabase::TSize size = iDb.Size(); + const TInt waterMark = 60; + if (size.iUsage <= waterMark) + { + MPX_DEBUG1( "Compacting DB" ); + iDb.Compact(); + } + + MPX_DEBUG1("CMPXHarvesterDatabaseTable::DeleteItemL --->"); + } + +// --------------------------------------------------------------------------- +// Return the number of rows in the current view +// --------------------------------------------------------------------------- +// +TInt CMPXHarvesterDatabaseTable::CountL() + { + return iView.CountL(); + } + +// --------------------------------------------------------------------------- +// Add an item to the table +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDatabaseTable::AddItemL( const TDesC& aPath, + const TDesC& aFileName, + const TTime aLastModTime, + const TInt aColId, + const TBool aDRM ) + { + MPX_DEBUG1("CMPXHarvesterDatabaseTable::AddItemL <---"); + + // Add the item into the db + iView.InsertL(); + iView.SetColL( KHarPathNameColumn, aPath ); + iView.SetColL( KHarFileNameColumn, aFileName ); + iView.SetColL( KHarModTimeColumn, aLastModTime ); + iView.SetColL( KHarColDBIDColumn, aColId ); + iView.SetColL( KHarDRMColumn, (TUint) aDRM ); + + // Safe update to database + TRAPD( err, iView.PutL() ); + if( KErrNone != err ) + { + iView.Cancel(); + User::Leave( err ); + } + +#ifdef __PRINTDB__ + PrintItemsInTableL(); +#endif //__PRINTDB__ + + MPX_DEBUG1("CMPXHarvesterDatabaseTable::AddItemL --->"); + } + +// --------------------------------------------------------------------------- +// Update the current row with the updated info +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDatabaseTable::UpdateItemL( const TDesC& /*aPath*/, + const TTime aLastModTime, + const TInt aColId, + const TBool aDrm, + TBool aNewTransaction ) + { + // Safe row update + // + TBool newTransaction = aNewTransaction && !iDb.InTransaction(); + if ( newTransaction ) + { + iDb.Begin(); + } + TBool valid = iView.FirstL(); + if( valid ) + { + iView.UpdateL(); + iView.SetColL( KHarModTimeColumn, aLastModTime ); + iView.SetColL( KHarColDBIDColumn, aColId ); + iView.SetColL( KHarDRMColumn, (TUint) aDrm ); + } + else + { + if( newTransaction ) + { + iDb.Commit(); + } + User::Leave( KErrNotFound ); + } + + TRAPD( err, iView.PutL() ); + if( err != KErrNone ) + { + iView.Cancel(); + if ( newTransaction ) + { + iDb.Commit(); + } + User::Leave( err ); + } + if ( newTransaction ) + { + iDb.Commit(); + } + + // DB Compaction + struct RDbDatabase::TSize size = iDb.Size(); + const TInt waterMark = 60; + if (size.iUsage <= waterMark) + { + if ( newTransaction ) + { + MPX_DEBUG1( "Compacting DB" ); + iDb.Compact(); + } + } + } + +// --------------------------------------------------------------------------- +// Update the current row with the updated info +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDatabaseTable::UpdateItemL( const TTime aLastModTime, + const TInt aColId, + TBool aNewTransaction, + const TDesC& aPath ) + { + // Safe row update + // + TBool newTransaction = aNewTransaction && !iDb.InTransaction(); + if( iView.FirstL() ) + { + if ( newTransaction ) + { + iDb.Begin(); + } + iView.UpdateL(); + if ( aPath != KNullDesC ) + { + TParsePtrC parser( aPath ); + iView.SetColL( KHarPathNameColumn, parser.DriveAndPath() ); + iView.SetColL( KHarFileNameColumn, parser.NameAndExt() ); + } + iView.SetColL( KHarModTimeColumn, aLastModTime ); + if ( aColId != KNullUid.iUid ) + { + iView.SetColL( KHarColDBIDColumn, aColId ); + } + } + else + { + User::Leave( KErrNotFound ); + } + + TRAPD( err, iView.PutL() ); + if( err != KErrNone ) + { + iView.Cancel(); + if ( newTransaction ) + { + iDb.Commit(); + } + + User::Leave( err ); + } + if ( newTransaction ) + { + iDb.Commit(); + } + + // DB Compaction + struct RDbDatabase::TSize size = iDb.Size(); + const TInt waterMark = 60; + if (size.iUsage <= waterMark) + { + if ( newTransaction ) + { + MPX_DEBUG1( "Compacting DB" ); + iDb.Compact(); + } + } + } + +// --------------------------------------------------------------------------- +// Local function to cleanup an array +// --------------------------------------------------------------------------- +// +static void CleanupArray( TAny* item ) + { + ((RPointerArray*) item )->ResetAndDestroy(); + } + +// --------------------------------------------------------------------------- +// Create an array representing the table that is generated +// --------------------------------------------------------------------------- +// +RPointerArray* CMPXHarvesterDatabaseTable::CreateTableRepresentationL() + { + MPX_DEBUG1("CMPXHarvesterDatabaseTable::CreateTableRepresentationL <---"); + + RPointerArray* array = + new (ELeave) RPointerArray; + CleanupStack::PushL( TCleanupItem( CleanupArray, array) ); + + for (iView.FirstL();iView.AtRow();iView.NextL()) + { + // Retrieve the row + iView.GetL(); + + CMPXHarvesterDbItem* item = new(ELeave) CMPXHarvesterDbItem(); + CleanupStack::PushL( item ); + + // Setup the item + HBufC* filepath = ReadLongTextLC( KHarPathNameColumn ); + HBufC* songname = ReadLongTextLC( KHarFileNameColumn ); + item->iFile = HBufC::NewL( filepath->Length() + songname->Length() ); + TPtr buf = item->iFile->Des(); + buf.Append( *filepath ); + buf.Append( *songname ); + CleanupStack::PopAndDestroy( 2, filepath ); + + item->iLastModifiedTime = iView.ColTime( KHarModTimeColumn ); + item->iColId = iView.ColInt( KHarColDBIDColumn ); + item->iDrm = iView.ColUint( KHarDRMColumn ); + + User::LeaveIfError( array->InsertInOrderAllowRepeats( item, + CMPXHarvesterDbItem::Compare ) ); + CleanupStack::Pop( item ); + } + + CleanupStack::Pop(); // cleanup + MPX_DEBUG1("CMPXHarvesterDatabaseTable::CreateTableRepresentationL --->"); + return array; + } + +// --------------------------------------------------------------------------- +// Read out the text at the current row and at a specific column +// --------------------------------------------------------------------------- +// +HBufC* CMPXHarvesterDatabaseTable::ReadLongTextLC( TInt aColumn ) + { + TInt len = iView.ColLength( aColumn ); + + HBufC* buf = HBufC::NewLC(len); + TPtr value( buf->Des() ); + if ( len>0 ) + { + RDbColReadStream strm; + strm.OpenLC(iView, aColumn ); + strm.ReadL( value, len ); + strm.Close(); + CleanupStack::PopAndDestroy( &strm ); + } + return buf; + } + +// --------------------------------------------------------------------------- +// Fixes single quote query issues +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDatabaseTable::FindAndReplaceSingleQuote(const TDesC& aSrc, + TDes& aTrg) + { + + TPtrC ch; + + TInt srcLen = aSrc.Length(); + + for (TInt i = 0; i < srcLen; ++i) + { + ch.Set(&aSrc[i], 1); + aTrg.Append(ch); + if ( ch.CompareF(_L("'")) == 0) + { + aTrg.Append(ch); + } + } + } + +#ifdef __PRINTDB__ +// --------------------------------------------------------------------------- +// Print out all items in the current table +// --------------------------------------------------------------------------- +// +void CMPXHarvesterDatabaseTable::PrintItemsInTableL() + { + for (iView.FirstL();iView.AtRow();iView.NextL()) + { + // Retrieve the row + iView.GetL(); + + // Print out each row + HBufC* filepath = ReadLongTextLC( KHarPathNameColumn ); + HBufC* songname = ReadLongTextLC( KHarFileNameColumn ); + TTime time = iView.ColTime( KHarModTimeColumn ); + MPX_DEBUG4("Filepath: %S Filename:%S Time %i", filepath, songname, time.Int64() ); + CleanupStack::PopAndDestroy( 2, filepath ); + } + } +#endif // __PRINTDB__ + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/src/mpxharvesterfilehandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/src/mpxharvesterfilehandler.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2006 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: Factory method to construct a file handler +* +*/ + + +#include +#include +#include "mpxharvesterfilehandler.h" +#include "mpxharvesterfilehandlerimp.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXHarvesterFileHandler* CMPXHarvesterFileHandler::NewL( RFs& aFs ) + { + return CMPXHarvesterFileHandlerImp::NewL(aFs); + } + +// --------------------------------------------------------------------------- +// Virtual Destructor +// --------------------------------------------------------------------------- +// +CMPXHarvesterFileHandler::~CMPXHarvesterFileHandler() + { + // do nothing + } + +// END OF FILE diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/src/mpxharvesterfilehandlerimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/src/mpxharvesterfilehandlerimp.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,2340 @@ +/* +* Copyright (c) 2006 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: Handles all file related activities +* Version : %version: da1mmcf#72.1.14.2.4.1.4.1.2 % << Don't touch! Updated by Synergy at check-out. +* +*/ + + +#include +#include +#include +#ifdef RD_MULTIPLE_DRIVE +#include +#include +#endif //RD_MULTIPLE_DRIVE + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mpxharvesterfilehandlerimp.h" +#include "mpxfolderscanner.h" +#include "mpxdbsynchronizer.h" +#include "mpxfoldermonitor.h" +#include "mpxmetadatascanner.h" +#include "mpxplaylistscanner.h" +#include "mpxharvesterdbmanager.h" +#include "mpxharvesterdbtable.h" +#include "mpxharvesterdbitem.h" +#include "mpxfhcommon.h" +#include "mpxbrokenlinkcleanup.h" + +// ============ CONSTANTS ========== +_LIT( KDefaultScanPath, "C:\\DATA\\|E:\\" ); +_LIT( KDefaultBlockPath, "\\SYS\\|\\PRIVATE\\|\\SYSTEM\\|\\CITIES\\"); +_LIT( KDefaultContainers, ".odf|.dcf|.asf|.m4a|.mp4" ); +_LIT( KDefaultAutoScanFolder, "C:\\data\\sounds\\digital\\|E:\\sounds\\digital\\"); +const TUid KCRUIDHarvesterFeatures = { 0x101FFCD2 }; +const TUid KMusicPlayerUid = {0x102072C3}; +const TInt KHarvesterScanPathKey = 1; +const TInt KHarvesterBlockPathKey = 2; +const TInt KHarvesterContainerKey = 3; +const TInt KAutoScanDirectoryKey = 4; +const TInt KDisablePodcasting = 5; +const TInt KAutoScanDelay = 10000000; // 10 second delay for rights to arrive +const TInt KAutoScanAfter = 10000000; + +// ==========LOCAL FUNCTIONS ======== +static void CleanupArray( TAny* item ) + { + ((RPointerArray*) item )->ResetAndDestroy(); + } + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// C++ Constructor +// --------------------------------------------------------------------------- +// +CMPXHarvesterFileHandlerImp::CMPXHarvesterFileHandlerImp( RFs& aFs ) : + iFs( aFs ), + iSynchronizing(EFalse), + iDisablePodcasting(EFalse) + { + } + + +// --------------------------------------------------------------------------- +// 2nd Phase Constructor +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::ConstructL() + { + // Folder monitoring related, + // + User::LeaveIfError( iAppArc.Connect() ); + iFolderScanner = CMPXFolderScanner::NewL( *this, *this, iFs ); + iMetadataScanner = CMPXMetadataScanner::NewL( iFs, + iAppArc, + iSupportedTypes, + *this, *this ); + iPlaylistScanner = CMPXPlaylistScanner::NewL( *this, + *this, + iSupportedTypes ); + + iBrokenLink = CMPXBrokenLinkCleanup::NewL( *this, *this ); + + // Database related + // + iDBManager = CMPXHarvesterDatabaseManager::NewL( iFs ); + + // List of watchers for different drives + // +#ifdef RD_MULTIPLE_DRIVE + TDriveList driveList; + TInt driveCount(0); + User::LeaveIfError( DriveInfo::GetUserVisibleDrives( + iFs, driveList, driveCount ) ); + + for( TInt driveNum = EDriveA; driveNum <= EDriveZ; driveNum++ ) + { + if ( driveList[driveNum] && (!iDBManager->IsRemoteDrive(static_cast(driveNum)))) + { + CMPXDiskSpaceWatcher* dw = CMPXDiskSpaceWatcher::NewL( + iFs, static_cast(driveNum), *this ); + CleanupStack::PushL( dw ); + iDiskMonitors.AppendL( dw ); + CleanupStack::Pop( dw ); + } + } +#else + CMPXDiskSpaceWatcher* dw_e = CMPXDiskSpaceWatcher::NewL( iFs, EDriveE, *this ); + CleanupStack::PushL( dw_e ); + iDiskMonitors.AppendL( dw_e ); + CleanupStack::Pop( dw_e ); + CMPXDiskSpaceWatcher* dw_c = CMPXDiskSpaceWatcher::NewL( iFs, EDriveC, *this ); + CleanupStack::PushL( dw_c ); + iDiskMonitors.AppendL( dw_c ); + CleanupStack::Pop( dw_c ); +#endif // RD_MULTIPLE_DRIVE + + + TInt openerr = iDBManager->OpenAllDatabasesL(); + + // Temporary collection utility + // + MMPXCollectionUtility* colUtil = + MMPXCollectionUtility::NewL( NULL, KMcModeDefault ); + CleanupStack::PushL( colUtil ); + + // Get the collection UIDs + RArray ary; + CleanupClosePushL( ary ); + ary.AppendL( TUid::Uid(EMPXCollectionPluginMusic) ); + iMusicCollectionId = colUtil->CollectionIDL( ary.Array() ); + ary.Reset(); + ary.AppendL( TUid::Uid(EMPXCollectionPluginPodCast) ); + iPodcastCollectionId = colUtil->CollectionIDL( ary.Array() ); + CleanupStack::PopAndDestroy( &ary ); + + // If harvester db was corrupted, mark podcast and music db as corrupt + if( openerr == KErrCorrupt ) + { + colUtil->Collection().CommandL(EMcCmdDbCorrupted, iMusicCollectionId.iUid ); + colUtil->Collection().CommandL(EMcCmdDbCorrupted, iPodcastCollectionId.iUid ); + } + + // Get the list of supported types from the collection + // + colUtil->Collection().GetSupportedTypesL( iSupportedTypes ); + CleanupStack::Pop( colUtil ); + colUtil->Close(); + + // Get the scan drives from cenrep. + // + ParseScanPathL(); + + // Get the list of container types + iContainerTypes = new(ELeave) CDesCArrayFlat(2); // granularity + ParseContainersL(); + + // Get the list of automatic scanned folders + ParseAutoScanL(); + iIdle = CPeriodic::NewL( CActive::EPriorityLow ); + + // Get the podcasting enabled / disabled flag + // + CRepository* cenrep(NULL); + TRAPD( err, cenrep = CRepository::NewL( KCRUIDHarvesterFeatures ) ); + if( err == KErrNone ) + { + cenrep->Get( KDisablePodcasting, iDisablePodcasting ); + delete cenrep; + } + else + { + iDisablePodcasting = EFalse; + } + + // Create the database synchronizer + iDbSynchronizer = CMPXDbSynchronizer::NewL(*this,*iDBManager,iMusicCollectionId, + iPodcastCollectionId,iFs, iDisablePodcasting); + +#ifdef RD_MULTIPLE_DRIVE + // Use default MMC drive as the Removable drive + User::LeaveIfError( DriveInfo::GetDefaultDrive( + DriveInfo::EDefaultRemovableMassStorage, + iRemovedDrive ) ); +#endif + + // Create DRM Notifier and register for AddRemove event + iDrmNotifier = CDRMNotifier::NewL(); + iDrmNotifier->RegisterEventObserverL( *this, KEventAddRemove ); + } + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXHarvesterFileHandlerImp* CMPXHarvesterFileHandlerImp::NewL( RFs& aFs ) + { + CMPXHarvesterFileHandlerImp* self = + new( ELeave ) CMPXHarvesterFileHandlerImp(aFs); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CMPXHarvesterFileHandlerImp::~CMPXHarvesterFileHandlerImp() + { + MPX_DEBUG1("~CMPXHarvesterFileHandlerImp <---"); + delete iDbSynchronizer; + delete iFolderScanner; + delete iMetadataScanner; + delete iPlaylistScanner; + delete iBrokenLink; + + iDiskMonitors.ResetAndDestroy(); + iDiskMonitors.Close(); + + iFolderMonitors.ResetAndDestroy(); + iFolderMonitors.Close(); + + + iSupportedTypes.ResetAndDestroy(); + iSupportedTypes.Close(); + + if( iContainerTypes ) + { + iContainerTypes->Reset(); + } + delete iContainerTypes; + + iFilteredDrivesToScan.Reset(); + iFilteredDrivesToScan.Close(); + iDrivesToScan.Reset(); + iDrivesToScan.Close(); + iPathsToBlock.Reset(); + iPathsToBlock.Close(); + + // Cleans up the scanning tables and arrays + Reset(); + + delete iDBManager; + + if( iCollectionUtil ) + { + iCollectionUtil->Close(); + } + + iAppArc.Close(); + + iAutoScanPaths.Reset(); + iAutoScanPaths.Close(); + delete iIdle; + + if(iDrmNotifier) + { + TRAP_IGNORE( iDrmNotifier->UnRegisterEventObserverL( *this, KEventAddRemove ) ); + delete iDrmNotifier; + } + MPX_DEBUG1("~CMPXHarvesterFileHandlerImp --->"); + } + +// --------------------------------------------------------------------------- +// Scans all drives in the list of interested drives +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::ScanL() + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::ScanL <---"); + + // Reset all previous states + CancelScan(); + Reset(); + + // Construct the collection utility + if( iCollectionUtil ) + { + iCollectionUtil->Close(); + iCollectionUtil = NULL; + } + iCollectionUtil = MMPXCollectionUtility::NewL( NULL, KMusicPlayerUid ); + + // cenrep key need to be checked whether USB cable is connected in MTP/Combined Mode + // to prevent refresh + TInt usbStatus; + RProperty::Get(KPSUidUsbWatcher, KUsbWatcherSelectedPersonality, usbStatus); + + if ((usbStatus == KUsbPersonalityIdMTP) || (usbStatus == KUsbPersonalityIdPCSuiteMTP)) + { + MPX_DEBUG1("USB is active, Leave with KErrLocked"); + // need to call back even if it leaves here + iCollectionUtil->Collection().NotifyL( EMcMsgRefreshEnd, KErrLocked ); + //User::Leave(KErrLocked); + return; + } + + iCollectionUtil->Collection().NotifyL( EMcMsgRefreshStart, KErrNone ); + + // Reopen databases + iDBManager->OpenAllDatabasesL(); + + // Begin transaction on databases + iDBManager->BeginL(); + + //Remove out of disk space drives from scanned drives list + iFilteredDrivesToScan.Reset(); + CopyArrayL(iDrivesToScan.Array(),iFilteredDrivesToScan); + + iOutOfDisk = EFalse; + TInt driveCount (iDiskMonitors.Count()); + TBool outOfDisk(EFalse); + for( TInt driveIndex = 0; driveIndex < driveCount; ++driveIndex ) + { + //Check if the current drive is low on disk + outOfDisk = iDiskMonitors[driveIndex]->IsLowOnDisk(); + iDiskMonitors[driveIndex]->StartL(); + + if(outOfDisk) + { + TInt count( iFilteredDrivesToScan.Count() ); + TInt index(0); + TInt currentDriveNumber = iDiskMonitors[driveIndex]->CurrentDrive(); + while(index < count) + { + // Remove current drive from the scanned drives list + TParse fileNameParser; + User::LeaveIfError(fileNameParser.Set(iFilteredDrivesToScan[index],NULL,NULL)); + TFileName driveName(fileNameParser.Drive()); + TInt driveNumber = TDriveUnit( driveName ); + if (currentDriveNumber == driveNumber) + { + iFilteredDrivesToScan.Remove(index); + count--; + } + else + { + index++; + } + } + TRAP_IGNORE(iDBManager->RemoveDatabaseL(static_cast(currentDriveNumber))); + } + } + + iSynchronizing = CheckDbInSyncL(); + + if(!iSynchronizing) + { + // Start the scanning process + iRefreshCount++; + iFolderScanner->ScanL( iFilteredDrivesToScan ); + iMetadataScanner->Reset(); + iBrokenLink->Reset(); + iPlaylistScanner->Reset(); + iIdle->Cancel(); + + // Keep a count of how many we added to synchronize the number + iAddedCount = 0; + iRefreshing = ETrue; + } + + if (iFilteredDrivesToScan.Count() == 0 ) + { + iOutOfDisk = ETrue; + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::ScanL -- cancelling scan"); + // Cancel the scan in this case, will goto HandleScanStateCompleteL() + CancelScan(); + } + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::ScanL --->"); + } + +// --------------------------------------------------------------------------- +// Cancels Scanning +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::CancelScan() + { + iDbSynchronizer->Cancel(); + iFolderScanner->Cancel(); + iBrokenLink->Cancel(); + iMetadataScanner->Stop(); + iPlaylistScanner->Cancel(); + } + +// --------------------------------------------------------------------------- +// Handles a system event +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::HandleSystemEventL( TSystemEvent aEvent, + TInt aData ) + { + MPX_DEBUG2("CMPXHarvesterFileHandlerImp::HandleSystemEventL %i", aEvent); + // How to handle each event + // + // 1: Format and eject, we stop scanning and close only the mmc db + // 2: Format end and disk insert we reopen db and scan for new files + // 3: USB start we stop scan and close all db + // 4: USB end we re-open all db and scan for new files + // 5: MTP start we stop monitoring for new files (no dismount) + // 6: MTP end we re-open all db, files added already, restart monitor + // +#ifdef RD_MULTIPLE_DRIVE + // Get all visible drives + TDriveList driveList; + TInt driveCount(0); + TPtrC drivePresent(_L("present")); + TPtrC driveNotPresent(_L("not present")); + TPtrC driveInUse(_L("in use")); + TPtrC driveAvailable(_L("available")); + TPtrC driveFormatted(_L("formatted")); + TPtrC driveNotFormatted(_L("not formatted")); + User::LeaveIfError( DriveInfo::GetUserVisibleDrives( + iFs, driveList, driveCount ) ); + MPX_DEBUG2 ("CMPXHarvesterFileHandlerImp::HandleSystemEventL - driveCount = %d", driveCount); + + for( TInt driveNum = EDriveA; driveNum <= EDriveZ; driveNum++ ) + { + if (driveList[driveNum]) + { + // Get the drive status + TUint driveStatus(0); + User::LeaveIfError( DriveInfo::GetDriveStatus( + iFs, driveNum, driveStatus ) ); + MPX_DEBUG3 ("CMPXHarvesterFileHandlerImp::HandleSystemEventL - drive %d status=0x%x", driveNum, driveStatus); + TChar driveChar; + User::LeaveIfError( + iFs.DriveToChar( driveNum, driveChar ) ); + MPX_DEBUG5 ("CMPXHarvesterFileHandlerImp::HandleSystemEventL - drive %c: is %S, %S and %S", + driveChar, + (driveStatus&DriveInfo::EDrivePresent)?&drivePresent:&driveNotPresent, + (driveStatus&DriveInfo::EDriveInUse)?&driveInUse:&driveAvailable, + (driveStatus&DriveInfo::EDriveFormatted)?&driveFormatted:&driveNotFormatted); + } + } +#endif //RD_MULTIPLE_DRIVE + switch( aEvent ) + { + case EFormatStartEvent: + { + MPX_DEBUG1("Disk Format start event"); + CancelScan(); + iDBManager->CloseDatabase( (TDriveNumber) aData ); + break; + } + case EDiskRemovedEvent: + { + MPX_DEBUG1("Disk Removed event"); + iIdle->Cancel(); + CancelScan(); +#ifdef RD_MULTIPLE_DRIVE + for( TInt driveNum = EDriveA; driveNum <= EDriveZ; driveNum++ ) + { + if (driveList[driveNum] && (!iDBManager->IsRemoteDrive(static_cast(driveNum)))) + { + TUint driveStatus(0); + User::LeaveIfError( DriveInfo::GetDriveStatus( + iFs, driveNum, driveStatus ) ); + if (!(driveStatus & DriveInfo::EDrivePresent )) + { + // Close database for non-present drive + iDBManager->CloseDatabase( (TDriveNumber) driveNum ); + // Save the drive + iRemovedDrive = driveNum; + break; + } + } + } +#else + iDBManager->CloseDatabase( (TDriveNumber) aData ); +#endif // RD_MULTIPLE_DRIVE + break; + } + case EFormatEndEvent: + { + MPX_DEBUG1("Disk Format end event"); + CancelScan(); + iDBManager->OpenDatabaseL( (TDriveNumber) aData ); + break; + } + case EDiskInsertedEvent: + { + MPX_DEBUG1("Disk Insert event"); + CancelScan(); +#ifdef RD_MULTIPLE_DRIVE + iDBManager->OpenDatabaseL( (TDriveNumber) iRemovedDrive ); +#else + iDBManager->OpenDatabaseL( (TDriveNumber) aData ); +#endif // RD_MULTIPLE_DRIVE + break; + } + case EUSBMassStorageStartEvent: + { + iIdle->Cancel(); + CancelScan(); +#ifdef RD_MULTIPLE_DRIVE + // Close all databases other than the phone memory database + for( TInt driveNum = EDriveA; driveNum <= EDriveZ; driveNum++ ) + { + if (driveList[driveNum] && (!iDBManager->IsRemoteDrive(static_cast(driveNum)))) + { + if ( driveNum != EDriveC ) + { + iDBManager->CloseDatabase( (TDriveNumber) driveNum ); + } + } + } +#else + iDBManager->CloseDatabase( (TDriveNumber) aData ); +#endif // RD_MULTIPLE_DRIVE + break; + } + case EUSBMassStorageEndEvent: + { +#ifdef RD_MULTIPLE_DRIVE + // Open all databases other than the phone memory + for( TInt driveNum = EDriveA; driveNum <= EDriveZ; driveNum++ ) + { + if (driveList[driveNum] && (!iDBManager->IsRemoteDrive(static_cast(driveNum)))) + { + if ( driveNum != EDriveC ) + { + iDBManager->OpenDatabaseL( (TDriveNumber) driveNum ); + } + } + } +#else + iDBManager->OpenDatabaseL( (TDriveNumber) aData ); +#endif // RD_MULTIPLE_DRIVE + break; + } + case EUSBMTPNotActiveEvent: // deliberate fall through + { + if ( iRefreshing ) + { + // Notify clients that refresh is cancelled. + iCollectionUtil->Collection().NotifyL( EMcMsgRefreshEnd, KErrLocked ); + } + } + case EUSBMTPStartEvent: + { + CancelScan(); + // nothing to do, db is needed for MTP + break; + } + case EUSBMTPEndEvent: + { + // nothing to do, db is updated by MTP + break; + } + case EPowerKeyEjectEvent: + { + CancelScan(); + break; + } + default: + { + MPX_DEBUG1("CCMPXHarvesterFileHandlerImp::HandleSystemEventL Unknown system event!"); + break; + } + } + } + +// --------------------------------------------------------------------------- +// Add a file to the harvester db +// --------------------------------------------------------------------------- +// +CMPXMedia* CMPXHarvesterFileHandlerImp::AddFileL( const TDesC& aPath ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::AddFileL <---"); + + // Create the media properties and add as usual. + // + CMPXMedia* prop = iMetadataScanner->ExtractFileL( aPath ); + CleanupStack::PushL( prop ); + AddFileL( *prop ); + CleanupStack::Pop( prop ); + + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::AddFileL --->"); + return prop; + } + +// --------------------------------------------------------------------------- +// Add a file to the harvester db +// --------------------------------------------------------------------------- +// +TInt CMPXHarvesterFileHandlerImp::AddFileL( CMPXMedia& aMediaProp ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::AddFileL <---"); + + // Parse + TPtrC path = aMediaProp.ValueText( TMPXAttribute( KMPXMediaIdGeneral, + EMPXMediaGeneralUri) ); + TInt r(0); + // Make sure we have a "file" + if( path.Compare(KNullDesC) ) + { + // Last modified time + TTime lastModTime; + iFs.Modified( path, lastModTime ); + + // Collection UID, + CMPXCollectionMediator* mediator = CMPXCollectionMediator::NewL(); + CleanupStack::PushL( mediator ); + mediator->CheckItemL( aMediaProp ); + CleanupStack::PopAndDestroy( mediator ); + + TUid col( KNullUid ); + if( aMediaProp.IsSupported( TMPXAttribute( KMPXMediaIdGeneral, + EMPXMediaGeneralCollectionId ) ) ) + { + col = aMediaProp.ValueTObjectL( TMPXAttribute( + KMPXMediaIdGeneral, + EMPXMediaGeneralCollectionId ) ); + } + MPX_DEBUG2("CMPXHarvesterFileHandlerImp::AddFileL aMediaProp->Value col = %i", col.iUid); + // Collection not set yet + if( col.iUid == 0 ) + { + TInt index = IsMediaFileL( path ); + if( index >= KErrNone ) + { + MPX_DEBUG2(_L("CMPXHarvesterFileHandlerImp::AddFileL - count: %i"),iSupportedTypes.Count()); + col = iSupportedTypes[index]->Uid(); + MPX_DEBUG2(_L("CMPXHarvesterFileHandlerImp::AddFileL Selected Collection %i"), col.iUid); + aMediaProp.SetTObjectValueL( TMPXAttribute( + KMPXMediaIdGeneral, + EMPXMediaGeneralCollectionId ), + col ); + } + } + + // drm + TBool drm(EFalse); + if( aMediaProp.IsSupported( TMPXAttribute(KMPXMediaIdDrm, + EMPXMediaDrmProtected) ) ) + { + if( aMediaProp.ValueTObjectL(TMPXAttribute(KMPXMediaIdDrm, + EMPXMediaDrmProtected)) ) + { + TInt rights( EMPXDrmRightsFull ); + + if( aMediaProp.IsSupported( TMPXAttribute(KMPXMediaIdDrm, + EMPXMediaDrmRightsStatus) ) ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::AddFiles -- getting rights"); + rights = aMediaProp.ValueTObjectL( TMPXAttribute(KMPXMediaIdDrm, + EMPXMediaDrmRightsStatus) ); + } + MPX_DEBUG2("CMPXHarvesterFileHandlerImp::AddFiles -- rights %i", rights); + if( rights == EMPXDrmRightsMissing || + rights == EMPXDrmRightsExpired ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::AddFiles -- drm"); + drm = ETrue; + } + } + } + if( aMediaProp.IsSupported(KMPXMediaGeneralFlags) ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::AddFiles -- db flags"); + TUint dbflags( aMediaProp.ValueTObjectL(KMPXMediaGeneralFlags) ); + if( dbflags&KMPXMediaGeneralFlagsIsDrmLicenceInvalid ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::AddFiles -- db flags drm invalid"); + drm = ETrue; + } + } + // Add to database + CMPXHarvesterDB& db = iDBManager->GetDatabaseL( ::ExtractDrive( path ) ); + CMPXHarvesterDatabaseTable* table = db.OpenFileL( path ); + CleanupStack::PushL( table ); + + // Don't add something we already have + // + if( table->CountL() == 0 ) + { + TParsePtrC parse( path ); + table->AddItemL( parse.DriveAndPath(), parse.NameAndExt(), + lastModTime, col.iUid, drm ); + } + CleanupStack::PopAndDestroy( table ); + + // Return the collection that it should belong to. + r = col.iUid; + } + else + { + // No file path, leave KErrArgument! + User::Leave( KErrArgument ); + } + + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::AddFileL --->"); + return r; + } + +// --------------------------------------------------------------------------- +// Remove a file from the harvester db +// --------------------------------------------------------------------------- +// +TInt CMPXHarvesterFileHandlerImp::RemoveFileL( const TDesC& aPath, TBool aEndTransaction ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::RemoveFileL <---"); + TInt r(0); + + // Open the db + CMPXHarvesterDB& db = iDBManager->GetDatabaseL( ::ExtractDrive(aPath) ); + MPX_PERF_START( MPX_PERF_HARV_DB_DELETE_SUB1 ); + CMPXHarvesterDatabaseTable* table = db.OpenFileL( aPath ); + MPX_PERF_END( MPX_PERF_HARV_DB_DELETE_SUB1 ); + + CleanupStack::PushL( table ); + + // Create a cached copy of the db + MPX_PERF_START( MPX_PERF_HARV_DB_DELETE_SUB2 ); + RPointerArray* ary = + table->CreateTableRepresentationL(); + TCleanupItem cleanup( CleanupArray, ary ); + CleanupStack::PushL( cleanup ); + MPX_PERF_END( MPX_PERF_HARV_DB_DELETE_SUB2 ); + + // Delete the item from db + MPX_PERF_START( MPX_PERF_HARV_DB_DELETE_SUB3 ); + TRAPD( err, table->DeleteItemL(aEndTransaction) ); + MPX_PERF_END( MPX_PERF_HARV_DB_DELETE_SUB3 ); + + // If delete was successful, that means the item existed + // find the collection db id for return + // + if( err == KErrNone ) + { + CMPXHarvesterDbItem* item = (*ary)[0]; + if( item != NULL ) + { + r = item->iColId; + } + } + else + { + r=err; + } + CleanupStack::Pop( ary ); + ary->ResetAndDestroy(); + delete ary; + CleanupStack::PopAndDestroy( table ); + + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::RemoveFileL --->"); + return r; + } + +// --------------------------------------------------------------------------- +// Update the properties of a file +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::UpdateFileL( const TDesC& aFile, TInt aCollection ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::UpdateFileL <---"); + + OpenDBForPathL( aFile ); + + // Last modified time + TTime lastModTime; + iFs.Modified( aFile, lastModTime ); + + iCurTable->UpdateItemL( lastModTime, aCollection,!iRefreshing ); + Reset(); + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::UpdateFileL --->"); + } + +// --------------------------------------------------------------------------- +// Rename a file +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::RenameFileL( const TDesC& aOldPath, + const TDesC& aNewPath, + TInt aCollection ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::RenameFileL <---"); + + // update harvester database + OpenDBForPathL( aOldPath ); + + // Last modified time + TTime lastModTime; + iFs.Modified( aNewPath, lastModTime ); + + iCurTable->UpdateItemL( lastModTime, aCollection, !iRefreshing, aNewPath ); + Reset(); + + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::RenameFileL --->"); + } + +// --------------------------------------------------------------------------- +// Finds the associated collection id for a file +// --------------------------------------------------------------------------- +// +TInt CMPXHarvesterFileHandlerImp::FindCollectionIdL( const TDesC& aFile ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::FindCollectionIdL <---"); + TInt r(0); + + // Open the db + CMPXHarvesterDB& db = iDBManager->GetDatabaseL( ::ExtractDrive(aFile) ); + CMPXHarvesterDatabaseTable* table = db.OpenFileL( aFile ); + CleanupStack::PushL( table ); + + // Create a cached copy of the db + RPointerArray* ary = + table->CreateTableRepresentationL(); + if( ary->Count() > 0 ) + { + CMPXHarvesterDbItem* item = (*ary)[0]; // not owned + r = item->iColId; + } + else + { + r = KErrNotFound; + } + ary->ResetAndDestroy(); + delete ary; + CleanupStack::PopAndDestroy( table ); + + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::FindCollectionIdL --->"); + return r; + } + + +// --------------------------------------------------------------------------- +// Re-create all databases +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::RecreateDatabases() + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::RecreateDatabasesL <--"); + iDBManager->RecreateDatabases(); + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::RecreateDatabasesL -->"); + } + +// --------------------------------------------------------------------------- +// Close database transaction +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::CloseTransactionL() + { + iDBManager->CommitL(); + } + +// --------------------------------------------------------------------------- +// Get a media object for the file +// --------------------------------------------------------------------------- +// +CMPXMedia* CMPXHarvesterFileHandlerImp::GetMediaForFileL( const TDesC& aPath ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::GetMediaForFileL <---"); + + // Create the media properties + // + CMPXMedia* prop = iMetadataScanner->ExtractFileL( aPath ); + + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::GetMediaForFileL --->"); + return prop; + } + +// --------------------------------------------------------------------------- +// Get Collection Uid for the file +// --------------------------------------------------------------------------- +// +TInt CMPXHarvesterFileHandlerImp::GetColUidForFileL( const TDesC& aPath ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::GetColUidForFileL <---"); + + if(aPath == KNullDesC) + { + // No file path, leave KErrArgument! + User::Leave( KErrArgument ); + } + + TInt ret(0); + TInt index = IsMediaFileL( aPath ); + if( index >= KErrNone ) + { + ret = iSupportedTypes[index]->Uid().iUid; + } + + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::GetColUidForFileL --->"); + return ret; + } + +// --------------------------------------------------------------------------- +// Remove multiple files from the harvester db +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::RemoveFilesL( const MDesCArray& aFilePaths ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::RemoveFilesL <---"); + + TInt count( aFilePaths.MdcaCount() ); + TBool endTransaction(EFalse); + for( TInt i=0; i"); + } + +// --------------------------------------------------------------------------- +// Remove all files from the harvester db +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::RemoveAllFilesL() + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::RemoveAllFilesL <---"); + TInt dbCount( iDBManager->Count() ); + for( TInt i=0; i< dbCount; ++i ) + { + CMPXHarvesterDB& db = iDBManager->GetDatabaseL( i ); + db.RemoveAllFilesL(); + } + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::RemoveAllFilesL --->"); + } + +// --------------------------------------------------------------------------- +// Handles a state change event +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::HandleScanStateCompleteL( TScanState aState, + TInt aErr ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::HandleScanStateCompleteL <---"); + + // Cleanup associated with each state + // + switch( aState ) + { + case EScanFiles: + { +#ifdef __PRINTDB__ + if( iCurTable ) + iCurTable->PrintItemsInTableL(); +#endif //__PRINTDB__ + + // Look for removed items + // Do not look for removed files if there was an error + if( aErr == KErrNone ) + { + HandleBrokenItemsL(); + } + Reset(); + break; + } + case ECleanupBrokenLink: + { + iBrokenLink->Reset(); + break; + } + case EScanPlaylists: + { + iPlaylistScanner->Reset(); + break; + } + case EScanMetadata: + { + iMetadataScanner->Reset(); + break; + } + default: + break; + } + + // Next state handling + // + if( KErrNone == aErr ) + { + switch( aState ) + { + case EScanFiles: + { + MPX_DEBUG1("Start Broken Link"); + iBrokenLink->Start(); + break; + } + case ECleanupBrokenLink: + { + MPX_DEBUG1("Start Metadata Scan"); + iMetadataScanner->Start(); + break; + } + case EScanMetadata: + { + MPX_DEBUG1("Start Metadata Scan"); + iPlaylistScanner->ScanL(); + break; + } + case EScanPlaylists: + { + MPX_DEBUG1("Scan complete"); + + TRAPD(err, DoCompleteRefreshL( KErrNone )); + + // handle DoCompleteRefreshL leave + if( err != KErrNone ) + { + // finish refresh, close waitnote + iCollectionUtil->Collection().NotifyL( EMcMsgRefreshEnd, err ); + } + + // Reset all scan states + Reset(); + break; + } + default: + break; + } + } + else + { + // Error occured, check for out of disk + // + TInt error = iOutOfDisk ? KErrDiskFull : aErr; + TRAPD(err, DoCompleteRefreshL( error )); + + // handle DoCompleteRefreshL leave + if( err != KErrNone ) + { + // finish refresh, close waitnote + iCollectionUtil->Collection().NotifyL( EMcMsgRefreshEnd, err ); + } + } + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::HandleScanStateCompleteL <---"); + } + +// --------------------------------------------------------------------------- +// Handles a state change event +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::HandleSynchronizationComplete( TInt aErr ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::HandleSynchronizationComplete enter"); + + iSynchronizing = EFalse; + + if(aErr == KErrNone) + { + // Start the scanning process + iRefreshCount++; + // Keep a count of how many we added to syncrhonize the number + iAddedCount = 0; + iRefreshing = ETrue; + + TRAPD(err,iFolderScanner->ScanL( iFilteredDrivesToScan )); + if(err == KErrNone) + { + iMetadataScanner->Reset(); + iBrokenLink->Reset(); + iPlaylistScanner->Reset(); + iIdle->Cancel(); + } + else + { + TRAPD(error, DoCompleteRefreshL( err )); + + // handle DoCompleteRefreshL leave + if( error != KErrNone ) + { + // finish refresh, close waitnote + TRAP_IGNORE( iCollectionUtil->Collection().NotifyL( EMcMsgRefreshEnd, error ) ); + } + } + } + else + { + iRefreshCount++; + iRefreshing = ETrue; + TInt error = iOutOfDisk ? KErrDiskFull : aErr; + TRAPD(err, DoCompleteRefreshL( error )); + + // handle DoCompleteRefreshL leave + if( err != KErrNone ) + { + // finish refresh, close waitnote + TRAP_IGNORE( iCollectionUtil->Collection().NotifyL( EMcMsgRefreshEnd, err ) ); + } + } + MPX_DEBUG1("<--- CMPXHarvesterFileHandlerImp::HandleSynchronizationCompleteL exit"); + } + +// --------------------------------------------------------------------------- +// Handle adding a single file +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::HandleFileAdditionL( const TDesC& aFileName, + TInt /*aColIndex*/, + TBool /*aPlaylist*/ ) + { + MPX_DEBUG2("CMPXHarvesterFileHandlerImp::HandleFileAdditionL %S<---", &aFileName ); + + // Find the item in the array + // + CMPXHarvesterDbItem tmp; + tmp.iFile = aFileName.AllocL(); + + // Last modified time + // + TTime lastModTime; + iFs.Modified( aFileName, lastModTime ); + + // This is very inefficient, should hash. + // + if( iCurList ) + { + TInt index = iCurList->FindInOrder( &tmp, CMPXHarvesterDbItem::Compare ); + if( index != KErrNotFound ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::HandleFileAdditionL found file"); + + // Check modified time stamp to see if it was modified + // Also check files that did not have rights, see if we have rights now + // + CMPXHarvesterDbItem* item = (*iCurList)[index]; + if( item->iLastModifiedTime != lastModTime || item->iDrm ) + { + MPX_DEBUG1("Rescanning a file because of modified or drm"); + HandleUpdatedItemL( aFileName ); + } + + // If found, we remove it from the list, items left should be deleted + // + delete item; + iCurList->Remove( index ); + } + else // new file + { + HandleNewItemL( aFileName ); + } + } + else + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::HandleFileAdditionL Scan cancelled"); + } + + delete tmp.iFile; + tmp.iFile = NULL; + + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::HandleFileAdditionL --->"); + } + +// --------------------------------------------------------------------------- +// Handle a change in the file system, could be a file added/removed +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::HandleDirectoryChangedL( const TDesC& aPath ) + { + // Delay the scanning for a few seconds so the files are finished + // copying. If already active, means we just append onto the list + // + iAutoScanPaths.AppendL( aPath ); + if( !iIdle->IsActive() ) + { + TCallBack cb( Callback, this ); + iIdle->Start( TTimeIntervalMicroSeconds32( KAutoScanDelay ), + TTimeIntervalMicroSeconds32( KAutoScanAfter ), + cb ); + } + + } + +// --------------------------------------------------------------------------- +// Handles opening the drive +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::HandleOpenDriveL( TDriveNumber aDrive, + const TDesC& aFolder ) + { +#ifdef __PRINTDB__ + if( iCurTable ) + iCurTable->PrintItemsInTableL(); +#endif //__PRINTDB__ + + // Look for broken files + HandleBrokenItemsL(); + + // Delete previous table and open the next one + Reset(); + MPX_TRAPD( err, iCurDB = &iDBManager->GetDatabaseL( aDrive ) ); + if ( err != KErrNone ) + { + iDBManager->OpenAllDatabasesL(); + iCurDB = &iDBManager->GetDatabaseL( aDrive ); + } + + if( iDrivesToScan.Find( aFolder ) != KErrNotFound ) + { + iCurTable = iCurDB->OpenAllFilesTableL(); + } + else + { + iCurTable = iCurDB->OpenDirectoryL( aFolder ); + } + iCurList = iCurTable->CreateTableRepresentationL(); + } + +// --------------------------------------------------------------------------- +// Is this a media file we are interested in +// --------------------------------------------------------------------------- +// +TInt CMPXHarvesterFileHandlerImp::IsMediaFileL( const TDesC& aFile ) + { + MPX_DEBUG2("CMPXHarvesterFileHandlerImp::IsMediaFileL %S <---", &aFile); + + TParsePtrC parse( aFile ); + TInt index(KErrNotFound); + TInt count( iSupportedTypes.Count() ); + for (TInt i=0; i Extensions(); + if (!exts.FindIsq(parse.Ext(), index2)) + { // found + index = i; + break; + } + } + + if( index == KErrNotFound ) + { + index = IsPlaylistFileL( aFile ) ? ETrue : KErrNotFound; + } + + MPX_DEBUG2("CMPXHarvesterFileHandlerImp::IsMediaFileL %i --->", index); + return index; + } + +// --------------------------------------------------------------------------- +// Is this a playlist file we are interested in +// --------------------------------------------------------------------------- +// +TInt CMPXHarvesterFileHandlerImp::IsPlaylistFileL( const TDesC& aFile ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::IsPlaylistFileL <---"); + return iPlaylistScanner->IsPlaylistFileL( aFile ); + } + +// --------------------------------------------------------------------------- +// Checks if this path is in the blocked list +// --------------------------------------------------------------------------- +// +TBool CMPXHarvesterFileHandlerImp::IsPathBlockedL( const TDesC& aPath ) + { + TInt count( iPathsToBlock.Count() ); + TBool isBlocked(EFalse); + HBufC* buf = aPath.AllocLC(); + TPtr ptr = buf->Des(); + ptr.UpperCase(); + for( TInt i=0; iCollection(), + this ); + CleanupStack::PushL( mediator ); + TRAPD( addErr, mediator->AddItemL( aMediaArray ) ); + CleanupStack::PopAndDestroy( mediator ); + + // Now we add them to the harvester db + // + if( addErr == KErrNone ) + { + TInt count = aMediaArray.Count(); + for( TInt i=0; iValueText( TMPXAttribute( + KMPXMediaIdGeneral, + EMPXMediaGeneralUri ) ); + OpenDBForPathL( path ); + + // Collection + const TUid& collection = aMediaArray.AtL(i)->ValueTObjectL( + TMPXAttribute( KMPXMediaIdGeneral, + EMPXMediaGeneralCollectionId ) ); + + // Last modified time + TTime lastModTime; + iFs.Modified( path, lastModTime ); + + // drm + TBool drm(EFalse); + if( aMediaArray[i]->IsSupported( TMPXAttribute(KMPXMediaIdDrm, + EMPXMediaDrmProtected) ) && + aMediaArray.AtL(i)->ValueTObjectL(TMPXAttribute(KMPXMediaIdDrm, + EMPXMediaDrmProtected)) ) + { + TInt rights = EMPXDrmRightsFull; + if( aMediaArray[i]->IsSupported( TMPXAttribute(KMPXMediaIdDrm, + EMPXMediaDrmRightsStatus)) ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::AddFilesToCollectionL -- getting rights"); + rights = aMediaArray.AtL(i)->ValueTObjectL( + TMPXAttribute(KMPXMediaIdDrm, EMPXMediaDrmRightsStatus) ); + } + if( rights == EMPXDrmRightsMissing || + rights == EMPXDrmRightsExpired ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::AddFilesToCollectionL -- rights missing/expired"); + drm = ETrue; + } + } + + TParsePtrC parse( path ); + iCurTable->AddItemL( parse.DriveAndPath(), + parse.NameAndExt(), + lastModTime, collection.iUid, drm ); + + iAddedCount++; + } + } + else if ( addErr == KErrDiskFull ) + { + User::Leave( KErrDiskFull ); + } + + MPX_DEBUG1("MPXHarvesterFileHandlerImp::AddFilesToCollectionL --->"); + } + +// --------------------------------------------------------------------------- +// Updates some files to the collection +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::UpdatesFilesInCollectionL( + CMPXMediaArray& aMediaArray ) + { + MPX_DEBUG1("MPXHarvesterFileHandlerImp::UpdatesFilesInCollectionL <---"); + + // Do not update files which still do not have rights + // + TInt c( aMediaArray.Count() ); + for( TInt i=0; iIsSupported( KMPXMediaDrmRightsStatus ) ) + { + rights = aMediaArray.AtL(i)->ValueTObjectL( KMPXMediaDrmRightsStatus ); + } + if( rights == EMPXDrmRightsMissing ) + { + aMediaArray.Remove(i); + i--; + c--; + } + } + + // Update collection db + CMPXCollectionMediator* mediator = + CMPXCollectionMediator::NewL( iCollectionUtil->Collection(), + this ); + CleanupStack::PushL( mediator ); + TRAPD( setErr , mediator->SetItemL( aMediaArray ) ); + CleanupStack::PopAndDestroy( mediator ); + + // Now we update them to the harvester db + // + if( setErr == KErrNone ) + { + TInt count( aMediaArray.Count() ); + for( TInt i=0; iValueText( KMPXMediaGeneralUri ); + OpenDBForPathL( filepath ); + + // Collection + TUid collection = aMediaArray.AtL(i)->ValueTObjectL( KMPXMediaGeneralCollectionId ); + // Last modified time + TTime lastModTime; + iFs.Modified( filepath, lastModTime ); + + // drm + TBool drm(EFalse); + if( aMediaArray.AtL(i)->IsSupported(KMPXMediaDrmProtected) && + aMediaArray.AtL(i)->ValueTObjectL(KMPXMediaDrmProtected) ) + { + TInt rights = EMPXDrmRightsFull; + + if( aMediaArray.AtL(i)->IsSupported(KMPXMediaDrmRightsStatus) ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::UpdateFilesToCollectionL -- getting rights"); + rights = aMediaArray.AtL(i)->ValueTObjectL(KMPXMediaDrmRightsStatus); + } + if( rights == EMPXDrmRightsMissing || + rights == EMPXDrmRightsExpired ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::UpdateFilesToCollectionL -- updating rights"); + drm = ETrue; + } + } + + iCurTable->UpdateItemL( filepath, lastModTime, collection.iUid, drm, !iRefreshing ); + } + } + else if ( setErr == KErrDiskFull ) + { + User::Leave( KErrDiskFull ); + } + + MPX_DEBUG1("MPXHarvesterFileHandlerImp::UpdatesFilesInCollectionL --->"); + } + +// --------------------------------------------------------------------------- +// Updates the db based on mediator decisions +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::HandleMediatorPathUpdatedL( + CMPXMedia*& aProperty, + TUid /*aOldPath*/ ) + { + MPX_DEBUG1("MPXHarvesterFileHandlerImp::UpdatesFilesInCollectionL <---"); + + // Update harvester database based on mediator changes + // + const TDesC& filepath = aProperty->ValueText( KMPXMediaGeneralUri ); + OpenDBForPathL( filepath ); + + // Collection + // + TUid colUid = aProperty->ValueTObjectL( KMPXMediaGeneralCollectionId ); + + // Last modified time + // + TTime lastModTime; + iFs.Modified( filepath, lastModTime ); + + // Update DB, only if the record existed. No record means this is a new + // entry + if( iCurTable->CountL() ) + { + iCurTable->UpdateItemL( lastModTime, colUid.iUid, !iRefreshing ); + } + + MPX_DEBUG1("MPXHarvesterFileHandlerImp::UpdatesFilesInCollectionL <---"); + } + +// --------------------------------------------------------------------------- +// Add playlists to the collection +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::AddPlaylistToCollectionL( + CMPXMediaArray& aMediaArray ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::AddPlaylistToCollectionL <---"); + + // + // add to collection one by one to avoid the following scenario: + // 2 playlists to add to the collection. The 1st one is successfully + // added but the 2nd playlist isn't. When AddL leaves, it does not + // indicate which one is successfully added and which one isn't. + // As a result, the successfully added playlist isn't added to + // harvester database and during the next scan, it will be picked + // up again and added to the database with auto-numbered title. + // + TInt count( aMediaArray.Count() ); + for (TInt i=0; iValueTObjectL(KMPXMediaGeneralCollectionId), + TMPXAttribute(KMPXCommandColAddMedia), + media, + ETrue ) ); + + // Now we add the item to the harvester db + // + if( addErr == KErrNone ) + { + const TDesC& path = + media->ValueText( TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralUri ) ); + OpenDBForPathL( path ); + + // Collection + TUid collection = + media->ValueTObjectL( TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralCollectionId ) ); + + // Last modified time + TTime lastModTime; + iFs.Modified( path, lastModTime ); + + TParsePtrC parse( path ); + iCurTable->AddItemL( parse.DriveAndPath(), + parse.NameAndExt(), + lastModTime, collection.iUid, EFalse ); + iAddedCount++; + } + else if ( addErr == KErrDiskFull ) + { + User::Leave( KErrDiskFull ); + } + } + + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::AddPlaylistToCollectionL --->"); + } + +// --------------------------------------------------------------------------- +// Update Playlists in the collection +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::UpdatePlaylistToCollectionL( + CMPXMediaArray& aMediaArray ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::UpdatePlaylistToCollectionL <---"); + + // Update the collection + // + TInt count( aMediaArray.Count() ); + for (TInt i=0; iValueTObjectL(KMPXMediaGeneralCollectionId), + KMPXCommandColSetMedia, + media, + ETrue ) ); + + // Now we update them to the harvester db + // + if( setErr == KErrNone ) + { + const TDesC& filepath = + media->ValueText( TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralUri ) ); + OpenDBForPathL( filepath ); + + // Collection + const TUid& collection = + media->ValueTObjectL( TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralCollectionId ) ); + + // Last modified time + TTime lastModTime; + iFs.Modified( filepath, lastModTime ); + + iCurTable->UpdateItemL( filepath, lastModTime, collection.iUid, EFalse, !iRefreshing); + } + else if ( setErr == KErrDiskFull ) + { + User::Leave( KErrDiskFull ); + } + } + + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::UpdatePlaylistToCollectionL --->"); + } + +// --------------------------------------------------------------------------- +// Handle low disk events +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::HandleLowDiskEvent( TInt /*aDrive*/ ) + { + // Cancel the scanning process, set low disk flag to true + iOutOfDisk = ETrue; + CancelScan(); + } + +// --------------------------------------------------------------------------- +// Handle Broken Links +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::HandleBrokenLinkL( MDesCArray& aFileArray, + RArray& aColIds , + RPointerArray& aDbs, + TInt aCount ) + { + // Common local variables + // + RArray contId; + CleanupClosePushL( contId ); + contId.AppendL( KMPXMediaIdGeneral ); + contId.AppendL( KMPXMediaIdContainer ); + + RArray itemId; + CleanupClosePushL( itemId ); + itemId.AppendL( KMPXMediaIdGeneral ); + + // Remove from Collection db + // + CMPXMediaArray* musicArray = CMPXMediaArray::NewL(); + CleanupStack::PushL( musicArray ); + CMPXMediaArray* podcastArray = CMPXMediaArray::NewL(); + CleanupStack::PushL( podcastArray ); + + for(TInt j=0; jSetTObjectValueL(KMPXMediaGeneralType, + EMPXItem); + media->SetTextValueL( KMPXMediaGeneralUri, + uri ); + media->SetTObjectValueL(KMPXMediaGeneralCategory, + EMPXSong ); + media->SetTObjectValueL( KMPXMediaGeneralCollectionId, + uid ); + if( uid == iMusicCollectionId ) + { + musicArray->AppendL( media ); + } + else + { + podcastArray->AppendL( media ); + } + CleanupStack::Pop( media ); // ownership xfer + + // Cleanup harvester DB + aDbs[j]->DeleteFileL( uri ); + } + else + { + OpenDBForPathL( uri ); + + // Last modified time + TTime lastModTime; + lastModTime.HomeTime(); + + iCurTable->UpdateItemL(uri, lastModTime, uid.iUid, EFalse); + } + } + + // Package the media array and send to collection + // + if( musicArray->Count() ) + { + CMPXMedia* rootMedia = CMPXMedia::NewL( contId.Array() ); + CleanupStack::PushL( rootMedia ); + rootMedia->SetTObjectValueL( KMPXMediaGeneralType, EMPXGroup ); + rootMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXCollection ); + rootMedia->SetCObjectValueL( KMPXMediaArrayContents, musicArray ); + rootMedia->SetTObjectValueL( KMPXMediaArrayCount, musicArray->Count() ); + DoRemoveL( rootMedia, iMusicCollectionId ); + CleanupStack::PopAndDestroy( rootMedia ); + } + if( podcastArray->Count() ) + { + CMPXMedia* rootMedia = CMPXMedia::NewL( contId.Array() ); + CleanupStack::PushL( rootMedia ); + rootMedia->SetTObjectValueL( KMPXMediaGeneralType, EMPXGroup ); + rootMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXCollection ); + rootMedia->SetCObjectValueL( KMPXMediaArrayContents, podcastArray ); + rootMedia->SetTObjectValueL( KMPXMediaArrayCount, podcastArray->Count() ); + DoRemoveL( rootMedia, iPodcastCollectionId ); + CleanupStack::PopAndDestroy( rootMedia ); + } + + // Cleanup + // + CleanupStack::PopAndDestroy( podcastArray ); + CleanupStack::PopAndDestroy( musicArray ); + + contId.Reset(); + itemId.Reset(); + CleanupStack::PopAndDestroy( &itemId ); + CleanupStack::PopAndDestroy( &contId ); + } + +// --------------------------------------------------------------------------- +// Parses cenrep setting for scan paths +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::ParseScanPathL() + { + // Gets the string from cenrep, use default if leave + // string should be in the form 'item1' 'item2' + // + TBuf<255> scanPath; + TBuf<255> blockPath; + CRepository* cenrep(NULL); + TRAPD( err, cenrep = CRepository::NewL( KCRUIDHarvesterFeatures ) ); + if( err == KErrNone ) + { + cenrep->Get( KHarvesterScanPathKey, scanPath ); + cenrep->Get( KHarvesterBlockPathKey, blockPath ); + delete cenrep; + } + else + { + scanPath = KDefaultScanPath; + blockPath = KDefaultBlockPath; + } + + MPX_DEBUG2("ParseScanPathL scanPaths: %S", &scanPath); + MPX_DEBUG2("ParseScanPathL blockPaths: %S", &blockPath); + ::ExtractTokensL( scanPath, iDrivesToScan ); + ::ExtractTokensL( blockPath, iPathsToBlock ); + } + +// --------------------------------------------------------------------------- +// Parses cenrep setting for container file types +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::ParseContainersL() + { + TBuf<255> containers; + CRepository* cenrep( NULL ); + TRAPD( err, cenrep = CRepository::NewL( KCRUIDHarvesterFeatures ) ); + if( err == KErrNone ) + { + cenrep->Get( KHarvesterContainerKey, containers ); + delete cenrep; + } + else + { + containers = KDefaultContainers; + } + + MPX_DEBUG2("Container types: %S", &containers); + ::ExtractTokensL( containers, *iContainerTypes); + } + +// --------------------------------------------------------------------------- +// Parses cenrep setting for automatic scan folders +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::ParseAutoScanL() + { + // Make sure we don't insert duplicates + iFolderMonitors.ResetAndDestroy(); + + TBuf<255> folders; + CRepository* cenrep( NULL ); + TRAPD( err, cenrep = CRepository::NewL( KCRUIDHarvesterFeatures ) ); + if( err == KErrNone ) + { + err = cenrep->Get( KAutoScanDirectoryKey, folders ); + delete cenrep; + } + if( err != KErrNone ) + { + folders = KDefaultAutoScanFolder; + } + + MPX_DEBUG2("AutoScanFolders: %S", &folders); + + CDesCArrayFlat* array = new(ELeave) CDesCArrayFlat(2); + CleanupStack::PushL( array ); + ::ExtractTokensL( folders, *array); + + TInt count( array->Count() ); + for( TInt i=0; iStartL( array->MdcaPoint(i) ); + } + CleanupStack::PopAndDestroy( array ); + } + +// --------------------------------------------------------------------------- +// Resets the scanning table and array +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::Reset() + { + delete iCurTable; + iCurTable = NULL; + + if( iCurList ) + { + iCurList->ResetAndDestroy(); + delete iCurList; + iCurList = NULL; + } + iCurDB = NULL; // not owned + } + +// --------------------------------------------------------------------------- +// Handles a new file added to the collection +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::HandleNewItemL( const TDesC& aFileName ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::HandleNewItemL new file"); + + // Add it to the database + // + if( IsPlaylistFileL( aFileName ) ) + { + iPlaylistScanner->AddPlaylistToScanL( aFileName ); + } + else + { + iMetadataScanner->AddNewFileToScanL( aFileName ); + } + } + +// --------------------------------------------------------------------------- +// Handles broken items +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::HandleBrokenItemsL() + { + // Add the item to the broken links list + // + if( iCurList ) + { + TInt count( iCurList->Count() ); + for( TInt i=0; iiFile->Des(); + TInt colId = (*iCurList)[i]->iColId; + iBrokenLink->AddBrokenLinkL( filename, colId, iCurDB ); + } + } + } + +// --------------------------------------------------------------------------- +// Handles Updated items +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::HandleUpdatedItemL( const TDesC& aFile ) + { + TBool playlist = IsPlaylistFileL( aFile ); + if( playlist ) + { + iPlaylistScanner->AddUpdatedPlaylistToScanL( aFile ); + } + else + { + iMetadataScanner->AddModifiedFileToScanL( aFile ); + } + } + +// --------------------------------------------------------------------------- +// Finds the associated collection for a file +// --------------------------------------------------------------------------- +// +TInt CMPXHarvesterFileHandlerImp::CollectionForExtensionL( const TDesC& aFile ) + { + TInt index = IsMediaFileL( aFile ); + TInt val(0); + if( KErrNotFound != index ) + { + const CMPXCollectionType& type = *iSupportedTypes[index]; + val = type.Uid().iUid; + } + return val; + } + +// --------------------------------------------------------------------------- +// Setup the internal variables when opening a path +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::OpenDBForPathL( const TDesC& aPath ) + { + Reset(); + TDriveNumber num = ::ExtractDrive( aPath ); + iCurDB = &iDBManager->GetDatabaseL( num ); + iCurTable = iCurDB->OpenFileL( aPath ); + } + +// --------------------------------------------------------------------------- +// Complete a refreshing event +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::DoCompleteRefreshL( TInt aErr ) + + { + // If no error or cancel, return the final number of items added + MPX_DEBUG2("Scan error %i", aErr ); + + // Reopen databases (in case we removed them for out of disk drives before scan) + iDBManager->OpenAllDatabasesL(); + + if( aErr == KErrNone ) + { + // Commit the changes on databases in transaction + iDBManager->CommitL(); + } + else + { + // Rollback the changes on databases in transaction + iDBManager->Rollback(); + } + + if( aErr == KErrNone || aErr == KErrCancel ) + { + aErr = iAddedCount; + } + + if (iFilteredDrivesToScan.Count() != iDrivesToScan.Count()) + { + aErr = KErrDiskFull; + } + + if( iRefreshing ) + { + iCollectionUtil->Collection().NotifyL( EMcMsgRefreshEnd, aErr ); + } + iRefreshCount--; + if ( iRefreshCount < 0 ) + { + iRefreshCount = 0; + } + if( iCollectionUtil && (iRefreshCount == 0) ) + { + iCollectionUtil->Close(); + iCollectionUtil = NULL; + } + iRefreshing = EFalse; + + // Cancel disk monitors + TInt c (iDiskMonitors.Count()); + iOutOfDisk = EFalse; + + for( TInt i=0; iCancel(); + } + } + +// --------------------------------------------------------------------------- +// Issue a command to the collection +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::DoCommandL( TInt aCommandId, + TUid aCollectionId, + const TMPXAttribute& aMediaAttribute, + CMPXMedia* aMedia, + TBool aSync ) + { + CMPXCommand* cmd = CMPXCommand::NewL(); + CleanupStack::PushL( cmd ); + + cmd->SetTObjectValueL( KMPXCommandGeneralId, aCommandId ); + cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, aCollectionId.iUid ); + cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, aSync ); + if( aMedia ) + { + cmd->SetCObjectValueL( aMediaAttribute, aMedia ); + } + + + iCollectionUtil->Collection().CommandL( *cmd ); + CleanupStack::PopAndDestroy( cmd ); + } + +// --------------------------------------------------------------------------- +// Remove an item from the collection +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::DoRemoveL( CMPXMedia* aMedia, TUid aCollectionId ) + { + CMPXCommand* cmd = CMPXCommand::NewL(); + CleanupStack::PushL( cmd ); + + cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdCollectionRemoveMedia ); + cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue ); + cmd->SetTObjectValueL( KMPXCommandCollectionRemoveMediaDeleteRecord, ETrue ); + cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, aCollectionId.iUid ); + cmd->SetCObjectValueL( KMPXCommandCollectionRemoveMedia, aMedia ); + + iCollectionUtil->Collection().CommandL( *cmd ); + CleanupStack::PopAndDestroy( cmd ); + } + +// --------------------------------------------------------------------------- +// Check DB logical synchronization +// --------------------------------------------------------------------------- +// +TBool CMPXHarvesterFileHandlerImp::CheckDbInSyncL() + { + ASSERT(iCollectionUtil != NULL); + TBool needsync(EFalse); + RArray dbDrives; + + TInt dbCount(iDBManager->Count()); + for(TInt i=0; i < dbCount; ++i) + { + TInt harv_count = 0; //records count from harvester database + TInt coll_count = 0; //records count from collection database + + CMPXHarvesterDB& db = iDBManager->GetDatabaseL(i); + TDriveNumber drive = db.GetDbDrive(); + harv_count = db.CountAllFilesL(); + + //get count from music db + coll_count = GetTrackCountL(drive,iMusicCollectionId.iUid,EMPXCollectionCountTotal); + + if ( !iDisablePodcasting ) + { + //get count from podcast db + coll_count += GetTrackCountL(drive,iPodcastCollectionId.iUid,EMPXCollectionCountTrack); + } + + if(harv_count != coll_count) + { + needsync = ETrue; + dbDrives.Append(drive); + } + } + + if(needsync) + { + iDbSynchronizer->Synchronize(dbDrives,iCollectionUtil); + } + dbDrives.Close(); + + return needsync; + } + +// --------------------------------------------------------------------------- +// Idle callback from CPerioidic +// --------------------------------------------------------------------------- +// +TInt CMPXHarvesterFileHandlerImp::Callback( TAny* aPtr ) + { + TBool rtn(EFalse); + TRAP_IGNORE( rtn = ((CMPXHarvesterFileHandlerImp*)aPtr)->DoAutoScanL() ); //lint !e665 + return rtn; // done + } + +// --------------------------------------------------------------------------- +// Perform the automatic scan event +// --------------------------------------------------------------------------- +// +TBool CMPXHarvesterFileHandlerImp::DoAutoScanL() + { + TBool again(EFalse); + // Make sure to create a collection utility instance if it has not been + // + if( !iCollectionUtil ) + { + iCollectionUtil = MMPXCollectionUtility::NewL( NULL, KMusicPlayerUid ); + } + + if( !iRefreshing && !iSynchronizing ) + { + // Add a path to scan + iRefreshCount++; + CancelScan(); + Reset(); + iFolderScanner->ScanL( iAutoScanPaths ); + + // Cleanup + iAutoScanPaths.Reset(); + iIdle->Cancel(); + } + else + { + again = ETrue; + } + + return again; + } + +// --------------------------------------------------------------------------- +// Get track count for given table in the db +// --------------------------------------------------------------------------- +// +TInt CMPXHarvesterFileHandlerImp::GetTrackCountL(TDriveNumber aDrive,TInt aColDbId, TInt aColTable) + { + TInt count(0); + + //get count from music db + CMPXCommand* cmdCountM = CMPXMedia::NewL(); + CleanupStack::PushL(cmdCountM); + cmdCountM->SetTObjectValueL(KMPXCommandGeneralId, KMPXCommandCollectionGetCount); + cmdCountM->SetTObjectValueL(KMPXCommandGeneralDoSync, ETrue); + cmdCountM->SetTObjectValueL(KMPXCommandGeneralCollectionId, aColDbId); + cmdCountM->SetTObjectValueL(KMPXCommandCollectionCountDrive, aDrive); + cmdCountM->SetTObjectValueL(KMPXCommandCollectionCountTable, aColTable); + + iCollectionUtil->Collection().CommandL(*cmdCountM); + + // returned command should contain count + if (!cmdCountM->IsSupported(KMPXCommandCollectionCountValue)) + { + User::Leave(KErrAbort); + } + + count = cmdCountM->ValueTObjectL(KMPXCommandCollectionCountValue); + CleanupStack::PopAndDestroy(cmdCountM); + + return count; + } + +// --------------------------------------------------------------------------- +// Event callback from MDRMEventObserver +// --------------------------------------------------------------------------- +// +void CMPXHarvesterFileHandlerImp::HandleEventL( MDRMEvent* aEvent ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::HandleEventL <---"); + CDRMEventAddRemove *event = reinterpret_cast(aEvent); + + if( event->Status() == ERightsObjectRecieved ) + { + HBufC8 *url = event->GetContentIDL(); + CleanupStack::PushL(url); + // Convert 8 bit data to 16 bit. + TBufC rightsCid; + TPtr cidPtr( rightsCid.Des() ); + cidPtr.Copy( url->Des() ); + + // get list of files with DRM flag set + RPointerArray* list = GetDrmFilesL(); + CleanupStack::PushL( list ); + + // match incoming rights to the correct file + TBool found = EFalse; + for ( TInt i=0; iCount(); i++ ) + { + CMPXHarvesterDbItem* item = (*list)[i]; + CContent* content = CContent::NewL( item->iFile->Des() ); + CleanupStack::PushL( content ); + CData* data = content->OpenContentL( EPeek ); + CleanupStack::PushL( data ); + + // Get content ID from file + TInt err = KErrNone; + TPtr cid( NULL, 0 ); + HBufC* uniqueId( HBufC::NewLC( ContentAccess::KMaxCafUniqueId ) ); + cid.Set( uniqueId->Des() ); + err = data->GetStringAttribute( ContentAccess::EContentID, cid ); + if ( (err == KErrNone ) && (cid.Compare( cidPtr ) == 0) ) + { + // Add file for metadata scanning + iMetadataScanner->AddModifiedFileToScanL( item->iFile->Des() ); + found = ETrue; + } + CleanupStack::PopAndDestroy( 3 ); // uniqueId, data, content + } + + // Start metadata scanning if match found + if ( found ) + { + if( !iCollectionUtil ) + { + iCollectionUtil = MMPXCollectionUtility::NewL( NULL, KMusicPlayerUid ); + } + iMetadataScanner->Start(); + } + list->ResetAndDestroy(); + CleanupStack::PopAndDestroy( list ); + CleanupStack::PopAndDestroy( url ); + } + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::HandleEventL --->"); + } + +// --------------------------------------------------------------------------- +// Get a list of files with DRM flag set from the Harvester DB. +// --------------------------------------------------------------------------- +// +RPointerArray* CMPXHarvesterFileHandlerImp::GetDrmFilesL() + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::GetDrmFiles <---"); + CMPXHarvesterDB* db=NULL; // Current db reference + CMPXHarvesterDatabaseTable* table=NULL; // owned, must delete + RPointerArray* tempList=NULL; + RPointerArray* drmFileList = new (ELeave) RPointerArray; + + CleanupStack::PushL( drmFileList ); + +#ifdef RD_MULTIPLE_DRIVE + TDriveList driveList; + TInt driveCount(0); + + // Get all visible drives + if ( KErrNone == DriveInfo::GetUserVisibleDrives( + iFs, driveList, driveCount ) ) + { + for( TInt driveNum = EDriveA; driveNum <= EDriveZ; driveNum++ ) + { + if ( driveList[driveNum] ) + { + TDriveNumber drive = (TDriveNumber)driveNum; + // Get DRM files from database + db = &iDBManager->GetDatabaseL( drive ); + table = db->OpenDrmFileL(); + CleanupStack::PushL( table ); + tempList = table->CreateTableRepresentationL(); + CleanupStack::PushL( tempList ); + // copy content to drm file list + for ( TInt i=0; iCount(); i++ ) + { + drmFileList->AppendL( (*tempList)[i] ); + } + // reset + tempList->Reset(); + CleanupStack::PopAndDestroy( tempList ); + CleanupStack::PopAndDestroy( table ); + } + } + } +#else + //ensure drive E is ready + //otherwise GetDataBaseL will leave if MMC is removed + if ( IsDriveReady( EDriveE ) ) + { + // Get DRM files from database in E drive + db = &iDBManager->GetDatabaseL( EDriveE ); + table = db->OpenDrmFileL(); + CleanupStack::PushL( table ); + tempList = table->CreateTableRepresentationL(); + CleanupStack::PushL( tempList ); + // copy content to drm file list + for ( TInt i=0; iCount(); i++ ) + { + drmFileList->AppendL( (*tempList)[i] ); + } + // reset + tempList->Reset(); + CleanupStack::PopAndDestroy( tempList ); + CleanupStack::PopAndDestroy( table ); + } + + // Get DRM files from database in C drive + db = &iDBManager->GetDatabaseL( EDriveC ); + table = db->OpenDrmFileL(); + CleanupStack::PushL( table ); + tempList = table->CreateTableRepresentationL(); + CleanupStack::PushL( tempList ); + // copy content to iCurList + for ( TInt i=0; iCount(); i++ ) + { + drmFileList->AppendL( (*tempList)[i] ); + } + tempList->Reset(); + CleanupStack::PopAndDestroy( tempList ); + CleanupStack::PopAndDestroy( table ); +#endif + CleanupStack::Pop( drmFileList ); + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::GetDrmFiles --->"); + return drmFileList; + } + +// --------------------------------------------------------------------------- +// Verifies if aDrive is ready. +// --------------------------------------------------------------------------- +// +TBool CMPXHarvesterFileHandlerImp::IsDriveReady( TDriveNumber aDrive ) + { + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::IsDriveReady <---"); + + TDriveInfo driveInfo; + TInt error = iFs.Drive( driveInfo, aDrive ); + TBool ready = ETrue; + if ( error != KErrNone ) + { + ready = EFalse; + } + else if ( driveInfo.iDriveAtt == static_cast( KDriveAbsent ) ) + { + //aDrive is absent + ready = EFalse; + } + else + { + TVolumeInfo volumeInfo; + TInt errCode = iFs.Volume( volumeInfo, aDrive ); + if( errCode != KErrNone ) + { + //aDrive is ready for use + ready = EFalse; + } + } + + MPX_DEBUG1("CMPXHarvesterFileHandlerImp::IsDriveReady --->"); + return ready; + } + +// END OF FILE diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/src/mpxmetadatascanner.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/src/mpxmetadatascanner.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,354 @@ +/* +* Copyright (c) 2006 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: Active object to extract metadata +* Version : %version: da1mmcf#16.2.3.1.5 % +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mpxmetadatascanner.h" +#include "mpxmetadatascanobserver.h" +#include "mpxfilescanstateobserver.h" + +// CONSTANTS +const TInt KLoopCount = 10; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Private Constructor +// --------------------------------------------------------------------------- +// +CMPXMetadataScanner::CMPXMetadataScanner( MMPXMetadataScanObserver& aObs, + MMPXFileScanStateObserver& aStateObs ) + : CActive( EPriorityNull ), + iObserver( aObs ), + iStateObserver( aStateObs ) + { + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------------------------- +// 2nd Phase Constructor +// --------------------------------------------------------------------------- +// +void CMPXMetadataScanner::ConstructL( RFs& aFs, + RApaLsSession& aAppArc, + RPointerArray& aTypesAry ) + { + iExtractor = CMPXMetadataExtractor::NewL( aFs, aAppArc, aTypesAry ); + iNewFileProps = CMPXMediaArray::NewL(); + iModifiedFileProps = CMPXMediaArray::NewL(); + } + + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXMetadataScanner* CMPXMetadataScanner::NewL( RFs& aFs, + RApaLsSession& aAppArc, + RPointerArray& aTypesAry, + MMPXMetadataScanObserver& aObs, + MMPXFileScanStateObserver& aStateObs ) + { + CMPXMetadataScanner* self = CMPXMetadataScanner::NewLC( aFs, + aAppArc, + aTypesAry, + aObs, + aStateObs ); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXMetadataScanner* CMPXMetadataScanner::NewLC( RFs& aFs, + RApaLsSession& aAppArc, + RPointerArray& aTypesAry, + MMPXMetadataScanObserver& aObs, + MMPXFileScanStateObserver& aStateObs ) + { + CMPXMetadataScanner* self = new( ELeave ) CMPXMetadataScanner( aObs, + aStateObs ); + CleanupStack::PushL( self ); + self->ConstructL( aFs, aAppArc, aTypesAry ); + return self; + } + + +// --------------------------------------------------------------------------- +// Virtual Destructor +// --------------------------------------------------------------------------- +// +CMPXMetadataScanner::~CMPXMetadataScanner() + { + Cancel(); + Reset(); + iNewFiles.Close(); + iModifiedFiles.Close(); + + delete iNewFileProps; + delete iModifiedFileProps; + + delete iExtractor; + } + +// --------------------------------------------------------------------------- +// Resets this object +// --------------------------------------------------------------------------- +// +void CMPXMetadataScanner::Reset() + { + iNewFiles.ResetAndDestroy(); + iModifiedFiles.ResetAndDestroy(); + if(iNewFileProps) + { + iNewFileProps->Reset(); + } + if(iModifiedFileProps) + { + iModifiedFileProps->Reset(); + } + } + +// --------------------------------------------------------------------------- +// Starts the metadata extraction process +// --------------------------------------------------------------------------- +// +void CMPXMetadataScanner::Start() + { + MPX_DEBUG1("MPXMetadataScanner::StartL <---"); + if( !IsActive() ) + { + // Setup + iAryPos = 0; + iExtractType = ENewFiles; + iExtracting = ETrue; + + // Set Active + iStatus = KRequestPending; + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + MPX_DEBUG1("MPXMetadataScanner::StartL --->"); + } + } +// --------------------------------------------------------------------------- +// Stops the metadata extraction process +// --------------------------------------------------------------------------- +// +void CMPXMetadataScanner::Stop() + { + MPX_DEBUG1("MPXMetadataScanner::Stop <---"); + DoCancel(); + MPX_DEBUG1("MPXMetadataScanner::Stop --->"); + } + +// --------------------------------------------------------------------------- +// Add a file to the scanning list +// --------------------------------------------------------------------------- +// +void CMPXMetadataScanner::AddNewFileToScanL( const TDesC& aFile ) + { + HBufC* file = aFile.AllocLC(); + iNewFiles.AppendL( file ); + CleanupStack::Pop( file ); + } + +// --------------------------------------------------------------------------- +// Add a file to the modified list +// --------------------------------------------------------------------------- +// +void CMPXMetadataScanner::AddModifiedFileToScanL( const TDesC& aFile ) + { + HBufC* file = aFile.AllocLC(); + iModifiedFiles.AppendL( file ); + CleanupStack::Pop( file ); + } + +// --------------------------------------------------------------------------- +// Extract media properties for a file +// --------------------------------------------------------------------------- +// +CMPXMedia* CMPXMetadataScanner::ExtractFileL( const TDesC& aFile ) + { + CMPXMedia* media; + iExtractor->CreateMediaL( aFile, media ); + return media; + } + +// --------------------------------------------------------------------------- +// Cancel the operation +// --------------------------------------------------------------------------- +// +void CMPXMetadataScanner::DoCancel() + { + if( iExtracting ) + { + // Callback to observer + Reset(); + TRAP_IGNORE( iStateObserver.HandleScanStateCompleteL( MMPXFileScanStateObserver::EScanMetadata, + KErrCancel ) ); + iExtracting = EFalse; + } + } + +// --------------------------------------------------------------------------- +// RunL function +// --------------------------------------------------------------------------- +// +void CMPXMetadataScanner::RunL() + { + if ( iExtracting ) + { + TBool done(EFalse); + TRAPD( err, done = DoExtractL() ); + if ( !iExtracting ) + { + // If DoCancel() was called during DoExtractL(), do nothing. + MPX_DEBUG1("CMPXMetadataScanner::RunL - Cancel during RunL"); + } + else if( KErrNone != err || done ) + { + // Callback to observer + TRAP_IGNORE( iStateObserver.HandleScanStateCompleteL( MMPXFileScanStateObserver::EScanMetadata, + err ) ); + iExtracting = EFalse; + } + else + { + MPX_DEBUG1("CMPXMetadataScanner::RunL -- Run again"); + iStatus = KRequestPending; + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + } + } + +// --------------------------------------------------------------------------- +// Extract metadata +// --------------------------------------------------------------------------- +// +TBool CMPXMetadataScanner::DoExtractL() + { + MPX_DEBUG1("CMPXMetadataScanner::DoExtractL <---"); + TBool done(EFalse); + TExtractType curType = (TExtractType) iExtractType; + + // Pointer re-direction to generalize extraction + RPointerArray* source; + CMPXMediaArray* mptarget; + if( curType == ENewFiles ) + { + source = &iNewFiles; + mptarget = iNewFileProps; + } + else if( curType == EModFiles ) + { + source = &iModifiedFiles; + mptarget = iModifiedFileProps; + } + else // All done! + { + return ETrue; + } + + // Process at most KLoopCount number of files + // + mptarget->Reset(); + if( source->Count() != 0 ) + { + for( TInt i=0; iCreateMediaL( *(*source)[iAryPos], media ) ); + if ( !iExtracting ) + { + // In case DoCancel() was called while processing iExtractor->CreateMediaL + MPX_DEBUG1("CMPXMetadataScanner::DoExtractL - Cancel during CreateMediaL"); + delete media; + return ETrue; + } + + if( err == KErrNone ) + { + CleanupStack::PushL( media ); + mptarget->AppendL( media ); + CleanupStack::Pop( media ); + } + + iAryPos++; + if( iAryPos == source->Count() ) + { + iAryPos = 0; + iExtractType++; + break; + } + } + } + else // No item in the array + { + iAryPos = 0; + iExtractType++; + } + + // After extraction, get observer to add files to the collection + // + switch( curType ) + { + case ENewFiles: + { + if( iNewFileProps->Count() ) + { + iObserver.AddFilesToCollectionL( *iNewFileProps ); + } + break; + } + case EModFiles: + { + if( iModifiedFileProps->Count() ) + { + iObserver.UpdatesFilesInCollectionL( *iModifiedFileProps ); + } + break; + } + case EMaxFile: // All done. + done = ETrue; + break; + default: + ASSERT(0); + } + + MPX_DEBUG1("CMPXMetadataScanner::DoExtractL --->"); + return done; + } diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/filehandler/src/mpxplaylistscanner.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/filehandler/src/mpxplaylistscanner.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,335 @@ +/* +* Copyright (c) 2006 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: Class to handle playlist extraction +* +*/ + + +#include +#include +#include +#include +#include +#include +#include "mpxplaylistscanner.h" +#include "mpxplaylistscanobserver.h" +#include "mpxfilescanstateobserver.h" + +// CONSTANTS +const TInt KExtractionCount = 2; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Default constructor +// --------------------------------------------------------------------------- +// +CMPXPlaylistScanner::CMPXPlaylistScanner( MMPXPlaylistScanObserver& aObs, + MMPXFileScanStateObserver& aStateObs, + RPointerArray& aTypes ) : + iObserver( aObs ), + iStateObserver( aStateObs ), + iSupportedTypes(aTypes) + { + } + + +// --------------------------------------------------------------------------- +// 2nd phase constructor +// --------------------------------------------------------------------------- +// +void CMPXPlaylistScanner::ConstructL() + { + iPlEngine = CMPXPlaylistEngine::NewL( *this ); + iPlList = new(ELeave) CDesCArrayFlat(1); // granularity + iPlUpdateList = new(ELeave) CDesCArrayFlat(1); // granularity + + iPropArray = CMPXMediaArray::NewL(); + iUpdatePropArray = CMPXMediaArray::NewL(); + } + + +// --------------------------------------------------------------------------- +// Two Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXPlaylistScanner* CMPXPlaylistScanner::NewL( + MMPXPlaylistScanObserver& aObs, + MMPXFileScanStateObserver& aStateObs, + RPointerArray& aTypes ) + { + CMPXPlaylistScanner* self = new(ELeave) CMPXPlaylistScanner( aObs, + aStateObs, + aTypes ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Virtual destructor +// --------------------------------------------------------------------------- +// +CMPXPlaylistScanner::~CMPXPlaylistScanner() + { + if( iPlList ) + { + iPlList->Reset(); + delete iPlList; + } + if( iPlUpdateList ) + { + iPlUpdateList->Reset(); + delete iPlUpdateList; + } + + if( iPropArray ) + { + iPropArray->Reset(); + } + delete iPropArray; + + if( iUpdatePropArray ) + { + iUpdatePropArray->Reset(); + } + delete iUpdatePropArray; + + if( iPlEngine ) + { + iPlEngine->CancelRequests(); + } + delete iPlEngine; + } + +// --------------------------------------------------------------------------- +// Start the playlist scanning procedure +// --------------------------------------------------------------------------- +// +void CMPXPlaylistScanner::ScanL() + { + iNewPlPending = iPlList->Count(); + iUpdatePlPending = iPlUpdateList->Count(); + + // Add all files in the list to the playlist engine queue. + // + if( iNewPlPending || iUpdatePlPending ) + { + for( TInt i=0; iInternalizePlaylistL( (*iPlList)[i] ); + } + for( TInt i=0; iInternalizePlaylistL( (*iPlUpdateList)[i] ); + } + iExtracting = ETrue; + } + // No files to extract + // + else + { + iStateObserver.HandleScanStateCompleteL( MMPXFileScanStateObserver::EScanPlaylists, + KErrNone ); + } + } + +// --------------------------------------------------------------------------- +// Cancel the playlist scanning procedure +// --------------------------------------------------------------------------- +// +void CMPXPlaylistScanner::Cancel() + { + if( iExtracting ) + { + iPlEngine->CancelRequests(); + iExtracting = EFalse; + TRAP_IGNORE(iStateObserver.HandleScanStateCompleteL( MMPXFileScanStateObserver::EScanPlaylists, + KErrCancel ); + ); + } + } + +// --------------------------------------------------------------------------- +// Reset the object +// --------------------------------------------------------------------------- +// +void CMPXPlaylistScanner::Reset() + { + iPlList->Reset(); + iPlUpdateList->Reset(); + iPropArray->Reset(); + iUpdatePropArray->Reset(); + } + +// --------------------------------------------------------------------------- +// Add a file to the list to be extracted +// --------------------------------------------------------------------------- +// +void CMPXPlaylistScanner::AddPlaylistToScanL( const TDesC& aFile ) + { + iPlList->AppendL( aFile ); + } + +// --------------------------------------------------------------------------- +// Add a file to the list to be updated +// --------------------------------------------------------------------------- +// +void CMPXPlaylistScanner::AddUpdatedPlaylistToScanL( const TDesC& aFile ) + { + iPlUpdateList->AppendL( aFile ); + } + +// --------------------------------------------------------------------------- +// Handles playlist import +// Note: aCompleted is not in use for Increment 8, for future usage. +// --------------------------------------------------------------------------- +// +void CMPXPlaylistScanner::HandlePlaylistL( CMPXMedia* aPlaylist, + const TInt aError, + const TBool /*aCompleted*/ ) + { + // Only add parsable playlists + // + if( aError == KErrNone ) + { + // We take ownership of the media object + // + CleanupStack::PushL( aPlaylist ); + + // Find what collection this belongs to + // + const TDesC& file = aPlaylist->ValueText( + TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralUri)); + TParsePtrC parse( file ); + TInt index(KErrNotFound); + TInt count( iSupportedTypes.Count() ); + for (TInt i=0; i Extensions(); + if (!exts.FindIsq(parse.Ext(), index2)) + { // found + index = i; + break; + } + } + + // Found? + if( index == KErrNotFound ) + { + // Unsupported by a collection + // + CleanupStack::PopAndDestroy( aPlaylist ); + } + else + { + // Set collection ID and add to array + // + aPlaylist->SetTObjectValueL( TMPXAttribute( KMPXMediaIdGeneral, + EMPXMediaGeneralCollectionId), + iSupportedTypes[index]->Uid() ); + if( iNewPlPending ) + { + iPropArray->AppendL( aPlaylist ); // owned by array + } + else + { + iUpdatePropArray->AppendL( aPlaylist ); // owned by array + } + CleanupStack::Pop( aPlaylist ); + } + } + else // an error occured + { + // Playlist engine should have set this to NULL + // (Just in case) + delete aPlaylist; + } + + if( iNewPlPending ) + { + iNewPlPending--; + } + else // Some update ones pending + { + iUpdatePlPending--; + } + + // All done! + // + TInt pending = iNewPlPending + iUpdatePlPending; + if( pending == 0 && iExtracting ) + { + CompleteFilesL(); + iExtracting = EFalse; + + iStateObserver.HandleScanStateCompleteL( MMPXFileScanStateObserver::EScanPlaylists, + KErrNone ); + } + // Enough to send to the collection + // + else if( iPropArray->Count() + iUpdatePropArray->Count() + == KExtractionCount ) + { + CompleteFilesL(); + } + } //lint !e961 + +// --------------------------------------------------------------------------- +// Handles Playlist export to a file +// --------------------------------------------------------------------------- +// +void CMPXPlaylistScanner::HandlePlaylistL(const TDesC& /*aPlaylistUri*/, + const TInt /*aError*/) + { + // not used + } + +// --------------------------------------------------------------------------- +// Checks if a file is a playlist file +// --------------------------------------------------------------------------- +// +TBool CMPXPlaylistScanner::IsPlaylistFileL( const TDesC& aFile ) + { + return iPlEngine->IsPlaylistL( aFile ); + } + +// --------------------------------------------------------------------------- +// Upload the next list of files +// --------------------------------------------------------------------------- +// +void CMPXPlaylistScanner::CompleteFilesL() + { + TInt err(KErrNone); + if( iPropArray->Count() ) + { + TRAP( err, iObserver.AddPlaylistToCollectionL( *iPropArray ) ); + } + if( iUpdatePropArray->Count() ) + { + TRAP( err, iObserver.UpdatePlaylistToCollectionL( *iUpdatePropArray ) ); + } + + if( err != KErrNone ) + { + // Cancel requests and notify end + iStateObserver.HandleScanStateCompleteL( MMPXFileScanStateObserver::EScanPlaylists, + err ); + iPlEngine->CancelRequests(); + } + Reset(); + } + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2006 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 for project Harvester subsystem +* +*/ + + +#include + +#include "../collectionmediator/group/bld.inf" +#include "../metadataextractor/group/bld.inf" +#include "../filehandler/group/bld.inf" +#include "../server/group/bld.inf" +#include "../utility/group/bld.inf" + +PRJ_EXPORTS +../rom/mpxharvester.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mpxharvester.iby) +../rom/mpxharvesterrsc.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(mpxharvesterrsc.iby) + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/inc/mpxharvesterfilehandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/inc/mpxharvesterfilehandler.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,151 @@ +/* +* Copyright (c) 2006 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 handler class to handle file scanning related events +* +*/ + + +#ifndef CMPXHARVESTERFILEHANDLER_H +#define CMPXHARVESTERFILEHANDLER_H + +#include +#include +#include +#include + +// Foward Declaration +class CMPXMedia; + +/** + * File handler class to handle file scanning related events + * + * @lib mpxfilehandler.lib + * @since S60 3.0 + */ +class CMPXHarvesterFileHandler : public CBase + + { +public: + + /** + * Two-Phased Constructor + * @param aFs file server session + */ + IMPORT_C static CMPXHarvesterFileHandler* NewL( RFs& aFs ); + + /** + * Virtual destructor + */ + virtual ~CMPXHarvesterFileHandler(); + + /** + * Scan all drives for files + */ + virtual void ScanL() = 0; + + /** + * Cancel the scanning operation + */ + virtual void CancelScan() = 0; + + /** + * Handles a system event + * @param aEvent, the event + * @param aData, event specific data + */ + virtual void HandleSystemEventL( TSystemEvent aEvent, + TInt aData ) = 0; + + /** + * Add a file to the db + * @param aPath File to add + * @return CMPXMedia object for the item pointed to by aPath + * ownership transferred + */ + virtual CMPXMedia* AddFileL( const TDesC& aPath ) = 0; + + /** + * Add a file to the db + * @param aMediaProp Media Property to add + * @return TInt collection ID for the item added + */ + virtual TInt AddFileL( CMPXMedia& aMediaProp ) = 0; + + /** + * Remove a file from the db + * @param aPath, File to remove + * @return Collection ID of the removed file + */ + virtual TInt RemoveFileL( const TDesC& aPath, TBool aEndTransaction ) = 0; + + /** + * Remove multiple files from the db + * @param aArray, array of files to remove + */ + virtual void RemoveFilesL( const MDesCArray& aFilePaths ) = 0; + + /** + * Remove all files from the db + */ + virtual void RemoveAllFilesL() = 0; + + /** + * Update a file with a new collection and time stamp + * @param aFile, file path + * @param aCollection, Collection ID (UID) + */ + virtual void UpdateFileL( const TDesC& aFile, TInt aCollection ) = 0; + + /** + * Rename a file + * @param aOldPath, the existing file path + * @param aNewPath, the new file path + * @param aCollection, Collection ID (UID) + */ + virtual void RenameFileL( const TDesC& aOldPath, const TDesC& aNewPath, TInt aCollection ) = 0; + + /** + * Find the associated collection ID with a file + * @return TInt containing the associated collection ID for a file + */ + virtual TInt FindCollectionIdL( const TDesC& aFile ) = 0; + + /** + * Recreate the harvester database + * (To handle corruption ) + */ + virtual void RecreateDatabases() = 0; + + /** + * Close harvester database transaction + */ + virtual void CloseTransactionL() = 0; + + /** + * Get a media object for the file + * @param aPath File to add + * @return CMPXMedia object for the item pointed to by aPath + * ownership transferred + */ + virtual CMPXMedia* GetMediaForFileL( const TDesC& aPath ) = 0; + + /** + * Get Collection Uid for the file + * @param aMediaProp Media Property to add + * @return TInt collection ID for the item added + */ + virtual TInt GetColUidForFileL( const TDesC& aPath ) = 0; + }; + +#endif // CMPXHARVESTERFILEHANDLER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/metadataextractor/bwinscw/mpxmetadataextractorU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/metadataextractor/bwinscw/mpxmetadataextractorU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,5 @@ +EXPORTS + ?CreateMediaL@CMPXMetadataExtractor@@QAEXABVTDesC16@@AAPAVCMPXMedia@@H@Z @ 1 NONAME ; void CMPXMetadataExtractor::CreateMediaL(class TDesC16 const &, class CMPXMedia * &, int) + ?NewL@CMPXMetadataExtractor@@SAPAV1@AAVRFs@@AAVRApaLsSession@@AAV?$RPointerArray@VCMPXCollectionType@@@@@Z @ 2 NONAME ; class CMPXMetadataExtractor * CMPXMetadataExtractor::NewL(class RFs &, class RApaLsSession &, class RPointerArray &) + ?ExtractAlbumArtL@CMPXMetadataExtractor@@QAEHPAVCMPXMedia@@@Z @ 3 NONAME ; int CMPXMetadataExtractor::ExtractAlbumArtL(class CMPXMedia *) + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/metadataextractor/eabi/mpxmetadataextractorU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/metadataextractor/eabi/mpxmetadataextractorU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,9 @@ +EXPORTS + _ZN21CMPXMetadataExtractor12CreateMediaLERK7TDesC16RP9CMPXMediai @ 1 NONAME + _ZN21CMPXMetadataExtractor4NewLER3RFsR13RApaLsSessionR13RPointerArrayI18CMPXCollectionTypeE @ 2 NONAME + _ZTI19CMPXFileInfoUtility @ 3 NONAME ; ## + _ZTI21CMPXMetadataExtractor @ 4 NONAME ; ## + _ZTV19CMPXFileInfoUtility @ 5 NONAME ; ## + _ZTV21CMPXMetadataExtractor @ 6 NONAME ; ## + _ZN21CMPXMetadataExtractor16ExtractAlbumArtLEP9CMPXMedia @ 7 NONAME + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/metadataextractor/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/metadataextractor/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2006 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 Metadata extractor +* +*/ + + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +mpxmetadataextractor.mmp \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/metadataextractor/group/mpxmetadataextractor.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/metadataextractor/group/mpxmetadataextractor.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2007 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 extractor subcomponent +* +*/ + + +#include +#include +#include + +TARGET mpxmetadataextractor.dll +TARGETTYPE dll +UID 0x1000006C 0x10282958 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +MACRO RD_MPX_TNM_INTEGRATION +#define RD_MPX_TNM_INTEGRATION + +SOURCEPATH ../src +SOURCE mpxmetadataextractor.cpp +SOURCE mpxfileinfoutility.cpp + +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY apgrfx.lib +LIBRARY apmime.lib +LIBRARY bafl.lib +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY ecom.lib +LIBRARY estor.lib +LIBRARY metadatautility.lib + +LIBRARY mmfcontrollerframework.lib +LIBRARY mmfstandardcustomcommands.lib +LIBRARY mpxcommon.lib + +LIBRARY SysUtil.lib +LIBRARY thumbnailmanager.lib + +#if defined(ARMCC) +deffile ../eabi/ +#elif defined(WINSCW) +deffile ../bwinscw/ +#endif diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/metadataextractor/inc/mpxfileinfoutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/metadataextractor/inc/mpxfileinfoutility.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,138 @@ +/* +* Copyright (c) 2006 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 class is responsible for getting MMF file information +* +*/ + + + +#ifndef CMPXFILEINFOUTILITY_H +#define CMPXFILEINFOUTILITY_H + +// INCLUDES +#include +#include +#include +#include + +// CLASS DECLARATION + +/** +* File info utility class +*/ +class CMPXFileInfoUtility : public CBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor: Normal C++ constructor & ConstructL. + */ + static CMPXFileInfoUtility* NewL(); + + /** + * Two-phased constructor: Normal C++ constructor & ConstructL. + */ + static CMPXFileInfoUtility* NewLC(); + + /** + * Destructor + * Destroy the object and release all memory objects + */ + virtual ~CMPXFileInfoUtility(); + + public: // New functions + + /** + * Open a file using audio controller. + * The file is opened based on MIME type given mime type. + * If MIME type is not provided, the file is opened by file handle + * @param aFile, file handle + * @param aMimeType, mime type of the file, by default it is KNullDesC + */ + void OpenFileL(RFile& aFile, + const TDesC& aMimeType = KNullDesC); + /** + * Reset file info utility + */ + void Reset(); + + /** + * Get the duration of a song + * @return duration with micro seconds + */ + TTimeIntervalMicroSeconds Duration(); + + /** + * Get the bit rate of a song + * @return the bit rate of the song + */ + TUint BitRate(); + + /** + * Get the sample rate of a song + * @return the sample rate of the song + */ + TUint SampleRate(); + + private: + + /** + * C++ default constructor + */ + CMPXFileInfoUtility(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Find a controller + * The controller is searched by MIME type. If MIME type is empty, + * the controller is searched by file name + * @param aFileName file name + * @param aMimeType, mime type of the file + * @param aUid uid of the controller + */ + void FindController( const TDesC& aFileName, + const TDesC& aMimeType, + TUid& aUid); + + /** + * Open a controller + * @param aUid uid of the controller + */ + void OpenControllerL(const TUid& aUid); + + /** + * Create an array to hold all the controller plugins that support audio + */ + void CreateAudioFormatsArrayL(); + + private: // Member variables + + // Controller for music file + RPtrHashMap iMMFControllers; + RMMFController *iController; + TUint32 iCurrentControllerUid; + TUint32 iUid1; + TUint32 iUid2; + + RMMFControllerImplInfoArray iAudioControllers; + }; + +#endif // CMPXFILEINFOUTILITY_H + +// End of File + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/metadataextractor/src/mpxfileinfoutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/metadataextractor/src/mpxfileinfoutility.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,386 @@ +/* +* Copyright (c) 2005 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 class is responsible for reading file info +* Version : %version: da1mmcf#5.1.3.1.6 % << Don't touch! Updated by Synergy at check-out. +* +* Copyright © 2005 Nokia. All rights reserved. +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include "mpxfileinfoutility.h" +using namespace ContentAccess; + +// CONSTANTS +const TInt KMCExpandSize = 100; + +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CMPXFileInfoUtility* CMPXFileInfoUtility::NewL() + { + CMPXFileInfoUtility* self = NewLC(); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------------------------- +// Two-phased constructor, leave object pointer in the cleanup stack +// ---------------------------------------------------------------------------- +// +CMPXFileInfoUtility* CMPXFileInfoUtility::NewLC() + { + CMPXFileInfoUtility* self = new (ELeave) CMPXFileInfoUtility(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// ---------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that might leave +// ---------------------------------------------------------------------------- +// +CMPXFileInfoUtility::CMPXFileInfoUtility(): iCurrentControllerUid(NULL) + { + } + +// Destructor +CMPXFileInfoUtility::~CMPXFileInfoUtility() + { + iAudioControllers.ResetAndDestroy(); + //Reset(); + // Close all MMF controllers in the cache + TPtrHashMapIter iter(iMMFControllers); + RMMFController* controller; + + while((controller = const_cast(iter.NextValue())) != NULL) + { + controller->Close(); + } + + iMMFControllers.ResetAndDestroy(); + iMMFControllers.Close(); + + // delete non cached controller + if(iController) + { + iController->Close(); + delete iController; + iController = NULL; + } + + REComSession::FinalClose(); + } + +// ---------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ---------------------------------------------------------------------------- +// +void CMPXFileInfoUtility::ConstructL() + { + CreateAudioFormatsArrayL(); + } + +// ---------------------------------------------------------------------------- +// Open a file using audio controller +// ---------------------------------------------------------------------------- +// +void CMPXFileInfoUtility::OpenFileL(RFile& aFile, + const TDesC& aMimeType /*= KNullDesC*/) + { + MPX_DEBUG1("CMPXFileInfoUtility::OpenFileL()"); + Reset(); + + HBufC* fileNameBuf = HBufC::NewLC(KMaxFileName); + TPtr fileName = fileNameBuf->Des(); + aFile.FullName(fileName); + + TUid pluginUid; + FindController(fileName, aMimeType, pluginUid); + CleanupStack::PopAndDestroy(fileNameBuf); + + // Open a new controller + OpenControllerL(pluginUid); + TMMFMessageDestination dataSource; + + TPtrC defaultID(KDefaultContentObject); + TBool enableUI = EFalse; + + //Code taken from TMMFileHandleSource + + + //{//build custom mmf message packet + //based on CMMFileSourceSink::DoCreateFileHandleSourceConfigDataL() + CBufFlat* buf = CBufFlat::NewL(KMCExpandSize); + CleanupStack::PushL(buf); + RBufWriteStream stream; + stream.Open(*buf); + CleanupClosePushL(stream); + + TPckgBuf fileptr(&aFile); + stream.WriteInt32L(KMMFileHandleSourceUid.iUid); + stream.WriteL(fileptr); + + //Code taken from TMMFileHandleSource + + TInt length = 0; + //if (defaultID != NULL) + length = defaultID.Length(); + stream.WriteInt32L(length); + //if (length>0) + stream.WriteL(defaultID); + + stream.WriteInt32L(enableUI); + + stream.CommitL(); + CleanupStack::PopAndDestroy(&stream); + //iSourceSinkData = buf->Ptr(0).AllocL(); + + //CleanupStack::PopAndDestroy(buf); + //} + + // User::LeaveIfError(iController->Reset()); + + + // Add new data source + User::LeaveIfError(iController->AddDataSource(KUidMmfFileSource, + buf->Ptr(0), + dataSource)); + + User::LeaveIfError(iController->AddDataSink(KUidMmfAudioOutput, + KNullDesC8)); + CleanupStack::PopAndDestroy(buf); + } + +// ---------------------------------------------------------------------------- +// Reset file info utility +// ---------------------------------------------------------------------------- +// +void CMPXFileInfoUtility::Reset() + { + // Reset the controller + if(iController) + { + if(iCurrentControllerUid == 0x101FAFB1 || iCurrentControllerUid == 0x10283351 + || iCurrentControllerUid == 0x10207B65 ) + { + iController->Close(); + delete iController; + iController = NULL; + } + else + { + iController->Reset(); + } + } + + } + +// ---------------------------------------------------------------------------- +// Get the duration of a song +// ---------------------------------------------------------------------------- +// +TTimeIntervalMicroSeconds CMPXFileInfoUtility::Duration() + { + MPX_DEBUG1("CMPXFileInfoUtility::Duration()"); + TTimeIntervalMicroSeconds duration; + TInt err = iController->GetDuration(duration); + if(err != KErrNone) + { + duration = TInt64(0); + } + return duration; + } + +// ---------------------------------------------------------------------------- +// Get the bit rate of a song +// ---------------------------------------------------------------------------- +// +TUint CMPXFileInfoUtility::BitRate() + { + RMMFAudioControllerCustomCommands customCommands(*iController); + + TUint bitRate(0); + //Ignore return value, bitRate remain 0 if error + customCommands.GetSourceBitRate(bitRate); + return bitRate; + } + +// ---------------------------------------------------------------------------- +// Get the sample rate of a song +// ---------------------------------------------------------------------------- +// +TUint CMPXFileInfoUtility::SampleRate() + { + RMMFAudioControllerCustomCommands customCommands(*iController); + + TUint sampleRate(0) ; + //Ignore return value, sampleRate remain 0 if error + customCommands.GetSourceSampleRate(sampleRate); + return sampleRate; + } + +// ---------------------------------------------------------------------------- +// Find a controller based on mime type, then file name +// ---------------------------------------------------------------------------- +void CMPXFileInfoUtility::FindController(const TDesC& aFileName, + const TDesC& aMimeType, + TUid& aUid) + { + MPX_DEBUG1("CMPXFileInfoUtility::FindControllerL()"); + TBool found(EFalse); + TInt i(0); + TInt j(0); + TInt count = iAudioControllers.Count(); + + // try with MIME type + if (aMimeType.Length() > 0) + { + TBuf8 mimeType; + mimeType.Copy(aMimeType); + for (i = 0 ; !found && i < count; i++) + { + RMMFFormatImplInfoArray formats = + iAudioControllers[i]->PlayFormats(); + for (j = 0; j < formats.Count() ; j++) + { + if (formats[j]->SupportsMimeType(mimeType)) + { + aUid = iAudioControllers[i]->Uid(); + found = ETrue; + break; + } + } + } + } + // try file extension + if (!found) + { + TParsePtrC parser(aFileName); + TBuf8 fileExtension; + fileExtension.Copy(parser.Ext()); + for (i = 0 ; !found && i < count; i++) + { + RMMFFormatImplInfoArray formats = + iAudioControllers[i]->PlayFormats(); + for (j = 0; j < formats.Count() ; j++) + { + if (formats[j]->SupportsFileExtension(fileExtension)) + { + aUid = iAudioControllers[i]->Uid(); + found = ETrue; + break; + } + } + } + } + } + +// ---------------------------------------------------------------------------- +// Open a controller based on file name +// The Controller Framework APIs are made of three distinct areas: choosing a +// controller plugin, loading and controlling a controller plugin, and custom +// commands. +// ---------------------------------------------------------------------------- +void CMPXFileInfoUtility::OpenControllerL(const TUid& aUid) + { + MPX_DEBUG1("CMPXFileInfoUtility::OpenControllerL()"); + + // 3gp and helix (wma) do not allow controller caching + if(aUid.iUid == 0x101FAFB1 || aUid.iUid == 0x10283351 + || aUid.iUid == 0x10207B65 ) + { + iCurrentControllerUid = aUid.iUid; + TMMFPrioritySettings prioritySettings; + prioritySettings.iPriority = EMdaPriorityNormal; + prioritySettings.iPref = EMdaPriorityPreferenceTimeAndQuality; + + iController = new (ELeave) RMMFController; + + // Controller loading + User::LeaveIfError(iController->Open(aUid, prioritySettings)); + + iCurrentControllerUid = aUid.iUid; + return; + } + + // check if we already have controller open for this UID in the cache + RMMFController* controller = const_cast(iMMFControllers.Find(aUid.iUid)); + + if(!controller) + { + // Controller not found from the cache + + // Allocate and open new controller for this UID + controller = new (ELeave) RMMFController; + CleanupStack::PushL(controller); + + TUint32* key = new (ELeave) TUint32(aUid.iUid); + CleanupStack::PushL(key); + // Now instantiate the first controller in the array + TMMFPrioritySettings prioritySettings; + prioritySettings.iPriority = EMdaPriorityNormal; + prioritySettings.iPref = EMdaPriorityPreferenceTimeAndQuality; + + // Try to open controller + User::LeaveIfError(controller->Open(aUid, + prioritySettings)); + + iMMFControllers.InsertL(key, controller); + + // iMMFController owns the objects now + CleanupStack::Pop(2); + + } + + iController = controller; + iCurrentControllerUid = aUid.iUid; + + } + +// ----------------------------------------------------------------------------- +// CMPXFileInfoUtility::CreateAudioFormatsArrayL +// ----------------------------------------------------------------------------- +// +void CMPXFileInfoUtility::CreateAudioFormatsArrayL() + { + CMMFControllerPluginSelectionParameters* cSelect = + CMMFControllerPluginSelectionParameters::NewLC(); + CMMFFormatSelectionParameters* fSelect = + CMMFFormatSelectionParameters::NewLC(); + // Set the play and record format selection parameters to be blank. + // - format support is only retrieved if requested. + cSelect->SetRequiredPlayFormatSupportL(*fSelect); + // Set the media ids + RArray mediaIds; + CleanupClosePushL(mediaIds); + User::LeaveIfError(mediaIds.Append(KUidMediaTypeAudio)); + // Get plugins that supports audio only + cSelect->SetMediaIdsL( mediaIds, + CMMFPluginSelectionParameters::EAllowOnlySuppliedMediaIds ); + // iAudioControllers contains now all audio plugins that + // support at least audio. + cSelect->ListImplementationsL(iAudioControllers); + // Clean up + CleanupStack::PopAndDestroy(3); //fSelect, cSelect, mediaIds + } + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/metadataextractor/src/mpxmetadataextractor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/metadataextractor/src/mpxmetadataextractor.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,828 @@ +/* +* Copyright (c) 2006 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: Extracts metadata from a file +* Version : %version: da1mmcf#38.1.4.2.6.1.5 % << Don't touch! Updated by Synergy at check-out. +* +*/ + + +#include +#include +#include +#include +#include + +#ifdef RD_MPX_TNM_INTEGRATION +#include +#include +#include +#include +#endif //RD_MPX_TNM_INTEGRATION + + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "mpxmetadataextractor.h" +#include "mpxfileinfoutility.h" +#ifdef RD_MPX_TNM_INTEGRATION +_LIT( KImageFileType, "image/jpeg" ); +const TInt KMPXTimeoutTimer = 3000000; // 3 seconds +const TInt KMPXMaxThumbnailRequest = 5; +#endif //RD_MPX_TNM_INTEGRATION + +//Helper functions +static void FindAndReplaceForbiddenChars(TDes& aString, TInt aLen) + { + MPX_ASSERT(aLen == aString.Length()); + + for (TInt i = 0; i < aLen; ++i) + { + if (aString[i] == TText('\t')) + { + aString[i] = TText(' '); + } + } + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CMPXMetadataExtractor::CMPXMetadataExtractor( + RFs& aFs, + RApaLsSession& aAppArc, + RPointerArray& aTypes ) + : iFs( aFs ), + iAppArc( aAppArc ), + iSupportedTypes( aTypes ), + iOutstandingThumbnailRequest(0), + iTNMBlockCount(0) + { + + } + + +// --------------------------------------------------------------------------- +// 2nd Phase Constructor +// --------------------------------------------------------------------------- +// +void CMPXMetadataExtractor::ConstructL() + { + iMetadataUtility = CMetaDataUtility::NewL(); + iDrmMediaUtility = CMPXDrmMediaUtility::NewL(); + iFileInfoUtil = CMPXFileInfoUtility::NewL(); + +#ifdef RD_MPX_TNM_INTEGRATION + // Create Thumbnail Manager instance. This object is the observer. + iTNManager = CThumbnailManager::NewL( *this ); + iTNManager->SetFlagsL( CThumbnailManager::EDefaultFlags ); + iTNManager->SetQualityPreferenceL( CThumbnailManager::EOptimizeForQuality); + // create wait loop + iTNSyncWait = new (ELeave) CActiveSchedulerWait; + iTimer = CPeriodic::NewL( CActive::EPriorityIdle ); +#endif //RD_MPX_TNM_INTEGRATION + } + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXMetadataExtractor* CMPXMetadataExtractor::NewL( + RFs& aFs, + RApaLsSession& aAppArc, + RPointerArray& aTypes ) + { + CMPXMetadataExtractor* self = new( ELeave ) CMPXMetadataExtractor( aFs, + aAppArc, + aTypes ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CMPXMetadataExtractor::~CMPXMetadataExtractor() + { + delete iMetadataUtility; + delete iFileInfoUtil; + delete iDrmMediaUtility; +#ifdef RD_MPX_TNM_INTEGRATION + delete iTNManager; + if (iTNSyncWait && iTNSyncWait->IsStarted() ) + { + iTNSyncWait->AsyncStop(); + } + delete iTNSyncWait; + delete iTimer; +#endif //RD_MPX_TNM_INTEGRATION + + MPX_DEBUG2("CMPXMetadataExtractor: TNM Block Count: %d ", iTNMBlockCount ); + } + +// --------------------------------------------------------------------------- +// Constructs a media properties object +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXMetadataExtractor::CreateMediaL( const TDesC& aFile, + CMPXMedia*& aNewProperty, + TBool aMetadataOnly ) + { + // make a copy of aFile + HBufC* fileName = HBufC::NewL(KMaxFileName); + CleanupStack::PushL( fileName ); + fileName->Des().Append( aFile ); + MPX_DEBUG2("CMPXMetadataExtractor::CreateMediaL %S <---", fileName ); + + RArray contentIDs; + contentIDs.AppendL( KMPXMediaIdGeneral ); + contentIDs.AppendL( KMPXMediaIdAudio ); + contentIDs.AppendL( KMPXMediaIdMusic ); + contentIDs.AppendL( KMPXMediaIdDrm ); + contentIDs.AppendL( KMPXMediaIdMTP ); + aNewProperty = NULL; + CMPXMedia* media = CMPXMedia::NewL( contentIDs.Array() ); + CleanupStack::PushL( media ); + contentIDs.Close(); + + // CMPXMedia default types + + media->SetTObjectValueL( KMPXMediaGeneralType, + EMPXItem ); + media->SetTObjectValueL( KMPXMediaGeneralCategory, + EMPXSong ); + + TParsePtrC parse( *fileName ); + + // Title, default is file name + media->SetTextValueL( KMPXMediaGeneralTitle, + parse.Name() ); + + // Default album track + media->SetTextValueL( KMPXMediaMusicAlbumTrack, + KNullDesC ); + + // Set the Mime Type and collection UID + // + if( !aMetadataOnly ) + { + TInt index(KErrNotFound); + TInt count( iSupportedTypes.Count() ); + for (TInt i=0; i Extensions(); + const TDesC& ext = parse.Ext(); + if (!exts.FindIsq(ext, index2)) + { // found + index = i; + break; + } + } + if( KErrNotFound != index ) + { + MPX_DEBUG1("CMPXMetadataExtractor::CreateMediaPropertiesL apparc <---" ); + TInt mimeIndex = SupportedContainerTypeL( *fileName, index ); + User::LeaveIfError( mimeIndex ); + MPX_DEBUG1("CMPXMetadataExtractor::CreateMediaPropertiesL apparc --->" ); + + media->SetTextValueL( KMPXMediaGeneralMimeType, + iSupportedTypes[index]->Mimetypes()[mimeIndex] ); + + media->SetTObjectValueL( KMPXMediaGeneralCollectionId, + iSupportedTypes[index]->Uid() ); + } + else + { + User::Leave(KErrNotSupported); + } + } + else // other case use apparc to fetch and set mimetype + { + TDataType dataType; + TUid dummyUid(KNullUid); + iAppArc.AppForDocument(*fileName, dummyUid, dataType); + media->SetTextValueL( KMPXMediaGeneralMimeType,dataType.Des() ); + } + + // Use file handle here + // + RFile file; + TInt err = file.Open( iFs, *fileName, EFileRead | EFileShareReadersOrWriters ); + CleanupClosePushL(file); + + // Metadata related + // + if( err == KErrNone ) + { + const TDesC& mimeType = media->ValueText( KMPXMediaGeneralMimeType ); + HBufC8* mimeType8 = HBufC8::NewLC( mimeType.Length() ); + mimeType8->Des().Append( mimeType ); + TRAPD( metadataerror, iMetadataUtility->OpenFileL( file, *mimeType8 ) ); + CleanupStack::PopAndDestroy( mimeType8 ); + + // No problem + if( KErrNone == metadataerror ) + { + // Add TRAPD to capture exception KErrNoMemory. + //If album art size is too large, trap this exception and SetDefaultL. + //Fix EYLU-7ESE5L + TRAPD( err, SetMediaPropertiesL( *media, *fileName ) ); + if ( KErrNoMemory == err ) + { + SetDefaultL( *media ); + } + } + else // Error, Set defaults + { + SetDefaultL( *media ); + } + + // Reset the utility + iMetadataUtility->ResetL(); + } + else // Error, Set defaults + { + SetDefaultL( *media ); + } + + // Common properties that we can extract + // + SetExtMediaPropertiesL( *media, *fileName, aMetadataOnly, file, err ); + CleanupStack::PopAndDestroy(&file); + + // Set the pointers now that the object is ready + // + CleanupStack::Pop( media ); + aNewProperty = media; + + CleanupStack::PopAndDestroy( fileName ); + MPX_DEBUG1("CMPXMetadataExtractor::CreateMediaPropertiesL --->"); + } + +// --------------------------------------------------------------------------- +// Sets all of the default media properties +// --------------------------------------------------------------------------- +// +void CMPXMetadataExtractor::SetDefaultL( CMPXMedia& aMediaProp ) + { + // Comment + aMediaProp.SetTextValueL( KMPXMediaGeneralComment, + KNullDesC ); + // Artist + aMediaProp.SetTextValueL( KMPXMediaMusicArtist, + KNullDesC ); + // Album + aMediaProp.SetTextValueL( KMPXMediaMusicAlbum, + KNullDesC ); + // Year + aMediaProp.SetTObjectValueL( KMPXMediaMusicYear, + (TInt64) 0 ); + // Track + aMediaProp.SetTextValueL( KMPXMediaMusicAlbumTrack, + KNullDesC ); + // Genre + aMediaProp.SetTextValueL( KMPXMediaMusicGenre, + KNullDesC ); + // Composer + aMediaProp.SetTextValueL( KMPXMediaMusicComposer, + KNullDesC ); + // Album artFilename + aMediaProp.SetTextValueL( KMPXMediaMusicAlbumArtFileName, + KNullDesC ); + // URL + aMediaProp.SetTextValueL( KMPXMediaMusicURL, + KNullDesC ); + } + +// --------------------------------------------------------------------------- +// Sets media object attributes from metadata utilities +// --------------------------------------------------------------------------- +// +void CMPXMetadataExtractor::SetMediaPropertiesL( CMPXMedia& aMedia, + const TDesC& aFile ) + { + MPX_DEBUG1("CMPXMetadataExtractor::SetMediaPropertiesL <---" ); + + const CMetaDataFieldContainer& metaCont = + iMetadataUtility->MetaDataFieldsL(); + TInt count( metaCont.Count() ); + for( TInt i=0; iDes(); + valptr.Trim(); + TInt vallen = value->Length(); + if (vallen>0) + { + FindAndReplaceForbiddenChars(valptr, vallen); + aMedia.SetTextValueL(KMPXMediaGeneralTitle, *value); + } + break; + } + case EMetaDataArtist: + { + TPtr valptr = value->Des(); + valptr.Trim(); + TInt vallen = value->Length(); + if (vallen>0) + { + FindAndReplaceForbiddenChars(valptr, vallen); + aMedia.SetTextValueL(KMPXMediaMusicArtist, *value); + } + break; + } + case EMetaDataAlbum: + { + TPtr valptr = value->Des(); + valptr.Trim(); + TInt vallen = value->Length(); + if (vallen>0) + { + FindAndReplaceForbiddenChars(valptr, vallen); + aMedia.SetTextValueL(KMPXMediaMusicAlbum, *value ); + } + break; + } + case EMetaDataYear: + { + // Perform the date time conversion + TLex lexer( *value ); + TInt year( 0 ); + lexer.Val( year ); + + // Convert from TInt -> TDateTime -> TTime -> TInt64 + TDateTime dt; + dt.SetYear( year ); + TTime time( dt ); + aMedia.SetTObjectValueL( KMPXMediaMusicYear, + time.Int64() ); + break; + } + case EMetaDataComment: + { + aMedia.SetTextValueL( KMPXMediaGeneralComment, + *value ); + break; + } + case EMetaDataAlbumTrack: + { + aMedia.SetTextValueL( KMPXMediaMusicAlbumTrack, + *value ); + break; + } + case EMetaDataGenre: + { + TPtr valptr = value->Des(); + valptr.Trim(); + TInt vallen = value->Length(); + if (vallen>0) + { + FindAndReplaceForbiddenChars(valptr, vallen); + aMedia.SetTextValueL(KMPXMediaMusicGenre, *value); + } + break; + } + case EMetaDataComposer: + { + TPtr valptr = value->Des(); + valptr.Trim(); + TInt vallen = value->Length(); + if (vallen>0) + { + FindAndReplaceForbiddenChars(valptr, vallen); + aMedia.SetTextValueL(KMPXMediaMusicComposer, *value); + } + break; + } + case EMetaDataUrl: + case EMetaDataUserUrl: // fall through + { + aMedia.SetTextValueL( KMPXMediaMusicURL, + *value ); + break; + } + case EMetaDataJpeg: + { +#ifdef RD_MPX_TNM_INTEGRATION + MPX_PERF_START(CMPXMetadataExtractor_SetMediaPropertiesL_JPEG_TNM); + HBufC8* value8 = MPXUser::Alloc8L(metaCont.At( i, fieldType )); + CleanupStack::PushL( value8 ); + AddMediaAlbumArtL( aMedia, aFile, *value8 ); + CleanupStack::Pop(value8); + MPX_PERF_END(CMPXMetadataExtractor_SetMediaPropertiesL_JPEG_TNM); +#else //RD_MPX_TNM_INTEGRATION + aMedia.SetTextValueL( KMPXMediaMusicAlbumArtFileName, + aFile ); +#endif //RD_MPX_TNM_INTEGRATION + break; + } + case EMetaDataCopyright: + { + aMedia.SetTextValueL( KMPXMediaGeneralCopyright, + *value ); + break; + } + case EMetaDataOriginalArtist: // fall through + case EMetaDataVendor: // fall through + case EMetaDataRating: // fall through + case EMetaDataUniqueFileIdentifier: // fall through + case EMetaDataDuration: // fall through + case EMetaDataDate: // fall through + { + // not used + break; + } + default: + { + //ASSERT(0); + break; + } + } + CleanupStack::PopAndDestroy(value); + } + + MPX_DEBUG1("CMPXMetadataExtractor::SetMediaPropertiesL --->" ); + } + +// --------------------------------------------------------------------------- +// Sets extra media properties not returned by metadata utilities +// --------------------------------------------------------------------------- +// +void CMPXMetadataExtractor::SetExtMediaPropertiesL( CMPXMedia& aProp, + const TDesC& aFile, + TBool aMetadataOnly, + RFile& aFileHandle, + TInt aFileErr ) + { + MPX_DEBUG1("CMPXMetadataExtractor::SetExtMediaPropertiesL <---"); + + // DB Flags to set + // + TUint dbFlags(KMPXMediaGeneralFlagsSetOrUnsetBit); + + // File Path + // + TParsePtrC parse( aFile ); + aProp.SetTextValueL( KMPXMediaGeneralUri, + aFile ); + aProp.SetTextValueL( KMPXMediaGeneralDrive, + parse.Drive() ); + + // DRM Rights + // + CMPXMedia* drm = NULL; + TRAPD( drmError, iDrmMediaUtility->InitL( aFile ); + drm = CMPXMedia::NewL( *iDrmMediaUtility->GetMediaL( KMPXMediaDrmProtected.iAttributeId | + KMPXMediaDrmRightsStatus.iAttributeId ) ); + ); + + TBool prot(EFalse); + if( drm ) + { + CleanupStack::PushL( drm ); + MPX_DEBUG1("CMPXMetadataExtractor::SetExtMediaPropertiesL -- is a drm file"); + if( drm->IsSupported( KMPXMediaDrmProtected ) ) + { + prot = drm->ValueTObjectL( KMPXMediaDrmProtected ); + MPX_DEBUG2("CMPXMetadataExtractor::SetExtMediaPropertiesL protected %i", prot); + } + + TMPXMediaDrmRightsStatus status(EMPXDrmRightsFull); + if( drm->IsSupported( KMPXMediaDrmRightsStatus ) ) + { + status = drm->ValueTObjectL(KMPXMediaDrmRightsStatus); + aProp.SetTObjectValueL(KMPXMediaDrmRightsStatus, status ); + MPX_DEBUG2("CMPXMetadataExtractor::SetExtMediaPropertiesL -- status %i", status); + } + + // Set DB flags + dbFlags |= KMPXMediaGeneralFlagsIsDrmProtected; + if( status != EMPXDrmRightsFull && status != EMPXDrmRightsRestricted && status != EMPXDrmRightsPreview ) + { + dbFlags |= KMPXMediaGeneralFlagsIsDrmLicenceInvalid; + } + CleanupStack::PopAndDestroy( drm ); + } + + // Trapped PV DRM error. If -46, we know the file has no rights + // + if( drmError == KErrPermissionDenied ) + { + dbFlags |= KMPXMediaGeneralFlagsIsDrmLicenceInvalid; + } + else + { + User::LeaveIfError( drmError ); + } + + aProp.SetTObjectValueL( KMPXMediaDrmProtected, prot ); + aProp.SetTObjectValueL( KMPXMediaMTPDrmStatus, (TUint16)prot ); + + iDrmMediaUtility->Close(); + + // File Size + // + TInt size( 0 ); + if( aFileErr == KErrNone ) + { + aFileHandle.Size( size ); + aProp.SetTObjectValueL( KMPXMediaGeneralSize, + size ); + + // Duration, bitrate, samplerate, etc + // + if( !aMetadataOnly ) + { + TRAPD(err2, iFileInfoUtil->OpenFileL( + aFileHandle, + aProp.ValueText(KMPXMediaGeneralMimeType))); + MPX_DEBUG2("CMPXMetadataExtractor::SetExtMediaPropertiesL, file info util error %i", err2); + if( KErrNone == err2 ) + { + aProp.SetTObjectValueL( KMPXMediaAudioBitrate, + iFileInfoUtil->BitRate() ); + aProp.SetTObjectValueL( KMPXMediaAudioSamplerate, + iFileInfoUtil->SampleRate() ); + TInt64 duration = (TInt64) iFileInfoUtil->Duration().Int64() / 1000; // ms + aProp.SetTObjectValueL( KMPXMediaGeneralDuration, + duration ); + MPX_DEBUG2("CMPXMetadataExtractor::SetExtMediaPropertiesL -- duration %i", duration); + } + } + } + else if( aFileErr == KErrNotFound || aFileErr == KErrPathNotFound ) + { + dbFlags |= KMPXMediaGeneralFlagsIsInvalid; + } + // Finally set the db flag + // + aProp.SetTObjectValueL( KMPXMediaGeneralFlags, + dbFlags ); + + iFileInfoUtil->Reset(); + + MPX_DEBUG1("CMPXMetadataExtractor::SetExtMediaPropertiesL --->"); + } + +// --------------------------------------------------------------------------- +// Check to see if this file is a supported container +// --------------------------------------------------------------------------- +// +TInt CMPXMetadataExtractor::SupportedContainerTypeL( const TDesC& aFile, + TInt aIndex ) + { + TInt index(KErrNotFound); + + TDataType dataType; + TUid dummyUid(KNullUid); + iAppArc.AppForDocument(aFile, dummyUid, dataType); + + TInt index2(KErrNotFound); + const CDesCArray& mimeTypes = iSupportedTypes[aIndex]->Mimetypes(); + if (!mimeTypes.FindIsq(dataType.Des(), index2)) + { // found + index = index2; + } + + return ( index == KErrNotFound ? KErrNotSupported : index ); + } + + +// --------------------------------------------------------------------------- +// CMPXMetadataExtractor::ThumbnailPreviewReady +// Callback but not used here +// --------------------------------------------------------------------------- +void CMPXMetadataExtractor::ThumbnailPreviewReady( + MThumbnailData& /*aThumbnail*/, TThumbnailRequestId /*aId*/ ) + { + MPX_FUNC("CMPXMetadataExtractor::ThumbnailPreviewReady()"); + } + + +// --------------------------------------------------------------------------- +// CMPXMetadataExtractor::ThumbnailReady +// Callback but not used here +// --------------------------------------------------------------------------- +void CMPXMetadataExtractor::ThumbnailReady( TInt /*aError*/, + MThumbnailData& /*aThumbnail*/, TThumbnailRequestId /*aId*/ ) + { + MPX_FUNC("CMPXMetadataExtractor::ThumbnailReady()"); + iOutstandingThumbnailRequest--; + if ( iOutstandingThumbnailRequest <= KMPXMaxThumbnailRequest ) + { + StopWaitLoop(); + } + } + +// ---------------------------------------------------------------------------- +// Callback for timer. +// ---------------------------------------------------------------------------- +TInt CMPXMetadataExtractor::TimeoutTimerCallback(TAny* aPtr) + { + MPX_FUNC("CMPXMetadataExtractor::TimeoutTimerCallback()"); + + CMPXMetadataExtractor* ptr = + static_cast(aPtr); + + // Timer expired before thumbnail callback occurred. Stop wait loop to unblock. + ptr->StopWaitLoop(); + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// Stop the wait loop. +// ---------------------------------------------------------------------------- +void CMPXMetadataExtractor::StopWaitLoop() + { + MPX_FUNC("CMPXMetadataExtractor::StopWaitLoop()"); + // Cancel timer + CancelTimeoutTimer(); + + // Stop wait loop to unblock. + if ( iTNSyncWait->IsStarted() ) + { + MPX_DEBUG1("CMPXMetadataExtractor::StopWaitLoop(): Stopping the wait loop."); + iTNSyncWait->AsyncStop(); + } + } + +// ---------------------------------------------------------------------------- +// Cancel timer. +// ---------------------------------------------------------------------------- +void CMPXMetadataExtractor::CancelTimeoutTimer() + { + MPX_FUNC("CMPXMetadataExtractor::CancelTimeoutTimer()"); + + // Cancel timer. + if ( iTimer && iTimer->IsActive() ) + { + MPX_DEBUG1("CMPXMetadataExtractor::CancelTimeoutTimer(): Timer active, cancelling"); + iTimer->Cancel(); + } + } + +// ---------------------------------------------------------------------------- +// Extract album art from a file and add to thumbnail manager. +// ---------------------------------------------------------------------------- +EXPORT_C TInt CMPXMetadataExtractor::ExtractAlbumArtL( CMPXMedia* aMedia ) + { + MPX_FUNC("CMPXMetadataExtractor::ExtractAlbumArtL()"); + TInt err = KErrNone; + + if ( !aMedia->IsSupported(KMPXMediaGeneralUri) ) + { + return KErrArgument; + } + + // Get full file name. + const TDesC& path = aMedia->ValueText(KMPXMediaGeneralUri); + MPX_DEBUG2("CMPXMetadataExtractor::ExtractAlbumArtL Filename:%S ", &path ); + + // create wanted fields array + RArray wantedFields; + CleanupClosePushL( wantedFields ); + wantedFields.Append(EMetaDataJpeg); + + // Open file + if ( aMedia->IsSupported(KMPXMediaGeneralMimeType) ) + { + const TDesC& mimeType = aMedia->ValueText( KMPXMediaGeneralMimeType ); + MPX_DEBUG2("CMPXMetadataExtractor::ExtractAlbumArtL MimeType:%S ", &mimeType ); + HBufC8* mimeType8 = HBufC8::NewLC( mimeType.Length() ); + mimeType8->Des().Append( mimeType ); + TRAP( err, iMetadataUtility->OpenFileL( path, wantedFields, *mimeType8 ) ); + CleanupStack::PopAndDestroy( mimeType8 ); + } + else + { + TRAP( err, iMetadataUtility->OpenFileL( path, wantedFields ) ); + } + CleanupStack::PopAndDestroy( &wantedFields ); + + if ( !err ) + { + TRAP( err, GetMediaAlbumArtL( *aMedia, path )); + } + + // Reset the utility + iMetadataUtility->ResetL(); + + return err; + } + +// ---------------------------------------------------------------------------- +// Set album art. +// ---------------------------------------------------------------------------- +TInt CMPXMetadataExtractor::GetMediaAlbumArtL( CMPXMedia& aMedia, + const TDesC& aFile ) + { + MPX_FUNC("CMPXMetadataExtractor::GetMediaAlbumArtL()"); + TInt err = KErrNone; + // get metadata container. + const CMetaDataFieldContainer& metaCont = iMetadataUtility->MetaDataFieldsL(); + + TPtrC data = metaCont.Field( EMetaDataJpeg ); + + if ( data.Length() ) + { + MPX_DEBUG1("CMPXMetadataExtractor::GetMediaAlbumArtL(): Album art exist."); +#ifdef RD_MPX_TNM_INTEGRATION + HBufC8* value8 = MPXUser::Alloc8L( data ); + CleanupStack::PushL( value8 ); + AddMediaAlbumArtL( aMedia, aFile, *value8 ); + CleanupStack::Pop(value8); +#else // RD_MPX_TNM_INTEGRATION + aMedia.SetTextValueL( KMPXMediaMusicAlbumArtFileName, aFile ); +#endif // RD_MPX_TNM_INTEGRATION + } + else + { + err = KErrNotFound; + } + + return err; + } + +// ---------------------------------------------------------------------------- +// Add album art to media object. +// ---------------------------------------------------------------------------- +void CMPXMetadataExtractor::AddMediaAlbumArtL( CMPXMedia& aMedia, + const TDesC& aFile, + TDesC8& aValue ) + { + MPX_FUNC("CMPXMetadataExtractor::AddMediaAlbumArtL()"); +#ifdef RD_MPX_TNM_INTEGRATION + + // If thumbnail creation is ongoing, wait til it is done + if ( iOutstandingThumbnailRequest > KMPXMaxThumbnailRequest ) + { + MPX_DEBUG1("CMPXMetadataExtractor::AddMediaAlbumArtL(): Thumbnail creation ongoing!"); + iTNMBlockCount++; + // Cancel timer. + CancelTimeoutTimer(); + // Start timer in case there is no callback from ThumbNail Manager. + iTimer->Start( + KMPXTimeoutTimer, + KMPXTimeoutTimer, + TCallBack(TimeoutTimerCallback, this )); + + // Start wait loop until we get a callback from ThumbNail Manager. + if ( !iTNSyncWait->IsStarted() ) + { + iTNSyncWait->Start(); + } + } + + aMedia.SetTextValueL( KMPXMediaMusicAlbumArtFileName, aFile ); + + TBuf<256> mimeType; + mimeType.Copy( KImageFileType ); + CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC( + &aValue, mimeType, aFile ); + iTNManager->CreateThumbnails( *source ); + CleanupStack::PopAndDestroy( source ); + aMedia.SetTextValueL( KMPXMediaMusicOriginalAlbumArtFileName, aFile ); + iOutstandingThumbnailRequest++; + +#endif // RD_MPX_TNM_INTEGRATION + } diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/rom/mpxharvester.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/rom/mpxharvester.iby Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2006 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: IBY file for the harvester component +* +*/ + + +#ifndef MPX_HARVESTER_IBY +#define MPX_HARVESTER_IBY + +#include + + +file=ABI_DIR\BUILD_DIR\mpxharvesterserver.exe PROGRAMS_DIR\mpxharvesterserver.exe +file=ABI_DIR\BUILD_DIR\mpxfilehandler.dll SHARED_LIB_DIR\mpxfilehandler.dll +file=ABI_DIR\BUILD_DIR\mpxharvesterutility.dll SHARED_LIB_DIR\mpxharvesterutility.dll +file=ABI_DIR\BUILD_DIR\mpxcollectionmediator.dll SHARED_LIB_DIR\mpxcollectionmediator.dll +file=ABI_DIR\BUILD_DIR\mpxmetadataextractor.dll SHARED_LIB_DIR\mpxmetadataextractor.dll + +#endif // MPX_HARVESTER_IBY diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/rom/mpxharvesterrsc.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/rom/mpxharvesterrsc.iby Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2006 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: IBY file for the harvester component +* +*/ + + +#ifndef MPX_HARVESTERRSC_IBY +#define MPX_HARVESTERRSC_IBY + +#include + + +data=DATAZ_\APP_RESOURCE_DIR\mpxmediator.rsc APP_RESOURCE_DIR\mpxmediator.rsc + +#endif // MPX_HARVESTERRSC_IBY diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/server/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/server/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2006 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 server +* +*/ + + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +mpxharvester.mmp \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/server/group/mpxharvester.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/server/group/mpxharvester.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2006 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 server project specification +* +*/ + + + +#include +#include + +TARGET mpxharvesterserver.exe +TARGETTYPE exe +UID 0 0x101FFCA9 +EPOCHEAPSIZE 0x1000 0x500000 +EPOCSTACKSIZE 0X5000 + +CAPABILITY CAP_SERVER DRM AllFiles +VENDORID VID_DEFAULT + +SOURCEPATH ../src + +// Core +SOURCE mpxharvesterserver.cpp +SOURCE mpxharvestersession.cpp +SOURCE mpxharvesterengine.cpp + +// System events +SOURCE mpxfsformatmonitor.cpp +SOURCE mpxmediaremovalmonitor.cpp +SOURCE mpxusbeventhandler.cpp +SOURCE mpxmmcejectmonitor.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../inc + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib // For CBaBackupSessionWrapper +LIBRARY estor.lib +LIBRARY mpxfilehandler.lib +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib +LIBRARY mpxplaylistengine.lib +LIBRARY mpxplaybackutility.lib +LIBRARY usbman.lib +#ifdef RD_MULTIPLE_DRIVE +LIBRARY PlatformEnv.lib +#endif //RD_MULTIPLE_DRIVE diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/server/inc/mpxfsformatmonitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/server/inc/mpxfsformatmonitor.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2006 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: Monitors File system for Format events +* +*/ + + +#ifndef CMPXFORMATMONITOR_H +#define CMPXFORMATMONITOR_H + +#include +#include "mpxsystemeventobserver.h" + +/** + * File System monitor class to monitor for format events + * + * @lib mpxharvesterserver.exe + * @since S60 3.0 + */ +NONSHARABLE_CLASS( CMPXFsFormatMonitor ) : public CBase, + public MBackupOperationObserver + { + +public: + + /** + * Two-phase constructor + * @param aObserver observer to the monitor + */ + static CMPXFsFormatMonitor* NewL( MMPXSystemEventObserver& aObserver ); + + /** + * Two-phase constructor + * @param aObserver observer to the monitor + */ + static CMPXFsFormatMonitor* NewLC( MMPXSystemEventObserver& aObserver ); + + /** + * Destructor + */ + virtual ~CMPXFsFormatMonitor(); + +public: // New functions + + /** + * Polls for the current monitor status + * If an event is happening, it will callback the observer of the event + */ + void PollStatus(); + +protected: // Base Class + + /* + * From MBackupOperationObserver + * Notifies this class of the backup event. + * MMC App will signal a start / end. + */ + void HandleBackupOperationEventL(const TBackupOperationAttributes& aBackupOperationAttributes); + +private: + + /** + * C++ constructor + * aObserver observer to this event + */ + CMPXFsFormatMonitor( MMPXSystemEventObserver& aObserver ); + + /* + * Second phased constructor + */ + void ConstructL(); + +private: // data + + RArray iBackupDrives; + CBaBackupSessionWrapper* iBackupSession; + + /* + * Observer interface to callback to an observer + */ + MMPXSystemEventObserver& iObserver; + }; + +#endif // CMPXFORMATMONITOR_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/server/inc/mpxharvesterengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/server/inc/mpxharvesterengine.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,325 @@ +/* +* Copyright (c) 2006 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 Engine to handle file and system related events +* +*/ + + +#ifndef CHARVESTERENGINE_H +#define CHARVESTERENGINE_H + +#include +#include +#include +#include +#include +#include +#include "mpxsystemeventobserver.h" + +// FORWARD DECLARATIONS +class CMPXHarvesterFileHandler; +class CMPXFsFormatMonitor; +class CMPXMediaRemovalMonitor; +class CMPXUsbEventHandler; +class CMPXMMCEjectMonitor; +class CMPXMedia; +class CMPXActiveTaskQueue; +class CMPXPlaylistEngine; +class MMPXHarvesterEngineObserver; +class MMPXCollectionUtility; +class RHvsMsg; + +/** + * Harvester engine to monitor for file system events + * + * @lib mpxharvesterserver.exe + * @since S60 S60_version 3.0 + */ +NONSHARABLE_CLASS( CMPXHarvesterEngine ) : public CBase, + public MMPXSystemEventObserver, + public MMPXTaskQueueObserver, + public MMPXPlaylistEngineObserver + { +public: + + /** + * Two-phase constructor + */ + static CMPXHarvesterEngine* NewL(); + + /** + * Virtual destructor + */ + virtual ~CMPXHarvesterEngine(); + +public: // New Functions + + /** + * Initiates a scan of the file system + */ + void ScanL(); + + /** + * Cancels a scan of the file system + */ + void CancelScan(); + + /** + * Add a song to the harvester db, asyncrhonous + * @param aMsg Message struct for the add file + * @param aFile path to the file + * @param aObs observer to the add event, + * callback with CompleteTask() on completion + */ + void AddFileL( RHvsMsg* aMsg, const TDesC& aFile, MMPXHarvesterEngineObserver* aObs ); + + /** + * Add a song to the harvester db + * @param aMedia, media to add + * @return collection ID + */ + TInt AddFileL( CMPXMedia*& aMedia ); + + /** + * Get media for song, asyncrhonous + * @param aMsg Message struct for the add file + * @param aFile path to the file + * @param aObs observer to the add event, + * callback with CompleteTask() on completion + */ + void GetMediaL( RHvsMsg* aMsg, const TDesC& aFile, MMPXHarvesterEngineObserver* aObs ); + + /** + * Get Collection id for the song + * @param aFile path to the file + * @return collection ID + */ + TInt GetColUidL( const TDesC& aFile ); + + /** + * Remove a song from the harvester db + * @param aFile path to the file + * @param aDelete, do we want to delete the file from FS + * @return the Collection ID of the removed file + */ + TInt RemoveFileL( const TDesC& aFile, TBool aDelete, TBool aEndTransaction=ETrue); + + /** + * Removes multiple songs from the harvester db + * @param aArray list of files to delete + * @param aDelete, do we want to delete the file from FS + */ + void RemoveMultipleFilesL( const MDesCArray& aArray, TBool aDelete, TBool aEndTransaction ); + + /** + * Remove all songs from the harvester db + */ + void RemoveAllFilesL(); + + /** + * Update a file + * @param aFile, File name + * @param aCollection, Collection ID + */ + void UpdateFileL( const TDesC& aFile, TInt aCollection ); + + /** + * Rename a file + * @param aOldPath original file path + * @param aNewPath new file path + * @param aCollection Collection ID + */ + void RenameFileL( const TDesC& aOldPath, const TDesC& aNewPath, TInt aCollection ); + + /** + * Finds the collection ID based on a File name + * @param aFile, file name to lookup + * @return the collection ID + */ + TInt FindCollectionIdL( const TDesC& aFile ); + + /** + * Exports a playlist based on the message + * @param aMessage containing the task + * @param aObs observer to the export event + * callback to HandleImportCompleteL() on completion + */ + void ExportPlaylistL( RHvsMsg* aMessage, + MMPXHarvesterEngineObserver* aObs ); + + /** + * Import a playlist based on the message + * @param aMessage containing the task + * @param aObs observer callback + * callback to HandleExportCompleteL() on completion + */ + void ImportPlaylistL( RHvsMsg* aMessage, + MMPXHarvesterEngineObserver* aObs ); + + /** + * Async method to import a file (playlist or media ) + * @param aMessage containing the task + * @param aObs, observer callback + */ + void ImportFileL( RHvsMsg* aMessage, + MMPXHarvesterEngineObserver* aObs ); + + /** + * Query the required attributes for tracks for the specified playlist type + * @param aPlaylistType typ of playlist to check for required attriubtes + * @return list of required attributes for a playlist + */ + const TArray RequiredAttributesL(TInt aPlaylistType) const; + + /** + * Query the optional attributes for tracks for the specified playlist type + * @param aPlaylistType typ of playlist to check for optional attriubtes + * @return list of required attributes for a playlist + */ + const TArray OptionalAttributesL(TInt aPlaylistType) const; + + /** + * Query about the file extension the playlist plugin for the given type + * supports + * @return file extension which includes the period + */ + const TDesC& PlaylistFileExtensionL(TInt aPlaylistType) const; + + /** + * Determines if the given file is a playlist + * @param aFile file path of the file to be tested + * @return ETrue if it's a playlist otherwise EFalse + */ + TBool IsPlaylistL( const TDesC& aFile ); + + /** + * Recreate the harvester database if corruption is detected + * note: all dbs are re-created for accuracy and simplicity + */ + void RecreateDatabases(); + + /** + * Polls for system events + * If an event occurs, it will br broadcasted to the rest of the MPX framework + */ + void CheckForSystemEvents(); + + /** + * Close the database transaction + */ + void CloseTransactionL(); + +protected: // From Base Class + + /* + * From MMPXSystemEventObserver + */ + void HandleSystemEventL( TSystemEvent aEvent, TInt aData ); + + /* + * From MMPXTaskQueueObserver + */ + void ExecuteTask(TInt aTask, + TInt aParamData, + TAny* aPtrData, + const CBufBase& aBuf, + TAny* aCallback, + CBase* aCObject1, + CBase* aCObject2); + + /* + * From MMPXTaskQueueObserver + */ + void HandleTaskError( + TInt aTask, + TAny* aPtrData, + TAny* aCallback, + TInt aError); + + /* + * From MMPXPlaylistEngineObserver + */ + void HandlePlaylistL(CMPXMedia* aPlaylist, + const TInt aError, + const TBool aCompleted ); + + /* + * From MMPXPlaylistEngineObserver + */ + void HandlePlaylistL(const TDesC& aPlaylistUri, + const TInt aError); + +private: // New functions + + /** + * Handles exporting a playlist + * @param aMsg, RMessage to handle + */ + void DoExportPlaylistL( RHvsMsg* aMsg ); + + /** + * Handles importing a playlist + * @param aMsg, RMessage to handle + */ + void DoImportPlaylistL( RHvsMsg* aMsg ); + + /** + * Handles importing a file + * @param aMsg, RMessage to handle + */ + void DoImportFileL( RHvsMsg* aMsg ); + + /** + * Stop playback synchronously + */ + void DoStopPlaybackL(); + +private: + + /** + * C++ constructor + */ + CMPXHarvesterEngine(); + + /** + * 2nd-phase constructor + */ + void ConstructL(); + +private: // data + RFs iFsSession; // Session to File System + + CMPXHarvesterFileHandler* iFileHandler; + + // Move to RPointerArrays of monitors in the future + CMPXFsFormatMonitor* iFormatMonitor; + CMPXMediaRemovalMonitor* iMediaRemovalMonitor; + CMPXUsbEventHandler* iUSBMonitor; + CMPXMMCEjectMonitor* iMMCMonitor; + + // Internal task queue for async operations + CMPXActiveTaskQueue* iTaskQueue; + + // Playlist engine + CMPXPlaylistEngine* iPlaylistEngine; + + // Async op details + TMPXHarvesterServerOp iCurAsyncOp; + + // Temporary variable, avoid msg queue already exist problems + MMPXCollectionUtility* iTempCollectionUtil; + TBool iDiskOpActive; + }; + +#endif // CHARVESTERENGINE_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/server/inc/mpxharvesterengineobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/server/inc/mpxharvesterengineobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2006 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: Engine observer used by each session to complete events +* +*/ + + +#ifndef M_MPXHARVESTERENGINEOBSERVER_H +#define M_MPXHARVESTERENGINEOBSERVER_H + +#include "mpxhvsmsg.h" + +class CMPXMedia; + +/** + * Harvester Engine observer + * + * Each session could have async requests, + * this class allows the engine to callback to a particular session + * + * @lib mpxharvesterserver.exe + */ +class MMPXHarvesterEngineObserver + { + +public: + + /** + * Handles the completion of an import event + * @param aMedia media object to return to the client + * @param aErr + * @param aMsg message to complete + */ + virtual void HandleImportCompleteL( CMPXMedia* aMedia, + TInt aErr, + RHvsMsg* aMsg ) = 0; + + /** + * Handles the completion of an export event + * @param aMedia media object to return to the client + * @param aErr error code for the operation + * @param aMsg message to complete + */ + virtual void HandleExportCompleteL( CMPXMedia* aMedia, + TInt aErr, + RHvsMsg* aMsg ) = 0; + + /** + * Complete the async request, no need for packaging any returns + * @param aMsg message to complete + * @param aErr error code to complete the operation + */ + virtual void CompleteTask( RHvsMsg* aMsg, TInt aErr ) = 0; + }; + + +#endif // M_MPXHARVESTERENGINEOBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/server/inc/mpxharvesterserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/server/inc/mpxharvesterserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2006 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 Server +* +*/ + + +#ifndef CMPXHARVESTERSERVER_H +#define CMPXHARVESTERSERVER_H + +#include + +class CMPXHarvesterEngine; + +/** +* Harvester Server +*/ +NONSHARABLE_CLASS(CMPXHarvesterServer) : public CPolicyServer + { +public: + + enum { EMPXHarvesterServerPriority = CActive::EPriorityStandard }; + +public: + + /** + * Two-phased constructor. Leaves on failure. + * + * @return The constructed object + */ + static CMPXHarvesterServer* NewL(); + + /** + * Destructor + */ + ~CMPXHarvesterServer(); + + /** + * Increments number of sessions this server holds + */ + void AddClient(); + + /** + * Decrements number of sessions this server holds, and if now zero, shuts + * down the server. + */ + void RemoveClient(); + +private: + + /** + * C++ constructor + * + * @param aPriority priority of server + * @param aPolicy security policy + */ + CMPXHarvesterServer(TInt aPriority, const TPolicy &aPolicy); + + /** + * 2nd phase constructor + */ + void ConstructL(); + + /** + * Create a new session + * + * @param aVersion version of the server + * @param aMessage message object + */ + CSession2* NewSessionL(const TVersion& aVersion, + const RMessage2& aMessage) const; +private: + + CMPXHarvesterEngine* iEngine; // Engine for the server + TInt iClients; + }; + +#endif // CMPXHARVESTERSERVER_H + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/server/inc/mpxharvestersession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/server/inc/mpxharvestersession.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,212 @@ +/* +* Copyright (c) 2006 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 Server Session +* +*/ + + +#ifndef CMPXHARVESTERSESSION_H +#define CMPXHARVESTERSESSION_H + +#include +#include +#include +#include + +#include "mpxharvesterengineobserver.h" +#include "mpxhvsmsg.h" + +// FORWARD DECLARATIONS +class CMPXHarvesterServer; +class CMPXHarvesterEngine; +class CMPXMedia; + +/** +* Harvester server session +*/ +NONSHARABLE_CLASS( CMPXHarvesterSession ) : public CSession2, + public MMPXHarvesterEngineObserver + { +public: + + /** + * Two-phased constructor. Leaves on failure. + * + * @param aServer server object + * @param aEngine engine object + * @return The constructed object + */ + static CMPXHarvesterSession* NewL(CMPXHarvesterServer& aServer, + CMPXHarvesterEngine& aEngine); + + /** + * C++ constructor + * + * @param aServer server object + * @param aEngine engine object + */ + CMPXHarvesterSession(CMPXHarvesterServer& aServer, + CMPXHarvesterEngine& aEngine); + + /** + * Destructor + */ + ~CMPXHarvesterSession(); + +private: // From base classes + + /** + * From CSession2 + * Service request + * @param aMessage message object + */ + void ServiceL(const RMessage2& aMessage); + + /** + * From MMPXHarvesterEngineObserver + * Handles the completion of an import event + */ + void HandleImportCompleteL( CMPXMedia* aMedia, TInt aErr, + RHvsMsg* aMsg ); + + /** + * From MMPXHarvesterEngineObserver + * Handles the completion of an import event + */ + void HandleExportCompleteL( CMPXMedia* aMedia, TInt aErr, + RHvsMsg* aMsg ); + + /** + * From MMPXHarvesterEngineObserver + * Handles the completion of an async msg with error + */ + void CompleteTask( RHvsMsg* aMsg, TInt aErr ); + +private: + /** + * Dispatch message + * + * @param aMessage message object + */ + void DispatchMessageL(const RMessage2& aMessage); + + /** + * Scan the FS for files + */ + void DoScanL(); + + /** + * Cancel the scan (if executing) + */ + void DoCancelScan(); + + /** + * Shutdown the harvester (for testing memory leaks) + * Testing ONLY + */ + void DoShutdown(); + + /** + * Handles addition of a file (iDes) to the harvester + * @param aMsg message containing the item to add + */ + void DoAddFileL( RHvsMsg* aMsg ); + + /** + * Decode the IPC message to add a media + * @param aMessage, message to decode + * @return, collection ID of the media + */ + TInt DoAddMediaPropL( const RMessage2& aMessage ); + + /** + * Handles media creation for a file + * @param aMsg message containing the item + */ + void DoGetMediaL( RHvsMsg* aMsg ); + + /** + * Decode the IPC message to get a collection id + * @param aMessage, message to decode + * @return, collection ID of the file + */ + TInt DoGetColUidL( const RMessage2& aMessage ); + + /** + * Removes multiple songs from the harvester db + * @param aMessage message to decode + */ + void DoRemoveMultipleFilesL( const RMessage2& aMessage ); + + /** + * Update a file according to new information + * @param aMessage message to decode + */ + void DoUpdateFileL( const RMessage2& aMessage ); + + /** + * Rename a file according to new information + * @param aMessage message to decode + */ + void DoRenameFileL( const RMessage2& aMessage ); + + /** + * Set the message as async and add it to the message list + * @param aMessage message to decode + * @param aOp operation id + */ + RHvsMsg* SetAsyncL( const RMessage2& aMessage, TMPXHarvesterServerOp aOp ); + + /** + * Complete and remove an RHvsMsg + * @param aMessage message to decode + * @param aErr error code to complete operation + */ + void CompleteMessage( RHvsMsg*& aMessage, TInt aErr ); + + /* + * Helper methods for transferring variable sized arrays and objects + */ + + /** + * Reads a descriptor from the message, allocated into iDes + * + * @param aMessage message object + * @param aMsgSlot message slot + * @return the result descriptor + */ + const TDesC& ReadDesL(const RMessage2& aMessage,TInt aMsgSlot); + +private: + + /** + * 2nd phase constructor + */ + void ConstructL(); + +private: + + CMPXHarvesterServer& iServer; // not owned + CMPXHarvesterEngine& iEngine; // not owned + + HBufC* iDes; + HBufC8* iDes8; + CBufBase* iBuffer; + + RPointerArray iMessages; + CMPXMedia* iMedia; + }; + +#endif // CMPXHARVESTERSESSION_H + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/server/inc/mpxhvsmsg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/server/inc/mpxhvsmsg.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2006 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: Encapsulates a message to send +* +*/ + + + +#ifndef RHVSMSG_H +#define RHVSMSG_H + +/** +* Encapsulates an outstanding request. Allows the client to have multiple +* asynchronous methods outstanding +*/ +class RHvsMsg + { +public: + /** + * C++ constructor + * + * @param aMsg message object + * @param aOp server function code + */ + inline RHvsMsg(const RMessage2 aMsg,TMPXHarvesterServerOp aOp); + + + /** + * Return message reference + */ + inline const RMessage2& Message(); + + /** + * Return the op + */ + inline const TMPXHarvesterServerOp Op(); + +private: + RMessage2 iMsg; + TMPXHarvesterServerOp iOp; + }; + +#include "mpxhvsmsg.inl" + +#endif // RHVSMSG_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/server/inc/mpxhvsmsg.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/server/inc/mpxhvsmsg.inl Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2007 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: Inline function declarations for harvester messages +* +*/ + + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +inline RHvsMsg::RHvsMsg( const RMessage2 aMsg,TMPXHarvesterServerOp aOp ) : + iMsg( aMsg ), + iOp( aOp) + { + } +// --------------------------------------------------------------------------- +// Returns RMessage2 +// --------------------------------------------------------------------------- +// +inline const RMessage2& RHvsMsg::Message() + { + return iMsg; + } + +// --------------------------------------------------------------------------- +// Returns the operation +// --------------------------------------------------------------------------- +// +inline const TMPXHarvesterServerOp RHvsMsg::Op() + { + return iOp; + } + \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/server/inc/mpxmediaremovalmonitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/server/inc/mpxmediaremovalmonitor.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2007 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: Monitors for media removal events +* +*/ + + +#ifndef CMPXMEDIAREMOVALMONITOR_H +#define CMPXMEDIAREMOVALMONITOR_H + +#include +#include "mpxsystemeventobserver.h" + +/** + * Class to monitors for File System dismount events + * @lib Harvester + * @since S60 3.0 + */ +class CMPXMediaRemovalMonitor : public CActive + { + +public: + + /** + * Two-phase constructor + * @param aDrive drive to monitor + * @param aFs file server session + * @param aObserver observer to the event + */ + static CMPXMediaRemovalMonitor* NewL( TInt aDrive, + RFs& aFs, + MMPXSystemEventObserver& aObserver ); + /** + * Two-phase constructor + * @param aDrive drive to monitor + * @param aFs file server session + * @param aObserver observer to the event + */ + static CMPXMediaRemovalMonitor* NewLC( TInt aDrive, + RFs& aFs, + MMPXSystemEventObserver& aObserver ); + + /** + * Virtual destructor + */ + virtual ~CMPXMediaRemovalMonitor(); + +protected: // From base class + + /* + * From CActive + */ + void RunL(); + + /* + * From CActive + */ + void DoCancel(); + + /** + * From CActive + */ + TInt RunError(TInt aError); + +private: + + /** + * C++ constructor + * @param aDrive drive to monitor + * @param aFs file server session + * @param aObserver observer to the event + */ + CMPXMediaRemovalMonitor( TInt aDrive, + RFs& aFs, + MMPXSystemEventObserver& aObserver ); + + void ConstructL(); + +private: // data + + TInt iDrive; // Drive that is being monitored + RFs& iFs; // File Session, not owned + TBool iDiskRemoved; // Is the disk inserted + + /* + * Observer interface to callback to an observer + */ + MMPXSystemEventObserver& iObserver; + }; + +#endif // CMPXMEDIAREMOVALMONITOR_H \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/server/inc/mpxmmcejectmonitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/server/inc/mpxmmcejectmonitor.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2007 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: MMC Eject monitor +* +*/ + + +#ifndef C_MPXMMCEJECTMONITOR_H +#define C_MPXMMCEJECTMONITOR_H + +#include +#include "mpxsystemeventobserver.h" + +// FORWARD DECLARATIONS +class CMPXPSKeyWatcher; + +/** + * Monitors a SysAp cenrep key for the "eject" mmc menu option + * + * @lib mpxharvester.exe + * @since S60 3.1 + */ +NONSHARABLE_CLASS( CMPXMMCEjectMonitor ) : public CBase, + public MMPXPSKeyObserver + { + +public: + + /** + * Two-phased constructor + */ + static CMPXMMCEjectMonitor* NewL( MMPXSystemEventObserver& aObserver ); + + /** + * Destructor + */ + virtual ~CMPXMMCEjectMonitor(); + +protected: // From Base Class + + /** + * From MMPXPSKeyObserver + */ + void HandlePSEvent( TUid aUid, TInt aKey ); + +private: + + /** + * 2nd phase constructor + */ + void ConstructL(); + + /** + * Private Constructor + */ + CMPXMMCEjectMonitor( MMPXSystemEventObserver& aObserver ); + +private: // data + + CMPXPSKeyWatcher* iPSKeyWatcher; // PS key watcher for USB PS key + + /* + * Observer interface to callback to an observer + */ + MMPXSystemEventObserver& iObserver; // Not owned + }; + +#endif // C_MPXMMCEJECTMONITOR_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/server/inc/mpxsystemeventobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/server/inc/mpxsystemeventobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2006 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: Abstract interface class to observe system events +* +*/ + + +#ifndef M_MPXSYSTEMEVENTOBSERVER_H +#define M_MPXSYSTEMEVENTOBSERVER_H + +#include "mpxharvestercommon.h" + +/** + * Abstract interface for observing system events + * + * @lib mpxharvesterserver.exe + * @since S60 3.0 + */ +NONSHARABLE_CLASS( MMPXSystemEventObserver ) + { + +public: + + /** + * HandleSystemEvent + * + * @since S60 3.0 + * @param aEvent event to handle + * @param aData additional data for the event (ie what drive number) + */ + virtual void HandleSystemEventL( TSystemEvent aEvent, TInt aData ) = 0; + + }; + +#endif // M_MPXSYSTEMEVENTOBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/server/inc/mpxusbeventhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/server/inc/mpxusbeventhandler.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2006 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: Monitors USB events +* +*/ + + +#ifndef CMPXUSBEVENTHANDLER_H +#define CMPXUSBEVENTHANDLER_H + +#include +#include +#include "mpxsystemeventobserver.h" + +class CMPXPSKeyWatcher; + +/** + * USB Monitoring class + * + * @lib mpxharvesterserver.exe + * @since S60 3.0 + */ +NONSHARABLE_CLASS( CMPXUsbEventHandler ) : public CActive, + public MMPXPSKeyObserver + { +public: + + /** + * Two-phase constructor + * @param aObserver observer to the event handler + */ + static CMPXUsbEventHandler* NewL( MMPXSystemEventObserver& aObserver ); + + /** + * Two-phase constructor + * @param aObserver observer to the event handler + */ + static CMPXUsbEventHandler* NewLC( MMPXSystemEventObserver& aObserver ); + + /** + * Virtual destructor + */ + virtual ~CMPXUsbEventHandler(); + +public: + + /** + * Polls for the current monitor status + * If an event is happening, it will callback the observer of the event + */ + void PollStatus(); + +protected: // From Base Class + + /** + * From CActive + */ + void RunL(); + void DoCancel(); + + /** + * From MMPXPSKeyObserver + */ + void HandlePSEvent( TUid aUid, TInt aKey ); + +private: // New Methods + + /** + * Handle the PS Key event + * @param aUid UID of the key + * @param aKey ID of the key + */ + void DoHandlePSEventL( TUid aUid, TInt aKey ); + + /** + * Connect to usbman. + * If error, default iDeviceState to EUsbDeviceStateConfigured so this would not + * block usb event mode change. + */ + void ConnectUsbMan(); + +private: + + /** + * C++ constructor + */ + CMPXUsbEventHandler( MMPXSystemEventObserver& aObserver ); + + /* + * Second phased constructor + */ + void ConstructL(); + +private: // data + + CMPXPSKeyWatcher* iPSKeyWatcher; // PS key watcher for USB PS key + CMPXPSKeyWatcher* iMTPKeyWatcher; // PS key watcher for MTP PS key + TBool iWasMtp; // Was the operation Mass Storage or MTP + + /* + * Observer interface to callback to an observer + */ + MMPXSystemEventObserver& iObserver; + TInt iState; + TBool iMTPActive; + + RUsb iUsbMan; + TUsbDeviceState iDeviceState; + TBool iUsbManConnected; + }; + +#endif // CMPXUSBEVENTHANDLER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/server/src/mpxfsformatmonitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/server/src/mpxfsformatmonitor.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,152 @@ +/* +* Copyright (c) 2006 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 System format monitor +* +*/ + + +#include +#include +#ifdef RD_MULTIPLE_DRIVE +#include +#endif //RD_MULTIPLE_DRIVE +#include +#include "mpxfsformatmonitor.h" + +#ifdef RD_MULTIPLE_DRIVE + static const TInt KDriveCount = 2; +#else + static const TInt KDriveCount = 1; +#endif + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Default Constructor +// --------------------------------------------------------------------------- +// +CMPXFsFormatMonitor::CMPXFsFormatMonitor( MMPXSystemEventObserver& aObserver ) : + iObserver( aObserver ) + { + + } + + +// --------------------------------------------------------------------------- +// Second Phase Constructor +// --------------------------------------------------------------------------- +// +void CMPXFsFormatMonitor::ConstructL() + { + MPX_DEBUG1(_L("CMPXFsFormatMonitor::ConstructL <---")); + + iBackupSession = CBaBackupSessionWrapper::NewL(); + iBackupSession->RegisterBackupOperationObserverL( *this ); + + TInt drive = EDriveE; + for(TInt i=0; i")); + } + + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXFsFormatMonitor* CMPXFsFormatMonitor::NewL + ( MMPXSystemEventObserver& aObserver ) + { + CMPXFsFormatMonitor* self = CMPXFsFormatMonitor::NewLC( aObserver ); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXFsFormatMonitor* CMPXFsFormatMonitor::NewLC + ( MMPXSystemEventObserver& aObserver ) + { + CMPXFsFormatMonitor* self = new( ELeave ) CMPXFsFormatMonitor( aObserver); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// destructor +// --------------------------------------------------------------------------- +// +CMPXFsFormatMonitor::~CMPXFsFormatMonitor() + { + iBackupDrives.Close(); + + if( iBackupSession ) + { + iBackupSession->DeRegisterBackupOperationObserver( *this ); + } + delete iBackupSession; + } + +// --------------------------------------------------------------------------- +// Checks the current status +// --------------------------------------------------------------------------- +// +void CMPXFsFormatMonitor::PollStatus() + { + TBool aFormatting = iBackupSession->IsBackupOperationRunning(); + if( aFormatting ) + { + for(TInt i=0; i")); + } diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/server/src/mpxharvesterengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/server/src/mpxharvesterengine.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,819 @@ +/* +* Copyright (c) 2006 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: Implementation file for the Harvester Engine +* +*/ + + +#include +#ifdef RD_MULTIPLE_DRIVE +#include +#endif //RD_MULTIPLE_DRIVE +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Harvester includes +#include "mpxharvestercommon.h" +#include "mpxharvesterengine.h" +#include "mpxfsformatmonitor.h" +#include "mpxmediaremovalmonitor.h" +#include "mpxusbeventhandler.h" +#include "mpxmmcejectmonitor.h" +#include "mpxharvesterfilehandler.h" +#include "mpxharvesterengineobserver.h" +#include "mpxhvsmsg.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CMPXHarvesterEngine::CMPXHarvesterEngine() : iDiskOpActive( EFalse ) + { + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CMPXHarvesterEngine::~CMPXHarvesterEngine() + { + MPX_DEBUG1("CMPXHarvesterEngine::~CMPXHarvesterEngine <---"); + + delete iFormatMonitor; + delete iMediaRemovalMonitor; + delete iUSBMonitor; + delete iMMCMonitor; + + delete iFileHandler; + iFsSession.Close(); + + if( iTaskQueue ) + { + iTaskQueue->Reset(); + } + delete iTaskQueue; + delete iPlaylistEngine; + + if( iTempCollectionUtil ) + { + iTempCollectionUtil->Close(); + } + } + +// --------------------------------------------------------------------------- +// 2nd Phase Constructor` +// --------------------------------------------------------------------------- +// +void CMPXHarvesterEngine::ConstructL() + { + MPX_DEBUG1("CMPXHarvesterEngine::ConstructL <---"); + + User::LeaveIfError(iFsSession.Connect()); + + iFsSession.ShareProtected(); + + // Format handler for Removable Drive + iFormatMonitor = CMPXFsFormatMonitor::NewL( *this ); + + // MMC Removal monitor for Removable Drive + TInt removableDrive( EDriveE ); +#ifdef RD_MULTIPLE_DRIVE + User::LeaveIfError( DriveInfo::GetDefaultDrive( + DriveInfo::EDefaultRemovableMassStorage, + removableDrive ) ); +#endif // RD_MULTIPLE_DRIVE + iMediaRemovalMonitor = CMPXMediaRemovalMonitor::NewL( + removableDrive, iFsSession, *this ); + + // USB Event monitor + iUSBMonitor = CMPXUsbEventHandler::NewL( *this ); + + // MMC Event handling + iMMCMonitor = CMPXMMCEjectMonitor::NewL( *this ); + + // File handler to handle file related events + iFileHandler = CMPXHarvesterFileHandler::NewL( iFsSession ); + + // Active task queue for async requests + iTaskQueue = CMPXActiveTaskQueue::NewL(); + + // Playlist Engine for export/import playlist + iPlaylistEngine = CMPXPlaylistEngine::NewL( *this ); + + MPX_DEBUG1("CMPXHarvesterEngine::ConstructL --->"); + } + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXHarvesterEngine* CMPXHarvesterEngine::NewL() + { + CMPXHarvesterEngine* self = new(ELeave) CMPXHarvesterEngine(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Start scanning all drives +// --------------------------------------------------------------------------- +// +void CMPXHarvesterEngine::ScanL() + { + iFileHandler->ScanL(); + } + +// --------------------------------------------------------------------------- +// Cancel scanning +// --------------------------------------------------------------------------- +// +void CMPXHarvesterEngine::CancelScan() + { + iFileHandler->CancelScan(); + } + +// --------------------------------------------------------------------------- +// Add a file to the db by file name +// --------------------------------------------------------------------------- +// +void CMPXHarvesterEngine::AddFileL( RHvsMsg* aMsg, const TDesC& aFile, + MMPXHarvesterEngineObserver* aObs ) + { + // If it is a playlist, get playlist engine to extract, + // if it is a normal media file, we get file handler to extract + // + if( iPlaylistEngine->IsPlaylistL( aFile ) ) + { + iTaskQueue->AddTaskL( aMsg->Op(), aObs, this, 0, NULL, aMsg); + } + else + { + CMPXMedia* media(NULL); + TRAPD( err, + media = iFileHandler->AddFileL( aFile ) + ); + CleanupStack::PushL( media ); + aObs->HandleImportCompleteL( media, err, aMsg ); + CleanupStack::PopAndDestroy( media ); + } + } + +// --------------------------------------------------------------------------- +// Add a file to the db (with media properties) +// --------------------------------------------------------------------------- +// +TInt CMPXHarvesterEngine::AddFileL( CMPXMedia*& aMedia ) + { + return iFileHandler->AddFileL( *aMedia ); + } + +// --------------------------------------------------------------------------- +// Create a media object for the file +// --------------------------------------------------------------------------- +// +void CMPXHarvesterEngine::GetMediaL( RHvsMsg* aMsg, const TDesC& aFile, + MMPXHarvesterEngineObserver* aObs ) + { + // If it is a playlist, get playlist engine to extract, + // if it is a normal media file, we get file handler to extract + // + if( iPlaylistEngine->IsPlaylistL( aFile ) ) + { + iTaskQueue->AddTaskL( aMsg->Op(), aObs, this, 0, NULL, aMsg); + } + else + { + CMPXMedia* media(NULL); + TRAPD(err, media = iFileHandler->GetMediaForFileL(aFile)); + CleanupStack::PushL( media ); + aObs->HandleImportCompleteL( media, err, aMsg ); + CleanupStack::PopAndDestroy( media ); + } + } + +// --------------------------------------------------------------------------- +// Get collection id for the file +// --------------------------------------------------------------------------- +// +TInt CMPXHarvesterEngine::GetColUidL( const TDesC& aFile ) + { + return iFileHandler->GetColUidForFileL(aFile); + } + +// --------------------------------------------------------------------------- +// Remove a single file +// --------------------------------------------------------------------------- +// +TInt CMPXHarvesterEngine::RemoveFileL( const TDesC& aFile, TBool aDelete, TBool aEndTransaction ) + { + // Delete this file? If so, delete it from the file system, if a problem + // occurs deleting this file, the correlating entry in the harvester db + // is not removed. + // + if( aDelete ) + { + MPX_PERF_START( MPX_PERF_FS_DELETE ); + TInt err = iFsSession.Delete( aFile ); + MPX_PERF_END( MPX_PERF_FS_DELETE ); + if (err == KErrAccessDenied) + { + iFsSession.SetAtt(aFile,KEntryAttNormal,KEntryAttReadOnly); + err = iFsSession.Delete(aFile); + } + User::LeaveIfError( err ); + } + + MPX_PERF_START( MPX_PERF_HARV_DB_DELETE ); + TInt r = iFileHandler->RemoveFileL( aFile, aEndTransaction ); + MPX_PERF_END( MPX_PERF_HARV_DB_DELETE ); + return r; + } + +// --------------------------------------------------------------------------- +// Remove Multiple files +// --------------------------------------------------------------------------- +// +void CMPXHarvesterEngine::RemoveMultipleFilesL( const MDesCArray& aArray, + TBool aDelete, TBool aEndTransaction) + { + // + // delete the file from the file system before updating harvester database. + // delete one file from the file system and update that file in the harvester + // database one by one; otherwise, file system and database will be out of + // sync + // + if( aDelete ) + { + TInt c = aArray.MdcaCount(); + for( TInt i=0; iRemoveFilesL( aArray ); + } + } + +// --------------------------------------------------------------------------- +// Remove all files +// --------------------------------------------------------------------------- +// +void CMPXHarvesterEngine::RemoveAllFilesL() + { + iFileHandler->RemoveAllFilesL(); + } + +// --------------------------------------------------------------------------- +// Update a particular file +// --------------------------------------------------------------------------- +// +void CMPXHarvesterEngine::UpdateFileL( const TDesC& aFile, TInt aCollection ) + { + MPX_DEBUG1("CMPXHarvesterEngine::UpdateFileL <---"); + iFileHandler->UpdateFileL( aFile, aCollection ); + } + +// --------------------------------------------------------------------------- +// Update a particular file +// --------------------------------------------------------------------------- +// +void CMPXHarvesterEngine::RenameFileL( const TDesC& aOldPath, + const TDesC& aNewPath, + TInt aCollection ) + { + MPX_DEBUG1("CMPXHarvesterEngine::RenameFileL <---"); + iFileHandler->RenameFileL( aOldPath, aNewPath, aCollection ); + } + +// --------------------------------------------------------------------------- +// Export a playlist, asynchronous +// --------------------------------------------------------------------------- +// +void CMPXHarvesterEngine::ExportPlaylistL( + RHvsMsg* aMessage, + MMPXHarvesterEngineObserver* aObs ) + { + MPX_DEBUG1("CMPXHarvesterEngine::HandleExportPlaylistL <---"); + iTaskQueue->AddTaskL( aMessage->Op(), aObs, this, 0, NULL, aMessage); + } + +// --------------------------------------------------------------------------- +// Find the collection id +// --------------------------------------------------------------------------- +// +TInt CMPXHarvesterEngine::FindCollectionIdL( const TDesC& aFile ) + { + MPX_DEBUG1("CMPXHarvesterEngine::FindCollectionIDL <---"); + return iFileHandler->FindCollectionIdL( aFile ); + } + +// --------------------------------------------------------------------------- +// Import a playlist +// --------------------------------------------------------------------------- +// +void CMPXHarvesterEngine::ImportPlaylistL( + RHvsMsg* aMessage, + MMPXHarvesterEngineObserver* aObs ) + { + MPX_DEBUG1("CMPXHarvesterEngine::ImportPlaylistL <---"); + iTaskQueue->AddTaskL( aMessage->Op(), aObs, this, 0, NULL, aMessage); + } + +// --------------------------------------------------------------------------- +// Import a file +// --------------------------------------------------------------------------- +// +void CMPXHarvesterEngine::ImportFileL( RHvsMsg* aMessage, + MMPXHarvesterEngineObserver* aObs ) + { + MPX_DEBUG1("CMPXHarvesterEngine::ImportFileL <---"); + iTaskQueue->AddTaskL( aMessage->Op(), aObs, this, 0, NULL, aMessage); + } + +// --------------------------------------------------------------------------- +// Query the required attributes for tracks for the specified playlist type +// --------------------------------------------------------------------------- +const TArray CMPXHarvesterEngine::RequiredAttributesL(TInt aPlaylistType) const + { + iPlaylistEngine->PlaylistPluginHandler().SelectPlaylistPluginL(aPlaylistType); + + CMPXPlaylistPlugin* playlistPlugin = iPlaylistEngine->PlaylistPluginHandler().Plugin(); + if (!playlistPlugin) + { + User::Leave(KErrNotSupported); + } + return playlistPlugin->RequiredAttributes(); + } + +// --------------------------------------------------------------------------- +// Query the optional attributes for tracks for the specified playlist type +// --------------------------------------------------------------------------- +const TArray CMPXHarvesterEngine::OptionalAttributesL(TInt aPlaylistType) const + { + iPlaylistEngine->PlaylistPluginHandler().SelectPlaylistPluginL(aPlaylistType); + + CMPXPlaylistPlugin* playlistPlugin = iPlaylistEngine->PlaylistPluginHandler().Plugin(); + if (!playlistPlugin) + { + User::Leave(KErrNotSupported); + } + return playlistPlugin->OptionalAttributes(); + } + +// --------------------------------------------------------------------------- +// Query the optional attributes for tracks for the specified playlist type +// --------------------------------------------------------------------------- +const TDesC& CMPXHarvesterEngine::PlaylistFileExtensionL(TInt aPlaylistType) const + { + iPlaylistEngine->PlaylistPluginHandler().SelectPlaylistPluginL(aPlaylistType); + + CMPXPlaylistPlugin* playlistPlugin = iPlaylistEngine->PlaylistPluginHandler().Plugin(); + if (!playlistPlugin) + { + User::Leave(KErrNotSupported); + } + return playlistPlugin->FileExtension(); + } + +// --------------------------------------------------------------------------- +// Determines if the given file is a playlist +// --------------------------------------------------------------------------- +// +TBool CMPXHarvesterEngine::IsPlaylistL( const TDesC& aFile ) + { + MPX_DEBUG1("CMPXHarvesterEngine::IsPlaylistL <---"); + return iPlaylistEngine->IsPlaylistL( aFile ); + } + +// --------------------------------------------------------------------------- +// Determines if the given file is a playlist +// --------------------------------------------------------------------------- +// +void CMPXHarvesterEngine::RecreateDatabases() + { + MPX_DEBUG1("CMPXHarvesterEngine::RecreateDatabasesL"); + iFileHandler->RecreateDatabases(); + } + +// --------------------------------------------------------------------------- +// Checks for any system events +// --------------------------------------------------------------------------- +// +void CMPXHarvesterEngine::CheckForSystemEvents() + { + MPX_DEBUG1("CMPXHarvesterEngine::CheckForSystemEventsL()"); + + // Check for formatting, mtp and usb + // No need to check for disk inserted or not because we + // wont be able to open the db anyways. + // + iFormatMonitor->PollStatus(); + iUSBMonitor->PollStatus(); + } + +// --------------------------------------------------------------------------- +// Handling system events +// --------------------------------------------------------------------------- +// +void CMPXHarvesterEngine::HandleSystemEventL( TSystemEvent aEvent, + TInt aData ) + { + MPX_DEBUG2("CMPXHarvesterEngine::HandleSystemEventL %i <---", aEvent); + + // The engine is a delegator, it sends the events to + // different classes to do the actual work + TRAPD( openErr, iFileHandler->HandleSystemEventL( aEvent, aData ) ); + + // Avoid Message queue already exist problem + // + TBool notify(ETrue); + switch( aEvent ) + { + case EPowerKeyEjectEvent: + { + notify=EFalse; + TRAP_IGNORE( DoStopPlaybackL() ); + break; + } + case EFormatStartEvent: + case EUSBMassStorageStartEvent: // deliberate fall through + case EUSBMTPStartEvent: // deliberate fall through + case EDiskInsertedEvent: // deliberate fall through + case EDiskRemovedEvent: // deliberate fall through + { + iDiskOpActive = ETrue; + TRAP_IGNORE( DoStopPlaybackL() ); + } + default: //lint !e616 !e825 + if( !iTempCollectionUtil ) + { + iTempCollectionUtil = MMPXCollectionUtility::NewL( NULL, KMcModeDefault ); + } + break; + } + + // Send a message to the collection server about the event + // + if( notify ) + { + TRAP_IGNORE( + iTempCollectionUtil->Collection().NotifyL( (TMPXCollectionBroadCastMsg)aEvent, + aData ) + ); + } + + // Avoid Message queue already exist problem + // + switch( aEvent ) + { + case EFormatEndEvent: + { + // On some, the formatting app remounts + // the disk before it is writable, so + // we have to "fake" the insert event back after the + // format is actually done + // + if( openErr == KErrNone ) + { + HandleSystemEventL( EDiskInsertedEvent, aData ); + } + } // deliberate fall through + case EUSBMassStorageEndEvent: // deliberate fall through + case EUSBMTPEndEvent: // deliberate fall through + iDiskOpActive = EFalse; + default: //lint !e616 !e825 + if( iTempCollectionUtil && !iDiskOpActive ) + { + iTempCollectionUtil->Close(); + iTempCollectionUtil = NULL; + } + } + } + +// --------------------------------------------------------------------------- +// Execute task queue events +// --------------------------------------------------------------------------- +// +void CMPXHarvesterEngine::ExecuteTask(TInt aTask, + TInt /*aParamData*/, + TAny* aPtrData, + const CBufBase& /*aBuf*/, + TAny* aCallback, + CBase* /*aCObject1*/, + CBase* /*aCObject2*/) + { + MPX_DEBUG1("CMPXHarvesterEngine::ExecuteTask <---"); + + // Execute the next task in the queue + // + // + TInt err( KErrNone ); + switch( aTask ) + { + case EHvsServerGetMedia: + case EHvsServerAddFile: + case EHvsServerImportPlaylist: // deliberate fall through + TRAP( err, DoImportPlaylistL( (RHvsMsg*) aPtrData ) ); + break; + + case EHvsServerExportPlaylist: + TRAP( err, DoExportPlaylistL( (RHvsMsg*) aPtrData ) ); + break; + case EHvsServerImportFile: + TRAP( err, DoImportFileL( (RHvsMsg*) aPtrData ) ); + break; + default: + break; + } + + // If we failed, we complete with error. + // + if( err != KErrNone ) + { + MPX_DEBUG2("CMPXHarvesterEngine::ExecuteTask err %i", err ); + MMPXHarvesterEngineObserver* obs = + (MMPXHarvesterEngineObserver*) aCallback; + obs->CompleteTask( (RHvsMsg*) aPtrData, err ); + iTaskQueue->CompleteTask(); + } + } + +// ---------------------------------------------------------------------------- +// Indicates that a task was terminated with an error +// ---------------------------------------------------------------------------- +// +void CMPXHarvesterEngine::HandleTaskError( + TInt /* aTask */, + TAny* /*aPtrData*/, + TAny* /*aCallback*/, + TInt /* aError */) + { + // Do Nothing + } + +// --------------------------------------------------------------------------- +// Handle the completion of importing a playlist +// --------------------------------------------------------------------------- +// +void CMPXHarvesterEngine::HandlePlaylistL( CMPXMedia* aPlaylist, + const TInt aError, + const TBool /*aCompleted*/ ) + { + MPX_DEBUG2("CMPXHarvesterEngine::HandlePlaylistL err %i", aError ); + TInt err( aError ); + if( iCurAsyncOp != EHvsServerImportPlaylist && iCurAsyncOp != EHvsServerAddFile && + iCurAsyncOp != EHvsServerImportFile && iCurAsyncOp != EHvsServerGetMedia) + { + err = KErrArgument; + } + + if( aPlaylist ) + { + CleanupStack::PushL( aPlaylist ); + } + + // If we were adding a file, we need to add it to file handler as well + if( iCurAsyncOp == EHvsServerAddFile && aPlaylist ) + { + iFileHandler->AddFileL( *aPlaylist ); + } + + // Complete the message and tell the client + // + MMPXHarvesterEngineObserver* obs = (MMPXHarvesterEngineObserver*) + iTaskQueue->Callback(); + RHvsMsg* msg = (RHvsMsg*) iTaskQueue->PtrData(); + if( err == KErrNone ) + { + obs->HandleImportCompleteL( aPlaylist, err, msg ); + } + else + { + obs->HandleImportCompleteL( NULL, err, msg ); + } + iTaskQueue->CompleteTask(); + + if( aPlaylist ) + { + CleanupStack::PopAndDestroy( aPlaylist ); + } + } + +// --------------------------------------------------------------------------- +// Handle the completion of exporting a playlist +// --------------------------------------------------------------------------- +// +void CMPXHarvesterEngine::HandlePlaylistL(const TDesC& aPlaylistUri, + const TInt aError) + { + MPX_DEBUG2("CMPXHarvesterEngine::HandlePlaylistL err %i", aError ); + + TInt err( aError ); + if( iCurAsyncOp != EHvsServerExportPlaylist ) + { + err = KErrArgument; + } + + // Complete the message and tell the client + // + MMPXHarvesterEngineObserver* obs = (MMPXHarvesterEngineObserver*) + iTaskQueue->Callback(); + RHvsMsg* msg = (RHvsMsg*) iTaskQueue->PtrData(); + if ( err == KErrNone ) + { + CMPXMedia* media(NULL); + ::NewFromMessageL( msg->Message(), 0, media ); + CleanupStack::PushL( media ); + + // set playlist uri + media->SetTextValueL( + TMPXAttribute(KMPXMediaIdGeneral, EMPXMediaGeneralUri), + aPlaylistUri); + + obs->HandleExportCompleteL( media, err, msg ); + CleanupStack::PopAndDestroy( media ); + } + else + { + obs->HandleExportCompleteL( NULL, err, msg ); + } + iTaskQueue->CompleteTask(); + } + +// --------------------------------------------------------------------------- +// Does the actual work for exporting a playlist +// --------------------------------------------------------------------------- +// +void CMPXHarvesterEngine::DoExportPlaylistL( RHvsMsg* aMsg ) + { + MPX_DEBUG1("CMPXHarvesterEngine::DoExportPlaylistL <---"); + iCurAsyncOp = EHvsServerExportPlaylist; + + // Unpack the message + // + CMPXMedia* media(NULL); + ::NewFromMessageL( aMsg->Message(), 0, media ); + CleanupStack::PushL( media ); + + HBufC* path = HBufC::NewLC( aMsg->Message().GetDesLength(1) ); + TPtr ptr = path->Des(); + aMsg->Message().Read( 1, ptr ); + + TPckgBuf t; + aMsg->Message().Read(2, t); + TInt plType = t(); + + // Find the playlist plugin + CMPXPlaylistPluginHandler& plHandler = + iPlaylistEngine->PlaylistPluginHandler(); + plHandler.SelectPlaylistPluginL( plType ); + + // Call playlist engine + // + iPlaylistEngine->ExternalizePlaylistL( *media, *path ); + + // Cleanup + CleanupStack::PopAndDestroy( 2, media ); + MPX_DEBUG1("CMPXHarvesterEngine::DoExportPlaylistL --->"); + } + +// --------------------------------------------------------------------------- +// Does the actual work for importing a playlist +// --------------------------------------------------------------------------- +// +void CMPXHarvesterEngine::DoImportPlaylistL( RHvsMsg* aMsg ) + { + MPX_DEBUG1("CMPXHarvesterEngine::DoImportPlaylistL <---"); + iCurAsyncOp = aMsg->Op(); + + // Unpack the message + // + HBufC* filename = HBufC::NewLC( aMsg->Message().GetDesLength(0) ); + TPtr ptr = filename->Des(); + aMsg->Message().Read(0, ptr ); + + // Call playlist engine + // + iPlaylistEngine->InternalizePlaylistL( *filename ); + + // Cleanup + CleanupStack::PopAndDestroy( filename ); + MPX_DEBUG1("CMPXHarvesterEngine::DoImportPlaylistL --->"); + } + +// --------------------------------------------------------------------------- +// Does the actual work for importing a file +// --------------------------------------------------------------------------- +// +void CMPXHarvesterEngine::DoImportFileL( RHvsMsg* aMsg ) + { + MPX_DEBUG1("CMPXHarvesterEngine::DoImportFileL <---"); + iCurAsyncOp = aMsg->Op(); + + // Unpack the message + // + HBufC* filename = HBufC::NewLC( aMsg->Message().GetDesLength(0) ); + TPtr ptr = filename->Des(); + aMsg->Message().Read(0, ptr ); + + if( iPlaylistEngine->IsPlaylistL( *filename ) ) + { + // Call playlist engine + iPlaylistEngine->InternalizePlaylistL( *filename ); + } + else + { + // Import file details + CMPXMedia* media = CMPXMedia::NewL(); + CleanupStack::PushL( media ); + media->SetTObjectValueL( TMPXAttribute(KMPXMediaIdGeneral, + EMPXMediaGeneralType), + EMPXItem ); + media->SetTObjectValueL( TMPXAttribute(KMPXMediaIdGeneral, + EMPXMediaGeneralCategory), + EMPXSong ); + + media->SetTextValueL( TMPXAttribute(KMPXMediaIdGeneral, + EMPXMediaGeneralUri), + *filename ); + + // Callback to observer + MMPXHarvesterEngineObserver* obs = (MMPXHarvesterEngineObserver*) + iTaskQueue->Callback(); + obs->HandleImportCompleteL( media, KErrNone, aMsg ); + CleanupStack::PopAndDestroy( media ); + + // Task is completed for file case + iTaskQueue->CompleteTask(); + } + + // Cleanup + CleanupStack::PopAndDestroy( filename ); + MPX_DEBUG1("CMPXHarvesterEngine::DoImportFileL --->"); + } + +// --------------------------------------------------------------------------- +// Stop playback +// --------------------------------------------------------------------------- +// +void CMPXHarvesterEngine::DoStopPlaybackL() + { + MMPXPlaybackUtility* pbUtil = MMPXPlaybackUtility::UtilityL( KPbModeActivePlayer ); + CleanupClosePushL( *pbUtil ); + + CMPXCommand* closeCmd = CMPXCommand::NewL(); + CleanupStack::PushL( closeCmd ); + + // Send a stop command + closeCmd->SetTObjectValueL(KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral); + closeCmd->SetTObjectValueL(KMPXCommandGeneralDoSync, ETrue); + closeCmd->SetTObjectValueL(KMPXCommandPlaybackGeneralType,EPbCmdStop); + closeCmd->SetTObjectValueL(KMPXCommandPlaybackGeneralNoBuffer, ETrue); + pbUtil->CommandL( *closeCmd ); + + // Send a clear buffer command + closeCmd->SetTObjectValueL(KMPXCommandPlaybackGeneralType,EPbCmdClearKeyBuffer); + pbUtil->CommandL( *closeCmd ); + CleanupStack::PopAndDestroy( closeCmd ); + + CleanupStack::Pop( pbUtil ); + pbUtil->Close(); + } + +// --------------------------------------------------------------------------- +// Close the database transaction +// --------------------------------------------------------------------------- +// +void CMPXHarvesterEngine::CloseTransactionL() + { + iFileHandler->CloseTransactionL(); + } + +// END OF FILE + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/server/src/mpxharvesterserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/server/src/mpxharvesterserver.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,182 @@ +/* +* Copyright (c) 2006 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 Server +* +*/ + + +#include +#include + +#include "mpxharvestercommon.h" +#include "mpxharvesterserver.h" +#include "mpxharvesterengine.h" +#include "mpxharvestersession.h" +#include "mpxharvesterserverdefs.h" + +// CONSTANTS + +// Server Security Policy +const TUint KMPXHarvesterServerRangeCount = 2; +const TInt KMPXHarvesterServerRanges[KMPXHarvesterServerRangeCount] = + { + 0, //range is [0-EHvsServerOpCount) + EHvsServerOpCount //range is [EHvsServerOpCount-KMaxTInt] + }; +const TUint8 KMPXHarvesterSeverElementsIndex[KMPXHarvesterServerRangeCount] = + { + 0, + CPolicyServer::ENotSupported + }; + +const CPolicyServer::TPolicyElement KMPXHarvesterServerPolicyElements[] = + { + {_INIT_SECURITY_POLICY_C1(ECapabilityWriteDeviceData), + CPolicyServer::EFailClient} + }; + +const CPolicyServer::TPolicy KMPXHarvesterServerPolicy = + { + CPolicyServer::EAlwaysPass, //specifies all connect attempts should pass + KMPXHarvesterServerRangeCount, + KMPXHarvesterServerRanges, + KMPXHarvesterSeverElementsIndex, + KMPXHarvesterServerPolicyElements + }; + + +// ============================ LOCAL FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Start Harvester Server +// ---------------------------------------------------------------------------- +// +LOCAL_C void StartServerL() + { + User::LeaveIfError(User::RenameThread(KMPXHarvesterServerName)); + CActiveScheduler* scheduler = new(ELeave)CActiveScheduler; + CleanupStack::PushL(scheduler); + CActiveScheduler::Install(scheduler); + CMPXHarvesterServer* server = CMPXHarvesterServer::NewL(); + CleanupStack::PushL(server); + RProcess::Rendezvous(KErrNone); + CActiveScheduler::Start(); + CActiveScheduler::Install(NULL); + CleanupStack::PopAndDestroy(server); + CleanupStack::PopAndDestroy(scheduler); + } + +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CMPXHarvesterServer* CMPXHarvesterServer::NewL() + { + CMPXHarvesterServer *server = new(ELeave) CMPXHarvesterServer( + EMPXHarvesterServerPriority, + KMPXHarvesterServerPolicy); + CleanupStack::PushL(server); + server->ConstructL(); + CleanupStack::Pop(server); + return server; + } + +// ---------------------------------------------------------------------------- +// C++ constructor can NOT contain any code that might leave. +// ---------------------------------------------------------------------------- +// +CMPXHarvesterServer::CMPXHarvesterServer(TInt aPriority, const TPolicy &aPolicy) + : CPolicyServer(aPriority, aPolicy) + {} + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CMPXHarvesterServer::~CMPXHarvesterServer() + { + delete iEngine; + } + +// ---------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ---------------------------------------------------------------------------- +// +void CMPXHarvesterServer::ConstructL() + { + iEngine = CMPXHarvesterEngine::NewL(); + StartL(KMPXHarvesterServerName); + RProcess().SetPriority(::EPriorityLow); + } + +// ---------------------------------------------------------------------------- +// Increments number of sessions this server holds +// ---------------------------------------------------------------------------- +// +void CMPXHarvesterServer::AddClient() + { + iClients++; + } + + +// ---------------------------------------------------------------------------- +// Decrement the number of clients currently connected to the harvester server +// ---------------------------------------------------------------------------- +// +void CMPXHarvesterServer::RemoveClient() + { + iClients--; + ASSERT(iClients>=0); + } + +// ---------------------------------------------------------------------------- +// Create a new session +// ---------------------------------------------------------------------------- +// +CSession2* CMPXHarvesterServer::NewSessionL(const TVersion& aVersion, + const RMessage2& /*aMessage*/) const + { + TVersion v(KMPXHarvesterServerMajorVersionNumber, + KMPXHarvesterServerMinorVersionNumber, + KMPXHarvesterServerBuildVersionNumber); + if (!User::QueryVersionSupported(v,aVersion)) + { + User::Leave(KErrNotSupported); + } + return CMPXHarvesterSession::NewL(*(const_cast(this)), + *iEngine); + } + +// ---------------------------------------------------------------------------- +// Server exe entry +// ---------------------------------------------------------------------------- +// +TInt E32Main() + { + __UHEAP_MARK; + // + CTrapCleanup* cleanup=CTrapCleanup::New(); + TInt r(KErrNoMemory); + if (cleanup) + { + TRAP(r,StartServerL()); + } + + delete cleanup; + __UHEAP_MARKEND; + return r; + } + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/server/src/mpxharvestersession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/server/src/mpxharvestersession.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,590 @@ +/* +* Copyright (c) 2006 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 server session +* +*/ + +#include +#include +#include +#include +#include +#include +#include +#include "mpxharvestercommon.h" +#include "mpxharvestersession.h" +#include "mpxharvesterserver.h" +#include "mpxharvesterengine.h" + +// ============================ LOCAL FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Panic client +// ---------------------------------------------------------------------------- +// +LOCAL_C void PanicClient(const RMessage2 &aMessage,TInt aPanic) + { + _LIT(KTxtServer,"Harvester Server Session"); + aMessage.Panic(KTxtServer,aPanic); + } + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CMPXHarvesterSession* CMPXHarvesterSession::NewL( + CMPXHarvesterServer& aServer, + CMPXHarvesterEngine& aEngine) + { + CMPXHarvesterSession* s = new(ELeave)CMPXHarvesterSession(aServer, aEngine); + CleanupStack::PushL(s); + s->ConstructL(); + CleanupStack::Pop(s); + return s; + } + +// ---------------------------------------------------------------------------- +// C++ constructor can NOT contain any code that might leave. +// ---------------------------------------------------------------------------- +// +CMPXHarvesterSession::CMPXHarvesterSession(CMPXHarvesterServer& aServer, + CMPXHarvesterEngine& aEngine) + : iServer(aServer), iEngine(aEngine) + { + iServer.AddClient(); + } + +// ---------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ---------------------------------------------------------------------------- +// +void CMPXHarvesterSession::ConstructL() + { + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CMPXHarvesterSession::~CMPXHarvesterSession() + { + iServer.RemoveClient(); + delete iDes; + delete iDes8; + delete iBuffer; + delete iMedia; + + iMessages.ResetAndDestroy(); + iMessages.Close(); + } + +// ---------------------------------------------------------------------------- +// Service request +// ---------------------------------------------------------------------------- +// +void CMPXHarvesterSession::ServiceL(const RMessage2& aMessage) + { + // Default ServiceErrorL() will complete the message if ServiceL() leaves + DispatchMessageL(aMessage); + } + +// ---------------------------------------------------------------------------- +// Handle Import Complete +// ---------------------------------------------------------------------------- +// +void CMPXHarvesterSession::HandleImportCompleteL( CMPXMedia* aMedia, + TInt aErr, + RHvsMsg* aMsg ) + { + TInt r(0); + if( aErr == KErrNone ) + { + // Keep media alive + delete iMedia; + iMedia = NULL; + iMedia = CMPXMedia::NewL( *aMedia ); + + // Serialize the media property to iBuffer + ::CreateBufferL( *aMedia, iBuffer ); + r = iBuffer->Size(); + } + CompleteMessage( aMsg, aErr < 0 ? aErr : r ); + } + +// ---------------------------------------------------------------------------- +// Handle Export Complete +// ---------------------------------------------------------------------------- +// +void CMPXHarvesterSession::HandleExportCompleteL( CMPXMedia* aMedia, + TInt aErr, + RHvsMsg* aMsg ) + { + TInt r(0); + if( aErr == KErrNone ) + { + // Keep media alive + delete iMedia; + iMedia = NULL; + + iMedia = CMPXMedia::NewL( *aMedia ); + + // Serialize the media property to iBuffer + ::CreateBufferL( *aMedia, iBuffer ); + r = iBuffer->Size(); + } + CompleteMessage( aMsg, aErr < 0 ? aErr : r ); + } + +// ---------------------------------------------------------------------------- +// Handles task completion with error +// ---------------------------------------------------------------------------- +// +void CMPXHarvesterSession::CompleteTask( RHvsMsg* aMsg, TInt aErr ) + { + CompleteMessage( aMsg, aErr ); + } + +// ---------------------------------------------------------------------------- +// Message dispatcher +// ---------------------------------------------------------------------------- +// +void CMPXHarvesterSession::DispatchMessageL(const RMessage2& aMessage) + { + MPX_DEBUG1(_L("CMPXHarvesterSession::DispatchMessageL <---")); + + TInt op(aMessage.Function()); + + switch(op) + { + case EHvsServerGetBuffer: + { + ASSERT( iBuffer ); + aMessage.WriteL(0,iBuffer->Ptr(0)); + delete iBuffer; + iBuffer = NULL; + aMessage.Complete( KErrNone ); + break; + } + case EHvsServerScan: + { + DoScanL(); + aMessage.Complete( KErrNone ); + break; + } + case EHvsServerCancelScan: + { + aMessage.Complete( KErrNone ); + DoCancelScan(); + break; + } + case EHvsServerShutdown: + { + DoShutdown(); + aMessage.Complete( KErrNone ); + break; + } + case EHvsServerAddFile: + { + ReadDesL( aMessage, 0 ); // file path + RHvsMsg* msg = SetAsyncL( aMessage, (TMPXHarvesterServerOp) op ); + DoAddFileL( msg ); + break; + } + case EHvsServerAddFileMedia: + { + TInt r = DoAddMediaPropL( aMessage ); + aMessage.Complete( r ); + break; + } + case EHvsServerGetMedia: + { + ReadDesL( aMessage, 0 ); // file path + RHvsMsg* msg = SetAsyncL( aMessage, (TMPXHarvesterServerOp) op ); + DoGetMediaL( msg ); + break; + } + case EHvsServerGetColUid: + { + TInt r = DoGetColUidL( aMessage ); + aMessage.Complete( r ); + break; + } + case EHvsServerRemoveFile: + { + ReadDesL( aMessage, 0 ); // file path + TPckgBuf del; + aMessage.Read( 1, del); + + TInt r = iEngine.RemoveFileL( *iDes, del() ); + aMessage.Complete( r ); + break; + } + case EHvsServerRemoveFiles: + { + DoRemoveMultipleFilesL( aMessage ); + aMessage.Complete( KErrNone ); + break; + } + + case EHvsServerRemoveAllFiles: + { + iEngine.RemoveAllFilesL(); + aMessage.Complete( KErrNone ); + break; + } + case EHvsServerUpdateFile: + { + DoUpdateFileL( aMessage ); + aMessage.Complete( KErrNone ); + break; + } + case EHvsServerRenameFile: + { + DoRenameFileL( aMessage ); + aMessage.Complete( KErrNone ); + break; + } + case EHvsServerExportPlaylist: + { + // Async, complete later + RHvsMsg* msg = SetAsyncL( aMessage, (TMPXHarvesterServerOp) op ); + TRAPD( err, iEngine.ExportPlaylistL( msg, this ) ); + if( err != KErrNone ) + { + CompleteMessage( msg, err ); + } + break; + } + case EHvsServerImportPlaylist: + { + RHvsMsg* msg = SetAsyncL( aMessage, (TMPXHarvesterServerOp) op ); + TRAPD( err, iEngine.ImportPlaylistL( msg, this ) ); + if( err != KErrNone ) + { + CompleteMessage( msg, err ); + } + break; + } + case EHvsServerFindColID: + { + ReadDesL( aMessage, 0 ); // file path + TInt r=iEngine.FindCollectionIdL( *iDes ); + aMessage.Complete( r ); + break; + } + case EHvsServerReqAttr: + { + TPckgBuf playlistType; + aMessage.Read(0, playlistType ); + TArray requiredAttributes=iEngine.RequiredAttributesL( playlistType() ); + ::CreateBufferL( requiredAttributes, iBuffer ); //lint !e1024 !e1703 !e1514 !e64 + aMessage.Complete( iBuffer->Size() ); + break; + } + case EHvsServerOptAttr: + { + TPckgBuf playlistType; + aMessage.Read(0, playlistType ); + TArray optionalAttributes=iEngine.OptionalAttributesL( playlistType() ); + ::CreateBufferL( optionalAttributes, iBuffer ); //lint !e1024 !e1703 !e1514 !e64 + aMessage.Complete( iBuffer->Size() ); + break; + } + case EHvsServerPlaylistFileExt: + { + TPckgBuf playlistType; + aMessage.Read(0, playlistType ); + const TDesC& fileExtension=iEngine.PlaylistFileExtensionL( playlistType() ); + aMessage.WriteL(1,fileExtension); + aMessage.Complete( KErrNone ); + break; + } + case EHvsServerIsPlaylist: + { + ReadDesL( aMessage, 0 ); // file path + TBool r=iEngine.IsPlaylistL( *iDes ); + aMessage.Complete( r ); + break; + } + case EHvsServerImportFile: + { + RHvsMsg* msg = SetAsyncL( aMessage, (TMPXHarvesterServerOp) op ); + TRAPD( err, iEngine.ImportFileL( msg, this ) ); + if( err != KErrNone ) + { + CompleteMessage( msg, err ); + } + break; + } + case EHvsServerReCreateDB: + { + iEngine.RecreateDatabases(); + aMessage.Complete( KErrNone ); + break; + } + case EHvsServerCheckSystemEvent: + { + iEngine.CheckForSystemEvents(); + aMessage.Complete( KErrNone ); + break; + } + case EHvsServerCloseTransaction: + { + TRAPD( err, iEngine.CloseTransactionL() ); + aMessage.Complete( err ); + break; + } + default: + PanicClient(aMessage, KErrNotFound); + break; + } + + MPX_DEBUG1(_L("CMPXHarvesterSession::DispatchMessageL --->")); + } + +// ---------------------------------------------------------------------------- +// Start scanning for new files +// ---------------------------------------------------------------------------- +// +void CMPXHarvesterSession::DoScanL() + { + MPX_DEBUG1(_L("CMPXHarvesterSession::DoScanL <---")); + iEngine.ScanL(); + MPX_DEBUG1(_L("CMPXHarvesterSession::DoScanL --->")); + } + +// ---------------------------------------------------------------------------- +// Cancel a scanning operation +// ---------------------------------------------------------------------------- +// +void CMPXHarvesterSession::DoCancelScan() + { + MPX_DEBUG1(_L("CMPXHarvesterSession::DoCancelScanL <---")); + iEngine.CancelScan(); + MPX_DEBUG1(_L("CMPXHarvesterSession::DoCancelScanL --->")); + } + +// ---------------------------------------------------------------------------- +// Shutdown the server, only used for memory leak testing +// ---------------------------------------------------------------------------- +// +void CMPXHarvesterSession::DoShutdown() + { + MPX_DEBUG1(_L("CMPXHarvesterSession::DoShutdown <---")); + CActiveScheduler::Stop(); + MPX_DEBUG1(_L("CMPXHarvesterSession::DoShutdown --->")); + } + +// ---------------------------------------------------------------------------- +// Handles adding a file +// ---------------------------------------------------------------------------- +// +void CMPXHarvesterSession::DoAddFileL( RHvsMsg* aMsg ) + { + MPX_DEBUG1(_L("CMPXHarvesterSession::DoAddFileL <---")); + iEngine.AddFileL( aMsg ,*iDes, this ); + MPX_DEBUG1(_L("CMPXHarvesterSession::DoAddFileL <---")); + } + +// ---------------------------------------------------------------------------- +// Handle adding a media property +// ---------------------------------------------------------------------------- +// +TInt CMPXHarvesterSession::DoAddMediaPropL( const RMessage2& aMessage ) + { + MPX_DEBUG1(_L("CMPXHarvesterSession::DoAddMediaPropL <---")); + CMPXMedia* prop( NULL ); + ::NewFromMessageL( aMessage, 0, prop ); + + CleanupStack::PushL( prop ); + TInt r = iEngine.AddFileL( prop ); + CleanupStack::PopAndDestroy( prop ); + + MPX_DEBUG1(_L("CMPXHarvesterSession::DoAddMediaPropL --->")); + return r; + } + +// ---------------------------------------------------------------------------- +// Handles media creation for a file +// ---------------------------------------------------------------------------- +// +void CMPXHarvesterSession::DoGetMediaL( RHvsMsg* aMsg ) + { + MPX_DEBUG1(_L("CMPXHarvesterSession::DoGetMediaL <---")); + iEngine.GetMediaL( aMsg ,*iDes, this ); + MPX_DEBUG1(_L("CMPXHarvesterSession::DoGetMediaL --->")); + } + +// ---------------------------------------------------------------------------- +// Handle getting collection id +// ---------------------------------------------------------------------------- +// +TInt CMPXHarvesterSession::DoGetColUidL( const RMessage2& aMessage ) + { + MPX_DEBUG1(_L("CMPXHarvesterSession::DoGetColUidL <---")); + + HBufC* buf = HBufC::NewLC(aMessage.GetDesLengthL(0)); + TPtr ptr = buf->Des(); + aMessage.Read(0,ptr); + + TInt r = iEngine.GetColUidL( *buf ); + CleanupStack::PopAndDestroy( buf ); + + MPX_DEBUG1(_L("CMPXHarvesterSession::DoGetColUidL --->")); + return r; + } + +// ---------------------------------------------------------------------------- +// Remove multiple songs from the harvester db +// ---------------------------------------------------------------------------- +// +void CMPXHarvesterSession::DoRemoveMultipleFilesL( const RMessage2& aMessage ) + { + MPX_DEBUG1(_L("CMPXHarvesterSession::DoRemoveMultipleSongsL <---")); + + // Buffer with the array + // + CDesCArray* array( NULL ); + CBufBase* buffer( NULL ); + MPXUser::RecreateBufferL(aMessage.GetDesLengthL(0), buffer); + CleanupStack::PushL( buffer ); + TPtr8 ptr = buffer->Ptr(0); + User::LeaveIfError( aMessage.Read( 0, ptr ) ); + MPXUser::CreateFromBufferL( *buffer, array ); + CleanupStack::PopAndDestroy( buffer ); + + if( array ) + { + CleanupStack::PushL( array ); + + // Check if we want to delete the files + // + TPckgBuf del; + aMessage.Read( 1, del ); + TPckgBuf endTransaction; + TInt error = aMessage.Read( 2, endTransaction ); + TInt endDbTransaction(1); // If endTranscation is not sent, assume True to commit the db. + if ( !error ) + { + endDbTransaction = endTransaction(); + } + // Engine to do the work + // + iEngine.RemoveMultipleFilesL(*array, del(), endDbTransaction ); + + CleanupStack::PopAndDestroy( array ); + } + else + { + // Array was NULL; + User::Leave( KErrArgument ); + } + + MPX_DEBUG1(_L("CMPXHarvesterSession::DoRemoveMultipleSongsL --->")); + } + +// ---------------------------------------------------------------------------- +// Unpacks an RMessage2 and calls update functions in the engine +// ---------------------------------------------------------------------------- +// +void CMPXHarvesterSession::DoUpdateFileL( const RMessage2& aMessage ) + { + // Path of the object + HBufC* buf = HBufC::NewLC(aMessage.GetDesLengthL(0)); + TPtr ptr = buf->Des(); + aMessage.Read(0,ptr); + + // New collection ID + TPckgBuf collection; + aMessage.Read(1, collection ); + + iEngine.UpdateFileL( *buf, collection() ); + CleanupStack::PopAndDestroy( buf ); + } + +// ---------------------------------------------------------------------------- +// Unpacks an RMessage2 and calls rename function in the engine +// ---------------------------------------------------------------------------- +// +void CMPXHarvesterSession::DoRenameFileL( const RMessage2& aMessage ) + { + // Path of the object + HBufC* oldPath = HBufC::NewLC(aMessage.GetDesLengthL(0)); + TPtr oldPathPtr = oldPath->Des(); + aMessage.Read(0,oldPathPtr); + + // Path of the object + HBufC* newPath = HBufC::NewLC(aMessage.GetDesLengthL(1)); + TPtr newPathPtr = newPath->Des(); + aMessage.Read(1,newPathPtr); + + // collection Id of the object + TPckgBuf collection; + aMessage.Read(2, collection ); + + iEngine.RenameFileL( *oldPath, *newPath, collection() ); + CleanupStack::PopAndDestroy( 2, oldPath ); // newPath, oldPath + } + +// ---------------------------------------------------------------------------- +// Sets this message as asynchronous and adds it to internal list +// ---------------------------------------------------------------------------- +// +RHvsMsg* CMPXHarvesterSession::SetAsyncL( const RMessage2& aMessage, + TMPXHarvesterServerOp aOp ) + { + RHvsMsg* msg = new(ELeave) RHvsMsg( aMessage, aOp ); + iMessages.Append( msg ); + return msg; + } + +// ---------------------------------------------------------------------------- +// Complete an async message +// ---------------------------------------------------------------------------- +// +void CMPXHarvesterSession::CompleteMessage( RHvsMsg*& aMessage, + TInt aErr ) + { + TInt count = iMessages.Count(); + for( TInt i=0; iMessage().Complete( aErr ); + delete iMessages[i]; + iMessages.Remove(i); + break; + } + } + } + +// ---------------------------------------------------------------------------- +// Reads a descriptor from the message, allocated into iDes +// ---------------------------------------------------------------------------- +// +const TDesC& CMPXHarvesterSession::ReadDesL(const RMessage2& aMessage, + TInt aMsgSlot) + { + TInt s=aMessage.GetDesLengthL(aMsgSlot); + delete iDes; + iDes=NULL; + iDes=HBufC::NewL(s); + TPtr p=iDes->Des(); + aMessage.ReadL(aMsgSlot,p); + return *iDes; + } + +// END OF FILE + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/server/src/mpxmediaremovalmonitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/server/src/mpxmediaremovalmonitor.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,172 @@ +/* +* Copyright (c) 2006 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: Monitors for Media removal +* +*/ + + +#include +#include +#include +#include "mpxmediaremovalmonitor.h" + +// --------------------------------------------------------------------------- +// C++ Constructor +// --------------------------------------------------------------------------- +// +CMPXMediaRemovalMonitor::CMPXMediaRemovalMonitor + ( TInt aDrive, RFs& aFs, MMPXSystemEventObserver& aObserver ) + : CActive(EPriorityHigh), + iDrive( aDrive ), + iFs( aFs ), + iDiskRemoved( EFalse ), + iObserver( aObserver ) + + { + CActiveScheduler::Add(this); + } + + +// --------------------------------------------------------------------------- +// 2nd Phase Constructor +// --------------------------------------------------------------------------- +// +void CMPXMediaRemovalMonitor::ConstructL() + { + MPX_DEBUG1(_L("CMPXMediaRemovalMonitor::ConstructL <---")); + + // Initial state + TDriveInfo drive; + User::LeaveIfError(iFs.Drive(drive, TInt(iDrive))); + iDiskRemoved = (drive.iType == EMediaNotPresent); + + // Start listening + TNotifyType notType(ENotifyDisk); + iFs.NotifyChange( notType, iStatus ); + SetActive(); + + MPX_DEBUG1(_L("CMPXMediaRemovalMonitor::ConstructL --->")); + } + + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXMediaRemovalMonitor* CMPXMediaRemovalMonitor::NewL + ( TInt aDrive, RFs& aFs, MMPXSystemEventObserver& aObserver ) + { + CMPXMediaRemovalMonitor* self + = CMPXMediaRemovalMonitor::NewLC( aDrive, + aFs, + aObserver ); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXMediaRemovalMonitor* CMPXMediaRemovalMonitor::NewLC + ( TInt aDrive, RFs& aFs, MMPXSystemEventObserver& aObserver ) + { + CMPXMediaRemovalMonitor* self = + new( ELeave ) CMPXMediaRemovalMonitor( aDrive, + aFs, + aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CMPXMediaRemovalMonitor::~CMPXMediaRemovalMonitor() + { + Cancel(); + } + + +// --------------------------------------------------------------------------- +// Service the request +// --------------------------------------------------------------------------- +// +void CMPXMediaRemovalMonitor::RunL() + { + MPX_DEBUG1(_L("CMPXMediaRemovalMonitor::RunL <---")); + + // Re-subscribe to event. + TNotifyType notType(ENotifyDisk); + iFs.NotifyChange( notType, iStatus ); + SetActive(); + + // Check state + TDriveInfo drive; + User::LeaveIfError(iFs.Drive(drive, TInt(iDrive))); + + // Notify Observer + switch(drive.iType) + { + case EMediaNotPresent: + { + if (!iDiskRemoved) + { + iObserver.HandleSystemEventL( EDiskRemovedEvent, iDrive ); + } + iDiskRemoved = ETrue; + break; + } + default: + { + if ( iDiskRemoved && + ( drive.iMediaAtt & ( KMediaAttLockable|KMediaAttLocked|KMediaAttHasPassword ) ) != + ( KMediaAttLockable|KMediaAttLocked|KMediaAttHasPassword ) ) + { + iObserver.HandleSystemEventL( EDiskInsertedEvent, iDrive ); + iDiskRemoved = EFalse; + } + break; + } + } + + + MPX_DEBUG1(_L("CMPXMediaRemovalMonitor::RunL --->")); + } + +// --------------------------------------------------------------------------- +// Cancel NotifyChange request from file system +// --------------------------------------------------------------------------- +// +void CMPXMediaRemovalMonitor::DoCancel() + { + iFs.NotifyChangeCancel(); + } + +// ---------------------------------------------------------------------------- +// Handles a leave occurring in the request completion event handler RunL() +// Don't care if client has a User::Leave() in RunL(), keep monitoring for events +// ---------------------------------------------------------------------------- +// +TInt CMPXMediaRemovalMonitor::RunError(TInt aError) + { + MPX_DEBUG2("CMPXMediaRemovalMonitor::RunError(%d)", aError ); + (void) aError; // avoid compile warning in urel + + return KErrNone; + } diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/server/src/mpxmmcejectmonitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/server/src/mpxmmcejectmonitor.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2007 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: Monitor for PS Key changes from SysAp ( ME specific ) +* +*/ + + +#include +#include +#include +#include +#include "mpxmmcejectmonitor.h" + +// CONSTANTS +const TUid KMmcEjectAppUid = { 0x101FFAFC }; +const TUint KKeyMmcEjectOperation = 10; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CMPXMMCEjectMonitor::CMPXMMCEjectMonitor( MMPXSystemEventObserver& aObserver ) : + iObserver( aObserver ) + { + + } + + +// --------------------------------------------------------------------------- +// 2nd phased Constructor +// --------------------------------------------------------------------------- +// +void CMPXMMCEjectMonitor::ConstructL() + { + MPX_DEBUG1(_L("CMPXMMCEjectMonitor::ConstructL <---")); + + iPSKeyWatcher = CMPXPSKeyWatcher::NewL( KMmcEjectAppUid, + KKeyMmcEjectOperation, + this ); + MPX_DEBUG1(_L("CMPXMMCEjectMonitor::ConstructL --->")); + } + + +// --------------------------------------------------------------------------- +// Two-Phase Constructor +// --------------------------------------------------------------------------- +// +CMPXMMCEjectMonitor* CMPXMMCEjectMonitor::NewL( MMPXSystemEventObserver& aObserver ) + { + CMPXMMCEjectMonitor* self = new( ELeave ) CMPXMMCEjectMonitor( aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CMPXMMCEjectMonitor::~CMPXMMCEjectMonitor() + { + delete iPSKeyWatcher; + } + +// --------------------------------------------------------------------------- +// Callback when a cenrep key is modified +// --------------------------------------------------------------------------- +// +void CMPXMMCEjectMonitor::HandlePSEvent( TUid /*aUid*/, TInt /*aKey*/ ) + { + MPX_DEBUG1(_L("CMPXMMCEjectMonitor::HandlePSEvent <---")); + TInt value; + iPSKeyWatcher->GetValue( value ); + + // MMC About to be ejected from power key menu + // + if( value == 1 ) + { + TRAP_IGNORE( iObserver.HandleSystemEventL( EPowerKeyEjectEvent, 0 ) ); + } + MPX_DEBUG1(_L("CMPXMMCEjectMonitor::HandlePSEvent --->")); + } + +// END OF FILE diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/server/src/mpxusbeventhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/server/src/mpxusbeventhandler.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,307 @@ +/* +* Copyright (c) 2006 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: Monitors for USB events +* +*/ + + +#include +#include +#include +#ifdef RD_MULTIPLE_DRIVE +#include +#endif //RD_MULTIPLE_DRIVE +#include +#include +#include +#include +#include +#include +#include "mpxusbeventhandler.h" + +// CONSTANTS +const TUint KUsbAllStates = 0xFFFFFFFF; + +// --------------------------------------------------------------------------- +// Default Constructor +// --------------------------------------------------------------------------- +// +CMPXUsbEventHandler::CMPXUsbEventHandler( MMPXSystemEventObserver& aObserver ) : + CActive( EPriorityStandard ), + iWasMtp ( EFalse ), + iObserver( aObserver ), + iMTPActive ( EFalse ), + iUsbManConnected( EFalse ) + { + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------------------------- +// 2nd Phase Constructor +// --------------------------------------------------------------------------- +// +void CMPXUsbEventHandler::ConstructL() + { + MPX_DEBUG1(_L("CMPXUsbEventHandler::ConstructL <---")); + iPSKeyWatcher = CMPXPSKeyWatcher::NewL( KPSUidUsbWatcher, + KUsbWatcherSelectedPersonality, + this ); + + //for checking MTP status key whether a client has started + iMTPKeyWatcher = CMPXPSKeyWatcher::NewL( KMtpPSUid, + KMtpPSStatus, + this ); + + // Connect to usbman + ConnectUsbMan(); + MPX_DEBUG1(_L("CMPXUsbEventHandler::ConstructL --->")); + } + + +// --------------------------------------------------------------------------- +// Two Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXUsbEventHandler* CMPXUsbEventHandler::NewL + ( MMPXSystemEventObserver& aObserver ) + { + CMPXUsbEventHandler* self = CMPXUsbEventHandler::NewLC( aObserver ); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// Two Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXUsbEventHandler* CMPXUsbEventHandler::NewLC + ( MMPXSystemEventObserver& aObserver ) + + { + CMPXUsbEventHandler* self = new( ELeave ) CMPXUsbEventHandler( aObserver); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CMPXUsbEventHandler::~CMPXUsbEventHandler() + { + Cancel(); + if ( iUsbManConnected ) + { + iUsbMan.Close(); + } + delete iPSKeyWatcher; + delete iMTPKeyWatcher; + } + +// --------------------------------------------------------------------------- +// Poll for any ongoing USB / MTP event +// --------------------------------------------------------------------------- +// +void CMPXUsbEventHandler::PollStatus() + { + TInt value; + iPSKeyWatcher->GetValue( value ); + if( (value==KUsbPersonalityIdMS) || + (value==KUsbPersonalityIdMTP) || + (value==KUsbPersonalityIdPCSuiteMTP) ) + { + HandlePSEvent( TUid::Uid(0), 0 ); + } + } + +// --------------------------------------------------------------------------- +// Handle the PS key event +// --------------------------------------------------------------------------- +// +void CMPXUsbEventHandler::HandlePSEvent( TUid aUid, TInt aKey ) + { + TRAP_IGNORE( DoHandlePSEventL(aUid,aKey) ); + } + +// --------------------------------------------------------------------------- +// Handle the PS key event +// --------------------------------------------------------------------------- +// +void CMPXUsbEventHandler::DoHandlePSEventL( TUid /*aUid*/, TInt /*aKey*/ ) + { + MPX_FUNC("CMPXUsbEventHandler::DoHandlePSEvent()"); + if ( !iUsbManConnected ) + { + ConnectUsbMan(); + } + + // Use the default MMC drive + TInt removableDrive( EDriveE ); +#ifdef RD_MULTIPLE_DRIVE + User::LeaveIfError( DriveInfo::GetDefaultDrive( + DriveInfo::EDefaultRemovableMassStorage, + removableDrive ) ); +#endif // RD_MULTIPLE_DRIVE + + // Handle the Key event + TInt value; + iPSKeyWatcher->GetValue( value ); + + // Determine if we are currently in MTP / Mass Storage mode + // + MPX_DEBUG2("CMPXUsbEventHandler::DoHandlePSEvent -- get usb value %i", value); + MPX_DEBUG2("CMPXUsbEventHandler::DoHandlePSEvent -iState=%d", iState); + if( (value == KUsbPersonalityIdMS) && + ( iDeviceState == EUsbDeviceStateAddress || + iDeviceState == EUsbDeviceStateConfigured ) ) + { + // Switch mode + if( iState == KUsbPersonalityIdMTP ) + { + MPX_DEBUG1("CMPXUsbEventHandler::DoHandlePSEvent - MTP End"); + iObserver.HandleSystemEventL( EUSBMTPEndEvent, removableDrive ); + iMTPActive = EFalse; + } + MPX_DEBUG1("CMPXUsbEventHandler::DoHandlePSEvent - USB Start"); +#ifdef RD_MULTIPLE_DRIVE + removableDrive = -1; +#endif // RD_MULTIPLE_DRIVE + + // Notify the state change (may happen more than once) + iObserver.HandleSystemEventL( EUSBMassStorageStartEvent, removableDrive ); + iState = KUsbPersonalityIdMS; + } + else if( ( value == KUsbPersonalityIdMTP || value == KUsbPersonalityIdPCSuiteMTP ) && + ( iDeviceState == EUsbDeviceStateAddress || iDeviceState == EUsbDeviceStateConfigured ) ) + { + if( iState == KUsbPersonalityIdMS ) + { + MPX_DEBUG1("CMPXUsbEventHandler::DoHandlePSEvent - USB End"); + iObserver.HandleSystemEventL( EUSBMassStorageEndEvent, removableDrive ); + } + iMTPKeyWatcher->GetValue(value); + MPX_DEBUG2("CMPXUsbEventHandler::DoHandlePSEvent -- get MTP value %i", value); + + if (value == EMtpPSStatusActive) + { + if( !iMTPActive ) + { + MPX_DEBUG1("CMPXUsbEventHandler::DoHandlePSEvent - MTP Start"); + iObserver.HandleSystemEventL( EUSBMTPStartEvent, removableDrive ); + iState = KUsbPersonalityIdMTP; + iMTPActive = ETrue; + } + } + else if( value != EMtpPSStatusReadyToSync ) + { + MPX_DEBUG1("CMPXUsbEventHandler::DoHandlePSEvent - MTP Not Active"); + iObserver.HandleSystemEventL( EUSBMTPNotActiveEvent, removableDrive ); + iState = KUsbPersonalityIdMTP; + iMTPActive = EFalse; + } + } + // Make sure MTP and MS flags are OFF + // + else if( value != KUsbPersonalityIdMTP && + value != KUsbPersonalityIdMS && + value != KUsbPersonalityIdPCSuiteMTP ) + { + // Signal end of event + if( iState == KUsbPersonalityIdMS ) + { + MPX_DEBUG1("CMPXUsbEventHandler::DoHandlePSEvent - USB End"); + iObserver.HandleSystemEventL( EUSBMassStorageEndEvent, removableDrive ); + } + else if( iState == KUsbPersonalityIdMTP ) + { + MPX_DEBUG1("CMPXUsbEventHandler::DoHandlePSEvent - MTP End"); + iObserver.HandleSystemEventL( EUSBMTPEndEvent, removableDrive ); + iMTPActive = EFalse; + } + iState = KUsbWatcherSelectedPersonalityNone; + } + } + +// --------------------------------------------------------------------------- +// CMPXUsbEventHandler::RunL +// --------------------------------------------------------------------------- +// +void CMPXUsbEventHandler::RunL() + { + MPX_FUNC("CMPXUsbEventHandler::RunL()"); + TInt status( iStatus.Int() ); + + MPX_DEBUG2("CMPXUsbEventHandler::RunL status=%d", status ); + if ( status != KErrCancel && status != KErrServerTerminated ) + { + iUsbMan.DeviceStateNotification( KUsbAllStates, iDeviceState, iStatus ); + SetActive(); + } + + if ( status == KErrNone ) + { + MPX_DEBUG2("CMPXUsbEventHandler::RunL - DeviceState = %d", iDeviceState); + HandlePSEvent( TUid::Uid(0), 0 ); + } + } + +// --------------------------------------------------------------------------- +// CMPXUsbEventHandler::DoCancel +// --------------------------------------------------------------------------- +// +void CMPXUsbEventHandler::DoCancel() + { + MPX_FUNC("CMPXUsbEventHandler::DoCancel()"); + if ( iUsbManConnected ) + { + iUsbMan.DeviceStateNotificationCancel(); + } + } + +// --------------------------------------------------------------------------- +// CMPXUsbEventHandler::ConnectUsbMan +// If error, default iDeviceState to EUsbDeviceStateConfigured so this would not +// block usb event mode change. +// --------------------------------------------------------------------------- +void CMPXUsbEventHandler::ConnectUsbMan() + { + MPX_FUNC("CMPXUsbEventHandler::ConnectUsbMan()"); + if ( iUsbMan.Connect() == KErrNone ) + { + iUsbManConnected = ETrue; + // get device state + TInt err = iUsbMan.GetDeviceState( iDeviceState ); + if ( err ) + { + iDeviceState = EUsbDeviceStateUndefined; + } + + // start active object + if ( !IsActive() ) + { + iUsbMan.DeviceStateNotification( KUsbAllStates, iDeviceState, iStatus ); + SetActive(); + } + } + else + { + iDeviceState = EUsbDeviceStateConfigured; + } + } +// END OF FILE + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/utility/bwinscw/mpxharvesterutilityU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/utility/bwinscw/mpxharvesterutilityU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?NewL@CMPXHarvesterFactory@@SAPAVMMPXHarvesterUtility@@XZ @ 1 NONAME ; class MMPXHarvesterUtility * CMPXHarvesterFactory::NewL(void) + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/utility/eabi/mpxharvesterutilityU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/utility/eabi/mpxharvesterutilityU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _ZN20CMPXHarvesterFactory4NewLEv @ 1 NONAME + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/utility/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/utility/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2006 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 Utility +* +*/ + + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +mpxharvesterutility.mmp \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/utility/group/mpxharvesterutility.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/utility/group/mpxharvesterutility.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2006 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 for Harvester Utility +* +*/ + + + +#include +#include + +TARGET mpxharvesterutility.dll +TARGETTYPE dll +UID 0x1000006C 0x101FFCD3 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT +VERSION 11.0 + +SOURCEPATH ../src +SOURCE mpxharvesterutility.cpp +SOURCE mpxharvesterutilityimp.cpp + +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY estor.lib +LIBRARY efsrv.lib +LIBRARY mpxcommon.lib + +#if defined(ARMCC) +deffile ../eabi/ +#elif defined(WINSCW) +deffile ../bwinscw/ +#endif \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/utility/inc/mpxharvesterutilityimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/utility/inc/mpxharvesterutilityimp.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,362 @@ +/* +* Copyright (c) 2007 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 Utility Implementation class +* +*/ + + +#ifndef CMPXHARVESTERUTILITYIMP_H +#define CMPXHARVESTERUTILITYIMP_H + +#include +#include +#include "mpxharvesterutility.h" + +// Foward Declaration +class MMPXHarvesterUtilityObserver; + +/** + * Harvester Utility, RSession owner + * + * Session class to the harvester server + * + * @lib mpxharvesterutility.lib + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CMPXHarvesterUtilityImp ): public CActive, + public MMPXHarvesterUtility + { + +public: + + /** + * Two Phase constructor + * @return CMPXHarvesterUtilityImp instance + */ + static CMPXHarvesterUtilityImp* NewL(); + + /** + * destructor + */ + virtual ~CMPXHarvesterUtilityImp(); + +protected: + + /* + * From MMPXHarvesterUtility + * Initiates a scan to refresh the database + */ + void ScanL(); + + /* + * From MMPXHarvesterUtility + * Cancels a scan to refresh the db + */ + void CancelScanL(); + + /* + * From MMPXHarvesterUtility + * Shutdown the server + */ + void ShutdownL(); + + /** + * From MMPXHarvesterUtility + * Add a single song + * @param aFilePath path to the song to be added + * @param aObs observer to the AddFileL() event + */ + void AddFileL( const TDesC& aFilePath, MMPXHarvesterUtilityObserver* aObs ); + + /** + * From MMPXHarvesterUtility + * Add a media object + * @param aMedia, media object to add + * @return, collection ID for this media property + */ + TInt AddFileL( CMPXMedia*& aMedia ); + + /** + * From MMPXHarvesterUtility + * Remove a single song + * @param aFilePath, path to the item to be removed + * @return, Collection ID for the item + */ + TInt RemoveFileL( const TDesC& aFilePath ); + + /** + * From MMPXHarvesterUtility + * Remove a list of songs + * @param aFilesArray, list of songs to remove + */ + void RemoveFilesL( const MDesCArray& aFilesArray ); + + /** + * From MMPXHarvesterUtility + * Remove all songs from the harvester + */ + void RemoveAllFilesL(); + + /** + * From MMPXHarvesterUtility + * Remove all databases and re-create the db to handle corruption + */ + void RecreateDatabasesL(); + + /** + * From MMPXHarvesterUtility + * Remove a single song + * @param aFilePath, path to the item to be removed + * @param aObs observer to the delete operation + */ + void DeleteFileL( const TDesC& aFilePath, MMPXHarvesterUtilityObserver* aObs ); + + /** + * From MMPXHarvesterUtility + * Remove a list of songs + * @param aArray, list of songs to remove + * @param aObs observer to the delete operation + */ + void DeleteFilesL( const MDesCArray& aArray, MMPXHarvesterUtilityObserver* aObs ); + + /** + * From MMPXHarvesterUtility + * Remove a list of songs + * @param aArray, list of songs to remove + */ + void DeleteFilesL( const MDesCArray& aArray ); + + /** + * From MMPXHarvesterUtility + * Remove a list of songs + * @param aArray, list of songs to remove + * @param aEndTransaction ETrue to end current database transaction + */ + void DeleteFilesL( const MDesCArray& aArray, TBool aEndTransaction ); + + /** + * From MMPXHarvesterUtility + * Close the transaction. + */ + void CloseTransactionL(); + + /** + * From MMPXHarvesterUtility + * Update the collection id column in the harvester for a media + * @param aMedia media object containing the item to update + */ + void UpdateFileL( CMPXMedia*& aMedia ); + + /** + * From MMPXHarvesterUtility + * Rename file for the given media. This method only supports + * playlist renaming. + * @param aMedia media to be renamed. this media must contain + * the new title of the playlist, the existing uri of + * the playlist + * @return new URI of the renamed playlist media, ownership transferred + */ + HBufC* RenameFileLC( const CMPXMedia& aMedia ); + + /** + * Rename file + * @param aOldUri, existing URI + * @param aNewUri, new URI + * @param aCollection, collection Id of the collection the file belongs to + */ + void RenameFileL( const TDesC& aOldUri, + const TDesC& aNewUri, + TInt aCollection ); + + /* + * From MMPXHarvesterUtility + * Finds the collection ID based on a File name + * @param aFile, file name to lookup + * @return the collection ID + */ + TInt FindCollectionIdL( const TDesC& aFile ); + + /** + * From MMPXHarvesterUtility + * Export a Media property as a playlist + * @param aProp CMPXMedia object to contain the "list" of items + * @param aPath, path and filename + * @param aPlaylistType, playlist type, default to M3U + * @param aObs, observer for async callback + */ + void ExportPlaylistL( const CMPXMedia& aProp, + const TDesC& aPath, + TInt aPlaylistType, + MMPXHarvesterUtilityObserver* aObs ); + + /** + * From MMPXHarvesterUtility + * Import a playlist from a file + * The user can ONLY execute 1 async op at a time! + */ + void ImportPlaylistL( const TDesC& aFilename, + MMPXHarvesterUtilityObserver* aObs ); + + /** + * From MMPXHarvesterUtility + * Imports a "file" in general + * @param aFileName, file to import + * @param aObs, observer for the import event + */ + void ImportFileL( const TDesC& aFilename, + MMPXHarvesterUtilityObserver* aObs ); + + /** + * From MMPXHarvesterUtility + * Query the required attributes for tracks for the specified playlist type + * @param aPlaylistType playlist type for this query + * @param aRequiredAttributes out parameter, an array of required attributes + * of the specified playlist type + */ + void RequiredAttributesL( TInt aPlaylistType, + RArray& aRequiredAttributes ); + + /** + * From MMPXHarvesterUtility + * Query the optional attributes for tracks for the specified playlist type + * @param aPlaylistType playlist type for this query + * @param aOptionalAttributes out parameter, an array of optional attributes + * of the specified playlist type + */ + void OptionalAttributesL( TInt aPlaylistType, + RArray& aOptionalAttributes ); + + + /* + * From MMPXHarvesterUtility + * Query the file extension of the playlist of the specified type + * @param aPlaylistType playlist type for this query + * @return playlist file extension of the specified playlist type, + * this includes the period. Ownership transferred + */ + HBufC* PlaylistFileExtensionLC( TInt aPlaylistType ); + + /** + * From MMPXHarvesterUtility + * Determines whether the given file is a playlist. + * + * @param aUri URI of the media to be tested + * @return ETrue if it's a playlist; otherwise EFalse. + */ + TBool IsPlaylistL( const TDesC& aUri ); + + /** + * From MMPXHarvesterUtility + * Sends a message to the harvester server to poll for any + * system events. If there is a sytem event happening, + * It will notify the rest of the MPX framework + */ + void CheckForSystemEventsL(); + + /** + * From MMPXHarvesterUtility + * Deletes the harvester utility and free the implementation + */ + void Close(); + + /** + * Get a media object for the file + * This method is asynchronous and will call back via the observer interface + * @note S60 metadata utility is REALLY slow, so this has to be async + * @param aFilePath, path to the song to be added + * @param aObs observer to the add file event + */ + void GetMediaForFileL( const TDesC& aFilePath, MMPXHarvesterUtilityObserver* aObs ); + + /** + * Get a collection ID for the file + * @param aMedia media to add + * @return collection ID for this media + */ + TInt GetColUidForFileL( const TDesC& aFilePath ); + +protected: + + /** + * From CActive + */ + void RunL(); + + /** + * From CActive + */ + void DoCancel(); + + /** + * From CActive + * Handles a leave occurring in the request completion event handler RunL() + * + * @param aError error code + * @return system error code + */ + TInt RunError(TInt aError); + +private: + + /** + * Constructor + */ + CMPXHarvesterUtilityImp(); + + /** + * 2nd phase constructor + */ + void ConstructL(); + + /** + * Class to maintain the life time of async requests + */ + NONSHARABLE_CLASS( CHvsUtilityTask ) : public CBase + { + public: + CHvsUtilityTask( CBufBase* arg1=NULL, HBufC* arg2=NULL, HBufC* arg3=NULL, + TInt arg4=0, CMPXMedia* arg5=NULL ); + virtual ~CHvsUtilityTask(); + const TDesC8& Arg1(); + const TDesC& Arg2(); + const TDesC& Arg3(); + const TDesC8& Arg4(); + const CMPXMedia& Arg5(); + + private: + CBufBase* iArg1; + HBufC* iArg2; + HBufC* iArg3; + TPckgBuf iArg4; + + TPtrC8 iPtr1; + TPtrC iPtr2; + TPtrC iPtr3; + CMPXMedia* iArg5; + }; + +private: // data + RMPXSession iSession; // Session + CBufBase* iBuffer; + + // Callback observer for async ops. + // + MMPXHarvesterUtilityObserver* iObserver; + TMPXHarvesterServerOp iCurAsyncOp; + CHvsUtilityTask* iCurTask; + HBufC* iFile; + }; + + +#endif // CMPXHarvesterUtilityImp_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/utility/src/mpxharvesterutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/utility/src/mpxharvesterutility.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2007 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: Factory function to create the harvester +* +*/ + + +#include +#include "mpxharvesterutility.h" +#include "mpxharvesterutilityimp.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Two Phased Constructor +// --------------------------------------------------------------------------- +// +EXPORT_C MMPXHarvesterUtility* CMPXHarvesterFactory::NewL() + { + return CMPXHarvesterUtilityImp::NewL(); + } + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/harvester/utility/src/mpxharvesterutilityimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/harvester/utility/src/mpxharvesterutilityimp.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,786 @@ +/* +* Copyright (c) 2006 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 utility implementation +* +*/ + + +#include +#include +#include +#include + +#include +#include +#include +#include +#include "mpxharvesterutilityobserver.h" +#include "mpxharvesterutilityimp.h" + + +const TInt KMaxPlaylistExtensionLength = 10; + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Private Constructor +// --------------------------------------------------------------------------- +// +CMPXHarvesterUtilityImp::CMPXHarvesterUtilityImp() : CActive( EPriorityNormal ), + iCurAsyncOp( EHvsServerOpCount ) + { + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------------------------- +// 2nd-Phased Constructor +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::ConstructL() + { + TInt err = iSession.Connect(KMPXHarvesterServerName, + KMPXHarvesterServerImg, + TVersion(KMPXHarvesterServerMajorVersionNumber, + KMPXHarvesterServerMinorVersionNumber, + KMPXHarvesterServerBuildVersionNumber)); + User::LeaveIfError( err ); + } + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXHarvesterUtilityImp* CMPXHarvesterUtilityImp::NewL() + { + CMPXHarvesterUtilityImp* self = new( ELeave ) CMPXHarvesterUtilityImp(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Virtual Destructor +// --------------------------------------------------------------------------- +// +CMPXHarvesterUtilityImp::~CMPXHarvesterUtilityImp() + { + Cancel(); + + delete iBuffer; + iSession.Close(); + delete iCurTask; + delete iFile; + } + +// --------------------------------------------------------------------------- +// Scan Function +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::ScanL() + { + iSession.SendReceiveL( EHvsServerScan ); + } + +// --------------------------------------------------------------------------- +// Cancel Scan Function +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::CancelScanL() + { + iSession.SendReceiveL( EHvsServerCancelScan ); + } + +// --------------------------------------------------------------------------- +// Shut down the server function +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::ShutdownL() + { + iSession.SendReceiveL( EHvsServerShutdown ); + } + +// --------------------------------------------------------------------------- +// Add a song to the harvester +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::AddFileL( const TDesC& aFilePath, + MMPXHarvesterUtilityObserver* aObs ) + { + ASSERT( !iCurTask ); + HBufC* path = aFilePath.AllocLC(); + iCurTask = new(ELeave) CHvsUtilityTask( NULL, path, + NULL, NULL ); + CleanupStack::Pop( path ); + iSession.SendReceive( EHvsServerAddFile, TIpcArgs( &iCurTask->Arg2() ), iStatus ); + + // Set Async op + iCurAsyncOp = EHvsServerAddFile; + iObserver = aObs; + SetActive(); + } + +// --------------------------------------------------------------------------- +// Add a song to the harvester +// --------------------------------------------------------------------------- +// +TInt CMPXHarvesterUtilityImp::AddFileL( CMPXMedia*& aProperty ) + { + CBufBase* buf( NULL ); + CreateBufferL( *aProperty, buf ); + CleanupStack::PushL( buf ); + TPtr8 p = buf->Ptr(0); + TInt r = iSession.SendReceiveL( EHvsServerAddFileMedia, TIpcArgs( &p ) ); + CleanupStack::PopAndDestroy( buf ); + return r; + } + +// --------------------------------------------------------------------------- +// Remove a song from the harvester +// --------------------------------------------------------------------------- +// +TInt CMPXHarvesterUtilityImp::RemoveFileL( const TDesC& aFilePath ) + { + TPckgBuf del(EFalse); + return iSession.SendReceiveL( EHvsServerRemoveFile, TIpcArgs( &aFilePath, + &del ) ); + } + +// --------------------------------------------------------------------------- +// Remove multiple songs from the harvester +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::RemoveFilesL( const MDesCArray& aArray ) + { + CBufBase* buf( NULL ); + MPXUser::CreateBufferL( &aArray, buf ); + CleanupStack::PushL( buf ); + // IPC args + TPtr8 p=buf->Ptr(0); + TPckgBuf del(EFalse); + iSession.SendReceiveL( EHvsServerRemoveFiles, + TIpcArgs( &p, &del ) ); + CleanupStack::PopAndDestroy( buf ); + } + +// --------------------------------------------------------------------------- +// Remove all songs from the harvester +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::RemoveAllFilesL() + { + iSession.SendReceiveL( EHvsServerRemoveAllFiles ); + } + +// --------------------------------------------------------------------------- +// Recreate the harvester database +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::RecreateDatabasesL() + { + iSession.SendReceiveL( EHvsServerReCreateDB ); + } + +// --------------------------------------------------------------------------- +// Remove a song and delete it from the file system +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::DeleteFileL( const TDesC& aFilePath, + MMPXHarvesterUtilityObserver* aObs ) + { + ASSERT( !iCurTask ); + + HBufC* path = aFilePath.AllocLC(); + iCurTask = new(ELeave) CHvsUtilityTask( NULL, path, + NULL, ETrue ); + CleanupStack::Pop( path ); + + iSession.SendReceive( EHvsServerRemoveFile, TIpcArgs( &iCurTask->Arg2(), + &iCurTask->Arg4() ), iStatus ); + + // Set Async op + iCurAsyncOp = EHvsServerRemoveFile; + iObserver = aObs; + SetActive(); + } + +// --------------------------------------------------------------------------- +// Remove and delete a list of files from the file system +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::DeleteFilesL( const MDesCArray& aArray, + MMPXHarvesterUtilityObserver* aObs ) + { + ASSERT( !iCurTask ); + + CBufBase* buf( NULL ); + MPXUser::CreateBufferL( &aArray, buf ); + CleanupStack::PushL( buf ); + iCurTask = new(ELeave) CHvsUtilityTask( buf, NULL, + NULL, ETrue ); + CleanupStack::Pop( buf ); + + iSession.SendReceive( EHvsServerRemoveFiles, + TIpcArgs( &iCurTask->Arg1(), &iCurTask->Arg4() ), iStatus ); + // Set Async op + iCurAsyncOp = EHvsServerRemoveFiles; + iObserver = aObs; + SetActive(); + } + +// --------------------------------------------------------------------------- +// Remove and delete a list of files from the file system +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::DeleteFilesL( const MDesCArray& aArray ) + { + DeleteFilesL( aArray, ETrue ); + } + +// --------------------------------------------------------------------------- +// Remove and delete a list of files from the file system +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::DeleteFilesL( const MDesCArray& aArray, TBool aEndTransaction ) + { + CBufBase* buf( NULL ); + MPXUser::CreateBufferL( &aArray, buf ); + CleanupStack::PushL( buf ); + // IPC args + TPtr8 p=buf->Ptr(0); + TPckgBuf del(ETrue); + TPckgBuf transaction(aEndTransaction); + iSession.SendReceiveL( EHvsServerRemoveFiles, + TIpcArgs( &p, &del , &transaction ) ); + CleanupStack::PopAndDestroy( buf ); + } + +// --------------------------------------------------------------------------- +// Close the database transaction +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::CloseTransactionL() + { + iSession.SendReceiveL( EHvsServerCloseTransaction ); + } + +// --------------------------------------------------------------------------- +// Remove and delete a file from the file system +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::UpdateFileL( CMPXMedia*& aProperty ) + { + TMPXAttribute att( KMPXMediaIdGeneral, EMPXMediaGeneralUri ); + const TDesC& filepath = aProperty->ValueText( att ); + + att = TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralCollectionId ); + const TUid& collection = aProperty->ValueTObjectL( att ); + + TPckgBuf arg2( collection.iUid ); + iSession.SendReceiveL( EHvsServerUpdateFile, TIpcArgs(&filepath, &arg2) ); + } + +// --------------------------------------------------------------------------- +// Rename file for the media +// --------------------------------------------------------------------------- +// +HBufC* CMPXHarvesterUtilityImp::RenameFileLC( const CMPXMedia& aMedia ) + { + TMPXGeneralCategory category = + aMedia.ValueTObjectL( + TMPXAttribute(KMPXMediaIdGeneral,EMPXMediaGeneralCategory)); + if ( category != EMPXPlaylist ) + { + User::Leave( KErrNotSupported ); + } + + const TDesC& title = + aMedia.ValueText( + TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralTitle ) ); + + const TDesC& oldPath = + aMedia.ValueText( + TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralUri ) ); + + // determine the new file path from the existing file path and the given title + TParsePtrC parser( oldPath ); + HBufC* newPath = HBufC::NewLC( parser.DriveAndPath().Length() + + title.Length() + parser.Ext().Length() ); + TPtr ptr = newPath->Des(); + ptr.Append( parser.DriveAndPath() ); + ptr.Append( title ); + ptr.Append( parser.Ext() ); + + // get collection Id + const TUid& collection = + aMedia.ValueTObjectL(TMPXAttribute(KMPXMediaIdGeneral,EMPXMediaGeneralCollectionId)); + + RenameFileL(oldPath, *newPath, collection.iUid); + + return newPath; + } + +// --------------------------------------------------------------------------- +// Rename file +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::RenameFileL( const TDesC& aOldUri, + const TDesC& aNewUri, + TInt aCollection ) + { + TPckgBuf collectionId( aCollection ); + + iSession.SendReceiveL( EHvsServerRenameFile, TIpcArgs(&aOldUri, &aNewUri, &collectionId) ); + } + +// --------------------------------------------------------------------------- +// Find the collection ID for a file +// --------------------------------------------------------------------------- +// +TInt CMPXHarvesterUtilityImp::FindCollectionIdL( const TDesC& aFile ) + { + return iSession.SendReceiveL( EHvsServerFindColID, TIpcArgs(&aFile) ); + } + +// --------------------------------------------------------------------------- +// Query the required attributes for tracks for the specified playlist type +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::RequiredAttributesL(TInt aPlaylistType, + RArray& aRequiredAttributes) + { + TPckgBuf playlistType( aPlaylistType ); + + TInt size = iSession.SendReceiveL( EHvsServerReqAttr, TIpcArgs( &playlistType) ); + + // Transfer results from server + // lint doesn't understand the template ::CreateBuffer + // + ::TransferBufferFromServerL( iSession, EHvsServerGetBuffer, size, iBuffer ); + ::CreateFromBufferL( *iBuffer, aRequiredAttributes ); //lint !e1024 !e1703 !e1514 !e64 + } + +// --------------------------------------------------------------------------- +// Query the optional attributes for tracks for the specified playlist type +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::OptionalAttributesL(TInt aPlaylistType, + RArray& aOptionalAttributes) + { + TPckgBuf playlistType( aPlaylistType ); + + TInt size = iSession.SendReceiveL( EHvsServerOptAttr, TIpcArgs( &playlistType) ); + + // Transfer results from server + // + ::TransferBufferFromServerL( iSession, EHvsServerGetBuffer, size, iBuffer ); + ::CreateFromBufferL( *iBuffer, aOptionalAttributes ); //lint !e1024 !e1703 !e1514 !e64 + } + +// --------------------------------------------------------------------------- +// Queries about the playlist file extension of the currently selected playlist +// plugin +// --------------------------------------------------------------------------- +HBufC* CMPXHarvesterUtilityImp::PlaylistFileExtensionLC(TInt aPlaylistType) + { + TPckgBuf playlistType( aPlaylistType ); + + HBufC* fileExtension = HBufC::NewLC(KMaxPlaylistExtensionLength); + TPtr extension = fileExtension->Des(); + + User::LeaveIfError( + iSession.SendReceiveL( EHvsServerPlaylistFileExt, TIpcArgs(&playlistType, &extension))); + + return fileExtension; + } + +// --------------------------------------------------------------------------- +// Determines if the given file is a playlist +// --------------------------------------------------------------------------- +// +TBool CMPXHarvesterUtilityImp::IsPlaylistL( const TDesC& aUri ) + { + return iSession.SendReceiveL( EHvsServerIsPlaylist, TIpcArgs(&aUri) ); + } + +// --------------------------------------------------------------------------- +// Tells the harvester to poll for system events +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::CheckForSystemEventsL() + { + User::LeaveIfError( iSession.SendReceiveL( EHvsServerCheckSystemEvent ) ); + } + + +// --------------------------------------------------------------------------- +// Closes the harvester utility +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::Close() + { + delete this; + } + +// --------------------------------------------------------------------------- +// Get a media object for the file +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::GetMediaForFileL( const TDesC& aFilePath, + MMPXHarvesterUtilityObserver* aObs ) + { + ASSERT( !iCurTask ); + HBufC* path = aFilePath.AllocLC(); + iCurTask = new(ELeave) CHvsUtilityTask( NULL, path, + NULL, NULL ); + CleanupStack::Pop( path ); + iSession.SendReceive( EHvsServerGetMedia, TIpcArgs( &iCurTask->Arg2() ), iStatus ); + + // Set Async op + iCurAsyncOp = EHvsServerGetMedia; + iObserver = aObs; + SetActive(); + } + +// --------------------------------------------------------------------------- +// Get a collection ID for the file +// --------------------------------------------------------------------------- +// +TInt CMPXHarvesterUtilityImp::GetColUidForFileL( const TDesC& aFilePath ) + { + return iSession.SendReceiveL( EHvsServerGetColUid, TIpcArgs(&aFilePath) ); + } + +// --------------------------------------------------------------------------- +// Export a playlist to a file +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::ExportPlaylistL( const CMPXMedia& aProp, + const TDesC& aPath, + TInt aPlaylistType, + MMPXHarvesterUtilityObserver* aObs ) + { + if( iCurAsyncOp != EHvsServerOpCount ) + { + User::Leave( KErrNotReady ); + } + + // Construct the IPC Args + CBufBase* buf( NULL ); + CreateBufferL( aProp, buf ); + CleanupStack::PushL( buf ); + HBufC* path = aPath.AllocLC(); + CMPXMedia* copy = CMPXMedia::NewL( aProp ); + CleanupStack::PushL( copy ); + iCurTask = new(ELeave) CHvsUtilityTask( buf, path, + NULL, aPlaylistType, copy ); // ownership xfer + CleanupStack::Pop( 3, buf ); + + // Send the IPC + // + iSession.SendReceive( EHvsServerExportPlaylist, + TIpcArgs( &iCurTask->Arg1(), &iCurTask->Arg2(), + &iCurTask->Arg4() ), + iStatus ); + + iCurAsyncOp = EHvsServerExportPlaylist; + iObserver = aObs; + SetActive(); + } + +// --------------------------------------------------------------------------- +// Import a playlist from a file +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::ImportPlaylistL( const TDesC& aFilename, + MMPXHarvesterUtilityObserver* aObs ) + { + if( iCurAsyncOp != EHvsServerOpCount ) + { + User::Leave( KErrNotReady ); + } + + HBufC* file = aFilename.AllocL(); + iCurTask = new(ELeave) CHvsUtilityTask( NULL, file ); + iSession.SendReceive( EHvsServerImportPlaylist, + TIpcArgs( &iCurTask->Arg2() ), + iStatus ); + + iCurAsyncOp = EHvsServerImportPlaylist; + iObserver = aObs; + SetActive(); + } + +// --------------------------------------------------------------------------- +// Import a file, async +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::ImportFileL( const TDesC& aFilename, + MMPXHarvesterUtilityObserver* aObs ) + { + if( iCurAsyncOp != EHvsServerOpCount ) + { + User::Leave( KErrNotReady ); + } + if( iFile != NULL ) + { + delete iFile; + iFile = NULL; + } + iFile = aFilename.AllocL(); + HBufC* file = aFilename.AllocL(); + iCurTask = new(ELeave) CHvsUtilityTask( NULL, file ); + iSession.SendReceive( EHvsServerImportFile, + TIpcArgs( iFile ), + iStatus ); + + iCurAsyncOp = EHvsServerImportFile; + iObserver = aObs; + SetActive(); + } + +// --------------------------------------------------------------------------- +// RunL() from CActive +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::RunL() + { + // Try again in case server is down for IAD + if (iStatus == KErrDied || iStatus == KErrServerTerminated) + { + MPX_DEBUG1("-->CMPXHarvesterUtilityImp::RunL Reconnecting session for IAD"); + + // attempt to bring the server back up + if (iSession.Reconnect() != KErrNone) + { + MPX_DEBUG1("-->CMPXHarvesterUtilityImp::RunL Reconnect Failed"); + } + } + + // Clear status needs to be here because user can launch a second + // async op within the callback! + // + delete iCurTask; + iCurTask = NULL; + + // Cache these variables as locals because they need to be used + // + MMPXHarvesterUtilityObserver* curObserver = iObserver; + iObserver = NULL; + TInt curTask = iCurAsyncOp; + iCurAsyncOp = EHvsServerOpCount; + + + switch( curTask ) + { + case EHvsServerAddFile: + { + TInt size = iStatus.Int(); + CMPXMedia* prop( NULL ); + if( size > 0 ) + { + ::TransferBufferFromServerL(iSession, EHvsServerGetBuffer, + size, iBuffer); + ::NewFromBufferL( *iBuffer, prop ); + delete iBuffer; + iBuffer = NULL; + } + curObserver->HandleFileAddCompletedL( prop, size<0?size:KErrNone ) ; + break; + } + case EHvsServerRemoveFile: + case EHvsServerRemoveFiles: // deliberate fall through + { + TInt err( iStatus.Int() ); + curObserver->HandleDeleteCompletedL( err>0?KErrNone:err ); + break; + } + case EHvsServerExportPlaylist: + { + TInt size = iStatus.Int(); + CMPXMedia* prop( NULL ); + if( size > 0 ) + { + ::TransferBufferFromServerL(iSession, EHvsServerGetBuffer, + size, iBuffer); + ::NewFromBufferL( *iBuffer, prop ); + delete iBuffer; + iBuffer = NULL; + } + // observer takes ownership of prop + curObserver->HandlePlaylistExportCompletedL( prop, size<0?size:KErrNone ); + break; + } + case EHvsServerImportPlaylist: + { + TInt size = iStatus.Int(); + CMPXMedia* prop(NULL); + if( size > 0 ) + { + ::TransferBufferFromServerL(iSession, EHvsServerGetBuffer, + size, iBuffer); + ::NewFromBufferL( *iBuffer, prop ); + delete iBuffer; + iBuffer = NULL; + } + curObserver->HandlePlaylistImportCompletedL( prop, + size<0?size:KErrNone ); + break; + } + case EHvsServerImportFile: + { + TInt size = iStatus.Int(); + CMPXMedia* prop(NULL); + if( size > 0 ) + { + ::TransferBufferFromServerL(iSession, EHvsServerGetBuffer, + size, iBuffer); + ::NewFromBufferL( *iBuffer, prop ); + delete iBuffer; + iBuffer = NULL; + } + curObserver->HandleFileImportCompletedL( prop, size<0?size:KErrNone ); + break; + } + case EHvsServerGetMedia: + { + TInt size = iStatus.Int(); + CMPXMedia* prop( NULL ); + if( size > 0 ) + { + ::TransferBufferFromServerL(iSession, EHvsServerGetBuffer, + size, iBuffer); + ::NewFromBufferL( *iBuffer, prop ); + delete iBuffer; + iBuffer = NULL; + } + curObserver->HandleFileGetMediaCompletedL( prop, size<0?size:KErrNone ) ; + break; + } + default: + { + ASSERT(0); + } + } + } + +// --------------------------------------------------------------------------- +// Cancels the current async op +// --------------------------------------------------------------------------- +// +void CMPXHarvesterUtilityImp::DoCancel() + { + // Do Nothing + } + +// ---------------------------------------------------------------------------- +// Handles a leave occurring in the request completion event handler RunL() +// ---------------------------------------------------------------------------- +// +TInt CMPXHarvesterUtilityImp::RunError(TInt aError) + { + MPX_DEBUG2("CMPXHarvesterUtilityImp::RunError(%d)", aError ); + (void) aError; + return KErrNone; + } + +// --------------------------------------------------------------------------- +// Utility class to cache async requests +// --------------------------------------------------------------------------- +// +CMPXHarvesterUtilityImp::CHvsUtilityTask::CHvsUtilityTask( CBufBase* arg1, + HBufC* arg2, + HBufC* arg3, + TInt arg4, + CMPXMedia* arg5 ) + { + iArg1 = arg1; + iArg2 = arg2; + iArg3 = arg3; + iArg4 = TPckgBuf(arg4); + iArg5 = arg5; + + if( iArg1 ) + { + iPtr1.Set(iArg1->Ptr(0)); + } + if( iArg2 ) + { + iPtr2.Set(iArg2->Des()); + } + if( iArg3 ) + { + iPtr3.Set(iArg3->Des()); + } + } + +// --------------------------------------------------------------------------- +// Default destructor +// --------------------------------------------------------------------------- +// +CMPXHarvesterUtilityImp::CHvsUtilityTask::~CHvsUtilityTask() + { + delete iArg1; + delete iArg2; + delete iArg3; + delete iArg5; + } + +// --------------------------------------------------------------------------- +// Access each argument +// --------------------------------------------------------------------------- +// +const TDesC8& CMPXHarvesterUtilityImp::CHvsUtilityTask::Arg1() + { + return iPtr1; + } + +// --------------------------------------------------------------------------- +// Access each argument +// --------------------------------------------------------------------------- +// +const TDesC& CMPXHarvesterUtilityImp::CHvsUtilityTask::Arg2() + { + return iPtr2; + } + +// --------------------------------------------------------------------------- +// Access each argument +// --------------------------------------------------------------------------- +// +const TDesC& CMPXHarvesterUtilityImp::CHvsUtilityTask::Arg3() + { + return iPtr3; + } + +// --------------------------------------------------------------------------- +// Access each argument +// --------------------------------------------------------------------------- +// +const TDesC8& CMPXHarvesterUtilityImp::CHvsUtilityTask::Arg4() + { + return iArg4; + } + +// --------------------------------------------------------------------------- +// Access each argument +// --------------------------------------------------------------------------- +// +const CMPXMedia& CMPXHarvesterUtilityImp::CHvsUtilityTask::Arg5() + { + return *iArg5; + } + +// END OF FILE diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mediaplayersettingsengine/bmarm/MPSETTENGINEU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mediaplayersettingsengine/bmarm/MPSETTENGINEU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,5 @@ +EXPORTS + ListImplementationsL__16CMPSettingsModelRt13RPointerArray1Z26CImplementationInformation @ 1 NONAME R3UNUSED ; CMPSettingsModel::ListImplementationsL(RPointerArray &) + NewL__16CMPSettingsModelG4TUid @ 2 NONAME R3UNUSED ; CMPSettingsModel::NewL(TUid) + "_._16CMPSettingsModel" @ 3 NONAME R3UNUSED ; CMPSettingsModel::~CMPSettingsModel(void) + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mediaplayersettingsengine/bwins/MPSETTENGINEU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mediaplayersettingsengine/bwins/MPSETTENGINEU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,5 @@ +EXPORTS + ??1CMPSettingsModel@@UAE@XZ @ 1 NONAME ; public: virtual __thiscall CMPSettingsModel::~CMPSettingsModel(void) + ?ListImplementationsL@CMPSettingsModel@@SAXAAV?$RPointerArray@VCImplementationInformation@@@@@Z @ 2 NONAME ; public: static void __cdecl CMPSettingsModel::ListImplementationsL(class RPointerArray &) + ?NewL@CMPSettingsModel@@SAPAV1@VTUid@@@Z @ 3 NONAME ; public: static class CMPSettingsModel * __cdecl CMPSettingsModel::NewL(class TUid) + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mediaplayersettingsengine/bwinscw/MPSETTENGINEU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mediaplayersettingsengine/bwinscw/MPSETTENGINEU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,5 @@ +EXPORTS + ??1CMPSettingsModel@@UAE@XZ @ 1 NONAME ; CMPSettingsModel::~CMPSettingsModel(void) + ?ListImplementationsL@CMPSettingsModel@@SAXAAV?$RPointerArray@VCImplementationInformation@@@@@Z @ 2 NONAME ; void CMPSettingsModel::ListImplementationsL(class RPointerArray &) + ?NewL@CMPSettingsModel@@SAPAV1@VTUid@@@Z @ 3 NONAME ; class CMPSettingsModel * CMPSettingsModel::NewL(class TUid) + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mediaplayersettingsengine/eabi/MPSettEngineU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mediaplayersettingsengine/eabi/MPSettEngineU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,9 @@ +EXPORTS + _ZN16CMPSettingsModel20ListImplementationsLER13RPointerArrayI26CImplementationInformationE @ 1 NONAME + _ZN16CMPSettingsModel4NewLE4TUid @ 2 NONAME + _ZN16CMPSettingsModelD0Ev @ 3 NONAME + _ZN16CMPSettingsModelD1Ev @ 4 NONAME + _ZN16CMPSettingsModelD2Ev @ 5 NONAME + _ZTI16CMPSettingsModel @ 6 NONAME ; ## + _ZTV16CMPSettingsModel @ 7 NONAME ; ## + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mediaplayersettingsengine/group/MPSettEng.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mediaplayersettingsengine/group/MPSettEng.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,49 @@ +/* +* 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: Makefile for Media Settings Engine +* +*/ + +// Version : %version: 4.1.2 % + + + +#include +TARGET mpsettengine.dll +TARGETTYPE dll +UID 0x1000006C 0x101F853D +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE MPSettingsModel.cpp + +MW_LAYER_SYSTEMINCLUDE + +CAPABILITY CAP_GENERAL_DLL + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY flogger.lib + +#if defined(ARMCC) +deffile ../eabi/ +#elif defined(WINSCW) +deffile ../bwinscw/ +#elif defined(WINS) +deffile ../bwins/ +#else +deffile ../bmarm/ +#endif + +//end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mediaplayersettingsengine/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mediaplayersettingsengine/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2008 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 file provides the information required for building the +* whole of a Media Player Settings Engine. +* +*/ + +// Version : %version: 5.1.1 % + + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +// +// Export the sis and iby files +// +../sis/mpsetteng_stub.sis /epoc32/data/z/system/install/mpsetteng_stub.sis +../rom/mpsetteng.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mpsetteng.iby) + +PRJ_MMPFILES +../group/MPSettEng.mmp + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mediaplayersettingsengine/rom/mpsetteng.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mediaplayersettingsengine/rom/mpsetteng.iby Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2005 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: Media Player Settings Engine IBY +* +*/ + +// Version : %version: 1.1.1 % + + +#ifndef __MPSETTENG_IBY__ +#define __MPSETTENG_IBY__ + +REM Media Player Settings Engine + +data = ZSYSTEM\install\mpsetteng_stub.sis system\install\mpsetteng_stub.sis +file = ABI_DIR\BUILD_DIR\MPSettEngine.dll SHARED_LIB_DIR\MPSettEngine.dll + +#endif // __MPSETTENG_IBY__ diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mediaplayersettingsengine/sis/mpsetteng.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mediaplayersettingsengine/sis/mpsetteng.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,32 @@ +; +; 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: Package File for Media Player Settings Engine component +; +; Version : %version: % +;Language +&EN + +;Header +# {"Media Player Settings Engine"}, (0x101F853D), 1, 0, 0, TYPE=SA, RU + +; Localised Vendor Name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +; +; MPSettEngine +; +"\epoc32\release\armv5\urel\MPSettEngine.dll" - "!:\sys\bin\MPSettEngine.dll" \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mediaplayersettingsengine/sis/mpsetteng.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mediaplayersettingsengine/sis/mpsetteng.xml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,31 @@ + + + + + 1 + Media Player Settings Engine + Media Player Settings Engine + + + + S60 + + 5 + 1 + + 2009 + 14 + + + + 9 + 2 + + 2010 + 1 + + + + + + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mediaplayersettingsengine/sis/mpsetteng_stub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mediaplayersettingsengine/sis/mpsetteng_stub.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -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: Stub Package File for Media Player Settings Engine component +; +; Version : %version: % +;Language +&EN + +;Header +# {"Media Player Settings Engine"}, (0x101F853D), 1, 0, 0, TYPE=SA + +; Localised Vendor Name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + + +; +; When adding a file to this list, the stub sis should be regenerated +; and checked in also +; + +; +; MPSettEngine +; +"" - "z:\sys\bin\MPSettEngine.dll" diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mediaplayersettingsengine/sis/mpsetteng_stub.sis Binary file mmappcomponents/mediaplayersettingsengine/sis/mpsetteng_stub.sis has changed diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mediaplayersettingsengine/src/MPSettingsModel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mediaplayersettingsengine/src/MPSettingsModel.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,66 @@ +/* +* 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: MPSettingsModel.cpp +* +* +*/ + +// Version : %version: 4.1.2 % + + + + +// INCLUDE FILES +#include +#include + +#define KMPSettEngUidPluginInterfaceMediaSettings 0x101F857C + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CMPSettingsModel::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPSettingsModel* CMPSettingsModel::NewL(TUid aUid) + { + return static_cast(REComSession::CreateImplementationL + (aUid, _FOFF(CMPSettingsModel, iDtor_ID_Key))); + } + +// ----------------------------------------------------------------------------- +// CMPSettingsModel::~CMPSettingsModel +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPSettingsModel::~CMPSettingsModel() + { + REComSession::FinalClose(); + REComSession::DestroyedImplementation(iDtor_ID_Key); + } + +// ----------------------------------------------------------------------------- +// CMPSettingsModel::ListImplementationsL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPSettingsModel::ListImplementationsL(RImplInfoPtrArray& aImplInfoArray) + { + const TUid pluginViewInterfaceUID = {KMPSettEngUidPluginInterfaceMediaSettings}; + REComSession::ListImplementationsL(pluginViewInterfaceUID, aImplInfoArray); + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmappcommonui/albumartutility/bwinscw/mpxalbumartutilityu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmappcommonui/albumartutility/bwinscw/mpxalbumartutilityu.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,17 @@ +EXPORTS + ??1CMPXAlbumArtUtility@@UAE@XZ @ 1 NONAME ; CMPXAlbumArtUtility::~CMPXAlbumArtUtility(void) + ?BitmapDataL@CMPXAlbumArtUtility@@QAEPAVHBufC8@@ABVCFbsBitmap@@@Z @ 2 NONAME ; class HBufC8 * CMPXAlbumArtUtility::BitmapDataL(class CFbsBitmap const &) + ?BitmapL@CMPXAlbumArtUtility@@QAEPAVCFbsBitmap@@ABVTDesC8@@@Z @ 3 NONAME ; class CFbsBitmap * CMPXAlbumArtUtility::BitmapL(class TDesC8 const &) + ?CancelRequest@CMPXAlbumArtUtility@@QAEXXZ @ 4 NONAME ; void CMPXAlbumArtUtility::CancelRequest(void) + ?Decode@CMPXAlbumArtUtility@@QAEXAAVTRequestStatus@@ABVTDesC16@@AAVCFbsBitmap@@VTSize@@W4TDisplayMode@@@Z @ 5 NONAME ; void CMPXAlbumArtUtility::Decode(class TRequestStatus &, class TDesC16 const &, class CFbsBitmap &, class TSize, enum TDisplayMode) + ?Decode@CMPXAlbumArtUtility@@QAEXAAVTRequestStatus@@ABVTDesC8@@AAVCFbsBitmap@@VTSize@@W4TDisplayMode@@@Z @ 6 NONAME ; void CMPXAlbumArtUtility::Decode(class TRequestStatus &, class TDesC8 const &, class CFbsBitmap &, class TSize, enum TDisplayMode) + ?DecodeL@CMPXAlbumArtUtility@@QAEPAVCFbsBitmap@@ABVTDesC16@@VTSize@@W4TDisplayMode@@@Z @ 7 NONAME ; class CFbsBitmap * CMPXAlbumArtUtility::DecodeL(class TDesC16 const &, class TSize, enum TDisplayMode) + ?DecodeL@CMPXAlbumArtUtility@@QAEPAVCFbsBitmap@@ABVTDesC8@@VTSize@@W4TDisplayMode@@@Z @ 8 NONAME ; class CFbsBitmap * CMPXAlbumArtUtility::DecodeL(class TDesC8 const &, class TSize, enum TDisplayMode) + ?Encode@CMPXAlbumArtUtility@@QAEXAAVTRequestStatus@@ABVCFbsBitmap@@AAPAVHBufC8@@@Z @ 9 NONAME ; void CMPXAlbumArtUtility::Encode(class TRequestStatus &, class CFbsBitmap const &, class HBufC8 * &) + ?EncodeL@CMPXAlbumArtUtility@@QAEPAVHBufC8@@ABVCFbsBitmap@@@Z @ 10 NONAME ; class HBufC8 * CMPXAlbumArtUtility::EncodeL(class CFbsBitmap const &) + ?ExtractAlbumArtL@CMPXAlbumArtUtility@@QAEXABVCMPXMedia@@AAVMMPXAlbumArtUtilityObserver@@ABVTSize@@W4TDisplayMode@@@Z @ 11 NONAME ; void CMPXAlbumArtUtility::ExtractAlbumArtL(class CMPXMedia const &, class MMPXAlbumArtUtilityObserver &, class TSize const &, enum TDisplayMode) + ?ExtractL@CMPXAlbumArtUtility@@QAEPAVHBufC8@@ABVTDesC16@@@Z @ 12 NONAME ; class HBufC8 * CMPXAlbumArtUtility::ExtractL(class TDesC16 const &) + ?NewL@CMPXAlbumArtUtility@@SAPAV1@XZ @ 13 NONAME ; class CMPXAlbumArtUtility * CMPXAlbumArtUtility::NewL(void) + ?Scale@CMPXAlbumArtUtility@@QAEXAAVTRequestStatus@@AAVCFbsBitmap@@1VTSize@@W4TDisplayMode@@@Z @ 14 NONAME ; void CMPXAlbumArtUtility::Scale(class TRequestStatus &, class CFbsBitmap &, class CFbsBitmap &, class TSize, enum TDisplayMode) + ?ScaleL@CMPXAlbumArtUtility@@QAEPAVCFbsBitmap@@AAV2@VTSize@@W4TDisplayMode@@@Z @ 15 NONAME ; class CFbsBitmap * CMPXAlbumArtUtility::ScaleL(class CFbsBitmap &, class TSize, enum TDisplayMode) + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmappcommonui/albumartutility/eabi/mpxalbumartutilityu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmappcommonui/albumartutility/eabi/mpxalbumartutilityu.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,21 @@ +EXPORTS + _ZN19CMPXAlbumArtUtility11BitmapDataLERK10CFbsBitmap @ 1 NONAME + _ZN19CMPXAlbumArtUtility13CancelRequestEv @ 2 NONAME + _ZN19CMPXAlbumArtUtility16ExtractAlbumArtLERK9CMPXMediaR27MMPXAlbumArtUtilityObserverRK5TSize12TDisplayMode @ 3 NONAME + _ZN19CMPXAlbumArtUtility4NewLEv @ 4 NONAME + _ZN19CMPXAlbumArtUtility5ScaleER14TRequestStatusR10CFbsBitmapS3_5TSize12TDisplayMode @ 5 NONAME + _ZN19CMPXAlbumArtUtility6DecodeER14TRequestStatusRK6TDesC8R10CFbsBitmap5TSize12TDisplayMode @ 6 NONAME + _ZN19CMPXAlbumArtUtility6DecodeER14TRequestStatusRK7TDesC16R10CFbsBitmap5TSize12TDisplayMode @ 7 NONAME + _ZN19CMPXAlbumArtUtility6EncodeER14TRequestStatusRK10CFbsBitmapRP6HBufC8 @ 8 NONAME + _ZN19CMPXAlbumArtUtility6ScaleLER10CFbsBitmap5TSize12TDisplayMode @ 9 NONAME + _ZN19CMPXAlbumArtUtility7BitmapLERK6TDesC8 @ 10 NONAME + _ZN19CMPXAlbumArtUtility7DecodeLERK6TDesC85TSize12TDisplayMode @ 11 NONAME + _ZN19CMPXAlbumArtUtility7DecodeLERK7TDesC165TSize12TDisplayMode @ 12 NONAME + _ZN19CMPXAlbumArtUtility7EncodeLERK10CFbsBitmap @ 13 NONAME + _ZN19CMPXAlbumArtUtility8ExtractLERK7TDesC16 @ 14 NONAME + _ZN19CMPXAlbumArtUtilityD0Ev @ 15 NONAME + _ZN19CMPXAlbumArtUtilityD1Ev @ 16 NONAME + _ZN19CMPXAlbumArtUtilityD2Ev @ 17 NONAME + _ZTI19CMPXAlbumArtUtility @ 18 NONAME ; ## + _ZTV19CMPXAlbumArtUtility @ 19 NONAME ; ## + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmappcommonui/albumartutility/group/albumartutility.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmappcommonui/albumartutility/group/albumartutility.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2005-2006 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 for project albumartutility +* +*/ + + + +#include +#include + +TARGET mpxalbumartutility.dll +CAPABILITY CAP_GENERAL_DLL +TARGETTYPE DLL +UID 0x1000008D 0x101FFC15 +VENDORID VID_DEFAULT + +USERINCLUDE ../inc +USERINCLUDE ../../../../inc + +MW_LAYER_SYSTEMINCLUDE + + +SOURCEPATH ../src +SOURCE mpxalbumartutility.cpp +SOURCE mpximageutil.cpp +SOURCE mpximageutilsync.cpp + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY fbscli.lib // CFbsBitmap +LIBRARY bitmaptransforms.lib // CBitmapScaler +LIBRARY metadatautility.lib // CMetadataUtility +LIBRARY imageconversion.lib // CImageDecoder +LIBRARY mpxcommon.lib + +#if defined(ARMCC) +deffile ../eabi/ +#elif defined(WINSCW) +deffile ../bwinscw/ +#endif + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmappcommonui/albumartutility/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmappcommonui/albumartutility/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2005-2006 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 for project albumartutility +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../rom/mpxalbumartutility.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mpxalbumartutility.iby) + +PRJ_MMPFILES +albumartutility.mmp + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmappcommonui/albumartutility/inc/mpximageutil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmappcommonui/albumartutility/inc/mpximageutil.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,221 @@ +/* +* Copyright (c) 2007 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: Class declaration of CMPXImageUtil. +* +*/ + + +#ifndef MPXIMAGEUTIL_H +#define MPXIMAGEUTIL_H + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class CFbsBitmap; +class CBitmapScaler; +class CImageDecoder; +class CImageEncoder; + +// CLASS DECLARATION + +/** +* Image utilities class. +* @lib MPXSQLiteDbCommon.lib +**/ +NONSHARABLE_CLASS( CMPXImageUtil ) : public CBase + { +public: // Constructors and destructor + /** + * Two-phased constructor. + * @return A pointer to a newly created object + */ + static CMPXImageUtil* NewL(); + + /** + * Destructor. + */ + ~CMPXImageUtil(); + +public: // New functions + + /** + * Extracts embedded album art field from the media file. + * @param aUri file URI + * @return embebded JPG album art, ownership transferred. + */ + HBufC8* ExtractL(const TDesC& aUri); + + /* + * Asynchronously decodes an image from a JPG file. Generates a BMP in memory. + * @param aStatus request status + * @param aSourceJPGFile Full path and filename of the image to be decoded. + * @param aDestBMP Destination bitmap, allocated inside. + * @param aSize destination size to be used for calculating the optimal loading size + * @param aDisplayMode the display mode of the destination BMP + */ + void Decode(TRequestStatus& aStatus, const TDesC& aSourceJPGFile, + CFbsBitmap& aDestBMP, TSize aSize, TDisplayMode aDisplayMode = EColor64K); + + /* + * Asynchronously decodes an image from JPG buffer. Generates a BMP in memory. + * @param aStatus request status + * @param aSourceJPG JPG data + * @param aDestBMP destination bitmap, created inside. + * @param aSize destination size to be used for calculating the optimal loading size + * @param aDisplayMode the display mode of the destination BMP + */ + void Decode(TRequestStatus& aStatus, const TDesC8& aSourceJPG, CFbsBitmap& aDestBMP, + TSize aSize, TDisplayMode aDisplayMode = EColor64K); + + /* + * Asynchronously encodes a BMP to a JPG. + * @param aStatus request status for ther asynchronous operation + * @param aSourceBMP source BMP + * @param aDestJPG destination JPG + */ + void Encode(TRequestStatus& aStatus, const CFbsBitmap& aSourceBMP, + HBufC8*& aDestJPG); + + /* + * Asynchronously scales a BMP to a specified size. Generates another + * BMP in memory. + * @param aStatus request status for ther asynchronous operation + * @param aSourceBMP source BMP + * @param aDestBMP destination BMP + * @param aSize size to scale to + * @param aDisplayMode display mode for the destination image + */ + void Scale(TRequestStatus& aStatus, CFbsBitmap& aSourceBMP, CFbsBitmap& aDestBMP, + TSize aSize, TDisplayMode aDisplayMode = EColor64K); + + /* + * Returns a new bitmap object from bitmnap data + * @param aBMPData source BMP data + * @return new bitmap object. Ownership is transferred. + */ + CFbsBitmap* BitmapL(const TDesC8& aBMPData); + + /* + * Returns bitmap data from a bitmap object + * @param aBMP source BMP + * @return bitmap data. Ownership is transferred. + */ + HBufC8* BitmapDataL(const CFbsBitmap& aBMP); + + /* + * Cancels any outstanding asynchronous request. + */ + void CancelRequest(); + +private: // New functions + /* + * Asynchronously decodes an image from a JPG file - leaving version. + * @param aStatus request status + * @param aSourceJPGFile Full path and filename of the image to be decoded. + * @param aDestBMP Destination bitmap, allocated inside. + * @param aSize size that should be considered when loading the image. + * Used to determine the optimal loading size. + * @param aDisplayMode the display mode of the destination BMP + */ + void DoDecodeL(TRequestStatus& aStatus, const TDesC& aSourceJPGFile, CFbsBitmap& aDestBMP, + TSize aSize, TDisplayMode aDisplayMode = EColor64K); + + /* + * Asynchronously decodes an image from JPG buffer - leaving version. + * @param aStatus request status + * @param aSourceJPG JPG data + * @param aDestBMP destination bitmap, allocated inside. + * @param aSize size that should be considered when loading the image. + * Used to determine the optimal loading size. + * @param aDisplayMode the display mode of the destination BMP + */ + void DoDecodeL(TRequestStatus& aStatus, const TDesC8& aSourceJPG, CFbsBitmap& aDestBMP, + TSize aSize, TDisplayMode aDisplayMode = EColor64K); + + /* + * Asynchronously encodes a BMP to JPG - leaving version. + * @param aStatus request status for ther asynchronous operation + * @param aSourceBMP source BMP + * @param aDestJPG destination JPG + */ + void DoEncodeL(TRequestStatus& aStatus, const CFbsBitmap& aSourceBMP, + HBufC8*& aDestJPG); + + /* + * Asynchronously scales a BMP to a specified size - leaving version. + * @param aStatus request status for ther asynchronous operation + * @param aSourceBMP source BMP + * @param aDestBMP destination BMP + * @param aSize size to scale to + * @param aDisplayMode display mode for the destination image + */ + void DoScaleL(TRequestStatus& aStatus, CFbsBitmap& aSourceBMP, + CFbsBitmap& aDestBMP, TSize aSize, TDisplayMode aDisplayMode = EColor64K); + + /** + * Gets an optimum loading size for the bitmap. You have a bitmap that has a + * size of 640x480. You need to produce a bitmap with size 44x48 calling + * this method returns the maximum downscaled size: 80, 60. Using this size + * (80x60) you get the fastest loading speed and less usage of memory when + * you load the bitmap in memory. This method also handles the needed + * rounding if the original size can not be divided evenly! + * @param aOriginalSize the size of the unscaled bitmap + * @param aNeededSize the needed size + * @return the optimal loading size + */ + TSize OptimalLoadingSize(const TSize& aOriginalSize, const TSize& aNeededSize); + + /** + * Reduce target size to same aspect ratio as source image. + * @param aSourceSize source size + * @param aTargetSize target size + * @return adjusted size + */ + TSize AdjustSize(const TSize& aSourceSize, const TSize& aTargetSize); + +private: + + /** + * C++ default constructor. + */ + CMPXImageUtil(); + + /** + * Second phase constructor. + */ + void ConstructL(); + +private: + // Internal operation codes + enum TOperation + { + EIdle = 0, + EDecoding, + EEncoding, + EScaling + }; + +private: // Data + CImageDecoder* iDecoder; // decoder + CBitmapScaler* iScaler; // bitmap scaler + CImageEncoder* iEncoder; // encoder + RFs iFs; // for opening/saving images from/to files + TOperation iOperation; // current operation + }; + +#endif // MPXIMAGEUTIL_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmappcommonui/albumartutility/inc/mpximageutilsync.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmappcommonui/albumartutility/inc/mpximageutilsync.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2007 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: Synchronous wrapper around CMPXImageUtil. +* +*/ + + +#ifndef MPXIMAGEUTILSYNC_H +#define MPXIMAGEUTILSYNC_H + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class CMPXImageUtil; + +// CLASS DECLARATION + +/** +* Declares the CMPXImageUtilSync class. +* @lib MPXSQLiteDbCommon.lib +**/ +NONSHARABLE_CLASS( CMPXImageUtilSync ) : public CActive + { +public: // Constructors and destructor + /** + * Two-phased constructor. + * @return pointer to a newly created object + */ + static CMPXImageUtilSync* NewL(); + + /** + * Destructor. + */ + ~CMPXImageUtilSync(); + +public: // New functions + /* + * Synchronously converts a JPG buffer to an CFbsBitmap. + * @param aSourceJPG JPG data + * @param aSize destination size to be used for calculating the optimal loading size + * @param aDisplayMode the display mode of the destination BMP + * @return converted bitmap. Ownership is transferred. + */ + CFbsBitmap* DecodeL(const TDesC8& aSourceJPG, TSize aSize, TDisplayMode aDisplayMode = EColor64K); + + /* + * Synchronously decodes an image from a JPG file. + * @param aSourceJPGFile Full path and filename of the image to be decoded. + * @param aSize destination size to be used for calculating the optimal loading size + * @param aDisplayMode the display mode of the destination BMP + * @return converted bitmap. Ownership is transferred. + */ + CFbsBitmap* DecodeL(const TDesC& aSourceJPGFile, TSize aSize, TDisplayMode aDisplayMode = EColor64K); + + /* + * Synchronously encodes a BMP to JPG. + * @param aSourceBMP source BMP + * @return destination JPG, ownership is transferred + */ + HBufC8* EncodeL(const CFbsBitmap& aSourceBMP); + + /* + * Synchronously scales a BMP to a specified size + * @param aSourceBMP source BMP + * @param aSize size to scale to + * @param aDisplayMode display mode for the destination image + * @return scaled BMP, ownership is transferred + */ + CFbsBitmap* ScaleL(CFbsBitmap& aSourceBMP, TSize aSize, TDisplayMode aDisplayMode = EColor64K); + +private: // From CActive + /** + * @see CActive + */ + void DoCancel(); + + /** + * @see CActive + */ + void RunL(); + + /** + * @see CActive + */ + TInt RunError(TInt aError); + +private: + /** + * C++ default constructor. + */ + CMPXImageUtilSync(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + +private: // Data + CActiveSchedulerWait* iActiveSchedulerWait; + CMPXImageUtil* iImageUtil; + CFbsBitmap* iBitmap; + HBufC8* iData; + TInt iError; + }; + +#endif // MPXIMAGEUTILSYNC_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmappcommonui/albumartutility/rom/mpxalbumartutility.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmappcommonui/albumartutility/rom/mpxalbumartutility.iby Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2005-2006 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: Image description file for project mpxalbumartutility +* +*/ + + + +#ifndef __MPXALBUMARTUTILITY_IBY__ +#define __MPXALBUMARTUTILITY_IBY__ + +file=ABI_DIR\BUILD_DIR\mpxalbumartutility.dll SHARED_LIB_DIR\mpxalbumartutility.dll + +#endif // __MPXALBUMARTUTILITY_IBY__ + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmappcommonui/albumartutility/src/mpxalbumartutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmappcommonui/albumartutility/src/mpxalbumartutility.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,319 @@ +/* +* Copyright (c) 2006 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: MPX album utility API +* +*/ + +#include +#include +#include +#include +#include +#include + +#include "mpximageutil.h" +#include "mpximageutilsync.h" +#include "mpxalbumartutility.h" + +// ============================== MEMBER FUNCTIONS ============================ + +// ---------------------------------------------------------------------------- +// Create the playback utility object +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXAlbumArtUtility* CMPXAlbumArtUtility::NewL() + { + CMPXAlbumArtUtility* self = new( ELeave )CMPXAlbumArtUtility(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXAlbumArtUtility::~CMPXAlbumArtUtility() + { + delete iImageUtil; + delete iImageUtilSync; + delete iBitmap; + delete iAlbumArt; + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CMPXAlbumArtUtility::CMPXAlbumArtUtility() : + CActive( EPriorityStandard ) + { + CActiveScheduler::Add( this ); + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +void CMPXAlbumArtUtility::ConstructL() + { + iImageUtil = CMPXImageUtil::NewL(); + iImageUtilSync = CMPXImageUtilSync::NewL(); + iBitmap = new ( ELeave ) CFbsBitmap(); + } + +// ---------------------------------------------------------------------------- +// Create the playback utility object +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXAlbumArtUtility::ExtractAlbumArtL(const CMPXMedia& aMedia, + MMPXAlbumArtUtilityObserver& aObs, + const TSize& aSize, + TDisplayMode aDisplayMode /*= EColor64K*/) + { + MPX_FUNC_EX( "CMPXAlbumArtUtility::ExtractAlbumArtL" ); + + if ( iCurrentOp != EIdle ) + { + User::Leave( KErrNotReady ); + } + + if ( aMedia.IsSupported( KMPXMediaMusicAlbumArtFileName ) ) + { + if ( aMedia.ValueText( KMPXMediaMusicAlbumArtFileName ).Length() == 0) + { + User::Leave( KErrNotFound ); + } + } + + if ( aMedia.IsSupported( KMPXMediaGeneralUri ) && + aMedia.IsSupported( KMPXMediaMusicAlbumArtFileName )) + { + if ( aMedia.ValueText( KMPXMediaGeneralUri ).CompareF( + aMedia.ValueText( KMPXMediaMusicAlbumArtFileName ) ) == 0 ) + { // embedded album art + iObs = &aObs; + delete iAlbumArt; + iAlbumArt = NULL; + iAlbumArt = iImageUtil->ExtractL( aMedia.ValueText( KMPXMediaMusicAlbumArtFileName ) ); + if ( iAlbumArt ) + { + iCurrentOp = EExtractAlbumArtL; + iObs->ExtractAlbumArtStarted(); + SetActive(); + iImageUtil->Decode( iStatus, *iAlbumArt, *iBitmap, aSize, aDisplayMode ); + } + else + { + User::Leave( KErrUnderflow ); + } + } + else + { + iCurrentOp = EExtractAlbumArtL; + // TO-DO: if we save externalize bitmap, we only need to internalize bitmap here. + iObs->ExtractAlbumArtStarted(); + SetActive(); + iImageUtil->Decode( iStatus, aMedia.ValueText( + KMPXMediaMusicAlbumArtFileName ), *iBitmap, aSize, aDisplayMode ); + } + } + else + { + User::Leave( KErrNotFound ); + } + } + +// ----------------------------------------------------------------------------- +// Asynchronously decodes an image from a JPG file. Generates a BMP in memory. +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXAlbumArtUtility::Decode( + TRequestStatus& aStatus, const TDesC& aSourceJPGFile, + CFbsBitmap& aDestBMP, TSize aSize, TDisplayMode aDisplayMode ) + { + MPX_FUNC_EX( "CMPXAlbumArtUtility::Decode Async File" ); + iImageUtil->Decode( aStatus, aSourceJPGFile, aDestBMP, aSize, aDisplayMode ); + } + +// ----------------------------------------------------------------------------- +// Asynchronously decodes an image from JPG buffer. Generates a BMP in memory. +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXAlbumArtUtility::Decode( + TRequestStatus& aStatus, const TDesC8& aSourceJPG, + CFbsBitmap& aDestBMP, TSize aSize, TDisplayMode aDisplayMode ) + { + MPX_FUNC_EX( "CMPXAlbumArtUtility::Decode Async Buffer" ); + iImageUtil->Decode( aStatus, aSourceJPG, aDestBMP, aSize, aDisplayMode ); + } + +// ----------------------------------------------------------------------------- +// Asynchronously encodes a BMP to a JPG. +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXAlbumArtUtility::Encode( + TRequestStatus& aStatus, const CFbsBitmap& aSourceBMP, + HBufC8*& aDestJPG ) + { + MPX_FUNC_EX( "CMPXAlbumArtUtility::Encode Async" ); + iImageUtil->Encode( aStatus, aSourceBMP, aDestJPG ); + } + +// ----------------------------------------------------------------------------- +// Asynchronously scales a BMP to a specified size. Generates another +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXAlbumArtUtility::Scale( + TRequestStatus& aStatus, CFbsBitmap& aSourceBMP, CFbsBitmap& aDestBMP, + TSize aSize, TDisplayMode aDisplayMode ) + { + MPX_FUNC_EX( "CMPXAlbumArtUtility::Scale Async" ); + iImageUtil->Scale( aStatus, aSourceBMP, aDestBMP, aSize, aDisplayMode ); + } + +// ----------------------------------------------------------------------------- +// Synchronously decodes an image from a JPG file. +// ----------------------------------------------------------------------------- +// +EXPORT_C CFbsBitmap* CMPXAlbumArtUtility::DecodeL( + const TDesC& aSourceJPGFile, TSize aSize, TDisplayMode aDisplayMode ) + { + MPX_FUNC_EX( "CMPXAlbumArtUtility::DecodeL Sync File" ); + return iImageUtilSync->DecodeL( aSourceJPGFile, aSize, aDisplayMode ); + } + +// ----------------------------------------------------------------------------- +// Synchronously converts a JPG buffer to an CFbsBitmap. +// ----------------------------------------------------------------------------- +// +EXPORT_C CFbsBitmap* CMPXAlbumArtUtility::DecodeL( + const TDesC8& aSourceJPG, TSize aSize, TDisplayMode aDisplayMode ) + { + MPX_FUNC_EX( "CMPXAlbumArtUtility::DecodeL Sync Buffer" ); + return iImageUtilSync->DecodeL( aSourceJPG, aSize, aDisplayMode ); + } + +// ----------------------------------------------------------------------------- +// Synchronously encodes a BMP to JPG. +// ----------------------------------------------------------------------------- +// +EXPORT_C HBufC8* CMPXAlbumArtUtility::EncodeL( const CFbsBitmap& aSourceBMP ) + { + MPX_FUNC_EX( "CMPXAlbumArtUtility::EncodeL Sync" ); + return iImageUtilSync->EncodeL( aSourceBMP ); + } + +// ----------------------------------------------------------------------------- +// Synchronously scales a BMP to a specified size +// ----------------------------------------------------------------------------- +// +EXPORT_C CFbsBitmap* CMPXAlbumArtUtility::ScaleL( + CFbsBitmap& aSourceBMP, TSize aSize, TDisplayMode aDisplayMode ) + { + MPX_FUNC_EX( "CMPXAlbumArtUtility::ScaleL Sync" ); + return iImageUtilSync->ScaleL( aSourceBMP, aSize, aDisplayMode ); + } + +// ----------------------------------------------------------------------------- +// Extracts embedded album art field from the media file. +// ----------------------------------------------------------------------------- +// +EXPORT_C HBufC8* CMPXAlbumArtUtility::ExtractL( const TDesC& aUri ) + { + MPX_FUNC_EX( "CMPXAlbumArtUtility::ExtractL Sync" ); + return iImageUtil->ExtractL( aUri ); + } + +// ----------------------------------------------------------------------------- +// Returns a new bitmap object from bitmnap data +// ----------------------------------------------------------------------------- +// +EXPORT_C CFbsBitmap* CMPXAlbumArtUtility::BitmapL( const TDesC8& aBMPData ) + { + MPX_FUNC_EX( "CMPXAlbumArtUtility::BitmapL Sync" ); + return iImageUtil->BitmapL( aBMPData ); + } + +// ----------------------------------------------------------------------------- +// Returns bitmap data from a bitmap object +// ----------------------------------------------------------------------------- +// +EXPORT_C HBufC8* CMPXAlbumArtUtility::BitmapDataL( const CFbsBitmap& aBMP ) + { + MPX_FUNC_EX( "CMPXAlbumArtUtility::BitmapDataL Sync" ); + return iImageUtil->BitmapDataL( aBMP ); + } + +// ----------------------------------------------------------------------------- +// Cancel Asynch requests +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXAlbumArtUtility::CancelRequest() + { + MPX_FUNC_EX( "CMPXAlbumArtUtility::CancelRequest" ); + if ( iImageUtil ) + { + iImageUtil->CancelRequest(); + } + } + +// ----------------------------------------------------------------------------- +// CMPXImageUtilSync::DoCancel +// ----------------------------------------------------------------------------- +// +void CMPXAlbumArtUtility::DoCancel() + { + MPX_FUNC( "CMPXAlbumArtUtility::DoCancel" ); + } + +// ----------------------------------------------------------------------------- +// CMPXImageUtilSync::RunL +// ----------------------------------------------------------------------------- +// +void CMPXAlbumArtUtility::RunL() + { + MPX_FUNC( "CMPXAlbumArtUtility::RunL" ); + switch ( iCurrentOp ) + { + case EExtractAlbumArtL: + { + iCurrentOp = EIdle; + iObs->ExtractAlbumArtCompleted( iBitmap, KErrNone ); + delete iAlbumArt; + iAlbumArt = NULL; + iBitmap = NULL; // ownership transfered + iBitmap = new ( ELeave ) CFbsBitmap(); + break; + } + default: + { + break; + } + } + } + +// ----------------------------------------------------------------------------- +// CMPXImageUtilSync::RunError +// ----------------------------------------------------------------------------- +// +TInt CMPXAlbumArtUtility::RunError( TInt /*aError*/ ) + { + MPX_FUNC( "CMPXAlbumArtUtility::RunError" ); + return KErrNone; + } + + +// End of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmappcommonui/albumartutility/src/mpximageutil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmappcommonui/albumartutility/src/mpximageutil.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,460 @@ +/* +* Copyright (c) 2007 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: Implementation of CMPXImageUtil. +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mpximageutil.h" + +// CONSTANTS +const TInt KMPXBitmapBufferGranularity = 1024; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CMPXImageUtil* CMPXImageUtil::NewL() + { + MPX_FUNC( "CMPXImageUtil::NewL" ); + CMPXImageUtil* self = new ( ELeave ) CMPXImageUtil(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// C++ constructor can NOT contain any code that might leave. +// ----------------------------------------------------------------------------- +// +CMPXImageUtil::CMPXImageUtil() : + iOperation( EIdle ) + { + MPX_FUNC( "CMPXImageUtil::CMPXImageUtil" ); + } + +// ----------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CMPXImageUtil::ConstructL() + { + MPX_FUNC( "CMPXImageUtil::ConstructL" ); + User::LeaveIfError( iFs.Connect() ); + + // this is needed in order to create CFbsBitmap instances and it has to be + // done before instantiating the bitmap scaler + User::LeaveIfError( RFbsSession::Connect( iFs ) ); + + iScaler = CBitmapScaler::NewL(); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CMPXImageUtil::~CMPXImageUtil() + { + MPX_FUNC( "CMPXImageUtil::~CMPXImageUtil" ); + delete iDecoder; + delete iEncoder; + delete iScaler; + + if (RFbsSession::GetSession()) + { + RFbsSession::Disconnect(); + } + iFs.Close(); + } + +// ----------------------------------------------------------------------------- +// CMPXImageUtil::ExtractL +// Synchronous method. +// ----------------------------------------------------------------------------- +// +HBufC8* CMPXImageUtil::ExtractL( const TDesC& aUri ) + { + MPX_FUNC( "CMPXImageUtil::ExtractL" ); + + HBufC8* ret( NULL ); + CMetaDataUtility* metaDataUtil = CMetaDataUtility::NewL(); + CleanupStack::PushL( metaDataUtil ); + + RArray wantedFields; + CleanupClosePushL( wantedFields ); + wantedFields.AppendL( EMetaDataJpeg ); + + metaDataUtil->OpenFileL( aUri, wantedFields ); + const CMetaDataFieldContainer& metaCont = metaDataUtil->MetaDataFieldsL(); + TPtrC data = metaCont.Field( EMetaDataJpeg ); + + if ( data.Length() ) + { + // if no album art return NULL + ret = MPXUser::Alloc8L( data ); + } + + CleanupStack::PopAndDestroy( &wantedFields ); + CleanupStack::PopAndDestroy( metaDataUtil ); + + return ret; + } + +// ----------------------------------------------------------------------------- +// CMPXImageUtil::Decode +// ----------------------------------------------------------------------------- +// +void CMPXImageUtil::Decode( + TRequestStatus& aStatus, + const TDesC& aSourceJPGFile, + CFbsBitmap& aDestBMP, + TSize aSize, + TDisplayMode aDisplayMode /* = EColor64K */) + { + MPX_FUNC( "CMPXImageUtil::Decode" ); + TRAPD( err, DoDecodeL( aStatus, aSourceJPGFile, aDestBMP, aSize, aDisplayMode ) ); + if ( err ) + { + TRequestStatus* status = &aStatus; + User::RequestComplete( status, err ); + } + } + +// ----------------------------------------------------------------------------- +// Starts to decode an image from a buffer. +// ----------------------------------------------------------------------------- +// +void CMPXImageUtil::Decode( + TRequestStatus& aStatus, + const TDesC8& aJPGData, + CFbsBitmap& aDestBMP, + TSize aSize, + TDisplayMode aDisplayMode /* = EColor64K */) + { + MPX_FUNC( "CMPXImageUtil::Decode" ); + TRAPD( err, DoDecodeL( aStatus, aJPGData, aDestBMP, aSize, aDisplayMode ) ); + if ( err ) + { + TRequestStatus* status = &aStatus; + User::RequestComplete( status, err ); + } + } + +// ----------------------------------------------------------------------------- +// CMPXImageUtil::Encode +// Converts a BMP to a JPG. +// ----------------------------------------------------------------------------- +// +void CMPXImageUtil::Encode( + TRequestStatus& aStatus, + const CFbsBitmap& aSourceBMP, + HBufC8*& aDestJPG ) + { + MPX_FUNC( "CMPXImageUtil::Encode" ); + TRAPD( err, DoEncodeL( aStatus, aSourceBMP, aDestJPG ) ); + if ( err ) + { + TRequestStatus* status = &aStatus; + User::RequestComplete( status, err ); + } + } + +// ----------------------------------------------------------------------------- +// CMPXImageUtil::Scale +// Scales a BMP to a specified size. +// ----------------------------------------------------------------------------- +// +void CMPXImageUtil::Scale( + TRequestStatus& aStatus, + CFbsBitmap& aSrcBMP, + CFbsBitmap& aDestBMP, + TSize aSize, + TDisplayMode aDisplayMode /* = EColor64K */) + { + MPX_FUNC( "CMPXImageUtil::Scale" ); + TRAPD( err, DoScaleL( aStatus, aSrcBMP, aDestBMP, aSize, aDisplayMode ) ); + if ( err ) + { + TRequestStatus* status = &aStatus; + User::RequestComplete( status, err ); + } + } + +// ----------------------------------------------------------------------------- +// CMPXImageUtil::BitmapL +// ----------------------------------------------------------------------------- +// +CFbsBitmap* CMPXImageUtil::BitmapL( + const TDesC8& aBMPData) + { + MPX_FUNC( "CMPXImageUtil::BitmapL" ); + + CFbsBitmap* bitmap = new ( ELeave ) CFbsBitmap; + CleanupStack::PushL( bitmap ); + + RDesReadStream stream( aBMPData ); + CleanupClosePushL( stream ); + stream >> *bitmap; + CleanupStack::PopAndDestroy( &stream ); + + CleanupStack::Pop( bitmap ); + + return bitmap; + } + +// ----------------------------------------------------------------------------- +// CMPXImageUtil::BitmapDataL +// ----------------------------------------------------------------------------- +// +HBufC8* CMPXImageUtil::BitmapDataL( + const CFbsBitmap& aBMP) + { + MPX_FUNC("CMPXImageUtil::BitmapDataL"); + + CBufBase* buffer = CBufSeg::NewL( KMPXBitmapBufferGranularity ); + CleanupStack::PushL( buffer ); + + RBufWriteStream stream( *buffer ); + CleanupClosePushL( stream ); + stream << aBMP; + stream.CommitL(); + CleanupStack::PopAndDestroy( &stream ); + + TInt length( buffer->Size() ); + HBufC8* data = HBufC8::NewL( length ); + TPtr8 ptr( data->Des() ); + buffer->Read( 0, ptr, length ); + + CleanupStack::PopAndDestroy( buffer ); + + return data; + } + +// ----------------------------------------------------------------------------- +// CMPXImageUtil::CancelRequest +// Cancel Asynch requests +// ----------------------------------------------------------------------------- +// +void CMPXImageUtil::CancelRequest() + { + MPX_FUNC( "CMPXImageUtil::CancelRequest" ); + switch ( iOperation ) + { + case EDecoding: + { + if( iDecoder ) + { + iDecoder->Cancel(); + delete iDecoder; + iDecoder = NULL; + } + break; + } + case EEncoding: + { + if( iEncoder ) + { + iEncoder->Cancel(); + delete iEncoder; + iEncoder = NULL; + } + break; + } + case EScaling: + { + if( iScaler ) + { + iScaler->Cancel(); + } + break; + } + default: + { + // No Asynchronous events are taking place, do nothing. + break; + } + } + } + +// ----------------------------------------------------------------------------- +// CMPXImageUtil::DoDecodeL +// ----------------------------------------------------------------------------- +// +void CMPXImageUtil::DoDecodeL( + TRequestStatus& aStatus, + const TDesC& aSourceJPGFile, + CFbsBitmap& aDestBMP, + TSize aSize, + TDisplayMode aDisplayMode /* = EColor64K */) + { + MPX_FUNC( "CMPXImageUtil::DoDecodeL" ); + + delete iDecoder; + iDecoder = NULL; + // create the decoder + iDecoder = CImageDecoder::FileNewL( iFs, aSourceJPGFile ); + + // Get image size + const TFrameInfo& frameInfo = iDecoder->FrameInfo(); + TSize bitmapSize = frameInfo.iOverallSizeInPixels; + bitmapSize = OptimalLoadingSize( bitmapSize, aSize ); + + User::LeaveIfError( aDestBMP.Create( bitmapSize, aDisplayMode ) ); + + // start conversion to bitmap + iOperation = EDecoding; + iDecoder->Convert( &aStatus, aDestBMP ); + } + +// ----------------------------------------------------------------------------- +// CMPXImageUtil::DoDecodeL +// ----------------------------------------------------------------------------- +// +void CMPXImageUtil::DoDecodeL( + TRequestStatus& aStatus, + const TDesC8& aSourceJPG, + CFbsBitmap& aDestBMP, + TSize aSize, + TDisplayMode aDisplayMode /* = EColor64K */) + { + MPX_FUNC( "CMPXImageUtil::DoDecodeL" ); + + delete iDecoder; + iDecoder = NULL; + + // create the decoder + iDecoder = CImageDecoder::DataNewL( iFs, aSourceJPG ); + + // Get image size + const TFrameInfo& frameInfo = iDecoder->FrameInfo(); + TSize bitmapSize = frameInfo.iOverallSizeInPixels; + bitmapSize = OptimalLoadingSize( bitmapSize, aSize ); + + // create the destination bitmap + User::LeaveIfError( aDestBMP.Create( bitmapSize, aDisplayMode ) ); + + // start conversion to bitmap + iOperation = EDecoding; + iDecoder->Convert( &aStatus, aDestBMP ); + } + +// ----------------------------------------------------------------------------- +// CMPXImageUtil::DoEncodeL +// ----------------------------------------------------------------------------- +// +void CMPXImageUtil::DoEncodeL( + TRequestStatus& aStatus, + const CFbsBitmap& aSourceBMP, + HBufC8*& aDestJPG) + { + MPX_FUNC( "CMPXImageUtil::DoEncodeL" ); + + // Encode as JPEG + delete iEncoder; + iEncoder = NULL; + iEncoder = CImageEncoder::DataNewL( + aDestJPG, CImageEncoder::EOptionNone, KImageTypeJPGUid ); + iOperation = EEncoding; + iEncoder->Convert( &aStatus, aSourceBMP ); + } + +// ----------------------------------------------------------------------------- +// CMPXImageUtil::DoScaleL +// ----------------------------------------------------------------------------- +// +void CMPXImageUtil::DoScaleL( + TRequestStatus& aStatus, + CFbsBitmap& aSourceBMP, + CFbsBitmap& aDestBMP, + TSize aSize, + TDisplayMode aDisplayMode /* = EColor64K */) + { + MPX_FUNC( "CMPXImageUtil::DoScaleL" ); + + // create the destination bitmap + User::LeaveIfError( aDestBMP.Create( aSize, aDisplayMode ) ); + + // if TBool aMaintainAspectRatio = ETrue, then the image may not have be + // 95x95. If TBool aMaintainAspectRatio = EFalse, the image may appear + // to be stretched, as the aspect ratio is not maintained. + iOperation = EScaling; + iScaler->Scale( &aStatus, aSourceBMP, aDestBMP, ETrue ); + } + +// ----------------------------------------------------------------------------- +// Determines optimum loading size for the bitmap. +// ----------------------------------------------------------------------------- +TSize CMPXImageUtil::OptimalLoadingSize( + const TSize& aOriginalSize, + const TSize& aNeededSize ) + { + TSize size = AdjustSize( aOriginalSize, aNeededSize ); + + // Find max scaling factor which won't make image smaller than target size + TInt shift = 3; + while (shift && ( ( aOriginalSize.iWidth >> shift ) < size.iWidth || + ( aOriginalSize.iHeight >> shift ) < size.iHeight ) ) + { + shift--; + } + + TInt round = ( 1 << shift ) - 1; // Used to "round up" the scaled values + TSize loadSize( ( aOriginalSize.iWidth + round ) >> shift, + ( aOriginalSize.iHeight + round ) >> shift ); + + return loadSize; + } + +// ----------------------------------------------------------------------------- +// CMPXImageUtil::AdjustSize +// ----------------------------------------------------------------------------- +// +TSize CMPXImageUtil::AdjustSize( + const TSize& aSourceSize, + const TSize& aTargetSize ) + { + TSize size( aTargetSize ); + + if ( aTargetSize.iHeight * aSourceSize.iWidth < + aTargetSize.iWidth * aSourceSize.iHeight ) + { + // Source has taller aspect than target so reduce target width + size.iWidth = ( aTargetSize.iHeight * aSourceSize.iWidth ) / + aSourceSize.iHeight; + } + else + { + // Source has wider aspect than target so reduce target height + size.iHeight = ( aTargetSize.iWidth * aSourceSize.iHeight ) / + aSourceSize.iWidth; + } + + return size; + } + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmappcommonui/albumartutility/src/mpximageutilsync.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmappcommonui/albumartutility/src/mpximageutilsync.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,216 @@ +/* +* Copyright (c) 2007 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: Implementation of CMPXImageUtilSync. +* +*/ + + +// INCLUDE FILES +#include +#include + +#include "mpximageutil.h" +#include "mpximageutilsync.h" + +// CONSTANTS + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CMPXImageUtilSync* CMPXImageUtilSync::NewL() + { + MPX_FUNC("CMPXImageUtil::NewL"); + CMPXImageUtilSync* self = new ( ELeave ) CMPXImageUtilSync(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// C++ constructor can NOT contain any code, that might leave. +// ----------------------------------------------------------------------------- +// +CMPXImageUtilSync::CMPXImageUtilSync() : + CActive( EPriorityStandard ) + { + MPX_FUNC( "CMPXImageUtilSync::CMPXImageUtilSync" ); + } + +// ----------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CMPXImageUtilSync::ConstructL() + { + MPX_FUNC( "CMPXImageUtilSync::ConstructL" ); + CActiveScheduler::Add(this); + + iImageUtil = CMPXImageUtil::NewL(); + iActiveSchedulerWait = new ( ELeave ) CActiveSchedulerWait(); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CMPXImageUtilSync::~CMPXImageUtilSync() + { + MPX_FUNC( "CMPXImageUtilSync::~CMPXImageUtilSync" ); + delete iImageUtil; + delete iActiveSchedulerWait; + } + +// ----------------------------------------------------------------------------- +// Decodes an JPG synchronously +// ----------------------------------------------------------------------------- +// +CFbsBitmap* CMPXImageUtilSync::DecodeL( + const TDesC8& aJPGData, + TSize aSize, + TDisplayMode aDisplayMode /* = EColor64K */) + { + MPX_FUNC( "CMPXImageUtilSync::DecodeL" ); + + iBitmap = new ( ELeave ) CFbsBitmap(); + + iImageUtil->Decode( iStatus, aJPGData, *iBitmap, aSize, aDisplayMode ); + SetActive(); + + // block waiting for completion + iActiveSchedulerWait->Start(); + User::LeaveIfError( iError ); + + // transfer the ownership + CFbsBitmap* bmp = iBitmap; + + iBitmap = NULL; + return bmp; + } + +// ----------------------------------------------------------------------------- +// Decodes an JPG synchronously +// ----------------------------------------------------------------------------- +// +CFbsBitmap* CMPXImageUtilSync::DecodeL( + const TDesC& aSourceJPGFile, + TSize aSize, + TDisplayMode aDisplayMode /* = EColor64K */) + { + MPX_FUNC( "CMPXImageUtilSync::DecodeL" ); + + iBitmap = new ( ELeave ) CFbsBitmap(); + + iImageUtil->Decode( iStatus, aSourceJPGFile, *iBitmap, aSize, aDisplayMode ); + SetActive(); + + // block waiting for completion + iActiveSchedulerWait->Start(); + User::LeaveIfError( iError ); + + // transfer the ownership + CFbsBitmap* bmp = iBitmap; + + iBitmap = NULL; + return bmp; + } + +// ----------------------------------------------------------------------------- +// CMPXImageUtilSync::EncodeL +// ----------------------------------------------------------------------------- +// +HBufC8* CMPXImageUtilSync::EncodeL( + const CFbsBitmap& aSourceBMP) + { + MPX_FUNC( "CMPXImageUtilSync::EncodeL" ); + + iImageUtil->Encode( iStatus, aSourceBMP, iData ); + SetActive(); + + // block waiting for completion + iActiveSchedulerWait->Start(); + User::LeaveIfError( iError ); + + // transfer the ownership + HBufC8* dataTmp = iData; + iData = NULL; + return dataTmp; + } + +// ----------------------------------------------------------------------------- +// CMPXImageUtilSync::ScaleL +// ----------------------------------------------------------------------------- +// +CFbsBitmap* CMPXImageUtilSync::ScaleL( + CFbsBitmap& aSourceBMP, + TSize aSize, + TDisplayMode aDisplayMode /* = EColor64K */) + { + MPX_FUNC( "CMPXImageUtilSync::ScaleL" ); + + iBitmap = new ( ELeave ) CFbsBitmap(); + + iImageUtil->Scale( iStatus, aSourceBMP, *iBitmap, aSize, aDisplayMode ); + SetActive(); + + // block waiting for completion + iActiveSchedulerWait->Start(); + User::LeaveIfError( iError ); + + // transfer the ownership + CFbsBitmap* bmp = iBitmap; + + iBitmap = NULL; + return bmp; + } + +// ----------------------------------------------------------------------------- +// CMPXImageUtilSync::DoCancel +// ----------------------------------------------------------------------------- +// +void CMPXImageUtilSync::DoCancel() + { + MPX_FUNC( "CMPXImageUtilSync::DoCancel" ); + iImageUtil->CancelRequest(); + } + +// ----------------------------------------------------------------------------- +// CMPXImageUtilSync::RunL +// ----------------------------------------------------------------------------- +// +void CMPXImageUtilSync::RunL() + { + MPX_FUNC( "CMPXImageUtilSync::RunL" ); + iActiveSchedulerWait->AsyncStop(); + } + +// ----------------------------------------------------------------------------- +// CMPXImageUtilSync::RunError +// ----------------------------------------------------------------------------- +// +TInt CMPXImageUtilSync::RunError( + TInt aError) + { + MPX_FUNC( "CMPXImageUtilSync::RunL" ); + + iError = aError; + iActiveSchedulerWait->AsyncStop(); + + return KErrNone; + } + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmappcommonui/backsteppingutility/bwinscw/mpxbacksteppingutilityu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmappcommonui/backsteppingutility/bwinscw/mpxbacksteppingutilityu.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?UtilityL@MMPXBackSteppingUtility@@SAPAV1@XZ @ 1 NONAME ; class MMPXBackSteppingUtility * MMPXBackSteppingUtility::UtilityL(void) + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmappcommonui/backsteppingutility/eabi/mpxbacksteppingutilityu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmappcommonui/backsteppingutility/eabi/mpxbacksteppingutilityu.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _ZN23MMPXBackSteppingUtility8UtilityLEv @ 1 NONAME + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmappcommonui/backsteppingutility/group/backsteppingutility.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmappcommonui/backsteppingutility/group/backsteppingutility.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2005-2006 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 for project backsteppingutility +* +*/ + + + +#include +#include + +TARGET mpxbacksteppingutility.dll +CAPABILITY CAP_GENERAL_DLL +TARGETTYPE DLL +UID 0x1000008D 0x101FFC16 +VENDORID VID_DEFAULT + +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE + + +SOURCEPATH ../src +SOURCE mpxbacksteppingutility.cpp +SOURCE mpxbacksteppingutilityimp.cpp + +LIBRARY euser.lib +LIBRARY liwservicehandler.lib + +#if defined(ARMCC) +deffile ../eabi/ +#elif defined(WINSCW) +deffile ../bwinscw/ +#endif + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmappcommonui/backsteppingutility/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmappcommonui/backsteppingutility/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2008 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 for project mpxbacksteppingutility +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../rom/mpxbacksteppingutility.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mpxbacksteppingutility.iby) + +PRJ_MMPFILES +backsteppingutility.mmp + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmappcommonui/backsteppingutility/inc/mpxbacksteppingutilityimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmappcommonui/backsteppingutility/inc/mpxbacksteppingutilityimp.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,170 @@ +/* +* Copyright (c) 2007 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: MPX back stepping utility singleton +* +*/ + + +#ifndef CMPXBACKSTEPPINGUTILITYIMP_H +#define CMPXBACKSTEPPINGUTILITYIMP_H + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class MLiwInterface; +class CLiwGenericParamList; +class CLiwServiceHandler; + +// CLASS DECLARATION + +/** +* Music Player common utility class + * + * @lib mpxbacksteppingutility.lib + * @since S60 v3.2 +*/ +NONSHARABLE_CLASS( CMPXBackSteppingUtilityImp ) + : public CBase + , public MMPXBackSteppingUtility + { +public: + + /** + * Retrieve a back stepping utility of this thread. All clients in this thread + * shares the same utility (singleton) + * Call Close() when this object is not needed anymore. + * + * @since 3.2 + * @return Pointer to backstepping utility. Ownership not transferred. + */ + static MMPXBackSteppingUtility* UtilityL(); + + /** + * This method must be called when this object can be freed. This object + * will be destroyed when no one is using it. + * + * @since 3.2 + */ + void Close(); + + /** + * Forwards activation event + * + * @since S60 v3.2 + * @param aState state of application like view ids + * @param aEnter indicate if it is entry/exit activation + * @return result code retutned by BS Service interface + * @leave leaves from HandleResultL are propagated + */ + TInt ForwardActivationEventL( + const TDesC8& aState, + const TBool aEnter ); + + /** + * Handles back command + * + * @since S60 v3.2 + * @param aState state of application like view ids + * @return result code retutned by BS Service interface + * @leave leaves from HandleResultL are propagated + */ + TInt HandleBackCommandL( const TDesC8& aState ); + + /** + * Initializes BS Service + * @param aUid client application UID + * @leave KErrNotSupported or KErrArgument + * (if arguments passed to BS Service are incorrect + * or could not initialize BS) + * KErrNotFound (if there was no return value) + */ + void InitializeL( const TUid aUid ); + +private: + + /** + * C++ constructor + */ + CMPXBackSteppingUtilityImp(); + + /** + * Destuctor + */ + virtual ~CMPXBackSteppingUtilityImp(); + + /** + * 2nd phase constructor + */ + void ConstructL(); + + /** + * Two phased contructor + */ + static CMPXBackSteppingUtilityImp* NewL(); + static CMPXBackSteppingUtilityImp* NewLC(); + + /** + * Store utility to TLS. + * + * @param aUtility Utility object. Ownership not transferred. + */ + static void StoreUtility( MMPXBackSteppingUtility* aUtility ); + + /** + * Handles the result of a LIW command + * @return result code retutned by BS Service interface + * @leave KErrNotSupported or KErrArgument + * (if arguments passed to BS Service are incorrect) + * KErrNotFound (if there was no return value) + */ + TInt HandleResultL(); + +private: // data + + /** + * Reference count. + */ + TInt iRefCount; + + /** + * AIW Service Handler + * Own. + */ + CLiwServiceHandler* iServiceHandler; + + /** + * BS Service interface returned by LIW + * Own. + */ + MLiwInterface* iBSInterface; + + /** + * In param list + * Not own. + */ + CLiwGenericParamList* iInParamList; + + /** + * Out param list + * Not own. + */ + CLiwGenericParamList* iOutParamList; + + }; + +#endif // CMPXBACKSTEPPINGUTILITYIMP_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmappcommonui/backsteppingutility/rom/mpxbacksteppingutility.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmappcommonui/backsteppingutility/rom/mpxbacksteppingutility.iby Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2005-2006 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: Image description file for project mpxbacksteppingutility +* +*/ + + + +#ifndef __MPXBACKSTEPPINGUTILITY_IBY__ +#define __MPXBACKSTEPPINGUTILITY_IBY__ + +file=ABI_DIR\BUILD_DIR\mpxbacksteppingutility.dll SHARED_LIB_DIR\mpxbacksteppingutility.dll + +#endif // __MPXBACKSTEPPINGUTILITY_IBY__ + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmappcommonui/backsteppingutility/src/mpxbacksteppingutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmappcommonui/backsteppingutility/src/mpxbacksteppingutility.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2006 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: Implementation of back stepping utility +* +*/ + + + +// INCLUDE FILES +#include "mpxbacksteppingutilityimp.h" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Retrieve a back stepping utility of this thread. +// --------------------------------------------------------------------------- +// +EXPORT_C MMPXBackSteppingUtility* MMPXBackSteppingUtility::UtilityL() + { + return CMPXBackSteppingUtilityImp::UtilityL(); + } + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmappcommonui/backsteppingutility/src/mpxbacksteppingutilityimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmappcommonui/backsteppingutility/src/mpxbacksteppingutilityimp.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,324 @@ +/* +* Copyright (c) 2007 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: MPX Back Stepping Service API +* +*/ + + +// from AIW and LIW +#include +#include + +// for CleanupResetAndDestroyPushL +#include + +#include "mpxbacksteppingutilityimp.h" +#include + +// definitions needed by BackStepping service. (ref. bsserviceconstants.h) + +// BSS Service and Interface ID +_LIT8( KBSServiceID, "Service.BackStepping" ); +_LIT8( KBSInterface, "IBackStepping" ); + +// BSS commands +_LIT8( KBSCmdInitialize, "Initialize" ); +_LIT8( KBSCmdForwardActivationEvent, "ForwardActivationEvent" ); +_LIT8( KBSCmdHandleBackCommand, "HandleBackCommand" ); + +// BSS in param names +_LIT8( KBSInParamAppUid, "AppUid" ); +_LIT8( KBSInParamState, "State" ); +_LIT8( KBSInParamEnter, "Enter" ); + +// BSS out param names +_LIT8( KBSOutParamStatusInfo, "StatusInfo" ); + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Private Constructor +// --------------------------------------------------------------------------- +// +CMPXBackSteppingUtilityImp::CMPXBackSteppingUtilityImp() + { + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CMPXBackSteppingUtilityImp::~CMPXBackSteppingUtilityImp() + { + MPX_DEBUG1( "CMPXBackSteppingUtilityImp::~CMPXBackSteppingUtilityImp" ); + if ( iBSInterface ) + { + iBSInterface->Close(); + } + + delete iServiceHandler; + } + +// ---------------------------------------------------------------------------- +// 2nd-Phased Constructor +// ---------------------------------------------------------------------------- +// +void CMPXBackSteppingUtilityImp::ConstructL() + { + MPX_DEBUG1( "-->CMPXBackSteppingUtilityImp::ConstructL" ); + // create Service Handler and keep as long as access to BS Service needed + iServiceHandler = CLiwServiceHandler::NewL(); + // for convinience keep pointers to Service Handler param lists + iInParamList = &iServiceHandler->InParamListL(); + iOutParamList = &iServiceHandler->OutParamListL(); + + RCriteriaArray criteriaArray; + CleanupResetAndDestroyPushL( criteriaArray ); + + // create AIW criteria + CLiwCriteriaItem* criterion = CLiwCriteriaItem::NewLC( + KLiwCmdAsStr, KBSInterface, KBSServiceID ); + criterion->SetServiceClass( TUid::Uid( KLiwClassBase ) ); + + criteriaArray.AppendL( criterion ); + CleanupStack::Pop( criterion ); + + // attach AIW criteria + iServiceHandler->AttachL( criteriaArray ); + // get BS Service interface + iServiceHandler->ExecuteServiceCmdL( + *criterion, + *iInParamList, + *iOutParamList ); + + CleanupStack::PopAndDestroy( &criteriaArray ); + + // extract BS interface from output params + TInt pos( 0 ); + iOutParamList->FindFirst( pos, KBSInterface ); + if( pos != KErrNotFound ) + { + iBSInterface = (*iOutParamList)[pos].Value().AsInterface(); + } + + if ( !iBSInterface ) + { + // handle no BS Service + User::Leave( KErrNotFound ); + } + + MPX_DEBUG1( "<--CMPXBackSteppingUtilityImp::ConstructL" ); + } + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXBackSteppingUtilityImp* CMPXBackSteppingUtilityImp::NewL() + { + CMPXBackSteppingUtilityImp* self = CMPXBackSteppingUtilityImp::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CMPXBackSteppingUtilityImp* CMPXBackSteppingUtilityImp::NewLC() + { + CMPXBackSteppingUtilityImp* self = new( ELeave ) CMPXBackSteppingUtilityImp; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// Retrieves view utility from TLS. Creates if it's not there. +// --------------------------------------------------------------------------- +// +MMPXBackSteppingUtility* CMPXBackSteppingUtilityImp::UtilityL() + { + MPX_DEBUG1( "-->CMPXBackSteppingUtilityImp::UtilityL" ); + MMPXBackSteppingUtility* utility = + reinterpret_cast( Dll::Tls() ); + if ( !utility ) + { + utility = CMPXBackSteppingUtilityImp::NewL(); + StoreUtility( utility ); + } + + static_cast( utility )->iRefCount++; + MPX_DEBUG1( "<--CMPXBackSteppingUtilityImp::UtilityL" ); + return utility; + } + +// --------------------------------------------------------------------------- +// Store back stepping utility to TLS. +// --------------------------------------------------------------------------- +// +void CMPXBackSteppingUtilityImp::StoreUtility( MMPXBackSteppingUtility* aUtility ) + { + Dll::SetTls( aUtility ); + } + +// --------------------------------------------------------------------------- +// From CMPXBackSteppingUtilityImp +// This method must be called when the client no longer needs this instance. +// This object will be destroyed when no one is using it. +// --------------------------------------------------------------------------- +// +void CMPXBackSteppingUtilityImp::Close() + { + ASSERT( iRefCount > 0 ); + MPX_FUNC_EX( "CMPXBackSteppingUtilityImp::Close" ); + MPX_DEBUG2( "CMPXBackSteppingUtilityImp::Close ref count = %d", iRefCount ); + if ( --iRefCount == 0 ) + { + MPX_DEBUG1( "CMPXBackSteppingUtilityImp::Close deleting this" ); + // last client released + StoreUtility( NULL ); + delete this; + } + } + +// --------------------------------------------------------------------------- +// Forwards activation event +// --------------------------------------------------------------------------- +// +TInt CMPXBackSteppingUtilityImp::ForwardActivationEventL( + const TDesC8& aState, + const TBool aEnter ) + { + MPX_DEBUG1( "-->CMPXBackSteppingUtilityImp::ForwardActivationEventL" ); + iInParamList->Reset(); + iOutParamList->Reset(); + + TLiwGenericParam state( KBSInParamState, TLiwVariant( aState ) ); + iInParamList->AppendL( state ); + TLiwGenericParam enter( KBSInParamEnter, TLiwVariant( aEnter ) ); + iInParamList->AppendL( enter ); + + iBSInterface->ExecuteCmdL( + KBSCmdForwardActivationEvent, + *iInParamList, + *iOutParamList ); + + TInt result = HandleResultL(); + + iInParamList->Reset(); + iOutParamList->Reset(); + + MPX_DEBUG1( "<--CMPXBackSteppingUtilityImp::ForwardActivationEventL" ); + return result; + } + +// --------------------------------------------------------------------------- +// Handles back command +// --------------------------------------------------------------------------- +// +TInt CMPXBackSteppingUtilityImp::HandleBackCommandL( + const TDesC8& aState ) + { + MPX_DEBUG1( "-->CMPXBackSteppingUtilityImp::HandleBackCommandL" ); + iInParamList->Reset(); + iOutParamList->Reset(); + + TLiwGenericParam state( KBSInParamState, TLiwVariant( aState ) ); + iInParamList->AppendL( state ); + + iBSInterface->ExecuteCmdL( + KBSCmdHandleBackCommand, + *iInParamList, + *iOutParamList ); + + TInt result = HandleResultL(); + + iInParamList->Reset(); + iOutParamList->Reset(); + + MPX_DEBUG1( "<--CMPXBackSteppingUtilityImp::HandleBackCommandL" ); + return result; + } + +// --------------------------------------------------------------------------- +// Initializes BS Service +// --------------------------------------------------------------------------- +// +void CMPXBackSteppingUtilityImp::InitializeL( const TUid aUid ) + { + MPX_DEBUG2( "-->CMPXBackSteppingUtilityImp::InitializeL aUid=0x%x", aUid.iUid ); + iInParamList->Reset(); + iOutParamList->Reset(); + + TLiwGenericParam appUid( KBSInParamAppUid, TLiwVariant( aUid.iUid ) ); + iInParamList->AppendL( appUid ); + + iBSInterface->ExecuteCmdL( + KBSCmdInitialize, + *iInParamList, + *iOutParamList ); + + if ( HandleResultL() != 1 ) + { + // Initialize command was not consumed - handle failiure + User::Leave( KErrArgument ); + } + + iInParamList->Reset(); + iOutParamList->Reset(); + MPX_DEBUG1( "<--CMPXBackSteppingUtilityImp::InitializeL" ); + } + +// --------------------------------------------------------------------------- +// Handles the result of a LIW command +// --------------------------------------------------------------------------- +// +TInt CMPXBackSteppingUtilityImp::HandleResultL() + { + MPX_DEBUG1( "-->CMPXBackSteppingUtilityImp::HandleResultL" ); + TInt statusInfo( KErrNotFound ); + + TInt posErr( 0 ); + iOutParamList->FindFirst( posErr, LIW::EGenericParamError ); + if( posErr != KErrNotFound ) + { + // error code found - extract and handle + TInt errorCode( KErrNone ); + (*iOutParamList)[posErr].Value().Get( errorCode ); + + User::LeaveIfError( errorCode ); + } + + // if no error returned, carry on + TInt posStat( 0 ); + iOutParamList->FindFirst( posStat, KBSOutParamStatusInfo ); + if( posStat != KErrNotFound ) + { + // status info present - extract and return + (*iOutParamList)[posStat].Value().Get( statusInfo ); + } + else + { + // no return value + // this should not happen + User::Leave( KErrNotFound ); + } + + MPX_DEBUG2( "<--CMPXBackSteppingUtilityImp::HandleResultL statusInfo=%d", statusInfo ); + return statusInfo; + } + +// End of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmappcommonui/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmappcommonui/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2007 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 for mmappcommonui +* +*/ + + +#include +#include +#include "../../../inc/mmappfwbldvariant.hrh" + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + + +PRJ_MMPFILES +#include "../albumartutility/group/bld.inf" +#ifdef IAD_INCLUDE_BACKSTEPPING +#include "../backsteppingutility/group/bld.inf" +#endif // IAD_INCLUDE_BACKSTEPPING + + +// End of File + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,30 @@ +/* +* 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: +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../rom/mmmtpdataprovider.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mmmtpdataprovider.iby) + +PRJ_MMPFILES +#include "../install/group/bld.inf" +#include "../mmmtpdprequestprocessor/group/bld.inf" +#include "../mmmtpdpplugins/mediamtpdataprovider/group/bld.inf" +#include "../mmmtpdpplugins/abstractmediamtpdataprovider/group/bld.inf" + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpaccesssingleton.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpaccesssingleton.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,88 @@ +/* +* 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: Meta data Access Singleton +* +*/ + + +#ifndef CMMMTPDPACCESSSINGLETON_H +#define CMMMTPDPACCESSSINGLETON_H + +/** +* Implements the MM MTP Data Priovider access singletons reference manager. +*/ + +class RFs; +class CMmMtpDpMetadataAccessWrapper; +class MMTPDataProviderFramework; + +class CMmMtpDpAccessSingleton : public CObject + { +public: + /** + * Create Singleton instance + * need Release(), if no use + * @param aRFs RFs reference + * @param aFramework framework reference + */ + IMPORT_C static void CreateL( RFs& aRfs, + MMTPDataProviderFramework& aFramework ); + + /** + * release singleton instance + */ + IMPORT_C static void Release(); + + /** + * get metadata access wrapper reference + */ + IMPORT_C static CMmMtpDpMetadataAccessWrapper& GetAccessWrapperL(); + + /** + * do some special process with assess DBs when receives opensession command + */ + IMPORT_C static void OpenSessionL(); + + /** + * do some special process with assess DBs when receives closesession command + */ + IMPORT_C static void CloseSessionL(); + +private: + /* + * get singleton instance, for internal use + */ + static CMmMtpDpAccessSingleton* Instance(); + + /* + * 2-phase construction + */ + static CMmMtpDpAccessSingleton* NewL( RFs& aRfs, + MMTPDataProviderFramework& aFramework ); + + /* + * 2-phase construction + */ + void ConstructL( RFs& aRfs, + MMTPDataProviderFramework& aFramework ); + /* + * destruction + */ + ~CMmMtpDpAccessSingleton(); + +private: + CMmMtpDpMetadataAccessWrapper* iWrapper; + }; + +#endif // CMMMTPDPACCESSSINGLETON_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpmetadataaccesswrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpmetadataaccesswrapper.h Thu Dec 17 08:55:47 2009 +0200 @@ -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: Meta data Access Wrapper +* +*/ + + +#ifndef CMMMTPDPMETADATAACCESSWRAPPER_H +#define CMMMTPDPMETADATAACCESSWRAPPER_H + +#include +#include +#include +#include + +// forward declacration +class CMmMtpDpMetadataMpxAccess; +class CMmMtpDpMetadataVideoAccess; + +class RFs; +class MMTPType; +class CMTPTypeObjectPropList; +class CMPXMediaArray; +class CMPXMedia; +class MMTPDataProviderFramework; + +class CMmMtpDpMetadataAccessWrapper : public CBase + { +public: + static CMmMtpDpMetadataAccessWrapper* NewL( RFs& aRfs, + MMTPDataProviderFramework& aFramework ); + + /** + * Destructor + */ + ~CMmMtpDpMetadataAccessWrapper(); + +public: + /** + * Get all playlists from MPX database in the assigned store + * @param aStoreRoot, specify in which drive playlists are stored + * @param aPlaylists, return result array + */ + IMPORT_C void GetAllPlaylistL( const TDesC& aStoreRoot, + CMPXMediaArray** aPlaylists ); + + /** + * Get all references of specified playlist + * @param aPlaylist, specify of which reference should be get + * @param aReferences, return result array which stored handles of all references + */ + IMPORT_C void GetAllReferenceL( CMPXMedia* aPlaylist, + CDesCArray& aReferences ); + + /** + * Get an playlist name from CMPXMedia object + * @param aPlaylist, specify the source + * @param aPlaylistName, return result + */ + IMPORT_C void GetPlaylistNameL( CMPXMedia* aPlaylist, TDes& aPlaylistName ); + + /** + * Add object (music, video and playlist) info to DB + * @param aFullFileName, full file name of file + * @return void + */ + void AddObjectL( const TDesC& aFullFileName, TBool aIsVideo = EFalse ); + + /** + * Set playlist to DB + * @param aPlaylistFileName, full file name of playlist file + * @param aRefFileArray, a array to store the full file name of media files + * @return void + */ + IMPORT_C void SetPlaylistL( const TDesC& aPlaylistFileName, + CDesCArray& aRefFileArray ); + + /** + * Gets a piece of metadata from the collection + * @param aPropCode, specify property code of aMediaProp + * @param aNewData, object property value which will be get from + * aObjectMetaData + * @param aObjectMetaData, owner of the property which should be + * inserted or updated into database + * @return void + */ + IMPORT_C void GetObjectMetadataValueL( const TUint16 aPropCode, + MMTPType& aNewData, + const CMTPObjectMetaData& aObjectMetaData ); + + /** + * Sets a piece of metadata in the collection + * @param aPropCode, specify property code of aMediaProp + * @param aNewData, object property value which will be set into + * aObjectMetaData + * @param aObjectMetaData, owner of the property which should be + * inserted or updated into database + * @return void + */ + void SetObjectMetadataValueL( const TUint16 aPropCode, + const MMTPType& aNewData, + const CMTPObjectMetaData& aObjectMetaData ); + + /** + * Renames the file part of a record in the collection database + * @param aFile, old full file name of Media file + * @param aNewFileName, new file name need update + * @return void + */ + IMPORT_C void RenameObjectL( const TDesC& aOldFileName, const TDesC& aNewFileName ); + + /** + * Deletes metadata information associated with the object + * @param aFullFileName, full file name of Media file + * @param aFormatCode, format code + */ + void DeleteObjectL( const TDesC& aFullFileName, const TUint aFormatCode ); + + /** + * Set current drive info + * @param aStorageRoot, current drive info + */ + void SetStorageRootL( const TDesC& aStorageRoot ); + + /* + * set image specific properties specific to videos + * @param aFullFileName, the fullFileName of object + * @param aWidth, the width of an object in pixels to set + * @parem aHeight, the height of an object in pixels to set + */ + void SetImageObjPropL( const TDesC& aFullFileName, + const TUint32 aWidth, + const TUint32 aHeight ); + + /* + * get image specific properties specific to videos + * @param aFullFileName, the fullFileName of object + * @param aWidth, the width of an object in pixels to get + * @parem aHeight, the height of an object in pixels to get + */ + void GetImageObjPropL( const TDesC& aFullFileName, + TUint32& aWidth, + TUint32& aHeight ); + + /** + * Get Modified object from DB + * @param aStorageRoot, the root path of storage + * @param arrayCount, array count + * @param aRefFileArray, a array to store the full file name of media files + * @return void + */ + IMPORT_C void GetModifiedContentL( const TDesC& aStorageRoot, + TInt& arrayCount, + CDesCArray& aRefFileArray ); + + /** + * Updated Music DB + * @return void + */ + IMPORT_C void UpdateMusicCollectionL(); + + /* + * Called when the MTP session is initialised + */ + void OpenSessionL(); + + /* + * clean up db resource especially for video dp + */ + void CloseSessionL(); + + /** + * Cleanup database + */ + IMPORT_C void CleanupDatabaseL(); + + /** + * if the playlsit exist in the MPX DB + * @param aSuid, the suid of playlsit + */ + TBool IsExistL( const TDesC& aSuid ); + + // related to dummy files + /** + * Add one dummy file to dummy files array + */ + IMPORT_C void AddDummyFileL( const TDesC& aDummyFileName ); + + /** + * Delete one dummy file from dummy files array + */ + IMPORT_C void DeleteDummyFile( const TDesC& aDummyFileName ); + + /** + * Create a Dummy File from the virtual playlist URI + * @param aPlaylistName, specify the filename of the dummy file + */ + IMPORT_C void CreateDummyFile( const TDesC& aPlaylistName ); + +private: + + CMmMtpDpMetadataAccessWrapper( RFs& aRfs, MMTPDataProviderFramework& aFramework ); + + void ConstructL(); + + TMPXGeneralCategory Category( const TUint aFormatCode ); + + /** + * Remove all dummy file of which format is "pla", and leave the "m3u" + */ + void RemoveDummyFiles(); + +private: + // Data + RFs& iRfs; + CMmMtpDpMetadataMpxAccess* iMmMtpDpMetadataMpxAccess; + CMmMtpDpMetadataVideoAccess* iMmMtpDpMetadataVideoAccess; + TBool iOpenSession; + + MMTPDataProviderFramework& iFramework; + + CDesCArray* iPlaylistArray; + + }; + +#endif // CMMMTPDPMETADATAACCESSWRAPPER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpmetadatamdsaccess.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpmetadatamdsaccess.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,16 @@ +/* +* 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: Meta data Mds access +* +*/ diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpmetadatampxaccess.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpmetadatampxaccess.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,224 @@ +/* +* 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: Meta data Mpx access +* +*/ + + +#ifndef CMMMTPDPMETADATAMPXACCESS_H +#define CMMMTPDPMETADATAMPXACCESS_H + +#include + +#include "cmmmtpdpperflog.h" + +// keep here to avoid warning on urel +_LIT( KMpxCollectionNewL, "MpxCollectionNewL" ); +_LIT( KMpxCollectionAddL, "MpxCollectionAddL" ); +_LIT( KMpxCollectionGetL, "MpxCollectionGetL" ); +_LIT( KMpxCollectionSetL, "MpxCollectionSetL" ); +_LIT( KMpxCollectionGetPlaylist, "MpxCollectionGetPlaylist" ); +_LIT( KMpxCollectionGetReference, "MpxCollectionGetReference" ); +_LIT( KMpxCollectionFindAllLValidate, "MpxCollectionValidate" ); +_LIT( KMpxCollectionFindAllLBeforeAdd, "KMpxCollectionFindAllLBeforeAdd" ); + +// forward declacration +class CMPXMedia; +class CMTPObjectMetaData; +class MMPXCollectionHelper; +class MMTPDataProviderFramework; +class MMTPType; +class TMPXAttributeData; + +const TInt KStorageRootMaxLength = 10; + +typedef struct + { + TMTPObjectPropertyCode iPropCode; + TMPXAttributeData iMpxAttrib; + } TMetadataTable; + +/** +* Controls access to the music MPX store database. Allows access to the +* information about any of the music stored in any of the MPX db's on any +* of the drives. Also supports deletions and insertions into the db. +*/ +class CMmMtpDpMetadataMpxAccess : public CBase + { +public: + + static CMmMtpDpMetadataMpxAccess* NewL( RFs& aRfs, MMTPDataProviderFramework& aFramework ); + + /** + * Destructor + */ + ~CMmMtpDpMetadataMpxAccess(); + +public: + /** + * Get all playlists from MPX database in the assigned store + * @param aStoreRoot, specify in which drive playlists are stored + * @param aPlaylists, return result array + */ + void GetAllPlaylistL( const TDesC& aStoreRoot, CMPXMediaArray** aPlaylists ); + + /** + * Get all references of specified playlist + * @param aPlaylist, specify of which reference should be get + * @param aReferences, return result array which stored handles of all references + */ + void GetAllReferenceL( CMPXMedia* aPlaylist, CDesCArray& aReferences ); + + /** + * Get an playlist name from CMPXMedia object + * @param aPlaylist, specify the source + * @param aPlaylistName, return result + */ + void GetPlaylistNameL( CMPXMedia* aPlaylist, TDes& aPlaylistName ); + + /** + * Adds Songs info to Mpx DB + * @param aFullFileName, full file name of Media file + */ + void AddSongL( const TDesC& aFullFileName ); + + /** + * Adds Playlist to Mpx DB + * @param aFullFileName, full file name of Playlist file + */ + void AddPlaylistL( const TDesC& aFullFileName ); + + /** + * Set playlist to DB + * @param aPlaylistFileName, full file name of playlist file + * @param aRefFileArray, a array to store the full file name of media files + */ + void SetPlaylistL( const TDesC& aPlaylistFileName, + CDesCArray& aRefFileArray ); + + void GetObjectMetadataValueL( const TUint16 aPropCode, + MMTPType& aNewData, + const CMTPObjectMetaData& aObjectMetaData ); + + /** + * Set object property and updated object in DB according property code, + * only for update, not for creation + * @param aPropCode, property code of aObjectMetaData + * @param aNewData, object property value which will be set into + * aObjectMetaData + * @param aObjectMetaData, owner of the property which should be + * updated into database + */ + void SetObjectMetadataValueL( const TUint16 aPropCode, + const MMTPType& aNewData, + const CMTPObjectMetaData& aObjectMetaData ); + + /** + * Set object property and updated object in DB according property code, + * only for update, not for creation + * @param aPropCode, property code of aObjectMetaData + * @param aNewData, object property value which will be set into + * aObjectMetaData + * @param aSuid, full file name of object of which properties need to set + */ + void SetObjectMetadataValueL( const TUint16 aPropCode, + const MMTPType& aNewData, + const TDesC& aSuid ); + + CMPXMedia* FindWMPMediaLC( TMPXAttributeData aWMPMediaID, TBool aFlag ); + + /** + * Update the Sync flag for those not synchronized, Update the Modified + * flag for those have been modified, and delete the stale records for + * files that have been deleted. + */ + void UpdateMusicCollectionL(); + + /** + * Remove the file from MPX DB + * @param aFullFileName, the file to remove + * @param aCategory, the category of the file + */ + void DeleteObjectL( const TDesC& aFullFileName, TMPXGeneralCategory aCategory ); + + /** + * Rename the filename onto MPX DB + * @param aOldFileName, the old file to rename + * @param aNewFileName, the new file name + * @param aFormatCode, the format of object + */ + void RenameObjectL( const TDesC& aOldFileName, const TDesC& aNewFileName, + TUint aFormatCode ); + + /** + * Set current drive info + * @param aStorageRoot, current drive info + */ + void SetStorageRootL( const TDesC& aStorageRoot ); + + /** + * Get modified content + * @param arrayCount, count of modified content + * @param aModifiedcontent, modified files name list + */ + void GetModifiedContentL( TInt& arrayCount, CDesCArray& aModifiedcontent ); + + /** + * if the playlsit exist in the MPX DB + * @param aSuid, the suid of playlsit + */ + TBool IsExistL( const TDesC& aSuid ); + +private: + CMmMtpDpMetadataMpxAccess( RFs& aFs, MMTPDataProviderFramework& aFramework ); + + void ConstructL(); + + void SetDefaultL( CMPXMedia& aMediaProp ); + + /** + * Set property value into MPX object according to property code, + * only used by member functions of this class. + * @param aPropCode, specify property code of aMediaProp + * @param aNewData, object property value which will be set into + * aObjectMetaData + * @param aObjectMetaData, owner of the property which should be + * inserted or updated into database + */ + void SetMetadataValueL( const TUint16 aPropCode, + const MMTPType& aNewData, + CMPXMedia& aMediaProp ); + + TMPXAttributeData MpxAttribFromPropL( const CMPXMedia& aMedia, + const TUint16 aPropCode ); + + MMPXCollectionHelper* CollectionHelperL(); + +private: + // File server to allow file access + RFs& iRfs; + + TBuf iStoreRoot; + + MMPXCollectionHelper* iCollectionHelper; + + MMTPDataProviderFramework& iFramework; + +#if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) + CMmMtpDpPerfLog* iPerfLog; +#endif + + }; + +#endif // CMMMTPDPMETADATAMPXACCESS_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpmetadatavideoaccess.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpmetadatavideoaccess.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,195 @@ +/* +* 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: Meta data video access +* +*/ + + +#ifndef CMMMTPDPMETADATAVIDEOACCESS_H +#define CMMMTPDPMETADATAVIDEOACCESS_H + +#include +#include +#include // for CPermanentFileStore +#include + +/* +* Mapping property code to db column name +*/ +typedef struct + { + TMTPObjectPropertyCode iPropCode; + const TDesC& iDbColumnName; + } TColumnNameTable; + +class CMmMtpDpMetadataVideoAccess : public CBase + { +public: + static CMmMtpDpMetadataVideoAccess* NewL( RFs& aRfs ); + + /** + * Destructor + */ + ~CMmMtpDpMetadataVideoAccess(); + + /* + * Called when the MTP session is initialised + */ + void OpenSessionL(); + + /* + * Cleanup db and notify CFL + */ + void CloseSessionL(); + + /* + * Set root for db to manipulate relevant ".db" file + */ + void SetStorageRootL( const TDesC& aStorageRoot ); + + /** + * Adds Video info to Video DB + * @param aFullFileName, full file name of Media file + */ + void AddVideoL( const TDesC& aFullFileName ); + + /* + * Gets a piece of metadata from permanent store + * @aPropCode + * @aNewData, output param, store the value get from db + * @aObjectMetaData, source to get properties + */ + void GetObjectMetadataValueL( const TUint16 aPropCode, + MMTPType& aNewData, + const CMTPObjectMetaData& aObjectMetaData ); + + /** + * Set object property and updated object in DB according property code, + * only for update, not for creation + * @param aPropCode, property code of aObjectMetaData + * @param aNewData, object property value which will be set into + * aObjectMetaData + * @param aObjectMetaData, owner of the property which should be + * updated into database + */ + void SetObjectMetadataValueL( const TUint16 aPropCode, + const MMTPType& aNewData, + const CMTPObjectMetaData& aObjectMetaData ); + + /* + * Rename the record acording to full file name + * @aOldFileName, specify the object which need to be changed + * @aNewFileName, specify the new name which will be changed into + */ + void RenameRecordL( const TDesC& aOldFileName, const TDesC& aNewFileName ); + + /** + * Remove the file from DB + * @param aFullFileName, the file to remove + */ + void DeleteRecordL( const TDesC& aFullFileName ); + + /** + * Remove all records from DB + */ + void DeleteAllRecordsL(); // Removes all metadata from the database + + /** + * set image specific properties specific to videos + * @param aFullFileName, the fullFileName of object + * @param aWidth, the width of an object in pixels to set + * @parem aHeight, the height of an object in pixels to set + */ + void SetImageObjPropL( const TDesC& aFullFileName, + const TUint32 aWidth, + const TUint32 aHeight ); + + /** + * get image specific properties specific to videos + * @param aFullFileName, the fullFileName of object + * @param aWidth, the width of an object in pixels to get + * @parem aHeight, the height of an object in pixels to get + */ + void GetImageObjPropL( const TDesC& aFullFileName, + TUint32& aWidth, + TUint32& aHeight ); + + /** + * Cleanup Database + */ + void CleanupDatabaseL(); + +private: + + enum TMtpDbState + { + ENoRecord, + ERecordRead, + ERecordWrite, + EFailedWrite + }; + + CMmMtpDpMetadataVideoAccess( RFs& aRfs ); + void ConstructL(); + + TInt OpenDatabase(); + void OpenDatabaseL(); + void CreateDatabaseTablesL(); + void CompactDbIfNecessaryL(); + void CleanupDbIfNecessaryL(); + + void IdentifyDeletedFilesL(); + + HBufC* ReadLongTextL( const TDesC& aColumn); + void WriteLongTextL( const TDesC& aColumn, const TDesC& aValue); + + void ExecuteQueryL( const TDesC& aSelectThese, + const TDesC& aFromTable, + const TDesC& aColumnToMatch = KNullDesC, + const TDesC& aMatchCriteria = KNullDesC, + const TBool aIfNot = EFalse, + const TBool aNeedQuote = ETrue ); + + void SetRecordL( const TDesC& aFullFileName, TMtpDbState aState ); // Updates the iRecord to the selected file + void SetMetadataL( const TUint16 aPropCode, const MMTPType& aNewData ); + + inline TBool IsDatabaseOpened() + { + return iDbOpened; + } + + const TDesC& ColumnNameFromPropCodeL( const TUint16 aPropCode ); + + TBool FileExists( const TDesC& aFullFileName ); + +private: // Data + + RFs iRfs; + + CPermanentFileStore* iFileStore; + TMtpDbState iDbState; + TFileName iCurrentFileName; + + RDbs iDbsSession; + RDbView iRecordSet; + HBufC* iQueryText; + CDbColSet* iColSet; + RDbStoreDatabase iDatabase; + TBool iDbOpened; + TInt iRecordCount; // Used to compact the database every KMtpCompactInterval + TInt iStoreNum; + + }; + +#endif // CMMMTPDPMETADATAVIDEOACCESS_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpperflog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpperflog.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,87 @@ +/* +* 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 "mmmtpdp_variant.hrh" + +#ifndef CMMMTPDPPERFLOG_H +#define CMMMTPDPPERFLOG_H + +#if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) +#define PERFLOGSTART(AAA) iPerfLog->Start(AAA); +#define PERFLOGSTOP(AAA) iPerfLog->Stop(AAA); +#else +#define PERFLOGSTART(AAA) +#define PERFLOGSTOP(AAA) +#endif // defined(_DEBUG) || defined(MMMTPDP_PERFLOG) + +#if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) +#include +#include + +// forward declaration +class CMmMtpDpPerfLog; + +class TMmMtpDpOverflowHandler : public TDesOverflow + { + public: + + inline void SetOwner( CMmMtpDpPerfLog* aOwner ); + inline void Overflow( TDes& aDes ); + + private: + + CMmMtpDpPerfLog* iOwner; + }; + +class CMmMtpDpPerfLog : public CBase + { + public: + + inline static CMmMtpDpPerfLog* NewL( const TDesC& aTitle ); + inline ~CMmMtpDpPerfLog(); + + inline void Write( const TDesC& aText); + inline void WriteFormat( TRefByValue aFmt, ... ); + + inline void Start( const TDesC& aDescription ); + inline void Stop( const TDesC& aDescription ); + + private: + + inline CMmMtpDpPerfLog(); + inline void ConstructL( const TDesC& aTitle ); + + private: + + TMmMtpDpOverflowHandler iOverflowHandler; + + HBufC16* iTitle; + CDesC16ArrayFlat iDescription; + CArrayFixFlat iStartTick; + CArrayFixFlat iTotalTime; + CArrayFixFlat iTotalUsage; + + TInt iNTickPeriod; + TInt iLastIndex; + + }; + +#include "cmmmtpdpperflog.inl" + +#endif // defined(_DEBUG) || defined(MMMTPDP_PERFLOG) +#endif // CMMMTPDPPERFLOG_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpperflog.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpperflog.inl Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,230 @@ +/* +* 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: +* +*/ + + +#if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) +#include +#include + +const TInt KMtpLogBufferSize = 1000; + +CMmMtpDpPerfLog* CMmMtpDpPerfLog::NewL( const TDesC& aTitle ) + { + CMmMtpDpPerfLog* self = new( ELeave ) CMmMtpDpPerfLog(); + CleanupStack::PushL( self ); + self->ConstructL( aTitle ); + CleanupStack::Pop( self ); + + return self; + } + +void CMmMtpDpPerfLog::ConstructL( const TDesC& aTitle ) + { + iOverflowHandler.SetOwner( this ); + HAL::Get( HAL::ENanoTickPeriod, iNTickPeriod ); + + iTitle = HBufC16::NewL( aTitle.Length() ); + + TPtr title = iTitle->Des(); + + title.Copy( aTitle ); + } + +CMmMtpDpPerfLog::CMmMtpDpPerfLog() : iDescription( 2 ), + iStartTick( 2 ), + iTotalTime( 2 ), + iTotalUsage( 2 ), + iLastIndex( 0 ) + { + } + +CMmMtpDpPerfLog::~CMmMtpDpPerfLog() + { + iDescription.Reset(); + iStartTick.Reset(); + iTotalTime.Reset(); + iTotalUsage.Reset(); + delete iTitle; + } + +void CMmMtpDpPerfLog::Write( const TDesC& aText ) + { + RDebug::Print( aText ); + } + +void CMmMtpDpPerfLog::WriteFormat( TRefByValue aFmt, ... ) + { + VA_LIST list; + VA_START( list, aFmt ); + + TBuf buf; + + buf.AppendFormatList( aFmt, list, &iOverflowHandler ); + Write( buf ); + } + +void CMmMtpDpPerfLog::Start( const TDesC& aDescription ) + { + TInt index = 0; + TInt err = KErrNone; + + // check last remember index first, to minimize looping string search + if ( ( iLastIndex >= 0 ) && ( iLastIndex < iDescription.Count() ) ) + { + if ( iDescription[iLastIndex].Compare( aDescription ) == 0 ) + index = iLastIndex; + else + { + for ( index = 0; index < iDescription.Count(); index++ ) + { + if ( index == iLastIndex ) + continue; + else if ( iDescription[index].Compare( aDescription ) == 0 ) + break; + } + } + } + + if ( index == iDescription.Count() ) + { + TRAP( err, iDescription.AppendL( aDescription ) ); + + if ( err == KErrNone ) + TRAP( err, iStartTick.AppendL( 0 ) ); + + if ( err == KErrNone ) + TRAP( err, iTotalTime.AppendL( 0 )); + + if ( err == KErrNone ) + TRAP( err, iTotalUsage.AppendL( 0 ) ); + + if ( err == KErrNone ) + WriteFormat( _L( "CMmMtpDpPerfLog::Start, '%S' is created..." ), &aDescription ); + else + { + WriteFormat( _L( "CMmMtpDpPerfLog::Start, '%S' cannot be created!!!" ), &aDescription ); + return; + } + } + + iStartTick[index] = User::NTickCount(); + // remember for next time, in case being ::Stop is call immediately afterward + iLastIndex = index; + } + +void CMmMtpDpPerfLog::Stop( const TDesC& aDescription ) + { + TUint32 endtick = User::NTickCount(); + TInt index = 0; + + // check last remember index first, to minimize looping string search + if ( ( iLastIndex >= 0 ) && ( iLastIndex < iDescription.Count() ) ) + { + if ( iDescription[iLastIndex].Compare( aDescription ) == 0 ) + index = iLastIndex; + else + { + for ( index = 0; index < iDescription.Count(); index++ ) + { + if ( index == iLastIndex ) + continue; + else if ( iDescription[index].Compare( aDescription ) == 0 ) + break; + } + } + } + + if ( index == iDescription.Count() ) + { + WriteFormat( _L( "CMmMtpDpPerfLog::Stop, '%S' cannot be found!!!" ), &aDescription ); + return; + } + + TUint microsecTaken = ( endtick-iStartTick[index] ) * iNTickPeriod; + + iTotalTime[index] += microsecTaken; + iTotalUsage[index]++; + + TBuf<3> lastTimeDecimal; + TBuf<3> totalTimeDecimal; + TBuf<3> averageTimeDecimal; + + TUint32 lastTimeValue = microsecTaken / 1000; + TUint32 lastTimeDecimalValue = microsecTaken % 1000; + TUint64 totalTimeValue = iTotalTime[index] / 1000; + TUint32 totalTimeDecimalValue = iTotalTime[index] % 1000; + TUint32 averageTimeValue = iTotalTime[index] / iTotalUsage[index] / 1000; + TUint32 averageTimeDecimalValue = iTotalTime[index] / iTotalUsage[index] % 1000; + + if ( ( lastTimeDecimalValue < 100 ) && ( lastTimeDecimalValue > 0 ) ) + lastTimeDecimal.AppendNum( 0 ); + + lastTimeDecimal.AppendNum( lastTimeDecimalValue ); + + if ( ( totalTimeDecimalValue < 100 ) && ( totalTimeDecimalValue > 0 ) ) + totalTimeDecimal.AppendNum( 0 ); + + totalTimeDecimal.AppendNum( totalTimeDecimalValue ); + + if ( ( averageTimeDecimalValue < 100 ) && ( averageTimeDecimalValue > 0 ) ) + averageTimeDecimal.AppendNum( 0 ); + + averageTimeDecimal.AppendNum( averageTimeDecimalValue ); + + if (totalTimeValue <= 0xFFFFFFFF) + { + WriteFormat( _L( "%S-%S, usage = %u, last time = %u.%S ms, total time = %u.%S ms, average time = %u.%S ms" ), + iTitle, + &iDescription[index], + iTotalUsage[index], + lastTimeValue, + &lastTimeDecimal, + I64LOW(totalTimeValue), + &totalTimeDecimal, + averageTimeValue, + &averageTimeDecimal ); + } + else + { + WriteFormat( _L( "%S-%S, usage = %u, last time = %u.%S ms, total time = %u%u.%S ms, average time = %u.%S ms" ), + iTitle, + &iDescription[index], + iTotalUsage[index], + lastTimeValue, + &lastTimeDecimal, + I64HIGH(totalTimeValue), + I64LOW(totalTimeValue), + &totalTimeDecimal, + averageTimeValue, + &averageTimeDecimal ); + } + } + +// Maintain a references for writing... +void TMmMtpDpOverflowHandler::SetOwner( CMmMtpDpPerfLog* aOwner ) + { + iOwner = aOwner; + } + +void TMmMtpDpOverflowHandler::Overflow( TDes& aDes ) + { + iOwner->Write( _L( "Logging Overflow!" ) ); + iOwner->Write( aDes ); + } + +#endif // defined(_DEBUG) || defined(MMMTPDP_PERFLOG) + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/inc/mmmtpdp_variant.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/inc/mmmtpdp_variant.hrh Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,28 @@ +/* +* 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: centralize control of internal flags +* +*/ + + +#ifndef MMMTPDP_VARIANT_HRH +#define MMMTPDP_VARIANT_HRH + +// flag to enable performance log even in urel, should be default to off +#undef MMMTPDP_PERFLOG // check to make sure it's off + +// flag to enable replace the exist object +#undef MMMTPDP_REPLACE_EXIST_FILE + +#endif // MMMTPDP_VARIANT_HRH diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/inc/mmmtpdpconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/inc/mmmtpdpconfig.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,55 @@ +/* +* 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 MMMTPDPCONFIG_H +#define MMMTPDPCONFIG_H + +class CMmMtpDpMetadataAccessWrapper; + +class MMmMtpDpConfig + { +public: + /** + * Get supported format from special data provider + * @param aArray The array which is used to store supported format + */ + virtual const RArray* GetSupportedFormat() const = 0; + + /** + * + */ + virtual const RArray* GetSupportedPropertiesL( TUint32 aFormatCode ) const = 0; + + /** + * + */ + virtual const RArray* GetAllSupportedProperties() const = 0; + + /** + * Get default storage Id from resource file, if not specify a storage Id + * @return TUint32 Default storage Id which read from resource file + */ + virtual TUint32 GetDefaultStorageIdL() const = 0; + + /* + * + */ + virtual CMmMtpDpMetadataAccessWrapper& GetWrapperL() = 0; + }; + +#endif // MMMTPDPCONFIG_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/inc/mmmtpdpdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/inc/mmmtpdpdefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,48 @@ +/* +* 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: define properties +* +*/ + + +#ifndef MMMTPDPDEFS_H +#define MMMTPDPDEFS_H + +/** +* define all the object properties that are supported by the mm mtp data provider +*/ + +// Mandatory for all formats +static const TUint16 KMmMtpDpSupportedPropMandatoryAll[] = + { + EMTPObjectPropCodeStorageID, + EMTPObjectPropCodeObjectFormat, + EMTPObjectPropCodeProtectionStatus, + EMTPObjectPropCodeObjectSize, + EMTPObjectPropCodeObjectFileName, + EMTPObjectPropCodeParentObject, + EMTPObjectPropCodePersistentUniqueObjectIdentifier, + EMTPObjectPropCodeName, + EMTPObjectPropCodeNonConsumable, + }; + +// Additional for all foramts +static const TUint16 KMmMtpDpSupportedPropAdditionalAll[] = + { + EMTPObjectPropCodeDateAdded, + EMTPObjectPropCodeDateCreated, + EMTPObjectPropCodeDateModified, + }; + +#endif // MMMTPDPDEFS_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/inc/mmmtpdpfiledefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/inc/mmmtpdpfiledefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,99 @@ +/* +* 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: Definition for MTP File, helper for Mimetype and extension +* +*/ + + +#ifndef MMMTPDPFILEDEFS_H +#define MMMTPDPFILEDEFS_H + +// constants +const TInt KMimeTypeMaxLength = 76; // according to RFC 2045 spec + +_LIT( KTxtBackSlash, "\\" ); + +//-------------------------------------------------------------------------------------------- +// extention +//-------------------------------------------------------------------------------------------- + +_LIT( KTxtExtension3GP, ".3gp" ); +_LIT( KTxtExtensionAAC, ".aac" ); +_LIT( KTxtExtensionASF, ".asf" ); +_LIT( KTxtExtensionM4A, ".m4a" ); +_LIT( KTxtExtensionMP3, ".mp3" ); +_LIT( KTxtExtensionMP4, ".mp4" ); +_LIT( KTxtExtensionWAV, ".wav" ); +_LIT( KTxtExtensionWMA, ".wma" ); +_LIT( KTxtExtensionWMV, ".wmv" ); +_LIT( KTxtExtensionO4A, ".o4a" ); +_LIT( KTxtExtensionO4V, ".o4v" ); +_LIT( KTxtExtensionODF, ".odf" ); + +_LIT( KTxtExtensionM3U, ".m3u" ); +_LIT( KTxtExtensionPLA, ".pla" ); +_LIT( KTxtExtensionVIR, ".vir" ); // virtual playlist from MPX + +_LIT(KFormatExtensionMP3, "0x3009:mp3"); +_LIT(KFormatExtensionWMA, "0xb901:wma"); +_LIT(KFormatExtensionMP4, "0xb982:mp4"); +_LIT(KFormatExtension3GP, "0xb984:3gp"); +_LIT(KFormatExtensionAAC, "0xb903:aac"); +_LIT(KFormatExtensionWAV, "0x3008:wav"); +_LIT(KFormatExtensionWMV, "0xb981:wmv"); +_LIT(KFormatExtensionASF, "0x300c:asf"); + +//ODF container +_LIT(KFormatExtensionODFAudio3GPP, "0xB984:ODF:audio/3gpp"); +_LIT(KFormatExtensionODFAudioMP4, "0xB982:ODF:audio/mp4"); +_LIT(KFormatExtensionODFVideo3GPP, "0xB984:ODF:video/3gpp"); +_LIT(KFormatExtensionODFVideoMP4, "0xB982:ODF:video/mp4"); + +_LIT(KFormatExtensionM4A, "0xB982:m4a"); +_LIT(KFormatExtensionO4A, "0xB984:o4a"); +_LIT(KFormatExtensionO4V, "0xB984:o4v"); + +//Playlists +_LIT(KFormatExtensionM3U, "0xba11:m3u"); +_LIT(KFormatExtensionPLA, "0xBA05:pla"); +_LIT(KFormatExtensionVIR, "0xBA05:vir"); //abstract audio & video playlist 0xBA05 +//-------------------------------------------------------------------------------------------- +// end extention +//-------------------------------------------------------------------------------------------- + +// file standard definition like extension +_LIT8( KMimeTypeAudio3gpp, "audio/3gpp" ); +_LIT8( KMimeTypeVideo3gpp, "video/3gpp" ); +_LIT8( KMimeTypeAudioMp4, "audio/mp4" ); +_LIT8( KMimeTypeVideoMp4, "video/mp4" ); +_LIT8( KMimeTypeAudioWm, "audio/x-ms-wma" ); +_LIT8( KMimeTypeVideoWm, "video/x-ms-wmv" ); + +// generic DRM status +enum TMmMtpDrmStatus + { + EMTPDrmStatusNotProtected, + EMTPDrmStatusProtected, + EMTPDrmStatusUnknown + }; + +// generic audio vs video vs unknown +enum TMmMtpSubFormatCode + { + EMTPSubFormatCodeUnknown, + EMTPSubFormatCodeAudio, + EMTPSubFormatCodeVideo + }; + +#endif // MMMTPDPFILEDEFS_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/inc/mmmtpdplogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/inc/mmmtpdplogger.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,68 @@ +/* +* 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: Header Information for MTP Logger +* +*/ + + +#ifndef MMMTPDPLOGGER_H +#define MMMTPDPLOGGER_H + +#include + +// --------------------------------------------------------------------------- +#if !defined( PRINT3 ) + #ifdef _DEBUG + #define PRINT( txt ) RDebug::Print( txt ); + #define PRINT1( txt, arg1 ) RDebug::Print( txt, arg1 ); + #define PRINT2( txt, arg1, arg2 ) RDebug::Print( txt, arg1, arg2 ); + #define PRINT3( txt, arg1, arg2, arg3 ) RDebug::Print( txt, arg1, arg2, arg3 ); + #define PRINT4( txt, arg1, arg2, arg3, arg4 ) RDebug::Print( txt, arg1, arg2, arg3, arg4 ); + + // PRINT_FRQ macros are used for logging of frequently occurring events, + // for example draws done every time a viewfinder frame arrives. + // By default, logging these is disabled. + #undef LOG_FREQUENT + + #ifdef LOG_FREQUENT + #define PRINT_FRQ( txt ) RDebug::Print( txt ); + #define PRINT_FRQ1( txt, arg1 ) RDebug::Print( txt, arg1 ); + #define PRINT_FRQ2( txt, arg1, arg2 ) RDebug::Print( txt, arg1, arg2 ); + #define PRINT_FRQ3( txt, arg1, arg2, arg3 ) RDebug::Print( txt, arg1, arg2, arg3 ); + #define PRINT_FRQ4( txt, arg1, arg2, arg3, arg4 ) RDebug::Print( txt, arg1, arg2, arg3, arg4 ); + #else + #define PRINT_FRQ( txt ) + #define PRINT_FRQ1( txt, arg1 ) + #define PRINT_FRQ2( txt, arg1, arg2 ) + #define PRINT_FRQ3( txt, arg1, arg2, arg3 ) + #define PRINT_FRQ4( txt, arg1, arg2, arg3, arg4 ) + #endif // LOG_FREQUENT + + #else + #define PRINT( txt ) + #define PRINT1( txt, arg1 ) + #define PRINT2( txt, arg1, arg2 ) + #define PRINT3( txt, arg1, arg2, arg3 ) + #define PRINT4( txt, arg1, arg2, arg3, arg4 ) + + #define PRINT_FRQ( txt ) + #define PRINT_FRQ1( txt, arg1 ) + #define PRINT_FRQ2( txt, arg1, arg2 ) + #define PRINT_FRQ3( txt, arg1, arg2, arg3 ) + #define PRINT_FRQ4( txt, arg1, arg2, arg3, arg4 ) + + #endif +#endif +// --------------------------------------------------------------------------- +#endif // MMMTPDPLOGGER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/inc/mmmtpdputility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/inc/mmmtpdputility.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,159 @@ +/* +* 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: Definition for MTP Utility File +* +*/ + + +#ifndef MMMTPDPUTILITY_H +#define MMMTPDPUTILITY_H + +#include + +#include "mmmtpdpfiledefs.h" + +// forward declacration +class CMTPObjectMetaData; +class MMTPDataProviderFramework; + +class MmMtpDpUtility + { +public: + /** + * Utility function to get the type of an object from the filename + * @param aFullFileName, full path of file name + * @return TMTPFormatCode for the passed file name + */ + IMPORT_C static TMTPFormatCode FormatFromFilename( const TDesC& aFullFileName ); + + /** + * Utility function to decide if has metadata + * @param aObjFormatCode, object format code + * @return TBool for decide if has metadata + */ + static TBool HasMetadata( TUint16 aObjFormatCode ); + + /** + * Utility function to decide if the file is video. + * @param aFullFileName, the full file name + * @return TBool for decide if the file is video + */ + IMPORT_C static TBool IsVideoL( const TDesC& aFullFileName ); + + /** + * Utility function to decide if the file is video. + * For internal use, this is fast version by querying framework DB + * @param aFullFileName, the full file name + * @param aFramework, the mtp framework instance pointer, default is null + * @return TBool for decide if the file is video + */ + static TBool IsVideoL( const TDesC& aFullFileName, const MMTPDataProviderFramework& aFramework ); + + /** + * Check the filename length to see if it exceeds Symbian 256 limit. + * @param aPathName, the path name of the file + * @param aFileName, the file to be check + * @return TBool for decide if the file name validate + */ + static TBool ValidateFilename( const TDesC& aPathName, + const TDesC& aFileName ); + + /** + * Check the file size, if file doesn't exist, leave + * @param aFs, handle of file server session + * @param aFileName, fine name + * @return TUint64 size for specified file + */ + static TUint64 GetObjectSizeL( RFs& aFs, const TDesC& aFileName ); + + /** + * Get file date modified info + * @param aFs , handle of file server session + * @param aFullFileName, fine name + * @return TTime for specified file + */ + static TTime GetObjectDateModifiedL( RFs& aFs, const TDesC& aFullFileName ); + + /** + * Check if file is read-only, if file doesn't exist, leave + * @param aFs , handle of file server session + * @param aFullFileName, the file to be check + */ + static TUint16 GetProtectionStatusL( RFs& aFs, const TDesC& aFullFileName ); + + /** + * Check if prop type and data type match + * @param aPropertyCode, the proptery code + * @param aDataType, the data type + * @param TMTPResponseCode, decide if match + */ + static TMTPResponseCode CheckPropType( TUint16 aPropertyCode, + TUint16 aDataType ); + + /** + * Update object file name + * @param aFs + * @param aPathName, the path name of the file + * @param aFullFileName, the file to be check + */ + static TInt UpdateObjectFileName( RFs& aFs, + const TDesC& aFullFileName, + TDes& aNewName ); + + /** + * Get the mime type of file, support mp4/3gp now + * @param aFullPath, full path of file + * @return mime type string, if return NULL, no mime or failed + */ + static HBufC8* ContainerMimeType( const TDesC& aFullPath ); + + /** + * Get the Mime from Mp4 file + * @param aFullFileName, full path of file + * @return mime type string, if return NULL, no mime or failed + */ + static HBufC8* Mp4MimeTypeL( const TDesC& aFullFileName ); + + /** + * Get the Mime from Odf file + * @param aFullFileName, full path of file + * @return mime type string, if return NULL, no mime or failed + */ + static HBufC8* OdfMimeTypeL( const TDesC& aFullFileName ); + + /** + * Get the Mime from Asf file + * @param aFullFileName, full path of file + * @return mime type string, if return NULL, no mime or failed + */ + static HBufC8* AsfMimeTypeL( const TDesC& aFullFileName ); + + /** + * get the sub format code by mime + * @param aMimeType, mime type + * @param aSubFormatCode, output the sub format code + * @return if success, return KErrNone, otherwise, error code + */ + static TInt SubFormatCodeFromMime( const TDesC8& aMimeType, TMmMtpSubFormatCode& aSubFormatCode ); + + /** + * Get DRM status + * @param aFullFileName, full file name + * @return return DRM status code + */ + IMPORT_C static TInt GetDrmStatus( const TDesC& aFullFileName ); + + }; + +#endif // MMMTPDPUTILITY_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/inc/mmmtpenumerationcallback.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/inc/mmmtpenumerationcallback.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,40 @@ +/* +* 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 MMMTPENUMERATIONCALLBACK_H +#define MMMTPENUMERATIONCALLBACK_H + +#include + +/** +* Defines the enumeration complete notification interface. +*/ +class MMTPEnumerationCallback + { +public: + + /** + * Notifies that enumeration of the specified storage is completed. + * @param aStorageId The MTP StorageID of the enumerated storage. + * @param aError The enumeration completion error status. + */ + virtual void NotifyEnumerationCompleteL( TUint32 aStorageId, TInt aError ) = 0; + + }; + +#endif // MMMTPENUMERATIONCALLBACK_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/inc/mmmtpvideodbdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/inc/mmmtpvideodbdefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,104 @@ +/* +* 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 MMMTPVIDEODEFS_H +#define MMMTPVIDEODEFS_H + +// INCLUDES +#include + +// CONSTANTS +_LIT( KMtpVideoTable, "Video" ); + +// field +_LIT( KMtpVideoLocation, "Location" ); +_LIT( KMtpVideoName, "Name" ); +_LIT( KMtpVideoArtist, "Artist" ); +_LIT( KMtpVideoTrack, "Track" ); +_LIT( KMtpVideoGenre, "Genre" ); +_LIT( KMtpVideoAlbumName, "AlbumName" ); +_LIT( KMtpVideoComposer, "Composer" ); +_LIT( KMtpVideoOrigReleaseDate, "OrigReleaseDate" ); +_LIT( KMtpVideoComment, "Comment" ); + +_LIT( KMtpVideoWidth, "Width" ); +_LIT( KMtpVideoHeight, "Height" ); +_LIT( KMtpVideoDuration, "Duration" ); + +_LIT( KMtpVideoSampleRate, "SampleRate" ); +_LIT( KMtpVideoNumberOfChannels, "NumberOfChannels" ); +_LIT( KMtpVideoAudioCodec, "AudioCodec" ); +_LIT( KMtpVideoAudioBitrate, "AudioBitrate" ); + +_LIT( KMtpVideoVideoCodec, "VideoCodec" ); +_LIT( KMtpVideoVideoBitrate, "VideoBitrate" ); +_LIT( KMtpVideoFramesPer1000Sec, "FramesPer1000Sec" ); +_LIT( KMtpVideoKeyFrameDistance, "KeyFrameDistance" ); +_LIT( KMtpVideoScanType, "ScanType" ); +_LIT( KMtpVideoEncodingProfile, "EncodingProfile" ); + +_LIT( KMtpVideoParentalRating, "ParentalRating" ); +_LIT( KMtpVideoUseCount , "UseCount" ); +_LIT( KMtpVideoDRM, "DRM" ); + +_LIT( KMtpVideoDeleted, "Deleted" ); + +// field type +_LIT( KMtpVideoLocationType, " CHAR (255) NOT NULL" ); +_LIT( KMtpVideoNameType, " LONG VARCHAR" ); +_LIT( KMtpVideoArtistType, " LONG VARCHAR" ); +_LIT( KMtpVideoTrackType, " UNSIGNED SMALLINT" ); +_LIT( KMtpVideoGenreType, " LONG VARCHAR" ); +_LIT( KMtpVideoAlbumNameType, " LONG VARCHAR" ); +_LIT( KMtpVideoComposerType, " LONG VARCHAR" ); +_LIT( KMtpVideoOrigReleaseDateType, " LONG VARCHAR" ); +_LIT( KMtpVideoCommentType, " LONG VARCHAR" ); + +_LIT( KMtpVideoWidthType, " UNSIGNED INTEGER" ); +_LIT( KMtpVideoHeightType, " UNSIGNED INTEGER" ); +_LIT( KMtpVideoDurationType, " UNSIGNED INTEGER" ); + +_LIT( KMtpVideoSampleRateType, " UNSIGNED INTEGER" ); +_LIT( KMtpVideoNumberOfChannelsType, " UNSIGNED SMALLINT" ); +_LIT( KMtpVideoAudioCodecType, " UNSIGNED INTEGER" ); +_LIT( KMtpVideoAudioBitrateType, " UNSIGNED INTEGER" ); + +_LIT( KMtpVideoVideoCodecType, " UNSIGNED INTEGER" ); +_LIT( KMtpVideoVideoBitrateType, " UNSIGNED INTEGER" ); +_LIT( KMtpVideoFramesPer1000SecType, " UNSIGNED INTEGER" ); +_LIT( KMtpVideoKeyFrameDistanceType, " UNSIGNED INTEGER" ); +_LIT( KMtpVideoScanTypeType, " UNSIGNED SMALLINT" ); +_LIT( KMtpVideoEncodingProfileType, " LONG VARCHAR" ); + +_LIT( KMtpVideoParentalRatingType, " LONG VARCHAR" ); +_LIT( KMtpVideoUseCountType, " UNSIGNED INTEGER" ); +_LIT( KMtpVideoDRMType, " UNSIGNED SMALLINT" ); + +_LIT( KMtpVideoDeletedType, " BIT" ); + +// operation +_LIT( KMtpVideoStartCreateTable, "CREATE TABLE " ); +_LIT( KMtpVideoCommaSign, "," ); +_LIT( KMtpVideoSingleQuote, "'" ); +_LIT( KMtpVideoOpenBracket, "(" ); +_LIT( KMtpVideoCloseBracket, ")" ); + +// Db file +_LIT( KMtpVideoDb, "MtpVideoDb.db" ); + +#endif // MMMTPVIDEODEFS_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/inc/tmmmtpdppanic.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/inc/tmmmtpdppanic.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,48 @@ +/* +* 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: MmMtpDataProvider +* +*/ + + +#ifndef TMMMTPDPPANIC_H +#define TMMMTPDPPANIC_H + +#include + +/** +* define the MM data provider panic code +*/ +enum TMmMTPDpPanic + { + EMmMTPDpNoMatchingProcessor = 0, + EMmMTPDpObjectNull = 1, + EMmMTPDpFormatNotSupported = 2, + EMmMTPDpSendObjectStateInvalid = 3, + EMmMTPDpReferencesNull = 4, + EMmMTPDpRequestCheckNull = 5, + EMmMTPDpHandlesNull = 6, + EMmMTPDpUnsupportedProperty = 7, + EMmMTPDpObjectPropertyNull = 8, + EMmMTPDpCannotRenameDir = 9, + }; + +_LIT( KMmMTPDpPanic, "MM MTP Data Provider" ); + +inline void Panic( TMmMTPDpPanic aCode ) + { + User::Panic( KMmMTPDpPanic, aCode ); + } + +#endif // TMMMTPDPPANIC_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/inc/tobjectdescription.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/inc/tobjectdescription.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,98 @@ +/* +* 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 TOBJECTDESCRIPTION_H +#define TOBJECTDESCRIPTION_H + +#include + +// vendor extended property code +const TUint16 EMTPExtObjectPropCodeOmaDrmStatus = 0xDB01; + +struct TObjectDescription + { + TUint16 iPropCode; + TUint32 iGroupCode; + }; + +enum TGroupCodeType + { + EGroupCodeGeneral = 0x00000001, + EGroupCodeMediaDB = 0x00FF0000, + EGroupCodeNotDefined = 0xFFFFFFFF // TODO: need to reconsider + }; + +static const TGroupCodeType KSupportedGroupCode[] = + { + EGroupCodeGeneral, + EGroupCodeMediaDB + }; + +static const TObjectDescription KPropGroupMapTable[] = + { + // First group, mandatory for all + { EMTPObjectPropCodeStorageID, EGroupCodeGeneral }, + { EMTPObjectPropCodeObjectFormat, EGroupCodeGeneral }, + { EMTPObjectPropCodeProtectionStatus, EGroupCodeGeneral }, + { EMTPObjectPropCodeObjectSize, EGroupCodeGeneral }, + { EMTPObjectPropCodeObjectFileName, EGroupCodeGeneral }, + { EMTPObjectPropCodeParentObject, EGroupCodeGeneral }, + { EMTPObjectPropCodePersistentUniqueObjectIdentifier, + EGroupCodeGeneral }, + { EMTPObjectPropCodeNonConsumable, EGroupCodeGeneral }, + + // First group, addtional for all + { EMTPObjectPropCodeDateCreated, EGroupCodeGeneral }, + { EMTPObjectPropCodeDateModified, EGroupCodeGeneral }, + + // Second group, additional for all + { EMTPObjectPropCodeName, EGroupCodeMediaDB }, + { EMTPObjectPropCodeDateAdded, EGroupCodeMediaDB }, + + // Second group, mandatory for audio + { EMTPObjectPropCodeArtist, EGroupCodeMediaDB }, + { EMTPObjectPropCodeTrack, EGroupCodeMediaDB }, + { EMTPObjectPropCodeGenre, EGroupCodeMediaDB }, + { EMTPObjectPropCodeAlbumName, EGroupCodeMediaDB }, + { EMTPObjectPropCodeSampleRate, EGroupCodeMediaDB }, + { EMTPObjectPropCodeNumberOfChannels, EGroupCodeMediaDB }, + { EMTPObjectPropCodeAudioWAVECodec, EGroupCodeMediaDB }, + { EMTPObjectPropCodeAudioBitRate, EGroupCodeMediaDB }, + { EMTPObjectPropCodeDuration, EGroupCodeMediaDB }, + { EMTPObjectPropCodeOriginalReleaseDate, EGroupCodeMediaDB }, + { EMTPObjectPropCodeDescription, EGroupCodeMediaDB }, + { EMTPObjectPropCodeComposer, EGroupCodeMediaDB }, + + // Second group, mandatory for video + { EMTPObjectPropCodeWidth, EGroupCodeMediaDB }, + { EMTPObjectPropCodeHeight, EGroupCodeMediaDB }, + { EMTPObjectPropCodeUseCount, EGroupCodeMediaDB }, + { EMTPObjectPropCodeScanType, EGroupCodeMediaDB }, + { EMTPObjectPropCodeVideoFourCCCodec, EGroupCodeMediaDB }, + { EMTPObjectPropCodeVideoBitRate, EGroupCodeMediaDB }, + { EMTPObjectPropCodeFramesPerThousandSeconds, EGroupCodeMediaDB }, + { EMTPObjectPropCodeKeyFrameDistance, EGroupCodeMediaDB }, + { EMTPObjectPropCodeEncodingProfile, EGroupCodeMediaDB }, + + // Second group, additional for video + { EMTPObjectPropCodeParentalRating, EGroupCodeMediaDB }, + { EMTPObjectPropCodeDRMStatus, EGroupCodeMediaDB }, + { EMTPExtObjectPropCodeOmaDrmStatus, EGroupCodeMediaDB } + }; + +#endif // TOBJECTDESCRIPTION_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/install/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/install/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,23 @@ +/* +* 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: Build information file for project MTP Install Stub +* +*/ + + +PRJ_PLATFORMS +ARMV5 + +PRJ_EXPORTS +../rom/mmmtpdpstub.sis /epoc32/data/z/system/install/mmmtpdpstub.sis \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/install/rom/makestub.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/install/rom/makestub.bat Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,18 @@ +@rem +@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +@rem All rights reserved. +@rem This component and the accompanying materials are made available +@rem under the terms of "Eclipse Public License v1.0" +@rem which accompanies this distribution, and is available +@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +@rem +@rem Initial Contributors: +@rem Nokia Corporation - initial contribution. +@rem +@rem Contributors: +@rem +@rem Description: +@rem + +makesis.exe -s mmmtpdpstub.pkg + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/install/rom/makeupgradesis.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/install/rom/makeupgradesis.bat Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,21 @@ +@rem +@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +@rem All rights reserved. +@rem This component and the accompanying materials are made available +@rem under the terms of "Eclipse Public License v1.0" +@rem which accompanies this distribution, and is available +@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +@rem +@rem Initial Contributors: +@rem Nokia Corporation - initial contribution. +@rem +@rem Contributors: +@rem +@rem Description: +@rem + +@ECHO OFF + +makesis.exe -v mmmtpdpupdate.pkg mmmtpdpupdate.sis +signsis mmmtpdpupdate.sis mmmtpdpupdate.sisx ..\..\internal\install\rd.cer ..\..\internal\install\rd-key.pem +del mmmtpdpupdate.sis diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/install/rom/makeupgradesisdebug.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/install/rom/makeupgradesisdebug.bat Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,21 @@ +@rem +@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +@rem All rights reserved. +@rem This component and the accompanying materials are made available +@rem under the terms of "Eclipse Public License v1.0" +@rem which accompanies this distribution, and is available +@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +@rem +@rem Initial Contributors: +@rem Nokia Corporation - initial contribution. +@rem +@rem Contributors: +@rem +@rem Description: +@rem + +@ECHO OFF + +makesis.exe -v mmmtpdpupdatedebug.pkg mmmtpdpupdatedebug.sis +signsis mmmtpdpupdatedebug.sis mmmtpdpupdatedebug.sisx ..\..\internal\install\rd.cer ..\..\internal\install\rd-key.pem +del mmmtpdpupdatedebug.sis diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/install/rom/mmmtpdpstub.pkg Binary file mmappcomponents/mmmtpdataprovider/install/rom/mmmtpdpstub.pkg has changed diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/install/rom/mmmtpdpstub.sis Binary file mmappcomponents/mmmtpdataprovider/install/rom/mmmtpdpstub.sis has changed diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/install/rom/mmmtpdpupdate.pkg Binary file mmappcomponents/mmmtpdataprovider/install/rom/mmmtpdpupdate.pkg has changed diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/install/rom/mmmtpdpupdatedebug.pkg Binary file mmappcomponents/mmmtpdataprovider/install/rom/mmmtpdpupdatedebug.pkg has changed diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/data/abstractmediamtpdataprovider.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/data/abstractmediamtpdataprovider.rss Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,42 @@ +/* +* 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: ECOM registration information for AbstractMediaDp +* +*/ + + +#include + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x10207C52; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x102827AD; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x10207C53; // implemention ID + version_no = 1; + display_name = "MTP Abstract Media Data Provider plug-in."; + default_data = "Abstract Media"; + opaque_data = "folderConfig"; + } + }; + } + }; + } diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/data/abstractmediamtpdataprovider_config.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/data/abstractmediamtpdataprovider_config.rss Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,40 @@ +/* +* 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: DP configuration information for abstract media dp on armv5 platform +* +*/ + + +#include +#include "abstractmediamtpdataprovider_config.rh" + +RESOURCE MTP_DATA_PROVIDER dpConfig + { + type = KMTPDataProviderTypeECOM; + major_version = 1; + object_enumeration_persistent = 0; + supported_modes = KMTPModeMTP; + server_name = ""; + server_image_name = ""; + opaque_resource = "folderConfig"; + enumeration_phase = 12; + } + +RESOURCE ABSTRACTMEDIAMTPDATAPROVIDER_CONFIG folderConfig + { + abstractmedia_drive = 4; + } + + + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/group/abstractmediamtpdataprovider.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/group/abstractmediamtpdataprovider.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,88 @@ +/* +* 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: Project definition file for project AbstractMediaMtpDataProvider +* +*/ + + +#include +#include +#include "../../../inc/mmmtpdp_variant.hrh" + +// mtpdp plugin target name +TARGET abstractmediamtpdataprovider.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x10207C52 +VENDORID 0x70000001 + +CAPABILITY CAP_ECOM_PLUGIN + +MW_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc +USERINCLUDE ../../../mmmtpdprequestprocessor/inc +USERINCLUDE ../../../inc + +SOURCEPATH ../src + +SOURCE cabstractmediamtpdataprovider.cpp +SOURCE abstractmediamtpdataprovidercontrollerimp.cpp +SOURCE abstractmediamtpdataproviderprocessor.cpp +SOURCE cabstractmediamtpdataproviderenumerator.cpp +SOURCE cabstractmediamtpdataprovidergetobjectpropdesc.cpp +SOURCE cabstractmediamtpdataprovidergetinterdependentpropdesc.cpp +SOURCE cabstractmediamtpdataprovidergetobjectpropvalue.cpp +SOURCE cabstractmediamtpdataprovidergetobjectproplist.cpp +SOURCE cabstractmediamtpdataprovidersetobjectpropvalue.cpp +SOURCE cabstractmediamtpdataprovidersetobjectproplist.cpp +SOURCE cabstractmediamtpdataprovidersetobjectreferences.cpp +SOURCE cabstractmediamtpdataproviderabstractmediapreference.cpp +SOURCE cabstractmediamtpdataprovidercopyobject.cpp +SOURCE cabstractmediamtpdataprovidermoveobject.cpp +SOURCE cabstractmediamtpdataproviderrenameobject.cpp +SOURCE cabstractmediamtpdataprovidersendobject.cpp +SOURCE cabstractmediamtpdataprovidergetformatcapabilities.cpp + + +SOURCEPATH ../data +START RESOURCE abstractmediamtpdataprovider.rss + TARGET abstractmediamtpdataprovider.rsc +END + +// Data provider configuration resource file. +// The target filename corresponds to the implementation UID. +START RESOURCE abstractmediamtpdataprovider_config.rss +TARGETPATH /resource/mtp +TARGET 10207C53.rsc +END + +// Data provider configuration resource file. +// The target filename corresponds to the implementation UID. + +LIBRARY euser.lib +LIBRARY efsrv.lib // TEntry, TEntryArray +LIBRARY bafl.lib // RResourceFile +LIBRARY PlatformEnv.lib +LIBRARY mtpdataproviderapi.lib // CMTPDataProviderPlugin +LIBRARY mtpdatatypes.lib +LIBRARY mmmtpdprequestprocessor.lib +LIBRARY mpxcommon.lib +LIBRARY mpxcollectionhelper.lib + +// for nanotick perf measurement +#if defined(MMMTPDP_PERFLOG) +LIBRARY hal.lib +#else +DEBUGLIBRARY hal.lib +#endif diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,23 @@ +/* +* 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: Build information file for project AbstractMediaMtpDataProvider +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_MMPFILES +abstractmediamtpdataprovider.mmp diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/abstractmediamtpdataprovider_config.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/abstractmediamtpdataprovider_config.rh Thu Dec 17 08:55:47 2009 +0200 @@ -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: Resource headers for project abstractmediadp +* +*/ + + +#ifndef ABSTRACTMEDIAMTPDATAPROVIDER_RH +#define ABSTRACTMEDIAMTPDATAPROVIDER_RH + +// -------------------------------------------------------------------- +// Defines the resource type for abstractmedia dp specific configuration data +// -------------------------------------------------------------------- +// +STRUCT ABSTRACTMEDIAMTPDATAPROVIDER_CONFIG + { + LONG abstractmedia_drive; // Symbian drive number @see TDrive + LTEXT abstractmedia_folder_root; + LTEXT folder_exclusion_list[]; // What to exclude + } + +#endif // ABSTRACTMEDIAMTPDATAPROVIDER_RH diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/abstractmediamtpdataproviderconst.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/abstractmediamtpdataproviderconst.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,93 @@ +/* +* 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 ABSTRACTMEDIAMTPDATAPROVIDERCONST_H +#define ABSTRACTMEDIAMTPDATAPROVIDERCONST_H + +#include + +const TUint16 EMTPExtOpCodeAbstractMediaPreference = 0x9203; + +/** +* define all the operations that are supported by the abstractmedia data provider +*/ +static const TUint16 KAbstractMediaMtpDataProviderSupportedFormats[] = + { + EMTPFormatCodeM3UPlaylist, + EMTPFormatCodeAbstractAudioVideoPlaylist + }; + +/** +* define all the operations that are supported by the abstract media data provider +*/ +static const TUint16 KAbstractMediaMtpDataProviderSupportedOperations[] = + { + // Required + EMTPOpCodeGetObjectInfo, + EMTPOpCodeGetObject, + EMTPOpCodeGetPartialObject, + EMTPOpCodeDeleteObject, + EMTPOpCodeSendObjectInfo, + EMTPOpCodeSendObject, + EMTPOpCodeGetObjectPropsSupported, + EMTPOpCodeGetObjectPropDesc, + EMTPOpCodeGetObjectPropValue, + EMTPOpCodeSetObjectPropValue, + EMTPOpCodeGetObjectReferences, + EMTPOpCodeSetObjectReferences, + + // Recommended + EMTPOpCodeGetObjectPropList, + EMTPOpCodeSetObjectPropList, + EMTPOpCodeGetInterdependentPropDesc, + + EMTPExtOpCodeAbstractMediaPreference, // 0x9203 + + EMTPOpCodeCopyObject, + EMTPOpCodeMoveObject, + + EMTPOpCodeSendObjectPropList, + EMTPOpCodeGetFormatCapabilities + }; + +#if 0 +/** +* define all the object properties that are supported by the abstract media data provider +*/ +static const TUint16 KAbstractMediaMtpDataProviderSupportedProperties[] = + { + // Mandatory for all objects + EMTPObjectPropCodeStorageID, + EMTPObjectPropCodeObjectFormat, + EMTPObjectPropCodeProtectionStatus, + EMTPObjectPropCodeObjectSize, + EMTPObjectPropCodeObjectFileName, + EMTPObjectPropCodeParentObject, + EMTPObjectPropCodePersistentUniqueObjectIdentifier, + EMTPObjectPropCodeName, + EMTPObjectPropCodeNonConsumable, + + // additional for all + EMTPObjectPropCodeDateAdded, + EMTPObjectPropCodeDateCreated, + EMTPObjectPropCodeDateModified, + }; +#endif + + +#endif // ABSTRACTMEDIAMTPDATAPROVIDERCONST_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/abstractmediamtpdataproviderprocessor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/abstractmediamtpdataproviderprocessor.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,58 @@ +/* +* 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 ABSTRACTMEDIAMTPDATAPROVIDERPROCESSOR_H +#define ABSTRACTMEDIAMTPDATAPROVIDERPROCESSOR_H + +// class forward +class MMTPConnection; +class TMTPTypeRequest; +class MMTPDataProviderFramework; +class MMmRequestProcessor; +class MMmMtpDpConfig; + +typedef MMmRequestProcessor* ( *TAbstractMediaMtpDataProviderRequestProcessorCreateFunc )( + MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + +typedef struct + { + TUint16 iOperationCode; + TAbstractMediaMtpDataProviderRequestProcessorCreateFunc iCreateFunc; + } TAbstractMediaMtpDataProviderRequestProcessorEntry; + +class AbstractMediaMtpDataProviderProcessor + { +public: + /** + * Create a request processor that matches the request + * @param aFramework The reference to the data provider framework + * @param aRequest The request to be processed + * @param aConnection The connection from which the request comes from + * @param aMetadataWrapper medadata access interface + * @return a pointer to the request processor + */ + static MMmRequestProcessor* CreateL( MMTPDataProviderFramework& aFramework, + const TMTPTypeRequest& aRequest, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + }; + +#endif // ABSTRACTMEDIAMTPDATAPROVIDERPROCESSOR_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataprovider.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,188 @@ +/* +* 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: Abstract media data provider plug in +* +*/ + + +#ifndef CABSTRACTMEDIAMTPDATAPROVIDER_H +#define CABSTRACTMEDIAMTPDATAPROVIDER_H + +#include + +#include "abstractmediamtpdataproviderprocessor.h" +#include "mmmtpenumerationcallback.h" +#include "mmmtpdpconfig.h" + + +// Forward declaration +class MMmRequestProcessor; +class CAbstractMediaMtpDataProviderEnumerator; +class CMTPObjectMetaData; +class CAbstractMediaMtpDataProviderRenameObject; + +/** +* Defines abstract media data provider plugin +*/ +class CAbstractMediaMtpDataProvider : public CMTPDataProviderPlugin, + public MMTPEnumerationCallback, + public MMmMtpDpConfig + { +public: + /** + * Two Phase Construction + * @param aParams pointer to MMTPDataProviderFramework + */ + static TAny* NewL( TAny* aParams ); + + /** + * Destructor. + */ + ~CAbstractMediaMtpDataProvider(); + +public: + // from MMmMtpDpConfig + const RArray* GetSupportedFormat() const; + + const RArray* GetSupportedPropertiesL( TUint32 aFormatCode ) const; + + const RArray* GetAllSupportedProperties() const; + + /** + * Get default storage Id from resource file, if not specify a storage Id + * @return TUint32 Default storage Id which read from resource file + */ + TUint32 GetDefaultStorageIdL() const; + + /** + * @return the reference of CMmMtpDpMetadataAccessWrapper to enumerator + */ + CMmMtpDpMetadataAccessWrapper& GetWrapperL(); + +protected: + // from CMTPDataProviderPlugin + void Cancel(); + + void ProcessEventL( const TMTPTypeEvent& aEvent, + MMTPConnection& aConnection ); + + void ProcessNotificationL( TMTPNotification aNotification, + const TAny* aParams ); + + /** + * Process the request from initiator + * @param aPhase The request transaction phase + * @param aRequest The request to be processed + * @param aConnection The connection from which the request comes + */ + void ProcessRequestPhaseL( TMTPTransactionPhase aPhase, + const TMTPTypeRequest& aRequest, + MMTPConnection& aConnection ); + + /** + * Notify the data provider that the session has been open + */ + void SessionOpenedL( const TMTPNotificationParamsSessionChange& aSession ); + + /** + * Notify the data provider that the session has been closed + * @param aConnection The connection of the sesssion + */ + void SessionClosedL( const TMTPNotificationParamsSessionChange& aSession ); + + /** + * Notify the data provider that the object has been changed + * @param aObject the changed object + */ + void RenameObjectL( const TMTPNotificationParamsHandle& aObject ); + + void StartObjectEnumerationL( TUint32 aStorageId ); + + void StartStorageEnumerationL(); + + /** + * Defines the supported operations and formats of the data provider + * @param aCategory Defines what MTP is quering the DP about + * @param aArray Supported() edits array to append supported features + */ + void Supported( TMTPSupportCategory aCategory, RArray& aArray ) const; + + void SupportedL( TMTPSupportCategory aCategory, CDesCArray& aStrings ) const; + + TAny* GetExtendedInterface( TUid aInterfaceUid ); + +protected: + // From MMTPEnumerationCallback + /** + * enumeration completed + */ + void NotifyEnumerationCompleteL( TUint32 aStorageId, TInt aError ); + +private: + /** + * Standard C++ constructor + * @param aParams pointer to MMTPDataProviderFramework + */ + CAbstractMediaMtpDataProvider( TAny* aParams ); + + /** + * Second-phase construction + */ + void ConstructL(); + + /** + * Find or create a request processor that can process the request + * @param aRequest The request to be processed + * @param aConnection The connection from which the request comes + * @return the index of the found/created request processor + */ + TInt LocateRequestProcessorL( const TMTPTypeRequest& aRequest, + MMTPConnection& aConnection ); + + /** + * Find or create a request processor that can process the event + * @param aEvent The event to be processed + * @param aConnection The connection from which the request comes + * @return the index of the found/created request processor + */ + TInt LocateRequestProcessorL( const TMTPTypeEvent& aEvent, + MMTPConnection& aConnection ); + + /** + * helper function + */ + void InsertL( RArray& aArray, const TUint aProperCode ) const; + + void GetSupportedFormatL(); + + void GetSupportedPropertiesL(); + +private: + // data + RPointerArray iActiveProcessors; + CAbstractMediaMtpDataProviderEnumerator* iAbstractMediaEnumerator; + RArray iPendingEnumerations; + + TInt iActiveProcessor; + + CAbstractMediaMtpDataProviderRenameObject *iRenameObject; + TBool iIsSessionOpen; + + RArray iSupportedFormat; + + RArray iSupportedProperties; + + }; + +#endif // CABSTRACTMEDIAMTPDATAPROVIDER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataproviderabstractmediapreference.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataproviderabstractmediapreference.h Thu Dec 17 08:55:47 2009 +0200 @@ -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: +* +*/ + + +#ifndef CABSTRACTMEDIAMTPDATAPROVIDERABSTRACTMEDIAPREFERENCE_H +#define CABSTRACTMEDIAMTPDATAPROVIDERABSTRACTMEDIAPREFERENCE_H + +// INCLUDES +#include "crequestprocessor.h" + +// CLASS DECLARATION +class MMmMtpDpConfig; + +enum TMTPAbstractMediaReference + { + EMTPAbstractMediaRefOrdinary, + EMTPAbstractMediaRefAll + }; + +/** +* Defines abstract media data provider WMPReportSyncOnlyPlaylists request processor +*/ +class CAbstractMediaMtpDataProviderAbstractMediaPreference : public CRequestProcessor + { +public: + /** + * Two-phase construction method + */ + static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Two-phase construction method + */ + static CAbstractMediaMtpDataProviderAbstractMediaPreference* NewLC( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection ); + + /** + * Destructor. + */ + ~CAbstractMediaMtpDataProviderAbstractMediaPreference(); + +protected: + // from CRequestProcessor + void ServiceL(); + +private: + /** + * Standard c++ constructor + */ + CAbstractMediaMtpDataProviderAbstractMediaPreference( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection ); + + /** + * EPOC default constructor for performing 2nd stage construction + */ + void ConstructL(); + + }; + +#endif // CABSTRACTMEDIAMTPDATAPROVIDERABSTRACTMEDIAPREFERENCE_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataprovidercopyobject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataprovidercopyobject.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,74 @@ +/* +* 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 CABSTRACTMEDIAMTPDATAPROVIDERCOPYOBJECT_H +#define CABSTRACTMEDIAMTPDATAPROVIDERCOPYOBJECT_H + +#include "ccopyobject.h" + +/** +* Defines abstract media data provider CopyObject request processor +*/ +class CAbstractMediaMtpDataProviderCopyObject: public CCopyObject + { +public: + /** + * Two-phase construction method + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper Medadata access + * @return a pointer to the created request processor object + */ + static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + ~CAbstractMediaMtpDataProviderCopyObject(); + +private: + /** + * Standard c++ constructor + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper Medadata access + */ + CAbstractMediaMtpDataProviderCopyObject( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * two-phase construction + */ + void ConstructL(); + +protected: + // from CCopyObject + void ServiceGetSpecificObjectPropertyL( TUint16 aPropCode, + TUint32 aHandle, + const CMTPObjectMetaData& aObject ); + + TMTPResponseCode ServiceSetSpecificObjectPropertyL( TUint16 aPropCode, + const CMTPObjectMetaData& aObject, + const CMTPTypeObjectPropListElement& aElement ); + + }; + +#endif // CABSTRACTMEDIAMTPDATAPROVIDERCOPYOBJECT_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataproviderenumerator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataproviderenumerator.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,153 @@ +/* +* 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: Enumerator objects +* +*/ + + +#ifndef CABSTRACTMEDIAMTPDATAPROVIDERENUMERATOR_H +#define CABSTRACTMEDIAMTPDATAPROVIDERENUMERATOR_H + +#include +#include + +#include "mmmtpenumerationcallback.h" +#include "cmmmtpdpperflog.h" + +// keep here to avoid warning on urel +_LIT( KMpxGetAllPlaylist, "MpxGetAllPlaylist" ); +_LIT( KMpxGetPlaylistName, "MpxGetPlaylistName" ); +_LIT( KMpxQueryPlaylistReference, "MpxQueryPlaylistReference" ); +_LIT( KObjectManagerObjectUid, "ObjectManagerObjectUid" ); +_LIT( KObjectManagerInsert, "ObjectManagerInsert" ); +_LIT( KObjectManagerHandle, "ObjectManagerHandle" ); +_LIT( KReferenceManagerSetReference, "ReferenceManagerSetReference" ); + +// Forward declarations +class MMTPDataProviderFramework; +class MMTPObjectMgr; +class CAbstractMediaMtpDataProvider; +class CMTPObjectMetaData; +class CMmMtpDpMetadataAccessWrapper; +class CMPXMediaArray; + +/** +* Defines file enumerator. Enumerates all files/directories under a +* specified path or storage +*/ +class CAbstractMediaMtpDataProviderEnumerator: public CActive + { +public: + /** + * Two phase constructor + * @param aFramework Reference to MMTPDataProviderFramework + * @param aDataProvider Reference to Abstract Media DataProvider + * @return A pointer to a new instance of the object + */ + static CAbstractMediaMtpDataProviderEnumerator* NewL( MMTPDataProviderFramework& aFramework, + CAbstractMediaMtpDataProvider& aDataProvider ); + + /** + * destructor + */ + ~CAbstractMediaMtpDataProviderEnumerator(); + + /** + * Kick off the enumeration on the specified storage + * @param aStorageId storage to be enumerated + */ + void StartL( TUint32 aStorageId ); + +protected: // from CActive + /** + * Cancel the enumeration process + */ + void DoCancel(); + + void RunL(); + + /** + * Ignore the error, continue with the next one + */ + TInt RunError( TInt aError ); + +private: + /** + * Standard C++ Constructor + * @param aFramework Reference to MMTPDataProviderFramework + * @param aDataProvider Reference to Abstract Media DataProvider + */ + CAbstractMediaMtpDataProviderEnumerator( MMTPDataProviderFramework& aFramework, + CAbstractMediaMtpDataProvider& aDataProvider ); + + void ConstructL(); + + /** + * Called when the enumeration is completed + */ + void SignalCompleteL( MMTPEnumerationCallback& aCallback, + TInt aError = KErrNone ); + + void ScanStorageL( TUint32 aStorageId ); + + /** + * Scan next storage + */ + void ScanNextL(); + + /** + * Add a file entry to the object store + * @param aPath current scanned file path + */ + void AddEntryL( const TDesC& aSuid ); + + /** + * Add references of specified abstract media into reference db + * @param aAbstractMediaName, specify the abstract media of which references should be added into db + * @param aReferences, suid array which stored references + */ + void AddReferencesL( const TDesC& aAbstractMediaName, CDesCArray& aReferences ); + +private: + // Owned + /** MMTPDataProviderFramework used to access MTP components*/ + MMTPDataProviderFramework& iFramework; + + /** MTP Object Manager */ + MMTPObjectMgr& iObjectMgr; + + /** MTP Data Provider ID */ + TUint iDataProviderId; + + /** Provides Callback mechanism for completion of enumeration*/ + CAbstractMediaMtpDataProvider& iDataProvider; + + TParse iPath; + TEntryArray iEntries; + TInt iFirstUnprocessed; + RArray iStorages; + TUint32 iStorageId; + TUint32 iParentHandle; + + CMPXMediaArray* iAbstractMedias; + TInt iCount; + TInt iCurrentIndex; + +#if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) + CMmMtpDpPerfLog* iPerfLog; +#endif + + }; + +#endif // CABSTRACTMEDIAMTPDATAPROVIDERENUMERATOR_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataprovidergetformatcapabilities.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataprovidergetformatcapabilities.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,98 @@ +/* +* 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 CABSTRACTMEDIAMTPDATAPROVIDERGETFORMATCAPABILITIES_H +#define CABSTRACTMEDIAMTPDATAPROVIDERGETFORMATCAPABILITIES_H + +#include "cgetformatcapabilities.h" + +// forward declaration +class MMmMtpDpConfig; +class CMTPTypeObjectPropDesc; +class CMTPTypeInterdependentPropDesc; +class CMTPTypeObjectPropDesc; +class CMTPTypeString; +class CGetFormatCapabilities; + +/** +* Defines abstract media data provider GetFormatCapabilities +*/ +class CAbstractMediaMtpDataProviderGetFormatCapabilities : public CGetFormatCapabilities + { +public: + + /** + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aWrapper Medadata access + * @return A pointer to the created request processor object + */ + static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + +/* * + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aWrapper Medadata access + * @return A pointer to the created request processor object + + static MMmRequestProcessor* NewLC( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig );*/ + + /** + * Destructor + */ + ~CAbstractMediaMtpDataProviderGetFormatCapabilities(); + +protected: + // from CGetFormatCapabilities, override from baseclass + + /** + * Service specific object property + * @param aPropCode, The prop code + * @return MTPType object propdesc + */ + CMTPTypeObjectPropDesc* ServiceSpecificPropertyDescL( TUint16 aPropCode ); + + /** + * Service interdepent propdesc + * @param aFormatCode, The format code + * @return MTPTypeInterdependentPropDesc + */ + void ServiceInterdepentPropDescL(); + +private: + + /** + * Standard C++ Constructor + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aWrapper Medadata access + */ + CAbstractMediaMtpDataProviderGetFormatCapabilities( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * two-phase construction + */ + void ConstructL(); + }; + +#endif // CAbstractMediaMTPDATAPROVIDERGETFORMATCAPABILITIES_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataprovidergetinterdependentpropdesc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataprovidergetinterdependentpropdesc.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,83 @@ +/* +* 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 CABSTRACTMEDIAMTPDATAPROVIDERGETINTERDEPENTENTPROPDESC_H +#define CABSTRACTMEDIAMTPDATAPROVIDERGETINTERDEPENTENTPROPDESC_H + +#include "crequestprocessor.h" + +class CMTPTypeInterdependentPropDesc; +class MMmMtpDpConfig; + +/** +* Defines abstract media data provider GetInterdependentPropDesc request processor +*/ +class CAbstractMediaMtpDataProviderGetInterdependentPropDesc: public CRequestProcessor + { +public: + /** + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aWrapper Medadata access + * @return A pointer to the created request processor object + */ + static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + ~CAbstractMediaMtpDataProviderGetInterdependentPropDesc(); + +private: + /** + * Standard C++ Constructor + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + */ + CAbstractMediaMtpDataProviderGetInterdependentPropDesc( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection ); + + /** + * two-phase construction + */ + void ConstructL(); + +protected: + // from CRequestProcessor + TMTPResponseCode CheckRequestL(); + + void ServiceL(); + +private: + void ServiceAudioWaveCodecL(); + + void ServiceAudioBitrateL(); + + void SetFormForResponseL( TUint16 aPropertyCode, const MMTPType& aForm ); + +private: + /** Dataset to store the prop descriptions*/ + CMTPTypeInterdependentPropDesc* iDataset; + + TUint32 iFormatCode; + + }; + +#endif // CABSTRACTMEDIAMTPDATAPROVIDERGETINTERDEPENTENTPROPDESC_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataprovidergetobjectpropdesc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataprovidergetobjectpropdesc.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,68 @@ +/* +* 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 CABSTRACTMEDIAMTPDATAPROVIDERGETOBJECTPROPDESC_H +#define CABSTRACTMEDIAMTPDATAPROVIDERGETOBJECTPROPDESC_H + +#include "cgetobjectpropdesc.h" + +/** +* Defines abstract media data provider GetObjectPropDesc request processor +*/ +class CAbstractMediaMtpDataProviderGetObjectPropDesc: public CGetObjectPropDesc + { +public: + + /** + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aWrapper Medadata access + * @return A pointer to the created request processor object + */ + static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + ~CAbstractMediaMtpDataProviderGetObjectPropDesc(); + +private: + /** + * Standard C++ Constructor + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aWrapper Medadata access + */ + CAbstractMediaMtpDataProviderGetObjectPropDesc( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * second-phase construction + */ + void ConstructL(); + +protected: + // from CGetObjectPropDesc + void ServiceSpecificObjectPropertyL( TUint16 aPropCode ); + + }; + +#endif // CABSTRACTMEDIAMTPDATAPROVIDERGETOBJECTPROPDESC_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataprovidergetobjectproplist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataprovidergetobjectproplist.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,70 @@ +/* +* 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 CABSTRACTMEDIAMTPDATAPROVIDERGETOBJECTPROPLIST_H +#define CABSTRACTMEDIAMTPDATAPROVIDERGETOBJECTPROPLIST_H + +#include "cgetobjectproplist.h" + +class MMmMtpDpConfig; + +/** +* Defines abstract media data provider GetObjectPropList request processor +*/ +class CAbstractMediaMtpDataProviderGetObjectPropList : public CGetObjectPropList + { +public: + /** + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aWrapper Medadata access + * @return A pointer to the created request processor object + */ + static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + ~CAbstractMediaMtpDataProviderGetObjectPropList(); + +private: + /** + * Standard C++ Constructor + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aWrapper Medadata access + */ + CAbstractMediaMtpDataProviderGetObjectPropList( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * 2nd Phase Constructor + */ + void ConstructL(); + +protected: + // from CGetObjectPropList + TInt ServiceSpecificObjectPropertyL( TUint16 aPropCode, TUint32 aHandle ); + + }; + +#endif // CABSTRACTMEDIAMTPDATAPROVIDERGETOBJECTPROPLIST_H + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataprovidergetobjectpropvalue.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataprovidergetobjectpropvalue.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,70 @@ +/* +* 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 CABSTRACTMEDIAMTPDATAPROVIDERGETOBJECTPROPVALUE_H +#define CABSTRACTMEDIAMTPDATAPROVIDERGETOBJECTPROPVALUE_H + +#include "cgetobjectpropvalue.h" + +class MMmMtpDpConfig; + +/** +* Defines abstract media data provider GetObjectPropValue request processor +*/ +class CAbstractMediaMtpDataProviderGetObjectPropValue: public CGetObjectPropValue + { +public: + /** + * Two-phase construction method + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper Medadata access + * @return a pointer to the created request processor object + */ + static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + ~CAbstractMediaMtpDataProviderGetObjectPropValue(); + +private: + /** + * Standard c++ constructor + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper Medadata access + */ + CAbstractMediaMtpDataProviderGetObjectPropValue( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * two-phase construction + */ + void ConstructL(); + +protected: + // from CGetObjectPropValue + void ServiceSpecificObjectPropertyL(TUint16 aPropCode); + + }; + +#endif // CABSTRACTMEDIAMTPDATAPROVIDERGETOBJECTPROPVALUE_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataprovidermoveobject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataprovidermoveobject.h Thu Dec 17 08:55:47 2009 +0200 @@ -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: +* +*/ + + +#ifndef CABSTRACTMEDIAMTPDATAPROVIDERMOVEOBJECT_H +#define CABSTRACTMEDIAMTPDATAPROVIDERMOVEOBJECT_H + +#include "cmoveobject.h" + +class MMmMtpDpConfig; + +/** +* Defines abstract media data provider MoveObject request processor +*/ +class CAbstractMediaMtpDataProviderMoveObject: public CMoveObject + { +public: + /** + * Two-phase construction method + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper Medadata access + * @return a pointer to the created request processor object + */ + static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + ~CAbstractMediaMtpDataProviderMoveObject(); + +private: + /** + * Standard c++ constructor + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper Medadata access + */ + CAbstractMediaMtpDataProviderMoveObject( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * two-phase construction + */ + void ConstructL(); + +protected: + + void ServiceGetSpecificObjectPropertyL( TUint16 aPropCode, + TUint32 aHandle, + const CMTPObjectMetaData& aObject ); + + TMTPResponseCode ServiceSetSpecificObjectPropertyL( TUint16 aPropCode, + const CMTPObjectMetaData& aObject, + const CMTPTypeObjectPropListElement& aElement ); + + }; + +#endif // CABSTRACTMEDIAMTPDATAPROVIDERMOVEOBJECT_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataproviderrenameobject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataproviderrenameobject.h Thu Dec 17 08:55:47 2009 +0200 @@ -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: Rename objects +* +*/ + + +#ifndef CABSTRACTMEDIAMTPDATAPROVIDERRENAMEOBJECT_H +#define CABSTRACTMEDIAMTPDATAPROVIDERRENAMEOBJECT_H + +#include "crenameobject.h" + +class CAbstractMediaMtpDataProviderRenameObject: public CRenameObject + { +public: + /** + * Two phase constructor + * @param aFramework Reference to MMTPDataProviderFramework + * @param aWrapper Reference to CMmMtpDpMetadataAccessWrapper + * @param aDummyArray Reference to abstract media dummy files array + * @return A pointer to a new instance of the object + */ + static CAbstractMediaMtpDataProviderRenameObject* NewL( MMTPDataProviderFramework& aFramework, + CMmMtpDpMetadataAccessWrapper& aWrapper ); + + /** + * destructor + */ + ~CAbstractMediaMtpDataProviderRenameObject(); + +protected: + // from CRenameObject + void PerformAdditionalActionL(); + +private: + /** + * Standard C++ Constructor + * @param aFramework Reference to MMTPDataProviderFramework + * @param aWrapper Reference to CMmMtpDpMetadataAccessWrapper + * @param aDummyArray Reference to abstract media dummy files array + */ + CAbstractMediaMtpDataProviderRenameObject( MMTPDataProviderFramework& aFramework, + CMmMtpDpMetadataAccessWrapper& aWrapper ); + + void ConstructL(); + + }; + +#endif // CABSTRACTMEDIAMTPDATAPROVIDERRENAMEOBJECT_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataprovidersendobject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataprovidersendobject.h Thu Dec 17 08:55:47 2009 +0200 @@ -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: * +*/ + +#ifndef CABSTRACTMEDIAMTPDATAPROVIDERSENDOBJECT_H_ +#define CABSTRACTMEDIAMTPDATAPROVIDERSENDOBJECT_H_ + +#include "csendobject.h" + +/** +* Defines media data provider SetObjectPropsList request processor +*/ +class CAbstractMediaMtpDataProviderSendObject: public CSendObject + { +public: + /** + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aWrapper Medadata access + * @return A pointer to the created request processor object + */ + static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + ~CAbstractMediaMtpDataProviderSendObject(); + +private: + /** + * Standard C++ Constructor + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aWrapper Medadata access + */ + CAbstractMediaMtpDataProviderSendObject( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * 2nd Phase Constructor + */ + void ConstructL(); + +protected: + // from CSendObjectInfo + TMTPResponseCode SetSpecificObjectPropertyL( TUint16 aPropCode, + const CMTPObjectMetaData& aObject, + const CMTPTypeObjectPropListElement& aElement ); + + TMTPResponseCode CheckSepecificPropType( TUint16 aPropCode, TUint16 aDataType ); + + TInt HandleSpecificWrapperError(TInt aError, + const CMTPObjectMetaData& aObject); + + }; + +#endif /*CABSTRACTMEDIAMTPDATAPROVIDERSENDOBJECT_H_*/ diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataprovidersetobjectproplist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataprovidersetobjectproplist.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,75 @@ +/* +* 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 CABSTRACTMEDIAMTPDATAPROVIDERSETOBJECTPROPLIST_H +#define CABSTRACTMEDIAMTPDATAPROVIDERSETOBJECTPROPLIST_H + +#include "csetobjectproplist.h" + +class MMmMtpDpConfig; + +/** +* Defines abstract media data provider SetObjectPropList request processor +*/ +class CAbstractMediaMtpDataProviderSetObjectPropList : public CSetObjectPropList + { +public: + /** + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aWrapper Medadata access + * @return A pointer to the created request processor object + */ + static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + ~CAbstractMediaMtpDataProviderSetObjectPropList(); + +private: + /** + * Standard C++ Constructor + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aWrapper Medadata access + */ + CAbstractMediaMtpDataProviderSetObjectPropList( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * 2nd Phase Constructor + */ + void ConstructL(); + +protected: + // from CSetObjectPropList + TMTPResponseCode ServiceSpecificObjectPropertyL( TUint16 aPropCode, + const CMTPObjectMetaData& aObject, + const CMTPTypeObjectPropListElement& aElement ); + + TInt HandleSpecificWrapperError( TInt aError, + const CMTPObjectMetaData& aObject); + + }; + +#endif // CABSTRACTMEDIAMTPDATAPROVIDERSETOBJECTPROPLIST_H + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataprovidersetobjectpropvalue.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataprovidersetobjectpropvalue.h Thu Dec 17 08:55:47 2009 +0200 @@ -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: +* +*/ + + +#ifndef CABSTRACTMEDIAMTPDATAPROVIDERSETOBJECTPROPVALUE_H +#define CABSTRACTMEDIAMTPDATAPROVIDERSETOBJECTPROPVALUE_H + +#include "csetobjectpropvalue.h" + +/** +* Defines abstract media data provider SetObjectPropValue request processor +*/ +class CAbstractMediaMtpDataProviderSetObjectPropValue: public CSetObjectPropValue + { +public: + /** + * Two-phase construction method + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper Medadata access + * @return a pointer to the created request processor object + */ + static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + ~CAbstractMediaMtpDataProviderSetObjectPropValue(); + +private: + /** + * Standard c++ constructor + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper Medadata access + */ + CAbstractMediaMtpDataProviderSetObjectPropValue( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * two-phase construction + */ + void ConstructL(); + +protected: + // from CSetObjectPropValue + TBool IsSpecificPropCodeReadOnly( TUint16 aPropCode ) const; + + void ReceiveDataSpecificObjectPropertyL( TUint16 aPropCode ); + + TMTPResponseCode ServiceSpecificObjectPropertyL( TUint16 aPropCode ); + + }; + +#endif // CABSTRACTMEDIAMTPDATAPROVIDERSETOBJECTPROPVALUE_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataprovidersetobjectreferences.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataprovidersetobjectreferences.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,78 @@ +/* +* 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: Set object references operation. +* +*/ + + +#ifndef CABSTRACTMEDIAMTPDATAPROVIDERSETOBJECTREFERENCES_H +#define CABSTRACTMEDIAMTPDATAPROVIDERSETOBJECTREFERENCES_H + +#include "csetobjectreferences.h" + +/** +* Defines abstract media data provider SetObjectReferences request processor +*/ +class CAbstractMediaMtpDataProviderSetObjectReferences : public CSetObjectReferences + { +public: + /** + * Two-phase construction method + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper medadata access interface + * @return a pointer to the created request processor object + */ + static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + ~CAbstractMediaMtpDataProviderSetObjectReferences(); + +private: + /** + * Standard c++ constructor + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper medadata access interface + */ + CAbstractMediaMtpDataProviderSetObjectReferences( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * two-phase construction + */ + void ConstructL(); + +protected: + // from CSetObjectPropValue + /** + * set references to DB + * @param aWrapper medadata access interface + * @param aObjectFormat the format of the file + * @param aSrcFileName file name, from + * @param aRefFileArray the array of file names, to + */ + void DoSetObjectReferencesL( CMmMtpDpMetadataAccessWrapper& aWrapper, + TUint16 aObjectFormat, + const TDesC& aSrcFileName, + CDesCArray& aRefFileArray ); + + }; + +#endif // CABSTRACTMEDIAMTPDATAPROVIDERSETOBJECTREFERENCES_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/abstractmediamtpdataprovidercontrollerimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/abstractmediamtpdataprovidercontrollerimp.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,43 @@ +/* +* 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 + +#include "cabstractmediamtpdataprovider.h" + +// ----------------------------------------------------------------------------- +// Define the interface UIDs +// ----------------------------------------------------------------------------- +// +static const TImplementationProxy ImplementationTable[] = + { + {{0x10207C53}, (TProxyNewLPtr) ( CAbstractMediaMtpDataProvider::NewL )} + }; + +// ----------------------------------------------------------------------------- +// ECOM entry point +// ----------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/abstractmediamtpdataproviderprocessor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/abstractmediamtpdataproviderprocessor.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,114 @@ +/* +* 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: AbstractMedia Dp processor handle +* +*/ + + +#include + +//Include the standard request processor headers +#include "crequestunknown.h" + +#include "abstractmediamtpdataproviderprocessor.h" + +// Include the required header for carrying out the specified request +#include "mmmtpdplogger.h" + +#include "abstractmediamtpdataproviderconst.h" +#include "cgetobjectpropssupported.h" +#include "cabstractmediamtpdataprovidergetobjectpropdesc.h" +#include "cabstractmediamtpdataprovidergetinterdependentpropdesc.h" +#include "cgetobject.h" +#include "cgetobjectinfo.h" +#include "cabstractmediamtpdataprovidersendobject.h" +#include "cabstractmediamtpdataprovidergetobjectpropvalue.h" +#include "cabstractmediamtpdataprovidergetobjectproplist.h" +#include "cabstractmediamtpdataprovidersetobjectpropvalue.h" +#include "cabstractmediamtpdataprovidersetobjectproplist.h" +#include "cgetobjectreferences.h" +#include "cabstractmediamtpdataprovidersetobjectreferences.h" +#include "cdeleteobject.h" +#include "cabstractmediamtpdataprovidercopyobject.h" +#include "cabstractmediamtpdataprovidermoveobject.h" +#include "cgetpartialobject.h" +#include "cabstractmediamtpdataproviderabstractmediapreference.h" +#include "cabstractmediamtpdataprovidergetformatcapabilities.h" + + +/** A mapping table from the operation code to the request processor factory method */ +const TAbstractMediaMtpDataProviderRequestProcessorEntry KAbstractMediaMtpDataProviderRequestProcessorTable[] = + { + {EMTPOpCodeGetObjectPropsSupported, CGetObjectPropsSupported::NewL}, //Get Supported Props + {EMTPOpCodeGetObjectPropDesc, CAbstractMediaMtpDataProviderGetObjectPropDesc::NewL}, //Get Props Description + {EMTPOpCodeGetInterdependentPropDesc, CAbstractMediaMtpDataProviderGetInterdependentPropDesc::NewL}, + {EMTPOpCodeGetObjectInfo, CGetObjectInfo::NewL}, //GetObjectInfo + {EMTPOpCodeGetObject, CGetObject::NewL}, //GetObject + {EMTPOpCodeGetObjectPropValue, CAbstractMediaMtpDataProviderGetObjectPropValue::NewL}, + {EMTPOpCodeGetObjectPropList, CAbstractMediaMtpDataProviderGetObjectPropList::NewL}, //GetObjectPropList + {EMTPOpCodeSendObjectInfo, CAbstractMediaMtpDataProviderSendObject::NewL}, //SendObjectInfo (routed to SendObject) + {EMTPOpCodeSendObject, CAbstractMediaMtpDataProviderSendObject::NewL}, //SendObject + {EMTPOpCodeSendObjectPropList, CAbstractMediaMtpDataProviderSendObject::NewL}, // SendobjectPropList (routed to SendObject) + {EMTPOpCodeSetObjectPropValue, CAbstractMediaMtpDataProviderSetObjectPropValue::NewL}, + {EMTPOpCodeSetObjectPropList, CAbstractMediaMtpDataProviderSetObjectPropList::NewL}, //SetObjectPropList + {EMTPOpCodeGetObjectReferences, CGetObjectReferences::NewL}, //Get Object References + {EMTPOpCodeSetObjectReferences, CAbstractMediaMtpDataProviderSetObjectReferences::NewL}, //Set Object References + {EMTPOpCodeDeleteObject, CDeleteObject::NewL}, //DeleteObject + {EMTPOpCodeCopyObject, CAbstractMediaMtpDataProviderCopyObject::NewL}, // Copy Object + {EMTPOpCodeMoveObject, CAbstractMediaMtpDataProviderMoveObject::NewL}, // Move Object + {EMTPOpCodeGetPartialObject, CGetPartialObject::NewL}, //GetPartialObject + {EMTPExtOpCodeAbstractMediaPreference, CAbstractMediaMtpDataProviderAbstractMediaPreference::NewL}, // WMPReportSyncOnlyAbstractMedias + {EMTPOpCodeGetFormatCapabilities, CAbstractMediaMtpDataProviderGetFormatCapabilities::NewL} // GetFormatCapabilities + + }; + +// ----------------------------------------------------------------------------- +// AbstractMediaMtpDataProviderProcessor::CreateL +// Create a request processor that matches the request +// ----------------------------------------------------------------------------- +// +MMmRequestProcessor* AbstractMediaMtpDataProviderProcessor::CreateL( MMTPDataProviderFramework& aFramework, + const TMTPTypeRequest& aRequest, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + PRINT( _L( "MM MTP => AbstractMediaMtpDataProviderProcessor::CreateL" ) ); + + TAbstractMediaMtpDataProviderRequestProcessorCreateFunc createFunc = NULL; + TUint16 operationCode = aRequest.Uint16( + TMTPTypeRequest::ERequestOperationCode ); + + TInt count = sizeof( KAbstractMediaMtpDataProviderRequestProcessorTable ) + / sizeof( TAbstractMediaMtpDataProviderRequestProcessorEntry ); + + for ( TInt i = 0; i < count; i++ ) + { + if ( KAbstractMediaMtpDataProviderRequestProcessorTable[i].iOperationCode == operationCode ) + { + createFunc = KAbstractMediaMtpDataProviderRequestProcessorTable[i].iCreateFunc; + break; + } + } + + if ( !createFunc ) + { + return CRequestUnknown::NewL( aFramework, aConnection ); + } + + PRINT( _L( "MM MTP <= AbstractMediaMtpDataProviderProcessor::CreateL" ) ); + + return ( *createFunc )( aFramework, aConnection, aDpConfig ); + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovider.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,579 @@ +/* +* 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: AbstractMedia data provider +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cabstractmediamtpdataprovider.h" +#include "crequestprocessor.h" +#include "abstractmediamtpdataproviderconst.h" +#include "tmmmtpdppanic.h" +#include "cabstractmediamtpdataproviderenumerator.h" +#include "mmmtpdplogger.h" +#include "cmmmtpdpaccesssingleton.h" +#include "mmmtpdputility.h" +#include "cabstractmediamtpdataproviderrenameobject.h" +#include "mmmtpdpdefs.h" +#include "mmmtpdpfiledefs.h" + +// Class constants. +// Defines the number of MTP Active Processors allowed +static const TInt KMTPAbstractMediaDpSessionGranularity = 3; +static const TInt KAbstractMediaMtpDpArrayGranularity = 2; + +static const TInt KActiveEnumeration = 0; + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProvider::NewL +// Two Phase Construction +// ----------------------------------------------------------------------------- +// +TAny* CAbstractMediaMtpDataProvider::NewL( TAny* aParams ) + { + CAbstractMediaMtpDataProvider* self = new ( ELeave ) CAbstractMediaMtpDataProvider( aParams ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProvider::CAbstractMediaMtpDataProvider +// Standard C++ constructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProvider::CAbstractMediaMtpDataProvider( TAny* aParams ) : + CMTPDataProviderPlugin( aParams ), + iActiveProcessors( KMTPAbstractMediaDpSessionGranularity ), + iAbstractMediaEnumerator( NULL ), + iPendingEnumerations ( KAbstractMediaMtpDpArrayGranularity ), + iActiveProcessor( -1 ), + iRenameObject( NULL ), + iSupportedFormat( KAbstractMediaMtpDpArrayGranularity ), + iSupportedProperties( KAbstractMediaMtpDpArrayGranularity ) + { + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProvider::~CAbstractMediaMtpDataProvider +// Destructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProvider::~CAbstractMediaMtpDataProvider() + { + PRINT( _L( "MM MTP => CAbstractMediaMtpDataProvider::~CAbstractMediaMtpDataProvider" ) ); + + iPendingEnumerations.Close(); + TInt count = iActiveProcessors.Count(); + for ( TInt i = 0; i < count; i++ ) + { + iActiveProcessors[i]->Release(); + } + iActiveProcessors.Close(); + + delete iAbstractMediaEnumerator; + CMmMtpDpAccessSingleton::Release(); + + if ( iRenameObject ) + delete iRenameObject; + + iSupportedFormat.Close(); + iSupportedProperties.Close(); + + PRINT( _L( "MM MTP => CAbstractMediaMtpDataProvider::~CAbstractMediaMtpDataProvider" ) ); + } + +void CAbstractMediaMtpDataProvider::Cancel() + { + iAbstractMediaEnumerator->Cancel(); + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProvider::ConstructL +// Second-phase construction +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProvider::ConstructL() + { + PRINT( _L( "MM MTP => CAbstractMediaMtpDataProvider::ConstructL" ) ); + + iAbstractMediaEnumerator = CAbstractMediaMtpDataProviderEnumerator::NewL( Framework(), *this ); + + CMmMtpDpAccessSingleton::CreateL( Framework().Fs(), Framework() ); + + GetSupportedFormatL(); + GetSupportedPropertiesL(); + + PRINT( _L( "MM MTP <= CAbstractMediaMtpDataProvider::ConstructL" ) ); + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProvider::ProcessEventL +// Process event from initiator +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProvider::ProcessEventL( const TMTPTypeEvent& aEvent, + MMTPConnection& aConnection ) + { + TInt index = LocateRequestProcessorL( aEvent, aConnection ); + if ( index != KErrNotFound ) + { + iActiveProcessors[index]->HandleEventL( aEvent ); + } + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProvider::ProcessNotificationL +// Process notification from initiator +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProvider::ProcessNotificationL( TMTPNotification aNotification, + const TAny* aParams ) + { + switch ( aNotification ) + { + case EMTPSessionClosed: + PRINT( _L( "MM MTP <> CAbstractMediaMtpDataProvider::ProcessNotificationL EMTPSessionClosed event recvd" ) ); + + SessionClosedL( *reinterpret_cast ( aParams ) ); + break; + + case EMTPSessionOpened: + PRINT( _L( "MM MTP <> CAbstractMediaMtpDataProvider::ProcessNotificationL EMTPSessionOpened event recvd" ) ); + + SessionOpenedL( *reinterpret_cast ( aParams ) ); + break; + + case EMTPStorageAdded: + break; + + case EMTPStorageRemoved: + break; + + case EMTPRenameObject: + PRINT( _L( "MM MTP <> CAbstractMediaMtpDataProvider::ProcessNotificationL EMTPRenameObject event recvd" ) ); + RenameObjectL( *reinterpret_cast ( aParams ) ); + break; + + default: + PRINT( _L( "MM MTP <> CAbstractMediaMtpDataProvider::ProcessNotificationL Ignore all other notifications" ) ); + // Ignore all other notifications. + break; + } + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProvider::ProcessRequestPhaseL +// Process the request from initiator +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProvider::ProcessRequestPhaseL( TMTPTransactionPhase aPhase, + const TMTPTypeRequest& aRequest, + MMTPConnection& aConnection ) + { + TInt index = LocateRequestProcessorL( aRequest, aConnection ); + + __ASSERT_DEBUG( index != KErrNotFound, Panic( EMmMTPDpNoMatchingProcessor ) ); + + MMmRequestProcessor* processor = iActiveProcessors[index]; + iActiveProcessor = index; + // iActiveProcessorRemoved = EFalse; + TBool result = processor->HandleRequestL( aRequest, aPhase ); + if( !iIsSessionOpen ) + { + processor->Release(); + } + // iActiveProcessorRemoved will be set to ETrue in the above function + // HandleRequestL(),such as SessionClose() + // else if ( iActiveProcessorRemoved ) + // { + // processor->Release(); // destroy the processor + // } + else if ( result ) // destroy the processor + { + processor->Release(); + iActiveProcessors.Remove( index ); + } + iActiveProcessor = -1; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProvider::SessionClosedL +// Notify the data provider that the session has been closed +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProvider::SessionClosedL( const TMTPNotificationParamsSessionChange& aSession ) + { + iIsSessionOpen = EFalse; + TInt count = iActiveProcessors.Count(); + PRINT1( _L( "MM MTP => CAbstractMediaMtpDataProvider::SessionClosedL, total processor count = %d" ), count ); + for( TInt i = 0; i < count; i++ ) + { + MMmRequestProcessor* processor = iActiveProcessors[i]; + + // replaced for the Request() is invalid sometimes + // TUint32 sessionId( processor->Request().Uint32( TMTPTypeRequest::ERequestSessionID ) ); + TUint32 sessionId = processor->SessionId(); + + if ( ( sessionId == aSession.iMTPId ) + && ( processor->Connection().ConnectionId() + == aSession.iConnection.ConnectionId() ) ) + { + processor->UsbDisconnect(); // Rollback + + iActiveProcessors.Remove( i ); + // if ( i == iActiveProcessor ) + // { + // iActiveProcessorRemoved = ETrue; + // } + // else + { + processor->Release(); + } + } + } + + // TODO: Compare to Media Dp, missing enumerator's SessionClose + CMmMtpDpAccessSingleton::CloseSessionL(); + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProvider::SessionOpenedL +// Open Session operation +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProvider::SessionOpenedL( const TMTPNotificationParamsSessionChange& /*aSession*/ ) + { + CMmMtpDpAccessSingleton::OpenSessionL(); + iIsSessionOpen = ETrue; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProvider::RenameObjectL +// Process the changed folder +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProvider::RenameObjectL( const TMTPNotificationParamsHandle& aObject ) + { + PRINT( _L( "MM MTP => CAbstractMediaMtpDataProvider::RenameObjectL" ) ); + + if ( !iRenameObject ) + { + iRenameObject = CAbstractMediaMtpDataProviderRenameObject::NewL( Framework(), + GetWrapperL() ); + } + + iRenameObject->StartL( aObject.iHandleId, aObject.iFileName ); + + PRINT( _L( "MM MTP <= CAbstractMediaMtpDataProvider::RenameObjectL" ) ); + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProvider::StartObjectEnumerationL +// Start object enumeration +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProvider::StartObjectEnumerationL( TUint32 aStorageId ) + { + iPendingEnumerations.AppendL( aStorageId ); + + if ( iPendingEnumerations.Count() > 0 ) + { + iAbstractMediaEnumerator->StartL( iPendingEnumerations[KActiveEnumeration] ); + } + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProvider::StartStorageEnumerationL +// Start Storage enumeration +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProvider::StartStorageEnumerationL() + { + Framework().StorageEnumerationCompleteL(); + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProvider::Supported +// Defines the supported operations and formats of the data provider +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProvider::Supported( TMTPSupportCategory aCategory, + RArray& aArray ) const + { + switch ( aCategory ) + { + case EEvents: + break; + + case EObjectCaptureFormats: + case EObjectPlaybackFormats: + { + TInt count = sizeof( KAbstractMediaMtpDataProviderSupportedFormats ) / sizeof( TUint16 ); + for ( TInt i = 0; i < count; i++ ) + { + aArray.Append( KAbstractMediaMtpDataProviderSupportedFormats[i] ); + } + } + break; + + case EOperations: + { + TInt count = sizeof( KAbstractMediaMtpDataProviderSupportedOperations ) / sizeof( TUint16 ); + + for ( TInt i = 0; i < count; i++ ) + { + aArray.Append( KAbstractMediaMtpDataProviderSupportedOperations[i] ); + } + } + break; + + case EObjectProperties: + { + TInt count = iSupportedProperties.Count(); + + for ( TInt i = 0; i < count; i++ ) + { + aArray.Append( iSupportedProperties[i] ); + } + PRINT1( _L( "MM MTP <> CAbstractMediaMtpDataProvider::Supported properties count = %d" ), aArray.Count() ); + } + break; + + case EStorageSystemTypes: + { + aArray.Append( CMTPStorageMetaData::ESystemTypeDefaultFileSystem ); + } + break; + + default: + // Unrecognised category, leave aArray unmodified. + break; + } + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProvider::SupportedL +// Defines the supported operations and formats of the data provider +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProvider::SupportedL( TMTPSupportCategory aCategory, + CDesCArray& aStrings ) const + { + if( aCategory == EFormatExtensionSets ) + { + //EMTPFormatCodeM3U, + aStrings.AppendL(KFormatExtensionM3U); + aStrings.AppendL(KFormatExtensionPLA); + aStrings.AppendL(KFormatExtensionVIR); + } + } + +TAny* CAbstractMediaMtpDataProvider::GetExtendedInterface( TUid /*aInterfaceUid*/ ) + { + return NULL; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProvider::NotifyEnumerationCompleteL +// enumeration completed +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProvider::NotifyEnumerationCompleteL( TUint32 /*aStorageId*/, + TInt /*aError*/ ) + { + Framework().ObjectEnumerationCompleteL( iPendingEnumerations[KActiveEnumeration] ); + iPendingEnumerations.Remove( KActiveEnumeration ); + if ( iPendingEnumerations.Count() ) + { + iAbstractMediaEnumerator->StartL( iPendingEnumerations[KActiveEnumeration] ); + } + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProvider::LocateRequestProcessorL +// Find or create a request processor that can process the request +// ----------------------------------------------------------------------------- +// +TInt CAbstractMediaMtpDataProvider::LocateRequestProcessorL( const TMTPTypeRequest& aRequest, + MMTPConnection& aConnection ) + { + TInt index = KErrNotFound; + TInt count = iActiveProcessors.Count(); + for ( TInt i = 0; i < count; i++ ) + { + if ( iActiveProcessors[i]->Match( aRequest, aConnection ) ) + { + index = i; + break; + } + } + if ( index == KErrNotFound ) + { + MMmRequestProcessor* processor = + AbstractMediaMtpDataProviderProcessor::CreateL( Framework(), + aRequest, + aConnection, + *this ); + + CleanupReleasePushL( *processor ); + iActiveProcessors.AppendL( processor ); + CleanupStack::Pop( processor ); + index = count; + } + + return index; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProvider::LocateRequestProcessorL +// Find or create a request processor that can process the event +// ----------------------------------------------------------------------------- +// +TInt CAbstractMediaMtpDataProvider::LocateRequestProcessorL( const TMTPTypeEvent& aEvent, + MMTPConnection& aConnection ) + { + TInt index = KErrNotFound; + TInt count = iActiveProcessors.Count(); + for ( TInt i = 0; i < count; i++ ) + { + if ( iActiveProcessors[i]->Match( aEvent, aConnection ) ) + { + index = i; + break; + } + } + return index; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProvider::GetWrapper +// return the reference of CMmMtpDpMetadataAccessWrapper to enumerator +// ----------------------------------------------------------------------------- +// +CMmMtpDpMetadataAccessWrapper& CAbstractMediaMtpDataProvider::GetWrapperL() + { + return CMmMtpDpAccessSingleton::GetAccessWrapperL(); + } + +// --------------------------------------------------------------------------- +// CAbstractMediaMtpDataProvider::GetSupportedFormat +// +// --------------------------------------------------------------------------- +// +const RArray* CAbstractMediaMtpDataProvider::GetSupportedFormat() const + { + return &iSupportedFormat; + } + +void CAbstractMediaMtpDataProvider::GetSupportedFormatL() + { + iSupportedFormat.Reset(); + + TInt count = sizeof ( KAbstractMediaMtpDataProviderSupportedFormats ) / sizeof( TUint16 ); + for ( TInt i = 0; i < count; i++ ) + { + InsertL( iSupportedFormat, KAbstractMediaMtpDataProviderSupportedFormats[i] ); + } + } + +const RArray* CAbstractMediaMtpDataProvider::GetSupportedPropertiesL( TUint32 aFormatCode ) const + { + return &iSupportedProperties; + } + +// --------------------------------------------------------------------------- +// CAbstractMediaMtpDataProvider::GetSupportedPropertiesL +// +// --------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProvider::GetSupportedPropertiesL() + { + iSupportedProperties.Reset(); + + TInt count = 0, i = 0; + count = sizeof( KMmMtpDpSupportedPropMandatoryAll ) / sizeof( TUint16 ); + for ( i = 0; i < count; i++ ) + { + InsertL( iSupportedProperties, KMmMtpDpSupportedPropMandatoryAll[i] ); + } + + count = sizeof( KMmMtpDpSupportedPropAdditionalAll ) / sizeof( TUint16 ); + for ( i = 0; i < count; i++ ) + { + InsertL( iSupportedProperties, KMmMtpDpSupportedPropAdditionalAll[i] ); + } + } + +// --------------------------------------------------------------------------- +// CAbstractMediaMtpDataProvider::GetAllSupportedProperties +// +// --------------------------------------------------------------------------- +// +const RArray* CAbstractMediaMtpDataProvider::GetAllSupportedProperties() const + { + return &iSupportedProperties; + } + +// --------------------------------------------------------------------------- +// CMediaMtpDataProvider::GetDefaultStorageIdL +// +// --------------------------------------------------------------------------- +// +TUint32 CAbstractMediaMtpDataProvider::GetDefaultStorageIdL() const + { + TInt driveNum = -1; + TInt err = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, driveNum ); + PRINT2( _L( "MM MTP <> GetDefaultDrive, driveNum = %d, err = %d" ), driveNum, err ); + + TDriveInfo driveInfo; + User::LeaveIfError( Framework().Fs().Drive( driveInfo, driveNum ) ); + if( driveInfo.iType == EMediaNotPresent || driveInfo.iType == EMediaUnknown ) + { + err = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultPhoneMemory, driveNum ); + PRINT( _L( "MM MTP <> Memory card doesn't exist, set PhoneMemory to default" ) ); + } + + return Framework().StorageMgr().FrameworkStorageId( TDriveNumber( driveNum ) ); + } + +// --------------------------------------------------------------------------- +// CAbstractMediaMtpDataProvider::Insert +// +// --------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProvider::InsertL( RArray& aArray, const TUint aProperCode ) const + { + TInt err = KErrNone; + err = aArray.Find( aProperCode ); + if ( err == KErrNotFound ) + err = aArray.Append( aProperCode ); + + User::LeaveIfError( err ); + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataproviderabstractmediapreference.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataproviderabstractmediapreference.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,96 @@ +/* +* 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: Implement the operation: 0x9203 +* +*/ + + +#include "cabstractmediamtpdataproviderabstractmediapreference.h" +#include "mmmtpdplogger.h" +#include "mmmtpdpconfig.h" + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderAbstractMediaPreference::NewLC +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderAbstractMediaPreference* CAbstractMediaMtpDataProviderAbstractMediaPreference::NewLC( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection ) + { + CAbstractMediaMtpDataProviderAbstractMediaPreference* self = + new ( ELeave ) CAbstractMediaMtpDataProviderAbstractMediaPreference( aFramework, aConnection ); + CleanupStack::PushL( self ); + self->ConstructL(); + + return self; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderAbstractMediaPreference::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +MMmRequestProcessor* CAbstractMediaMtpDataProviderAbstractMediaPreference::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& /*aDpConfig*/ ) + { + CAbstractMediaMtpDataProviderAbstractMediaPreference* self = + CAbstractMediaMtpDataProviderAbstractMediaPreference::NewLC( aFramework, aConnection ); + CleanupStack::Pop( self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderAbstractMediaPreference::CAbstractMediaMtpDataProviderAbstractMediaPreference +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderAbstractMediaPreference::CAbstractMediaMtpDataProviderAbstractMediaPreference( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection ) : + CRequestProcessor( aFramework, aConnection, 0, NULL ) + { + PRINT( _L( "Operation: WMPReportSyncOnlyAbstractMedias(0x9203)" ) ); + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderAbstractMediaPreference::~CAbstractMediaMtpDataProviderAbstractMediaPreference +// Destructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderAbstractMediaPreference::~CAbstractMediaMtpDataProviderAbstractMediaPreference() + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderAbstractMediaPreference::ConstructL +// Two-phased constructor +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderAbstractMediaPreference::ConstructL() + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderAbstractMediaPreference::ServiceL +// +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderAbstractMediaPreference::ServiceL() + { + TUint32 referenceType = EMTPAbstractMediaRefOrdinary; + SendResponseL( EMTPRespCodeOK, 1, &referenceType ); + } diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovidercopyobject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovidercopyobject.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,106 @@ +/* +* 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: Implement the operation: copyobject +* +*/ + + +#include + +#include "cabstractmediamtpdataprovidercopyobject.h" +#include "abstractmediamtpdataproviderconst.h" +#include "mmmtpdplogger.h" +#include "mmmtpdpdefs.h" + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderCopyObject::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +MMmRequestProcessor* CAbstractMediaMtpDataProviderCopyObject::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + CAbstractMediaMtpDataProviderCopyObject* self = + new ( ELeave ) CAbstractMediaMtpDataProviderCopyObject( aFramework, + aConnection, + aDpConfig ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderCopyObject::ConstructL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderCopyObject::ConstructL() + { + CCopyObject::ConstructL(); + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderCopyObject::~CAbstractMediaMtpDataProviderCopyObject +// Destructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderCopyObject::~CAbstractMediaMtpDataProviderCopyObject() + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderCopyObject::CAbstractMediaMtpDataProviderCopyObject +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderCopyObject::CAbstractMediaMtpDataProviderCopyObject( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CCopyObject( aFramework, aConnection, aDpConfig ) + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderCopyObject::ServiceGetSpecificObjectPropertyL +// do nothing here +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderCopyObject::ServiceGetSpecificObjectPropertyL( TUint16 /*aPropCode*/, + TUint32 /*aHandle*/, + const CMTPObjectMetaData& /*aObject*/ ) + { + PRINT( _L( "MM MTP <> CAbstractMediaMtpDataProviderCopyObject::ServiceGetSpecificObjectPropertyL" ) ); + // do nothing + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderCopyObject::ServiceSetSpecificObjectPropertyL +// do nothing here +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CAbstractMediaMtpDataProviderCopyObject::ServiceSetSpecificObjectPropertyL( TUint16 /*aPropCode*/, + const CMTPObjectMetaData& /*aObject*/, + const CMTPTypeObjectPropListElement& /*aElement*/) + { + PRINT( _L( "MM MTP <> CAbstractMediaMtpDataProviderCopyObject::ServiceSetSpecificObjectPropertyL" ) ); + + return EMTPRespCodeOK; + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataproviderenumerator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataproviderenumerator.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,441 @@ +/* +* 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: Enumerator objects +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "abstractmediamtpdataproviderconst.h" +#include "cabstractmediamtpdataproviderenumerator.h" +#include "cabstractmediamtpdataprovider.h" +#include "mmmtpdplogger.h" +#include "mmmtpdputility.h" +#include "cmmmtpdpmetadataaccesswrapper.h" +#include "cmmmtpdpmetadatampxaccess.h" + + +/** Number of objects to insert into the object manager in one go*/ +const TInt KMTPDriveGranularity = 5; + +_LIT( KPlaylistFilePath, "Playlists\\" ); + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderEnumerator::NewL +// Two phase constructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderEnumerator* CAbstractMediaMtpDataProviderEnumerator::NewL( MMTPDataProviderFramework& aFramework, + CAbstractMediaMtpDataProvider& aDataProvider ) + { + PRINT( _L( "MM MTP => CAbstractMediaMtpDataProviderEnumerator::NewL" ) ); + CAbstractMediaMtpDataProviderEnumerator* self = new ( ELeave ) CAbstractMediaMtpDataProviderEnumerator( aFramework, + aDataProvider ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + PRINT( _L( "MM MTP <= CAbstractMediaMtpDataProviderEnumerator::NewL" ) ); + return self; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderEnumerator::CAbstractMediaMtpDataProviderEnumerator +// Standard C++ Constructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderEnumerator::CAbstractMediaMtpDataProviderEnumerator( MMTPDataProviderFramework& aFramework, + CAbstractMediaMtpDataProvider& aDataProvider ) : + CActive( EPriorityLow ), + iFramework( aFramework ), + iObjectMgr( aFramework.ObjectMgr() ), + iDataProviderId( aFramework.DataProviderId() ), + iDataProvider( aDataProvider ), + iStorages( 2 ), + iAbstractMedias( NULL ), + iCount( 0 ), + iCurrentIndex( 0 ) + { + PRINT1( _L( "MM MTP <> CAbstractMediaMtpDataProviderEnumerator::CAbstractMediaMtpDataProviderEnumerator, iDataProviderId = %d" ), iDataProviderId ); + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderEnumerator::ConstructL +// +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderEnumerator::ConstructL() + { + CActiveScheduler::Add( this ); + +#if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) + iPerfLog = CMmMtpDpPerfLog::NewL( _L( "CAbstractMediaMtpDataProviderEnumerator" ) ); +#endif + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderEnumerator::~CAbstractMediaMtpDataProviderEnumerator +// destructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderEnumerator::~CAbstractMediaMtpDataProviderEnumerator() + { + PRINT( _L( "MM MTP => CAbstractMediaMtpDataProviderEnumerator::~CAbstractMediaMtpDataProviderEnumerator" ) ); + + Cancel(); + iStorages.Close(); + + delete iAbstractMedias; + iAbstractMedias = NULL; +#if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) + delete iPerfLog; +#endif // _DEBUG + PRINT( _L( "MM MTP <= CAbstractMediaMtpDataProviderEnumerator::~CAbstractMediaMtpDataProviderEnumerator" ) ); + } + +// ----------------------------------------------------------------------------- +// AbstractMediaDpMtpEnumerator::StartL +// Kick off the enumeration on the specified storage +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderEnumerator::StartL( TUint32 aStorageId ) + { + PRINT1( _L( "MM MTP => CAbstractMediaMtpDataProviderEnumerator::StartL aStorageId = 0x%x" ), aStorageId ); + + MMTPStorageMgr& storageMgr( iFramework.StorageMgr() ); + if ( aStorageId == KMTPStorageAll ) + { + // Retrieve the available logical StorageIDs + RPointerArray storages; + CleanupClosePushL( storages ); // + storages + TMTPStorageMgrQueryParams params( KNullDesC, + CMTPStorageMetaData::ESystemTypeDefaultFileSystem ); + + storageMgr.GetLogicalStoragesL( params, storages ); + + // Construct the StorageIDs list. + for ( TInt i = 0; i < storages.Count(); i++ ) + { + iStorages.AppendL( storages[i]->Uint( + CMTPStorageMetaData::EStorageId ) ); + } + CleanupStack::PopAndDestroy( &storages ); // - storages + } + else if ( aStorageId != KMTPNotSpecified32 ) + { + __ASSERT_DEBUG( storageMgr.ValidStorageId( aStorageId ), User::Invariant() ); + const CMTPStorageMetaData& storage( + storageMgr.StorageL( aStorageId ) ); + if ( storage.Uint( CMTPStorageMetaData::EStorageSystemType ) == + CMTPStorageMetaData::ESystemTypeDefaultFileSystem ) + { + if ( storageMgr.LogicalStorageId( aStorageId ) != KMTPNotSpecified32 ) + { + // Logical StorageID. + iStorages.AppendL( aStorageId ); + } + else + { + // Physical StorageID. Enumerate all eligible logical storages. + const RArray& logicalIds( storage.UintArray( + CMTPStorageMetaData::EStorageLogicalIds ) ); + + TInt countLogicalIds = logicalIds.Count(); + + for ( TInt i = 0; i < countLogicalIds; i++ ) + { + iStorages.AppendL( logicalIds[i] ); + } + } + } + } + + // keep in mind for notification when enumeration complete + iStorageId = aStorageId; + + if ( iStorages.Count() > 0 ) + { + ScanStorageL( iStorages[0] ); + } + else + { + iStorages.Reset(); + SignalCompleteL( iDataProvider ); + } + + PRINT( _L( "MM MTP <= CAbstractMediaMtpDataProviderEnumerator::StartL" ) ); + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderEnumerator::ScanStorageL +// Find out all AbstractMedia file according to storage id +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderEnumerator::ScanStorageL( TUint32 aStorageId ) + { + PRINT1( _L( "MM MTP => CAbstractMediaMtpDataProviderEnumerator::ScanStorageL aStorageId = 0x%x" ), aStorageId ); + const CMTPStorageMetaData& storage( + iFramework.StorageMgr().StorageL( aStorageId ) ); + + __ASSERT_DEBUG( ( storage.Uint( CMTPStorageMetaData::EStorageSystemType ) == + CMTPStorageMetaData::ESystemTypeDefaultFileSystem ), User::Invariant() ); + + TFileName root( storage.DesC( CMTPStorageMetaData::EStorageSuid ) ); + PRINT1( _L( "MM MTP <> CAbstractMediaMtpDataProviderEnumerator::ScanStorageL StorageSuid = %S" ), &root ); + + // created by windows media player, or else return responsecode is Access denied + // Create abstract media directory if it does not exist + HBufC* tempBuf = HBufC::NewLC( KMaxFileName ); // + tempBuf + TPtr folder = tempBuf->Des(); + folder.Zero(); + folder.Append( root ); + folder.Append( KPlaylistFilePath ); + TBool ret = BaflUtils::FileExists( iFramework.Fs(), folder ); + PRINT2( _L( "MM MTP <> CAbstractMediaMtpDataProviderEnumerator::ScanStorageL ret = %d, folder = %S" ), ret, &folder ); + if( !ret ) + { + TInt err = iFramework.Fs().MkDirAll( folder ); + PRINT2( _L( "MM MTP <> CAbstractMediaMtpDataProviderEnumerator::ScanStorageL Creating folder (%S) returned error %d" ), tempBuf, err ); + + // add this new folder to framework metadata DB + CMTPObjectMetaData* object = CMTPObjectMetaData::NewLC( 0, // Dev Dp hard code + EMTPFormatCodeAssociation, + aStorageId, + folder ); // + object + object->SetUint( CMTPObjectMetaData::EParentHandle, KMTPHandleNoParent ); + object->SetUint( CMTPObjectMetaData::EFormatSubCode, EMTPAssociationTypeGenericFolder ); + PERFLOGSTART( KObjectManagerInsert ); + iObjectMgr.InsertObjectL( *object ); + PERFLOGSTOP( KObjectManagerInsert ); + CleanupStack::PopAndDestroy( object ); // - object + } + CleanupStack::PopAndDestroy( tempBuf ); // - tempBuf + + // find all abstract medias stored in MPX + delete iAbstractMedias; + iAbstractMedias = NULL; + PERFLOGSTART( KMpxGetAllPlaylist ); + TRAPD( err, iDataProvider.GetWrapperL().GetAllPlaylistL( root, &iAbstractMedias ) ); + PERFLOGSTOP( KMpxGetAllPlaylist ); + + if ( iAbstractMedias != NULL && err == KErrNone ) + { + iCount = iAbstractMedias->Count(); + iCurrentIndex = 0; + + TRequestStatus* status = &iStatus; + User::RequestComplete( status, iStatus.Int() ); + SetActive(); + } + else + { + iCount = 0; + iCurrentIndex = 0; + ScanNextL(); + } + + PRINT( _L( "MM MTP <= CAbstractMediaMtpDataProviderEnumerator::ScanStorageL" ) ); + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderEnumerator::ScanNextStorageL +// +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderEnumerator::ScanNextL() + { + PRINT1( _L( "MM MTP = > CAbstractMediaMtpDataProviderEnumerator::ScanNextStorageL iStorages.Count = %d" ), iStorages.Count() ); + if ( iCurrentIndex < iCount ) + { + TRequestStatus* status = &iStatus; + User::RequestComplete( status, iStatus.Int() ); + SetActive(); + + PRINT2( _L( "MM MTP <> Current storage is still being scanned, current index = %d, total AbstractMedia count = %d" ), + iCurrentIndex, + iCount ); + } + // If there are one or more unscanned storages left + // (the currently scanned one is still on the list) + else if ( iStorages.Count() > 1 ) + { + iStorages.Remove( 0 ); + ScanStorageL( iStorages[0] ); + } + else + { + // We are done + PRINT( _L( "MM MTP <> Objects enumeration completed 2" ) ); + iStorages.Reset(); + SignalCompleteL( iDataProvider ); + } + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderEnumerator::RunL +// NOTE: preserve for performance improvement +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderEnumerator::RunL() + { + TBuf playlist; + + // insert all playlists into handle db of framework + CMPXMedia* media = ( *iAbstractMedias )[iCurrentIndex]; + PERFLOGSTART( KMpxGetPlaylistName ); + iDataProvider.GetWrapperL().GetPlaylistNameL( media, playlist ); + PERFLOGSTOP( KMpxGetPlaylistName ); + AddEntryL( playlist ); + + // find all reference of each playlist and create dummy files for each playlist + CDesCArray* references = new ( ELeave ) CDesCArrayFlat( KMTPDriveGranularity ); + CleanupStack::PushL( references ); // + references + + PERFLOGSTART( KMpxQueryPlaylistReference ); + iDataProvider.GetWrapperL().GetAllReferenceL( media, *references ); + PERFLOGSTOP( KMpxQueryPlaylistReference ); + + // insert references into reference db + AddReferencesL( playlist, *references ); + + CleanupStack::PopAndDestroy( references ); // - references + iCurrentIndex++; + + ScanNextL(); + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderEnumerator::RunError +// NOTE: preserve for performance improvement +// ----------------------------------------------------------------------------- +// +TInt CAbstractMediaMtpDataProviderEnumerator::RunError( TInt aError ) + { + if ( aError != KErrNone ) + PRINT1( _L( "MM MTP <> CAbstractMediaMtpDataProviderEnumerator::RunError with error %d" ), aError ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderEnumerator::DoCancel() +// Cancel the enumeration process +// NOTE: preserve for performance improvement +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderEnumerator::DoCancel() + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderEnumerator::SignalCompleteL +// Called when the enumeration is completed +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderEnumerator::SignalCompleteL( MMTPEnumerationCallback& aCallback, + TInt aError ) + { + PRINT( _L( "MM MTP <> CAbstractMediaMtpDataProviderEnumerator::SignalCompleteL" ) ); + // Enumeration completed on this drive + aCallback.NotifyEnumerationCompleteL( iStorageId, aError ); + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderEnumerator::AddEntryL +// Add a file entry to the object store +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderEnumerator::AddEntryL( const TDesC& aSuid ) + { + PRINT1( _L("MM MTP => CAbstractMediaMtpDataProviderEnumerator::AddEntryL AbstractMedia name = %S"), &aSuid ); + + TMTPFormatCode format = MmMtpDpUtility::FormatFromFilename( aSuid ); + CMTPObjectMetaData* object = CMTPObjectMetaData::NewLC( iDataProviderId, + format, + iStorages[0], + aSuid ); // + object + + TParsePtrC parser( aSuid ); + PERFLOGSTART( KObjectManagerObjectUid ); + TUint32 parentHandle = iFramework.ObjectMgr().HandleL( parser.DriveAndPath() ); + PERFLOGSTOP( KObjectManagerObjectUid ); + object->SetUint( CMTPObjectMetaData::EParentHandle, parentHandle ); + + PERFLOGSTART(KObjectManagerInsert); + iObjectMgr.InsertObjectL( *object ); + PERFLOGSTOP(KObjectManagerInsert); + + CleanupStack::PopAndDestroy( object );// - object + + iDataProvider.GetWrapperL().CreateDummyFile( aSuid ); + + // remember the abstract media file for clean up + iDataProvider.GetWrapperL().AddDummyFileL( aSuid ); + + PRINT( _L( "MM MTP <= CAbstractMediaMtpDataProviderEnumerator::AddEntryL" ) ); + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderEnumerator::AddReferencesL +// Add references into reference db according to abstract media name +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderEnumerator::AddReferencesL( const TDesC& aAbstractMediaName, + CDesCArray& aReferences ) + { + TInt count = aReferences.Count(); + PRINT2( _L("MM MTP => CAbstractMediaMtpDataProviderEnumerator::AddReferencesL AbstractMedia name = %S, ref count = %d"), &aAbstractMediaName, count ); + + // check if references are valid + CMTPObjectMetaData* object = CMTPObjectMetaData::NewLC(); // + object + MMTPObjectMgr& objectMgr = iFramework.ObjectMgr(); + + TInt removeCount = 0; + for ( TInt i = 0; i < count; i++ ) + { + TInt index = i - removeCount; + PRINT2( _L( "MM MTP <> CAbstractMediaMtpDataProviderEnumerator::AddReferencesL ref[%d]'s name = %S" ), index, &( aReferences[index] ) ); + PERFLOGSTART( KObjectManagerHandle ); + TUint32 handle = iFramework.ObjectMgr().HandleL( aReferences[index] ); + PERFLOGSTOP( KObjectManagerHandle ); + if ( handle == KMTPHandleNone ) // object doesn't exist + { + TPtrC temp( aReferences[index] ); + PRINT1( _L( "MM MTP <> CAbstractMediaMtpDataProviderEnumerator::AddReferencesL, [%S] doesn't existed in handle db, remove this from reference array" ), &temp ); + + // if handle is invalid, remove from reference array + aReferences.Delete( index, 1 ); + removeCount++; + } + } + CleanupStack::PopAndDestroy( object ); // - object + + // add all references into references db + MMTPReferenceMgr& referenceMgr = iFramework.ReferenceMgr(); + PERFLOGSTART( KReferenceManagerSetReference ); + referenceMgr.SetReferencesL( aAbstractMediaName, aReferences ); + PERFLOGSTOP( KReferenceManagerSetReference ); + + PRINT( _L( "MM MTP <= CAbstractMediaMtpDataProviderEnumerator::AddReferencesL" ) ); + } + +//end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovidergetformatcapabilities.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovidergetformatcapabilities.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,97 @@ +/* +* 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 + +#include "cabstractmediamtpdataprovidergetformatcapabilities.h" + + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetFormatCapabilities::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// + +MMmRequestProcessor* CAbstractMediaMtpDataProviderGetFormatCapabilities::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + CAbstractMediaMtpDataProviderGetFormatCapabilities* self = + new ( ELeave ) CAbstractMediaMtpDataProviderGetFormatCapabilities( aFramework, + aConnection, + aDpConfig ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetFormatCapabilities::ConstructL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderGetFormatCapabilities::ConstructL() + { + CGetFormatCapabilities::ConstructL(); + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetFormatCapabilities::~CAbstractMediaMtpDataProviderGetFormatCapabilities() +// Destructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderGetFormatCapabilities::~CAbstractMediaMtpDataProviderGetFormatCapabilities() + { + + } + + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetFormatCapabilities::CAbstractMediaMtpDataProviderGetFormatCapabilities +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderGetFormatCapabilities::CAbstractMediaMtpDataProviderGetFormatCapabilities( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CGetFormatCapabilities( aFramework, aConnection, aDpConfig ) + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetFormatCapabilities::ServiceInterdepentPropDesc +// +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderGetFormatCapabilities::ServiceInterdepentPropDescL() + { + iInterdependentPropDesc = CMTPTypeInterdependentPropDesc::NewL(); + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetFormatCapabilities::ServiceSpecificObjectPropertyL +// Service specific object property +// ----------------------------------------------------------------------------- +// +CMTPTypeObjectPropDesc* CAbstractMediaMtpDataProviderGetFormatCapabilities::ServiceSpecificPropertyDescL( TUint16 aPropCode ) + { + return NULL; + } + + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovidergetinterdependentpropdesc.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovidergetinterdependentpropdesc.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,136 @@ +/* +* 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: Implement the operation: GetInterdenpendentPropDesc +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cabstractmediamtpdataprovidergetinterdependentpropdesc.h" +#include "cmmmtpdpmetadataaccesswrapper.h" +#include "tmmmtpdppanic.h" +#include "abstractmediamtpdataproviderconst.h" +#include "mmmtpdplogger.h" +#include "mmmtpdpconfig.h" + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetInterdependentPropDesc::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +MMmRequestProcessor* CAbstractMediaMtpDataProviderGetInterdependentPropDesc::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& /*aDpConfig*/ ) + { + CAbstractMediaMtpDataProviderGetInterdependentPropDesc* self = + new ( ELeave ) CAbstractMediaMtpDataProviderGetInterdependentPropDesc( aFramework, + aConnection ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetInterdependentPropDesc::ConstructL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderGetInterdependentPropDesc::ConstructL() + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetInterdependentPropDesc::~CAbstractMediaMtpDataProviderGetInterdependentPropDesc +// Destructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderGetInterdependentPropDesc::~CAbstractMediaMtpDataProviderGetInterdependentPropDesc() + { + delete iDataset; + } + +// ----------------------------------------------------------------------------- +// CMTPGetInterdependentPropDesc::CMTPGetInterdependentPropDesc +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderGetInterdependentPropDesc::CAbstractMediaMtpDataProviderGetInterdependentPropDesc( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection ) : + CRequestProcessor( aFramework, aConnection, 0, NULL ) + { + PRINT( _L( "Operation: GetInterdependentPropDesc(0x9807)" ) ); + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetInterdependentPropDesc::CheckRequestL +// Verify the reqeust and returns it +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CAbstractMediaMtpDataProviderGetInterdependentPropDesc::CheckRequestL() + { + TMTPResponseCode responseCode = CRequestProcessor::CheckRequestL(); + iFormatCode = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); + + if ( EMTPRespCodeOK == responseCode ) + { + TInt count = sizeof( KAbstractMediaMtpDataProviderSupportedFormats ) / sizeof( TUint16 ); + + responseCode = EMTPRespCodeInvalidObjectFormatCode; + + for ( TInt i = 0; i < count; i++ ) + { + if ( iFormatCode == KAbstractMediaMtpDataProviderSupportedFormats[i] ) + { + responseCode = EMTPRespCodeOK; + break; + } + } + } + + return responseCode; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetInterdependentPropDesc::ServiceL +// service a request at request phase +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderGetInterdependentPropDesc::ServiceL() + { + PRINT( _L( "MM MTP => CAbstractMediaMtpDataProviderGetInterdependentPropDesc::ServiceL" ) ); + + // Clear the data set. + delete iDataset; + iDataset = NULL; + iDataset = CMTPTypeInterdependentPropDesc::NewL(); + + PRINT( _L( "MM MTP <> CAbstractMediaMtpDataProviderGetInterdependentPropDesc::ServiceL don't have interdependent properties!" ) ); + + // Send the dataset. + SendDataL( *iDataset ); + PRINT( _L( "MM MTP <= CAbstractMediaMtpDataProviderGetInterdependentPropDesc::ServiceL" ) ); + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovidergetobjectpropdesc.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovidergetobjectpropdesc.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,90 @@ +/* +* 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: Implement the operation: GetObjectPropDesc +* +*/ + +#include +#include + +#include "cabstractmediamtpdataprovidergetobjectpropdesc.h" +#include "mmmtpdplogger.h" +#include "abstractmediamtpdataproviderconst.h" +#include "mmmtpdpdefs.h" + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetObjectPropDesc::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +MMmRequestProcessor* CAbstractMediaMtpDataProviderGetObjectPropDesc::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + CAbstractMediaMtpDataProviderGetObjectPropDesc* self = + new ( ELeave ) CAbstractMediaMtpDataProviderGetObjectPropDesc( aFramework, + aConnection, + aDpConfig ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetObjectPropDesc::ConstructL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderGetObjectPropDesc::ConstructL() + { + CGetObjectPropDesc::ConstructL(); + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetObjectPropDesc::~CAbstractMediaMtpDataProviderGetObjectPropDesc +// Destructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderGetObjectPropDesc::~CAbstractMediaMtpDataProviderGetObjectPropDesc() + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetObjectPropDesc::CAbstractMediaMtpDataProviderGetObjectPropDesc +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderGetObjectPropDesc::CAbstractMediaMtpDataProviderGetObjectPropDesc( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CGetObjectPropDesc( aFramework, aConnection, aDpConfig ) + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetObjectPropDesc::ServiceSpecificObjectPropertyL +// +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderGetObjectPropDesc::ServiceSpecificObjectPropertyL( TUint16 /*aPropCode*/ ) + { + PRINT( _L( "MM MTP <> CAbstractMediaMtpDataProviderGetObjectPropDesc::ServiceSpecificObjectPropertyL leave with not supportd" ) ); + User::Leave( KErrNotSupported ); + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovidergetobjectproplist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovidergetobjectproplist.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,91 @@ +/* +* 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: Implement the operation: getobjectproplist + * +*/ + + +#include "cabstractmediamtpdataprovidergetobjectproplist.h" +#include "abstractmediamtpdataproviderconst.h" +#include "mmmtpdplogger.h" +#include "mmmtpdpdefs.h" +#include "mmmtpdpconfig.h" + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetObjectPropList::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +MMmRequestProcessor* CAbstractMediaMtpDataProviderGetObjectPropList::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + CAbstractMediaMtpDataProviderGetObjectPropList* self = + new (ELeave) CAbstractMediaMtpDataProviderGetObjectPropList( aFramework, + aConnection, + aDpConfig ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetObjectPropList::~CAbstractMediaMtpDataProviderGetObjectPropList +// Destructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderGetObjectPropList::~CAbstractMediaMtpDataProviderGetObjectPropList() + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetObjectPropList::CAbstractMediaMtpDataProviderGetObjectPropList +// Standard C++ Constructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderGetObjectPropList::CAbstractMediaMtpDataProviderGetObjectPropList( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CGetObjectPropList( aFramework, aConnection, aDpConfig ) + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetObjectPropList::ConstructL +// 2nd Phase Constructor +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderGetObjectPropList::ConstructL() + { + CGetObjectPropList::ConstructL(); + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetObjectPropList::ServiceSpecificObjectPropertyL +// do nothing here, just leave, as this should never be invoked or invalid propcode +// ----------------------------------------------------------------------------- +// +TInt CAbstractMediaMtpDataProviderGetObjectPropList::ServiceSpecificObjectPropertyL( TUint16 /*aPropCode*/, + TUint32 /*aHandle*/ ) + { + PRINT( _L( "MM MTP <> CAbstractMediaMtpDataProviderGetObjectPropList::ServiceSpecificObjectPropertyL, leave with KErrNotSupported" ) ); + return KErrNotSupported; + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovidergetobjectpropvalue.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovidergetobjectpropvalue.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,90 @@ +/* +* 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: Implement the operation: getobjectpropvalue +* +*/ + + +#include "cabstractmediamtpdataprovidergetobjectpropvalue.h" +#include "abstractmediamtpdataproviderconst.h" +#include "mmmtpdplogger.h" +#include "mmmtpdpdefs.h" +#include "mmmtpdpconfig.h" + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetObjectPropValue::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +MMmRequestProcessor* CAbstractMediaMtpDataProviderGetObjectPropValue::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + CAbstractMediaMtpDataProviderGetObjectPropValue* self = + new ( ELeave ) CAbstractMediaMtpDataProviderGetObjectPropValue( aFramework, + aConnection, + aDpConfig ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetObjectPropValue::ConstructL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderGetObjectPropValue::ConstructL() + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetObjectPropValue::~CAbstractMediaMtpDataProviderGetObjectPropValue +// Destructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderGetObjectPropValue::~CAbstractMediaMtpDataProviderGetObjectPropValue() + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetObjectPropValue::CAbstractMediaMtpDataProviderGetObjectPropValue +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderGetObjectPropValue::CAbstractMediaMtpDataProviderGetObjectPropValue( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CGetObjectPropValue( aFramework, aConnection, aDpConfig ) + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderGetObjectPropValue::ServiceSpecificObjectProperty +// no need to do anything here, just leave, as this should never be +// invoked or invalid propcode +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderGetObjectPropValue::ServiceSpecificObjectPropertyL( TUint16 /*aPropCode*/ ) + { + PRINT( _L( "MM MTP <> CAbstractMediaMtpDataProviderGetObjectPropValue::ServiceSpecificObjectPropertyL, leave with KErrNotSupported")); + User::Leave( KErrNotSupported ); + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovidermoveobject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovidermoveobject.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,107 @@ +/* +* 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: Implement the operation: moveobject +* +*/ + + +#include + +#include "cabstractmediamtpdataprovidermoveobject.h" +#include "abstractmediamtpdataproviderconst.h" +#include "mmmtpdplogger.h" +#include "mmmtpdpdefs.h" +#include "mmmtpdpconfig.h" + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderMoveObject::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +MMmRequestProcessor* CAbstractMediaMtpDataProviderMoveObject::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + CAbstractMediaMtpDataProviderMoveObject* self = + new ( ELeave ) CAbstractMediaMtpDataProviderMoveObject( aFramework, + aConnection, + aDpConfig ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderMoveObject::ConstructL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderMoveObject::ConstructL() + { + CMoveObject::ConstructL(); + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderMoveObject::~CAbstractMediaMtpDataProviderMoveObject +// Destructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderMoveObject::~CAbstractMediaMtpDataProviderMoveObject() + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderMoveObject::CAbstractMediaMtpDataProviderMoveObject +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderMoveObject::CAbstractMediaMtpDataProviderMoveObject( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CMoveObject( aFramework, aConnection, aDpConfig ) + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderMoveObject::ServiceGetSpecificObjectPropertyL +// do nothing here +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderMoveObject::ServiceGetSpecificObjectPropertyL( TUint16 /*aPropCode*/, + TUint32 /*aHandle*/, + const CMTPObjectMetaData& /*aObject*/ ) + { + PRINT( _L( "MM MTP <> CAbstractMediaMtpDataProviderMoveObject::ServiceGetSpecificObjectPropertyL" ) ); + // do nothing + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderMoveObject::ServiceSetSpecificObjectPropertyL +// do nothing here +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CAbstractMediaMtpDataProviderMoveObject::ServiceSetSpecificObjectPropertyL( TUint16 /*aPropCode*/, + const CMTPObjectMetaData& /*aObject*/, + const CMTPTypeObjectPropListElement& /*aElement*/ ) + { + PRINT( _L( "MM MTP <> CAbstractMediaMtpDataProviderMoveObject::ServiceSetSpecificObjectPropertyL" ) ); + + return EMTPRespCodeOK; + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataproviderrenameobject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataproviderrenameobject.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,108 @@ +/* +* 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: Rename objects +* +*/ + + +#include +#include +#include +#include +#include + +#include "cabstractmediamtpdataproviderrenameobject.h" +#include "mmmtpdplogger.h" +#include "cmmmtpdpmetadataaccesswrapper.h" + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderRenameObject::NewL +// Two phase constructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderRenameObject* CAbstractMediaMtpDataProviderRenameObject::NewL( MMTPDataProviderFramework& aFramework, + CMmMtpDpMetadataAccessWrapper& aWrapper ) + { + PRINT( _L( "MM MTP => CAbstractMediaMtpDataProviderRenameObject::NewL" ) ); + + CAbstractMediaMtpDataProviderRenameObject* self = new ( ELeave ) CAbstractMediaMtpDataProviderRenameObject( aFramework, + aWrapper ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + PRINT( _L( "MM MTP <= CAbstractMediaMtpDataProviderRenameObject::NewL" ) ); + return self; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderRenameObject::CAbstractMediaMtpDataProviderRenameObject +// Standard C++ Constructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderRenameObject::CAbstractMediaMtpDataProviderRenameObject( MMTPDataProviderFramework& aFramework, + CMmMtpDpMetadataAccessWrapper& aWrapper ) : + CRenameObject( aFramework, aWrapper ) + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderRenameObject::~CAbstractMediaMtpDataProviderRenameObject +// destructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderRenameObject::~CAbstractMediaMtpDataProviderRenameObject() + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderRenameObject::ConstructL +// +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderRenameObject::ConstructL() + { + CRenameObject::ConstructL(); + } + +void CAbstractMediaMtpDataProviderRenameObject::PerformAdditionalActionL() + { + PRINT( _L( "MM MTP => CAbstractMediaMtpDataProviderRenameObject::PerformAdditionalActionL" ) ); + + // modified the dummy array + if ( iObjectInfo->Uint( CMTPObjectMetaData::EFormatCode ) + == EMTPFormatCodeAbstractAudioVideoPlaylist ) + { + iWrapper.DeleteDummyFile( iOldFileName ); + iWrapper.AddDummyFileL( iFileName ); + // Do not update MPX db to keep the same behavior in mass storage and device file manager. + } + else + { + TRAPD( err, iWrapper.RenameObjectL( iOldFileName, iFileName ) ); + + // should not fail for 1 file, keep it going, as folder already renamed + if ( err != KErrNone ) + PRINT1( _L( "MM MTP <> CRenameObject::PerformAdditionalActionL err = %d" ), err ); + } + + // the reference DB use PUID + // so we needn't to update the reference DB + + PRINT( _L( "MM MTP <= CAbstractMediaMtpDataProviderRenameObject::PerformAdditionalActionL" ) ); + } + +//end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovidersendobject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovidersendobject.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,111 @@ +/* +* 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: Implement the operation: SendObjectInfo/SendObjectPropList/SendObject +* +*/ + + +#include +#include + +#include "cabstractmediamtpdataprovidersendobject.h" +#include "abstractmediamtpdataproviderconst.h" +#include "mmmtpdplogger.h" +#include "mmmtpdpconfig.h" + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderSendObject::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +MMmRequestProcessor* CAbstractMediaMtpDataProviderSendObject::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + CAbstractMediaMtpDataProviderSendObject* self = + new (ELeave) CAbstractMediaMtpDataProviderSendObject( aFramework, + aConnection, + aDpConfig ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderSendObject::~CAbstractMediaMtpDataProviderSendObject +// Destructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderSendObject::~CAbstractMediaMtpDataProviderSendObject() + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderSendObject::CAbstractMediaMtpDataProviderSendObject +// Standard C++ Constructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderSendObject::CAbstractMediaMtpDataProviderSendObject( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CSendObject( aFramework, aConnection, aDpConfig ) + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderSendObject::ConstructL +// 2nd Phase Constructor +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderSendObject::ConstructL() + { + CSendObject::ConstructL(); + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderSendObject::ServiceSpecificObjectPropertyL +// no need to do anything here, just leave, as this should never be invoked or +// invalid propcode +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CAbstractMediaMtpDataProviderSendObject::SetSpecificObjectPropertyL( TUint16 /*aPropCode*/, + const CMTPObjectMetaData& /*aObject*/, + const CMTPTypeObjectPropListElement& /*aElement*/ ) + { + PRINT( _L( "MM MTP <> CAbstractMediaMtpDataProviderSendObject::ServiceSpecificObjectPropertyL, leave with KErrNotSupported" ) ); + User::Leave( KErrNotSupported ); + + return EMTPRespCodeOK; + } + +TMTPResponseCode CAbstractMediaMtpDataProviderSendObject::CheckSepecificPropType( TUint16 aPropCode, TUint16 aDataType ) + { + PRINT( _L( "MM MTP <> CAbstractMediaMtpDataProviderSendObject::ServiceSpecificCheckDataTypeL, leave with KErrNotSupported" ) ); + // TODO: User::Leave( KErrNotSupported ); + return EMTPRespCodeOK; + } + +TInt CAbstractMediaMtpDataProviderSendObject::HandleSpecificWrapperError( TInt aError, + const CMTPObjectMetaData& /*aObject*/ ) + { + // do nothing, simply return the error + return aError; + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovidersetobjectproplist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovidersetobjectproplist.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,104 @@ +/* +* 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: Implement the operation: getobjectproplist +* +*/ + + +#include +#include + +#include "cabstractmediamtpdataprovidersetobjectproplist.h" +#include "abstractmediamtpdataproviderconst.h" +#include "mmmtpdplogger.h" +#include "mmmtpdpconfig.h" + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderSetObjectPropList::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +MMmRequestProcessor* CAbstractMediaMtpDataProviderSetObjectPropList::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + CAbstractMediaMtpDataProviderSetObjectPropList* self = + new (ELeave) CAbstractMediaMtpDataProviderSetObjectPropList( aFramework, + aConnection, + aDpConfig ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderSetObjectPropList::~CAbstractMediaMtpDataProviderSetObjectPropList +// Destructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderSetObjectPropList::~CAbstractMediaMtpDataProviderSetObjectPropList() + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderSetObjectPropList::CAbstractMediaMtpDataProviderSetObjectPropList +// Standard C++ Constructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderSetObjectPropList::CAbstractMediaMtpDataProviderSetObjectPropList( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CSetObjectPropList( aFramework, aConnection, aDpConfig ) + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderSetObjectPropList::ConstructL +// 2nd Phase Constructor +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderSetObjectPropList::ConstructL() + { + CSetObjectPropList::ConstructL(); + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderSetObjectPropList::ServiceSpecificObjectPropertyL +// no need to do anything here, just leave, as this should never be invoked or +// invalid propcode +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CAbstractMediaMtpDataProviderSetObjectPropList::ServiceSpecificObjectPropertyL( TUint16 /*aPropCode*/, + const CMTPObjectMetaData& /*aObject*/, + const CMTPTypeObjectPropListElement& /*aElement*/ ) + { + PRINT( _L( "MM MTP <> CAbstractMediaMtpDataProviderSetObjectPropList::ServiceSpecificObjectPropertyL, leave with KErrNotSupported" ) ); + User::Leave( KErrNotSupported ); + + return EMTPRespCodeOK; + } + +TInt CAbstractMediaMtpDataProviderSetObjectPropList::HandleSpecificWrapperError( TInt aError, + const CMTPObjectMetaData& /*aObject*/ ) + { + // do nothing, simply return the error + return aError; + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovidersetobjectpropvalue.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovidersetobjectpropvalue.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,115 @@ +/* +* 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: Implement opeartion setobjectpropvalue +* +*/ + + +#include "cabstractmediamtpdataprovidersetobjectpropvalue.h" +#include "abstractmediamtpdataproviderconst.h" +#include "mmmtpdplogger.h" +#include "mmmtpdpdefs.h" +#include "mmmtpdpconfig.h" + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderSetObjectPropValue::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +MMmRequestProcessor* CAbstractMediaMtpDataProviderSetObjectPropValue::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + CAbstractMediaMtpDataProviderSetObjectPropValue* self = + new ( ELeave ) CAbstractMediaMtpDataProviderSetObjectPropValue( aFramework, + aConnection, + aDpConfig ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderSetObjectPropValue::ConstructL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderSetObjectPropValue::ConstructL() + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderSetObjectPropValue::CAbstractMediaMtpDataProviderSetObjectPropValue +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderSetObjectPropValue::CAbstractMediaMtpDataProviderSetObjectPropValue( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CSetObjectPropValue( aFramework, aConnection, aDpConfig ) + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderSetObjectPropValue::~CAbstractMediaMtpDataProviderSetObjectPropValue +// Destructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderSetObjectPropValue::~CAbstractMediaMtpDataProviderSetObjectPropValue() + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderSetObjectPropValue::IsSpecificPropCodeReadOnly +// no need to do anything here, just leave, as this should never be invoked or +// invalid propcode +// ----------------------------------------------------------------------------- +// +TBool CAbstractMediaMtpDataProviderSetObjectPropValue::IsSpecificPropCodeReadOnly( TUint16 /*aPropCode*/ ) const + { + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderSetObjectPropValue::ReceiveDataSpecificObjectPropertyL +// no need to do anything here, just leave, as this should never be invoked or +// invalid propcode +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderSetObjectPropValue::ReceiveDataSpecificObjectPropertyL( TUint16 /*aPropCode*/ ) + { + PRINT( _L( "MM MTP => CAbstractMediaMtpDataProviderSetObjectPropValue::ReceiveDataSpecificObjectPropertyL leave with KErrNotSupported" ) ); + User::Leave( KErrNotSupported ); + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderSetObjectPropValue::ServiceSpecificObjectPropertyL +// no need to do anything here, just leave, as this should never be invoked or +// invalid propcode +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CAbstractMediaMtpDataProviderSetObjectPropValue::ServiceSpecificObjectPropertyL( TUint16 /*aPropCode*/ ) + { + PRINT( _L( "MM MTP => CAbstractMediaMtpDataProviderSetObjectPropValue::ServiceSpecificObjectPropertyL leave with KErrNotSupported" ) ); + User::Leave( KErrNotSupported ); + + return EMTPRespCodeOK; + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovidersetobjectreferences.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovidersetobjectreferences.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,105 @@ +/* +* 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: Implement the operation: SetObjectReferences +* +*/ + + +#include "cabstractmediamtpdataprovidersetobjectreferences.h" +#include "abstractmediamtpdataproviderconst.h" +#include "cmmmtpdpmetadataaccesswrapper.h" +#include "mmmtpdplogger.h" + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderSetObjectReferences::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +MMmRequestProcessor* CAbstractMediaMtpDataProviderSetObjectReferences::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + CAbstractMediaMtpDataProviderSetObjectReferences* self = + new ( ELeave ) CAbstractMediaMtpDataProviderSetObjectReferences( aFramework, + aConnection, + aDpConfig ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderSetObjectReferences::ConstructL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderSetObjectReferences::ConstructL() + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderSetObjectReferences::~CAbstractMediaMtpDataProviderSetObjectReferences +// Destructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderSetObjectReferences::~CAbstractMediaMtpDataProviderSetObjectReferences() + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderSetObjectReferences::CAbstractMediaMtpDataProviderSetObjectReferences +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderSetObjectReferences::CAbstractMediaMtpDataProviderSetObjectReferences( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CSetObjectReferences( aFramework, aConnection, aDpConfig ) + { + + } + +// ----------------------------------------------------------------------------- +// CAbstractMediaMtpDataProviderSetObjectReferences::DoSetObjectReferencesL +// set references to DB +// ----------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderSetObjectReferences::DoSetObjectReferencesL( CMmMtpDpMetadataAccessWrapper& aWrapper, + TUint16 aObjectFormat, + const TDesC& aSrcFileName, + CDesCArray& aRefFileArray ) + { + TInt count = sizeof( KAbstractMediaMtpDataProviderSupportedFormats ) / sizeof (TUint16); + TBool supported = EFalse; + + for( TInt i = 0; i < count; i++ ) + { + if( KAbstractMediaMtpDataProviderSupportedFormats[i] == aObjectFormat ) + { + supported = ETrue; + break; + } + } + + if ( supported ) + { + aWrapper.SetPlaylistL( aSrcFileName, aRefFileArray ); + } + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/data/mediamtpdataprovider.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/data/mediamtpdataprovider.rss Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,42 @@ +/* +* 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: ECOM registration information for mediamtpdataprovdier +* +*/ + + +#include + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x10207C4A; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x102827AD; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x10207C4B; // implemention ID + version_no = 1; + display_name = "Media MTP Data Provider"; + default_data = "Media"; + opaque_data = "folderConfig"; + } + }; + } + }; + } diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/data/mediamtpdataprovider_config.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/data/mediamtpdataprovider_config.rss Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,40 @@ +/* +* 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: DP configuration information for mediamtpdataprovider +* +*/ + + +#include +#include "mediamtpdataprovider_config.rh" + +RESOURCE MTP_DATA_PROVIDER dpConfig + { + type = KMTPDataProviderTypeECOM; + major_version = 1; + object_enumeration_persistent = 0; + supported_modes = KMTPModeMTP; + server_name = ""; + server_image_name = ""; + opaque_resource = "folderConfig"; + enumeration_phase = 11; + } + +RESOURCE MEDIAMTPDATAPROVIDE_CONFIG folderConfig + { + media_drive = 4; // 2 change to SD card + } + + + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,23 @@ +/* +* 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: Build information file for project mediamtpdataprovider +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_MMPFILES +mediamtpdataprovider.mmp diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/group/mediamtpdataprovider.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/group/mediamtpdataprovider.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,80 @@ +/* +* 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: Project definition file for project mediamtpdataprovider +* +*/ + + +#include +#include +#include "../../../inc/mmmtpdp_variant.hrh" + +// mtpdp plugin target name +TARGET mediamtpdataprovider.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x10207C4A +VENDORID 0x70000001 + +CAPABILITY CAP_ECOM_PLUGIN + +MW_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc +USERINCLUDE ../../../inc +USERINCLUDE ../../../mmmtpdprequestprocessor/inc + +SOURCEPATH ../src + +SOURCE cmediamtpdataprovider.cpp +SOURCE mediamtpdataprovidercontrollerimp.cpp +SOURCE mediamtpdataproviderprocessor.cpp +SOURCE cmediamtpdataproviderenumerator.cpp +SOURCE cmediamtpdataprovidergetobjectpropdesc.cpp +SOURCE cmediamtpdataprovidergetinterdependentpropdesc.cpp +SOURCE cmediamtpdataprovidergetobjectpropvalue.cpp +SOURCE cmediamtpdataprovidergetobjectproplist.cpp +SOURCE cmediamtpdataprovidersetobjectpropvalue.cpp +SOURCE cmediamtpdataprovidersetobjectproplist.cpp +SOURCE cmediamtpdataprovidercopyobject.cpp +SOURCE cmediamtpdataprovidermoveobject.cpp +SOURCE cmediamtpdataprovidersendobject.cpp +SOURCE cmediamtpdataprovidergetformatcapabilities.cpp + +SOURCEPATH ../data +START RESOURCE mediamtpdataprovider.rss +TARGET mediamtpdataprovider.rsc +END + +// Data provider configuration resource file. +// The target filename corresponds to the implementation UID. +START RESOURCE mediamtpdataprovider_config.rss +TARGETPATH /resource/mtp +TARGET 10207C4B.rsc +END + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY edbms.lib +LIBRARY PlatformEnv.lib +LIBRARY hal.lib + +LIBRARY mtpdatatypes.lib +LIBRARY mtpdataproviderapi.lib + +LIBRARY mpxcommon.lib +LIBRARY mpxharvesterutility.lib +LIBRARY mpxcollectionhelper.lib + +LIBRARY mmmtpdprequestprocessor.lib diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataprovider.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,185 @@ +/* +* 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: media mtp data provider +* +*/ + + +#ifndef CMEDIAMTPDATAPROVIDER_H +#define CMEDIAMTPDATAPROVIDER_H + +#include + +#include "mediamtpdataproviderprocessor.h" +#include "mmmtpenumerationcallback.h" +#include "mmmtpdpconfig.h" + +// Forward declaration +class MMmRequestProcessor; +class CMediaMtpDataProviderEnumerator; +class CMTPObjectMetaData; +class CRenameObject; + +/** +* Defines media mtp data provider plugin +*/ +class CMediaMtpDataProvider : public CMTPDataProviderPlugin, + public MMTPEnumerationCallback, + public MMmMtpDpConfig + { +public: + /** + * Two Phase Construction + * @param aParams pointer to MMTPDataProviderFramework + */ + static TAny* NewL( TAny* aParams ); + + /** + * Destructor. + */ + ~CMediaMtpDataProvider(); + +public: + // from MMmMtpDpConfig + const RArray* GetSupportedFormat() const; + + const RArray* GetSupportedPropertiesL( TUint32 aFormatCode ) const; + + const RArray* GetAllSupportedProperties() const; + + /** + * Get default storage Id from resource file, if not specify a storage Id + * @return TUint32 Default storage Id which read from resource file + */ + TUint32 GetDefaultStorageIdL() const; + + /** + * @return the reference of CMmMtpDpMetadataAccessWrapper to enumerator + */ + CMmMtpDpMetadataAccessWrapper& GetWrapperL(); + +protected: + // from CMTPDataProviderPlugin + void Cancel(); + + void ProcessEventL( const TMTPTypeEvent& aEvent, + MMTPConnection& aConnection ); + + void ProcessNotificationL( TMTPNotification aNotification, + const TAny* aParams ); + + /** + * Process the request from initiator + * @param aPhase The request transaction phase + * @param aRequest The request to be processed + * @param aConnection The connection from which the request comes + */ + void ProcessRequestPhaseL( TMTPTransactionPhase aPhase, + const TMTPTypeRequest& aRequest, + MMTPConnection& aConnection ); + + void SessionOpenedL( const TMTPNotificationParamsSessionChange& aSession ); + + /** + * Notify the data provider that the session has been closed + * @param aSession The connection of the sesssion + */ + void SessionClosedL( const TMTPNotificationParamsSessionChange& aSession ); + + /** + * Notify the data provider that the object has been changed + * @param aObject the changed object + */ + void RenameObjectL( const TMTPNotificationParamsHandle& aObject ); + + void StartObjectEnumerationL( TUint32 aStorageId ); + + void StartStorageEnumerationL(); + + /** + * Defines the supported operations and formats of the data provider + * @param aCategory Defines what MTP is quering the DP about + * @param aArray Supported() edits array to append supported features + */ + void Supported( TMTPSupportCategory aCategory, RArray& aArray ) const; + + void SupportedL( TMTPSupportCategory aCategory, CDesCArray& aStrings ) const; + +protected: + // From MMTPEnumerationCallback + /** + * enumeration completed + */ + void NotifyEnumerationCompleteL( TUint32 aStorageId, TInt aError ); + +private: + /** + * Standard C++ constructor + * @param aParams pointer to MMTPDataProviderFramework + */ + CMediaMtpDataProvider( TAny* aParams ); + + /** + * Second-phase construction + */ + void ConstructL(); + + /** + * Find or create a request processor that can process the request + * @param aRequest The request to be processed + * @param aConnection The connection from which the request comes + * @return the index of the found/created request processor + */ + TInt LocateRequestProcessorL( const TMTPTypeRequest& aRequest, + MMTPConnection& aConnection ); + + /** + * Find or create a request processor that can process the event + * @param aEvent The event to be processed + * @param aConnection The connection from which the request comes + * @return the index of the found/created request processor + */ + TInt LocateRequestProcessorL( const TMTPTypeEvent& aEvent, + MMTPConnection& aConnection ); + + void InsertL( RArray& aArray, const TUint aProperCode ) const; + + void GetSupportedFormatL(); + + void GetSupportedPropL(); + + void GetAllSupportedPropL(); + +private: + // data + RPointerArray iActiveProcessors; + CMediaMtpDataProviderEnumerator* iMediaEnumerator; + RArray iPendingEnumerations; + + TInt iActiveProcessor; + TBool iIsSessionOpen; + + CRenameObject *iRenameObject; + + RArray iSupportedFormat; + + RArray iSupportedPropAudio; + RArray iSupportedPropVideo; + RArray iSupportedPropAll; + + TUint32 iDefaultStorageId; + + }; + +#endif // CMEDIAMTPDATAPROVIDER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataprovidercopyobject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataprovidercopyobject.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,74 @@ +/* +* 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 CMEDIAMTPDATAPROVIDERCOPYOBJECT_H +#define CMEDIAMTPDATAPROVIDERCOPYOBJECT_H + +#include "ccopyobject.h" + +/** +* Defines media data provider CopyObject request processor +*/ +class CMediaMtpDataProviderCopyObject: public CCopyObject + { +public: + /** + * Two-phase construction method + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper Medadata access + * @return a pointer to the created request processor object + */ + static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + ~CMediaMtpDataProviderCopyObject(); + +private: + /** + * Standard c++ constructor + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper Medadata access + */ + CMediaMtpDataProviderCopyObject( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * two-phase construction + */ + void ConstructL(); + +protected: + + void ServiceGetSpecificObjectPropertyL( TUint16 aPropCode, + TUint32 aHandle, + const CMTPObjectMetaData& aObject ); + + TMTPResponseCode ServiceSetSpecificObjectPropertyL( TUint16 aPropCode, + const CMTPObjectMetaData& aObject, + const CMTPTypeObjectPropListElement& aElement ); + + }; + +#endif // CMEDIAMTPDATAPROVIDERCOPYOBJECT_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataproviderenumerator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataproviderenumerator.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,218 @@ +/* +* 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: Enumerator objects +* +*/ + + +#ifndef CMEDIAMTPDATAPROVIDERENUMERATOR_H +#define CMEDIAMTPDATAPROVIDERENUMERATOR_H + +#include +#include + +#include "mmmtpenumerationcallback.h" +#include "cmmmtpdpperflog.h" + +// keep here to avoid warning on urel +_LIT( KDirectoryScan, "DirectoryScan" ); +_LIT( KFormatFilter, "FormatFilter" ); +_LIT( KObjectManagerObjectUid, "ObjectManagerObjectUid" ); +_LIT( KObjectManagerInsert, "ObjectManagerInsert" ); + +// Forward declarations +class MMTPDataProviderFramework; +class MMTPObjectMgr; +class CMTPObjectMetaData; +class CMediaMtpDataProvider; + +/** +* Defines file enumerator. Enumerates all files/directories under a +* specified path or storage +*/ +class CMediaMtpDataProviderEnumerator: public CActive + { +public: + /** + * Two phase constructor + * @param aFramework Reference to MMTPDataProviderFramework + * @param aDataProvider Reference to CMediaMtpDataProvider + * @return A pointer to a new instance of the object + */ + static CMediaMtpDataProviderEnumerator* NewL( MMTPDataProviderFramework& aFramework, + CMediaMtpDataProvider& aDataProvider ); + + /** + * destructor + */ + ~CMediaMtpDataProviderEnumerator(); + + /** + * Kick off the enumeration on the specified storage + * @param aStorageId storage to be enumerated + */ + void StartL( TUint32 aStorageId ); + + // introduce to cleanup db at close session + void SessionClosedL(); + +protected: + // from CActive + /** + * Cancel the enumeration process + */ + void DoCancel(); + + void RunL(); + + /** + * Ignore the error, continue with the next one + */ + TInt RunError( TInt aError ); + +private: + /** + * Standard C++ Constructor + * @param aFramework Reference to MMTPDataProviderFramework + * @param aDataProvider Reference to CMediaMtpDataProvider + */ + CMediaMtpDataProviderEnumerator( MMTPDataProviderFramework& aFramework, + CMediaMtpDataProvider& aDataProvider ); + + void ConstructL(); + + /** + * Called when the enumeration is completed + */ + void SignalCompleteL( MMTPEnumerationCallback& aCallback, + TInt aError = KErrNone ); + + void ScanStorageL( TUint32 aStorageId ); + + /** + * Scan next storage + */ + void ScanNextStorageL(); + + /** + * Scans directory at aPath recursing into subdirectories on a depth + * first basis. + * + * Directory entries are kept in iDirStack - which is a LIFO stack. + * The current path, needed since TEntries don't keep track of it, + * is kept in iPath. + * + * The algorithm works as follows: + * + * 1. Read directory entries. + * 2. ProcessEntriesL is called if no error occurs and >= 1 entries are + * read. + * 3. ProcessEntriesL adds entries to database, if entry is directory + * add to iDirStack. + * 4. When all entries are processed pop entry off the dirstack, + * if entry is empty TEntry remove one directory from iPath. + * 5. Append entry name onto iPath - to update path with new depth + * (parent/subdir). + * 6. Push an empty TEntry onto iDirStack - this tells us we have + * recursed one, think of it as pushing the '\' separator onto + * iDirStack. + * 7. Repeat 1-7 until iDirStack is empty. + */ + void ScanDirL(); + + /** + * Recurse into the next directory on the stack + * and scan it for entries. + */ + void ScanNextDirL(); + + /** + * Scan next sub dir + */ + void ScanNextSubdirL(); + + /** + * Iterates iEntries adding entries as needed to object manager and + * iDirStack. + */ + void ProcessEntriesL(); + + /** + * Add a file entry to the object store + * @param aFullFileName current scanned file path + */ + void AddEntryL( const TDesC& aFullFileName ); + + /** + * Returns a TMTPFormatCode for the requested object + */ + TMTPFormatCode GetObjectFormatCode( const TDesC& aFullFileName ); + + /** + * @param aFullFileName the object file name + * @return the file if needed to be enumeratored? + */ + TBool IsFileAccepted( const TDesC& aFullFileName ); + + /** + * start count system tick + */ + void StartEnumerationCount(); + + /** + * check if the system tick more than predefined value + * @retuan if more than the predefined value, return true + * else return false + */ + TBool IsOverThreshold(); + + /** + * Get modified content and report to Symbian MTP Framework + */ + void GetModifiedContentL( const TDesC& aStorageRoot ); + +private: + // Owned + /** MMTPDataProviderFramework used to access MTP components*/ + MMTPDataProviderFramework& iFramework; + + /** MTP Object Manager */ + MMTPObjectMgr& iObjectMgr; + + /** MTP Data Provider ID */ + TUint iDataProviderId; + + CMediaMtpDataProvider& iDataProvider; + TParse iPath; + RDir iDir; + TEntryArray iEntries; + TInt iFirstUnprocessed; + RPointerArray iDirStack; + RArray iStorages; + TUint32 iStorageId; + TUint32 iParentHandle; + TMTPFormatCode iFormatCode; + TBool iScanningDir; + + // record the system tick + TUint iTickCountBegin; + TInt iTickPeriod; + +#if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) + CMmMtpDpPerfLog* iPerfLog; +#endif + + }; + +#endif // CMEDIAMTPDATAPROVIDERENUMERATOR_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataprovidergetformatcapabilities.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataprovidergetformatcapabilities.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,163 @@ +/* +* 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 CMEDIAMTPDATAPROVIDERGETFORMATCAPABILITIES_H +#define CMEDIAMTPDATAPROVIDERGETFORMATCAPABILITIES_H + +#include "cgetformatcapabilities.h" + +class CMTPTypeObjectPropDesc; +/** +* Defines media data provider GetFormatCapabilities +*/ +class CMediaMtpDataProviderGetFormatCapabilities : public CGetFormatCapabilities + { +public: + + /** + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aWrapper Medadata access + * @return A pointer to the created request processor object + */ + static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + ~CMediaMtpDataProviderGetFormatCapabilities(); + +protected: + // from CGetFormatCapabilities, override from baseclass + /** + * Service interdepent propdesc + */ + void ServiceInterdepentPropDescL(); + + /** + * Service specific object property + * @param aPropCode, The prop code + * @return MTPType object propdesc + */ + CMTPTypeObjectPropDesc* ServiceSpecificPropertyDescL( TUint16 aPropCode ); + +private: + /** + * Standard C++ Constructor + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aWrapper Medadata access + */ + CMediaMtpDataProviderGetFormatCapabilities( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * two-phase construction + */ + void ConstructL(); + + //functions used by ServiceInterdepentPropDesc + /** + * Service AudioWaveCodec + * @param aFormatCode, The format code + * @return MTPTypeInterdependentProperties + */ + CMTPTypeObjectPropDesc* ServiceAudioWaveCodecL(); + + /** + * Service AudioBitrate + * @param aFormatCode, The format code + * @return MTPTypeInterdependentProperties + */ + CMTPTypeObjectPropDesc* ServiceAudioBitrateL(); + + /** + * Service videoFourCCCodec + * @param aFormatCode, The format code + * @return MTPTypeInterdependentProperties + */ + CMTPTypeObjectPropDesc* ServiceVideoFourCCCodecL(); + + /** + * Service VideoBitrate + * @param aFormatCode, The format code + * @return MTPTypeInterdependentProperties + */ + CMTPTypeObjectPropDesc* ServiceVideoBitrateL(); + + /** + * Service RangeForm Description + * @param aMinValue The minimal value + * @param aMaxValue The maximal value + * @param aStepValue The step value + * @return MTPTypeObjectPropDescRangeForm + */ + CMTPTypeObjectPropDesc* ServiceRangeFormDescriptionL( TUint16 aPropCode, + TUint32 aMinValue, + TUint32 aMaxValue, + TUint32 aStepValue, + TBool aIsReadOnly = EFalse ); + + //functions used by ServiceSpecificObjectPropertyL + /** + * Service number of channels + * @return MTPTypeObjectPropDesc + */ + CMTPTypeObjectPropDesc* ServiceNumberOfChannelsL(); + + /** + * Service code sample rate + * @return MTPTypeObjectPropDesc + */ + CMTPTypeObjectPropDesc* ServiceCodeSampleRateL(); + + /** + * Service description + * @return MTPTypeObjectPropDesc + */ + CMTPTypeObjectPropDesc* ServiceDescriptionL(); + + /** + * Service scan type description + * @return MTPTypeObjectPropDesc + */ + CMTPTypeObjectPropDesc* ServiceScanTypeDescriptionL(); + + /** + * Service encoding profile description + * @return MTPTypeObjectPropDesc + */ + CMTPTypeObjectPropDesc* ServiceEncodingProfileDescriptionL(); + + /** + * Service DRM status + * @return MTPTypeObjectPropDesc + */ + CMTPTypeObjectPropDesc* ServiceDRMStatusL(); + + /** + * Service OMADRM status + * @return MTPTypeObjectPropDesc + */ + CMTPTypeObjectPropDesc* ServiceOMADRMStatusL(); + + + }; + +#endif // CMEDIAMTPDATAPROVIDERGETFORMATCAPABILITIES_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataprovidergetinterdependentpropdesc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataprovidergetinterdependentpropdesc.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,97 @@ +/* +* 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 CMEDIAMTPDATAPROVIDERGETINTERDEPENTENTPROPDESC_H +#define CMEDIAMTPDATAPROVIDERGETINTERDEPENTENTPROPDESC_H + +#include +#include "crequestprocessor.h" + +class CMTPTypeInterdependentPropDesc; +class CMTPTypeInterdependentProperties; +class MMmMtpDpConfig; + +/** +* Defines media data provider GetInterDependentPropDesc request processor +*/ +class CMediaMtpDataProviderGetInterDependentPropDesc: public CRequestProcessor + { +public: + /** + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aWrapper Medadata access + * @return A pointer to the created request processor object + */ + static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + ~CMediaMtpDataProviderGetInterDependentPropDesc(); + +private: + /** + * Standard C++ Constructor + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + */ + CMediaMtpDataProviderGetInterDependentPropDesc( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection ); + +protected: + // from CRequestProcessor + TMTPResponseCode CheckRequestL(); + void ServiceL(); + +private: + /** + * two-phase construction + */ + void ConstructL(); + + void ServiceAudioWaveCodecL(); + void ServiceAudioBitrateL(); + + void ServiceVideoFourCCCodecL(); + void ServiceVideoBitrateL(); + + void ServiceRangeFormDescriptionL( TUint16 aPropCode, + TUint32 aMinValue, + TUint32 aMaxValue, + TUint32 aStepValue, + TBool aIsReadOnly = EFalse); + + void SetFormForResponseL( TUint16 aPropertyCode, + CMTPTypeObjectPropDesc::TPropertyInfo& aPropInfo, + const MMTPType* aForm ); + +private: + /** Dataset to store the prop descriptions*/ + CMTPTypeInterdependentPropDesc* iDataset; + + /**support configuration correctly*/ + CMTPTypeInterdependentProperties* iProperties; + + TUint32 iFormatCode; + + }; + +#endif // CMEDIAMTPDATAPROVIDERGETINTERDEPENTENTPROPDESC_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataprovidergetobjectpropdesc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataprovidergetobjectpropdesc.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,87 @@ +/* +* 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 CMEDIAMTPDATAPROVIDERGETOBJECTPROPDESC_H +#define CMEDIAMTPDATAPROVIDERGETOBJECTPROPDESC_H + +#include "cgetobjectpropdesc.h" + +/** +* Defines media data provider GetObjectPropDesc request processor +*/ +class CMediaMtpDataProviderGetObjectPropDesc: public CGetObjectPropDesc + { +public: + + /** + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aWrapper Medadata access + * @return A pointer to the created request processor object + */ + static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + ~CMediaMtpDataProviderGetObjectPropDesc(); + +protected: + // from CGetObjectPropDesc, override from baseclass + void ServiceSpecificObjectPropertyL( TUint16 aPropCode ); + +private: + + /** + * Standard C++ Constructor + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aWrapper Medadata access + */ + CMediaMtpDataProviderGetObjectPropDesc( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + /** + * two-phase construction + */ + void ConstructL(); + + void ServiceNumberOfChannelsL(); + void ServiceCodeSampleRateL(); + void ServiceCodeWaveCodecL(); + void ServiceCodeAudioBitrateL(); + void ServiceDurationL(); + void ServiceDescriptionL(); + void ServiceScanTypeDescriptionL(); + void ServiceVideoFourCCCodecL(); + void ServiceVideoBitrateL(); + void ServiceEncodingProfileDescriptionL(); + void ServiceDRMStatusL(); + void ServiceOMADRMStatusL(); + + void ServiceRangeFormDescriptionL( TUint16 aPropCode, + TUint32 aMinValue, + TUint32 aMaxValue, + TUint32 aStepValue, + TBool aIsReadOnly = EFalse ); + + }; + +#endif // CMEDIAMTPDATAPROVIDERGETOBJECTPROPDESC_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataprovidergetobjectproplist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataprovidergetobjectproplist.h Thu Dec 17 08:55:47 2009 +0200 @@ -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: +* +*/ + + +#ifndef CMEDIAMTPDATAPROVIDERGETOBJECTPROPLIST_H +#define CMEDIAMTPDATAPROVIDERGETOBJECTPROPLIST_H + +#include"cgetobjectproplist.h" + +/** +* Defines media data provider GetObjectPropList request processor +*/ +class CMediaMtpDataProviderGetObjectPropList: public CGetObjectPropList + { +public: + /** + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aWrapper Medadata access + * @return A pointer to the created request processor object + */ + static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + ~CMediaMtpDataProviderGetObjectPropList(); + +private: + /** + * Standard C++ Constructor + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aWrapper Medadata access + */ + CMediaMtpDataProviderGetObjectPropList( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * 2nd Phase Constructor + */ + void ConstructL(); + +protected: + // from CGetObjectPropList + TInt ServiceSpecificObjectPropertyL( TUint16 aPropCode, TUint32 aHandle ); + + }; + +#endif // CMEDIAMTPDATAPROVIDERGETOBJECTPROPLIST_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataprovidergetobjectpropvalue.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataprovidergetobjectpropvalue.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,70 @@ +/* +* 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 CMEDIAMTPDATAPROVIDERGETOBJECTPROPVALUE_H +#define CMEDIAMTPDATAPROVIDERGETOBJECTPROPVALUE_H + +#include "cgetobjectpropvalue.h" + +class MMmMtpDpConfig; + +/** +* Defines media data provider GetObjectPropValue request processor +*/ +class CMediaMtpDataProviderGetObjectPropValue: public CGetObjectPropValue + { +public: + /** + * Two-phase construction method + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper Medadata access + * @return a pointer to the created request processor object + */ + static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + ~CMediaMtpDataProviderGetObjectPropValue(); + +protected: + // from CGetObjectPropValue + void ServiceSpecificObjectPropertyL( TUint16 aPropCode ); + +private: + /** + * Standard c++ constructor + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper Medadata access + */ + CMediaMtpDataProviderGetObjectPropValue( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * two-phase construction + */ + void ConstructL(); + + }; + +#endif // CMEDIAMTPDATAPROVIDERGETOBJECTPROPVALUE_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataprovidermoveobject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataprovidermoveobject.h Thu Dec 17 08:55:47 2009 +0200 @@ -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: +* +*/ + + +#ifndef CMEDIAMTPDATAPROVIDERMOVEOBJECT_H +#define CMEDIAMTPDATAPROVIDERMOVEOBJECT_H + +#include "cmoveobject.h" + +class MMmMtpDpConfig; + +/** +* Defines media data provider MoveObject request processor +*/ +class CMediaMtpDataProviderMoveObject: public CMoveObject + { +public: + /** + * Two-phase construction method + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper Medadata access + * @return a pointer to the created request processor object + */ + static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + ~CMediaMtpDataProviderMoveObject(); + +private: + /** + * Standard c++ constructor + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper Medadata access + */ + CMediaMtpDataProviderMoveObject( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * two-phase construction + */ + void ConstructL(); + +protected: + + void ServiceGetSpecificObjectPropertyL( TUint16 aPropCode, + TUint32 aHandle, + const CMTPObjectMetaData& aObject ); + + TMTPResponseCode ServiceSetSpecificObjectPropertyL( TUint16 aPropCode, + const CMTPObjectMetaData& aObject, + const CMTPTypeObjectPropListElement& aElement ); + + }; + +#endif // CMEDIAMTPDATAPROVIDERMOVEOBJECT_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataprovidersendobject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataprovidersendobject.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,74 @@ +/* +* 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 CMEDIAMTPDATAPROVIDERSENDOBJECT_H_ +#define CMEDIAMTPDATAPROVIDERSENDOBJECT_H_ + +#include "csendobject.h" + +/** +* Defines media data provider SetObjectPropsList request processor +*/ +class CMediaMtpDataProviderSendObject: public CSendObject + { +public: + /** + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aWrapper Medadata access + * @return A pointer to the created request processor object + */ + static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + ~CMediaMtpDataProviderSendObject(); + +private: + /** + * Standard C++ Constructor + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aWrapper Medadata access + */ + CMediaMtpDataProviderSendObject( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * 2nd Phase Constructor + */ + void ConstructL(); + +protected: + // from CSendObject + TMTPResponseCode SetSpecificObjectPropertyL( TUint16 aPropCode, + const CMTPObjectMetaData& aObject, + const CMTPTypeObjectPropListElement& aElement ); + + TMTPResponseCode CheckSepecificPropType( TUint16 aPropCode, TUint16 aDataType ); + + TInt HandleSpecificWrapperError(TInt aError, + const CMTPObjectMetaData& aObject); + + }; + + +#endif /*CMEDIAMTPDATAPROVIDERSENDOBJECT_H_*/ diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataprovidersetobjectproplist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataprovidersetobjectproplist.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,71 @@ +/* +* 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 CMEDIAMTPDATAPROVIDERSETOBJECTPROPLIST_H +#define CMEDIAMTPDATAPROVIDERSETOBJECTPROPLIST_H + +#include"csetobjectproplist.h" + +/** +* Defines media data provider SetObjectPropsList request processor +*/ +class CMediaMtpDataProviderSetObjectPropList: public CSetObjectPropList + { +public: + /** + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aWrapper Medadata access + * @return A pointer to the created request processor object + */ + static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + ~CMediaMtpDataProviderSetObjectPropList(); + +private: + /** + * Standard C++ Constructor + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aWrapper Medadata access + */ + CMediaMtpDataProviderSetObjectPropList( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * 2nd Phase Constructor + */ + void ConstructL(); + +protected: + // from CSetObjectPropList + TMTPResponseCode ServiceSpecificObjectPropertyL( TUint16 aPropCode, + const CMTPObjectMetaData& aObject, + const CMTPTypeObjectPropListElement& aElement ); + + TInt HandleSpecificWrapperError( TInt aError, + const CMTPObjectMetaData& aObject); + + }; + +#endif // CMEDIAMTPDATAPROVIDERGETOBJECTPROPLIST_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataprovidersetobjectpropvalue.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataprovidersetobjectpropvalue.h Thu Dec 17 08:55:47 2009 +0200 @@ -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: +* +*/ + + +#ifndef CMEDIAMTPDATAPROVIDERSETOBJECTPROPVALUE_H +#define CMEDIAMTPDATAPROVIDERSETOBJECTPROPVALUE_H + +#include "csetobjectpropvalue.h" + +/** +* Defines media data provider SetObjectPropValue request processor +*/ +class CMediaMtpDataProviderSetObjectPropValue: public CSetObjectPropValue + { +public: + /** + * Two-phase construction method + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper Medadata access + * @return a pointer to the created request processor object + */ + static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + ~CMediaMtpDataProviderSetObjectPropValue(); + +private: + /** + * Standard c++ constructor + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper Medadata access + */ + CMediaMtpDataProviderSetObjectPropValue( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * two-phase construction + */ + void ConstructL(); + +protected: + // from CSetObjectPropValue + TBool IsSpecificPropCodeReadOnly( TUint16 aPropCode ) const; + + void ReceiveDataSpecificObjectPropertyL( TUint16 aPropCode ); + + TMTPResponseCode ServiceSpecificObjectPropertyL( TUint16 aPropCode ); + + }; + +#endif // CMEDIAMTPDATAPROVIDERSETOBJECTPROPVALUE_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/mediamtpdataprovider_config.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/mediamtpdataprovider_config.rh Thu Dec 17 08:55:47 2009 +0200 @@ -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: Resource headers for project media mtp data provider +* +*/ + + +#ifndef MEDIAMTPDATAPROVIDER_RH +#define MEDIAMTPDATAPROVIDER_RH + +// -------------------------------------------------------------------- +// Defines the resource type for media mtp data provider specific configuration data +// -------------------------------------------------------------------- +// +STRUCT MEDIAMTPDATAPROVIDE_CONFIG + { + LONG media_drive; // Symbian drive number @see TDrive + LTEXT media_folder_root; + LTEXT folder_exclusion_list[]; // What to exclude + } + +#endif // MEDIAMTPDATAPROVIDER_RH diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/mediamtpdataproviderconst.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/mediamtpdataproviderconst.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,240 @@ +/* +* 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 MEDIAMTPDATAPROVIDERCONST_H +#define MEDIAMTPDATAPROVIDERCONST_H + +#include + +#include "tobjectdescription.h" + +_LIT( KMTPTxtColon, ":" ); + +/** Granularity of the drive list*/ +const TInt KMtpMaxStringLength = 255; + +enum TMmMtpNumberOfChannels + { + EMTPChannelMono = 0x0001, + EMTPChannelStereo = 0x0002 + }; + +enum TMmMtpSampleRateValue + { + EMTPSampleRate8K = 0x00001F40, + EMTPSampleRate16K = 0x00003E80, + EMTPSampleRate22_05K = 0x00005622, + EMTPSampleRate24K = 0x00005DC0, + EMTPSampleRate32K = 0x00007D00, + EMTPSampleRate44_1K = 0x0000AC44, + EMTPSampleRate48K = 0x0000BB80 + }; + +// WAVECodec value +enum TMmMtpWAVECodecValue + { + EMTPAudioWAVECodecMP3 = 0x00000055, + EMTPAudioWAVECodecWMA = 0x00000161, + EMTPAudioWAVECodecAAC = 0x0000A106, + EMTPAudioWAVECodecPCM = 0x00000001 + }; + +// Bitrate value scope +enum TMmMtpBitrateValue + { + EMTPMP3MinBitrate = 0x00001F40, //8 kbps + EMTPMP3MaxBitrate = 0x0004E200, //320 kbps + EMTPWMAMinBitrate = 0x00001388, //5 kbps + EMTPWMAMaxBitrate = 0x0004E200, //320 kbps + EMTPAACMinBitrate = 0x00001F40, //8 kbps + EMTPAACMaxBitrate = 0x0004E200, //320 kbps + EMTPPCMMinBitrate = 0x00003E80, //16 kbps + EMTPPCMMaxBitrate = 0x00177000, //1536 kbps + EMTPAACPlusMinBitrate = 0x00003E80, //16 kbps + EMTPAACPlusMaxBitrate = 0x0008CA00, //576 kbps + EMTPAudioBitrateStep = 0x00000001 + }; + +enum TMmMtpDuration + { + EMTPMinDuration = 0x00000000, + EMTPMaxDuration = 0xFFFFFFFF, + EMTPDurationStep = 0x00000001 + }; + +enum TMmMtpWidthRange + { + EMTPMinWidth = 0x000000b0, // 176 pixels + EMTPMaxWidth = 0x00000140, // 320 pixels + EMTPStepWidth = 0x00000001, + }; + +enum TMmMtpHeightRange + { + EMTPMinHeight = 0x00000090, // 144 pixels + EMTPMaxHeight = 0x000000F0, // 240 pixels + EMTPStepHeight = 0x00000001, + }; + +enum TMmMtpVideoBitRateRange + { + EMTPWMVMinBitrate = 0x00000000, + EMTPWMVMaxBitrate = 0x0005dc00, // 384 kbps + EMTPVideoBitrateStep = 0x00000001 + }; + +enum TMmMtpScanType + { + EMTPScanTypeProgressive = 0x0001 + }; + +enum TMmMtpVideoFourCCCodec + { + EMTPVideoFourCCCodecWMV3 = 0x33564d57/*, // this is intended, please keep it like this, comment out asf fourcc for mp2a and mp4a, not sure if this is needed + EMTPVideoFourCCCodecMP2A = 0x4D503241, + EMTPVideoFourCCCodecMP4A = 0x4D503441*/ + }; + +enum TMmMtpFramesPerThousandSecondsRange + { + EMTPMinFramesPerThousandSeconds = 0x00000000, + EMTPMaxFramesPerThousandSeconds = 0x00003a98, // 15000 frame per ms + EMTPStepFramesPerThousandSeconds = 0x00000001 + }; + +enum TMmMtpKeyFrameDistanceRange + { + EMTPMinKeyFrameDistance = 0x00000000, + EMTPMaxKeyFrameDistance = 0x00003a98, // 15000 ms + EMTPStepKeyFrameDistance = 0x00000001 + }; + +enum TMmMtpDrmPropertyValues + { + EMTPDrmNoProtection = 0x0000, + EMTPDrmProtection = 0x0001, + EMTPDrmReserveForMTP = 0x4000, + EMTPDrmVenderExtension = 0x4001 + }; + +enum TMmMtpOMADrmPropertyValues + { + EMTPOMADrmNoProtection = 0x00, + EMTPOMADrmProtection = 0x01 + }; + +/** +* define all the operations that are supported by the media mtp data provider +*/ +static const TUint16 KMediaMtpDataProviderSupportedFormats[] = + { + EMTPFormatCodeMP3, +#ifdef __WINDOWS_MEDIA + EMTPFormatCodeWMA, +#endif + EMTPFormatCodeMP4Container, + EMTPFormatCode3GPContainer, + EMTPFormatCodeAAC, + EMTPFormatCodeWAV, +#ifdef __WINDOWS_MEDIA + EMTPFormatCodeWMV, + EMTPFormatCodeASF +#endif + }; + +/** +* define all the operations that are supported by the media mtp data provider +*/ +static const TUint16 KMediaMtpDataProviderSupportedOperations[] = + { + // basic mode + EMTPOpCodeGetObjectInfo, + EMTPOpCodeGetObject, + EMTPOpCodeDeleteObject, + EMTPOpCodeSendObjectInfo, + EMTPOpCodeSendObject, + EMTPOpCodeMoveObject, + EMTPOpCodeCopyObject, + EMTPOpCodeGetPartialObject, + EMTPOpCodeGetObjectPropsSupported, + EMTPOpCodeGetObjectPropDesc, + EMTPOpCodeGetObjectPropValue, + EMTPOpCodeSetObjectPropValue, + + // enhanced mode + EMTPOpCodeGetObjectPropList, + EMTPOpCodeSetObjectPropList, + EMTPOpCodeGetInterdependentPropDesc, + EMTPOpCodeSendObjectPropList, + EMTPOpCodeGetFormatCapabilities + }; + +// Mandatory for audio formats +static const TUint16 KMmMtpDpSupportedPropMandatoryAudio[] = + { + EMTPObjectPropCodeArtist, + EMTPObjectPropCodeTrack, + EMTPObjectPropCodeGenre, + EMTPObjectPropCodeAlbumName, + EMTPObjectPropCodeSampleRate, + EMTPObjectPropCodeNumberOfChannels, + EMTPObjectPropCodeAudioWAVECodec, + EMTPObjectPropCodeAudioBitRate, + }; + +// Additional for audio formats +static const TUint16 KMmMtpDpSupportedPropAdditionalAudio[] = + { + EMTPObjectPropCodeDuration, + EMTPObjectPropCodeOriginalReleaseDate, + EMTPObjectPropCodeDescription, + EMTPObjectPropCodeComposer, + EMTPObjectPropCodeDRMStatus, + EMTPExtObjectPropCodeOmaDrmStatus, + }; + +// Mandatory properties for WMV/ASF +static const TUint16 KMmMtpDpSupportedPropMandatoryWMV[] = + { + EMTPObjectPropCodeWidth, + EMTPObjectPropCodeHeight, + EMTPObjectPropCodeDuration, + EMTPObjectPropCodeGenre, + EMTPObjectPropCodeUseCount, + EMTPObjectPropCodeSampleRate, + EMTPObjectPropCodeNumberOfChannels, + EMTPObjectPropCodeScanType, + EMTPObjectPropCodeAudioWAVECodec, + EMTPObjectPropCodeAudioBitRate, + EMTPObjectPropCodeVideoFourCCCodec, + EMTPObjectPropCodeVideoBitRate, + EMTPObjectPropCodeFramesPerThousandSeconds, + EMTPObjectPropCodeKeyFrameDistance, + EMTPObjectPropCodeEncodingProfile, + }; + +// Additional for WMV/ASF +static const TUint16 KMmMtpDpSupportedPropAdditionalWMV[] = + { + EMTPObjectPropCodeParentalRating, + EMTPObjectPropCodeDRMStatus, + EMTPExtObjectPropCodeOmaDrmStatus, + }; + + +#endif // MEDIAMTPDATAPROVIDERCONST_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/mediamtpdataproviderprocessor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/mediamtpdataproviderprocessor.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,62 @@ +/* +* 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 MEDIAMTPDATAPROVIDERPROCESSOR_H +#define MEDIAMTPDATAPROVIDERPROCESSOR_H + +#include "crequestprocessor.h" + +// class forward +class MMTPConnection; +class TMTPTypeRequest; +class CMTPDataProviderPlugin; +class MMTPDataProviderFramework; +class MMTPRequestProcessor; +class CMediaMtpDataProvider; +class MMmMtpDpConfig; + +typedef MMmRequestProcessor* ( *TMediaMtpDataProviderRequestProcessorCreateFunc )( + MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + +typedef struct + { + TUint16 iOperationCode; + TMediaMtpDataProviderRequestProcessorCreateFunc iCreateFunc; + } TMediaMtpDataProviderRequestProcessorEntry; + +class MediaMtpDataProviderProcessor + { +public: + /** + * Create a request processor that matches the request + * @param aFramework The reference to the data provider framework + * @param aRequest The request to be processed + * @param aConnection The connection from which the request comes from + * @param aDpConfig Dp configurations + * @return a pointer to the request processor + */ + static MMmRequestProcessor* CreateL( MMTPDataProviderFramework& aFramework, + const TMTPTypeRequest& aRequest, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + }; + +#endif // MEDIAMTPDATAPROVIDERPROCESSOR_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataprovider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataprovider.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,720 @@ +/* +* 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: media mtp data provider +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cmediamtpdataprovider.h" +#include "mediamtpdataproviderconst.h" +#include "cmediamtpdataproviderenumerator.h" +#include "mmmtpdplogger.h" +#include "tmmmtpdppanic.h" +#include "cmmmtpdpaccesssingleton.h" +#include "cmmmtpdpmetadataaccesswrapper.h" +#include "mmmtpdputility.h" +#include "crenameobject.h" +#include "mmmtpdpdefs.h" +#include "mmmtpdpfiledefs.h" + +// Class constants. +// Defines the number of MTP Active Processors allowed +static const TInt KMediaMtpDataProviderSessionGranularity = 3; +static const TInt KMediaMtpDpArrayGranularity = 2; + +static const TInt KActiveEnumeration = 0; +_LIT( KMediaMtpDataProviderExtension1, "microsoft.com/WMPPD: 11.0" ); +_LIT( KMediaMtpDataProviderExtension2, "vodafone.com/omadrmv2: 1.0" ); + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProvider::NewL +// Two Phase Construction +// ----------------------------------------------------------------------------- +// +TAny* CMediaMtpDataProvider::NewL( TAny* aParams ) + { + CMediaMtpDataProvider* self = new ( ELeave ) CMediaMtpDataProvider( aParams ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProvider::CMediaMtpDataProvider +// Standard C++ constructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProvider::CMediaMtpDataProvider( TAny* aParams ) : + CMTPDataProviderPlugin( aParams ), + iActiveProcessors( KMediaMtpDataProviderSessionGranularity ), + iMediaEnumerator( NULL ), + iPendingEnumerations ( KMediaMtpDpArrayGranularity ), + iActiveProcessor( -1 ), + iRenameObject( NULL ), + iSupportedFormat( KMediaMtpDpArrayGranularity ), + iSupportedPropAudio( KMediaMtpDpArrayGranularity ), + iSupportedPropVideo( KMediaMtpDpArrayGranularity ), + iSupportedPropAll( KMediaMtpDpArrayGranularity ) + { + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProvider::~CMediaMtpDataProvider +// Destructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProvider::~CMediaMtpDataProvider() + { + PRINT( _L( "MM MTP => CMediaMtpDataProvider::~CMediaMtpDataProvider" ) ); + + CMmMtpDpAccessSingleton::Release(); + delete iMediaEnumerator; + + iPendingEnumerations.Close(); + TInt count = iActiveProcessors.Count(); + for ( TInt i = 0; i < count; i++ ) + { + iActiveProcessors[i]->Release(); + } + iActiveProcessors.Close(); + + if ( iRenameObject ) + delete iRenameObject; + + iSupportedFormat.Close(); + iSupportedPropAudio.Close(); + iSupportedPropVideo.Close(); + iSupportedPropAll.Close(); + + PRINT( _L( "MM MTP <= CMediaMtpDataProvider::~CMediaMtpDataProvider" ) ); + } + +void CMediaMtpDataProvider::Cancel() + { + iMediaEnumerator->Cancel(); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProvider::ConstructL +// Second-phase construction +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProvider::ConstructL() + { + PRINT( _L( "MM MTP => CMediaMtpDataProvider::ConstructL" ) ); + + iMediaEnumerator = CMediaMtpDataProviderEnumerator::NewL( Framework(), *this ); + + CMmMtpDpAccessSingleton::CreateL( Framework().Fs(), Framework() ); + + GetSupportedFormatL(); + GetSupportedPropL(); + GetAllSupportedPropL(); + + PRINT( _L( "MM MTP <= CMediaMtpDataProvider::ConstructL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProvider::ProcessEventL +// Process event from initiator +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProvider::ProcessEventL( const TMTPTypeEvent& aEvent, + MMTPConnection& aConnection ) + { + TInt index = LocateRequestProcessorL( aEvent, aConnection ); + if ( index != KErrNotFound ) + { + iActiveProcessors[index]->HandleEventL( aEvent ); + } + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProvider::ProcessNotificationL +// Process notification from initiator +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProvider::ProcessNotificationL( TMTPNotification aNotification, + const TAny* aParams ) + { + switch ( aNotification ) + { + case EMTPSessionClosed: + PRINT( _L( "MM MTP <> CMediaMtpDataProvider::ProcessNotificationL EMTPSessionClosed event recvd" ) ); + + SessionClosedL( *reinterpret_cast ( aParams ) ); + break; + + case EMTPSessionOpened: + PRINT( _L( "MM MTP <> CMediaMtpDataProvider::ProcessNotificationL EMTPSessionOpened event recvd" ) ); + + SessionOpenedL( *reinterpret_cast ( aParams ) ); + break; + + case EMTPStorageAdded: + break; + + case EMTPStorageRemoved: + break; + + case EMTPRenameObject: + PRINT( _L( "MM MTP <> CMediaMtpDataProvider::ProcessNotificationL EMTPRenameObject event recvd" ) ); + RenameObjectL( *reinterpret_cast ( aParams ) ); + break; + + default: + PRINT( _L( "MM MTP <> CMediaMtpDataProvider::ProcessNotificationL default" ) ); + // Ignore all other notifications. + break; + } + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProvider::ProcessRequestPhaseL +// Process the request from initiator +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProvider::ProcessRequestPhaseL( TMTPTransactionPhase aPhase, + const TMTPTypeRequest& aRequest, + MMTPConnection& aConnection ) + { + TInt index = LocateRequestProcessorL( aRequest, aConnection ); + + __ASSERT_DEBUG( index != KErrNotFound, Panic(EMmMTPDpNoMatchingProcessor) ); + + MMmRequestProcessor* processor = iActiveProcessors[index]; + iActiveProcessor = index; + // iActiveProcessorRemoved = EFalse; + TBool result = processor->HandleRequestL( aRequest, aPhase ); + + if( !iIsSessionOpen ) + { + processor->Release(); + } + + else if ( result ) // destroy the processor + { + processor->Release(); + iActiveProcessors.Remove( index ); + } + iActiveProcessor = -1; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProvider::SessionClosedL +// Notify the data provider that the session has been closed +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProvider::SessionClosedL( const TMTPNotificationParamsSessionChange& aSession ) + { + iIsSessionOpen = EFalse; + TInt count = iActiveProcessors.Count(); + PRINT1( _L( "MM MTP => CMediaMtpDataProvider::SessionClosedL, total processor count = %d" ), count ); + for( TInt i = 0; i < count; i++ ) + { + MMmRequestProcessor* processor = iActiveProcessors[i]; + + // replaced for the Request() is invalid sometimes + // TUint32 sessionId( processor->Request().Uint32( TMTPTypeRequest::ERequestSessionID ) ); + TUint32 sessionId = processor->SessionId(); + + if ( ( sessionId == aSession.iMTPId ) + && ( processor->Connection().ConnectionId() + == aSession.iConnection.ConnectionId() ) ) + { + processor->UsbDisconnect(); // Rollback + + iActiveProcessors.Remove( i ); + processor->Release(); + } + } + + // introduce to cleanup DBs at each close session + iMediaEnumerator->SessionClosedL(); + PRINT( _L( "MM MTP <= CMediaMtpDataProvider::SessionClosedL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProvider::SessionOpenedL +// Open Session operation +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProvider::SessionOpenedL( const TMTPNotificationParamsSessionChange& /*aSession*/) + { + CMmMtpDpAccessSingleton::OpenSessionL(); + iIsSessionOpen = ETrue; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProvider::RenameObjectL +// Process the changed folder +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProvider::RenameObjectL( const TMTPNotificationParamsHandle& aObject ) + { + PRINT2( _L( "MM MTP => CMediaMtpDataProvider::RenameObjectL folder handle=0x%x, modified name=%S" ), aObject.iHandleId, &(aObject.iFileName) ); + + if ( !iRenameObject ) + { + iRenameObject = CRenameObject::NewL( Framework(), GetWrapperL() ); + } + + iRenameObject->StartL( aObject.iHandleId, aObject.iFileName ); + + PRINT( _L( "MM MTP <= CMediaMtpDataProvider::RenameObjectL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProvider::StartObjectEnumerationL +// Start object enumeration +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProvider::StartObjectEnumerationL( TUint32 aStorageId ) + { + iPendingEnumerations.AppendL( aStorageId ); + + if ( iPendingEnumerations.Count() > 0 ) + { + iMediaEnumerator->StartL( iPendingEnumerations[KActiveEnumeration] ); + } + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProvider::StartStorageEnumerationL +// Start Storage enumeration +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProvider::StartStorageEnumerationL() + { + Framework().StorageEnumerationCompleteL(); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProvider::Supported +// Defines the supported operations and formats of the data provider +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProvider::Supported( TMTPSupportCategory aCategory, + RArray& aArray ) const + { + switch ( aCategory ) + { + case EEvents: + break; + + case EObjectCaptureFormats: + case EObjectPlaybackFormats: + { + TInt count = sizeof( KMediaMtpDataProviderSupportedFormats ) / sizeof( TUint16 ); + for ( TInt i = 0; i < count; i++ ) + { + aArray.Append( KMediaMtpDataProviderSupportedFormats[i] ); + } + PRINT1( _L( "MM MTP <> CMediaMtpDataProvider::Supported format count = %d" ), count ); + } + break; + + case EOperations: + { + TInt count = sizeof( KMediaMtpDataProviderSupportedOperations ) / sizeof( TUint16 ); + + for ( TInt i = 0; i < count; i++ ) + { + aArray.Append( KMediaMtpDataProviderSupportedOperations[i] ); + } + PRINT1( _L( "MM MTP <> CMediaMtpDataProvider::Supported operation count = %d" ), count ); + } + break; + + case EObjectProperties: + { + TInt count = iSupportedPropAll.Count(); + + for ( TInt i = 0; i < count; i++ ) + { + aArray.Append( iSupportedPropAll[i] ); + } + PRINT1( _L( "MM MTP <> CMediaMtpDataProvider::Supported properties count = %d" ), aArray.Count() ); + } + break; + + case EStorageSystemTypes: + { + aArray.Append( CMTPStorageMetaData::ESystemTypeDefaultFileSystem ); + } + break; + + default: + // Unrecognised category, leave aArray unmodified. + break; + } + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProvider::SupportedL +// Defines the supported operations and formats of the data provider +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProvider::SupportedL( TMTPSupportCategory aCategory, + CDesCArray& aStrings ) const + { + if ( aCategory == EVendorExtensionSets ) + { + aStrings.AppendL( KMediaMtpDataProviderExtension1 ); + aStrings.AppendL( KMediaMtpDataProviderExtension2 ); + } + else if( aCategory == EFormatExtensionSets ) + { + //EMTPFormatCodeMP3, + aStrings.AppendL(KFormatExtensionMP3); + + #ifdef __WINDOWS_MEDIA + //EMTPFormatCodeWMA, + aStrings.AppendL(KFormatExtensionWMA); + #endif + + //EMTPFormatCodeMP4Container, + aStrings.AppendL(KFormatExtensionMP4); + aStrings.AppendL(KFormatExtensionM4A); + + //EMTPFormatCode3GPContainer, + aStrings.AppendL(KFormatExtension3GP); + + //EMTPFormatCodeAAC, + aStrings.AppendL(KFormatExtensionAAC); + + //EMTPFormatCodeWAV, + aStrings.AppendL(KFormatExtensionWAV); + #ifdef __WINDOWS_MEDIA + //EMTPFormatCodeWMV, + aStrings.AppendL(KFormatExtensionWMV); + + //EMTPFormatCodeASF + aStrings.AppendL(KFormatExtensionASF); + #endif + //ODF container + aStrings.AppendL(KFormatExtensionODFAudio3GPP); + aStrings.AppendL(KFormatExtensionODFAudioMP4); + aStrings.AppendL(KFormatExtensionODFVideo3GPP); + aStrings.AppendL(KFormatExtensionODFVideoMP4); + + aStrings.AppendL(KFormatExtensionO4A); + aStrings.AppendL(KFormatExtensionO4V); + + } + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProvider::NotifyEnumerationCompleteL +// enumeration completed +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProvider::NotifyEnumerationCompleteL( TUint32 /*aStorageId*/, + TInt /*aError*/ ) + { + Framework().ObjectEnumerationCompleteL( iPendingEnumerations[KActiveEnumeration] ); + iPendingEnumerations.Remove( KActiveEnumeration ); + if ( iPendingEnumerations.Count() ) + { + iMediaEnumerator->StartL( iPendingEnumerations[KActiveEnumeration] ); + } + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProvider::LocateRequestProcessorL +// Find or create a request processor that can process the request +// ----------------------------------------------------------------------------- +// +TInt CMediaMtpDataProvider::LocateRequestProcessorL( const TMTPTypeRequest& aRequest, + MMTPConnection& aConnection ) + { + TInt index = KErrNotFound; + TInt count = iActiveProcessors.Count(); + for ( TInt i = 0; i < count; i++ ) + { + if ( iActiveProcessors[i]->Match( aRequest, aConnection ) ) + { + index = i; + break; + } + } + if ( index == KErrNotFound ) + { + MMmRequestProcessor* processor = + MediaMtpDataProviderProcessor::CreateL( Framework(), + aRequest, + aConnection, + *this ); + + CleanupReleasePushL( *processor ); + iActiveProcessors.AppendL( processor ); + CleanupStack::Pop( processor ); + index = count; + } + + return index; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProvider::LocateRequestProcessorL +// Find or create a request processor that can process the event +// ----------------------------------------------------------------------------- +// +TInt CMediaMtpDataProvider::LocateRequestProcessorL( const TMTPTypeEvent& aEvent, + MMTPConnection& aConnection ) + { + TInt index = KErrNotFound; + TInt count = iActiveProcessors.Count(); + for ( TInt i = 0; i < count; i++ ) + { + if ( iActiveProcessors[i]->Match( aEvent, aConnection ) ) + { + index = i; + break; + } + } + + return index; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProvider::GetWrapper +// return the reference of CMmMtpDpMetadataAccessWrapper to enumerator +// ----------------------------------------------------------------------------- +// +CMmMtpDpMetadataAccessWrapper& CMediaMtpDataProvider::GetWrapperL() + { + return CMmMtpDpAccessSingleton::GetAccessWrapperL(); + } + +// --------------------------------------------------------------------------- +// CMediaMtpDataProvider::GetSupportedFormat +// +// --------------------------------------------------------------------------- +// +const RArray* CMediaMtpDataProvider::GetSupportedFormat() const + { + PRINT1( _L( "MM MTP <> CMediaMtpDataProvider::GetSupportedFormat, count = %d" ), iSupportedFormat.Count() ); + return &iSupportedFormat; + } + +void CMediaMtpDataProvider::GetSupportedFormatL() + { + iSupportedFormat.Reset(); + + TInt count = sizeof ( KMediaMtpDataProviderSupportedFormats ) / sizeof( TUint16 ); + for ( TInt i = 0; i < count; i++ ) + { + InsertL( iSupportedFormat, KMediaMtpDataProviderSupportedFormats[i] ); + } + } + +const RArray* CMediaMtpDataProvider::GetSupportedPropertiesL( TUint32 aFormatCode ) const + { + switch ( aFormatCode ) + { + case EMTPFormatCodeWMA: + case EMTPFormatCodeMP3: + case EMTPFormatCodeAAC: + case EMTPFormatCodeWAV: + case EMTPFormatCodeMP4Container: + case EMTPFormatCode3GPContainer: + return &iSupportedPropAudio; + + case EMTPFormatCodeWMV: + case EMTPFormatCodeASF: + return &iSupportedPropVideo; + + default: + { + User::Leave( KErrNotSupported ); + } + } + // should never run to this line, just for avoiding warning. + return NULL; + } + +// --------------------------------------------------------------------------- +// CMediaMtpDataProvider::GetSupportedPropL +// +// --------------------------------------------------------------------------- +// +void CMediaMtpDataProvider::GetSupportedPropL() + { + iSupportedPropAudio.Reset(); + iSupportedPropVideo.Reset(); + + TInt count = 0, i = 0; + count = sizeof( KMmMtpDpSupportedPropMandatoryAll ) / sizeof( TUint16 ); + for ( i = 0; i < count; i++ ) + { + InsertL( iSupportedPropAudio, KMmMtpDpSupportedPropMandatoryAll[i] ); + InsertL( iSupportedPropVideo, KMmMtpDpSupportedPropMandatoryAll[i] ); + + } + + count = sizeof( KMmMtpDpSupportedPropAdditionalAll ) / sizeof( TUint16 ); + for ( i = 0; i < count; i++ ) + { + InsertL( iSupportedPropAudio, KMmMtpDpSupportedPropAdditionalAll[i] ); + InsertL( iSupportedPropVideo, KMmMtpDpSupportedPropAdditionalAll[i] ); + } + + for ( TInt j = 0; j < iSupportedFormat.Count(); j++ ) + { + switch ( iSupportedFormat[j] ) + { + case EMTPFormatCodeWMA: + case EMTPFormatCodeMP3: + case EMTPFormatCodeAAC: + case EMTPFormatCodeWAV: + case EMTPFormatCodeMP4Container: + case EMTPFormatCode3GPContainer: + { + count = sizeof ( KMmMtpDpSupportedPropMandatoryAudio ) / sizeof( TUint16 ); + for ( i = 0; i < count; i++ ) + { + InsertL( iSupportedPropAudio, KMmMtpDpSupportedPropMandatoryAudio[i] ); + } + + count = sizeof ( KMmMtpDpSupportedPropAdditionalAudio ) / sizeof(TUint16); + for ( i = 0; i < count; i++ ) + { + InsertL( iSupportedPropAudio, KMmMtpDpSupportedPropAdditionalAudio[i] ); + } + } + break; + + case EMTPFormatCodeWMV: + case EMTPFormatCodeASF: + { + count = sizeof ( KMmMtpDpSupportedPropMandatoryWMV ) / sizeof(TUint16); + for ( i = 0; i < count; i++ ) + { + InsertL( iSupportedPropVideo, KMmMtpDpSupportedPropMandatoryWMV[i] ); + } + + count = sizeof ( KMmMtpDpSupportedPropAdditionalWMV ) / sizeof(TUint16); + for ( i = 0; i < count; i++ ) + { + InsertL( iSupportedPropVideo, KMmMtpDpSupportedPropAdditionalWMV[i] ); + } + } + break; + + default: + { + // shouldn't happen + User::Leave( KErrNotSupported ); + } + break; + } + } + } + +// --------------------------------------------------------------------------- +// CMediaMtpDataProvider::GetAllSupportedProperties +// +// --------------------------------------------------------------------------- +// +const RArray* CMediaMtpDataProvider::GetAllSupportedProperties() const + { + return &iSupportedPropAll; + } + +void CMediaMtpDataProvider::GetAllSupportedPropL() + { + iSupportedPropAll.Reset(); + + TInt i = 0; + TInt count = sizeof( KMmMtpDpSupportedPropMandatoryAll ) / sizeof( TUint16 ); + for ( i = 0; i < count; i++ ) + InsertL( iSupportedPropAll, KMmMtpDpSupportedPropMandatoryAll[i] ); + + count = sizeof ( KMmMtpDpSupportedPropAdditionalAll ) / sizeof(TUint16); + for ( i = 0; i < count; i++ ) + InsertL( iSupportedPropAll, KMmMtpDpSupportedPropAdditionalAll[i] ); + + count = sizeof ( KMmMtpDpSupportedPropMandatoryAudio ) / sizeof(TUint16); + for ( i = 0; i < count; i++ ) + InsertL( iSupportedPropAll, KMmMtpDpSupportedPropMandatoryAudio[i] ); + + count = sizeof ( KMmMtpDpSupportedPropAdditionalAudio ) / sizeof(TUint16); + for ( i = 0; i < count; i++ ) + InsertL( iSupportedPropAll, KMmMtpDpSupportedPropAdditionalAudio[i] ); + + count = sizeof ( KMmMtpDpSupportedPropMandatoryWMV ) / sizeof(TUint16); + for ( i = 0; i < count; i++ ) + InsertL( iSupportedPropAll, KMmMtpDpSupportedPropMandatoryWMV[i] ); + + count = sizeof ( KMmMtpDpSupportedPropAdditionalWMV ) / sizeof(TUint16); + for ( i = 0; i < count; i++ ) + InsertL( iSupportedPropAll, KMmMtpDpSupportedPropAdditionalWMV[i] ); + } + +// --------------------------------------------------------------------------- +// CMediaMtpDataProvider::GetDefaultStorageIdL +// +// --------------------------------------------------------------------------- +// +TUint32 CMediaMtpDataProvider::GetDefaultStorageIdL() const + { + TInt driveNum = -1; + TInt err = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, driveNum ); + PRINT2( _L( "MM MTP <> GetDefaultDrive, driveNum = %d, err = %d" ), driveNum, err ); + + TDriveInfo driveInfo; + User::LeaveIfError( Framework().Fs().Drive( driveInfo, driveNum ) ); + PRINT3( _L( "driveInfo.iType = 0x%x, driveInfo.iDriveAtt = 0x%x, driveInfo.iMediaAtt = 0x%x" ), + driveInfo.iType, driveInfo.iDriveAtt, driveInfo.iMediaAtt ); + if( driveInfo.iType == EMediaNotPresent || driveInfo.iType == EMediaUnknown ) + { + err = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, driveNum ); + User::LeaveIfError( Framework().Fs().Drive( driveInfo, driveNum ) ); + if( driveInfo.iType == EMediaNotPresent || driveInfo.iType == EMediaUnknown ) + { + err = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultPhoneMemory, driveNum ); + PRINT( _L( "MM MTP <> Memory card doesn't exist, set PhoneMemory to default" ) ); + } + } + + return Framework().StorageMgr().FrameworkStorageId( TDriveNumber( driveNum ) ); + } + +// --------------------------------------------------------------------------- +// CMediaMtpDataProvider::Insert +// +// --------------------------------------------------------------------------- +// +void CMediaMtpDataProvider::InsertL( RArray& aArray, const TUint aProperCode ) const + { + TInt err = KErrNone; + err = aArray.Find( aProperCode ); + if ( err == KErrNotFound ) + err = aArray.Append( aProperCode ); + + User::LeaveIfError( err ); + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataprovidercopyobject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataprovidercopyobject.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,375 @@ +/* +* 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: Implement the operation: Copy Object +* +*/ + + +#include +#include +#include +#include + +#include "cmediamtpdataprovidercopyobject.h" +#include "mediamtpdataproviderconst.h" +#include "mmmtpdplogger.h" +#include "mmmtpdputility.h" +#include "cmmmtpdpmetadataaccesswrapper.h" +#include "mmmtpdpdefs.h" +#include "mmmtpdpconfig.h" + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderCopyObject::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +MMmRequestProcessor* CMediaMtpDataProviderCopyObject::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + CMediaMtpDataProviderCopyObject* self = + new ( ELeave ) CMediaMtpDataProviderCopyObject( aFramework, + aConnection, + aDpConfig ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderCopyObject::ConstructL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderCopyObject::ConstructL() + { + CCopyObject::ConstructL(); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderCopyObject::~CMediaMtpDataProviderCopyObject +// Destructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProviderCopyObject::~CMediaMtpDataProviderCopyObject() + { + + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderCopyObject::CMediaMtpDataProviderCopyObject +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProviderCopyObject::CMediaMtpDataProviderCopyObject( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CCopyObject( aFramework, aConnection, aDpConfig ) + { + + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderCopyObject::ServiceSpecificObjectPropertyL +// +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderCopyObject::ServiceGetSpecificObjectPropertyL( TUint16 aPropCode, + TUint32 aHandle, + const CMTPObjectMetaData& aObject ) + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderCopyObject::ServiceSpecificObjectPropertyL" ) ); + + CMTPTypeString* textData = NULL; + CMTPTypeArray* desData = NULL; + TInt err = KErrNone; + + if ( iPropertyElement ) + { + delete iPropertyElement; + iPropertyElement = NULL; + } + + switch ( aPropCode ) + { + case EMTPObjectPropCodeArtist: + case EMTPObjectPropCodeGenre: + case EMTPObjectPropCodeComposer: + case EMTPObjectPropCodeOriginalReleaseDate: + case EMTPObjectPropCodeAlbumName: + case EMTPObjectPropCodeParentalRating: + case EMTPObjectPropCodeEncodingProfile: + { + textData = CMTPTypeString::NewLC(); // + textData + + TRAP( err, iDpConfig.GetWrapperL().GetObjectMetadataValueL( aPropCode, + *textData, + aObject ) ); + + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderCopyObject::ServiceSpecificObjectPropertyL err = %d" ), err ); + + if ( err == KErrNone ) + { + iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); + iPropertyElement->SetStringL( CMTPTypeObjectPropListElement::EValue, textData->StringChars()); + +// iPropertyElement = CMTPTypeObjectPropListElement::NewL( aHandle, +// aPropCode, +// *textData ); + } + + CleanupStack::PopAndDestroy( textData ); // - textData + } + break; + + case EMTPObjectPropCodeDescription: + { + desData = CMTPTypeArray::NewLC( EMTPTypeAUINT16 ); // + desData + + TRAP( err, iDpConfig.GetWrapperL().GetObjectMetadataValueL( aPropCode, + *desData, + aObject ) ); + + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderCopyObject::ServiceSpecificObjectPropertyL err = %d" ), err ); + + if ( err == KErrNone ) + { + iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); + iPropertyElement->SetArrayL( CMTPTypeObjectPropListElement::EValue, *desData); + +// iPropertyElement = CMTPTypeObjectPropListElement::NewL( aHandle, +// aPropCode, +// *desData ); + } + + CleanupStack::PopAndDestroy( desData ); // - desData + } + break; + + case EMTPObjectPropCodeTrack: + case EMTPObjectPropCodeNumberOfChannels: + case EMTPObjectPropCodeScanType: + case EMTPObjectPropCodeDRMStatus: + { + TMTPTypeUint16 uint16( 0 ); + TRAP( err, iDpConfig.GetWrapperL().GetObjectMetadataValueL( aPropCode, + uint16, + aObject ) ); + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderCopyObject::ServiceSpecificObjectPropertyL err = %d" ), err ); + + if ( err == KErrNone ) + { + iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); + iPropertyElement->SetUint16L( CMTPTypeObjectPropListElement::EValue, uint16.Value()); + +// iPropertyElement = CMTPTypeObjectPropListElement::NewL( aHandle, +// aPropCode, +// uint16 ); + } + + } + break; + + case EMTPObjectPropCodeWidth: + case EMTPObjectPropCodeHeight: + case EMTPObjectPropCodeDuration: + case EMTPObjectPropCodeUseCount: + case EMTPObjectPropCodeSampleRate: + case EMTPObjectPropCodeAudioWAVECodec: + case EMTPObjectPropCodeAudioBitRate: + case EMTPObjectPropCodeVideoFourCCCodec: + case EMTPObjectPropCodeVideoBitRate: + case EMTPObjectPropCodeFramesPerThousandSeconds: + case EMTPObjectPropCodeKeyFrameDistance: + { + TMTPTypeUint32 uint32 = 0; + TRAP( err, iDpConfig.GetWrapperL().GetObjectMetadataValueL( aPropCode, + uint32, + aObject ) ); + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderCopyObject::ServiceSpecificObjectPropertyL err = %d" ), err ); + + if ( err == KErrNone ) + { + iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); + iPropertyElement->SetUint32L( CMTPTypeObjectPropListElement::EValue, uint32.Value()); +// iPropertyElement = CMTPTypeObjectPropListElement::NewL( aHandle, +// aPropCode, +// uint32 ); + } + } + break; + + case EMTPExtObjectPropCodeOmaDrmStatus: + { + TInt drmStatus = MmMtpDpUtility::GetDrmStatus( aObject.DesC( CMTPObjectMetaData::ESuid ) ); + TMTPTypeUint8 result; + result.Set( 0 ); + + if ( drmStatus == EMTPDrmStatusProtected ) + result.Set( 1 ); + + iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); + iPropertyElement->SetUint16L( CMTPTypeObjectPropListElement::EDatatype, EMTPTypeUINT8); + iPropertyElement->SetUint8L( CMTPTypeObjectPropListElement::EValue, result.Value()); + +// iPropertyElement = CMTPTypeObjectPropListElement::NewL( aHandle, +// aPropCode, +// EMTPTypeUINT8, +// result ); + } + break; + + default: + { + User::Leave( KErrNotSupported ); + } + break; + } + + // centralize logic to handle error, doing so, that's on need to trap the + // leave for KErrNotSupported in base class like previous version. + if ( ( err == KErrNotFound ) + || ( ( err == KErrNotSupported ) + && ( ( aObject.Uint( CMTPObjectMetaData::EFormatCode ) == EMTPFormatCodeASF ) + || ( aObject.Uint( CMTPObjectMetaData::EFormatCode ) == EMTPFormatCodeMP4Container ) + || ( aObject.Uint( CMTPObjectMetaData::EFormatCode ) == EMTPFormatCode3GPContainer ) ) ) ) + { + iPropertyElement = NULL; + } + else + { + User::LeaveIfError( err ); + } + PRINT( _L( "MM MTP <= CMediaMtpDataProviderCopyObject::ServiceSpecificObjectPropertyL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderCopyObject::ServiceSetSpecificObjectPropertyL +// +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CMediaMtpDataProviderCopyObject::ServiceSetSpecificObjectPropertyL( TUint16 aPropCode, const CMTPObjectMetaData& aObject, + const CMTPTypeObjectPropListElement& aElement ) + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderCopyObject::ServiceSetSpecificObjectPropertyL" ) ); + TMTPResponseCode responseCode( EMTPRespCodeOK ); + + switch ( aPropCode ) + { + case EMTPObjectPropCodeArtist: + case EMTPObjectPropCodeGenre: + case EMTPObjectPropCodeComposer: + case EMTPObjectPropCodeOriginalReleaseDate: + case EMTPObjectPropCodeAlbumName: + case EMTPObjectPropCodeParentalRating: + case EMTPObjectPropCodeEncodingProfile: + { + CMTPTypeString* stringData = + CMTPTypeString::NewLC( aElement.StringL( CMTPTypeObjectPropListElement::EValue ) );// + stringData + + responseCode = ServiceMetaDataToWrapper( aPropCode, + *stringData, + aObject ); + + CleanupStack::PopAndDestroy( stringData ); // - stringData + } + break; + + case EMTPObjectPropCodeVideoBitRate: + { + responseCode = EMTPRespCodeAccessDenied; + } + break; + + case EMTPObjectPropCodeDescription: + { + CMTPTypeArray* desData = CMTPTypeArray::NewLC( EMTPTypeAUINT16 ); // + desData +// aElement.GetL( CMTPTypeObjectPropListElement::EValue, *desData ); + desData->SetByDesL(aElement.ArrayL(CMTPTypeObjectPropListElement::EValue)); + //desData(aElement.ArrayL(CMTPTypeObjectPropListElement::EValue)); + + responseCode = ServiceMetaDataToWrapper( aPropCode, + *desData, + aObject ); + CleanupStack::PopAndDestroy( desData ); // - desData + } + break; + + case EMTPObjectPropCodeWidth: + case EMTPObjectPropCodeHeight: + case EMTPObjectPropCodeDuration: + case EMTPObjectPropCodeUseCount: + case EMTPObjectPropCodeSampleRate: + case EMTPObjectPropCodeAudioWAVECodec: + case EMTPObjectPropCodeAudioBitRate: + case EMTPObjectPropCodeVideoFourCCCodec: + case EMTPObjectPropCodeFramesPerThousandSeconds: + case EMTPObjectPropCodeKeyFrameDistance: + { + TMTPTypeUint32 uint32( aElement.Uint32L( CMTPTypeObjectPropListElement::EValue ) ); + responseCode = ServiceMetaDataToWrapper( aPropCode, + uint32, + aObject ); + } + break; + + case EMTPObjectPropCodeTrack: + case EMTPObjectPropCodeNumberOfChannels: + case EMTPObjectPropCodeScanType: + case EMTPObjectPropCodeDRMStatus: + { + TMTPTypeUint16 uint16( aElement.Uint16L( CMTPTypeObjectPropListElement::EValue )); + responseCode = ServiceMetaDataToWrapper( aPropCode, + uint16, + aObject ); + } + break; + + case EMTPExtObjectPropCodeOmaDrmStatus: + { + TInt drmStatus = MmMtpDpUtility::GetDrmStatus( aObject.DesC( CMTPObjectMetaData::ESuid ) ); + + if (drmStatus == EMTPDrmStatusUnknown) + { + responseCode = EMTPRespCodeAccessDenied; + } + else + { + TMTPTypeUint8 newValue( aElement.Uint8L( CMTPTypeObjectPropListElement::EValue ) ); + + // there's no DB field to remember the value, so return an error + // if there's a mismatch to CAF protection status + if ( ( ( drmStatus == EMTPDrmStatusProtected) && ( newValue.Value() == 0 ) ) || + ( ( drmStatus == EMTPDrmStatusNotProtected ) && ( newValue.Value() == 1 ) ) ) + { + responseCode = EMTPRespCodeAccessDenied; + } + } + } + break; + + default: + { + User::Leave( KErrNotSupported ); + } + break; + } + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderCopyObject::ServiceSetSpecificObjectPropertyL" ) ); + + return responseCode; + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataproviderenumerator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataproviderenumerator.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,649 @@ +/* +* 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: Enumerator objects +* +*/ + + +#include +#include +#include +#include +#include + +#include "mediamtpdataproviderconst.h" +#include "cmediamtpdataproviderenumerator.h" +#include "cmediamtpdataprovider.h" +#include "mmmtpdplogger.h" +#include "mmmtpdputility.h" +#include "cmmmtpdpaccesssingleton.h" +#include "cmmmtpdpmetadataaccesswrapper.h" + +// Unit: microsecond +const TInt KThresholdOfEnumerationLoopDuration = 1000 * 1000; // microsecond + +const TInt KMTPDriveGranularity = 5; +const TInt KMediaDpArrayGranularity = 2; + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderEnumerator::NewL +// Two phase constructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProviderEnumerator* CMediaMtpDataProviderEnumerator::NewL( MMTPDataProviderFramework& aFramework, + CMediaMtpDataProvider& aDataProvider ) + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderEnumerator::NewL" ) ); + + CMediaMtpDataProviderEnumerator* self = new ( ELeave ) CMediaMtpDataProviderEnumerator( aFramework, aDataProvider ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderEnumerator::NewL" ) ); + return self; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderEnumerator::CMediaMtpDataProviderEnumerator +// Standard C++ Constructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProviderEnumerator::CMediaMtpDataProviderEnumerator( MMTPDataProviderFramework& aFramework, + CMediaMtpDataProvider& aDataProvider ) : + CActive( EPriorityLow ), // EPriorityStandard ? sure? + iFramework( aFramework ), + iObjectMgr( aFramework.ObjectMgr() ), + iDataProviderId( aFramework.DataProviderId() ), + iDataProvider( aDataProvider ), + iDirStack( KMediaDpArrayGranularity ), + iStorages( KMediaDpArrayGranularity ), + iScanningDir( EFalse ) + { + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderEnumerator::CMediaMtpDataProviderEnumerator, iDataProviderId = %d" ), iDataProviderId ); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderEnumerator::~CMediaMtpDataProviderEnumerator +// destructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProviderEnumerator::~CMediaMtpDataProviderEnumerator() + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderEnumerator::~CMediaMtpDataProviderEnumerator" ) ); + Cancel(); + iDir.Close(); + iDirStack.Close(); + iStorages.Close(); + +#if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) + delete iPerfLog; +#endif + PRINT( _L( "MM MTP <= CMediaMtpDataProviderEnumerator::~CMediaMtpDataProviderEnumerator" ) ); + } + +// ----------------------------------------------------------------------------- +// MediaMtpDataProviderEnumerator::StartL +// Kick off the enumeration on the specified storage +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderEnumerator::StartL( TUint32 aStorageId ) + { + PRINT1( _L( "MM MTP => CMediaMtpDataProviderEnumerator::StartL aStorageId = 0x%x" ), aStorageId ); + + MMTPStorageMgr& storageMgr( iFramework.StorageMgr() ); + if ( aStorageId == KMTPStorageAll ) + { + // Retrieve the available logical StorageIDs + RPointerArray storages; + CleanupClosePushL( storages ); // + storages + TMTPStorageMgrQueryParams params( KNullDesC, + CMTPStorageMetaData::ESystemTypeDefaultFileSystem ); + + storageMgr.GetLogicalStoragesL( params, storages ); + + // Construct the StorageIDs list. + for ( TInt i = 0; i < storages.Count(); i++ ) + { + iStorages.AppendL( storages[i]->Uint( CMTPStorageMetaData::EStorageId ) ); + } + CleanupStack::PopAndDestroy( &storages ); // - storages + } + else if ( aStorageId != KMTPNotSpecified32 ) + { + __ASSERT_DEBUG( storageMgr.ValidStorageId( aStorageId ), User::Invariant() ); + + const CMTPStorageMetaData& storage( storageMgr.StorageL( aStorageId ) ); + + if ( storage.Uint( CMTPStorageMetaData::EStorageSystemType ) + == CMTPStorageMetaData::ESystemTypeDefaultFileSystem ) + { + if ( storageMgr.LogicalStorageId( aStorageId ) ) + { + // Logical StorageID. + iStorages.AppendL( aStorageId ); + } + else + { + // Physical StorageID. Enumerate all eligible logical storages. + const RArray& logicalIds( storage.UintArray( CMTPStorageMetaData::EStorageLogicalIds ) ); + + for ( TInt i = 0; i < logicalIds.Count(); i++ ) + { + iStorages.AppendL( logicalIds[i] ); + } + } + } + } + + iStorageId = aStorageId; + + if ( iStorages.Count() > 0 ) + { + ScanStorageL( iStorages[0] ); + } + else + { + SignalCompleteL( iDataProvider ); + } + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderEnumerator::StartL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderEnumerator::DoCancel() +// Cancel the enumeration process +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderEnumerator::DoCancel() + { + iDir.Close(); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderEnumerator::ScanStorageL +// +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderEnumerator::ScanStorageL( TUint32 aStorageId ) + { + const CMTPStorageMetaData& storage( iFramework.StorageMgr().StorageL( aStorageId ) ); + + __ASSERT_DEBUG( ( storage.Uint( CMTPStorageMetaData::EStorageSystemType ) == CMTPStorageMetaData::ESystemTypeDefaultFileSystem ), + User::Invariant() ); + + TFileName root( storage.DesC( CMTPStorageMetaData::EStorageSuid ) ); + PRINT2( _L("MM MTP <> CMediaMtpDataProviderEnumerator::ScanStorageL aStorageId = 0x%x, StorageSuid = %S"), aStorageId, &root ); + + iParentHandle = KMTPHandleNone; + iPath.Set( root, NULL, NULL); + iDir.Close(); + User::LeaveIfError( iDir.Open( iFramework.Fs(), + iPath.DriveAndPath(), + KEntryAttNormal | KEntryAttDir ) ); + ScanDirL(); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderEnumerator::ScanNextStorageL +// +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderEnumerator::ScanNextStorageL() + { + // If there are one or more unscanned storages left + // (the currently scanned one is still on the list) + if ( iStorages.Count() > 1 ) + { + // Round trip suppport + const CMTPStorageMetaData& storage( iFramework.StorageMgr().StorageL( iStorages[0] ) ); + TFileName root( storage.DesC( CMTPStorageMetaData::EStorageSuid ) ); + GetModifiedContentL( root ); + iDataProvider.GetWrapperL().UpdateMusicCollectionL(); + + iStorages.Remove( 0 ); + ScanStorageL( iStorages[0] ); + } + else + { + + // Round trip suppport + const CMTPStorageMetaData& storage( iFramework.StorageMgr().StorageL( iStorages[0] ) ); + TFileName root( storage.DesC( CMTPStorageMetaData::EStorageSuid ) ); + GetModifiedContentL( root ); + + // We are done + iStorages.Reset(); + + SignalCompleteL( iDataProvider ); + } + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderEnumerator::ScanDirL +// +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderEnumerator::ScanDirL() + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderEnumerator::ScanDirL" ) ); + + StartEnumerationCount(); + + iFirstUnprocessed = 0; + + iScanningDir = ETrue; + PERFLOGSTART( KDirectoryScan ); + iDir.Read( iEntries, iStatus ); + SetActive(); + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderEnumerator::ScanDirL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderEnumerator::ScanNextDirL +// Recurse into the next directory on the stack +// and scan it for entries. +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderEnumerator::ScanNextDirL() + { + TInt count = iDirStack.Count(); + + if ( count == 0 ) + { + // No more directories on the stack, try the next storage + ScanNextStorageL(); + } + else + { + TEntry* entry = iDirStack[count - 1]; + if ( entry != NULL ) + { + + // Empty TEntry, no more subdirectories in + // the current path + if ( entry->iName == KNullDesC ) + { + // Remove current dir from path + iPath.PopDir(); + iDirStack.Remove( count - 1 ); + delete entry; + entry = NULL; + iDir.Close(); + + // Scan the next directory of the parent + ScanNextDirL(); + } + // Going into a subdirectory of current + else + { + // Add directory to path + iPath.AddDir( entry->iName ); + // Remove directory so we don't think it's a subdirectory + iDirStack.Remove( count - 1 ); + delete entry; + entry = NULL; + ScanNextSubdirL(); + } + } + } + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderEnumerator::ScanNextSubdirL +// Scan next sub dir +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderEnumerator::ScanNextSubdirL() + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderEnumerator::ScanNextSubdirL" ) ); + + // A empty (non-constructed) TEntry is our marker telling us to pop a directory + // from iPath when we see this + TEntry* entry = new TEntry( TEntry() ); + + User::LeaveIfNull( entry ); + + iDirStack.AppendL( entry ); + + // Leave with KErrNotFound if we don't find the object handle since it shouldn't be on the + // dirstack if the entry wasn't added + TPtrC suid = iPath.DriveAndPath().Left( iPath.DriveAndPath().Length() ); + // Update the current parenthandle with object of the directory + PERFLOGSTART( KObjectManagerObjectUid ); + iParentHandle = iFramework.ObjectMgr().HandleL( suid ); + PERFLOGSTOP( KObjectManagerObjectUid ); + PRINT1( _L( "MM MTP <> iParentHandle = 0x%Lx" ), iParentHandle ); + + // Kick-off a scan of the next directory + iDir.Close(); + + TInt err = iDir.Open( iFramework.Fs(), + iPath.DriveAndPath(), + KEntryAttNormal | KEntryAttDir ); + + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderEnumerator::ScanNextSubdirL, RDir::Open err = %d" ), err ); + + if ( err == KErrNone ) + ScanDirL(); + else + { + iEntries = TEntryArray(); + + TRequestStatus* status = &iStatus; + User::RequestComplete( status, iStatus.Int() ); + SetActive(); + } + + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderEnumerator::ScanNextSubdirL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderEnumerator::RunL +// +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderEnumerator::RunL() + { + if ( iScanningDir ) + { + PERFLOGSTOP( KDirectoryScan ); + } + + iScanningDir = EFalse; + if ( iEntries.Count() == 0 ) + { + // No entries to process, scan next dir or storage + ScanNextDirL(); + } + else if ( iFirstUnprocessed < iEntries.Count() ) + { + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderEnumerator::RunL iFirstUnprocessed = %d" ), iFirstUnprocessed); + TRAPD( err, ProcessEntriesL();); + if ( err != KErrNone ) + { + iFirstUnprocessed++; + } + + // Complete ourselves with current TRequestStatus + // since we need to run again to either scan a new dir or drive + // or process more entries + TRequestStatus* status = &iStatus; + User::RequestComplete( status, iStatus.Int() ); + SetActive(); + } + else + { + switch ( iStatus.Int() ) + { + case KErrNone: + // There are still entries left to be read + ScanDirL(); + break; + + case KErrEof: + // There are no more entries + default: + // Error, ignore and continue with next dir + ScanNextDirL(); + break; + } + } + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderEnumerator::RunError +// +// ----------------------------------------------------------------------------- +// +TInt CMediaMtpDataProviderEnumerator::RunError( TInt aError ) + { + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderEnumerator::RunError with error %d" ), aError ); + + TRAP_IGNORE( SignalCompleteL( iDataProvider ) ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderEnumerator::ConstructL +// +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderEnumerator::ConstructL() + { + CActiveScheduler::Add( this ); + + TTimeIntervalMicroSeconds32 tickPeriod = 0; + TInt err = UserHal::TickPeriod(tickPeriod); + + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderEnumerator::ConstructL, UserHal::TickPeriod err = %d" ), err); + User::LeaveIfError( err ); + iTickPeriod = tickPeriod.Int(); + +#if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) + iPerfLog = CMmMtpDpPerfLog::NewL( _L( "MediaMtpDataProviderEnumerator" ) ); +#endif + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderEnumerator::SignalCompleteL +// Called when the enumeration is completed +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderEnumerator::SignalCompleteL( MMTPEnumerationCallback& aCallback, + TInt aError/* = KErrNone*/) + { + // Enumeration completed on this drive + aCallback.NotifyEnumerationCompleteL( iStorageId, aError ); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderEnumerator::ProcessEntriesL +// Iterates iEntries adding entries as needed to object manager and iDirStack. +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderEnumerator::ProcessEntriesL() + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderEnumerator::ProcessEntriesL" ) ); + + TBuf path = iPath.DriveAndPath(); + + while ( !IsOverThreshold() && iFirstUnprocessed < iEntries.Count() ) + { + const TEntry& entry = iEntries[iFirstUnprocessed]; + path.Append( entry.iName ); + PRINT1( _L( "MM MTP <> path = %S" ), &path ); + + TInt len = entry.iName.Length(); + + if ( entry.IsDir() ) + { + path.Append( '\\' ); + ++len; + + // we don't need to process folder, just remember + // the folder + TEntry* dirEntry = new TEntry( entry ); + User::LeaveIfNull( dirEntry ); + iDirStack.AppendL( dirEntry ); + } + else if ( IsFileAccepted( path ) ) + { + AddEntryL( path ); + } + + // Remove filename part + path.SetLength( path.Length() - len ); + + iFirstUnprocessed++; + } + + StartEnumerationCount(); + PRINT( _L( "MM MTP <= CMediaMtpDataProviderEnumerator::ProcessEntriesL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderEnumerator::AddEntryL +// Add a file entry to the object store +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderEnumerator::AddEntryL( const TDesC& aFullFileName ) + { + PRINT1( _L( "MM MTP => CMediaDataProviderEnumerator::AddEntryL aFullFileName = %S" ), &aFullFileName ); + + CMTPObjectMetaData* object( CMTPObjectMetaData::NewLC( iDataProviderId, + iFormatCode, + iStorages[0], + aFullFileName ) ); // + object + + object->SetUint( CMTPObjectMetaData::EParentHandle, iParentHandle ); + + if ( ( iFormatCode == EMTPFormatCodeMP4Container ) + || ( iFormatCode == EMTPFormatCode3GPContainer ) + || ( iFormatCode == EMTPFormatCodeASF ) ) + { + TMmMtpSubFormatCode subFormatCode; + + // Note: Delay the file parsing until external enumeration phase to avoid time-out + subFormatCode = EMTPSubFormatCodeUnknown; + + object->SetUint( CMTPObjectMetaData::EFormatSubCode, (TUint)subFormatCode ); + } + + PERFLOGSTART( KObjectManagerInsert ); + iObjectMgr.InsertObjectL( *object ); + PERFLOGSTOP( KObjectManagerInsert ); + + CleanupStack::PopAndDestroy( object ); // - object + + PRINT1( _L( "MM MTP <= CMediaMtpDataProviderEnumerator::AddEntryL, entry inserted, iFormatCode = 0x%x" ), iFormatCode); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderEnumerator::GetObjectFormatCode +// Returns a TMTPFormatCode for the requested object +// ----------------------------------------------------------------------------- +// +TMTPFormatCode CMediaMtpDataProviderEnumerator::GetObjectFormatCode( const TDesC& aFullFileName ) + { + PRINT1( _L("MM MTP <> CMediaMtpDataProviderEnumerator::GetObjectFormatCodeL aFullFileName = %S"), &aFullFileName ); + TMTPFormatCode formatCode = MmMtpDpUtility::FormatFromFilename( aFullFileName ); + return formatCode; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderEnumerator::IsFileAccepted +// Is the file format is supported by this Dp +// ----------------------------------------------------------------------------- +// +TBool CMediaMtpDataProviderEnumerator::IsFileAccepted( const TDesC& aFullFileName ) + { + PERFLOGSTART(KFormatFilter); + iFormatCode = GetObjectFormatCode( aFullFileName ); + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderEnumerator::IsFileAcceptedL formatCode = 0x%x" ), iFormatCode ); + TBool accepted = EFalse; + TInt count = sizeof( KMediaMtpDataProviderSupportedFormats ) / sizeof( TUint16 ); + for ( TInt i = 0; i < count; i++ ) + { + if ( iFormatCode == KMediaMtpDataProviderSupportedFormats[i] ) + { + accepted = ETrue; + break; + } + } + + PERFLOGSTOP(KFormatFilter); + return accepted; + } + +// ----------------------------------------------------------------------------- +// CMediaDpMtpEnumerator::StartEnumerationCount +// start record system tick +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderEnumerator::StartEnumerationCount() + { + iTickCountBegin = User::TickCount(); + } + +// ----------------------------------------------------------------------------- +// CMediaDpMtpEnumerator::IsOverThreshold +// Is system tick more than the predefined value? +// ----------------------------------------------------------------------------- +// +TBool CMediaMtpDataProviderEnumerator::IsOverThreshold() + { + TUint tcNow = User::TickCount(); + + if ( ( tcNow - iTickCountBegin ) * iTickPeriod >= KThresholdOfEnumerationLoopDuration ) + { + return ETrue; + } + else + { + return EFalse; + } + } + +// ----------------------------------------------------------------------------- +// CMediaDpMtpEnumerator::GetModifiedContentL() +// Get Modified Content and report to Framework +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderEnumerator::GetModifiedContentL( const TDesC& aStorageRoot ) + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderEnumerator::GetModifiedContentL" ) ); + TInt arrayCount = 0; + CDesCArray* modifiedContents = new ( ELeave ) CDesCArrayFlat( KMTPDriveGranularity ); + CleanupStack::PushL( modifiedContents ); // + modifiedContents + + iDataProvider.GetWrapperL().GetModifiedContentL( aStorageRoot, arrayCount, *modifiedContents ); + + if ( arrayCount > 0 ) + { + CMTPObjectMetaData* object = CMTPObjectMetaData::NewLC(); // + object + for ( TInt i = 0; i < arrayCount; i++ ) + { + + if ( iFramework.ObjectMgr().ObjectL( ( *modifiedContents )[i], *object ) ) + { + object->SetUint( CMTPObjectMetaData::EObjectMetaDataUpdate , 1 ); + iFramework.ObjectMgr().ModifyObjectL( *object ); + } + } + + CleanupStack::PopAndDestroy( object ); // - object + } + + CleanupStack::PopAndDestroy( modifiedContents ); // - modifiedContents + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderEnumerator::GetModifiedContentL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderEnumerator::SessionClosedL +// +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderEnumerator::SessionClosedL() + { + iDataProvider.GetWrapperL().UpdateMusicCollectionL(); + iDataProvider.GetWrapperL().CleanupDatabaseL(); + } + +//end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataprovidergetformatcapabilities.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataprovidergetformatcapabilities.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,795 @@ +/* +* 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 +#include +#include + +#include "cmediamtpdataprovidergetobjectpropdesc.h" +#include "mediamtpdataproviderconst.h" +#include "cmediamtpdataprovidergetformatcapabilities.h" +#include "mmmtpdplogger.h" + +const TUint32 KMTPDescriptionLen = 0x00000200; + +// forward declaration +class MMmMtpDpConfig; +class CMTPTypeObjectPropDesc; +class CMTPTypeInterdependentPropDesc; +class CMTPTypeObjectPropDesc; +class CMTPTypeString; +class CGetFormatCapabilities; + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetFormatCapabilities::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +MMmRequestProcessor* CMediaMtpDataProviderGetFormatCapabilities::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + CMediaMtpDataProviderGetFormatCapabilities* self = + new ( ELeave ) CMediaMtpDataProviderGetFormatCapabilities( aFramework, + aConnection, + aDpConfig ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetFormatCapabilities::ConstructL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderGetFormatCapabilities::ConstructL() + { + CGetFormatCapabilities::ConstructL(); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetFormatCapabilities::~CMediaMtpDataProviderGetFormatCapabilities() +// Destructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProviderGetFormatCapabilities::~CMediaMtpDataProviderGetFormatCapabilities() + { + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetFormatCapabilities::CMediaMtpDataProviderGetFormatCapabilities +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProviderGetFormatCapabilities::CMediaMtpDataProviderGetFormatCapabilities( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CGetFormatCapabilities( aFramework, aConnection, aDpConfig ) + { + + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetFormatCapabilities::ServiceInterdepentPropDescL +// +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderGetFormatCapabilities::ServiceInterdepentPropDescL() + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceInterdepentPropDescL" ) ); + + iInterdependentPropDesc = CMTPTypeInterdependentPropDesc::NewL(); + + TBool audioWaveCodecSupported = EFalse; + TBool audioBitRateSupported = EFalse; + TBool videoFourCcCodecSupported = EFalse; + TBool videoBitRateSupported = EFalse; + + switch ( iFormatCode ) + { + case EMTPFormatCodeWMA: + case EMTPFormatCodeMP3: + case EMTPFormatCodeAAC: + case EMTPFormatCodeWAV: + { + TInt count = sizeof( KMmMtpDpSupportedPropMandatoryAudio ) / sizeof( TUint16 ); + + for ( TInt i = 0; i < count; i++ ) + { + switch ( KMmMtpDpSupportedPropMandatoryAudio[i] ) + { + case EMTPObjectPropCodeAudioWAVECodec: + audioWaveCodecSupported = ETrue; + break; + case EMTPObjectPropCodeAudioBitRate: + audioBitRateSupported = ETrue; + break; + default: + // do nothing + break; + } + } + } + break; + + case EMTPFormatCodeMP4Container: + { + TInt count = sizeof( KMmMtpDpSupportedPropMandatoryAudio ) / sizeof( TUint16 ); + + for ( TInt i = 0; i < count; i++ ) + { + switch ( KMmMtpDpSupportedPropMandatoryAudio[i] ) + { + case EMTPObjectPropCodeAudioWAVECodec: + audioWaveCodecSupported = ETrue; + break; + case EMTPObjectPropCodeAudioBitRate: + audioBitRateSupported = ETrue; + break; + default: + // do nothing + break; + } + } + } + break; + + case EMTPFormatCode3GPContainer: + { + TInt count = sizeof( KMmMtpDpSupportedPropMandatoryAudio ) / sizeof( TUint16 ); + + for ( TInt i = 0; i < count; i++ ) + { + switch ( KMmMtpDpSupportedPropMandatoryAudio[i] ) + { + case EMTPObjectPropCodeAudioWAVECodec: + audioWaveCodecSupported = ETrue; + break; + case EMTPObjectPropCodeAudioBitRate: + audioBitRateSupported = ETrue; + break; + default: + // do nothing + break; + } + } + } + break; + + case EMTPFormatCodeWMV: + case EMTPFormatCodeASF: + { + TInt count = sizeof( KMmMtpDpSupportedPropMandatoryWMV ) / sizeof( TUint16 ); + + for ( TInt i = 0; i < count; i++ ) + { + switch ( KMmMtpDpSupportedPropMandatoryWMV[i] ) + { + case EMTPObjectPropCodeAudioWAVECodec: + audioWaveCodecSupported = ETrue; + break; + case EMTPObjectPropCodeAudioBitRate: + audioBitRateSupported = ETrue; + break; + case EMTPObjectPropCodeVideoFourCCCodec: + videoFourCcCodecSupported = ETrue; + break; + case EMTPObjectPropCodeVideoBitRate: + videoBitRateSupported = ETrue; + break; + default: + // do nothing + break; + } + } + } + break; + + default: + { + User::Leave( KErrNotSupported ); + } + break; + } + + + if ( audioWaveCodecSupported && audioBitRateSupported ) + { + CMTPTypeInterdependentProperties* properties = CMTPTypeInterdependentProperties::NewL(); + if ( videoFourCcCodecSupported && videoBitRateSupported ) + { + // TODO: need to confirm + properties->AppendL( ServiceVideoFourCCCodecL() ); + properties->AppendL( ServiceVideoBitrateL() ); + iInterdependentPropDesc->AppendL( properties ); + } + properties = CMTPTypeInterdependentProperties::NewL(); + properties->AppendL( ServiceAudioWaveCodecL() ); + properties->AppendL( ServiceAudioBitrateL() ); + iInterdependentPropDesc->AppendL( properties ); + } + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceInterdepentPropDescL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetFormatCapabilities::ServiceAudioWaveCodecL +// +// ----------------------------------------------------------------------------- +// +CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceAudioWaveCodecL() + { + PRINT1( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceAudioWaveCodecL, iFormatCode = 0x%X" ), iFormatCode ); + CMTPTypeObjectPropDescEnumerationForm* form = + CMTPTypeObjectPropDescEnumerationForm::NewLC( EMTPTypeUINT32 ); // + form + + switch( iFormatCode ) + { + case EMTPFormatCodeWMA: + case EMTPFormatCodeWMV: + case EMTPFormatCodeASF: + form->AppendSupportedValueL( TMTPTypeUint32( EMTPAudioWAVECodecWMA ) ); + break; + + case EMTPFormatCodeMP3: + form->AppendSupportedValueL( TMTPTypeUint32( EMTPAudioWAVECodecMP3 ) ); + break; + + case EMTPFormatCodeMP4Container: + case EMTPFormatCode3GPContainer: + case EMTPFormatCodeAAC: + form->AppendSupportedValueL( TMTPTypeUint32( EMTPAudioWAVECodecAAC ) ); + break; + + case EMTPFormatCodeWAV: + form->AppendSupportedValueL( TMTPTypeUint32( EMTPAudioWAVECodecPCM ) ); + break; + + default: + User::Leave( KErrNotSupported ); + break; + } + + CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewLC( EMTPObjectPropCodeAudioWAVECodec, *form ); // + propertyDesc + + // Set group code + propertyDesc->SetUint32L( CMTPTypeObjectPropDesc::EGroupCode, + EGroupCodeMediaDB ); + CleanupStack::Pop( propertyDesc ); // - propertyDesc + CleanupStack::PopAndDestroy( form ); // - form + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceAudioWaveCodecL" ) ); + + return propertyDesc; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetFormatCapabilities::ServiceAudioBitrateL +// +// ----------------------------------------------------------------------------- +// +CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceAudioBitrateL() + { + PRINT1( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceAudioBitrateL, iFormatCode = 0x%X" ), iFormatCode ); + CMTPTypeObjectPropDesc* propertyDesc = NULL; + switch( iFormatCode ) + { + case EMTPFormatCodeWMA: + case EMTPFormatCodeWMV: + case EMTPFormatCodeASF: + propertyDesc = ServiceRangeFormDescriptionL( EMTPObjectPropCodeAudioBitRate, + EMTPWMAMinBitrate, + EMTPWMAMaxBitrate, + EMTPAudioBitrateStep ); + break; + + case EMTPFormatCodeMP3: + propertyDesc = ServiceRangeFormDescriptionL( EMTPObjectPropCodeAudioBitRate, + EMTPMP3MinBitrate, + EMTPMP3MaxBitrate, + EMTPAudioBitrateStep ); + break; + + case EMTPFormatCodeAAC: + propertyDesc = ServiceRangeFormDescriptionL( EMTPObjectPropCodeAudioBitRate, + EMTPAACMinBitrate, + EMTPAACMaxBitrate, + EMTPAudioBitrateStep ); + break; + + case EMTPFormatCodeWAV: + propertyDesc = ServiceRangeFormDescriptionL( EMTPObjectPropCodeAudioBitRate, + EMTPPCMMinBitrate, + EMTPPCMMaxBitrate, + EMTPAudioBitrateStep ); + break; + + case EMTPFormatCodeMP4Container: + case EMTPFormatCode3GPContainer: + propertyDesc = ServiceRangeFormDescriptionL( EMTPObjectPropCodeAudioBitRate, + EMTPAACPlusMinBitrate, + EMTPAACPlusMaxBitrate, + EMTPAudioBitrateStep ); + break; + + default: + User::Leave( KErrNotSupported ); + break; + } + PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceAudioBitrateL" ) ); + + return propertyDesc; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetFormatCapabilities::ServiceVideoFourCCCodecL +// Create Description and create new ObjectPropDesc +// ----------------------------------------------------------------------------- +// +CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceVideoFourCCCodecL() + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceVideoFourCCCodecL" ) ); + CMTPTypeObjectPropDesc* propertyDesc = NULL; + if ( ( EMTPFormatCodeWMV == iFormatCode ) + || ( EMTPFormatCodeASF == iFormatCode ) ) + { + CMTPTypeObjectPropDescEnumerationForm* expectedForm = + CMTPTypeObjectPropDescEnumerationForm::NewLC( EMTPTypeUINT32 ); // + expectedForm + + TUint32 values[] = + { + EMTPVideoFourCCCodecWMV3 + }; + + TInt numValues = sizeof( values ) / sizeof( values[0] ); + for ( TInt i = 0; i < numValues; i++ ) + { + TMTPTypeUint32 data( values[i] ); + expectedForm->AppendSupportedValueL( data ); + } + propertyDesc = CMTPTypeObjectPropDesc::NewLC( EMTPObjectPropCodeVideoFourCCCodec, + *expectedForm ); // + propertyDesc + // Set group code + propertyDesc->SetUint32L( CMTPTypeObjectPropDesc::EGroupCode, + EGroupCodeMediaDB ); + CleanupStack::Pop( propertyDesc ); // - propertyDesc + CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm + } + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceVideoFourCCCodecL" ) ); + return propertyDesc; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetFormatCapabilities::ServiceVideoBitrateL +// Create Description and create new ObjectPropDesc +// ----------------------------------------------------------------------------- +// +CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceVideoBitrateL() + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceVideoBitrateL" ) ); + CMTPTypeObjectPropDesc* propertyDesc = NULL; + if ( ( EMTPFormatCodeWMV == iFormatCode ) + || ( EMTPFormatCodeASF == iFormatCode ) ) + { + propertyDesc = ServiceRangeFormDescriptionL( EMTPObjectPropCodeVideoBitRate, + EMTPWMVMinBitrate, + EMTPWMVMaxBitrate, + EMTPVideoBitrateStep, + ETrue ); + } + PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceVideoBitrateL" ) ); + return propertyDesc; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetFormatCapabilities::ServiceRangeFormDescriptionL +// +// ----------------------------------------------------------------------------- +// +CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceRangeFormDescriptionL( TUint16 aPropertyCode, + TUint32 aMinValue, + TUint32 aMaxValue, + TUint32 aStepValue, + TBool aIsReadOnly ) + { + PRINT1( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceRangeFormDescriptionL, aPropertyCode = 0x%X" ), + aPropertyCode ); + CMTPTypeObjectPropDescRangeForm* form = + CMTPTypeObjectPropDescRangeForm::NewLC( EMTPTypeUINT32 ); // + form + + // Set expected values + form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EMinimumValue, aMinValue ); + form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EMaximumValue, aMaxValue ); + form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EStepSize, aStepValue ); + + CMTPTypeObjectPropDesc::TPropertyInfo propertyInfo; + propertyInfo.iDataType = EMTPTypeUINT32; + propertyInfo.iFormFlag = CMTPTypeObjectPropDesc::ERangeForm; + propertyInfo.iGetSet = !aIsReadOnly; + + CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewLC( aPropertyCode, + propertyInfo, + form ); // + propertyDesc + // Set group code + propertyDesc->SetUint32L( CMTPTypeObjectPropDesc::EGroupCode, EGroupCodeMediaDB ); + + CleanupStack::Pop( propertyDesc ); // - propertyDesc + CleanupStack::PopAndDestroy( form ); // - form + PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceRangeFormDescriptionL" ) ); + + return propertyDesc; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetFormatCapabilities::ServiceSpecificpropertyDescL +// +// ----------------------------------------------------------------------------- +// +CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceSpecificPropertyDescL( TUint16 aPropertyCode ) + { + PRINT1( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceSpecificPropertyDescL, aPropertyCode = 0x%X" ), aPropertyCode ); + // Property object to return with the desc value + CMTPTypeObjectPropDesc* propertyDesc = NULL; + + switch ( aPropertyCode ) + { + // format specific + case EMTPObjectPropCodeArtist: // Artist + case EMTPObjectPropCodeTrack: // Track + case EMTPObjectPropCodeGenre: // Genre + case EMTPObjectPropCodeUseCount: // Use Count + case EMTPObjectPropCodeAlbumName: // Album Name + case EMTPObjectPropCodeAlbumArtist: // Album Artist + case EMTPObjectPropCodeOriginalReleaseDate: // Original Release Date + case EMTPObjectPropCodeComposer: // Composer + case EMTPObjectPropCodeParentalRating: + propertyDesc = CMTPTypeObjectPropDesc::NewL( aPropertyCode ); + break; + + // Number of Channels (m) + case EMTPObjectPropCodeNumberOfChannels: + propertyDesc = ServiceNumberOfChannelsL(); + break; + + // Sample Rate (HAS MINIMUM AND MAX VALUE) + case EMTPObjectPropCodeSampleRate: + propertyDesc = ServiceCodeSampleRateL(); + break; + + // Audio Wave Codec (MAY REQUIRED LIMITED NUMBER TO BE PRODUCED) + case EMTPObjectPropCodeAudioWAVECodec: + propertyDesc = ServiceAudioWaveCodecL(); + break; + + // Audio Bit Rate (MAY REQUIRED LIMITED NUMBER TO BE PRODUCED) + case EMTPObjectPropCodeAudioBitRate: + propertyDesc = ServiceAudioBitrateL(); + break; + + // Duration + case EMTPObjectPropCodeDuration: + propertyDesc = ServiceRangeFormDescriptionL( aPropertyCode, + EMTPMinDuration, + EMTPMaxDuration, + EMTPDurationStep ); + break; + + // Description + case EMTPObjectPropCodeDescription: + propertyDesc = ServiceDescriptionL(); + break; + + case EMTPObjectPropCodeWidth: + propertyDesc = ServiceRangeFormDescriptionL( aPropertyCode, + EMTPMinWidth, + EMTPMaxWidth, + EMTPStepWidth ); + break; + + case EMTPObjectPropCodeHeight: + propertyDesc = ServiceRangeFormDescriptionL( aPropertyCode, + EMTPMinHeight, + EMTPMaxHeight, + EMTPStepHeight ); + break; + + case EMTPObjectPropCodeScanType: + propertyDesc = ServiceScanTypeDescriptionL(); + break; + + case EMTPObjectPropCodeVideoFourCCCodec: + propertyDesc = ServiceVideoFourCCCodecL(); + break; + + case EMTPObjectPropCodeVideoBitRate: + propertyDesc = ServiceRangeFormDescriptionL( aPropertyCode, + EMTPWMVMinBitrate, + EMTPWMVMaxBitrate, + EMTPVideoBitrateStep, + ETrue ); + break; + + case EMTPObjectPropCodeFramesPerThousandSeconds: + propertyDesc = ServiceRangeFormDescriptionL( aPropertyCode, + EMTPMinFramesPerThousandSeconds, + EMTPMaxFramesPerThousandSeconds, + EMTPStepFramesPerThousandSeconds ); + break; + + case EMTPObjectPropCodeKeyFrameDistance: + propertyDesc = ServiceRangeFormDescriptionL( aPropertyCode, + EMTPMinKeyFrameDistance, + EMTPMaxKeyFrameDistance, + EMTPStepKeyFrameDistance ); + break; + + case EMTPObjectPropCodeEncodingProfile: + propertyDesc = ServiceEncodingProfileDescriptionL(); + break; + + case EMTPObjectPropCodeDRMStatus: + propertyDesc = ServiceDRMStatusL(); + break; + + case EMTPExtObjectPropCodeOmaDrmStatus: + propertyDesc = ServiceOMADRMStatusL(); + break; + + default: + User::Leave( KErrNotSupported ); + break; + } + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceSpecificPropertyDescL" ) ); + return propertyDesc; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetFormatCapabilities::ServiceNumberOfChannelsL() +// Create list of possible Channel numbers and create new ObjectPropDesc +// ----------------------------------------------------------------------------- +// +CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceNumberOfChannelsL() + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceNumberOfChannelsL" ) ); + CMTPTypeObjectPropDescEnumerationForm* expectedForm = + CMTPTypeObjectPropDescEnumerationForm::NewLC( EMTPTypeUINT16 ); // + expectedForm + + TUint16 values[] = + { + EMTPChannelMono, + EMTPChannelStereo + }; + + TInt numValues = sizeof( values ) / sizeof( values[0] ); + + for ( TInt i = 0; i < numValues; i++ ) + { + TMTPTypeUint16 data( values[i] ); + expectedForm->AppendSupportedValueL( data ); + } + + CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeNumberOfChannels, + *expectedForm ); + CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceNumberOfChannelsL" ) ); + + return propertyDesc; + } + +// ----------------------------------------------------------------------------- +//CMediaMtpDataProviderGetFormatCapabilities::ServiceCodeSampleRateL +// Create list of possible Sample rate list and create new ObjectPropDesc +// ----------------------------------------------------------------------------- +// +CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceCodeSampleRateL() + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceCodeSampleRateL" ) ); + CMTPTypeObjectPropDescEnumerationForm* expectedForm = + CMTPTypeObjectPropDescEnumerationForm::NewLC( EMTPTypeUINT32 ); // + expectedForm + + TUint32 values[] = + { + EMTPSampleRate8K, + EMTPSampleRate16K, + EMTPSampleRate22_05K, + EMTPSampleRate24K, + EMTPSampleRate32K, + EMTPSampleRate44_1K, + EMTPSampleRate48K + }; + + TInt numValues = sizeof( values ) / sizeof( values[0] ); + + for ( TInt i = 0; i < numValues; i++ ) + { + TMTPTypeUint32 data( values[i] ); + expectedForm->AppendSupportedValueL( data ); + } + + CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeSampleRate, + CMTPTypeObjectPropDesc::EEnumerationForm, + expectedForm ); + CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceCodeSampleRateL" ) ); + + return propertyDesc; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetFormatCapabilities::ServiceDescriptionL() +// Create Description and create new ObjectPropDesc +// ----------------------------------------------------------------------------- +// +CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceDescriptionL() + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceDescriptionL" ) ); + + TMTPTypeUint32 uint32Data( KMTPDescriptionLen ); + CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeDescription, + CMTPTypeObjectPropDesc::ELongStringForm, + &uint32Data ); + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceDescriptionL" ) ); + + return propertyDesc; + } + +// ----------------------------------------------------------------------------- +//CMediaMtpDataProviderGetFormatCapabilities::ServiceScanTypeDescriptionL +// Create Description and create new ObjectPropDesc +// ----------------------------------------------------------------------------- +// +CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceScanTypeDescriptionL() + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceScanTypeDescriptionL" ) ); + CMTPTypeObjectPropDescEnumerationForm* expectedForm = + CMTPTypeObjectPropDescEnumerationForm::NewLC( EMTPTypeUINT16 ); // + expectedForm + + TUint16 values[] = + { + EMTPScanTypeProgressive + }; + + TInt numValues = sizeof( values ) / sizeof( values[0] ); + for ( TInt i = 0; i < numValues; i++ ) + { + TMTPTypeUint16 data( values[i] ); + expectedForm->AppendSupportedValueL( data ); + } + + CMTPTypeObjectPropDesc* propertyDesc = NULL; + propertyDesc = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeScanType, + *expectedForm ); + CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceScanTypeDescriptionL" ) ); + + return propertyDesc; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetFormatCapabilities::ServiceEncodingProfileDescriptionL +// Create Description and create new ObjectPropDesc +// ----------------------------------------------------------------------------- +// +CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceEncodingProfileDescriptionL() + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceEncodingProfileDescriptionL" ) ); + CMTPTypeObjectPropDescEnumerationForm* expectedForm = + CMTPTypeObjectPropDescEnumerationForm::NewLC( EMTPTypeString ); // + expectedForm + + CMTPTypeString* string = CMTPTypeString::NewLC( _L( "SP@LL" ) ); // + string + expectedForm->AppendSupportedValueL( *string ); + string->SetL( _L("SP@ML")); + expectedForm->AppendSupportedValueL( *string ); + string->SetL( _L("MP@LL")); + expectedForm->AppendSupportedValueL( *string ); + + CMTPTypeObjectPropDesc::TPropertyInfo propertyInfo; + propertyInfo.iDataType = EMTPTypeString; + propertyInfo.iFormFlag = CMTPTypeObjectPropDesc::EEnumerationForm; + propertyInfo.iGetSet = CMTPTypeObjectPropDesc::EReadWrite; + + CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeEncodingProfile, + propertyInfo, + expectedForm ); + + CleanupStack::PopAndDestroy( string ); // - string + CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceEncodingProfileDescriptionL" ) ); + + return propertyDesc; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetFormatCapabilities::ServiceDRMStatusL +// Create Description and create new ObjectPropDesc +// ----------------------------------------------------------------------------- +// +CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceDRMStatusL() + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceDRMStatusL" ) ); + CMTPTypeObjectPropDescEnumerationForm* expectedForm = + CMTPTypeObjectPropDescEnumerationForm::NewLC( EMTPTypeUINT16 ); // + expectedForm + + TUint16 values[] = + { + EMTPDrmNoProtection, + EMTPDrmProtection, + EMTPDrmReserveForMTP, + EMTPDrmVenderExtension + }; + + TInt numValues = sizeof( values ) / sizeof( values[0] ); + for ( TInt i = 0; i < numValues; i++ ) + { + TMTPTypeUint16 data( values[i] ); + expectedForm->AppendSupportedValueL( data ); + } + + CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeDRMStatus, + *expectedForm ); + CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm + PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceDRMStatusL" ) ); + + return propertyDesc; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetFormatCapabilities::ServiceOMADRMStatusL +// Create Description and create new ObjectPropDesc +// ----------------------------------------------------------------------------- +// +CMTPTypeObjectPropDesc* CMediaMtpDataProviderGetFormatCapabilities::ServiceOMADRMStatusL() + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderGetFormatCapabilities::ServiceOMADRMStatusL" ) ); + CMTPTypeObjectPropDescEnumerationForm* expectedForm = + CMTPTypeObjectPropDescEnumerationForm::NewLC( EMTPTypeUINT8 ); // + expectedForm + + TUint8 values[] = + { + EMTPOMADrmNoProtection, + EMTPOMADrmProtection, + }; + + TInt numValues = sizeof( values ) / sizeof( values[0] ); + for ( TInt i = 0; i < numValues; i++ ) + { + TMTPTypeUint8 data( values[i] ); + expectedForm->AppendSupportedValueL( data ); + } + + CMTPTypeObjectPropDesc::TPropertyInfo propertyInfo; + propertyInfo.iDataType = EMTPTypeUINT8; + propertyInfo.iFormFlag = CMTPTypeObjectPropDesc::EEnumerationForm; + + CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewL( EMTPExtObjectPropCodeOmaDrmStatus, + propertyInfo, + expectedForm ); + CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm + PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetFormatCapabilities::ServiceOMADRMStatusL" ) ); + + return propertyDesc; + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataprovidergetinterdependentpropdesc.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataprovidergetinterdependentpropdesc.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,461 @@ +/* +* 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: Implement the operation: GetInterdenpendentPropDesc +* +*/ + + +#include "cmediamtpdataprovidergetinterdependentpropdesc.h" +#include "mediamtpdataproviderconst.h" +#include "mmmtpdplogger.h" +#include "tobjectdescription.h" +#include "mmmtpdpdefs.h" +#include "mmmtpdpconfig.h" + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetInterDependentPropDesc::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +MMmRequestProcessor* CMediaMtpDataProviderGetInterDependentPropDesc::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + CMediaMtpDataProviderGetInterDependentPropDesc* self = + new ( ELeave ) CMediaMtpDataProviderGetInterDependentPropDesc( aFramework, + aConnection ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CMediaDpMtpGetInterDependentPropDesc::ConstructL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderGetInterDependentPropDesc::ConstructL() + { + + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetInterDependentPropDesc::~CMediaMtpDataProviderGetInterDependentPropDesc +// Destructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProviderGetInterDependentPropDesc::~CMediaMtpDataProviderGetInterDependentPropDesc() + { + delete iDataset; + delete iProperties; + } + +// ----------------------------------------------------------------------------- +// CMTPGetInterDependentPropDesc::CMTPGetInterDependentPropDesc +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProviderGetInterDependentPropDesc::CMediaMtpDataProviderGetInterDependentPropDesc( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection ) : + CRequestProcessor( aFramework, aConnection, 0, NULL ) + { + PRINT( _L( "Operation: GetInterdependentPropDesc(0x9807)" ) ); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetInterDependentPropDesc::CheckRequestL +// Verify the reqeust and returns it +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CMediaMtpDataProviderGetInterDependentPropDesc::CheckRequestL() + { + TMTPResponseCode responseCode = CRequestProcessor::CheckRequestL(); + iFormatCode = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); + + if ( EMTPRespCodeOK == responseCode ) + { + TInt count = sizeof( KMediaMtpDataProviderSupportedFormats ) / sizeof( TUint16 ); + + responseCode = EMTPRespCodeInvalidObjectFormatCode; + + for ( TInt i = 0; i < count; i++ ) + { + if ( iFormatCode == KMediaMtpDataProviderSupportedFormats[i] ) + { + responseCode = EMTPRespCodeOK; + break; + } + } + } + + return responseCode; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetInterDependentPropDesc::ServiceL +// service a request at request phase +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderGetInterDependentPropDesc::ServiceL() + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderGetInterDependentPropDesc::ServiceL" ) ); + + // Clear the data set. + delete iDataset; + iDataset = NULL; + iDataset = CMTPTypeInterdependentPropDesc::NewL(); + + TBool audioWaveCodecSupported = EFalse; + TBool audioBitRateSupported = EFalse; + TBool videoFourCcCodecSupported = EFalse; + TBool videoBitRateSupported = EFalse; + + switch ( iFormatCode ) + { + case EMTPFormatCodeWMA: + case EMTPFormatCodeMP3: + case EMTPFormatCodeAAC: + case EMTPFormatCodeWAV: + { + TInt count = sizeof( KMmMtpDpSupportedPropMandatoryAudio ) / sizeof( TUint16 ); + + for ( TInt i = 0; i < count; i++ ) + { + switch ( KMmMtpDpSupportedPropMandatoryAudio[i] ) + { + case EMTPObjectPropCodeAudioWAVECodec: + audioWaveCodecSupported = ETrue; + break; + case EMTPObjectPropCodeAudioBitRate: + audioBitRateSupported = ETrue; + break; + default: + PRINT( _L( "MM MTP <> CMediaMtpDataProviderGetInterDependentPropDesc::ServiceL default" ) ); + // do nothing + break; + } + } + } + break; + + case EMTPFormatCodeMP4Container: + { + TInt count = sizeof( KMmMtpDpSupportedPropMandatoryAudio ) / sizeof( TUint16 ); + + for ( TInt i = 0; i < count; i++ ) + { + switch ( KMmMtpDpSupportedPropMandatoryAudio[i] ) + { + case EMTPObjectPropCodeAudioWAVECodec: + audioWaveCodecSupported = ETrue; + break; + case EMTPObjectPropCodeAudioBitRate: + audioBitRateSupported = ETrue; + break; + default: + // do nothing + break; + } + } + } + break; + + case EMTPFormatCode3GPContainer: + { + TInt count = sizeof( KMmMtpDpSupportedPropMandatoryAudio ) / sizeof( TUint16 ); + + for ( TInt i = 0; i < count; i++ ) + { + switch ( KMmMtpDpSupportedPropMandatoryAudio[i] ) + { + case EMTPObjectPropCodeAudioWAVECodec: + audioWaveCodecSupported = ETrue; + break; + case EMTPObjectPropCodeAudioBitRate: + audioBitRateSupported = ETrue; + break; + default: + // do nothing + break; + } + } + } + break; + + case EMTPFormatCodeWMV: + case EMTPFormatCodeASF: + { + TInt count = sizeof( KMmMtpDpSupportedPropMandatoryWMV ) / sizeof( TUint16 ); + + for ( TInt i = 0; i < count; i++ ) + { + switch (KMmMtpDpSupportedPropMandatoryWMV[i] ) + { + case EMTPObjectPropCodeAudioWAVECodec: + audioWaveCodecSupported = ETrue; + break; + case EMTPObjectPropCodeAudioBitRate: + audioBitRateSupported = ETrue; + break; + case EMTPObjectPropCodeVideoFourCCCodec: + videoFourCcCodecSupported = ETrue; + break; + case EMTPObjectPropCodeVideoBitRate: + videoBitRateSupported = ETrue; + break; + default: + // do nothing + break; + } + } + } + break; + + default: + { + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderGetInterDependentPropDesc::ServiceL leave because of invalid formatcode = 0x%x" ), iFormatCode ); + User::Leave( KErrNotSupported ); + } + break; + } + + if ( audioWaveCodecSupported && audioBitRateSupported ) + { + if ( videoFourCcCodecSupported && videoBitRateSupported ) + { + iProperties = CMTPTypeInterdependentProperties::NewL(); + ServiceVideoFourCCCodecL(); + ServiceVideoBitrateL(); + iDataset->AppendL( iProperties ); +// CleanupStack::Pop(); + iProperties = NULL; + } + + iProperties = CMTPTypeInterdependentProperties::NewL(); + ServiceAudioWaveCodecL(); + ServiceAudioBitrateL(); + iDataset->AppendL( iProperties ); +// CleanupStack::Pop(); + iProperties = NULL; + } + + // Send the dataset. + SendDataL( *iDataset ); + PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetInterDependentPropDesc::ServiceL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetInterDependentPropDesc::ServiceAudioWaveCodecL +// +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderGetInterDependentPropDesc::ServiceAudioWaveCodecL() + { + CMTPTypeObjectPropDescEnumerationForm* form = + CMTPTypeObjectPropDescEnumerationForm::NewLC( EMTPTypeUINT32 ); + + switch( iFormatCode ) + { + case EMTPFormatCodeWMA: + case EMTPFormatCodeWMV: + case EMTPFormatCodeASF: + form->AppendSupportedValueL( TMTPTypeUint32( EMTPAudioWAVECodecWMA ) ); + break; + + case EMTPFormatCodeMP3: + form->AppendSupportedValueL( TMTPTypeUint32( EMTPAudioWAVECodecMP3 ) ); + break; + + case EMTPFormatCodeMP4Container: + case EMTPFormatCode3GPContainer: + case EMTPFormatCodeAAC: + form->AppendSupportedValueL( TMTPTypeUint32( EMTPAudioWAVECodecAAC ) ); + break; + + case EMTPFormatCodeWAV: + form->AppendSupportedValueL( TMTPTypeUint32( EMTPAudioWAVECodecPCM ) ); + break; + + default: + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderGetInterDependentPropDesc::ServiceAudioWaveCodecL leave because of invalid formatcode = 0x%x" ), iFormatCode ); + User::Leave( KErrNotSupported ); + break; + } + + CMTPTypeObjectPropDesc::TPropertyInfo propInfo; + propInfo.iDataType = EMTPTypeUINT32; + propInfo.iFormFlag = CMTPTypeObjectPropDesc::EEnumerationForm; + propInfo.iGetSet = CMTPTypeObjectPropDesc::EReadWrite; + SetFormForResponseL( EMTPObjectPropCodeAudioWAVECodec, propInfo, form ); + CleanupStack::PopAndDestroy( form ); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetInterDependentPropDesc::ServiceAudioBitrateL +// +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderGetInterDependentPropDesc::ServiceAudioBitrateL() + { + switch( iFormatCode ) + { + case EMTPFormatCodeWMA: + case EMTPFormatCodeWMV: + case EMTPFormatCodeASF: + ServiceRangeFormDescriptionL( EMTPObjectPropCodeAudioBitRate, + EMTPWMAMinBitrate, + EMTPWMAMaxBitrate, + EMTPAudioBitrateStep ); + break; + + case EMTPFormatCodeMP3: + ServiceRangeFormDescriptionL( EMTPObjectPropCodeAudioBitRate, + EMTPMP3MinBitrate, + EMTPMP3MaxBitrate, + EMTPAudioBitrateStep ); + break; + + case EMTPFormatCodeAAC: + ServiceRangeFormDescriptionL( EMTPObjectPropCodeAudioBitRate, + EMTPAACMinBitrate, + EMTPAACMaxBitrate, + EMTPAudioBitrateStep ); + break; + + case EMTPFormatCodeWAV: + ServiceRangeFormDescriptionL( EMTPObjectPropCodeAudioBitRate, + EMTPPCMMinBitrate, + EMTPPCMMaxBitrate, + EMTPAudioBitrateStep ); + break; + + case EMTPFormatCodeMP4Container: + case EMTPFormatCode3GPContainer: + ServiceRangeFormDescriptionL( EMTPObjectPropCodeAudioBitRate, + EMTPAACPlusMinBitrate, + EMTPAACPlusMaxBitrate, + EMTPAudioBitrateStep ); + break; + + default: + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderGetInterDependentPropDesc::ServiceAudioBitrateL leave because of invalid formatcode = 0x%x" ), iFormatCode ); + User::Leave( KErrNotSupported ); + break; + } + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetInterDependentPropDesc::ServiceVideoFourCCCodecL +// Create Description and create new ObjectPropDesc +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderGetInterDependentPropDesc::ServiceVideoFourCCCodecL() + { + switch( iFormatCode ) + { + case EMTPFormatCodeWMV: + case EMTPFormatCodeASF: + { + CMTPTypeObjectPropDescEnumerationForm* form = + CMTPTypeObjectPropDescEnumerationForm::NewL( EMTPTypeUINT32 ); + CleanupStack::PushL( form ); // + form + + TUint32 values[] = + { + EMTPVideoFourCCCodecWMV3 + }; + + TInt numValues = sizeof ( values ) / sizeof ( values[0] ) ; + for ( TInt i = 0; i < numValues; i++ ) + { + TMTPTypeUint32 data( values[i] ); + form->AppendSupportedValueL( data ); + } + // TODO: + CMTPTypeObjectPropDesc::TPropertyInfo propInfo; + propInfo.iDataType = EMTPTypeUINT32; + propInfo.iFormFlag = CMTPTypeObjectPropDesc::EEnumerationForm; + propInfo.iGetSet = CMTPTypeObjectPropDesc::EReadWrite; + SetFormForResponseL( EMTPObjectPropCodeVideoFourCCCodec, propInfo, form ); + CleanupStack::PopAndDestroy( form ); // - form + } + break; + + default: + { + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderGetInterDependentPropDesc::ServiceVideoFourCCCodecL leave because of invalid formatcode = 0x%x" ), iFormatCode ); + User::Leave( KErrNotSupported ); + } + break; + } + } + +void CMediaMtpDataProviderGetInterDependentPropDesc::ServiceVideoBitrateL() + { + switch( iFormatCode ) + { + case EMTPFormatCodeWMV: + case EMTPFormatCodeASF: + ServiceRangeFormDescriptionL( EMTPObjectPropCodeVideoBitRate, + EMTPWMVMinBitrate, + EMTPWMVMaxBitrate, + EMTPVideoBitrateStep, + ETrue ); + break; + + default: + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderGetInterDependentPropDesc::ServiceVideoBitrateL leave because of invalid formatcode = 0x%x" ), iFormatCode ); + User::Leave( KErrNotSupported ); + break; + } + } + +void CMediaMtpDataProviderGetInterDependentPropDesc::ServiceRangeFormDescriptionL( TUint16 aPropCode, + TUint32 aMinValue, + TUint32 aMaxValue, + TUint32 aStepValue, + TBool aIsReadOnly ) + { + CMTPTypeObjectPropDescRangeForm* form = + CMTPTypeObjectPropDescRangeForm::NewLC( EMTPTypeUINT32 ); // + form + + // Set expected values + form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EMinimumValue, aMinValue ); + form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EMaximumValue, aMaxValue ); + form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EStepSize, aStepValue ); + + CMTPTypeObjectPropDesc::TPropertyInfo propInfo; + propInfo.iDataType = EMTPTypeUINT32; + propInfo.iFormFlag = CMTPTypeObjectPropDesc::ERangeForm; + propInfo.iGetSet = !aIsReadOnly; + SetFormForResponseL( aPropCode, propInfo, form ); + CleanupStack::PopAndDestroy( form ); // - form + } + +void CMediaMtpDataProviderGetInterDependentPropDesc::SetFormForResponseL( TUint16 aPropertyCode, + CMTPTypeObjectPropDesc::TPropertyInfo& aPropInfo, + const MMTPType* aForm ) + { + CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewLC( aPropertyCode, + aPropInfo, + aForm ); + // Set group code + propertyDesc->SetUint32L( CMTPTypeObjectPropDesc::EGroupCode, EGroupCodeMediaDB ); + + iProperties->AppendL( propertyDesc ); + CleanupStack::Pop( propertyDesc ); + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataprovidergetobjectpropdesc.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataprovidergetobjectpropdesc.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,716 @@ +/* +* 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: Implement the operation: GetObjectPropDesc +* +*/ + +#include +#include +#include + +#include "cmediamtpdataprovidergetobjectpropdesc.h" +#include "mediamtpdataproviderconst.h" +#include "mmmtpdplogger.h" +#include "mmmtpdpdefs.h" + +const TUint32 KMTPDescriptionLen = 0x00000200; + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetObjectPropDesc::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +MMmRequestProcessor* CMediaMtpDataProviderGetObjectPropDesc::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + CMediaMtpDataProviderGetObjectPropDesc* self = + new ( ELeave ) CMediaMtpDataProviderGetObjectPropDesc( aFramework, + aConnection, + aDpConfig ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetObjectPropDesc::ConstructL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderGetObjectPropDesc::ConstructL() + { + CGetObjectPropDesc::ConstructL(); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetObjectPropDesc::~CMediaMtpDataProviderGetObjectPropDesc +// Destructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProviderGetObjectPropDesc::~CMediaMtpDataProviderGetObjectPropDesc() + { + + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetObjectPropDesc::CMediaMtpDataProviderGetObjectPropDesc +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProviderGetObjectPropDesc::CMediaMtpDataProviderGetObjectPropDesc( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CGetObjectPropDesc( aFramework, aConnection, aDpConfig ) + { + + } + +void CMediaMtpDataProviderGetObjectPropDesc::ServiceSpecificObjectPropertyL(TUint16 aPropCode) + { + switch (aPropCode) + { + // format specific + case EMTPObjectPropCodeArtist: // Artist + case EMTPObjectPropCodeTrack: // Track + case EMTPObjectPropCodeGenre: // Genre + case EMTPObjectPropCodeUseCount: // Use Count + case EMTPObjectPropCodeAlbumName: // Album Name + case EMTPObjectPropCodeAlbumArtist: // Album Artist + case EMTPObjectPropCodeOriginalReleaseDate: // Original Release Date + case EMTPObjectPropCodeComposer: // Composer + case EMTPObjectPropCodeParentalRating: + iObjectProperty = CMTPTypeObjectPropDesc::NewL( aPropCode ); + break; + + // Number of Channels (m) + case EMTPObjectPropCodeNumberOfChannels: + ServiceNumberOfChannelsL(); + break; + + // Sample Rate (HAS MINIMUM AND MAX VALUE) + case EMTPObjectPropCodeSampleRate: + ServiceCodeSampleRateL(); + break; + + // Audio Wave Codec (MAY REQUIRED LIMITED NUMBER TO BE PRODUCED) + case EMTPObjectPropCodeAudioWAVECodec: + ServiceCodeWaveCodecL(); + break; + + // Audio Bit Rate (MAY REQUIRED LIMITED NUMBER TO BE PRODUCED) + case EMTPObjectPropCodeAudioBitRate: + ServiceCodeAudioBitrateL(); + break; + + // Duration + case EMTPObjectPropCodeDuration: + ServiceDurationL(); + break; + + // Description + case EMTPObjectPropCodeDescription: + ServiceDescriptionL(); + break; + + case EMTPObjectPropCodeWidth: + ServiceRangeFormDescriptionL( aPropCode, + EMTPMinWidth, + EMTPMaxWidth, + EMTPStepWidth ); + break; + + case EMTPObjectPropCodeHeight: + ServiceRangeFormDescriptionL( aPropCode, + EMTPMinHeight, + EMTPMaxHeight, + EMTPStepHeight ); + break; + + case EMTPObjectPropCodeScanType: + ServiceScanTypeDescriptionL(); + break; + + case EMTPObjectPropCodeVideoFourCCCodec: + ServiceVideoFourCCCodecL(); + break; + + case EMTPObjectPropCodeVideoBitRate: + ServiceRangeFormDescriptionL( aPropCode, + EMTPWMVMinBitrate, + EMTPWMVMaxBitrate, + EMTPVideoBitrateStep, + ETrue ); + break; + + case EMTPObjectPropCodeFramesPerThousandSeconds: + ServiceRangeFormDescriptionL( aPropCode, + EMTPMinFramesPerThousandSeconds, + EMTPMaxFramesPerThousandSeconds, + EMTPStepFramesPerThousandSeconds ); + break; + + case EMTPObjectPropCodeKeyFrameDistance: + ServiceRangeFormDescriptionL( aPropCode, + EMTPMinKeyFrameDistance, + EMTPMaxKeyFrameDistance, + EMTPStepKeyFrameDistance ); + break; + + case EMTPObjectPropCodeEncodingProfile: + ServiceEncodingProfileDescriptionL(); + break; + + case EMTPObjectPropCodeDRMStatus: + ServiceDRMStatusL(); + break; + + case EMTPExtObjectPropCodeOmaDrmStatus: + ServiceOMADRMStatusL(); + break; + + default: + User::Leave( KErrNotSupported ); + break; + } + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetObjectPropDesc::ServiceDescriptionL() +// Create Description and create new ObjectPropDesc +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderGetObjectPropDesc::ServiceDescriptionL() + { + TMTPTypeUint32 uint32Data( KMTPDescriptionLen ); + + // Althrough iObjectProperty is released in ServiceL(), + // release it here maybe a more safer way + if ( iObjectProperty != NULL ) + { + delete iObjectProperty; + iObjectProperty = NULL; + } + + iObjectProperty = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeDescription, + CMTPTypeObjectPropDesc::ELongStringForm, + &uint32Data ); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetObjectPropDesc::ServiceNumberOfChannelsL +// Create list of possible Channel numbers and create new ObjectPropDesc +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderGetObjectPropDesc::ServiceNumberOfChannelsL() + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderGetObjectPropDesc::ServiceCodeSampleRateL" ) ); + + CMTPTypeObjectPropDescEnumerationForm* expectedForm = CMTPTypeObjectPropDescEnumerationForm::NewL( EMTPTypeUINT16 ); + CleanupStack::PushL( expectedForm ); // + expectedForm + + TUint16 values[] = + { + EMTPChannelMono, + EMTPChannelStereo + }; + + TInt numValues = sizeof ( values ) / sizeof ( values[0] ) ; + + for ( TInt i = 0; i < numValues; i++ ) + { + TMTPTypeUint16 data( values[i] ); + expectedForm->AppendSupportedValueL( data ); + } + + // Althrough iObjectProperty is released in ServiceL(), + // release it here maybe a more safer way :) + if ( iObjectProperty != NULL ) + { + delete iObjectProperty; + iObjectProperty = NULL; + } + + iObjectProperty = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeNumberOfChannels, *expectedForm ); + CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetObjectPropDesc::ServiceCodeSampleRateL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetObjectPropDesc::ServiceCodeSampleRateL +// Create list of possible Sample rate list and create new ObjectPropDesc +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderGetObjectPropDesc::ServiceCodeSampleRateL() + { + // if some format does not support the sample rate, + // here still need an instance of CMTPTypeObjectPropDesc. + PRINT( _L( "MM MTP => CMediaMtpDataProviderGetObjectPropDesc::ServiceCodeSampleRateL" ) ); + + CMTPTypeObjectPropDescEnumerationForm* expectedForm = + CMTPTypeObjectPropDescEnumerationForm::NewLC( EMTPTypeUINT32 ); // + expectedForm + + TUint32 values[] = + { + EMTPSampleRate8K , + EMTPSampleRate16K, + EMTPSampleRate22_05K, + EMTPSampleRate24K, + EMTPSampleRate32K, + EMTPSampleRate44_1K, + EMTPSampleRate48K + }; + + TInt numValues = sizeof( values ) / sizeof( values[0] ) ; + + for ( TInt i = 0; i < numValues; i++ ) + { + TMTPTypeUint32 data( values[i] ); + expectedForm->AppendSupportedValueL( data ); + } + + // Althrough iObjectProperty is released in ServiceL(), + // release it here maybe a more safer way :) + if ( iObjectProperty != NULL ) + { + delete iObjectProperty; + iObjectProperty = NULL; + } + + iObjectProperty = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeSampleRate, CMTPTypeObjectPropDesc::EEnumerationForm, expectedForm ); + CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetObjectPropDesc::ServiceCodeSampleRateL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetObjectPropDesc::ServiceWaveCodecL +// Create list of possible bitrate types and create new ObjectPropDesc +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderGetObjectPropDesc::ServiceCodeWaveCodecL() + { + PRINT1( _L( "MM MTP => CMediaMtpDataProviderGetObjectPropDesc::ServiceCodeWaveCodecL, format = 0x%x" ), iFormatCode ); + + CMTPTypeObjectPropDescEnumerationForm* form = + CMTPTypeObjectPropDescEnumerationForm::NewLC( EMTPTypeUINT32 ); // + form + + switch (iFormatCode) + { + case EMTPFormatCodeWMA: + case EMTPFormatCodeWMV: + case EMTPFormatCodeASF: + { + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderGetObjectPropDesc::ServiceCodeWaveCodecL format = 0x%x" ), iFormatCode ); + TMTPTypeUint32 data( EMTPAudioWAVECodecWMA ); + form->AppendSupportedValueL( data ); + } + break; + + case EMTPFormatCodeMP3: + { + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderGetObjectPropDesc::ServiceCodeWaveCodecL format = 0x%x" ), iFormatCode ); + TMTPTypeUint32 data( EMTPAudioWAVECodecMP3 ); + form->AppendSupportedValueL( data ); + } + break; + + case EMTPFormatCodeMP4Container: + case EMTPFormatCode3GPContainer: + case EMTPFormatCodeAAC: + { + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderGetObjectPropDesc::ServiceCodeWaveCodecL format = 0x%x" ), iFormatCode ); + TMTPTypeUint32 data( EMTPAudioWAVECodecAAC ); + form->AppendSupportedValueL( data ); + } + break; + + case EMTPFormatCodeWAV: + { + PRINT1( _L("MM MTP <> CMediaMtpDataProviderGetObjectPropDesc::ServiceCodeWaveCodecL format = 0x%x"), iFormatCode ); + TMTPTypeUint32 data( EMTPAudioWAVECodecPCM ); + form->AppendSupportedValueL( data ); + } + break; + + default: + { + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderGetObjectPropDesc::ServiceCodeWaveCodecL leave because of invalid formatcode = 0x%x" ), iFormatCode ); + User::Leave(KErrNotSupported); + } + break; + } + + // Althrough iObjectProperty is released in ServiceL(), + // release it here maybe a more safer way :) + if ( iObjectProperty != NULL ) + { + delete iObjectProperty; + iObjectProperty = NULL; + } + + iObjectProperty = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeAudioWAVECodec, *form ); + CleanupStack::PopAndDestroy( form ); // - form + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetObjectPropDesc::ServiceCodeWaveCodecL" ) ); + } + +void CMediaMtpDataProviderGetObjectPropDesc::ServiceCodeAudioBitrateL() + { + PRINT1( _L("MM MTP => CMediaMtpDataProviderGetObjectPropDesc::ServiceCodeAudioBitrate, format = 0x%x"), iFormatCode ); + + switch (iFormatCode) + { + case EMTPFormatCodeWMA: + case EMTPFormatCodeWMV: + case EMTPFormatCodeASF: + { + ServiceRangeFormDescriptionL( EMTPObjectPropCodeAudioBitRate, + EMTPWMAMinBitrate, + EMTPWMAMaxBitrate, + EMTPAudioBitrateStep ); + } + break; + + case EMTPFormatCodeMP3: + { + ServiceRangeFormDescriptionL( EMTPObjectPropCodeAudioBitRate, + EMTPMP3MinBitrate, + EMTPMP3MaxBitrate, + EMTPAudioBitrateStep ); + } + break; + + case EMTPFormatCodeAAC: + { + ServiceRangeFormDescriptionL( EMTPObjectPropCodeAudioBitRate, + EMTPAACMinBitrate, + EMTPAACMaxBitrate, + EMTPAudioBitrateStep ); + } + break; + + case EMTPFormatCodeWAV: + { + ServiceRangeFormDescriptionL( EMTPObjectPropCodeAudioBitRate, + EMTPPCMMinBitrate, + EMTPPCMMaxBitrate, + EMTPAudioBitrateStep ); + } + break; + + case EMTPFormatCodeMP4Container: + case EMTPFormatCode3GPContainer: + { + ServiceRangeFormDescriptionL( EMTPObjectPropCodeAudioBitRate, + EMTPAACPlusMinBitrate, + EMTPAACPlusMaxBitrate, + EMTPAudioBitrateStep ); + } + break; + + default: + { + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderGetObjectPropDesc::ServiceCodeAudioBitRateL leave because of invalid formatcode = 0x%x" ), iFormatCode ); + User::Leave( KErrNotSupported ); + } + } + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetObjectPropDesc::ServiceCodeAudioBitRateL" ) ); + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropDesc::ServiceDurationL() +// Create list of Duration types and create new ObjectPropDesc +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderGetObjectPropDesc::ServiceDurationL() + { + + PRINT( _L( "MM MTP => CMediaMtpDataProviderGetObjectPropDesc::ServiceDurationL" ) ); + + CMTPTypeObjectPropDescRangeForm* form = CMTPTypeObjectPropDescRangeForm::NewLC( EMTPTypeUINT32 ); // + form + + // Set expected values + form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EMinimumValue, EMTPMinDuration ); + form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EMaximumValue, EMTPMaxDuration ); + form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EStepSize, EMTPDurationStep ); + + // Althrough iObjectProperty is released in ServiceL(), + // release it here maybe a more safer way + if ( iObjectProperty != NULL ) + { + delete iObjectProperty; + iObjectProperty = NULL; + } + + iObjectProperty = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeDuration, *form ); + CleanupStack::PopAndDestroy( form ); // - form + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetObjectPropDesc::ServiceDurationL" ) ); + } + +void CMediaMtpDataProviderGetObjectPropDesc::ServiceScanTypeDescriptionL() + { + CMTPTypeObjectPropDescEnumerationForm* expectedForm = + CMTPTypeObjectPropDescEnumerationForm::NewL( EMTPTypeUINT16 ); + CleanupStack::PushL( expectedForm ); // + expectedForm + + TUint16 values[] = + { + EMTPScanTypeProgressive + }; + + TInt numValues = sizeof ( values ) / sizeof ( values[0] ) ; + for ( TInt i = 0; i < numValues; i++ ) + { + TMTPTypeUint16 data( values[i] ); + expectedForm->AppendSupportedValueL( data ); + } + + // Althrough iObjectProperty is released in ServiceL(), + // release it here maybe a more safer way :) + if ( iObjectProperty != NULL ) + { + delete iObjectProperty; + iObjectProperty = NULL; + } + + iObjectProperty = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeScanType, *expectedForm ); + CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm + } + +void CMediaMtpDataProviderGetObjectPropDesc::ServiceVideoFourCCCodecL() + { + switch( iFormatCode ) + { + case EMTPFormatCodeWMV: + case EMTPFormatCodeASF: + { + CMTPTypeObjectPropDescEnumerationForm* expectedForm = + CMTPTypeObjectPropDescEnumerationForm::NewL( EMTPTypeUINT32 ); + CleanupStack::PushL( expectedForm ); // + expectedForm + + TUint32 values[] = + { + EMTPVideoFourCCCodecWMV3 + }; + + TInt numValues = sizeof ( values ) / sizeof ( values[0] ) ; + for ( TInt i = 0; i < numValues; i++ ) + { + TMTPTypeUint32 data( values[i] ); + expectedForm->AppendSupportedValueL( data ); + } + + // comment out asf fourcc for mp2a and mp4a, not sure if this is needed + /*if ( iFormatCode == EMTPFormatCodeASF ) + { + TUint32 additionalValues[] = + { + EMTPVideoFourCCCodecMP2A, + EMTPVideoFourCCCodecMP4A + }; + + for ( TInt j = 0; i < sizeof(additionalValues) / sizeof(additionalValues[0]) ) + { + TMTPTypeUint32 data( additionalValues[i] ); + expectedForm->AppendSupportedValueL( data ); + } + }*/ + + // Althrough iObjectProperty is released in ServiceL(), + // release it here maybe a more safer way :) + if ( iObjectProperty != NULL ) + { + delete iObjectProperty; + iObjectProperty = NULL; + } + + iObjectProperty = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeVideoFourCCCodec, *expectedForm ); + CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm + } + break; + + default: + { + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderGetObjectPropDesc::ServiceVideoFourCCCodecL leave because of invalid formatcode = 0x%x" ), iFormatCode ); + User::Leave( KErrNotSupported ); + } + break; + } + } + +void CMediaMtpDataProviderGetObjectPropDesc::ServiceVideoBitrateL() + { + switch( iFormatCode ) + { + case EMTPFormatCodeWMV: + case EMTPFormatCodeASF: + { + ServiceRangeFormDescriptionL( EMTPObjectPropCodeAudioBitRate, + EMTPWMVMinBitrate, + EMTPWMVMaxBitrate, + EMTPVideoBitrateStep, + ETrue ); + } + break; + + default: + { + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderGetObjectPropDesc::ServiceVideoBitrateL leave because of invalid formatcode = 0x%x" ), iFormatCode ); + User::Leave( KErrNotSupported ); + } + break; + } + } + +void CMediaMtpDataProviderGetObjectPropDesc::ServiceEncodingProfileDescriptionL() + { + CMTPTypeObjectPropDescEnumerationForm* expectedForm = + CMTPTypeObjectPropDescEnumerationForm::NewLC( EMTPTypeString ); // + expectedForm + + CMTPTypeString* string = CMTPTypeString::NewLC( _L( "SP@LL" ) ); + expectedForm->AppendSupportedValueL( *string ); + string->SetL(_L("SP@ML")); + expectedForm->AppendSupportedValueL( *string ); + string->SetL(_L("MP@LL")); + expectedForm->AppendSupportedValueL( *string ); + + CMTPTypeObjectPropDesc::TPropertyInfo propertyInfo; + propertyInfo.iDataType = EMTPTypeString; + propertyInfo.iFormFlag = CMTPTypeObjectPropDesc::EEnumerationForm; + propertyInfo.iGetSet = CMTPTypeObjectPropDesc::EReadWrite; + iObjectProperty = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeEncodingProfile, + propertyInfo, + expectedForm ); + + CleanupStack::PopAndDestroy( string ); + CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm + } + +void CMediaMtpDataProviderGetObjectPropDesc::ServiceRangeFormDescriptionL( TUint16 aPropCode, + TUint32 aMinValue, + TUint32 aMaxValue, + TUint32 aStepValue, + TBool aIsReadOnly ) + { + CMTPTypeObjectPropDescRangeForm* form = + CMTPTypeObjectPropDescRangeForm::NewLC( EMTPTypeUINT32 ); // + form + + // Set expected values + form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EMinimumValue, aMinValue ); + form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EMaximumValue, aMaxValue ); + form->SetUint32L( CMTPTypeObjectPropDescRangeForm::EStepSize, aStepValue ); + + // Althrough iObjectProperty is released in ServiceL(), + // release it here maybe a more safer way + if ( iObjectProperty != NULL ) + { + delete iObjectProperty; + iObjectProperty = NULL; + } + + CMTPTypeObjectPropDesc::TPropertyInfo propertyInfo; + propertyInfo.iDataType = EMTPTypeUINT32; + propertyInfo.iFormFlag = CMTPTypeObjectPropDesc::ERangeForm; + propertyInfo.iGetSet = !aIsReadOnly; + iObjectProperty = CMTPTypeObjectPropDesc::NewL( aPropCode, propertyInfo, form ); + + CleanupStack::PopAndDestroy( form ); // - form + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropDesc::ServiceDRMStatusL +// Create list of possible DRM status and create new ObjectPropDesc +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderGetObjectPropDesc::ServiceDRMStatusL() + { + CMTPTypeObjectPropDescEnumerationForm* expectedForm = + CMTPTypeObjectPropDescEnumerationForm::NewL( EMTPTypeUINT16 ); + CleanupStack::PushL( expectedForm ); // + expectedForm + + TUint16 values[] = + { + EMTPDrmNoProtection, + EMTPDrmProtection, + EMTPDrmReserveForMTP, + EMTPDrmVenderExtension + }; + + TInt numValues = sizeof ( values ) / sizeof ( values[0] ) ; + for ( TInt i = 0; i < numValues; i++ ) + { + TMTPTypeUint16 data( values[i] ); + expectedForm->AppendSupportedValueL( data ); + } + + // Althrough iObjectProperty is released in ServiceL(), + // release it here maybe a more safer way :) + if ( iObjectProperty != NULL ) + { + delete iObjectProperty; + iObjectProperty = NULL; + } + + iObjectProperty = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeDRMStatus, *expectedForm ); + CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetObjectPropDesc::ServiceOMADRMStatusL +// Create list of possible OMA DRM status and create new ObjectPropDesc +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderGetObjectPropDesc::ServiceOMADRMStatusL() + { + CMTPTypeObjectPropDescEnumerationForm* expectedForm = + CMTPTypeObjectPropDescEnumerationForm::NewL( EMTPTypeUINT8 ); + CleanupStack::PushL( expectedForm ); // + expectedForm + + TUint8 values[] = + { + EMTPOMADrmNoProtection, + EMTPOMADrmProtection, + }; + + TInt numValues = sizeof ( values ) / sizeof ( values[0] ) ; + for ( TInt i = 0; i < numValues; i++ ) + { + TMTPTypeUint8 data( values[i] ); + expectedForm->AppendSupportedValueL( data ); + } + + // Althrough iObjectProperty is released in ServiceL(), + // release it here maybe a more safer way :) + if ( iObjectProperty != NULL ) + { + delete iObjectProperty; + iObjectProperty = NULL; + } + + CMTPTypeObjectPropDesc::TPropertyInfo propertyInfo; + propertyInfo.iDataType = EMTPTypeUINT8; + propertyInfo.iFormFlag = CMTPTypeObjectPropDesc::EEnumerationForm; + + iObjectProperty = CMTPTypeObjectPropDesc::NewL( EMTPExtObjectPropCodeOmaDrmStatus, + propertyInfo, + expectedForm ); + CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataprovidergetobjectproplist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataprovidergetobjectproplist.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,219 @@ +/* +* 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: Implement the operation: getobjectproplist +* +*/ + + +#include +#include +#include +#include + +#include "cmediamtpdataprovidergetobjectproplist.h" +#include "mediamtpdataproviderconst.h" +#include "mmmtpdplogger.h" +#include "cmmmtpdpmetadataaccesswrapper.h" +#include "mmmtpdputility.h" +#include "mmmtpdpdefs.h" +#include "mmmtpdpconfig.h" + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetObjectPropList::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +MMmRequestProcessor* CMediaMtpDataProviderGetObjectPropList::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + CMediaMtpDataProviderGetObjectPropList* self = + new ( ELeave ) CMediaMtpDataProviderGetObjectPropList( aFramework, aConnection, aDpConfig ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetObjectPropList::~CMediaMtpDataProviderGetObjectPropList +// Destructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProviderGetObjectPropList::~CMediaMtpDataProviderGetObjectPropList() + { + + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetObjectPropList::CMediaMtpDataProviderGetObjectPropList +// Standard C++ Constructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProviderGetObjectPropList::CMediaMtpDataProviderGetObjectPropList( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CGetObjectPropList( aFramework, aConnection, aDpConfig ) + { + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetObjectPropList::ConstructL +// 2nd Phase Constructor +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderGetObjectPropList::ConstructL() + { + CGetObjectPropList::ConstructL(); + } + +TInt CMediaMtpDataProviderGetObjectPropList::ServiceSpecificObjectPropertyL( TUint16 aPropCode, + TUint32 aHandle ) + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderGetObjectPropList::ServiceSpecificObjectPropertyL" ) ); + + CMTPTypeString* textData = NULL; + CMTPTypeArray* desData = NULL; + TInt err = KErrNone; + + if ( iPropertyElement != NULL ) + { + delete iPropertyElement; + iPropertyElement = NULL; + } + + switch ( aPropCode ) + { + //case EMTPObjectPropCodeName: + case EMTPObjectPropCodeArtist: + case EMTPObjectPropCodeGenre: + case EMTPObjectPropCodeComposer: + case EMTPObjectPropCodeOriginalReleaseDate: + case EMTPObjectPropCodeAlbumName: + case EMTPObjectPropCodeParentalRating: + case EMTPObjectPropCodeEncodingProfile: + { + textData = CMTPTypeString::NewLC(); // + textData + + TRAP( err, iDpConfig.GetWrapperL().GetObjectMetadataValueL( aPropCode, + *textData, + *iObject ) ); + + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderGetObjectPropList::ServiceSpecificObjectPropertyL err = %d" ), err ); + + if ( err == KErrNone ) + { + iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); + iPropertyElement->SetStringL( CMTPTypeObjectPropListElement::EValue, textData->StringChars()); + } + + CleanupStack::PopAndDestroy( textData ); // - textData + } + break; + + case EMTPObjectPropCodeDescription: + { + desData = CMTPTypeArray::NewLC( EMTPTypeAUINT16 ); // + desData + + TRAP( err, iDpConfig.GetWrapperL().GetObjectMetadataValueL( aPropCode, + *desData, + *iObject ) ); + + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderGetObjectPropList::ServiceSpecificObjectPropertyL err = %d" ), err ); + + if ( err == KErrNone ) + { + iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); + iPropertyElement->SetArrayL( CMTPTypeObjectPropListElement::EValue, *desData); + } + + CleanupStack::PopAndDestroy( desData ); // - desData + } + break; + + case EMTPObjectPropCodeTrack: + case EMTPObjectPropCodeNumberOfChannels: + case EMTPObjectPropCodeScanType: + case EMTPObjectPropCodeDRMStatus: + { + TMTPTypeUint16 uint16( 0 ); + TRAP( err, iDpConfig.GetWrapperL().GetObjectMetadataValueL( aPropCode, + uint16, + *iObject ) ); + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderGetObjectPropList::ServiceSpecificObjectPropertyL err = %d" ), err ); + + if ( err == KErrNone ) + { + iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); + iPropertyElement->SetUint16L( CMTPTypeObjectPropListElement::EValue, uint16.Value()); + } + } + break; + + case EMTPObjectPropCodeWidth: + case EMTPObjectPropCodeHeight: + case EMTPObjectPropCodeDuration: + case EMTPObjectPropCodeUseCount: + case EMTPObjectPropCodeSampleRate: + case EMTPObjectPropCodeAudioWAVECodec: + case EMTPObjectPropCodeAudioBitRate: + case EMTPObjectPropCodeVideoFourCCCodec: + case EMTPObjectPropCodeVideoBitRate: + case EMTPObjectPropCodeFramesPerThousandSeconds: + case EMTPObjectPropCodeKeyFrameDistance: + { + TMTPTypeUint32 uint32 = 0; + TRAP( err, iDpConfig.GetWrapperL().GetObjectMetadataValueL( aPropCode, + uint32, + *iObject ) ); + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderGetObjectPropList::ServiceSpecificObjectPropertyL err = %d" ), err ); + + if ( err == KErrNone ) + { + iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); + iPropertyElement->SetUint32L( CMTPTypeObjectPropListElement::EValue, uint32.Value()); + } + } + break; + + case EMTPExtObjectPropCodeOmaDrmStatus: + { + TInt drmStatus = MmMtpDpUtility::GetDrmStatus( iObject->DesC( CMTPObjectMetaData::ESuid ) ); + TMTPTypeUint8 result; + result.Set( 0 ); + + if ( drmStatus == EMTPDrmStatusProtected ) + result.Set( 1 ); + + iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); + iPropertyElement->SetUint16L( CMTPTypeObjectPropListElement::EDatatype, EMTPTypeUINT8); + iPropertyElement->SetUint8L( CMTPTypeObjectPropListElement::EValue, result.Value()); + } + break; + + default: + { + iPropertyElement = NULL; + err = KErrNotSupported; + } + break; + } + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetObjectPropList::ServiceSpecificObjectPropertyL" ) ); + + return err; + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataprovidergetobjectpropvalue.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataprovidergetobjectpropvalue.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -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: Implement the operation: getobjectpropvalue +* +*/ + + +#include +#include +#include + +#include "cmediamtpdataprovidergetobjectpropvalue.h" +#include "mediamtpdataproviderconst.h" +#include "mmmtpdplogger.h" +#include "mmmtpdputility.h" +#include "cmmmtpdpmetadataaccesswrapper.h" +#include "mmmtpdpdefs.h" +#include "mmmtpdpconfig.h" + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetObjectPropValue::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +MMmRequestProcessor* CMediaMtpDataProviderGetObjectPropValue::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + CMediaMtpDataProviderGetObjectPropValue* self = + new ( ELeave ) CMediaMtpDataProviderGetObjectPropValue( aFramework, + aConnection, + aDpConfig ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetObjectPropValue::ConstructL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderGetObjectPropValue::ConstructL() + { + + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetObjectPropValue::~CMediaMtpDataProviderGetObjectPropValue +// Destructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProviderGetObjectPropValue::~CMediaMtpDataProviderGetObjectPropValue() + { + + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderGetObjectPropValue::CMediaMtpDataProviderGetObjectPropValue +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProviderGetObjectPropValue::CMediaMtpDataProviderGetObjectPropValue( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CGetObjectPropValue( aFramework, aConnection, aDpConfig ) + { + + } + +void CMediaMtpDataProviderGetObjectPropValue::ServiceSpecificObjectPropertyL(TUint16 aPropCode) + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderGetObjectPropValue::ServiceSpecificObjectPropertyL" ) ); + switch ( aPropCode ) + { + case EMTPObjectPropCodeArtist: // 0xDC46 + case EMTPObjectPropCodeGenre: // 0xDC8C + case EMTPObjectPropCodeParentalRating: // 0xDC94 + case EMTPObjectPropCodeComposer: // 0xDC96 + case EMTPObjectPropCodeOriginalReleaseDate: // 0xDC99 + case EMTPObjectPropCodeAlbumName: // 0xDC9A + case EMTPObjectPropCodeEncodingProfile: // 0xDEA1 + { + if ( iMTPTypeString != NULL ) + { + delete iMTPTypeString; + iMTPTypeString = NULL; + } + + iMTPTypeString = CMTPTypeString::NewL(); + ServiceMetaDataFromWrapperL( aPropCode, *iMTPTypeString, *iObjectInfo ); + } + break; + + case EMTPObjectPropCodeDescription: + { + if ( iMTPTypeArray != NULL ) + { + delete iMTPTypeArray; + iMTPTypeArray = NULL; + } + + iMTPTypeArray = CMTPTypeArray::NewL( EMTPTypeAUINT16 ); + ServiceMetaDataFromWrapperL( aPropCode, *iMTPTypeArray, *iObjectInfo ); + } + break; + + case EMTPObjectPropCodeWidth: // 0xDC87 + case EMTPObjectPropCodeHeight: // 0xDC88 + case EMTPObjectPropCodeDuration: // 0xDC89 + case EMTPObjectPropCodeUseCount: // 0xDC91 + case EMTPObjectPropCodeSampleRate: // 0xDE93 + case EMTPObjectPropCodeAudioWAVECodec: // 0xDE99 + case EMTPObjectPropCodeAudioBitRate: // 0xDE9A + case EMTPObjectPropCodeVideoFourCCCodec: // 0xDE9B + case EMTPObjectPropCodeVideoBitRate: // 0xDE9C + case EMTPObjectPropCodeFramesPerThousandSeconds: // 0xDE9D + case EMTPObjectPropCodeKeyFrameDistance: // 0xDE9E + { + iMTPTypeUint32.Set( 0 ); + ServiceMetaDataFromWrapperL( aPropCode, iMTPTypeUint32, *iObjectInfo ); + } + break; + + case EMTPObjectPropCodeTrack: // 0xDC8B + case EMTPObjectPropCodeDRMStatus: // 0xDC9D + case EMTPObjectPropCodeNumberOfChannels: // 0xDE94 + case EMTPObjectPropCodeScanType: // 0xDE97 + { + iMTPTypeUint16.Set( 0 ); + ServiceMetaDataFromWrapperL( aPropCode, iMTPTypeUint16, *iObjectInfo ); + + PRINT1( _L( "MM MTP <> CGetObjectPropValue::ServiceL value = %d" ), iMTPTypeUint16.Value() ); + } + break; + + case EMTPExtObjectPropCodeOmaDrmStatus: + { + TInt drmStatus = MmMtpDpUtility::GetDrmStatus( iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); + iMTPTypeUint8.Set( 0 ); + + if (drmStatus == EMTPDrmStatusProtected) + iMTPTypeUint8.Set( 1 ); + + SendDataL( iMTPTypeUint8 ); + } + break; + + default: + { + User::Leave( KErrNotSupported ); + } + break; + } + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderGetObjectPropValue::ServiceSpecificObjectPropertyL" ) ); + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataprovidermoveobject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataprovidermoveobject.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,395 @@ +/* +* 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: Implement the operation: Copy Object +* +*/ + + +#include +#include +#include +#include + +#include "cmediamtpdataprovidermoveobject.h" +#include "mediamtpdataproviderconst.h" +#include "mmmtpdplogger.h" +#include "mmmtpdputility.h" +#include "cmmmtpdpmetadataaccesswrapper.h" +#include "mmmtpdpdefs.h" +#include "mmmtpdpconfig.h" + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderMoveObject::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +MMmRequestProcessor* CMediaMtpDataProviderMoveObject::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + CMediaMtpDataProviderMoveObject* self = + new ( ELeave ) CMediaMtpDataProviderMoveObject( aFramework, + aConnection, + aDpConfig ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderMoveObject::ConstructL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderMoveObject::ConstructL() + { + CMoveObject::ConstructL(); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderMoveObject::~CMediaMtpDataProviderMoveObject +// Destructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProviderMoveObject::~CMediaMtpDataProviderMoveObject() + { + + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderMoveObject::CMediaMtpDataProviderMoveObject +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProviderMoveObject::CMediaMtpDataProviderMoveObject( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CMoveObject( aFramework, aConnection, aDpConfig ) + { + + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderMoveObject::ServiceSpecificObjectPropertyL +// +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderMoveObject::ServiceGetSpecificObjectPropertyL( TUint16 aPropCode, + TUint32 aHandle, + const CMTPObjectMetaData& aObject ) + { + PRINT1( _L( "MM MTP => CMediaMtpDataProviderMoveObject::ServiceSpecificObjectPropertyL aPropCode(0x%x)" ), aPropCode ); + + CMTPTypeString* textData = NULL; + CMTPTypeArray* desData = NULL; + TInt err = KErrNone; + + if ( iPropertyElement ) + { + delete iPropertyElement; + iPropertyElement = NULL; + } + + switch ( aPropCode ) + { + case EMTPObjectPropCodeArtist: + case EMTPObjectPropCodeGenre: + case EMTPObjectPropCodeComposer: + case EMTPObjectPropCodeOriginalReleaseDate: + case EMTPObjectPropCodeAlbumName: + case EMTPObjectPropCodeParentalRating: + case EMTPObjectPropCodeEncodingProfile: + { + textData = CMTPTypeString::NewLC(); // + textData + + TRAP( err, iDpConfig.GetWrapperL().GetObjectMetadataValueL( aPropCode, + *textData, + aObject ) ); + + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderMoveObject::ServiceSpecificObjectPropertyL err = %d" ), err ); + + if ( err == KErrNone ) + { + iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); + iPropertyElement->SetStringL( CMTPTypeObjectPropListElement::EValue, textData->StringChars()); + +// iPropertyElement = CMTPTypeObjectPropListElement::NewL( aHandle, +// aPropCode, +// *textData ); + } + else if ( err == KErrNotFound ) + { + iPropertyElement = NULL; + } + else + { + User::Leave( err ); + } + + CleanupStack::PopAndDestroy( textData ); // - textData + } + break; + + case EMTPObjectPropCodeDescription: + { + desData = CMTPTypeArray::NewLC( EMTPTypeAUINT16 ); // + desData + + TRAP( err, iDpConfig.GetWrapperL().GetObjectMetadataValueL( aPropCode, + *desData, + aObject ) ); + + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderMoveObject::ServiceSpecificObjectPropertyL err = %d" ), err ); + + if ( err == KErrNone ) + { + + iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); + iPropertyElement->SetArrayL( CMTPTypeObjectPropListElement::EValue, *desData); + +// iPropertyElement = CMTPTypeObjectPropListElement::NewL( aHandle, +// aPropCode, +// *desData ); + } + else if ( err == KErrNotFound ) + { + iPropertyElement = NULL; + } + else + { + User::Leave( err ); + } + + CleanupStack::PopAndDestroy( desData ); // - desData + } + break; + + case EMTPObjectPropCodeTrack: + case EMTPObjectPropCodeNumberOfChannels: + case EMTPObjectPropCodeScanType: + case EMTPObjectPropCodeDRMStatus: + { + TMTPTypeUint16 uint16( 0 ); + TRAP( err, iDpConfig.GetWrapperL().GetObjectMetadataValueL( aPropCode, + uint16, + aObject ) ); + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderMoveObject::ServiceSpecificObjectPropertyL err = %d" ), err ); + + if ( err == KErrNone ) + { + + iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); + iPropertyElement->SetUint16L( CMTPTypeObjectPropListElement::EValue, uint16.Value()); + +// iPropertyElement = CMTPTypeObjectPropListElement::NewL( aHandle, +// aPropCode, +// uint16 ); + } + else if ( err == KErrNotFound ) + { + iPropertyElement = NULL; + } + else + { + User::Leave( err ); + } + } + break; + + case EMTPObjectPropCodeWidth: + case EMTPObjectPropCodeHeight: + case EMTPObjectPropCodeDuration: + case EMTPObjectPropCodeUseCount: + case EMTPObjectPropCodeSampleRate: + case EMTPObjectPropCodeAudioWAVECodec: + case EMTPObjectPropCodeAudioBitRate: + case EMTPObjectPropCodeVideoFourCCCodec: + case EMTPObjectPropCodeVideoBitRate: + case EMTPObjectPropCodeFramesPerThousandSeconds: + case EMTPObjectPropCodeKeyFrameDistance: + { + TMTPTypeUint32 uint32 = 0; + TRAP( err, iDpConfig.GetWrapperL().GetObjectMetadataValueL( aPropCode, + uint32, + aObject ) ); + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderMoveObject::ServiceSpecificObjectPropertyL err = %d" ), err ); + + if ( err == KErrNone ) + { + iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); + iPropertyElement->SetUint32L( CMTPTypeObjectPropListElement::EValue, uint32.Value()); + +// iPropertyElement = CMTPTypeObjectPropListElement::NewL( aHandle, +// aPropCode, +// uint32 ); + } + else if ( err == KErrNotFound ) + { + iPropertyElement = NULL; + } + else + { + User::Leave( err ); + } + } + break; + + case EMTPExtObjectPropCodeOmaDrmStatus: + { + TInt drmStatus = MmMtpDpUtility::GetDrmStatus( aObject.DesC( CMTPObjectMetaData::ESuid ) ); + TMTPTypeUint8 result; + result.Set( 0 ); + + if ( drmStatus == EMTPDrmStatusProtected ) + result.Set( 1 ); + + iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); + iPropertyElement->SetUint16L( CMTPTypeObjectPropListElement::EDatatype, EMTPTypeUINT8); + iPropertyElement->SetUint8L( CMTPTypeObjectPropListElement::EValue, result.Value()); + +// iPropertyElement = CMTPTypeObjectPropListElement::NewL( aHandle, +// aPropCode, +// EMTPTypeUINT8, +// result ); + } + break; + + default: + { + User::Leave( KErrNotSupported ); + } + break; + } + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderMoveObject::ServiceSpecificObjectPropertyL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderMoveObject::ServiceSetSpecificObjectPropertyL +// +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CMediaMtpDataProviderMoveObject::ServiceSetSpecificObjectPropertyL( TUint16 aPropCode, const CMTPObjectMetaData& aObject, + const CMTPTypeObjectPropListElement& aElement ) + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderMoveObject::ServiceSetSpecificObjectPropertyL" ) ); + TMTPResponseCode responseCode( EMTPRespCodeOK ); + + switch ( aPropCode ) + { + case EMTPObjectPropCodeArtist: + case EMTPObjectPropCodeGenre: + case EMTPObjectPropCodeComposer: + case EMTPObjectPropCodeOriginalReleaseDate: + case EMTPObjectPropCodeAlbumName: + case EMTPObjectPropCodeParentalRating: + case EMTPObjectPropCodeEncodingProfile: + { + CMTPTypeString* stringData = + CMTPTypeString::NewLC( aElement.StringL( CMTPTypeObjectPropListElement::EValue ) );// + stringData + + responseCode = ServiceMetaDataToWrapper( aPropCode, + *stringData, + aObject ); + + CleanupStack::PopAndDestroy( stringData );// - stringData + } + break; + + case EMTPObjectPropCodeVideoBitRate: + { + responseCode = EMTPRespCodeAccessDenied; + } + break; + + case EMTPObjectPropCodeDescription: + { + CMTPTypeArray* desData = CMTPTypeArray::NewLC( EMTPTypeAUINT16 ); // + desData +// aElement.GetL( CMTPTypeObjectPropListElement::EValue, *desData ); + + desData->SetByDesL(aElement.ArrayL(CMTPTypeObjectPropListElement::EValue )); + responseCode = ServiceMetaDataToWrapper( aPropCode, + *desData, + aObject ); + CleanupStack::PopAndDestroy( desData ); // - desData + } + break; + + case EMTPObjectPropCodeWidth: + case EMTPObjectPropCodeHeight: + case EMTPObjectPropCodeDuration: + case EMTPObjectPropCodeUseCount: + case EMTPObjectPropCodeSampleRate: + case EMTPObjectPropCodeAudioWAVECodec: + case EMTPObjectPropCodeAudioBitRate: + case EMTPObjectPropCodeVideoFourCCCodec: + case EMTPObjectPropCodeFramesPerThousandSeconds: + case EMTPObjectPropCodeKeyFrameDistance: + { + TMTPTypeUint32 uint32( aElement.Uint32L( CMTPTypeObjectPropListElement::EValue ) ); + responseCode = ServiceMetaDataToWrapper( aPropCode, + uint32, + aObject ); + } + break; + + case EMTPObjectPropCodeTrack: + case EMTPObjectPropCodeNumberOfChannels: + case EMTPObjectPropCodeScanType: + case EMTPObjectPropCodeDRMStatus: + { + TMTPTypeUint16 uint16( aElement.Uint16L( CMTPTypeObjectPropListElement::EValue )); + responseCode = ServiceMetaDataToWrapper( aPropCode, + uint16, + aObject ); + } + break; + + case EMTPExtObjectPropCodeOmaDrmStatus: + { + TInt drmStatus = MmMtpDpUtility::GetDrmStatus( aObject.DesC( + CMTPObjectMetaData::ESuid ) ); + + if ( drmStatus == EMTPDrmStatusUnknown ) + { + responseCode = EMTPRespCodeAccessDenied; + } + else + { + TMTPTypeUint8 newValue( aElement.Uint8L( CMTPTypeObjectPropListElement::EValue ) ); + + // there's no DB field to remember the value, so return an error + // if there's a mismatch to CAF protection status + if ( ( ( drmStatus == EMTPDrmStatusProtected ) && ( newValue.Value() == 0 ) ) + || ( ( drmStatus == EMTPDrmStatusNotProtected ) && ( newValue.Value() == 1 ) ) ) + { + responseCode = EMTPRespCodeAccessDenied; + } + } + } + break; + + default: + { + User::Leave( KErrNotSupported ); + } + break; + } + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderMoveObject::ServiceSetSpecificObjectPropertyL" ) ); + + return responseCode; + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataprovidersendobject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataprovidersendobject.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,289 @@ +/* + * 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: Implement the operation: SendObjectInfo/SendObjectPropList/SendObject + * + */ + +#include +#include +#include +#include + +#include "cmediamtpdataprovidersendobject.h" +#include "mediamtpdataproviderconst.h" +#include "mmmtpdplogger.h" +#include "cmmmtpdpmetadataaccesswrapper.h" +#include "mmmtpdputility.h" + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderSendObject::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +MMmRequestProcessor* CMediaMtpDataProviderSendObject::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig) + { + CMediaMtpDataProviderSendObject* self = new ( ELeave ) CMediaMtpDataProviderSendObject( aFramework, aConnection, aDpConfig ); + + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderSendObject::~CMediaMtpDataProviderSendObject +// Destructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProviderSendObject::~CMediaMtpDataProviderSendObject() + { + + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderSendObject::CMediaMtpDataProviderSendObject +// Standard C++ Constructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProviderSendObject::CMediaMtpDataProviderSendObject( + MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig) : + CSendObject(aFramework, aConnection, aDpConfig) + { + + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderSendObject::ConstructL +// 2nd Phase Constructor +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderSendObject::ConstructL() + { + CSendObject::ConstructL(); + } + +TMTPResponseCode CMediaMtpDataProviderSendObject::CheckSepecificPropType( TUint16 aPropCode, TUint16 aDataType ) + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderSendObject::CheckSepecificPropType" ) ); + TMTPResponseCode responseCode( EMTPRespCodeOK ); + + switch ( aPropCode ) + { + case EMTPObjectPropCodeArtist: // 0xDC46 + case EMTPObjectPropCodeGenre: // 0xDC8C + case EMTPObjectPropCodeParentalRating: // 0xDC94 + case EMTPObjectPropCodeComposer: // 0xDC96 + case EMTPObjectPropCodeOriginalReleaseDate: // 0xDC99 + case EMTPObjectPropCodeAlbumName: // 0xDC9A + case EMTPObjectPropCodeEncodingProfile: // 0xDEA1 + if ( aDataType != EMTPTypeString) + { + responseCode = EMTPRespCodeInvalidObjectPropFormat; + } + break; + + case EMTPObjectPropCodeDescription: + if ( aDataType != EMTPTypeAUINT16) + { + responseCode = EMTPRespCodeInvalidObjectPropFormat; + } + break; + + case EMTPObjectPropCodeTrack: // 0xDC8B + case EMTPObjectPropCodeDRMStatus: // 0xDC9D + case EMTPObjectPropCodeNumberOfChannels: // 0xDE94 + case EMTPObjectPropCodeScanType: // 0xDE97 + if ( aDataType != EMTPTypeUINT16) + { + responseCode = EMTPRespCodeInvalidObjectPropFormat; + } + break; + + //Get Data for Int32 objects + case EMTPObjectPropCodeWidth: // 0xDC87 + case EMTPObjectPropCodeHeight: // 0xDC88 + case EMTPObjectPropCodeDuration: // 0xDC89 + case EMTPObjectPropCodeUseCount: // 0xDC91 + case EMTPObjectPropCodeSampleRate: // 0xDE93 + case EMTPObjectPropCodeAudioWAVECodec: // 0xDE99 + case EMTPObjectPropCodeAudioBitRate: // 0xDE9A + case EMTPObjectPropCodeVideoFourCCCodec: // 0xDE9B + case EMTPObjectPropCodeFramesPerThousandSeconds: // 0xDE9D + case EMTPObjectPropCodeKeyFrameDistance: // 0xDE9E + if ( aDataType != EMTPTypeUINT32) + { + responseCode = EMTPRespCodeInvalidObjectPropFormat; + } + break; + + case EMTPExtObjectPropCodeOmaDrmStatus: + if ( aDataType != EMTPTypeUINT8) + { + responseCode = EMTPRespCodeInvalidObjectPropFormat; + } + break; + + default: + // It's not possible to run here. + responseCode = EMTPRespCodeInvalidObjectPropCode; + break; + + } + PRINT1( _L( "MM MTP <= CMediaMtpDataProviderSendObject::CheckSepecificPropType, responseCode = 0x%X" ), responseCode ); + return responseCode; + } + +TMTPResponseCode CMediaMtpDataProviderSendObject::SetSpecificObjectPropertyL( TUint16 aPropCode, + const CMTPObjectMetaData& aObject, + const CMTPTypeObjectPropListElement& aElement ) + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderSendObject::SetSpecificObjectPropertyL" ) ); + TMTPResponseCode responseCode(EMTPRespCodeOK); + + switch ( aPropCode ) + { + case EMTPObjectPropCodeArtist: + case EMTPObjectPropCodeGenre: + case EMTPObjectPropCodeComposer: + case EMTPObjectPropCodeOriginalReleaseDate: + case EMTPObjectPropCodeAlbumName: + case EMTPObjectPropCodeParentalRating: + case EMTPObjectPropCodeEncodingProfile: + { + CMTPTypeString* stringData = + CMTPTypeString::NewLC( aElement.StringL( CMTPTypeObjectPropListElement::EValue ) );// + stringData + + responseCode = SetMetaDataToWrapperL( aPropCode, + *stringData, + aObject ); + + CleanupStack::PopAndDestroy( stringData );// - stringData + } + break; + + case EMTPObjectPropCodeVideoBitRate: + // TODO: Does anything need to be done? + /* spec: + * Object properties that are get-only (0x00 GET) + * should accept values during object creation by + * way of the SendObjectPropList command. + */ + break; + + case EMTPObjectPropCodeDescription: + { + CMTPTypeArray* desData = CMTPTypeArray::NewLC( EMTPTypeAUINT16 ); // + desData + // aElement.GetL( CMTPTypeObjectPropListElement::EValue, *desData ); + desData->SetByDesL( aElement.ArrayL( CMTPTypeObjectPropListElement::EValue ) ); + responseCode = SetMetaDataToWrapperL( aPropCode, + *desData, + aObject ); + CleanupStack::PopAndDestroy( desData ); // - desData + } + break; + + case EMTPObjectPropCodeWidth: + case EMTPObjectPropCodeHeight: + case EMTPObjectPropCodeDuration: + case EMTPObjectPropCodeUseCount: + case EMTPObjectPropCodeSampleRate: + case EMTPObjectPropCodeAudioWAVECodec: + case EMTPObjectPropCodeAudioBitRate: + case EMTPObjectPropCodeVideoFourCCCodec: + case EMTPObjectPropCodeFramesPerThousandSeconds: + case EMTPObjectPropCodeKeyFrameDistance: + { + TMTPTypeUint32 uint32( aElement.Uint32L( CMTPTypeObjectPropListElement::EValue ) ); + responseCode = SetMetaDataToWrapperL( aPropCode, + uint32, + aObject ); + } + break; + + case EMTPObjectPropCodeTrack: + case EMTPObjectPropCodeNumberOfChannels: + case EMTPObjectPropCodeScanType: + case EMTPObjectPropCodeDRMStatus: + { + TMTPTypeUint16 uint16( aElement.Uint16L( CMTPTypeObjectPropListElement::EValue ) ); + responseCode = SetMetaDataToWrapperL( aPropCode, + uint16, + aObject ); + } + break; + + case EMTPExtObjectPropCodeOmaDrmStatus: + { + TInt drmStatus = MmMtpDpUtility::GetDrmStatus( aObject.DesC( CMTPObjectMetaData::ESuid ) ); + + if ( drmStatus == EMTPDrmStatusUnknown ) + { + responseCode = EMTPRespCodeAccessDenied; + } + else + { + TMTPTypeUint8 newValue( aElement.Uint8L( CMTPTypeObjectPropListElement::EValue ) ); + + // there's no DB field to remember the value, so return an error + // if there's a mismatch to CAF protection status + if ( ( ( drmStatus == EMTPDrmStatusProtected ) + && ( newValue.Value() == 0 ) ) + || ( ( drmStatus == EMTPDrmStatusNotProtected ) + && ( newValue.Value() == 1 ) ) ) + { + responseCode = EMTPRespCodeAccessDenied; + } + } + } + break; + + default: + { + PRINT( _L( "MM MTP <> Default CASE leaving CMedia...tInfo::SetSpecificObjectPropertyL" ) ); + User::Leave( KErrNotSupported ); + } + break; + } + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderSendObject::ServiceSpecificObjectPropertyL" ) ); + + return responseCode; + } + +// TODO: Is it necessary? +TInt CMediaMtpDataProviderSendObject::HandleSpecificWrapperError( TInt aError, + const CMTPObjectMetaData& aObject ) + { + PRINT( _L( "MM MTP <> CMediaMtpDataProviderSendObject::HandleSpecificWrapperError" ) ); + TInt err = aError; + + if ( ( err == KErrNotSupported ) + && ( ( aObject.Uint( CMTPObjectMetaData::EFormatCode ) == EMTPFormatCodeASF ) + || ( aObject.Uint( CMTPObjectMetaData::EFormatCode ) == EMTPFormatCodeMP4Container ) + || ( aObject.Uint( CMTPObjectMetaData::EFormatCode ) == EMTPFormatCode3GPContainer ) ) ) + { + // do nothing, handle gracefully + // should only happens for container case where metadata field does not match in different DB + err = KErrNone; + PRINT( _L( "MM MTP <> CMediaMtpDataProviderSendObject::HandleSpecificWrapperError, gracefully dealt with error" ) ); + } + + return err; + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataprovidersetobjectproplist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataprovidersetobjectproplist.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,211 @@ +/* +* 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: Implement the operation: getobjectproplist +* +*/ + + +#include +#include +#include +#include + +#include "cmediamtpdataprovidersetobjectproplist.h" +#include "mediamtpdataproviderconst.h" +#include "mmmtpdplogger.h" +#include "cmmmtpdpmetadataaccesswrapper.h" +#include "mmmtpdputility.h" + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderSetObjectPropList::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +MMmRequestProcessor* CMediaMtpDataProviderSetObjectPropList::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + CMediaMtpDataProviderSetObjectPropList* self = + new ( ELeave ) CMediaMtpDataProviderSetObjectPropList( aFramework, aConnection, aDpConfig ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderSetObjectPropList::~CMediaMtpDataProviderSetObjectPropList +// Destructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProviderSetObjectPropList::~CMediaMtpDataProviderSetObjectPropList() + { + + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderSetObjectPropList::CMediaMtpDataProviderSetObjectPropList +// Standard C++ Constructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProviderSetObjectPropList::CMediaMtpDataProviderSetObjectPropList( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CSetObjectPropList( aFramework, aConnection, aDpConfig ) + { + + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderSetObjectPropList::ConstructL +// 2nd Phase Constructor +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderSetObjectPropList::ConstructL() + { + CSetObjectPropList::ConstructL(); + } + +TMTPResponseCode CMediaMtpDataProviderSetObjectPropList::ServiceSpecificObjectPropertyL( TUint16 aPropCode, const CMTPObjectMetaData& aObject, + const CMTPTypeObjectPropListElement& aElement ) + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderSetObjectPropList::ServiceSpecificObjectPropertyL" ) ); + TMTPResponseCode responseCode( EMTPRespCodeOK ); + + switch ( aPropCode ) + { + case EMTPObjectPropCodeArtist: + case EMTPObjectPropCodeGenre: + case EMTPObjectPropCodeComposer: + case EMTPObjectPropCodeOriginalReleaseDate: + case EMTPObjectPropCodeAlbumName: + case EMTPObjectPropCodeParentalRating: + case EMTPObjectPropCodeEncodingProfile: + { + CMTPTypeString* stringData = + CMTPTypeString::NewLC( aElement.StringL( CMTPTypeObjectPropListElement::EValue ) );// + stringData + + responseCode = ServiceMetaDataToWrapperL( aPropCode, + *stringData, + aObject ); + + CleanupStack::PopAndDestroy( stringData );// - stringData + } + break; + + case EMTPObjectPropCodeVideoBitRate: + { + responseCode = EMTPRespCodeAccessDenied; + } + break; + + case EMTPObjectPropCodeDescription: + { + CMTPTypeArray* desData = CMTPTypeArray::NewLC( EMTPTypeAUINT16 ); // + desData +// aElement.GetL( CMTPTypeObjectPropListElement::EValue, *desData ); + desData->SetByDesL(aElement.ArrayL(CMTPTypeObjectPropListElement::EValue )); + responseCode = ServiceMetaDataToWrapperL( aPropCode, + *desData, + aObject ); + CleanupStack::PopAndDestroy( desData ); // - desData + } + break; + + case EMTPObjectPropCodeWidth: + case EMTPObjectPropCodeHeight: + case EMTPObjectPropCodeDuration: + case EMTPObjectPropCodeUseCount: + case EMTPObjectPropCodeSampleRate: + case EMTPObjectPropCodeAudioWAVECodec: + case EMTPObjectPropCodeAudioBitRate: + case EMTPObjectPropCodeVideoFourCCCodec: + case EMTPObjectPropCodeFramesPerThousandSeconds: + case EMTPObjectPropCodeKeyFrameDistance: + { + TMTPTypeUint32 uint32( aElement.Uint32L( CMTPTypeObjectPropListElement::EValue ) ); + responseCode = ServiceMetaDataToWrapperL( aPropCode, + uint32, + aObject ); + } + break; + + case EMTPObjectPropCodeTrack: + case EMTPObjectPropCodeNumberOfChannels: + case EMTPObjectPropCodeScanType: + case EMTPObjectPropCodeDRMStatus: + { + TMTPTypeUint16 uint16( aElement.Uint16L( CMTPTypeObjectPropListElement::EValue )); + responseCode = ServiceMetaDataToWrapperL( aPropCode, + uint16, + aObject ); + } + break; + + case EMTPExtObjectPropCodeOmaDrmStatus: + { + TInt drmStatus = MmMtpDpUtility::GetDrmStatus( aObject.DesC( CMTPObjectMetaData::ESuid ) ); + + if (drmStatus == EMTPDrmStatusUnknown) + { + responseCode = EMTPRespCodeAccessDenied; + } + else + { + TMTPTypeUint8 newValue( aElement.Uint8L( CMTPTypeObjectPropListElement::EValue ) ); + + // there's no DB field to remember the value, so return an error + // if there's a mismatch to CAF protection status + if ( ( ( drmStatus == EMTPDrmStatusProtected) && ( newValue.Value() == 0 ) ) || + ( ( drmStatus == EMTPDrmStatusNotProtected ) && ( newValue.Value() == 1 ) ) ) + { + responseCode = EMTPRespCodeAccessDenied; + } + } + } + break; + + default: + { + User::Leave( KErrNotSupported ); + } + break; + } + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderSetObjectPropList::ServiceSpecificObjectPropertyL" ) ); + + return responseCode; + } + +TInt CMediaMtpDataProviderSetObjectPropList::HandleSpecificWrapperError( TInt aError, + const CMTPObjectMetaData& aObject) + { + TInt err = aError; + + if ( ( err == KErrNotSupported ) + && ( ( aObject.Uint( CMTPObjectMetaData::EFormatCode ) == EMTPFormatCodeASF ) + || ( aObject.Uint( CMTPObjectMetaData::EFormatCode ) == EMTPFormatCodeMP4Container ) + || ( aObject.Uint( CMTPObjectMetaData::EFormatCode ) == EMTPFormatCode3GPContainer ) ) ) + { + // do nothing, handle gracefully + // should only happens for container case where metadata field does not match in different DB + err = KErrNone; + PRINT( _L( "MM MTP <> CMediaMtpDataProviderSetObjectPropList::HandleSpecificWrapperError, gracefully dealt with error" ) ); + } + + return err; + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataprovidersetobjectpropvalue.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataprovidersetobjectpropvalue.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,247 @@ +/* +* 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: Implement opeartion setobjectpropvalue +* +*/ + + +#include +#include +#include +#include + +#include "cmediamtpdataprovidersetobjectpropvalue.h" +#include "mediamtpdataproviderconst.h" +#include "mmmtpdplogger.h" +#include "mmmtpdputility.h" +#include "cmmmtpdpmetadataaccesswrapper.h" +#include "mmmtpdpdefs.h" + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderSetObjectPropValue::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +MMmRequestProcessor* CMediaMtpDataProviderSetObjectPropValue::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + CMediaMtpDataProviderSetObjectPropValue* self = + new ( ELeave ) CMediaMtpDataProviderSetObjectPropValue( aFramework, + aConnection, + aDpConfig ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderSetObjectPropValue::ConstructL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderSetObjectPropValue::ConstructL() + { + + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderSetObjectPropValue::CMediaMtpDataProviderSetObjectPropValue +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProviderSetObjectPropValue::CMediaMtpDataProviderSetObjectPropValue( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CSetObjectPropValue( aFramework, aConnection, aDpConfig ) + { + + } + +// ----------------------------------------------------------------------------- +// CMediaMtpDataProviderSetObjectPropValue::~CMediaMtpDataProviderSetObjectPropValue +// Destructor +// ----------------------------------------------------------------------------- +// +CMediaMtpDataProviderSetObjectPropValue::~CMediaMtpDataProviderSetObjectPropValue() + { + + } + +TBool CMediaMtpDataProviderSetObjectPropValue::IsSpecificPropCodeReadOnly( TUint16 aPropCode ) const + { + TBool returnCode = EFalse; + + if ( aPropCode == EMTPObjectPropCodeVideoBitRate ) + returnCode = ETrue; + + return returnCode; + } + +void CMediaMtpDataProviderSetObjectPropValue::ReceiveDataSpecificObjectPropertyL( TUint16 aPropCode ) + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderSetObjectPropValue::RecieveDataSpecificObjectPropertyL" ) ); + + switch ( aPropCode ) + { + case EMTPObjectPropCodeArtist: // 0xDC46 + case EMTPObjectPropCodeGenre: // 0xDC8C + case EMTPObjectPropCodeParentalRating: // 0xDC94 + case EMTPObjectPropCodeComposer: // 0xDC96 + case EMTPObjectPropCodeOriginalReleaseDate: // 0xDC99 + case EMTPObjectPropCodeAlbumName: // 0xDC9A + case EMTPObjectPropCodeEncodingProfile: // 0xDEA1 + { + delete iMTPTypeString; + iMTPTypeString = NULL; + iMTPTypeString = CMTPTypeString::NewL(); + ReceiveDataL( *iMTPTypeString ); + } + break; + + case EMTPObjectPropCodeDescription: + { + delete iMTPTypeArray; + iMTPTypeArray = NULL; + iMTPTypeArray = CMTPTypeArray::NewL( EMTPTypeAUINT16 ); + ReceiveDataL( *iMTPTypeArray ); + } + break; + + //Get Data for Int16 objects + case EMTPObjectPropCodeTrack: // 0xDC8B + case EMTPObjectPropCodeDRMStatus: // 0xDC9D + case EMTPObjectPropCodeNumberOfChannels: // 0xDE94 + case EMTPObjectPropCodeScanType: // 0xDE97 + ReceiveDataL( iMTPTypeUint16 ); + break; + + //Get Data for Int32 objects + case EMTPObjectPropCodeWidth: // 0xDC87 + case EMTPObjectPropCodeHeight: // 0xDC88 + case EMTPObjectPropCodeDuration: // 0xDC89 + case EMTPObjectPropCodeUseCount: // 0xDC91 + case EMTPObjectPropCodeSampleRate: // 0xDE93 + case EMTPObjectPropCodeAudioWAVECodec: // 0xDE99 + case EMTPObjectPropCodeAudioBitRate: // 0xDE9A + case EMTPObjectPropCodeVideoFourCCCodec: // 0xDE9B + case EMTPObjectPropCodeFramesPerThousandSeconds: // 0xDE9D + case EMTPObjectPropCodeKeyFrameDistance: // 0xDE9E + ReceiveDataL( iMTPTypeUint32 ); + break; + + case EMTPExtObjectPropCodeOmaDrmStatus: + ReceiveDataL( iMTPTypeUint8 ); + break; + + default: + User::Leave( KErrNotSupported ); + break; + } + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderSetObjectPropValue::RecieveDataSpecificObjectPropertyL" ) ); + } + +TMTPResponseCode CMediaMtpDataProviderSetObjectPropValue::ServiceSpecificObjectPropertyL( TUint16 aPropCode ) + { + TMTPResponseCode responseCode = EMTPRespCodeOK; + + switch ( aPropCode ) + { + case EMTPObjectPropCodeArtist: // 0xDC46 + case EMTPObjectPropCodeGenre: //0xDC8C + case EMTPObjectPropCodeParentalRating: //0xDC94 + case EMTPObjectPropCodeComposer: //0xDC96 + case EMTPObjectPropCodeOriginalReleaseDate: //0xDC99 + case EMTPObjectPropCodeAlbumName: //0xDC9A + case EMTPObjectPropCodeEncodingProfile: //0xDEA1 + { + responseCode = ServiceMetaDataToWrapperL( iPropCode, + *iMTPTypeString, + *iObjectInfo ); + } + break; + + case EMTPObjectPropCodeDescription: + { + responseCode = ServiceMetaDataToWrapperL( EMTPObjectPropCodeDescription, + *iMTPTypeArray, + *iObjectInfo ); + } + break; + + case EMTPObjectPropCodeWidth: //0xDC87 + case EMTPObjectPropCodeHeight: //0xDC88 + case EMTPObjectPropCodeDuration: //0xDC89 + case EMTPObjectPropCodeUseCount: //0xDC91 + case EMTPObjectPropCodeSampleRate: //0xDE93 + case EMTPObjectPropCodeAudioWAVECodec: //0xDE99 + case EMTPObjectPropCodeAudioBitRate: //0xDE9A + case EMTPObjectPropCodeVideoFourCCCodec: //0xDE9B + case EMTPObjectPropCodeFramesPerThousandSeconds: //0xDE9D + case EMTPObjectPropCodeKeyFrameDistance: //0xDE9E + { + responseCode = ServiceMetaDataToWrapperL( iPropCode, + iMTPTypeUint32, + *iObjectInfo ); + } + break; + + case EMTPObjectPropCodeTrack: // 0xDC8B + case EMTPObjectPropCodeDRMStatus: // 0xDC9D + case EMTPObjectPropCodeNumberOfChannels: // 0xDE94 + case EMTPObjectPropCodeScanType: // 0xDE97 + { + responseCode = ServiceMetaDataToWrapperL( iPropCode, + iMTPTypeUint16, + *iObjectInfo ); + } + break; + + case EMTPExtObjectPropCodeOmaDrmStatus: + { + CMTPObjectMetaData& aObject( *iObjectInfo ); + TInt drmStatus = MmMtpDpUtility::GetDrmStatus( aObject.DesC( CMTPObjectMetaData::ESuid ) ); + + if (drmStatus == EMTPDrmStatusUnknown) + { + responseCode = EMTPRespCodeAccessDenied; + } + else + { + TMTPTypeUint8 newValue( iMTPTypeUint8 ); + + // there's no DB field to remember the value, so return an error + // if there's a mismatch to CAF protection status + if ( ( ( drmStatus == EMTPDrmStatusProtected) && ( newValue.Value() == 0 ) ) || + ( ( drmStatus == EMTPDrmStatusNotProtected ) && ( newValue.Value() == 1 ) ) ) + { + responseCode = EMTPRespCodeAccessDenied; + } + } + } + break; + + default: + { + User::Leave( KErrNotSupported ); + } + break; + } + + return responseCode; + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/mediamtpdataprovidercontrollerimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/mediamtpdataprovidercontrollerimp.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,43 @@ +/* +* 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 + +#include "cmediamtpdataprovider.h" + +// ----------------------------------------------------------------------------- +// Define the interface UIDs +// ----------------------------------------------------------------------------- +// +static const TImplementationProxy ImplementationTable[] = + { + {{0x10207C4B}, (TProxyNewLPtr) ( CMediaMtpDataProvider::NewL )} + }; + +// ----------------------------------------------------------------------------- +// ECOM entry point +// ----------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount ) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/mediamtpdataproviderprocessor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/mediamtpdataproviderprocessor.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,109 @@ +/* +* 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: media mtp data provider processor handle +* +*/ + + +#include + +//Include the standard request processor headers +#include "crequestunknown.h" + +#include "mediamtpdataproviderprocessor.h" + +//Include the required header for carrying out the specified request +#include "mmmtpdplogger.h" + +#include "cgetobjectpropssupported.h" +#include "cmediamtpdataprovidergetobjectpropdesc.h" +#include "cmediamtpdataprovidergetinterdependentpropdesc.h" +#include "cgetobject.h" +#include "cgetobjectinfo.h" +#include "cmediamtpdataprovidergetobjectpropvalue.h" +#include "cmediamtpdataprovidergetobjectproplist.h" +#include "cmediamtpdataprovidersendobject.h" +#include "cmediamtpdataprovidersetobjectpropvalue.h" +#include "cmediamtpdataprovidersetobjectproplist.h" +#include "cgetobjectreferences.h" +#include "csetobjectreferences.h" +#include "cdeleteobject.h" +#include "cmediamtpdataprovidercopyobject.h" +#include "cmediamtpdataprovidermoveobject.h" +#include "cgetpartialobject.h" +#include "cmediamtpdataprovidergetformatcapabilities.h" + +/** A mapping table from the operation code to the request processor factory method */ +const TMediaMtpDataProviderRequestProcessorEntry KKMediaMtpDataProviderRequestProcessorTable[] = + { + {EMTPOpCodeGetObjectPropsSupported, CGetObjectPropsSupported::NewL}, //Get Supported Props + {EMTPOpCodeGetObjectPropDesc, CMediaMtpDataProviderGetObjectPropDesc::NewL}, //Get Props Description + {EMTPOpCodeGetInterdependentPropDesc, CMediaMtpDataProviderGetInterDependentPropDesc::NewL},//Get Interdependent PropDesc + {EMTPOpCodeGetObjectInfo, CGetObjectInfo::NewL}, //GetObjectInfo + {EMTPOpCodeGetObject, CGetObject::NewL}, //GetObject + {EMTPOpCodeGetObjectPropValue, CMediaMtpDataProviderGetObjectPropValue::NewL}, //Get Props Value + {EMTPOpCodeGetObjectPropList, CMediaMtpDataProviderGetObjectPropList::NewL}, //GetObjectPropList + {EMTPOpCodeSendObjectInfo, CMediaMtpDataProviderSendObject::NewL}, //SendObjectInfo (routed to SendObject) + {EMTPOpCodeSendObject, CMediaMtpDataProviderSendObject::NewL}, //SendObject + {EMTPOpCodeSendObjectPropList, CMediaMtpDataProviderSendObject::NewL}, // SendobjectPropList (routed to SendObject) + {EMTPOpCodeSetObjectPropValue, CMediaMtpDataProviderSetObjectPropValue::NewL}, //Set Props Value + {EMTPOpCodeSetObjectPropList, CMediaMtpDataProviderSetObjectPropList::NewL}, //SetObjectPropList + {EMTPOpCodeDeleteObject, CDeleteObject::NewL}, //DeleteObject + {EMTPOpCodeCopyObject, CMediaMtpDataProviderCopyObject::NewL}, // Copy Object + {EMTPOpCodeMoveObject, CMediaMtpDataProviderMoveObject::NewL}, // Move Object + {EMTPOpCodeGetPartialObject, CGetPartialObject::NewL}, // GetPartialObject + {EMTPOpCodeSetObjectReferences, CSetObjectReferences::NewL}, //Set Object References + {EMTPOpCodeGetObjectReferences, CGetObjectReferences::NewL}, //Get Object References + {EMTPOpCodeGetFormatCapabilities, CMediaMtpDataProviderGetFormatCapabilities::NewL} // GetFormatCapabilities + }; + +// ----------------------------------------------------------------------------- +// MediaMtpDataProviderProcessor::CreateL +// Create a request processor that matches the request +// ----------------------------------------------------------------------------- +// +MMmRequestProcessor* MediaMtpDataProviderProcessor::CreateL( MMTPDataProviderFramework& aFramework, + const TMTPTypeRequest& aRequest, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + TMediaMtpDataProviderRequestProcessorCreateFunc createFunc = NULL; + TUint16 operationCode = aRequest.Uint16( + TMTPTypeRequest::ERequestOperationCode ); + + TInt count = sizeof ( KKMediaMtpDataProviderRequestProcessorTable ) + / sizeof( TMediaMtpDataProviderRequestProcessorEntry ); + + for ( TInt i = 0; i < count; i++ ) + { + if ( KKMediaMtpDataProviderRequestProcessorTable[i].iOperationCode + == operationCode ) + { + PRINT1( _L( "MM MTP <> MediaMtpDataProviderProcessor::CreateL, operation code = 0x%x" ), + operationCode ); + createFunc = KKMediaMtpDataProviderRequestProcessorTable[i].iCreateFunc; + break; + } + } + + if ( !createFunc ) + { + PRINT( _L( "MM MTP <> MediaMtpDataProviderProcessor::CreateL, Can't find processor!!!" ) ); + return CRequestUnknown::NewL( aFramework, aConnection ); + } + + return ( *createFunc )( aFramework, aConnection, aDpConfig ); + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/bwins/mmmtpdprequestprocessoru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/bwins/mmmtpdprequestprocessoru.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,154 @@ +EXPORTS + ?RunL@CDeleteObject@@MAEXXZ @ 1 NONAME ; void CDeleteObject::RunL(void) + ?DoHandleResponsePhaseL@CSetObjectPropValue@@MAEHXZ @ 2 NONAME ; int CSetObjectPropValue::DoHandleResponsePhaseL(void) + ?NewL@CDeleteObject@@SAPAVMMmRequestProcessor@@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 3 NONAME ; class MMmRequestProcessor * CDeleteObject::NewL(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ?StartL@CRenameObject@@QAEXKABVTDesC16@@@Z @ 4 NONAME ; void CRenameObject::StartL(unsigned long, class TDesC16 const &) + ?ConstructL@CGetObjectPropDesc@@IAEXXZ @ 5 NONAME ; void CGetObjectPropDesc::ConstructL(void) + ??1CRequestUnknown@@UAE@XZ @ 6 NONAME ; CRequestUnknown::~CRequestUnknown(void) + ?Release@CRequestProcessor@@MAEXXZ @ 7 NONAME ; void CRequestProcessor::Release(void) + ?HandleRequestL@CRequestProcessor@@MAEHABVTMTPTypeRequest@@W4TMTPTransactionPhase@@@Z @ 8 NONAME ; int CRequestProcessor::HandleRequestL(class TMTPTypeRequest const &, enum TMTPTransactionPhase) + ?OpenSessionL@CMmMtpDpAccessSingleton@@SAXXZ @ 9 NONAME ; void CMmMtpDpAccessSingleton::OpenSessionL(void) + ?ServiceL@CGetPartialObject@@MAEXXZ @ 10 NONAME ; void CGetPartialObject::ServiceL(void) + ??0CGetObjectInfo@@AAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 11 NONAME ; CGetObjectInfo::CGetObjectInfo(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ?DoHandleResponsePhaseL@CRequestProcessor@@MAEHXZ @ 12 NONAME ; int CRequestProcessor::DoHandleResponsePhaseL(void) + ?RunError@CCopyObject@@MAEHH@Z @ 13 NONAME ; int CCopyObject::RunError(int) + ??0CGetObjectPropValue@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 14 NONAME ; CGetObjectPropValue::CGetObjectPropValue(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ?ServiceMetaDataToWrapper@CCopyObject@@IAE?AW4TMTPResponseCode@@GAAVMMTPType@@ABVCMTPObjectMetaData@@@Z @ 15 NONAME ; enum TMTPResponseCode CCopyObject::ServiceMetaDataToWrapper(unsigned short, class MMTPType &, class CMTPObjectMetaData const &) + ?RunL@CRequestProcessor@@MAEXXZ @ 16 NONAME ; void CRequestProcessor::RunL(void) + ?ServiceL@CDeleteObject@@MAEXXZ @ 17 NONAME ; void CDeleteObject::ServiceL(void) + ?DoCancel@CSetObjectPropList@@MAEXXZ @ 18 NONAME ; void CSetObjectPropList::DoCancel(void) + ?CleanupDatabaseL@CMmMtpDpMetadataAccessWrapper@@QAEXXZ @ 19 NONAME ; void CMmMtpDpMetadataAccessWrapper::CleanupDatabaseL(void) + ?ServiceL@CGetObjectPropsSupported@@MAEXXZ @ 20 NONAME ; void CGetObjectPropsSupported::ServiceL(void) + ?NewL@CSetObjectReferences@@SAPAVMMmRequestProcessor@@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 21 NONAME ; class MMmRequestProcessor * CSetObjectReferences::NewL(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ?ServiceMetaDataToWrapperL@CSetObjectPropList@@IAE?AW4TMTPResponseCode@@GAAVMMTPType@@ABVCMTPObjectMetaData@@@Z @ 22 NONAME ; enum TMTPResponseCode CSetObjectPropList::ServiceMetaDataToWrapperL(unsigned short, class MMTPType &, class CMTPObjectMetaData const &) + ??0CGetObjectPropDesc@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 23 NONAME ; CGetObjectPropDesc::CGetObjectPropDesc(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ?Release@CMmMtpDpAccessSingleton@@SAXXZ @ 24 NONAME ; void CMmMtpDpAccessSingleton::Release(void) + ?UsbDisconnect@CSendObject@@MAEXXZ @ 25 NONAME ; void CSendObject::UsbDisconnect(void) + ?DoSetObjectReferencesL@CSetObjectReferences@@MAEXAAVCMmMtpDpMetadataAccessWrapper@@GABVTDesC16@@AAVCDesC16Array@@@Z @ 26 NONAME ; void CSetObjectReferences::DoSetObjectReferencesL(class CMmMtpDpMetadataAccessWrapper &, unsigned short, class TDesC16 const &, class CDesC16Array &) + ?ServiceL@CGetFormatCapabilities@@MAEXXZ @ 27 NONAME ; void CGetFormatCapabilities::ServiceL(void) + ?GetAllReferenceL@CMmMtpDpMetadataAccessWrapper@@QAEXPAVCMPXMedia@@AAVCDesC16Array@@@Z @ 28 NONAME ; void CMmMtpDpMetadataAccessWrapper::GetAllReferenceL(class CMPXMedia *, class CDesC16Array &) + ??1CSetObjectPropList@@UAE@XZ @ 29 NONAME ; CSetObjectPropList::~CSetObjectPropList(void) + ?ServiceL@CSetObjectPropList@@MAEXXZ @ 30 NONAME ; void CSetObjectPropList::ServiceL(void) + ??0CMoveObject@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 31 NONAME ; CMoveObject::CMoveObject(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ??0CRequestUnknown@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@@Z @ 32 NONAME ; CRequestUnknown::CRequestUnknown(class MMTPDataProviderFramework &, class MMTPConnection &) + ?ConstructL@CGetObjectPropList@@IAEXXZ @ 33 NONAME ; void CGetObjectPropList::ConstructL(void) + ??1CSendObject@@UAE@XZ @ 34 NONAME ; CSendObject::~CSendObject(void) + ?ServiceMetaDataFromWrapperL@CGetObjectPropValue@@IAEXGAAVMMTPType@@ABVCMTPObjectMetaData@@@Z @ 35 NONAME ; void CGetObjectPropValue::ServiceMetaDataFromWrapperL(unsigned short, class MMTPType &, class CMTPObjectMetaData const &) + ?NewL@CGetObject@@SAPAVMMmRequestProcessor@@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 36 NONAME ; class MMmRequestProcessor * CGetObject::NewL(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ??1CGetObjectPropValue@@UAE@XZ @ 37 NONAME ; CGetObjectPropValue::~CGetObjectPropValue(void) + ??1CGetFormatCapabilities@@UAE@XZ @ 38 NONAME ; CGetFormatCapabilities::~CGetFormatCapabilities(void) + ?SetMetaDataToWrapperL@CSendObject@@IAE?AW4TMTPResponseCode@@GAAVMMTPType@@ABVCMTPObjectMetaData@@@Z @ 39 NONAME ; enum TMTPResponseCode CSendObject::SetMetaDataToWrapperL(unsigned short, class MMTPType &, class CMTPObjectMetaData const &) + ?ServiceL@CSetObjectReferences@@EAEXXZ @ 40 NONAME ; void CSetObjectReferences::ServiceL(void) + ?DoHandleDataIToRPhaseL@CRequestProcessor@@MAEHXZ @ 41 NONAME ; int CRequestProcessor::DoHandleDataIToRPhaseL(void) + ??0CGetObjectPropList@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 42 NONAME ; CGetObjectPropList::CGetObjectPropList(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ?ConstructL@CCopyObject@@IAEXXZ @ 43 NONAME ; void CCopyObject::ConstructL(void) + ?ServiceL@CGetObjectPropValue@@MAEXXZ @ 44 NONAME ; void CGetObjectPropValue::ServiceL(void) + ??1CRenameObject@@UAE@XZ @ 45 NONAME ; CRenameObject::~CRenameObject(void) + ?Match@CRequestProcessor@@MBEHABVTMTPTypeEvent@@AAVMMTPConnection@@@Z @ 46 NONAME ; int CRequestProcessor::Match(class TMTPTypeEvent const &, class MMTPConnection &) const + ?DoHandleCompletingPhaseL@CSendObject@@MAEHXZ @ 47 NONAME ; int CSendObject::DoHandleCompletingPhaseL(void) + ?GetDrmStatus@MmMtpDpUtility@@SAHABVTDesC16@@@Z @ 48 NONAME ; int MmMtpDpUtility::GetDrmStatus(class TDesC16 const &) + ?RunL@CRenameObject@@MAEXXZ @ 49 NONAME ; void CRenameObject::RunL(void) + ??0CSendObject@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 50 NONAME ; CSendObject::CSendObject(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ??0CSetObjectReferences@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 51 NONAME ; CSetObjectReferences::CSetObjectReferences(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ??0CRequestProcessor@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@HPBUTMTPRequestElementInfo@@@Z @ 52 NONAME ; CRequestProcessor::CRequestProcessor(class MMTPDataProviderFramework &, class MMTPConnection &, int, struct TMTPRequestElementInfo const *) + ?ServiceL@CSendObject@@MAEXXZ @ 53 NONAME ; void CSendObject::ServiceL(void) + ?Request@CRequestProcessor@@MBEABVTMTPTypeRequest@@XZ @ 54 NONAME ; class TMTPTypeRequest const & CRequestProcessor::Request(void) const + ?CreateL@CMmMtpDpAccessSingleton@@SAXAAVRFs@@AAVMMTPDataProviderFramework@@@Z @ 55 NONAME ; void CMmMtpDpAccessSingleton::CreateL(class RFs &, class MMTPDataProviderFramework &) + ?ServiceMetaDataToWrapper@CMoveObject@@IAE?AW4TMTPResponseCode@@GAAVMMTPType@@ABVCMTPObjectMetaData@@@Z @ 56 NONAME ; enum TMTPResponseCode CMoveObject::ServiceMetaDataToWrapper(unsigned short, class MMTPType &, class CMTPObjectMetaData const &) + ?CheckRequestL@CGetPartialObject@@MAE?AW4TMTPResponseCode@@XZ @ 57 NONAME ; enum TMTPResponseCode CGetPartialObject::CheckRequestL(void) + ?DoCancel@CRequestProcessor@@MAEXXZ @ 58 NONAME ; void CRequestProcessor::DoCancel(void) + ?ConstructL@CSetObjectPropList@@IAEXXZ @ 59 NONAME ; void CSetObjectPropList::ConstructL(void) + ?NewL@CRequestUnknown@@SAPAVMMmRequestProcessor@@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@@Z @ 60 NONAME ; class MMmRequestProcessor * CRequestUnknown::NewL(class MMTPDataProviderFramework &, class MMTPConnection &) + ?ConstructL@CGetObjectInfo@@AAEXXZ @ 61 NONAME ; void CGetObjectInfo::ConstructL(void) + ?UsbDisconnect@CRequestProcessor@@MAEXXZ @ 62 NONAME ; void CRequestProcessor::UsbDisconnect(void) + ?UpdateMusicCollectionL@CMmMtpDpMetadataAccessWrapper@@QAEXXZ @ 63 NONAME ; void CMmMtpDpMetadataAccessWrapper::UpdateMusicCollectionL(void) + ??1CMoveObject@@UAE@XZ @ 64 NONAME ; CMoveObject::~CMoveObject(void) + ?CheckRequestL@CSendObject@@MAE?AW4TMTPResponseCode@@XZ @ 65 NONAME ; enum TMTPResponseCode CSendObject::CheckRequestL(void) + ??1CRequestProcessor@@MAE@XZ @ 66 NONAME ; CRequestProcessor::~CRequestProcessor(void) + ?DoCancel@CDeleteObject@@MAEXXZ @ 67 NONAME ; void CDeleteObject::DoCancel(void) + ?RunL@CMoveObject@@MAEXXZ @ 68 NONAME ; void CMoveObject::RunL(void) + ??1CGetObject@@UAE@XZ @ 69 NONAME ; CGetObject::~CGetObject(void) + ?DoHandleResponsePhaseL@CSetObjectReferences@@EAEHXZ @ 70 NONAME ; int CSetObjectReferences::DoHandleResponsePhaseL(void) + ?GetPlaylistNameL@CMmMtpDpMetadataAccessWrapper@@QAEXPAVCMPXMedia@@AAVTDes16@@@Z @ 71 NONAME ; void CMmMtpDpMetadataAccessWrapper::GetPlaylistNameL(class CMPXMedia *, class TDes16 &) + ?GetAccessWrapperL@CMmMtpDpAccessSingleton@@SAAAVCMmMtpDpMetadataAccessWrapper@@XZ @ 72 NONAME ; class CMmMtpDpMetadataAccessWrapper & CMmMtpDpAccessSingleton::GetAccessWrapperL(void) + ??1CGetObjectPropsSupported@@UAE@XZ @ 73 NONAME ; CGetObjectPropsSupported::~CGetObjectPropsSupported(void) + ?CheckRequestL@CGetObjectPropList@@MAE?AW4TMTPResponseCode@@XZ @ 74 NONAME ; enum TMTPResponseCode CGetObjectPropList::CheckRequestL(void) + ?HasDataphase@CRequestProcessor@@MBEHXZ @ 75 NONAME ; int CRequestProcessor::HasDataphase(void) const + ?NewL@CGetObjectPropsSupported@@SAPAVMMmRequestProcessor@@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 76 NONAME ; class MMmRequestProcessor * CGetObjectPropsSupported::NewL(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ?Connection@CRequestProcessor@@MBEAAVMMTPConnection@@XZ @ 77 NONAME ; class MMTPConnection & CRequestProcessor::Connection(void) const + ??1CGetPartialObject@@UAE@XZ @ 78 NONAME ; CGetPartialObject::~CGetPartialObject(void) + ?NewL@CGetObjectInfo@@SAPAVMMmRequestProcessor@@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 79 NONAME ; class MMmRequestProcessor * CGetObjectInfo::NewL(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ?RunError@CSetObjectPropList@@MAEHH@Z @ 80 NONAME ; int CSetObjectPropList::RunError(int) + ?Match@CRequestUnknown@@MBEHABVTMTPTypeRequest@@AAVMMTPConnection@@@Z @ 81 NONAME ; int CRequestUnknown::Match(class TMTPTypeRequest const &, class MMTPConnection &) const + ?ServiceL@CMoveObject@@MAEXXZ @ 82 NONAME ; void CMoveObject::ServiceL(void) + ?CreateDummyFile@CMmMtpDpMetadataAccessWrapper@@QAEXABVTDesC16@@@Z @ 83 NONAME ; void CMmMtpDpMetadataAccessWrapper::CreateDummyFile(class TDesC16 const &) + ?CheckRequestL@CGetObjectPropDesc@@MAE?AW4TMTPResponseCode@@XZ @ 84 NONAME ; enum TMTPResponseCode CGetObjectPropDesc::CheckRequestL(void) + ?DoHandleRToIPhaseL@CRequestProcessor@@MAEHXZ @ 85 NONAME ; int CRequestProcessor::DoHandleRToIPhaseL(void) + ?ServiceMetaDataToWrapperL@CSetObjectPropValue@@IAE?AW4TMTPResponseCode@@GAAVMMTPType@@ABVCMTPObjectMetaData@@@Z @ 86 NONAME ; enum TMTPResponseCode CSetObjectPropValue::ServiceMetaDataToWrapperL(unsigned short, class MMTPType &, class CMTPObjectMetaData const &) + ?FormatFromFilename@MmMtpDpUtility@@SA?AW4TMTPFormatCode@@ABVTDesC16@@@Z @ 87 NONAME ; enum TMTPFormatCode MmMtpDpUtility::FormatFromFilename(class TDesC16 const &) + ?CheckRequestL@CSetObjectPropValue@@MAE?AW4TMTPResponseCode@@XZ @ 88 NONAME ; enum TMTPResponseCode CSetObjectPropValue::CheckRequestL(void) + ?Match@CRequestProcessor@@MBEHABVTMTPTypeRequest@@AAVMMTPConnection@@@Z @ 89 NONAME ; int CRequestProcessor::Match(class TMTPTypeRequest const &, class MMTPConnection &) const + ??0CCopyObject@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 90 NONAME ; CCopyObject::CCopyObject(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ?CheckRequestL@CRequestProcessor@@MAE?AW4TMTPResponseCode@@XZ @ 91 NONAME ; enum TMTPResponseCode CRequestProcessor::CheckRequestL(void) + ?SendResponseL@CRequestProcessor@@IAEXW4TMTPResponseCode@@HPAK@Z @ 92 NONAME ; void CRequestProcessor::SendResponseL(enum TMTPResponseCode, int, unsigned long *) + ??0CGetPartialObject@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@@Z @ 93 NONAME ; CGetPartialObject::CGetPartialObject(class MMTPDataProviderFramework &, class MMTPConnection &) + ?DoHandleCompletingPhaseL@CRequestProcessor@@MAEHXZ @ 94 NONAME ; int CRequestProcessor::DoHandleCompletingPhaseL(void) + ??0CSetObjectPropList@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 95 NONAME ; CSetObjectPropList::CSetObjectPropList(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ?DeleteDummyFile@CMmMtpDpMetadataAccessWrapper@@QAEXABVTDesC16@@@Z @ 96 NONAME ; void CMmMtpDpMetadataAccessWrapper::DeleteDummyFile(class TDesC16 const &) + ?IsVideoL@MmMtpDpUtility@@SAHABVTDesC16@@@Z @ 97 NONAME ; int MmMtpDpUtility::IsVideoL(class TDesC16 const &) + ??1CGetObjectInfo@@UAE@XZ @ 98 NONAME ; CGetObjectInfo::~CGetObjectInfo(void) + ?ServiceL@CRequestUnknown@@MAEXXZ @ 99 NONAME ; void CRequestUnknown::ServiceL(void) + ?HasDataphase@CSetObjectPropList@@MBEHXZ @ 100 NONAME ; int CSetObjectPropList::HasDataphase(void) const + ?NewL@CGetObjectReferences@@SAPAVMMmRequestProcessor@@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 101 NONAME ; class MMmRequestProcessor * CGetObjectReferences::NewL(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ?ConstructL@CGetFormatCapabilities@@IAEXXZ @ 102 NONAME ; void CGetFormatCapabilities::ConstructL(void) + ?DoCancel@CRenameObject@@MAEXXZ @ 103 NONAME ; void CRenameObject::DoCancel(void) + ??0CGetFormatCapabilities@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 104 NONAME ; CGetFormatCapabilities::CGetFormatCapabilities(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ??1CSetObjectReferences@@UAE@XZ @ 105 NONAME ; CSetObjectReferences::~CSetObjectReferences(void) + ?Match@CSendObject@@MBEHABVTMTPTypeRequest@@AAVMMTPConnection@@@Z @ 106 NONAME ; int CSendObject::Match(class TMTPTypeRequest const &, class MMTPConnection &) const + ??1CCopyObject@@UAE@XZ @ 107 NONAME ; CCopyObject::~CCopyObject(void) + ?RunError@CMoveObject@@MAEHH@Z @ 108 NONAME ; int CMoveObject::RunError(int) + ?ConstructL@CSendObject@@IAEXXZ @ 109 NONAME ; void CSendObject::ConstructL(void) + ?GetModifiedContentL@CMmMtpDpMetadataAccessWrapper@@QAEXABVTDesC16@@AAHAAVCDesC16Array@@@Z @ 110 NONAME ; void CMmMtpDpMetadataAccessWrapper::GetModifiedContentL(class TDesC16 const &, int &, class CDesC16Array &) + ?RunL@CGetObjectPropList@@MAEXXZ @ 111 NONAME ; void CGetObjectPropList::RunL(void) + ?RunL@CCopyObject@@MAEXXZ @ 112 NONAME ; void CCopyObject::RunL(void) + ?RunError@CRequestProcessor@@MAEHH@Z @ 113 NONAME ; int CRequestProcessor::RunError(int) + ?SessionId@CRequestProcessor@@MAEKXZ @ 114 NONAME ; unsigned long CRequestProcessor::SessionId(void) + ?SetPlaylistL@CMmMtpDpMetadataAccessWrapper@@QAEXABVTDesC16@@AAVCDesC16Array@@@Z @ 115 NONAME ; void CMmMtpDpMetadataAccessWrapper::SetPlaylistL(class TDesC16 const &, class CDesC16Array &) + ?HandleEventL@CRequestProcessor@@MAEXABVTMTPTypeEvent@@@Z @ 116 NONAME ; void CRequestProcessor::HandleEventL(class TMTPTypeEvent const &) + ?NewL@CGetPartialObject@@SAPAVMMmRequestProcessor@@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 117 NONAME ; class MMmRequestProcessor * CGetPartialObject::NewL(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ?HasDataphase@CSetObjectReferences@@EBEHXZ @ 118 NONAME ; int CSetObjectReferences::HasDataphase(void) const + ?RenameObjectL@CMmMtpDpMetadataAccessWrapper@@QAEXABVTDesC16@@0@Z @ 119 NONAME ; void CMmMtpDpMetadataAccessWrapper::RenameObjectL(class TDesC16 const &, class TDesC16 const &) + ?RunError@CGetObjectPropList@@MAEHH@Z @ 120 NONAME ; int CGetObjectPropList::RunError(int) + ?DoHandleResponsePhaseL@CSetObjectPropList@@MAEHXZ @ 121 NONAME ; int CSetObjectPropList::DoHandleResponsePhaseL(void) + ??0CDeleteObject@@AAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 122 NONAME ; CDeleteObject::CDeleteObject(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ?GetAllPlaylistL@CMmMtpDpMetadataAccessWrapper@@QAEXABVTDesC16@@PAPAVCMPXMediaArray@@@Z @ 123 NONAME ; void CMmMtpDpMetadataAccessWrapper::GetAllPlaylistL(class TDesC16 const &, class CMPXMediaArray * *) + ?NewL@CRenameObject@@SAPAV1@AAVMMTPDataProviderFramework@@AAVCMmMtpDpMetadataAccessWrapper@@@Z @ 124 NONAME ; class CRenameObject * CRenameObject::NewL(class MMTPDataProviderFramework &, class CMmMtpDpMetadataAccessWrapper &) + ?GetObjectMetadataValueL@CMmMtpDpMetadataAccessWrapper@@QAEXGAAVMMTPType@@ABVCMTPObjectMetaData@@@Z @ 125 NONAME ; void CMmMtpDpMetadataAccessWrapper::GetObjectMetadataValueL(unsigned short, class MMTPType &, class CMTPObjectMetaData const &) + ?AddDummyFileL@CMmMtpDpMetadataAccessWrapper@@QAEXABVTDesC16@@@Z @ 126 NONAME ; void CMmMtpDpMetadataAccessWrapper::AddDummyFileL(class TDesC16 const &) + ??1CGetObjectPropDesc@@UAE@XZ @ 127 NONAME ; CGetObjectPropDesc::~CGetObjectPropDesc(void) + ?ServiceL@CGetObjectPropDesc@@MAEXXZ @ 128 NONAME ; void CGetObjectPropDesc::ServiceL(void) + ?HasDataphase@CSetObjectPropValue@@MBEHXZ @ 129 NONAME ; int CSetObjectPropValue::HasDataphase(void) const + ?ServiceL@CCopyObject@@MAEXXZ @ 130 NONAME ; void CCopyObject::ServiceL(void) + ?CheckRequestL@CGetObjectPropValue@@MAE?AW4TMTPResponseCode@@XZ @ 131 NONAME ; enum TMTPResponseCode CGetObjectPropValue::CheckRequestL(void) + ?CloseSessionL@CMmMtpDpAccessSingleton@@SAXXZ @ 132 NONAME ; void CMmMtpDpAccessSingleton::CloseSessionL(void) + ?ReceiveDataL@CRequestProcessor@@IAEXAAVMMTPType@@@Z @ 133 NONAME ; void CRequestProcessor::ReceiveDataL(class MMTPType &) + ?ConstructL@CMoveObject@@IAEXXZ @ 134 NONAME ; void CMoveObject::ConstructL(void) + ?RunL@CSetObjectPropList@@MAEXXZ @ 135 NONAME ; void CSetObjectPropList::RunL(void) + ??1CGetObjectReferences@@UAE@XZ @ 136 NONAME ; CGetObjectReferences::~CGetObjectReferences(void) + ?HasDataphase@CSendObject@@MBEHXZ @ 137 NONAME ; int CSendObject::HasDataphase(void) const + ??1CSetObjectPropValue@@UAE@XZ @ 138 NONAME ; CSetObjectPropValue::~CSetObjectPropValue(void) + ?ConstructL@CRenameObject@@IAEXXZ @ 139 NONAME ; void CRenameObject::ConstructL(void) + ?DoHandleResponsePhaseL@CSendObject@@MAEHXZ @ 140 NONAME ; int CSendObject::DoHandleResponsePhaseL(void) + ?SendDataL@CRequestProcessor@@IAEXABVMMTPType@@@Z @ 141 NONAME ; void CRequestProcessor::SendDataL(class MMTPType const &) + ?DoCancel@CGetObjectPropList@@MAEXXZ @ 142 NONAME ; void CGetObjectPropList::DoCancel(void) + ?DoHandleRequestPhaseL@CRequestProcessor@@MAEHXZ @ 143 NONAME ; int CRequestProcessor::DoHandleRequestPhaseL(void) + ?ServiceL@CSetObjectPropValue@@MAEXXZ @ 144 NONAME ; void CSetObjectPropValue::ServiceL(void) + ?RunError@CRenameObject@@MAEHH@Z @ 145 NONAME ; int CRenameObject::RunError(int) + ??1CDeleteObject@@UAE@XZ @ 146 NONAME ; CDeleteObject::~CDeleteObject(void) + ?DoHandleResponsePhaseL@CGetPartialObject@@MAEHXZ @ 147 NONAME ; int CGetPartialObject::DoHandleResponsePhaseL(void) + ?CheckRequestL@CGetFormatCapabilities@@MAE?AW4TMTPResponseCode@@XZ @ 148 NONAME ; enum TMTPResponseCode CGetFormatCapabilities::CheckRequestL(void) + ??0CSetObjectPropValue@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 149 NONAME ; CSetObjectPropValue::CSetObjectPropValue(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ??1CGetObjectPropList@@UAE@XZ @ 150 NONAME ; CGetObjectPropList::~CGetObjectPropList(void) + ?ServiceL@CGetObjectPropList@@MAEXXZ @ 151 NONAME ; void CGetObjectPropList::ServiceL(void) + ??0CRenameObject@@IAE@AAVMMTPDataProviderFramework@@AAVCMmMtpDpMetadataAccessWrapper@@@Z @ 152 NONAME ; CRenameObject::CRenameObject(class MMTPDataProviderFramework &, class CMmMtpDpMetadataAccessWrapper &) + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/eabi/mmmtpdprequestprocessoru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/eabi/mmmtpdprequestprocessoru.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,258 @@ +EXPORTS + _ZN10CGetObject4NewLER25MMTPDataProviderFrameworkR14MMTPConnectionR14MMmMtpDpConfig @ 1 NONAME + _ZN10CGetObjectD0Ev @ 2 NONAME + _ZN10CGetObjectD1Ev @ 3 NONAME + _ZN10CGetObjectD2Ev @ 4 NONAME + _ZN11CCopyObject10ConstructLEv @ 5 NONAME + _ZN11CCopyObject24ServiceMetaDataToWrapperEtR8MMTPTypeRK18CMTPObjectMetaData @ 6 NONAME + _ZN11CCopyObject4RunLEv @ 7 NONAME + _ZN11CCopyObject8RunErrorEi @ 8 NONAME + _ZN11CCopyObject8ServiceLEv @ 9 NONAME + _ZN11CCopyObjectC2ER25MMTPDataProviderFrameworkR14MMTPConnectionR14MMmMtpDpConfig @ 10 NONAME + _ZN11CCopyObjectD0Ev @ 11 NONAME + _ZN11CCopyObjectD1Ev @ 12 NONAME + _ZN11CCopyObjectD2Ev @ 13 NONAME + _ZN11CMoveObject10ConstructLEv @ 14 NONAME + _ZN11CMoveObject24ServiceMetaDataToWrapperEtR8MMTPTypeRK18CMTPObjectMetaData @ 15 NONAME + _ZN11CMoveObject4RunLEv @ 16 NONAME + _ZN11CMoveObject8RunErrorEi @ 17 NONAME + _ZN11CMoveObject8ServiceLEv @ 18 NONAME + _ZN11CMoveObjectC2ER25MMTPDataProviderFrameworkR14MMTPConnectionR14MMmMtpDpConfig @ 19 NONAME + _ZN11CMoveObjectD0Ev @ 20 NONAME + _ZN11CMoveObjectD1Ev @ 21 NONAME + _ZN11CMoveObjectD2Ev @ 22 NONAME + _ZN11CSendObject10ConstructLEv @ 23 NONAME + _ZN11CSendObject13CheckRequestLEv @ 24 NONAME + _ZN11CSendObject13UsbDisconnectEv @ 25 NONAME + _ZN11CSendObject21SetMetaDataToWrapperLEtR8MMTPTypeRK18CMTPObjectMetaData @ 26 NONAME + _ZN11CSendObject22DoHandleResponsePhaseLEv @ 27 NONAME + _ZN11CSendObject24DoHandleCompletingPhaseLEv @ 28 NONAME + _ZN11CSendObject8ServiceLEv @ 29 NONAME + _ZN11CSendObjectC2ER25MMTPDataProviderFrameworkR14MMTPConnectionR14MMmMtpDpConfig @ 30 NONAME + _ZN11CSendObjectD0Ev @ 31 NONAME + _ZN11CSendObjectD1Ev @ 32 NONAME + _ZN11CSendObjectD2Ev @ 33 NONAME + _ZN13CDeleteObject4NewLER25MMTPDataProviderFrameworkR14MMTPConnectionR14MMmMtpDpConfig @ 34 NONAME + _ZN13CDeleteObject4RunLEv @ 35 NONAME + _ZN13CDeleteObject8DoCancelEv @ 36 NONAME + _ZN13CDeleteObject8ServiceLEv @ 37 NONAME + _ZN13CDeleteObjectD0Ev @ 38 NONAME + _ZN13CDeleteObjectD1Ev @ 39 NONAME + _ZN13CDeleteObjectD2Ev @ 40 NONAME + _ZN13CRenameObject10ConstructLEv @ 41 NONAME + _ZN13CRenameObject4NewLER25MMTPDataProviderFrameworkR29CMmMtpDpMetadataAccessWrapper @ 42 NONAME + _ZN13CRenameObject4RunLEv @ 43 NONAME + _ZN13CRenameObject6StartLEmRK7TDesC16 @ 44 NONAME + _ZN13CRenameObject8DoCancelEv @ 45 NONAME + _ZN13CRenameObject8RunErrorEi @ 46 NONAME + _ZN13CRenameObjectC1ER25MMTPDataProviderFrameworkR29CMmMtpDpMetadataAccessWrapper @ 47 NONAME + _ZN13CRenameObjectC2ER25MMTPDataProviderFrameworkR29CMmMtpDpMetadataAccessWrapper @ 48 NONAME + _ZN13CRenameObjectD0Ev @ 49 NONAME + _ZN13CRenameObjectD1Ev @ 50 NONAME + _ZN13CRenameObjectD2Ev @ 51 NONAME + _ZN14CGetObjectInfo10ConstructLEv @ 52 NONAME + _ZN14CGetObjectInfo4NewLER25MMTPDataProviderFrameworkR14MMTPConnectionR14MMmMtpDpConfig @ 53 NONAME + _ZN14CGetObjectInfoD0Ev @ 54 NONAME + _ZN14CGetObjectInfoD1Ev @ 55 NONAME + _ZN14CGetObjectInfoD2Ev @ 56 NONAME + _ZN14MmMtpDpUtility12GetDrmStatusERK7TDesC16 @ 57 NONAME + _ZN14MmMtpDpUtility18FormatFromFilenameERK7TDesC16 @ 58 NONAME + _ZN14MmMtpDpUtility8IsVideoLERK7TDesC16 @ 59 NONAME + _ZN15CRequestUnknown4NewLER25MMTPDataProviderFrameworkR14MMTPConnection @ 60 NONAME + _ZN15CRequestUnknown8ServiceLEv @ 61 NONAME + _ZN15CRequestUnknownC1ER25MMTPDataProviderFrameworkR14MMTPConnection @ 62 NONAME + _ZN15CRequestUnknownC2ER25MMTPDataProviderFrameworkR14MMTPConnection @ 63 NONAME + _ZN15CRequestUnknownD0Ev @ 64 NONAME + _ZN15CRequestUnknownD1Ev @ 65 NONAME + _ZN15CRequestUnknownD2Ev @ 66 NONAME + _ZN17CGetPartialObject13CheckRequestLEv @ 67 NONAME + _ZN17CGetPartialObject22DoHandleResponsePhaseLEv @ 68 NONAME + _ZN17CGetPartialObject4NewLER25MMTPDataProviderFrameworkR14MMTPConnectionR14MMmMtpDpConfig @ 69 NONAME + _ZN17CGetPartialObject8ServiceLEv @ 70 NONAME + _ZN17CGetPartialObjectC1ER25MMTPDataProviderFrameworkR14MMTPConnection @ 71 NONAME + _ZN17CGetPartialObjectC2ER25MMTPDataProviderFrameworkR14MMTPConnection @ 72 NONAME + _ZN17CGetPartialObjectD0Ev @ 73 NONAME + _ZN17CGetPartialObjectD1Ev @ 74 NONAME + _ZN17CGetPartialObjectD2Ev @ 75 NONAME + _ZN17CRequestProcessor12HandleEventLERK13TMTPTypeEvent @ 76 NONAME + _ZN17CRequestProcessor12ReceiveDataLER8MMTPType @ 77 NONAME + _ZN17CRequestProcessor13CheckRequestLEv @ 78 NONAME + _ZN17CRequestProcessor13SendResponseLE16TMTPResponseCodeiPm @ 79 NONAME + _ZN17CRequestProcessor13UsbDisconnectEv @ 80 NONAME + _ZN17CRequestProcessor14HandleRequestLERK15TMTPTypeRequest20TMTPTransactionPhase @ 81 NONAME + _ZN17CRequestProcessor18DoHandleRToIPhaseLEv @ 82 NONAME + _ZN17CRequestProcessor21DoHandleRequestPhaseLEv @ 83 NONAME + _ZN17CRequestProcessor22DoHandleDataIToRPhaseLEv @ 84 NONAME + _ZN17CRequestProcessor22DoHandleResponsePhaseLEv @ 85 NONAME + _ZN17CRequestProcessor24DoHandleCompletingPhaseLEv @ 86 NONAME + _ZN17CRequestProcessor4RunLEv @ 87 NONAME + _ZN17CRequestProcessor7ReleaseEv @ 88 NONAME + _ZN17CRequestProcessor8DoCancelEv @ 89 NONAME + _ZN17CRequestProcessor8RunErrorEi @ 90 NONAME + _ZN17CRequestProcessor9SendDataLERK8MMTPType @ 91 NONAME + _ZN17CRequestProcessor9SessionIdEv @ 92 NONAME + _ZN17CRequestProcessorC2ER25MMTPDataProviderFrameworkR14MMTPConnectioniPK22TMTPRequestElementInfo @ 93 NONAME + _ZN17CRequestProcessorD0Ev @ 94 NONAME + _ZN17CRequestProcessorD1Ev @ 95 NONAME + _ZN17CRequestProcessorD2Ev @ 96 NONAME + _ZN18CGetObjectPropDesc10ConstructLEv @ 97 NONAME + _ZN18CGetObjectPropDesc13CheckRequestLEv @ 98 NONAME + _ZN18CGetObjectPropDesc8ServiceLEv @ 99 NONAME + _ZN18CGetObjectPropDescC2ER25MMTPDataProviderFrameworkR14MMTPConnectionR14MMmMtpDpConfig @ 100 NONAME + _ZN18CGetObjectPropDescD0Ev @ 101 NONAME + _ZN18CGetObjectPropDescD1Ev @ 102 NONAME + _ZN18CGetObjectPropDescD2Ev @ 103 NONAME + _ZN18CGetObjectPropList10ConstructLEv @ 104 NONAME + _ZN18CGetObjectPropList13CheckRequestLEv @ 105 NONAME + _ZN18CGetObjectPropList4RunLEv @ 106 NONAME + _ZN18CGetObjectPropList8DoCancelEv @ 107 NONAME + _ZN18CGetObjectPropList8RunErrorEi @ 108 NONAME + _ZN18CGetObjectPropList8ServiceLEv @ 109 NONAME + _ZN18CGetObjectPropListC2ER25MMTPDataProviderFrameworkR14MMTPConnectionR14MMmMtpDpConfig @ 110 NONAME + _ZN18CGetObjectPropListD0Ev @ 111 NONAME + _ZN18CGetObjectPropListD1Ev @ 112 NONAME + _ZN18CGetObjectPropListD2Ev @ 113 NONAME + _ZN18CSetObjectPropList10ConstructLEv @ 114 NONAME + _ZN18CSetObjectPropList22DoHandleResponsePhaseLEv @ 115 NONAME + _ZN18CSetObjectPropList25ServiceMetaDataToWrapperLEtR8MMTPTypeRK18CMTPObjectMetaData @ 116 NONAME + _ZN18CSetObjectPropList4RunLEv @ 117 NONAME + _ZN18CSetObjectPropList8DoCancelEv @ 118 NONAME + _ZN18CSetObjectPropList8RunErrorEi @ 119 NONAME + _ZN18CSetObjectPropList8ServiceLEv @ 120 NONAME + _ZN18CSetObjectPropListC2ER25MMTPDataProviderFrameworkR14MMTPConnectionR14MMmMtpDpConfig @ 121 NONAME + _ZN18CSetObjectPropListD0Ev @ 122 NONAME + _ZN18CSetObjectPropListD1Ev @ 123 NONAME + _ZN18CSetObjectPropListD2Ev @ 124 NONAME + _ZN19CGetObjectPropValue13CheckRequestLEv @ 125 NONAME + _ZN19CGetObjectPropValue27ServiceMetaDataFromWrapperLEtR8MMTPTypeRK18CMTPObjectMetaData @ 126 NONAME + _ZN19CGetObjectPropValue8ServiceLEv @ 127 NONAME + _ZN19CGetObjectPropValueC2ER25MMTPDataProviderFrameworkR14MMTPConnectionR14MMmMtpDpConfig @ 128 NONAME + _ZN19CGetObjectPropValueD0Ev @ 129 NONAME + _ZN19CGetObjectPropValueD1Ev @ 130 NONAME + _ZN19CGetObjectPropValueD2Ev @ 131 NONAME + _ZN19CSetObjectPropValue13CheckRequestLEv @ 132 NONAME + _ZN19CSetObjectPropValue22DoHandleResponsePhaseLEv @ 133 NONAME + _ZN19CSetObjectPropValue25ServiceMetaDataToWrapperLEtR8MMTPTypeRK18CMTPObjectMetaData @ 134 NONAME + _ZN19CSetObjectPropValue8ServiceLEv @ 135 NONAME + _ZN19CSetObjectPropValueC2ER25MMTPDataProviderFrameworkR14MMTPConnectionR14MMmMtpDpConfig @ 136 NONAME + _ZN19CSetObjectPropValueD0Ev @ 137 NONAME + _ZN19CSetObjectPropValueD1Ev @ 138 NONAME + _ZN19CSetObjectPropValueD2Ev @ 139 NONAME + _ZN20CGetObjectReferences4NewLER25MMTPDataProviderFrameworkR14MMTPConnectionR14MMmMtpDpConfig @ 140 NONAME + _ZN20CGetObjectReferencesD0Ev @ 141 NONAME + _ZN20CGetObjectReferencesD1Ev @ 142 NONAME + _ZN20CGetObjectReferencesD2Ev @ 143 NONAME + _ZN20CSetObjectReferences22DoHandleResponsePhaseLEv @ 144 NONAME + _ZN20CSetObjectReferences22DoSetObjectReferencesLER29CMmMtpDpMetadataAccessWrappertRK7TDesC16R12CDesC16Array @ 145 NONAME + _ZN20CSetObjectReferences4NewLER25MMTPDataProviderFrameworkR14MMTPConnectionR14MMmMtpDpConfig @ 146 NONAME + _ZN20CSetObjectReferences8ServiceLEv @ 147 NONAME + _ZN20CSetObjectReferencesC1ER25MMTPDataProviderFrameworkR14MMTPConnectionR14MMmMtpDpConfig @ 148 NONAME + _ZN20CSetObjectReferencesC2ER25MMTPDataProviderFrameworkR14MMTPConnectionR14MMmMtpDpConfig @ 149 NONAME + _ZN20CSetObjectReferencesD0Ev @ 150 NONAME + _ZN20CSetObjectReferencesD1Ev @ 151 NONAME + _ZN20CSetObjectReferencesD2Ev @ 152 NONAME + _ZN22CGetFormatCapabilities10ConstructLEv @ 153 NONAME + _ZN22CGetFormatCapabilities13CheckRequestLEv @ 154 NONAME + _ZN22CGetFormatCapabilities8ServiceLEv @ 155 NONAME + _ZN22CGetFormatCapabilitiesC2ER25MMTPDataProviderFrameworkR14MMTPConnectionR14MMmMtpDpConfig @ 156 NONAME + _ZN22CGetFormatCapabilitiesD0Ev @ 157 NONAME + _ZN22CGetFormatCapabilitiesD1Ev @ 158 NONAME + _ZN22CGetFormatCapabilitiesD2Ev @ 159 NONAME + _ZN23CMmMtpDpAccessSingleton12OpenSessionLEv @ 160 NONAME + _ZN23CMmMtpDpAccessSingleton13CloseSessionLEv @ 161 NONAME + _ZN23CMmMtpDpAccessSingleton17GetAccessWrapperLEv @ 162 NONAME + _ZN23CMmMtpDpAccessSingleton7CreateLER3RFsR25MMTPDataProviderFramework @ 163 NONAME + _ZN23CMmMtpDpAccessSingleton7ReleaseEv @ 164 NONAME + _ZN24CGetObjectPropsSupported4NewLER25MMTPDataProviderFrameworkR14MMTPConnectionR14MMmMtpDpConfig @ 165 NONAME + _ZN24CGetObjectPropsSupported8ServiceLEv @ 166 NONAME + _ZN24CGetObjectPropsSupportedD0Ev @ 167 NONAME + _ZN24CGetObjectPropsSupportedD1Ev @ 168 NONAME + _ZN24CGetObjectPropsSupportedD2Ev @ 169 NONAME + _ZN29CMmMtpDpMetadataAccessWrapper12SetPlaylistLERK7TDesC16R12CDesC16Array @ 170 NONAME + _ZN29CMmMtpDpMetadataAccessWrapper13AddDummyFileLERK7TDesC16 @ 171 NONAME + _ZN29CMmMtpDpMetadataAccessWrapper13RenameObjectLERK7TDesC16S2_ @ 172 NONAME + _ZN29CMmMtpDpMetadataAccessWrapper15CreateDummyFileERK7TDesC16 @ 173 NONAME + _ZN29CMmMtpDpMetadataAccessWrapper15DeleteDummyFileERK7TDesC16 @ 174 NONAME + _ZN29CMmMtpDpMetadataAccessWrapper15GetAllPlaylistLERK7TDesC16PP14CMPXMediaArray @ 175 NONAME + _ZN29CMmMtpDpMetadataAccessWrapper16CleanupDatabaseLEv @ 176 NONAME + _ZN29CMmMtpDpMetadataAccessWrapper16GetAllReferenceLEP9CMPXMediaR12CDesC16Array @ 177 NONAME + _ZN29CMmMtpDpMetadataAccessWrapper16GetPlaylistNameLEP9CMPXMediaR6TDes16 @ 178 NONAME + _ZN29CMmMtpDpMetadataAccessWrapper19GetModifiedContentLERK7TDesC16RiR12CDesC16Array @ 179 NONAME + _ZN29CMmMtpDpMetadataAccessWrapper22UpdateMusicCollectionLEv @ 180 NONAME + _ZN29CMmMtpDpMetadataAccessWrapper23GetObjectMetadataValueLEtR8MMTPTypeRK18CMTPObjectMetaData @ 181 NONAME + _ZNK11CSendObject12HasDataphaseEv @ 182 NONAME + _ZNK11CSendObject5MatchERK15TMTPTypeRequestR14MMTPConnection @ 183 NONAME + _ZNK15CRequestUnknown5MatchERK15TMTPTypeRequestR14MMTPConnection @ 184 NONAME + _ZNK17CRequestProcessor10ConnectionEv @ 185 NONAME + _ZNK17CRequestProcessor12HasDataphaseEv @ 186 NONAME + _ZNK17CRequestProcessor5MatchERK13TMTPTypeEventR14MMTPConnection @ 187 NONAME + _ZNK17CRequestProcessor5MatchERK15TMTPTypeRequestR14MMTPConnection @ 188 NONAME + _ZNK17CRequestProcessor7RequestEv @ 189 NONAME + _ZNK18CSetObjectPropList12HasDataphaseEv @ 190 NONAME + _ZNK19CSetObjectPropValue12HasDataphaseEv @ 191 NONAME + _ZNK20CSetObjectReferences12HasDataphaseEv @ 192 NONAME + _ZTI10CGetObject @ 193 NONAME + _ZTI11CCopyObject @ 194 NONAME + _ZTI11CMoveObject @ 195 NONAME + _ZTI11CSendObject @ 196 NONAME + _ZTI13CDeleteObject @ 197 NONAME + _ZTI13CRenameObject @ 198 NONAME + _ZTI14CGetObjectInfo @ 199 NONAME + _ZTI15CRequestChecker @ 200 NONAME + _ZTI15CRequestUnknown @ 201 NONAME + _ZTI15TMTPTypeFlatBuf @ 202 NONAME + _ZTI17CGetPartialObject @ 203 NONAME + _ZTI17CRequestProcessor @ 204 NONAME + _ZTI18CGetObjectPropDesc @ 205 NONAME + _ZTI18CGetObjectPropList @ 206 NONAME + _ZTI18CHXMetaDataUtility @ 207 NONAME + _ZTI18CSetObjectPropList @ 208 NONAME + _ZTI19CGetObjectPropValue @ 209 NONAME + _ZTI19CSetObjectPropValue @ 210 NONAME + _ZTI20CGetObjectReferences @ 211 NONAME + _ZTI20CSetObjectReferences @ 212 NONAME + _ZTI22CGetFormatCapabilities @ 213 NONAME + _ZTI23CMmMtpDpAccessSingleton @ 214 NONAME + _ZTI24CGetObjectPropsSupported @ 215 NONAME + _ZTI25CMmMtpDpMetadataMpxAccess @ 216 NONAME + _ZTI27CMmMtpDpMetadataVideoAccess @ 217 NONAME + _ZTI29CMmMtpDpMetadataAccessWrapper @ 218 NONAME + _ZTV10CGetObject @ 219 NONAME + _ZTV11CCopyObject @ 220 NONAME + _ZTV11CMoveObject @ 221 NONAME + _ZTV11CSendObject @ 222 NONAME + _ZTV13CDeleteObject @ 223 NONAME + _ZTV13CRenameObject @ 224 NONAME + _ZTV14CGetObjectInfo @ 225 NONAME + _ZTV15CRequestChecker @ 226 NONAME + _ZTV15CRequestUnknown @ 227 NONAME + _ZTV15TMTPTypeFlatBuf @ 228 NONAME + _ZTV17CGetPartialObject @ 229 NONAME + _ZTV17CRequestProcessor @ 230 NONAME + _ZTV18CGetObjectPropDesc @ 231 NONAME + _ZTV18CGetObjectPropList @ 232 NONAME + _ZTV18CHXMetaDataUtility @ 233 NONAME + _ZTV18CSetObjectPropList @ 234 NONAME + _ZTV19CGetObjectPropValue @ 235 NONAME + _ZTV19CSetObjectPropValue @ 236 NONAME + _ZTV20CGetObjectReferences @ 237 NONAME + _ZTV20CSetObjectReferences @ 238 NONAME + _ZTV22CGetFormatCapabilities @ 239 NONAME + _ZTV23CMmMtpDpAccessSingleton @ 240 NONAME + _ZTV24CGetObjectPropsSupported @ 241 NONAME + _ZTV25CMmMtpDpMetadataMpxAccess @ 242 NONAME + _ZTV27CMmMtpDpMetadataVideoAccess @ 243 NONAME + _ZTV29CMmMtpDpMetadataAccessWrapper @ 244 NONAME + _ZThn28_N11CSendObject13UsbDisconnectEv @ 245 NONAME + _ZThn28_N17CRequestProcessor12HandleEventLERK13TMTPTypeEvent @ 246 NONAME + _ZThn28_N17CRequestProcessor13UsbDisconnectEv @ 247 NONAME + _ZThn28_N17CRequestProcessor14HandleRequestLERK15TMTPTypeRequest20TMTPTransactionPhase @ 248 NONAME + _ZThn28_N17CRequestProcessor7ReleaseEv @ 249 NONAME + _ZThn28_N17CRequestProcessor9SessionIdEv @ 250 NONAME + _ZThn28_NK11CSendObject5MatchERK15TMTPTypeRequestR14MMTPConnection @ 251 NONAME + _ZThn28_NK15CRequestUnknown5MatchERK15TMTPTypeRequestR14MMTPConnection @ 252 NONAME + _ZThn28_NK17CRequestProcessor10ConnectionEv @ 253 NONAME + _ZThn28_NK17CRequestProcessor5MatchERK13TMTPTypeEventR14MMTPConnection @ 254 NONAME + _ZThn28_NK17CRequestProcessor5MatchERK15TMTPTypeRequestR14MMTPConnection @ 255 NONAME + _ZThn28_NK17CRequestProcessor7RequestEv @ 256 NONAME + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,25 @@ +/* +* 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: Build information file for project mmmtpdprequestprocessor +* +*/ + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + + +PRJ_MMPFILES +mmmtpdprequestprocessor.mmp diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/group/mmmtpdprequestprocessor.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/group/mmmtpdprequestprocessor.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,93 @@ +/* +* 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: mmp file +* +*/ + + +#include +#include "../../inc/mmmtpdp_variant.hrh" + +TARGET mmmtpdprequestprocessor.dll +TARGETTYPE DLL +UID 0x1000008D 0x10207C54 + +VENDORID 0x70000001 + +CAPABILITY CAP_ECOM_PLUGIN + +MW_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc/ +USERINCLUDE ../../inc/ + +SOURCEPATH ../src +SOURCE crequestchecker.cpp +SOURCE crequestprocessor.cpp +SOURCE crequestunknown.cpp +SOURCE cdeleteobject.cpp +SOURCE cgetobject.cpp +SOURCE cgetobjectinfo.cpp +SOURCE cgetobjectpropdesc.cpp +SOURCE cgetobjectproplist.cpp +SOURCE cgetobjectpropssupported.cpp +SOURCE cgetobjectpropvalue.cpp +SOURCE cgetobjectreferences.cpp +SOURCE csendobject.cpp +SOURCE csetobjectproplist.cpp +SOURCE csetobjectpropvalue.cpp +SOURCE csetobjectreferences.cpp +SOURCE ttypeflatbuf.cpp +SOURCE cgetpartialobject.cpp +SOURCE ccopyobject.cpp +SOURCE cmoveobject.cpp +SOURCE crenameobject.cpp +SOURCE cgetformatcapabilities.cpp + +SOURCEPATH ../../src +SOURCE cmmmtpdpmetadatampxaccess.cpp +SOURCE cmmmtpdpmetadataaccesswrapper.cpp +SOURCE mmmtpdputility.cpp +SOURCE cmmmtpdpmetadatavideoaccess.cpp +SOURCE cmmmtpdpaccesssingleton.cpp + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY estor.lib +LIBRARY 3gpmp4lib.lib + +LIBRARY mpxcommon.lib +LIBRARY mpxcollectionhelper.lib + +LIBRARY mtpdatatypes.lib +LIBRARY mtpdataproviderapi.lib +LIBRARY platformenv.lib + +LIBRARY edbms.lib +LIBRARY contentlistingframework.lib +LIBRARY caf.lib + + +#if defined(__WINDOWS_MEDIA) +STATICLIBRARY hxmetadatautil.lib +#endif + +// for nanotick perf measurement +#if defined(MMMTPDP_PERFLOG) +LIBRARY hal.lib +#else +DEBUGLIBRARY hal.lib +#endif + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/ccopyobject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/ccopyobject.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,186 @@ +/* +* 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: Copy object operation +* +*/ + + +#ifndef CCOPYOBJECT_H +#define CCOPYOBJECT_H + +#include "crequestprocessor.h" + +class RFs; +class CFileMan; +class CMTPObjectMetaData; +class CMTPTypeObjectPropList; +class CMTPTypeObjectPropListElement; +class MMmMtpDpConfig; + +/** +* Defines CopyObject request processor +*/ +class CCopyObject : public CRequestProcessor + { +public: + /** + * Two-phase construction method + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper medadata access interface + * @return a pointer to the created request processor object + */ + //IMPORT_C static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + // MMTPConnection& aConnection, + // CMmMtpDpMetadataAccessWrapper& aWrapper ); + + /** + * Destructor + */ + IMPORT_C virtual ~CCopyObject(); + +protected: + /** + * Standard c++ constructor + */ + IMPORT_C CCopyObject( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Second phase constructor + */ + IMPORT_C void ConstructL(); + +protected: + // from CMTPRequestProcessor + /** + * CopyObject request handler + */ + IMPORT_C void ServiceL(); + + /** + * Set MetaData to CMetadataAccessWrapper, for internal use + * @param aPropCode, specify property code of aMediaProp + * @param aNewData, object property value which will be get from + * aObjectMetaData + * @param aObjectMetaData, owner of the property which should be + * inserted or updated into database + * @return response code + */ + IMPORT_C TMTPResponseCode ServiceMetaDataToWrapper( const TUint16 aPropCode, + MMTPType& aNewData, + const CMTPObjectMetaData& aObject ); + + virtual void ServiceGetSpecificObjectPropertyL( TUint16 aPropCode, + TUint32 aHandle, + const CMTPObjectMetaData& aObjectMetaData ) = 0; + + virtual TMTPResponseCode ServiceSetSpecificObjectPropertyL( TUint16 aPropCode, + const CMTPObjectMetaData& aObject, + const CMTPTypeObjectPropListElement& aElement ) = 0; + + // from CActive + IMPORT_C void RunL(); + + IMPORT_C TInt RunError( TInt aError ); + +private: + /** + * Retrieve the parameters of the request + */ + void GetParametersL(); + + void SetDefaultParentObjectL(); + + /** + * Copy object operation + */ + void CopyObjectL( TUint32& aNewHandle ); + + /** + * Check if we can copy the file to the new location + */ + TMTPResponseCode CanCopyObjectL( const TDesC& aOldName, + const TDesC& aNewName ) const; + + /** + * Save the object properties before doing the copy + */ + void GetPreviousPropertiesL( const CMTPObjectMetaData& aObject ); + + /** + * Set the object properties after doing the copy + */ + void SetPreviousPropertiesL( const CMTPObjectMetaData& aObject ); + + /** + * A helper function of CopyObjectL. + * @param aNewFileName the new full filename after copy. + * @return objectHandle of new copy of object. + */ + TUint32 CopyFileL( const TDesC& aNewFileName ); + + /* + * Generate the list of handles that need to be copied to the new location. + */ + void GenerateObjectHandleListL( TUint32 aParentHandle ); + + /** + * A helper function of CopyObjectL. + * @param aNewFolderName the new full file folder name after copy. + * @return objecthandle of new copy of the folder. + */ + TUint32 CopyFolderL( const TDesC& aNewFolderName ); + + /** + * Set the object properties in the object property store. + */ + void SetPropertiesL( const TDesC& aOldFileName, + const TDesC& aNewFileName, + const CMTPObjectMetaData& aObject ); + + /** + * Update object info in the database. + */ + TUint32 UpdateObjectInfoL( const TDesC& aOldObjectName, + const TDesC& aNewObjectName); + + /* + * A helper function of CopyObjectL + * Copy a single object and update the database + */ + void CopyAndUpdateL( TUint32 objectHandle ); + +protected: + CMTPTypeObjectPropListElement* iPropertyElement; + MMmMtpDpConfig& iDpConfig; + CMTPTypeObjectPropList* iPropertyList; +private: + CMTPObjectMetaData* iObjectInfo; // Not owned + RArray iObjectHandles; + CFileMan* iFileMan; + HBufC* iDest; + TUint32 iNewParentHandle; + TUint32 iHandle; + TUint32 iStorageId; + TInt iCopyObjectIndex; + TInt iNumberOfObjects; + HBufC* iPathToCopy; + HBufC* iNewRootFolder; + TTime iPreviousModifiedTime; + + }; + +#endif // CCOPYOBJECT_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/cdeleteobject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/cdeleteobject.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,132 @@ +/* +* 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: Delete object operation +* +*/ + + +#ifndef CDELETEOBJECT_H +#define CDELETEOBJECT_H + +#include +#include +#include + +#include "crequestprocessor.h" + +//forward declaration +class RFs; +class CMTPTypeArray; +class MMTPObjectMgr; +class MMmMtpDpConfig; + +/** +* Defines DeleteObject request processor +*/ +class CDeleteObject : public CRequestProcessor + { +public: + /** + * Two-phase construction method + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper medadata access interface + * @return a pointer to the created request processor object + */ + IMPORT_C static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + IMPORT_C virtual ~CDeleteObject(); + +private: + /** + * Standard c++ constructor + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper medadata access interface + */ + IMPORT_C CDeleteObject( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + +protected: + //from CRequestProcessor + /** + * DeleteObject request handler + */ + IMPORT_C void ServiceL(); + + //from CActive + /** + * AO Run method, deletes a selection of files on the system + */ + IMPORT_C void RunL(); + + /** + * Used to cancel the deletion of the files + */ + IMPORT_C void DoCancel(); + +private: + void ConstructL(); + /** + * Control the deletion + */ + void StartL(); + /** + * Delete all child objects of an association recursively. + */ + void DeleteAllChildrenL(); + + /** + * Delete all of the associations if file deletion was successful + * Then signals that the deletion has been completed + */ + void ProcessFinalPhaseL(); + + /** + * Gets all object handles (for GetObjectHandlesL) + */ + void GetObjectHandlesL( TUint32 aStorageId, TUint32 aParentHandle ); + + /** + * Deletes an object from the file system and the object store + */ + void DeleteObjectL( const CMTPObjectMetaData& aObjectInfo ); + +private: + // MTP Object Manager + MMTPObjectMgr& iObjectMgr; + + // File server used to open the database + RFs& iFs; + + // Array of all the objects to delete + RArray iObjectsToDelete; + + // Keeps track of any errors that occur + TInt iDeleteError; + + // Keeps track of whether any files where deleted + TBool iIsMultiDelete; + + // Accessor of DB + MMmMtpDpConfig& iDpConfig; + }; + +#endif // CDELETEOBJECT_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/cgetformatcapabilities.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/cgetformatcapabilities.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,146 @@ +/* +* 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: Get Format Capabilities operation +* +*/ +#ifndef CGETFORMATCAPABILITLIST_H +#define CGETFORMATCAPABILITLIST_H + +#include + +#include "crequestprocessor.h" +#include "mmmtpdplogger.h" +#include "mmmtpdpconfig.h" + +// forward declaration +class MMTPRequestProcessor; +class MMmMtpDpConfig; +class CMTPTypeObjectPropDesc; +class CMTPTypeInterdependentPropDesc; +class CMTPTypeObjectPropDesc; +class CMTPTypeString; + +/** +Implements the file data provider CMTPGetFormatCapabilities request processor. +@internalComponent +*/ +class CGetFormatCapabilities : public CRequestProcessor + { +public: + /** + * Destructor + */ + IMPORT_C virtual ~CGetFormatCapabilities(); + +protected: + /** + * Standard c++ constructor + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aDpConfig, The interface of dataprovider configuration + */ + IMPORT_C CGetFormatCapabilities( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Constructor + * Second phase constructor + */ + IMPORT_C void ConstructL(); + +protected: + // from CMTPRequestProcessor + /** + * CGetFormatCapabilities request handler + */ + IMPORT_C void ServiceL(); + + /** + * Check the current request + * @return EMTPRespCodeOK if the reqeust is good, otherwise, + * one of the error response codes + */ + IMPORT_C TMTPResponseCode CheckRequestL(); + +protected: + // new virtuals + /** + * Service specific object property + * @param aPropCode, The prop code + * @return MTPType object propdesc + */ + virtual CMTPTypeObjectPropDesc* ServiceSpecificPropertyDescL( TUint16 aPropCode ) = 0; + + /** + * Service interdepent propdesc + * @param aFormatCode, The format code + * @return MTPTypeInterdependentPropDesc + */ + virtual void ServiceInterdepentPropDescL() = 0; + +private: + /** + * Get PropDesc via PropCode + * @param aPropCode The Property Code + * @return The MTPTypeObject PropDesc + */ + CMTPTypeObjectPropDesc* ServicePropDescL( TUint16 aPropCode ); + + /** + * Get PropDesc with Protection status + * @return The MTPTypeObject PropDesc + */ + CMTPTypeObjectPropDesc* ServiceProtectionStatusL(); + + /** + * Get PropDesc with file name + * @return The MTPTypeObject PropDesc + */ + CMTPTypeObjectPropDesc* ServiceFileNameL(); + + /** + * Get PropDesc with nonconsumable + * @return The MTPTypeObject PropDesc + */ + CMTPTypeObjectPropDesc* ServiceNonConsumableL(); + + /** + * Get group code + * @param aPropCode Specify the property code of which the group code needed + * @return Group code of specified property + */ + TUint32 GetGroupCode( TUint32 aPropCode ); + +protected: + /* + * Format code. + */ + TUint iFormatCode; + + CMTPTypeInterdependentPropDesc* iInterdependentPropDesc; + +private: // Owned + /* + * CMTPTypeCapabilityList dataset. + */ + CMTPTypeFormatCapabilityList* iCapabilityList; + + /* + * MMmMtpDpConfig. + */ + MMmMtpDpConfig& iDpConfig; + }; + +#endif // CMTPGETFORMATCAPABILITLIST_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/cgetobject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/cgetobject.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,94 @@ +/* +* 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: Get Object operation +* +*/ + + +#ifndef CGETOBJECT_H +#define CGETOBJECT_H + +#include "crequestprocessor.h" + +// forward declaration +class RFs; +class CMTPTypeFile; +class MMmMtpDpConfig; + +/** +* Defines GetObject request processor +*/ +class CGetObject : public CRequestProcessor + { +public: + /** + * Two-phase construction method + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper medadata access interface + * @return a pointer to the created request processor object + */ + IMPORT_C static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + IMPORT_C ~CGetObject(); + +protected: + // from CRequestProcessor + /** + * GetObject request handler + */ + void ServiceL(); + + /** + * Handle the response phase of the current request + * @return EFalse + */ + TBool DoHandleResponsePhaseL(); + + /** + * Two-phase construction + */ + void ConstructL(); + +private: + /** + * Standard c++ constructor + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + */ + CGetObject( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection ); + + void GetObjectL( const TDesC& aFileName ); + +private: + // File server used to open the database + RFs& iFs; + + // File Object to encapsulate the object to send back + CMTPTypeFile* iFileObject; + + // Object Info + CMTPObjectMetaData* iObjectInfo; + + // + TMTPResponseCode iError; + }; + +#endif // CGETOBJECT_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/cgetobjectinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/cgetobjectinfo.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,87 @@ +/* +* 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: Get object info operation +* +*/ + + +#ifndef CGETOBJECTINFO_H +#define CGETOBJECTINFO_H + +#include "crequestprocessor.h" + +// forward declacration +class CMmMtpDpMetadataAccessWrapper; +class CMTPTypeObjectInfo; +class MMmMtpDpConfig; + +/** +* Defines GetObjectInfo request processor +*/ +class CGetObjectInfo : public CRequestProcessor + { +public: + /** + * Two-phase construction method + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper medadata access interface + * @return a pointer to the created request processor object + */ + IMPORT_C static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + IMPORT_C ~CGetObjectInfo(); + +protected: + // From CRequestProcessor + /** + * GetObjectInfo request handler + */ + void ServiceL(); + +private: + /** + * Standard c++ constructor + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper medadata access interface + */ + IMPORT_C CGetObjectInfo( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Second-phase construction + */ + IMPORT_C void ConstructL(); + +private: + /** + * Prepare object with existing data according to the handle from PC + */ + void BuildObjectInfoL(); + +private: + + CMTPTypeObjectInfo* iObjectInfo; + + MMmMtpDpConfig& iDpConfig; + }; + +#endif // CGETOBJECTINFO_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/cgetobjectpropdesc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/cgetobjectpropdesc.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,121 @@ +/* +* 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: Get object properties descript operation +* +*/ + + +#ifndef CGETOBJECTPROPDESC_H +#define CGETOBJECTPROPDESC_H + +#include "crequestprocessor.h" + +// forward declaration +class CMTPTypeObjectPropDesc; +class MMmMtpDpConfig; + +/** +* Defines GetObjectPropDesc request processor for common +*/ +class CGetObjectPropDesc : public CRequestProcessor + { +public: + /** + * Destructor + */ + IMPORT_C virtual ~CGetObjectPropDesc(); + +protected: + /** + * Standard c++ constructor + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper Medadata access interface + */ + IMPORT_C CGetObjectPropDesc( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Second phase constructor + */ + IMPORT_C void ConstructL(); + +protected: + //from CRequestProcessor + /** + * GetObjectPropDesc request handler + */ + IMPORT_C void ServiceL(); + + /** + * Check the current request + * @return EMTPRespCodeOK if the reqeust is good, otherwise, + * one of the error response codes + */ + IMPORT_C TMTPResponseCode CheckRequestL(); + +protected: + // new virtuals + virtual void ServiceSpecificObjectPropertyL( TUint16 aPropCode ) = 0; + +private: + /** + * Ensures the object format operation parameter is valid + * (done for CheckRequestL) + * @return Response code of the check result + */ + TMTPResponseCode CheckFormatL() const; + + /** + * Ensures the object prop code operation parameter is valid + * (done for CheckRequestL) + * @return Response code of the check + */ + TMTPResponseCode CheckPropCodeL() const; + + /** + * Create list of possible protection status and create new ObjectPropDesc + */ + void ServiceProtectionStatusL(); + + /** + * Create Regular expression for a file name and create new ObjectPropDesc + */ + void ServiceFileNameL(); + + /** + * Create list of possible nonConsumable values and create new ObjectPropDesc + */ + void ServiceNonConsumableL(); + + /* + * Get group code according to property code + * @param aPropCode Specify the property code of which the group code needed + * @return Group code of specified property + */ + TUint32 GetGroupCode( TUint16 aPropCode ); + + +protected: + // Property object to return with the desc value + CMTPTypeObjectPropDesc* iObjectProperty; + + //Format code + TUint32 iFormatCode; + + MMmMtpDpConfig& iDpConfig; + }; + +#endif // CGETOBJECTPROPDESC_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/cgetobjectproplist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/cgetobjectproplist.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,193 @@ +/* +* 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: Get object proplist operation +* +*/ + + +#ifndef CGETOBJECTPROPLIST_H +#define CGETOBJECTPROPLIST_H + +#include "crequestprocessor.h" +#include "cmmmtpdpperflog.h" + +// forward declaration +class CMTPTypeArray; +class CMTPTypeObjectPropList; +class MMmMtpDpConfig; +class CMTPTypeObjectPropListElement; + +/** +* Defines GetObjectPropList request processor +*/ +class CGetObjectPropList : public CRequestProcessor + { +public: + /** + * Destructor + */ + IMPORT_C virtual ~CGetObjectPropList(); + +protected: + /** + * Standard C++ Constructor + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aDpConfig, The interface of dataprovider configuration + */ + IMPORT_C CGetObjectPropList( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * 2nd Phase Constructor + */ + IMPORT_C void ConstructL(); + +protected: + // from CRequestProcessor + /** + * Service a request at request phase + */ + IMPORT_C void ServiceL(); + + /** + * Check the current request + * @return EMTPRespCodeOK if the reqeust is good, otherwise, + * one of the error response codes + */ + IMPORT_C TMTPResponseCode CheckRequestL(); + + // From CActive + /** + * Cancel the enumeration process + */ + IMPORT_C void DoCancel(); + + /** + * Handle completed request + */ + IMPORT_C void RunL(); + + /** + * Ignore the error, continue with the next one + */ + IMPORT_C TInt RunError( TInt aError ); + +protected: + // new virtuals + virtual TInt ServiceSpecificObjectPropertyL( TUint16 aPropCode, TUint32 aHandle ) = 0; + +private: + /** + * Ensures the object format operation parameter is valid + * (done for CheckRequestL) + * @return Response code of the check result + */ + TMTPResponseCode CheckFormatL() const; + + /** + * Ensures the object prop code operation parameter is valid + * (done for CheckRequestL) + * @return Response code of the check + */ + TMTPResponseCode CheckPropCodeL() const; + + /** + * Ensures the depth operation parameter is valid (done for CheckRequestL) + * @return Response code of the check + */ + TMTPResponseCode CheckDepth() const; + + /** + * Gets the handles for the objects that we want the properties for + */ + void GetObjectHandlesL(); + + /** + * Gets all object handles (for GetObjectHandlesL) + * @param aStorageId, storage ID + * @param aParentHandle, parent handle + * @param aFormat, format + */ + void GetObjectHandlesL( TUint32 aStorageId, TUint32 aParentHandle, TUint16 aFormat = 0x0000 ); + + /** + * Gets the handles of all objects on the root (for GetObjectHandlesL) + * @param aDepth, depth of file structure + * @param aFormat, format + */ + void GetRootObjectHandlesL( TUint32 aDepth, TUint16 aFormat ); + + /** + * Gets a folder object handle (for GetObjectHandlesL) + * @param aDepth, depth of file structure + * @param aParentHandle, parent handle + */ + void GetFolderObjectHandlesL( TUint32 aDepth, TUint32 aParentHandle ); + + /** + * Gets a specified object handle (for GetObjectHandlesL) + * @param aHandle, object handler + */ +// void GetSpecificObjectHandlesL( TUint32 aHandle ); + + /** + * Gets the object property information for the required object + * @param aHandle, object handler + * @param aPropCode, property code + * @return error code + */ + TInt ServiceOneObjectPropertyL( TUint32 aHandle, TUint16 aPropCode ); + + /** + * Gets a list of all the properties supported + * @param aHandle, object handler + */ + TInt ServiceAllPropertiesL( TUint32 aHandle ); + + TInt ServiceGroupPropertiesL( TUint32 aHandle ); + + void GetPropertiesL( RArray& aPropArray, TUint32 aGroupCode, TUint16 aFormatCode ) const; + + void SetSubFormatCodeL(); + +protected: + CMTPTypeObjectPropListElement* iPropertyElement; // used by media DP directly + + // object which is prepare for PC + CMTPObjectMetaData* iObject; + + // Array of the object handles to get object properties about + RArray iHandles; + + // Final object property array to send back + CMTPTypeObjectPropList* iPropertyList; + + MMmMtpDpConfig& iDpConfig; + + mutable RArray iPropertyArray; + + mutable TUint32 iHandle; + mutable TUint32 iDepth; + mutable TUint32 iPropCode; + mutable TUint32 iFormatCode; + +#if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) + CMmMtpDpPerfLog* iPerfLog; +#endif + + }; + +#endif // CGETOBJECTPROPLIST_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/cgetobjectpropssupported.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/cgetobjectpropssupported.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,75 @@ +/* +* 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: Get object properties supported. +* +*/ + + +#ifndef CGETOBJECTPROPSSUPPORTED_H +#define CGETOBJECTPROPSSUPPORTED_H + +#include "crequestprocessor.h" + +// forward declaration +class CMTPTypeArray; +class CMmMtpDpMetadataAccessWrapper; +class MMmMtpDpConfig; + +/** +* Defines GetObjectPropsSupported request processor +*/ +class CGetObjectPropsSupported : public CRequestProcessor + { +public: + /** + * Two-phase construction method + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aDpConfig, The interface of dataprovider configuration + * @return a pointer to the created request processor object + */ + IMPORT_C static MMmRequestProcessor* NewL(MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + + /** + * Destructor. + */ + IMPORT_C ~CGetObjectPropsSupported(); + +private: + /** + * Standard c++ constructor + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aDpConfig, The interface of dataprovider configuration + */ + CGetObjectPropsSupported( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + +protected: + // from CRequestProcessor + /** + * GetObjectPropsSupported request handler + */ + IMPORT_C void ServiceL(); + +private: + CMTPTypeArray* iObjectPropsSupported; + MMmMtpDpConfig& iDpConfig; + }; + +#endif // CGETOBJECTPROPSSUPPORTED_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/cgetobjectpropvalue.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/cgetobjectpropvalue.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,115 @@ +/* +* 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: Get object prop value +* +*/ + + +#ifndef CGETOBJECTPROPVALUE_H +#define CGETOBJECTPROPVALUE_H + +#include "crequestprocessor.h" + +// forward declaration +class TMTPTypeUint8; +class TMTPTypeUint16; +class TMTPTypeUint32; +class TMTPTypeUint64; +class TMTPTypeUint128; +class CMTPTypeString; +class CMTPTypeArray; +class TMTPObjectInfo; +class MMmMtpDpConfig; + + +/** +* Defines GetObjectPropValue request processor +*/ +class CGetObjectPropValue : public CRequestProcessor + { +public: + /** + * Two-phase construction method + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper medadata access interface + * @return a pointer to the created request processor object + */ + //IMPORT_C static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection, CMmMtpDpMetadataAccessWrapper& aWrapper ); + + /** + * Destructor + */ + IMPORT_C virtual ~CGetObjectPropValue(); + +protected: + /** + * Standard c++ constructor + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper medadata access interface + */ + IMPORT_C CGetObjectPropValue( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + +protected: + //from CRequestProcessor + /** + * Verify the reqeust + * @return EMTPRespCodeOK if request is verified, otherwise one of + * the error response codes + */ + IMPORT_C TMTPResponseCode CheckRequestL(); + + /** + * GetObjectPropValue request handler + */ + IMPORT_C void ServiceL(); + +protected: + // new virtuals + virtual void ServiceSpecificObjectPropertyL( TUint16 aPropCode ) = 0; + +protected: + /** + * Get MetaData from CMetadataAccessWrapper and send data + * or response to initiator. for internal use + * @param aPropCode, specify property code of aMediaProp + * @param aNewData, object property value which will be get from + * aObjectMetaData + * @param aObjectMetaData, owner of the property which should be + * inserted or updated into database + * @return void + */ + IMPORT_C void ServiceMetaDataFromWrapperL( const TUint16 aPropCode, + MMTPType& aNewData, + const CMTPObjectMetaData& aObjectMetaData ); + +protected: + // object which is prepare for PC + CMTPObjectMetaData* iObjectInfo; + + MMmMtpDpConfig& iDpConfig; + TMTPTypeUint8 iMTPTypeUint8; + TMTPTypeUint16 iMTPTypeUint16; + TMTPTypeUint32 iMTPTypeUint32; + TMTPTypeUint64 iMTPTypeUint64; + TMTPTypeUint128 iMTPTypeUint128; + CMTPTypeString* iMTPTypeString; + CMTPTypeArray* iMTPTypeArray; + + }; + +#endif // CGETOBJECTPROPVALUE_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/cgetobjectreferences.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/cgetobjectreferences.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,78 @@ +/* +* 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: Get object references. +* +*/ + + +#ifndef CGETOBJECTREFERENCES_H +#define CGETOBJECTREFERENCES_H + +#include "crequestprocessor.h" + +// forward declaration +class CMTPTypeArray; +class MMmMtpDpConfig; + +/** +* Defines GetObjectReferences request processor +*/ +class CGetObjectReferences : public CRequestProcessor + { +public: + /** + * Two-phase construction method + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper Medadata access interface + * @return a pointer to the created request processor object + */ + IMPORT_C static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + IMPORT_C ~CGetObjectReferences(); + +protected: + // From CRequestProcessor + /** + * GetObjectReferences request handler + */ + void ServiceL(); + +private: + /** + * Standard c++ constructor + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper Medadata access interface + */ + CGetObjectReferences( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection ); + + /** + * Two-phase construction + */ + void ConstructL(); + +private: + // Array object to store object references + CMTPTypeArray* iReferences; + + }; + +#endif // CGETOBJECTREFERENCES_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/cgetpartialobject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/cgetpartialobject.h Thu Dec 17 08:55:47 2009 +0200 @@ -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: GetParitialObject operation +* +*/ + + +#ifndef CGETPARTIALOBJECT_H +#define CGETPARTIALOBJECT_H + +#include "crequestprocessor.h" + +class MMTPDataProviderFramework; +class RFs; +class TMTPTypeFlatBase; +class CMTPTypeFile; +class CMmMtpDpMetadataAccessWrapper; +class MMmMtpDpConfig; + +/** +* Defines GetPartialObject request processor +*/ +class CGetPartialObject : public CRequestProcessor + { +public: + /** + * Two-phase construction method + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper medadata access interface + * @return a pointer to the created request processor object + */ + IMPORT_C static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + IMPORT_C virtual ~CGetPartialObject(); + +protected: + /** + * Standard c++ constructor + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + */ + IMPORT_C CGetPartialObject( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection ); + +protected: + // from CRequestProcessor + /** + * Check the GetPartialObject reqeust + * @return EMTPRespCodeOK if the request is good, otherwise, one of the error response codes + */ + IMPORT_C TMTPResponseCode CheckRequestL(); + + /** + * GetPartialObject request handler + * Send the partial object data to the initiator + */ + IMPORT_C void ServiceL(); + + /** + * Signal to the initiator how much data has been sent + * @return EFalse + */ + IMPORT_C TBool DoHandleResponsePhaseL(); + +private: + /** + * Second-phase construction + */ + void ConstructL(); + +private: + //helper + /** + * Verify if the parameter of the request (i.e. offset) is good. + * @return ETrue if the parameter is good, otherwise, EFalse + */ + TBool VerifyParametersL(); + + /** + * Populate the partial data object + */ + void BuildPartialDataL(); + +private: + MMTPDataProviderFramework& iFramework; + RFs& iFs; + TMTPTypeFlatBase* iPartialData; + HBufC8* iBuffer; + TPtr8 iBufferPtr8; + TInt iOffset; + TInt iPartialDataLength; + TBool iCompleteFile; + CMTPTypeFile* iFileObject; + TBuf iFileSuid; + TUint32 iObjectHandle; + + }; + +#endif // CGETPARTIALOBJECT_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/cmoveobject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/cmoveobject.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,195 @@ +/* +* 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: Move object operation +* +*/ + + +#ifndef CMOVEOBJECT_H +#define CMOVEOBJECT_H + +#include "crequestprocessor.h" + +class CFileMan; +class CMTPObjectMetaData; +class CMmMtpDpMetadataAccessWrapper; +class CMTPTypeObjectPropList; +class CMTPTypeObjectPropListElement; +class MMmMtpDpConfig; + +/** +* Defines MoveObject request processor +*/ +class CMoveObject : public CRequestProcessor + { +public: + /** + * Two-phase construction method + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper medadata access interface + * @return a pointer to the created request processor object + */ + //IMPORT_C static MMmRequestProcessor* NewL( + // MMTPDataProviderFramework& aFramework, + // MMTPConnection& aConnection, + // CMmMtpDpMetadataAccessWrapper& aWrapper ); + + /** + * Destructor + */ + IMPORT_C virtual ~CMoveObject(); + +protected: + /** + * Standard c++ constructor + */ + IMPORT_C CMoveObject( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Second phase constructor + */ + IMPORT_C void ConstructL(); + +protected: + // from CRequestProcessor + /** + * MoveObject request handler + */ + IMPORT_C void ServiceL(); + + // from CActive + IMPORT_C void RunL(); + + IMPORT_C TInt RunError( TInt aError ); + + +protected: + // new virtuals + /** + * Set MetaData to CMetadataAccessWrapper, for internal use + * @param aPropCode, specify property code of aMediaProp + * @param aNewData, object property value which will be get from + * aObjectMetaData + * @param aObjectMetaData, owner of the property which should be + * inserted or updated into database + * @return response code + */ + IMPORT_C TMTPResponseCode ServiceMetaDataToWrapper( const TUint16 aPropCode, + MMTPType& aNewData, + const CMTPObjectMetaData& aObject ); + + virtual void ServiceGetSpecificObjectPropertyL( TUint16 aPropCode, + TUint32 aHandle, + const CMTPObjectMetaData& aObject ) = 0; + + virtual TMTPResponseCode ServiceSetSpecificObjectPropertyL( TUint16 aPropCode, + const CMTPObjectMetaData& aObject, + const CMTPTypeObjectPropListElement& aElement ) = 0; + +private: + /** + * Retrieve the parameters of the request + */ + void GetParametersL(); + + /** + * Get a default parent object, ff the request does not specify a parent object, + */ + void SetDefaultParentObjectL(); + + /** + * move object operations + * @return A valid MTP response code. + */ + TMTPResponseCode MoveObjectL(); + + /** + * Check if we can move the file to the new location + */ + TMTPResponseCode CanMoveObjectL( const TDesC& aOldName, + const TDesC& aNewName ) const; + + /** + * Save the object properties before moving + */ + void GetPreviousPropertiesL( const CMTPObjectMetaData& aObject ); + + /** + * Set the object properties after moving + */ + + void SetPreviousPropertiesL( const CMTPObjectMetaData& aObject ); + /** + * A helper function of MoveObjectL. + * @param aNewFileName the new file name after the object is moved. + */ + void MoveFileL( const TDesC& aNewFileName ); + + /** + * A helper function of MoveObjectL + */ + void MoveFolderL(); + + /* Move the objects through iterations of RunL. It currently move 20 objects + * at a time and the number can be adjusted by changing + * "KMoveObjectGranularity" + */ + TBool MoveOwnedObjectsL(); + + /** + * Set the object properties in the object property store. + */ + void SetPropertiesL( const TDesC& aOldFileName, + const TDesC& aNewFileName, + const CMTPObjectMetaData& aNewObject ); + + /* + * This function will actually delete the orginal folders from the file system. + */ + TMTPResponseCode FinalPhaseMove(); + + /* + * Generate the list of handles that need to be moved to the new location. + */ + void GenerateObjectHandleListL( TUint32 aParentHandle ); + + /* + * Move a single object and update the database + */ + void MoveAndUpdateL( TUint32 objectHandle ); + + +protected: + CMTPTypeObjectPropListElement* iPropertyElement; + MMmMtpDpConfig& iDpConfig; + CMTPTypeObjectPropList* iPropertyList; +private: + TBool iSameStorage; + CFileMan* iFileMan; + CMTPObjectMetaData* iObjectInfo; //Not owned. + HBufC* iDest; + HBufC* iNewRootFolder; + TUint32 iNewParentHandle; + TUint32 iStorageId; + TTime iPreviousModifiedTime; + HBufC* iPathToMove; + RArray iObjectHandles; + TInt iMoveObjectIndex; + TInt iNumberOfObjects; + }; + +#endif // CMOVEOBJCT_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/crenameobject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/crenameobject.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,97 @@ +/* +* 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: Rename object +* +*/ + + +#ifndef CRENAMEOBJECT_H +#define CRENAMEOBJECT_H + +// Forward declarations +class MMTPDataProviderFramework; +class CMmMtpDpMetadataAccessWrapper; +class MMTPObjectMgr; +class CMTPObjectMetaData; + +class CRenameObject: public CActive + { +public: + /** + * Two phase constructor + * @param aFramework Reference to MMTPDataProviderFramework + * @param aWrapper Reference to CMmMtpDpMetadataAccessWrapper + * @return A pointer to a new instance of the object + */ + IMPORT_C static CRenameObject* NewL( MMTPDataProviderFramework& aFramework, + CMmMtpDpMetadataAccessWrapper& aWrapper ); + + /** + * destructor + */ + IMPORT_C virtual ~CRenameObject(); + + IMPORT_C void StartL( const TUint32 aParentHandle, + const TDesC& aOldFolderName ); + +protected: + /** + * Standard C++ Constructor + * @param aFramework Reference to MMTPDataProviderFramework + * @param aWrapper Reference to CMmMtpDpMetadataAccessWrapper + */ + IMPORT_C CRenameObject( MMTPDataProviderFramework& aFramework, + CMmMtpDpMetadataAccessWrapper& aWrapper ); + + IMPORT_C void ConstructL(); + + // added to perform additional action base on need + virtual void PerformAdditionalActionL(); + +protected: + // from CActive + IMPORT_C void DoCancel(); + + IMPORT_C void RunL(); + + IMPORT_C TInt RunError( TInt aError ); + +private: + + void GenerateObjectHandleListL( TUint32 aParentHandle ); + + void GetParentSuidL( TUint32 aHandle, const TDesC& aFolderName ); + +protected: + MMTPDataProviderFramework& iFramework; + RArray iObjectHandles; + CMTPObjectMetaData* iObjectInfo; + TInt iCount; + TInt iIndex; + RBuf iNewFolderName; + RBuf iOldFolderFullName; + RBuf iFileName; + RBuf iRightPartName; + RBuf iOldFileName; + + // Owned + /** MMTPDataProviderFramework used to access MTP components*/ + CMmMtpDpMetadataAccessWrapper& iWrapper; + +private: + CActiveSchedulerWait* iRenameWaiter; + TUint32 iParentHandle; + }; + +#endif // CRENAMEOBJECT_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/crequestchecker.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/crequestchecker.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,225 @@ +/* +* 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 CREQUESTCHECKER_H +#define CREQUESTCHECKER_H + +#include +#include +#include + +class CMTPObjectMetaData; +class MMTPDataProviderFramework; +class MMTPConnection; + +/** +* element type in the request +*/ +enum TMTPElementType + { + /** + * Session ID type + */ + EMTPElementTypeSessionID, + + /** + * Object Handle type + */ + EMTPElementTypeObjectHandle, + + /** + * Format code type + */ + EMTPElementTypeFormatCode, + + /** + * Storeage Id type + */ + EMTPElementTypeStorageId, + }; + +/** +* element attribute to check in the reqeust +*/ +enum TMTPElementAttr + { + /** + * no attribute to check + */ + EMTPElementAttrNone = 0x0000, + + /** + * the object/storage should be readable + */ + EMTPElementAttrRead = 0x0001, + + /** + * the object/storage should be writable + */ + EMTPElementAttrWrite = 0x0002, + + /** + * the object should be a file + */ + EMTPElementAttrFile = 0x0004, + + /** + * the object should be a directory + */ + EMTPElementAttrDir = 0x0008, + + /** + * supported format array + */ + EMTPElementAttrFormatEnums = 0x0010, + + /** + * The object can be either a file or directory. + */ + EMTPElementAttrFileOrDir = 0x0020, + }; + +/** +* defines the verification data structure +*/ +struct TMTPRequestElementInfo + { + TMTPTypeRequest::TElements iElementIndex; //which element in the request to check + TMTPElementType iElementType; //the type of the element + TInt iElementAttr; //the attribute of the element + TInt iCount; //number of special values (0, 1, 2) + TUint32 iValue1; //special value 1 + TUint32 iValue2; //special value 2 + }; + +/** +* defines a generic request verification class. It iterates through the verification data elements, +* and performs the check based on the element type/attribute. +*/ +class CRequestChecker : public CBase + { +public: + /** + * Two-phase construction method + * @param aFramework The data provider framework + * @param aConnection The connection object + * @return a pointer to the created request checker object + */ + static CRequestChecker* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection ); + + /** + * Destructor + */ + ~CRequestChecker(); + + /** + * Verfiy the request. It check the request header first (session id and transaction code), and check for special values, last + * it iterates through the verification elements for checking individul parameters in the request + * @param aRequest The request object to verify + * @param aCount The number of verification elements + * @param aElementInfo The array of verification elements + * @return reponse code to return to the initiator + */ + TMTPResponseCode VerifyRequestL( const TMTPTypeRequest& aRequest, + TInt aCount, + const TMTPRequestElementInfo* aElementInfo ); + + /** + * Return the object info for the handle. + * This is to remove extra expensive DMBS retrieval operations. + * @param aHandle the handle of the object requested + * @return an object info for the handle + */ + CMTPObjectMetaData* GetObjectInfo( TUint32 aHandle ) const; + +private: + /** + * Check the request header portion (session Id and transaction code) + * @param aRequest the request object to check + * @return repsonse code to return to initiator + */ + TMTPResponseCode CheckRequestHeader( const TMTPTypeRequest& aRequest ) const; + + /** + * Check the session id in the request parameter (NOTE the session id is different from the one in the request header), + * this usually only applies to the OpenSession request + * @param aSessionId Session id of the request. + * @param aElementInfo ElementInfo data array to check against. + * @return repsonse code to return to initiator + */ + TMTPResponseCode VerifySessionId( TUint32 aSessionId, + const TMTPRequestElementInfo& aElementInfo ) const; + + /** + * Check the object handle in the request parameter, whether the handle is in the object store, read/write, file/dir + * @param aHandle Object handle to be checked. + * @param aElementInfo Element info array to be checked against. + * @return repsonse code to return to initiator + */ + TMTPResponseCode VerifyObjectHandleL( TUint32 aHandle, + const TMTPRequestElementInfo& aElementInfo ); + + /** + * Check the storage id parameter in the request, read/write attributes + * @param aStorageId Storage id to be checked. + * @param aElementInfo Element info array to be checked against. + * @return repsonse code to return to initiator + */ + TMTPResponseCode VerifyStorageIdL( TUint32 aStorageId, + const TMTPRequestElementInfo& aElementInfo ) const; + + /** + * Check the format code parameter in the request, + * @param aStorageId aFormatCode to be checked. + * @param aElementInfo Element info array to be checked against. + * @return repsonse code to return to initiator + */ + TMTPResponseCode VerifyFormatCode( TUint32 aFormatCode, + const TMTPRequestElementInfo& aElementInfo ) const; + + /** + * Check if the parameter is one of the special values + * @param aParameter The parameter value in the request + * @param aElementInfo The ElementInfo for the parameter + * @return ETrue if the parameter is one of the special values, otherwise, EFalse + */ + TBool IsSpecialValue( TUint32 aParameter, + const TMTPRequestElementInfo& aElementInfo ) const; + +private: + /** + * Standard c++ constructor + */ + CRequestChecker( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection ); + + /** + * Two-phase construction + */ + void ConstructL(); + +private: + MMTPDataProviderFramework& iFramework; + MMTPConnection& iConnection; + RArray iHandles; //these two arrays contain the mapping from the handle to objectinfo + RPointerArray iObjectArray; + + }; + +#endif // CREQUESTCHECKER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/crequestprocessor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/crequestprocessor.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,339 @@ +/* +* 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 CREQUESTPROCESSOR_H +#define CREQUESTPROCESSOR_H + +#include +#include +#include +#include +#include + +#include "crequestchecker.h" + +class MMTPConnection; +class TMTPTypeRequest; +class CMTPDataProviderPlugin; +class MMTPDataProviderFramework; +class TMTPTypeEvent; +class CMTPObjectInfo; + +static const TInt KMmMtpRArrayGranularity = 2; + +/** +* Defines a request processor interface +*/ +class MMmRequestProcessor + { +public: + /** + * Process a request from the initiator + * @param aRequest The request to be processed + * @param aPhase The transaction phase of the request + * @return ETrue to signal that the processor object can be deleted, EFalse to keep the processor object + */ + virtual TBool HandleRequestL( const TMTPTypeRequest& aRequest, + TMTPTransactionPhase aPhase ) = 0; + + /** + * Process an event from the initiator + * @param aEvent The event to be processed + */ + virtual void HandleEventL( const TMTPTypeEvent& aEvent ) = 0; + + /** + * delete the request processor object + */ + virtual void Release() = 0; + + /** + * Check if the processor matches the request on the connection + * @param aRequest The request to be checked + * @param aConnection The connection from which the request comes + * @return ETrue to indicate the processor can handle the request, otherwise, EFalse + */ + virtual TBool Match( const TMTPTypeRequest& aRequest, + MMTPConnection& aConnection ) const = 0; + + /** + * Check if the processor matches the event on the connection + * @param aEvent The event to be checked + * @param aConnection The connection from which the event comes + * @return ETrue to indicate the processor can handle the event, otherwise, EFalse + */ + virtual TBool Match( const TMTPTypeEvent& aEvent, + MMTPConnection& aConnection ) const = 0; + + /** + * Get the request object which the processor is currently handling + * @return the request object which the processor is currently handling + */ + virtual const TMTPTypeRequest& Request() const = 0; + + /** + * Get the connection object associated with the current request object + * @return the connection object associated with the current request object + */ + virtual MMTPConnection& Connection() const = 0; + + /* + * Rollback when WMP closed and disconnect the USB cable, + * during the transferring file + */ + virtual void UsbDisconnect() = 0; + + /* + * Get the session id associated with current request object + * This interface was added to avoid the case that the data member iRequest + * was sometimes invalid in session close phase, and getting session id from + * request would cause panic + * @return session id + */ + virtual TUint32 SessionId() = 0; + }; + +/** +* Defines a processor factory function pointer +*/ +typedef MMmRequestProcessor + * (*TMTPRequestProcessorCreateFunc)( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection ); + +/** +* Defines an entry which maps from operation code to the request processor +*/ +typedef struct + { + TUint16 iOperationCode; + TMTPRequestProcessorCreateFunc iCreateFunc; + } TMTPRequestProcessorEntry; + +/** +* Defines a generic request processor interface from which all processors derive +*/ +class CRequestProcessor : public CActive, public MMmRequestProcessor + { +protected: + /** + * Standard c++ constructor + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aElementCount Number of element in the request. + * @param aElements The element info data. + * @return a pointer to the created request processor object + */ + IMPORT_C CRequestProcessor( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + TInt aElementCount, + const TMTPRequestElementInfo* aElements ); + + /** + * Destructor + */ + IMPORT_C virtual ~CRequestProcessor(); + +protected: + // utility methods + /** + * Send a response to the initiator + * @param aResponseCode The response code to send + * @param aParamCount The number of parameters + * @param aParmas The pointer to array of parameters + */ + IMPORT_C void SendResponseL( TMTPResponseCode aResponseCode, + TInt aParameterCount = 0, + TUint32* aParams = NULL ); + + /** + * Signal to the framework that the current request transaction has completed + */ + void CompleteRequestL(); + + /** + * Send data to the initiator + * @param aData The data to send + */ + IMPORT_C void SendDataL( const MMTPType& aData ); + + /** + * Receive data from the initiator + * @param aData The data to receive + */ + IMPORT_C void ReceiveDataL( MMTPType& aData ); + +protected: + // from MMTPRequestProcessor + /** + * Handle the request + * @param aRequest The request to be processed + * @param aPhase The current transaction phase of the request + * @return ETrue if the transaction has completed, otherwise, EFalse + */ + IMPORT_C TBool HandleRequestL( const TMTPTypeRequest& aRequest, + TMTPTransactionPhase aPhase ); + + /** + * Handle the event + * @param aEvent The event to be processed + */ + IMPORT_C void HandleEventL( const TMTPTypeEvent& aEvent ); + + /** + * Relese (delete) this request processor + */ + IMPORT_C void Release(); + + /** + * Check whether the processor can process the request + * @param aRequest The request to be processed + * @param aConnection The connection from which the request comes + * @return ETrue if the processor can process the request, otherwise EFalse + */ + IMPORT_C TBool Match( const TMTPTypeRequest& aRequest, + MMTPConnection& aConnection ) const; + + /** + * Check whether the processor can process the event + * @param aEvent The event to be processed + * @param aConnection The connection from which the request comes + * @return ETrue if the processor can process the request, otherwise EFalse + */ + IMPORT_C TBool Match( const TMTPTypeEvent& aEvent, + MMTPConnection& aConnection ) const; + + /** + * The current active request + * @return A reference to the current request + */ + IMPORT_C const TMTPTypeRequest& Request() const; + + /** + * The connection from which the current request comes + * @return A reference to the current connection + */ + IMPORT_C MMTPConnection& Connection() const; + + /* + * Rollback when WMP closed and disconnect the USB cable, + * during the transferring file + */ + IMPORT_C void UsbDisconnect(); + + /* + * Get the session id associated with current request object + * This interface was added to avoid the case that the data member iRequest + * was sometimes invalid in session close phase, and getting session id from + * request would cause panic + * @return session id + */ + IMPORT_C TUint32 SessionId(); +protected: + // from CActive + /** + * part of active object framework, provide default implementation + */ + IMPORT_C void RunL(); + + /** + * part of active object framework, provide default implementation + */ + IMPORT_C void DoCancel(); + + /** + * part of active object framework, provide default implementation + */ + IMPORT_C TInt RunError( TInt aError ); + +protected: + //new virtuals + /** + * Handle the request phase of the current request + * @return EFalse + */ + IMPORT_C virtual TBool DoHandleRequestPhaseL(); + + /** + * Handle the receiving data phase of the current request + * @return EFalse + */ + IMPORT_C virtual TBool DoHandleDataIToRPhaseL(); + + /** + * Handle the sending data phase of the current request + * @return EFalse + */ + IMPORT_C virtual TBool DoHandleRToIPhaseL(); + + /** + * Handle the response phase of the current request + * @return EFalse + */ + IMPORT_C virtual TBool DoHandleResponsePhaseL(); + + /** + * Handle the completing phase of the current request + * @return ETrue + */ + IMPORT_C virtual TBool DoHandleCompletingPhaseL(); + + /** + * Check the current request + * @return EMTPRespCodeOK if the reqeust is good, otherwise, one of the error response codes + */ + IMPORT_C virtual TMTPResponseCode CheckRequestL(); + + IMPORT_C virtual TBool HasDataphase() const; + + /** + * service a request at request phase + */ + virtual void ServiceL() = 0; + +protected: + /** + * Set P&S Status to avoid MPX access conflict + */ + void SetPSStatus(); + +private: + /** + * retrieve the session id and transaction code from the current request + */ + void ExtractSessionTransactionId(); + +protected: + MMTPDataProviderFramework& iFramework; + const TMTPTypeRequest* iRequest; //the pending requst object + MMTPConnection& iConnection; //the connection from which the request comes + TMTPTypeResponse iResponse; //the response object to send to the initiator + TBool iCancelled; //indicates whether the data phase (send/receive) has been cancelled + CRequestChecker* iRequestChecker; //a utility class providing generic request verification service + TInt iElementCount; //number of verification elements used for request checker + const TMTPRequestElementInfo* iElements; //pointer to an array of verification elements + TUint32 iSessionId; //session id for the pending request + TUint32 iTransactionCode; //transaction code for the pending request + +private: + TMTPResponseCode iResponseCode; // contains response from CheckRequestL call + RBuf8 iNullBuffer; // buffer to receive data from discarded data phase + TMTPTypeNull iNull; + + }; + +#endif // CREQUESTPROCESSOR_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/crequestunknown.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/crequestunknown.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,75 @@ +/* +* 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 CREQUESTUNKNOWN_H +#define CREQUESTUNKNOWN_H + +#include "crequestprocessor.h" + +/** +* Defines device data provider OpenSession request processor +*/ +class CRequestUnknown : public CRequestProcessor + { +public: + /** + * Two-phase construction method + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @return a pointer to the created request processor object + */ + IMPORT_C static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection ); + + /** + * Destructor + */ + IMPORT_C ~CRequestUnknown(); + +protected: + /** + * Standard c++ constructor + */ + IMPORT_C CRequestUnknown( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection ); + +protected: + // from CRequestProcessor + /** + * OpenSession request handler + */ + IMPORT_C void ServiceL(); + + /** + * Override to match both the unknown requests + * @param aRequest The request to match + * @param aConnection The connection from which the request comes + * @return always return ETrue to process all unknown request + */ + IMPORT_C TBool Match( const TMTPTypeRequest& aRequest, + MMTPConnection& aConnection ) const; + +private: + /** + * Two-phase construction + */ + void ConstructL(); + + }; + +#endif // CREQUESTUNKNOWN_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/csendobject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/csendobject.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,304 @@ +/* +* 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: SendObjectInfo/SendObjectPropList/SendObject operation +* +*/ + + +#ifndef CSENDOBJECT_H +#define CSENDOBJECT_H + +#include "crequestprocessor.h" + +// forward declaration +class RFs; +class CMTPTypeObjectInfo; +class MMTPObjectMgr; +class CMTPTypeFile; +class CMTPTypeObjectPropListElement; +class CMTPTypeObjectPropList; +class TMTPTypeUint32; +class CMTPObjectMetaData; +class CMTPObjectPropertyMgr; +class MMmMtpDpConfig; + +/** +* Defines SendObjectInfo/SendObject request processor +*/ +class CSendObject : public CRequestProcessor + { +public: + /** + * Destructor + */ + IMPORT_C virtual ~CSendObject(); + +protected: + /** + * Standard C++ Constructor + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper Medadata access interface + */ + IMPORT_C CSendObject( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * 2nd Phase Constructor + */ + IMPORT_C void ConstructL(); + +protected: + // from CRequestProcessor + /** + * Override to match both the SendObjectInfo and SendObject requests + * @param aRequest The request to match + * @param aConnection The connection from which the request comes + * @return ETrue if the processor can handle the request, otherwise EFalse + */ + IMPORT_C TBool Match( const TMTPTypeRequest& aRequest, + MMTPConnection& aConnection ) const; + + /** + * Verify the reqeust + * @return EMTPRespCodeOK if request is verified, otherwise one of the + * error response codes + */ + IMPORT_C TMTPResponseCode CheckRequestL(); + + /** + * Override from CRequestProcessor, can not be neglected + * @return ETrue + */ + IMPORT_C TBool HasDataphase() const; + + /** + * SendObjectInfo/SendObject request handler + */ + IMPORT_C void ServiceL(); + + /** + * Response Phase Handler + */ + IMPORT_C TBool DoHandleResponsePhaseL(); + + /** + * Completeing phase Handler + */ + IMPORT_C TBool DoHandleCompletingPhaseL(); + + /** + * Override from CRequestProcessor, can not be neglected + */ + IMPORT_C void UsbDisconnect(); + + // new protected function + /** + * Called by dp derived processor + */ + IMPORT_C TMTPResponseCode SetMetaDataToWrapperL( const TUint16 aPropCode, + MMTPType& aNewData, + const CMTPObjectMetaData& aObjectMetaData ); + +protected: + // new virtual functions + /** + * + */ + virtual TMTPResponseCode SetSpecificObjectPropertyL( TUint16 aPropCode, + const CMTPObjectMetaData& aObject, + const CMTPTypeObjectPropListElement& aElement ) = 0; + + /** + * Check datatypes for DP specific PropCodes + */ + virtual TMTPResponseCode CheckSepecificPropType( TUint16 aPropCode, TUint16 aDataType ) = 0; + + virtual TInt HandleSpecificWrapperError(TInt aError, + const CMTPObjectMetaData& aObject) = 0; + +private: + /** + * Verify if the SendObject request comes after SendObjectInfo request + * @return EMTPRespCodeOK if SendObject request comes after a valid + * SendObjectInfo request, otherwise + * EMTPRespCodeNoValidObjectInfo + */ + TMTPResponseCode CheckSendingStateL(); + + /** + * Handle request phase of SendObjectInfo operation + */ + void ServiceInfoL(); + + /** + * Handle request phase of SendObjectPropList operation + */ + void ServicePropListL(); + + /** + * Handle request phase of SendObject operation + */ + void ServiceObjectL(); + + /** + * Handle response phase of SendObjectInfo operation + */ + TBool DoHandleResponsePhaseInfoL(); + + /** + * Handle response phase of SendObject operation + */ + TBool DoHandleResponsePhasePropListL(); + + /** + * Handle response phase of SendObject operation + */ + TBool DoHandleResponsePhaseObjectL(); + + /** + * + */ + TMTPResponseCode VerifyObjectPropListL(TInt& aInvalidParameterIndex); + + /** + * + */ + TMTPResponseCode CheckPropCodeL(const CMTPTypeObjectPropListElement& aElement); + + /** + * + */ + TMTPResponseCode ExtractPropertyL(const CMTPTypeObjectPropListElement& aElement); + + /* + * Handle response phase of SetObjectPropListL operation + */ + TMTPResponseCode SetObjectPropListL( const CMTPTypeObjectPropList& aPropList ); + + /** + * + */ + TMTPResponseCode MatchStoreAndParentL(); + + /** + * Check if the object is too large + * @return ETrue if yes, otherwise EFalse + */ + TBool IsTooLarge( TUint32 aObjectSize ) const; + + /** + * Check if we can store the file on the storage + * @return ETrue if yes, otherwise EFalse + */ + TBool CanStoreFileL( TUint32 aStorageId, TInt64 aObjectSize ) const; + + /** + * Get the full path name of the object to be saved + * @param aFileName, on entry, contains the file name of the object, + * on return, contains the full path name of the object to be saved + */ + TBool GetFullPathNameL( const TDesC& aFileName ); + + /** + * Check if the file already exists on the storage. + * @return ETrue if file is exists, otherwise EFalse + */ + TBool ExistsL( const TDesC& aName ) const; + + /** + * Reserve object information before SendObject + */ + void ReserveObjectL(); + + /** + * Set protection status of object which could be read/write-only + */ + void SetProtectionStatusL(); + + /** + * Save object information of object whose size is zero + */ + void SaveEmptyFileL(); + + + /** + * Add file information into database in response phase of SendObject + */ + void AddMediaToStoreL(); + + /** + * delete the file, which transfer incompletely + */ + void Rollback(); + + +private: + enum TMTPSendingObjectState + { + EObjectNone, + EObjectInfoInProgress, + EObjectInfoSucceed, + EObjectInfoFail, + ESendObjectInProgress, + ESendObjectSucceed, + ESendObjectFail + }; + +private: + RFs& iFs; + MMTPObjectMgr& iObjectMgr; + MMmMtpDpConfig& iDpConfig; + + // received dataset + CMTPTypeObjectInfo* iObjectInfo; + CMTPTypeObjectPropList* iObjectPropList; + CMTPTypeFile* iFileReceived; + + // object which need to reserved + CMTPObjectMetaData* iReceivedObjectInfo; + + // progress of request + TMTPSendingObjectState iProgress; + + // request params + TUint16 iOperationCode; + TUint32 iStorageId; + TUint32 iParentHandle; + TUint16 iObjectFormat; + TUint64 iObjectSize; + + // S60 feature doesn't include this. + // Reserve for future + TUint16 iProtectionStatus; + HBufC* iDateMod; + + // cache info during SendObjectInfo + TUint32 iWidth; + TUint32 iHeight; + + TFileName iFullPath; + HBufC* iParentSuid; + + // params which is needed for reserve handle + TMTPTypeRequest iExpectedSendObjectRequest; + + TBool iNoRollback; + + TUint32 iPreviousTransactionID; + TUint32 iPreviousOperation; + }; + +#endif // CSENDOBJECT_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/csetobjectproplist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/csetobjectproplist.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,141 @@ +/* +* 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: Set Object proplist operation. +* +*/ + + +#ifndef CSETOBJECTPROPLIST_H +#define CSETOBJECTPROPLIST_H + +#include "crequestprocessor.h" + +// forward declaration +class CMTPTypeObjectPropList; +class CMmMtpDpMetadataAccessWrapper; +class MMTPObjectMgr; +class CMTPObjectMetaData; +class MMmMtpDpConfig; + +/** +* Defines SetObjectPropList request processor +*/ +class CSetObjectPropList : public CRequestProcessor + { +public: + /** + * Two-phase construction method + * @param aFramework, The data provider framework + * @param aConnection, The connection from which the request comes + * @param aWrapper medadata access interface + * @return a pointer to the created request processor object + */ + //IMPORT_C static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + // MMTPConnection& aConnection, + // CMmMtpDpMetadataAccessWrapper& aWrapper ); + + /** + * Destructor + */ + IMPORT_C virtual ~CSetObjectPropList(); + +protected: + /** + * Standard c++ constructor + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper medadata access interface + */ + IMPORT_C CSetObjectPropList( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * 2nd Phase Constructor + */ + IMPORT_C void ConstructL(); + +protected: + // from CRequestProcessor + /** + * SetObjectPropList request handler + */ + IMPORT_C void ServiceL(); + + /** + * Completing phase for the request handler + */ + IMPORT_C TBool DoHandleResponsePhaseL(); + + /** + * Derived from CRequestProcessor, can not be neglected + * @return ETrue + */ + IMPORT_C TBool HasDataphase() const; + + // From CActive + /** + * Cancel the enumeration process + */ + IMPORT_C void DoCancel(); + + /** + * Handle completed request + */ + IMPORT_C void RunL(); + + /** + * Ignore the error, continue with the next one + */ + IMPORT_C TInt RunError( TInt aError ); + +protected: + // new virtuals + /** + * Set MetaData to CMetadataAccessWrapper, for internal use + * @param aPropCode, specify property code of aMediaProp + * @param aNewData, object property value which will be get from + * aObjectMetaData + * @param aObjectMetaData, owner of the property which should be + * inserted or updated into database + * @return response code + */ + IMPORT_C TMTPResponseCode ServiceMetaDataToWrapperL( const TUint16 aPropCode, + MMTPType& aNewData, + const CMTPObjectMetaData& aObjectMetaData ); + + virtual TMTPResponseCode ServiceSpecificObjectPropertyL( TUint16 aPropCode, + const CMTPObjectMetaData& aObject, + const CMTPTypeObjectPropListElement& aElement ) = 0; + + virtual TInt HandleSpecificWrapperError( TInt aError, + const CMTPObjectMetaData& aObject) = 0; + +private: + /* + * Handle response phase of SetObjectPropListL operation + */ + TMTPResponseCode SetObjectPropListL( const CMTPTypeObjectPropListElement& aPropListElement ); + +protected: + MMTPObjectMgr& iObjectMgr; + RFs& iFs; + CMTPTypeObjectPropList* iPropertyList; + MMmMtpDpConfig& iDpConfig; + TUint32 iUnprocessedIndex; + TInt iElementCount; + + }; + +#endif // CSETOBJECTPROPLIST_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/csetobjectpropvalue.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/csetobjectpropvalue.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,133 @@ +/* +* 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: Set object property value operation. +* +*/ + + +#ifndef CSETOBJECTPROPVALUE_H +#define CSETOBJECTPROPVALUE_H + +#include "crequestprocessor.h" + +// forward declaration +class CMTPTypeString; +class CMTPTypeArray; +class TMTPTypeUint8; +class TMTPTypeUint16; +class TMTPTypeUint32; +class CMTPObjectMetaData; +class MMTPObjectMgr; +class MMmMtpDpConfig; + +/** +* Defines SetObjectPropValue request processor for common +*/ +class CSetObjectPropValue : public CRequestProcessor + { +public: + /** + * Two-phase construction method + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper medadata access interface + * @return a pointer to the created request processor object + */ + //IMPORT_C static MMmRequestProcessor* NewL(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection, CMmMtpDpMetadataAccessWrapper& aWrapper); + + /** + * Destructor + */ + IMPORT_C virtual ~CSetObjectPropValue(); + +protected: + /** + * Standard c++ constructor + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper medadata access interface + */ + IMPORT_C CSetObjectPropValue( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + +protected: + // from CRequestProcessor + /** + * Verify the reqeust + * @return EMTPRespCodeOK if request is verified, otherwise one of + * the error response codes + */ + IMPORT_C TMTPResponseCode CheckRequestL(); + + /** + * SetObjectPropValue request handler + */ + IMPORT_C void ServiceL(); + + /** + * Edit the file to update the prop value + * @return EFalse + */ + IMPORT_C TBool DoHandleResponsePhaseL(); + + /** + * Derived from CRequestProcessor, can not be neglected + * @return ETrue + */ + IMPORT_C TBool HasDataphase() const; + +protected: + // new virtuals + virtual TBool IsSpecificPropCodeReadOnly( TUint16 aPropCode ) const = 0; + + virtual void ReceiveDataSpecificObjectPropertyL( TUint16 aPropCode ) = 0; + + virtual TMTPResponseCode ServiceSpecificObjectPropertyL( TUint16 aPropCode ) = 0; + +protected: + /** + * Set MetaData to CMetadataAccessWrapper, for internal use + * @param aPropCode, specify property code of aMediaProp + * @param aNewData, object property value which will be get from + * aObjectMetaData + * @param aObjectMetaData, owner of the property which should be + * inserted or updated into database + * @return response code + */ + IMPORT_C TMTPResponseCode ServiceMetaDataToWrapperL( const TUint16 aPropCode, + MMTPType& aNewData, + const CMTPObjectMetaData& aObjectMetaData ); + +private: + /* + * Check if property could be set + */ + TBool IsPropCodeReadonly( TUint16 aPropCode ); + +protected: + //TUint32 iPropCode; + TUint16 iPropCode; + CMTPTypeString* iMTPTypeString; + CMTPTypeArray* iMTPTypeArray; + TMTPTypeUint8 iMTPTypeUint8; + TMTPTypeUint16 iMTPTypeUint16; + TMTPTypeUint32 iMTPTypeUint32; + CMTPObjectMetaData* iObjectInfo; + MMTPObjectMgr& iObjectMgr; + MMmMtpDpConfig& iDpConfig; + + }; + +#endif // CSETOBJECTPROPVALUE_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/csetobjectreferences.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/csetobjectreferences.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,118 @@ +/* +* 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: Set object references operation. +* +*/ + + +#ifndef CSETOBJECTREFERENCES_H +#define CSETOBJECTREFERENCES_H + +#include + +#include "crequestprocessor.h" + +// forward declaration +class CMTPTypeArray; +class CMmMtpDpMetadataAccessWrapper; +class MMmMtpDpConfig; + +/** +* Defines SetObjectReferences request processor +*/ +class CSetObjectReferences : public CRequestProcessor + { +public: + /** + * Two-phase construction method + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper medadata access interface + * @return a pointer to the created request processor object + */ + IMPORT_C static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + + /** + * Destructor + */ + IMPORT_C virtual ~CSetObjectReferences(); + +protected: + /** + * Standard c++ constructor + * @param aFramework The data provider framework + * @param aConnection The connection from which the request comes + * @param aWrapper medadata access interface + */ + IMPORT_C CSetObjectReferences( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ); + +protected: + /** + * set references to DB + * @param aWrapper medadata access interface + * @param aObjectFormat the format of the file + * @param aSrcFileName file name, from + * @param aRefFileArray the array of file names, to + */ + IMPORT_C virtual void + DoSetObjectReferencesL( CMmMtpDpMetadataAccessWrapper& aWrapper, + TUint16 aObjectFormat, + const TDesC& aSrcFileName, + CDesCArray& aRefFileArray ); + +private: + //from CRequestProcessor + /** + * SetReferences request handler + * start receiving reference data from the initiator + */ + IMPORT_C void ServiceL(); + + /** + * Apply the references to the specified object + * @return EFalse + */ + IMPORT_C TBool DoHandleResponsePhaseL(); + + /** + * Derived from CRequestProcessor, can not be neglected + * @return ETrue + */ + IMPORT_C TBool HasDataphase() const; + +private: + /** + * Verify if the references are valid handles to objects + * @return ETrue if all the references are good, otherwise, EFalse + */ + TBool VerifyReferenceHandlesL() const; + + /** + * Two-phase construction + */ + void ConstructL(); + +private: + // Array to store the references to set to the object + CMTPTypeArray* iReferences; + MMmMtpDpConfig& iDpConfig; + CDesCArray* iReferenceSuids; + + }; + +#endif // CSETOBJECTREFERENCES_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/ttypeflatbuf.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/ttypeflatbuf.h Thu Dec 17 08:55:47 2009 +0200 @@ -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: GetParitialObject operation helper function +* +*/ + + +#ifndef TMTPTYPEFLATBUF_H +#define TMTPTYPEFLATBUF_H + +#include + +/** +* Defines the MTP flat data types +*/ +class TMTPTypeFlatBuf: public TMTPTypeFlatBase + { +public: + /** + * Standard c++ constructor + */ + TMTPTypeFlatBuf(const TDes8& aBuffer); + +private: + // from TMTPTypeFlatBase + /** + * Override to provide element info + */ + const TElementInfo& ElementInfo(TInt aElementId) const; + + }; + +#endif //TMTPTYPEFLATBUF_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/ccopyobject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/ccopyobject.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,834 @@ +/* +* 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: Implement the operation: CopyObject +* +*/ + + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ccopyobject.h" +#include "mmmtpdplogger.h" +#include "tmmmtpdppanic.h" +#include "mmmtpdputility.h" +#include "mmmtpdpconfig.h" +#include "cmmmtpdpmetadataaccesswrapper.h" + +/** +* Verification data for the CopyObject request +*/ +const TMTPRequestElementInfo KMTPCopyObjectPolicy[] = + { + { + TMTPTypeRequest::ERequestParameter1, + EMTPElementTypeObjectHandle, + EMTPElementAttrFileOrDir, + 0, + 0, + 0 + }, + { + TMTPTypeRequest::ERequestParameter2, + EMTPElementTypeStorageId, + EMTPElementAttrWrite, + 0, + 0, + 0 + }, + { + TMTPTypeRequest::ERequestParameter3, + EMTPElementTypeObjectHandle, + EMTPElementAttrDir | EMTPElementAttrWrite, + 1, + 0, + 0 + } + }; + +// ----------------------------------------------------------------------------- +// CCopyObject::~CCopyObject +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CCopyObject::~CCopyObject() + { + Cancel(); + + delete iDest; + delete iFileMan; + iObjectHandles.Close(); + if ( iPropertyElement ) + delete iPropertyElement; + delete iPropertyList; + delete iPathToCopy; + delete iNewRootFolder; + } + +// ----------------------------------------------------------------------------- +// CCopyObject::CCopyObject +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CCopyObject::CCopyObject( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CRequestProcessor( aFramework, + aConnection, + sizeof ( KMTPCopyObjectPolicy ) / sizeof(TMTPRequestElementInfo), + KMTPCopyObjectPolicy ), + iDpConfig( aDpConfig ), + iObjectHandles( KMmMtpRArrayGranularity ) + { + PRINT( _L( "Operation: CopyObject(0x101A)" ) ); + } + +// ----------------------------------------------------------------------------- +// CCopyObject::ServiceL +// CopyObject request handler +// ----------------------------------------------------------------------------- +// +EXPORT_C void CCopyObject::ServiceL() + { + PRINT( _L( "MM MTP => CCopyObject::ServiceL" ) ); + iHandle = KMTPHandleNone; + + CopyObjectL( iHandle ); + + PRINT( _L( "MM MTP <= CCopyObject::ServiceL" ) ); + } + +// ----------------------------------------------------------------------------- +// CCopyObject::ConstructL +// Second phase constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C void CCopyObject::ConstructL() + { + CActiveScheduler::Add( this ); + + iPropertyList = CMTPTypeObjectPropList::NewL(); + + // Set the CenRep value of MTP status, + // also need to do in other processors which related to MPX + SetPSStatus(); + } + +// ----------------------------------------------------------------------------- +// CCopyObject::RunL +// +// ----------------------------------------------------------------------------- +// +EXPORT_C void CCopyObject::RunL() + { + PRINT( _L( "MM MTP => CCopyObject::RunL" ) ); + + if ( iCopyObjectIndex < iNumberOfObjects ) + { + CopyAndUpdateL( iObjectHandles[iCopyObjectIndex++] ); + + TRequestStatus* status = &iStatus; + User::RequestComplete( status, iStatus.Int() ); + SetActive(); + } + else + { + PRINT1( _L( "MM MTP <> CCopyObject::RunL iHandle = 0x%x" ), iHandle ); + SendResponseL( EMTPRespCodeOK, 1, &iHandle ); + } + + PRINT( _L( "MM MTP <= CCopyObject::RunL" ) ); + } + +// ----------------------------------------------------------------------------- +// CCopyObject::CopyFileL +// A helper function of CopyObjectL +// ----------------------------------------------------------------------------- +// +TUint32 CCopyObject::CopyFileL( const TDesC& aNewFileName ) + { + const TDesC& suid( iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); + PRINT2( _L( "MM MTP => CCopyObject::CopyFileL old name = %S, aNewFileName = %S" ), + &suid, + &aNewFileName ); + + GetPreviousPropertiesL( *iObjectInfo ); + User::LeaveIfError( iFileMan->Copy( suid, aNewFileName ) ); // iDest just folder + User::LeaveIfError( iFramework.Fs().SetModified( aNewFileName, iPreviousModifiedTime ) ); + TUint32 handle = UpdateObjectInfoL( suid, aNewFileName ); + + PRINT1( _L( "MM MTP <= CCopyObject::CopyFileL handle = 0x%x" ), handle ); + + return handle; + } + +// ----------------------------------------------------------------------------- +// CCopyObject::GenerateObjectHandleListL +// Generate the list of handles that need to be copied to the new location +// ----------------------------------------------------------------------------- +// +void CCopyObject::GenerateObjectHandleListL( TUint32 aParentHandle ) + { + PRINT1( _L( "MM MTP => CCopyObject::GenerateObjectHandleListL aParentHandle = 0x%x" ), + aParentHandle ); + RMTPObjectMgrQueryContext context; + RArray handles; + CleanupClosePushL( context ); // + context + CleanupClosePushL( handles ); // + handles + + TMTPObjectMgrQueryParams params( KMTPStorageAll, KMTPFormatsAll, + aParentHandle ); + do + { + iFramework.ObjectMgr().GetObjectHandlesL( params, context, handles ); + + TInt numberOfObjects = handles.Count(); + for ( TInt i = 0; i < numberOfObjects; i++ ) + { + if ( iFramework.ObjectMgr().ObjectOwnerId( handles[i] ) == iFramework.DataProviderId() ) + { + iObjectHandles.AppendL( handles[i] ); + continue; + } + + // Folder + if ( iFramework.ObjectMgr().ObjectOwnerId( handles[i] ) == 0 ) // We know that the device dp id is always 0, otherwise the whole MTP won't work. + { + GenerateObjectHandleListL( handles[i] ); + } + } + } + while ( !context.QueryComplete() ); + + CleanupStack::PopAndDestroy( &handles ); // - handles + CleanupStack::PopAndDestroy( &context ); // - context + PRINT( _L( "MM MTP <= CCopyObject::GenerateObjectHandleListL" ) ); + } + +// ----------------------------------------------------------------------------- +// CCopyObject::CopyFolderL +// A helper function of CopyObjectL +// ----------------------------------------------------------------------------- +// +TUint32 CCopyObject::CopyFolderL( const TDesC& aNewFolderName ) + { + PRINT1( _L( "MM MTP => CCopyObject::CopyFolderL aNewFolderName = %S" ), &aNewFolderName ); + TUint32 handle = iFramework.ObjectMgr().HandleL( aNewFolderName ); // just get it + + GenerateObjectHandleListL( iObjectInfo->Uint( CMTPObjectMetaData::EHandle ) ); + iCopyObjectIndex = 0; + iNumberOfObjects = iObjectHandles.Count(); + PRINT1( _L( "MM MTP <> CCopyObject::CopyFolderL iNumberOfObjects = %d" ), iNumberOfObjects ); + + TRequestStatus* status = &iStatus; + User::RequestComplete( status, iStatus.Int() ); + SetActive(); + + PRINT1( _L( "MM MTP <= CCopyObject::CopyFolderL handle = 0x%x" ), handle ); + return handle; + } + +// ----------------------------------------------------------------------------- +// CCopyObject::CopyObjectL +// Copy object operation +// ----------------------------------------------------------------------------- +// +void CCopyObject::CopyObjectL( TUint32& aNewHandle ) + { + PRINT( _L( "MM MTP => CCopyObject::CopyObjectL" ) ); + TMTPResponseCode responseCode = EMTPRespCodeOK; + aNewHandle = KMTPHandleNone; + + GetParametersL(); + + RBuf newObjectName; + newObjectName.CleanupClosePushL(); // + newObjectName + newObjectName.CreateL( KMaxFileName ); + newObjectName = *iDest; + + const TDesC& suid( iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); + TParsePtrC fileNameParser( suid ); + + // Check if the object is a folder or a file. + TBool isFolder = EFalse; + User::LeaveIfError( BaflUtils::IsFolder( iFramework.Fs(), suid, isFolder ) ); + + if ( !isFolder ) + { + if ( ( newObjectName.Length() + fileNameParser.NameAndExt().Length() ) <= newObjectName.MaxLength() ) + { + newObjectName.Append( fileNameParser.NameAndExt() ); + } + responseCode = CanCopyObjectL( suid, newObjectName ); + } + else // It is a folder. + { + TFileName rightMostFolderName; + User::LeaveIfError( BaflUtils::MostSignificantPartOfFullName( suid, + rightMostFolderName ) ); + if ( ( newObjectName.Length() + rightMostFolderName.Length() + 1 ) <= newObjectName.MaxLength() ) + { + newObjectName.Append( rightMostFolderName ); + // Add backslash. + _LIT( KBackSlash, "\\" ); + newObjectName.Append( KBackSlash ); + } + } + + delete iNewRootFolder; + iNewRootFolder = NULL; + iNewRootFolder = newObjectName.AllocL(); + + if ( responseCode == EMTPRespCodeOK ) + { + delete iFileMan; + iFileMan = NULL; + iFileMan = CFileMan::NewL( iFramework.Fs() ); + + if ( !isFolder ) // It is a file. + { + aNewHandle = CopyFileL( newObjectName ); +// if ( responseCode == EMTPRespCodeOK ) + SendResponseL( EMTPRespCodeOK, 1, &aNewHandle ); +// else +// SendResponseL( responseCode ); + } + else // It is a folder. + { + delete iPathToCopy; + iPathToCopy = NULL; + iPathToCopy = suid.AllocL(); + PRINT1( _L( "MM MTP <> CCopyObject::CopyObjectL iPathToCopy = %S" ), iPathToCopy ); + aNewHandle = CopyFolderL( newObjectName ); + } + } + else + SendResponseL( responseCode ); + + CleanupStack::PopAndDestroy( &newObjectName ); // - newObjectName + PRINT2( _L( "MM MTP <= CCopyObject::CopyObjectL responseCode = 0x%x, aNewHandle = 0x%x" ), + responseCode, aNewHandle ); + } + +// ----------------------------------------------------------------------------- +// CCopyObject::GetParametersL +// Retrieve the parameters of the request +// ----------------------------------------------------------------------------- +// +void CCopyObject::GetParametersL() + { + PRINT( _L( "MM MTP => CCopyObject::GetParametersL" ) ); + __ASSERT_DEBUG( iRequestChecker, Panic( EMmMTPDpRequestCheckNull ) ); + + TUint32 objectHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); + iStorageId = Request().Uint32( TMTPTypeRequest::ERequestParameter2 ); + TUint32 parentObjectHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter3 ); + PRINT3( _L( "MM MTP <> CCopyObject::GetParametersL Object Hanlde = 0x%x, StorageId = 0x%x, Parent Handle = 0x%x" ), + objectHandle, iStorageId, parentObjectHandle ); + + // not taking owernship + iObjectInfo = iRequestChecker->GetObjectInfo( objectHandle ); + __ASSERT_DEBUG( iObjectInfo, Panic( EMmMTPDpObjectNull ) ); + + if ( parentObjectHandle == 0 ) + { + SetDefaultParentObjectL(); + } + else + { + CMTPObjectMetaData* parentObjectInfo = iRequestChecker->GetObjectInfo( parentObjectHandle ); + __ASSERT_DEBUG( parentObjectInfo, Panic( EMmMTPDpObjectNull ) ); + delete iDest; + iDest = NULL; + iDest = parentObjectInfo->DesC( CMTPObjectMetaData::ESuid ).AllocL(); + iNewParentHandle = parentObjectHandle; + } + PRINT( _L( "MM MTP <= CCopyObject::GetParametersL" ) ); + } + +// ----------------------------------------------------------------------------- +// CCopyObject::SetDefaultParentObjectL +// Get a default parent object, ff the request does not specify a parent object, +// ----------------------------------------------------------------------------- +// +void CCopyObject::SetDefaultParentObjectL() + { + PRINT( _L( "MM MTP => CCopyObject::SetDefaultParentObjectL" ) ); + + delete iDest; + iDest = NULL; + iDest = ( iFramework.StorageMgr().StorageL( iStorageId ).DesC( + CMTPStorageMetaData::EStorageSuid ) ).AllocL(); + PRINT1( _L( "MM MTP <> CCopyObject::SetDefaultParentObjectL Destination location is %S" ), iDest ); + iNewParentHandle = KMTPHandleNoParent; + PRINT( _L( "MM MTP <= CCopyObject::SetDefaultParentObjectL" ) ); + } + +// ----------------------------------------------------------------------------- +// CCopyObject::CanCopyObjectL +// Check if we can copy the file to the new location +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CCopyObject::CanCopyObjectL( const TDesC& aOldName, + const TDesC& aNewName ) const + { + PRINT2( _L( "MM MTP => CCopyObject::CanCopyObjectL aOldName = %S, aNewName = %S" ), + &aOldName, &aNewName ); + TMTPResponseCode result = EMTPRespCodeOK; + + TEntry fileEntry; + User::LeaveIfError( iFramework.Fs().Entry( aOldName, fileEntry ) ); + TDriveNumber drive( static_cast( iFramework.StorageMgr().DriveNumber( iStorageId ) ) ); + User::LeaveIfError( drive ); + TVolumeInfo volumeInfo; + User::LeaveIfError( iFramework.Fs().Volume( volumeInfo, drive ) ); + + if ( volumeInfo.iFree < fileEntry.iSize ) + { + result = EMTPRespCodeStoreFull; + } + else if ( BaflUtils::FileExists( iFramework.Fs(), aNewName ) ) + { +#ifdef MMMTPDP_REPLACE_EXIST_FILE + // delete the old one and replace + TInt delErr = iFramework.Fs().Delete( aNewName ); + PRINT1( _L( "MM MTP <> CCopyObject::CanCopyObjectL delErr = %d" ), delErr ); + // delete from the metadata DB + TRAPD( err, iFramework.ObjectMgr().RemoveObjectL( aNewName ) ); + PRINT1( _L( "MM MTP <> CCopyObject::CanCopyObjectL err = %d" ), err ); + // delete from video/mpx DB + CMTPObjectMetaData* objectInfo = CMTPObjectMetaData::NewLC(); // + objectInfo + if ( iFramework.ObjectMgr().ObjectL( aNewName, *objectInfo ) ) + { + TRAP( err, iDpConfig.GetWrapperL().DeleteObjectL( aNewName, + objectInfo->Uint( CMTPObjectMetaData::EFormatCode ) ) ); + } + CleanupStack::PopAndDestroy( objectInfo ); // - objectInfo + + if ( err ) + { + // do nothing + } +#else + result = EMTPRespCodeInvalidParentObject; +#endif + } + // This is used to keep the same behavior in mass storage and device file manager. + else if ( iObjectInfo->Uint( CMTPObjectMetaData::EFormatCode ) + == EMTPFormatCodeAbstractAudioVideoPlaylist ) + { + PRINT( _L( "MM MTP <> CCopyObject::CanCopyObjectL playlist file can't copy" ) ); + result = EMTPRespCodeAccessDenied; + } + + PRINT1( _L( "MM MTP <= CCopyObject::CanCopyObjectL result = 0x%x" ), result ); + return result; + } + +// ----------------------------------------------------------------------------- +// CCopyObject::GetPreviousPropertiesL +// Save the object properties before doing the copy +// ----------------------------------------------------------------------------- +// +void CCopyObject::GetPreviousPropertiesL( const CMTPObjectMetaData& aObject ) + { + PRINT( _L( "MM MTP => CCopyObject::GetPreviousPropertiesL" ) ); + + const TDesC& suid( aObject.DesC( CMTPObjectMetaData::ESuid ) ); + + User::LeaveIfError( iFramework.Fs().Modified( suid, iPreviousModifiedTime ) ); + + TUint formatCode = aObject.Uint( CMTPObjectMetaData::EFormatCode ); + const RArray* properties = iDpConfig.GetSupportedPropertiesL( formatCode ); + TInt count = properties->Count(); + + CMTPTypeString* textData = NULL; + TInt err = KErrNone; + TUint16 propCode; + TUint32 handle = aObject.Uint( CMTPObjectMetaData::EHandle ) ; + + if ( iPropertyElement ) + { + delete iPropertyElement; + iPropertyElement = NULL; + } + + for ( TInt i = 0; i < count; i++ ) + { + propCode = (*properties)[i]; + + switch( propCode ) + { + case EMTPObjectPropCodeStorageID: + case EMTPObjectPropCodeObjectFormat: + case EMTPObjectPropCodeProtectionStatus: + case EMTPObjectPropCodeObjectSize: + case EMTPObjectPropCodeObjectFileName: + case EMTPObjectPropCodeParentObject: + case EMTPObjectPropCodePersistentUniqueObjectIdentifier: + case EMTPObjectPropCodeNonConsumable: + case EMTPObjectPropCodeDateCreated: + case EMTPObjectPropCodeDateModified: + break; + + case EMTPObjectPropCodeName: + case EMTPObjectPropCodeDateAdded: + if ( ( propCode == EMTPObjectPropCodeName ) + || ( ( !MmMtpDpUtility::IsVideoL( aObject.DesC( CMTPObjectMetaData::ESuid ), iFramework ) ) + && ( propCode == EMTPObjectPropCodeDateAdded ) ) ) + { + textData = CMTPTypeString::NewLC(); // + textData + + TRAP( err, iDpConfig.GetWrapperL().GetObjectMetadataValueL( propCode, + *textData, + aObject ) ); + + PRINT1( _L( "MM MTP <> CCopyObject::GetPreviousPropertiesL::ServiceSpecificObjectPropertyL err = %d" ), err ); + + if ( err == KErrNone ) + { + iPropertyElement = &(iPropertyList->ReservePropElemL(handle, propCode)); + iPropertyElement->SetStringL(CMTPTypeObjectPropListElement::EValue, textData->StringChars()); +// iPropertyElement = CMTPTypeObjectPropListElement::NewL( +// handle, propCode, *textData ); + } + else if ( err == KErrNotFound ) + { + iPropertyElement = NULL; + } + else + { + User::Leave( err ); + } + + CleanupStack::PopAndDestroy( textData ); // - textData + } + break; + + default: + { + ServiceGetSpecificObjectPropertyL( propCode, handle, aObject ); + } + break; + } + + if ( iPropertyElement ) + { + iPropertyList->CommitPropElemL( *iPropertyElement ); + iPropertyElement = NULL; + } + } // end of for loop + + PRINT1( _L( "MM MTP <= CCopyObject::GetPreviousPropertiesL err = %d" ), err ); + } + +// ----------------------------------------------------------------------------- +// CCopyObject::ServiceMetaDataToWrapper +// +// ----------------------------------------------------------------------------- +// +EXPORT_C TMTPResponseCode CCopyObject::ServiceMetaDataToWrapper( + const TUint16 aPropCode, + MMTPType& aNewData, + const CMTPObjectMetaData& aObject ) + { + TMTPResponseCode resCode = EMTPRespCodeOK; + + TRAPD( err, iDpConfig.GetWrapperL().SetObjectMetadataValueL( aPropCode, + aNewData, + aObject ) ); + + PRINT1( _L("MM MTP <> CCopyObject::ServiceMetaDataToWrapper err = %d"), err); + + if ( err == KErrNone ) + { + resCode = EMTPRespCodeOK; + } + else if ( err == KErrTooBig ) + // according to the codes of S60 + { + resCode = EMTPRespCodeInvalidDataset; + } + else if ( err == KErrPermissionDenied ) + { + resCode = EMTPRespCodeAccessDenied; + } + else if ( err == KErrNotFound ) + { + if ( MmMtpDpUtility::HasMetadata( aObject.Uint( CMTPObjectMetaData::EFormatCode ) ) ) + resCode = EMTPRespCodeAccessDenied; + else + resCode = EMTPRespCodeOK; + } + else + { + resCode = EMTPRespCodeGeneralError; + } + + PRINT1( _L("MM MTP <= CCopyObject::ServiceMetaDataToWrapper resCode = 0x%x"), resCode); + + return resCode; + } + +// ----------------------------------------------------------------------------- +// CCopyObject::SetPreviousPropertiesL +// Set the object properties after doing the copy +// ----------------------------------------------------------------------------- +// +void CCopyObject::SetPreviousPropertiesL( const CMTPObjectMetaData& aObject ) + { + PRINT( _L( "MM MTP => CCopyObject::SetPreviousPropertiesL" ) ); + const TInt count( iPropertyList->NumberOfElements() ); + PRINT1( _L( "MM MTP <> CCopyObject::SetPreviousPropertiesL count = %d" ), count ); + TMTPResponseCode respcode = EMTPRespCodeOK; + CMTPTypeString* stringData = NULL; + iPropertyList->ResetCursor(); + for ( TInt i = 0; i < count; i++ ) + { + CMTPTypeObjectPropListElement& element = iPropertyList->GetNextElementL(); + + TUint32 handle = element.Uint32L( + CMTPTypeObjectPropListElement::EObjectHandle ); + TUint16 propertyCode = element.Uint16L( + CMTPTypeObjectPropListElement::EPropertyCode ); + TUint16 dataType = element.Uint16L( + CMTPTypeObjectPropListElement::EDatatype ); + PRINT3( _L( "MM MTP <> CCopyObject::SetPreviousPropertiesL = 0x%x, propertyCode = 0x%x, dataType = 0x%x" ), + handle, propertyCode, dataType ); + + switch ( propertyCode ) + { + case EMTPObjectPropCodeStorageID: + case EMTPObjectPropCodeObjectFormat: + case EMTPObjectPropCodeProtectionStatus: + case EMTPObjectPropCodeObjectSize: + case EMTPObjectPropCodeObjectFileName: + case EMTPObjectPropCodeParentObject: + case EMTPObjectPropCodePersistentUniqueObjectIdentifier: + case EMTPObjectPropCodeNonConsumable: + case EMTPObjectPropCodeDateCreated: + case EMTPObjectPropCodeDateModified: + case EMTPObjectPropCodeDateAdded: + break; + + case EMTPObjectPropCodeName: + { + stringData = CMTPTypeString::NewLC( + element.StringL( + CMTPTypeObjectPropListElement::EValue)); // + stringData + + respcode = ServiceMetaDataToWrapper( propertyCode, + *stringData, + aObject ); + + CleanupStack::PopAndDestroy( stringData ); // - stringData + } + break; + + default: + { + respcode = ServiceSetSpecificObjectPropertyL( propertyCode, + aObject, + element ); + } + break; + } + } // end of for loop + + if( respcode == EMTPRespCodeOK ) + { + // do nothing, ignore warning + } + + PRINT1( _L( "MM MTP <= CCopyObject::SetPreviousPropertiesL respcode = 0x%x" ), respcode ); + } + +// ----------------------------------------------------------------------------- +// CCopyObject::UpdateObjectInfoL +// Update object info in the database +// ----------------------------------------------------------------------------- +// +TUint32 CCopyObject::UpdateObjectInfoL( const TDesC& aOldObjectName, const TDesC& aNewObjectName ) + { + PRINT2( _L( "MM MTP => CCopyObject::UpdateObjectInfoL aOldObjectName = %S, aNewObjectName = %S" ), + &aOldObjectName, &aNewObjectName ); + // We should not modify this object's handle, so just get a "copy". + CMTPObjectMetaData* objectInfo = CMTPObjectMetaData::NewLC(); // + objectInfo + const TMTPTypeUint32 objectHandle( iObjectInfo->Uint( CMTPObjectMetaData::EHandle ) ); + if ( iFramework.ObjectMgr().ObjectL( objectHandle, *objectInfo) ) + { + objectInfo->SetDesCL( CMTPObjectMetaData::ESuid, aNewObjectName ); + objectInfo->SetUint( CMTPObjectMetaData::EParentHandle, + iNewParentHandle ); + // Modify storage Id. + objectInfo->SetUint( CMTPObjectMetaData::EStorageId, iStorageId ); + iFramework.ObjectMgr().InsertObjectL( *objectInfo ); + } + else + { + User::Leave( KErrCorrupt ); + } + + TUint32 handle = objectInfo->Uint( CMTPObjectMetaData::EHandle ); + PRINT1( _L( "MM MTP <> CCopyObject::UpdateObjectInfoL handle = 0x%x" ), handle ); + SetPropertiesL( aOldObjectName, aNewObjectName, *objectInfo ); + CleanupStack::PopAndDestroy( objectInfo ); // - objectInfo + PRINT( _L( "MM MTP <= CCopyObject::UpdateObjectInfoL" ) ); + return handle; + } + +// ----------------------------------------------------------------------------- +// CCopyObject::CopyAndUpdateL +// Move a single object and update the database +// ----------------------------------------------------------------------------- +// +void CCopyObject::CopyAndUpdateL( TUint32 aObjectHandle ) + { + PRINT1( _L( "MM MTP => CopyObject::CopyAndUpdateL aObjectHanlde = 0x%x" ), aObjectHandle ); + CMTPObjectMetaData* objectInfo = CMTPObjectMetaData::NewLC(); // + objectInfo + + if ( iFramework.ObjectMgr().ObjectL( aObjectHandle, *objectInfo ) ) + { + // This is used to keep the same behavior in mass storage and device file manager. + if ( objectInfo->Uint( CMTPObjectMetaData::EFormatCode ) + == EMTPFormatCodeAbstractAudioVideoPlaylist ) + { + PRINT( _L( "MM MTP <> CopyObject::CopyAndUpdateL Playlist file don't to be copieds" ) ); + CleanupStack::PopAndDestroy( objectInfo ); // - objectInfo + return; + } + + RBuf fileName; // This is the source object name. + fileName.CleanupClosePushL(); // + fileName + fileName.CreateL( KMaxFileName ); + + RBuf oldFileName; + oldFileName.CleanupClosePushL(); // + oldFileName + oldFileName.CreateL( KMaxFileName ); + + RBuf rightPartName; + rightPartName.CleanupClosePushL(); // + rightPartName + rightPartName.CreateL( KMaxFileName ); + + fileName = objectInfo->DesC( CMTPObjectMetaData::ESuid ); + oldFileName = fileName; + + rightPartName = fileName.Right( fileName.Length() + - iPathToCopy->Length() ); + + if ( ( iNewRootFolder->Length() + rightPartName.Length() ) > fileName.MaxLength() ) + { + User::Leave( KErrCorrupt ); + } + + fileName.Zero(); + fileName.Append( *iNewRootFolder ); + fileName.Append( rightPartName ); + PRINT1( _L( "MM MTP <> CopyAndUpdateL fileName = %S" ), &fileName ); + + if ( objectInfo->Uint( CMTPObjectMetaData::EDataProviderId ) + == iFramework.DataProviderId() ) + { + // should copy before the set metadata DB + GetPreviousPropertiesL( *objectInfo ); + TInt err = iFileMan->Copy( oldFileName, fileName ); + PRINT1( _L( "MM MTP <> CCopyObject::CopyAndUpdateL err = %d" ), err ); + User::LeaveIfError( err ); + User::LeaveIfError( iFramework.Fs().SetModified( fileName, + iPreviousModifiedTime ) ); + + // Modify Suid + objectInfo->SetDesCL( CMTPObjectMetaData::ESuid, fileName ); + + // Modify parentHandle + TParsePtrC parentSuid( fileName ); + PRINT1( _L( "MM MTP <> CCopyObject::CopyAndUpdateL parentSuid = %S" ), &(parentSuid.DriveAndPath()) ); + + TUint32 parentHandle = iFramework.ObjectMgr().HandleL( parentSuid.DriveAndPath() ); + objectInfo->SetUint( CMTPObjectMetaData::EParentHandle, parentHandle ); + PRINT1( _L( "MM MTP <> CCopyObject::CopyAndUpdateL parentHandle = 0x%x" ), parentHandle ); + + // Modify storage Id. + objectInfo->SetUint( CMTPObjectMetaData::EStorageId, iStorageId ); + TRAP( err, iFramework.ObjectMgr().InsertObjectL( *objectInfo ) ); + if ( err != KErrNone ) + PRINT1( _L( "MM MTP <> CCopyObject::CopyAndUpdateL err = %d" ), err ); + // Set the properties of the new object + SetPropertiesL( oldFileName, fileName, *objectInfo ); + } + // Else this is not the owner of this object, so don't update the object store. + + CleanupStack::PopAndDestroy( &rightPartName ); // - rightPartName + CleanupStack::PopAndDestroy( &oldFileName ); // - oldFileName + CleanupStack::PopAndDestroy( &fileName ); // - fileName + } + else + { + User::Leave( KErrCorrupt ); + } + + CleanupStack::PopAndDestroy( objectInfo ); // - objectInfo + + PRINT( _L( "MM MTP <= CopyObject::CopyAndUpdateL" ) ); + } + +// ----------------------------------------------------------------------------- +// CCopyObject::SetPropertiesL +// Set the object properties in the object property store +// ----------------------------------------------------------------------------- +// +void CCopyObject::SetPropertiesL( const TDesC& aOldFileName, + const TDesC& aNewFileName, + const CMTPObjectMetaData& aObject ) + { + PRINT( _L( "MM MTP => CCopyObject::SetPropertiesL" ) ); + // won't leave with KErrAlreadyExist + iDpConfig.GetWrapperL().AddObjectL( aNewFileName ); + + TUint formatCode = aObject.Uint( CMTPObjectMetaData::EFormatCode ); + if ( formatCode == EMTPFormatCodeM3UPlaylist ) + { + MMTPReferenceMgr& referenceMgr = iFramework.ReferenceMgr(); + CDesCArray* references = referenceMgr.ReferencesLC( aOldFileName ); // + references + referenceMgr.SetReferencesL( aNewFileName, *references ); + CleanupStack::PopAndDestroy( references ); // - references + } + + SetPreviousPropertiesL( aObject ); + PRINT( _L( "MM MTP <= CCopyObject::SetPropertiesL" ) ); + } + +// ----------------------------------------------------------------------------- +// CCopyObject::RunError +// +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CCopyObject::RunError( TInt aError ) + { + if ( aError != KErrNone ) + PRINT1( _L( "MM MTP <> CCopyObject::RunError aError = %d" ), aError ); + + TRAP_IGNORE( SendResponseL( EMTPRespCodeGeneralError ) ); + return KErrNone; + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cdeleteobject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cdeleteobject.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,362 @@ +/* +* 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: Implement the operation: DeleteObject +* +*/ + + +#include +#include +#include + +#include "cdeleteobject.h" +#include "mmmtpdplogger.h" +#include "mmmtpdpconfig.h" +#include "cmmmtpdpmetadataaccesswrapper.h" + +// static const TInt KMTPDriveGranularity = 5; + +// ----------------------------------------------------------------------------- +// Verification data for the DeleteObject request +// ----------------------------------------------------------------------------- +// +const TMTPRequestElementInfo KMTPDeleteObjectPolicy[] = + { + { + TMTPTypeRequest::ERequestParameter1, + EMTPElementTypeObjectHandle, + EMTPElementAttrWrite, + 1, + KMTPHandleAll, + 0 + }, + }; + +// ----------------------------------------------------------------------------- +// CDeleteObject::NewL +// Two-phase construction method +// CDeleteObject is an abstract class and shouldn't be instaniated. +// ----------------------------------------------------------------------------- +// +EXPORT_C MMmRequestProcessor* CDeleteObject::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + CDeleteObject* self = new (ELeave) CDeleteObject( aFramework, aConnection, aDpConfig ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +void CDeleteObject::ConstructL() + { + CActiveScheduler::Add( this ); + SetPSStatus(); + } + +// ----------------------------------------------------------------------------- +// CDeleteObject::~CDeleteObject +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CDeleteObject::~CDeleteObject() + { + Cancel(); + iObjectsToDelete.Close(); + } + +// ----------------------------------------------------------------------------- +// CDeleteObject::CDeleteObject +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +CDeleteObject::CDeleteObject( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CRequestProcessor( aFramework, + aConnection, + sizeof( KMTPDeleteObjectPolicy ) / sizeof( TMTPRequestElementInfo ), + KMTPDeleteObjectPolicy ), + iObjectMgr( aFramework.ObjectMgr() ), + iFs( aFramework.Fs() ), + iObjectsToDelete( KMmMtpRArrayGranularity ), + iDeleteError( KErrNone ), + iDpConfig( aDpConfig ) + { + PRINT( _L( "Operation: DeleteObject(0x100B)" ) ); + } + +// ----------------------------------------------------------------------------- +// CDeleteObject::ServiceL +// DeleteObject request handler +// ----------------------------------------------------------------------------- +// +EXPORT_C void CDeleteObject::ServiceL() + { + iObjectsToDelete.Reset(); + iDeleteError = KErrNone; + TUint32 objectHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); + + PRINT3( _L( "MM MTP <> CDeleteObject::ServiceL, objectHandle = 0x%x, numObject = %d, iDeleteError = %d" ), + objectHandle, + iObjectsToDelete.Count(), + iDeleteError ); + + // Check to see whether the request is to delete all files or a specific file/directory + if ( objectHandle == KMTPHandleAll ) + { + iIsMultiDelete = ETrue; + // Get the complete list of all the media files that are to be deleted + GetObjectHandlesL( KMTPStorageAll, KMTPHandleNoParent ); + StartL(); + } + else + { + iIsMultiDelete = EFalse; + // Not Owned the object + // TODO: need to check if this is best way and if it is applicable to other processors + CMTPObjectMetaData* objectInfo = iRequestChecker->GetObjectInfo( objectHandle ); + + if ( objectInfo->Uint( CMTPObjectMetaData::EFormatCode ) == EMTPFormatCodeAssociation ) + { + TUint parentHandle = objectInfo->Uint( CMTPObjectMetaData::EHandle ); + GetObjectHandlesL( KMTPStorageAll, parentHandle ); + if ( iObjectsToDelete.Count() > 0 ) + iIsMultiDelete = ETrue; + StartL(); + } + else + { + DeleteObjectL( *objectInfo ); + ProcessFinalPhaseL(); + } + } + + PRINT( _L( "MM MTP <= CDeleteObject::ServiceL" ) ); + } + +// ----------------------------------------------------------------------------- +// MTPDeleteObject::StartL +// Control the deletion +// ----------------------------------------------------------------------------- +// +void CDeleteObject::StartL() + { + TInt numObjectsToDelete = iObjectsToDelete.Count(); + PRINT2( _L( "MM MTP <> CDeleteObject::StartL, numObjectsToDelete = %d, iDeleteError = %d" ), + numObjectsToDelete, + iDeleteError ); + + TBool isOk = iDeleteError == KErrNone || iDeleteError == KErrNotFound; + if ( numObjectsToDelete > 0 && isOk ) + { + //Set the active object going to delete the file + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + SetActive(); + } + else + { + ProcessFinalPhaseL(); + } + PRINT( _L( "MM MTP <= CDeleteObject::StartL" ) ); + } + +// ----------------------------------------------------------------------------- +// CDeleteObject::RunL +// AO Run method, deletes a selection of files on the system +// ----------------------------------------------------------------------------- +// +EXPORT_C void CDeleteObject::RunL() + { + TInt numObjectsToDelete = iObjectsToDelete.Count(); + PRINT1( _L( "MM MTP => CDeleteObject::RunL, numObjectsToDelete = %d" ), + numObjectsToDelete ); + + if ( numObjectsToDelete > 0 ) + { + // Get the next object + CMTPObjectMetaData* objectInfo = CMTPObjectMetaData::NewLC(); // + objectInfo + + TUint32 handle = iObjectsToDelete[0]; + iObjectMgr.ObjectL( handle, *objectInfo ); + TFileName fileName( objectInfo->DesC( CMTPObjectMetaData::ESuid ) ); + PRINT2( _L( "MM MTP <> CDeleteObject::RunL delete object handle is 0x%x, fileName is %S" ), handle, &fileName ); + + if ( objectInfo->Uint( CMTPObjectMetaData::EFormatCode ) == EMTPFormatCodeAssociation ) + { + TUint parentHandle = objectInfo->Uint( CMTPObjectMetaData::EHandle ); + GetObjectHandlesL( KMTPStorageAll, parentHandle ); + } + else + { + DeleteObjectL( *objectInfo ); + } + + CleanupStack::PopAndDestroy( objectInfo ); // - objectInfo + + iObjectsToDelete.Remove( 0 ); + } + + // Start the process again to read the next row... + StartL(); + PRINT( _L( "MM MTP <= CDeleteObject::RunL" ) ); + } + +// ----------------------------------------------------------------------------- +// CDeleteObject::DeleteObjectL() +// Deletes the object from the file system and the object from the store +// ----------------------------------------------------------------------------- +// +void CDeleteObject::DeleteObjectL( const CMTPObjectMetaData& aObjectInfo ) + { + TFileName fileName( aObjectInfo.DesC( CMTPObjectMetaData::ESuid ) ); + PRINT1( _L( "MM MTP <> CDeleteObject::DeleteObjectL fileName = %S" ), &fileName ); + + TParsePtrC parse( fileName ); + iDpConfig.GetWrapperL().SetStorageRootL( parse.Drive() ); + + // To capture special situation: After copy, move, rename playlist folder name, + // record in MPX is not inlined with framework db, playlist should not be deleted + // until next session. + // This is used to keep the same behavior in mass storage and device file manager. + if ( aObjectInfo.Uint(CMTPObjectMetaData::EFormatCode ) + == EMTPFormatCodeAbstractAudioVideoPlaylist + && !iDpConfig.GetWrapperL().IsExistL( fileName ) ) + { + iDeleteError = KErrGeneral; + PRINT( _L( "MM MTP <= CDeleteObject::DeleteObjectL playlist file not exist in the MPX DB" ) ); + return; + } + + // 1. Delete object from file system + TEntry fileInfo; + iFs.Entry( fileName, fileInfo ); + if ( fileInfo.IsReadOnly() ) + { + iDeleteError = KErrAccessDenied; + PRINT1( _L( "MM MTP <= CDeleteObject::DeleteObjectL, \"%S\" is a read-only file"), &fileName ); + return; + } + iDeleteError = iFs.Delete( fileName ); + if ( iDeleteError != KErrNone && iDeleteError != KErrNotFound ) + { + PRINT1( _L( "MM MTP <= CDeleteObject::DeleteObjectL, Delete from file system failed, err = %d" ), iDeleteError ); + return; + } + + // 2. Delete object from metadata db + TRAP( iDeleteError, iDpConfig.GetWrapperL().DeleteObjectL( fileName, aObjectInfo.Uint( CMTPObjectMetaData::EFormatCode ) )); + PRINT1( _L( "MM MTP <> CDeleteObject::DeleteObjectL, Delete from Media DB, err = %d" ), iDeleteError ); + + // 3. Delete object from framework db + iObjectMgr.RemoveObjectL( aObjectInfo.Uint( CMTPObjectMetaData::EHandle ) ); + + PRINT( _L( "MM MTP <= CDeleteObject::DeleteObjectL" ) ); + } + +// ----------------------------------------------------------------------------- +// CDeleteObject::DoCancel +// Used to cancel the deletion of the files +// ----------------------------------------------------------------------------- +// +EXPORT_C void CDeleteObject::DoCancel() + { + TRAP_IGNORE( ProcessFinalPhaseL() ); + } + +// ----------------------------------------------------------------------------- +// CDeleteObject::ProcessFinalPhaseL +// Delete all of the associations if file deletion was successful +// Then signals that the deletion has been completed +// ----------------------------------------------------------------------------- +// +void CDeleteObject::ProcessFinalPhaseL() + { + PRINT( _L( "MM MTP => CDeleteObject::ProcessFinalPhaseL" ) ); + + TInt num = iObjectsToDelete.Count(); + TBool isOk = iDeleteError == KErrNone || iDeleteError == KErrNotFound; + + if ( num == 0 && isOk ) + { + SendResponseL( EMTPRespCodeOK ); + } + else if ( iIsMultiDelete && !isOk ) + { + SendResponseL( EMTPRespCodePartialDeletion ); + } + else if( !iIsMultiDelete && iDeleteError == KErrAccessDenied ) + { + SendResponseL( EMTPRespCodeObjectWriteProtected ); + } + else + { + SendResponseL( EMTPRespCodeAccessDenied ); + } + } + +// ----------------------------------------------------------------------------- +// CDeleteObject::GetObjectHandlesL +// Gets all object handles (for GetObjectHandlesL) +// ----------------------------------------------------------------------------- +// +void CDeleteObject::GetObjectHandlesL( TUint32 aStorageId, + TUint32 aParentHandle ) + { + PRINT2( _L( "MM MTP => CDeleteObject::GetObjectHandlesL, StorageId = 0x%x, ParentHandle = 0x%x" ), + aStorageId, aParentHandle ); + RMTPObjectMgrQueryContext context; + RArray handles; + CleanupClosePushL( context ); // + context + CleanupClosePushL( handles ); // + handles + + TMTPObjectMgrQueryParams params( aStorageId, KMTPFormatsAll, aParentHandle ); + + do + { + iFramework.ObjectMgr().GetObjectHandlesL( params, context, handles ); + + for ( TInt i = 0; i < handles.Count(); i++ ) + { + if ( iFramework.ObjectMgr().ObjectOwnerId( handles[i] ) + == iFramework.DataProviderId() ) + { + iObjectsToDelete.Append( handles[i] ); + } + // TODO: should not know dp id of device dp, + // else if ( iFramework.ObjectMgr().ObjectOwnerId( handles[i] ) == 0 ) // We know that the device dp id is always 0, otherwise the whole MTP won't work. + // iParentHandles.AppendL( handles[i] ); + else + { + CMTPObjectMetaData* objectInfo = CMTPObjectMetaData::NewLC(); // + objectInfo + iObjectMgr.ObjectL( handles[i], *objectInfo ); + if ( EMTPFormatCodeAssociation == objectInfo->Uint( CMTPObjectMetaData::EFormatCode ) ) + { + GetObjectHandlesL( KMTPStorageAll, handles[i] ); + } + CleanupStack::PopAndDestroy( objectInfo ); // - objectInfo + } + } + } + while ( !context.QueryComplete() ); + + CleanupStack::PopAndDestroy( &handles ); // - handles + CleanupStack::PopAndDestroy( &context ); // - context + + PRINT( _L( "MM MTP <= CDeleteObject::GetObjectHandlesL" ) ); + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cgetformatcapabilities.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cgetformatcapabilities.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,328 @@ +/* +* 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 +#include +#include +#include +#include + + +#include "cgetformatcapabilities.h" +#include "mmmtpdplogger.h" +#include "mmmtpdpconfig.h" +#include "tobjectdescription.h" + +_LIT( KMtpObjDescObjFileName, "[a-zA-Z!#\\$%&'\\(\\)\\-0-9@\\^_\\`\\{\\}\\~][a-zA-Z!#\\$%&'\\(\\)\\-0-9@\\^_\\`\\{\\}\\~ ]{0, 7}\\.[[a-zA-Z!#\\$%&'\\(\\)\\-0-9@\\^_\\`\\{\\}\\~][a-zA-Z!#\\$%&'\\(\\)\\-0-9@\\^_\\`\\{\\}\\~ ]{0, 2}]?" ); + +// ----------------------------------------------------------------------------- +// CGetFormatCapabilities::CGetFormatCapabilities +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGetFormatCapabilities::CGetFormatCapabilities( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CRequestProcessor( aFramework, aConnection, 0, NULL ), + iDpConfig( aDpConfig ) + { + PRINT( _L( "Operation: CGetFormatCapabilities(0x930A)" ) ); + } + +// ----------------------------------------------------------------------------- +// CGetFormatCapabilities::ConstructL +// Second phase constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGetFormatCapabilities::ConstructL() + { + } + +// ----------------------------------------------------------------------------- +// CGetFormatCapabilities::~CGetFormatCapabilities +// Second phase constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGetFormatCapabilities::~CGetFormatCapabilities() + { + delete iCapabilityList; + iCapabilityList = NULL; + } + +// ----------------------------------------------------------------------------- +// CGetFormatCapabilities::CheckRequestL +// Ensures the object prop code operation parameter is valid +// ----------------------------------------------------------------------------- +// +EXPORT_C TMTPResponseCode CGetFormatCapabilities::CheckRequestL() + { + PRINT( _L( "MM MTP => CGetFormatCapabilities::CheckRequestL" ) ); + TMTPResponseCode response = EMTPRespCodeOK; + iFormatCode = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); + + if ( iFormatCode != KMTPFormatsAll ) + { + response = EMTPRespCodeInvalidObjectFormatCode; + + const RArray* format = iDpConfig.GetSupportedFormat(); + TInt count = format->Count(); + + for ( TInt i = 0; i < count; i++ ) + { + if ( iFormatCode == (*format)[i] ) + { + response = EMTPRespCodeOK; + break; + } + } + } + + PRINT1( _L( "MM MTP <= CGetFormatCapabilities::CheckRequestL, response = 0x%X" ), response ); + return response; + } + +// ----------------------------------------------------------------------------- +// CGetFormatCapabilities::ServiceL +// GetFormatCapabilities request handler +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGetFormatCapabilities::ServiceL() + { + PRINT( _L( "MM MTP => CGetFormatCapabilities::ServiceL" ) ); + + delete iCapabilityList; + iCapabilityList = NULL; + + iCapabilityList = CMTPTypeFormatCapabilityList::NewL(); + iFormatCode = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); + + if ( KMTPFormatsAll == iFormatCode ) + { + const RArray* formatArray = iDpConfig.GetSupportedFormat(); + TInt count = formatArray->Count(); + for( TInt i = 0; i < count; i++ ) + { + PRINT( _L( "MM MTP <> CGetFormatCapabilities::ServiceL, KMTPFormatsAll!!!" ) ); + iFormatCode = ( *formatArray )[i]; + ServiceInterdepentPropDescL(); + CMTPTypeFormatCapability* frmCap = CMTPTypeFormatCapability::NewL( iFormatCode, iInterdependentPropDesc ); + const RArray* propertiesArray = iDpConfig.GetSupportedPropertiesL( iFormatCode ); + TInt num = propertiesArray->Count(); + for( TInt j = 0;j < num; j++ ) + { + CMTPTypeObjectPropDesc* propertyDesc = ServicePropDescL( (*propertiesArray)[j] ); + if ( propertyDesc != NULL ) + { + frmCap->AppendL( propertyDesc ); + } + }//end for j + iCapabilityList->AppendL( frmCap ); + }//end for i + }//end if + else + { + ServiceInterdepentPropDescL(); + PRINT1( _L( "MM MTP <> CGetFormatCapabilities::ServiceL, ONLY one Format!!! formatCode = 0x%X" ), iFormatCode ); + + CMTPTypeFormatCapability* frmCap = CMTPTypeFormatCapability::NewL( iFormatCode, iInterdependentPropDesc ); + const RArray* propertiesArray = iDpConfig.GetSupportedPropertiesL( iFormatCode ); + TInt num = propertiesArray->Count(); + for( TInt j = 0;j < num; j++ ) + { + CMTPTypeObjectPropDesc* propertyDesc = ServicePropDescL( ( *propertiesArray )[j] ); + if ( propertyDesc != NULL ) + { + frmCap->AppendL( propertyDesc ); + } + }//end for j + iCapabilityList->AppendL( frmCap ); + } + + SendDataL( *iCapabilityList ); + PRINT( _L( "MM MTP <= CGetFormatCapabilities::ServiceL" ) ); + } + +// ----------------------------------------------------------------------------- +// CGetFormatCapabilities::ServicePropDescL +// Get MTPTypeObjectPropDesc according to property code +// ----------------------------------------------------------------------------- +// +CMTPTypeObjectPropDesc* CGetFormatCapabilities::ServicePropDescL( TUint16 aPropCode ) + { + PRINT1( _L( "MM MTP => CGetFormatCapabilities::ServicePropDescL, aPropCode = 0x%X" ), aPropCode ); + // implement just like what we did in CGetpropertyDescc::ServiceL + CMTPTypeObjectPropDesc* propertyDesc; + CMTPTypeObjectPropDesc::TPropertyInfo propertyInfo; + + /* Create new PropDesc object to return to device + m - signals only limited supported values - hence these requests require the expected form + variable to be passed into the NewL contstuctor as well */ + switch( aPropCode ) + { + case EMTPObjectPropCodeStorageID: // Storage ID + case EMTPObjectPropCodeObjectFormat: // Format Code + case EMTPObjectPropCodeObjectSize: // Object Size + case EMTPObjectPropCodeParentObject: // Parent Object + case EMTPObjectPropCodePersistentUniqueObjectIdentifier: // Unique Object Identifier + case EMTPObjectPropCodeName: // Name + case EMTPObjectPropCodeDateAdded: // Date Added + propertyDesc = CMTPTypeObjectPropDesc::NewL( aPropCode ); + break; + + // Protection Status (m) + case EMTPObjectPropCodeProtectionStatus: + propertyDesc = ServiceProtectionStatusL(); + break; + + // FileName + case EMTPObjectPropCodeObjectFileName: + propertyDesc = ServiceFileNameL(); + break; + + // Consumable (m) + case EMTPObjectPropCodeNonConsumable: + propertyDesc = ServiceNonConsumableL(); + break; + + case EMTPObjectPropCodeDateModified: // Date Modified + case EMTPObjectPropCodeDateCreated: // Date Created + propertyInfo.iDataType = EMTPTypeString; + propertyInfo.iFormFlag = CMTPTypeObjectPropDesc::EDateTimeForm; + propertyInfo.iGetSet = CMTPTypeObjectPropDesc::EReadOnly; + propertyDesc = CMTPTypeObjectPropDesc::NewL( aPropCode, propertyInfo, NULL); + break; + + default: + propertyDesc = ServiceSpecificPropertyDescL( aPropCode ); + break; + } + if ( propertyDesc != NULL ) + { + TUint32 groupCode = GetGroupCode( aPropCode ); + propertyDesc->SetUint32L( CMTPTypeObjectPropDesc::EGroupCode, groupCode ); + } + + PRINT( _L( "MM MTP <= CGetFormatCapabilities::ServicePropDescL" ) ); + + return propertyDesc; + } + +// ----------------------------------------------------------------------------- +// CGetFormatCapabilities::GetGroupCode +// Get MTPTypeObjectPropDesc according to property code +// ----------------------------------------------------------------------------- +// +TUint32 CGetFormatCapabilities::GetGroupCode( TUint32 aPropCode ) + { + TInt count = sizeof( KPropGroupMapTable ); + // TODO: if need to refine the search approach to improve performance + for( TInt i = 0; i < count; i++ ) + { + if ( aPropCode == KPropGroupMapTable[i].iPropCode ) + return KPropGroupMapTable[i].iGroupCode; + } + return EGroupCodeNotDefined; + } + +// ----------------------------------------------------------------------------- +// CGetFormatCapabilities::ServiceProtectionStatusL +// Get MTPTypeObjectPropDesc protection status +// ----------------------------------------------------------------------------- +// +CMTPTypeObjectPropDesc* CGetFormatCapabilities::ServiceProtectionStatusL() + { + PRINT( _L( "MM MTP => CGetFormatCapabilities::ServiceProtectionStatusL" ) ); + + CMTPTypeObjectPropDescEnumerationForm* expectedForm = + CMTPTypeObjectPropDescEnumerationForm::NewLC( EMTPTypeUINT16 ); // + expectedForm + + TUint16 values[] = + { + EMTPProtectionNoProtection, + EMTPProtectionReadOnly + }; + + TInt numValues = sizeof ( values ) / sizeof ( values[0] ) ; + for ( TInt i = 0; i < numValues; i++ ) + { + TMTPTypeUint16 data( values[i] ); + expectedForm->AppendSupportedValueL( data ); + } + + CMTPTypeObjectPropDesc* propertyDesc = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeProtectionStatus, *expectedForm ); + CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm + + PRINT( _L( "MM MTP <= CGetFormatCapabilities::ServiceProtectionStatusL" ) ); + return propertyDesc; + } + +// ----------------------------------------------------------------------------- +// CGetFormatCapabilities::ServiceFileNameL +// Get MTPTypeObjectPropDesc service file name +// ----------------------------------------------------------------------------- +// +CMTPTypeObjectPropDesc* CGetFormatCapabilities::ServiceFileNameL() + { + PRINT( _L( "MM MTP => CGetFormatCapabilities::ServiceFileNameL" ) ); + CMTPTypeString* form = CMTPTypeString::NewLC( KMtpObjDescObjFileName ); // + form + + CMTPTypeObjectPropDesc* ret = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeObjectFileName, + CMTPTypeObjectPropDesc::ERegularExpressionForm, + form ); + + CleanupStack::PopAndDestroy( form ); // - form + PRINT( _L( "MM MTP <= CGetFormatCapabilities::ServiceFileNameL" ) ); + return ret; + } + +// ----------------------------------------------------------------------------- +// CGetFormatCapabilities::ServiceFileNameL +// Get MTPTypeObjectPropDesc service file name +// ----------------------------------------------------------------------------- +// +CMTPTypeObjectPropDesc* CGetFormatCapabilities::ServiceNonConsumableL() + { + PRINT( _L( "MM MTP => CGetFormatCapabilities::ServiceNonConsumableL" ) ); + CMTPTypeObjectPropDescEnumerationForm* expectedForm = + CMTPTypeObjectPropDescEnumerationForm::NewLC( EMTPTypeUINT8 ); // + expectedForm + TUint8 values[] = + { + EMTPConsumable, + EMTPNonConsumable + }; + + TInt numValues = sizeof ( values ) / sizeof ( values[0] ); + for ( TInt i = 0; i < numValues; i++ ) + { + TMTPTypeUint8 data( values[i] ); + expectedForm->AppendSupportedValueL( data ); + } + + CMTPTypeObjectPropDesc::TPropertyInfo propertyInfo; + propertyInfo.iDataType = EMTPTypeUINT8; + propertyInfo.iFormFlag = CMTPTypeObjectPropDesc::EEnumerationForm; + propertyInfo.iGetSet = CMTPTypeObjectPropDesc::EReadOnly; + CMTPTypeObjectPropDesc* ret = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeNonConsumable, + propertyInfo, + expectedForm ); + CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm + + PRINT( _L( "MM MTP <= CGetFormatCapabilities::ServiceNonConsumableL" ) ); + return ret; + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cgetobject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cgetobject.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,166 @@ +/* +* 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: Implement the operation: GetObject +* +*/ + + +#include +#include +#include + +#include "cgetobject.h" +#include "mmmtpdplogger.h" + +// ----------------------------------------------------------------------------- +// Verification data for the GetNumObjects request +// ----------------------------------------------------------------------------- +// +const TMTPRequestElementInfo KMTPGetObjectPolicy[] = + { + { + TMTPTypeRequest::ERequestParameter1, + EMTPElementTypeObjectHandle, + EMTPElementAttrFile, + 0, + 0, + 0 + } + }; + +// ----------------------------------------------------------------------------- +// CGetObject::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +EXPORT_C MMmRequestProcessor* CGetObject::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& /*aDpConfig*/ ) + { + CGetObject* self = new ( ELeave ) CGetObject( aFramework, aConnection ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CGetObject::ConstructL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +void CGetObject::ConstructL() + { + SetPSStatus(); + } + +// ----------------------------------------------------------------------------- +// CGetObject::~CGetObject +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGetObject::~CGetObject() + { + PRINT( _L( "MM MTP => CGetObject::~CGetObject" ) ); + delete iFileObject; + PRINT( _L( "MM MTP <= CGetObject::~CGetObject" ) ); + } + +// ----------------------------------------------------------------------------- +// CGetObject::CGetObject +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +CGetObject::CGetObject( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection ) : + CRequestProcessor( aFramework, + aConnection, + sizeof( KMTPGetObjectPolicy ) / sizeof( TMTPRequestElementInfo ), + KMTPGetObjectPolicy ), + iFs( iFramework.Fs() ), + iError( EMTPRespCodeOK ) + { + PRINT( _L( "Operation: GetObject(0x1009)" ) ); + } + +// ----------------------------------------------------------------------------- +// CGetObject::ServiceL +// GetObject request handler +// ----------------------------------------------------------------------------- +// +void CGetObject::ServiceL() + { + PRINT( _L( "MM MTP => CGetObject::ServiceL" ) ); + + // Get the objectinfo + TUint32 objectHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); + PRINT1( _L( "MM MTP <> CGetObject::ServiceL objectHandle = 0x%x" ), objectHandle ); + + // NOTE: shouldn't be deleted in destructor, don't have the ownership + iObjectInfo = iRequestChecker->GetObjectInfo( objectHandle ); + + if ( iObjectInfo != NULL ) + { + // Get the file + GetObjectL( iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); + + // Send the data (file) + SendDataL( *iFileObject ); + } + else + { + // The object handle has already been checked, so an invalid handle can + // only occur if it was invalidated during a context switch between + // the validation time and now. + iError = EMTPRespCodeInvalidObjectHandle; + } + + PRINT1( _L( "MM MTP <= CGetObject::ServiceL iError = 0x%x" ), iError ); + } + +// ----------------------------------------------------------------------------- +// CGetObject::GetObjectL +// +// ----------------------------------------------------------------------------- +// +void CGetObject::GetObjectL( const TDesC& aFileName ) + { + PRINT( _L( "MM MTP => CGetObject::GetObjectL" ) ); + + // Create the file object + delete iFileObject; + iFileObject = NULL; + iFileObject = CMTPTypeFile::NewL( iFs, aFileName, EFileRead ); + + PRINT( _L( "MM MTP <= CGetObject::GetObjectL" ) ); + } + +// ----------------------------------------------------------------------------- +// CGetObject::DoHandleResponsePhaseL +// Handle the response phase of the current request +// ----------------------------------------------------------------------------- +// +TBool CGetObject::DoHandleResponsePhaseL() + { + PRINT( _L( "MM MTP => CGetObject::DoHandleResponsePhaseL" ) ) + + TMTPResponseCode responseCode = ( iCancelled ? EMTPRespCodeIncompleteTransfer : iError ); + SendResponseL( responseCode ); + + PRINT1( _L( "MM MTP <= CGetObject::DoHandleResponsePhaseL responseCode = 0x%x" ), responseCode ); + + return EFalse; + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cgetobjectinfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cgetobjectinfo.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,208 @@ +/* +* 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: Implement operation: GetObjectInfo +* +*/ + + +#include +#include +#include + +#include "mmmtpdputility.h" +#include "cgetobjectinfo.h" +#include "cmmmtpdpmetadataaccesswrapper.h" +#include "tmmmtpdppanic.h" +#include "mmmtpdplogger.h" +#include "mmmtpdpconfig.h" + +_LIT( KMtpDateTimeFormat, "%F%Y%M%DT%H%T%S" ); +const TInt KMtpMaxDateTimeStringLength = 15; + +// ----------------------------------------------------------------------------- +// Verification data for GetObjectInfo request +// ----------------------------------------------------------------------------- +// +const TMTPRequestElementInfo KMTPGetObjectInfoPolicy[] = + { + { + TMTPTypeRequest::ERequestParameter1, + EMTPElementTypeObjectHandle, + EMTPElementAttrNone, + 0, + 0, + 0 + } + }; + +// ----------------------------------------------------------------------------- +// CGetObjectInfo::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +EXPORT_C MMmRequestProcessor* CGetObjectInfo::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + CGetObjectInfo* self = new ( ELeave ) CGetObjectInfo( aFramework, aConnection, aDpConfig ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// CGetObjectInfo::~CGetObjectInfo +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGetObjectInfo::~CGetObjectInfo() + { + delete iObjectInfo; + } + +// ----------------------------------------------------------------------------- +// CGetObjectInfo::CGetObjectInfo +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +CGetObjectInfo::CGetObjectInfo( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CRequestProcessor( aFramework, + aConnection, + sizeof ( KMTPGetObjectInfoPolicy ) / sizeof( TMTPRequestElementInfo ), + KMTPGetObjectInfoPolicy ), + iDpConfig( aDpConfig ) + { + PRINT( _L( "Operation: GetObjectInfo(0x1008)" ) ); + } + +// ----------------------------------------------------------------------------- +// CGetObjectInfo::ConstructL +// Second-phase construction +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGetObjectInfo::ConstructL() + { + CActiveScheduler::Add( this ); + + SetPSStatus(); + } + +// ----------------------------------------------------------------------------- +// CGetObjectInfo::ServiceL +// GetObjectInfo request handler +// ----------------------------------------------------------------------------- +// +void CGetObjectInfo::ServiceL() + { + PRINT( _L( "MM MTP => CGetObjectInfo::ServiceL" ) ); + + delete iObjectInfo; + iObjectInfo = NULL; + iObjectInfo = CMTPTypeObjectInfo::NewL(); + + BuildObjectInfoL(); + + SendDataL( *iObjectInfo ); + + PRINT( _L( "MM MTP <= CGetObjectInfo::ServiceL" ) ); + } + +void CGetObjectInfo::BuildObjectInfoL() + { + PRINT( _L( "MM MTP => CGetObjectInfo::BuildObjectInfoL" ) ); + // Get the request information + TUint32 objectHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); + PRINT1( _L( "MM MTP <> CGetObjectInfo::BuildObjectInfoL The object handle being queried is: 0x%x" ), objectHandle ); + + CMTPObjectMetaData* object = iRequestChecker->GetObjectInfo( objectHandle ); + __ASSERT_DEBUG( object, Panic( EMmMTPDpObjectNull ) ); + + // StorageID + iObjectInfo->SetUint32L( CMTPTypeObjectInfo::EStorageID, + object->Uint( CMTPObjectMetaData::EStorageId ) ); + + // Object Format + iObjectInfo->SetUint16L( CMTPTypeObjectInfo::EObjectFormat, + object->Uint( CMTPObjectMetaData::EFormatCode ) ); + PRINT1( _L( "MM MTP <> CGetObjectInfo::BuildObjectInfoL objet formatCode = 0x%x" ), + object->Uint( CMTPObjectMetaData::EFormatCode ) ); + + // Protection Status + TPtrC suid( object->DesC( CMTPObjectMetaData::ESuid ) ); + PRINT1( _L( "MM MTP <> CGetObjectInfo::BuildObjectInfo suid = %S" ), &suid ); + TUint16 status = MmMtpDpUtility::GetProtectionStatusL( iFramework.Fs(), suid ); + iObjectInfo->SetUint16L( CMTPTypeObjectInfo::EProtectionStatus, status); + + // Object Compressed Size + TInt size = MmMtpDpUtility::GetObjectSizeL( iFramework.Fs(), suid ); + iObjectInfo->SetUint32L( CMTPTypeObjectInfo::EObjectCompressedSize, size ); + + // *Thumb Format + iObjectInfo->SetUint16L( CMTPTypeObjectInfo::EThumbFormat, 0 ); + // *Thumb Compressed Size + iObjectInfo->SetUint32L( CMTPTypeObjectInfo::EThumbCompressedSize, 0 ); + // *Thumb Pix Width + iObjectInfo->SetUint32L( CMTPTypeObjectInfo::EThumbPixWidth, 0 ); + // *Thumb Pix Height + iObjectInfo->SetUint32L( CMTPTypeObjectInfo::EThumbPixHeight, 0 ); + + TUint32 width(0); + TUint32 height(0); + TInt err = KErrNone; + TRAP( err, iDpConfig.GetWrapperL().GetImageObjPropL( suid, width, height ) ); + if( err != KErrNone ) + PRINT1( _L( "MM MTP <> CGetObjectInfo::BuildObjectInfoL TRAP iWrapper.GetImageObjPropL err = %d" ), err ); + + // Image Pix Width + iObjectInfo->SetUint32L( CMTPTypeObjectInfo::EImagePixWidth, width ); + // Image Pix Height + iObjectInfo->SetUint32L( CMTPTypeObjectInfo::EImagePixHeight, height ); + + // Image Bit Depth + iObjectInfo->SetUint32L( CMTPTypeObjectInfo::EImageBitDepth, 0 ); + // Parent Object + iObjectInfo->SetUint32L( CMTPTypeObjectInfo::EParentObject, + object->Uint( CMTPObjectMetaData::EParentHandle ) ); + // Association Type + iObjectInfo->SetUint16L( CMTPTypeObjectInfo::EAssociationType, 0 ); + // Association Description + iObjectInfo->SetUint32L( CMTPTypeObjectInfo::EAssociationDescription, 0 ); + // *Sequence Number + iObjectInfo->SetUint32L( CMTPTypeObjectInfo::ESequenceNumber, 0 ); + // Filename + TParsePtrC parse( suid ); + iObjectInfo->SetStringL( CMTPTypeObjectInfo::EFilename, parse.NameAndExt() ); + + TTime dataModified; + dataModified = MmMtpDpUtility::GetObjectDateModifiedL( iFramework.Fs(), suid ); + + TBuf date; + dataModified.FormatL( date, KMtpDateTimeFormat ); + PRINT1( _L( "MM MTP <> CGetObjectInfo::BuildObjectInfo date is %S" ), &date ); + + // Date Created + iObjectInfo->SetStringL( CMTPTypeObjectInfo::EDateCreated, date ); + // Date Modified + iObjectInfo->SetStringL( CMTPTypeObjectInfo::EDateModified, date ); + // Keywords, not supported + iObjectInfo->SetStringL( CMTPTypeObjectInfo::EKeywords, KNullDesC ); + + PRINT( _L( "MM MTP <= CGetObjectInfo::BuildObjectInfoL" ) ); + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cgetobjectpropdesc.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cgetobjectpropdesc.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,355 @@ +/* +* 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: Implement operation: GetObjectPropDesc +* +*/ + + +#include +#include + +#include "cgetobjectpropdesc.h" +#include "tmmmtpdppanic.h" +#include "mmmtpdplogger.h" +#include "tobjectdescription.h" +#include "mmmtpdpconfig.h" + +_LIT( KMtpObjDescObjFileName, "[a-zA-Z!#\\$%&'\\(\\)\\-0-9@\\^_\\`\\{\\}\\~][a-zA-Z!#\\$%&'\\(\\)\\-0-9@\\^_\\`\\{\\}\\~ ]{0, 7}\\.[[a-zA-Z!#\\$%&'\\(\\)\\-0-9@\\^_\\`\\{\\}\\~][a-zA-Z!#\\$%&'\\(\\)\\-0-9@\\^_\\`\\{\\}\\~ ]{0, 2}]?" ); +// RegEx is [a-zA-Z!#\$%&'\(\)\-0-9@\^_\`\{\}\~][a-zA-Z!#\$%&'\(\)\-0-9@\^_\`\{\}\~ ]{0, 7}\.[[a-zA-Z!#\$%&'\(\)\-0-9@\^_\`\{\}\~][a-zA-Z!#\$%&'\(\)\-0-9@\^_\`\{\}\~ ]{0, 2}]? + +// ----------------------------------------------------------------------------- +// CGetObjectPropDesc::~CGetObjectPropDesc +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGetObjectPropDesc::~CGetObjectPropDesc() + { + delete iObjectProperty; + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropDesc::CGetObjectPropDesc +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGetObjectPropDesc::CGetObjectPropDesc( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CRequestProcessor( aFramework, aConnection, 0, NULL ), + iObjectProperty( NULL ), + iDpConfig( aDpConfig ) + { + PRINT( _L( "Operation: GetObjectPropDesc(0x9802)" ) ); + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropDesc::ConstructL +// Second phase constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGetObjectPropDesc::ConstructL() + { + + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropList::CheckRequestL +// Verify the reqeust and returns it +// ----------------------------------------------------------------------------- +// +EXPORT_C TMTPResponseCode CGetObjectPropDesc::CheckRequestL() + { + TMTPResponseCode response = CRequestProcessor::CheckRequestL(); + + if ( response == EMTPRespCodeOK ) + { + response = CheckFormatL(); + } + + if ( response == EMTPRespCodeOK ) + { + response = CheckPropCodeL(); + } + + PRINT1( _L("MM MTP <= CGetObjectPropDesc::CheckRequestL response = 0x%x"), response ); + return response; + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropDesc::ServiceL +// GetObjectPropDesc request handler +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGetObjectPropDesc::ServiceL() + { + PRINT( _L( "MM MTP => CGetObjectPropDesc::ServiceL" ) ); + delete iObjectProperty; + iObjectProperty = NULL; + + TUint32 propCode = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); + iFormatCode = Request().Uint32( TMTPTypeRequest::ERequestParameter2 ); + PRINT2( _L( "MM MTP <> CGetObjectPropDesc::ServiceL propCode = 0x%x, iFormatCode = 0x%x" ), + propCode, + iFormatCode ); + + CMTPTypeObjectPropDesc::TPropertyInfo propertyInfo; + + /* Create new PropDesc object to return to device + m - signals only limited supported values - hence these requests require the expected form + variable to be passed into the NewL contstuctor as well */ + switch ( propCode ) + { + case EMTPObjectPropCodeStorageID: // Storage ID + case EMTPObjectPropCodeObjectFormat: // Format Code + case EMTPObjectPropCodeObjectSize: // Object Size + case EMTPObjectPropCodeParentObject: // Parent Object + case EMTPObjectPropCodePersistentUniqueObjectIdentifier: // Unique Object Identifier + case EMTPObjectPropCodeName: // Name + case EMTPObjectPropCodeDateAdded: // Date Added + iObjectProperty = CMTPTypeObjectPropDesc::NewL( propCode ); + break; + + // Protection Status (m) + case EMTPObjectPropCodeProtectionStatus: + ServiceProtectionStatusL(); + break; + + // FileName + case EMTPObjectPropCodeObjectFileName: + ServiceFileNameL(); + break; + + // Consumable (m) + case EMTPObjectPropCodeNonConsumable: + ServiceNonConsumableL(); + break; + + case EMTPObjectPropCodeDateModified: // Date Modified + case EMTPObjectPropCodeDateCreated: // Date Created + propertyInfo.iDataType = EMTPTypeString; + propertyInfo.iFormFlag = CMTPTypeObjectPropDesc::EDateTimeForm; + propertyInfo.iGetSet = CMTPTypeObjectPropDesc::EReadOnly; + iObjectProperty = CMTPTypeObjectPropDesc::NewL( propCode, propertyInfo, NULL); + break; + + // Error - Should be caught by CheckRequestL + default: + ServiceSpecificObjectPropertyL( propCode ); + break; + } + + // Set group code + TUint32 groupCode = GetGroupCode( propCode ); + PRINT1( _L("MM MTP <> CGetObjectPropDesc::ServiceL, groupCode = 0x%x"), groupCode ); + iObjectProperty->SetUint32L( CMTPTypeObjectPropDesc::EGroupCode, groupCode ); + + __ASSERT_DEBUG( iObjectProperty, Panic( EMmMTPDpObjectPropertyNull ) ); + + SendDataL( *iObjectProperty ); + + PRINT( _L( "MM MTP <= CGetObjectPropDesc::ServiceL" ) ); + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropDesc::ServiceProtectionStatusL +// Create list of possible protection status and create new ObjectPropDesc +// ----------------------------------------------------------------------------- +// +void CGetObjectPropDesc::ServiceProtectionStatusL() + { + CMTPTypeObjectPropDescEnumerationForm* expectedForm = + CMTPTypeObjectPropDescEnumerationForm::NewL( EMTPTypeUINT16 ); + CleanupStack::PushL( expectedForm ); // + expectedForm + + TUint16 values[] = + { + EMTPProtectionNoProtection, + EMTPProtectionReadOnly + }; + + TInt numValues = sizeof ( values ) / sizeof ( values[0] ) ; + for ( TInt i = 0; i < numValues; i++ ) + { + TMTPTypeUint16 data( values[i] ); + expectedForm->AppendSupportedValueL( data ); + } + + // Althrough iObjectProperty is released in ServiceL(), + // release it here maybe a more safer way :) + if ( iObjectProperty != NULL ) + { + delete iObjectProperty; + iObjectProperty = NULL; + } + + iObjectProperty = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeProtectionStatus, *expectedForm ); + CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropDesc::ServiceFileNameL() +// Create Regular expression for a file name and create new ObjectPropDesc +// ----------------------------------------------------------------------------- +// +void CGetObjectPropDesc::ServiceFileNameL() + { + CMTPTypeString* form = CMTPTypeString::NewLC( KMtpObjDescObjFileName ); // + form + + // Althrough iObjectProperty is released in ServiceL(), + // release it here maybe a more safer way + if ( iObjectProperty != NULL ) + { + delete iObjectProperty; + iObjectProperty = NULL; + } + + iObjectProperty = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeObjectFileName, + CMTPTypeObjectPropDesc::ERegularExpressionForm, + form ); + + CleanupStack::PopAndDestroy( form ); // - form + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropDesc::ServiceNonConsumableL +// Create list of possible nonConsumable values and create new ObjectPropDesc +// ----------------------------------------------------------------------------- +// +void CGetObjectPropDesc::ServiceNonConsumableL() + { + CMTPTypeObjectPropDescEnumerationForm* expectedForm = + CMTPTypeObjectPropDescEnumerationForm::NewL( EMTPTypeUINT8 ); + CleanupStack::PushL( expectedForm ); // + expectedForm + TUint8 values[] = + { + EMTPConsumable, + EMTPNonConsumable + }; + + TInt numValues = sizeof ( values ) / sizeof ( values[0] ); + for ( TInt i = 0; i < numValues; i++ ) + { + TMTPTypeUint8 data( values[i] ); + expectedForm->AppendSupportedValueL( data ); + } + + // Althrough iObjectProperty is released in ServiceL(), + // release it here maybe a more safer way :) + if ( iObjectProperty != NULL ) + { + delete iObjectProperty; + iObjectProperty = NULL; + } + + CMTPTypeObjectPropDesc::TPropertyInfo propertyInfo; + propertyInfo.iDataType = EMTPTypeUINT8; + propertyInfo.iFormFlag = CMTPTypeObjectPropDesc::EEnumerationForm; + propertyInfo.iGetSet = CMTPTypeObjectPropDesc::EReadOnly; + iObjectProperty = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeNonConsumable, + propertyInfo, + expectedForm ); + CleanupStack::PopAndDestroy( expectedForm ); // - expectedForm + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropList::CheckFormatL +// Ensures the object format operation parameter is valid +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CGetObjectPropDesc::CheckFormatL() const + { + TMTPResponseCode response = EMTPRespCodeOK; + + TUint32 formatCode = Request().Uint32( TMTPTypeRequest::ERequestParameter2 ); + PRINT1( _L( "MM MTP <> CGetObjectPropDesc::CheckFormatL formatCode = 0x%x" ), formatCode ); + + if( formatCode != 0) + { + response = EMTPRespCodeInvalidObjectFormatCode; + + const RArray* format = iDpConfig.GetSupportedFormat(); + TInt count = format->Count(); + + for ( TInt i = 0; i < count; i++ ) + { + if ( formatCode == (*format)[i] ) + { + response = EMTPRespCodeOK; + break; + } + } + } + + return response; + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropDesc::CheckPropCodeL +// Ensures the object prop code operation parameter is valid +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CGetObjectPropDesc::CheckPropCodeL() const + { + TMTPResponseCode response = EMTPRespCodeOK; + + TUint32 propCode = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); + PRINT1( _L( "MM MTP <> CGetObjectPropDesc::CheckPropCode, propCode = 0x%x" ), propCode ); + + if ( propCode == 0 ) + { + // A propCode of 0 means specification by group (which is not supported) + response = EMTPRespCodeSpecificationByGroupUnsupported; + } + else + { + TUint32 formatCode = Request().Uint32( TMTPTypeRequest::ERequestParameter2 ); + + const RArray* properties = NULL; + if ( formatCode == KMTPFormatsAll ) + properties= iDpConfig.GetAllSupportedProperties(); + else + properties = iDpConfig.GetSupportedPropertiesL( formatCode ); + + const TInt count = properties->Count(); + TInt i = 0; + for( i = 0; i < count; i++ ) + { + if ( (*properties)[i] == propCode ) + { + break; + } + } + + if ( i == count ) + { + response = EMTPRespCodeInvalidObjectPropCode; + } + } + + return response; + } + +TUint32 CGetObjectPropDesc::GetGroupCode( TUint16 aPropCode ) + { + TInt count = sizeof( KPropGroupMapTable ); + // TODO: if need to refine the search approach to improve performance + for( TInt i = 0; i < count; i++ ) + { + if ( aPropCode == KPropGroupMapTable[i].iPropCode ) + return KPropGroupMapTable[i].iGroupCode; + } + return EGroupCodeNotDefined; + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cgetobjectproplist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cgetobjectproplist.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,863 @@ +/* +* 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: Implement the operation: GetObjectPropList +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tobjectdescription.h" +#include "cgetobjectproplist.h" +#include "tmmmtpdppanic.h" +#include "mmmtpdplogger.h" +#include "mmmtpdpconfig.h" +#include "mmmtpdputility.h" +#include "cmmmtpdpmetadataaccesswrapper.h" + +static const TUint32 KMTPAll = 0xffffffff; +_LIT( KMtpDateTimeFormat, "%F%Y%M%DT%H%T%S" ); +const TInt KMtpMaxDateTimeStringLength = 15; + +#if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) +_LIT( KSubFormatParse, "SubFormatParse" ); +#endif + +// Verification data for the getObjectPropList request +const TMTPRequestElementInfo KMTPGetObjectPropListPolicy[] = + { + { + TMTPTypeRequest::ERequestParameter1, + EMTPElementTypeObjectHandle, + EMTPElementAttrNone, + 2, + KMTPHandleAll, + KMTPHandleNone + } + }; + +// ----------------------------------------------------------------------------- +// CGetObjectPropList::~CGetObjectPropList +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGetObjectPropList::~CGetObjectPropList() + { + Cancel(); + + delete iObject; + delete iPropertyList; + delete iPropertyElement; + iHandles.Close(); + iPropertyArray.Close(); + +#if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) + delete iPerfLog; +#endif + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropList::CGetObjectPropList +// Standard C++ Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGetObjectPropList::CGetObjectPropList( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CRequestProcessor( aFramework, + aConnection, + sizeof ( KMTPGetObjectPropListPolicy ) / sizeof( TMTPRequestElementInfo ), + KMTPGetObjectPropListPolicy ), + iHandles ( KMmMtpRArrayGranularity ), + iDpConfig( aDpConfig ), + iPropertyArray( KMmMtpRArrayGranularity ) + { + PRINT( _L( "Operation: GetObjectPropList(0x9805)" ) ); + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropList::ConstructL +// 2nd Phase Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGetObjectPropList::ConstructL() + { + CActiveScheduler::Add( this ); + + iPropertyList = CMTPTypeObjectPropList::NewL(); + + SetPSStatus(); + +#if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) + iPerfLog = CMmMtpDpPerfLog::NewL( _L( "MediaMtpDataProviderEnumerator" ) ); +#endif + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropList::CheckRequestL +// Verify the reqeust and returns it +// ----------------------------------------------------------------------------- +// +EXPORT_C TMTPResponseCode CGetObjectPropList::CheckRequestL() + { + PRINT( _L( "MM MTP => CGetObjectPropList::CheckRequestL" ) ); + + TMTPResponseCode result = CRequestProcessor::CheckRequestL(); + + if ( result == EMTPRespCodeOK ) + { + result = CheckFormatL(); + } + + if ( result == EMTPRespCodeOK ) + { + result = CheckDepth(); + } + + if ( result == EMTPRespCodeOK ) + { + result = CheckPropCodeL(); + } + + PRINT1( _L("MM MTP <= CGetObjectPropList::CheckRequestL, response 0x%x"), result ); + + return result; + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropList::ServiceL +// service a request at request phase +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGetObjectPropList::ServiceL() + { + GetObjectHandlesL(); + TInt numOfObjects = iHandles.Count(); + PRINT2( _L( "MM MTP <> CGetObjectPropList::ServiceL, numOfObjects = %d, iPropCode = 0x%x" ), + numOfObjects, + iPropCode ); + if ( numOfObjects > 0 + && ( iPropCode == KMTPAll || iPropCode == EMTPObjectPropCodeUndefined ) ) + { + // iFirstUnprocessed = 0; + TRequestStatus* status = &iStatus; + User::RequestComplete( status, iStatus.Int() ); + SetActive(); + } + else + { + TInt err = KErrNone; + for ( TInt i = 0; i < numOfObjects; i++ ) + { + TUint32 handle = iHandles[i ]; + + if ( iFramework.ObjectMgr().ObjectOwnerId( handle ) + == iFramework.DataProviderId() ) + { + delete iObject; + iObject = NULL; + iObject = CMTPObjectMetaData::NewL(); + + if ( iFramework.ObjectMgr().ObjectL( handle, *iObject ) ) // Populate the object meta data + { + SetSubFormatCodeL(); + + err = ServiceOneObjectPropertyL( handle, iPropCode ); + if ( err != KErrNone && err != KErrNotSupported ) + break; + } + } + } + PRINT1( _L( "MM MTP <> CGetObjectPropList::ServiceL, one property was queried, Send data to PC! err = %d" ), err ); + if ( err == KErrNone || err == KErrNotSupported ) + SendDataL( *iPropertyList ); + else if ( err == KErrNotFound ) + SendResponseL( EMTPRespCodeAccessDenied ); + else + SendResponseL( EMTPRespCodeGeneralError ); + } + + PRINT( _L( "MM MTP <= CGetObjectPropList::ServiceL" ) ); + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropList::CheckFormatL +// Ensures the object format operation parameter is valid +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CGetObjectPropList::CheckFormatL() const + { + TMTPResponseCode response = EMTPRespCodeOK; + + PRINT( _L( "MM MTP => CGetObjectPropList::CheckFormatL" ) ); + + TUint32 formatCode = Request().Uint32( TMTPTypeRequest::ERequestParameter2 ); + iFormatCode = formatCode; + + PRINT1( _L( "MM MTP <> CGetObjectPropList::CheckFormatL formatCode = 0x%x" ), formatCode ); + + if ( formatCode != 0 ) + { + response = EMTPRespCodeInvalidObjectFormatCode; + + const RArray* format = iDpConfig.GetSupportedFormat(); + TInt count = format->Count(); + + for ( TInt i = 0; i < count; i++ ) + { + if ( formatCode == (*format)[i ] ) + { + response = EMTPRespCodeOK; + break; + } + } + } + + PRINT1( _L( "MM MTP <= CGetObjectPropList::CheckFormatL, response 0x%x" ), response ); + + return response; + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropList::CheckPropCodeL +// Ensures the object prop code operation parameter is valid +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CGetObjectPropList::CheckPropCodeL() const + { + PRINT( _L( "MM MTP => CGetObjectPropList::CheckPropCode" ) ); + + TMTPResponseCode response = EMTPRespCodeOK; + + TUint32 formatCode = Request().Uint32( TMTPTypeRequest::ERequestParameter2 ); + iPropCode = Request().Uint32( TMTPTypeRequest::ERequestParameter3 ); + PRINT1( _L( "MM MTP <> CGetObjectPropList::CheckPropCode, iPropCode = 0x%x" ), iPropCode ); + + iPropertyArray.Reset(); + if ( iPropCode == EMTPObjectPropCodeUndefined ) + { + // Get group code + TUint32 groupCode = Request().Uint32( TMTPTypeRequest::ERequestParameter4 ); + PRINT1( _L( "MM MTP <> CGetObjectPropList::CheckPropCode, Group Code = 0x%x" ), groupCode ); + + // check if groupCode is supported + TInt count = sizeof ( KSupportedGroupCode ) + / sizeof ( KSupportedGroupCode[0] ); + TInt i = 0; + for ( ; i < count; i++ ) + { + if ( groupCode == KSupportedGroupCode[i ] ) + break; + } + if ( i == count ) + response = EMTPRespCodeSpecificationByGroupUnsupported; + + } + else if ( iPropCode != KMTPAll ) + { + PRINT1( _L( "MM MTP <> CGetObjectPropList::CheckPropCode, Property(0x%x) was queried." ), iPropCode ); + + TInt err = KErrNone; + const RArray* properties = NULL; + if ( formatCode == KMTPFormatsAll ) + properties = iDpConfig.GetAllSupportedProperties(); + else + properties = iDpConfig.GetSupportedPropertiesL( formatCode ); + + User::LeaveIfError( err ); + + const TInt count = properties->Count(); + TInt i = 0; + for ( i = 0; i < count; i++ ) + { + if ( (*properties)[i] == iPropCode ) + { + iPropertyArray.Append( iPropCode ); + break; + } + } + + if ( iPropertyArray.Count() == 0 ) + { + response = EMTPRespCodeInvalidObjectPropCode; + } + } + else + { + PRINT( _L( "MM MTP <> CGetObjectPropList::CheckPropCode, All properties were queried." ) ); + } + + PRINT1( _L( "MM MTP <= CGetObjectPropList::CheckPropCode, response 0x%x" ), response ); + + return response; + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropList::CheckDepth +// Ensures the depth operation parameter is valid +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CGetObjectPropList::CheckDepth() const + { + TMTPResponseCode response = EMTPRespCodeSpecificationByDepthUnsupported; + + PRINT( _L( "MM MTP => CGetObjectPropList::CheckDepth" ) ); + + // We either support no depth at all, or 1 depth or (0xFFFFFFFF) with objecthandle as 0x00000000 + iHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); + PRINT1( _L( "MM MTP <> CGetObjectPropList::CheckDepth iHandle = 0x%x" ), iHandle ); + iDepth = Request().Uint32( TMTPTypeRequest::ERequestParameter5 ); + PRINT1( _L( "MM MTP <> CGetObjectPropList::CheckDepth iDepth = 0x%x" ), iDepth ); + + if ( ( iDepth == 0 ) + || ( iDepth == 1 ) + || ( iDepth == KMTPAll && iHandle == KMTPHandleNone ) ) + { + response = EMTPRespCodeOK; + } + + PRINT1( _L( "MM MTP <= CGetObjectPropList::CheckDepth, response 0x%x" ), response ); + + return response; + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropList::GetObjectHandlesL +// Gets the handles for the objects that we want the properties for +// ----------------------------------------------------------------------------- +// +void CGetObjectPropList::GetObjectHandlesL() + { + PRINT( _L( "MM MTP => CGetObjectPropList::GetObjectHandlesL" ) ); + + iHandles.Reset(); + + if ( iHandle == KMTPHandleAll ) + { + GetObjectHandlesL( KMTPStorageAll, KMTPHandleNone ); + } + else if ( iHandle == KMTPHandleNone ) + { + GetRootObjectHandlesL( iDepth, iFormatCode ); + } + else + { + CMTPObjectMetaData* meta( iRequestChecker->GetObjectInfo( iHandle ) ); + TPtrC suid( meta->DesC( CMTPObjectMetaData::ESuid ) ); + TParsePtrC parse( suid ); + iDpConfig.GetWrapperL().SetStorageRootL( parse.Drive() ); + + __ASSERT_DEBUG( meta, Panic( EMmMTPDpObjectNull ) ); + + if ( ( meta->Uint( CMTPObjectMetaData::EFormatCode ) == EMTPFormatCodeAssociation ) + && ( meta->Uint( CMTPObjectMetaData::EFormatSubCode ) == EMTPAssociationTypeGenericFolder ) ) + { + GetFolderObjectHandlesL( iDepth, iHandle ); + } + else + { + iHandles.Append( iHandle ); + } + } + + PRINT( _L( "MM MTP <= CGetObjectPropList::GetObjectHandlesL" ) ); + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropList::GetObjectHandlesL +// Gets all object handles (for GetObjectHandlesL) +// ----------------------------------------------------------------------------- +// +void CGetObjectPropList::GetObjectHandlesL( TUint32 aStorageId, + TUint32 aParentHandle, + TUint16 aFormat /*= 0x0000*/) + { + PRINT2( _L( "MM MTP => CGetObjectPropList::GetObjectHandlesL, aStorageId = 0x%x, aParentHandle = 0x%x" ), + aStorageId, + aParentHandle ); + + RMTPObjectMgrQueryContext context; + CleanupClosePushL( context ); // + context + + iHandles.Reset(); + + if ( aFormat ) + { + TMTPObjectMgrQueryParams params( aStorageId, aFormat, aParentHandle ); + + do + { + iFramework.ObjectMgr().GetObjectHandlesL( params, context, iHandles ); + } + while ( !context.QueryComplete() ); + } + else + { + TMTPObjectMgrQueryParams params( aStorageId, + KMTPFormatsAll, + aParentHandle ); + + do + { + RArray handles; + CleanupClosePushL( handles ); // + handles + iFramework.ObjectMgr().GetObjectHandlesL( params, context, handles ); + + for ( TInt i = 0; i < handles.Count(); i++ ) + { + if ( iFramework.ObjectMgr().ObjectOwnerId( handles[i ] ) + == iFramework.DataProviderId() ) + iHandles.Append( handles[i ] ); + } + CleanupStack::PopAndDestroy( &handles ); // - handles + } + while ( !context.QueryComplete() ); + } + + CleanupStack::PopAndDestroy( &context ); // - context + + PRINT( _L( "MM MTP <= CGetObjectPropList::GetObjectHandlesL" ) ); + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropList::GetFolderObjectHandlesL +// Gets a folder object handle +// ----------------------------------------------------------------------------- +// +void CGetObjectPropList::GetFolderObjectHandlesL( TUint32 aDepth, + TUint32 aParentHandle ) + { + PRINT2( _L( "MM MTP => CGetObjectPropList::GetFolderObjectHandlesL aDepth = 0x%x, aParentHandle = 0x%x" ), + aDepth, + aParentHandle ); + + if ( aDepth == 0 ) + { + // Do Nothing!!! + } + else //if(aDepth ==1) + { + GetObjectHandlesL( KMTPStorageAll, aParentHandle, iFormatCode ); + } + + PRINT( _L( "MM MTP <= CGetObjectPropList::GetFolderObjectHandlesL" ) ); + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropList::GetRootObjectHandlesL +// Gets the handles of all objects on the root +// ----------------------------------------------------------------------------- +// +void CGetObjectPropList::GetRootObjectHandlesL( TUint32 aDepth, TUint16 aFormat ) + { + PRINT2( _L( "MM MTP => CGetObjectPropList::GetRootObjectHandlesL aDepth = 0x%x, aFormat = 0x%x" ), aDepth , aFormat); + + if ( aDepth == KMaxTUint ) + { + GetObjectHandlesL( KMTPStorageAll, KMTPHandleNone, aFormat ); + } + else if ( aDepth == 0 ) + { + // Return empty set to PC according to spec 0.96, folder is handled by device dp + iHandles.Reset(); + } + else + { + GetObjectHandlesL( KMTPStorageAll, KMTPHandleNoParent, aFormat ); + } + + PRINT( _L( "MM MTP <= CGetObjectPropList::GetRootObjectHandlesL" ) ); + } +// ----------------------------------------------------------------------------- +// CGetObjectPropList::ServiceAllPropertiesL +// Gets a list of all the properties supported +// ----------------------------------------------------------------------------- +// +TInt CGetObjectPropList::ServiceAllPropertiesL( TUint32 aHandle ) + { + PRINT1( _L( "MM MTP => CGetObjectPropList::ServiceAllPropertiesL aHandle = 0x%x" ), aHandle ); + + // Append the current object info onto our list + TFileName fileName( iObject->DesC( CMTPObjectMetaData::ESuid ) ); + TUint32 formatCode = iObject->Uint( CMTPObjectMetaData::EFormatCode ); + + PRINT2( _L( "MM MTP <> CGetObjectPropList::ServiceAllPropertiesL, fileName = %S, formatCode = 0x%x" ), + &fileName, + formatCode ); + + const RArray* properties = NULL; + if ( formatCode == KMTPFormatsAll ) + properties = iDpConfig.GetAllSupportedProperties(); + else + properties = iDpConfig.GetSupportedPropertiesL( formatCode ); + + const TInt count = properties->Count(); + + TInt err = KErrNone; + for ( TInt i = 0; i < count; i++ ) + { + // no need to do the trap anymore, this is being handle internally in Media DP's ServiceSpecificObjectPropertyL, also, this base class should not know too much of different handling between different formats + err = ServiceOneObjectPropertyL( aHandle, (*properties)[i] ); + if ( err == KErrNotSupported ) // Skip + err = KErrNone; + if ( err != KErrNone ) + break; + } + + PRINT1( _L( "MM MTP <= CGetObjectPropList::ServiceAllPropertiesL err = %d" ), err ); + return err; + } + +TInt CGetObjectPropList::ServiceGroupPropertiesL( TUint32 aHandle ) + { + PRINT1( _L( "MM MTP => CGetObjectPropList::ServiceGroupPropertiesL aHandle = 0x%x" ), aHandle ); + + TFileName fileName( iObject->DesC( CMTPObjectMetaData::ESuid ) ); + TUint32 formatCode = iObject->Uint( CMTPObjectMetaData::EFormatCode ); + + PRINT2( _L( "MM MTP <> CGetObjectPropList::ServiceGroupPropertiesL, fileName = %S, formatCode = 0x%x" ), + &fileName, + formatCode ); + + // Get property codes according to group code, put those into array + TUint32 groupCode = Request().Uint32( TMTPTypeRequest::ERequestParameter4 ); + iPropertyArray.Reset(); + GetPropertiesL( iPropertyArray, groupCode, formatCode ); + + const TInt count = iPropertyArray.Count(); + + TInt err = KErrNone; + for ( TInt i = 0; i < count; i++ ) + { + err = ServiceOneObjectPropertyL( aHandle, iPropertyArray[i] ); + if ( err == KErrNotSupported ) // Skip + err = KErrNone; + if ( err != KErrNone ) + break; + } + + PRINT1( _L( "MM MTP <= CGetObjectPropList::ServiceGroupPropertiesL err = %d" ), err ); + + return err; + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropList::ServiceOneObjectPropertyL +// Gets the object property information for the required object +// ----------------------------------------------------------------------------- +// +TInt CGetObjectPropList::ServiceOneObjectPropertyL( TUint32 aHandle, + TUint16 aPropCode ) + { + PRINT2( _L( "MM MTP => CGetObjectPropList::ServiceOneObjectPropertyL aHandle = 0x%x, aPropCode = 0x%x" ), + aHandle, + aPropCode ); + CMTPTypeString* textData = NULL; + TInt err = KErrNone; + + if ( iPropertyElement != NULL ) + { + delete iPropertyElement; + iPropertyElement = NULL; + } + + switch ( aPropCode ) + { + // Storage ID + case EMTPObjectPropCodeStorageID: + { + TMTPTypeUint32 storageId( iObject->Uint( CMTPObjectMetaData::EStorageId ) ); + iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); + iPropertyElement->SetUint32L(CMTPTypeObjectPropListElement::EValue, storageId.Value()); + } + break; + + // Format Code + case EMTPObjectPropCodeObjectFormat: + { + TMTPTypeUint16 objectFormat( iObject->Uint( CMTPObjectMetaData::EFormatCode ) ); + iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); + iPropertyElement->SetUint16L(CMTPTypeObjectPropListElement::EValue, objectFormat.Value()); + } + break; + + // Protection Status + case EMTPObjectPropCodeProtectionStatus: + { + TMTPTypeUint16 protectionStatus( MmMtpDpUtility::GetProtectionStatusL( iFramework.Fs(), + iObject->DesC( CMTPObjectMetaData::ESuid ) ) ); + iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); + iPropertyElement->SetUint16L(CMTPTypeObjectPropListElement::EValue, protectionStatus.Value()); + } + break; + + // Object Size + case EMTPObjectPropCodeObjectSize: + { + TMTPTypeUint64 objectSize( MmMtpDpUtility::GetObjectSizeL( iFramework.Fs(), + iObject->DesC( CMTPObjectMetaData::ESuid ) ) ); + iPropertyElement = &( iPropertyList->ReservePropElemL( aHandle, aPropCode ) ); + iPropertyElement->SetUint64L( CMTPTypeObjectPropListElement::EValue, objectSize.Value() ); + } + break; + + // Filename + case EMTPObjectPropCodeObjectFileName: + { +#ifdef _DEBUG + HBufC* log = iObject->DesC( CMTPObjectMetaData::ESuid ).Alloc(); + PRINT1( _L( "MM MTP <> CGetObjectPropList::ServiceOneObjectPropertyL FileName = %S" ), log ); + delete log; + log = NULL; +#endif // _DEBUG + TParsePtrC parse( iObject->DesC( CMTPObjectMetaData::ESuid ) ); + textData = CMTPTypeString::NewLC( parse.NameAndExt() ); // + textData + iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); + iPropertyElement->SetStringL(CMTPTypeObjectPropListElement::EValue, textData->StringChars()); + CleanupStack::PopAndDestroy( textData ); // - textData + } + break; + + // Parent Object + case EMTPObjectPropCodeParentObject: + { + iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); + iPropertyElement->SetUint32L(CMTPTypeObjectPropListElement::EValue, iObject->Uint( CMTPObjectMetaData::EParentHandle )); + } + break; + + // PUID + case EMTPObjectPropCodePersistentUniqueObjectIdentifier: + { + TMTPTypeUint128 puid = iFramework.ObjectMgr().PuidL( aHandle ); + iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); + iPropertyElement->SetUint128L(CMTPTypeObjectPropListElement::EValue,puid.UpperValue(), puid.LowerValue() ); + } + break; + + case EMTPObjectPropCodeName: + case EMTPObjectPropCodeDateAdded: + { + if ( ( aPropCode == EMTPObjectPropCodeName ) + || ( ( !MmMtpDpUtility::IsVideoL( iObject->DesC( CMTPObjectMetaData::ESuid ), iFramework ) ) + && ( aPropCode == EMTPObjectPropCodeDateAdded ) ) ) + { + textData = CMTPTypeString::NewLC(); // + textData + + TRAP( err, iDpConfig.GetWrapperL().GetObjectMetadataValueL( aPropCode, + *textData, + *iObject ) ); + + PRINT1( _L( "MM MTP <> CGetObjectPropList::ServiceOneObjectPropertyL err = %d" ), err ); + + if ( err == KErrNone ) + { + iPropertyElement = &(iPropertyList->ReservePropElemL( aHandle, aPropCode ) ); + iPropertyElement->SetStringL(CMTPTypeObjectPropListElement::EValue, textData->StringChars()); + } + + CleanupStack::PopAndDestroy( textData ); // - textData + } + } + break; + + case EMTPObjectPropCodeDateCreated: + case EMTPObjectPropCodeDateModified: + { + TTime dataModified; + dataModified = MmMtpDpUtility::GetObjectDateModifiedL( iFramework.Fs(), + iObject->DesC( CMTPObjectMetaData::ESuid ) ); + + TBuf timeStr; + dataModified.FormatL( timeStr, KMtpDateTimeFormat ); + PRINT1( _L( "MM MTP <> CGetObjectPropList::ServiceOneObjectPropertyL Date time %S" ), &timeStr ); + CMTPTypeString* datastring = CMTPTypeString::NewLC( timeStr ); // + datastring + + iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); + iPropertyElement->SetStringL(CMTPTypeObjectPropListElement::EValue, datastring->StringChars()); + CleanupStack::PopAndDestroy( datastring ); // - datastring + } + break; + + // Consumable Value + case EMTPObjectPropCodeNonConsumable: + { + iPropertyElement = &(iPropertyList->ReservePropElemL(aHandle, aPropCode)); + iPropertyElement->SetUint8L(CMTPTypeObjectPropListElement::EValue,0); + } + break; + + default: + { + err = ServiceSpecificObjectPropertyL( aPropCode, aHandle ); + } + break; + } + + if ( iPropertyElement != NULL ) + { + iPropertyList->CommitPropElemL( *iPropertyElement ); + iPropertyElement = NULL; + } + + PRINT( _L( "MM MTP <= CGetObjectPropList::ServiceOneObjectPropertyL" ) ); + + return err; + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropList::RunL +// +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGetObjectPropList::RunL() + { + if ( iHandles.Count() > 0 ) + { + TInt err = KErrNone; + TUint32 handle = iHandles[0]; + PRINT1( _L( "MM MTP <> CGetObjectPropList::RunL, handle = 0x%x" ), handle ); + if ( iFramework.ObjectMgr().ObjectOwnerId( handle ) + == iFramework.DataProviderId() ) + { + delete iObject; + iObject = NULL; + iObject = CMTPObjectMetaData::NewL(); + + if ( iFramework.ObjectMgr().ObjectL( handle, *iObject ) ) // Populate the object meta data + { + SetSubFormatCodeL(); + + if ( iPropCode == KMTPAll ) + err = ServiceAllPropertiesL( handle ); + else if ( iPropCode == EMTPObjectPropCodeUndefined ) + { + err = ServiceGroupPropertiesL( handle ); + } + if ( err == KErrNotFound ) + SendResponseL( EMTPRespCodeAccessDenied ); + else if ( err != KErrNone ) + SendResponseL( EMTPRespCodeGeneralError ); + } + } + + // Complete ourselves with current TRequestStatus + // Increase index to process next handle on next round + // iFirstUnprocessed++; + iHandles.Remove( 0 ); + + if ( err == KErrNone ) + { + TRequestStatus* status = &iStatus; + User::RequestComplete( status, iStatus.Int() ); + SetActive(); + } + } + else // all handles processed, can send data + { + PRINT( _L( "MM MTP <> CGetObjectPropList::RunL, Finished, Send data to PC!" ) ); + SendDataL( *iPropertyList ); + } + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropList::RunError +// +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CGetObjectPropList::RunError( TInt aError ) + { + PRINT1( _L( "MM MTP <> CGetObjectPropList::RunError aError = %d" ), aError ); + TRAP_IGNORE( SendResponseL( EMTPRespCodeGeneralError ) ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropList::DoCancel() +// Cancel the process +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGetObjectPropList::DoCancel() + { + // TODO: need to send the data here? + // SendDataL( *iPropertyList ); + } + +void CGetObjectPropList::GetPropertiesL( RArray& aPropArray, + TUint32 aGroupCode, + TUint16 aFormatCode ) const + { + aPropArray.Reset(); + + const RArray* properties = NULL; + if ( aFormatCode == KMTPFormatsAll ) + properties = iDpConfig.GetAllSupportedProperties(); + else + properties = iDpConfig.GetSupportedPropertiesL( aFormatCode ); + + TInt count = sizeof ( KPropGroupMapTable ) / sizeof ( KPropGroupMapTable[0] ); + for ( TInt i = 0; i < properties->Count(); i++ ) + { + for ( TInt j = 0; j < count; j++ ) + { + if( KPropGroupMapTable[j].iPropCode == (*properties)[i] + && KPropGroupMapTable[j].iGroupCode == aGroupCode ) + { + aPropArray.Append( (*properties)[i] ); + break; + } + } + } + } + +void CGetObjectPropList::SetSubFormatCodeL() + { + __ASSERT_DEBUG( iObject, Panic( EMmMTPDpObjectNull ) ); + + // Note: Parsing out subformat code in external enumeration phase. + // This process was delayed in internal phase to avoid time-out. + TUint16 formatCode = iObject->Uint( CMTPObjectMetaData::EFormatCode ); + TUint subFormatCode = iObject->Uint( CMTPObjectMetaData::EFormatSubCode ); + PRINT2( _L( "MM MTP <> CGetObjectPropList::SetSubFormatCode, formatCode = 0x%x, subFormatCode = 0x%x" ), + formatCode, + subFormatCode ); + + TBool ifNeedParse = ( ( formatCode == EMTPFormatCodeMP4Container ) + || ( formatCode == EMTPFormatCode3GPContainer ) + || ( formatCode== EMTPFormatCodeASF ) ) + && ( subFormatCode == EMTPSubFormatCodeUnknown ); + if ( ifNeedParse ) + { + PERFLOGSTART( KSubFormatParse ); + + if ( MmMtpDpUtility::IsVideoL( iObject->DesC( CMTPObjectMetaData::ESuid ) ) ) + subFormatCode = EMTPSubFormatCodeVideo; + else + subFormatCode = EMTPSubFormatCodeAudio; + + PERFLOGSTOP( KSubFormatParse ); + + iObject->SetUint( CMTPObjectMetaData::EFormatSubCode, subFormatCode ); + } + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cgetobjectpropssupported.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cgetobjectpropssupported.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,127 @@ +/* +* 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: Implement operation GetObjectPropsSupported +* +*/ + + +#include + +#include "cgetobjectpropssupported.h" +#include "mmmtpdplogger.h" +#include "mmmtpdpconfig.h" + +// ----------------------------------------------------------------------------- +// Verification data for the GetObjectPropSupported request +// ----------------------------------------------------------------------------- +// +const TMTPRequestElementInfo KMTPGetObjectPropSupportedPolicy[] = + { + { + TMTPTypeRequest::ERequestParameter1, + EMTPElementTypeFormatCode, + EMTPElementAttrNone, + 1, + EMTPFormatCodeUndefined, + 0 + }, + }; + +// ----------------------------------------------------------------------------- +// CGetObjectPropsSupported::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +EXPORT_C MMmRequestProcessor* CGetObjectPropsSupported::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + CGetObjectPropsSupported* self = new ( ELeave ) CGetObjectPropsSupported( aFramework, aConnection, aDpConfig ); + // CleanupStack::PushL( self ); + // self->ConstructL(); + // CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropsSupported::~CGetObjectPropsSupported( +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGetObjectPropsSupported::~CGetObjectPropsSupported() + { + delete iObjectPropsSupported; + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropsSupported::~CGetObjectPropsSupported( +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +CGetObjectPropsSupported::CGetObjectPropsSupported( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CRequestProcessor( aFramework, + aConnection, + sizeof( KMTPGetObjectPropSupportedPolicy ) / sizeof( TMTPRequestElementInfo ), + KMTPGetObjectPropSupportedPolicy ), + iDpConfig( aDpConfig ) + { + PRINT( _L( "Operation: GetObjectPropsSupported(0x9801)" ) ); + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropsSupported::ServiceL +// GetObjectPropSupported request handler +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGetObjectPropsSupported::ServiceL() + { + delete iObjectPropsSupported; + iObjectPropsSupported = NULL; + iObjectPropsSupported = CMTPTypeArray::NewL( EMTPTypeAUINT16 ); + + TUint32 formatCode = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); + PRINT1( _L( "MM MTP <> CGetObjectPropsSupported::ServiceL formatCode = 0x%x" ), formatCode ); + + const RArray* format = iDpConfig.GetSupportedFormat(); + TInt count = format->Count(); + + TInt i = 0; + for ( ; i < count; i++ ) + { + if ( formatCode == (*format)[i] ) // only process the support format + { + const RArray* properties; + properties = iDpConfig.GetSupportedPropertiesL( formatCode ) ; + + TInt count = properties->Count(); + + PRINT1( _L( "MM MTP <> CGetObjectPropsSupported::ServiceL properties count = %d"), count ); + for ( TInt j = 0; j < count; j++ ) + { + iObjectPropsSupported->AppendUintL( (*properties)[j] ); + } + + break; + } + } + + if( i == count ) + SendResponseL( EMTPRespCodeInvalidObjectFormatCode ); + else + SendDataL( *iObjectPropsSupported ); + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cgetobjectpropvalue.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cgetobjectpropvalue.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,324 @@ +/* +* 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: Implement the operation: GetObjectPropValue +* +*/ + + +#include +#include +#include +#include +#include +#include + +#include "cgetobjectpropvalue.h" +#include "mmmtpdputility.h" +#include "cmmmtpdpmetadataaccesswrapper.h" +#include "mmmtpdplogger.h" +#include "mmmtpdpconfig.h" + +_LIT( KMtpDateTimeFormat, "%F%Y%M%DT%H%T%S" ); +const TInt KMtpMaxDateTimeStringLength = 15; + +// ----------------------------------------------------------------------------- +// Verification data for the GetObjectPropValue request +// ----------------------------------------------------------------------------- +// +const TMTPRequestElementInfo KMTPGetObjectPropValuePolicy[] = + { + { + TMTPTypeRequest::ERequestParameter1, + EMTPElementTypeObjectHandle, + EMTPElementAttrNone, + 0, + 0, + 0 + }, + }; + +// ----------------------------------------------------------------------------- +// CGetObjectPropValue::~CGetObjectPropValue +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGetObjectPropValue::~CGetObjectPropValue() + { + delete iMTPTypeString; + delete iMTPTypeArray; + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropValue::CGetObjectPropValue +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGetObjectPropValue::CGetObjectPropValue( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CRequestProcessor( aFramework, + aConnection, + sizeof ( KMTPGetObjectPropValuePolicy ) / sizeof ( TMTPRequestElementInfo ), + KMTPGetObjectPropValuePolicy ), + iDpConfig( aDpConfig ) + { + SetPSStatus(); + PRINT( _L( "Operation: GetObjectPropValue(0x9803)" ) ); + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropValue::CheckRequestL +// Verify the reqeust +// ----------------------------------------------------------------------------- +// +EXPORT_C TMTPResponseCode CGetObjectPropValue::CheckRequestL() + { + PRINT( _L( "MM MTP => CGetObjectPropValue::CheckRequestL" ) ); + TMTPResponseCode result = CRequestProcessor::CheckRequestL(); + + //Now check to see if we support the property + if ( result == EMTPRespCodeOK ) + { + TUint32 objectHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); + CMTPObjectMetaData* objectInfo = iRequestChecker->GetObjectInfo( objectHandle ); + + if (!objectInfo) + { + PRINT(_L("MM MTP <> CGetObjectPropValue::CheckRequestL, objectInfo is NULL")); + return EMTPRespCodeInvalidObjectHandle; + } + + TFileName fileName = objectInfo->DesC( CMTPObjectMetaData::ESuid ); + TUint32 formatCode = objectInfo->Uint( CMTPObjectMetaData::EFormatCode ); + + PRINT3( _L( "MM MTP <> CGetObjectPropValue::CheckRequestL, handle = 0x%x, filename = %S, formatCode = 0x%x" ), objectHandle, &fileName, formatCode); + const RArray* properties = iDpConfig.GetSupportedPropertiesL( formatCode ); + TInt count = properties->Count(); + + TUint32 propCode = Request().Uint32( TMTPTypeRequest::ERequestParameter2 ); + PRINT1( _L( "MM MTP <> CGetObjectPropValue::CheckRequestL propCode = 0x%x" ), propCode ); + + result = EMTPRespCodeInvalidObjectPropCode; + + for ( TInt i = 0; i < count; i++ ) + { + if ( (*properties)[i] == propCode ) + { + result = EMTPRespCodeOK; + break; + } + } + } + + PRINT1( _L( "MM MTP <= CGetObjectPropValue::CheckRequestL result = 0x%x" ), result ); + return result; + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropValue::ServiceL +// GetObjectPropValue request handler +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGetObjectPropValue::ServiceL() + { + PRINT( _L( "MM MTP => CGetObjectPropValue::ServiceL" ) ); + + //Get the request information + TUint32 objectHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); + TUint32 propCode = Request().Uint32( TMTPTypeRequest::ERequestParameter2 ); + PRINT2( _L( "MM MTP <> CGetObjectPropValue::ServiceL objectHandle = 0x%x, propCode = 0x%x" ), + objectHandle, propCode ); + + // don't have the ownship of the object + iObjectInfo = iRequestChecker->GetObjectInfo( objectHandle ); + TPtrC suid( iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); + PRINT1( _L( "MM MTP <> CGetObjectPropValue::ServiceL object file name is %S" ), &suid ); + TParsePtrC parse( suid ); + + iDpConfig.GetWrapperL().SetStorageRootL( parse.Drive() ); + + if ( iMTPTypeString != NULL ) + { + delete iMTPTypeString; + iMTPTypeString = NULL; + } + + switch ( propCode ) + { + // Storage ID + case EMTPObjectPropCodeStorageID: + { + iMTPTypeUint32.Set( 0 ); + iMTPTypeUint32 = iObjectInfo->Uint( CMTPObjectMetaData::EStorageId ); + SendDataL( iMTPTypeUint32 ); + } + break; + + // Format Code + case EMTPObjectPropCodeObjectFormat: + { + iMTPTypeUint16.Set( 0 ); + iMTPTypeUint16 = iObjectInfo->Uint( CMTPObjectMetaData::EFormatCode ); + PRINT1( _L( "MM MTP <> CGetObjectPropValue::ServiceL ObjectFormat = 0x%x" ), + iMTPTypeUint16.Value() ); + + SendDataL( iMTPTypeUint16 ); + } + break; + + // ProtectionStatus + case EMTPObjectPropCodeProtectionStatus: + { + iMTPTypeUint16.Set( 0 ); + iMTPTypeUint16 = MmMtpDpUtility::GetProtectionStatusL( iFramework.Fs(), + iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); + SendDataL( iMTPTypeUint16 ); + } + break; + + // Object Size + case EMTPObjectPropCodeObjectSize: + { + iMTPTypeUint64.Set( 0 ); + iMTPTypeUint64 = MmMtpDpUtility::GetObjectSizeL( iFramework.Fs(), + iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); + SendDataL( iMTPTypeUint64 ); + } + break; + + // Filename + case EMTPObjectPropCodeObjectFileName: + { + const TDesC& suid( iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); + PRINT1( _L( "MM MTP <> CGetObjectPropValue::ServiceL SUID = %S" ), &suid ); + + TPtrC path( suid.Ptr(), suid.Length() ); + TParsePtrC parse( path ); + iMTPTypeString = CMTPTypeString::NewL( parse.NameAndExt() ); + SendDataL( *iMTPTypeString ); + } + break; + + // Parent + case EMTPObjectPropCodeParentObject: + { + iMTPTypeUint32.Set( 0 ); + iMTPTypeUint32 = iObjectInfo->Uint( CMTPObjectMetaData::EParentHandle ); + SendDataL( iMTPTypeUint32 ); + } + break; + + // Persistent Unique Object Identifier + case EMTPObjectPropCodePersistentUniqueObjectIdentifier: + { + iMTPTypeUint128.Set( 0, 0 ); + iMTPTypeUint128 = iFramework.ObjectMgr().PuidL( objectHandle ); + SendDataL( iMTPTypeUint128 ); + } + break; + + // Name and DataAdded (audio only) fall under the same branch while dateadded(video)/modified/created fall under another + case EMTPObjectPropCodeName: // 0xDC44 + case EMTPObjectPropCodeDateAdded: // 0xDC4E + { + if ( ( propCode == EMTPObjectPropCodeName) + || ( ( !MmMtpDpUtility::IsVideoL(iObjectInfo->DesC( CMTPObjectMetaData::ESuid ), iFramework ) ) + && ( propCode == EMTPObjectPropCodeDateAdded ) ) ) + { + iMTPTypeString = CMTPTypeString::NewL(); + ServiceMetaDataFromWrapperL( propCode, *iMTPTypeString, *iObjectInfo ); + break; + } + } + //lint -fallthrough + case EMTPObjectPropCodeDateCreated: + case EMTPObjectPropCodeDateModified: + { + TTime dataModified; + dataModified = MmMtpDpUtility::GetObjectDateModifiedL( iFramework.Fs(), + iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); + + TBuf timeStr; + dataModified.FormatL( timeStr, KMtpDateTimeFormat ); + PRINT1( _L( "MM MTP <> CGetObjectPropValue::ServiceL Date time %S" ), &timeStr ); + iMTPTypeString = CMTPTypeString::NewL( timeStr ); + SendDataL( *iMTPTypeString ); + } + break; + + // Consumable + case EMTPObjectPropCodeNonConsumable: + { + iMTPTypeUint8.Set( 0 ); + SendDataL( iMTPTypeUint8 ); + } + break; + + default: + { + ServiceSpecificObjectPropertyL( propCode ); + } + break; + } + PRINT( _L( "MM MTP <= CGetObjectPropValue::ServiceL" ) ); + } + +// ----------------------------------------------------------------------------- +// CGetObjectPropValue::ServiceMetaDataFromWrapperL +// Get MetaData from CMetadataAccessWrapper and send data +// or response to initiator +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGetObjectPropValue::ServiceMetaDataFromWrapperL( const TUint16 aPropCode, + MMTPType& aNewData, + const CMTPObjectMetaData& aObjectMetaData ) + { + TRAPD( err, iDpConfig.GetWrapperL().GetObjectMetadataValueL( aPropCode, + aNewData, + aObjectMetaData ) ); + + PRINT1( _L( "MM MTP <> CGetObjectPropValue::ServiceMetaDataFromWrapperL err = %d" ), err ); + + if ( err == KErrNone ) + { + SendDataL( aNewData ); + } + // according to the codes of S60 + else if ( err == KErrTooBig ) + { + SendResponseL( EMTPRespCodeInvalidDataset ); + } + else if( err == KErrPermissionDenied ) + { + SendResponseL( EMTPRespCodeAccessDenied ); + } + else if ( err == KErrNotFound ) + { + if( MmMtpDpUtility::HasMetadata( aObjectMetaData.Uint( CMTPObjectMetaData::EFormatCode ) ) ) + SendResponseL( EMTPRespCodeAccessDenied ); + else + SendDataL( aNewData ); + } + // PTP/MTP error code, according to the codes of S60 + else if ( err > KErrNone ) + { + SendResponseL( static_cast( err ) ); + } + else + { + SendResponseL( EMTPRespCodeGeneralError ); + } + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cgetobjectreferences.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cgetobjectreferences.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,143 @@ +/* +* 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: Implement the operation: GetObjectReferences +* +*/ + + +#include +#include +#include +#ifdef _DEBUG +#include +#include +#include +#endif + +#include "cgetobjectreferences.h" +#include "mmmtpdplogger.h" + +// ----------------------------------------------------------------------------- +// Verification data for the GetReferences request +// ----------------------------------------------------------------------------- +// +const TMTPRequestElementInfo KMTPGetObjectReferencesPolicy[] = + { + { + TMTPTypeRequest::ERequestParameter1, + EMTPElementTypeObjectHandle, + EMTPElementAttrNone, + 0, + 0, + 0 + } + }; + +// ----------------------------------------------------------------------------- +// CGetObjectReferences::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +EXPORT_C MMmRequestProcessor* CGetObjectReferences::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& /*aDpConfig*/ ) + { + CGetObjectReferences* self = new ( ELeave ) CGetObjectReferences( aFramework, + aConnection ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// CGetObjectReferences::ConstructL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +void CGetObjectReferences::ConstructL() + { + SetPSStatus(); + } + +// ----------------------------------------------------------------------------- +// CGetObjectReferences::~CGetObjectReferences +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGetObjectReferences::~CGetObjectReferences() + { + delete iReferences; + } + +// ----------------------------------------------------------------------------- +// CGetObjectReferences::CGetObjectReferences +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +CGetObjectReferences::CGetObjectReferences( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection ) : + CRequestProcessor( aFramework, + aConnection, + sizeof ( KMTPGetObjectReferencesPolicy ) / sizeof( TMTPRequestElementInfo ), + KMTPGetObjectReferencesPolicy ) + { + PRINT( _L( "Operation: GetObjectReferences(0x9810)" ) ); + } + +// ----------------------------------------------------------------------------- +// CGetObjectReferences::ServiceL +// GetObjectInfo request handler +// ----------------------------------------------------------------------------- +// +void CGetObjectReferences::ServiceL() + { + PRINT( _L( "MM MTP => CGetObjectReferences::ServiceL" ) ); + + TUint32 objectHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); + PRINT1( _L( "MM MTP <> CGetObjectReferences::ServiceL objectHandle = 0x%x" ), + objectHandle ); + MMTPReferenceMgr& referenceMgr = iFramework.ReferenceMgr(); + delete iReferences; + iReferences = NULL; + iReferences = referenceMgr.ReferencesLC( TMTPTypeUint32( objectHandle ) ); + CleanupStack::Pop( iReferences ); + SendDataL( *iReferences ); + +#if _DEBUG + TUint32 handle = 0; + TUint count = iReferences->NumElements(); + PRINT1( _L( "MM MTP <> CGetObjectReferences::ServiceL count = %d" ), count ); + CMTPObjectMetaData* object = NULL; + for( TUint i = 0; i < count; i++ ) + { + object = CMTPObjectMetaData::NewLC(); // + object + handle = iReferences->ElementUint( i ); + PRINT1( _L( "MM MTP <> CGetObjectReferences::ServiceL handle = 0x%x" ), handle ); + iFramework.ObjectMgr().ObjectL( handle, *object); + PRINT1( _L( "MM MTP <> CGetObjectReferences::ServiceL object file name is %S" ), &object->DesC( CMTPObjectMetaData::ESuid ) ); + CleanupStack::PopAndDestroy( object ); // - object + TMTPTypeUint128 puoid; + puoid.Set( 0, 0 ); + puoid = iFramework.ObjectMgr().PuidL( handle ); + PRINT1( _L( "MM MTP <> CGetObjectReferences::ServiceL higher value of puoid = 0x%04Lx" ), puoid.UpperValue() ); + PRINT1( _L( "MM MTP <> CGetObjectReferences::ServiceL lower value of puoid = 0x%04Lx" ), puoid.LowerValue() ); + } +#endif + + PRINT( _L( "MM MTP <= CGetObjectReferences::ServiceL" ) ); + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cgetpartialobject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cgetpartialobject.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,240 @@ +/* +* 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: Implement the operation: GetPartialObject +* +*/ + + +#include +#include +#include + +#include "cgetpartialobject.h" +#include "mmmtpdplogger.h" +#include "tmmmtpdppanic.h" +#include "ttypeflatbuf.h" +#include "mmmtpdpconfig.h" + +/** +* Verification data for the GetPartialObject request +*/ +const TMTPRequestElementInfo KMTPGetPartialObjectPolicy[] = + { + {TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, EMTPElementAttrFile, 0, 0, 0} + }; + +// ----------------------------------------------------------------------------- +// CGetPartialObject::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +EXPORT_C MMmRequestProcessor* CGetPartialObject::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + CGetPartialObject* self = new (ELeave) CGetPartialObject( aFramework, aConnection ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CGetPartialObject::~CGetPartialObject() +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGetPartialObject::~CGetPartialObject() + { + delete iBuffer; + delete iPartialData; + delete iFileObject; + } + +// ----------------------------------------------------------------------------- +// CGetPartialObject::CGetPartialObject +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CGetPartialObject::CGetPartialObject( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection ) : + CRequestProcessor( aFramework, + aConnection, + sizeof( KMTPGetPartialObjectPolicy ) / sizeof( TMTPRequestElementInfo ), + KMTPGetPartialObjectPolicy ), + iFramework ( aFramework ), + iFs( iFramework.Fs() ), + iBufferPtr8( NULL, 0 ) + { + PRINT( _L( "Operation: GetPartialObject(0x101B)" ) ); + } + +// ----------------------------------------------------------------------------- +// CGetPartialObject::CheckRequestL +// Check the GetPartialObject reqeust +// ----------------------------------------------------------------------------- +// +EXPORT_C TMTPResponseCode CGetPartialObject::CheckRequestL() + { + PRINT( _L( "MM MTP => CGetPartialObject::CheckRequestL" ) ); + TMTPResponseCode result = CRequestProcessor::CheckRequestL(); + if( result == EMTPRespCodeOK && !VerifyParametersL() ) + { + result = EMTPRespCodeInvalidParameter; + } + + PRINT1( _L( "MM MTP <= CGetPartialObject::CheckRequestL result = ox%x" ), result ); + return result; + } + +// ----------------------------------------------------------------------------- +// CGetPartialObject::VerifyParametersL +// Verify if the parameter of the request (i.e. offset) is good. +// ----------------------------------------------------------------------------- +// +TBool CGetPartialObject::VerifyParametersL() + { + PRINT( _L( "MM MTP => CGetPartialObject::VerifyParametersL" ) ); + __ASSERT_DEBUG( iRequestChecker, Panic( EMmMTPDpRequestCheckNull ) ); + TBool result = EFalse; + iObjectHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); + PRINT1( _L( "MM MTP <> CGetPartialObject::VerifyParametersL iObjectHandle = 0x%x" ), iObjectHandle ); + iOffset = Request().Uint32( TMTPTypeRequest::ERequestParameter2 ); + PRINT1( _L( "MM MTP <> CGetPartialObject::VerifyParametersL iOffset = %d" ), iOffset ); + TUint32 maxLength = Request().Uint32( TMTPTypeRequest::ERequestParameter3 ); + PRINT1( _L( "MM MTP <> CGetPartialObject::VerifyParametersL maxLength = %d" ), maxLength ); + + //get object info, but do not have the ownship of the object + CMTPObjectMetaData* objectInfo = iRequestChecker->GetObjectInfo( iObjectHandle ); + __ASSERT_DEBUG( objectInfo, Panic( EMmMTPDpObjectNull ) ); + + const TDesC& suid( objectInfo->DesC( CMTPObjectMetaData::ESuid ) ); + PRINT1( _L( "MM MTP <> CGetPartialObject::VerifyParametersL suid = %S" ), &suid ); + + if ( objectInfo->Uint( CMTPObjectMetaData::EDataProviderId ) + == iFramework.DataProviderId() ) + result = ETrue; + + TEntry fileEntry; + User::LeaveIfError( iFs.Entry( suid, fileEntry ) ); + TInt64 fileSize = fileEntry.iSize; + if( ( iOffset < fileEntry.iSize ) && result ) + { + if ( maxLength == fileSize ) + { + iCompleteFile = ETrue; + } + + if( iOffset + maxLength > fileSize ) + { + maxLength = fileSize - iOffset; + } + iPartialDataLength = maxLength; + result = ETrue; + } + PRINT1( _L( "MM MTP <> CGetPartialObject::VerifyParametersL iPartialDataLength = %d" ), iPartialDataLength ); + + PRINT1( _L( "MM MTP <= CGetPartialObject::VerifyParametersL result = %d" ), result ); + return result; + } + +// ----------------------------------------------------------------------------- +// CGetPartialObject::ServiceL +// GetPartialObject request handler +// ----------------------------------------------------------------------------- +// +EXPORT_C void CGetPartialObject::ServiceL() + { + PRINT( _L( "MM MTP => CGetPartialObject::ServiceL" ) ); + // Get file information + CMTPObjectMetaData* objectInfo = iRequestChecker->GetObjectInfo( iObjectHandle ); + __ASSERT_DEBUG( objectInfo, Panic( EMmMTPDpObjectNull ) ); + iFileSuid.SetLength( 0 ); + iFileSuid.Append( objectInfo->DesC( CMTPObjectMetaData::ESuid ) ); + + if ( iCompleteFile ) + { + // Pass the complete file back to the host + delete iFileObject; + iFileObject = NULL; + iFileObject = CMTPTypeFile::NewL( iFramework.Fs(), iFileSuid, EFileRead ); + SendDataL( *iFileObject ); + } + else + { + // Send partial file fragment back. + BuildPartialDataL(); + delete iPartialData; + iPartialData = NULL; + iPartialData = new (ELeave) TMTPTypeFlatBuf( iBufferPtr8 ); + SendDataL( *iPartialData ); + } + PRINT( _L( "MM MTP <= CGetPartialObject::ServiceL" ) ); + } + +// ----------------------------------------------------------------------------- +// CGetPartialObject::DoHandleResponsePhaseL +// Signal to the initiator how much data has been sent +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CGetPartialObject::DoHandleResponsePhaseL() + { + PRINT( _L( "MM MTP => CGetPartialObject::DoHandleResponsePhaseL" ) ); + TUint32 dataLength = iPartialDataLength; + PRINT1( _L( "MM MTP <> CGetPartialObject::DoHandleResponsePhaseL dataLength = %d" ), dataLength ); + SendResponseL( EMTPRespCodeOK, 1, &dataLength ); + PRINT( _L( "MM MTP <= CGetPartialObject::DoHandleResponsePhaseL" ) ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CGetPartialObject::ConstructL() +// Second-phase construction +// ----------------------------------------------------------------------------- +// +void CGetPartialObject::ConstructL() + { + SetPSStatus(); + } + +// ----------------------------------------------------------------------------- +// CGetPartialObject::BuildPartialDataL() +// Populate the partial data object +// ----------------------------------------------------------------------------- +// +void CGetPartialObject::BuildPartialDataL() + { + PRINT( _L( "MM MTP => CGetPartialObject::BuildPartialDataL" ) ); + __ASSERT_DEBUG( iRequestChecker, Panic( EMmMTPDpRequestCheckNull ) ); + + if ( iBuffer ) + { + delete iBuffer; + iBuffer = NULL; + } + + // We might fail if we have insufficient memory... + iBuffer = HBufC8::NewL( iPartialDataLength ); + iBuffer->Des().Zero(); + iBufferPtr8.Set( iBuffer->Des() ); + + RFile file; + User::LeaveIfError( file.Open( iFs, iFileSuid, EFileRead ) ); + CleanupClosePushL( file ); // + file + User::LeaveIfError( file.Read( iOffset, iBufferPtr8, iPartialDataLength ) ); + CleanupStack::PopAndDestroy( &file ); // - file + PRINT( _L( "MM MTP <= CGetPartialObject::BuildPartialDataL" ) ); + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cmoveobject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cmoveobject.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,849 @@ +/* +* 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: Implement the operation: MoveObject +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cmoveobject.h" +#include "mmmtpdplogger.h" +#include "tmmmtpdppanic.h" +#include "mmmtpdputility.h" +#include "cmmmtpdpmetadataaccesswrapper.h" +#include "mmmtpdpconfig.h" + +/** +* Verification data for the MoveObject request +*/ +const TMTPRequestElementInfo KMTPMoveObjectPolicy[] = + { + { + TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, + EMTPElementAttrFileOrDir | EMTPElementAttrWrite, 0, 0, 0 + }, + { + TMTPTypeRequest::ERequestParameter2, EMTPElementTypeStorageId, + EMTPElementAttrWrite, 0, 0, 0 + }, + { + TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, + EMTPElementAttrDir | EMTPElementAttrWrite, 1, 0, 0 + } + }; + +// ----------------------------------------------------------------------------- +// CMoveObject::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +//EXPORT_C MMmRequestProcessor* CMoveObject::NewL( MMTPDataProviderFramework& aFramework, +// MMTPConnection& aConnection, +// CMmMtpDpMetadataAccessWrapper& aWrapper ) +// { +// CMoveObject* self = new (ELeave) CMoveObject( aFramework, aConnection, aWrapper ); +// CleanupStack::PushL( self ); +// self->ConstructL(); +// CleanupStack::Pop( self ); +// +// return self; +// } + +// ----------------------------------------------------------------------------- +// CMoveObject::~CMoveObject +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CMoveObject::~CMoveObject() + { + Cancel(); + + delete iDest; + delete iFileMan; + delete iPathToMove; + delete iNewRootFolder; + iObjectHandles.Close(); + if ( iPropertyElement ) + delete iPropertyElement; + delete iPropertyList; + } + +// ----------------------------------------------------------------------------- +// CMoveObject::CMoveObject +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CMoveObject::CMoveObject( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig) : + CRequestProcessor( aFramework, aConnection, sizeof( KMTPMoveObjectPolicy ) + /sizeof( TMTPRequestElementInfo ), KMTPMoveObjectPolicy), + iDpConfig( aDpConfig ), + iObjectHandles( KMmMtpRArrayGranularity ), + iMoveObjectIndex( 0 ) + { + PRINT( _L( "Operation: MoveObject(0x1019)" ) ); + } + +// ----------------------------------------------------------------------------- +// CMoveObject::ServiceL +// MoveObject request handler +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMoveObject::ServiceL() + { + PRINT( _L( "MM MTP => CMoveObject::ServiceL" ) ); + TMTPResponseCode ret = MoveObjectL(); + PRINT1( _L( "MM MTP <> CMoveObject::ServiceL ret = 0x%x" ), ret ); + if ( EMTPRespCodeOK != ret ) + { + SendResponseL( ret ); + } + PRINT( _L( "MM MTP <= CMoveObject::ServiceL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMoveObject::ConstructL +// Second phase constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMoveObject::ConstructL() + { + CActiveScheduler::Add( this ); + + iPropertyList = CMTPTypeObjectPropList::NewL(); + SetPSStatus(); + } + +// ----------------------------------------------------------------------------- +// CMoveObject::RunL +// +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMoveObject::RunL() + { + PRINT( _L( "MM MTP => CMoveObject::RunL" ) ); + if ( MoveOwnedObjectsL() ) + { + // Reset iMoveObjectIndex count since move completed + iMoveObjectIndex = 0; + + TMTPResponseCode ret = EMTPRespCodeOK; + // Delete the original folders in the device dp. + if ( iObjectInfo->Uint( CMTPObjectMetaData::EDataProviderId ) + == iFramework.DataProviderId() ) + { + ret = FinalPhaseMove(); + } + PRINT1( _L("MM MTP <> CMoveObject::RunL ret = 0x%x"), ret ); + SendResponseL( ret ); + } + PRINT( _L( "MM MTP <= CMoveObject::RunL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMoveObject::RunError +// +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CMoveObject::RunError( TInt aError ) + { + if ( aError != KErrNone ) + PRINT1( _L( "MM MTP <> CMoveObject::RunError aError = %d" ), aError ); + TRAP_IGNORE( SendResponseL( EMTPRespCodeGeneralError ) ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMoveObject::MoveFileL +// A helper function of MoveObjectL +// ----------------------------------------------------------------------------- +// +void CMoveObject::MoveFileL( const TDesC& aNewFileName ) + { + PRINT1( _L( "MM MTP => CMoveObject::MoveFileL aNewFileName = %S" ), &aNewFileName ); + const TDesC& suid( iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); + TFileName oldFileName( suid ); // save the old file name, the suid will be modified + PRINT1( _L( "MM MTP <> CMoveObject::MoveFileL oldFileName = %S" ), &suid ); + + if ( iStorageId == iObjectInfo->Uint( CMTPObjectMetaData::EStorageId ) ) + iSameStorage = ETrue; + else + iSameStorage = EFalse; + GetPreviousPropertiesL( *iObjectInfo ); + User::LeaveIfError( iFileMan->Move( suid, aNewFileName ) ); // iDest just Folder + User::LeaveIfError( iFramework.Fs().SetModified( aNewFileName, iPreviousModifiedTime ) ); + + iObjectInfo->SetDesCL( CMTPObjectMetaData::ESuid, aNewFileName ); + iObjectInfo->SetUint( CMTPObjectMetaData::EStorageId, iStorageId ); + iObjectInfo->SetUint( CMTPObjectMetaData::EParentHandle, iNewParentHandle ); + iFramework.ObjectMgr().ModifyObjectL( *iObjectInfo ); + SetPropertiesL( oldFileName, aNewFileName, *iObjectInfo ); + PRINT( _L( "MM MTP <= CMoveObject::MoveFileL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMoveObject::MoveOwnedObjectsL +// Move the objects through iterations of RunL +// ----------------------------------------------------------------------------- +// +TBool CMoveObject::MoveOwnedObjectsL() + { + PRINT( _L( "MM MTP => CMoveObject::MoveOwnedObjectsL" ) ); + TBool ret = EFalse; + + if ( iMoveObjectIndex < iNumberOfObjects ) + { + MoveAndUpdateL( iObjectHandles[iMoveObjectIndex++] ); + + TRequestStatus* status = &iStatus; + User::RequestComplete( status, iStatus.Int() ); + SetActive(); + } + else + { + ret = ETrue; + } + + PRINT1( _L( "MM MTP <= CMoveObject::MoveOwnedObjectsL ret = %d" ), ret ); + return ret; + } + +// ----------------------------------------------------------------------------- +// CMoveObject::MoveFolderL +// A helper function of MoveObjectL +// ----------------------------------------------------------------------------- +// +void CMoveObject::MoveFolderL() + { + PRINT( _L( "MM MTP => CMoveObject::MoveFolderL" ) ); + RBuf oldFolderName; + oldFolderName.CreateL( KMaxFileName ); + oldFolderName.CleanupClosePushL(); // + oldFileName + oldFolderName = iObjectInfo->DesC( CMTPObjectMetaData::ESuid ); + PRINT1( _L( "MM MTP <> CMoveObject::MoveFolderL oldFolderName = %S" ), &oldFolderName ); + iPathToMove = oldFolderName.AllocL(); + CleanupStack::PopAndDestroy( &oldFolderName ); // - oldFolderName + + GenerateObjectHandleListL( iObjectInfo->Uint( CMTPObjectMetaData::EHandle ) ); + + iNumberOfObjects = iObjectHandles.Count(); + PRINT1( _L( "MM MTP <> CMoveObject::MoveFolderL iNumberOfObjects = %d" ), iNumberOfObjects ); + + TRequestStatus* status = &iStatus; + User::RequestComplete( status, iStatus.Int() ); + SetActive(); + + PRINT( _L( "MM MTP <= CMoveObject::MoveFolderL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMoveObject::MoveObjectL +// move object operations +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CMoveObject::MoveObjectL() + { + PRINT( _L( "MM MTP => CMoveObject::MoveObjectL" ) ); + TMTPResponseCode responseCode = EMTPRespCodeOK; + + GetParametersL(); + + RBuf newObjectName; + newObjectName.CreateL( KMaxFileName ); + newObjectName.CleanupClosePushL(); // + newObjectName + newObjectName = *iDest; + + const TDesC& suid( iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); + TParsePtrC fileNameParser( suid ); + + // Check if the object is a folder or a file. + TBool isFolder = EFalse; + User::LeaveIfError( BaflUtils::IsFolder( iFramework.Fs(), suid, isFolder ) ); + + if ( !isFolder ) + { + if ( ( newObjectName.Length() + fileNameParser.NameAndExt().Length() ) <= newObjectName.MaxLength() ) + { + newObjectName.Append( fileNameParser.NameAndExt() ); + } + responseCode = CanMoveObjectL( suid, newObjectName ); + } + else // It is a folder. + { + TFileName rightMostFolderName; + User::LeaveIfError( BaflUtils::MostSignificantPartOfFullName( suid, + rightMostFolderName ) ); + if ( ( newObjectName.Length() + rightMostFolderName.Length() + 1 ) <= newObjectName.MaxLength() ) + { + newObjectName.Append( rightMostFolderName ); + // Add backslash. + _LIT( KBackSlash, "\\" ); + newObjectName.Append( KBackSlash ); + } + } + + iNewRootFolder = newObjectName.AllocL(); + + if ( responseCode == EMTPRespCodeOK ) + { + delete iFileMan; + iFileMan = NULL; + iFileMan = CFileMan::NewL( iFramework.Fs() ); + + if ( !isFolder ) + { + MoveFileL( newObjectName ); + SendResponseL( responseCode ); + } + else + { + MoveFolderL(); + } + } + CleanupStack::PopAndDestroy( &newObjectName ); // - newObjectName. + + PRINT1( _L( "MM MTP <= CMoveObject::MoveObjectL responseCode = 0x%x" ), responseCode ); + return responseCode; + } + +// ----------------------------------------------------------------------------- +// CMoveObject::GetParametersL +// Retrieve the parameters of the request +// ----------------------------------------------------------------------------- +// +void CMoveObject::GetParametersL() + { + PRINT( _L( "MM MTP => CMoveObject::GetParametersL" ) ); + __ASSERT_DEBUG( iRequestChecker, Panic( EMmMTPDpRequestCheckNull ) ); + + TUint32 objectHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); + iStorageId = Request().Uint32( TMTPTypeRequest::ERequestParameter2 ); + iNewParentHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter3 ); + PRINT3( _L( "MM MTP <> objectHandle = 0x%x, iStoargeId = 0x%x, iNewParentHandle = 0x%x" ), + objectHandle, iStorageId, iNewParentHandle ); + + // not taking owernship + iObjectInfo = iRequestChecker->GetObjectInfo( objectHandle ); + __ASSERT_DEBUG( iObjectInfo, Panic( EMmMTPDpObjectNull ) ); + + if ( iNewParentHandle == 0 ) + { + SetDefaultParentObjectL(); + } + else + { + CMTPObjectMetaData* parentObjectInfo = + iRequestChecker->GetObjectInfo( iNewParentHandle ); + __ASSERT_DEBUG( parentObjectInfo, Panic( EMmMTPDpObjectNull ) ); + delete iDest; + iDest = NULL; + iDest = parentObjectInfo->DesC( CMTPObjectMetaData::ESuid ).AllocL(); + PRINT1( _L( "MM MTP <> CMoveObject::GetParametersL iDest = %S" ), iDest ); + } + PRINT( _L( "MM MTP <= CMoveObject::GetParametersL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMoveObject::SetDefaultParentObjectL +// Get a default parent object, ff the request does not specify a parent object, +// ----------------------------------------------------------------------------- +// +void CMoveObject::SetDefaultParentObjectL() + { + PRINT( _L( "MM MTP => CMoveObject::SetDefaultParentObjectL" ) ); + + delete iDest; + iDest = NULL; + iDest = ( iFramework.StorageMgr().StorageL( iStorageId ).DesC( + CMTPStorageMetaData::EStorageSuid ) ).AllocL(); + PRINT1( _L( "MM MTP <> CMoveObject::SetDefaultParentObjectL iDest = %S" ), iDest ); + iNewParentHandle = KMTPHandleNoParent; + PRINT( _L( "MM MTP <= CMoveObject::SetDefaultParentObjectL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMoveObject::CanMoveObjectL +// Check if we can move the file to the new location +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CMoveObject::CanMoveObjectL( const TDesC& aOldName, + const TDesC& aNewName ) const + { + PRINT( _L( "MM MTP => CMoveObject::CanMoveObjectL" ) ); + TMTPResponseCode result = EMTPRespCodeOK; + + TEntry fileEntry; + User::LeaveIfError( iFramework.Fs().Entry( aOldName, fileEntry ) ); + TDriveNumber drive( static_cast( iFramework.StorageMgr().DriveNumber( iStorageId ) ) ); + User::LeaveIfError( drive ); + TVolumeInfo volumeInfo; + User::LeaveIfError( iFramework.Fs().Volume( volumeInfo, drive ) ); + + if ( volumeInfo.iFree < fileEntry.iSize ) + { + result = EMTPRespCodeStoreFull; + } + else if ( BaflUtils::FileExists( iFramework.Fs(), aNewName ) ) + { +#ifdef MMMTPDP_REPLACE_EXIST_FILE + // delete the old one and replace + TInt delErr = iFramework.Fs().Delete( aNewName ); + PRINT1( _L( "MM MTP <> CMoveObject::CanMoveObjectL delErr = %d" ), delErr ); + // delete from the metadata DB + TRAPD( err, iFramework.ObjectMgr().RemoveObjectL( aNewName ) ); + PRINT1( _L( "MM MTP <> CMoveObject::CanMoveObjectL err = %d" ), err ); + // delete from video/mpx DB + CMTPObjectMetaData* objectInfo = CMTPObjectMetaData::NewLC(); // + objectInfo + if ( iFramework.ObjectMgr().ObjectL( aNewName, *objectInfo ) ) + { + TRAP( err, iDpConfig.GetWrapperL().DeleteObjectL( aNewName, + objectInfo->Uint( CMTPObjectMetaData::EFormatCode ) ) ); + } + CleanupStack::PopAndDestroy( objectInfo ); // - objectInfo + if ( err ) + { + // do nothing + } +#else + result = EMTPRespCodeInvalidParentObject; +#endif + } + + PRINT1( _L( "MM MTP <= CMoveObject::CanMoveObjectL result = 0x%x" ), result ); + return result; + } + +// ----------------------------------------------------------------------------- +// CMoveObject::GetPreviousPropertiesL +// Save the object properties before doing the move +// ----------------------------------------------------------------------------- +// +void CMoveObject::GetPreviousPropertiesL( const CMTPObjectMetaData& aObject ) + { + PRINT( _L( "MM MTP => CMoveObject::GetPreviousPropertiesL" ) ); + + const TDesC& suid( aObject.DesC( CMTPObjectMetaData::ESuid ) ); + + User::LeaveIfError( iFramework.Fs().Modified( suid, iPreviousModifiedTime ) ); + + // same storage, not necessary to get the properties + if ( iSameStorage ) + return; + + TUint formatCode = aObject.Uint( CMTPObjectMetaData::EFormatCode ); + const RArray* properties = iDpConfig.GetSupportedPropertiesL( formatCode ); + TInt count = properties->Count(); + CMTPTypeString* textData = NULL; + TInt err = KErrNone; + TUint16 propCode; + TUint32 handle = aObject.Uint( CMTPObjectMetaData::EHandle ) ; + + if ( iPropertyElement ) + { + delete iPropertyElement; + iPropertyElement = NULL; + } + + for ( TInt i = 0; i < count; i++ ) + { + propCode = (*properties)[i]; + switch( propCode ) + { + case EMTPObjectPropCodeStorageID: + case EMTPObjectPropCodeObjectFormat: + case EMTPObjectPropCodeProtectionStatus: + case EMTPObjectPropCodeObjectSize: + case EMTPObjectPropCodeObjectFileName: + case EMTPObjectPropCodeParentObject: + case EMTPObjectPropCodePersistentUniqueObjectIdentifier: + case EMTPObjectPropCodeNonConsumable: + case EMTPObjectPropCodeDateCreated: + case EMTPObjectPropCodeDateModified: + break; + + case EMTPObjectPropCodeName: + case EMTPObjectPropCodeDateAdded: + if ( ( propCode == EMTPObjectPropCodeName ) + || ( ( !MmMtpDpUtility::IsVideoL( aObject.DesC( CMTPObjectMetaData::ESuid ), iFramework ) ) + && ( propCode == EMTPObjectPropCodeDateAdded ) ) ) + { + textData = CMTPTypeString::NewLC(); // + textData + + TRAP( err, iDpConfig.GetWrapperL().GetObjectMetadataValueL( propCode, + *textData, + aObject ) ); + + PRINT1( _L( "MM MTP <> CMoveObject::GetPreviousPropertiesL::ServiceSpecificObjectPropertyL err = %d" ), err ); + + if ( err == KErrNone ) + { + iPropertyElement = &(iPropertyList->ReservePropElemL(handle, propCode)); + iPropertyElement->SetStringL(CMTPTypeObjectPropListElement::EValue, textData->StringChars()); +// iPropertyElement = CMTPTypeObjectPropListElement::NewL( +// handle, propCode, *textData ); + } + else if ( err == KErrNotFound ) + { + iPropertyElement = NULL; + } + else + { + User::Leave( err ); + } + + CleanupStack::PopAndDestroy( textData ); // - textData + } + break; + + default: + { + ServiceGetSpecificObjectPropertyL( propCode, handle, aObject ); + } + break; + } + + if ( iPropertyElement ) + { + iPropertyList->CommitPropElemL( *iPropertyElement ); + + iPropertyElement = NULL; + } + + } // end of for loop + + PRINT1( _L( "MM MTP <= CMoveObject::GetPreviousPropertiesL err = %d" ), err ); + } + +// ----------------------------------------------------------------------------- +// CMoveObject::ServiceMetaDataToWrapper +// +// ----------------------------------------------------------------------------- +// +EXPORT_C TMTPResponseCode CMoveObject::ServiceMetaDataToWrapper( + const TUint16 aPropCode, + MMTPType& aNewData, + const CMTPObjectMetaData& aObject ) + { + TMTPResponseCode resCode = EMTPRespCodeOK; + + TRAPD( err, iDpConfig.GetWrapperL().SetObjectMetadataValueL( aPropCode, + aNewData, + aObject ) ); + + PRINT1( _L("MM MTP <> CMoveObject::ServiceMetaDataToWrapper err = %d"), err); + + if ( err == KErrNone ) + { + resCode = EMTPRespCodeOK; + } + else if ( err == KErrTooBig ) + // according to the codes of S60 + { + resCode = EMTPRespCodeInvalidDataset; + } + else if ( err == KErrPermissionDenied ) + { + resCode = EMTPRespCodeAccessDenied; + } + else if ( err == KErrNotFound ) + { + if ( MmMtpDpUtility::HasMetadata( aObject.Uint( CMTPObjectMetaData::EFormatCode ) ) ) + resCode = EMTPRespCodeAccessDenied; + else + resCode = EMTPRespCodeOK; + } + else + { + resCode = EMTPRespCodeGeneralError; + } + + PRINT1( _L("MM MTP <= CMoveObject::ServiceMetaDataToWrapper resCode = 0x%x"), resCode); + + return resCode; + } + +// ----------------------------------------------------------------------------- +// CMoveObject::SetPreviousPropertiesL +// Set the object properties after doing the move +// ----------------------------------------------------------------------------- +// +void CMoveObject::SetPreviousPropertiesL( const CMTPObjectMetaData& aObject ) + { + PRINT( _L( "MM MTP => CMoveObject::SetPreviousPropertiesL" ) ); + const TInt count( iPropertyList->NumberOfElements() ); + PRINT1( _L( "MM MTP <> CMoveObject::SetPreviousPropertiesL count = %d" ), count ); + TMTPResponseCode respcode = EMTPRespCodeOK; + CMTPTypeString* stringData = NULL; + iPropertyList->ResetCursor(); + + for ( TInt i = 0; i < count; i++ ) + { + CMTPTypeObjectPropListElement& element = iPropertyList->GetNextElementL( ); + + TUint32 handle = element.Uint32L( + CMTPTypeObjectPropListElement::EObjectHandle ); + TUint16 propertyCode = element.Uint16L( + CMTPTypeObjectPropListElement::EPropertyCode ); + TUint16 dataType = element.Uint16L( + CMTPTypeObjectPropListElement::EDatatype ); + PRINT3( _L( "MM MTP <> CMoveObject::SetPreviousPropertiesL = 0x%x, propertyCode = 0x%x, dataType = 0x%x" ), + handle, propertyCode, dataType ); + + switch ( propertyCode ) + { + case EMTPObjectPropCodeStorageID: + case EMTPObjectPropCodeObjectFormat: + case EMTPObjectPropCodeProtectionStatus: + case EMTPObjectPropCodeObjectSize: + case EMTPObjectPropCodeObjectFileName: + case EMTPObjectPropCodeParentObject: + case EMTPObjectPropCodePersistentUniqueObjectIdentifier: + case EMTPObjectPropCodeNonConsumable: + case EMTPObjectPropCodeDateCreated: + case EMTPObjectPropCodeDateModified: + case EMTPObjectPropCodeDateAdded: + break; + + case EMTPObjectPropCodeName: + { + stringData = CMTPTypeString::NewLC( + element.StringL(CMTPTypeObjectPropListElement::EValue)); // + stringData + + respcode = ServiceMetaDataToWrapper( propertyCode, + *stringData, + aObject ); + + CleanupStack::PopAndDestroy( stringData ); // - stringData + } + break; + + default: + { + respcode = ServiceSetSpecificObjectPropertyL( propertyCode, + aObject, + element ); + } + break; + } + } // end of for loop + + if( respcode == EMTPRespCodeOK ) + { + // do nothing, ignore warning + } + + PRINT1( _L( "MM MTP <= CMoveObject::SetPreviousPropertiesL respcode = 0x%x" ), respcode ); + } + +// ----------------------------------------------------------------------------- +// CMoveObject::SetPropertiesL +// Set the object properties in the object property store. +// ----------------------------------------------------------------------------- +// +void CMoveObject::SetPropertiesL( const TDesC& aOldFileName, const TDesC& aNewFileName, + const CMTPObjectMetaData& aNewObject ) + { + PRINT2( _L( "MM MTP => CMoveObject::SetPropertiesL aOldFileName = %S, aNewFileName = %S" ), + &aOldFileName, &aNewFileName ); + + TUint32 formatCode = aNewObject.Uint( CMTPObjectMetaData::EFormatCode ); + // This is used to keep the same behavior in mass storage and device file manager. + if ( formatCode == EMTPFormatCodeAbstractAudioVideoPlaylist ) + { + PRINT( _L( "MM MTP <> CMoveObject::SetPropertiesL Playlist file do not update the MPX DB" ) ); + } + else + { + // if the two object in different stoarge, we should delete the old one and insert new one + if ( iSameStorage ) + iDpConfig.GetWrapperL().RenameObjectL( aOldFileName, aNewFileName ); + else + { + iDpConfig.GetWrapperL().DeleteObjectL( aOldFileName, formatCode ); + iDpConfig.GetWrapperL().AddObjectL( aNewFileName ); + SetPreviousPropertiesL( aNewObject ); + } + } + + // Reference DB is used PUID +// if ( formatCode == EMTPFormatCodeAbstractAudioVideoPlaylist +// || formatCode == EMTPFormatCodeM3UPlaylist ) +// { +// MMTPReferenceMgr& referenceMgr = iFramework.ReferenceMgr(); +// CDesCArray* references = referenceMgr.ReferencesLC( aOldFileName ); // + references +// referenceMgr.SetReferencesL( aNewFileName, *references ); +// CleanupStack::PopAndDestroy( references ); // - references +// // delete the old references +// referenceMgr.RemoveReferencesL( aOldFileName ); +// } + + + PRINT( _L( "MM MTP <= CMoveObject::SetPropertiesL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMoveObject::FinalPhaseMove +// This function will actually delete the orginal folders from the file system +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CMoveObject::FinalPhaseMove() + { + PRINT( _L( "MM MTP => CMoveObject::FinalPhaseMove" ) ); + TMTPResponseCode ret = EMTPRespCodeOK; + + TInt rel = iFileMan->RmDir( *iPathToMove ); + PRINT1( _L( "MM MTP <> CMoveObject::FinalPhaseMove rel = %d" ), rel ); + + if ( rel != KErrNone ) + { + ret = EMTPRespCodeGeneralError; + } + + PRINT1( _L( "MM MTP <= CMoveObject::FinalPhaseMove ret = 0x%x" ), ret ); + return ret; + } + +// ----------------------------------------------------------------------------- +// CMoveObject::GenerateObjectHandleListL +// Generate the list of handles that need to be moved to the new location +// ----------------------------------------------------------------------------- +// +void CMoveObject::GenerateObjectHandleListL( TUint32 aParentHandle ) + { + PRINT1( _L( "MM MTP => CMoveObject::GenerateObjectHandleListL aParentHandle = 0x%x" ), aParentHandle ); + RMTPObjectMgrQueryContext context; + RArray handles; + TMTPObjectMgrQueryParams params( KMTPStorageAll, KMTPFormatsAll, + aParentHandle ); + CleanupClosePushL( context ); // + context + CleanupClosePushL( handles ); // - handles + + do + { + iFramework.ObjectMgr().GetObjectHandlesL( params, context, handles ); + + TInt numberOfObjects = handles.Count(); + for ( TInt i = 0; i < numberOfObjects; i++ ) + { + if ( iFramework.ObjectMgr().ObjectOwnerId( handles[i] ) == iFramework.DataProviderId() ) + { + iObjectHandles.AppendL( handles[i] ); + continue; + } + + // Folder + if ( iFramework.ObjectMgr().ObjectOwnerId( handles[i] ) == 0 ) // We know that the device dp id is always 0, otherwise the whole MTP won't work. + { + GenerateObjectHandleListL( handles[i] ); + } + } + } + while ( !context.QueryComplete() ); + + CleanupStack::PopAndDestroy( &handles ); // - handles + CleanupStack::PopAndDestroy( &context ); // - contect + + PRINT( _L( "MM MTP <= CMoveObject::GenerateObjectHandleListL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMoveObject::MoveAndUpdateL +// Move a single object and update the database +// ----------------------------------------------------------------------------- +// +void CMoveObject::MoveAndUpdateL( TUint32 aObjectHandle ) + { + PRINT1( _L( "MM MTP => CMoveObject::MoveAndUpdateL aObjectHanlde = 0x%x" ), aObjectHandle ); + + CMTPObjectMetaData* objectInfo( CMTPObjectMetaData::NewLC() ); // + objectInfo + + RBuf fileName; + fileName.CreateL( KMaxFileName ); + fileName.CleanupClosePushL(); // + fileName + + RBuf rightPartName; + rightPartName.CreateL( KMaxFileName ); + rightPartName.CleanupClosePushL(); // + rightPartName + + RBuf oldName; + oldName.CreateL( KMaxFileName ); + oldName.CleanupClosePushL(); // + oldName + + if ( iFramework.ObjectMgr().ObjectL( TMTPTypeUint32( aObjectHandle ), *objectInfo ) ) + { + fileName = objectInfo->DesC( CMTPObjectMetaData::ESuid ); + oldName = fileName; + + if ( objectInfo->Uint( CMTPObjectMetaData::EDataProviderId ) + == iFramework.DataProviderId() ) + { + rightPartName = fileName.Right( fileName.Length() - iPathToMove->Length() ); + + if ( ( iNewRootFolder->Length() + rightPartName.Length() ) > fileName.MaxLength() ) + { + User::Leave( KErrCorrupt ); + } + + fileName.Zero(); + fileName.Append( *iNewRootFolder ); + fileName.Append( rightPartName ); + PRINT1( _L( "MM MTP <> MoveAndUpdateL fileName = %S" ), &fileName ); + + if ( iStorageId == objectInfo->Uint( CMTPObjectMetaData::EStorageId ) ) + iSameStorage = ETrue; + else + iSameStorage = EFalse; + GetPreviousPropertiesL( *objectInfo ); + TInt err = iFileMan->Move( oldName, fileName ); + PRINT1( _L( "MM MTP <> CMoveObject::MoveAndUpdateL Move error code = %d" ), err ); + User::LeaveIfError( err ); + User::LeaveIfError( iFramework.Fs().SetModified( fileName, iPreviousModifiedTime ) ); + + objectInfo->SetDesCL( CMTPObjectMetaData::ESuid, fileName ); + objectInfo->SetUint( CMTPObjectMetaData::EStorageId, iStorageId ); + TParsePtrC parentSuid( fileName ); + TUint32 parentHandle = iFramework.ObjectMgr().HandleL( parentSuid.DriveAndPath() ); + objectInfo->SetUint( CMTPObjectMetaData::EParentHandle, parentHandle ); + + //TUint32 parentHandle = iFramework.ObjectMgr().HandleL( parentSuid.DriveAndPath() ); + PRINT1( _L( "MM MTP <> CMoveObject::MoveAndUpdateL parentHandle = 0x%x" ), parentHandle ); + + iFramework.ObjectMgr().ModifyObjectL( *objectInfo ); + + SetPropertiesL( oldName, fileName, *objectInfo ); + } + } + else + { + User::Leave( KErrCorrupt ); + } + + CleanupStack::PopAndDestroy( &oldName ); // - oldName + CleanupStack::PopAndDestroy( &rightPartName ); // - rightPartName + CleanupStack::PopAndDestroy( &fileName ); // - fileName + CleanupStack::PopAndDestroy( objectInfo ); // - objectInfo + PRINT( _L( "MM MTP <= CMoveObject::MoveAndUpdateL" ) ); + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/crenameobject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/crenameobject.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,309 @@ +/* +* 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: Rename Object +* +*/ + + +#include + +#include +#include +#include +#include + +#include "crenameobject.h" +#include "mmmtpdplogger.h" +#include "cmmmtpdpmetadataaccesswrapper.h" +#include "crequestprocessor.h" // refer to KMmMtpRArrayGranularity + +// ----------------------------------------------------------------------------- +// CRenameObject::NewL +// Two phase constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CRenameObject* CRenameObject::NewL( MMTPDataProviderFramework& aFramework, + CMmMtpDpMetadataAccessWrapper& aWrapper ) + { + PRINT( _L( "MM MTP => CRenameObject::NewL" ) ); + + CRenameObject* self = new ( ELeave ) CRenameObject( aFramework, aWrapper ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + PRINT( _L( "MM MTP <= CRenameObject::NewL" ) ); + return self; + } + +// ----------------------------------------------------------------------------- +// CRenameObject::CRenameObject +// Standard C++ Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CRenameObject::CRenameObject( MMTPDataProviderFramework& aFramework, + CMmMtpDpMetadataAccessWrapper& aWrapper ) : + CActive( EPriorityStandard ), + iFramework( aFramework ), + iObjectHandles( KMmMtpRArrayGranularity ), + iWrapper ( aWrapper ) + { + } + +// ----------------------------------------------------------------------------- +// CRenameObject::~CRenameObject +// destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CRenameObject::~CRenameObject() + { + Cancel(); + iObjectHandles.Close(); + delete iObjectInfo; + iOldFileName.Close(); + iRightPartName.Close(); + iFileName.Close(); + iOldFolderFullName.Close(); + iNewFolderName.Close(); + + delete iRenameWaiter; + } + +// ----------------------------------------------------------------------------- +// CRenameObject::StartL +// +// ----------------------------------------------------------------------------- +// +EXPORT_C void CRenameObject::StartL( const TUint32 aParentHandle, + const TDesC& aOldFolderName ) + { + PRINT2( _L( "MM MTP => CRenameObject::StartL aParentHandle(0x%x), aOldFolderName(%S)" ), + aParentHandle, &aOldFolderName); + + iObjectHandles.Reset(); + + GenerateObjectHandleListL( aParentHandle ); + + iCount = iObjectHandles.Count(); + PRINT1( _L( "MM MTP <> CRenameObject::StartL, handle count = %d" ), iCount ); + if ( iCount > 0 ) + { + // get the old/new folder full file name + GetParentSuidL( aParentHandle, aOldFolderName ); + + iIndex = 0; + + TRequestStatus* status = &iStatus; + User::RequestComplete( status, iStatus.Int() ); + SetActive(); + + iRenameWaiter->Start(); + } + + PRINT( _L( "MM MTP <= CRenameObject::StartL" ) ); + } + +// ----------------------------------------------------------------------------- +// CRenameObject::DoCancel() +// Cancel the rename object process +// ----------------------------------------------------------------------------- +// +EXPORT_C void CRenameObject::DoCancel() + { + + } + +// ----------------------------------------------------------------------------- +// CRenameObject::RunL +// +// ----------------------------------------------------------------------------- +// +EXPORT_C void CRenameObject::RunL() + { + PRINT1( _L( "MM MTP => CRenameObject::RunL iIndex = %d" ), iIndex ); + if ( iIndex < iCount ) + { + if ( iFramework.ObjectMgr().ObjectL( iObjectHandles[iIndex], *iObjectInfo ) ) + { + iOldFileName.Zero(); + iOldFileName = iObjectInfo->DesC( CMTPObjectMetaData::ESuid ); + PRINT1( _L( "MM MTP <> CRenameObject::RunL old file name(%S)" ), &iOldFileName ); + + iRightPartName.Zero(); + iRightPartName = iOldFileName.Right( iOldFileName.Length() - iOldFolderFullName.Length() ); + PRINT1( _L( "MM MTP <> CRenameObject::RunL right part name(%S)" ), &iRightPartName ); + + if ( iNewFolderName.Length() + iRightPartName.Length() <= KMaxFileName ) + { + iFileName.Zero(); + iFileName.Append( iNewFolderName ); + iFileName.Append( iRightPartName ); + PRINT1( _L( "MM MTP <> CRenameObject::RunL new file name(%S)" ), &iFileName ); + // update framework metadata DB + iObjectInfo->SetDesCL( CMTPObjectMetaData::ESuid, iFileName ); + iObjectInfo->SetUint( CMTPObjectMetaData::EObjectMetaDataUpdate, 1 ); + iFramework.ObjectMgr().ModifyObjectL( *iObjectInfo ); + + PerformAdditionalActionL(); + } + } + + iIndex++; + + TRequestStatus* status = &iStatus; + User::RequestComplete( status, iStatus.Int() ); + SetActive(); + } + else + { + if( iRenameWaiter->IsStarted() ) + iRenameWaiter->AsyncStop(); + } + + PRINT( _L( "MM MTP <= CRenameObject::RunL" ) ); + } + +// ----------------------------------------------------------------------------- +// CRenameObject::RunError +// +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CRenameObject::RunError( TInt aError ) + { + if ( aError != KErrNone ) + PRINT1( _L( "MM MTP <> CRenameObject::RunError with error %d" ), aError ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CRenameObject::ConstructL +// +// ----------------------------------------------------------------------------- +// +EXPORT_C void CRenameObject::ConstructL() + { + CActiveScheduler::Add( this ); + + iObjectInfo = CMTPObjectMetaData::NewL(); + + iNewFolderName.CreateL( KMaxFileName ); + iOldFolderFullName.CreateL( KMaxFileName ); + iRightPartName.CreateL( KMaxFileName ); + iFileName.CreateL( KMaxFileName ); + iOldFileName.CreateL( KMaxFileName ); + + iRenameWaiter = new( ELeave ) CActiveSchedulerWait; + } + +// ----------------------------------------------------------------------------- +// CRenameObject::GenerateObjectHandleListL +// +// ----------------------------------------------------------------------------- +// +void CRenameObject::GenerateObjectHandleListL( TUint32 aParentHandle ) + { + PRINT1( _L( "MM MTP => CRenameObject::GenerateObjectHandleListL aParentHandle(0x%x)" ), aParentHandle ); + RMTPObjectMgrQueryContext context; + RArray handles; + CleanupClosePushL( context ); // + context + CleanupClosePushL( handles ); // + handles + + TMTPObjectMgrQueryParams params( KMTPStorageAll, KMTPFormatsAll, + aParentHandle ); + do + { + iFramework.ObjectMgr().GetObjectHandlesL( params, context, handles ); + + TInt numberOfObjects = handles.Count(); + for ( TInt i = 0; i < numberOfObjects; i++ ) + { + if ( iFramework.ObjectMgr().ObjectOwnerId( handles[i] ) == iFramework.DataProviderId() ) + { + iObjectHandles.AppendL( handles[i] ); + continue; + } + + // Folder + // TODO: need to modify, should not know device dp id + if ( iFramework.ObjectMgr().ObjectOwnerId( handles[i] ) == 0 ) // We know that the device dp id is always 0, otherwise the whole MTP won't work. + { + GenerateObjectHandleListL( handles[i] ); + } + } + } + while ( !context.QueryComplete() ); + + CleanupStack::PopAndDestroy( &handles ); // - handles + CleanupStack::PopAndDestroy( &context ); // - context + + PRINT( _L( "MM MTP <= CRenameObject::GenerateObjectHandleListL" ) ); + } + +// ----------------------------------------------------------------------------- +// CRenameObject::GetParentSuidL +// Get the full file name of old/new folder +// ----------------------------------------------------------------------------- +// +void CRenameObject::GetParentSuidL( TUint32 aHandle, + const TDesC& aFolderName ) + { + PRINT2( _L( "MM MTP => CRenameObject::GetParentSuidL aHandle(0x%x), aFolderName(%S)" ), + aHandle, &aFolderName ); + CMTPObjectMetaData* objectInfo( CMTPObjectMetaData::NewLC() ); // + objectInfo + // get the old folder suid + if ( iFramework .ObjectMgr().ObjectL( aHandle, *objectInfo ) ) + { + iNewFolderName.Zero(); + iNewFolderName = objectInfo->DesC( CMTPObjectMetaData::ESuid ); + PRINT1( _L( "MM MTP <> CRenameObject::GetParentSuidL new folder full file name(%S)" ), &iNewFolderName ); + const TInt length = iNewFolderName.Length(); + + TParsePtrC parentSuid( iNewFolderName.Left( length - 1 ) ); + + iOldFolderFullName.Zero(); + iOldFolderFullName.Append( parentSuid.DriveAndPath() ); + iOldFolderFullName.Append( aFolderName ); // just name not suid + _LIT( KBackSlash, "\\" ); + iOldFolderFullName.Append( KBackSlash ); + PRINT1( _L( "MM MTP <> CRenameObject::GetParentSuidL = %S" ), &iOldFolderFullName ); + } + else + User::Leave( KErrCorrupt ); + + CleanupStack::PopAndDestroy( objectInfo ); // - objectInfo + + PRINT( _L( "MM MTP <= CRenameObject::GetParentSuidL" ) ); + } + +// ----------------------------------------------------------------------------- +// CRenameObject::PerformAdditionalActionL +// +// ----------------------------------------------------------------------------- +// +void CRenameObject::PerformAdditionalActionL() + { + PRINT( _L( "MM MTP => CRenameObject::PerformAdditionalActionL" ) ); + + // update MPX DB + TRAPD( err, iWrapper.RenameObjectL( iOldFileName, iFileName ) ); + + // should not fail for 1 file, keep it going, as folder already renamed + if ( err != KErrNone ) + PRINT1( _L( "MM MTP <> CRenameObject::PerformAdditionalActionL err = %d" ), err ); + + PRINT( _L( "MM MTP <= CRenameObject::PerformAdditionalActionL" ) ); + } + +//end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/crequestchecker.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/crequestchecker.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,429 @@ +/* +* 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 +#include +#include +#include +#include + +#include "crequestchecker.h" +#include "mmmtpdplogger.h" + +static const TInt KMTPRequestCheckerHandleGranularity = 2; + +// ----------------------------------------------------------------------------- +// CRequestChecker::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +CRequestChecker* CRequestChecker::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection ) + { + CRequestChecker* self = new (ELeave) CRequestChecker( aFramework, aConnection ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CRequestChecker::CRequestChecker +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +CRequestChecker::CRequestChecker( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection ) : + iFramework( aFramework ), + iConnection( aConnection ), + iHandles( KMTPRequestCheckerHandleGranularity ), + iObjectArray( KMTPRequestCheckerHandleGranularity ) + { + + } + +// ----------------------------------------------------------------------------- +// CRequestChecker::ConstructL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +void CRequestChecker::ConstructL() + { + + } + +// ----------------------------------------------------------------------------- +// CRequestChecker::~CRequestChecker +// Destructor +// ----------------------------------------------------------------------------- +// +CRequestChecker::~CRequestChecker() + { + iHandles.Close(); + iObjectArray.ResetAndDestroy(); + } + +// ----------------------------------------------------------------------------- +// CRequestChecker::VerifyRequestL +// Verfiy the request +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CRequestChecker::VerifyRequestL( const TMTPTypeRequest& aRequest, + TInt aCount, + const TMTPRequestElementInfo* aElementInfo ) + { + TMTPResponseCode result = EMTPRespCodeOK; + iHandles.Close(); + iObjectArray.ResetAndDestroy(); + + result = CheckRequestHeader( aRequest ); + + for ( TInt i = 0; i < aCount && EMTPRespCodeOK == result; i++ ) + { + TUint32 parameter = aRequest.Uint32( aElementInfo[i].iElementIndex ); + PRINT3( _L( "MM MTP <> CRequestChecker parameter %d/%d = %d" ), + i + 1, aCount, parameter ); + + if ( !IsSpecialValue( parameter, aElementInfo[i] ) ) + { + switch ( aElementInfo[i].iElementType ) + { + case EMTPElementTypeSessionID: + result = VerifySessionId( parameter, aElementInfo[i] ); + break; + + case EMTPElementTypeObjectHandle: + result = VerifyObjectHandleL( parameter, aElementInfo[i] ); + break; + + case EMTPElementTypeStorageId: + result = VerifyStorageIdL( parameter, aElementInfo[i] ); + break; + + case EMTPElementTypeFormatCode: + result = VerifyFormatCode( parameter, aElementInfo[i] ); + break; + + default: + User::Invariant(); // Should never run + break; + } + } + } + + return result; + } + +// ----------------------------------------------------------------------------- +// CRequestChecker::GetObjectInfo +// Return the object info for the handle +// ----------------------------------------------------------------------------- +// +CMTPObjectMetaData* CRequestChecker::GetObjectInfo( TUint32 aHandle ) const + { + CMTPObjectMetaData* result = NULL; + TInt count = iHandles.Count(); + for( TInt i = 0; i < count; i++ ) + { + if ( iHandles[i] == aHandle ) + { + result = iObjectArray[i]; + break; + } + } + return result; + } + +// ----------------------------------------------------------------------------- +// CRequestChecker::CheckRequestHeader +// Check the request header portion (session Id and transaction code) +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CRequestChecker::CheckRequestHeader( const TMTPTypeRequest& aRequest ) const + { + TMTPResponseCode ret = EMTPRespCodeOK; + TUint16 operationCode = aRequest.Uint16( TMTPTypeRequest::ERequestOperationCode ); + TUint32 sessionId = aRequest.Uint32( TMTPTypeRequest::ERequestSessionID ); + TUint32 transactionCode = aRequest.Uint32( TMTPTypeRequest::ERequestTransactionID ); + + if ( operationCode == EMTPOpCodeCloseSession || operationCode == EMTPOpCodeResetDevice ) + { + if ( sessionId != 0 ) + { + ret = EMTPRespCodeInvalidParameter; + } + } + else + { + // requests that are valid when there's no opened session. + if ( sessionId == 0 ) + { + switch ( operationCode ) + { + case EMTPOpCodeGetDeviceInfo: + case EMTPOpCodeOpenSession: + { + // Transaction id must be 0 when called out side an active session. + if ( transactionCode != 0 ) + { + ret = EMTPRespCodeInvalidTransactionID; + } + } + break; + + default: + { + ret = EMTPRespCodeSessionNotOpen; + } + break; + } + } + else if ( !iConnection.SessionWithMTPIdExists( sessionId ) ) + { + ret = EMTPRespCodeSessionNotOpen; + } + } + + return ret; + } + +// ----------------------------------------------------------------------------- +// CRequestChecker::VerifySessionId +// Check the session id in the request parameter (NOTE the session id is different from the one in the request header), +// this usually only applies to the OpenSession request +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CRequestChecker::VerifySessionId( TUint32 aSessionId, + const TMTPRequestElementInfo& /*aElementInfo*/ ) const + { + TMTPResponseCode ret = EMTPRespCodeOK; + + if ( aSessionId != 0 ) + { + if ( iConnection.SessionWithMTPIdExists( aSessionId ) ) + { + ret = EMTPRespCodeSessionAlreadyOpen; + } + } + else + { + ret = EMTPRespCodeInvalidParameter; + } + + return ret; + } + +// ----------------------------------------------------------------------------- +// CRequestChecker::VerifyObjectHandleL +// Check the object handle in the request parameter, whether the handle is in the object store, +// read/write, file/dir +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CRequestChecker::VerifyObjectHandleL( TUint32 aHandle, + const TMTPRequestElementInfo& aElementInfo ) + { + PRINT1( _L("MM MTP => CRequestChecker::VerifyObjectHandleL aHandle = 0x%x"), aHandle ); + TMTPResponseCode ret = EMTPRespCodeOK; + + CMTPObjectMetaData* object( CMTPObjectMetaData::NewLC() ); + TBool result( iFramework.ObjectMgr().ObjectL( aHandle, *object ) ); + iObjectArray.AppendL( object ); + CleanupStack::Pop( object ); + iHandles.AppendL( aHandle ); + + // Obj handle exists + if ( result ) + { + const TDesC& suid( object->DesC( CMTPObjectMetaData::ESuid ) ); + TEntry entry; + TInt err = iFramework.Fs().Entry( suid, entry ); + + if ( object->Uint( CMTPObjectMetaData::EFormatCode ) == EMTPFormatCodeAssociation ) +// && ( object->Uint( CMTPObjectMetaData::EFormatSubCode ) == EMTPAssociationTypeGenericFolder ) ) + { + // Special association type .. not always present on the filesystem. + return ret; + } + else + { + User::LeaveIfError( err ); + + if ( iFramework.ObjectMgr().ObjectOwnerId( aHandle ) != iFramework.DataProviderId() ) + { + PRINT( _L(" ewrwe ret = EMTPRespCodeInvalidObjectHandle;")); + ret = EMTPRespCodeInvalidObjectHandle; + } + } + + if ( aElementInfo.iElementAttr & EMTPElementAttrWrite ) + { + if ( entry.IsReadOnly() ) + { + ret = EMTPRespCodeObjectWriteProtected; + } + } + + //((EMTPRespCodeOK == ret) && (aElementInfo.iElementAttr & EMTPElementAttrFileOrDir)) is + // covered implicitly here, EMTPRespCodeOK will be returned. It is a valid case for an object to be either a folder or file + // for certain operation's request parameter, for instance the first parameter of copyObject or + // moveObject can be either a file or a directory. + + // Other cases. + if ( ( EMTPRespCodeOK == ret ) && ( aElementInfo.iElementAttr & EMTPElementAttrFile) ) + { + if ( entry.IsDir() ) + { + ret = EMTPRespCodeInvalidObjectHandle; + } + } + + if ( ( EMTPRespCodeOK == ret ) && ( aElementInfo.iElementAttr & EMTPElementAttrDir ) ) + { + if (!entry.IsDir()) + { + ret = EMTPRespCodeInvalidParentObject; + } + } + } + else + { + PRINT( _L( "MM MTP <> CRequestChecker::VerifyObjectHandleL, Object does not exist." ) ); + ret = EMTPRespCodeInvalidObjectHandle; + } + PRINT1( _L( "MM MTP <= CRequestChecker::VerifyObjectHandleL ret = 0x%x" ), ret ); + + return ret; + } + +// ----------------------------------------------------------------------------- +// CRequestChecker::VerifyStorageIdL +// Check the storage id parameter in the request, read/write attributes +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CRequestChecker::VerifyStorageIdL( TUint32 aStorageId, + const TMTPRequestElementInfo& aElementInfo ) const + { + MMTPStorageMgr& mgr( iFramework.StorageMgr() ); + TMTPResponseCode ret( EMTPRespCodeOK ); + if ( !mgr.ValidStorageId( aStorageId ) ) + { + ret = EMTPRespCodeInvalidStorageID; + } + else + { + if ( !mgr.LogicalStorageId( aStorageId ) ) + { + ret = EMTPRespCodeStoreNotAvailable; + } + else + { + TInt drive( mgr.DriveNumber( aStorageId ) ); + // StorageIDs which are not system owned do not correspond to drives. + if ( drive != KErrNotFound ) + { + TDriveInfo info; + User::LeaveIfError( iFramework.Fs().Drive( info, drive ) ); + if ( info.iType == EMediaNotPresent ) + { + /** + * Race conditions between media ejection and request processing + * may result in a previously valid storage ID no longer being + * available. + */ + ret = EMTPRespCodeStoreNotAvailable; + } + else + if ( ( aElementInfo.iElementAttr & EMTPElementAttrWrite ) + && ( ( info.iMediaAtt & KMediaAttWriteProtected ) + || ( info.iDriveAtt & KDriveAttRom ) ) ) + { + ret = EMTPRespCodeStoreReadOnly; + } + } + } + } + + return ret; + } + +// ----------------------------------------------------------------------------- +// CRequestChecker::VerifyFormatCode +// Check the format code parameter in the request +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CRequestChecker::VerifyFormatCode( TUint32 aFormatCode, + const TMTPRequestElementInfo& aElementInfo ) const + { + PRINT1( _L( "MM MTP => CRequestChecker::VerifyFormatCode aFormatCode = 0x%x" ), aFormatCode ); + TMTPResponseCode ret = EMTPRespCodeInvalidObjectFormatCode; + + if ( aElementInfo.iElementAttr == EMTPElementAttrFormatEnums ) + { + TUint32* formatArray = (TUint32*)( aElementInfo.iValue1 ); + TUint32 i = 0; + for ( i = 0; i < aElementInfo.iValue2; i++ ) + { + if ( aFormatCode == formatArray[i] ) + { + ret = EMTPRespCodeOK; + break; + } + } + } + else + { + if ( ( aFormatCode >= EMTPFormatCodePTPStart ) + && ( aFormatCode <= EMTPFormatCodeMTPEnd ) ) + { + ret = EMTPRespCodeOK; + } + } + + PRINT1( _L( "MM MTP => CRequestChecker::VerifyFormatCode ret = 0x%x" ), ret ); + + return ret; + } + +// ----------------------------------------------------------------------------- +// CRequestChecker::IsSpecialValue +// Check if the parameter is one of the special values +// ----------------------------------------------------------------------------- +// +TBool CRequestChecker::IsSpecialValue( TUint32 aParameter, + const TMTPRequestElementInfo& aElementInfo ) const + { + TBool result = EFalse; + switch ( aElementInfo.iCount ) + { + case 1: + result = ( aParameter == aElementInfo.iValue1 ); + break; + + case 2: + result = ( aParameter == aElementInfo.iValue1 + || aParameter == aElementInfo.iValue2 ); + break; + + default: + break; + } + + return result; + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/crequestprocessor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/crequestprocessor.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,460 @@ +/* +* 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 +#include +#include +#include +#include +#include +#include +#include + +#include "crequestprocessor.h" +#include "crequestchecker.h" +#include "mmmtpdplogger.h" + +static const TInt KNullBufferSize = 4096; + +// ----------------------------------------------------------------------------- +// CRequestProcessor::CRequestProcessor +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CRequestProcessor::CRequestProcessor( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + TInt aElementCount, + const TMTPRequestElementInfo* aElements ): + CActive( EPriorityStandard ), + iFramework( aFramework ), + iConnection( aConnection ), + iElementCount( aElementCount ), + iElements( aElements ) + { + // CActiveScheduler::Add( this ); + } + +// ----------------------------------------------------------------------------- +// CRequestProcessor::~CRequestProcessor +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CRequestProcessor::~CRequestProcessor() + { +// Cancel(); + iNullBuffer.Close(); + delete iRequestChecker; + } + +// ----------------------------------------------------------------------------- +// CRequestProcessor::Release +// Relese (delete) this request processor +// ----------------------------------------------------------------------------- +// +EXPORT_C void CRequestProcessor::Release() + { + delete this; + } + +// ----------------------------------------------------------------------------- +// CRequestProcessor::SendResponseL +// Send a response to the initiator +// ----------------------------------------------------------------------------- +// +EXPORT_C void CRequestProcessor::SendResponseL( TMTPResponseCode aResponseCode, + TInt aParameterCount, + TUint32* aParams ) + { + PRINT2( _L( "MM MTP <> CRequestProcessor::SendResponseL iTransactionCode = %d, aResponseCode = 0x%x" ), + iTransactionCode, + aResponseCode ); + __ASSERT_DEBUG( aParameterCount < TMTPTypeRequest::ENumElements, User::Invariant() ); + + iResponse.SetUint16( TMTPTypeResponse::EResponseCode, aResponseCode ); + iResponse.SetUint32( TMTPTypeResponse::EResponseSessionID, iSessionId ); + iResponse.SetUint32( TMTPTypeResponse::EResponseTransactionID, iTransactionCode ); + + TInt i = 0; + for( i = 0; i < aParameterCount; i++ ) + { + iResponse.SetUint32( TMTPTypeResponse::EResponseParameter1 + i, aParams[i] ); + } + + i += TMTPTypeResponse::EResponseParameter1; + while( i < TMTPTypeResponse::EResponseParameter5 ) + { + iResponse.SetUint32( i, 0 ); + i++; + } + + __ASSERT_DEBUG( iRequest, User::Invariant() ); + iFramework.SendResponseL( iResponse, *iRequest, iConnection ); + } + +// ----------------------------------------------------------------------------- +// CRequestProcessor::Request +// The current active request +// ----------------------------------------------------------------------------- +// +EXPORT_C const TMTPTypeRequest& CRequestProcessor::Request() const + { + __ASSERT_DEBUG( iRequest, User::Invariant() ); + return *iRequest; + } + +// ----------------------------------------------------------------------------- +// CRequestProcessor::Connection +// The connection from which the current request comes +// ----------------------------------------------------------------------------- +// +EXPORT_C MMTPConnection& CRequestProcessor::Connection() const + { + return iConnection; + } + +// ----------------------------------------------------------------------------- +// CRequestProcessor::UsbDisconnect +// Rollback when WMP closed and disconnect the USB cable, +// during the transferring file +// ----------------------------------------------------------------------------- +// +EXPORT_C void CRequestProcessor::UsbDisconnect() + { + // TODO: reset the CenRep value + } + +// ----------------------------------------------------------------------------- +// CRequestProcessor::CompleteRequestL +// Signal to the framework that the current request transaction has completed +// ----------------------------------------------------------------------------- +// +void CRequestProcessor::CompleteRequestL() + { + __ASSERT_DEBUG( iRequest, User::Invariant() ); + iFramework.TransactionCompleteL( *iRequest, iConnection ); + } + +// ----------------------------------------------------------------------------- +// CRequestProcessor::SendDataL +// Send data to the initiator +// ----------------------------------------------------------------------------- +// +EXPORT_C void CRequestProcessor::SendDataL( const MMTPType& aData ) + { + __ASSERT_DEBUG( iRequest, User::Invariant() ); + iFramework.SendDataL( aData, *iRequest, iConnection ); + } + +// ----------------------------------------------------------------------------- +// CRequestProcessor::ReceiveDataL +// Receive data from the initiator +// ----------------------------------------------------------------------------- +// +EXPORT_C void CRequestProcessor::ReceiveDataL( MMTPType& aData ) + { + __ASSERT_DEBUG( iRequest, User::Invariant() ); + iFramework.ReceiveDataL( aData, *iRequest, iConnection ); + } + +// ----------------------------------------------------------------------------- +// CRequestProcessor::HandleRequestL +// Handle the request +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CRequestProcessor::HandleRequestL( const TMTPTypeRequest& aRequest, + TMTPTransactionPhase aPhase ) + { + iRequest = &aRequest; + __ASSERT_DEBUG( iRequest, User::Invariant() ); + TBool result = EFalse; + switch( aPhase ) + { + case ERequestPhase: + ExtractSessionTransactionId(); + result = DoHandleRequestPhaseL(); + break; + + case EDataIToRPhase: + result = DoHandleDataIToRPhaseL(); + break; + + case EDataRToIPhase: + result = DoHandleRToIPhaseL(); + break; + + case EResponsePhase: + if ( iResponseCode != EMTPRespCodeOK && HasDataphase() ) + { + SendResponseL( iResponseCode ); + iNullBuffer.Close(); + PRINT1( _L( "MM MTP <> CRequestProcessor::HandleRequestL SendResponse 0x%x" ), iResponseCode ); + } + else + { + result = DoHandleResponsePhaseL(); + } + break; + + case ECompletingPhase: + result = DoHandleCompletingPhaseL(); + break; + + default: + PRINT( _L( "MM MTP <> CRequestProcessor::HandleRequestL default" ) ); + break; + } + + return result; + } + +// ----------------------------------------------------------------------------- +// CRequestProcessor::HandleEventL +// Handle the event +// ----------------------------------------------------------------------------- +// +EXPORT_C void CRequestProcessor::HandleEventL( const TMTPTypeEvent& aEvent ) + { + TUint16 eventCode = aEvent.Uint16( TMTPTypeEvent::EEventCode ); + iCancelled = ( eventCode == EMTPEventCodeCancelTransaction ); + } + +// ----------------------------------------------------------------------------- +// CRequestProcessor::Match +// Check whether the processor can process the request +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CRequestProcessor::Match( const TMTPTypeRequest& aRequest, + MMTPConnection& aConnection ) const + { + __ASSERT_DEBUG( iRequest, User::Invariant() ); + TBool result = ( ( &aRequest == iRequest ) && ( &iConnection == &aConnection ) ); + return result; + } + +// ----------------------------------------------------------------------------- +// CRequestProcessor::Match +// Check whether the processor can process the event +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CRequestProcessor::Match( const TMTPTypeEvent& aEvent, + MMTPConnection& aConnection ) const + { + TUint32 eventSessionId = aEvent.Uint32( TMTPTypeEvent::EEventSessionID ); + TUint32 eventTransactionCode = aEvent.Uint32( TMTPTypeEvent::EEventTransactionID ); + + TBool result = EFalse; + if ( ( iSessionId == eventSessionId ) + && ( iTransactionCode == eventTransactionCode ) + && ( &iConnection == &aConnection ) ) + { + result = ETrue; + } + return result; + } + +// ----------------------------------------------------------------------------- +// CRequestProcessor::DoHandleRequestPhaseL +// Handle the request phase of the current request +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CRequestProcessor::DoHandleRequestPhaseL() + { + TRAPD( err, iResponseCode = CheckRequestL() ); + PRINT2( _L( "MM MTP <> CRequestProcessor::DoHandleRequestPhaseL iResponseCode = 0x%x, CheckRequestL err = %d" ), + iResponseCode, err ); + if ( ( err != KErrNone ) || ( iResponseCode != EMTPRespCodeOK ) ) + { + if ( HasDataphase() ) + { + // If we have a dataphase + // we need to read in the data and discard it + iNullBuffer.Close(); + iNullBuffer.CreateMaxL( KNullBufferSize ); + iNull.SetBuffer( iNullBuffer ); + ReceiveDataL( iNull ); + } + else + { + if ( err != KErrNone ) + { + User::Leave( err ); + } + SendResponseL( iResponseCode ); + } + } + else + { + TRAP( err, ServiceL() ); + PRINT1( _L( "MM MTP <> CRequestProcessor::DoHandleRequestPhaseL ServiceL err = %d" ), err ); + if ( err != KErrNone ) + { + iResponseCode = EMTPRespCodeGeneralError; + if ( HasDataphase() ) + { + // If we have a dataphase + // we need to read in the data and discard it + iNullBuffer.Close(); + iNullBuffer.CreateMaxL( KNullBufferSize ); + iNull.SetBuffer( iNullBuffer ); + ReceiveDataL( iNull ); + } + else + { + User::Leave( err ); + } + } + } + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CRequestProcessor::DoHandleDataIToRPhaseL +// Handle the receiving data phase of the current request +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CRequestProcessor::DoHandleDataIToRPhaseL() + { + User::Invariant(); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CRequestProcessor::DoHandleRToIPhaseL +// Handle the sending data phase of the current request +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CRequestProcessor::DoHandleRToIPhaseL() + { + User::Invariant(); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CRequestProcessor::DoHandleResponsePhaseL +// Handle the response phase of the current request +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CRequestProcessor::DoHandleResponsePhaseL() + { + TMTPResponseCode responseCode = ( iCancelled ? EMTPRespCodeIncompleteTransfer : EMTPRespCodeOK ); + SendResponseL( responseCode ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CRequestProcessor::DoHandleCompletingPhaseL +// Handle the completing phase of the current request +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CRequestProcessor::DoHandleCompletingPhaseL() + { + CompleteRequestL(); + return ETrue; + } + +// ----------------------------------------------------------------------------- +// CRequestProcessor::CheckRequestL +// Check the current request +// ----------------------------------------------------------------------------- +// +EXPORT_C TMTPResponseCode CRequestProcessor::CheckRequestL() + { + if ( !iRequestChecker ) + { + iRequestChecker = CRequestChecker::NewL( iFramework, iConnection ); + } + __ASSERT_DEBUG( iRequest, User::Invariant() ); + return iRequestChecker->VerifyRequestL( *iRequest, iElementCount, iElements ); + } + +// ----------------------------------------------------------------------------- +// CRequestProcessor::RunL +// part of active object framework, provide default implementation +// ----------------------------------------------------------------------------- +// +EXPORT_C void CRequestProcessor::RunL() + { + + } + +// ----------------------------------------------------------------------------- +// CRequestProcessor::DoCancel +// part of active object framework, provide default implementation +// ----------------------------------------------------------------------------- +// +EXPORT_C void CRequestProcessor::DoCancel() + { + + } + +// ----------------------------------------------------------------------------- +// CRequestProcessor::RunError +// part of active object framework, provide default implementation +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CRequestProcessor::RunError( TInt aError ) + { + PRINT1( _L( "MM MTP <> CRequestProcessor RunError = %d" ), aError ); + TRAP_IGNORE( SendResponseL( EMTPRespCodeGeneralError ) ); + return KErrNone; + } + +EXPORT_C TBool CRequestProcessor::HasDataphase() const + { + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CRequestProcessor::SetPSStatus +// Set P&S Status to avoid MPX access conflict +// ----------------------------------------------------------------------------- +// +void CRequestProcessor::SetPSStatus() + { + TInt mtpStatus; + RProperty::Get( KMtpPSUid, KMtpPSStatus, mtpStatus); + + if ( mtpStatus != EMtpPSStatusActive ) + { + TInt err = RProperty::Set( KMtpPSUid, KMtpPSStatus, EMtpPSStatusActive ); + PRINT1( _L("MM MTP <> CRequestProcessor::SetPSStatus err = %d" ), err ); + } + } + +// ----------------------------------------------------------------------------- +// CRequestProcessor::ExtractSessionTransactionId +// retrieve the session id and transaction code from the current request +// ----------------------------------------------------------------------------- +// +void CRequestProcessor::ExtractSessionTransactionId() + { + iSessionId = iRequest->Uint32( TMTPTypeRequest::ERequestSessionID ); + iTransactionCode = iRequest->Uint32( TMTPTypeRequest::ERequestTransactionID ); + + PRINT2( _L( "MM MTP <> CRequestProcessor iSessionId = %d, iTransactionCode = %d" ), + iSessionId, + iTransactionCode ); + } + +EXPORT_C TUint32 CRequestProcessor::SessionId() + { + return iSessionId; + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/crequestunknown.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/crequestunknown.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,91 @@ +/* +* 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 +#include "crequestunknown.h" +#include "mmmtpdplogger.h" + +// ----------------------------------------------------------------------------- +// CRequestUnknown::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +EXPORT_C MMmRequestProcessor* CRequestUnknown::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection ) + { + CRequestUnknown* self = new (ELeave) CRequestUnknown( aFramework, aConnection ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CRequestUnknown::ConstructL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +void CRequestUnknown::ConstructL() + { + + } + +// ----------------------------------------------------------------------------- +// CRequestUnknown::~CRequestUnknown +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CRequestUnknown::~CRequestUnknown() + { + + } + +// ----------------------------------------------------------------------------- +// CRequestUnknown::CRequestUnknown +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CRequestUnknown::CRequestUnknown( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection ) : + CRequestProcessor( aFramework, aConnection, 0, NULL ) + { + PRINT( _L( "Operation: Unknown" ) ); + } + +// ----------------------------------------------------------------------------- +// CRequestUnknown::ServiceL +// penSession request handler +// ----------------------------------------------------------------------------- +// +EXPORT_C void CRequestUnknown::ServiceL() + { + SendResponseL( EMTPRespCodeOperationNotSupported ); + } + +// ----------------------------------------------------------------------------- +// CRequestUnknown::Match +// Override to match both the unknown requests +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CRequestUnknown::Match( const TMTPTypeRequest& /*aRequest*/, + MMTPConnection& /*aConnection*/ ) const + { + return ETrue; + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/csendobject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/csendobject.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,1351 @@ +/* +* 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: Implement the operation: SendObjectInfo/SendObjectPropList/SendObject +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "csendobject.h" +#include "mmmtpdpconfig.h" +#include "mmmtpdputility.h" +#include "tmmmtpdppanic.h" +#include "mmmtpdplogger.h" +#include "cmmmtpdpmetadataaccesswrapper.h" + +// Verification data for the SendObjectInfo request +const TMTPRequestElementInfo KMTPSendObjectInfoPolicy[] = + { + { + TMTPTypeRequest::ERequestParameter1, + EMTPElementTypeStorageId, + EMTPElementAttrWrite, + 1, + 0, + 0 + }, + + { + TMTPTypeRequest::ERequestParameter2, + EMTPElementTypeObjectHandle, + EMTPElementAttrDir | EMTPElementAttrWrite, + 2, + KMTPHandleAll, + KMTPHandleNone + } + }; + +// ----------------------------------------------------------------------------- +// CSendObject::~CSendObject +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSendObject::~CSendObject() + { + if ( ( iProgress == EObjectInfoSucceed + || iProgress == EObjectInfoFail + || iProgress == EObjectInfoInProgress ) + && !iNoRollback ) + { + // Not finished SendObjectInfo \ SendObject pair detected. + Rollback(); + PRINT( _L( "MM MTP <> CSendObject::~CSendObject, Rollback" ) ); + } + + delete iFileReceived; + delete iParentSuid; + delete iObjectInfo; + delete iObjectPropList; + delete iDateMod; + delete iReceivedObjectInfo; + + PRINT( _L( "MM MTP <= CSendObject::~CSendObject" ) ); + } + +// ----------------------------------------------------------------------------- +// CSendObject::CSendObject +// Standard C++ Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSendObject::CSendObject( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CRequestProcessor( aFramework, aConnection, 0, NULL), + iFs( iFramework.Fs() ), + iObjectMgr( iFramework.ObjectMgr() ), + iDpConfig( aDpConfig ) + { + PRINT( _L( "Operation: SendObjectInfo/SendObject/SendObjectPropList(0x100C/0x100D/0x9808)" ) ); + } + +// ----------------------------------------------------------------------------- +// CSendObject::ConstructL +// 2nd Phase Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSendObject::ConstructL() + { + PRINT( _L( "MM MTP => CSendObject::ConstructL" ) ); + + iExpectedSendObjectRequest.SetUint16( TMTPTypeRequest::ERequestOperationCode, + EMTPOpCodeSendObject ); + + iReceivedObjectInfo = CMTPObjectMetaData::NewL(); + iReceivedObjectInfo->SetUint( CMTPObjectMetaData::EDataProviderId, + iFramework.DataProviderId() ); + + PRINT1( _L( "MM MTP <> CSendObject::ConstructL DataProviderId = 0x%x" ), iFramework.DataProviderId()); + + iNoRollback = EFalse; + + SetPSStatus(); + PRINT( _L( "MM MTP <= CSendObject::ConstructL" ) ); + } + +// ----------------------------------------------------------------------------- +// CSendObject::Match +// Override to match both the SendObjectInfo and SendObject requests +// @param aRequest The request to match +// @param aConnection The connection from which the request comes +// @return ETrue if the processor can handle the request, otherwise EFalse +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CSendObject::Match( const TMTPTypeRequest& aRequest, + MMTPConnection& aConnection ) const + { + TBool result = EFalse; + + TUint16 operationCode = aRequest.Uint16( TMTPTypeRequest::ERequestOperationCode ); + if ( ( operationCode == EMTPOpCodeSendObjectInfo + || operationCode == EMTPOpCodeSendObject + || operationCode == EMTPOpCodeSendObjectPropList ) + && ( &iConnection == &aConnection ) ) + { + result = ETrue; + } + + return result; + } + +// ----------------------------------------------------------------------------- +// CSendObject::CheckSendingState +// Helper Functions +// Verify if the SendObject request comes after SendObjectInfo request +// @return EMTPRespCodeOK if SendObject request comes after a valid SendObjectInfo request, otherwise +// EMTPRespCodeNoValidObjectInfo +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CSendObject::CheckSendingStateL() + { + PRINT( _L( "MM MTP => CSendObject::CheckSendingState" ) ); + + TMTPResponseCode result = EMTPRespCodeOK; + iOperationCode = Request().Uint16( TMTPTypeRequest::ERequestOperationCode ); + PRINT1( _L( "MM MTP <> CSendObject iOperationCode = 0x%x" ), iOperationCode ); + + if ( iOperationCode == EMTPOpCodeSendObject ) + { + // In ParseRouter everytime SendObject gets resolved then will be removed from Registry + // right away therefore we need reRegister it here again in case possible cancelRequest + // against this SendObject being raised. + iExpectedSendObjectRequest.SetUint32( TMTPTypeRequest::ERequestSessionID, + iSessionId ); + iFramework.RouteRequestRegisterL( iExpectedSendObjectRequest, + iConnection ); + } + + if ( iProgress == EObjectNone ) + { + if ( iOperationCode == EMTPOpCodeSendObject ) + { + PRINT( _L( "MM MTP <> CSendObject::CheckSendingState EMTPRespCodeNoValidObjectInfo" ) ); + result = EMTPRespCodeNoValidObjectInfo; + } + } + else if ( iProgress == EObjectInfoSucceed ) + { + if ( iOperationCode == EMTPOpCodeSendObjectInfo ) + { + delete iObjectInfo; + iObjectInfo = NULL; + iProgress = EObjectNone; + } + else if ( iOperationCode == EMTPOpCodeSendObjectPropList ) + { + delete iObjectPropList; + iObjectPropList = NULL; + iProgress = EObjectNone; + } + } + else + { + Panic( EMmMTPDpSendObjectStateInvalid ); + } + + PRINT1( _L( "MM MTP <= CSendObject::CheckSendingState result = 0x%x" ), result ); + + return result; + } + +// ----------------------------------------------------------------------------- +// CSendObject::CheckRequestL +// Verify the reqeust +// ----------------------------------------------------------------------------- +// +EXPORT_C TMTPResponseCode CSendObject::CheckRequestL() + { + PRINT( _L( "MM MTP => CSendObject::CheckRequestL" ) ); + + TMTPResponseCode responseCode = CheckSendingStateL(); + + if ( responseCode != EMTPRespCodeOK ) + { + return responseCode; + } + + if ( iProgress == EObjectNone ) + // Only SendObjectInfo/SendObjectPropList's request phase will enter into this function, + // otherwise, state machine of fw should be wrong. + { + iElementCount = sizeof( KMTPSendObjectInfoPolicy ) / sizeof( TMTPRequestElementInfo ); + iElements = KMTPSendObjectInfoPolicy; + } + else if ( iProgress == EObjectInfoSucceed ) + { + iElementCount = 0; + iElements = NULL; + } + + if ( iElements != NULL ) + { + responseCode = CRequestProcessor::CheckRequestL(); + if ( responseCode != EMTPRespCodeOK ) + { + return responseCode; + } + + // Reserve storageId and parent into member data variables if they are matched. + responseCode = MatchStoreAndParentL(); + if ( responseCode != EMTPRespCodeOK ) + { + return responseCode; + } + + if ( iOperationCode == EMTPOpCodeSendObjectPropList ) + { + // check if it is what dp supported + iObjectFormat = Request().Uint32( TMTPTypeRequest::ERequestParameter3 ); + if ( iObjectFormat != KMTPFormatsAll ) + { + responseCode = EMTPRespCodeInvalidObjectFormatCode; + + const RArray* format = iDpConfig.GetSupportedFormat(); + TInt count = format->Count(); + + for ( TInt i = 0; i < count; i++ ) + { + if ( iObjectFormat == ( *format )[i] ) + { + responseCode = EMTPRespCodeOK; + break; + } + } + if ( responseCode != EMTPRespCodeOK ) + { + return responseCode; + } + } // end of if ( iObjectFormat != KMTPFormatsAll ) + + // check object size + TUint32 objectSizeHigh = Request().Uint32( TMTPTypeRequest::ERequestParameter4 ); + TUint32 objectSizeLow = Request().Uint32( TMTPTypeRequest::ERequestParameter5 ); + iObjectSize = MAKE_TUINT64( objectSizeHigh, objectSizeLow ); + PRINT1( _L( "MM MTP <> CSendObject::CheckRequestL iObjectSize = %Lu" ), iObjectSize ); + + if ( IsTooLarge( iObjectSize ) ) + { + responseCode = EMTPRespCodeObjectTooLarge; + } + + if ( ( responseCode != EMTPRespCodeOK ) && !CanStoreFileL( iStorageId, iObjectSize ) ) + { + responseCode = EMTPRespCodeStoreFull; + } + } + } + + PRINT1( _L( "MM MTP <= CSendObject::CheckRequestL, responseCode = 0x%x" ), responseCode ); + return responseCode; + } + +// ----------------------------------------------------------------------------- +// CSendObject::HasDataphase +// Exception handling. CRequestProcessor will receive data if this operation +// won't by return ETrue. +// @return ETrue if there is data need to be received from initiator +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CSendObject::HasDataphase() const + { + return ETrue; + } + +// ----------------------------------------------------------------------------- +// CSendObject::ServiceL +// ServiceL request handler +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSendObject::ServiceL() + { + PRINT( _L( "MM MTP => CSendObject::ServiceL" ) ); + + if ( iProgress == EObjectNone ) + { + if ( iOperationCode == EMTPOpCodeSendObjectInfo ) + { + ServiceInfoL(); + } + else + { + ServicePropListL(); + } + } + else + { + PRINT1( _L( "MM MTP <> CSendObject::ServiceL, iProgress = %d" ), iProgress ); + ServiceObjectL(); + } + PRINT( _L( "MM MTP <= CSendObject::ServiceL" ) ); + } + +// ----------------------------------------------------------------------------- +// CSendObject::ServiceInfoL +// ServiceL - Recieves the objectinfo data +// ----------------------------------------------------------------------------- +// +void CSendObject::ServiceInfoL() + { + PRINT( _L( "MM MTP => CSendObject::ServiceInfoL" ) ); + + iObjectInfo = CMTPTypeObjectInfo::NewL(); + ReceiveDataL( *iObjectInfo ); + iProgress = EObjectInfoInProgress; + + PRINT( _L( "MM MTP <= CSendObject::ServiceInfoL" ) ); + } + +// ----------------------------------------------------------------------------- +// CSendObject::ServicePropListL +// SendObjectPropList +// ----------------------------------------------------------------------------- +// +void CSendObject::ServicePropListL() + { + PRINT( _L( "MM MTP => CSendObject::ServicePropListL" ) ); + + iObjectPropList = CMTPTypeObjectPropList::NewL(); + ReceiveDataL( *iObjectPropList ); + iProgress = EObjectInfoInProgress; + + PRINT( _L( "MM MTP <= CSendObject::ServicePropListL" ) ); + } + +// ----------------------------------------------------------------------------- +// CSendObject::ServiceObjectL +// SendObject +// ----------------------------------------------------------------------------- +// +void CSendObject::ServiceObjectL() + { + PRINT( _L( "MM MTP => CSendObject::ServiceObjectL" ) ); + + delete iFileReceived; + iFileReceived = NULL; + + PRINT2( _L( "MM MTP <> CSendObject::ServiceObjectL, iFullPath is %S, iObjectSize: %Lu" ), &iFullPath, iObjectSize ); + TRAPD( err, iFileReceived = CMTPTypeFile::NewL( iFs, + iFullPath, + EFileWrite ) ); + + PRINT1( _L("MM MTP <> CSendObject::ServiceObjectL, Leave Code is: %d"), err ); + User::LeaveIfError( err ); + + iFileReceived->SetSizeL( iObjectSize ); + + ReceiveDataL( *iFileReceived ); + + iProgress = ESendObjectInProgress; + + PRINT( _L( "MM MTP <= CSendObject::ServiceObjectL" ) ); + } + +// ----------------------------------------------------------------------------- +// CSendObject::DoHandleResponsePhaseL +// Response Phase Handler +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CSendObject::DoHandleResponsePhaseL() + { + PRINT( _L( "MM MTP => CSendObject::DoHandleResponsePhaseL" ) ); + + // check if the sending/receiving data is successful + TBool successful = !iCancelled; + if ( iProgress == EObjectInfoInProgress ) + { + if ( iOperationCode == EMTPOpCodeSendObjectInfo ) + { + successful = DoHandleResponsePhaseInfoL(); + } + else if ( iOperationCode == EMTPOpCodeSendObjectPropList ) + { + successful = DoHandleResponsePhasePropListL(); + } + iProgress = ( successful ? EObjectInfoSucceed : EObjectInfoFail ); + iPreviousOperation = iOperationCode; + } + else if ( iProgress == ESendObjectInProgress ) + { + successful = DoHandleResponsePhaseObjectL(); + iProgress = ( successful ? ESendObjectSucceed : ESendObjectFail ); + } + PRINT1( _L( "MM MTP <= CSendObject::DoHandleResponsePhaseL iProgress = %d" ), iProgress ); + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CSendObject::DoHandleResponsePhaseInfoL +// Handle Response - Checks whether the request was successful +// ----------------------------------------------------------------------------- +// +TBool CSendObject::DoHandleResponsePhaseInfoL() + { + PRINT( _L( "MM MTP => CSendObject::DoHandleResponsePhaseInfoL" ) ); + + TBool result = ETrue; + + // cache the width and height of video file + iObjectFormat = iObjectInfo->Uint16L( CMTPTypeObjectInfo::EObjectFormat ); + iWidth = iObjectInfo->Uint32L( CMTPTypeObjectInfo::EImagePixWidth ); + iHeight = iObjectInfo->Uint32L( CMTPTypeObjectInfo::EImagePixWidth ); + PRINT3( _L("MM MTP <> CSendObject::DoHandleResponsePhaseInfoL iObjectFormat = 0x%x, iWidth = %d, iHeight = %d"), + iObjectFormat, + iWidth, + iHeight ); + + // TODO: dateModified is reserved for extention usage. + delete iDateMod; + iDateMod = NULL; + iDateMod = iObjectInfo->StringCharsL( CMTPTypeObjectInfo::EDateModified ).AllocL(); + + // check if storage is full + iObjectSize = iObjectInfo->Uint32L( CMTPTypeObjectInfo::EObjectCompressedSize ); + PRINT1( _L("MM MTP <> CSendObject::DoHandleResponsePhaseInfoL, iObjectSize = %Lu"), iObjectSize ); + + if ( IsTooLarge( iObjectSize ) ) + { + SendResponseL( EMTPRespCodeObjectTooLarge ); + result = EFalse; + } + + if ( result && !CanStoreFileL( iStorageId, iObjectSize ) ) + { + SendResponseL( EMTPRespCodeStoreFull ); + result = EFalse; + } + + if ( result ) + { + iProtectionStatus = iObjectInfo->Uint16L( CMTPTypeObjectInfo::EProtectionStatus ); + PRINT1( _L( "MM MTP <> CSendObject::DoHandleResponsePhaseInfoL iProtectionStatus = %d" ), iProtectionStatus ); + if ( iProtectionStatus != EMTPProtectionNoProtection + && iProtectionStatus != EMTPProtectionReadOnly ) + { + SendResponseL( EMTPRespCodeParameterNotSupported ); + result = EFalse; + } + } + + if ( result ) + { + result = GetFullPathNameL( iObjectInfo->StringCharsL( CMTPTypeObjectInfo::EFilename ) ); + if ( !result ) + { + // File and/or parent pathname invalid. + SendResponseL( EMTPRespCodeInvalidDataset ); + } + } + + if ( result ) + { + if ( ExistsL( iFullPath ) ) + { + // Object with the same name already exists. + iNoRollback = ETrue; + SendResponseL( EMTPRespCodeAccessDenied ); + result = EFalse; + } + } + + if ( result ) + ReserveObjectL(); + + PRINT1( _L( "MM MTP <= CSendObject::DoHandleResponsePhaseInfoL result = %d" ), result ); + + return result; + } + +// ----------------------------------------------------------------------------- +// CSendObject::DoHandleResponsePhasePropListL +// SendObjectPropList +// ----------------------------------------------------------------------------- +// +TBool CSendObject::DoHandleResponsePhasePropListL() + { + PRINT( _L("MM MTP => CSendObject::DoHandleResponsePhasePropListL" ) ); + + TMTPResponseCode responseCode = EMTPRespCodeOK; + + TInt invalidParameterIndex = KErrNotFound; + responseCode = VerifyObjectPropListL( invalidParameterIndex ); + + if ( responseCode != EMTPRespCodeOK ) + { + TUint32 parameters[4]; + parameters[0] = 0; + parameters[1] = 0; + parameters[2] = 0; + parameters[3] = invalidParameterIndex; + SendResponseL( responseCode, 4, parameters ); + } + else if ( ExistsL( iFullPath ) ) + { + // Object with the same name already exists. + iNoRollback = ETrue; + SendResponseL( EMTPRespCodeAccessDenied ); + } + else + ReserveObjectL(); + + PRINT( _L( "MM MTP <= CSendObject::DoHandleResponsePhasePropListL" ) ); + return ( responseCode == EMTPRespCodeOK ); + } + +// ----------------------------------------------------------------------------- +// CSendObject::DoHandleResponsePhaseObjectL +// SendObject +// ----------------------------------------------------------------------------- +// +TBool CSendObject::DoHandleResponsePhaseObjectL() + { + PRINT( _L( "MM MTP => CSendObject::DoHandleResponsePhaseObjectL" ) ); + + TBool result = ETrue; + + delete iFileReceived; + iFileReceived = NULL; + + TEntry fileEntry; + User::LeaveIfError( iFs.Entry( iFullPath, fileEntry ) ); + if ( fileEntry.iSize != iObjectSize ) + { + iFs.Delete( iFullPath ); + iObjectMgr.UnreserveObjectHandleL( *iReceivedObjectInfo ); + TMTPResponseCode responseCode = EMTPRespCodeObjectTooLarge; + if ( fileEntry.iSize < iObjectSize ) + { + responseCode = EMTPRespCodeIncompleteTransfer; + } + SendResponseL( responseCode ); + result = EFalse; + } + + // SendObject is cancelled or connection is dropped. + if ( result && iCancelled ) + { + iFramework.RouteRequestUnregisterL( iExpectedSendObjectRequest, + iConnection ); + Rollback(); + SendResponseL( EMTPRespCodeTransactionCancelled ); + } + else if ( result && !iCancelled ) + { + if ( iObjectSize > 0 ) // media file + { + AddMediaToStoreL(); + + if( iPreviousOperation == EMTPOpCodeSendObjectPropList ) + { + SetObjectPropListL( *iObjectPropList ); + } + + // Commits into MTP data object enumeration store the object handle and + // storage space previously reserved for the specified object. + iFramework.ObjectMgr().CommitReservedObjectHandleL( *iReceivedObjectInfo ); + } + + // Commit object to MTP data store + iFramework.RouteRequestUnregisterL( iExpectedSendObjectRequest, + iConnection ); + + SendResponseL( EMTPRespCodeOK ); + } + + PRINT1( _L( "MM MTP <= CSendObject::DoHandleResponsePhaseObjectL result = %d" ), result ); + + return result; + } + +// ----------------------------------------------------------------------------- +// CSendObject::DoHandleCompletingPhaseL +// Completeing phase Handler +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CSendObject::DoHandleCompletingPhaseL() + { + TBool result = ETrue; + + PRINT( _L( "MM MTP => CSendObject::DoHandleCompletingPhaseL" ) ); + + CRequestProcessor::DoHandleCompletingPhaseL(); + //Ensure that, even though the SendObjectInfo was successul, the request responder is not deleted + if ( iProgress == EObjectInfoSucceed ) + { + result = EFalse; + } + else if ( iProgress == ESendObjectFail ) + { + //Sending Object failed, but still do not delete request, can try again with current info + iProgress = EObjectInfoSucceed; + result = EFalse; + } + + PRINT2( _L( "MM MTP <= CSendObject::DoHandleCompletingPhaseL iProgress= %d, result = %d" ), + iProgress, + result ); + + return result; + } + +// ----------------------------------------------------------------------------- +// Check if the property list is valid and extract necessary properties +// @param aInvalidParameterIndex if invalid, contains the index of the property. +// Undefined, if it is valid. +// @return if error, one of the error response code; otherwise EMTPRespCodeOK +// ----------------------------------------------------------------------------- +TMTPResponseCode CSendObject::VerifyObjectPropListL( TInt& aInvalidParameterIndex ) + { + PRINT( _L( "MM MTP => CSendObject::VerifyObjectPropListL" ) ); + + TMTPResponseCode responseCode( EMTPRespCodeOK ); + const TInt count = iObjectPropList->NumberOfElements(); + iObjectPropList->ResetCursor(); + for ( TInt i = 0; i < count; i++ ) + { + const CMTPTypeObjectPropListElement& element( iObjectPropList->GetNextElementL() ); + const TUint32 handle( element.Uint32L( CMTPTypeObjectPropListElement::EObjectHandle ) ); + aInvalidParameterIndex = i; + if ( handle != KMTPHandleNone ) + { + responseCode = EMTPRespCodeInvalidObjectHandle; + break; + } + + responseCode = CheckPropCodeL( element ); + if ( responseCode != EMTPRespCodeOK ) + { + break; + } + responseCode = ExtractPropertyL( element ); + if ( responseCode != EMTPRespCodeOK ) + { + break; + } + } + + PRINT1( _L( "MM MTP <= CSendObject::VerifyObjectPropListL, responseCode = 0x%X" ), responseCode ); + return responseCode; + } + +// ----------------------------------------------------------------------------- +// Validates the data type for a given property code. +// @param aElement an object property list element +// @param aPropertyCode MTP property code for the element +// @return EMTPRespCodeOK if the combination is valid, or another MTP response code if not +// ----------------------------------------------------------------------------- +TMTPResponseCode CSendObject::CheckPropCodeL( const CMTPTypeObjectPropListElement& aElement ) + { + PRINT( _L( "MM MTP => CSendObject::CheckPropCodeL" ) ); + TMTPResponseCode responseCode( EMTPRespCodeOK ); + + // Checking if the propCode is supported first then check its type + const RArray* properties = iDpConfig.GetSupportedPropertiesL( iObjectFormat ); + TUint16 propCode = aElement.Uint16L( CMTPTypeObjectPropListElement::EPropertyCode ); + TUint16 dataType = aElement.Uint16L( CMTPTypeObjectPropListElement::EDatatype ); + PRINT2( _L( "MM MTP => CSendObject::CheckPropCodeL propCode = 0x%X, dataType = 0x%X" ), propCode, dataType ); + + responseCode = EMTPRespCodeInvalidObjectPropCode; + const TInt count = properties->Count(); + for ( TInt i = 0; i < count; i++ ) + { + if ( ( *properties )[i] == propCode ) + { + responseCode = EMTPRespCodeOK; + break; + } + } + + if ( responseCode != EMTPRespCodeOK ) + return responseCode; + + // TODO: abstractmedia and media dp have different supported propCode, need check common prop code and check others in dp derived processors. + // also need to check if the propCode is supported + switch ( propCode ) + { + case EMTPObjectPropCodeStorageID: + if ( dataType != EMTPTypeUINT32 ) + { + responseCode = EMTPRespCodeInvalidObjectPropFormat; + } + else if ( iStorageId != aElement.Uint32L( CMTPTypeObjectPropListElement::EValue ) ) + { + responseCode = EMTPRespCodeInvalidDataset; + } + break; + + case EMTPObjectPropCodeObjectFormat: + if ( dataType != EMTPTypeUINT16 ) + { + responseCode = EMTPRespCodeInvalidObjectPropFormat; + } + else if ( iObjectFormat != aElement.Uint16L( CMTPTypeObjectPropListElement::EValue ) ) + { + responseCode = EMTPRespCodeInvalidDataset; + } + break; + + case EMTPObjectPropCodeObjectSize: + if ( dataType != EMTPTypeUINT64 ) + { + responseCode = EMTPRespCodeInvalidObjectPropFormat; + } + else if ( iObjectSize != aElement.Uint64L( CMTPTypeObjectPropListElement::EValue ) ) + { + responseCode = EMTPRespCodeInvalidDataset; + } + PRINT1(_L("MM MTP => CSendObject::CheckPropCodeL Checking ObjectSize %d"), responseCode ); + break; + + case EMTPObjectPropCodeParentObject: + if ( dataType != EMTPTypeUINT32 ) + { + responseCode = EMTPRespCodeInvalidObjectPropFormat; + } + else if ( ( iParentHandle != aElement.Uint32L( CMTPTypeObjectPropListElement::EValue ) ) + || ( KMTPHandleNone != aElement.Uint32L( CMTPTypeObjectPropListElement::EValue ) ) ) + // iParentHandle might be changed in CheckRequestL + { + responseCode = EMTPRespCodeInvalidDataset; + } + break; + + case EMTPObjectPropCodePersistentUniqueObjectIdentifier: // read-only + if ( dataType != EMTPTypeUINT128 ) + { + responseCode = EMTPRespCodeInvalidObjectPropFormat; + } + break; + + case EMTPObjectPropCodeProtectionStatus: + if ( dataType != EMTPTypeUINT16 ) + { + responseCode = EMTPRespCodeInvalidObjectPropFormat; + } + break; + + case EMTPObjectPropCodeDateCreated: + // TODO: this property is read-only, should response EMTPRespCodeAccessDenied or set nothing? + case EMTPObjectPropCodeDateModified: + case EMTPObjectPropCodeObjectFileName: + case EMTPObjectPropCodeName: + if ( dataType != EMTPTypeString ) + { + responseCode = EMTPRespCodeInvalidObjectPropFormat; + } + break; + + case EMTPObjectPropCodeNonConsumable: + if ( dataType != EMTPTypeUINT8 ) + { + responseCode = EMTPRespCodeInvalidObjectPropFormat; + } + break; + + default: + // check types of DP specific properties + // TODO: Is there anything except datatype need to be checked? + responseCode = CheckSepecificPropType( propCode, dataType ); + break; + } + + PRINT1( _L( "MM MTP <= CSendObject::CheckPropCode, responseCode = 0x%X" ), responseCode ); + return responseCode; + } + +// ----------------------------------------------------------------------------- +// Extracts the file information from the object property list element +// @param aElement an object property list element +// @param aPropertyCode MTP property code for the element +// @return MTP response code +// ----------------------------------------------------------------------------- +TMTPResponseCode CSendObject::ExtractPropertyL( const CMTPTypeObjectPropListElement& aElement ) + { + PRINT( _L ( "MM MTP => CSendObject::ExtractPropertyL" ) ); + TMTPResponseCode responseCode( EMTPRespCodeOK ); + switch ( aElement.Uint16L( CMTPTypeObjectPropListElement::EPropertyCode ) ) + { + case EMTPObjectPropCodeObjectFileName: + { + const TDesC& fileName = aElement.StringL( CMTPTypeObjectPropListElement::EValue ); + if ( !GetFullPathNameL( fileName ) ) + { + responseCode = EMTPRespCodeInvalidDataset; + } + } + break; + + case EMTPObjectPropCodeProtectionStatus: + { + iProtectionStatus = aElement.Uint16L( CMTPTypeObjectPropListElement::EValue ); + if ( iProtectionStatus != EMTPProtectionNoProtection + && iProtectionStatus != EMTPProtectionReadOnly ) + { + responseCode = EMTPRespCodeParameterNotSupported; + } + } + break; + + case EMTPObjectPropCodeDateModified: + delete iDateMod; + iDateMod = NULL; + iDateMod = aElement.StringL( CMTPTypeObjectPropListElement::EValue ).AllocL(); + // Cache it for further usage. + break; + + default: + // Only extract necessary properties which conform to SendObjectInfo. + break; + } + + PRINT1( _L( "MM MTP <= CSendObject::ExtractPropertyL, responseCode = 0x%X" ), responseCode ); + return responseCode; + } + +// ----------------------------------------------------------------------------- +// CSendObject::SetObjectPropListL +// Reserve object proplist into database +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CSendObject::SetObjectPropListL( const CMTPTypeObjectPropList& aPropList ) + { + PRINT( _L( "MM MTP => CSendObject::SetObjectPropListL" ) ); + + TMTPResponseCode responseCode( EMTPRespCodeOK ); + + const TUint count( iObjectPropList->NumberOfElements() ); + iObjectPropList->ResetCursor(); + for ( TInt i = 0; i < count; i++ ) + { + const CMTPTypeObjectPropListElement& element( iObjectPropList->GetNextElementL() ); + + TUint16 propertyCode = element.Uint16L( CMTPTypeObjectPropListElement::EPropertyCode ); + TUint16 dataType = element.Uint16L( CMTPTypeObjectPropListElement::EDatatype ); + PRINT2( _L( "MM MTP <> SetObjectPropListL propertyCode = 0x%x, dataType = 0x%x" ), + propertyCode, dataType ); + + switch ( propertyCode ) + { + case EMTPObjectPropCodeStorageID: + case EMTPObjectPropCodeObjectFormat: + case EMTPObjectPropCodeProtectionStatus: + case EMTPObjectPropCodeObjectSize: + case EMTPObjectPropCodeParentObject: + case EMTPObjectPropCodePersistentUniqueObjectIdentifier: + // Do nothing for those properties are already set. + break; + + case EMTPObjectPropCodeNonConsumable: + case EMTPObjectPropCodeDateAdded: + case EMTPObjectPropCodeDateCreated: + case EMTPObjectPropCodeDateModified: + case EMTPObjectPropCodeObjectFileName: + // TODO: Does anything need to be done on these read-only properties? + /* spec: + * Object properties that are get-only (0x00 GET) + * should accept values during object creation by + * way of the SendObjectPropList command. + */ + break; + + case EMTPObjectPropCodeName: + { + CMTPTypeString* stringData = CMTPTypeString::NewLC( element.StringL( CMTPTypeObjectPropListElement::EValue ) );// + stringData + + responseCode = SetMetaDataToWrapperL( propertyCode, + *stringData, + *iReceivedObjectInfo ); + + CleanupStack::PopAndDestroy( stringData );// - stringData + } + break; + + default: + { + responseCode = SetSpecificObjectPropertyL( propertyCode, + *iReceivedObjectInfo, + element ); + } + break; + } // end of switch + } // end of for + + PRINT1( _L( "MM MTP <= CSendObject::SetObjectPropListL responseCode = 0x%x" ), responseCode ); + return responseCode; + } + +// ----------------------------------------------------------------------------- +// CSendObject::SetMetaDataToWrapperL +// +// ----------------------------------------------------------------------------- +// +EXPORT_C TMTPResponseCode CSendObject::SetMetaDataToWrapperL( const TUint16 aPropCode, + MMTPType& aNewData, + const CMTPObjectMetaData& aObjectMetaData ) + { + TMTPResponseCode resCode = EMTPRespCodeOK; + TRAPD( err, iDpConfig.GetWrapperL().SetObjectMetadataValueL( aPropCode, + aNewData, + aObjectMetaData ) ); + + PRINT1( _L("MM MTP <> CSendObject::SetMetaDataToWrapperL err = %d"), err); + + if ( err == KErrNone ) + { + resCode = EMTPRespCodeOK; + } + else if ( err == KErrTooBig ) + // according to the codes of S60 + { + resCode = EMTPRespCodeInvalidDataset; + } + else if ( err == KErrPermissionDenied ) + { + resCode = EMTPRespCodeAccessDenied; + } + else if ( err == KErrNotFound ) + { + if ( MmMtpDpUtility::HasMetadata( aObjectMetaData.Uint( CMTPObjectMetaData::EFormatCode ) ) ) + SendResponseL( EMTPRespCodeAccessDenied ); + } + else + { + err = HandleSpecificWrapperError( err, aObjectMetaData ); + + if ( err != KErrNone ) + resCode = EMTPRespCodeGeneralError; + } + + PRINT1( _L( "MM MTP <= CSendObject::SetMetaDataToWrapperL resCode = 0x%x" ), resCode ); + + return resCode; + } + +// ----------------------------------------------------------------------------- +// CSendObject::MatchStoreAndParentL +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CSendObject::MatchStoreAndParentL() + { + TMTPResponseCode responseCode = EMTPRespCodeOK; + + iStorageId = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); + iParentHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter2 ); + PRINT2( _L( "MM MTP <> CSendObject::MatchStoreAndParentL, iStorageId = 0x%X, iParentHandle = 0x%X" ), + iStorageId, + iParentHandle ); + + if ( iStorageId == KMTPStorageDefault ) + { + iStorageId = iDpConfig.GetDefaultStorageIdL(); + PRINT1( _L( "MM MTP <> CSendObject::GetDefaultStorageIdL, iStorageId = 0x%X" ), iStorageId ); + } + + delete iParentSuid; + iParentSuid = NULL; + + if( iParentHandle == KMTPHandleNone ) // parentHandle is not used by initiator, set it to root + { + iParentHandle = KMTPHandleAll; + } + if ( iParentHandle == KMTPHandleAll ) // According to spec, KMTPHandleAll means initiator wish to place in the root + { + PRINT( _L( "MM MTP <> CSendObject::MatchStoreAndParentL, iParentSuid = KMTPHandleAll" ) ); + iParentSuid = iFramework.StorageMgr().StorageL( iStorageId ).DesC( CMTPStorageMetaData::EStorageSuid ).AllocL(); + PRINT1( _L( "MM MTP <> CSendObject::MatchStoreAndParentL, iParentSuid = %S" ), iParentSuid ); + } + else // parentHandle is specified by initiator + { + // does not take owernship + CMTPObjectMetaData* parentObjInfo = iRequestChecker->GetObjectInfo( iParentHandle ); + __ASSERT_DEBUG( parentObjInfo, Panic( EMmMTPDpObjectNull ) ); + + if ( parentObjInfo->Uint( CMTPObjectMetaData::EStorageId ) != iStorageId ) + { + responseCode = EMTPRespCodeInvalidObjectHandle; + PRINT( _L( "MM MTP <> CSendObject::MatchStoreAndParentL, STORAGEID DOES NOT MATCH WITH PARENTHANDLE!" ) ); + } + else + { + iParentSuid = parentObjInfo->DesC( CMTPObjectMetaData::ESuid ).AllocL(); + } + } + PRINT1( _L( "MM MTP <> CSendObject::MatchStoreAndParentL, iParentSuid = %S" ), iParentSuid ); + + if ( ( responseCode == EMTPRespCodeOK ) && !BaflUtils::PathExists( iFramework.Fs(), *iParentSuid ) ) + { + responseCode = EMTPRespCodeInvalidDataset; + } + + return responseCode; + } + +// ----------------------------------------------------------------------------- +// CSendObject::IsTooLarge +// Check if the object is too large +// @return ETrue if yes, otherwise EFalse +// ----------------------------------------------------------------------------- +// +TBool CSendObject::IsTooLarge( TUint32 aObjectSize ) const + { + TBool ret = ( aObjectSize > KMaxTInt ); + PRINT2( _L( "MM MTP <> CSendObject::IsTooLarge aObjectSize = %d, ret = %d" ), aObjectSize, ret ); + return ret; + } + +// ----------------------------------------------------------------------------- +// CSendObject::CanStoreFileL +// Check if we can store the file on the storage +// @return ETrue if yes, otherwise EFalse +// ----------------------------------------------------------------------------- +// +TBool CSendObject::CanStoreFileL( TUint32 aStorageId, + TInt64 aObjectSize ) const + { + PRINT( _L( "MM MTP => CSendObject::CanStoreFileL" ) ); + + TBool result = ETrue; + TVolumeInfo volumeInfo; + TInt driveNo = iFramework.StorageMgr().DriveNumber( aStorageId ); + User::LeaveIfError( iFs.Volume( volumeInfo, driveNo ) ); + + if ( volumeInfo.iFree < aObjectSize ) + { + result = EFalse; + } + + PRINT1( _L( "MM MTP <= CSendObject::CanStoreFileL , result = %d" ), result ); + + return result; + } + +// ----------------------------------------------------------------------------- +// CSendObject::GetFullPathNameL +// Get the full path name of the object to be saved +// @param aFileName, on entry, contains the file name of the object, +// on return, contains the full path name of the object to be saved +// ----------------------------------------------------------------------------- +// +TBool CSendObject::GetFullPathNameL( const TDesC& aFileName ) + { + PRINT1( _L("MM MTP => CSendObject::GetFullPathNameL aFileName = %S"), &aFileName ); + + TBool result( EFalse ); + if ( aFileName.Length() > 0 ) + { + iFullPath.Zero(); + iFullPath.Append( *iParentSuid ); + if ( ( iFullPath.Length() + aFileName.Length() ) < KMaxFileName ) + { + iFullPath.Append( aFileName ); + PRINT1( _L( "MM MTP <> CSendObject::GetFullPathNameL iFullPath = %S" ), &iFullPath ); + result = iFramework.Fs().IsValidName( iFullPath ); + } + } + if ( result && ( iObjectFormat != MmMtpDpUtility::FormatFromFilename( iFullPath ) ) ) + { + PRINT2( _L( "MM MTP <> %S does not match 0x%x" ), &iFullPath, iObjectFormat ); + result = EFalse; + } + + PRINT1( _L( "MM MTP <= CSendObject::GetFullPathNameL result = %d" ), result ); + + return result; + } + +// ----------------------------------------------------------------------------- +// CSendObject::ExistsL +// Check if the file already exists on the storage. +// ----------------------------------------------------------------------------- +// +TBool CSendObject::ExistsL( const TDesC& aName ) const + { + PRINT1( _L( "MM MTP => CSendObject::Exists aName = %S" ), &aName ); + // This detects both files and folders + TBool ret( EFalse ); + ret = BaflUtils::FileExists( iFramework.Fs(), aName ); + +#ifdef MMMTPDP_REPLACE_EXIST_FILE + if( ret ) + { + // delete the old one and replace + TInt delErr = iFramework.Fs().Delete( aName ); + PRINT1( _L( "MM MTP <> CSendObject::Exists delErr = %d" ), delErr ); + // delete from the metadata DB + TRAPD( err, iFramework.ObjectMgr().RemoveObjectL( aName ) ); + PRINT1( _L( "MM MTP <> CSendObject::Exists err = %d" ), err ); + if( err == KErrNone ) + { + // do nothing, ignore warning + } + // delete from video/mpx DB + CMTPObjectMetaData* objectInfo = CMTPObjectMetaData::NewLC(); // + objectInfo + if ( iFramework.ObjectMgr().ObjectL( aName, *objectInfo ) ) + { + TRAP_IGNORE( iWrapper.DeleteObjectL( aName, + objectInfo->Uint( CMTPObjectMetaData::EFormatCode ) ) ); + } + CleanupStack::PopAndDestroy( objectInfo ); // - objectInfo + ret = EFalse; + } +#endif + PRINT1( _L( "MM MTP <= CSendObject::Exists ret = %d" ), ret ); + return ret; + } + +// ----------------------------------------------------------------------------- +// CSendObject::ReserveObjectL +// ----------------------------------------------------------------------------- +// +void CSendObject::ReserveObjectL() + { + PRINT( _L( "MM MTP => CSendObject::ReserveObjectL" ) ); + TInt err = KErrNone; + + iReceivedObjectInfo->SetUint( CMTPObjectMetaData::EStorageId, iStorageId ); + iReceivedObjectInfo->SetUint( CMTPObjectMetaData::EParentHandle, + iParentHandle ); + iReceivedObjectInfo->SetDesCL( CMTPObjectMetaData::ESuid, iFullPath ); + iReceivedObjectInfo->SetUint( CMTPObjectMetaData::EFormatCode, + iObjectFormat ); + + // Reserves space for and assigns an object handle to the object described + // by the specified object information record. + TRAP( err, iObjectMgr.ReserveObjectHandleL( *iReceivedObjectInfo, + iObjectSize ) ); + + PRINT2( _L( "MM MTP => CSendObject::ReserveObjectL iObjectsize = %Lu, Operation: 0x%x" ), iObjectSize, iOperationCode ); + if ( err != KErrNone ) + PRINT1( _L( "MM MTP <> CSendObject::ReserveObjectL err = %d" ), err ); + if ( iObjectSize == 0 ) + { + SaveEmptyFileL(); + iObjectMgr.CommitReservedObjectHandleL( *iReceivedObjectInfo ); + } + + iExpectedSendObjectRequest.SetUint32( TMTPTypeRequest::ERequestSessionID, + iSessionId ); + iFramework.RouteRequestRegisterL( iExpectedSendObjectRequest, iConnection ); + + TUint32 parameters[3]; + parameters[0] = iStorageId; + parameters[1] = iParentHandle; + parameters[2] = iReceivedObjectInfo->Uint( CMTPObjectMetaData::EHandle ); + SendResponseL( EMTPRespCodeOK, 3, parameters ); + + PRINT( _L( "MM MTP <= CSendObject::ReserveObjectL" ) ); + } + +// ----------------------------------------------------------------------------- +// CSendObject::SetProtectionStatusL +// ----------------------------------------------------------------------------- +// +void CSendObject::SetProtectionStatusL() + { + PRINT1( _L( "MM MTP => CSendObject::SetProtectionStatusL iProtectionStatus = %d" ), iProtectionStatus ); + + if ( iProtectionStatus == EMTPProtectionNoProtection + || iProtectionStatus == EMTPProtectionReadOnly ) + { + // TODO: wait for review + TInt err = KErrNone; + if ( iProtectionStatus == EMTPProtectionNoProtection ) + { + iFs.SetAtt( iFullPath, KEntryAttNormal, KEntryAttReadOnly ); + } + else + { + iFs.SetAtt( iFullPath, KEntryAttReadOnly, KEntryAttNormal ); + } + User::LeaveIfError( err ); + } + PRINT( _L( "MM MTP <= CSendObject::SetProtectionStatusL" ) ); + } + +// ----------------------------------------------------------------------------- +// CSendObject::SaveEmptyFileL +// ----------------------------------------------------------------------------- +// +void CSendObject::SaveEmptyFileL() + { + PRINT( _L( "MM MTP => CSendObject::SaveEmptyFileL" ) ); + + RFile file; + User::LeaveIfError( file.Create( iFs, iFullPath, EFileWrite ) ); + file.Close(); + + // set entry protection status and modified date + SetProtectionStatusL(); + + // add playlist to MPX DB + TParsePtrC parse( iFullPath ); + iDpConfig.GetWrapperL().SetStorageRootL( parse.Drive() ); + iDpConfig.GetWrapperL().AddObjectL( iFullPath ); + + if ( EMTPFormatCodeAbstractAudioVideoPlaylist == iObjectFormat ) + { + TInt err = KErrNone; + err = iFs.SetAtt( iFullPath, + KEntryAttSystem | KEntryAttHidden, + KEntryAttReadOnly | KEntryAttNormal ); + if ( err != KErrNone ) + PRINT1( _L( "MM MTP <> CSendObject::SaveEmptyFileL err = %d" ), err ); + iDpConfig.GetWrapperL().AddDummyFileL( iFullPath ); + } + + PRINT( _L( "MM MTP <= CSendObject::SaveEmptyFileL" ) ); + } + +// ----------------------------------------------------------------------------- +// CSendObject::AddMediaToStoreL() +// +// ----------------------------------------------------------------------------- +// +void CSendObject::AddMediaToStoreL() + { + PRINT( _L( "MM MTP => CSendObject::AddMediaToStoreL" ) ); + + TBool isVideo = EFalse; + switch ( iObjectFormat ) + { + case EMTPFormatCode3GPContainer: + case EMTPFormatCodeMP4Container: + case EMTPFormatCodeASF: + { + TMmMtpSubFormatCode subFormatCode; + + if ( MmMtpDpUtility::IsVideoL( iFullPath ) ) + { + subFormatCode = EMTPSubFormatCodeVideo; + isVideo = ETrue; + } + else + { + subFormatCode = EMTPSubFormatCodeAudio; + isVideo = EFalse; + } + + iReceivedObjectInfo->SetUint( CMTPObjectMetaData::EFormatSubCode, + ( TUint ) subFormatCode ); + } + break; + + // put all just video format codes here + case EMTPFormatCodeWMV: + { + isVideo = ETrue; + } + break; + + default: + PRINT( _L( "MM MTP <> CSendObject::DoHandleResponsePhaseObjectL default" ) ); + break; + } + + TPtrC suid( iReceivedObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); + PRINT1( _L( "MM MTP <> CSendObject::AddMediaToStoreL suid = %S" ), &suid ); + TParsePtrC parse( suid ); + iDpConfig.GetWrapperL().SetStorageRootL( parse.Drive() ); + iDpConfig.GetWrapperL().AddObjectL( iFullPath, isVideo ); + + if ( isVideo ) + { + TInt err = KErrNone; + TRAP( err, iDpConfig.GetWrapperL().SetImageObjPropL( iFullPath, iWidth, iHeight ) ); + + PRINT1( _L( "MM MTP <= CSendObject::AddVideoToStoreL err = %d" ), err ); + } + + PRINT( _L( "MM MTP <= CSendObject::AddMediaToStoreL" ) ); + } + +// ----------------------------------------------------------------------------- +// CSendObject::UsbDisconnect +// +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSendObject::UsbDisconnect() + { + PRINT( _L( "MM MTP => CSendObject::UsbDisconnect" ) ); + Rollback(); + PRINT( _L( "MM MTP <= CSendObject::UsbDisconnect" ) ); + } + +// ----------------------------------------------------------------------------- +// CSendObject::Rollback() +// delete the file, which transfer incompletely +// ----------------------------------------------------------------------------- +// +void CSendObject::Rollback() + { + // Delete this object from file system. + if ( iProgress == ESendObjectInProgress ) + { + PRINT1( _L( "MM MTP <> CSendObject::Rollback ROLLBACK_FILE %S" ), &iFullPath ); + iFramework.Fs().Delete( iFullPath ); + TRAP_IGNORE( iFramework.ObjectMgr().UnreserveObjectHandleL( *iReceivedObjectInfo ) ); + iProgress = EObjectNone; + } + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/csetobjectproplist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/csetobjectproplist.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,378 @@ +/* +* 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: Implement the operation: SetObjectPropList +* +*/ + + +#include +#include +#include +#include +#include + +#include "csetobjectproplist.h" +#include "cmmmtpdpmetadataaccesswrapper.h" +#include "mmmtpdputility.h" +#include "mmmtpdplogger.h" +#include "mmmtpdpconfig.h" + +// ----------------------------------------------------------------------------- +// CSetObjectPropList::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +//EXPORT_C MMmRequestProcessor* CSetObjectPropList::NewL( MMTPDataProviderFramework& aFramework, +// MMTPConnection& aConnection, +// CMmMtpDpMetadataAccessWrapper& aWrapper ) +// { +// CSetObjectPropList* self = new ( ELeave ) CSetObjectPropList( aFramework, +// aConnection, +// aWrapper ); +// CleanupStack::PushL( self ); +// self->ConstructL(); +// CleanupStack::Pop( self ); +// return self; +// } + +// ----------------------------------------------------------------------------- +// CSetObjectPropList::CSetObjectPropList +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSetObjectPropList::CSetObjectPropList( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CRequestProcessor( aFramework, aConnection, 0, NULL), + iObjectMgr( aFramework.ObjectMgr() ), + iFs( aFramework.Fs() ), + iDpConfig( aDpConfig ), + iUnprocessedIndex ( 0 ) + { + PRINT( _L( "Operation: SetObjectPropList(0x9806)" ) ); + } + +// ----------------------------------------------------------------------------- +// CSetObjectPropList::ConstructL +// 2nd Phase Constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSetObjectPropList::ConstructL() + { + CActiveScheduler::Add( this ); + + iPropertyList = CMTPTypeObjectPropList::NewL(); + SetPSStatus(); + } + +// ----------------------------------------------------------------------------- +// CSetObjectPropList::~CSetObjectPropList +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSetObjectPropList::~CSetObjectPropList() + { + Cancel(); + delete iPropertyList; + } + +// ----------------------------------------------------------------------------- +// CSetObjectPropList::ServiceL +// SetObjectPropList request handler +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSetObjectPropList::ServiceL() + { + PRINT( _L( "MM MTP => CSetObjectPropList::ServiceL" ) ); + // Recieve the data from the property list + ReceiveDataL( *iPropertyList ); + PRINT( _L( "MM MTP <= CSetObjectPropList::ServiceL" ) ); + } + +// ----------------------------------------------------------------------------- +// CSetObjectPropList::DoHandleResponsePhaseL +// Completing phase for the request handler +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CSetObjectPropList::DoHandleResponsePhaseL() + { + PRINT( _L( "MM MTP => CSetObjectPropList::DoHandleResponsePhaseL" ) ); + + iElementCount = iPropertyList->NumberOfElements(); + iPropertyList->ResetCursor(); + if( iElementCount > 0 ) + { + iUnprocessedIndex = 0; + TRequestStatus* status = &iStatus; + User::RequestComplete( status, iStatus.Int() ); + SetActive(); + } + else + { + SendResponseL( EMTPRespCodeOK ); + } + + PRINT( _L( "MM MTP <= CSetObjectPropList::DoHandleResponsePhaseL" ) ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CSetObjectPropList::SetObjectPropListL +// Set object proplist +// ----------------------------------------------------------------------------- +// +TMTPResponseCode CSetObjectPropList::SetObjectPropListL( + const CMTPTypeObjectPropListElement& aPropListElement ) + { + PRINT( _L( "MM MTP => CSetObjectPropList::SetObjectPropListL" ) ); + + TMTPTypeUint16 protectionStatus( EMTPProtectionNoProtection ); + TMTPResponseCode responseCode( EMTPRespCodeOK ); + + TUint32 handle = aPropListElement.Uint32L( CMTPTypeObjectPropListElement::EObjectHandle ); + TUint16 propertyCode = aPropListElement.Uint16L( CMTPTypeObjectPropListElement::EPropertyCode ); + TUint16 dataType = aPropListElement.Uint16L( CMTPTypeObjectPropListElement::EDatatype ); + PRINT3( _L( "MM MTP <> handle = 0x%x, propertyCode = 0x%x, dataType = 0x%x" ), + handle, propertyCode, dataType ); + + responseCode = MmMtpDpUtility::CheckPropType( propertyCode, dataType ); + PRINT1( _L( "MM MTP <> CheckPropType response code is 0x%x" ), responseCode ); + if( responseCode != EMTPRespCodeOK ) + return responseCode; + + if ( iFramework.ObjectMgr().ObjectOwnerId( handle ) + == iFramework.DataProviderId() ) + { + PRINT( _L( "MM MTP => CSetObjectPropList::SetObjectPropListL enter" ) ); + CMTPObjectMetaData* object = CMTPObjectMetaData::NewLC(); // + object + iFramework.ObjectMgr().ObjectL( handle, *object ); + + if ( protectionStatus.Value() != EMTPProtectionNoProtection ) + { + //for some reason, P4S expects Access Denied response instead of write protected + return EMTPRespCodeAccessDenied; // EMTPRespCodeObjectWriteProtected; + } + + switch ( propertyCode ) + { + case EMTPObjectPropCodeStorageID: + case EMTPObjectPropCodeObjectFormat: + case EMTPObjectPropCodeProtectionStatus: + case EMTPObjectPropCodeObjectSize: + case EMTPObjectPropCodeParentObject: + case EMTPObjectPropCodePersistentUniqueObjectIdentifier: + case EMTPObjectPropCodeNonConsumable: + case EMTPObjectPropCodeDateAdded: + case EMTPObjectPropCodeDateCreated: + case EMTPObjectPropCodeDateModified: + { + responseCode = EMTPRespCodeAccessDenied; + } + break; + + case EMTPObjectPropCodeObjectFileName: + { + TPtrC suid( object->DesC( CMTPObjectMetaData::ESuid ) ); + TBuf newSuid( aPropListElement.StringL( + CMTPTypeObjectPropListElement::EValue ) ); + TInt err = KErrNone; + err = MmMtpDpUtility::UpdateObjectFileName( iFramework.Fs(), suid, newSuid ); + PRINT1( _L( "MM MTP <> Update object file name err = %d" ), err ); + if ( KErrOverflow == err ) // full path name is too long + { + responseCode = EMTPRespCodeInvalidDataset; + } + else if ( ( KErrNone == err ) || ( KErrAlreadyExists == err ) ) + { + TRAP( err, iDpConfig.GetWrapperL().RenameObjectL( suid, newSuid ) ); //Update MPX DB + PRINT1( _L( "MM MTP <> Rename Object err = %d" ), err ); + // it is ok if file is not found in DB, following S60 solution + if ( KErrNotFound == err ) + { + TRAP( err, iDpConfig.GetWrapperL().AddObjectL( newSuid ) ); + PRINT1( _L( "MM MTP <> Add Object err = %d" ), err ); + } + + if ( KErrNone == err ) + { + object->SetDesCL( CMTPObjectMetaData::ESuid, newSuid ); + iFramework.ObjectMgr().ModifyObjectL( *object ); + } + else + { + responseCode = EMTPRespCodeGeneralError; + } + } + } + break; + + case EMTPObjectPropCodeName: + { + CMTPTypeString* stringData = CMTPTypeString::NewLC( + aPropListElement.StringL( + CMTPTypeObjectPropListElement::EValue ) );// + stringData + + responseCode = ServiceMetaDataToWrapperL( propertyCode, + *stringData, *object ); + + CleanupStack::PopAndDestroy( stringData );// - stringData + } + break; + + default: + { + /*// trap and handle with response code here, so correct fail index should report + TRAPD( err, responseCode = ServiceSpecificObjectPropertyL( propertyCode, *object, aPropListElement ) ); + PRINT1( _L("MM MTP <> CSetObjectPropList::SetObjectPropListL, ServiceSpecificObjectPropertyL, err = %d"), err ); + + if ( err == KErrNotSupported ) + { + responseCode = EMTPRespCodeAccessDenied; + }*/ + responseCode = ServiceSpecificObjectPropertyL( propertyCode, *object, + aPropListElement ); + } + break; + } + + CleanupStack::PopAndDestroy( object ); // - object + } + + PRINT1( _L( "MM MTP <= CSetObjectPropList::SetObjectPropListL responseCode = 0x%x" ), responseCode ); + return responseCode; + } + +// ----------------------------------------------------------------------------- +// CSetObjectPropList::HasDataphase +// Decide if has data phase +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CSetObjectPropList::HasDataphase() const + { + return ETrue; + } + +// ----------------------------------------------------------------------------- +// CSetObjectPropList::ServiceMetaDataToWrapperL +// +// ----------------------------------------------------------------------------- +// +EXPORT_C TMTPResponseCode CSetObjectPropList::ServiceMetaDataToWrapperL( + const TUint16 aPropCode, + MMTPType& aNewData, + const CMTPObjectMetaData& aObjectMetaData ) + { + TMTPResponseCode resCode = EMTPRespCodeOK; + + TRAPD( err, iDpConfig.GetWrapperL().SetObjectMetadataValueL( aPropCode, + aNewData, + aObjectMetaData ) ); + + PRINT1( _L("MM MTP <> CSetObjectPropList::ServiceMetaDataToWrapperL err = %d"), err); + + if ( err == KErrNone ) + { + resCode = EMTPRespCodeOK; + } + else if ( err == KErrTooBig ) + // according to the codes of S60 + { + resCode = EMTPRespCodeInvalidDataset; + } + else if ( err == KErrPermissionDenied ) + { + resCode = EMTPRespCodeAccessDenied; + } + else if ( err == KErrNotFound ) + { + if( MmMtpDpUtility::HasMetadata( aObjectMetaData.Uint( CMTPObjectMetaData::EFormatCode ) ) ) + SendResponseL( EMTPRespCodeAccessDenied ); + } + else + { + // add new virtual call to see if the above condition can be handle probably + err = HandleSpecificWrapperError( err, aObjectMetaData ); + + if ( err != KErrNone ) + resCode = EMTPRespCodeGeneralError; + } + + PRINT1( _L( "MM MTP <= CSetObjectPropList::ServiceMetaDataToWrapperL resCode = 0x%x" ), resCode ); + + return resCode; + } + +// ----------------------------------------------------------------------------- +// CSetObjectPropList::RunL +// +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSetObjectPropList::RunL() + { + if ( iUnprocessedIndex < iElementCount ) + { + TMTPResponseCode responseCode = SetObjectPropListL( iPropertyList->GetNextElementL()); + + if ( responseCode != EMTPRespCodeOK ) + { + SendResponseL( responseCode, 1, &iUnprocessedIndex ); + } + else + { + // Complete ourselves with current TRequestStatus + // Increase index to process next handle on next round + iUnprocessedIndex++; + TRequestStatus* status = &iStatus; + User::RequestComplete( status, iStatus.Int() ); + SetActive(); + } + } + else // all handles processed, can send data + { + SendResponseL( EMTPRespCodeOK ); + } + } + +// ----------------------------------------------------------------------------- +// CSetObjectPropList::RunError +// +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CSetObjectPropList::RunError( TInt aError ) + { + PRINT1( _L( "MM MTP <> CSetObjectPropList::RunError with error %d" ), aError ); + + // Reschedule ourselves + // TODO: go to next index or increase? + // iUnprocessedIndex++ +// TRequestStatus* status = &iStatus; +// User::RequestComplete( status, aError ); +// SetActive(); + PRINT1( _L( "MM MTP <> CGetObjectPropList::RunError aError = %d" ), aError ); + TRAP_IGNORE( SendResponseL( EMTPRespCodeGeneralError ) ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CSetObjectPropList::DoCancel() +// Cancel the process +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSetObjectPropList::DoCancel() + { + + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/csetobjectpropvalue.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/csetobjectpropvalue.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,363 @@ +/* +* 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: Implement opeartion SetObjectPropValue +* +*/ + + +#include +#include +#include +#include + +#include "csetobjectpropvalue.h" +#include "mmmtpdputility.h" +#include "cmmmtpdpmetadataaccesswrapper.h" +#include "tmmmtpdppanic.h" +#include "mmmtpdplogger.h" +#include "mmmtpdpconfig.h" + +// ----------------------------------------------------------------------------- +// Verification data for the SetObjectPropValue request +// ----------------------------------------------------------------------------- +// +const TMTPRequestElementInfo KMTPSetObjectPropValuePolicy[] = + { + { + TMTPTypeRequest::ERequestParameter1, + EMTPElementTypeObjectHandle, + EMTPElementAttrWrite, + 0, + 0, + 0 + }, + }; + +// ----------------------------------------------------------------------------- +// CSetObjectPropValue::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +//EXPORT_C MMmRequestProcessor* CSetObjectPropValue::NewL( MMTPDataProviderFramework& aFramework, +// MMTPConnection& aConnection, +// CMmMtpDpMetadataAccessWrapper& aWrapper ) +// { +// CSetObjectPropValue* self = new (ELeave) CSetObjectPropValue( aFramework, aConnection, aWrapper ); +// +// return self; +// } + +// ----------------------------------------------------------------------------- +// CSetObjectPropValue::CSetObjectPropValue +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSetObjectPropValue::CSetObjectPropValue( + MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CRequestProcessor( aFramework, + aConnection, + sizeof(KMTPSetObjectPropValuePolicy) / sizeof(TMTPRequestElementInfo), + KMTPSetObjectPropValuePolicy ), + iObjectMgr( aFramework.ObjectMgr() ), + iDpConfig( aDpConfig ) + { + SetPSStatus(); + PRINT( _L( "Operation: SetObjectPropValue(0x9804)" ) ); + } + +// ----------------------------------------------------------------------------- +// CSetObjectPropValue::~CSetObjectPropValue +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSetObjectPropValue::~CSetObjectPropValue() + { + delete iMTPTypeString; + delete iMTPTypeArray; + } + +// ----------------------------------------------------------------------------- +// CSetObjectPropValue::IsPropCodeReadonly +// A helper function of CheckRequestL. +// To check whether the object property code is readonly. +// ----------------------------------------------------------------------------- +// +TBool CSetObjectPropValue::IsPropCodeReadonly( TUint16 aPropCode ) + { + TBool returnCode = EFalse; + + switch (aPropCode) + { + case EMTPObjectPropCodeStorageID: + case EMTPObjectPropCodeObjectFormat: + case EMTPObjectPropCodeProtectionStatus: + case EMTPObjectPropCodeObjectSize: + case EMTPObjectPropCodeParentObject: + case EMTPObjectPropCodePersistentUniqueObjectIdentifier: + case EMTPObjectPropCodeNonConsumable: + case EMTPObjectPropCodeDateAdded: + case EMTPObjectPropCodeDateCreated: + case EMTPObjectPropCodeDateModified: + //case EMTPObjectPropCodeVideoBitRate: // move to specific dp + returnCode = ETrue; + break; + + default: + returnCode = IsSpecificPropCodeReadOnly(aPropCode); + break; + } + + return returnCode; + } + +// ----------------------------------------------------------------------------- +// CSetObjectPropValue::CheckRequestL +// Verify the reqeust +// ----------------------------------------------------------------------------- +// +EXPORT_C TMTPResponseCode CSetObjectPropValue::CheckRequestL() + { + PRINT( _L( "MM MTP => CSetObjectPropValue::CheckRequestL" ) ); + + TMTPResponseCode result = CRequestProcessor::CheckRequestL(); + + // Check if property is supported + if ( result == EMTPRespCodeOK ) + { + iPropCode = Request().Uint32( TMTPTypeRequest::ERequestParameter2 ); + PRINT1( _L( "MM MTP <> CSetObjectPropValue::CheckRequestL iPropCode = 0x%x" ), iPropCode ); + result = EMTPRespCodeInvalidObjectPropCode; + + TUint32 objectHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); + CMTPObjectMetaData* objectInfo = iRequestChecker->GetObjectInfo( objectHandle ); + + if (!objectInfo) + { + PRINT(_L("MM MTP <> CGetObjectPropValue::CheckRequestL, objectInfo is NULL")); + return EMTPRespCodeInvalidObjectHandle; + } + + TFileName fileName = objectInfo->DesC(CMTPObjectMetaData::ESuid); + TUint32 formatCode = objectInfo->Uint(CMTPObjectMetaData::EFormatCode); + + PRINT3( _L( "MM MTP <> CGetObjectPropValue::CheckRequestL, handle = 0x%x, filename = %S, formatCode = 0x%x" ), + objectHandle, + &fileName, + formatCode ); + const RArray* properties = iDpConfig.GetSupportedPropertiesL( formatCode ); + TInt count = properties->Count(); + for ( TInt i = 0; i < count; i++ ) + { + // Object property code is supported, but can not be set which is read only. + if ( (*properties)[i] == iPropCode + && IsPropCodeReadonly( iPropCode ) ) + { + result = EMTPRespCodeAccessDenied; + break; + } + // Object property code is supported and can be set. + else if ( iPropCode == (*properties)[i] ) + { + result = EMTPRespCodeOK; + break; + } + } // end of for + } + + PRINT( _L( "MM MTP <= CSetObjectPropValue::CheckRequestL" ) ); + return result; + } + +EXPORT_C TBool CSetObjectPropValue::HasDataphase() const + { + return ETrue; + } + +// ----------------------------------------------------------------------------- +// CSetObjectPropValue::ServiceL +// SetObjectPropValue request handler +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSetObjectPropValue::ServiceL() + { + PRINT( _L( "MM MTP => CSetObjectPropValue::ServiceL" ) ); + __ASSERT_DEBUG( iRequestChecker, Panic( EMmMTPDpRequestCheckNull ) ); + TUint32 handle = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); + PRINT1( _L( "MM MTP <> CSetObjectPropValue::ServiceL handle = 0x%x" ), handle ); + + iObjectInfo = iRequestChecker->GetObjectInfo( handle ); + + switch ( iPropCode ) + { + // Access not allowed on these properties: (so send error) + case EMTPObjectPropCodeStorageID: + case EMTPObjectPropCodeObjectFormat: + case EMTPObjectPropCodeProtectionStatus: + case EMTPObjectPropCodeObjectSize: + case EMTPObjectPropCodeParentObject: + case EMTPObjectPropCodePersistentUniqueObjectIdentifier: + case EMTPObjectPropCodeDateAdded: // 0xDC4E + case EMTPObjectPropCodeDateCreated: // Date Created(0xDC08) + case EMTPObjectPropCodeDateModified: // Modified Date(0xDC09) + case EMTPObjectPropCodeNonConsumable: // Non Consumable(0xDC4F) + case EMTPObjectPropCodeVideoBitRate: // 0xDE9C + { + SendResponseL( EMTPRespCodeAccessDenied ); + } + break; + + // Get Data for String objects + case EMTPObjectPropCodeObjectFileName: // 0xDC07 + case EMTPObjectPropCodeName: // 0xDC44 + { + delete iMTPTypeString; + iMTPTypeString = NULL; + iMTPTypeString = CMTPTypeString::NewL(); + ReceiveDataL( *iMTPTypeString ); + } + break; + + default: + { + ReceiveDataSpecificObjectPropertyL( iPropCode ); + } + break; + } + PRINT( _L( "MM MTP <= CSetObjectPropValue::ServiceL" ) ); + } + +// ----------------------------------------------------------------------------- +// CSetObjectPropValue::DoHandleResponsePhaseL +// Edit the file to update the prop value +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CSetObjectPropValue::DoHandleResponsePhaseL() + { + PRINT( _L( "MM MTP => CSetObjectPropValue::DoHandleResponsePhaseL" ) ); + __ASSERT_DEBUG( iObjectInfo, Panic( EMmMTPDpObjectNull ) ); + TMTPResponseCode responseCode = EMTPRespCodeOK; + + switch ( iPropCode ) + { + case EMTPObjectPropCodeObjectFileName: + { + TPtrC suid( iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); + TBuf newSuid( iMTPTypeString->StringChars() ); + PRINT2( _L( "MM MTP <> old name = %S, new name = %S" ), &suid, &newSuid ); + TInt err = KErrNone; + err = MmMtpDpUtility::UpdateObjectFileName( iFramework.Fs(), + suid, + newSuid ); + PRINT1( _L( "MM MTP <> Update object file name err = %d" ), err ); + if ( KErrOverflow == err ) // full path name is too long + { + responseCode = EMTPRespCodeInvalidDataset; + } + else if ( ( KErrNone == err ) || ( KErrAlreadyExists == err ) ) + { + TRAP( err, iDpConfig.GetWrapperL().RenameObjectL( suid, newSuid ) ); //Update MPX DB + PRINT1( _L( "MM MTP <> Rename MPX object file name err = %d" ), err ); + // it is ok if file is not found in DB, following S60 solution + if ( KErrNotFound == err ) + { + TRAP( err, iDpConfig.GetWrapperL().AddObjectL( newSuid ) ); + PRINT1( _L( "MM MTP <> Add MPX object file name err = %d" ), err ); + } + + if ( KErrNone == err ) + { + iObjectInfo->SetDesCL( CMTPObjectMetaData::ESuid, newSuid ); + iFramework.ObjectMgr().ModifyObjectL( *iObjectInfo ); + } + else + { + responseCode = EMTPRespCodeGeneralError; + } + } + } + break; + + case EMTPObjectPropCodeName: // 0xDC44 + { + responseCode = ServiceMetaDataToWrapperL( iPropCode, + *iMTPTypeString, + *iObjectInfo ); + } + break; + + default: + { + responseCode = ServiceSpecificObjectPropertyL( iPropCode ); + } + break; + } + + SendResponseL( responseCode ); + PRINT1( _L( "MM MTP <= CSetObjectPropValue::DoHandleResponsePhaseL responseCode = 0x%x" ), responseCode ); + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CSetObjectPropValue::ServiceMetaDataToWrapperL +// +// ----------------------------------------------------------------------------- +// +EXPORT_C TMTPResponseCode CSetObjectPropValue::ServiceMetaDataToWrapperL( const TUint16 aPropCode, + MMTPType& aNewData, + const CMTPObjectMetaData& aObjectMetaData ) + { + TMTPResponseCode resCode = EMTPRespCodeOK; + + TRAPD( err, iDpConfig.GetWrapperL().SetObjectMetadataValueL( aPropCode, + aNewData, + aObjectMetaData ) ); + + PRINT1( _L( "MM MTP <> CSetObjectPropValue::ServiceMetaDataToWrapperL err = %d" ), err); + + if ( err == KErrNone ) + { + resCode = EMTPRespCodeOK; + } + else if ( err == KErrTooBig ) + // according to the codes of S60 + { + resCode = EMTPRespCodeInvalidDataset; + } + else if ( err == KErrPermissionDenied ) + { + resCode = EMTPRespCodeAccessDenied; + } + else if ( err == KErrNotFound ) + { +// TMTPFormatCode formatCode = +// MmMtpDpUtility::FormatFromFilename( aObjectMetaData.DesC( CMTPObjectMetaData::ESuid ) ); + if( MmMtpDpUtility::HasMetadata( aObjectMetaData.Uint( CMTPObjectMetaData::EFormatCode ) ) ) + SendResponseL( EMTPRespCodeAccessDenied ); + else + SendDataL( aNewData ); + } + else + { + resCode = EMTPRespCodeGeneralError; + } + + PRINT1( _L( "MM MTP <> CSetObjectPropValue::ServiceMetaDataToWrapperL resCode = 0x%x" ), resCode ); + + return resCode; + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/csetobjectreferences.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/csetobjectreferences.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,217 @@ +/* +* 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: Implement the operation: SetObjectReferences +* +*/ + + +#include +#include +#include +#include + +#include "csetobjectreferences.h" +#include "tmmmtpdppanic.h" +#include "mmmtpdplogger.h" +#include "cmmmtpdpmetadataaccesswrapper.h" +#include "mmmtpdputility.h" +#include "mmmtpdpconfig.h" + +// ----------------------------------------------------------------------------- +// Verification data for the SetReferences request +// ----------------------------------------------------------------------------- +// +const TMTPRequestElementInfo KMTPSetObjectReferencesPolicy[] = + { + { + TMTPTypeRequest::ERequestParameter1, + EMTPElementTypeObjectHandle, + EMTPElementAttrNone, + 0, + 0, + 0 + } + }; + +// ----------------------------------------------------------------------------- +// CSetObjectReferences::NewL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +EXPORT_C MMmRequestProcessor* CSetObjectReferences::NewL( MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) + { + CSetObjectReferences* self = new ( ELeave ) CSetObjectReferences( aFramework, + aConnection, + aDpConfig ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CSetObjectReferences::ConstructL +// Two-phase construction method +// ----------------------------------------------------------------------------- +// +void CSetObjectReferences::ConstructL() + { + SetPSStatus(); + } + +// ----------------------------------------------------------------------------- +// CSetObjectReferences::~CSetObjectReferences +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSetObjectReferences::~CSetObjectReferences() + { + delete iReferences; + delete iReferenceSuids; + } + +// ----------------------------------------------------------------------------- +// CSetObjectReferences::CSetObjectReferences +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CSetObjectReferences::CSetObjectReferences( + MMTPDataProviderFramework& aFramework, + MMTPConnection& aConnection, + MMmMtpDpConfig& aDpConfig ) : + CRequestProcessor( + aFramework, + aConnection, + sizeof( KMTPSetObjectReferencesPolicy )/sizeof( TMTPRequestElementInfo ), + KMTPSetObjectReferencesPolicy ), + iDpConfig( aDpConfig ) + { + PRINT( _L( "Operation: SetObjectReferences(0x9811)" ) ); + } + +// ----------------------------------------------------------------------------- +// CSetObjectReferences::DoSetObjectReferencesL +// set references to DB +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSetObjectReferences::DoSetObjectReferencesL( CMmMtpDpMetadataAccessWrapper& aWrapper, + TUint16 aObjectFormat, + const TDesC& aSrcFileName, + CDesCArray& aRefFileArray ) + { + // do nothing, do special thing by inheriting + } + +// ----------------------------------------------------------------------------- +// CSetObjectReferences::ServiceL +// SetReferences request handler +// start receiving reference data from the initiator +// ----------------------------------------------------------------------------- +// +EXPORT_C void CSetObjectReferences::ServiceL() + { + PRINT( _L( "MM MTP => CSetObjectReferences::ServiceL" ) ); + delete iReferences; + iReferences = NULL; + iReferences = CMTPTypeArray::NewL( EMTPTypeAUINT32 ); + ReceiveDataL( *iReferences ); + PRINT( _L( "MM MTP <= CSetObjectReferences::ServiceL" ) ); + } + +// ----------------------------------------------------------------------------- +// CSetObjectReferences::DoHandleResponsePhaseL +// Apply the references to the specified object +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CSetObjectReferences::DoHandleResponsePhaseL() + { + PRINT( _L("MM MTP => CSetObjectReferences::DoHandleResponsePhaseL" ) ); + + delete iReferenceSuids; + iReferenceSuids = NULL; + iReferenceSuids = new ( ELeave ) CDesCArrayFlat( 3 ); + + if ( !VerifyReferenceHandlesL() ) + { + SendResponseL( EMTPRespCodeInvalidObjectReference ); + } + else + { + MMTPReferenceMgr& referenceMgr = iFramework.ReferenceMgr(); + TUint32 objectHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); + PRINT1( _L( "MM MTP <>CSetObjectReferences::DoHandleResponsePhaseL objectHandle = 0x%x" ), objectHandle ); + referenceMgr.SetReferencesL( TMTPTypeUint32( objectHandle ), + *iReferences ); + + CMTPObjectMetaData* object = CMTPObjectMetaData::NewLC(); // + object + iFramework.ObjectMgr().ObjectL( objectHandle, *object ); + PRINT1( _L( "MM MTP <> object file name is %S" ), &(object->DesC( CMTPObjectMetaData::ESuid ) ) ); + DoSetObjectReferencesL( iDpConfig.GetWrapperL(), + object->Uint( CMTPObjectMetaData::EFormatCode ), + object->DesC( CMTPObjectMetaData::ESuid ), + *iReferenceSuids ); + + CleanupStack::PopAndDestroy( object ); // - object + + SendResponseL( EMTPRespCodeOK ); + } + PRINT( _L("MM MTP <= CSetObjectReferences::DoHandleResponsePhaseL" ) ); + return EFalse; + } + +// ----------------------------------------------------------------------------- +// CSetObjectReferences::VerifyReferenceHandlesL +// Verify if the references are valid handles to objects +// ----------------------------------------------------------------------------- +// +TBool CSetObjectReferences::VerifyReferenceHandlesL() const + { + PRINT( _L( "MM MTP => CSetObjectReferences::VerifyReferenceHandlesL" ) ); + __ASSERT_DEBUG( iReferences, Panic( EMmMTPDpReferencesNull ) ); + TBool result = ETrue; + TInt count = iReferences->NumElements(); + PRINT1( _L( "MM MTP <> CSetObjectReferences::VerifyReferenceHandlesL count = %d" ), count ); + CMTPObjectMetaData* object( CMTPObjectMetaData::NewLC() ); // + object + MMTPObjectMgr& objectMgr = iFramework.ObjectMgr(); + + for ( TInt i = 0; i < count; i++ ) + { + TMTPTypeUint32 handle; + iReferences->ElementL( i, handle ); + if ( !objectMgr.ObjectL( handle, *object ) ) + { + result = EFalse; + break; + } + + iReferenceSuids->AppendL( object->DesC( CMTPObjectMetaData::ESuid ) ); + } + CleanupStack::PopAndDestroy( object ); // - object + PRINT( _L( "MM MTP <= CSetObjectReferences::VerifyReferenceHandlesL" ) ); + return result; + } + +// ----------------------------------------------------------------------------- +// CSetObjectReferences::HasDataphase +// Derived from CRequestProcessor, can not be neglected +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CSetObjectReferences::HasDataphase() const + { + return ETrue; + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/ttypeflatbuf.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/ttypeflatbuf.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -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: GetParitialObject operation helper function +* +*/ + + +#include + +#include "ttypeflatbuf.h" + +static const TMTPTypeFlatBase::TElementInfo KMTPTypeFlatBufElementInfo = { EMTPTypeFlat, 0, -1 }; + +// ----------------------------------------------------------------------------- +// TMTPTypeFlatBuf::TMTPTypeFlatBuf +// Standard c++ constructor +// ----------------------------------------------------------------------------- +// +TMTPTypeFlatBuf::TMTPTypeFlatBuf( const TDes8& aBuffer ) + : TMTPTypeFlatBase() + { + SetBuffer( aBuffer ); + } + +// ----------------------------------------------------------------------------- +// TMTPTypeFlatBase::TElementInfo& TMTPTypeFlatBuf::ElementInfo +// Override to provide element info +// ----------------------------------------------------------------------------- +// +const TMTPTypeFlatBase::TElementInfo& TMTPTypeFlatBuf::ElementInfo( TInt /**aElementId*/ ) const + { + return KMTPTypeFlatBufElementInfo; + } + +// end of file + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/rom/mmmtpdataprovider.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/rom/mmmtpdataprovider.iby Thu Dec 17 08:55:47 2009 +0200 @@ -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: Image description file for project ?myapp +* +*/ + +#ifndef MMMTPDATAPROVIDER_IBY +#define MMMTPDATAPROVIDER_IBY + +#include + +// stub file for MTP upgrade with SISX (required by Platform security) +data=ZSYSTEM\install\mmmtpdpstub.sis System\install\mmmtpdpstub.sis + +/* +* Media Data Provider +*/ +// MTP Data Provider API +ECOM_PLUGIN(mediamtpdataprovider.dll, mediamtpdataprovider.rsc) + +// MTP plugin registration resource file +data=\epoc32\data\Z\resource\mtp\10207C4B.rsc resource\mtp\10207C4B.rsc + +/* +* Abstract Media Data Provider +*/ +// MTP Data Provider API +ECOM_PLUGIN(abstractmediamtpdataprovider.dll, abstractmediamtpdataprovider.rsc) + +// MTP plugin registration resource file +data=\epoc32\data\Z\resource\mtp\10207C53.rsc resource\mtp\10207C53.rsc + +// MTP multimedia request processor +file=ABI_DIR\BUILD_DIR\mmmtpdprequestprocessor.dll SHARED_LIB_DIR\mmmtpdprequestprocessor.dll + +#endif // MMMTPDATAPROVIDER_IBY \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/src/cmmmtpdpaccesssingleton.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/src/cmmmtpdpaccesssingleton.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,160 @@ +/* +* 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: Meta data access singleton +* +*/ + + +#include // CObject + +#include "cmmmtpdpaccesssingleton.h" +#include "cmmmtpdpmetadataaccesswrapper.h" +#include "mmmtpdplogger.h" + +// ----------------------------------------------------------------------------- +// CMmMtpDpAccessSingleton::~CMmMtpDpAccessSingleton +// destructor +// ----------------------------------------------------------------------------- +// +CMmMtpDpAccessSingleton::~CMmMtpDpAccessSingleton() + { + delete iWrapper; + } + +// ----------------------------------------------------------------------------- +// CMmMtpDpAccessSingleton::GetAccessWrapperL +// get wrapper instance +// ----------------------------------------------------------------------------- +// +EXPORT_C CMmMtpDpMetadataAccessWrapper& CMmMtpDpAccessSingleton::GetAccessWrapperL() + { + CMmMtpDpAccessSingleton* self = CMmMtpDpAccessSingleton::Instance(); + User::LeaveIfNull( self ); + + return *( self->iWrapper ); + } + +// ----------------------------------------------------------------------------- +// CMmMtpDpAccessSingleton::CreateL +// create singleton instance +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMmMtpDpAccessSingleton::CreateL( RFs& aRfs, + MMTPDataProviderFramework& aFramework ) + { + CMmMtpDpAccessSingleton* self = reinterpret_cast( Dll::Tls() ); + + if ( self == NULL ) + { + self = CMmMtpDpAccessSingleton::NewL( aRfs, aFramework ); + Dll::SetTls( reinterpret_cast( self ) ); + } + else + { + self->Inc(); + } + + PRINT1( _L("MM MTP <> CMmMtpDpAccessSingleton::CreateL, AccessCount: %d"), + self->AccessCount() ); + } + +// ----------------------------------------------------------------------------- +// CMmMtpDpAccessSingleton::Release +// release singleton instance +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMmMtpDpAccessSingleton::Release() + { + CMmMtpDpAccessSingleton* self = reinterpret_cast( Dll::Tls() ); + if ( self != NULL ) + { + PRINT1( _L("MM MTP <> CMmMtpDpAccessSingleton::Release, singleton != NULL, AccessCount: %d"), + self->AccessCount() ); + + self->Dec(); + if ( self->AccessCount() == 0 ) + { + PRINT( _L("MM MTP <> CMmMtpDpAccessSingleton::Release, AccessCount == 0, delete it") ); + delete self; + Dll::SetTls( NULL ); + } + } + } + +// ----------------------------------------------------------------------------- +// CMmMtpDpAccessSingleton::OpenSessionL +// do some special process with assess DBs when receives opensession command +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMmMtpDpAccessSingleton::OpenSessionL() + { + PRINT( _L("MM MTP => CMmMtpDpAccessSingleton::OpenSessionL") ); + CMmMtpDpAccessSingleton* self = CMmMtpDpAccessSingleton::Instance(); + User::LeaveIfNull( self ); + self->GetAccessWrapperL().OpenSessionL(); + PRINT( _L("MM MTP <= CMmMtpDpAccessSingleton::OpenSessionL") ); + } + +// ----------------------------------------------------------------------------- +// CMmMtpDpAccessSingleton::CloseSessionL +// do some special process with assess DBs when receives closesession command +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMmMtpDpAccessSingleton::CloseSessionL() + { + PRINT( _L("MM MTP => CMmMtpDpAccessSingleton::CloseSessionL") ); + CMmMtpDpAccessSingleton* self = CMmMtpDpAccessSingleton::Instance(); + User::LeaveIfNull( self ); + self->GetAccessWrapperL().CloseSessionL(); + PRINT( _L("MM MTP <= CMmMtpDpAccessSingleton::CloseSessionL") ); + } + +// ----------------------------------------------------------------------------- +// CMmMtpDpAccessSingleton::Instance +// get singleton instance, for internal use +// ----------------------------------------------------------------------------- +// +CMmMtpDpAccessSingleton* CMmMtpDpAccessSingleton::Instance() + { + return reinterpret_cast( Dll::Tls() ); + } + +// ----------------------------------------------------------------------------- +// CMmMtpDpAccessSingleton::NewL +// two-phase construction +// ----------------------------------------------------------------------------- +// +CMmMtpDpAccessSingleton* CMmMtpDpAccessSingleton::NewL( RFs& aRfs, + MMTPDataProviderFramework& aFramework ) + { + CMmMtpDpAccessSingleton* self = new(ELeave) CMmMtpDpAccessSingleton; + CleanupStack::PushL( self ); + self->ConstructL(aRfs, aFramework); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CMmMtpDpAccessSingleton::ConstructL +// two-phase construction +// ----------------------------------------------------------------------------- +// +void CMmMtpDpAccessSingleton::ConstructL( RFs& aRfs, + MMTPDataProviderFramework& aFramework ) + { + iWrapper = CMmMtpDpMetadataAccessWrapper::NewL( aRfs, aFramework ); + } + + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadataaccesswrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadataaccesswrapper.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,587 @@ +/* +* 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: Meta data access wrapper +* +*/ + + +#include +#include +#include +#include +#include + +#include "cmmmtpdpmetadataaccesswrapper.h" +#include "cmmmtpdpmetadatampxaccess.h" +#include "cmmmtpdpmetadatavideoaccess.h" +#include "mmmtpdputility.h" +#include "mmmtpdplogger.h" + +const TInt KMMMTPDummyFileArrayGranularity = 5; + +CMmMtpDpMetadataAccessWrapper* CMmMtpDpMetadataAccessWrapper::NewL( RFs& aRfs, + MMTPDataProviderFramework& aFramework ) + { + CMmMtpDpMetadataAccessWrapper* me = new (ELeave) CMmMtpDpMetadataAccessWrapper( aRfs, aFramework ); + CleanupStack::PushL( me ); + me->ConstructL(); + CleanupStack::Pop( me ); + + return me; + } + +CMmMtpDpMetadataAccessWrapper::CMmMtpDpMetadataAccessWrapper( RFs& aRfs, + MMTPDataProviderFramework& aFramework ) : + iRfs( aRfs ), + iFramework( aFramework ) + { + + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataAccessWrapper::ConstructL +// Second-phase +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataAccessWrapper::ConstructL() + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::ConstructL" ) ); + + iMmMtpDpMetadataMpxAccess = CMmMtpDpMetadataMpxAccess::NewL( iRfs, iFramework ); + + iMmMtpDpMetadataVideoAccess = CMmMtpDpMetadataVideoAccess::NewL( iRfs ); + + iPlaylistArray = new ( ELeave ) CDesCArrayFlat( KMMMTPDummyFileArrayGranularity ); + + // Create the PS key to notify subscribers that MTP mode is activated + _LIT_SECURITY_POLICY_C1(KKeyReadPolicy, ECapabilityReadUserData); + _LIT_SECURITY_POLICY_C1(KKeyWritePolicy, ECapabilityWriteUserData); + RProperty::Define( KMtpPSUid, + KMtpPSStatus, + RProperty::EInt, + KKeyReadPolicy, + KKeyWritePolicy); + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::ConstructL" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataAccessWrapper::~CMmMtpDpMetadataAccessWrapper +// Destructor +// --------------------------------------------------------------------------- +// +CMmMtpDpMetadataAccessWrapper::~CMmMtpDpMetadataAccessWrapper() + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::~CMmMtpDpMetadataAccessWrapper" ) ); + RemoveDummyFiles(); + + delete iPlaylistArray; + + delete iMmMtpDpMetadataVideoAccess; + delete iMmMtpDpMetadataMpxAccess; + + // unblock MPX + RProperty::Set( KMtpPSUid, + KMtpPSStatus, + EMtpPSStatusUninitialized); + PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::~CMmMtpDpMetadataAccessWrapper" ) ); + } + +// ----------------------------------------------------------------------------- +// CMmMtpDpMetadataAccessWrapper::SetPlaylist +// Set playlist to DB +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMmMtpDpMetadataAccessWrapper::SetPlaylistL( const TDesC& aPlaylistFileName, CDesCArray& aRefFileArray ) + { + PRINT1( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::SetPlaylistL aPlaylistFileName = %S" ), &aPlaylistFileName ); + + if ( !MmMtpDpUtility::IsVideoL( aPlaylistFileName, iFramework ) ) + { + iMmMtpDpMetadataMpxAccess->SetPlaylistL( aPlaylistFileName, aRefFileArray ); + } + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::SetPlaylistL" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataAccessWrapper::AddMediaL +// Gets a piece of metadata from the collection +// --------------------------------------------------------------------------- +// +EXPORT_C void CMmMtpDpMetadataAccessWrapper::GetObjectMetadataValueL( const TUint16 aPropCode, + MMTPType& aNewData, + const CMTPObjectMetaData& aObjectMetaData ) + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::GetObjectMetadataValueL" ) ); + + TPtrC fullFileName( aObjectMetaData.DesC( CMTPObjectMetaData::ESuid ) ); + if ( !MmMtpDpUtility::IsVideoL( fullFileName, iFramework ) ) + { + iMmMtpDpMetadataMpxAccess->GetObjectMetadataValueL( aPropCode, + aNewData, + aObjectMetaData ); + } + else + { + iMmMtpDpMetadataVideoAccess->GetObjectMetadataValueL( aPropCode, + aNewData, + aObjectMetaData ); + } + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::GetObjectMetadataValueL" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataAccessWrapper::SetObjectMetadataValueL +// Sets a piece of metadata in the collection +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataAccessWrapper::SetObjectMetadataValueL( const TUint16 aPropCode, + const MMTPType& aNewData, + const CMTPObjectMetaData& aObjectMetaData ) + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::SetObjectMetadataValueL" ) ); + + TPtrC fullFileName( aObjectMetaData.DesC( CMTPObjectMetaData::ESuid ) ); + if ( MmMtpDpUtility::IsVideoL( fullFileName, iFramework ) ) + { + iMmMtpDpMetadataVideoAccess->SetObjectMetadataValueL( aPropCode, + aNewData, + aObjectMetaData ); + } + else + { + iMmMtpDpMetadataMpxAccess->SetObjectMetadataValueL( aPropCode, + aNewData, + aObjectMetaData ); + } + + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::SetObjectMetadataValueL" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataAccessWrapper::SetObjectMetadataValueL +// Renames the file part of a record in the collection database +// --------------------------------------------------------------------------- +// +EXPORT_C void CMmMtpDpMetadataAccessWrapper::RenameObjectL( const TDesC& aOldFileName, + const TDesC& aNewFileName ) + { + PRINT2( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::RenameObjectL old = %S, new = %S" ), + &aOldFileName, + &aNewFileName ); + + TMTPFormatCode formatCode = MmMtpDpUtility::FormatFromFilename( aOldFileName ); + if ( formatCode == EMTPFormatCodeWMV ) + { + iMmMtpDpMetadataVideoAccess->RenameRecordL( aOldFileName, aNewFileName ); + } + else + { + if ( !MmMtpDpUtility::IsVideoL( aNewFileName , iFramework ) ) + { + iMmMtpDpMetadataMpxAccess->RenameObjectL( aOldFileName, aNewFileName, formatCode ); + } + else + { + iMmMtpDpMetadataVideoAccess->RenameRecordL( aOldFileName, aNewFileName ); + } + } + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::RenameObjectL" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataAccessWrapper::SetObjectMetadataValueL +// Deletes metadata information associated with the object +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataAccessWrapper::DeleteObjectL( const TDesC& aFullFileName, + const TUint aFormatCode ) + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::DeleteObjectL" ) ); + + TMPXGeneralCategory category = Category( aFormatCode ); + + // Have to do this. File might not be in file system anymore, have to + // reply on ObjectManager + if ( ( aFormatCode == EMTPFormatCodeMP4Container ) + || ( aFormatCode == EMTPFormatCode3GPContainer ) + || ( aFormatCode == EMTPFormatCodeASF ) ) + { + if ( MmMtpDpUtility::IsVideoL( aFullFileName, iFramework ) ) + { + category = EMPXVideo; + } + else + { + category = EMPXSong; + } + } + + switch ( category ) + { + case EMPXPlaylist: + case EMPXSong: + { + iMmMtpDpMetadataMpxAccess->DeleteObjectL( aFullFileName, category ); + } + break; + + case EMPXVideo: + { + iMmMtpDpMetadataVideoAccess->DeleteRecordL( aFullFileName ); + } + break; + + default: + PRINT( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::DeleteObjectL default" ) ); + break; + } + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::DeleteObjectL" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataAccessWrapper::SetStorageRootL +// Sets current Drive info +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataAccessWrapper::SetStorageRootL( const TDesC& aStorageRoot ) + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::SetStorageRootL" ) ); + + iMmMtpDpMetadataVideoAccess->SetStorageRootL( aStorageRoot ); + iMmMtpDpMetadataMpxAccess->SetStorageRootL( aStorageRoot ); + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::SetStorageRootL" ) ); + } +// ----------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::SetImageObjPropL +// set image specific properties specific to videos +// ----------------------------------------------------------------------------- +// +void CMmMtpDpMetadataAccessWrapper::SetImageObjPropL( const TDesC& aFullFileName, + const TUint32 aWidth, + const TUint32 aHeight ) + { + if ( MmMtpDpUtility::IsVideoL( aFullFileName, iFramework ) ) + { + iMmMtpDpMetadataVideoAccess->SetStorageRootL( aFullFileName ); + iMmMtpDpMetadataVideoAccess->SetImageObjPropL( aFullFileName, aWidth, aHeight ); + } + } + +// ----------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::GetImageObjPropL +// get image specific properties specific to videos +// ----------------------------------------------------------------------------- +// +void CMmMtpDpMetadataAccessWrapper::GetImageObjPropL( const TDesC& aFullFileName, + TUint32& aWidth, + TUint32& aHeight ) + { + if ( MmMtpDpUtility::IsVideoL( aFullFileName, iFramework ) ) + { + iMmMtpDpMetadataVideoAccess->SetStorageRootL( aFullFileName ); + iMmMtpDpMetadataVideoAccess->GetImageObjPropL( aFullFileName, aWidth, aHeight ); + } + } +// ----------------------------------------------------------------------------- +// CMmMtpDpMetadataAccessWrapper::OpenSessionL +// Called when the MTP session is initialised +// ----------------------------------------------------------------------------- +// +void CMmMtpDpMetadataAccessWrapper::OpenSessionL() + { + iOpenSession = ETrue; + } + +// ----------------------------------------------------------------------------- +// CMmMtpDpMetadataAccessWrapper::CloseSessionL +// +// ----------------------------------------------------------------------------- +// +void CMmMtpDpMetadataAccessWrapper::CloseSessionL() + { + if ( iOpenSession ) + { + PRINT( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::CloseSessionL close" ) ); + iMmMtpDpMetadataVideoAccess->CloseSessionL(); + iOpenSession = EFalse; + } + else + { + PRINT( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::CloseSessionL alreay close" ) ); + } + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataAccessWrapper::Category +// Get category according format code +// --------------------------------------------------------------------------- +// +TMPXGeneralCategory CMmMtpDpMetadataAccessWrapper::Category( const TUint aFormatCode ) + { + TMPXGeneralCategory category = EMPXNoCategory; + switch ( aFormatCode ) + { + case EMTPFormatCodeMP3: + case EMTPFormatCodeWAV: + case EMTPFormatCodeWMA: + case EMTPFormatCodeAAC: + case EMTPFormatCodeASF: + case EMTPFormatCodeMP4Container: + case EMTPFormatCode3GPContainer: + { + category = EMPXSong; + } + break; + + case EMTPFormatCodeAbstractAudioVideoPlaylist: + { + category = EMPXPlaylist; + } + break; + + case EMTPFormatCodeWMV: + { + category = EMPXVideo; + } + break; + + default: + break; + } + return category; + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataAccessWrapper::GetAllPlaylistL +// +// --------------------------------------------------------------------------- +EXPORT_C void CMmMtpDpMetadataAccessWrapper::GetAllPlaylistL( const TDesC& aStoreRoot, CMPXMediaArray** aPlaylists ) + { + iMmMtpDpMetadataMpxAccess->GetAllPlaylistL( aStoreRoot, aPlaylists ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataAccessWrapper::GetAllReferenceL +// +// --------------------------------------------------------------------------- +//s +EXPORT_C void CMmMtpDpMetadataAccessWrapper::GetAllReferenceL( CMPXMedia* aPlaylist, CDesCArray& aReferences ) + { + iMmMtpDpMetadataMpxAccess->GetAllReferenceL( aPlaylist, aReferences ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataAccessWrapper::GetPlaylistNameL +// +// --------------------------------------------------------------------------- +// +EXPORT_C void CMmMtpDpMetadataAccessWrapper::GetPlaylistNameL( CMPXMedia* aPlaylist, TDes& aPlaylistName ) + { + iMmMtpDpMetadataMpxAccess->GetPlaylistNameL( aPlaylist, aPlaylistName ); + } + +// ----------------------------------------------------------------------------- +// CMmMtpDpMetadataAccessWrapper::AddObjectL +// Add object (music, video and playlist) info to DB +// ----------------------------------------------------------------------------- +// +void CMmMtpDpMetadataAccessWrapper::AddObjectL( const TDesC& aFullFileName, TBool aIsVideo /*= EFalse */ ) + { + PRINT1( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::AddObjectL aFullFileName = %S" ), &aFullFileName ); + + if ( aFullFileName.Length() <= 0) + { + User::Leave( KErrArgument ); + } + if ( aIsVideo ) + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::AddObjectL Addvideo" ) ); + iMmMtpDpMetadataVideoAccess->AddVideoL( aFullFileName ); + } + else + { + if ( MmMtpDpUtility::IsVideoL( aFullFileName, iFramework ) ) + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::AddObjectL Addvideo" ) ); + iMmMtpDpMetadataVideoAccess->AddVideoL( aFullFileName ); + } + else + { + TMTPFormatCode formatCode = MmMtpDpUtility::FormatFromFilename( aFullFileName ); + + if ( formatCode == EMTPFormatCodeM3UPlaylist + || formatCode == EMTPFormatCodeMPLPlaylist + || formatCode == EMTPFormatCodeAbstractAudioVideoPlaylist + || formatCode == EMTPFormatCodeAbstractAudioPlaylist + || formatCode == EMTPFormatCodeAbstractVideoPlaylist + || formatCode == EMTPFormatCodeASXPlaylist + || formatCode == EMTPFormatCodePLSPlaylist ) + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::AddObjectL AddPlaylist" ) ); + iMmMtpDpMetadataMpxAccess->AddPlaylistL( aFullFileName ); + } + else + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::AddObjectL AddSong" ) ); + iMmMtpDpMetadataMpxAccess->AddSongL( aFullFileName ); + } + } + } + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::AddObjectL" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataAccessWrapper::GetModifiedContentL +// Get Modified content +// --------------------------------------------------------------------------- +// +EXPORT_C void CMmMtpDpMetadataAccessWrapper::GetModifiedContentL( const TDesC& aStorageRoot, + TInt& arrayCount, + CDesCArray& aModifiedcontent ) + { + iMmMtpDpMetadataMpxAccess->SetStorageRootL( aStorageRoot ); + iMmMtpDpMetadataMpxAccess->GetModifiedContentL( arrayCount, aModifiedcontent ); + } + +EXPORT_C void CMmMtpDpMetadataAccessWrapper::CleanupDatabaseL() + { + iMmMtpDpMetadataVideoAccess->CleanupDatabaseL(); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataAccessWrapper::IsExistL +// if the playlsit exist in the MPX DB +// --------------------------------------------------------------------------- +// +TBool CMmMtpDpMetadataAccessWrapper::IsExistL( const TDesC& aSuid ) + { + TParsePtrC parse( aSuid ); + iMmMtpDpMetadataMpxAccess->SetStorageRootL( parse.Drive() ); + return iMmMtpDpMetadataMpxAccess->IsExistL( aSuid ); + } + +// ----------------------------------------------------------------------------- +// CMmMtpDpMetadataAccessWrapper::AddDummyFile +// Add one dummy file to dummy files array +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMmMtpDpMetadataAccessWrapper::AddDummyFileL( const TDesC& aDummyFileName ) + { + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::AddDummyFile aDummyFileName(%S)" ), &aDummyFileName ); + iPlaylistArray->AppendL( aDummyFileName ); + } + +// ----------------------------------------------------------------------------- +// CMmMtpDpMetadataAccessWrapper::DeleteDummyFile +// Delete one dummy file from dummy files array +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMmMtpDpMetadataAccessWrapper::DeleteDummyFile( const TDesC& aDummyFileName ) + { + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::DeleteDummyFile aDummyFileName(%S)" ), &aDummyFileName ); + TInt pos = 0; + if ( iPlaylistArray->Count() > 0 ) + { + if ( 0 == iPlaylistArray->Find( aDummyFileName, pos ) ) + { + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::DeleteDummyFile pos = %d" ), pos ); + iPlaylistArray->Delete( pos ); + } + } + } + +// ----------------------------------------------------------------------------- +// CMmMtpDpMetadataAccessWrapper::CreateDummyFile +// Create a Dummy File from the virtual playlist URI +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMmMtpDpMetadataAccessWrapper::CreateDummyFile( const TDesC& aPlaylistName ) + { + PRINT1( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::CreateDummyFile, filename = %S" ), &aPlaylistName ); + + if ( MmMtpDpUtility::FormatFromFilename( aPlaylistName ) == + EMTPFormatCodeAbstractAudioVideoPlaylist ) + { + RFile newfile; + TInt err = newfile.Replace( iFramework.Fs(), aPlaylistName, EFileWrite ); + + if ( err != KErrNone ) + { + newfile.Close(); + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::CreateDummyFile err = %d" ), err ); + } + else // File created OK + { + err = newfile.Flush(); + newfile.Close(); + err = iFramework.Fs().SetAtt( aPlaylistName, KEntryAttSystem | KEntryAttHidden, + KEntryAttReadOnly | KEntryAttNormal ); + if ( err != KErrNone ) + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::CreateDummyFile Dummy Playlist file created. err = %d" ), err ); + } + } + } + +// ----------------------------------------------------------------------------- +// CMmMtpDpMetadataAccessWrapper::RemoveDummyFiles +// Remove all dummy file of which format is "pla", and leave the "m3u" +// ----------------------------------------------------------------------------- +// +void CMmMtpDpMetadataAccessWrapper::RemoveDummyFiles() + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::RemoveDummyFiles" ) ); + + TInt count = iPlaylistArray->Count(); + // Check if playlist file is a dummy file or an imported file + for ( TInt i = 0; i < count; i++ ) + { + if ( MmMtpDpUtility::FormatFromFilename( (*iPlaylistArray)[i] ) != + EMTPFormatCodeM3UPlaylist ) + { + // delete the virtual playlist + // iFramework has release don't use iFramework.FS() + TInt err = iRfs.Delete( (*iPlaylistArray)[i] ); + + PRINT2( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::RemoveDummyFile filename = %S, err %d" ), + &( (*iPlaylistArray)[i] ), + err ); + } + else + { + // leave the Imported playlist in the file system + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::RemoveDummyFile, Don't delete m3u file [%S]" ), &( (*iPlaylistArray)[i] ) ); + } + } + PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::RemoveDummyFiles" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataAccessWrapper::UpdateMusicCollectionL +// Update Music collection +// --------------------------------------------------------------------------- +// +EXPORT_C void CMmMtpDpMetadataAccessWrapper::UpdateMusicCollectionL() + { + iMmMtpDpMetadataMpxAccess->UpdateMusicCollectionL( ); + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadatamdsaccess.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadatamdsaccess.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,17 @@ +/* +* 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: Meta data Mds access +* +*/ + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadatampxaccess.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadatampxaccess.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,1625 @@ +/* +* 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: Meta data Mpx access +* +*/ + + +// from Symbian MTP +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// from MPX +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cmmmtpdpmetadatampxaccess.h" +#include "mmmtpdplogger.h" +#include "mmmtpdputility.h" +#include "tmmmtpdppanic.h" + +static const TInt KMtpInvalidSongID = 0x1FFFFFFF; +static const TInt KMtpChannelMono = 1; +static const TInt KMtpChannelStereo = 2; +static const TInt KMtpDateTimeStringLength = 15; +static const TInt KMtpMaxStringLength = 255; +static const TInt KMtpMaxDescriptionLength = 0x200; + +_LIT( KMtpDateTimeFormat, "%F%Y%M%DT%H%T%S" ); +_LIT( KMtpDateTimeConnector, "T" ); +_LIT( KEmptyText, "" ); + +#ifdef _DEBUG +_LIT( KMtpMpxPanic, "CMmMtpDpMetadataMpxAccess" ); +#endif + +CMmMtpDpMetadataMpxAccess* CMmMtpDpMetadataMpxAccess::NewL( RFs& aRfs, + MMTPDataProviderFramework& aFramework ) + { + CMmMtpDpMetadataMpxAccess* self = new(ELeave) CMmMtpDpMetadataMpxAccess( aRfs, aFramework ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +CMmMtpDpMetadataMpxAccess::CMmMtpDpMetadataMpxAccess( RFs& aRfs, + MMTPDataProviderFramework& aFramework ): + iRfs( aRfs ), + iFramework( aFramework ) + { + + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::ConstructL +// Second-phase +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataMpxAccess::ConstructL() + { + // for performance measurement purpose +#if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) + iPerfLog = CMmMtpDpPerfLog::NewL( _L( "CMmMtpDpMetadataMpxAccess" ) ); +#endif + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::~CMmMtpDpMetadataMpxAccess +// Destructor +// --------------------------------------------------------------------------- +// +CMmMtpDpMetadataMpxAccess::~CMmMtpDpMetadataMpxAccess() + { + if ( iCollectionHelper ) + { + iCollectionHelper->Close(); + iCollectionHelper = NULL; + } + + // for performance measurement purpose +#if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) + delete iPerfLog; +#endif + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::GetObjectMetadataValueL +// Gets a piece of metadata from the collection +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataMpxAccess::GetObjectMetadataValueL( const TUint16 aPropCode, + MMTPType& aNewData, + const CMTPObjectMetaData& aObjectMetaData ) + { + PRINT1( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::GetObjectMetadataValueL aPropCode = 0x%x" ), aPropCode ); + + // File Path + HBufC* suid = aObjectMetaData.DesC( CMTPObjectMetaData::ESuid ).AllocLC(); // + suid + TUint format = aObjectMetaData.Uint( CMTPObjectMetaData::EFormatCode ); + TMPXGeneralCategory category = ( format == EMTPFormatCodeAbstractAudioVideoPlaylist ) || + ( format == EMTPFormatCodeM3UPlaylist ) ? EMPXPlaylist : EMPXSong; + + PERFLOGSTART( KMpxCollectionGetL ); + const CMPXMedia& media = CollectionHelperL()->GetL( *suid, category ); + PERFLOGSTOP( KMpxCollectionGetL ); + + CleanupStack::PopAndDestroy( suid ); // - suid + + TMPXAttributeData attrib( MpxAttribFromPropL( media, aPropCode ) ); + TBool isSupported = media.IsSupported( attrib ); + PRINT1(_L( "MM MTP <> CMmMtpDpMetadataMpxAccess::GetObjectMetadataValueL isSupported = %d" ), isSupported); + + if ( aPropCode != EMTPObjectPropCodeOriginalReleaseDate + && aPropCode != EMTPObjectPropCodeDRMStatus + && !isSupported ) + { + User::Leave( KErrNotSupported ); + } + + switch ( aPropCode ) + { + case EMTPObjectPropCodeName: + case EMTPObjectPropCodeArtist: + case EMTPObjectPropCodeAlbumName: + case EMTPObjectPropCodeComposer: + case EMTPObjectPropCodeGenre: + case EMTPObjectPropCodeAlbumArtist: + { + if ( EMTPTypeString == aNewData.Type() ) + { + ( ( CMTPTypeString& ) aNewData ).SetL( media.ValueText( attrib ) ); + } + else + { + User::Leave( KErrArgument ); + } + } + break; + + case EMTPObjectPropCodeDescription: + { + HBufC* data; + data = media.ValueText( KMPXMediaGeneralComment ).AllocLC(); // + data + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::GetObjectMetadataValue data = %S" ), data ); + if ( EMTPTypeAUINT16 == aNewData.Type() ) + { + TInt len = data->Length(); + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::GetObjectMetadataValue len = %d" ),len ); + if( len != 0 ) + { + for( TInt i = 0; i < len; i++ ) + ( ( CMTPTypeArray& ) aNewData ).AppendUintL( (*data)[i] ); + } + } + else + { + User::Leave( KErrArgument ); + } + CleanupStack::PopAndDestroy( data ); // - data + } + break; + + case EMTPObjectPropCodeDateModified: + case EMTPObjectPropCodeDateAdded: + case EMTPObjectPropCodeDateCreated: + { + TTime time( *media.Value ( attrib ) ); + TBuf timeStr; + time.FormatL( timeStr, KMtpDateTimeFormat ); + + if ( EMTPTypeString == aNewData.Type() ) + { + ( ( CMTPTypeString & ) aNewData ).SetL( timeStr ); + } + else + { + User::Leave( KErrArgument ); + } + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::GetObjectMetadataValue - get DC4E DateAdded = %Ld" ), time.Int64() ); + } + break; + + case EMTPObjectPropCodeDuration: + case EMTPObjectPropCodeAudioBitRate: + case EMTPObjectPropCodeSampleRate: + case EMTPObjectPropCodeAudioWAVECodec: + { + if ( EMTPTypeUINT32 == aNewData.Type() ) + { + ( ( TMTPTypeUint32& ) aNewData ).Set( *media.Value( attrib ) ); + } + else + { + User::Leave( KErrArgument ); + } + } + break; + + case EMTPObjectPropCodeTrack: + { + TLex lex( media.ValueText( attrib ) ); + TUint16 uint16( 0 ); + lex.Val( uint16, EDecimal ); + + if ( EMTPTypeUINT16 == aNewData.Type() ) + { + ( ( TMTPTypeUint16 & ) aNewData ).Set( uint16 ); + } + else + { + User::Leave( KErrArgument ); + } + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::GetObjectMetadataValue - get DC8B Track = %d" ), uint16 ); + } + break; + + case EMTPObjectPropCodeOriginalReleaseDate: + { + // Compose DateTime string in format YYYYMMDDTHHMMSS + TBuf dateTime; + dateTime.Zero(); + + // NOTE: Handled specially, shouldn't leave like other property, following S60 + if ( !isSupported ) + { + PRINT( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::GetObjectMetadataValue 0xDC99 date hasn't been set before" ) ); + dateTime.Copy( KEmptyText ); + } + else + { + TTime time = *media.Value ( attrib ); +#ifdef _DEBUG + RDebug::Print( _L( "MM MTP <> GetObjectMetadataValue 0xDC99 time = %Ld, Year = %d, Month = %d, Day = %d, Hour = %d, Minute = %d, Second = %d" ), + time.Int64(), + time.DateTime().Year(), + time.DateTime().Month(), + time.DateTime().Day(), + time.DateTime().Hour(), + time.DateTime().Minute(), + time.DateTime().Second() ); +#endif // _DEBUG + // Compose DateTime string in format YYYYMMDDTHHMMSS + dateTime.AppendNumFixedWidth( time.DateTime().Year(), + EDecimal, + 4 ); + dateTime.AppendNumFixedWidth( time.DateTime().Month() + 1, + EDecimal, + 2 ); + dateTime.AppendNumFixedWidth( time.DateTime().Day() + 1, + EDecimal, + 2 ); + dateTime.Append( KMtpDateTimeConnector ); + dateTime.AppendNumFixedWidth( time.DateTime().Hour(), + EDecimal, + 2 ); + dateTime.AppendNumFixedWidth( time.DateTime().Minute(), + EDecimal, 2 ); + dateTime.AppendNumFixedWidth( time.DateTime().Second(), + EDecimal, 2 ); + + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::GetObjectMetadataValue 0xDC99 dateString = %S" ), &dateTime ); + } + if ( EMTPTypeString == aNewData.Type() ) + { + ( ( CMTPTypeString & ) aNewData ).SetL( dateTime ); + } + else + { + User::Leave( KErrArgument ); + } + } + break; + + case EMTPObjectPropCodeNumberOfChannels: + case EMTPObjectPropCodeDRMStatus: + if ( !isSupported) + { + PRINT( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::GetObjectMetadataValue 0xDC9D date hasn't been set before" ) ); + TInt16 zeroValue = 0x0; + ( ( TMTPTypeUint16 & ) aNewData ).Set( zeroValue ); + } + else + { + if (EMTPTypeUINT16 == aNewData.Type() ) + { + ( ( TMTPTypeUint16 & ) aNewData ).Set( *media.Value(attrib) ); + } + else + { + User::Leave(KErrArgument); + } + } + break; + + default: + { + User::Leave( KErrNotSupported ); + } + break; + } + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::GetObjectMetadataValueL" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::CollectionHelperL +// Returns the collection helper +// --------------------------------------------------------------------------- +// +MMPXCollectionHelper* CMmMtpDpMetadataMpxAccess::CollectionHelperL() + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::CollectionHelperL()" ) ); + + // This is for the case when drive is completely full but Music DB is not + // yet created. NewCollectionCachedHelperL() will attempt to create a + // DB file on the spot when MPX Collection helper is accessed. For the + // case of Music DB creation failure, it will be handled by MTP server + // as a General Error + if ( iCollectionHelper == NULL ) + { + PERFLOGSTART(KMpxCollectionNewL); + iCollectionHelper = CMPXCollectionHelperFactory::NewCollectionCachedHelperL(); + PERFLOGSTOP(KMpxCollectionNewL); + + // Do a search for a song ID that does not exist + // This is to validate the presence of the media database. + RArray contentIDs; + CleanupClosePushL( contentIDs ); // + contentIDs + contentIDs.AppendL( KMPXMediaIdGeneral ); + + CMPXMedia* searchMedia = CMPXMedia::NewL( contentIDs.Array() ); + CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs + CleanupStack::PushL( searchMedia ); // + searchMedia + + searchMedia->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem ); + searchMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXSong ); + searchMedia->SetTObjectValueL( KMPXMediaGeneralId, + KMtpInvalidSongID ); + searchMedia->SetTextValueL( KMPXMediaGeneralDrive, iStoreRoot ); + + RArray songAttributes; + CleanupClosePushL( songAttributes ); // + songAttributes + songAttributes.AppendL( KMPXMediaGeneralId ); + + CMPXMedia* foundMedia = NULL; + + PERFLOGSTART( KMpxCollectionFindAllLValidate ); + TRAPD( err, foundMedia = iCollectionHelper->FindAllL( + *searchMedia, + songAttributes.Array() ) ); + PERFLOGSTOP( KMpxCollectionFindAllLValidate ); + + CleanupStack::PopAndDestroy( &songAttributes ); // - songAttributes + CleanupStack::PopAndDestroy( searchMedia ); // - searchMedia + + CleanupStack::PushL( foundMedia ); // + foundMedia + if ( err != KErrNone ) + { + PRINT1( _L("MM MTP <> CMmMtpDpMetadataMpxAccess::CollectionHelperL() Had err (%d) accessing the Music Database!!!"), err ); + // Delete the collection helper for now + iCollectionHelper->Close(); + iCollectionHelper = NULL; + User::Leave( KErrGeneral ); + } + else + { + PRINT( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::CollectionHelperL() Music Database successfully created and validated!!!" ) ); + } + + CleanupStack::PopAndDestroy( foundMedia ); // - foundMedia + } + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::CollectionHelperL()" ) ); + return iCollectionHelper; + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::FindWMPMediaLC +// Finds Media with specific WMP values +// --------------------------------------------------------------------------- +// +CMPXMedia* CMmMtpDpMetadataMpxAccess::FindWMPMediaLC( TMPXAttributeData aWMPMediaID, + TBool aFlag ) + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::FindWMPMediaLC" ) ); + + CMPXMedia* searchMedia = CMPXMedia::NewL(); + CleanupStack::PushL( searchMedia ); // + searchMeida + + searchMedia->SetTObjectValueL( KMPXMediaGeneralType, EMPXGroup ); + searchMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXSong ); + searchMedia->SetTObjectValueL( aWMPMediaID, aFlag ); + + searchMedia->SetTextValueL( KMPXMediaGeneralDrive, iStoreRoot ); + + RArray songAttributes; + CleanupClosePushL( songAttributes ); // + songAttributes + songAttributes.AppendL( KMPXMediaGeneralUri ); + + PRINT( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::FindWMPMediaLC searchMedia setup with no problems" ) ); + + CMPXMedia* foundMedia = CollectionHelperL()->FindAllL( + *searchMedia, + songAttributes.Array() ); + PRINT( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::FindWMPMediaLC foundMedia assigned from FindAllL" ) ); + + CleanupStack::PopAndDestroy( &songAttributes ); // - songAttributes + CleanupStack::PopAndDestroy( searchMedia ); // - searchMedia + CleanupStack::PushL( foundMedia ); // + foundMedia + + if ( !foundMedia->IsSupported( KMPXMediaArrayCount ) ) + { + User::Leave( KErrNotSupported ); + } + +#ifdef _DEBUG + TInt foundItemCount = *foundMedia->Value( KMPXMediaArrayCount ); + PRINT1( _L( "MM MTP <> %d Media Objects found in the WMP search" ), foundItemCount ); +#endif + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::FindWMPMediaLC" ) ); + return foundMedia; + } + +// --------------------------------------------------------------------------- +// Update the Sync flag for those not synchronized, Update the Modified flag for those have been modified, and delete the stale +// records for files that have been deleted. +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataMpxAccess::UpdateMusicCollectionL() + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::UpdateMusicCollectionL" ) ); + CMPXMedia* foundMedia= NULL; + TInt foundItemCount( 0 ); + + // We Should Consider this!!! + // if (iWmpRoundTripUsed) // Only update values if they've been read by the PC... + // { + // Change flag on acquired content so they won't be reported twice + + //when thousands of the file are being copied in with mass storage, and MTP is connected/disconnected for the first time + //updateing the sync bit cause a serious performance issue issue + //since our DP is not presistent, and we are not depedns on KMPXMediaGeneralSynchronized flag to tell whether a file is newly added or not + //reseting this flag is not needed in reality, comment out for now + /*foundMedia = FindWMPMediaLC( KMPXMediaGeneralSynchronized, EFalse );// + foundMedia + + if ( !foundMedia->IsSupported( KMPXMediaArrayCount ) ) + { + User::Leave( KErrNotSupported ); + } + + foundItemCount = *foundMedia->Value( KMPXMediaArrayCount ); + + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::UpdateMusicCollectionL found %d Media Objects" ), foundItemCount ); + + if ( foundItemCount ) + { + if ( !foundMedia->IsSupported( KMPXMediaArrayContents ) ) + { + User::Leave( KErrNotSupported ); + } + + const CMPXMediaArray* foundArray = foundMedia->Value( + KMPXMediaArrayContents ); + + for ( TInt j = 0; j < foundItemCount; j++ ) + { + CMPXMedia* media = CMPXMedia::NewL( *(*foundArray)[j] ); + CleanupStack::PushL( media ); + media->SetTObjectValueL( + KMPXMediaGeneralSynchronized, + ETrue ); + // Update the song's metadata with the media object + PERFLOGSTART(KMpxCollectionSetL); + CollectionHelperL()->SetL( media ); + PERFLOGSTOP(KMpxCollectionSetL); + + CleanupStack::PopAndDestroy( media ); + } + } + + CleanupStack::PopAndDestroy( foundMedia );// - foundMedia*/ + + //we are indeed depends on KMPXMediaGeneralModified for modified content to be report correctly + //hence it should be reset everytime to ensure integrity + // Change flag for files with updated metadata + PRINT( _L( "MM MTP <> Updating the mod bit for files..." ) ); + + foundMedia = FindWMPMediaLC( KMPXMediaGeneralModified, ETrue ); // + foundMedia + + if ( !foundMedia->IsSupported( KMPXMediaArrayCount ) ) + { + User::Leave( KErrNotSupported ); + } + + foundItemCount = *foundMedia->Value( KMPXMediaArrayCount ); + + PRINT1( _L( "MM MTP <> CMtpMpxMetadataAccess::UpdateMusicCollectionL found %d Media Objects" ), foundItemCount ); + + if ( foundItemCount ) + { + if ( !foundMedia->IsSupported( KMPXMediaArrayContents ) ) + { + User::Leave( KErrNotSupported ); + } + + const CMPXMediaArray* foundArray2 = foundMedia->Value( + KMPXMediaArrayContents ); + + for ( TInt j = 0; j < foundItemCount; j++ ) + { + CMPXMedia* media = CMPXMedia::NewL( *(*foundArray2)[j] ); + CleanupStack::PushL( media ); // + media + media->SetTObjectValueL( + KMPXMediaGeneralModified, + EFalse ); + // Update the song's metadata with the media object + PERFLOGSTART(KMpxCollectionSetL); + CollectionHelperL()->SetL( media ); + PERFLOGSTOP(KMpxCollectionSetL); + + CleanupStack::PopAndDestroy( media ); // - media + } + } + + CleanupStack::PopAndDestroy( foundMedia ); // - foundMedia + + //although as a non-presistent DP, we are not depending on KMPXMediaGeneralDeleted to report deleted file, + //however, mark as deleted entry should be cleanup to improve music db performance + // Delete stale records from the audio collection, for files that have been deleted. + // Records are deleted everytime in CloseSession to improve the audio database performance + // as there is NOT a separate database for deleted files. + PRINT( _L( "MM MTP <> Deleting metadata for deleted files" ) ); + + CollectionHelperL()->CleanupDeletedMediasL(); + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::UpdateMusicCollectionL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::RemoveL +// Remove the file from MPX DB +// ----------------------------------------------------------------------------- +// +void CMmMtpDpMetadataMpxAccess::DeleteObjectL( const TDesC& aFullFileName, + TMPXGeneralCategory aCategory ) + { + TRAPD( err, CollectionHelperL()->RemoveL( aFullFileName, aCategory ) ); + + if ( err == KErrNotFound ) + { + // Ignore songs not found in MPX DB + PRINT1( _L( "MM MTP <> DeleteObjectL deletion failed: %S not found" ), &aFullFileName ); + } + else if ( err != KErrNone ) + { + User::Leave( err ); + } + } + +// ----------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::RenameRecordL +// Rename the filename onto MPX DB +// ----------------------------------------------------------------------------- +// +void CMmMtpDpMetadataMpxAccess::RenameObjectL( const TDesC& aOldFileName, + const TDesC& aNewFileName, + TUint aFormatCode ) + { + PRINT2( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::RenameObjectL aOldFileName = %S, aNewFileName = %S" ), + &aOldFileName, &aNewFileName ); + + TInt err = KErrNone; + + if ( ( aFormatCode == EMTPFormatCodeAbstractAudioVideoPlaylist ) + || ( aFormatCode == EMTPFormatCodeM3UPlaylist ) ) + { + PRINT( _L( "MM MTP <> Playlist" ) ); + TRAP( err, CollectionHelperL()->RenameL( + aOldFileName, + aNewFileName, + EMPXPlaylist ) ); + } + else // Not a playlist + { + PRINT( _L( "MM MTP <> Non-Playlist" ) ); + TRAP( err, CollectionHelperL()->RenameL( aOldFileName, aNewFileName, EMPXSong ) ); + } + + if ( KErrNotFound == err ) + { + PRINT1( _L( "MM MTP <> Not found the %S in the MPX DB" ), &aOldFileName ); + } + else if ( KErrNone != err ) + { + User::Leave( err ); + } + PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::RenameObjectL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::SetObjectMetadataValueL +// Updated object metadata in MPX database +// ----------------------------------------------------------------------------- +void CMmMtpDpMetadataMpxAccess::SetObjectMetadataValueL( const TUint16 aPropCode, + const MMTPType& aNewData, + const TDesC& aSuid ) + { + PRINT2( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::SetObjectMetadataValueL aPropCode = 0x%x aSuid = %S" ), + aPropCode, + &aSuid ); + CMPXMedia* media = NULL; + + // Creat media properties for the song + RArray contentIDs; + CleanupClosePushL( contentIDs ); // + contentIDs + contentIDs.AppendL( KMPXMediaIdGeneral ); + contentIDs.AppendL( KMPXMediaIdAudio ); + contentIDs.AppendL( KMPXMediaIdMusic ); + contentIDs.AppendL( KMPXMediaIdMTP ); + + media = CMPXMedia::NewL( contentIDs.Array() ); + CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs + CleanupStack::PushL( media ); // + media + + media->SetTObjectValueL( + KMPXMediaGeneralCategory, + EMPXSong ); + + // MPXMedia default types + media->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem ); + + // Get file path + TParsePtrC parse( aSuid ); + media->SetTextValueL( KMPXMediaGeneralUri, aSuid ); + media->SetTextValueL( KMPXMediaGeneralDrive, parse.Drive() ); + + TRAPD( err, SetMetadataValueL( aPropCode, aNewData, *media ) ); + + if ( err == KErrNone ) + { + SetStorageRootL( parse.Drive() ); + + // Update the song's metadata with the media object + PERFLOGSTART( KMpxCollectionSetL ); + CollectionHelperL()->SetL( media ); + PERFLOGSTOP( KMpxCollectionSetL ); + } + else + { + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::SetObjectMetadataValueL ERROR = %d" ), err ); + + User::Leave( err ); + } + + CleanupStack::PopAndDestroy( media ); // - media + PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::SetObjectMetadataValueL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::SetObjectMetadataValueL +// Updated object metadata in MPX database +// ----------------------------------------------------------------------------- +void CMmMtpDpMetadataMpxAccess::SetObjectMetadataValueL( const TUint16 aPropCode, + const MMTPType& aNewData, + const CMTPObjectMetaData& aObjectMetaData ) + { + PRINT1( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::SetObjectMetadataValueL aPropCode = 0x%x" ), aPropCode ); + CMPXMedia* media = NULL; + + RArray contentIDs; + CleanupClosePushL( contentIDs ); // + contentIDs + + TUint format = aObjectMetaData.Uint( CMTPObjectMetaData::EFormatCode ); + if ( ( format == EMTPFormatCodeAbstractAudioVideoPlaylist ) + || ( format == EMTPFormatCodeM3UPlaylist ) ) + { + PRINT( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::SetObjectMetadataValueL format is playlist" ) ); + contentIDs.AppendL( KMPXMediaIdGeneral ); + + media = CMPXMedia::NewL( contentIDs.Array() ); + CleanupStack::PushL( media ); // + media + + media->SetTObjectValueL( + KMPXMediaGeneralCategory, + EMPXPlaylist ); + } + else + { + // Creat media properties for the song + contentIDs.AppendL( KMPXMediaIdGeneral ); + contentIDs.AppendL( KMPXMediaIdAudio ); + contentIDs.AppendL( KMPXMediaIdMusic ); + contentIDs.AppendL( KMPXMediaIdMTP ); + + media = CMPXMedia::NewL( contentIDs.Array() ); + CleanupStack::PushL( media ); // + media + + media->SetTObjectValueL( + KMPXMediaGeneralCategory, + EMPXSong ); + } + + // MPXMedia default types + media->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem ); + + // Get file path + HBufC* suid = aObjectMetaData.DesC( CMTPObjectMetaData::ESuid ).AllocLC(); // + suid + TParsePtrC parse( *suid ); + media->SetTextValueL( KMPXMediaGeneralUri, *suid ); + media->SetTextValueL( KMPXMediaGeneralDrive, parse.Drive() ); + CleanupStack::PopAndDestroy( suid ); // - suid + + SetMetadataValueL( aPropCode, aNewData, *media ); + + // Update the song's metadata with the media object + PERFLOGSTART(KMpxCollectionSetL); + CollectionHelperL()->SetL( media ); + PERFLOGSTOP(KMpxCollectionSetL); + + CleanupStack::PopAndDestroy( 2, &contentIDs ); // - media, contentIDs + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::SetObjectMetadataValueL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::SetMetadataValueL +// private, Set property value into MPX object according to property code +// ----------------------------------------------------------------------------- +void CMmMtpDpMetadataMpxAccess::SetMetadataValueL( const TUint16 aPropCode, + const MMTPType& aNewData, + CMPXMedia& aMediaProp ) + { + PRINT1( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::SetMetadataValueL aPropCode = 0x%x" ), aPropCode ); + CMTPTypeString* textData = CMTPTypeString::NewLC(); // + textData + CMTPTypeArray* desData = NULL; + TMTPTypeUint16 uint16Data; + TMTPTypeUint32 uint32Data; + + TMPXAttributeData attrib( MpxAttribFromPropL( aMediaProp, aPropCode ) ); + + switch ( aPropCode ) + { + case EMTPObjectPropCodeName: + case EMTPObjectPropCodeArtist: + case EMTPObjectPropCodeGenre: + case EMTPObjectPropCodeAlbumName: + case EMTPObjectPropCodeComposer: + case EMTPObjectPropCodeAlbumArtist: + { + PRINT1( _L( "MM MTP <> SetMetadataValueL Before Copy, string length = %d" ), aNewData.Size() ); + MMTPType::CopyL( aNewData, *textData ); + PRINT1( _L( "MM MTP <> SetMetadataValueL string length = %d" ), textData->StringChars().Length() ); + aMediaProp.SetTextValueL( attrib, textData->StringChars() ); + HBufC* log = textData->StringChars().AllocL(); + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::SetMetadataValueL string = %S" ), log ); + delete log; + log = NULL; + } + break; + + case EMTPObjectPropCodeTrack: + { + MMTPType::CopyL( aNewData, uint16Data ); + TBuf data; + data.AppendNum( uint16Data.Value() ); + aMediaProp.SetTextValueL( KMPXMediaMusicAlbumTrack, data ); + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::SetMetadataValueL Track = %S" ), &data ); + } + break; + + case EMTPObjectPropCodeNumberOfChannels: + { + MMTPType::CopyL( aNewData, uint16Data ); + // Device currently supports types 1(mono) & 2(Stereo) only + if ( ( uint16Data.Value() != KMtpChannelMono ) + && ( uint16Data.Value() != KMtpChannelStereo ) + && ( uint16Data.Value() != 0 ) )// 0 not used + { + PRINT( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::SetMetadataValueL NumberOfChannels NOT SUPPORT!" ) ); + User::Leave( KErrNotSupported ); + } + aMediaProp.SetTObjectValueL( KMPXMediaAudioNumberOfChannels, + uint16Data.Value() ); + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::SetMetadataValueL NumberOfChannels = %u" ), uint16Data.Value() ); + } + break; + + case EMTPObjectPropCodeSampleRate: + case EMTPObjectPropCodeAudioWAVECodec: + case EMTPObjectPropCodeAudioBitRate: + case EMTPObjectPropCodeDuration: + { + MMTPType::CopyL( aNewData, uint32Data ); + aMediaProp.SetTObjectValueL( attrib, uint32Data.Value() ); + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::SetMetadataValueL uint32 value = %u" ), uint32Data.Value() ); + } + break; + + case EMTPObjectPropCodeOriginalReleaseDate: + { + MMTPType::CopyL( aNewData, *textData ); + + TBuf data; + data.Copy( textData->StringChars().Left( KMtpDateTimeStringLength ) ); + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::SetMetadataValueL 0xDC99 date = %S" ), + &data ); + if ( data.Length() < KMtpDateTimeStringLength ) + { + PRINT( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::SetMetadataValueL 0xDC99 date string is too short" ) ); + break; + } + + TLex dateBuf( data.Left( 4 ) ); + TInt year; + dateBuf.Val( year ); + + dateBuf = data.Mid( 4, 2 ); + TInt month; + dateBuf.Val( month ); + + dateBuf = data.Mid( 6, 2 ); + TInt day; + dateBuf.Val( day ); + + dateBuf = data.Mid( 9, 2 ); + TInt hour; + dateBuf.Val( hour ); + + dateBuf = data.Mid( 11, 2 ); + TInt minute; + dateBuf.Val( minute ); + + dateBuf = data.Mid( 13, 2 ); + TInt second; + dateBuf.Val( second ); + +#ifdef _DEBUG + RDebug::Print( _L( "MM MTP <> SetMetadataValueL 0xDC99 dateTime Year = %d, Month = %d, Day = %d, Hour = %d, Minute = %d, Second = %d" ), + year, month, day, hour, minute, second ); +#endif // _DEBUG + TDateTime dateTime; + if ( ( month > 0 && month < 13 ) + && ( day > 0 && day < 32 ) + && ( hour >= 0 && hour < 60 ) + && ( minute >= 0 && minute < 60 ) + && ( second >= 0 && second < 60 ) ) + { + // microsecond is ignored because MPX doesn't support it, following s60 + dateTime.Set( year, + TMonth( --month ), + --day, + hour, + minute, + second, + 0 ); + } + else + { + // date string syntax is wrong + User::Leave( KErrGeneral ); + } + TTime time( dateTime ); +#ifdef _DEBUG + RDebug::Print( _L( "MM MTP <> SetMetadataValueL 0xDC99 time = %Ld, Year = %d, Month = %d, Day = %d, Hour = %d, Minute = %d, Second = %d"), + time.Int64(), + time.DateTime().Year(), + time.DateTime().Month(), + time.DateTime().Day(), + time.DateTime().Hour(), + time.DateTime().Minute(), + time.DateTime().Second() ); +#endif // _DEBUG + aMediaProp.SetTObjectValueL( KMPXMediaMusicYear, time.Int64() ); + } + break; + + case EMTPObjectPropCodeDescription: + { +#ifdef __MUSIC_ID_SUPPORT + //WriteMusicIdsL(*longString); +#else + desData = CMTPTypeArray::NewLC( EMTPTypeAUINT16 ); // + desData + MMTPType::CopyL( aNewData, *desData ); + TUint length = desData->NumElements(); + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::SetMetadataValueL length = %d" ), + length ); + if ( length != 0 ) + { + TBuf text; + text.Zero(); + for ( TUint i = 0; i < length; i++ ) + text.Append( desData->ElementUint( i ) ); + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::SetMetadataValueL text = %S" ), + &text ); + aMediaProp.SetTextValueL( KMPXMediaGeneralComment, text ); + } + else + { + aMediaProp.SetTextValueL( KMPXMediaGeneralComment, KEmptyText ); + } + CleanupStack::PopAndDestroy( desData ); // - desData +#endif //__MUSIC_ID_SUPPORT + } + break; + + case EMTPObjectPropCodeDRMStatus: + { + MMTPType::CopyL( aNewData, uint16Data ); + aMediaProp.SetTObjectValueL( attrib, uint16Data.Value() ); + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::SetMetadataValueL DRM Status uint16 value = %u" ), uint16Data.Value() ); + } + break; + + default: + { + User::Leave( KErrNotSupported ); + } + break; + } + + CleanupStack::PopAndDestroy( textData ); // - textData + PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::SetMetadataValueL" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::AddSongL +// Adds song info to the database +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataMpxAccess::AddSongL( const TDesC& aFullFileName ) + { + PRINT1( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::AddSongL aFullFileName = %S" ), &aFullFileName ); + + // Does a record already exist for this song? + RArray contentIDs; + CleanupClosePushL( contentIDs ); // + contentIDs + contentIDs.AppendL( KMPXMediaIdGeneral ); + + CMPXMedia* searchMedia = CMPXMedia::NewL( contentIDs.Array() ); + CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs + CleanupStack::PushL( searchMedia ); // + searchMedia + + searchMedia->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem ); + + searchMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXSong ); + + searchMedia->SetTextValueL( KMPXMediaGeneralUri, aFullFileName ); + + RArray songAttributes; + CleanupClosePushL( songAttributes ); // + songAttributes + songAttributes.AppendL( KMPXMediaGeneralUri ); + + PRINT( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::AddSongL searchMedia setup with no problems" ) ); + + PERFLOGSTART(KMpxCollectionFindAllLBeforeAdd); + CMPXMedia* foundMedia = CollectionHelperL()->FindAllL( + *searchMedia, + songAttributes.Array() ); + PERFLOGSTOP(KMpxCollectionFindAllLBeforeAdd); + + CleanupStack::PopAndDestroy( &songAttributes ); // - songAttributes + CleanupStack::PopAndDestroy( searchMedia ); // - searchMedia + + CleanupStack::PushL( foundMedia ); // + foundMedia + + if ( !foundMedia->IsSupported( KMPXMediaArrayCount ) ) + { + PRINT( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::AddSongL Not supported KMPXMediaArrayCount" ) ); + User::Leave( KErrNotSupported ); + } + + TInt foundItemCount = *foundMedia->Value( KMPXMediaArrayCount ); + + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::AddSongL %d Media Objects found in the WMP search" ), foundItemCount ); + + if ( foundItemCount > 1 ) + { + PRINT( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::AddSongL Multiple medias already exist in the collection. Error!!!" ) ); + } + else + { + // Create media properties for the song + PRINT( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::AddSongL Create media properties" ) ); + RArray contentIDs; + CleanupClosePushL( contentIDs ) ; // + contentIDs + contentIDs.AppendL( KMPXMediaIdGeneral ); + contentIDs.AppendL( KMPXMediaIdAudio ); + contentIDs.AppendL( KMPXMediaIdMusic ); + contentIDs.AppendL( KMPXMediaIdMTP ); + + CMPXMedia* media = CMPXMedia::NewL( contentIDs.Array() ); + CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs + CleanupStack::PushL( media ); // + media + + // MPXMedia default types + media->SetTObjectValueL( + KMPXMediaGeneralType, + EMPXItem ); + media->SetTObjectValueL( + KMPXMediaGeneralCategory, + EMPXSong ); + // File Path + // + TParsePtrC parse( aFullFileName ); + media->SetTextValueL( KMPXMediaGeneralUri, aFullFileName ); + media->SetTextValueL( KMPXMediaGeneralDrive, parse.Drive() ); + + if ( foundItemCount == 0 ) + { + // Set default Metadata + SetDefaultL( *media ); + PRINT( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::AddSongL Default values set to Media" ) ); + } + + // Update MPX WMP Roundtrip Metadata of the media object + media->SetTObjectValueL( KMPXMediaGeneralDeleted, EFalse ); + media->SetTObjectValueL( KMPXMediaGeneralModified, EFalse ); + media->SetTObjectValueL( KMPXMediaGeneralSynchronized, ETrue ); + media->SetTObjectValueL( KMPXMediaGeneralFlags, + KMPXMediaGeneralFlagsIsInvalid | KMPXMediaGeneralFlagsIsCorrupted ); + + if ( foundItemCount == 0 ) + { + PERFLOGSTART(KMpxCollectionAddL); + CollectionHelperL()->AddL( media ); + PERFLOGSTOP(KMpxCollectionAddL); + + PRINT( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::AddSongL Media added into collection" ) ); + } + else + { + PERFLOGSTART(KMpxCollectionSetL); + CollectionHelperL()->SetL( media ); + PERFLOGSTOP(KMpxCollectionSetL); + + PRINT( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::AddSongL Media metadata updated in collection" ) ); + } + + CleanupStack::PopAndDestroy( media ); // - media + } + + CleanupStack::PopAndDestroy( foundMedia ); // - foundMedia + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::AddSongL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::AddPlaylistL +// Adds Playlist to Mpx DB +// ----------------------------------------------------------------------------- +// +void CMmMtpDpMetadataMpxAccess::AddPlaylistL( const TDesC& aFullFileName ) + { + PRINT1( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::AddPlaylistL aFullFileName = %S" ), &aFullFileName ); + + // Does a record already exist for this playlist? + RArray contentIDs; + CleanupClosePushL( contentIDs ); // + contentIDs + contentIDs.AppendL( KMPXMediaIdGeneral ); + + CMPXMedia* searchMedia = CMPXMedia::NewL( contentIDs.Array() ); + CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs + CleanupStack::PushL( searchMedia ); // + searchMedia + + searchMedia->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem ); + searchMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXPlaylist ); + searchMedia->SetTextValueL( KMPXMediaGeneralUri, aFullFileName ); + + RArray playlistAttributes; + CleanupClosePushL( playlistAttributes ); // + playlistAttributes + playlistAttributes.AppendL( KMPXMediaGeneralId ); + playlistAttributes.AppendL( KMPXMediaGeneralTitle ); + playlistAttributes.AppendL( KMPXMediaGeneralUri ); + + PERFLOGSTART(KMpxCollectionFindAllLBeforeAdd); + CMPXMedia* foundMedia = CollectionHelperL()->FindAllL( *searchMedia, + playlistAttributes.Array() ); + PERFLOGSTOP(KMpxCollectionFindAllLBeforeAdd); + + CleanupStack::PopAndDestroy( &playlistAttributes ); // - playlistAttributes + CleanupStack::PopAndDestroy( searchMedia ); // - searchMedia + CleanupStack::PushL( foundMedia ); // + foundMedia + + if ( !foundMedia->IsSupported( KMPXMediaArrayCount ) ) + User::Leave( KErrNotSupported ); + + TInt foundItemCount = *foundMedia->Value( KMPXMediaArrayCount ); + + if ( foundItemCount != 0 ) + { + PRINT( _L( "MM MTP <> Playlist Media already exists in the collection" ) ); + } + else + { + // Creat media properties for the playlist + PRINT( _L( "MM MTP <> Create playlist media properties" ) ); + RArray contentIDs; + CleanupClosePushL( contentIDs ); // + contentIDs + contentIDs.AppendL( KMPXMediaIdGeneral ); + + CMPXMedia* media = CMPXMedia::NewL( contentIDs.Array() ); + CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs + CleanupStack::PushL( media ); // + media + + CMPXMediaArray* playlistArray = CMPXMediaArray::NewL(); + CleanupStack::PushL( playlistArray ); // + playlistArray; + + // MPXMedia default types + media->SetTObjectValueL( KMPXMediaGeneralType, + EMPXItem ); + media->SetTObjectValueL( KMPXMediaGeneralCategory, + EMPXPlaylist ); + // File Path + // + media->SetTextValueL( KMPXMediaGeneralUri, aFullFileName ); + + TParsePtrC parse( aFullFileName ); + + media->SetTextValueL( KMPXMediaGeneralDrive, parse.Drive() ); + media->SetTextValueL( KMPXMediaGeneralTitle, parse.Name() ); + media->SetTObjectValueL( KMPXMediaGeneralSynchronized, ETrue ); + media->SetCObjectValueL( KMPXMediaArrayContents, playlistArray ); + media->SetTObjectValueL( KMPXMediaArrayCount, playlistArray->Count() ); + + PERFLOGSTART(KMpxCollectionAddL); + CollectionHelperL()->AddL( media ); + PERFLOGSTOP(KMpxCollectionAddL); + + // Clear the array + CleanupStack::PopAndDestroy( playlistArray ); // - playlistArray + + CleanupStack::PopAndDestroy( media ); // - media + } + + CleanupStack::PopAndDestroy( foundMedia ); // - foundMedia + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::AddPlaylistL" ) ); + } + +// ----------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::SetPlaylistL +// Set playlist to DB +// ----------------------------------------------------------------------------- +// +void CMmMtpDpMetadataMpxAccess::SetPlaylistL( const TDesC& aPlaylistFileName, + CDesCArray& aRefFileArray ) + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::SetPlaylistL" ) ); + CMPXMediaArray* playlistArray = CMPXMediaArray::NewL(); + CleanupStack::PushL( playlistArray ); // + playlistArray + + TUint count = aRefFileArray.Count(); + for ( TUint j = 0; j < count; j++ ) + { + // if the file is video, skip it and continue + if ( MmMtpDpUtility::IsVideoL( aRefFileArray[j], iFramework ) ) + { + continue; + } + + // Creat media properties for the song + RArray contentIDs; + CleanupClosePushL( contentIDs ); // + contentIDs + contentIDs.AppendL( KMPXMediaIdGeneral ); + contentIDs.AppendL( KMPXMediaIdAudio ); + contentIDs.AppendL( KMPXMediaIdMusic ); + contentIDs.AppendL( KMPXMediaIdMTP ); + + CMPXMedia* media = CMPXMedia::NewL( contentIDs.Array() ); + CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs + CleanupStack::PushL( media ); // + media + + // MPXMedia default types + media->SetTObjectValueL( KMPXMediaGeneralType, + EMPXItem ); + media->SetTObjectValueL( KMPXMediaGeneralCategory, + EMPXSong ); + // File Path + // + TParsePtrC parse( aRefFileArray[j] ); + media->SetTextValueL( KMPXMediaGeneralUri, aRefFileArray[j] ); + media->SetTextValueL( KMPXMediaGeneralDrive, parse.Drive() ); + + // Add media into array contents + playlistArray->AppendL( media ); + + CleanupStack::Pop( media ); // - media + } + + RArray contentIDs; + CleanupClosePushL( contentIDs ); // + contentIDs + contentIDs.AppendL( KMPXMediaIdGeneral ); + + CMPXMedia* playlistMedia = CMPXMedia::NewL( contentIDs.Array() ); + CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs + CleanupStack::PushL( playlistMedia ); // + playlistMedia + + playlistMedia->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem ); + + playlistMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXPlaylist ); + + playlistMedia->SetTextValueL( KMPXMediaGeneralUri, aPlaylistFileName ); + + TParsePtrC parse( aPlaylistFileName ); + playlistMedia->SetTextValueL( KMPXMediaGeneralDrive, parse.Drive() ); + playlistMedia->SetTObjectValueL( KMPXMediaGeneralSynchronized, + ETrue ); + playlistMedia->SetCObjectValueL( KMPXMediaArrayContents, playlistArray ); + playlistMedia->SetTObjectValueL( KMPXMediaArrayCount, + playlistArray->Count() ); + + // Update the duplicate playlist(s) with the new playlist array + PERFLOGSTART(KMpxCollectionSetL); + CollectionHelperL()->SetL( playlistMedia ); + PERFLOGSTOP(KMpxCollectionSetL); + + CleanupStack::PopAndDestroy( playlistMedia ); // - playlistMedia + + // Clear the array + CleanupStack::PopAndDestroy( playlistArray ); // - playlistArray + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::SetPlaylistL" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::SetStorageRootL +// Set storage root of the MPX DB +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataMpxAccess::SetStorageRootL( const TDesC& aStorageRoot ) + { + PRINT1( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::SetStorageRoot aStoreRoot = %S" ), &aStorageRoot ); + + // get the drive number + TParse pathParser; + User::LeaveIfError( pathParser.Set( aStorageRoot, NULL, NULL ) ); + TChar driveChar( pathParser.Drive()[0] ); + + TInt driveNumber; + User::LeaveIfError( RFs::CharToDrive( driveChar, driveNumber ) ); + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::SetStorageRoot drive number = %d" ), driveNumber ); + + // get root path + User::LeaveIfError( PathInfo::GetRootPath( iStoreRoot, driveNumber ) ); + + PRINT1( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::SetStorageRoot root path: %S" ), &iStoreRoot ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::SetDefaultL +// Sets all of the default media properties +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataMpxAccess::SetDefaultL( CMPXMedia& aMediaProp ) + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::SetDefaultL" ) ); + // Title + aMediaProp.SetTextValueL( KMPXMediaGeneralTitle, KNullDesC ); + // Comment + aMediaProp.SetTextValueL( KMPXMediaGeneralComment, KNullDesC ); + // Artist + aMediaProp.SetTextValueL( KMPXMediaMusicArtist, KNullDesC ); + // Album + aMediaProp.SetTextValueL( KMPXMediaMusicAlbum, KNullDesC ); + // Year + //aMediaProp.SetTextValueL(KMPXMediaMusicYear, KNullDesC); // should never set year to KNullDesC, it is a TInt64 value + // Track + aMediaProp.SetTextValueL( KMPXMediaMusicAlbumTrack, KNullDesC ); + // Genre + aMediaProp.SetTextValueL( KMPXMediaMusicGenre, KNullDesC ); + // Composer + aMediaProp.SetTextValueL( KMPXMediaMusicComposer, KNullDesC ); + // Album artFilename + aMediaProp.SetTextValueL( KMPXMediaMusicAlbumArtFileName, KNullDesC ); + // URL + aMediaProp.SetTextValueL( KMPXMediaMusicURL, KNullDesC ); + PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::SetDefaultL" ) ); + } + +TMPXAttributeData CMmMtpDpMetadataMpxAccess::MpxAttribFromPropL( const CMPXMedia& aMedia, + const TUint16 aPropCode ) + { + const TMetadataTable KMetadataTable[] = + { + { EMTPObjectPropCodeName, KMPXMediaGeneralTitle }, + { EMTPObjectPropCodeArtist, KMPXMediaMusicArtist }, + { EMTPObjectPropCodeAlbumName, KMPXMediaMusicAlbum }, + { EMTPObjectPropCodeDateModified, KMPXMediaGeneralDate }, + { EMTPObjectPropCodeDateAdded, KMPXMediaGeneralDate }, + { EMTPObjectPropCodeDuration, KMPXMediaGeneralDuration }, + { EMTPObjectPropCodeTrack, KMPXMediaMusicAlbumTrack }, + { EMTPObjectPropCodeComposer, KMPXMediaMusicComposer }, + { EMTPObjectPropCodeOriginalReleaseDate, KMPXMediaMusicYear }, + { EMTPObjectPropCodeGenre, KMPXMediaMusicGenre }, + { EMTPObjectPropCodeDRMStatus, KMPXMediaMTPDrmStatus }, + { EMTPObjectPropCodeDescription, KMPXMediaGeneralComment }, + { EMTPObjectPropCodeNumberOfChannels, KMPXMediaAudioNumberOfChannels }, + { EMTPObjectPropCodeAudioBitRate, KMPXMediaAudioBitrate }, + { EMTPObjectPropCodeSampleRate, KMPXMediaAudioSamplerate }, + { EMTPObjectPropCodeAudioWAVECodec, KMPXMediaAudioAudioCodec }, + { EMTPObjectPropCodeAlbumArtist, KMPXMediaMusicArtist } + }; + + TInt i = 0; + TInt count = sizeof( KMetadataTable ) / sizeof( KMetadataTable[0] ); + while ( ( KMetadataTable[i].iPropCode != aPropCode ) + && ( i < count ) ) + { + i++; + } + + if ( i == count ) + { + // Not supported by MPX, shouldn't call this function + PRINT( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::MpxAttribFromPropL NOT SUPPORTED ATTRIBUTE" ) ); + User::Leave( KErrNotSupported ); + } + + return KMetadataTable[i].iMpxAttrib; + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::GetAllPlaylistL +// Get all playlists from MPX database in the assigned store +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataMpxAccess::GetAllPlaylistL( const TDesC& aStoreRoot, + CMPXMediaArray** aPlaylists ) + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::GetAllPlaylistL" ) ); + + SetStorageRootL( aStoreRoot ); + + RArray contentIDs; + CleanupClosePushL( contentIDs ); // + contentIDs + contentIDs.AppendL( KMPXMediaIdGeneral ); + + CMPXMedia* searchMedia = CMPXMedia::NewL( contentIDs.Array() ); + CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs + CleanupStack::PushL( searchMedia ); // + searchMedia + + searchMedia->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem ); + searchMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXPlaylist ); + searchMedia->SetTextValueL( KMPXMediaGeneralDrive, iStoreRoot ); + + RArray playlistAttributes; + CleanupClosePushL( playlistAttributes ); // + playlistAttributes + playlistAttributes.AppendL( KMPXMediaGeneralId ); + playlistAttributes.AppendL( KMPXMediaGeneralTitle ); + playlistAttributes.AppendL( KMPXMediaGeneralUri ); + + PERFLOGSTART(KMpxCollectionGetPlaylist); + CMPXMedia* foundMedia = CollectionHelperL()->FindAllL( *searchMedia, + playlistAttributes.Array() ); + PERFLOGSTOP(KMpxCollectionGetPlaylist); + + CleanupStack::PopAndDestroy( &playlistAttributes ); // - playlistAttributes + CleanupStack::PopAndDestroy( searchMedia ); // - searchMedia + CleanupStack::PushL( foundMedia ); // + foundMedia + + if ( !foundMedia->IsSupported( KMPXMediaArrayCount ) ) + { + User::Leave( KErrNotSupported ); + } + + TInt count = *foundMedia->Value ( KMPXMediaArrayCount ); + + PRINT1( _L("MM MTP <> CMmMtpDpMetadataMpxAccess::GetAllPlaylistL [%d] playlists found in Playlist Database"), count ); + + if ( count > 0 ) + { + if ( !foundMedia->IsSupported( KMPXMediaArrayContents ) ) + { + User::Leave( KErrNotSupported ); + } + + *aPlaylists = CMPXMediaArray::NewL( *( foundMedia->Value ( + KMPXMediaArrayContents ) ) ); + } + + CleanupStack::PopAndDestroy( foundMedia ); // - foundMedia + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::GetAllPlaylistL" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::GetAllReferenceL +// Get all references of specified playlist +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataMpxAccess::GetAllReferenceL( CMPXMedia* aPlaylist, + CDesCArray& aReferences ) + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::GetAllReferenceL" ) ); + + __ASSERT_DEBUG( aPlaylist, User::Panic( KMtpMpxPanic, KErrArgument ) ); + + // Extract the playlist id from the found object + TUint32 playlistId = *(*aPlaylist).Value ( KMPXMediaGeneralId ); + + // find the media object that contains a list of songs in the playlist + RArray contentIDs; + CleanupClosePushL( contentIDs ); // + contentIDs + contentIDs.AppendL( KMPXMediaIdGeneral ); + + CMPXMedia* searchMedia = CMPXMedia::NewL( contentIDs.Array() ); + CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs + CleanupStack::PushL( searchMedia ); // + searchMedia + + searchMedia->SetTObjectValueL( KMPXMediaGeneralType, EMPXGroup ); + searchMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXSong ); + searchMedia->SetTObjectValueL ( KMPXMediaGeneralId, playlistId ); + + RArray songAttributes; + CleanupClosePushL( songAttributes ); // + songAttributes + songAttributes.AppendL( KMPXMediaGeneralId ); + songAttributes.AppendL( KMPXMediaGeneralUri ); + + PERFLOGSTART(KMpxCollectionGetReference); + CMPXMedia* foundMedia = CollectionHelperL()->FindAllL( *searchMedia, + songAttributes.Array() ); + PERFLOGSTOP(KMpxCollectionGetReference); + + CleanupStack::PopAndDestroy( &songAttributes ); // - songAttributes + CleanupStack::PopAndDestroy( searchMedia ); // - searchMedia + CleanupStack::PushL( foundMedia ); // + foundMedia + + if ( !foundMedia->IsSupported( KMPXMediaArrayCount ) ) + { + User::Leave( KErrNotSupported ); + } + + // Number of references + TInt numOfRefs = *foundMedia->Value ( KMPXMediaArrayCount ); + if ( numOfRefs > 0 ) + { + if ( !foundMedia->IsSupported( KMPXMediaArrayContents ) ) + { + User::Leave( KErrNotSupported ); + } + + const CMPXMediaArray* refArray = foundMedia->Value ( + KMPXMediaArrayContents ); + + // Import the references + for ( TInt i = 0; i < numOfRefs; i++ ) + { + const CMPXMedia* refMedia = ( *refArray )[i]; + + if ( !refMedia->IsSupported( KMPXMediaGeneralUri ) ) + { + User::Leave( KErrNotSupported ); + } + + // may replace the following 3 statements into the following: + // AppendL(refMedia->ValueText(KMPXMediaGeneralUri)); + HBufC* musicFileLocation = refMedia->ValueText( KMPXMediaGeneralUri ).AllocLC(); + aReferences.AppendL( *musicFileLocation ); + + PRINT1( _L("MM MTP <> CMmMtpDpMetadataMpxAccess::GetAllReferenceL, [%S] found from MPX db"), musicFileLocation ); + + CleanupStack::PopAndDestroy( musicFileLocation ); // - musicFileLocation + } + } + + CleanupStack::PopAndDestroy( foundMedia ); // - foundMedia + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::GetAllReferenceL" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::GetPlaylistNameL +// +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataMpxAccess::GetPlaylistNameL( CMPXMedia* aPlaylist, + TDes& aPlaylistName ) + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::GetPlaylistNameL" ) ); + + if ( !aPlaylist->IsSupported( KMPXMediaGeneralUri ) ) + { + User::Leave( KErrNotSupported ); + } + + aPlaylistName.Copy( aPlaylist->ValueText( KMPXMediaGeneralUri ) ); + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::GetPlaylistNameL" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::GetModifiedContentL +// Get modified content +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataMpxAccess::GetModifiedContentL( TInt& arrayCount, + CDesCArray& aModifiedcontent ) + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::GetModifiedContentL" ) ); + CMPXMedia* foundMedia; + TInt foundItemCount( 0 ); + HBufC* musicFileLocation( NULL ); + + // Modified content + PRINT( _L( "MM MTP <> Modified contents are:" ) ); + + foundMedia = FindWMPMediaLC( KMPXMediaGeneralModified, ETrue ); // + foundMedia + + if ( !foundMedia->IsSupported( KMPXMediaArrayCount ) ) + { + User::Leave( KErrNotSupported ); + } + + foundItemCount = *foundMedia->Value( KMPXMediaArrayCount ); + + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::GetModifiedContentL() found %d Media Objects" ), foundItemCount ); + + if ( foundItemCount ) + { + if ( !foundMedia->IsSupported( KMPXMediaArrayContents ) ) + { + User::Leave( KErrNotSupported ); + } + + const CMPXMediaArray* foundArray = foundMedia->Value( KMPXMediaArrayContents ); + + for ( TInt j = 0; j < foundItemCount; j++ ) + { + CMPXMedia* media = CMPXMedia::NewL( *(*foundArray)[j] ); + CleanupStack::PushL( media ); // + media + + if ( !media->IsSupported( KMPXMediaGeneralUri ) ) + { + User::Leave( KErrNotSupported ); + } + + musicFileLocation = media->ValueText( KMPXMediaGeneralUri ).AllocLC(); // + musicFileLoaction + + aModifiedcontent.AppendL( *musicFileLocation ); + arrayCount++; + PRINT1( _L("arrayCount = %d"), arrayCount); + + CleanupStack::PopAndDestroy( musicFileLocation ); // - musicFileLocation + CleanupStack::PopAndDestroy( media ); // - media + } + } + + CleanupStack::PopAndDestroy( foundMedia ); // + foundMedia + PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::GetModifiedContentL" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::IsExistL +// if the playlsit exist in the MPX DB +// --------------------------------------------------------------------------- +// +TBool CMmMtpDpMetadataMpxAccess::IsExistL( const TDesC& aSuid ) + { + PRINT1( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::IsExist aSuid(%S)" ), &aSuid ); + RArray contentIDs; + CleanupClosePushL( contentIDs ); // + contentIDs + contentIDs.AppendL( KMPXMediaIdGeneral ); + + CMPXMedia* searchMedia = CMPXMedia::NewL( contentIDs.Array() ); + CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs + CleanupStack::PushL( searchMedia ); // + searchMedia + + searchMedia->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem ); + searchMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXPlaylist ); + searchMedia->SetTextValueL( KMPXMediaGeneralUri, aSuid ); + + RArray playlistAttributes; + CleanupClosePushL( playlistAttributes ); // + playlistAttributes + playlistAttributes.AppendL( KMPXMediaGeneralId ); + playlistAttributes.AppendL( KMPXMediaGeneralTitle ); + playlistAttributes.AppendL( KMPXMediaGeneralUri ); + + CMPXMedia* foundMedia = CollectionHelperL()->FindAllL( *searchMedia, + playlistAttributes.Array() ); + + CleanupStack::PopAndDestroy( &playlistAttributes ); // - playlistAttributes + CleanupStack::PopAndDestroy( searchMedia ); // - searchMedia + + if ( !foundMedia->IsSupported( KMPXMediaArrayCount ) ) + User::Leave( KErrNotSupported ); + + TInt foundItemCount = *foundMedia->Value( KMPXMediaArrayCount ); + + delete foundMedia; + foundMedia = NULL; + + PRINT1( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::IsExist foundItemCount(%d)" ), foundItemCount ); + return ( foundItemCount > 0 ? ETrue : EFalse ); + } + +//end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadatavideoaccess.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadatavideoaccess.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,1560 @@ +/* +* 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: Meta data Video access +* +*/ + +#include +#include +#include +#include +#include + +// from Symbian MTP +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cmmmtpdpmetadatavideoaccess.h" +#include "mmmtpdplogger.h" +#include "mmmtpdputility.h" +#include "tmmmtpdppanic.h" +#include "mmmtpvideodbdefs.h" + +static const TInt KMtpMaxStringLength = 255; +static const TInt KMtpMaxDescriptionLength = 0x200; +const TInt KStorageRootMaxLength = 10; + +#ifdef _DEBUG +static const TInt KMtpMaxStringDescLength = KMtpMaxStringLength - 1; +#endif + +_LIT( KEmptyText, "" ); +// Database interface +_LIT( KSelect, "SELECT " ); +_LIT( KAllColumns, "*" ); +_LIT( KFrom, " FROM " ); +_LIT( KWhere, " WHERE " ); +_LIT( KNot, " NOT " ); +_LIT( KEquals, " = " ); +_LIT( KTrue, "1" ); + +const TInt KMaxQueryLength = 512; +const TInt KMtpCompactInterval = 50; // Compact every .... + +CMmMtpDpMetadataVideoAccess* CMmMtpDpMetadataVideoAccess::NewL( RFs& aRfs ) + { + CMmMtpDpMetadataVideoAccess* me = new(ELeave) CMmMtpDpMetadataVideoAccess( aRfs ); + CleanupStack::PushL(me); + me->ConstructL(); + CleanupStack::Pop(me); + + return me; + } + +CMmMtpDpMetadataVideoAccess::CMmMtpDpMetadataVideoAccess( RFs& aRfs ) : iRfs(aRfs), + iDbState(ENoRecord), + iDbOpened(EFalse) + { + + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::ConstructL +// Second-phase +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataVideoAccess::ConstructL() + { + iQueryText = HBufC::NewL( KMaxQueryLength ); + + User::LeaveIfError( iDbsSession.Connect() ); + + TInt err = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultPhoneMemory, + iStoreNum ); + + err = OpenDatabase(); + + if ( KErrNone != err ) + { + PRINT1( _L( "CMmMtpDpMetadataVideoAccess::ConstructL OpenDatabase err = %d" ), err ); + } + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::OpenDatabase +// Open data base +// --------------------------------------------------------------------------- +// +TInt CMmMtpDpMetadataVideoAccess::OpenDatabase() + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::OpenDatabase" ) ); + + iRfs.CreatePrivatePath( iStoreNum ); + TInt err = iRfs.SetSessionToPrivate( iStoreNum ); + + if ( err == KErrNone ) + { + TRAP( err, iFileStore = CPermanentFileStore::OpenL( iRfs, KMtpVideoDb, EFileRead | EFileWrite ) ); + + if ( err == KErrNone ) + TRAP( err, iFileStore->SetTypeL( iFileStore->Layout() ) ); + + if ( err == KErrNone ) + { + TRAP( err, iDatabase.OpenL( iFileStore, iFileStore->Root() ) ); + PRINT1( _L( "MM MTP <> OpenDatabase RDbNamedDatabase::OpenL, err = %d" ), err ); + } + + if ( err != KErrNone ) + { + iRfs.Delete( KMtpVideoDb ); // delete first before creating a new one + TRAP( err, iFileStore = CPermanentFileStore::CreateL( iRfs, KMtpVideoDb, EFileRead | EFileWrite ) ); + PRINT1( _L( "MM MTP <> OpenDatabase RDbNamedDatabase::CreateL, err = %d" ), err ); + + if ( err == KErrNone ) + { + TRAP( err, iFileStore->SetTypeL( iFileStore->Layout() ) ); + + TStreamId streamId = 0; + + if ( err == KErrNone ) + TRAP( err, streamId = iDatabase.CreateL( iFileStore ) ); + + if ( err == KErrNone ) + TRAP( err, iFileStore->SetRootL( streamId ) ); + + if ( err == KErrNone ) + TRAP( err, CreateDatabaseTablesL() ); + + if ( KErrNone != err ) + { + iDatabase.Close(); + iRfs.Delete( KMtpVideoDb ); + } + } + } + } + + TBuf storeRoot; + err = PathInfo::GetRootPath( storeRoot, iStoreNum ); + iRfs.SetSessionPath( storeRoot ); + + if ( err == KErrNone ) + { + iDbOpened = ETrue; + } + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::OpenDatabase" ) ); + return err; + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::OpenDatabaseL +// Open data base +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataVideoAccess::OpenDatabaseL() + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::OpenDatabaseL" ) ); + if ( OpenDatabase() != KErrNone ) + User::Leave( KErrGeneral ); + PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::OpenDatabaseL" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::~CMmMtpDpMetadataVideoAccess +// Destructor +// --------------------------------------------------------------------------- +// +CMmMtpDpMetadataVideoAccess::~CMmMtpDpMetadataVideoAccess() + { + delete iQueryText; + delete iColSet; + iRecordSet.Close(); + iDatabase.Close(); + iDbsSession.Close(); + delete iFileStore; + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::CreateDatabaseTablesL +// Case where a new memory card is used and the player has not been opened +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataVideoAccess::CreateDatabaseTablesL() + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::CreateDatabaseTablesL" ) ); + // Video table + RBuf formatBuf; + User::LeaveIfError( formatBuf.Create( 5 * KMaxQueryLength ) ); + CleanupClosePushL( formatBuf ); // + foramtBuf + + formatBuf.Append( KMtpVideoStartCreateTable ); + formatBuf.Append( KMtpVideoTable ); + formatBuf.Append( KMtpVideoOpenBracket ); + + formatBuf.Append( KMtpVideoLocation ); + formatBuf.Append( KMtpVideoLocationType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoName ); + formatBuf.Append( KMtpVideoNameType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoArtist ); + formatBuf.Append( KMtpVideoArtistType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoTrack ); + formatBuf.Append( KMtpVideoTrackType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoGenre ); + formatBuf.Append( KMtpVideoGenreType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoAlbumName ); + formatBuf.Append( KMtpVideoAlbumNameType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoComposer ); + formatBuf.Append( KMtpVideoComposerType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoOrigReleaseDate ); + formatBuf.Append( KMtpVideoOrigReleaseDateType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoComment ); + formatBuf.Append( KMtpVideoCommentType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoWidth ); + formatBuf.Append( KMtpVideoWidthType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoHeight ); + formatBuf.Append( KMtpVideoHeightType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoDuration ); + formatBuf.Append( KMtpVideoDurationType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoSampleRate ); + formatBuf.Append( KMtpVideoSampleRateType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoNumberOfChannels ); + formatBuf.Append( KMtpVideoNumberOfChannelsType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoAudioCodec ); + formatBuf.Append( KMtpVideoAudioCodecType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoAudioBitrate ); + formatBuf.Append( KMtpVideoAudioBitrateType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoVideoCodec ); + formatBuf.Append( KMtpVideoVideoCodecType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoVideoBitrate ); + formatBuf.Append( KMtpVideoVideoBitrateType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoFramesPer1000Sec ); + formatBuf.Append( KMtpVideoFramesPer1000SecType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoKeyFrameDistance ); + formatBuf.Append( KMtpVideoKeyFrameDistanceType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoScanType ); + formatBuf.Append( KMtpVideoScanTypeType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoEncodingProfile ); + formatBuf.Append( KMtpVideoEncodingProfileType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoParentalRating ); + formatBuf.Append( KMtpVideoParentalRatingType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoUseCount ); + formatBuf.Append( KMtpVideoUseCountType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoDRM ); + formatBuf.Append( KMtpVideoDRMType ); + formatBuf.Append( KMtpVideoCommaSign ); + + formatBuf.Append( KMtpVideoDeleted ); + formatBuf.Append( KMtpVideoDeletedType ); + formatBuf.Append( KMtpVideoCloseBracket ); + + // Execute the SQL statement. + User::LeaveIfError( iDatabase.Execute( formatBuf ) ); + PRINT( _L( "MM MTP <> Video Table Created" ) ); + + CleanupStack::PopAndDestroy( &formatBuf ); // - foramtBuf + PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::CreateDatabaseTablesL" ) ); + } + +// For performance, better to regularly compact the MC database. +void CMmMtpDpMetadataVideoAccess::CompactDbIfNecessaryL() + { + iRecordCount++; + + if ( iRecordCount > KMtpCompactInterval ) + { + iRecordCount = 0; + + PRINT( _L( "MM MTP <> Compacting database file..." ) ); + + if ( IsDatabaseOpened() ) + User::LeaveIfError( iDatabase.Compact() ); + } + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::CleanupDbIfNecessaryL +// Cleanup Database +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataVideoAccess::CleanupDbIfNecessaryL() + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::CleanupDbIfNecessaryL" ) ); + + ExecuteQueryL( KAllColumns, KMtpVideoTable, KMtpVideoDeleted, KTrue, EFalse, EFalse ); + PRINT1( _L( "MM MTP <> CleanupDbIfNecessaryL Database deleted count = %d" ), iRecordSet.CountL() ); + + for ( iRecordSet.FirstL(); iRecordSet.AtRow(); iRecordSet.NextL() ) + { + HBufC* data = ReadLongTextL( KMtpVideoLocation ); + CleanupStack::PushL( data ); + + PRINT1( _L( "MM MTP <> CleanupDbIfNecessaryL removing %S from database" ), data ); + iRecordSet.DeleteL(); + CleanupStack::PopAndDestroy( data ); + } + + delete iColSet; + iColSet = NULL; + iRecordSet.Close(); + PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::CleanupDbIfNecessaryL" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::IdentifyDeletedFilesL +// Identify deleted files +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataVideoAccess::IdentifyDeletedFilesL() + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::IdentifyDeletedFilesL" ) ); + + ExecuteQueryL( KAllColumns, KMtpVideoTable, KMtpVideoLocation, KNullDesC, ETrue ); + PRINT1( _L( "MM MTP <> CleanupDbIfNecessaryL Database total count = %d" ), iRecordSet.CountL() ); + + for ( iRecordSet.FirstL(); iRecordSet.AtRow(); iRecordSet.NextL( )) + { + HBufC* data = ReadLongTextL( KMtpVideoLocation ); + CleanupStack::PushL( data ); + + if ( !FileExists( *data ) ) + { + iRecordSet.UpdateL(); + PRINT1( _L( "MM MTP <> IdentifyDeletedFilesL marking %S as deleted" ), data ); + + TDbColNo num = iColSet->ColNo( KMtpVideoDeleted ); + + iRecordSet.SetColL( num, 1 ); + iRecordSet.PutL(); + } + + CleanupStack::PopAndDestroy( data ); + } + + delete iColSet; + iColSet = NULL; + iRecordSet.Close(); + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::IdentifyDeletedFilesL" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::ReadLongTextL +// Read from Data base +// --------------------------------------------------------------------------- +// +HBufC* CMmMtpDpMetadataVideoAccess::ReadLongTextL( const TDesC& aColumn ) + { + TDbColNo num = iColSet->ColNo( aColumn ); + + // The row must have previously been read into the rowset + // using RDbRowSet::GetL(). + iRecordSet.GetL(); + + TInt len = iRecordSet.ColLength( num ); + + HBufC* buf = HBufC::NewLC( len ); // + buf + TPtr value( buf->Des() ); + + if ( len > 0 ) + { + RDbColReadStream strm; + strm.OpenLC( iRecordSet, num ); + strm.ReadL( value, len ); + strm.Close(); + CleanupStack::PopAndDestroy( &strm ); + } + else + { + value.SetLength( 0 ); + } + + CleanupStack::Pop( buf ); // - buf + PRINT2( _L( "MM MTP <> ReadLongTextL Metadata value for %S is \"%S\"" ), &aColumn, buf ); + return buf; + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::WriteLongTextL +// Utility to write to the database +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataVideoAccess::WriteLongTextL( const TDesC& aColumn, const TDesC& aValue ) + { + PRINT2( _L( "MM MTP <> WriteLongTextL Metadata value for %S is \"%S\"" ), &aColumn, &aValue ); + TDbColNo num = iColSet->ColNo( aColumn ); + RDbColWriteStream strm; + strm.OpenLC( iRecordSet, num ); + strm.WriteL( aValue ); + strm.Close(); + CleanupStack::PopAndDestroy( &strm ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::ExecuteQueryL +// Executes a query on the database and sets the cursor at the start of the recordset +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataVideoAccess::ExecuteQueryL( const TDesC& aSelectThese, const TDesC& aFromTable, + const TDesC& aColumnToMatch, const TDesC& aMatchCriteria, + const TBool aIfNot, const TBool aNeedQuotes ) + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::ExecuteQueryL" ) ); + + delete iColSet; + iColSet = NULL; + iRecordSet.Close(); + //__ASSERT_DEBUG(!iColSet, _MTP_PANIC(KMtpPrtPncCat, ENullPointer)); // Must have iColSet == NULL + + // Make sure any quotes in the aMatchCriteria are doubled... + HBufC* matchText = HBufC::NewLC( 2 * aMatchCriteria.Length() ); + TPtr pMatchText( matchText->Des() ); + TInt srcLen = aMatchCriteria.Length(); + TPtrC ch; + + for ( TInt i = 0; i < srcLen; ++i ) + { + ch.Set( &aMatchCriteria[i], 1 ); + pMatchText.Append( ch ); + + if ( ch.CompareF( KMtpVideoSingleQuote ) == 0 ) + { + pMatchText.Append( ch ); + } + } + + TPtr query( iQueryText->Des() ); + query.Zero(); + query.Append( KSelect ); + query.Append( aSelectThese ); + query.Append( KFrom ); + query.Append( aFromTable ); + + if ( aColumnToMatch.Length() != 0 ) + { + query.Append( KWhere ); + + if ( aIfNot ) + query.Append( KNot ); + + query.Append( aColumnToMatch ); + query.Append( KEquals ); + + if ( aNeedQuotes ) + query.Append( KMtpVideoSingleQuote ); + + query.Append( *matchText ); + + if ( aNeedQuotes ) + query.Append( KMtpVideoSingleQuote ); + } + + TDbQuery dbQuery( query ); + PRINT1( _L( "MM MTP <> ExecuteQueryL Query is \"%S\"" ), &query ); + + // Execute the query + User::LeaveIfError( iRecordSet.Prepare( iDatabase, dbQuery ) ); + User::LeaveIfError( iRecordSet.EvaluateAll() ); + iRecordSet.FirstL(); + iColSet = iRecordSet.ColSetL(); + CleanupStack::PopAndDestroy( matchText ); + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::ExecuteQueryL" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::OpenSessionL +// Called when the MTP session is initialised +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataVideoAccess::OpenSessionL() + { + + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::CloseSessionL +// Called when the MTP session is closed +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataVideoAccess::CloseSessionL() + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::CloseSessionL" ) ); + + //open database if not opened + if ( !IsDatabaseOpened() ) + return; + + // Make sure the db is commited + SetRecordL( KNullDesC, ENoRecord ); + + CleanupDbIfNecessaryL(); + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::CloseSessionL" ) ) + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::AddVideoL +// Adds video info to the database +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataVideoAccess::AddVideoL( const TDesC& aFullFileName ) + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::AddVideoL" ) ); + + //open database if not opened + if ( !IsDatabaseOpened() ) + OpenDatabaseL(); + + // Put any outstanding changes to the DB + SetRecordL( KNullDesC, ENoRecord ); + TDbColNo num = 0; + + // Does a record already exist for this playlist? + ExecuteQueryL( KAllColumns, KMtpVideoTable, KMtpVideoLocation, aFullFileName ); + + if ( iRecordSet.CountL() == 0 ) // No record... + { + PRINT1( _L( "MM MTP <> AddVideoL file %S is adding to collection" ), &aFullFileName ); + + // Create the record + iRecordSet.InsertL(); + + // Defaults + num = iColSet->ColNo( KMtpVideoLocation ); + iRecordSet.SetColL( num, aFullFileName ); + + num = iColSet->ColNo( KMtpVideoName ); + iRecordSet.SetColL( num, aFullFileName ); // Default name is the filename. + + num = iColSet->ColNo( KMtpVideoArtist ); + iRecordSet.SetColL( num, KNullDesC ); + + num = iColSet->ColNo( KMtpVideoTrack ); + iRecordSet.SetColL( num, 0 ); + + num = iColSet->ColNo( KMtpVideoGenre ); + iRecordSet.SetColL( num, KNullDesC ); + + num = iColSet->ColNo( KMtpVideoAlbumName ); + iRecordSet.SetColL( num, KNullDesC ); + + num = iColSet->ColNo( KMtpVideoComposer ); + iRecordSet.SetColL( num, KNullDesC ); + + num = iColSet->ColNo( KMtpVideoOrigReleaseDate ); + iRecordSet.SetColL( num, KNullDesC ); + + num = iColSet->ColNo( KMtpVideoComment ); + iRecordSet.SetColL( num, KNullDesC ); + + num = iColSet->ColNo( KMtpVideoWidth ); + iRecordSet.SetColL( num, 0 ); + + num = iColSet->ColNo( KMtpVideoHeight ); + iRecordSet.SetColL( num, 0 ); + + num = iColSet->ColNo(KMtpVideoDuration); + iRecordSet.SetColL(num, 0); + + num = iColSet->ColNo( KMtpVideoSampleRate ); + iRecordSet.SetColL( num, 0 ); + + num = iColSet->ColNo( KMtpVideoNumberOfChannels ); + iRecordSet.SetColL( num, 0 ); + + num = iColSet->ColNo( KMtpVideoAudioCodec ); + iRecordSet.SetColL( num, 0 ); + + num = iColSet->ColNo( KMtpVideoAudioBitrate ); + iRecordSet.SetColL( num, 0 ); + + num = iColSet->ColNo( KMtpVideoVideoCodec ); + iRecordSet.SetColL( num, 0 ); + + num = iColSet->ColNo( KMtpVideoVideoBitrate ); + iRecordSet.SetColL( num, 0 ); + + num = iColSet->ColNo(KMtpVideoFramesPer1000Sec); + iRecordSet.SetColL(num, 0); + + num = iColSet->ColNo( KMtpVideoKeyFrameDistance ); + iRecordSet.SetColL( num, 0 ); + + num = iColSet->ColNo( KMtpVideoScanType ); + iRecordSet.SetColL( num, 0 ); + + num = iColSet->ColNo( KMtpVideoEncodingProfile ); + iRecordSet.SetColL( num, KNullDesC ); + + num = iColSet->ColNo( KMtpVideoParentalRating ); + iRecordSet.SetColL( num, KNullDesC ); + + num = iColSet->ColNo( KMtpVideoUseCount ); + iRecordSet.SetColL( num, 0 ); + + num = iColSet->ColNo( KMtpVideoDRM ); + iRecordSet.SetColL( num, 0 ); + } + else + { + PRINT1( _L( "MM MTP <> AddVideoL file %S is found in the collection" ), &aFullFileName ); + + iRecordSet.FirstL(); + iRecordSet.UpdateL(); + } + + // reset deleted bit + num = iColSet->ColNo( KMtpVideoDeleted ); + iRecordSet.SetColL( num, 0 ); + + // Commit the record + TRAPD( err, iRecordSet.PutL() ); + + if ( KErrNone != err ) + { + PRINT1( _L( "MM MTP <> AddVideoL Failed to add record to database with code %d" ), err ); + iRecordSet.Cancel(); + User::Leave( err ); + } + + delete iColSet; + iColSet = NULL; + iRecordSet.Close(); + CompactDbIfNecessaryL(); + PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::AddVideoL" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::GetObjectMetadataValueL +// Gets a piece of metadata from the collection +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataVideoAccess::GetObjectMetadataValueL( const TUint16 aPropCode, + MMTPType& aNewData, + const CMTPObjectMetaData& aObjectMetaData ) + { + PRINT1( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::GetObjectMetadataValue aPropCode = 0x%x" ), aPropCode ); + + //open database if not opened + if ( !IsDatabaseOpened() ) + OpenDatabaseL(); + + // File Path + HBufC* suid = aObjectMetaData.DesC( CMTPObjectMetaData::ESuid ).AllocLC(); // + suid + SetRecordL( *suid, ERecordRead ); + CleanupStack::PopAndDestroy( suid ); // - suid + + HBufC* data = NULL; + TDbColNo num; + TUint32 uInt32 = 0; + TUint16 uInt16 = 0; + + switch (aPropCode) + { + case EMTPObjectPropCodeName: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeName-MD" ) ); + data = ReadLongTextL( KMtpVideoName ); + } + break; + + case EMTPObjectPropCodeArtist: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeArtist-MD" ) ); + data = ReadLongTextL( KMtpVideoArtist ); + } + break; + + case EMTPObjectPropCodeTrack: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeTrack-MD" ) ); + num = iColSet->ColNo( KMtpVideoTrack ); + uInt16 = iRecordSet.ColUint16( num ); + if ( EMTPTypeUINT16 == aNewData.Type() ) + { + ( ( TMTPTypeUint16 & ) aNewData ).Set( uInt16 ); + } + else + { + User::Leave( KErrArgument ); + } + } + break; + + case EMTPObjectPropCodeGenre: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeGenre-MD" ) ); + data = ReadLongTextL( KMtpVideoGenre ); + } + break; + + case EMTPObjectPropCodeAlbumName: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeAlbumName-MD" ) ); + data = ReadLongTextL( KMtpVideoAlbumName ); + } + break; + + case EMTPObjectPropCodeComposer: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeComposer-MD" ) ); + data = ReadLongTextL( KMtpVideoComposer ); + } + break; + + case EMTPObjectPropCodeOriginalReleaseDate: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeOriginalReleaseDate-MD" ) ); + data = ReadLongTextL( KMtpVideoOrigReleaseDate ); + } + break; + + case EMTPObjectPropCodeDescription: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeDescription-MD" ) ); + data = ReadLongTextL( KMtpVideoComment ); + + if ( data->Length() != 0 ) + ( ( CMTPTypeString& ) aNewData ).SetL( *data ) ; + else + ( ( TMTPTypeUint32 & ) aNewData ).Set( 0 ); // return zero if description is empty + + delete data; + data = NULL; + } + break; + + case EMTPObjectPropCodeWidth: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeWidth-MD" ) ); + num = iColSet->ColNo( KMtpVideoWidth ); + uInt32 = iRecordSet.ColUint32( num ); + if ( EMTPTypeUINT32 == aNewData.Type() ) + { + ( ( TMTPTypeUint32 & ) aNewData ).Set( uInt32 ); + } + else + { + User::Leave( KErrArgument ); + } + } + break; + + case EMTPObjectPropCodeHeight: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeHeight-MD" ) ); + num = iColSet->ColNo( KMtpVideoHeight ); + uInt32 = iRecordSet.ColUint32( num ); + if ( EMTPTypeUINT32 == aNewData.Type() ) + { + ( ( TMTPTypeUint32 & ) aNewData ).Set( uInt32 ); + } + else + { + User::Leave( KErrArgument ); + } + } + break; + + case EMTPObjectPropCodeDuration: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeDuration-MD" ) ); + num = iColSet->ColNo( KMtpVideoDuration ); + uInt32 = iRecordSet.ColUint32( num ); + if ( EMTPTypeUINT32 == aNewData.Type() ) + { + ( ( TMTPTypeUint32 & ) aNewData ).Set( uInt32 ); + } + else + { + User::Leave( KErrArgument ); + } + } + break; + + case EMTPObjectPropCodeSampleRate: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeSampleRate-MD" ) ); + num = iColSet->ColNo( KMtpVideoSampleRate ); + uInt32 = iRecordSet.ColUint32( num ); + if ( EMTPTypeUINT32 == aNewData.Type() ) + { + ( ( TMTPTypeUint32 & ) aNewData ).Set( uInt32 ); + } + else + { + User::Leave( KErrArgument ); + } + } + break; + + case EMTPObjectPropCodeNumberOfChannels: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeNumberOfChannels-MD" ) ); + num = iColSet->ColNo( KMtpVideoNumberOfChannels ); + uInt16 = iRecordSet.ColUint16( num ); + if ( EMTPTypeUINT16 == aNewData.Type() ) + { + ( ( TMTPTypeUint16 & ) aNewData ).Set( uInt16 ); + } + else + { + User::Leave( KErrArgument ); + } + } + break; + + case EMTPObjectPropCodeAudioWAVECodec: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeAudioWAVECodec-MD" ) ); + num = iColSet->ColNo( KMtpVideoAudioCodec ); + uInt32 = iRecordSet.ColUint32( num ); + if ( EMTPTypeUINT32 == aNewData.Type() ) + { + ( ( TMTPTypeUint32 & ) aNewData ).Set( uInt32 ); + } + else + { + User::Leave( KErrArgument ); + } + } + break; + + case EMTPObjectPropCodeAudioBitRate: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeAudioBitRate-MD" ) ); + num = iColSet->ColNo( KMtpVideoAudioBitrate ); + uInt32 = iRecordSet.ColUint32( num ); + if ( EMTPTypeUINT32 == aNewData.Type() ) + { + ( ( TMTPTypeUint32 & ) aNewData ).Set( uInt32 ); + } + else + { + User::Leave( KErrArgument ); + } + } + break; + + case EMTPObjectPropCodeVideoFourCCCodec: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeVideoFourCCCodec-MD" ) ); + num = iColSet->ColNo( KMtpVideoVideoCodec ); + uInt32 = iRecordSet.ColUint32( num ); + if ( EMTPTypeUINT32 == aNewData.Type() ) + { + ( ( TMTPTypeUint32 & ) aNewData ).Set( uInt32 ); + } + else + { + User::Leave( KErrArgument ); + } + } + break; + + case EMTPObjectPropCodeVideoBitRate: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeVideoBitRate-MD" ) ); + num = iColSet->ColNo( KMtpVideoVideoBitrate ); + uInt32 = iRecordSet.ColUint32( num ); + if ( EMTPTypeUINT32 == aNewData.Type() ) + { + ( ( TMTPTypeUint32 & ) aNewData ).Set( uInt32 ); + } + else + { + User::Leave( KErrArgument ); + } + } + break; + + case EMTPObjectPropCodeFramesPerThousandSeconds: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeFramesPerThousandSeconds-MD" ) ); + num = iColSet->ColNo( KMtpVideoFramesPer1000Sec ); + uInt32 = iRecordSet.ColUint32( num ); + if ( EMTPTypeUINT32 == aNewData.Type() ) + { + ( ( TMTPTypeUint32 & ) aNewData ).Set( uInt32 ); + } + else + { + User::Leave( KErrArgument ); + } + } + break; + + case EMTPObjectPropCodeKeyFrameDistance: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeKeyFrameDistance-MD" ) ); + num = iColSet->ColNo( KMtpVideoKeyFrameDistance ); + uInt32 = iRecordSet.ColUint32( num ); + if ( EMTPTypeUINT32 == aNewData.Type() ) + { + ( ( TMTPTypeUint32 & ) aNewData ).Set( uInt32 ); + } + else + { + User::Leave( KErrArgument ); + } + } + break; + + case EMTPObjectPropCodeScanType: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeScanType-MD" ) ); + num = iColSet->ColNo( KMtpVideoScanType ); + uInt16 = iRecordSet.ColUint16( num ); + if ( EMTPTypeUINT16 == aNewData.Type() ) + { + ( ( TMTPTypeUint16 & ) aNewData ).Set( uInt16 ); + } + else + { + User::Leave( KErrArgument ); + } + } + break; + + case EMTPObjectPropCodeEncodingProfile: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeEncodingProfile-MD" ) ); + data = ReadLongTextL( KMtpVideoEncodingProfile ); + } + break; + + case EMTPObjectPropCodeParentalRating: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeParentalRating-MD" ) ); + data = ReadLongTextL( KMtpVideoParentalRating ); + } + break; + + case EMTPObjectPropCodeUseCount: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeUseCount-MD" ) ); + num = iColSet->ColNo( KMtpVideoUseCount ); + uInt32 = iRecordSet.ColUint32( num ); + if ( EMTPTypeUINT32 == aNewData.Type() ) + { + ( ( TMTPTypeUint32 & ) aNewData ).Set( uInt32 ); + } + else + { + User::Leave( KErrArgument ); + } + } + break; + + case EMTPObjectPropCodeDRMStatus: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeDRMStatus-MD" ) ); + num = iColSet->ColNo( KMtpVideoDRM ); + uInt16 = iRecordSet.ColUint16( num ); + if ( EMTPTypeUINT16 == aNewData.Type() ) + { + ( ( TMTPTypeUint16 & ) aNewData ).Set( uInt16 ); + } + else + { + User::Leave( KErrArgument ); + } + } + break; + + default: + { + User::Leave( KErrNotSupported ); + } + break; + } + + // Pack the info to aNewData + if (data) + { +#ifdef _DEBUG + if ( data->Length() > KMtpMaxStringDescLength ) // Have to concatenate for MTP + { + PRINT1( _L( "MM MTP <> Descriptor will be concatenated from length %d to KMtpMaxStringLength" ), data->Length() ); + } +#endif // _DEBUG + + if ( EMTPTypeString == aNewData.Type() ) + { + ( ( CMTPTypeString& ) aNewData ).SetL( *data ); + } + else + { + User::Leave( KErrArgument ); + } + delete data; + data = NULL; + } + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::GetObjectMetadataValue" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::SetObjectMetadataValueL +// Sets a piece of metadata in the collection +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataVideoAccess::SetObjectMetadataValueL( const TUint16 aPropCode, + const MMTPType& aNewData, + const CMTPObjectMetaData& aObjectMetaData ) + { + PRINT1( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::SetObjectMetadataValueL aPropCode = 0x%x" ), aPropCode ); + + if ( !IsDatabaseOpened() ) + OpenDatabaseL(); + + // Get file path + TPtrC suid( aObjectMetaData.DesC( CMTPObjectMetaData::ESuid ) ); + TParsePtrC parse( suid ); + SetRecordL( suid, ERecordWrite ); + TRAPD( err, SetMetadataL( aPropCode, aNewData ) ); + + if ( err < KErrNone ) // EPOC error condition + { + PRINT1( _L( "MM MTP <> Metadata write failed, with error %d" ), err ); + SetRecordL( suid, EFailedWrite ); + } + + if ( err != KErrNone ) + User::Leave( err ); + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::SetObjectMetadataValueL" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::SetMetadataL +// Set meta data. +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataVideoAccess::SetMetadataL( const TUint16 aObjPropCode, + const MMTPType& aNewData ) + { + PRINT1( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::SetMetadataL property Code = 0x%x" ), aObjPropCode ); + + TBuf data; + TDbColNo num; + TMTPTypeUint16 uint16Data; + TMTPTypeUint32 uint32Data; + CMTPTypeArray* desData = NULL; + + TPtrC colName( ColumnNameFromPropCodeL( aObjPropCode ) ); + switch ( aObjPropCode ) + { + case EMTPObjectPropCodeName: + case EMTPObjectPropCodeArtist: + case EMTPObjectPropCodeGenre: + case EMTPObjectPropCodeAlbumName: + case EMTPObjectPropCodeComposer: + case EMTPObjectPropCodeOriginalReleaseDate: + case EMTPObjectPropCodeEncodingProfile: + case EMTPObjectPropCodeParentalRating: + { + if( EMTPTypeString != aNewData.Type()) + { + User::Leave( KErrArgument ); + } + TPtrC string( ( ( CMTPTypeString& ) aNewData ).StringChars() ); + WriteLongTextL( colName, string ); + PRINT2( _L( "MM MTP <> CMmMtpDpMetadataVideoAccess::SetMetadataL string = %S, length = %d" ), &string, string.Length() ); + } + break; + + case EMTPObjectPropCodeDescription: + { + PRINT( _L( "MM MTP <> EMTPObjectPropCodeDescription-MD" ) ); +#ifdef __MUSIC_ID_SUPPORT + //WriteMusicIdsL(*longString); +#else + desData = CMTPTypeArray::NewLC( EMTPTypeAUINT16 ); // + desData + MMTPType::CopyL( aNewData, *desData ); + TUint length = desData->NumElements(); + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::SetMetadataValueL length = %d" ), length ); + if ( length != 0 ) + { + TBuf text; + text.Zero(); + for ( TUint i = 0; i < length; i++ ) + { + text.Append( desData->ElementUint( i ) ); + } + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::SetMetadataValueL text = %S" ), + &text ); + WriteLongTextL( KMtpVideoComment, text ); + } + else + { + WriteLongTextL( KMtpVideoComment, KEmptyText ); + } + CleanupStack::PopAndDestroy( desData ); // - desData +#endif //__MUSIC_ID_SUPPORT + } + break; + + case EMTPObjectPropCodeWidth: + case EMTPObjectPropCodeHeight: + case EMTPObjectPropCodeDuration: + case EMTPObjectPropCodeSampleRate: + case EMTPObjectPropCodeAudioWAVECodec: + case EMTPObjectPropCodeAudioBitRate: + case EMTPObjectPropCodeVideoFourCCCodec: + case EMTPObjectPropCodeVideoBitRate: + case EMTPObjectPropCodeFramesPerThousandSeconds: + case EMTPObjectPropCodeKeyFrameDistance: + case EMTPObjectPropCodeUseCount: + { + if ( EMTPTypeUINT32 != aNewData.Type() ) + { + User::Leave( KErrArgument ); + } + num = iColSet->ColNo( colName ); + iRecordSet.SetColL( num, ( ( TMTPTypeUint32& ) aNewData ).Value() ); + } + break; + + case EMTPObjectPropCodeTrack: + case EMTPObjectPropCodeNumberOfChannels: + case EMTPObjectPropCodeScanType: + case EMTPObjectPropCodeDRMStatus: + { + if ( EMTPTypeUINT16 != aNewData.Type() ) + { + User::Leave( KErrArgument ); + } + num = iColSet->ColNo( colName ); + iRecordSet.SetColL( num, ( ( TMTPTypeUint16& ) aNewData ).Value() ); + } + break; + + default: + { + User::Leave( KErrNotSupported ); + } + break; + } + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::SetMetadataL" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::RenameRecordL +// Renames the file part of a record in the collection database. +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataVideoAccess::RenameRecordL(const TDesC& aOldFileName, const TDesC& aNewFileName) + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::RenameRecordL()" ) ); + + //open database if not opened + if ( !IsDatabaseOpened() ) + OpenDatabaseL(); + + SetRecordL( aOldFileName, ERecordWrite ); // Open the record to write + TDbColNo num = iColSet->ColNo( KMtpVideoLocation ); + iRecordSet.SetColL( num, aNewFileName ); + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::RenameRecordL()" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::DeleteRecordL +// Deletes metadata information associated with the object +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataVideoAccess::DeleteRecordL( const TDesC& aFullFileName ) + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::DeleteRecordL" ) ); + + //open database if not opened + if ( !IsDatabaseOpened() ) + OpenDatabaseL(); + + SetRecordL( KNullDesC, ENoRecord ); // Commit any other changes to the DB + + TUint format = MmMtpDpUtility::FormatFromFilename( aFullFileName ); + + if ( MmMtpDpUtility::HasMetadata( format ) ) + { + ExecuteQueryL( KMtpVideoLocation, + KMtpVideoTable, + KMtpVideoLocation, + aFullFileName ); + + for ( iRecordSet.FirstL(); iRecordSet.AtRow(); iRecordSet.NextL() ) + { + iRecordSet.DeleteL(); + PRINT( _L( "MM MTP <> CMmMtpDpMetadataVideoAccess::DeleteRecordL Record deleted" ) ); + } + + delete iColSet; + iColSet = NULL; + iRecordSet.Close(); + } + PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::DeleteRecordL" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::DeleteAllRecordsL +// Empties the database - used by the FormatStore command +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataVideoAccess::DeleteAllRecordsL() + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::DeleteAllRecordsL()" ) ); + + //open database if not opened + if (!IsDatabaseOpened()) + OpenDatabaseL(); + + SetRecordL( KNullDesC, ENoRecord ); // Commit any other changes to the DB + + PRINT( _L( "MM MTP <> Deleting music files" ) ); + ExecuteQueryL( KAllColumns, KMtpVideoTable ); + + for ( iRecordSet.FirstL(); iRecordSet.AtRow(); iRecordSet.NextL() ) + { + iRecordSet.DeleteL(); + } + + delete iColSet; + iColSet = NULL; + iRecordSet.Close(); + + iDatabase.Compact(); + PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::DeleteAllRecordsL()" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::SetRecordL +// Set Record +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataVideoAccess::SetRecordL( const TDesC& aFullFileName, TMtpDbState aState ) + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::SetRecordL()" ) ); + + if ( ( aState == iDbState ) + && ( 0 == aFullFileName.Compare( iCurrentFileName ) ) ) // Already have it + { + if (iDbState == ERecordRead) + iRecordSet.GetL(); + + PRINT1( _L( "MM MTP <> Cached recordset, filename is '%S'" ), &iCurrentFileName ); + return; + } + + iCurrentFileName.Copy( aFullFileName ); + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataVideoAccess::iCurrentFileName set to '%S'" ), &iCurrentFileName ); + + // We arrive here, if a new view is required. First, need to deal with the old one. + switch ( iDbState ) + { + case EFailedWrite: + // We wrote to the DB, but the op failed + PRINT( _L( "MM MTP <> SetRecordL EFailedWrite" ) ); + iRecordSet.Cancel(); + + case ERecordWrite: // intentionally fallthrough + // We wrote some stuff to the db, now needs comitting + PRINT( _L( "MM MTP <> SetRecordL ERecordWrite" ) ); + TRAPD( err, iRecordSet.PutL() ); + + if (KErrNone != err) + { + iRecordSet.Cancel(); + User::Leave( err ); + } + //lint -fallthrough + case ENoRecord: // intentionally fallthrough + // We need to just close the open record + PRINT( _L( "MM MTP <> SetRecordL ENoRecord" ) ); + //lint -fallthrough + case ERecordRead: // intentionally fallthrough + // We need to open a row for reading + PRINT( _L( "MM MTP <> SetRecordL ERecordRead" ) ); + //lint -fallthrough + default: // intentionally fallthrough + PRINT( _L( "MM MTP <> SetRecordL Closing recordset" ) ); + delete iColSet; + iColSet = NULL; + iRecordSet.Close(); + iDbState = ENoRecord; + break; + } + + if ( aState == ENoRecord ) // We are closing the session if this is the case + { + PRINT( _L( "MM MTP <> SetRecordL Record closed, no request to open" ) ); + return; + } + + // if we have a music format, we can open the database... + TUint16 format = MmMtpDpUtility::FormatFromFilename( iCurrentFileName ); + PRINT1( _L( "MM MTP <> SetRecordL format = 0x%x" ), format ); + + + if ( MmMtpDpUtility::HasMetadata( format ) ) + { + // Get the record + ExecuteQueryL( KAllColumns, KMtpVideoTable, KMtpVideoLocation, aFullFileName ); + + if ( iRecordSet.CountL() == 0 ) // No match... + { + iRecordSet.Close(); + PRINT( _L( "MM MTP <> Recordset is empty! Bailing out..." ) ); + delete iColSet; + iColSet = NULL; + iRecordSet.Close(); + iDbState = ENoRecord; + User::Leave( KErrNotFound ); // Have an object on the disk, but no metadata + } + + // Check that we only have one record, not many... + if ( iRecordSet.CountL() > 1 ) + { + //LOGTEXT2("METADATA DATABASE ERROR: %d entries for the same file name!!", iRecordSet.CountL()); + User::Leave( KErrCorrupt ); + } + + if ( aState == ERecordWrite ) + { + iRecordSet.UpdateL(); // Lock the row + PRINT( _L( "MM MTP <> Row locked" ) ); + } + else if ( aState == ERecordRead ) + { + iRecordSet.GetL(); + } + + // Update the internal state + iDbState = aState; + } + else + User::Leave( KErrNotFound ); + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::SetRecordL()" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::SetImageObjPropL +// set image specific properties specific to videos +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataVideoAccess::SetImageObjPropL( const TDesC& aFullFileName, + const TUint32 aWidth, + const TUint32 aHeight ) + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::SetImageObjPropL()" ) ); + + if ( !IsDatabaseOpened() ) + OpenDatabaseL(); + + TDbColNo num = 0; + TInt err = KErrNone; + + SetRecordL( aFullFileName, ERecordWrite ); + num = iColSet->ColNo( KMtpVideoWidth ); + TRAP( err, iRecordSet.SetColL( num, aWidth ) ); + + if ( err != KErrNone ) + { + SetRecordL( aFullFileName, EFailedWrite ); + User::Leave( err ); + } + + num = iColSet->ColNo( KMtpVideoHeight ); + TRAP( err, iRecordSet.SetColL( num, aHeight ) ); + + if ( err != KErrNone ) + { + SetRecordL( aFullFileName, EFailedWrite ); + User::Leave( err ); + } + PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::SetImageObjPropL()" ) ); + } + +// --------------------------------------------------------------------------- +// CMmMtpDpMetadataMpxAccess::GetImageObjPropL +// Get image specific properties specific to videos +// --------------------------------------------------------------------------- +// +void CMmMtpDpMetadataVideoAccess::GetImageObjPropL( const TDesC& aFullFileName, + TUint32& aWidth, + TUint32& aHeight ) + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::GetImageObjPropL()" ) ); + + if ( !IsDatabaseOpened() ) + OpenDatabaseL(); + + TDbColNo num = 0; + + SetRecordL( aFullFileName, ERecordRead ); + + num = iColSet->ColNo( KMtpVideoWidth ); + aWidth = iRecordSet.ColUint32( num ); + + num = iColSet->ColNo( KMtpVideoHeight ); + aHeight = iRecordSet.ColUint32( num ); + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::GetImageObjPropL()" ) ); + } + +const TDesC& CMmMtpDpMetadataVideoAccess::ColumnNameFromPropCodeL( const TUint16 aPropCode ) + { + const TColumnNameTable KColumnTable[] = + { + { EMTPObjectPropCodeName, KMtpVideoName }, + { EMTPObjectPropCodeArtist, KMtpVideoArtist }, + { EMTPObjectPropCodeTrack, KMtpVideoTrack }, + { EMTPObjectPropCodeGenre, KMtpVideoGenre }, + { EMTPObjectPropCodeAlbumName, KMtpVideoAlbumName }, + { EMTPObjectPropCodeComposer, KMtpVideoComposer }, + { EMTPObjectPropCodeOriginalReleaseDate, KMtpVideoOrigReleaseDate }, + { EMTPObjectPropCodeDescription, KMtpVideoComment }, + { EMTPObjectPropCodeWidth, KMtpVideoWidth }, + { EMTPObjectPropCodeHeight, KMtpVideoHeight }, + { EMTPObjectPropCodeDuration, KMtpVideoDuration }, + { EMTPObjectPropCodeSampleRate, KMtpVideoSampleRate }, + { EMTPObjectPropCodeNumberOfChannels, KMtpVideoNumberOfChannels }, + { EMTPObjectPropCodeAudioBitRate, KMtpVideoAudioBitrate }, + { EMTPObjectPropCodeVideoFourCCCodec, KMtpVideoVideoCodec }, + { EMTPObjectPropCodeVideoBitRate, KMtpVideoVideoBitrate }, + { EMTPObjectPropCodeFramesPerThousandSeconds,KMtpVideoFramesPer1000Sec }, + { EMTPObjectPropCodeKeyFrameDistance, KMtpVideoKeyFrameDistance }, + { EMTPObjectPropCodeScanType, KMtpVideoScanType }, + { EMTPObjectPropCodeEncodingProfile, KMtpVideoEncodingProfile }, + { EMTPObjectPropCodeParentalRating, KMtpVideoParentalRating }, + { EMTPObjectPropCodeUseCount, KMtpVideoUseCount }, + { EMTPObjectPropCodeAudioWAVECodec, KMtpVideoAudioCodec }, + { EMTPObjectPropCodeDRMStatus, KMtpVideoDRM }, + }; + + TInt i = 0; + TInt count = sizeof ( KColumnTable ) / sizeof ( KColumnTable[0] ); + while ( ( KColumnTable[i].iPropCode != aPropCode ) && ( i < count ) ) + { + i++; + } + + if ( i == count ) + { + // Not supported by MPX, shouldn't call this function + PRINT( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::MpxAttribFromPropL NOT SUPPORTED ATTRIBUTE" ) ); + User::Leave( KErrNotSupported ); + } + return KColumnTable[i].iDbColumnName; + } + +void CMmMtpDpMetadataVideoAccess::SetStorageRootL( const TDesC& aStorageRoot ) + { + PRINT1( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::SetStorageRoot aStoreRoot = %S" ), &aStorageRoot ); + + // get the drive number + TParse pathParser; + User::LeaveIfError( pathParser.Set( aStorageRoot, NULL, NULL ) ); + TChar driveChar( pathParser.Drive()[0] ); + + User::LeaveIfError( RFs::CharToDrive( driveChar, iStoreNum ) ); + PRINT1( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::SetStorageRoot drive number = %d" ), iStoreNum ); + } + +void CMmMtpDpMetadataVideoAccess::CleanupDatabaseL() + { + PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::CleanupDatabaseL" ) ); + + //open database if not opened + if ( !IsDatabaseOpened() ) + { + return; + } + + // Make sure the db is commited + SetRecordL( KNullDesC, ENoRecord ); + + IdentifyDeletedFilesL(); + + CleanupDbIfNecessaryL(); + + PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::CleanupDatabaseL" ) ) + } + +TBool CMmMtpDpMetadataVideoAccess::FileExists( const TDesC& aFullFileName ) + { + return BaflUtils::FileExists( iRfs, aFullFileName ); + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/src/mmmtpdputility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/src/mmmtpdputility.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,798 @@ +/* +* 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: Implementation for MTP Common Function +* +*/ + + +#include +#include +#include +#include +#include +#include <3gplibrary/mp4lib.h> +#include +#include +#include +#include +#include + +// for asf mimetype parsing +#ifdef __WINDOWS_MEDIA +#include +#include +#endif + +#include "mmmtpdputility.h" +#include "mmmtpdpfiledefs.h" +#include "mmmtpdplogger.h" + +using namespace ContentAccess; + +// local to this file, non standard mimetype used for ASF parsing with helix +_LIT( KHxMimeTypeWma, "audio/x-hx-wma" ); +_LIT( KHxMimeTypeWmv, "video/x-hx-wmv" ); + +// ----------------------------------------------------------------------------- +// MmMtpDpUtility::FormatFromFilename +// Utility function to get the type of an object from the filename +// The recommended way from the MS implementation +// These should be kept in sync with the object formats supported +// ----------------------------------------------------------------------------- +// +EXPORT_C TMTPFormatCode MmMtpDpUtility::FormatFromFilename( const TDesC& aFullFileName ) + { + if ( aFullFileName.Right( 1 ).CompareF( KTxtBackSlash ) == 0 ) // We have a directory name + { + return EMTPFormatCodeAssociation; + } + + TParsePtrC file( aFullFileName ); + + // need to do it in popularity of format, to optmize performance + if ( file.Ext().CompareF( KTxtExtensionMP3 ) == 0 ) + return EMTPFormatCodeMP3; + +#ifdef __WINDOWS_MEDIA + if ( file.Ext().CompareF( KTxtExtensionWMA ) == 0 ) + return EMTPFormatCodeWMA; +#endif // __WINDOWS_MEDIA + + if ( ( file.Ext().CompareF( KTxtExtensionMP4 ) == 0 ) || ( file.Ext().CompareF( KTxtExtensionM4A ) == 0 ) ) + return EMTPFormatCodeMP4Container; + + if ( ( file.Ext().CompareF( KTxtExtension3GP ) == 0 ) || ( file.Ext().CompareF( KTxtExtensionO4A ) == 0 ) || ( file.Ext().CompareF( KTxtExtensionO4V ) == 0 ) ) + return EMTPFormatCode3GPContainer; + + if ( file.Ext().CompareF( KTxtExtensionAAC ) == 0 ) + return EMTPFormatCodeAAC; + + if ( file.Ext().CompareF( KTxtExtensionWAV ) == 0 ) + return EMTPFormatCodeWAV; + +#ifdef __WINDOWS_MEDIA + if ( file.Ext().CompareF( KTxtExtensionWMV ) == 0 ) + return EMTPFormatCodeWMV; + + if ( file.Ext().CompareF( KTxtExtensionASF ) == 0 ) + return EMTPFormatCodeASF; + +#endif // __WINDOWS_MEDIA + + if ( file.Ext().CompareF( KTxtExtensionODF ) == 0 ) + { + HBufC8* mime = MmMtpDpUtility::ContainerMimeType( file.FullName() ); + if ( mime != NULL ) + { + // 3GP + if ( mime->CompareF( KMimeTypeAudio3gpp ) == 0 + || mime->CompareF( KMimeTypeVideo3gpp ) == 0 ) + { + delete mime; + mime = NULL; + return EMTPFormatCode3GPContainer; + } + } + + if ( mime != NULL ) + { + delete mime; + mime = NULL; + } + } + + if (( file.Ext().CompareF( KTxtExtensionPLA ) == 0 ) || ( file.Ext().CompareF( KTxtExtensionVIR ) == 0 ) ) + return EMTPFormatCodeAbstractAudioVideoPlaylist; + + if ( file.Ext().CompareF( KTxtExtensionM3U ) == 0 ) + return EMTPFormatCodeM3UPlaylist; + + return EMTPFormatCodeUndefined; + } + +// ----------------------------------------------------------------------------- +// MmMtpDpUtility::HasMetadata +// Utility function to determine whether a format has metadata support +// ----------------------------------------------------------------------------- +// +TBool MmMtpDpUtility::HasMetadata( TUint16 aObjFormatCode ) + { + if ( aObjFormatCode == EMTPFormatCodeMP3 + || aObjFormatCode == EMTPFormatCodeWMA + || aObjFormatCode == EMTPFormatCodeAAC + || aObjFormatCode == EMTPFormatCodeWAV + || aObjFormatCode == EMTPFormatCodeMP4Container + || aObjFormatCode == EMTPFormatCode3GPContainer + || aObjFormatCode == EMTPFormatCodeWMV + || aObjFormatCode == EMTPFormatCodeASF ) + { + return ETrue; + } + + return EFalse; + } + +// ----------------------------------------------------------------------------- +// MmMtpDpUtility::IsVideoL (Slow Version) +// Utility function to determine whether a format is Video or not +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool MmMtpDpUtility::IsVideoL( const TDesC& aFullFileName ) + { + PRINT1( _L( "MM MTP => MmMtpDpUtility::IsVideoL (Slow Version) aFullFileName = %S" ), &aFullFileName ); + + TParse pathParser; + User::LeaveIfError( pathParser.Set( aFullFileName, NULL, NULL ) ); + + TPtrC ext( pathParser.Ext() ); + + if ( ext.Length() <= 0 ) + { + PRINT( _L( "MM MTP <> MmMtpDpUtility::IsVideoL ext len <= 0, return false" ) ); + return EFalse; + } + + // move WMV early to optmize comparison + if ( ext.CompareF( KTxtExtensionWMV ) == 0 ) + { + return ETrue; + } + else if ( ext.CompareF( KTxtExtensionMP4 ) == 0 + || ext.CompareF( KTxtExtension3GP ) == 0 + || ext.CompareF( KTxtExtensionODF ) == 0 + || ext.CompareF( KTxtExtensionASF ) == 0 ) + { + HBufC8* mimetype = ContainerMimeType( aFullFileName ); + User::LeaveIfNull( mimetype ); + + CleanupStack::PushL( mimetype ); // + mimetype + + TMmMtpSubFormatCode subFormatCode; + + User::LeaveIfError( SubFormatCodeFromMime( *mimetype, subFormatCode ) ); + CleanupStack::PopAndDestroy( mimetype ); // - mimetype + + if ( subFormatCode == EMTPSubFormatCodeVideo ) + { + return ETrue; + } + else + { + return EFalse; + } + } + else if ( ext.CompareF( KTxtExtensionO4V ) == 0 ) + return ETrue; + + // other format, as audio + return EFalse; + } + +// ----------------------------------------------------------------------------- +// MmMtpDpUtility::IsVideoL (Fast Version) +// Utility function to determine whether a format is Video or not +// ----------------------------------------------------------------------------- +// +TBool MmMtpDpUtility::IsVideoL( const TDesC& aFullFileName, + const MMTPDataProviderFramework& aFramework ) + { + PRINT1( _L( "MM MTP => MmMtpDpUtility::IsVideoL (Fast Version) aFullFileName = %S" ), &aFullFileName ); + + CMTPObjectMetaData* info = CMTPObjectMetaData::NewLC(); // + info + aFramework.ObjectMgr().ObjectL( aFullFileName, *info ); + + TUint formatCode = info->Uint( CMTPObjectMetaData::EFormatCode ); + TUint subFormatCode = info->Uint( CMTPObjectMetaData::EFormatSubCode ); + + CleanupStack::PopAndDestroy( info ); // - info + + if ( formatCode == EMTPFormatCodeWMV ) + { + return ETrue; + } + else if ( ( formatCode == EMTPFormatCodeMP4Container ) + || ( formatCode == EMTPFormatCode3GPContainer ) + || ( formatCode == EMTPFormatCodeASF ) ) + { + if ( subFormatCode == EMTPSubFormatCodeAudio ) + { + return EFalse; + } + else if ( subFormatCode == EMTPSubFormatCodeVideo ) + { + return ETrue; + } + } + + PRINT( _L( "MM MTP <= MmMtpDpUtility::IsVideoL (Fast Version)" ) ); + + // other format, as audio + return EFalse; + } + +// ----------------------------------------------------------------------------- +// MmMtpDpUtility::ValidateFilename +// Check the filename to see if it exceeds Symbian 256 limit. +// ----------------------------------------------------------------------------- +// +TBool MmMtpDpUtility::ValidateFilename( const TDesC& aPathName, + const TDesC& aFileName ) + { + TBool result = ETrue; + + if ( ( aPathName.Length() + aFileName.Length() ) > KMaxFileName ) + { + result = EFalse; + } + + return result; + } + +// ----------------------------------------------------------------------------- +// MmMtpDpUtility::GetObjectSizeL +// Get the filesize. +// ----------------------------------------------------------------------------- +// +TUint64 MmMtpDpUtility::GetObjectSizeL( RFs& aFs, const TDesC& aFileName ) + { + TEntry fileInfo; + // Shouldn't leave + User::LeaveIfError( aFs.Entry( aFileName, fileInfo ) ); + return fileInfo.iSize; + } + +// ----------------------------------------------------------------------------- +// MmMtpDpUtility::GetDateModifiedL +// Get the file date modified. +// ----------------------------------------------------------------------------- +// +TTime MmMtpDpUtility::GetObjectDateModifiedL( RFs& aFs, const TDesC& aFullFileName ) + { + TTime dataModified; + TEntry fileInfo; + // Shouldn't leave + User::LeaveIfError( aFs.Entry( aFullFileName, fileInfo ) ); + + dataModified = fileInfo.iModified; + + return dataModified; + } + +// ----------------------------------------------------------------------------- +// MmMtpDpUtility::GetProtectionStatusL +// Get the file protection status. +// ----------------------------------------------------------------------------- +// +TUint16 MmMtpDpUtility::GetProtectionStatusL( RFs& aFs, const TDesC& aFullFileName ) + { + TUint16 protectionStatus = EMTPProtectionNoProtection; + + TEntry fileInfo; + // Shouldn't leave + User::LeaveIfError( aFs.Entry( aFullFileName, fileInfo ) ); + if ( fileInfo.IsReadOnly() ) + { + protectionStatus = EMTPProtectionReadOnly; + } + + return protectionStatus; + } + +// ----------------------------------------------------------------------------- +// MmMtpDpUtility::CheckPropType +// Check if property type match datatype. +// ----------------------------------------------------------------------------- +// +TMTPResponseCode MmMtpDpUtility::CheckPropType(TUint16 aPropertyCode, TUint16 aDataType) + { + PRINT2( _L( "MM MTP => MmMtpDpUtility::CheckPropCode aPropertyCode = 0x%x, aDataType = 0x%x" ), + aPropertyCode, + aDataType ); + + TMTPResponseCode responseCode = EMTPRespCodeOK; + switch ( aPropertyCode ) + { + //Access denied Properties + case EMTPObjectPropCodeStorageID: + case EMTPObjectPropCodeObjectFormat: + case EMTPObjectPropCodeProtectionStatus: + case EMTPObjectPropCodeObjectSize: + case EMTPObjectPropCodeParentObject: + case EMTPObjectPropCodePersistentUniqueObjectIdentifier: + case EMTPObjectPropCodeDateCreated: + case EMTPObjectPropCodeDateModified: + case EMTPObjectPropCodeDateAdded: + case EMTPObjectPropCodeNonConsumable: + case EMTPObjectPropCodeVideoBitRate: + { + responseCode = EMTPRespCodeAccessDenied; + } + break; + + //String properties + case EMTPObjectPropCodeObjectFileName: // 0xDC07 + case EMTPObjectPropCodeName: // 0xDC44 + case EMTPObjectPropCodeArtist: // 0xDC46 + case EMTPObjectPropCodeGenre: // 0xDC8C + case EMTPObjectPropCodeParentalRating: // 0xDC94 + case EMTPObjectPropCodeComposer: // 0xDC96 + case EMTPObjectPropCodeOriginalReleaseDate: // 0xDC99 + case EMTPObjectPropCodeAlbumName: // 0xDC9A + case EMTPObjectPropCodeEncodingProfile: // 0xDEA1 + { + if ( aDataType != EMTPTypeString ) + { + responseCode = EMTPRespCodeInvalidObjectPropFormat; + } + } + break; + + case EMTPObjectPropCodeDescription: + { + if ( aDataType != EMTPTypeAUINT16 ) + { + responseCode = EMTPRespCodeInvalidObjectPropFormat; + } + } + break; + + //Uint32 properties + case EMTPObjectPropCodeWidth: // 0xDC87 + case EMTPObjectPropCodeHeight: // 0xDC88 + case EMTPObjectPropCodeDuration: // 0xDC89 + case EMTPObjectPropCodeUseCount: // 0xDC91 + case EMTPObjectPropCodeSampleRate: // 0xDE93 + case EMTPObjectPropCodeAudioWAVECodec: // 0xDE99 + case EMTPObjectPropCodeAudioBitRate: // 0xDE9A + case EMTPObjectPropCodeVideoFourCCCodec: // 0xDE9B + case EMTPObjectPropCodeFramesPerThousandSeconds: // 0xDE9D + case EMTPObjectPropCodeKeyFrameDistance: // 0xDE9E + { + if ( aDataType != EMTPTypeUINT32 ) + { + responseCode = EMTPRespCodeInvalidObjectPropFormat; + } + } + break; + + //Uint16 properties + case EMTPObjectPropCodeTrack: // 0xDC8B + case EMTPObjectPropCodeDRMStatus: // 0xDC9D + case EMTPObjectPropCodeNumberOfChannels: // 0xDE94 + case EMTPObjectPropCodeScanType: // 0xDE97 + { + if ( aDataType != EMTPTypeUINT16 ) + { + responseCode = EMTPRespCodeInvalidObjectPropFormat; + } + } + break; + + default: + { + responseCode = EMTPRespCodeInvalidObjectPropCode; + } + break; + } + PRINT1( _L( "MM MTP <= MmMtpDpUtility::CheckPropCode responseCode = 0x%x" ), + responseCode ); + return responseCode; + } + +// ----------------------------------------------------------------------------- +// MmMtpDpUtility::UpdateObjectFileName +// Update object file name. +// ----------------------------------------------------------------------------- +// +TInt MmMtpDpUtility::UpdateObjectFileName( RFs& aFs, + const TDesC& aFullFileName, + TDes& aNewName ) + { + TInt bufSize = aNewName.MaxLength() < KMaxFileName ? aNewName.MaxLength() : KMaxFileName; + + TParsePtrC parser( aFullFileName ); + TPtrC ptr( parser.DriveAndPath() ); + + if ( aNewName.Length() + ptr.Length() > bufSize ) + { + return KErrOverflow; + } + else + { + aNewName.Insert( 0, ptr ); + } + + return aFs.Rename( aFullFileName, aNewName ); + } + +// ----------------------------------------------------------------------------- +// MetadataAccessWrapper::ContainerMimeType +// Get mime type from file +// ----------------------------------------------------------------------------- +// +HBufC8* MmMtpDpUtility::ContainerMimeType( const TDesC& aFullPath ) + { + PRINT( _L( "MM MTP => MmMtpDpUtility::ContainerMimeType" ) ); + + // parse the file path + TParse pathParser; + TInt retCode = pathParser.Set( aFullPath, NULL, NULL ); + if ( retCode != KErrNone ) + { + PRINT( _L( "MM MTP <> MmMtpDpUtility::ContainerMimeType parse path failed" ) ); + return NULL; + } + + // get the extension of file + TPtrC ext( pathParser.Ext() ); + if ( ext.Length() <= 0 ) + { + PRINT( _L( "MM MTP <> MmMtpDpUtility::ContainerMimeType file ext len == 0" ) ); + return NULL; + } + + HBufC8* mimebuf = NULL; + TInt err = KErrNone; + + // MP4/3GP + if ( ext.CompareF( KTxtExtensionMP4 ) == 0 + || ext.CompareF( KTxtExtension3GP ) == 0 ) + { + TRAP( err, mimebuf = Mp4MimeTypeL( aFullPath ) ); + PRINT1( _L("MM MTP <> MmMtpDpUtility::ContainerMimeType, Mp4MimeTypeL err = %d"), err ); + } + else if ( ext.CompareF( KTxtExtensionODF ) == 0 ) + { + TRAP( err, mimebuf = Mp4MimeTypeL( aFullPath ) ); + PRINT1( _L("MM MTP <> MmMtpDpUtility::ContainerMimeType, OdfMimeTypeL err = %d"), err ); + } +#ifdef __WINDOWS_MEDIA + else if ( ext.CompareF( KTxtExtensionASF ) == 0 ) + { + TRAP( err, mimebuf = AsfMimeTypeL( aFullPath ) ); + PRINT1( _L("MM MTP <> MmMtpDpUtility::ContainerMimeType, AsfMimeTypeL err = %d"), err ); + } +#endif + + PRINT( _L( "MM MTP <= MmMtpDpUtility::ContainerMimeType" ) ); + return mimebuf; + } + +// ----------------------------------------------------------------------------- +// MetadataAccessWrapper::Mp4MimeTypeL +// Get mime type from mp4 file +// ----------------------------------------------------------------------------- +// +HBufC8* MmMtpDpUtility::Mp4MimeTypeL( const TDesC& aFullPath ) + { + PRINT( _L( "MM MTP => MmMtpDpUtility::Mp4MimeTypeL" ) ); + HBufC8* mimebuf = NULL; + TParsePtrC file( aFullPath ); + + if ( file.Ext().CompareF( KTxtExtensionMP4 ) == 0 + || file.Ext().CompareF( KTxtExtension3GP ) == 0 ) + { + // get mime from file + MP4Handle mp4Handle = NULL; + + RBuf buf; + TInt err = buf.Create( aFullPath.Length() + 1 ); + User::LeaveIfError( err ); + buf = aFullPath; + + // open mp4 file + MP4Err mp4err = MP4ParseOpen( &mp4Handle, (MP4FileName) buf.PtrZ() ); + + if ( mp4err == MP4_OK ) + { + + mp4_u32 videoLength, videoType, videoWidth, videoHeight, timeScale; + mp4_double frameRate; + + // get video description + mp4err = MP4ParseRequestVideoDescription( mp4Handle, &videoLength, + &frameRate, &videoType, &videoWidth, &videoHeight, &timeScale ); + + // not the video file + if ( mp4err == MP4_NO_VIDEO ) + { + mp4_u32 audioLength, audioType, timeScale, averateBitRate; + mp4_u8 framesPerSample; + + // get audio description + mp4err = MP4ParseRequestAudioDescription( mp4Handle, + &audioLength, &audioType, &framesPerSample, &timeScale, + &averateBitRate ); + + if ( mp4err == MP4_OK ) + { + if ( file.Ext().CompareF( KTxtExtension3GP ) == 0 ) + { + mimebuf = KMimeTypeAudio3gpp().Alloc(); + } + else + { + mimebuf = KMimeTypeAudioMp4().Alloc(); + } + } + } + // is video file + else if ( mp4err == MP4_OK ) + { + if ( file.Ext().CompareF( KTxtExtension3GP ) == 0 ) + { + mimebuf = KMimeTypeVideo3gpp().Alloc(); + } + else + { + mimebuf = KMimeTypeVideoMp4().Alloc(); + } + } + + // Close mp4 parser + if ( mp4Handle != NULL ) + { + MP4ParseClose( mp4Handle ); + } + } + + buf.Close(); + } + else + { + User::Leave( KErrNotSupported ); + } + + if ( mimebuf == NULL ) + { + User::Leave( KErrNotFound ); + } + PRINT( _L( "MM MTP <= MmMtpDpUtility::Mp4MimeTypeL" ) ); + return mimebuf; + } + +// ----------------------------------------------------------------------------- +// MetadataAccessWrapper::OdfMimeTypeL +// Get mime type from odf file +// ----------------------------------------------------------------------------- +// +HBufC8* MmMtpDpUtility::OdfMimeTypeL( const TDesC& aFullPath ) + { + PRINT( _L( "MM MTP => MmMtpDpUtility::OdfMimeTypeL" ) ); + HBufC8* mimebuf = NULL; + + TParsePtrC file( aFullPath ); + + if ( file.Ext().CompareF( KTxtExtensionODF ) == 0 ) + { + CContent* content = CContent::NewL( aFullPath ); + CleanupStack::PushL( content ); // + content + + HBufC* buffer = HBufC::NewL( KMimeTypeMaxLength ); + CleanupStack::PushL( buffer ); // + buffer + + TPtr data = buffer->Des(); + TInt err = content->GetStringAttribute( EMimeType, data ); + + if ( err == KErrNone ) + { + mimebuf = HBufC8::New( buffer->Length() ); + + if (mimebuf == NULL) + { + User::LeaveIfError( KErrNotFound ); + } + + mimebuf->Des().Copy( *buffer ); + } + + // leave if NULL + if ( mimebuf == NULL ) + { + User::Leave( KErrNotFound ); + } + + CleanupStack::PopAndDestroy( buffer ); // - buffer + CleanupStack::PopAndDestroy( content ); // - content + } + else + { + User::Leave( KErrNotSupported ); + } + + PRINT( _L( "MM MTP <= MmMtpDpUtility::OdfMimeTypeL" ) ); + return mimebuf; + } + +// ----------------------------------------------------------------------------- +// MetadataAccessWrapper::AsfMimeTypeL +// Get mime type from asf file +// ----------------------------------------------------------------------------- +// +HBufC8* MmMtpDpUtility::AsfMimeTypeL( const TDesC& aFullPath ) + { + PRINT( _L( "MM MTP => MmMtpDpUtility::AsfMimeTypeL" ) ); + + HBufC8* mimebuf = NULL; + +#ifdef __WINDOWS_MEDIA + TParsePtrC file( aFullPath ); + + if ( file.Ext().CompareF( KTxtExtensionASF ) == 0 ) + { + CHXMetaDataUtility *hxUtility = CHXMetaDataUtility::NewL(); + CleanupStack::PushL( hxUtility ); + + hxUtility->OpenFileL( aFullPath ); + + HXMetaDataKeys::EHXMetaDataId id; + TUint count = 0; + TBool isAudio = EFalse; + hxUtility->GetMetaDataCount( count ); + for ( TUint i = 0; i < count; i++ ) + { + HBufC* buf = NULL; + hxUtility->GetMetaDataAt( i, id, buf ); + + if ( id == HXMetaDataKeys::EHXMimeType ) + { + TPtr des = buf->Des(); + + if ( des.Find( KHxMimeTypeWma() ) != KErrNotFound ) + { + isAudio = ETrue; + } + else if ( des.Find( KHxMimeTypeWmv() ) != KErrNotFound ) + { + PRINT( _L( "MM MTP <> MmMtpDpUtility::AsfMimeTypeL, video" ) ); + mimebuf = KMimeTypeVideoWm().Alloc(); + break; + } + } + else if ( i == count - 1 ) + { + if ( isAudio ) + { + PRINT( _L( "MM MTP <> MmMtpDpUtility::AsfMimeTypeL, audio" ) ); + mimebuf = KMimeTypeAudioWm().Alloc(); + } + else + { + User::Leave( KErrNotFound ); + } + } + } + + hxUtility->ResetL(); + CleanupStack::PopAndDestroy( hxUtility ); + } + else + { + User::Leave( KErrNotSupported ); + } + +#else + User::Leave( KErrNotSupported ); +#endif + + PRINT( _L( "MM MTP <= MmMtpDpUtility::AsfMimeTypeL" ) ); + return mimebuf; + } + +// ----------------------------------------------------------------------------- +// MetadataAccessWrapper::SubFormatCodeFromMime +// Get subformat code from mime string +// ----------------------------------------------------------------------------- +// +TInt MmMtpDpUtility::SubFormatCodeFromMime( const TDesC8& aMimeType, + TMmMtpSubFormatCode& aSubFormatCode ) + { + PRINT( _L( "MM MTP => MmMtpDpUtility::SubFormatCodeFromMime" ) ); + + if ( aMimeType.CompareF( KMimeTypeVideoMp4 ) == 0 + || aMimeType.CompareF( KMimeTypeVideo3gpp ) == 0 +#ifdef __WINDOWS_MEDIA + || aMimeType.CompareF( KMimeTypeVideoWm ) == 0 +#endif + ) + { + aSubFormatCode = EMTPSubFormatCodeVideo; + } + else if ( aMimeType.CompareF( KMimeTypeAudioMp4 ) == 0 + || aMimeType.CompareF( KMimeTypeAudio3gpp ) == 0 +#ifdef __WINDOWS_MEDIA + || aMimeType.CompareF( KMimeTypeAudioWm ) == 0 +#endif + ) + { + aSubFormatCode = EMTPSubFormatCodeAudio; + } + else + { + PRINT( _L( "MM MTP <= MmMtpDpUtility::SubFormatCodeFromMime format not supported" ) ); + return KErrNotFound; + } + + PRINT( _L( "MM MTP <= MmMtpDpUtility::SubFormatCodeFromMime" ) ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// MetadataAccessWrapper::GetDrmStatus +// Get drm status code from file +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt MmMtpDpUtility::GetDrmStatus( const TDesC& aFullFileName ) + { + PRINT1( _L( "MM MTP => MmMtpDpUtility::GetDrmStatus, full file name: %S" ), &aFullFileName ); + TParsePtrC file( aFullFileName ); + TInt drmStatus = EMTPDrmStatusUnknown; + + if ( ( file.Ext().CompareF( KTxtExtensionODF ) == 0 ) || + ( file.Ext().CompareF( KTxtExtensionO4A ) == 0 ) || + ( file.Ext().CompareF( KTxtExtensionO4V ) == 0 ) ) + { + CContent* content = NULL; + + TRAPD( err, content = CContent::NewL( aFullFileName ) ); + + if ( err == KErrNone ) + { + TInt value = 0; + + content->GetAttribute( EIsProtected, value ); + + if ( value != 0 ) + { + drmStatus = EMTPDrmStatusProtected; + } + else + { + drmStatus = EMTPDrmStatusNotProtected; + } + } + + if ( content ) + { + delete content; + content = NULL; + } + } + + PRINT1( _L( "MM MTP <= MmMtpDpUtility::GetDrmStatus, drmStatus: %d" ), drmStatus ); + + return drmStatus; + } + +//end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/conf/mmmtpdataprovidertester.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/conf/mmmtpdataprovidertester.cfg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,174 @@ +[StifSettings] +TestThreadStackSize=16384 +TestThreadMinHeap=4096 +TestThreadMaxHeap=6291456 +[EndStifSettings] + +[Test] +title Delete mediamtpdp +create mmmtpdataprovidertester tester +tester LoadPlugin mediamtpdp +tester PrepareEnvironment +tester ObjectEnumeration +tester OpenSession +tester StartTransaction +tester DeleteObject +tester CompleteTransaction +tester CloseSession +tester CleanEnvironment +delete tester +[Endtest] + +[Test] +title Delete abstractmediamtpdp +create mmmtpdataprovidertester tester +tester LoadPlugin abstractmediamtpdp +tester PrepareEnvironment +tester ObjectEnumeration +tester OpenSession +tester StartTransaction +tester DeleteObject +tester CompleteTransaction +tester CloseSession +tester CleanEnvironment +delete tester +[Endtest] + +[Test] +title Get mediamtpdp +create mmmtpdataprovidertester tester +tester LoadPlugin mediamtpdp +tester PrepareEnvironment +tester ObjectEnumeration +tester OpenSession +tester StartTransaction +tester GetObjectInfo +tester CompleteTransaction +tester StartTransaction +tester GetObject +tester CompleteTransaction +tester CloseSession +tester CleanEnvironment +delete tester +[Endtest] + +[Test] +title Send mediamtpdp +create mmmtpdataprovidertester tester +tester LoadPlugin mediamtpdp +tester PrepareEnvironment +tester ObjectEnumeration +tester OpenSession +tester StartTransaction +tester SendObjectInfo +tester CompleteTransaction +tester StartTransaction +tester SendObject +tester CompleteTransaction +tester CloseSession +tester CleanEnvironment +delete tester +[Endtest] + +[Test] +title Copy mediamtpdp +create mmmtpdataprovidertester tester +tester LoadPlugin mediamtpdp +tester PrepareEnvironment +tester ObjectEnumeration +tester OpenSession +tester StartTransaction +tester CopyObject +tester CompleteTransaction +tester CloseSession +tester CleanEnvironment +delete tester +[Endtest] + +[Test] +title Move mediamtpdp +create mmmtpdataprovidertester tester +tester LoadPlugin mediamtpdp +tester PrepareEnvironment +tester ObjectEnumeration +tester OpenSession +tester StartTransaction +tester MoveObject +tester CompleteTransaction +tester CloseSession +tester CleanEnvironment +delete tester +[Endtest] + +[Test] +title Rename mediamtpdp +create mmmtpdataprovidertester tester +tester LoadPlugin mediamtpdp +tester PrepareEnvironment +tester ObjectEnumeration +tester OpenSession +tester RenameObject +tester CloseSession +tester CleanEnvironment +delete tester +[Endtest] + +[Test] +title PropValue mediamtpdp +create mmmtpdataprovidertester tester +tester LoadPlugin mediamtpdp +tester PrepareEnvironment +tester ObjectEnumeration +tester OpenSession +tester SetObjectPropValue +tester GetObjectPropValue +tester CloseSession +tester CleanEnvironment +delete tester +[Endtest] + +[Test] +title PropList mediamtpdp +create mmmtpdataprovidertester tester +tester LoadPlugin mediamtpdp +tester PrepareEnvironment +tester ObjectEnumeration +tester OpenSession +tester StartTransaction +tester SetObjectPropList +tester CompleteTransaction +tester StartTransaction +tester GetObjectPropList +tester CompleteTransaction +tester CloseSession +tester CleanEnvironment +delete tester +[Endtest] + +[Test] +title PropDesc mediamtpdp +create mmmtpdataprovidertester tester +tester LoadPlugin mediamtpdp +tester PrepareEnvironment +tester ObjectEnumeration +tester OpenSession +tester GetObjectPropDesc +tester CloseSession +tester CleanEnvironment +delete tester +[Endtest] + +[Test] +title PropsSupported mediamtpdp +create mmmtpdataprovidertester tester +tester LoadPlugin mediamtpdp +tester PrepareEnvironment +tester ObjectEnumeration +tester OpenSession +tester StartTransaction +tester GetObjectPropsSupported +tester CompleteTransaction +tester CloseSession +tester CleanEnvironment +delete tester +[Endtest] diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,26 @@ +/* +* 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: Build information file +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTEXPORTS + + +PRJ_TESTMMPFILES +mmmtpdataprovidertester.mmp diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/group/mmmtpdataprovidertester.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/group/mmmtpdataprovidertester.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,65 @@ +/* +* 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: Project definition file +* +*/ + + +#include +#include + +TARGET mmmtpdataprovidertester.dll +TARGETTYPE dll +UID 0x1000008D 0x102827AD + +CAPABILITY ALL -TCB + +VENDORID 0x70000001 + +SOURCEPATH ../src +SOURCE cmmmtpdataprovidertestmodule.cpp +SOURCE cmmmtpdataprovidertestmoduleblocks.cpp +SOURCE ctestconnectionchannel.cpp +SOURCE ctestobjectmanager.cpp +SOURCE cteststoragemgr.cpp +SOURCE ctestobserver.cpp +SOURCE cmmmtpdataprovidertester.cpp +SOURCE cmediamtpdataprovidertester.cpp +SOURCE cabstractmediamtpdataprovidertester.cpp + +USERINCLUDE ../inc + +// Data provider configuration resource file. +// The target filename corresponds to the implementation UID. +SOURCEPATH ../data +START RESOURCE mmmtpdataprovidertester.rss +TARGETPATH /resource +TARGET mmmtpdataprovidertester.rsc +END + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY ecom.lib +LIBRARY mdeclient.lib +LIBRARY mtpdatatypes.lib +LIBRARY mtpdataproviderapi.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY mpxharvesterutility.lib + +NOEXPORTLIBRARY +EPOCALLOWDLLDATA diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/group/mmmtpdataprovidertester.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/group/mmmtpdataprovidertester.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,43 @@ +; +; 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: Upgrade package for test dll (stub included in ROM) +; + +; Languages here +&EN + +; TYPE must be PU (Partial Upgrade)! +; Also update version! + +#{"MTPSTIF"}, (0x102827AD), 1, 1, 0, TYPE=PU + +; Localised vendor name, one for each language +%{"Nokia"} + +; Unique vendor name +:"Nokia" + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Updated files to install +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +"\epoc32\release\armv5\udeb\mmmtpdataprovidertester.dll" - "c:\sys\bin\mmmtpdataprovidertester.dll" +"..\init\TestFramework.ini"-"C:\TestFramework\TestFramework.ini" +"..\conf\mmmtpdataprovidertester.cfg" - "C:\testframework\mmmtpdataprovidertester.cfg" + +"..\data\mmc\TEST.MP3" - "e:\mtp_testdata\TEST.MP3" +"..\data\mmc\TEST1.MP3" - "e:\mtp_testdata\TESTDIR\TEST1.MP3" +"..\data\mmc\TEST2.MP3" - "e:\mtp_testdata\TESTDIR\TEST2.MP3" +"..\data\mmc\PLAYLIST.m3u" - "e:\mtp_testdata\PLAYLIST.m3u" +"..\data\mmc\SENDTEST.MP3" - "e:\mtp_testdata\SENDTEST.MP3" \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/inc/cmediamtpdataprovidertester.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/inc/cmediamtpdataprovidertester.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,98 @@ +/* +* 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: Tester class for mediamtpdp plugin +* +*/ + + +#ifndef CMEDIAMTPDATAPROVIDERTESTER_H +#define CMEDIAMTPDATAPROVIDERTESTER_H + +#include "cmmmtpdataprovidertester.h" + +/** +* CMediaMtpDataProviderTester class. +* +*/ +class CMediaMtpDataProviderTester : public CMmMtpDataProviderTester + { +public: + static CMediaMtpDataProviderTester* NewL(); + virtual ~CMediaMtpDataProviderTester(); +private: + TInt CheckSupportedL( TMTPSupportCategory aCategory, + RArray aResponseArray ); + + TInt PrepareEnvironmentL(); + TInt CleanEnvironmentL(); + + TBool ObjectEnumerationL_prepare( CMTPStorageMetaData* aPhysicalStorage, + CMTPStorageMetaData* aLogicalStorage ); + TInt ObjectEnumerationL_checkresults( MMTPObjectMgr& aObjectManager ); + + TInt GetObjectInfoL_checkresults( const CMTPTypeObjectInfo* aObjectInfo ); + + TInt GetObjectL_checkresults( CMTPTypeFile* aObjectInfo ); + + TInt GetObjectPropValueL_checkresults( const MMTPType* aObjectPropValue, + const TUint aPropCode ); + + TInt GetObjectPropListL_checkresults( const CMTPTypeObjectPropList* + aObjectPropList ); + + TInt GetObjectPropDescL_checkresults( const CMTPTypeObjectPropDesc* + aObjectPropDesc, const TUint aPropCode ); + + TBool SendObjectInfoL_prepare( TMTPTypeRequest& aRequest ); + void SendObjectInfoReceiveData( CMTPTypeObjectInfo* aData ); + + TBool SendObjectL_prepare( TMTPTypeRequest& aRequest ); + void SendObjectReceiveDataL( CMTPTypeFile* aData ); + TInt SendObjectL_checkresults(); + + void SetObjectPropValueReceiveDataL( const TMTPTypeRequest& aRequest, + MMTPType* aData ); + + void SetObjectPropListReceiveDataL( CMTPTypeObjectPropList* aData ); + + TInt DeleteObjectL_checkresults( MMTPObjectMgr& aObjectManager ); + + TBool CopyObjectL_prepare( TMTPTypeRequest& aRequest ); + TInt CopyObjectL_checkresults( const CMTPObjectMetaData* aMetaData ); + + TBool MoveObjectL_prepare( TMTPTypeRequest& aRequest ); + TInt MoveObjectL_checkresults( const CMTPObjectMetaData* aMetaData ); + + TBool RenameObjectL_prepare( TMTPNotificationParamsHandle& aParam ); + TInt RenameObjectL_checkresults( const CMTPObjectMetaData* aMetaData ); + + TInt GetPartialObjectL_checkresults ( CMTPTypeFile* aObjectInfo ); + + TBool GetObjectPropsSupportedL_prepare( TMTPTypeRequest& aRequest ); + TInt GetObjectPropsSupportedL_checkresults( const CMTPTypeArray* + aObjectProps ); + + TBool ProcessRequestIllegalIdL_prepare( TInt aOpCode ); + TInt ProcessRequestIllegalIdL_checkresults( TInt aOpCode, + TInt aResponseCode ); +private: + CMediaMtpDataProviderTester(); + void ConstructL(); +private: + CActiveSchedulerWait* iActiveSchedulerWait; + RFs iFsSession; + CFileMan* iFileMan; + }; + +#endif // CMEDIAMTPDATAPROVIDERTESTER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/inc/cmmmtpdataprovidertester.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/inc/cmmmtpdataprovidertester.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,160 @@ +/* +* 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 plugin tester +* +*/ + + +#ifndef CMMMTPDATAPROVIDERTESTER_H +#define CMMMTPDATAPROVIDERTESTER_H + +#include +#include +#include +#include +#include +#include +#include +#include "ctestobserver.h" +#include "ctestconnectionchannel.h" + +class CMTPStorageMetaData; +class MMTPObjectMgr; +class CMTPTypeObjectInfo; +class CMTPTypeObjectPropList; +class CMTPTypeObjectPropDesc; +class CMTPTypeFile; +class CMTPTypeString; + +/** +Defines the MTP data provider ECOM plug-in service provider +interface. +@publishedPartner +@released +*/ +class CMmMtpDataProviderTester : public CBase + { +public: + virtual ~CMmMtpDataProviderTester(); + + void RegisterObserver( CTestObserver* aTestObserver, + CTestConnectionChannel* aTestConnChannel, + CMTPDataProviderPlugin* aDataProviderPlugin ); +public: + TInt CheckSupportedL( TMTPSupportCategory aCategory, + RArray aResponseArray ); + + virtual TInt PrepareEnvironmentL(); + virtual TInt CleanEnvironmentL(); + + virtual TBool OpenSessionL_prepare( + TMTPNotificationParamsSessionChange& param ); + virtual TInt OpenSessionL_checkresults(); + + virtual TBool CloseSessionL_prepare( + TMTPNotificationParamsSessionChange& param ); + virtual TInt CloseSessionL_checkresults(); + + virtual TBool ObjectEnumerationL_prepare( CMTPStorageMetaData* + aPhysicalStorage, CMTPStorageMetaData* aLogicalStorage ); + virtual TInt ObjectEnumerationL_checkresults( MMTPObjectMgr& + aObjectManager ); + + virtual TBool StorageEnumerationL_prepare(); + virtual TInt StorageEnumerationL_checkresults( MMTPObjectMgr& + aObjectManager ); + + virtual TBool CancelL_prepare(); + virtual TInt CancelL_checkresults(); + + virtual TBool GetObjectInfoL_prepare( TMTPTypeRequest& aRequest ); + virtual TInt GetObjectInfoL_checkresults( const CMTPTypeObjectInfo* + aObjectInfo ); + + virtual TBool GetObjectL_prepare( TMTPTypeRequest& aRequest ); + virtual TInt GetObjectL_checkresults( CMTPTypeFile* aObjectInfo ); + + virtual TBool GetObjectPropValueL_prepare( TMTPTypeRequest& aRequest ); + virtual TInt GetObjectPropValueL_checkresults( + const MMTPType* aObjectPropValue, const TUint aPropCode ); + + virtual TBool GetObjectPropListL_prepare( TMTPTypeRequest& aRequest ); + virtual TInt GetObjectPropListL_checkresults( + const CMTPTypeObjectPropList* aObjectPropList ); + + virtual TBool GetObjectPropDescL_prepare( TMTPTypeRequest& aRequest ); + virtual TInt GetObjectPropDescL_checkresults( + const CMTPTypeObjectPropDesc* aObjectPropDesc, + const TUint aPropCode ); + + virtual TBool SendObjectInfoL_prepare( TMTPTypeRequest& aRequest ); + virtual void SendObjectInfoReceiveData( CMTPTypeObjectInfo* aData ); + virtual TInt SendObjectInfoL_checkresults(); + + virtual TBool SendObjectL_prepare( TMTPTypeRequest& aRequest ); + virtual void SendObjectReceiveDataL( CMTPTypeFile* aData ); + virtual TInt SendObjectL_checkresults(); + + virtual TBool SetObjectPropValueL_prepare( TMTPTypeRequest& aRequest ); + virtual void SetObjectPropValueReceiveDataL( + const TMTPTypeRequest& aRequest, MMTPType* aData ); + virtual TInt SetObjectPropValueL_checkresults( const CMTPTypeObjectInfo* + aObjectInfo ); + + virtual TBool SetObjectPropListL_prepare( TMTPTypeRequest& aRequest ); + virtual void SetObjectPropListReceiveDataL( CMTPTypeObjectPropList* + aData ); + virtual TInt SetObjectPropListL_checkresults( + const CMTPTypeObjectPropList* aObjectPropList ); + + virtual TBool DeleteObjectL_prepare( TMTPTypeRequest& aRequest ); + virtual TInt DeleteObjectL_checkresults( MMTPObjectMgr& aObjectManager ); + + virtual TBool CopyObjectL_prepare( TMTPTypeRequest& aRequest ); + virtual TInt CopyObjectL_checkresults( const CMTPObjectMetaData* + aMetaData ); + + virtual TBool MoveObjectL_prepare( TMTPTypeRequest& aRequest ); + virtual TInt MoveObjectL_checkresults( const CMTPObjectMetaData* + aMetaData ); + + virtual TBool RenameObjectL_prepare( TMTPNotificationParamsHandle& + aParam ); + virtual TInt RenameObjectL_checkresults( const CMTPObjectMetaData* + aMetaData ); + + virtual TBool GetPartialObjectL_prepare( TMTPTypeRequest& aRequest ); + virtual TInt GetPartialObjectL_checkresults(); + + virtual TBool SetObjectReferencesL_prepare( TMTPTypeRequest& aRequest ); + virtual TInt SetObjectReferencesL_checkresults(); + + virtual TBool GetObjectReferencesL_prepare( TMTPTypeRequest& aRequest ); + virtual TInt GetObjectReferencesL_checkresults(); + + virtual TBool GetObjectPropsSupportedL_prepare( TMTPTypeRequest& + aRequest ); + virtual TInt GetObjectPropsSupportedL_checkresults( const CMTPTypeArray* + aObjectProps ); +protected: + CMmMtpDataProviderTester(); +protected: + CStifLogger* iLog; + // not owned: + CTestObserver* iTestObserver; + CTestConnectionChannel* iTestConnChannel; + CMTPDataProviderPlugin* iDataProviderPlugin; + }; + +#endif // CMMMTPDATAPROVIDERTESTER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/inc/cmmmtpdataprovidertestmodule.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/inc/cmmmtpdataprovidertestmodule.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,120 @@ +/* +* 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: Test class for STIF TestScripter module +* +*/ + + +#ifndef CMMMTPDATAPROVIDERTESTMODULE_H +#define CMMMTPDATAPROVIDERTESTMODULE_H + +// INCLUDES + +#include +#include +#include +#include +#include + +#include "ctestobjectmanager.h" +#include "ctestconnectionchannel.h" +#include "ctestobserver.h" + +// CONSTANTS + +_LIT( KTestModuleName, "MMMTP" ); + +// MACROS + +#define TEST_CLASS_VERSION_MAJOR 1 +#define TEST_CLASS_VERSION_MINOR 0 +#define TEST_CLASS_VERSION_BUILD 0 + +// FORWARD DECLARATIONS + +class CMTPDataProviderPlugin; +class CMmMtpDataProviderTester; + +// CLASS DECLARATION + +/** +* CMtpDataProviderTestModule test class for STIF Test Framework TestScripter. +* +*/ +NONSHARABLE_CLASS(CMmMtpDataProviderTestModule) : public CScriptBase + { +public: // Constructors and destructor + static CMmMtpDataProviderTestModule* NewL( CTestModuleIf& aTestModuleIf ); + virtual ~CMmMtpDataProviderTestModule(); +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: + CMmMtpDataProviderTestModule( CTestModuleIf& aTestModuleIf ); + + void ConstructL(); + void Delete(); + + /** + * Test methods are listed below. + */ + virtual TInt LoadPluginL( CStifItemParser& aItem ); + virtual TInt PrepareEnvironmentL( CStifItemParser& aItem ); + virtual TInt CleanEnvironmentL( CStifItemParser& aItem ); + virtual TInt OpenSessionL( CStifItemParser& aItem ); + virtual TInt CloseSessionL( CStifItemParser& aItem ); + virtual TInt ObjectEnumerationL( CStifItemParser& aItem ); + virtual TInt StorageEnumerationL( CStifItemParser& aItem ); + virtual TInt StartTransactionL( CStifItemParser& aItem ); + virtual TInt CancelTransactionL( CStifItemParser& aItem ); + virtual TInt CompleteTransactionL( CStifItemParser& aItem ); + virtual TInt GetObjectInfoL( CStifItemParser& aItem ); + virtual TInt GetObjectL( CStifItemParser& aItem ); + virtual TInt GetObjectPropValueL( CStifItemParser& aItem ); + virtual TInt GetObjectPropListL( CStifItemParser& aItem ); + virtual TInt GetObjectPropDescL( CStifItemParser& aItem ); + virtual TInt SendObjectInfoL( CStifItemParser& aItem ); + virtual TInt SendObjectL( CStifItemParser& aItem ); + virtual TInt SetObjectPropValueL( CStifItemParser& aItem ); + virtual TInt SetObjectPropListL( CStifItemParser& aItem ); + virtual TInt DeleteObjectL( CStifItemParser& aItem ); + virtual TInt CopyObjectL( CStifItemParser& aItem ); + virtual TInt MoveObjectL( CStifItemParser& aItem ); + virtual TInt RenameObjectL ( CStifItemParser& aItem ); + virtual TInt GetPartialObjectL( CStifItemParser& aItem ); + virtual TInt SetObjectReferencesL( CStifItemParser& aItem ); + virtual TInt GetObjectReferencesL( CStifItemParser& aItem ); + virtual TInt GetObjectPropsSupportedL( CStifItemParser& aItem ); + void SendTestClassVersion(); +public: // data + CMmMtpDataProviderTester* iPluginTester; + CMTPDataProviderPlugin* iDataProviderPlugin; + CTestConnectionChannel* iTestConnChannel; +private: + TMTPTypeRequest* iRequest; + TUint iSessionId; + TBool iSessionOpen; + TUint iTransactionId; + TBool iTransactionOpen; + + CTestObserver* iTestObserver; + CActiveScheduler* iActiveScheduler; + }; + +#endif // CMMMTPDATAPROVIDERTESTMODULE_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/inc/cplaylistmtpdataprovidertester.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/inc/cplaylistmtpdataprovidertester.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,53 @@ +/* +* 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: Tester class for abstractmediamtpdp plugin +* +*/ + + +#ifndef CABSTRACTMEDIAMTPDATAPROVIDERTESTER_H +#define CABSTRACTMEDIAMTPDATAPROVIDERTESTER_H + +#include "cmmmtpdataprovidertester.h" + +/** +* CAbstractMediaMtpDataProviderTester class. +* +*/ +class CAbstractMediaMtpDataProviderTester : public CMmMtpDataProviderTester + { +public: + static CAbstractMediaMtpDataProviderTester* NewL(); + virtual ~CAbstractMediaMtpDataProviderTester(); +private: + TInt CheckSupportedL( TMTPSupportCategory aCategory, + RArray aResponseArray ); + + TInt PrepareEnvironmentL(); + TInt CleanEnvironmentL(); + + TBool ObjectEnumerationL_prepare( CMTPStorageMetaData* aPhysicalStorage, + CMTPStorageMetaData* aLogicalStorage ); + TInt ObjectEnumerationL_checkresults( MMTPObjectMgr& aObjectManager ); + TInt DeleteObjectL_checkresults( MMTPObjectMgr& aObjectManager ); +private: + CAbstractMediaMtpDataProviderTester(); + void ConstructL(); +private: + CActiveSchedulerWait* iActiveSchedulerWait; + RFs iFsSession; + CFileMan* iFileMan; + }; + +#endif // CABSTRACTMEDIAMTPDATAPROVIDERTESTER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/inc/ctestconnectionchannel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/inc/ctestconnectionchannel.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,90 @@ +/* +* 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: Dummy test connection channel for test module +* +*/ + + +#ifndef CTESTCONNECTIONCHANNEL_H +#define CTESTCONNECTIONCHANNEL_H + +#include + +class MMTPSession; + +class CTestConnectionChannel : public MMTPConnection + { + // from MMTPConnection + /** + Provides the unique MTP data provider framework assigned identifier of the + connection. + @return The MTP data provider framework assigned connection identifier. + */ + TUint ConnectionId() const; + + /** + Provides a count of the number of sessions currently active on the + connection. + @return The number of sessions currently active on the connection. + */ + TUint SessionCount() const; + + /** + Indicates if a session with the specified MTP connection assigned + identifier is currently active on the connection. + @param aMTPId The MTP connection assigned identifier of the session. + @return ETrue, if a session with the specified session identifier is + currently active on the connection, otherwise EFalse. + */ + TBool SessionWithMTPIdExists(TUint32 aMTPId) const; + + /** + Provides a reference to the session with the specified MTP connection + assigned identifier. + @param aMTPId The MTP connection assigned identifier of the + requested session. + @return The reference of the session with the specified MTP connection + assigned identifier. + @leave KErrNotFound, if the specified session identifier is not currently + active on the connection. + @see SessionWithMTPIdExists + */ + MMTPSession& SessionWithMTPIdL(TUint32 aMTPId) const; + + /** + Indicates if a session with the specified MTP connection assigned + identifier is currently active on the connection. + @param aUniqueId The MTP connection assigned identifier of the session. + @return ETrue, if a session with the specified session identifier is + currently active on the connection, otherwise EFalse. + */ + TBool SessionWithUniqueIdExists(TUint32 aUniqueId) const; + + /** + Provides a reference to the session with the specified MTP connection + assigned identifier. + @param aUniqueId The MTP connection assigned identifier of the + requested session. + @return The reference of the session with the specified MTP connection + assigned identifier. + @leave KErrNotFound, if the specified session identifier is not currently + active on the connection. + @see SessionWithMTPIdExists + */ + MMTPSession& SessionWithUniqueIdL(TUint32 aUniqueId) const; + + + }; + +#endif // CTESTCONNECTIONCHANNEL_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/inc/ctestobjectmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/inc/ctestobjectmanager.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,325 @@ +/* +* 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: Dummy object manager for test module +* +*/ + + +#ifndef CTESTOBJECTMANAGER_H +#define CTESTOBJECTMANAGER_H + +#include +#include +#include +#include + +class CTestObjectManager : public MMTPObjectMgr, public CBase + { +public: + // destructor + virtual ~CTestObjectManager(); + static CTestObjectManager* NewL(); + + // from MMTPObjectMgr + /** + Provides a count of the number of object meta data records present + in the MTP data object enumeration store. This query can be targeted + at specific storage media and/or object data formats, or can be used + to query all MTP data objects on the device. + @param aParams The query parameters. + @return A count of the number of object meta data records. + @leave One of the system wide error codes, if a processing failure occurs. + */ + TUint CountL( const TMTPObjectMgrQueryParams& aParams ) const; + + /** + Commits into MTP data object enumeration store the object handle and + storage space previously reserved for the specified object. This is + typically used when either an MTP SendObjectInfo/SendObject, or + SendObjectPropList/SendObject operation sequence has completed + successfully. + @param aObject The MTP data object information record to be commited. + @leave One of the system wide error codes, if a processing failure occurs. + @see ReserveObjectHandleL + */ + void CommitReservedObjectHandleL( CMTPObjectMetaData& aObject ); + + /** + Provides an array of object handles present in the MTP data object + enumeration store. This query can be targeted at specific storage media + and/or object data formats, or can be used to query all MTP data objects + on the device. + + Depending on the query parameter specified, this query may incur significant + RAM consumption, and so is intended to be called repeatedly in order to + retrieve all matching SUID data. On completion, @see aContext can be used + to determine if there is more data to be retrieved. + + If there are no object handles which match the specified parameters then a + zero length SUID array is provided. + + @param aParams The query parameters. + @param aContext The query context data. On completion this data indicates + if there are additional object handle data to retrieve. + @param aHandles The MTP object handles array buffer to be populated. + @leave One of the system wide error codes, if a processing failure occurs. + @leave One of the system wide error codes, if a processing failure occurs. + */ + void GetObjectHandlesL( const TMTPObjectMgrQueryParams& aParams, + RMTPObjectMgrQueryContext& aContext, + RArray& aHandles ) const; + + /** + Provides an array of object SUIDs present in the MTP data object + enumeration store. This query can be targeted at specific storage media + and/or object data formats, or can be used to query all MTP data objects + on the device. + + Depending on the query parameter specified, this query may incur significant + RAM consumption, and so is intended to be called repeatedly in order to + retrieve all matching object SUID data. On completion, @see aContext can be used + to determine if there is more data to be retrieved. + + If there are no object handles which match the specified parameters then a + zero length SUID array is provided. + + @param aParams The query parameters. + @param aContext The query context data. On completion this data indicates + if there are additional SUID data to retrieve. + @param aSuids The object SUIDs array buffer to be populated. + @leave One of the system wide error codes, if a processing failure occurs. + */ + void GetObjectSuidsL( const TMTPObjectMgrQueryParams& aParams, + RMTPObjectMgrQueryContext& aContext, CDesCArray& aSuids ) const; + + /** + Provides the MTP object handle of the object with the specified internal + object unique ID. + @param aObjectUid The internal object unique ID. + @return The MTP object handle. + @leave One of the system wide error codes, if a processing failure occurs. + */ + TUint32 HandleL( TInt64 aObjectUid ) const; + + /** + Provides the MTP object handle of the object with the specified Persistent + Unique Identifier (PUID). + @param aPuid The object PUID. + @return The MTP object handle. + @leave One of the system wide error codes, if a processing failure occurs. + */ + TUint32 HandleL( const TMTPTypeUint128& aPuid ) const; + + /** + Provides the MTP object handle of the object with the specified specified + System Unique Identifier (SUID). + @param aSuid The object SUID. + @return The MTP object handle. + @leave One of the system wide error codes, if a processing failure occurs. + */ + TUint32 HandleL( const TDesC& aSuid ) const; + + /** + Inserts a single object information record into the MTP data object + enumeration store. A unique MTP object handle is assigned to the + data object. + @param aObject The MTP data object information record to be inserted. + @leave KErrAlreadyExists, if an object with the specified MTP object SUID + already exists in the MTP data object enumeration store. + @leave One of the system wide error codes, if a processing failure occurs. + */ + void InsertObjectL( CMTPObjectMetaData& aObject ); + + /** + Inserts multiple object meta data records in the MTP data object + enumeration store. A unique MTP object handle is assigned to each of the + data objects. + @param aObjects The MTP data object meta data records to be inserted. + @leave KErrAlreadyExists, if an object with the one of the specified MTP + object SUIDs already exists in the MTP data object enumeration store. + already exists in the MTP data object enumeration store. + @leave One of the system wide error codes, if a processing failure occurs. + */ + void InsertObjectsL( RPointerArray& aObjects ); + + /** + Modifies the specified MTP data object's object information record. + @param aObject The modified MTP data object information record values. + */ + void ModifyObjectL( const CMTPObjectMetaData& aObject ); + + /** + Provides either the object information record associated with the + associated MTP object handle, or provides an indication that the specified + object handle does not exist. + @param aHandle The MTP object handle associated with the object information + record to be provided. + @param aObject On exit, the object information record of the requested object. + @return ETrue if the specified object handle exists, otherwise EFalse. + @leave One of the system wide error codes, if a processing failure occurs. + */ + TBool ObjectL( const TMTPTypeUint32& aHandle, + CMTPObjectMetaData& aObject ) const; + + /** + Provides the object information record associated with the associated MTP + object SUID, or provides an indication that the specified object handle + does not exist. + @param aSuid The MTP object SUID associated with the object information + record to be provided. + @param aObject On exit, the object information record of the requested object. + @return ETrue if the specified object handle exists, otherwise EFalse. + @leave One of the system wide error codes, if a processing failure occurs. + */ + TBool ObjectL( const TDesC& aSuid, CMTPObjectMetaData& aObject ) const; + + /** + Provides the ID of the data provider responsible for the specified MTP + data object. + @param aHandle The MTP object handle. + @return The responsible data provider ID. + */ + TUint ObjectOwnerId( const TMTPTypeUint32& aHandle ) const; + + /** + Provides the internal object unique ID of the object with the specified MTP + object handle. + @param aHandle The MTP object handle. + @return The internal object unique ID. + @leave One of the system wide error codes, if a processing failure occurs. + */ + TInt64 ObjectUidL( TUint32 aHandle ) const; + + /** + Provides the internal object unique ID of the object with the specified + System Unique Identifier (SUID). + @param aSuid The object SUID. + @return The internal object unique ID. + @leave One of the system wide error codes, if a processing failure occurs. + */ + TInt64 ObjectUidL( const TDesC& aSuid ) const; + + /** + Provides the internal object unique ID of the object with the specified + Persistent Unique Identifier (PUID). + @param aPuid The object PUID. + @return The internal object unique ID. + @leave One of the system wide error codes, if a processing failure occurs. + */ + TInt64 ObjectUidL( TMTPTypeUint128 aPuid ) const; + + /** + Provides the Persistent Unique Identifier (PUID) of the object with the + specified MTP object handle. + @param aHandle The MTP object handle. + @return The object PUID. + @leave One of the system wide error codes, if a processing failure occurs. + */ + TMTPTypeUint128 PuidL( TUint32 aHandle ) const; + + /** + Provides the Persistent Unique Identifier (PUID) of the object with the + specified internal object unique ID. + @param aObjectUid The internal object unique ID. + @return The object PUID. + @leave One of the system wide error codes, if a processing failure occurs. + */ + TMTPTypeUint128 PuidL( TInt64 aObjectUid ) const; + + /** + Provides the Persistent Unique Identifier (PUID) of the object with the + specified System Unique Identifier (SUID). + @param aSuid The object SUID. + @return The object PUID. + @leave One of the system wide error codes, if a processing failure occurs. + */ + TMTPTypeUint128 PuidL( const TDesC& aSuid ) const; + + /** + Removes the object information record associated with the specified MTP + object handle from the MTP data object enumeration store. + @param aHandle The MTP object handle associated with the object information + record to be removed. + @leave One of the system wide error codes, if a processing failure occurs. + */ + void RemoveObjectL( const TMTPTypeUint32& aHandle ); + + /** + Removes the object information record associated with the specified object + SUID from the MTP data object enumeration store. + @param aSuid The object SUID associated with the object information + record to be removed. + @leave One of the system wide error codes, if a processing failure occurs. + */ + void RemoveObjectL( const TDesC& aSuid ); + + /** + Removes multiple object meta data records from the MTP data object + enumeration store. + @param aSuids The array of object SUIDs associated with the object + meta data records to be removed. + @leave One of the system wide error codes, if a processing failure occurs. + */ + void RemoveObjectsL( const CDesCArray& aSuids ); + + /** + Removes from the MTP data object enumeration store all object meta data + records owned by the specified data provider. + @param aDataProviderId The ID of the data provider owning the object + meta data records to be deleted. + @leave One of the system wide error codes, if a processing failure occurs. + */ + void RemoveObjectsL( TUint aDataProviderId ); + + /** + Reserves space for and assigns an object handle to the object described + by the specified object information record. This is typically used when + processing MTP SendObjectInfo or SendObjectPropList operations. + @param aObject The object information record of the object. On + successful completion this is updated with the assigned object handle. + @param aSpaceRequired The storage space to be reserved for the object. + @leave KErrTooBig, if aSpaceRequired exceeds the available capacity of the + storage. + @leave KErrOverflow, if an object handle cannot be assigned. + @leave One of the system wide error codes, if a processing failure occurs. + @see CommitReservedObjectL + @see UnReserveObjectHandleL + */ + void ReserveObjectHandleL( CMTPObjectMetaData& aObject, + TUint64 aSpaceRequired ); + + /** + Releases the object handle and storage space previously reserved for the + specified object. This is typically used when either an MTP + SendObjectInfo/SendObject, or SendObjectPropList/SendObject operation + sequence has not completed successfully. + @param aObject The MTP data object information record of the object. + @leave One of the system wide error codes, if a processing failure occurs. + @see ReserveObjectHandleL + */ + void UnreserveObjectHandleL( const CMTPObjectMetaData& aObject ); +private: + CTestObjectManager(); + void ConstructL(); + + void CopyObjectMetadataL( const CMTPObjectMetaData& aSource, + CMTPObjectMetaData& aTarget ) const; +private: + CStifLogger* iLog; + RPointerArray iMTPObjects; + + TInt iHandle; + }; + +#endif // CTESTOBJECTMANAGER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/inc/ctestobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/inc/ctestobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,368 @@ +/* +* 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: Test observer to act as dummy mtp framework +* +*/ + + +#ifndef CTESTOBSERVER_H +#define CTESTOBSERVER_H + +#include +#include +#include +#include +#include +#include +#include +#include "ctestobjectmanager.h" +#include "cteststoragemgr.h" + +#if defined(_UNICODE) +#define CASTING(a) ((TText)L ## a) +#else +#define CASTING(a) ((TText)(a)) +#endif + +class CMmMtpDataProviderTestModule; + +class CTestObserver : public MMTPDataProviderFramework, public MMTPDataProviderConfig, + public MMPXHarvesterUtilityObserver, public CBase + { +public: + enum TAsyncOperation + { + EIdleOperation, + EStorageEnumeration, + EObjectEnumeration, + EHarvesterAddObject, + EHarvesterDeleteObject, + EHarvesterImportAbstractMedia, + ECopyObject, + EMoveObject, + EDeleteObject, + EGetObjectPropList, + ESetObjectPropList + }; + + /** + * C++ default constructor. + */ + CTestObserver( CMmMtpDataProviderTestModule* aTestModule ); + + /** + * Destructor. + */ + ~CTestObserver(); + + static CTestObserver* NewL( CMmMtpDataProviderTestModule* aTestModule ); + static CTestObserver* NewLC( CMmMtpDataProviderTestModule* aTestModule ); + + + // from MMTPDataProviderFramework + + /** + Provides the unique identifier of the calling data provider. + @return The data provider identifier. + */ + TUint DataProviderId() const; + + /** + Provides the current MTP operational mode. + @return The current MTP operational mode. + */ + TMTPOperationalMode Mode() const; + + /** + Initiates a data object receive sequence in the MTP data provider framework + layer. This method should only be invoked when processing the ERequestPhase + of an MTP transaction (@see CMTPDataProviderPlugin::ProcessRequestPhaseL), + and causes the MTP session transaction state to transition to the + @see EDataIToRPhase. The data object receive sequence is completed when the + MTP data provider framework layer initiates the @see EResponsePhase of the + MTP transaction (@see CMTPDataProviderPlugin::ProcessRequestPhaseL). + @param aData The MTP data object sink buffer. + @param aRequest The MTP request dataset of the active MTP transaction. + @param aConnection The handle of the MTP connection on which the transaction + is being processed. + @see CMTPDataProviderPlugin::ProcessRequestPhaseL + @leave KErrNotReady, if invoked when the current MTP transaction phase is + not ERequestPhase. + */ + void ReceiveDataL(MMTPType& aData, const TMTPTypeRequest& aRequest, MMTPConnection& aConnection); + + /** + Initiates a data object send sequence in the MTP data provider framework + layer. This method should only be invoked when processing the ERequestPhase + of an MTP transaction (@see CMTPDataProviderPlugin::ProcessRequestPhaseL), + and causes the MTP session transaction state to transition to the + @see EDataRToIPhase. The data object send sequence is completed when the + MTP data provider framework layer initiates the @see EResponsePhase of the + MTP transaction (@see CMTPDataProviderPlugin::ProcessRequestPhaseL). + @param aData The MTP data object source buffer. + @param aRequest The MTP request dataset of the active MTP transaction. + @param aConnection The handle of the MTP connection on which the transaction + is being processed. + @see CMTPDataProviderPlugin::ProcessRequestPhaseL + @leave KErrNotReady, if invoked when the current MTP transaction phase is + not ERequestPhase. + */ + void SendDataL(const MMTPType& aData, const TMTPTypeRequest& aRequest, MMTPConnection& aConnection); + + /** + Signals the MTP data provider framework layer to send an asynchronous event + dataset on the specified MTP connection. + @param aEvent The MTP event dataset source buffer. + @param aConnection The handle of the MTP connection on which the event is + to be sent. + @leave KErrArgument, if the event data is not valid. + */ + void SendEventL(const TMTPTypeEvent& aEvent, MMTPConnection& aConnection); + + /** + Signals the MTP data provider framework layer to send an asynchronous event + dataset on all active MTP connections. + @param aEvent The MTP event dataset source, this should always target all + open sessions, i.e. SessionID should be set to KMTPAllSessions. + @leave KErrArgument, if the event data is invalid. + */ + void SendEventL(const TMTPTypeEvent& aEvent); + + /** + Initiates an MTP response dataset send sequence in the MTP data provider + framework layer. This method should only be invoked when processing either + the @see ERequestPhase or @see EResponsePhase of an MTP transaction, (@see + CMTPDataProviderPlugin::ProcessRequestPhaseL) and causes the MTP session + transaction state to transition to the @see ECompletingPhase. The MTP + response dataset send sequence is completed when the MTP data provider + framework layer initiates the @see ECompletingPhase of the MTP transaction + (@see CMTPDataProviderPlugin::ProcessRequestPhaseL). + @param aResponse The MTP aResponse dataset source buffer. + @param aConnection The handle of the MTP connection on which the transaction + is being processed. + @see CMTPDataProviderPlugin::ProcessRequestPhaseL + @leave KErrNotReady, if invoked when the current MTP transaction phase is + not ERequestPhase or EResponsePhase. + */ + void SendResponseL(const TMTPTypeResponse& aResponse, const TMTPTypeRequest& aRequest, MMTPConnection& aConnection); + + /** + Signals to the MTP data provider framework layer that all processing + related to the current transaction has been completed. This method should + only be invoked when processing the @see ECompletingPhase of the MTP + transaction (@see CMTPDataProviderPlugin::ProcessRequestPhaseL), and causes + the MTP session transaction state to transition to the @see EIdle state. + @param aRequest The MTP request dataset that initiated the transaction. + @param aRequest The MTP request dataset of the active MTP transaction. + @param aConnection The handle of the MTP connection on which the transaction + is being processed. + @see CMTPDataProviderPlugin::ProcessRequestPhaseL + @leave KErrNotReady If invoked when the current MTP transaction phase is + invalid. + */ + void TransactionCompleteL(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection); + + /** + Registers the calling data provider to receive one or more occurrences of + the specified request dataset that are received on the specified + connection. This method should be used to register the calling data + provider to receive the following request types: + + 1. Follow-on requests of an MTP operation that can span multiple + transaction cycles. The following request types are recognised + by the framework as follow-on requests: + + i) SendObject (preceded by SendObjectInfo or SendObjectPropList). + ii) TerminateOpenCapture (preceded by InitiateOpenCapture). + + 2. MTP vendor extension requests. + + Note that: + + 1. The request dataset being registered must minimally specify the + Operation Code of the expected operation and the SessionID on which + the operation request is expected to be received. + + Follow-on request registrations MUST specify a specific SessionID. + Registrations of non follow-on requests may optionally specify a + SessionID of @see KMTPSessionAll to receive matching requests from + any active MTP session. + + 2. With the exception of the TransactionID element, registered request + datasets must exactly match all data elements of the expected request + dataset in order to be successfully routed. + + 3. Duplicate RouteRequestRegisterL registrations are not permitted. A request + dataset that matches that of a previous registration by this or + any other data provider on the same MTP session will result in the + previous registration being superceded. + + 4. Pending RouteRequestRegisterL registrations can be withdrawn at any time + using the @see RouteRequestUnregisterL method. + + 5. RouteRequestRegisterL registrations of MTP request types which ARE + recognised by the framework as MTP follow-on requests (SendObject, + TerminateOpenCapture) will result in at most one matching request + occurence being routed to the data provider. To receive another + request dataset of the same type, a new @see RouteRequestRegisterL + registration must be made. + + 6 RouteRequestRegisterL registrations of MTP request types which ARE + NOT recognised by the framework as MTP follow-on requests will + result in all matching requests which are subsequently received + being routed to the data provider. This will continue until such + time as the RouteRequestRegisterL registration is withdrawn using + the @see RouteRequestUnregisterL method. + + 7. RouteRequestRegisterL registrations request datasets which specify + an SessionID value of @see KMTPSessionAll, will result in matching + requests which are subsequently received on any active MTP session + being routed to the data provider. + + @param aRequest The operation request dataset being registered. + @param aConnection The handle of the MTP connection on which the operation + request is expected to be received. + @leave KErrArgument, if the request dataset does meet the minimal + registration requirements specified above. + @leave One of the system wide error codes, if a general processing error + occurs. + @see RouteRequestUnregisterL + */ + void RouteRequestRegisterL(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection); + + /** + Cancels a pending RouteRequestRegisterL registration. + @param aRequest The registered operation request dataset. + @param aConnection The handle of the MTP connection for which the operation + request was registered. + @leave One of the system wide error codes, if a general processing error + occurs. + @see RouteRequestRegisterL + */ + void RouteRequestUnregisterL(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection); + + /** + Signals the completion of the data provider's object store enumeration + sequence that was previously initiated by a StartObjectEnumerationL signal + made to the MTP data provider interface. + @param aStorageId The MTP StorageID of the enumerated storage. This should + match the value specified in the preceding StartObjectEnumerationL. + @see MMTPDataProvider::StartObjectEnumerationL + */ + void ObjectEnumerationCompleteL(TUint32 aStorageId); + + /** + Signals the completion of the data provider's storage enumeration sequence + that was previously initiated by a StartStorageEnumerationL signal + made to the MTP data provider interface. + @see MMTPDataProvider::StartStorageEnumerationL + */ + void StorageEnumerationCompleteL(); + + /** + Provides a handle to the configurability data specified in the data + provider's configuration file. + @return Handle to the data provider's configurability data. + */ + const MMTPDataProviderConfig& DataProviderConfig() const; + + /** + Provides a handle to the data provider framework configurability parameter + data. + @return Handle to the data provider framework configurability data. + */ + const MMTPFrameworkConfig& FrameworkConfig() const; + + /** + Provides a handle to the MTP object manager, which manages the assignment + of MTP object handles and their mapping to actual data objects on behalf + of the data provider. + @return Handle to the MTP data provider framework object manager. + */ + MMTPObjectMgr& ObjectMgr() const; + + /** + Provides a handle to the MTP object reference manager, to which data + providers can delegate the handling of the MTP persistent, abstract + object referencing mechanism. + @return Handle to the MTP data provider framework object reference manager. + */ + MMTPReferenceMgr& ReferenceMgr() const; + + /** + Provides a handle to the MTP storage manager, which manages the assignment + of MTP storage identifiers on behalf of the data provider. + @return Handle to the MTP data provider framework storage manager. + */ + MMTPStorageMgr& StorageMgr() const; + + /** + Provides a handle to the MTP data provider framework RFs session. + @return Handle to the MTP data provider framework RFs session. + */ + RFs& Fs() const; + + TBool ObjectEnumerationComplete() const; + TInt ObjectEnumerationError() const; + + TBool StorageEnumerationComplete() const; + + TMTPTransactionPhase SetPhaseL( TMTPTransactionPhase aPhase ); + + void SetPendingOperation( TAsyncOperation aOperation ); + TInt WaitForPendingOperation(); + TInt GetPendingResult(); +public: // From MMTPDataProviderConfig + + TUint UintValue( TParameter aParam ) const; + TBool BoolValue( TParameter aParam ) const; + const TDesC& DesCValue( TParameter aParam ) const; + const TDesC8& DesC8Value( TParameter aParam ) const; + void GetArrayValue( TParameter aParam, RArray& aArray ) const; + +public: // From MMPXHarvesterUtilityObserver + void HandleAbstractMediaExportCompletedL( CMPXMedia* aMedia, TInt aErr ); + void HandleAbstractMediaImportCompletedL( CMPXMedia* aMedia, TInt aErr ); + void HandleFileAddCompletedL( CMPXMedia* aMedia, TInt aErr ); + void HandleDeleteCompletedL( TInt aErr ); + void HandleFileImportCompletedL( CMPXMedia* aMedia, TInt aErr ); + void HandleFileGetMediaCompletedL( CMPXMedia* aMedia, TInt aErr ); + +protected: + void ConstructL(); + +public: + TMTPTransactionPhase iPhase; + TMTPTypeResponse iResponse; + TUint16 iResponseCode; + const MMTPType* iMMTPTypeData; + CMTPTypeArray* iObjectPropsSupported; + +private: + CStifLogger* iLog; + + CTestObjectManager* iTestObjManager; + RFs iFsSession; + TBool iObjectEnumerationComplete; + TInt iObjectEnumerationError; + TBool iStorageEnumerationComplete; + CTestStorageMgr* iStorageManager; + CMmMtpDataProviderTestModule *iTestModule; + TAsyncOperation iPendingOperation; + TInt iAsyncResult; + CActiveSchedulerWait* iActiveSchedulerWait; + TUint32 iResourceId; + }; + +#endif // CTESTOBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/inc/cteststoragemgr.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/inc/cteststoragemgr.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,132 @@ +/* +* 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: Storage manager for test module dummy mtp implementation +* +*/ + + +#ifndef CTESTSTORAGEMGR_H +#define CTESTSTORAGEMGR_H + +#include +#include +#include +#include + +class CTestStorageMgr : + public CBase, + public MMTPStorageMgr + { +public: + static CTestStorageMgr* NewL(); + ~CTestStorageMgr(); + + static TUint LogicalStorageNumber( TUint32 aStorageId ); + static TUint LogicalStorageOwner( TUint32 aStorageId ); + static TUint PhysicalStorageNumber( TUint32 aStorageId ); + static TUint PhysicalStorageOwner( TUint32 aStorageId ); + + void SetDefaultStorageId( TUint32 aStorageId ); + void SetDriveMappingL( TDriveNumber aDriveNumber, TUint32 aStorageId ); + void SetFrameworkId( TUint aDataProviderId ); +public: // From MMTPStorageMgr + TUint32 AllocateLogicalStorageIdL( TUint aDataProviderId, + TDriveNumber aDriveNumber, const CMTPStorageMetaData& aStorage ); + TUint32 AllocateLogicalStorageIdL( TUint aDataProviderId, + TUint32 aPhysicalStorageId, const CMTPStorageMetaData& aStorage ); + TUint32 AllocatePhysicalStorageIdL( TUint aDataProviderId, + const CMTPStorageMetaData& aStorage ); + TInt DeallocateLogicalStorageId( TUint aDataProviderId, + TUint32 aLogicalStorageId ); + void DeallocateLogicalStorageIds( TUint aDataProviderId, + TUint32 aPhysicalStorageId ); + TInt DeallocatePhysicalStorageId( TUint aDataProviderId, + TUint32 aPhysicalStorageId ); + TUint32 DefaultStorageId() const; + TInt DriveNumber( TUint32 aStorageId ) const; + TInt32 FrameworkStorageId( TDriveNumber aDriveNumber ) const; + void GetAvailableDrivesL( RArray& aDrives ) const; + void GetLogicalStoragesL( const TMTPStorageMgrQueryParams& aParams, + RPointerArray& aStorages ) const; + void GetPhysicalStoragesL( const TMTPStorageMgrQueryParams& aParams, + RPointerArray& aStorages ) const; + TUint32 LogicalStorageId( TUint32 aStorageId ) const; + TInt32 LogicalStorageId( const TDesC& aStorageSuid ) const; + TInt32 PhysicalStorageId( TDriveNumber aDriveNumber ) const; + TUint32 PhysicalStorageId( TUint32 aStorageId ) const; + const CMTPStorageMetaData& StorageL( TUint32 aStorageId ) const; + TUint32 StorageId( TUint32 aPhysicalStorageId, + TUint32 aLogicalStorageId ) const; + TBool ValidStorageId( TUint32 aStorageId ) const; + CMTPTypeString* VolumeIdL( TUint aDataProviderId, TUint32 aStorageId, + const TDesC& aVolumeIdSuffix ) const; +private: + CTestStorageMgr(); + void ConstructL(); + + TInt32 AllocateLogicalStorageId( TUint aDataProviderId, + TUint32 aPhysicalStorageId ); + TInt32 AllocatePhysicalStorageId( TUint aDataProviderId ); + TUint32 EncodeLogicalStorageId( TUint32 aPhysicalStorageId, + TUint aDataProviderId, TUint aStorageNumber ); + TUint32 EncodeLogicalStorageNumber( TUint aStorageNumber ); + TUint32 EncodeLogicalStorageOwner( TUint aDataProviderId ); + TUint32 EncodePhysicalStorageId( TUint aDataProviderId, + TUint aStorageNumber ); + TUint32 EncodePhysicalStorageNumber( TUint aStorageNumber ); + TUint32 EncodePhysicalStorageOwner( TUint aDataProviderId ); + void RemoveLogicalStorageL( TUint aIdx ); + CMTPStorageMetaData& StorageMetaDataL( TUint32 aStorageId ); + + static TBool StorageKeyMatchSuid( const TDesC* aSuid, + const CMTPStorageMetaData& aStorage ); + static TInt StorageOrder( const CMTPStorageMetaData& aL, + const CMTPStorageMetaData& aR ); + static TInt StorageOrder( const TUint32* aKey, + const CMTPStorageMetaData& aStorage ); + +private: // owned data + /** + The default MTP storage ID. + */ + TUint32 iDefaultStorageId; + + /** + The framework storages (drives) owning data provider ID. + */ + TInt iFrameworkId; + + /** + The Symbian OS drive number to default MTP StorageID mapping table. This + StorageID may either be the physical MTP StorageID or the default logical + MTP StorageID. + */ + TFixedArray iMapDriveToStorage; + + /** + The physical storage numbers allocation table. Indexed by physical storage + owner data provider ID. + */ + RArray iPhysicalStorageNumbers; + + /** + The storages table. + */ + RPointerArray iStorages; + + RFs iFs; + static CStifLogger* iLog; + }; + +#endif // CTESTSTORAGEMGR_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/inc/logging.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/inc/logging.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,104 @@ +/* +* 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: Logging definitions for test module +* +*/ + + +#ifndef LOGGING_H +#define LOGGING_H + +// INCLUDES +#include +#include + +// CONSTANTS +const TUint KError = 0x1; +const TUint KInit = 0x2; +const TUint KPrint = 0x4; +const TUint KMessage = 0x10; +const TUint KFunction = 0x20; +const TUint KVerbose = 0x40; +const TUint KAlways = 0xFFFFFFFF; +const TUint KDebugLevel = ( KFunction | KPrint | KError | KMessage | KVerbose ); + +// Logging path +_LIT( KMtpDataProviderTestModuleLogPath, "\\logs\\testframework\\mtp\\" ); +// Log file +_LIT( KMtpDataProviderTestModuleLogFile, "MtpDataProviderTestModule.txt" ); +_LIT( KMtpDataProviderTestModuleLogFileWithTitle, "MtpDataProviderTestModule_[%S].txt" ); + +_LIT( KTestObserverLogFile, "TestObserver.txt" ); +_LIT( KTestObserverLogFileWithTitle, "TestObserver_[%S].txt" ); + +_LIT( KFuncTraceFormat, "%S - %S" ); + +// MACROS +#define __TRACING_ENABLED + +#ifdef __TRACING_ENABLED + #define PRINTTESTMODULEIF + #define PRINTTESTMODULE + // target can be CStifLogger::ERDebug or CStifLogger::EFile + #define TRACE_TARGET CStifLogger::EFile + // Disable conditional expression is constant -warning + #pragma warning( disable : 4127 ) + + // General tracing function + #define __TRACE(level,p) if ( ( (level) & KDebugLevel ) && LOGGER )\ + {LOGGER->Log p;} + + // Direct RDebug::Print + #define __RDEBUG(p) if( KVerbose & KDebugLevel ){ RDebug::Print p ; } + + // Log function name + #define __TRACEFUNC() if( ( KFunction & KDebugLevel ) && LOGGER ){\ + const char* func = __FUNCTION__;\ + TPtrC8 F((const unsigned char*)func);\ + LOGGER->Log(F);} + + #define PRINT0( level, p ) __TRACE( level, ( p ) ); \ + if ( ( level ) & KMessage ) { \ + PRINTTESTMODULEIF( p ); } \ + if ( ( level ) & KError ) { \ + PRINTTESTMODULE( p ); } + #define PRINTn( level, p ) __TRACE( level, ( p ) ); + #define PRINTM0( p ) PRINT0( KMessage, ( _L( p ) ) ) + #define PRINTM1( p, a ) __TRACE( KMessage, ( _L( p ), a ) ) + #define PRINTM2( p, a, b ) __TRACE( KMessage, ( _L( p ), a, b ) ) + #define PRINTE0( p ) PRINT0( KError, ( _L( p ) ) ) + #define PRINTE1( p, a ) __TRACE( KError, ( _L( p ), a ) ) + #define PRINTE2( p, a, b ) __TRACE( KError, ( _L( p ), a, b ) ) + #define PRINTN0( p ) __TRACE( KPrint, ( _L( p ) ) ) + #define PRINTN1( p, a ) __TRACE( KPrint, ( _L( p ), a ) ) + #define PRINTN2( p, a, b ) __TRACE( KPrint, ( _L( p ), a, b ) ) + #define PRINTV0( p ) __TRACE( KVerbose, ( _L( p ) ) ) + #define PRINTV1( p, a ) __TRACE( KVerbose, ( _L( p ), a ) ) + #define PRINTV2( p, a, b ) __TRACE( KVerbose, ( _L( p ), a, b ) ) + #define PRINTV3( p, a, b, c ) __TRACE( KVerbose, ( _L( p ), a, b, c ) ) + #define PRINTV4( p, a, b, c, d ) __TRACE( KVerbose, ( _L( p ), a, b, c, d ) ) + #define PRINTF0( p ) __TRACE( KFunction, ( _L( p ) ) ) + #define PRINTF1( p, a ) __TRACE( KFunction, ( _L( p ), a ) ) + #define PRINTF2( p, a, b ) __TRACE( KFunction, ( _L( p ), a, b ) ) + #define PRINTF3( p, a, b, c ) __TRACE( KFunction, ( _L( p ), a, b, c ) ) + +#else // __TRACING_ENABLED + // No tracing + #define __TRACE(level,p) + #define __RDEBUG(p) + #define __TRACEFUNC() +#endif // __TRACING_ENABLED + +#endif // LOGGING_H + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/init/testframework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/init/testframework.ini Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,217 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# + XML, Test report will be xml type, for example 'TestReport.xml'. +# Note, that xml format is available only when output is set to FILE. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[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, HTML or XML +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= 0 # 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] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +[New_Module] +ModuleName= TestScripter +TestCaseFile= c:\testframework\mmmtpdataprovidertester.cfg +[End_Module] + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[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= D:\LOGS\TestFramework\ +#HardwareFormat= HTML # Possible values: TXT or HTML +HardwareOutput=RDEBUG # 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] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set filters to be used by ConsoleUI. +# If you want to use filter with ConsoleUI, simply remove comments +# from section below and provide valid filter entries. +# Each filter line has to start with "filter= " keyword. +# Filter can contain special wildcard characters: +# * which stands for none or any literal; +# ? which stands for single character. +# Filters are not case-sensitive. + +#[Filters] +#filter= *math* +#filter= *radio* +#[End_Filters] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/src/cmediamtpdataprovidertester.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/src/cmediamtpdataprovidertester.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,1557 @@ +/* +* 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: Tester class for mediamtpdp plugin +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "cmediamtpdataprovidertester.h" +#include "logging.h" + +#ifdef LOGGER +#undef LOGGER +#endif +#define LOGGER iLog + +// definitions and constants for the test data + +const TUint32 KTestStorageId = 0x10000; +const TInt KTestObjectsCount = 4; +const TUint KTestDirHandle = 1; +const TInt KTestDirDataproviderId = 0; +_LIT( KTempDirPath, "C:\\mtp_testdata\\temp\\" ); +_LIT( KTestDirPath, "C:\\mtp_testdata\\temp\\TESTDIR\\" ); +_LIT( KTestFileOrigPath, "C:\\mtp_testdata\\TEST.MP3" ); +_LIT( KTestFileTempPath, "C:\\mtp_testdata\\temp\\TEST.MP3" ); +_LIT( KTestDirOrigPath, "C:\\mtp_testdata\\TESTDIR\\*" ); +_LIT( KTestDirTempPath, "C:\\mtp_testdata\\temp\\TESTDIR\\" ); +_LIT( KTestDirPhysicalStorage, "C:\\mtp_testdata\\temp\\" ); +_LIT( KTestDirLogicalStorage, "C:\\mtp_testdata\\temp\\" ); +_LIT( KTestObjectPath1, "C:\\mtp_testdata\\temp\\TEST.MP3" ); +_LIT( KTestObjectPath2, "C:\\mtp_testdata\\temp\\TESTDIR\\TEST1.MP3" ); +_LIT( KTestObjectPath3, "C:\\mtp_testdata\\temp\\TESTDIR\\TEST2.MP3" ); + +_LIT( KSendTestObjectFile, "SENDTEST.MP3" ); +_LIT( KSendTestObjectFileFullPath, "C:\\mtp_testdata\\SENDTEST.MP3" ); +_LIT( KSendTestObjectPath, "C:\\mtp_testdata\\temp\\SENDTEST.MP3" ); +_LIT( KSendTestObjectDateString, "20090511T091022+0800" ); +_LIT( KCopyTestObjectPath, "C:\\mtp_testdata\\temp\\TEST1.MP3" ); +_LIT( KCopyTestFileName, "TEST1.MP3" ); +_LIT( KMoveTestObjectOldPath, "C:\\mtp_testdata\\temp\\TESTDIR\\TEST1.MP3" ); +_LIT( KMoveTestObjectNewPath, "C:\\mtp_testdata\\temp\\TEST1.MP3" ); +_LIT( KMoveTestFileName, "TEST1.MP3" ); +_LIT( KRenameObjectName, "TESTDIR" ); +_LIT( KRenameObjectPath, "C:\\mtp_testdata\\temp\\RENAMEDIR\\" ); + +//_LIT( KSendObjectNameString, "Test Object" ); + +_LIT( KPropObjectDate, "20090610T090000+0800" ); +_LIT( KPropObjectName, "Test Object" ); +_LIT( KPropObjectArtist, "Test Artist" ); +_LIT( KPropObjectAlbumName, "Test Album" ); + +const TInt KTestFileSize = 271890; +const TInt KSendTestFileSize = 271890; +const TInt KCopyTestFileSize = 271890; +const TInt KMoveTestFileSize = 271890; + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CMediaMtpDataProviderTester* CMediaMtpDataProviderTester::NewL() + { + CMediaMtpDataProviderTester* self = + new ( ELeave ) CMediaMtpDataProviderTester(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that might leave. +// ---------------------------------------------------------------------------- +// +CMediaMtpDataProviderTester::CMediaMtpDataProviderTester() + : CMmMtpDataProviderTester() + { + // no implementation required + } + +// ---------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ---------------------------------------------------------------------------- +// +void CMediaMtpDataProviderTester::ConstructL() + { + TFileName logFileName; + logFileName.Copy( KMtpDataProviderTestModuleLogFile ); + + iLog = CStifLogger::NewL( KMtpDataProviderTestModuleLogPath, + logFileName, + CStifLogger::ETxt, + TRACE_TARGET, + ETrue, ETrue, ETrue, EFalse, ETrue ); + PRINTF0( ">CMediaMtpDataProviderTester::ConstructL" ); + iActiveSchedulerWait = new ( ELeave ) CActiveSchedulerWait(); + iFsSession.Connect(); + iFileMan = CFileMan::NewL( iFsSession ); + PRINTF0( "CMediaMtpDataProviderTester::~CMediaMtpDataProviderTester" ); + delete iActiveSchedulerWait; + delete iFileMan; + iFsSession.Close(); + PRINTF0( "CMediaMtpDataProviderTester::PrepareEnvironmentL" ); + TInt result = KErrNone; + + result = iFileMan->RmDir( KTempDirPath ); + if ( result == KErrNone ) + { + PRINTN0( "Warning: old temp directory found, deleted" ); + } + result = KErrNone; + + // create the temp dir if it doesn't exist + BaflUtils::EnsurePathExistsL( iFsSession, KTempDirPath ); + + // copy the test data to temp dir + result = iFileMan->Copy( KTestFileOrigPath, KTestFileTempPath ); + if ( result != KErrNone ) + { + PRINTE1( "Failed to copy test file, error %d", result ); + } + else + { + result = iFileMan->Copy( KTestDirOrigPath, KTestDirTempPath, + CFileMan::EOverWrite | CFileMan::ERecurse ); + if ( result != KErrNone ) + { + PRINTE1( "Failed to copy test dir, error %d", result ); + } + } + + PRINTF1( "CMediaMtpDataProviderTester::CleanEnvironmentL" ); + TInt result = KErrNone; + TMTPObjectMgrQueryParams queryParams ( KMTPStorageAll, KMTPFormatsAll, + KMTPHandleNone ); + RMTPObjectMgrQueryContext context; + RArray handles; + CleanupClosePushL( handles ); + + PRINTN0( "Starting to delete entries from mpx" ); + MMPXHarvesterUtility* harvester = CMPXHarvesterFactory::NewL(); + CleanupClosePushL( *harvester ); + + iTestObserver->ObjectMgr().GetObjectHandlesL( queryParams, context, + handles ); + PRINTV1( "Handle count: %d", handles.Count() ); + context.Close(); + + CMTPObjectMetaData* metadata = CMTPObjectMetaData::NewLC(); + for ( TInt i = 0; i < handles.Count(); i++ ) + { + PRINTN0( "enter for loop" ); + TUint handle = handles[i]; + if ( handle != KTestDirHandle ) + { + iTestObserver->ObjectMgr().ObjectL( handles[i], *metadata ); + TPtrC fileName = metadata->DesC( CMTPObjectMetaData::ESuid ); + PRINTV1( "Handle: %d", handles[i] ); + PRINTV1( "File name: %S", &fileName ); + + PRINTN0( "Starting to delete the file from mpx" ); + iTestObserver->SetPendingOperation( CTestObserver::EHarvesterDeleteObject ); + PRINTN0( "before deletefilel" ); + harvester->DeleteFileL( fileName, iTestObserver ); + PRINTN0( "after deletefilel" ); + User::After( 1000000 ); + PRINTN0( "before waitforpendingoperation" ); + // waiting for asynchronous operation to complete + result = iTestObserver->WaitForPendingOperation(); + PRINTN0( "after waitforpendingoperation" ); + + if ( result != KErrNone ) + { + PRINTE1( "Warning: failed to delete from mpx, error %d", result ); + result = KErrNone; // ignore for now, there are problems after DeleteObject + } + } + } + CleanupStack::PopAndDestroy( 3 ); // metadata, harvester, handles + PRINTN0( "Finished deleting entries from mpx" ); + + if ( result == KErrNone ) + { + PRINTN0( "Deleting temp directory" ); + result = iFileMan->RmDir( KTempDirPath ); + if ( result != KErrNone ) + { + PRINTE1( "Warning: failed to delete temp directory, error %d", result ); + result = KErrNone; + } + } + + PRINTF1( "CMediaMtpDataProviderTester::ObjectEnumerationL_prepare" ); + + TBool result = ETrue; + aPhysicalStorage->SetDesCL( CMTPStorageMetaData::EStorageSuid, + KTestDirPhysicalStorage() ); + aPhysicalStorage->SetUint( CMTPStorageMetaData::EStorageSystemType, + CMTPStorageMetaData::ESystemTypeDefaultFileSystem ); + + aLogicalStorage->SetDesCL( CMTPStorageMetaData::EStorageSuid, + KTestDirLogicalStorage() ); + aLogicalStorage->SetUint( CMTPStorageMetaData::EStorageSystemType, + CMTPStorageMetaData::ESystemTypeDefaultFileSystem ); + + // insert TESTDIR object manually + CMTPObjectMetaData* object( CMTPObjectMetaData::NewLC( 0, + EMTPFormatCodeAssociation, // a folder object + KTestStorageId, KTestDirPath ) ); + // object is in storage root + object->SetInt( CMTPObjectMetaData::EParentId, KErrNotFound ); + + iTestObserver->ObjectMgr().InsertObjectL( *object ); + CleanupStack::PopAndDestroy( object ); + + PRINTF1( "CMediaMtpDataProviderTester::ObjectEnumerationL_checkresults" ); + + TInt result = KErrNone; + + TMTPObjectMgrQueryParams queryParams ( KMTPStorageAll, KMTPFormatsAll, + KMTPHandleNone ); + RMTPObjectMgrQueryContext context; + RArray handles; + CleanupClosePushL( handles ); + MMPXHarvesterUtility* harvester = CMPXHarvesterFactory::NewL(); + CleanupClosePushL( *harvester ); + + aObjectManager.GetObjectHandlesL( queryParams, context, handles ); + context.Close(); + TInt count = handles.Count(); + PRINTV1( "Handle count: %d", count ); + if ( count != KTestObjectsCount ) + { + PRINTE2( "Wrong number of handles: %d != %d", count, KTestObjectsCount ); + result = KErrGeneral; + } + + CMTPObjectMetaData* metadata = CMTPObjectMetaData::NewLC(); + for ( TInt i = 0; i < count; i++ ) + { + TUint handle = handles[i]; + aObjectManager.ObjectL( handle, *metadata ); + TPtrC suid = metadata->DesC( CMTPObjectMetaData::ESuid ); + TUint formatCode = metadata->Uint( CMTPObjectMetaData::EFormatCode ); + TUint dataproviderId = metadata->Uint( CMTPObjectMetaData::EDataProviderId ); + TUint storageId = metadata->Uint( CMTPObjectMetaData::EStorageId ); + TInt parentId = metadata->Int( CMTPObjectMetaData::EParentId ); + + PRINTN1( "Handle: %d", handle ); + PRINTN1( "Suid: %S", &suid ); + + if ( dataproviderId != iTestObserver->DataProviderId() ) + { + if ( !( ( handle == KTestDirHandle ) && + ( dataproviderId == KTestDirDataproviderId ) ) ) + { + PRINTE2( "Wrong dataprovider id: %d != %d", dataproviderId, iTestObserver->DataProviderId() ); + result = KErrGeneral; + } + } + if ( storageId != KTestStorageId ) + { + PRINTE2( "Wrong storage id: %d != %d", storageId, KTestStorageId ); + result = KErrGeneral; + } + switch ( handle ) + { + case 1: + { + if ( suid.Match( KTestDirPath ) != 0 ) + { + PRINTE2( "Wrong test dir path: %S != %S", &suid, &KTestDirPath ); + result = KErrGeneral; + } + if ( formatCode != EMTPFormatCodeAssociation ) + { + PRINTE2( "Wrong format code: 0x%x != 0x%x", formatCode, EMTPFormatCodeAssociation ); + result = KErrGeneral; + } + if ( parentId != KErrNotFound ) + { + PRINTE2( "Wrong parent id: %d != %d", parentId, KErrNotFound ); + result = KErrGeneral; + } + break; + } + case 2: + { + if ( suid.Match( KTestObjectPath1 ) != 0 ) + { + PRINTE2( "Wrong test object 1 path: %S != %S", &suid, &KTestObjectPath1 ); + result = KErrGeneral; + } + if ( formatCode != EMTPFormatCodeMP3 ) + { + PRINTE2( "Wrong format code: 0x%x != 0x%x", formatCode, EMTPFormatCodeMP3 ); + result = KErrGeneral; + } + if ( parentId != KErrNotFound ) + { + PRINTE2( "Wrong parent id: %d != %d", parentId, KErrNotFound ); + result = KErrGeneral; + } + break; + } + case 3: + { + if ( suid.Match( KTestObjectPath2 ) != 0 ) + { + PRINTE2( "Wrong test object 2 path: %S != %S", &suid, KTestObjectPath2 ); + result = KErrGeneral; + } + if ( formatCode != EMTPFormatCodeMP3 ) + { + PRINTE2( "Wrong format code: 0x%x != 0x%x", formatCode, EMTPFormatCodeMP3 ); + result = KErrGeneral; + } + if ( parentId != 1 ) + { + PRINTE2( "Wrong parent id: %d != %d", parentId, 1 ); + result = KErrGeneral; + } + break; + } + case 4: + { + if ( suid.Match( KTestObjectPath3 ) != 0 ) + { + PRINTE2( "Wrong test object 3 path: %S != %S", &suid, &KTestObjectPath3 ); + result = KErrGeneral; + } + if ( formatCode != EMTPFormatCodeMP3 ) + { + PRINTE2( "Wrong format code: 0x%x != 0x%x", formatCode, EMTPFormatCodeMP3 ); + result = KErrGeneral; + } + if ( parentId != 1 ) + { + PRINTE2( "Wrong parent id: %d != %d", parentId, 1 ); + result = KErrGeneral; + } + break; + } + default: + { + PRINTE1( "Unexpected handle: %d", handle ); + result = KErrGeneral; + } + } + + if ( ( result == KErrNone ) && ( handle != KTestDirHandle ) ) + { + PRINTN0( "Starting to harvest the file" ); + iTestObserver->SetPendingOperation( CTestObserver::EHarvesterAddObject ); + harvester->AddFileL( metadata->DesC( CMTPObjectMetaData::ESuid ), iTestObserver ); + PRINTN0( "Waiting for harvesting to complete" ); + result = iTestObserver->WaitForPendingOperation(); + if ( result != KErrNone ) + { + PRINTE1( "Harvesting error: %d", result ); + } + } + } + CleanupStack::PopAndDestroy( 3 ); // handles, harvester, metadata + PRINTF1( "CMediaMtpDataProviderTester::GetObjectInfoL_checkresults" ); + _LIT( KTestFileName, "TEST.MP3" ); + TInt result = KErrNone; + if ( aObjectInfo ) + { + PRINTV1( "Object filename: %S", &aObjectInfo->StringCharsL( CMTPTypeObjectInfo::EFilename ) ); + if ( aObjectInfo->StringCharsL( CMTPTypeObjectInfo::EFilename ). + CompareF( KTestFileName ) != 0 ) + { + PRINTE0( "ObjectInfo filename not correct" ); + result = KErrGeneral; + } + PRINTV1( "Object modified date: %S", &aObjectInfo->StringCharsL( CMTPTypeObjectInfo::EDateModified ) ); + if ( aObjectInfo->StringCharsL( CMTPTypeObjectInfo::EDateModified ). + Length() == 0 ) + { + PRINTE0( "ObjectInfo modified date not set" ); + } + PRINTV1( "Object formatcode: 0x%x", aObjectInfo->Uint16L( CMTPTypeObjectInfo::EObjectFormat ) ); + if ( aObjectInfo->Uint16L( CMTPTypeObjectInfo::EObjectFormat ) != + EMTPFormatCodeMP3 ) + { + PRINTE0( "ObjectInfo format code not correct" ); + result=KErrGeneral; + } + } + else + { + PRINTE0( "ObjectInfo not received correctly" ); + result = KErrArgument; + } + PRINTF1( "CMediaMtpDataProviderTester::GetObjectL_checkresults" ); + // just check the handle is correct, based on the size + TInt result = KErrNone; + if ( aObjectInfo ) + { + TInt size = aObjectInfo->Size(); + PRINTV1( "Received object size: %d", size ); + if ( size != KTestFileSize ) + { + PRINTE2( "Wrong received object size: %d != %d", KTestFileSize, size ); + result = KErrGeneral; + } + aObjectInfo->File().Close(); + } + else + { + PRINTE0( "Object info not received" ); + result = KErrArgument; + } + PRINTF1( "CMediaMtpDataProviderTester::GetObjectPropValueL_checkresults" ); + TInt type = aObjectPropValue->Type(); + PRINTV1( "Received data type: 0x%x", type ); + TInt result = KErrNone; + + switch ( aPropCode ) + { + case EMTPObjectPropCodeStorageID: + { + TUint32 value = static_cast( aObjectPropValue )->Value(); + PRINTV1( "Storage ID: 0x%x", value ); + if ( value == KTestStorageId ) + { + result = KErrNone; + } + } + break; + case EMTPObjectPropCodeObjectFormat: + { + TUint16 value = static_cast( aObjectPropValue )->Value(); + PRINTV1( "Format: 0x%x", value ); + if ( value == EMTPFormatCodeMP3 ) + { + result = KErrNone; + } + } + break; + case EMTPObjectPropCodeProtectionStatus: + { + TUint16 value = static_cast( aObjectPropValue )->Value(); + PRINTV1( "Protections status: 0x%x", value ); + if ( value == EMTPProtectionNoProtection ) + { + result = KErrNone; + } + } + break; + case EMTPObjectPropCodeObjectSize: + { + TUint64 value = static_cast( aObjectPropValue )->Value(); + PRINTV1( "Object size: %d", value ); + if ( value == KTestFileSize ) + { + result = KErrNone; + } + } + break; + case EMTPObjectPropCodeObjectFileName: + { + TPtrC value = static_cast( aObjectPropValue )->StringChars(); + PRINTV1( "Object file name: '%S'", &value ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeParentObject: + { + TUint32 value = static_cast( aObjectPropValue )->Value(); + PRINTV1( "Parent object: %d", value ); + if ( value == KMaxTUint32 ) + { + result = KErrNone; + } + } + break; + case EMTPObjectPropCodePersistentUniqueObjectIdentifier: + { + /* + TUint64 lower = static_cast( aObjectPropValue )->LowerValue(); + TUint64 upper = static_cast( aObjectPropValue )->UpperValue(); + __TRACE( KPrint, ( _L( "Unique identifier: 0x%x 0x%x" ), lower, upper ) ); + if ( ( lower == 1) && ( upper == 1 ) ) + { + result = KErrNone; + } + */ + } + break; + case EMTPObjectPropCodeName: + { + TPtrC value = static_cast( aObjectPropValue )->StringChars(); + PRINTV1( "Object name: '%S'", &value ); + if ( value.Match( KPropObjectName ) != 0 ) + { + PRINTE2( "Received object name does not match: '%S' != '%S'", &value, &KPropObjectName ); + result = KErrGeneral; + } + } + break; + case EMTPObjectPropCodeNonConsumable: + { + TUint8 value = static_cast( aObjectPropValue )->Value(); + PRINTV1( "Non-consumable: %d", value ); + if ( value == 1 ) + { + result = KErrNone; + } + } + break; + case EMTPObjectPropCodeDateAdded: + { + TPtrC value = static_cast( aObjectPropValue )->StringChars(); + PRINTV1( "Date added: '%S'", &value ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeDateCreated: + { + TPtrC value = static_cast( aObjectPropValue )->StringChars(); + PRINTV1( "Date created: '%S'", &value ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeDateModified: + { + TPtrC value = static_cast( aObjectPropValue )->StringChars(); + PRINTV1( "Date modified: '%S'", &value ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeArtist: + { + TPtrC value = static_cast( aObjectPropValue )->StringChars(); + PRINTV1( "Artist: '%S'", &value ); + if ( value.Match( KPropObjectArtist ) != 0 ) + { + PRINTE2( "Received object artist does not match: '%S' != '%S'", &value, &KPropObjectArtist ); + result = KErrGeneral; + } + } + break; + case EMTPObjectPropCodeTrack: + { + TUint16 value = static_cast( aObjectPropValue )->Value(); + PRINTV1( "Track: %d", value ); + if ( value == 1 ) + { + result = KErrNone; + } + } + break; + case EMTPObjectPropCodeGenre: + { + TPtrC value = static_cast( aObjectPropValue )->StringChars(); + PRINTV1( "Genre: '%S'", &value ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeAlbumName: + { + TPtrC value = static_cast( aObjectPropValue )->StringChars(); + PRINTV1( "Album name: '%S'", &value ); + if ( value.Match( KPropObjectAlbumName ) != 0 ) + { + PRINTE2( "Received object album name does not match: '%S' != '%S'", &value, &KPropObjectAlbumName ); + result = KErrGeneral; + } + } + break; + case EMTPObjectPropCodeSampleRate: + { + TUint32 value = static_cast( aObjectPropValue )->Value(); + PRINTV1( "Sample rate: %d", value ); + if ( value == 1 ) + { + result = KErrNone; + } + } + break; + case EMTPObjectPropCodeNumberOfChannels: + { + TUint16 value = static_cast( aObjectPropValue )->Value(); + PRINTV1( "Number of channels: %d", value ); + if ( value == 1 ) + { + result = KErrNone; + } + } + break; + case EMTPObjectPropCodeAudioWAVECodec: + { + TUint32 value = static_cast( aObjectPropValue )->Value(); + PRINTV1( "WAVE codec: %d", value ); + if ( value == 1 ) + { + result = KErrNone; + } + } + break; + case EMTPObjectPropCodeAudioBitRate: + { + TUint32 value = static_cast( aObjectPropValue )->Value(); + PRINTV1( "Audio bit rate: %d", value ); + if ( value == 1 ) + { + result = KErrNone; + } + } + break; + case EMTPObjectPropCodeDuration: + { + TUint32 value = static_cast( aObjectPropValue )->Value(); + PRINTV1( "Duration: %d", value ); + if ( value == 1 ) + { + result = KErrNone; + } + } + break; + case EMTPObjectPropCodeOriginalReleaseDate: + { + TPtrC value = static_cast( aObjectPropValue )->StringChars(); + PRINTV1( "Original release date: '%S'", &value ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeDescription: + { + result = KErrNone; + } + break; + case EMTPObjectPropCodeComposer: + { + TPtrC value = static_cast( aObjectPropValue )->StringChars(); + PRINTV1( "Composer: '%S'", &value ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeWidth: + case EMTPObjectPropCodeHeight: + case EMTPObjectPropCodeUseCount: + case EMTPObjectPropCodeScanType: + case EMTPObjectPropCodeVideoFourCCCodec: + case EMTPObjectPropCodeVideoBitRate: + case EMTPObjectPropCodeFramesPerThousandSeconds: + case EMTPObjectPropCodeKeyFrameDistance: + case EMTPObjectPropCodeEncodingProfile: + case EMTPObjectPropCodeParentalRating: + { + result = KErrNone; + } + break; + default: + { + PRINTE1( "Unsupported prop code: %d", aPropCode ); + result = KErrArgument; + } + } + PRINTF1( "CMediaMtpDataProviderTester::GetObjectPropListL_checkresults" ); + TInt result = KErrNone; + TUint32 count = aObjectPropList->NumberOfElements(); + PRINTV1( "PropList elements received: %d", count ); + for ( TUint32 i = 0; i < count; i++ ) + { + CMTPTypeObjectPropListElement& element = aObjectPropList->Element( i ); + TUint32 handle = element.Uint32L( CMTPTypeObjectPropListElement::EObjectHandle ); + PRINTV1( "Object handle: %d", handle ); + TUint16 dataType = element.Uint16L( CMTPTypeObjectPropListElement::EDatatype ); + PRINTV1( "Data type: 0x%x", dataType ); + TUint16 propCode = element.Uint16L( CMTPTypeObjectPropListElement::EPropertyCode ); + PRINTV1( "Prop code: 0x%x", propCode ); + if ( propCode == EMTPObjectPropCodeName ) + { + if ( dataType == EMTPTypeString ) + { + TPtrC name = element.StringCharsL( CMTPTypeObjectPropListElement::EValue ); + PRINTN1( "Object name: %S", &name ); + if ( name.Match( KPropObjectName ) != 0 ) + { + PRINTE2( "Object modified date is incorrect: %S != %S", &name, &KPropObjectName ); + result = KErrGeneral; + } + } + else + { + PRINTE2( "Wrong datatype received, 0x%x != 0x%x", dataType, EMTPTypeString ); + result = KErrArgument; + } + } + } + + PRINTF1( "CMediaMtpDataProviderTester::GetObjectPropDescL_checkresults" ); + TUint16 propertyCode = aObjectPropDesc->Uint16L( CMTPTypeObjectPropDesc::EPropertyCode ); + TUint16 dataType = aObjectPropDesc->Uint16L( CMTPTypeObjectPropDesc::EDatatype ); + TUint8 getSet = aObjectPropDesc->Uint8L( CMTPTypeObjectPropDesc::EGetSet ); + TUint8 formFlag = aObjectPropDesc->Uint8L( CMTPTypeObjectPropDesc::EFormFlag ); + + TInt result = KErrNone; + + PRINTV4( "Property code: 0x%x, data type: 0x%x, form flag: 0x%x, get/set: 0x%x", propertyCode, dataType, formFlag, getSet ); + + if ( formFlag != CMTPTypeObjectPropDesc::ENone ) + { + switch ( formFlag ) + { + case CMTPTypeObjectPropDesc::ERangeForm: + PRINTV0( "Range form" ); + break; + case CMTPTypeObjectPropDesc::EEnumerationForm: + PRINTV0( "Enumeration form" ); + break; + case CMTPTypeObjectPropDesc::EDateTimeForm: + PRINTV0( "Datetime form" ); + break; + case CMTPTypeObjectPropDesc::EFixedLengthArrayForm: + PRINTV0( "Fixed length array form" ); + break; + case CMTPTypeObjectPropDesc::ERegularExpressionForm: + PRINTV0( "Regular expression form" ); + break; + case CMTPTypeObjectPropDesc::EByteArrayForm: + PRINTV0( "Byte array form" ); + break; + case CMTPTypeObjectPropDesc::ELongStringForm: + PRINTV0( "Long string form" ); + default: + { + PRINTE0( "Invalid form" ); + result = KErrArgument; + } + } + } + + switch ( aPropCode ) + { + case EMTPObjectPropCodeStorageID: + { + PRINTV0( "Storage ID" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeObjectFormat: + { + PRINTV0( "Object format" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeProtectionStatus: + { + PRINTV0( "Protection status" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeObjectSize: + { + PRINTV0( "Object size" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeObjectFileName: + { + PRINTV0( "Object file name" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeParentObject: + { + PRINTV0( "Parent object" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodePersistentUniqueObjectIdentifier: + { + PRINTV0( "Unique object identifier" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeName: + { + PRINTV0( "Name" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeNonConsumable: + { + PRINTV0( "Non consumable" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeDateAdded: + { + PRINTV0( "Date added" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeDateCreated: + { + PRINTV0( "Date created" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeDateModified: + { + PRINTV0( "Date modified" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeArtist: + { + PRINTV0( "Artist" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeTrack: + { + PRINTV0( "Track" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeGenre: + { + PRINTV0( "Genre" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeAlbumName: + { + PRINTV0( "Album name" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeSampleRate: + { + PRINTV0( "Sample rate" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeNumberOfChannels: + { + PRINTV0( "Number of channels" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeAudioWAVECodec: + { + PRINTV0( "Audio wave codec" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeAudioBitRate: + { + PRINTV0( "Audio bitrate" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeDuration: + { + PRINTV0( "Duration" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeOriginalReleaseDate: + { + PRINTV0( "Original release date" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeDescription: + { + PRINTV0( "Description" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeComposer: + { + PRINTV0( "Composer" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeWidth: + { + PRINTV0( "Width" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeHeight: + { + PRINTV0( "Height" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeUseCount: + { + PRINTV0( "Use count" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeScanType: + { + PRINTV0( "Scan type" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeVideoFourCCCodec: + { + PRINTV0( "Video 4cc codec" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeVideoBitRate: + { + PRINTV0( "Video bitrate" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeFramesPerThousandSeconds: + { + PRINTV0( "Frames per thousand seconds" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeKeyFrameDistance: + { + PRINTV0( "Key frame distance" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeEncodingProfile: + { + PRINTV0( "Encoding profile" ); + result = KErrNone; + } + break; + case EMTPObjectPropCodeParentalRating: + { + PRINTV0( "Parental rating" ); + result = KErrNone; + } + break; + default: + { + PRINTE1( "Unsupported prop code: %d", aPropCode ); + result = KErrArgument; + } + } + PRINTF1( "CMediaMtpDataProviderTester::SendObjectInfoL_prepare" ); + TBool result = ETrue; + TUint32 storageId = KTestStorageId; // physical storage + aRequest.SetUint32( TMTPTypeRequest::ERequestParameter1, storageId ); + PRINTF1( "CMediaMtpDataProviderTester::SendObjectInfoReceiveData" ); + aData->SetUint32L( CMTPTypeObjectInfo::EStorageID, KTestStorageId ); + aData->SetUint16L( CMTPTypeObjectInfo::EObjectFormat, EMTPFormatCodeMP3 ); + aData->SetStringL( CMTPTypeObjectInfo::EFilename, KSendTestObjectFile ); + aData->SetStringL( CMTPTypeObjectInfo::EDateModified, KSendTestObjectDateString ); + aData->SetUint32L( CMTPTypeObjectInfo::EObjectCompressedSize, KSendTestFileSize ); + PRINTF0( "CMediaMtpDataProviderTester::SendObjectL_prepare" ); + TBool result = ETrue; + TUint32 storageId = KTestStorageId; // physical storage + aRequest.SetUint32( TMTPTypeRequest::ERequestParameter1, storageId ); + PRINTF1( "CMediaMtpDataProviderTester::SendObjectReceiveDataL" ); + CMTPTypeFile* fileObject = CMTPTypeFile::NewL( iFsSession, + KSendTestObjectFileFullPath, EFileRead ); + CMTPTypeFile::CopyL( *fileObject, *aData ); + delete fileObject; + aData->File().Close(); + PRINTF0( "CMediaMtpDataProviderTester::SendObjectL_checkresults" ); + TInt result = KErrNone; + TEntry entry; + if ( !BaflUtils::FileExists( iFsSession, KSendTestObjectPath ) ) + { + PRINTE0( "Sent file does not exist" ); + result = KErrGeneral; + } + else + { + result = iFsSession.Entry( KSendTestObjectPath, entry ); + if ( result != KErrNone ) + { + PRINTE1( "Could not read file entry, error: %d", result ); + } + else + { + if ( entry.iSize != KSendTestFileSize ) + { + PRINTE2( "Sent file size is incorrect: %d != %d", entry.iSize, KSendTestFileSize ); + result = KErrGeneral; + } + } + } + if ( result == KErrNone ) + { + CMTPObjectMetaData* metadata = CMTPObjectMetaData::NewLC(); + iTestObserver->ObjectMgr().ObjectL( KSendTestObjectPath, *metadata ); + if ( metadata->Uint( CMTPObjectMetaData::EHandle ) <= 0 ) + { + PRINTE1( "Object handle not found: %d", metadata->Uint( CMTPObjectMetaData::EHandle ) ); + result = KErrGeneral; + } + if ( metadata->Uint( CMTPObjectMetaData::EFormatCode ) != EMTPFormatCodeMP3 ) + { + PRINTE1( "Wrong format code: %d", metadata->Uint( CMTPObjectMetaData::EFormatCode ) ); + result = KErrGeneral; + } + CleanupStack::PopAndDestroy( metadata ); + } + PRINTF1( "Type(); + switch ( propCode ) + { + case EMTPObjectPropCodeName: + if ( type != EMTPTypeString ) + { + PRINTE2( "Incorrect data type: 0x%x != 0x%x", type, EMTPTypeString ); + User::Leave( KErrArgument ); + } + static_cast( aData )->SetL( KPropObjectName ); + break; + case EMTPObjectPropCodeArtist: + if ( type != EMTPTypeString ) + { + PRINTE2( "Incorrect data type: 0x%x != 0x%x", type, EMTPTypeString ); + User::Leave( KErrArgument ); + } + static_cast( aData )->SetL( KPropObjectArtist ); + break; + case EMTPObjectPropCodeAlbumName: + if ( type != EMTPTypeString ) + { + PRINTE2( "Incorrect data type: 0x%x != 0x%x", type, EMTPTypeString ); + User::Leave( KErrArgument ); + } + static_cast( aData )->SetL( KPropObjectAlbumName ); + break; + default: + PRINTE1( "Property code not supported: 0x%x", propCode ); + User::Leave( KErrNotSupported ); + break; + } + } + +void CMediaMtpDataProviderTester::SetObjectPropListReceiveDataL( + CMTPTypeObjectPropList* aData ) + { + PRINTF0( ">CMediaMtpDataProviderTester::SetObjectPropListReceiveDataL" ); + CMTPTypeString* nameString = CMTPTypeString::NewLC( KPropObjectName ); + CMTPTypeObjectPropListElement* newElement; + newElement = CMTPTypeObjectPropListElement::NewL( 1, static_cast( EMTPObjectPropCodeName ), *nameString ); + aData->AppendL( newElement ); + newElement = CMTPTypeObjectPropListElement::NewL( 2, static_cast( EMTPObjectPropCodeName ), *nameString ); + aData->AppendL( newElement ); + newElement = CMTPTypeObjectPropListElement::NewL( 3, static_cast( EMTPObjectPropCodeName ), *nameString ); + aData->AppendL( newElement ); + CleanupStack::Pop( nameString ); + PRINTF0( "CMediaMtpDataProviderTester::DeleteObjectL_checkresults" ); + TInt result = KErrNone; + // check that everything has been deleted from the file system + if ( BaflUtils::FileExists( iFsSession, KTestObjectPath1 ) ) + { + PRINTE0( "Test file 1 was not deleted successfully" ); + result = KErrGeneral; + } + if ( BaflUtils::FileExists( iFsSession, KTestObjectPath2 ) ) + { + PRINTE0( "Test file 2 was not deleted successfully" ); + result = KErrGeneral; + } + if ( BaflUtils::FileExists( iFsSession, KTestObjectPath3 ) ) + { + PRINTE0( "Test file 3 was not deleted successfully" ); + result = KErrGeneral; + } + PRINTF1( ">CMediaMtpDataProviderTester::DeleteObjectL_checkresults result = %d", result ); + return result; + } + +TBool CMediaMtpDataProviderTester::CopyObjectL_prepare( + TMTPTypeRequest& aRequest ) + { + PRINTF0( ">CMediaMtpDataProviderTester::CopyObjectL_prepare" ); + TBool result = ETrue; + TUint32 storageId = KTestStorageId; // physical storage + aRequest.SetUint32( TMTPTypeRequest::ERequestParameter2, storageId ); + PRINTF1( "CMediaMtpDataProviderTester::CopyObjectL_checkresults" ); + TInt result = KErrNone; + if ( !BaflUtils::FileExists( iFsSession, KCopyTestObjectPath ) ) + { + PRINTE0( "Copied file does not exist" ); + result = KErrGeneral; + } + else + { + TEntry entry; + result = iFsSession.Entry( KCopyTestObjectPath, entry ); + if ( result != KErrNone ) + { + PRINTE1( "Could not read file entry, error: %d", result ); + } + else + { + if ( entry.iSize != KCopyTestFileSize ) + { + PRINTE2( "Copied file size is incorrect: %d != %d", entry.iSize, KCopyTestFileSize ); + result = KErrGeneral; + } + } + } + + if ( aMetaData ) + { + PRINTV1( "Suid: %S", &aMetaData->DesC( CMTPObjectMetaData::ESuid ) ); + + if ( aMetaData->Uint( CMTPObjectMetaData::EParentHandle ) != KMTPHandleNoParent ) + { + PRINTV1( "Parent handle = %d", aMetaData->Uint( CMTPObjectMetaData::EParentHandle ) ); + //TODO: parent handles don't work yet properly + //result = KErrGeneral; + } + + if ( aMetaData->Int( CMTPObjectMetaData::EParentId ) != KErrNotFound ) + { + PRINTV1( "Parent id = %d", aMetaData->Int( CMTPObjectMetaData::EParentId ) ); + //TODO: parent ids don't work yet properly + //result = KErrGeneral; + } + if ( aMetaData->Uint( CMTPObjectMetaData::EDataProviderId ) != 0 ) + { + PRINTV1( "Dataprovider id = %d", aMetaData->Uint( CMTPObjectMetaData::EDataProviderId ) ); + //TODO: not sure if this is necessary + //result = KErrGeneral; + } + if ( aMetaData->Uint( CMTPObjectMetaData::EFormatCode ) != EMTPFormatCodeMP3 ) + { + PRINTV1( "Format code = %d", aMetaData->Uint( CMTPObjectMetaData::EFormatCode ) ); + result = KErrGeneral; + } + if ( aMetaData->Uint( CMTPObjectMetaData::EStorageId ) != KTestStorageId ) + { + PRINTV1( "StorageId = %d ", aMetaData->Uint( CMTPObjectMetaData::EStorageId ) ); + result = KErrGeneral; + } + if ( ( aMetaData->DesC( CMTPObjectMetaData::ESuid ) ).Match( KCopyTestObjectPath ) != 0 ) + { + PRINTV0( "Copied object path incorrect" ); + result = KErrGeneral; + } + } + else + { + PRINTV0( "Object metadata not received correctly" ); + result = KErrArgument; + } + PRINTF1( "CMediaMtpDataProviderTester::MoveObjectL_prepare" ); + TBool result = ETrue; + TUint32 storageId = KTestStorageId; // physical storage + aRequest.SetUint32( TMTPTypeRequest::ERequestParameter2, storageId ); + PRINTF1( "CMediaMtpDataProviderTester::MoveObjectL_checkresults" ); + TInt result = KErrNone; + if ( BaflUtils::FileExists( iFsSession, KMoveTestObjectOldPath ) ) + { + PRINTE0( "Moved file still exists in original location" ); + result = KErrGeneral; + } + if ( !BaflUtils::FileExists( iFsSession, KMoveTestObjectNewPath ) ) + { + PRINTE0( "Moved file does not exist in new location" ); + result = KErrGeneral; + } + else + { + TEntry entry; + result = iFsSession.Entry( KMoveTestObjectNewPath, entry ); + if ( result != KErrNone ) + { + PRINTE1( "Could not read file entry, error: %d", result ); + } + else + { + if ( entry.iSize != KMoveTestFileSize ) + { + PRINTE2( "Moved file size is incorrect: %d != %d", entry.iSize, KCopyTestFileSize ); + result = KErrGeneral; + } + } + } + + if ( aMetaData ) + { + PRINTV1( "Suid: %S", &aMetaData->DesC( CMTPObjectMetaData::ESuid ) ); + + if ( aMetaData->Uint( CMTPObjectMetaData::EParentHandle ) != KMTPHandleNoParent ) + { + PRINTV1( "Parent handle = %d", aMetaData->Uint( CMTPObjectMetaData::EParentHandle ) ); + //TODO: parent handles don't work yet properly + //result = KErrGeneral; + } + + if ( aMetaData->Int( CMTPObjectMetaData::EParentId ) != KErrNotFound ) + { + PRINTV1( "Parent id = %d", aMetaData->Int( CMTPObjectMetaData::EParentId ) ); + //TODO: parent ids don't work yet properly + //result = KErrGeneral; + } + if ( aMetaData->Uint( CMTPObjectMetaData::EDataProviderId ) != 0 ) + { + PRINTV1( "Dataprovider id = %d", aMetaData->Uint( CMTPObjectMetaData::EDataProviderId ) ); + //TODO: not sure if this is necessary + //result = KErrGeneral; + } + if ( aMetaData->Uint( CMTPObjectMetaData::EFormatCode ) != EMTPFormatCodeMP3 ) + { + PRINTV1( "Format code = %d", aMetaData->Uint( CMTPObjectMetaData::EFormatCode ) ); + result = KErrGeneral; + } + if ( aMetaData->Uint( CMTPObjectMetaData::EStorageId ) != KTestStorageId ) + { + PRINTV1( "StorageId = %d ", aMetaData->Uint( CMTPObjectMetaData::EStorageId ) ); + result = KErrGeneral; + } + if ( ( aMetaData->DesC( CMTPObjectMetaData::ESuid ) ).Match( KMoveTestObjectNewPath ) != 0 ) + { + PRINTV0( "Copied object path incorrect" ); + result = KErrGeneral; + } + } + else + { + PRINTV0( "Object metadata not received correctly" ); + result = KErrArgument; + } + PRINTF1( "CMediaMtpDataProviderTester::GetPartialObjectL_checkresults" ); + // just check the handle is correct, based on the size... + TInt result = KErrNone; + if ( aObjectInfo ) + { + TInt size = aObjectInfo->Size(); + __TRACE( KPrint, ( _L("Received object size: %d"), size ) ); + if ( size != KTestFileSize ) + { + __TRACE( KError, ( _L("Wrong received object size: %d != %d" ), KTestFileSize, size ) ); + result = KErrGeneral; + } + aObjectInfo->File().Close(); + } + else + { + __TRACE( KError, ( _L("Object info not received" ) ) ); + result = KErrArgument; + } + PRINTF1( "CMediaMtpDataProviderTester::RenameObjectL_prepare" ); + TBool result = ETrue; + TFileName fileName( KRenameObjectName ); + aParam.iHandleId = KTestDirHandle; + aParam.iFileName = fileName; + + TInt moveResult = iFileMan->Move( KTestDirPath, KRenameObjectPath, + CFileMan::ERecurse ); + if ( moveResult != KErrNone ) + { + PRINTE1( "Moving directory failed with error %d", moveResult ); + } + CMTPObjectMetaData* metadata = CMTPObjectMetaData::NewLC(); + iTestObserver->ObjectMgr().ObjectL( KTestDirPath, *metadata ); + metadata->SetDesCL( CMTPObjectMetaData::ESuid, KRenameObjectPath ); + iTestObserver->ObjectMgr().ModifyObjectL( *metadata ); + CleanupStack::PopAndDestroy( metadata ); + PRINTF1( "CMediaMtpDataProviderTester::RenameObjectL_checkresults" ); + TInt result = KErrNone; + + TMTPObjectMgrQueryParams queryParams ( KMTPStorageAll, KMTPFormatsAll, KMTPHandleNone ); + RMTPObjectMgrQueryContext context; + RArray handles; + CleanupClosePushL( handles ); + + iTestObserver->ObjectMgr().GetObjectHandlesL( queryParams, context, handles ); + context.Close(); + TInt count = handles.Count(); + PRINTV1( "Handle count: %d", count ); + + CMTPObjectMetaData* metadata = CMTPObjectMetaData::NewLC(); + for ( TInt i = 0; i < count; i++ ) + { + TUint handle = handles[i]; + iTestObserver->ObjectMgr().ObjectL( handle, *metadata ); + TPtrC fileName = metadata->DesC( CMTPObjectMetaData::ESuid ); + PRINTV1( "Handle: %d", handle ); + PRINTV1( "File name: %S", &fileName ); + } + CleanupStack::PopAndDestroy( 2 ); // metadata, handles + PRINTF1( "CMediaMtpDataProviderTester::GetObjectPropsSupportedL_prepare" ); + TBool result = ETrue; + aRequest.SetUint32( TMTPTypeRequest::ERequestParameter1, EMTPFormatCodeMP3 ); + PRINTF1( "CMediaMtpDataProviderTester::GetObjectPropsSupportedL_checkresults" ); + TInt result = KErrNone; + TInt count = aObjectProps->NumElements(); + PRINTV1( "Object props found: %d", count ); + PRINTF1( "CMediaMtpDataProviderTester::ProcessRequestIllegalIdL_prepare" ); + // EMTPOpCodeGetObjectPropValue cannot be tested with the invalid session id, as the object + // must exist or the data provider fails in __ASSERT_DEBUG(aObjectInfo, Panic(EMTPPictureDpObjectNull)); + TBool result = ETrue; + if ( aOpCode == EMTPOpCodeGetObjectPropValue ) + { + result = EFalse; + } + PRINTF1( "CMediaMtpDataProviderTester::ProcessRequestIllegalIdL_checkresults" ); + TInt result = KErrGeneral; + switch (aOpCode) + { + case EMTPOpCodeGetObjectInfo: + case EMTPOpCodeGetObject: + case EMTPOpCodeGetPartialObject: + case EMTPOpCodeGetThumb: + case EMTPOpCodeDeleteObject: + case EMTPOpCodeMoveObject: + case EMTPOpCodeCopyObject: + case EMTPOpCodeGetObjectPropsSupported: + case EMTPOpCodeGetObjectPropList: + case EMTPOpCodeGetObjectReferences: + if (aResponseCode == EMTPRespCodeSessionNotOpen) + { + result = KErrNone; + } + break; + case EMTPOpCodeSendObjectInfo: + case EMTPOpCodeSendObject: + case EMTPOpCodeSetObjectPropValue: + case EMTPOpCodeSetObjectPropList: + case EMTPOpCodeSendObjectPropList: + case EMTPOpCodeSetObjectReferences: + if (aResponseCode == 0) + { + result = KErrNone; + } + break; + case EMTPOpCodeGetObjectPropDesc: + if (aResponseCode == EMTPRespCodeInvalidObjectFormatCode) + { + result = KErrNone; + } + break; + case EMTPOpCodeGetDeviceInfo: + if (aResponseCode == EMTPRespCodeInvalidTransactionID) + { + result = KErrNone; + } + break; + default: + result = KErrNone; + break; + } + PRINTF1( "CMmMtpDataProviderTester::RegisterObserver" ); + iTestObserver = aTestObserver; + iTestConnChannel = aTestConnChannel; + iDataProviderPlugin = aDataProviderPlugin; + PRINTF0( " aResponseArray ) + { + PRINTF0( "<>CMmMtpDataProviderTester::CheckSupportedL" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } + +TInt CMmMtpDataProviderTester::PrepareEnvironmentL() + { + PRINTF0( "<>CMmMtpDataProviderTester::PrepareEnvironmentL" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } + +TInt CMmMtpDataProviderTester::CleanEnvironmentL() + { + PRINTF0( "<>CMmMtpDataProviderTester::CleanEnvironmentL" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } + +TBool CMmMtpDataProviderTester::OpenSessionL_prepare( TMTPNotificationParamsSessionChange& aParam ) + { + PRINTF0( "<>CMmMtpDataProviderTester::OpenSessionL_prepare" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return ETrue; + } + +TInt CMmMtpDataProviderTester::OpenSessionL_checkresults() + { + PRINTF0( "<>CMmMtpDataProviderTester::OpenSessionL_checkresults" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } + +TBool CMmMtpDataProviderTester::CloseSessionL_prepare( TMTPNotificationParamsSessionChange& aParam ) + { + PRINTF0( "<>CMmMtpDataProviderTester::CloseSessionL_prepare" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return ETrue; + } + +TInt CMmMtpDataProviderTester::CloseSessionL_checkresults() + { + PRINTF0( "<>CMmMtpDataProviderTester::CloseSessionL_checkresults" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } + +TBool CMmMtpDataProviderTester::ObjectEnumerationL_prepare( CMTPStorageMetaData* aPhysicalStorage, CMTPStorageMetaData* aLogicalStorage ) + { + PRINTF0( "<>CMmMtpDataProviderTester::ObjectEnumerationL_prepare" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return ETrue; + } + +TInt CMmMtpDataProviderTester::ObjectEnumerationL_checkresults( MMTPObjectMgr& aObjectManager ) + { + PRINTF0( "<>CMmMtpDataProviderTester::ObjectEnumerationL_checkresults" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } + +TBool CMmMtpDataProviderTester::StorageEnumerationL_prepare() + { + PRINTF0( "<>CMmMtpDataProviderTester::StorageEnumerationL_prepare" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return ETrue; + } + +TInt CMmMtpDataProviderTester::StorageEnumerationL_checkresults( MMTPObjectMgr& aObjectManager ) + { + PRINTF0( "<>CMmMtpDataProviderTester::StorageEnumerationL_checkresults" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } + +TBool CMmMtpDataProviderTester::CancelL_prepare() + { + PRINTF0( "<>CMmMtpDataProviderTester::CancelL_prepare" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return ETrue; + } + +TInt CMmMtpDataProviderTester::CancelL_checkresults() + { + PRINTF0( "<>CMmMtpDataProviderTester::CancelL_checkresults" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } + +TBool CMmMtpDataProviderTester::GetObjectInfoL_prepare( TMTPTypeRequest& aRequest ) + { + PRINTF0( "<>CMmMtpDataProviderTester::GetObjectInfoL_prepare" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return ETrue; + } + +TInt CMmMtpDataProviderTester::GetObjectInfoL_checkresults( const CMTPTypeObjectInfo* aObjectInfo ) + { + PRINTF0( "<>CMmMtpDataProviderTester::GetObjectInfoL_checkresults" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } + +TBool CMmMtpDataProviderTester::GetObjectL_prepare( TMTPTypeRequest& aRequest ) + { + PRINTF0( "<>CMmMtpDataProviderTester::GetObjectL_prepare" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return ETrue; + } + +TInt CMmMtpDataProviderTester::GetObjectL_checkresults( CMTPTypeFile* aObjectInfo ) + { + PRINTF0( "<>CMmMtpDataProviderTester::GetObjectL_checkresults" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } + +TBool CMmMtpDataProviderTester::GetObjectPropValueL_prepare( TMTPTypeRequest& aRequest ) + { + PRINTF0( "<>CMmMtpDataProviderTester::GetObjectPropValueL_prepare" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return ETrue; + } + +TInt CMmMtpDataProviderTester::GetObjectPropValueL_checkresults( const MMTPType* aObjectInfo, const TUint aPropCode ) + { + PRINTF0( "<>CMmMtpDataProviderTester::GetObjectPropValueL_checkresults" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } + +TBool CMmMtpDataProviderTester::GetObjectPropListL_prepare( TMTPTypeRequest& aRequest ) + { + PRINTF0( "<>CMmMtpDataProviderTester::GetObjectPropListL_prepare" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return ETrue; + } + +TInt CMmMtpDataProviderTester::GetObjectPropListL_checkresults( const CMTPTypeObjectPropList* aObjectPropList ) + { + PRINTF0( "<>CMmMtpDataProviderTester::GetObjectPropListL_checkresults" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } + +TBool CMmMtpDataProviderTester::GetObjectPropDescL_prepare( TMTPTypeRequest& aRequest ) + { + PRINTF0( "<>CMmMtpDataProviderTester::GetObjectPropDescL_prepare" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return ETrue; + } + +TInt CMmMtpDataProviderTester::GetObjectPropDescL_checkresults( const CMTPTypeObjectPropDesc* aObjectPropDesc, const TUint aPropCode ) + { + PRINTF0( "<>CMmMtpDataProviderTester::GetObjectPropDescL_checkresults" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } + +TBool CMmMtpDataProviderTester::SendObjectInfoL_prepare( TMTPTypeRequest& aRequest ) + { + PRINTF0( "<>CMmMtpDataProviderTester::SendObjectInfoL_prepare" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return ETrue; + } + +void CMmMtpDataProviderTester::SendObjectInfoReceiveData( CMTPTypeObjectInfo* aData ) + { + PRINTF0( "<>CMmMtpDataProviderTester::SendObjectInfoReceiveData" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + } + +TInt CMmMtpDataProviderTester::SendObjectInfoL_checkresults() + { + PRINTF0( "<>CMmMtpDataProviderTester::SendObjectInfoL_checkresults" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } + +TBool CMmMtpDataProviderTester::SendObjectL_prepare( TMTPTypeRequest& aRequest ) + { + PRINTF0( "<>CMmMtpDataProviderTester::SendObjectL_prepare" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return ETrue; + } + +void CMmMtpDataProviderTester::SendObjectReceiveDataL( CMTPTypeFile* aData ) + { + PRINTF0( "<>CMmMtpDataProviderTester::SendObjectReceiveDataL" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + } + +TInt CMmMtpDataProviderTester::SendObjectL_checkresults() + { + PRINTF0( "<>CMmMtpDataProviderTester::SendObjectL_checkresults" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } + +TBool CMmMtpDataProviderTester::SetObjectPropValueL_prepare( TMTPTypeRequest& aRequest ) + { + PRINTF0( "<>CMmMtpDataProviderTester::SetObjectPropValueL_prepare" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return ETrue; + } + +void CMmMtpDataProviderTester::SetObjectPropValueReceiveDataL( + const TMTPTypeRequest& aRequest, MMTPType* aData ) + { + PRINTF0( "<>CMmMtpDataProviderTester::SetObjectPropValueReceiveDataL" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + } + +TInt CMmMtpDataProviderTester::SetObjectPropValueL_checkresults( const CMTPTypeObjectInfo* aObjectInfo ) + { + PRINTF0( "<>CMmMtpDataProviderTester::SetObjectPropValueL_checkresults" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } + +TBool CMmMtpDataProviderTester::SetObjectPropListL_prepare( TMTPTypeRequest& aRequest ) + { + PRINTF0( "<>CMmMtpDataProviderTester::SetObjectPropListL_prepare" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return ETrue; + } + +void CMmMtpDataProviderTester::SetObjectPropListReceiveDataL( CMTPTypeObjectPropList* aData ) + { + PRINTF0( "<>CMmMtpDataProviderTester::SetObjectPropListReceiveDataL" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + } + +TInt CMmMtpDataProviderTester::SetObjectPropListL_checkresults( const CMTPTypeObjectPropList* aObjectPropList ) + { + PRINTF0( "<>CMmMtpDataProviderTester::SetObjectPropListL_checkresults" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } + +TBool CMmMtpDataProviderTester::DeleteObjectL_prepare( TMTPTypeRequest& aRequest ) + { + PRINTF0( "<>CMmMtpDataProviderTester::DeleteObjectL_prepare" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return ETrue; + } + +TInt CMmMtpDataProviderTester::DeleteObjectL_checkresults( MMTPObjectMgr& aObjectManager ) + { + PRINTF0( "<>CMmMtpDataProviderTester::DeleteObjectL_checkresults" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } + +TBool CMmMtpDataProviderTester::CopyObjectL_prepare( TMTPTypeRequest& aRequest ) + { + PRINTF0( "<>CMmMtpDataProviderTester::CopyObjectL_prepare" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return ETrue; + } + +TInt CMmMtpDataProviderTester::CopyObjectL_checkresults( const CMTPObjectMetaData* aMetaData ) + { + PRINTF0( "<>CMmMtpDataProviderTester::CopyObjectL_checkresults" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } + +TBool CMmMtpDataProviderTester::MoveObjectL_prepare( TMTPTypeRequest& aRequest ) + { + PRINTF0( "<>CMmMtpDataProviderTester::MoveObjectL_prepare" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return ETrue; + } + +TInt CMmMtpDataProviderTester::RenameObjectL_checkresults( const CMTPObjectMetaData* aMetaData ) + { + PRINTF0( "<>CMmMtpDataProviderTester::RenameObjectL_checkresults" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } + +TBool CMmMtpDataProviderTester::RenameObjectL_prepare( TMTPNotificationParamsHandle& aParam ) + { + PRINTF0( "<>CMmMtpDataProviderTester::RenameObjectL_prepare" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return ETrue; + } + +TInt CMmMtpDataProviderTester::MoveObjectL_checkresults( const CMTPObjectMetaData* aMetaData ) + { + PRINTF0( "<>CMmMtpDataProviderTester::MoveObjectL_checkresults" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } + +TBool CMmMtpDataProviderTester::GetPartialObjectL_prepare( TMTPTypeRequest& aRequest ) + { + PRINTF0( "<>CMmMtpDataProviderTester::GetPartialObjectL_prepare" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return ETrue; + } + +TInt CMmMtpDataProviderTester::GetPartialObjectL_checkresults() + { + PRINTF0( "<>CMmMtpDataProviderTester::GetPartialObjectL_checkresults" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } + +TBool CMmMtpDataProviderTester::GetObjectReferencesL_prepare( TMTPTypeRequest& aRequest ) + { + PRINTF0( "<>CMmMtpDataProviderTester::GetObjectReferencesL_prepare" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return ETrue; + } + +TInt CMmMtpDataProviderTester::GetObjectReferencesL_checkresults() + { + PRINTF0( "<>CMmMtpDataProviderTester::GetObjectReferencesL_checkresults" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } + +TBool CMmMtpDataProviderTester::SetObjectReferencesL_prepare( TMTPTypeRequest& aRequest ) + { + PRINTF0( "<>CMmMtpDataProviderTester::SetObjectReferencesL_prepare" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return ETrue; + } + +TInt CMmMtpDataProviderTester::SetObjectReferencesL_checkresults() + { + PRINTF0( "<>CMmMtpDataProviderTester::SetObjectReferencesL_checkresults" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } + +TBool CMmMtpDataProviderTester::GetObjectPropsSupportedL_prepare( TMTPTypeRequest& aRequest ) + { + PRINTF0( "<>CMmMtpDataProviderTester::GetObjectPropsSupportedL_prepare" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return ETrue; + } + +TInt CMmMtpDataProviderTester::GetObjectPropsSupportedL_checkresults( const CMTPTypeArray* aObjectProps ) + { + PRINTF0( "<>CMmMtpDataProviderTester::GetObjectPropsSupportedL_checkresults" ); + PRINTE0( "DUMMY IMPLEMENTATION" ); + return KErrNone; + } diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/src/cmmmtpdataprovidertestmodule.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/src/cmmmtpdataprovidertestmodule.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,133 @@ +/* +* 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: Test module for mmmtpdataprovider plugin +* +*/ + + +// INCLUDE FILES + +#include +#include +#include +#include +#include "cmmmtpdataprovidertestmodule.h" +#include "logging.h" + +// MACROS + +#ifdef LOGGER +#undef LOGGER +#endif +#define LOGGER iLog + +// MEMBER FUNCTIONS + +CMmMtpDataProviderTestModule::CMmMtpDataProviderTestModule( + CTestModuleIf& aTestModuleIf ) + : CScriptBase( aTestModuleIf ) + { + // no implementation required + } + +void CMmMtpDataProviderTestModule::ConstructL() + { + TFileName logFileName; + logFileName.Copy(KMtpDataProviderTestModuleLogFile); + + iLog = CStifLogger::NewL( KMtpDataProviderTestModuleLogPath, + logFileName, + CStifLogger::ETxt, + TRACE_TARGET, + ETrue, ETrue, ETrue, EFalse, ETrue ); + PRINTF0( ">CMmMtpDataProviderTestModule::ConstructL" ); + + SendTestClassVersion(); + + if ( CActiveScheduler::Current() == NULL ) + { + iActiveScheduler = new ( ELeave ) CActiveScheduler; + CActiveScheduler::Install( iActiveScheduler ); + } + iTestObserver = CTestObserver::NewL( this ); + iTestConnChannel = new ( ELeave ) CTestConnectionChannel(); + iRequest = new ( ELeave ) TMTPTypeRequest(); + + PRINTF0( "ConstructL(); + CleanupStack::Pop(); + + return self; + } + +CMmMtpDataProviderTestModule::~CMmMtpDataProviderTestModule() + { + PRINTF0( ">CMmMtpDataProviderTestModule::~CMmMtpDataProviderTestModule" ); + + // delete resources allocated from test methods + Delete(); + + if ( iTestObserver ) + { + delete iTestObserver; + } + if ( iTestConnChannel ) + { + delete iTestConnChannel; + } + if ( iActiveScheduler ) + { + delete iActiveScheduler; + } + + PRINTF0( "CMmMtpDataProviderTestModule::SendTestClassVersion" ); + TVersion moduleVersion; + moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; + moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; + moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; + + _LIT( KModuleName, "mmmtpdataprovidertester.dll" ); + TFileName moduleName( KModuleName ); + + TBool newVersionOfMethod = ETrue; + TestModuleIf().SendTestModuleVersion( moduleVersion, moduleName, + newVersionOfMethod ); + PRINTF0( " +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cmmmtpdataprovidertestmodule.h" +#include "cmmmtpdataprovidertester.h" +#include "cmediamtpdataprovidertester.h" +#include "cabstractmediamtpdataprovidertester.h" +#include "logging.h" + +// MACROS + +#ifdef LOGGER +#undef LOGGER +#endif +#define LOGGER iLog +#ifdef PRINTTESTMODULEIF +#undef PRINTTESTMODULEIF +#endif +#define PRINTTESTMODULEIF( p ) TestModuleIf().Printf( 0, KTestModuleName, p ); +#ifdef PRINTTESTMODULE +#undef PRINTTESTMODULE +#endif +#define PRINTTESTMODULE( p ) this->SetResultDescription( p ); + +// MEMBER FUNCTIONS + +void CMmMtpDataProviderTestModule::Delete() + { + PRINTF0( ">CMmMtpDataProviderTestModule::Delete()" ); + delete iDataProviderPlugin; + delete iPluginTester; + + if ( iRequest != NULL ) + { + PRINTN0( "Delete request" ); + delete iRequest; + } + REComSession::FinalClose(); + PRINTF0( "CMmMtpDataProviderTestModule::RunMethodL" ); + + 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( "LoadPlugin", CMmMtpDataProviderTestModule::LoadPluginL ), + ENTRY( "PrepareEnvironment", CMmMtpDataProviderTestModule::PrepareEnvironmentL ), + ENTRY( "CleanEnvironment", CMmMtpDataProviderTestModule::CleanEnvironmentL ), + ENTRY( "OpenSession", CMmMtpDataProviderTestModule::OpenSessionL ), + ENTRY( "CloseSession", CMmMtpDataProviderTestModule::CloseSessionL ), + ENTRY( "ObjectEnumeration", CMmMtpDataProviderTestModule::ObjectEnumerationL ), + ENTRY( "StorageEnumeration", CMmMtpDataProviderTestModule::StorageEnumerationL ), + ENTRY( "StartTransaction", CMmMtpDataProviderTestModule::StartTransactionL ), + ENTRY( "CancelTransaction", CMmMtpDataProviderTestModule::CancelTransactionL ), + ENTRY( "CompleteTransaction", CMmMtpDataProviderTestModule::CompleteTransactionL ), + ENTRY( "GetObjectInfo", CMmMtpDataProviderTestModule::GetObjectInfoL ), + ENTRY( "GetObject", CMmMtpDataProviderTestModule::GetObjectL ), + ENTRY( "GetObjectPropValue", CMmMtpDataProviderTestModule::GetObjectPropValueL ), + ENTRY( "GetObjectPropList", CMmMtpDataProviderTestModule::GetObjectPropListL ), + ENTRY( "GetObjectPropDesc", CMmMtpDataProviderTestModule::GetObjectPropDescL ), + ENTRY( "SendObjectInfo", CMmMtpDataProviderTestModule::SendObjectInfoL ), + ENTRY( "SendObject", CMmMtpDataProviderTestModule::SendObjectL ), + ENTRY( "SetObjectPropValue", CMmMtpDataProviderTestModule::SetObjectPropValueL ), + ENTRY( "SetObjectPropList", CMmMtpDataProviderTestModule::SetObjectPropListL ), + ENTRY( "DeleteObject", CMmMtpDataProviderTestModule::DeleteObjectL ), + ENTRY( "CopyObject", CMmMtpDataProviderTestModule::CopyObjectL ), + ENTRY( "MoveObject", CMmMtpDataProviderTestModule::MoveObjectL ), + ENTRY( "RenameObject", CMmMtpDataProviderTestModule::RenameObjectL ), + ENTRY( "GetPartialObject", CMmMtpDataProviderTestModule::GetPartialObjectL ), + ENTRY( "SetObjectReferences", CMmMtpDataProviderTestModule::SetObjectReferencesL ), + ENTRY( "GetObjectReferences", CMmMtpDataProviderTestModule::GetObjectReferencesL ), + ENTRY( "GetObjectPropsSupported", CMmMtpDataProviderTestModule::GetObjectPropsSupportedL) + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + TInt result = RunInternalL( KFunctions, count, aItem ); + PRINTF1( "RegisterObserver( iTestObserver, iTestConnChannel, iDataProviderPlugin ); + } + else + { + PRINTE0( "Missing parameter: plugin name" ); + result = KErrArgument; + } + + PRINTN1( "Exiting LoadPluginL with result %d", result ); + return result; + } + +TInt CMmMtpDataProviderTestModule::PrepareEnvironmentL( CStifItemParser& /*aItem*/ ) + { + PRINTM0( "PrepareEnvironment" ); + + TInt result = iPluginTester->PrepareEnvironmentL(); + if ( result != KErrNone ) + { + PRINTE0( "Preparing environment failed" ); + } + PRINTN1( "Exiting PrepareEnvironmentL with result %d", result ); + return result; + } + +TInt CMmMtpDataProviderTestModule::CleanEnvironmentL( CStifItemParser& /*aItem*/ ) + { + PRINTM0( "CleanEnvironment" ); + + TInt result = iPluginTester->CleanEnvironmentL(); + if ( result != KErrNone ) + { + PRINTE0( "Cleaning environment failed" ); + } + PRINTN1( "Exiting CleanEnvironmentL with result %d", result ); + return result; + } + +TInt CMmMtpDataProviderTestModule::OpenSessionL ( CStifItemParser& aItem ) + { + PRINTM0( "OpenSession" ); + + TInt result = KErrNone; + if ( iSessionOpen ) + { + PRINTE0( "OpenSession failed, session already open" ); + result = KErrNotReady; + } + else + { + iSessionId++; + TInt sessionId; + result = aItem.GetNextInt ( sessionId ); + if ( result == KErrNone ) + { + PRINTN1( "Got session id parameter: %d", sessionId ); + iSessionId = sessionId; + } + else + { + PRINTN1( "GetNextInt returned %d", result ); + } + + TMTPNotificationParamsSessionChange param = { iSessionId, *iTestConnChannel } ; + if ( iPluginTester->OpenSessionL_prepare( param ) ) + { + iDataProviderPlugin->ProcessNotificationL( EMTPSessionOpened, ¶m ); + result = iPluginTester->OpenSessionL_checkresults(); + if ( result == KErrNone ) + { + iSessionOpen = ETrue; + } + else + { + PRINTE0( "OpenSession result check failed" ); + } + } + else + { + PRINTE0( "OpenSession prepare phase failed" ); + result = KErrGeneral; + } + } + + PRINTN1( "Exiting OpenSession with result %d", result ); + return result; + } + +TInt CMmMtpDataProviderTestModule::CloseSessionL ( CStifItemParser& aItem ) + { + PRINTM0( "CloseSession" ); + + TInt result = KErrNone; + if ( !iSessionOpen ) + { + PRINTE0( "CloseSession failed, session not open" ); + result = KErrNotReady; + } + else + { + TMTPNotificationParamsSessionChange param = { iSessionId, *iTestConnChannel }; + if ( iPluginTester->CloseSessionL_prepare( param ) ) + { + iDataProviderPlugin->ProcessNotificationL( EMTPSessionClosed, ¶m ); + result = iPluginTester->CloseSessionL_checkresults(); + if ( result == KErrNone ) + { + iSessionId = 0; + iSessionOpen = EFalse; + iTransactionId = 0; // start transaction numbering from beginning + iTransactionOpen = EFalse; + } + else + { + PRINTE0( "CloseSession result check failed" ); + } + } + else + { + PRINTE0( "CloseSession prepare phase failed" ); + result = KErrGeneral; + } + } + PRINTN1( "Exiting CloseSession with result %d", result ); + return result; + } + +TInt CMmMtpDataProviderTestModule::ObjectEnumerationL( CStifItemParser& /*aItem*/ ) + { + PRINTM0( "ObjectEnumeration" ); + + TInt result = KErrNotReady; + + TBool complete = iTestObserver->ObjectEnumerationComplete(); + if ( complete == EFalse ) + { + CMTPStorageMetaData* physicalStorage( CMTPStorageMetaData::NewLC() ); + CMTPStorageMetaData* logicalStorage( CMTPStorageMetaData::NewLC() ); + if ( iPluginTester->ObjectEnumerationL_prepare( physicalStorage, logicalStorage ) ) + { + TUint32 physicalStorageId; + physicalStorageId = iTestObserver->StorageMgr().AllocatePhysicalStorageIdL( 0, *physicalStorage ); + physicalStorage->SetUint( CMTPStorageMetaData::EStorageId, physicalStorageId ); + TUint32 logicalStorageId; + TRAP_IGNORE( logicalStorageId = iTestObserver->StorageMgr().AllocateLogicalStorageIdL( 0, physicalStorageId, *logicalStorage ) ); + logicalStorage->SetUint( CMTPStorageMetaData::EStorageId, logicalStorageId ); + iTestObserver->SetPendingOperation( CTestObserver::EObjectEnumeration ); + iDataProviderPlugin->StartObjectEnumerationL( KMTPStorageAll ); + iTestObserver->WaitForPendingOperation(); + result = iPluginTester->ObjectEnumerationL_checkresults( iTestObserver->ObjectMgr() ); + if ( result != KErrNone ) + { + PRINTE0( "ObjectEnumeration result check failed" ); + } + } + else + { + PRINTE0 ( "ObjectEnumeration prepare phase failed" ); + result = KErrGeneral; + } + CleanupStack::PopAndDestroy( 2 ); // logicalStorage, physicalStorage + } + else + { + PRINTE0( "Object enumeration already run in this session" ); + result = KErrGeneral; + } + + PRINTN1( "Exiting ObjectEnumerationL with result %d", result ); + return result; + } + +TInt CMmMtpDataProviderTestModule::StorageEnumerationL( CStifItemParser& /*aItem*/ ) + { + PRINTM0( "StorageEnumeration" ); + + TInt result = KErrNotReady; + TBool complete = iTestObserver->StorageEnumerationComplete(); + if ( complete == EFalse ) + { + if ( iPluginTester->StorageEnumerationL_prepare() ) + { + iDataProviderPlugin->StartStorageEnumerationL(); + complete = iTestObserver->StorageEnumerationComplete(); + if (complete) + { + result = KErrNone; + } + } + else + { + PRINTE0( "StartStorageEnumeration prepare phase failed" ); + result = KErrGeneral; + } + } + else + { + PRINTE0( "Storage enumeration already run in this session" ); + result = KErrGeneral; + } + return result; + } + +TInt CMmMtpDataProviderTestModule::StartTransactionL( CStifItemParser& aItem ) + { + PRINTM0( "StartTransaction" ); + + TInt result = KErrNone; + if ( iSessionOpen ) + { + if ( iTransactionOpen ) + { + PRINTE0( "StartTransaction failed, transaction already open" ); + result = KErrGeneral; + } + else + { + if ( iRequest != NULL ) + { + PRINTN0( "Delete previous request" ); + delete iRequest; + iRequest = NULL; + } + iRequest = new TMTPTypeRequest(); + iTransactionId++; + iTransactionOpen = ETrue; + iTestObserver->SetPhaseL( EUndefined ); + } + } + else + { + PRINTE0( "StartTransaction failed, session not open" ); + result = KErrNotReady; + } + + PRINTN1( "Exiting StartTransactionL with result %d", result ); + return result; + } + +// Notify that the current transaction has been cancelled. +// Affects: +// Response code of GetObject response phase +// Also default response code of other operations +// (EMTPRespCodeIncompleteTransfer) +// Outcome of SendObject/SendObjectInfo (should rollback) +TInt CMmMtpDataProviderTestModule::CancelTransactionL( CStifItemParser& /*aItem*/ ) + { + PRINTM0( "CancelTransaction" ); + + TInt result = KErrNone; + iTransactionOpen = EFalse; + TMTPTypeEvent eventDataSet; + eventDataSet.SetUint16( TMTPTypeEvent::EEventCode, EMTPEventCodeCancelTransaction ); + iDataProviderPlugin->ProcessEventL( eventDataSet, *iTestConnChannel ); + + PRINTN1( "Exiting CancelTransactionL with result %d", result ); + return result; + } + +TInt CMmMtpDataProviderTestModule::CompleteTransactionL( CStifItemParser& aItem ) + { + PRINTM0( "CompleteTransaction" ); + + TInt result = KErrNone; + if ( iSessionOpen ) + { + if ( !iTransactionOpen ) + { + PRINTE0( "CompleteTransaction failed, transaction not open" ); + result = KErrNotReady; + } + else + { + iTransactionOpen = EFalse; + TMTPTransactionPhase phase = iTestObserver->SetPhaseL( ECompletingPhase ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + } + } + else + { + PRINTE0( "CompleteTransaction failed, session not open" ); + result = KErrNotReady; + } + return result; + } + +TInt CMmMtpDataProviderTestModule::GetObjectInfoL( CStifItemParser& /*aItem*/ ) + { + PRINTM0( "GetObjectInfo" ); + + if ( !iTransactionOpen ) + { + PRINTE0( "Running GetObjectInfo without open transaction" ); + return KErrGeneral; + } + + TMTPTransactionPhase phase; + TInt result = KErrNone; + + iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); + iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); + TUint32 objectHandle = 2; + iRequest->SetUint32( TMTPTypeRequest::ERequestParameter1, objectHandle ); + iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeGetObjectInfo ); + + if ( iPluginTester->GetObjectInfoL_prepare( *iRequest ) ) + { + phase = iTestObserver->SetPhaseL( ERequestPhase ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + phase = iTestObserver->SetPhaseL( EResponsePhase ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) + { + PRINTE0( "GetObjectInfo request failed" ); + PRINTE1( "Response code: 0x%x" , iTestObserver->iResponseCode ); + result = KErrGeneral; + } + else + { + result = iPluginTester->GetObjectInfoL_checkresults( static_cast ( iTestObserver->iMMTPTypeData ) ); + if ( result != KErrNone ) + { + PRINTE0( "GetObjectInfo result check failed" ); + } + } + } + else + { + PRINTE0( "GetObjectInfo prepare phase failed" ); + result = KErrGeneral; + } + + PRINTN1( "Exiting GetObjectInfoL with result %d", result ); + return result; + } + +TInt CMmMtpDataProviderTestModule::GetObjectL( CStifItemParser& /*aItem*/ ) + { + PRINTM0( "GetObject" ); + + if ( !iTransactionOpen ) + { + PRINTE0( "Running GetObject without open transaction" ); + return KErrGeneral; + } + + TMTPTransactionPhase phase; + TInt result = KErrNone; + + iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); + iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); + TUint32 objectHandle = 2; + iRequest->SetUint32( TMTPTypeRequest::ERequestParameter1, objectHandle ); + iRequest->SetUint32( TMTPTypeRequest::ERequestParameter2, KMTPFormatsAll ); + iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeGetObject ); + + if ( iPluginTester->GetObjectL_prepare( *iRequest ) ) + { + phase = iTestObserver->SetPhaseL( ERequestPhase ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + phase = iTestObserver->SetPhaseL( EResponsePhase ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) + { + PRINTE0( "GetObjectInfo request failed" ); + PRINTE1( "Response code: 0x%x" , iTestObserver->iResponseCode ); + result = KErrGeneral; + } + else + { + result = iPluginTester->GetObjectL_checkresults( const_cast( static_cast( iTestObserver->iMMTPTypeData ) ) ); + if ( result != KErrNone ) + { + PRINTE0( "GetObject result check failed" ); + } + } + } + else + { + result = KErrGeneral; + PRINTE0( "GetObject prepare phase failed" ); + } + + PRINTN1( "Exiting GetObjectL with result %d", result ); + return result; + } + +TInt CMmMtpDataProviderTestModule::GetObjectPropValueL( CStifItemParser& aItem ) + { + PRINTM0( "GetObjectPropValue" ); + + TMTPTransactionPhase phase; + TInt result = KErrNone; + + // get supported properties and test with them all + RArray properties; + iDataProviderPlugin->Supported( EObjectProperties, properties ); + + for ( TInt i = 0; i < properties.Count(); i++ ) + { + switch ( properties[i] ) + { + //case EMTPObjectPropCodeObjectFileName: // 0xDC07 + case EMTPObjectPropCodeName: // 0xDC44 + case EMTPObjectPropCodeArtist: // 0xDC46 + //case EMTPObjectPropCodeGenre: // 0xDC8C + //case EMTPObjectPropCodeParentalRating: // 0xDC94 + //case EMTPObjectPropCodeComposer: // 0xDC96 + //case EMTPObjectPropCodeOriginalReleaseDate: // 0xDC99 + case EMTPObjectPropCodeAlbumName: // 0xDC9A + //case EMTPObjectPropCodeEncodingProfile: // 0xDEA1 + //case EMTPObjectPropCodeDescription: + //case EMTPObjectPropCodeWidth: // 0xDC87 + //case EMTPObjectPropCodeHeight: // 0xDC88 + //case EMTPObjectPropCodeDuration: // 0xDC89 + //case EMTPObjectPropCodeUseCount: // 0xDC91 + //case EMTPObjectPropCodeSampleRate: // 0xDE93 + //case EMTPObjectPropCodeAudioWAVECodec: // 0xDE99 + //case EMTPObjectPropCodeAudioBitRate: // 0xDE9A + //case EMTPObjectPropCodeVideoFourCCCodec: // 0xDE9B + //case EMTPObjectPropCodeVideoBitRate: // 0xDE9C + //case EMTPObjectPropCodeFramesPerThousandSeconds: // 0xDE9D + //case EMTPObjectPropCodeKeyFrameDistance: // 0xDE9E + //case EMTPObjectPropCodeTrack: // 0xDC8B + //case EMTPObjectPropCodeDRMStatus: // 0xDC9D + //case EMTPObjectPropCodeNumberOfChannels: // 0xDE94 + //case EMTPObjectPropCodeScanType: // 0xDE97 + //case EMTPExtObjectPropCodeOmaDrmStatus: + result = StartTransactionL( aItem ); + if ( result != KErrNone ) + { + break; // transaction cycle is broken, better to abort + } + iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); + iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); + TUint32 objectHandle = 2; + iRequest->SetUint32( TMTPTypeRequest::ERequestParameter1, objectHandle ); + iRequest->SetUint32( TMTPTypeRequest::ERequestParameter2, properties[i] ); + iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeGetObjectPropValue ); + + if ( iPluginTester->GetObjectPropValueL_prepare( *iRequest ) ) + { + phase = iTestObserver->SetPhaseL( ERequestPhase ); + PRINTV1( "Testing with property 0x%x" , properties[i] ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + phase = iTestObserver->SetPhaseL( EResponsePhase ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) + { + if ( iTestObserver->iResponseCode == EMTPRespCodeAccessDenied ) + { + PRINTN1( "Could not access value for property 0x%x", properties[i] ); + } + else + { + PRINTE0( "GetObjectPropValue request failed" ); + PRINTE2( "Property code: 0x%x, response code: 0x%x", properties[i], iTestObserver->iResponseCode ); + result = KErrGeneral; + } + } + else + { + result = iPluginTester->GetObjectPropValueL_checkresults( iTestObserver->iMMTPTypeData, properties[i] ); + if ( result != KErrNone ) + { + PRINTE0( "GetObjectPropValue result check failed" ); + } + } + } + else + { + PRINTE0( "GetObjectPropValue prepare phase failed" ); + result = KErrGeneral; + } + + result = CompleteTransactionL( aItem ); + break; + } + // don't allow errors in any request + if ( result != KErrNone ) + { + break; + } + } + properties.Close(); + PRINTN1( "Exiting GetObjectPropValueL with result %d", result ); + return result; + } + +TInt CMmMtpDataProviderTestModule::GetObjectPropListL( CStifItemParser& aItem ) + { + PRINTM0( "GetObjectPropList" ); + + if ( !iTransactionOpen ) + { + PRINTE0( "Running GetObjectPropList without open transaction" ); + return KErrGeneral; + } + + TMTPTransactionPhase phase; + TInt result = KErrNone; + + iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); + iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); + iRequest->SetUint32( TMTPTypeRequest::ERequestParameter1, KMTPHandleAll ); + iRequest->SetUint32( TMTPTypeRequest::ERequestParameter2, KMTPFormatsAll ); + iRequest->SetUint32( TMTPTypeRequest::ERequestParameter3, EMTPObjectPropCodeUndefined ); + iRequest->SetUint32( TMTPTypeRequest::ERequestParameter4, 0x00FF0000 ); // mediadb group + iRequest->SetUint32( TMTPTypeRequest::ERequestParameter5, 0 ); // depth + iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeGetObjectPropList ); + + if ( iPluginTester->GetObjectPropListL_prepare( *iRequest ) ) + { + phase = iTestObserver->SetPhaseL( ERequestPhase ); + iTestObserver->SetPendingOperation( CTestObserver::EGetObjectPropList ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + result = iTestObserver->WaitForPendingOperation(); + if ( result != KErrNone ) + { + PRINTE0( "GetObjectPropList asynchronous operation failed" ); + } + else + { + phase = iTestObserver->SetPhaseL( EResponsePhase ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) + { + PRINTE0( "GetObjectPropList request failed" ); + PRINTE1( "Response code: 0x%x", iTestObserver->iResponseCode ); + result = KErrGeneral; + } + else + { + result = iPluginTester->GetObjectPropListL_checkresults( static_cast( iTestObserver->iMMTPTypeData ) ); + if ( result != KErrNone ) + { + PRINTE0( "GetObjectPropList result check failed" ); + } + } + } + } + else + { + PRINTE0( "GetObjectPropList prepare phase failed" ); + result = KErrGeneral; + } + + PRINTN1( "Exiting GetObjectPropList with result %d", result ); + return result; + } + +TInt CMmMtpDataProviderTestModule::GetObjectPropDescL( CStifItemParser& aItem ) + { + PRINTM0( "GetObjectPropDesc" ); + + TMTPTransactionPhase phase; + TInt result = KErrNone; + + // get supported properties and test with them all + RArray properties; + iDataProviderPlugin->Supported( EObjectProperties, properties ); + + for ( TInt i = 0; i < properties.Count(); i++ ) + { + if ( properties[i] < 0xde99 ) // some problem with these + { + result = StartTransactionL( aItem ); + if ( result != KErrNone ) + { + break; // transaction cycle is broken, better to abort + } + iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); + iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); + iRequest->SetUint32( TMTPTypeRequest::ERequestParameter2, KMTPFormatsAll ); + iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeGetObjectPropDesc ); + iRequest->SetUint32( TMTPTypeRequest::ERequestParameter1, properties[i] ); + TInt result = KErrNone; + if ( iPluginTester->GetObjectPropDescL_prepare( *iRequest ) ) + { + phase = iTestObserver->SetPhaseL( ERequestPhase ); + PRINTV1( "Testing with property 0x%x", properties[i] ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + phase = iTestObserver->SetPhaseL( EResponsePhase ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) + { + PRINTE0( "GetObjectPropDesc request failed") + PRINTE2( "Property code: 0x%x, response code: 0x%x", properties[i], iTestObserver->iResponseCode ); + result = KErrGeneral; + } + else + { + result = iPluginTester->GetObjectPropDescL_checkresults( static_cast( iTestObserver->iMMTPTypeData ), properties[i] ); + if ( result != KErrNone ) + { + PRINTE0( "GetObjectPropDesc result check failed" ); + } + } + } + else + { + PRINTE0( "GetObjectPropValue prepare phase failed" ); + } + + result = CompleteTransactionL( aItem ); + // don't allow errors in any request + if ( result != KErrNone ) + { + break; + } + } + } + properties.Close(); + + PRINTN1( "Exiting GetObjectPropValueL with result %d", result ); + return result; + } + +TInt CMmMtpDataProviderTestModule::SendObjectInfoL( CStifItemParser& /*aItem*/ ) + { + PRINTM0( "SendObjectInfo" ); + + if ( !iTransactionOpen ) + { + PRINTE0( "Running SendObjectInfo without open transaction" ); + return KErrGeneral; + } + + TMTPTransactionPhase phase; + TInt result = KErrNone; + + iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); + iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); + TUint32 objectHandle = 0; // send to storage root + iRequest->SetUint32( TMTPTypeRequest::ERequestParameter2, objectHandle ); + iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeSendObjectInfo ); + + if ( iPluginTester->SendObjectInfoL_prepare( *iRequest ) ) + { + phase = iTestObserver->SetPhaseL( ERequestPhase ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + phase = iTestObserver->SetPhaseL( EResponsePhase ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) + { + PRINTE0( "SendObjectInfo request failed" ) + PRINTE1( "Response code: 0x%x", iTestObserver->iResponseCode ); + result = KErrGeneral; + } + else + { + result = iPluginTester->SendObjectInfoL_checkresults(); + if ( result != KErrNone ) + { + PRINTE0( "SendObjectInfo result check failed" ); + } + } + } + else + { + PRINTE0( "SendObjectInfo prepare phase failed" ); + result = KErrGeneral; + } + + PRINTN1( "Exiting SendObjectInfoL with result %d", result ); + return result; + } + +TInt CMmMtpDataProviderTestModule::SendObjectL( CStifItemParser& /*aItem*/ ) + { + PRINTM0( "SendObject" ); + + if ( !iTransactionOpen ) + { + PRINTE0( "Running SendObject without open transaction" ); + return KErrGeneral; + } + + TMTPTransactionPhase phase; + TInt result = KErrNone; + + iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); + // the transaction id should be one greater than the id for send object info + iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); + // parameter 1 (storage id) is set in prepare function + TUint32 objectHandle = 0; // send to storage root + iRequest->SetUint32(TMTPTypeRequest::ERequestParameter2, objectHandle ); + iRequest->SetUint16(TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeSendObject ); + + if ( iPluginTester->SendObjectL_prepare( *iRequest ) ) + { + phase = iTestObserver->SetPhaseL( ERequestPhase ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + phase = iTestObserver->SetPhaseL( EResponsePhase ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) + { + PRINTE0( "SendObject request failed" ); + PRINTE1( "Response code: 0x%x", iTestObserver->iResponseCode ); + result = KErrArgument; + } + else + { + result = iPluginTester->SendObjectL_checkresults(); + if ( result != KErrNone ) + { + PRINTE0( "SendObject result check failed" ); + } + } + } + else + { + PRINTE0( "SendObject prepare phase failed" ); + result = KErrGeneral; + } + + PRINTN1( "Exiting SendObject with result %d", result ); + return result; + } + +TInt CMmMtpDataProviderTestModule::SetObjectPropValueL( CStifItemParser& aItem ) + { + PRINTM0( "SetObjectPropValue" ); + + TMTPTransactionPhase phase = ERequestPhase; + TInt result = KErrNone; + + // get supported properties and test with them all + RArray properties; + iDataProviderPlugin->Supported( EObjectProperties, properties ); + + for ( TInt i = 0; i < properties.Count(); i++ ) + { + switch ( properties[i] ) + { + //case EMTPObjectPropCodeObjectFileName: // 0xDC07 + case EMTPObjectPropCodeName: // 0xDC44 + case EMTPObjectPropCodeArtist: // 0xDC46 + //case EMTPObjectPropCodeGenre: // 0xDC8C + //case EMTPObjectPropCodeParentalRating: // 0xDC94 + //case EMTPObjectPropCodeComposer: // 0xDC96 + //case EMTPObjectPropCodeOriginalReleaseDate: // 0xDC99 + case EMTPObjectPropCodeAlbumName: // 0xDC9A + //case EMTPObjectPropCodeEncodingProfile: // 0xDEA1 + //case EMTPObjectPropCodeDescription: + //case EMTPObjectPropCodeWidth: // 0xDC87 + //case EMTPObjectPropCodeHeight: // 0xDC88 + //case EMTPObjectPropCodeDuration: // 0xDC89 + //case EMTPObjectPropCodeUseCount: // 0xDC91 + //case EMTPObjectPropCodeSampleRate: // 0xDE93 + //case EMTPObjectPropCodeAudioWAVECodec: // 0xDE99 + //case EMTPObjectPropCodeAudioBitRate: // 0xDE9A + //case EMTPObjectPropCodeVideoFourCCCodec: // 0xDE9B + //case EMTPObjectPropCodeFramesPerThousandSeconds: // 0xDE9D + //case EMTPObjectPropCodeKeyFrameDistance: // 0xDE9E + //case EMTPObjectPropCodeTrack: // 0xDC8B + //case EMTPObjectPropCodeDRMStatus: // 0xDC9D + //case EMTPObjectPropCodeNumberOfChannels: // 0xDE94 + //case EMTPObjectPropCodeScanType: // 0xDE97 + //case EMTPExtObjectPropCodeOmaDrmStatus: + result = StartTransactionL( aItem ); + if ( result != KErrNone ) + { + break; // transaction cycle is broken, better to abort + } + iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); + iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); + TUint32 objectHandle = 2; + iRequest->SetUint32( TMTPTypeRequest::ERequestParameter1, objectHandle ); + iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeSetObjectPropValue ); + + iRequest->SetUint32( TMTPTypeRequest::ERequestParameter2, properties[i] ); + TInt result = KErrNone; + if ( iPluginTester->SetObjectPropValueL_prepare( *iRequest ) ) + { + phase = iTestObserver->SetPhaseL( ERequestPhase ); + PRINTV1( "Testing with property 0x%x", properties[i] ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + phase = iTestObserver->SetPhaseL( EResponsePhase ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) + { + PRINTE0( "SetObjectPropValue request failed" ); + PRINTE2( "Property code: 0x%x, response code: 0x%x", properties[i], iTestObserver->iResponseCode ); + result = KErrGeneral; + } + else + { + result = iPluginTester->SetObjectPropValueL_checkresults( static_cast ( iTestObserver->iMMTPTypeData ) ); + if ( result != KErrNone ) + { + PRINTE0( "SetObjectPropValue result check failed" ); + } + } + } + else + { + PRINTE0( "SetObjectPropValue prepare phase failed" ); + } + + result = CompleteTransactionL( aItem ); + break; + } + // don't allow errors in any request + if ( result != KErrNone ) + { + break; + } + } + properties.Close(); + + PRINTN1( "Exiting SetObjectPropValueL with result %d", result ); + return result; + } + +TInt CMmMtpDataProviderTestModule::SetObjectPropListL( CStifItemParser& aItem ) + { + PRINTM0( "SetObjectPropList" ); + + if ( !iTransactionOpen ) + { + PRINTE0( "Running SetObjectPropList without open transaction" ); + return KErrGeneral; + } + + TMTPTransactionPhase phase; + TInt result = KErrNotReady; + + iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); + iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); + iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeSetObjectPropList ); + + if ( iPluginTester->SetObjectPropListL_prepare( *iRequest ) ) + { + phase = iTestObserver->SetPhaseL( ERequestPhase ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + phase = iTestObserver->SetPhaseL( EResponsePhase ); + iTestObserver->SetPendingOperation( CTestObserver::ESetObjectPropList ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + result = iTestObserver->WaitForPendingOperation(); + if ( result != KErrNone ) + { + PRINTE0( "SetObjectPropList asynchronous operation failed" ); + } + else + { + if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) + { + PRINTE0( "SetObjectPropList request failed" ); + PRINTE1( "Response code: 0x%x", iTestObserver->iResponseCode ); + result = KErrGeneral; + } + else + { + result = iPluginTester->SetObjectPropListL_checkresults( static_cast( iTestObserver->iMMTPTypeData ) ); + if ( result != KErrNone ) + { + PRINTE0( "SetObjectPropList result check failed" ); + result = KErrGeneral; + } + } + } + } + else + { + PRINTE0( "SetObjectPropList prepare phase failed" ); + result = KErrGeneral; + } + + PRINTN1( "Exiting SetObjectPropList with result %d", result ); + return result; + } + +TInt CMmMtpDataProviderTestModule::DeleteObjectL( CStifItemParser& aItem ) + { + PRINTM0( "DeleteObject" ); + + if ( !iTransactionOpen ) + { + PRINTE0( "Running DeleteObject without open transaction" ); + return KErrGeneral; + } + + TMTPTransactionPhase phase; + TInt result = KErrNotReady; + + iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); + iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); + TUint32 objectHandle = KMTPHandleAll; + iRequest->SetUint32( TMTPTypeRequest::ERequestParameter1, objectHandle ); + iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeDeleteObject ); + + if ( iPluginTester->DeleteObjectL_prepare( *iRequest ) ) + { + iTestObserver->SetPendingOperation( CTestObserver::EDeleteObject ); + phase = iTestObserver->SetPhaseL( ERequestPhase ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + result = iTestObserver->WaitForPendingOperation(); + phase = iTestObserver->SetPhaseL( EResponsePhase ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) + { + PRINTE0( "DeleteObject request failed" ); + PRINTE1( "Response code 0x%x", iTestObserver->iResponseCode ); + result = KErrGeneral; + } + else + { + result = iPluginTester->DeleteObjectL_checkresults( iTestObserver->ObjectMgr() ); + if ( result != KErrNone ) + { + PRINTE0( "DeleteObject result check failed" ); + } + } + } + else + { + PRINTE0( "DeleteObject prepare phase failed" ); + result = KErrGeneral; + } + + PRINTN1( "Exiting TestDeleteObjectL with result %d", result ); + return result; + } + +TInt CMmMtpDataProviderTestModule::CopyObjectL( CStifItemParser& aItem ) + { + PRINTM0( "CopyObject" ); + + if ( !iTransactionOpen ) + { + PRINTE0( "Running CopyObject without open transaction" ); + return KErrGeneral; + } + + TMTPTransactionPhase phase; + TInt result = KErrNone; + + iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); + iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); + TUint32 objectHandle = 3; + iRequest->SetUint32( TMTPTypeRequest::ERequestParameter1, objectHandle ); + // parameter 2 (storage id) set in prepare function + TUint32 parentObjectHandle = 0; // copy to root directory + iRequest->SetUint32( TMTPTypeRequest::ERequestParameter3, parentObjectHandle ); + iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeCopyObject ); + + if ( iPluginTester->CopyObjectL_prepare( *iRequest ) ) + { + phase = iTestObserver->SetPhaseL( ERequestPhase ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + phase = iTestObserver->SetPhaseL( EResponsePhase ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) + { + __TRACE( KError, ( _L( "CopyObject request phase failed, response code: 0x%x" ), iTestObserver->iResponseCode ) ); + result = KErrGeneral; + } + else + { + TUint32 handle = iTestObserver->iResponse.Uint32( TMTPTypeResponse::EResponseParameter1 ); + PRINTV1( "Copied object handle: %d", handle ); + CMTPObjectMetaData* metaData = CMTPObjectMetaData::NewLC(); + iTestObserver->ObjectMgr().ObjectL( handle, *metaData ); + result = iPluginTester->CopyObjectL_checkresults( metaData ); + if ( result != KErrNone ) + { + PRINTE0( "CopyObject result check failed" ); + } + CleanupStack::PopAndDestroy( metaData ); + } + } + else + { + PRINTE0( "CopyObject prepare phase failed" ); + result = KErrGeneral; + } + + PRINTN1( "Exiting CopyObject with result %d", result ); + return result; + } + +TInt CMmMtpDataProviderTestModule::MoveObjectL( CStifItemParser& aItem ) + { + PRINTM0( "MoveObject" ); + + if ( !iTransactionOpen ) + { + PRINTE0( "Running MoveObject without open transaction" ); + return KErrGeneral; + } + + TInt result = KErrNotReady; + TMTPTransactionPhase phase; + + iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); + // the transaction id should be one greater than the id for send object info + iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); + TUint32 objectHandle = 3; + iRequest->SetUint32( TMTPTypeRequest::ERequestParameter1, objectHandle ); + // parameter 2 (storage id) is set in prepare function + TUint32 parentHandle = 0; // move to root directory + iRequest->SetUint32( TMTPTypeRequest::ERequestParameter3, parentHandle ); + iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeMoveObject ); + + if ( iPluginTester->MoveObjectL_prepare( *iRequest ) ) + { + phase = iTestObserver->SetPhaseL( ERequestPhase ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + phase = iTestObserver->SetPhaseL( EResponsePhase ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) + { + PRINTE0( "MoveObject request failed" ); + PRINTE1( "Response code: 0x%x", iTestObserver->iResponseCode ); + result = KErrGeneral; + } + else + { + CMTPObjectMetaData* metaData = CMTPObjectMetaData::NewLC(); + iTestObserver->ObjectMgr().ObjectL( objectHandle, *metaData ); + result = iPluginTester->MoveObjectL_checkresults( metaData ); + if ( result != KErrNone ) + { + PRINTE0( "MoveObject result check failed" ); + } + CleanupStack::PopAndDestroy( metaData ); + } + } + else + { + PRINTE0( "MoveObject prepare failed" ); + result = KErrGeneral; + } + + PRINTN1( "Exiting MoveObject with result %d", result ); + return result; + } + +TInt CMmMtpDataProviderTestModule::RenameObjectL( CStifItemParser& aItem ) + { + PRINTM0( "RenameObject" ); + + TInt result = KErrNotReady; + TMTPNotificationParamsHandle param; + + if ( iPluginTester->RenameObjectL_prepare( param ) ) + { + TUint32 handle = param.iHandleId; + iDataProviderPlugin->ProcessNotificationL( EMTPRenameObject, ¶m ); + User::After( 10000 ); + CMTPObjectMetaData* metaData = CMTPObjectMetaData::NewLC(); + iTestObserver->ObjectMgr().ObjectL( handle, *metaData ); + result = iPluginTester->RenameObjectL_checkresults( metaData ); + if ( result != KErrNone ) + { + __TRACE( KError, ( _L( "Result check failed with error %d" ), result ) ); + } + CleanupStack::PopAndDestroy( metaData ); + } + else + { + PRINTE0( "RenameObject prepare phase failed" ); + result = KErrGeneral; + } + + return result; + } + +TInt CMmMtpDataProviderTestModule::GetPartialObjectL( CStifItemParser& aItem ) + { + PRINTM0( "GetPartialObject" ); + + if ( !iTransactionOpen ) + { + PRINTE0( "Running GetPartialObject without open transaction" ); + return KErrGeneral; + } + + TMTPTransactionPhase phase; + TInt result = KErrNone; + + iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); + iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); + TUint32 objectHandle = 2; // first enumerated object + iRequest->SetUint32( TMTPTypeRequest::ERequestParameter1, objectHandle ); + iRequest->SetUint32( TMTPTypeRequest::ERequestParameter2, 0 ); + iRequest->SetUint32( TMTPTypeRequest::ERequestParameter3, KMTPHandleAll ); + iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeGetPartialObject ); + + if ( iPluginTester->GetPartialObjectL_prepare( *iRequest ) ) + { + phase = iTestObserver->SetPhaseL( ERequestPhase ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + phase = iTestObserver->SetPhaseL( EResponsePhase ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) + { + PRINTE0( "GetPartialObject request failed" ); + PRINTE1( "Response code: 0x%x", iTestObserver->iResponseCode ); + result = KErrGeneral; + } + else + { + result = iPluginTester->GetPartialObjectL_checkresults(); + if ( result != KErrNone ) + { + PRINTE0( "GetPartialObject result check failed" ); + } + } + } + else + { + PRINTE0( "GetPartialObject prepare phase failed" ); + result = KErrGeneral; + } + + PRINTN1( "Exiting GetPartialObjectL with result %d", result ); + return result; + } + +TInt CMmMtpDataProviderTestModule::SetObjectReferencesL( CStifItemParser& /*aItem*/ ) + { + PRINTM0( "SetObjectReferences" ); + TInt result = KErrNone; + PRINTN1( "Exiting SetObjectReferences with result %d", result ); + return result; + } + +TInt CMmMtpDataProviderTestModule::GetObjectReferencesL( CStifItemParser& /*aItem*/ ) + { + PRINTM0( "GetObjectReferences" ); + TInt result = KErrNone; + PRINTN1( "Exiting GetObjectReferences with result %d", result ); + return result; + } + +TInt CMmMtpDataProviderTestModule::GetObjectPropsSupportedL( CStifItemParser& /*aItem*/ ) + { + PRINTM0( "GetObjectPropsSupported" ); + + if ( !iTransactionOpen ) + { + PRINTE0( "Running GetObjectPropsSupported without open transaction" ); + return KErrGeneral; + } + + TMTPTransactionPhase phase; + TInt result = KErrNone; + + iRequest->SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); + iRequest->SetUint32( TMTPTypeRequest::ERequestTransactionID, iTransactionId ); + iRequest->SetUint32( TMTPTypeRequest::ERequestParameter1, EMTPFormatCodeMP3 ); + iRequest->SetUint16( TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeGetObjectPropsSupported ); + + if ( iPluginTester->GetObjectPropsSupportedL_prepare( *iRequest ) ) + { + phase = iTestObserver->SetPhaseL( ERequestPhase ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + phase = iTestObserver->SetPhaseL( EResponsePhase ); + iDataProviderPlugin->ProcessRequestPhaseL( phase, *iRequest, *iTestConnChannel ); + if ( iTestObserver->iResponseCode != EMTPRespCodeOK ) + { + PRINTE0( "GetObjectPropsSupported request failed" ); + PRINTE1( "Response code: 0x%x", iTestObserver->iResponseCode ); + result = KErrGeneral; + } + else + { + result = iPluginTester->GetObjectPropsSupportedL_checkresults( static_cast( iTestObserver->iMMTPTypeData ) ); + if ( result != KErrNone ) + { + PRINTE0( "GetObjectPropsSupported result check failed" ); + } + } + } + else + { + PRINTE0( "GetObjectPropsSupported prepare phase failed" ); + result = KErrGeneral; + } + + PRINTN1( "Exiting GetObjectPropsSupportedL with result %d", result ); + return result; + } diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/src/cplaylistmtpdataprovidertester.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/src/cplaylistmtpdataprovidertester.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,387 @@ +/* +* 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: Tester class for abstractmediamtpdp plugin +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "cabstractmediamtpdataprovidertester.h" +#include "logging.h" + +#ifdef LOGGER +#undef LOGGER +#endif +#define LOGGER iLog + +// definitions and constants for the test data + +const TUint32 KTestStorageId = 0x10000; +const TInt KTestObjectsCount = 1; +const TUint KTestDirHandle = 1; +const TInt KTestDirDataproviderId = 0; +const TInt KPlaylistsDirParentId = 0; +_LIT( KTempDirPath, "C:\\mtp_testdata\\temp\\" ); +_LIT( KTestDirPath, "C:\\mtp_testdata\\temp\\TESTDIR\\" ); +_LIT( KPlaylistFileOrigPath, "C:\\mtp_testdata\\PLAYLIST.M3U" ); +_LIT( KPlaylistFileTempPath, "C:\\mtp_testdata\\temp\\PLAYLIST.m3u" ); +_LIT( KPlaylistFilePath, "C:\\mtp_testdata\\temp\\PLAYLIST.m3u" ); +_LIT( KPlaylistsDirPath, "C:\\mtp_testdata\\temp\\Playlists\\" ); +_LIT( KTestDirOrigPath, "C:\\mtp_testdata\\TESTDIR\\*" ); +_LIT( KTestDirTempPath, "C:\\mtp_testdata\\temp\\TESTDIR\\" ); +_LIT( KTestDirPhysicalStorage, "C:\\mtp_testdata\\temp\\" ); +_LIT( KTestDirLogicalStorage, "C:\\mtp_testdata\\temp\\" ); + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderTester* CAbstractMediaMtpDataProviderTester::NewL() + { + CAbstractMediaMtpDataProviderTester* self = + new ( ELeave ) CAbstractMediaMtpDataProviderTester(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that might leave. +// ---------------------------------------------------------------------------- +// +CAbstractMediaMtpDataProviderTester::CAbstractMediaMtpDataProviderTester() + : CMmMtpDataProviderTester() + { + // no implementation required + } + +// ---------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ---------------------------------------------------------------------------- +// +void CAbstractMediaMtpDataProviderTester::ConstructL() + { + TFileName logFileName; + logFileName.Copy( KMtpDataProviderTestModuleLogFile ); + + iLog = CStifLogger::NewL( KMtpDataProviderTestModuleLogPath, + logFileName, + CStifLogger::ETxt, + TRACE_TARGET, + ETrue, ETrue, ETrue, EFalse, ETrue ); + PRINTF0( ">CAbstractMediaMtpDataProviderTester::ConstructL" ); + iActiveSchedulerWait = new ( ELeave ) CActiveSchedulerWait(); + iFsSession.Connect(); + iFileMan = CFileMan::NewL( iFsSession ); + PRINTF0( "CAbstractMediaMtpDataProviderTester::~CAbstractMediaMtpDataProviderTester" ); + delete iActiveSchedulerWait; + delete iFileMan; + iFsSession.Close(); + PRINTF0( "CAbstractMediaMtpDataProviderTester::PrepareEnvironmentL" ); + TInt result = KErrNone; + + result = iFileMan->RmDir( KTempDirPath ); + if ( result == KErrNone ) + { + PRINTN0( "Warning: old temp directory found, deleted" ); + } + result = KErrNone; + + // create the temp dir if it doesn't exist + BaflUtils::EnsurePathExistsL( iFsSession, KTempDirPath ); + + // copy the test data to temp dir + result = iFileMan->Copy( KPlaylistFileOrigPath, KPlaylistFileTempPath ); + if ( result != KErrNone ) + { + PRINTE1( "Failed to copy playlist file, error %d", result ); + } + else + { + result = iFileMan->Copy( KTestDirOrigPath, KTestDirTempPath, + CFileMan::EOverWrite | CFileMan::ERecurse ); + if ( result != KErrNone ) + { + PRINTE1( "Failed to copy test dir, error %d", result ); + } + } + + MMPXHarvesterUtility* harvester = CMPXHarvesterFactory::NewL(); + CleanupClosePushL( *harvester ); + PRINTN0( "Starting to import playlist to mpx" ); + iTestObserver->SetPendingOperation( CTestObserver::EHarvesterAddObject ); + harvester->AddFileL(KPlaylistFilePath, iTestObserver); + + // waiting for asynchronous operation to complete + result = iTestObserver->WaitForPendingOperation(); + if ( result != KErrNone ) + { + PRINTE1( "Importing playlist to mpx failed with result %d", result ); + } + harvester->CloseTransactionL(); + CleanupStack::PopAndDestroy( harvester ); + PRINTF1( "CAbstractMediaMtpDataProviderTester::CleanEnvironmentL" ); + TInt result = KErrNone; + TMTPObjectMgrQueryParams queryParams ( KMTPStorageAll, KMTPFormatsAll, + KMTPHandleNone ); + RMTPObjectMgrQueryContext context; + RArray handles; + CleanupClosePushL( handles ); + + PRINTN0( "Starting to delete entries from mpx" ); + MMPXHarvesterUtility* harvester = CMPXHarvesterFactory::NewL(); + CleanupClosePushL( *harvester ); + + iTestObserver->ObjectMgr().GetObjectHandlesL( queryParams, context, + handles ); + PRINTV1( "Handle count: %d", handles.Count() ); + context.Close(); + + CMTPObjectMetaData* metadata = CMTPObjectMetaData::NewLC(); + for ( TInt i = 0; i < handles.Count(); i++ ) + { + TUint handle = handles[i]; + if ( handle != KTestDirHandle ) + { + iTestObserver->ObjectMgr().ObjectL( handles[i], *metadata ); + TPtrC fileName = metadata->DesC( CMTPObjectMetaData::ESuid ); + PRINTV1( "Handle: %d", handles[i] ); + PRINTV1( "File name: %S", &fileName ); + + PRINTN0( "Starting to delete the file from mpx" ); + iTestObserver->SetPendingOperation( CTestObserver::EHarvesterDeleteObject ); + harvester->DeleteFileL( fileName, iTestObserver ); + User::After( 1000000 ); + // waiting for asynchronous operation to complete + result = iTestObserver->WaitForPendingOperation(); + if ( result != KErrNone ) + { + PRINTE1( "Warning: failed to delete from mpx, error %d", result ); + result = KErrNone; // ignore for now, there are problems after DeleteObject + } + } + } + CleanupStack::PopAndDestroy( 3 ); // metadata, harvester, handles + PRINTN0( "Finished deleting entries from mpx" ); + + if ( result == KErrNone ) + { + PRINTN0( "Deleting temp directory" ); + result = iFileMan->RmDir( KTempDirPath ); + if ( result != KErrNone ) + { + PRINTE1( "Warning: failed to delete temp directory, error %d", result ); + result = KErrNone; + } + } + + PRINTF1( "CAbstractMediaMtpDataProviderTester::ObjectEnumerationL_prepare" ); + + TBool result = ETrue; + aPhysicalStorage->SetDesCL( CMTPStorageMetaData::EStorageSuid, + KTestDirPhysicalStorage() ); + aPhysicalStorage->SetUint( CMTPStorageMetaData::EStorageSystemType, + CMTPStorageMetaData::ESystemTypeDefaultFileSystem ); + + aLogicalStorage->SetDesCL( CMTPStorageMetaData::EStorageSuid, + KTestDirLogicalStorage() ); + aLogicalStorage->SetUint( CMTPStorageMetaData::EStorageSystemType, + CMTPStorageMetaData::ESystemTypeDefaultFileSystem ); + + // insert TESTDIR object manually + CMTPObjectMetaData* object( CMTPObjectMetaData::NewLC( 0, + EMTPFormatCodeAssociation, // a folder object + KTestStorageId, KTestDirPath ) ); + // object is in storage root + object->SetInt( CMTPObjectMetaData::EParentId, KErrNotFound ); + + iTestObserver->ObjectMgr().InsertObjectL( *object ); + CleanupStack::PopAndDestroy( object ); + + PRINTF1( "CAbstractMediaMtpDataProviderTester::ObjectEnumerationL_checkresults" ); + + TInt result = KErrNone; + + TMTPObjectMgrQueryParams queryParams ( KMTPStorageAll, KMTPFormatsAll, + KMTPHandleNone ); + RMTPObjectMgrQueryContext context; + RArray handles; + CleanupClosePushL( handles ); + MMPXHarvesterUtility* harvester = CMPXHarvesterFactory::NewL(); + CleanupClosePushL( *harvester ); + + aObjectManager.GetObjectHandlesL( queryParams, context, handles ); + context.Close(); + TInt count = handles.Count(); + PRINTV1( "Handle count: %d", count ); + if ( count != KTestObjectsCount ) + { + PRINTE2( "Wrong number of handles: %d != %d", count, KTestObjectsCount ); + result = KErrGeneral; + } + + CMTPObjectMetaData* metadata = CMTPObjectMetaData::NewLC(); + for ( TInt i = 0; i < count; i++ ) + { + TUint handle = handles[i]; + aObjectManager.ObjectL( handle, *metadata ); + TPtrC suid = metadata->DesC( CMTPObjectMetaData::ESuid ); + TUint formatCode = metadata->Uint( CMTPObjectMetaData::EFormatCode ); + TUint dataproviderId = metadata->Uint( CMTPObjectMetaData::EDataProviderId ); + TUint storageId = metadata->Uint( CMTPObjectMetaData::EStorageId ); + TInt parentId = metadata->Int( CMTPObjectMetaData::EParentId ); + + PRINTN1( "Handle: %d", handle ); + PRINTN1( "Suid: %S", &suid ); + + if ( dataproviderId != KTestDirDataproviderId ) + { + PRINTE2( "Wrong dataprovider id: %d != %d", dataproviderId, KTestDirDataproviderId ); + result = KErrGeneral; + } + if ( storageId != KTestStorageId ) + { + PRINTE2( "Wrong storage id: %d != %d", storageId, KTestStorageId ); + result = KErrGeneral; + } + switch ( handle ) + { + case 1: + { + if ( suid.Match( KTestDirPath ) != 0 ) + { + PRINTE2( "Wrong test dir path: %S != %S", &suid, &KTestDirPath ); + result = KErrGeneral; + } + if ( formatCode != EMTPFormatCodeAssociation ) + { + PRINTE2( "Wrong format code: 0x%x != 0x%x", formatCode, EMTPFormatCodeAssociation ); + result = KErrGeneral; + } + if ( parentId != KErrNotFound ) + { + PRINTE2( "Wrong parent id: %d != %d", parentId, KErrNotFound ); + result = KErrGeneral; + } + break; + } + case 2: + { + if ( suid.Match( KPlaylistsDirPath ) != 0 ) + { + PRINTE2( "Wrong test object 1 path: %S != %S", &suid, &KPlaylistsDirPath ); + result = KErrGeneral; + } + if ( formatCode != EMTPFormatCodeAssociation ) + { + PRINTE2( "Wrong format code: 0x%x != 0x%x", formatCode, EMTPFormatCodeAssociation ); + result = KErrGeneral; + } + if ( parentId != KPlaylistsDirParentId ) + { + PRINTE2( "Wrong parent id: %d != %d", parentId, KPlaylistsDirParentId ); + result = KErrGeneral; + } + break; + } + default: + { + PRINTE1( "Unexpected handle: %d", handle ); + result = KErrGeneral; + } + } + /* + if ( ( result == KErrNone ) && ( handle != KTestDirHandle ) ) + { + PRINTN0( "Starting to harvest the file" ); + iTestObserver->SetPendingOperation( CTestObserver::EHarvesterAddObject ); + harvester->AddFileL( metadata->DesC( CMTPObjectMetaData::ESuid ), iTestObserver ); + PRINTN0( "Waiting for harvesting to complete" ); + result = iTestObserver->WaitForPendingOperation(); + if ( result != KErrNone ) + { + PRINTE1( "Harvesting error: %d", result ); + } + } + */ + } + CleanupStack::PopAndDestroy( 3 ); // handles, harvester, metadata + PRINTF1( "CAbstractMediaMtpDataProviderTester::DeleteObjectL_checkresults" ); + TInt result = KErrNone; + // check that everything has been deleted from the file system + if ( BaflUtils::FileExists( iFsSession, KPlaylistFilePath ) ) + { + PRINTE0( "Playlist file was not deleted successfully" ); + // playlist file is not enumerated, so it cannot be deleted + //result = KErrGeneral; + } + PRINTF1( ">CAbstractMediaMtpDataProviderTester::DeleteObjectL_checkresults result = %d", result ); + return result; + } diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/src/ctestconnectionchannel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/src/ctestconnectionchannel.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -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: Dummy test connection channel for test module +* +*/ + + +#include +#include "ctestconnectionchannel.h" + +TUint CTestConnectionChannel::ConnectionId() const + { + return KErrNone; + } + +TUint CTestConnectionChannel::SessionCount() const + { + return KErrNone; + } + +TBool CTestConnectionChannel::SessionWithMTPIdExists(TUint32 /*aMTPId*/) const + { + return ETrue; + } + +MMTPSession& CTestConnectionChannel::SessionWithMTPIdL(TUint32 /*aMTPId*/) const + { + + } + +TBool CTestConnectionChannel::SessionWithUniqueIdExists(TUint32 /*aUniqueId*/) const + { + return ETrue; + } + +MMTPSession& CTestConnectionChannel::SessionWithUniqueIdL(TUint32 /*aUniqueId*/) const + { + + } diff -r 000000000000 -r a2952bb97e68 mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/src/ctestobjectmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/mmmtpdataprovider/tsrc/mtpdataprovidertestmodule/src/ctestobjectmanager.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,425 @@ +/* +* 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: Dummy object manager for test module +* +*/ + + +#include +#include +#include +#include + +#include "ctestobjectmanager.h" +#include "logging.h" + +#ifdef LOGGER +#undef LOGGER +#endif +#define LOGGER iLog + +CTestObjectManager* CTestObjectManager::NewL() + { + CTestObjectManager* self = new ( ELeave ) CTestObjectManager(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +CTestObjectManager::CTestObjectManager() + { + // implementation not required + } + +void CTestObjectManager::ConstructL() + { + TFileName logFileName; + logFileName.Copy( KMtpDataProviderTestModuleLogFile ); + + iLog = CStifLogger::NewL( KMtpDataProviderTestModuleLogPath, + logFileName, + CStifLogger::ETxt, + TRACE_TARGET, + ETrue, ETrue, ETrue, EFalse, ETrue ); + PRINTF0( "CTestObjectManager::ConstructL" ); + } + +TUint CTestObjectManager::CountL( const TMTPObjectMgrQueryParams& aParams ) const + { + PRINTF3( ">CTestObjectManager::CountL storage = 0x%x parent = 0x%x format = 0x%x", aParams.iStorageId, aParams.iParentHandle, aParams.iFormatCode ); + TUint count = 0; + for ( TInt i = 0; i < iMTPObjects.Count(); i++ ) + { + TUint handle = iMTPObjects[i]->Uint( CMTPObjectMetaData::EHandle ); + TUint formatCode = iMTPObjects[i]->Uint( CMTPObjectMetaData::EFormatCode ); + TUint storageId = iMTPObjects[i]->Uint( CMTPObjectMetaData::EStorageId ); + TInt parentId = iMTPObjects[i]->Int( CMTPObjectMetaData::EParentId ); + if ( ( ( aParams.iStorageId == storageId ) || ( aParams.iStorageId == KMTPStorageAll ) ) + && + ( ( aParams.iFormatCode == formatCode ) || ( aParams.iFormatCode == KMTPFormatsAll ) ) + && + ( ( aParams.iParentHandle == parentId ) || ( aParams.iParentHandle == KMTPHandleNone ) || ( ( aParams.iParentHandle == KMTPHandleNoParent ) && ( parentId == KErrNotFound ) ) ) ) + { + PRINTV1( "Adding handle %d to count", handle ); + count++; + } + } + PRINTF1( "& aHandles ) const + { + PRINTF3( ">CTestObjectManager::GetObjectHandlesL storage = 0x%x parent = 0x%x format = 0x%x", aParams.iStorageId, aParams.iParentHandle, aParams.iFormatCode ); + for ( TInt i = 0; i < iMTPObjects.Count(); i++ ) + { + TUint handle = iMTPObjects[i]->Uint( CMTPObjectMetaData::EHandle ); + TUint formatCode = iMTPObjects[i]->Uint( CMTPObjectMetaData::EFormatCode ); + TUint storageId = iMTPObjects[i]->Uint( CMTPObjectMetaData::EStorageId ); + TInt parentId = iMTPObjects[i]->Int( CMTPObjectMetaData::EParentId ); + if ( ( ( aParams.iStorageId == storageId ) || ( aParams.iStorageId == KMTPStorageAll ) ) + && + ( ( aParams.iFormatCode == formatCode ) || ( aParams.iFormatCode == KMTPFormatsAll ) ) + && + ( ( aParams.iParentHandle == parentId ) || ( aParams.iParentHandle == KMTPHandleNone ) || ( ( aParams.iParentHandle == KMTPHandleNoParent ) && ( parentId == KErrNotFound ) ) ) ) + { + PRINTV1( "Appending handle %d", handle ); + aHandles.AppendL( handle ); + } + } + aContext.Close(); + PRINTF0( "CTestObjectManager::GetObjectSuidsL storage = 0x%x parent = 0x%x format = 0x%x", aParams.iStorageId, aParams.iParentHandle, aParams.iFormatCode ); + for ( TInt i = 0; i < iMTPObjects.Count(); i++ ) + { + TPtrC suid = iMTPObjects[i]->DesC( CMTPObjectMetaData::ESuid ); + TUint formatCode = iMTPObjects[i]->Uint( CMTPObjectMetaData::EFormatCode ); + TUint storageId = iMTPObjects[i]->Uint( CMTPObjectMetaData::EStorageId ); + TInt parentId = iMTPObjects[i]->Int( CMTPObjectMetaData::EParentId ); + if ( ( ( aParams.iStorageId == storageId ) || ( aParams.iStorageId == KMTPStorageAll ) ) + && + ( ( aParams.iFormatCode == formatCode ) || ( aParams.iFormatCode == KMTPFormatsAll ) ) + && + ( ( aParams.iParentHandle == parentId ) || ( aParams.iParentHandle == KMTPHandleNone ) || ( ( aParams.iParentHandle == KMTPHandleNoParent ) && ( parentId == KErrNotFound ) ) ) ) + { + PRINTV1( "Appending suid %S", &suid ); + aSuids.AppendL( suid ); + } + } + aContext.Close(); + PRINTF0( "CTestObjectManager::HandleL uid = %Ld", aObjectUid ); + PRINTE0( "NOT IMPLEMENTED" ); + return NULL; + } + + +TUint32 CTestObjectManager::HandleL( const TMTPTypeUint128& aPuid ) const + { + TUint64 lower = aPuid.LowerValue(); + TUint64 higher = aPuid.UpperValue(); + PRINTF2( "<>CTestObjectManager::HandleL puid = %Lu %Lu", lower, higher ); + PRINTE0( "NOT IMPLEMENTED" ); + return NULL; + } + + +TUint32 CTestObjectManager::HandleL( const TDesC& aSuid ) const + { + PRINTF1( ">CTestObjectManager::HandleL suid = %S", &aSuid ); + TUint handle = 0; + for ( TInt i = 0; i < iMTPObjects.Count(); i++ ) + { + if ( ( iMTPObjects[i]->DesC( CMTPObjectMetaData::ESuid ) ).Match( aSuid ) == 0 ) + { + handle = iMTPObjects[i]->Uint( CMTPObjectMetaData::EHandle ); + break; + } + } + PRINTF1( "CTestObjectManager::InsertObjectL handle = %d", handle ); + + CMTPObjectMetaData* newObject = CMTPObjectMetaData::NewL( + aObject.DesC( CMTPObjectMetaData::ESuid ), 0, 0, 0 ); + + CleanupStack::PushL( newObject ); + iHandle++; + aObject.SetUint( CMTPObjectMetaData::EHandle, iHandle ); + newObject->SetUint( CMTPObjectMetaData::EHandle, iHandle ); + CopyObjectMetadataL( aObject, *newObject ); + CleanupStack::Pop( newObject ); + + iMTPObjects.Append( newObject ); + PRINTF1( "New object inserted with handle %d", iHandle ); + } + +void CTestObjectManager::InsertObjectsL( RPointerArray& /*aObjects*/ ) + { + PRINTF0( "<>CTestObjectManager::InsertObjectsL" ); + PRINTE0( "NOT IMPLEMENTED" ); + } + +void CTestObjectManager::ModifyObjectL( const CMTPObjectMetaData& aObject ) + { + TUint32 handle = aObject.Uint( CMTPObjectMetaData::EHandle ); + PRINTF1( ">CTestObjectManager::ModifyObjectL handle = %d", handle ); + for ( TInt i = 0; i < iMTPObjects.Count(); i++ ) + { + if ( iMTPObjects[i]->Uint( CMTPObjectMetaData::EHandle ) == handle ) + { + PRINTF1( "CTestObjectManager::ObjectL handle = %d", handle ); + for ( TInt i = 0; i < iMTPObjects.Count(); i++ ) + { + if ( iMTPObjects[i]->Uint( CMTPObjectMetaData::EHandle ) == handle ) + { + PRINTF1( "CTestObjectManager::ObjectL suid = %S", &aSuid ); + for ( TInt i = 0; i < iMTPObjects.Count(); i++ ) + { + if ( ( iMTPObjects[i]->DesC(CMTPObjectMetaData::ESuid ) ).Match( aSuid ) == 0) + { + PRINTF1( "CTestObjectManager::ObjectOwnerId handle = %d", handle ); + TUint ownerId = KErrNotFound; + for ( TInt i = 0; i < iMTPObjects.Count(); i++ ) + { + if ( handle == iMTPObjects[i]->Uint( CMTPObjectMetaData::EHandle ) ) + { + ownerId = iMTPObjects[i]->Uint( CMTPObjectMetaData::EDataProviderId ); + break; + } + } + if ( ownerId == KErrNotFound ) + { + PRINTE1( "CTestObjectManager::ObjectUidL handle = %d", aHandle ); + return aHandle; + } + +TInt64 CTestObjectManager::ObjectUidL( const TDesC& aSuid ) const + { + PRINTF1( ">CTestObjectManager::ObjectUidL suid = %S", &aSuid ); + TUint handle = 0; + for ( TInt i = 0; i < iMTPObjects.Count(); i++ ) + { + if ( ( iMTPObjects[i]->DesC( CMTPObjectMetaData::ESuid ) ).Match( aSuid ) == 0 ) + { + handle = iMTPObjects[i]->Uint( CMTPObjectMetaData::EHandle ); + break; + } + } + PRINTF1( "CTestObjectManager::ObjectUidL puid = %Lu %Lu", lower, higher ); + PRINTE0( "NOT IMPLEMENTED" ); + return 0; + } + +TMTPTypeUint128 CTestObjectManager::PuidL( TUint32 aHandle ) const + { + PRINTF1( ">CTestObjectManager::PuidL handle = %d", aHandle ); + TMTPTypeUint128 returnValue; + for ( TInt i = 0; i < iMTPObjects.Count(); i++) + { + TUint handle = iMTPObjects[i]->Uint( CMTPObjectMetaData::EHandle ); + if ( handle == aHandle ) + { + returnValue.Set( handle, handle ); + break; + } + } + return returnValue; + } + +TMTPTypeUint128 CTestObjectManager::PuidL( TInt64 aObjectUid ) const + { + PRINTF1( "<>CTestObjectManager::PuidL uid = %Ld", aObjectUid ); + TMTPTypeUint128 returnValue; + PRINTE0( "NOT IMPLEMENTED" ); + return returnValue; + } + +TMTPTypeUint128 CTestObjectManager::PuidL( const TDesC& aSuid ) const + { + PRINTF1( "<>CTestObjectManager::PuidL suid = %S", &aSuid ); + TMTPTypeUint128 returnValue; + PRINTE0( "NOT IMPLEMENTED" ); + return returnValue; + } + +void CTestObjectManager::RemoveObjectL( const TMTPTypeUint32& aHandle ) + { + TUint handle = aHandle.Value(); + PRINTF1( "<>CTestObjectManager::RemoveObjectL handle = %d", handle ); + PRINTE0( "NOT IMPLEMENTED" ); + } + +void CTestObjectManager::RemoveObjectL( const TDesC& aSuid ) + { + PRINTF1( "<>CTestObjectManager::RemoveObjectL suid = %S", &aSuid ); + PRINTE0( "NOT IMPLEMENTED" ); + } + +void CTestObjectManager::RemoveObjectsL( const CDesCArray& /*aSuids*/ ) + { + PRINTF0( "<>CTestObjectManager::RemoveObjectsL suid arr" ); + PRINTE0( "NOT IMPLEMENTED" ); + } + +void CTestObjectManager::RemoveObjectsL( TUint aDataProviderId ) + { + PRINTF1( "<>CTestObjectManager::RemoveObjectsL data provider id = %d", aDataProviderId ); + PRINTE0( "NOT IMPLEMENTED" ); + } + +void CTestObjectManager::ReserveObjectHandleL( CMTPObjectMetaData& aObject, TUint64 aSpaceRequired ) + { + TUint handle = aObject.Uint( CMTPObjectMetaData::EHandle ); + PRINTF2( ">CTestObjectManager::ReserveObjectHandleL handle = %d, space = %Ld", handle, aSpaceRequired ); + + CMTPObjectMetaData* newObject = CMTPObjectMetaData::NewL( + aObject.DesC( CMTPObjectMetaData::ESuid ), 0, 0, 0 ); + + CleanupStack::PushL( newObject ); + iHandle++; + aObject.SetUint( CMTPObjectMetaData::EHandle, iHandle ); + newObject->SetUint( CMTPObjectMetaData::EHandle, iHandle ); + CopyObjectMetadataL( aObject, *newObject ); + CleanupStack::Pop( newObject ); + + iMTPObjects.Append( newObject ); + PRINTF1( "CTestObjectManager::CommitReservedObjectHandleL handle = %d", handle ); + } + +void CTestObjectManager::UnreserveObjectHandleL( const CMTPObjectMetaData& aObject ) + { + TUint reservedHandle = aObject.Uint( CMTPObjectMetaData::EHandle ); + PRINTF1( ">CTestObjectManager::UnreserveObjectHandleL handle = %d", reservedHandle ); + + for ( TInt i = 0; i < iMTPObjects.Count(); i++) + { + TUint handle = iMTPObjects[i]->Uint( CMTPObjectMetaData::EHandle ); + if ( reservedHandle == handle ) + { + CMTPObjectMetaData* object = iMTPObjects[i]; + iMTPObjects.Remove( i ); + delete object; + break; + } + } + PRINTF0( "CTestObjectManager::~CTestObjectManager()" ); + delete iLog; + iMTPObjects.ResetAndDestroy(); + } + +void CTestObjectManager::CopyObjectMetadataL( + const CMTPObjectMetaData& aSource, CMTPObjectMetaData& aTarget ) const + { + PRINTF0( ">CTestObjectManager::CopyObjectMetadataL" ); + for ( TInt i = CMTPObjectMetaData::EDataProviderId; + i <= CMTPObjectMetaData::EStorageVolumeId; i++ ) + { + aTarget.SetUint( i, aSource.Uint( i ) ); + } + + aTarget.SetDesCL( CMTPObjectMetaData::ESuid, + aSource.DesC( CMTPObjectMetaData::ESuid ) ); + + for ( TInt i = CMTPObjectMetaData::EUserRating; + i <= CMTPObjectMetaData::EIdentifier; i++ ) + { + aTarget.SetUint( i, aSource.Uint( i ) ); + } + + aTarget.SetInt( CMTPObjectMetaData::EParentId, + aSource.Int( CMTPObjectMetaData::EParentId ) ); + PRINTF0( " +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "logging.h" + +#ifdef LOGGER +#undef LOGGER +#endif +#define LOGGER iLog + +_LIT( KResFileName, "Z:\\resource\\mmmtpdataprovidertester.rsc" ); + +const TInt KDataProviderId = 1; + +CTestObserver::CTestObserver( CMmMtpDataProviderTestModule* aTestModule ) + : iObjectEnumerationComplete( EFalse ), + iStorageEnumerationComplete( EFalse ), + iTestModule( aTestModule ) + { + // no implementation required + } + +CTestObserver::~CTestObserver() + { + PRINTF0( ">CTestObserver::~CTestObserver" ); + iFsSession.Close(); + delete iStorageManager; + delete iTestObjManager; + delete iActiveSchedulerWait; + PRINTF0( "ConstructL(); + return self; + } + +CTestObserver* CTestObserver::NewL( CMmMtpDataProviderTestModule* aTestModule ) + { + CTestObserver* self = CTestObserver::NewLC( aTestModule ); + CleanupStack::Pop(); + return self; + } + +void CTestObserver::ConstructL() + { + TFileName logFileName; + logFileName.Copy( KMtpDataProviderTestModuleLogFile ); + + iLog = CStifLogger::NewL( KMtpDataProviderTestModuleLogPath, + logFileName, + CStifLogger::ETxt, + TRACE_TARGET, + ETrue, ETrue, ETrue, EFalse, ETrue ); + + PRINTF0( ">CTestObserver::ConstructL" ); + iStorageManager = CTestStorageMgr::NewL(); + iTestObjManager = CTestObjectManager::NewL(); + iFsSession.Connect(); + iActiveSchedulerWait = new ( ELeave ) CActiveSchedulerWait(); + + RResourceFile resFile; + CleanupClosePushL( resFile ); + + resFile.OpenL( Fs(), KResFileName ); + const TInt KDefaultResourceId( 1 ); + HBufC8* resBuffer( resFile.AllocReadLC( KDefaultResourceId ) ); + TResourceReader resReader; + resReader.SetBuffer( resBuffer ); + + // WORD type + TInt temp; + HBufC* tempBuf; + temp = resReader.ReadUint16(); // read and discard type + temp = resReader.ReadInt8(); // read and discard version + temp = resReader.ReadInt8(); // read and discard enumeration persistent flag + temp = resReader.ReadUint16(); // read and discard supported modes + + tempBuf = resReader.ReadHBufCL(); // read server name + delete tempBuf; + tempBuf = resReader.ReadHBufCL(); // read server image name + delete tempBuf; + + // LLINK opaque_resource + iResourceId = resReader.ReadUint32(); + __TRACE( KPrint, ( _L( "Resource id = 0x%x" ), iResourceId ) ); + temp = resReader.ReadUint8(); // read and discard enumeration phase + temp = temp; // prevent warning + CleanupStack::PopAndDestroy( resBuffer ); + CleanupStack::PopAndDestroy( &resFile ); + + PRINTF0( "CTestObserver::DataProviderId id = %d", id ); + return id; + } + +TMTPOperationalMode CTestObserver::Mode() const + { + TMTPOperationalMode mode = EModeMTP; + PRINTF1( "<>CTestObserver::Mode mode = %d", mode ); + return EModeMTP; + } + +void CTestObserver::ReceiveDataL( MMTPType& aData, + const TMTPTypeRequest& aRequest, MMTPConnection& /*aConnection*/ ) + { + TInt requestCode = aRequest.Uint16( TMTPTypeRequest::ERequestOperationCode ); + TInt sessionId = aRequest.Uint32( TMTPTypeRequest::ERequestSessionID ); + + PRINTF2( ">CTestObserver::ReceiveDataL request = 0x%x session = %d", requestCode, sessionId ); + + SetPhaseL( EDataIToRPhase ); + + TUint type = aData.Type(); + PRINTV1( "Type of data: 0x%x", type ); + if ( type == EMTPTypeUndefined ) + { + PRINTN0( "Null data received, executing dummy data phase" ); + return; + } + + switch ( requestCode ) + { + case EMTPOpCodeSendObjectInfo: + { + PRINTN0( "Receiving data for SendObjectInfo" ); + if ( type != EMTPTypeObjectInfoDataset ) + { + PRINTE2( "Wrong data type received: 0x%x != 0x%x", type, EMTPTypeObjectInfoDataset ); + User::Leave( KErrArgument ); + } + iTestModule->iPluginTester->SendObjectInfoReceiveData( + static_cast ( &aData ) ); + } + break; + case EMTPOpCodeSendObject: + { + PRINTN0( "Receiving data for SendObject" ); + if ( type != EMTPTypeFile ) + { + PRINTE2( "Wrong data type received: 0x%x != 0x%x", type, + EMTPTypeFile ); + User::Leave( KErrArgument ); + } + iTestModule->iPluginTester->SendObjectReceiveDataL( + static_cast( &aData ) ); + } + break; + case EMTPOpCodeSetObjectPropList: + { + PRINTN0( "Receiving data for SetObjectPropList" ); + if ( type != EMTPTypeObjectPropListDataset ) + { + PRINTE2( "Wrong data type received: 0x%x != 0x%x", type, EMTPTypeObjectPropListDataset ); + User::Leave( KErrArgument ); + } + iTestModule->iPluginTester->SetObjectPropListReceiveDataL( + static_cast ( &aData ) ); + } + break; + case EMTPOpCodeSetObjectPropValue: + { + PRINTN0( "Receiving data for SetObjectPropValue" ); + iTestModule->iPluginTester->SetObjectPropValueReceiveDataL( + aRequest, &aData ); + } + break; + } + PRINTF0( "CTestObserver::SendDataL operation = 0x%x", operationCode ); + SetPhaseL( EDataRToIPhase ); + iMMTPTypeData = &aData; + switch ( operationCode ) + { + case EMTPOpCodeGetObjectPropList: + if ( iPendingOperation == EGetObjectPropList ) + { + PRINTN0( "GetObjectPropList async operation finished successfully" ); + iAsyncResult = KErrNone; + } + else + { + PRINTE0( "GetObjectPropList async operation finished in incorrect state" ); + iAsyncResult = KErrNotReady; + } + if ( iActiveSchedulerWait->IsStarted() ) + { + iActiveSchedulerWait->AsyncStop(); + } + iPendingOperation = EIdleOperation; + break; + } + PRINTF0( "CTestObserver::SendEventL event = 0x%x session = %d", eventCode, sessionId ); + PRINTE0( "NOT IMPLEMENTED" ); + } + +void CTestObserver::SendEventL( const TMTPTypeEvent& aEvent ) + { + TUint16 eventCode = aEvent.Uint16( TMTPTypeEvent::EEventCode ); + TUint32 sessionId = aEvent.Uint32( TMTPTypeEvent::EEventSessionID ); + PRINTF2( "<>CTestObserver::SendEventL event = 0x%x session = %d", eventCode, sessionId ); + PRINTE0( "NOT IMPLEMENTED" ); + } + +void CTestObserver::SendResponseL( + const TMTPTypeResponse& aResponse, + const TMTPTypeRequest& aRequest, + MMTPConnection& /*aConnection*/ ) + { + TUint16 response = aResponse.Uint16( TMTPTypeResponse::EResponseCode ); + TUint16 operationCode = aRequest.Uint16( TMTPTypeRequest::ERequestOperationCode ); + PRINTF2( ">CTestObserver::SendResponseL response = 0x%x operation = 0x%x", response, operationCode ); + TInt result = KErrNone; + if ( iPhase == ECompletingPhase ) + { + PRINTN1( "Response 0x%x received while already in completing phase", response ); + } + else + { + SetPhaseL( ECompletingPhase ); + TMTPTypeResponse::CopyL( aResponse, iResponse ); + iResponseCode = response; + switch ( operationCode ) + { + case EMTPOpCodeGetObjectPropList: + if ( iPendingOperation == EGetObjectPropList ) + { + PRINTN0( "GetObjectPropList async operation aborted" ); + iAsyncResult = KErrAbort; + if ( iActiveSchedulerWait->IsStarted() ) + { + iActiveSchedulerWait->AsyncStop(); + } + iPendingOperation = EIdleOperation; + } + break; + case EMTPOpCodeSetObjectPropList: + if ( iPendingOperation == ESetObjectPropList ) + { + PRINTN0( "SetObjectPropList async operation finished successfully" ); + iAsyncResult = KErrNone; + } + else + { + PRINTE0( "SetObjectPropList async operation finished in incorrect state" ); + iAsyncResult = KErrNotReady; + } + if ( iActiveSchedulerWait->IsStarted() ) + { + iActiveSchedulerWait->AsyncStop(); + } + iPendingOperation = EIdleOperation; + break; + case EMTPOpCodeDeleteObject: + if ( iPendingOperation == EDeleteObject ) + { + PRINTN0( "DeleteObject async operation finished successfully" ); + iAsyncResult = KErrNone; + } + else + { + PRINTE0( "DeleteObject async operation finished in incorrect state" ); + iAsyncResult = KErrNotReady; + } + if ( iActiveSchedulerWait->IsStarted() ) + { + iActiveSchedulerWait->AsyncStop(); + } + iPendingOperation = EIdleOperation; + break; + } + } + PRINTF0( "CTestObserver::TransactionCompleteL" ); + SetPhaseL( EIdlePhase ); + } + +void CTestObserver::RouteRequestRegisterL(const TMTPTypeRequest& /*aRequest*/, + MMTPConnection& /*aConnection*/) + { + PRINTF0( "<>CTestObserver::RouteRequestRegisterL" ); + } + +void CTestObserver::RouteRequestUnregisterL(const TMTPTypeRequest& /*aRequest*/, + MMTPConnection& /*aConnection*/) + { + PRINTF0( "<>CTestObserver::RouteRequestUnregisterL" ); + } + +void CTestObserver::ObjectEnumerationCompleteL( TUint32 aStorageId ) + { + PRINTF1( ">CTestObserver::ObjectEnumerationCompleteL aStorageId = 0x%x", aStorageId ); + + if ( iPendingOperation == EObjectEnumeration ) + { + if ( iActiveSchedulerWait->IsStarted() ) + { + iActiveSchedulerWait->AsyncStop(); + } + iAsyncResult = KErrNone; + iObjectEnumerationComplete = ETrue; + iPendingOperation = EIdleOperation; + } + else + { + PRINTE0( "Unexpected pending operation" ); + iObjectEnumerationComplete = EFalse; + iAsyncResult = KErrNotReady; + } + PRINTF0( "CTestObserver::StorageEnumerationCompleteL" ); + if ( iPendingOperation == EStorageEnumeration ) + { + if ( iActiveSchedulerWait->IsStarted() ) + { + iActiveSchedulerWait->AsyncStop(); + } + iAsyncResult = KErrNone; + iStorageEnumerationComplete = ETrue; + iPendingOperation = EIdleOperation; + } + else + { + PRINTE0( "Unexpected pending operation" ); + iStorageEnumerationComplete = EFalse; + iAsyncResult = KErrNotReady; + } + PRINTF0( "CTestObserver::ObjectEnumerationComplete = %d", iObjectEnumerationComplete ); + return iObjectEnumerationComplete; + } + +TInt CTestObserver::ObjectEnumerationError() const + { + PRINTF1( "<>CTestObserver::ObjectEnumerationError = %d", iObjectEnumerationError ); + return iObjectEnumerationError; + } + +TBool CTestObserver::StorageEnumerationComplete() const + { + PRINTF1( "<>CTestObserver::ObjectEnumerationError = %d", iStorageEnumerationComplete ); + return iStorageEnumerationComplete; + } + +// sets the phase member variable and leaves if state transition is illegal +TMTPTransactionPhase CTestObserver::SetPhaseL( TMTPTransactionPhase aPhase ) + { + PRINTF1( ">CTestObserver::SetPhaseL aPhase = 0x%x", aPhase ) + TMTPTransactionPhase result = iPhase; + switch ( aPhase ) + { + case EUndefined: + iPhase = aPhase; + result = iPhase; + break; + case EIdlePhase: + if ( iPhase == ECompletingPhase ) + { + iPhase = aPhase; + result = iPhase; + } + else + { + PRINTE0( "Illegal attempt to switch to idle phase" ); + PRINTE1( "Current phase: 0x%x", iPhase ); + User::Leave( KErrNotReady ); + } + break; + case ERequestPhase: + if ( iPhase == EUndefined ) + { + iPhase = aPhase; + result = iPhase; + } + else + { + PRINTE0( "Illegal attempt to switch to request phase" ); + PRINTE1( "Current phase: 0x%x", iPhase ); + User::Leave( KErrNotReady ); + } + break; + case EResponsePhase: + switch ( iPhase ) + { + case ECompletingPhase: + PRINTN0( "Attempted to switch back to response phase from completing phase" ); + // while already in completing phase, must not change internal state + result = aPhase; + break; + case ERequestPhase: + case EDataIToRPhase: + case EDataRToIPhase: + iPhase = aPhase; + result = iPhase; + break; + default: + PRINTE0( "Illegal attempt to switch to response phase" ); + PRINTE1( "Current phase: 0x%x", iPhase ); + User::Leave( KErrNotReady ); + break; + } + break; + case ECompletingPhase: + switch ( iPhase ) + { + case ECompletingPhase: + // allow switch but print notice + PRINTN0( "Attempted to switch to completing phase while already in completing phase" ); + result = iPhase; + break; + case EIdlePhase: + // some operations do automatically the completing phase + // allow switch but don't change internal phase + PRINTN0( "Attempted to switch to completing phase while already in idle phase" ); + result = aPhase; + break; + case ERequestPhase: + case EDataIToRPhase: + case EDataRToIPhase: + case EResponsePhase: + iPhase = aPhase; + result = iPhase; + break; + default: + PRINTE0( "Illegal attempt to switch to completing phase" ); + PRINTE1( "Current phase: 0x%x", iPhase ); + User::Leave( KErrNotReady ); + break; + } + break; + case EDataIToRPhase: + if ( iPhase == ERequestPhase ) + { + iPhase = aPhase; + result = iPhase; + } + else + { + PRINTE0( "Illegal attempt to switch to data i to r phase" ); + PRINTE1( "Current phase: 0x%x", iPhase ); + User::Leave( KErrNotReady ); + } + break; + case EDataRToIPhase: + if ( iPhase == ERequestPhase ) + { + iPhase = aPhase; + result = iPhase; + } + else + { + PRINTE0( "Illegal attempt to switch to data r to i phase" ); + PRINTE1( "Current phase: 0x%x", iPhase ); + User::Leave( KErrNotReady ); + } + break; + default: + PRINTE0( "Attempting to switch to illegal phase" ); + PRINTE1( "Tried to change to phase: 0x%x", aPhase ); + User::Leave( KErrArgument ); + break; + } + PRINTF1( "CTestObserver::DataProviderConfig" ); + return *this; + } + +const MMTPFrameworkConfig& CTestObserver::FrameworkConfig() const + { + PRINTF0( "<>CTestObserver::FrameworkConfig" ); + PRINTE0( "NOT IMPLEMENTED" ); + } + + +MMTPObjectMgr& CTestObserver::ObjectMgr() const + { + PRINTF0( "<>CTestObserver::ObjectMgr" ); + return *iTestObjManager; + } + +MMTPReferenceMgr& CTestObserver::ReferenceMgr() const + { + PRINTF0( "<>CTestObserver::ReferenceMgr()" ); + PRINTE0( "NOT IMPLEMENTED" ); + } + +MMTPStorageMgr& CTestObserver::StorageMgr() const + { + PRINTF0( "<>CTestObserver::StorageMgr" ); + return *iStorageManager; + } + + +RFs& CTestObserver::Fs() const + { + PRINTF0( "<>CTestObserver::Fs()" ); + return const_cast(iFsSession); + } + +void CTestObserver::SetPendingOperation( TAsyncOperation aOperation ) + { + PRINTF1( "<>CTestObserver::SetPendingOperation aOperation = %d", aOperation ); + iPendingOperation = aOperation; + } + +TInt CTestObserver::WaitForPendingOperation() + { + PRINTF0( ">CTestObserver::WaitForPendingOperation" ); + if ( iPendingOperation != EIdleOperation ) + { + if ( iActiveSchedulerWait->IsStarted() ) + { + PRINTE0( "Active scheduler wait already started" ); + iAsyncResult = KErrNotReady; + } + else + { + iActiveSchedulerWait->Start(); + } + } + else + { + PRINTN0( "Pending operation already finished" ); + } + PRINTF1( "CTestObserver::GetPendingResult = %d", iAsyncResult ); + return iAsyncResult; + } + +void CTestObserver::HandleAbstractMediaExportCompletedL( CMPXMedia* /*aMedia*/, TInt /*aErr*/ ) + { + PRINTF0( "<>CTestObserver::GetPendingResult" ); + PRINTE0( "NOT IMPLEMENTED" ); + } + +void CTestObserver::HandleAbstractMediaImportCompletedL( CMPXMedia* aMedia, TInt aErr ) + { + PRINTF0( ">CTestObserver::HandleAbstractMediaImportCompletedL" ); + if ( iPendingOperation == EHarvesterImportAbstractMedia ) + { + // TODO: add check function for the harvest results using this media object + if ( aMedia != NULL ) + { + delete aMedia; + } + iAsyncResult = aErr; + } + else + { + PRINTE0( "HarvesterImportPlaylist async operation finished in incorrect state" ); + iAsyncResult = KErrNotReady; + } + if ( iActiveSchedulerWait->IsStarted() ) + { + iActiveSchedulerWait->AsyncStop(); + } + PRINTF0( "CTestObserver::HandleFileAddCompletedL aErr = %d", aErr ); + if ( iPendingOperation == EHarvesterAddObject ) + { + // TODO: add check function for the harvest results using this media object + if ( aMedia != NULL ) + { + delete aMedia; + } + iAsyncResult = aErr; + } + else + { + PRINTE0( "HarvesterAddObject async operation finished in incorrect state" ); + iAsyncResult = KErrNotReady; + } + if ( iActiveSchedulerWait->IsStarted() ) + { + iActiveSchedulerWait->AsyncStop(); + } + PRINTF0( "CTestObserver::HandleDeleteCompletedL aErr = %d", aErr ); + if ( iPendingOperation == EHarvesterDeleteObject ) + { + iAsyncResult = aErr; + } + else + { + PRINTE0( "HarvesterDeleteObject async operation finished in incorrect state" ); + iAsyncResult = KErrNotReady; + } + if ( iActiveSchedulerWait->IsStarted() ) + { + iActiveSchedulerWait->AsyncStop(); + } + PRINTF0( "CTestObserver::HandleFileImportCompletedL" ); + PRINTE0( "NOT IMPLEMENTED" ); + } + +void CTestObserver::HandleFileGetMediaCompletedL( CMPXMedia* /*aMedia*/, TInt /*aErr*/ ) + { + PRINTF0( "<>CTestObserver::HandleFileGetMediaCompletedL" ); + PRINTE0( "NOT IMPLEMENTED" ); + } + +TUint CTestObserver::UintValue( MMTPDataProviderConfig::TParameter aParam ) const + { + PRINTF1( ">CTestObserver::UintValue aParam = %d", aParam ); + TUint result = 0; + switch ( aParam ) + { + case EOpaqueResource: + result = iResourceId; + break; + default: + PRINTE1( "UintValue called with unexpected param: 0x%x", aParam ); + } + PRINTF1( "CTestObserver::BoolValue aParam = %d", aParam ); + TBool result = EFalse; + PRINTF1( "CTestObserver::DesCValue aParam = %d", aParam ); + const TDesC* nullValue( &KNullDesC ); + const TDesC* resValue( &KResFileName ); + switch ( aParam ) + { + case EResourceFileName: + PRINTF1( "CTestObserver::DesC8Value aParam = %d", aParam ); + return KNullDesC8; + } + +void CTestObserver::GetArrayValue( MMTPDataProviderConfig::TParameter aParam, RArray& aArray ) const + { + PRINTF1( ">CTestObserver::GetArrayValue aParam = %d", aParam ); + switch (aParam) + { + case ESupportedModes: + { + PRINTV0( "Appending MTP mode" ); + aArray.Append(EModeMTP); + break; + } + default: + PRINTE1( "GetArrayValue called with unexpected param: 0x%x", aParam ); + User::Leave( KErrArgument ); + } + PRINTF0( " +#include +#include +#include + +#include "cteststoragemgr.h" +#include "logging.h" + +#ifdef LOGGER +#undef LOGGER +#endif +#define LOGGER CTestStorageMgr::iLog + +// StorageID bit manipulation patterns. +static const TUint32 KLogicalIdMask(0x0000FFFF); +static const TUint32 KPhysicalIdMask(0xFFFF0000); + +static const TUint KLogicalNumberMask(0x000000FF); +static const TUint KLogicalOwnerShift(8); +static const TUint KPhysicalNumberShift(16); +static const TUint KPhysicalOwnerShift(24); +static const TUint8 KMaxOwnedStorages(0xFF); + +CStifLogger* CTestStorageMgr::iLog = NULL; + +/** +MTP data provider framework storage manager factory method. +@return A pointer to an MTP data provider framework storage manager. Ownership +IS transfered. +@leave One of the system wide error codes, if a processing failure occurs. +*/ +CTestStorageMgr* CTestStorageMgr::NewL() + { + TFileName logFileName; + logFileName.Copy( KMtpDataProviderTestModuleLogFile ); + + if ( CTestStorageMgr::iLog == NULL ) + { + CTestStorageMgr::iLog = CStifLogger::NewL( + KMtpDataProviderTestModuleLogPath, + logFileName, + CStifLogger::ETxt, + TRACE_TARGET, + ETrue, ETrue, ETrue, EFalse, ETrue ); + } + PRINTF0( ">CTestStorageMgr::NewL" ); + CTestStorageMgr* self = new( ELeave ) CTestStorageMgr(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + PRINTF0( "CTestStorageMgr::~CTestStorageMgr()" ); + iFs.Close(); + iPhysicalStorageNumbers.Reset(); + iStorages.ResetAndDestroy(); + PRINTF0( "CTestStorageMgr::LogicalStorageNumber aStorageId = 0x%x", aStorageId ); + TUint number = aStorageId & KLogicalNumberMask; + PRINTF1( "CTestStorageMgr::LogicalStorageOwner aStorageId = 0x%x", aStorageId ); + TUint owner = ( aStorageId & KLogicalIdMask ) >> KLogicalOwnerShift; + PRINTF1( "CTestStorageMgr::PhysicalStorageNumber aStorageId = 0x%x", aStorageId ); + TUint number = ( aStorageId & KPhysicalIdMask ) >> KPhysicalNumberShift; + PRINTF1( "CTestStorageMgr::PhysicalStorageOwner aStorageId = 0x%x", aStorageId ); + TUint owner = ( aStorageId & KPhysicalIdMask ) >> KPhysicalOwnerShift; + PRINTF1( "CTestStorageMgr::SetDefaultStorageId aStorageId = 0x%x", aStorageId ); + iDefaultStorageId = aStorageId; + } + +/** +Creates a mapping between the specified Symbian OS drive number and MTP +StorageID. +@param aDriveNumber The Symbian OS drive number. +@param aStorageId The MTP StorageID. +@leave One of the sysem wide error codes, if a processing failure occurs. +*/ +void CTestStorageMgr::SetDriveMappingL( TDriveNumber aDriveNumber, TUint32 aStorageId ) + { + PRINTF2( ">CTestStorageMgr::SetDriveMappingL aDriveNumber = %d aStorageId = 0x%x", aDriveNumber, aStorageId ); + iMapDriveToStorage[aDriveNumber] = aStorageId; + PRINTF0( "CTestStorageMgr::SetFrameworkId aDataProviderId = %d", aDataProviderId ); + __ASSERT_DEBUG( ( iFrameworkId == KErrNotFound ), User::Invariant() ); + iFrameworkId = aDataProviderId; + PRINTF0( "CTestStorageMgr::AllocateLogicalStorageIdL aDataProviderId = %u aDriveNumber = %d", aDataProviderId, aDriveNumber ); + TUint id( AllocateLogicalStorageIdL( aDataProviderId, + PhysicalStorageId( aDriveNumber ), aStorage ) ); + PRINTF1( "CTestStorageMgr::AllocateLogicalStorageIdL aDataProviderId = %u aPhysicalStorageId = 0x%x", aDataProviderId, aPhysicalStorageId ); + // Resolve the physical storage. + CMTPStorageMetaData& physical( StorageMetaDataL( aPhysicalStorageId ) ); + // Validate the SUID and storage type. + if ( iStorages.Find( aStorage.DesC( CMTPStorageMetaData::EStorageSuid ), + StorageKeyMatchSuid ) != KErrNotFound ) + { + // SUID is not unique. + User::Leave( KErrAlreadyExists ); + } + else if ( aStorage.Uint( CMTPStorageMetaData::EStorageSystemType ) != + physical.Uint( CMTPStorageMetaData::EStorageSystemType ) ) + { + // Physical/logical storage type mis-match. + User::Leave( KErrArgument ); + } + else if ( aStorage.Uint( CMTPStorageMetaData::EStorageSystemType ) == + CMTPStorageMetaData::ESystemTypeDefaultFileSystem ) + { + // Validate that the SUID path exists. + if ( !BaflUtils::PathExists( iFs, + aStorage.DesC( CMTPStorageMetaData::EStorageSuid ) ) ) + { + User::Leave( KErrPathNotFound ); + } + + // Validate that the SUID path corresponds to the physical storage drive. + TInt storageDrive( DriveNumber( aPhysicalStorageId ) ); + TParse p; + User::LeaveIfError( p.Set( aStorage.DesC( + CMTPStorageMetaData::EStorageSuid ), NULL, NULL ) ); + TInt suidDrive( 0 ); + User::LeaveIfError( iFs.CharToDrive( TChar( p.Drive()[0] ), + suidDrive ) ); + if ( suidDrive != storageDrive ) + { + // SUID path/physical storage drive mis-match. + User::Leave( KErrArgument ); + } + } + + // Allocate a logical StorageId. + TInt32 id( AllocateLogicalStorageId( aDataProviderId, + aPhysicalStorageId ) ); + User::LeaveIfError( id ); + + // Create the logical storage meta-data. + CMTPStorageMetaData* logical( CMTPStorageMetaData::NewLC( aStorage ) ); + logical->SetUint( CMTPStorageMetaData::EStorageId, id ); + + // Store the logical storage meta-data. + iStorages.InsertInOrderL( logical, StorageOrder ); + CleanupStack::Pop( logical ); + + // Associate the logical and physical storages. + RArray logicals; + CleanupClosePushL( logicals ); + physical.GetUintArrayL( CMTPStorageMetaData::EStorageLogicalIds, + logicals ); + logicals.InsertInOrderL( id ); + physical.SetUintArrayL( CMTPStorageMetaData::EStorageLogicalIds, + logicals ); + CleanupStack::PopAndDestroy( &logicals ); + + PRINTF1( "CTestStorageMgr::AllocatePhysicalStorageIdL aDataProviderId = %u", aDataProviderId ); + // Validate the SUID. + if ( iStorages.Find( aStorage.DesC( CMTPStorageMetaData::EStorageSuid ), + StorageKeyMatchSuid ) != KErrNotFound ) + { + // SUID is not unique. + User::Leave( KErrAlreadyExists ); + } + + // Allocate a physical StorageId. + TInt32 id( AllocatePhysicalStorageId( aDataProviderId ) ); + User::LeaveIfError( id ); + + // Create the physical storage meta-data. + CMTPStorageMetaData* physical( CMTPStorageMetaData::NewLC( aStorage ) ); + const RArray noStorages; + physical->SetUint( CMTPStorageMetaData::EStorageId, id ); + physical->SetUintArrayL( CMTPStorageMetaData::EStorageLogicalIds, + noStorages ); + + // Store the physical storage meta-data. + iStorages.InsertInOrderL( physical, StorageOrder ); + CleanupStack::Pop( physical ); + + PRINTF1( "CTestStorageMgr::DeallocateLogicalStorageId aDataProviderId = %d aLogicalStorageId = 0x%x", aDataProviderId, aLogicalStorageId ); + TInt result = KErrArgument; + + // Validate the StorageID. + if ( LogicalStorageId( aLogicalStorageId ) ) + { + result = iStorages.FindInOrder( aLogicalStorageId, StorageOrder ); + if ( result != KErrNotFound ) + { + // Validate the storage owner. + if ( LogicalStorageOwner( iStorages[result]-> + Uint( CMTPStorageMetaData::EStorageId ) ) != + aDataProviderId ) + { + result = KErrAccessDenied; + } + else + { + TRAP( result, RemoveLogicalStorageL( result ) ); + } + } + } + PRINTF1( "CTestStorageMgr::DeallocateLogicalStorageIds aDataProviderId = %d aPhysicalStorageId = 0x%x", aDataProviderId, aPhysicalStorageId ); + TInt result = iStorages.FindInOrder( aPhysicalStorageId, StorageOrder ); + if ( result != KErrNotFound ) + { + const RArray& logicals( iStorages[result]-> + UintArray( CMTPStorageMetaData::EStorageLogicalIds ) ); + TUint count = logicals.Count(); + while ( count ) + { + const TUint KIdx = count - 1; + if ( LogicalStorageOwner( logicals[KIdx] ) == aDataProviderId ) + { + DeallocateLogicalStorageId( aDataProviderId, logicals[KIdx] ); + } + count--; + } + } + PRINTF0( "CTestStorageMgr::DeallocatePhysicalStorageId aDataProviderId = %u aPhysicalStorageId = 0x%x", aDataProviderId, aPhysicalStorageId ); + TInt result = KErrArgument; + + // Validate the StorageID. + if ( !LogicalStorageId( aPhysicalStorageId ) ) + { + result = iStorages.FindInOrder( aPhysicalStorageId, StorageOrder ); + if ( result != KErrNotFound ) + { + // Validate the storage owner. + if ( PhysicalStorageOwner( iStorages[result]-> + Uint( CMTPStorageMetaData::EStorageId ) ) != + aDataProviderId ) + { + result = KErrAccessDenied; + } + else + { + // Deallocate all associated logical storages. + const RArray& logicals( iStorages[result]-> + UintArray( CMTPStorageMetaData::EStorageLogicalIds ) ); + TUint count = logicals.Count(); + while ( count ) + { + const TUint KIdx = --count; + DeallocateLogicalStorageId( aDataProviderId, + logicals[KIdx] ); + } + + // Delete the storage. + delete iStorages[result]; + iStorages.Remove( result ); + } + } + } + PRINTF1( "CTestStorageMgr::DefaultStorageId iDefaultStorageId = 0x%x", iDefaultStorageId ); + return iDefaultStorageId; + } + +TInt CTestStorageMgr::DriveNumber( TUint32 aStorageId ) const + { + PRINTF1( ">CTestStorageMgr::DriveNumber aStorageId = 0x%x", aStorageId ); + TInt drive = EDriveC; // return C by default + if ( PhysicalStorageOwner( aStorageId ) == iFrameworkId ) + { + const TUint32 KPhysicalId = PhysicalStorageId( aStorageId ); + const TUint KCount = iMapDriveToStorage.Count(); + for ( TUint i = 0; ( i < KCount ) && ( drive == KErrNotFound ); i++ ) + { + if ( PhysicalStorageId( iMapDriveToStorage[i] ) == KPhysicalId ) + { + drive = i; + } + } + } + PRINTF1( "CTestStorageMgr::FrameworkStorageId aDriveNumber = %d", aDriveNumber ); + TInt32 result = KErrNotFound; + TInt32 id = iMapDriveToStorage[aDriveNumber]; + if ( ( id != KErrNotFound ) && ( LogicalStorageId( id ) ) ) + { + result = id; + } + PRINTF1( "& aDrives ) const + { + PRINTF0( ">CTestStorageMgr::GetAvailableDrivesL" ); + aDrives.Reset(); + for ( TUint i = 0; ( i < iMapDriveToStorage.Count() ); i++ ) + { + if ( iMapDriveToStorage[i] != KErrNotFound ) + { + PRINTV1( "Appending drive %d", i ); + aDrives.AppendL( static_cast( i ) ); + } + } + PRINTF0( "& aStorages ) const + { + PRINTF2( ">CTestStorageMgr::GetLogicalStoragesL suid = %S system type = %d", &aParams.StorageSuid(), aParams.StorageSystemType() ); + aStorages.Reset(); + const TBool KAllStorages = ( aParams.StorageSuid() == KNullDesC ); + const TBool KAllStorageSystemTypes = ( aParams.StorageSystemType() == + CMTPStorageMetaData::ESystemTypeUndefined ); + const TUint KCount = iStorages.Count(); + for ( TUint i = 0; i < KCount; i++ ) + { + const CMTPStorageMetaData& storage = *iStorages[i]; + if ( ( ( KAllStorages ) || + ( storage.DesC( CMTPStorageMetaData::EStorageSuid ) == + aParams.StorageSuid() ) ) && + ( ( KAllStorageSystemTypes) || + ( storage.Uint( CMTPStorageMetaData::EStorageSystemType ) == + aParams.StorageSystemType() ) ) && + ( LogicalStorageId( + storage.Uint( CMTPStorageMetaData::EStorageId ) ) ) ) + { + PRINTV1( "Appending storage 0x%x", storage.Uint( CMTPStorageMetaData::EStorageId ) ); + aStorages.AppendL( iStorages[i] ); + } + } + PRINTF0( "& aStorages ) const + { + PRINTF2( ">CTestStorageMgr::GetPhysicalStoragesL suid = %S system type = %d", &aParams.StorageSuid(), aParams.StorageSystemType() ); + aStorages.Reset(); + const TBool KAllStorages = ( aParams.StorageSuid() == KNullDesC ); + const TBool KAllStorageSystemTypes = ( aParams.StorageSystemType() == + CMTPStorageMetaData::ESystemTypeUndefined ); + const TUint KCount = iStorages.Count(); + for ( TUint i = 0; i < KCount; i++ ) + { + const CMTPStorageMetaData& storage = *iStorages[i]; + if ( ( ( KAllStorages ) || + ( storage.DesC( CMTPStorageMetaData::EStorageSuid ) == + aParams.StorageSuid() ) ) && + ( ( KAllStorageSystemTypes ) || + ( storage.Uint( CMTPStorageMetaData::EStorageSystemType ) == + aParams.StorageSystemType() ) ) && + ( !LogicalStorageId( + storage.Uint( CMTPStorageMetaData::EStorageId ) ) ) ) + { + PRINTV1( "Appending storage 0x%x", storage.Uint( CMTPStorageMetaData::EStorageId ) ); + aStorages.AppendL( iStorages[i] ); + } + } + PRINTF0( "CTestStorageMgr::LogicalStorageId aStorageId = 0x%x", aStorageId ); + TUint32 id = 1; + PRINTF1( "CTestStorageMgr::LogicalStorageId aStorageSuid = %S", &aStorageSuid ); + TInt32 id = KErrNotFound; + TInt idx = iStorages.Find( aStorageSuid, StorageKeyMatchSuid ); + if ( idx != KErrNotFound ) + { + id = iStorages[ idx ]->Uint( CMTPStorageMetaData::EStorageId ); + if ( !LogicalStorageId( id ) ) + { + id = KErrNotFound; + } + } + PRINTF1( "CTestStorageMgr::PhysicalStorageId aDriveNumber = %d", aDriveNumber ); + TInt32 storageId = iMapDriveToStorage[aDriveNumber]; + if ( storageId != KErrNotFound ) + { + storageId = PhysicalStorageId( storageId ); + } + PRINTF1( "CTestStorageMgr::PhysicalStorageId aStorageId = 0x%x", aStorageId ); + TUint32 id = ( aStorageId & KPhysicalIdMask ); + PRINTF1( "CTestStorageMgr::StorageL aStorageId = 0x%x", aStorageId ); + TInt idx = iStorages.FindInOrder( aStorageId, StorageOrder ); + User::LeaveIfError( idx ); + PRINTF1( "CTestStorageMgr::StorageId aPhysicalStorageId = 0x%x aLogicalStorageId = 0x%x", aPhysicalStorageId, aLogicalStorageId ); + TUint32 id = ( aPhysicalStorageId | aLogicalStorageId ); + PRINTF1( "CTestStorageMgr::ValidStorageId aStorageId = 0x%x", aStorageId ); + TBool valid = + iStorages.FindInOrder( aStorageId, StorageOrder ) != KErrNotFound; + PRINTF1( "CTestStorageMgr::VolumeIdL aDataProviderId = %u aStorageId = 0x%x aVolumeIdSuffix = %S", aDataProviderId, aStorageId, &aVolumeIdSuffix ); + // Validate the StorageId. + TUint owner = LogicalStorageId( aStorageId ) ? + LogicalStorageOwner( aStorageId ) : + PhysicalStorageOwner( aStorageId ); + if ( !ValidStorageId( aStorageId ) ) + { + User::Leave( KErrNotFound ); + } + else if ( aDataProviderId != owner ) + { + User::Leave( KErrAccessDenied ); + } + + // Generate a unique volume ID. + RBuf16 buffer; + buffer.CreateL( KMTPMaxStringCharactersLength ); + CleanupClosePushL( buffer ); + buffer.Format( _L( "%08X" ), aStorageId ); + + if ( aVolumeIdSuffix.Length() != 0 ) + { + // Append the separator and suffix, truncating if necessary. + buffer.Append( _L( "-" ) ); + buffer.Append( aVolumeIdSuffix.Left( KMTPMaxStringCharactersLength - + buffer.Length() ) ); + } + + CMTPTypeString* volumeId = CMTPTypeString::NewL( buffer ); + CleanupStack::PopAndDestroy( &buffer ); + + PRINTF1( "CTestStorageMgr::ConstructL" ); + + iFs.Connect(); + for ( TUint i = 0; i < KMaxDrives; i++ ) + { + iMapDriveToStorage[i] = KErrNotFound; + } + PRINTF0( "CTestStorageMgr::AllocateLogicalStorageId aDataProviderId = %d aPhysicalStorageId = 0x%x", aDataProviderId, aPhysicalStorageId ); + TInt result = iStorages.FindInOrder( aPhysicalStorageId, StorageOrder ); + if ( result != KErrNotFound ) + { + // Scan for the first available storage number. + const RArray& logicalIds( iStorages[result]-> + UintArray( CMTPStorageMetaData::EStorageLogicalIds ) ); + TUint num = 1; + do + { + result = EncodeLogicalStorageId( aPhysicalStorageId, + aDataProviderId, num ); + } + while ( ( logicalIds.FindInOrder( result ) != KErrNotFound ) && + ( ++num <= KMaxOwnedStorages ) ); + + if ( num >= KMaxOwnedStorages ) + { + result = KErrOverflow; + } + } + PRINTF1( "CTestStorageMgr::AllocatePhysicalStorageId aDataProviderId = %d", aDataProviderId ); + TInt32 result = KErrNone; + while ( ( iPhysicalStorageNumbers.Count() < ( aDataProviderId + 1 ) ) && + ( result == KErrNone ) ) + { + result = iPhysicalStorageNumbers.Append( 0 ); + } + + if ( result == KErrNone ) + { + if ( iPhysicalStorageNumbers[aDataProviderId] < KMaxOwnedStorages ) + { + result = EncodePhysicalStorageId( aDataProviderId, + ++iPhysicalStorageNumbers[aDataProviderId] ); + } + else + { + result = KErrOverflow; + } + } + PRINTF1( "CTestStorageMgr::EncodeLogicalStorageId aPhysicalStorageId = 0x%x aDataProviderId = %d aStorageNumber = %d", aPhysicalStorageId, aDataProviderId, aStorageNumber ); + TUint32 id = StorageId( aPhysicalStorageId, + EncodeLogicalStorageOwner( aDataProviderId) | + EncodeLogicalStorageNumber( aStorageNumber ) ); + PRINTF1( "CTestStorageMgr::EncodeLogicalStorageNumber aStorageNumber = 0x%x", aStorageNumber ); + return aStorageNumber; + } + +/** +Encodes the specified data provider identifier as the logical storage owner +in a fully formed MTP StorageID. +@param aDataProviderId The data provider identifier. +@return The encoded logical storage owner. +*/ +TUint32 CTestStorageMgr::EncodeLogicalStorageOwner( TUint aDataProviderId ) + { + PRINTF1( ">CTestStorageMgr::EncodeLogicalStorageOwner aDataProviderId = %d", aDataProviderId ); + TUint32 owner = ( aDataProviderId << KLogicalOwnerShift ); + PRINTF1( "CTestStorageMgr::EncodePhysicalStorageId aDataProviderId = %d, aStorageNumber = %d", aDataProviderId, aStorageNumber ); + TUint32 id = EncodePhysicalStorageOwner( aDataProviderId ) | + EncodePhysicalStorageNumber( aStorageNumber ); + PRINTF1( "CTestStorageMgr::EncodePhysicalStorageNumber aStorageNumber = 0x%x", aStorageNumber ); + TUint32 number = ( aStorageNumber << KPhysicalNumberShift ); + PRINTF1( "CTestStorageMgr::EncodePhysicalStorageOwner aDataProviderId = 0x%x", aDataProviderId ); + TUint32 owner = ( aDataProviderId << KPhysicalOwnerShift ); + PRINTF1( "CTestStorageMgr::RemoveLogicalStorageL aIdx = %u", aIdx ); + TUint32 id = iStorages[aIdx]->Uint( CMTPStorageMetaData::EStorageId ); + PRINTV1( "Removing storage with id 0x%x", id ); + // Disassociate the logical and physical storages. + CMTPStorageMetaData& physical( StorageMetaDataL( + PhysicalStorageId( id ) ) ); + RArray logicals; + CleanupClosePushL( logicals ); + physical.GetUintArrayL( CMTPStorageMetaData::EStorageLogicalIds, + logicals ); + logicals.Remove( logicals.FindInOrderL( id ) ); + physical.SetUintArrayL( CMTPStorageMetaData::EStorageLogicalIds, + logicals ); + CleanupStack::PopAndDestroy( &logicals ); + + // Delete the storage. + delete iStorages[aIdx]; + iStorages.Remove( aIdx ); + PRINTF0( "CTestStorageMgr::StorageMetaDataL aStorageId = 0x%x", aStorageId ); + TInt idx = iStorages.FindInOrder( aStorageId, StorageOrder ); + User::LeaveIfError( idx ); + PRINTF1( "StorageKeyMatchSuid aSuid = %S storage id = 0x%x", &aSuid, aStorage.Uint( CMTPStorageMetaData::EStorageId ) ); + TBool match = ( *aSuid == + aStorage.DesC( CMTPStorageMetaData::EStorageSuid ) ); + PRINTF1( "CTestStorageMgr::StorageOrder left id = 0x%x right id = 0x%x", aL.Uint( CMTPStorageMetaData::EStorageId ), aR.Uint( CMTPStorageMetaData::EStorageId ) ); + TInt order = aL.Uint( CMTPStorageMetaData::EStorageId ) - + aR.Uint( CMTPStorageMetaData::EStorageId ); + PRINTF1( "CTestStorageMgr::StorageOrder aKey = 0x%x storage id = 0x%x", *aKey, aStorage.Uint( CMTPStorageMetaData::EStorageId ) ); + TInt order = *aKey - aStorage.Uint( CMTPStorageMetaData::EStorageId ); + PRINTF1( " CMediaRecognizer::MimeTypeL(class RFile &) + ?MimeTypeL@CMediaRecognizer@@QAE?AV?$TBuf@$0BAA@@@ABVTDesC16@@@Z @ 14 NONAME ; class TBuf<256> CMediaRecognizer::MimeTypeL(class TDesC16 const &) + ?MultiLinksCount@CStreamingLinkModel@@QAEHXZ @ 15 NONAME ; int CStreamingLinkModel::MultiLinksCount(void) + ?NewL@CMediaRecognizer@@SAPAV1@XZ @ 16 NONAME ; class CMediaRecognizer * CMediaRecognizer::NewL(void) + ?NewL@CStreamingLinkModel@@SAPAV1@XZ @ 17 NONAME ; class CStreamingLinkModel * CStreamingLinkModel::NewL(void) + ?OpenLinkFileL@CStreamingLinkModel@@QAEHAAVRFile@@H@Z @ 18 NONAME ; int CStreamingLinkModel::OpenLinkFileL(class RFile &, int) + ?OpenLinkFileL@CStreamingLinkModel@@QAEHABVTDesC16@@H@Z @ 19 NONAME ; int CStreamingLinkModel::OpenLinkFileL(class TDesC16 const &, int) + ?ResetLinkCount@CStreamingLinkModel@@QAEXXZ @ 20 NONAME ; void CStreamingLinkModel::ResetLinkCount(void) + ?OpenAsxFileL@CStreamingLinkModel@@QAEHAAVRFile@@H@Z @ 21 NONAME ; int CStreamingLinkModel::OpenAsxFileL(class RFile &, int) + ?OpenAsxFileL@CStreamingLinkModel@@QAEHABVTDesC16@@H@Z @ 22 NONAME ; int CStreamingLinkModel::OpenAsxFileL(class TDesC16 const &, int) + ?AreAllLinksLocal@CStreamingLinkModel@@QAEHXZ @ 23 NONAME ; int CStreamingLinkModel::AreAllLinksLocal(void) + ??1CDevSoundIf@@UAE@XZ @ 24 NONAME ; CDevSoundIf::~CDevSoundIf(void) + ?GetNumberOfVolumeSteps@CDevSoundIf@@QAEHXZ @ 25 NONAME ; int CDevSoundIf::GetNumberOfVolumeSteps(void) + ?NewL@CDevSoundIf@@SAPAV1@XZ @ 26 NONAME ; class CDevSoundIf * CDevSoundIf::NewL(void) + ?IsSeekable@CStreamingLinkModel@@QAEHXZ @ 27 NONAME ; int CStreamingLinkModel::IsSeekable(void) + ?IdentifyMediaTypeL@CMediaRecognizer@@QAE?AW4TMediaType@1@ABVTDesC16@@AAVRFile64@@H@Z @ 28 NONAME ; enum CMediaRecognizer::TMediaType CMediaRecognizer::IdentifyMediaTypeL(class TDesC16 const &, class RFile64 &, int) + ?MimeTypeL@CMediaRecognizer@@QAE?AV?$TBuf@$0BAA@@@AAVRFile64@@@Z @ 29 NONAME ; class TBuf<256> CMediaRecognizer::MimeTypeL(class RFile64 &) + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playbackhelper/eabi/playbackhelperu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playbackhelper/eabi/playbackhelperu.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,37 @@ +EXPORTS + _ZN16CMediaRecognizer14FreeFilehandleEv @ 1 NONAME + _ZN16CMediaRecognizer16IsValidUrlPrefixERK6TDesC8 @ 2 NONAME + _ZN16CMediaRecognizer16IsValidUrlPrefixERK7TDesC16 @ 3 NONAME + _ZN16CMediaRecognizer18IdentifyMediaTypeLERK7TDesC16R5RFilei @ 4 NONAME + _ZN16CMediaRecognizer18IdentifyMediaTypeLERK7TDesC16i @ 5 NONAME + _ZN16CMediaRecognizer22IsValidStreamingPrefixERK7TDesC16 @ 6 NONAME + _ZN16CMediaRecognizer4NewLEv @ 7 NONAME + _ZN16CMediaRecognizer9MimeTypeLER5RFile @ 8 NONAME + _ZN16CMediaRecognizer9MimeTypeLERK7TDesC16 @ 9 NONAME + _ZN16CMediaRecognizerD0Ev @ 10 NONAME + _ZN16CMediaRecognizerD1Ev @ 11 NONAME + _ZN16CMediaRecognizerD2Ev @ 12 NONAME + _ZN19CStreamingLinkModel12GetNextLinkLER6TDes16Rii @ 13 NONAME + _ZN19CStreamingLinkModel13MaxLinkLengthEv @ 14 NONAME + _ZN19CStreamingLinkModel13OpenLinkFileLER5RFilei @ 15 NONAME + _ZN19CStreamingLinkModel13OpenLinkFileLERK7TDesC16i @ 16 NONAME + _ZN19CStreamingLinkModel14FreeFilehandleEv @ 17 NONAME + _ZN19CStreamingLinkModel14ResetLinkCountEv @ 18 NONAME + _ZN19CStreamingLinkModel15MultiLinksCountEv @ 19 NONAME + _ZN19CStreamingLinkModel18CreateNewLinkFileLERK7TDesC16P12MDesC16Arrayi @ 20 NONAME + _ZN19CStreamingLinkModel4NewLEv @ 21 NONAME + _ZN19CStreamingLinkModelD0Ev @ 22 NONAME + _ZN19CStreamingLinkModelD1Ev @ 23 NONAME + _ZN19CStreamingLinkModelD2Ev @ 24 NONAME + _ZN19CStreamingLinkModel12OpenAsxFileLER5RFilei @ 25 NONAME + _ZN19CStreamingLinkModel12OpenAsxFileLERK7TDesC16i @ 26 NONAME + _ZN19CStreamingLinkModel16AreAllLinksLocalEv @ 27 NONAME + _ZN11CDevSoundIf22GetNumberOfVolumeStepsEv @ 28 NONAME + _ZN11CDevSoundIf4NewLEv @ 29 NONAME + _ZN11CDevSoundIfD0Ev @ 30 NONAME + _ZN11CDevSoundIfD1Ev @ 31 NONAME + _ZN11CDevSoundIfD2Ev @ 32 NONAME + _ZN19CStreamingLinkModel10IsSeekableEv @ 33 NONAME + _ZN16CMediaRecognizer18IdentifyMediaTypeLERK7TDesC16R7RFile64i @ 34 NONAME + _ZN16CMediaRecognizer9MimeTypeLER7RFile64 @ 35 NONAME + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playbackhelper/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playbackhelper/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2008 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: helper for media playback +* +*/ + +// Version : %version: 4 % + + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../sis/playbackhelper_stub.sis /epoc32/data/z/system/install/playbackhelper_stub.sis +../rom/playbackhelper.iby CORE_MW_LAYER_IBY_EXPORT_PATH(playbackhelper.iby) + +PRJ_MMPFILES +playbackhelper.mmp + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playbackhelper/group/playbackhelper.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playbackhelper/group/playbackhelper.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2008 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: helper for media playback +* +*/ + +// Version : %version: 5 % + + + + +#include +#include + +TARGET playbackhelper.dll +CAPABILITY CAP_GENERAL_DLL +TARGETTYPE DLL +UID 0x1000008D 0x200159B3 +VENDORID VID_DEFAULT + +MW_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc + +SOURCEPATH ../src +SOURCE streaminglinkmodel.cpp +SOURCE mediarecognizer.cpp +SOURCE devsoundif.cpp + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY cone.lib +LIBRARY apgrfx.lib +LIBRARY sysutil.lib +LIBRARY apmime.lib +LIBRARY charconv.lib +LIBRARY mmfcontrollerframework.lib +LIBRARY flogger.lib +LIBRARY mmfdevsound.lib + +#ifdef __WINDOWS_MEDIA +LIBRARY asxparser.lib +#endif + +#if defined(ARMCC) +deffile ../eabi/ +#elif defined(WINSCW) +deffile ../bwinscw/ +#endif + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playbackhelper/inc/playbackhelper_log.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playbackhelper/inc/playbackhelper_log.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2008 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: Debug print macros +* +*/ + +// Version : %version: 4 % + + + + +#ifndef PLAYBACKHELPER_LOG_H +#define PLAYBACKHELPER_LOG_H + +// INCLUDES +#include +#include +#include + + + +// #define _PLAYBACKHELPER_FILE_LOGGING_ + +#ifdef _DEBUG + #define PLAYBACKHELPER_DEBUG RDebug::Print +#else + #ifdef _PLAYBACKHELPER_FILE_LOGGING_ + #define PLAYBACKHELPER_DEBUG PlaybackHelperDebug::FileLog + #else + #define PLAYBACKHELPER_DEBUG RDebug::Print + #endif +#endif + + +class PlaybackHelperDebug +{ + public: + inline static void NullLog( TRefByValue /*aFmt*/, ... ) + { + } + + inline static void FileLog( TRefByValue aFmt, ... ) + { + VA_LIST list; + VA_START(list,aFmt); + RFileLogger::WriteFormat( _L("PlaybackHelper"), + _L("playbackhelper.log"), + EFileLoggingModeAppend, + aFmt, + list ); + } +}; + +#endif // PLAYBACKHELPER_LOG_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playbackhelper/rom/playbackhelper.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playbackhelper/rom/playbackhelper.iby Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2008 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: IBY file for playbackhelper.dll +* +*/ + +// Version : %version: 4 % + + +#ifndef __PLAYBACKHELPER_IBY__ +#define __PLAYBACKHELPER_IBY__ + +data = ZSYSTEM\install\playbackhelper_stub.sis system\install\playbackhelper_stub.sis +file=ABI_DIR\BUILD_DIR\playbackhelper.dll SHARED_LIB_DIR\playbackhelper.dll + +#endif // __PLAYBACKHELPER_IBY__ + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playbackhelper/sis/playbackhelper.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playbackhelper/sis/playbackhelper.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,31 @@ +; +; 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: Package file for Playback Helper component +; +; Version : %version: 4 % +; +; Languages +&EN + +; Header +# {"PlaybackHelper"}, (0x200159B3), 1, 0, 0, TYPE=SA, RU + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +;Files +"\epoc32\release\armv5\urel\playbackhelper.dll" - "!:\sys\bin\playbackhelper.dll" diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playbackhelper/sis/playbackhelper.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playbackhelper/sis/playbackhelper.xml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,31 @@ + + + + + 1 + playbackhelper + playbackhelper + + + + S60 + + 9 + 2 + + 2009 + 12 + + + + 9 + 2 + + 2010 + 1 + + + + + + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playbackhelper/sis/playbackhelper_stub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playbackhelper/sis/playbackhelper_stub.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,31 @@ +; +; 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: Stub Package file for Playback Helper component +; +; Version : %version: 4 % +; +;Language +&EN + +; Header +# {"PlaybackHelper"}, (0x200159B3), 1, 0, 0, TYPE=SA + +; Localised Vendor Name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +;Files +"" - "z:\sys\bin\playbackhelper.dll" diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playbackhelper/sis/playbackhelper_stub.sis Binary file mmappcomponents/playbackhelper/sis/playbackhelper_stub.sis has changed diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playbackhelper/src/devsoundif.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playbackhelper/src/devsoundif.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2008 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: Implementation of CDevSoundIf +* +*/ + +// Version : %version: 5 % + + + +// INCLUDE FILES +#include +#include + +#include "playbackhelper_log.h" + +// CONSTANTS +const TInt KTenStepsVolume = 10; +const TInt KTwentyStepsVolume = 20; + + +// ============================ MEMBER FUNCTIONS =================================================== + +// ------------------------------------------------------------------------------------------------- +// CDevSoundIf::CDevSoundIf +// C++ default constructor can NOT contain any code, that might leave. +// ------------------------------------------------------------------------------------------------- +// +CDevSoundIf::CDevSoundIf() +{ + PLAYBACKHELPER_DEBUG(_L("CDevSoundIf::CDevSoundIf()")); +} + +// ------------------------------------------------------------------------------------------------- +// CDevSoundIf::ConstructL +// Symbian 2nd phase constructor can leave. +// ------------------------------------------------------------------------------------------------- +// +void CDevSoundIf::ConstructL() +{ + PLAYBACKHELPER_DEBUG(_L("CDevSoundIf::ConstructL()")); + + iDevSound = CMMFDevSound::NewL(); +} + +// ------------------------------------------------------------------------------------------------- +// CDevSoundIf::NewL +// Two-phased constructor. +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C CDevSoundIf* CDevSoundIf::NewL() +{ + PLAYBACKHELPER_DEBUG(_L("CDevSoundIf::NewL()")); + + CDevSoundIf* self = new( ELeave ) CDevSoundIf; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; +} + +// ------------------------------------------------------------------------------------------------- +// CDevSoundIf::~CDevSoundIf +// Destructor +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C CDevSoundIf::~CDevSoundIf() +{ + PLAYBACKHELPER_DEBUG(_L("CDevSoundIf::~CDevSoundIf()")); + + if ( iDevSound ) + { + delete iDevSound; + } + +} + +// ------------------------------------------------------------------------------------------------- +// CDevSoundIf::GetNumberOfVolumeSteps +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C TInt CDevSoundIf::GetNumberOfVolumeSteps() +{ + // + // set default 10-steps volume + // + TInt volumeSteps = KTenStepsVolume; + + if ( iDevSound && + iDevSound->MaxVolume() >= KTwentyStepsVolume ) + { + // + // set 20-steps volume + // + volumeSteps = KTwentyStepsVolume; + } + + PLAYBACKHELPER_DEBUG(_L("CDevSoundIf::GetNumberOfVolumeSteps() returns [%d]"), volumeSteps); + + return volumeSteps; +} + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playbackhelper/src/mediarecognizer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playbackhelper/src/mediarecognizer.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,889 @@ +/* +* Copyright (c) 2008 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: Implementation of CMediaRecognizer +* +*/ + +// Version : %version: 7 % + + + +// INCLUDE FILES +#include +#include +#include +#include +#include + +#include "playbackhelper_log.h" + +// CONSTANTS +_LIT8(KDataTypeRAM,"audio/x-pn-realaudio-plugin"); +_LIT8(KDataTypeSDP,"application/sdp"); +_LIT8(KDataTypePlaylist,"audio/mpegurl"); +_LIT8(KDataTypeRNG,"application/vnd.nokia.ringing-tone"); + +_LIT8(KDataTypeMp3,"audio/mp3"); +_LIT8(KDataTypeXmp3,"audio/x-mp3"); +_LIT8(KDataTypeAudio3gp,"audio/3gpp"); +_LIT8(KDataTypeFlashVideo,"video/x-flv"); +_LIT8(KDataTypeText,"text"); + +_LIT8(KDataTypeAVI,"video/avi"); +_LIT8(KDataTypeMsAVI,"video/msvideo"); +_LIT8(KDataTypeMsAVIVideo,"video/x-msvideo"); + +_LIT8(KDataTypeMatroskaVideo ,"video/x-matroska"); + +#ifdef __WINDOWS_MEDIA +_LIT8(KDataTypeWMV_APP,"application/vnd.rn-wmv"); +_LIT8(KDataTypeWMV,"video/x-ms-wmv"); +_LIT8(KDataTypeASF,"application/vnd.ms-asf"); +_LIT8(KDataTypeASX, "video/x-ms-asf"); +_LIT(KRtspTcpPrefix,"rtspt://"); +_LIT(KRtspUdpPrefix,"rtspu://"); +_LIT(KHttpPrefix,"http://"); +_LIT(KHttpTcpPrefix,"httpt://"); +_LIT(KMmsPrefix,"mms://"); +_LIT(KMmstPrefix,"mmst://"); +#endif // __WINDOWS_MEDIA + +_LIT8(KDmFileExtension,".dm"); +_LIT8(KDcfFileExtension,".dcf"); +_LIT8(KOdfFileExtension,".odf"); +_LIT(KRtspPrefix,"rtsp://"); +_LIT(KFilePrefix,"file://"); + +const TInt KDefaultBufferSize = 1000; +const TInt KMinPrefixLength = 6; + + +// ============================ MEMBER FUNCTIONS =================================================== + +// ------------------------------------------------------------------------------------------------- +// CMediaRecognizer::CMediaRecognizer +// C++ default constructor can NOT contain any code, that might leave. +// ------------------------------------------------------------------------------------------------- +// +CMediaRecognizer::CMediaRecognizer() +{ + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::CMediaRecognizer()")); +} + +// ------------------------------------------------------------------------------------------------- +// CMediaRecognizer::ConstructL +// Symbian 2nd phase constructor can leave. +// ------------------------------------------------------------------------------------------------- +// +void CMediaRecognizer::ConstructL() +{ + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::ConstructL()")); + + User::LeaveIfError( iFs.Connect() ); +} + +// ------------------------------------------------------------------------------------------------- +// CMediaRecognizer::NewL +// Two-phased constructor. +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C CMediaRecognizer* CMediaRecognizer::NewL() +{ + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::NewL()")); + + CMediaRecognizer* self = new( ELeave ) CMediaRecognizer; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; +} + +// ------------------------------------------------------------------------------------------------- +// CMediaRecognizer::~CMediaRecognizer +// Destructor +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C CMediaRecognizer::~CMediaRecognizer() +{ + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::~CMediaRecognizer()")); + + if ( iFileHandle.SubSessionHandle() ) + { + iFileHandle.Close(); + } + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + if ( iFileHandle64.SubSessionHandle() ) + { + iFileHandle64.Close(); + } +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + + iFs.Close(); +} + +// ------------------------------------------------------------------------------------------------- +// CMediaRecognizer::IdentifyMediaTypeL +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C CMediaRecognizer::TMediaType +CMediaRecognizer::IdentifyMediaTypeL( const TDesC& aMediaName, TBool aIncludeUrls ) +{ + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::IdentifyMediaTypeL( %S )"), &aMediaName); + + TMediaType ret = EUnidentified; + + if ( BaflUtils::FileExists( iFs, aMediaName ) ) + { + ret = MediaTypeL( aMediaName ); + } + else if ( aIncludeUrls && IsValidStreamingPrefix( aMediaName ) ) + { + ret = EUrl; + } + + return ret; +} + +// ------------------------------------------------------------------------------------------------- +// CMediaRecognizer::IdentifyMediaTypeL +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C CMediaRecognizer::TMediaType +CMediaRecognizer::IdentifyMediaTypeL( const TDesC& aMediaName, RFile& aFile, TBool aIncludeUrls ) +{ + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::IdentifyMediaTypeL( %S, RFile )"), &aMediaName); + + if ( aFile.SubSessionHandle() ) + { + iFileHandle.Close(); + User::LeaveIfError( iFileHandle.Duplicate( aFile ) ); + } + + TMediaType ret = EUnidentified; + + if ( FileHandleExists() ) + { + ret = MediaTypeL( aMediaName ); + } + else if ( aIncludeUrls && IsValidStreamingPrefix( aMediaName ) ) + { + ret = EUrl; + } + + return ret; +} + +// ------------------------------------------------------------------------------------------------- +// CMediaRecognizer::MediaTypeL +// ------------------------------------------------------------------------------------------------- +// +CMediaRecognizer::TMediaType CMediaRecognizer::MediaTypeL( const TDesC& aMediaName ) +{ + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::MediaTypeL( %S )"), &aMediaName); + + TMediaType ret = EUnidentified; + + TDataRecognitionResult fileRecognitionResult; + RecognizeFileL( aMediaName, fileRecognitionResult ); + + if ( ! fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeSDP ) ) + { + ret = ELocalSdpFile; + } + else if ( ! fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeRAM ) ) + { + ret = ELocalRamFile; + } + else + { + // + // Create a list of the controller plugins that support video + // + RMMFControllerImplInfoArray videoControllers; + CleanupResetAndDestroyPushL( videoControllers ); + + CreateVideoFormatsArrayL( videoControllers ); + + if ( FileHasVideoSupportL( aMediaName, fileRecognitionResult, videoControllers ) ) + { + ret = ELocalVideoFile; + } +#ifdef __WINDOWS_MEDIA + else if ( ! fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeWMV ) || + ! fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeWMV_APP ) || + ! fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeASF ) ) + { + ret = ELocalVideoFile; + } + else if ( ! fileRecognitionResult.iDataType.Des8().CompareF(KDataTypeASX) ) + { + ret = ELocalAsxFile; + } +#endif // __WINDOWS_MEDIA + else if ( ! fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeAVI ) || + ! fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeMsAVI) || + ! fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeMsAVIVideo) ) + { + ret = ELocalVideoFile; + } + else if ( ! fileRecognitionResult.iDataType.Des8().CompareF(KDataTypeFlashVideo) ) + { + ret = EFlashVideoFile; + } + else if ( ! fileRecognitionResult.iDataType.Des8().CompareF( KDataTypePlaylist ) ) + { + ret = ELocalAudioPlaylist; + } + else if ( ! fileRecognitionResult.iDataType.Des8().CompareF( KDataTypeMatroskaVideo ) ) + { + ret = ELocalVideoFile; + } + else + { + // + // Create a list of the controller plugins that support audio + // + RMMFControllerImplInfoArray audioControllers; + CleanupResetAndDestroyPushL( audioControllers ); + + CreateAudioFormatsArrayL( audioControllers ); + + if ( FileHasAudioSupport( aMediaName, + fileRecognitionResult, + audioControllers, + videoControllers ) ) + { + ret = ELocalAudioFile; + } + + CleanupStack::PopAndDestroy(); // audioControllers + } + + CleanupStack::PopAndDestroy(); // videoControllers + } + + return ret; +} + +// ------------------------------------------------------------------------------------------------- +// CMediaRecognizer::MimeTypeL +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C TBuf CMediaRecognizer::MimeTypeL( const TDesC& aLocalFile ) +{ + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::MimeTypeL()")); + + TDataRecognitionResult fileRecognitionResult; + RecognizeFileL(aLocalFile,fileRecognitionResult); + TPtrC mimeType( KNullDesC ); + + if (fileRecognitionResult.iConfidence >= CApaDataRecognizerType::EPossible) + { + mimeType.Set( fileRecognitionResult.iDataType.Des() ); + } + + return mimeType; +} + +// ------------------------------------------------------------------------------------------------- +// CMediaRecognizer::FreeFilehandle +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C void CMediaRecognizer::FreeFilehandle() +{ + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::FreeFilehandle()")); + + if ( iFileHandle.SubSessionHandle() ) + { + iFileHandle.Close(); + } + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + if ( iFileHandle64.SubSessionHandle() ) + { + iFileHandle64.Close(); + } +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + +} + +// ------------------------------------------------------------------------------------------------- +// CMediaRecognizer::FileHasVideoSupport +// ------------------------------------------------------------------------------------------------- +// +TBool CMediaRecognizer::FileHasVideoSupportL( const TDesC& aFileName, + TDataRecognitionResult& aFileRecognitionResult, + RMMFControllerImplInfoArray& aVideoControllers ) +{ + TBool videoSupport = EFalse; + + if ( aFileRecognitionResult.iConfidence >= CApaDataRecognizerType::EPossible ) + { + for ( TInt i = 0 ; i < aVideoControllers.Count() ; i++ ) + { + RMMFFormatImplInfoArray formats = aVideoControllers[i]->PlayFormats(); + + for ( TInt j = 0; j < formats.Count() ; j++ ) + { + if ( formats[j]->SupportsMimeType( aFileRecognitionResult.iDataType.Des8() ) ) + { + TPtrC8 iDataTypePtr = aFileRecognitionResult.iDataType.Des8(); + + if ( iDataTypePtr.Find( KDataTypeText ) == KErrNotFound ) + { + videoSupport = ETrue; + } + } + else if ( formats[j]->SupportsHeaderDataL( aFileRecognitionResult.iDataType.Des8())) + { + TParsePtrC parser( aFileName ); + TBuf8 fileExtension; + fileExtension.Copy( parser.Ext() ); + + TBuf8 dmExtension( KDmFileExtension ); + TBuf8 dcfExtension( KDcfFileExtension ); + TBuf8 odfExtension( KOdfFileExtension ); + + if ( ( fileExtension.Compare( dmExtension ) == 0 ) || + ( fileExtension.Compare( dcfExtension ) == 0 ) || + ( fileExtension.Compare( odfExtension ) == 0 ) ) + { + videoSupport = ETrue; + } + } + } + } + } + + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::FileHasVideoSupport() support video [%d]"), videoSupport); + + return videoSupport; +} + +// ------------------------------------------------------------------------------------------------- +// CMediaRecognizer::FileHasAudioSupport +// ------------------------------------------------------------------------------------------------- +// +TBool CMediaRecognizer::FileHasAudioSupport( const TDesC& aFileName, + TDataRecognitionResult& aFileRecognitionResult, + RMMFControllerImplInfoArray& aAudioControllers, + RMMFControllerImplInfoArray& aVideoControllers ) +{ + + TBool audioSupport = EFalse; + + if ( aFileRecognitionResult.iConfidence >= CApaDataRecognizerType::EPossible ) + { + for ( TInt i = 0 ; i < aAudioControllers.Count() ; i++ ) + { + RMMFFormatImplInfoArray formats = aAudioControllers[i]->PlayFormats(); + + for ( TInt j = 0; j < formats.Count() ; j++ ) + { + if ( formats[j]->SupportsMimeType( aFileRecognitionResult.iDataType.Des8() ) ) + { + TPtrC8 iDataTypePtr = aFileRecognitionResult.iDataType.Des8(); + + if ( iDataTypePtr.Find( KDataTypeText ) == KErrNotFound ) + { + audioSupport = ETrue; + } + } + } + } + } + else + { + // + // If we can't quess, try with file extension + // + TParsePtrC parser( aFileName ); + TBuf8 fileExtension; + fileExtension.Copy( parser.Ext() ); + for ( TInt i = 0 ; i < aVideoControllers.Count() ; i++ ) + { + RMMFFormatImplInfoArray formats = aAudioControllers[i]->PlayFormats(); + + for ( TInt j = 0; j < formats.Count() ; j++) + { + if ( formats[j]->SupportsFileExtension( fileExtension ) ) + { + audioSupport = ETrue; + } + } + } + } + + if ( audioSupport && + aFileRecognitionResult.iDataType.Des8().CompareF( KDataTypeRNG ) && + aFileRecognitionResult.iDataType.Des8().CompareF( KDataTypeMp3 ) && + aFileRecognitionResult.iDataType.Des8().CompareF( KDataTypeXmp3 ) && + aFileRecognitionResult.iDataType.Des8().CompareF( KDataTypeAudio3gp ) ) + { + audioSupport = EFalse; + } + + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::FileHasAudioSupport() audio support [%d]"), audioSupport); + + return audioSupport; +} + +// ------------------------------------------------------------------------------------------------- +// CMediaRecognizer::MimeTypeL +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C TBuf CMediaRecognizer::MimeTypeL( RFile& aFile ) +{ + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::MimeTypeL( RFile )")); + + if ( aFile.SubSessionHandle() ) + { + iFileHandle.Close(); + // Preferred + User::LeaveIfError( iFileHandle.Duplicate( aFile ) ); + } + + // If new handle is not valid, old might still be + if ( !FileHandleExists() ) + { + User::Leave( KErrBadHandle ); + } + + TDataRecognitionResult fileRecognitionResult; + RecognizeFileL( KNullDesC(), fileRecognitionResult ); + TPtrC mimeType( KNullDesC ); + + if (fileRecognitionResult.iConfidence >= CApaDataRecognizerType::EPossible) + { + mimeType.Set( fileRecognitionResult.iDataType.Des() ); + } + + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::MimeTypeL( RFile ) ret [%S]"),&mimeType); + + return mimeType; +} + +// ------------------------------------------------------------------------------------------------- +// CMediaRecognizer::CreateVideoFormatsArrayL +// ------------------------------------------------------------------------------------------------- +// +void CMediaRecognizer::CreateVideoFormatsArrayL( RMMFControllerImplInfoArray& aVideoControllers ) +{ + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::CreateVideoFormatsArrayL()")); + + CMMFControllerPluginSelectionParameters* cSelect = + CMMFControllerPluginSelectionParameters::NewLC(); + + CMMFFormatSelectionParameters* fSelect = CMMFFormatSelectionParameters::NewLC(); + + // Set the play and record format selection parameters to be blank. + // - format support is only retrieved if requested. + cSelect->SetRequiredPlayFormatSupportL( *fSelect ); + + // Set the media ids + RArray mediaIds; + CleanupClosePushL( mediaIds ); + User::LeaveIfError( mediaIds.Append( KUidMediaTypeVideo ) ); + + //get plugins that support at least video + cSelect->SetMediaIdsL( mediaIds, CMMFPluginSelectionParameters::EAllowOtherMediaIds ); + + // aVideoControllers contains now all plugins that support at least video + cSelect->ListImplementationsL( aVideoControllers ); + + // Clean up + CleanupStack::PopAndDestroy( 3 ); //fSelect, cSelect, mediaIds +} + +// ------------------------------------------------------------------------------------------------- +// CMediaRecognizer::CreateAudioFormatsArrayL +// ------------------------------------------------------------------------------------------------- +// +void CMediaRecognizer::CreateAudioFormatsArrayL( RMMFControllerImplInfoArray& aAudioControllers ) +{ + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::CreateAudioFormatsArrayL()")); + + CMMFControllerPluginSelectionParameters* cSelect = + CMMFControllerPluginSelectionParameters::NewLC(); + + CMMFFormatSelectionParameters* fSelect = CMMFFormatSelectionParameters::NewLC(); + + // Set the play and record format selection parameters to be blank. + // - format support is only retrieved if requested. + cSelect->SetRequiredPlayFormatSupportL( *fSelect ); + + // Set the media ids + RArray mediaIds; + CleanupClosePushL( mediaIds ); + User::LeaveIfError( mediaIds.Append( KUidMediaTypeAudio ) ); + + // Get plugins that supports audio only + cSelect->SetMediaIdsL( mediaIds, CMMFPluginSelectionParameters::EAllowOnlySuppliedMediaIds ); + + // aAudioControllers contains now all audio plugins that support at least audio. + cSelect->ListImplementationsL( aAudioControllers ); + + // Clean up + CleanupStack::PopAndDestroy( 3 ); //fSelect, cSelect, mediaIds +} + +// ------------------------------------------------------------------------------------------------- +// CMediaRecognizer::RecognizeFileL +// ------------------------------------------------------------------------------------------------- +// +void CMediaRecognizer::RecognizeFileL( const TDesC& aFileName, TDataRecognitionResult& aResult ) +{ + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::RecognizeFileL()")); + + aResult.Reset(); + + TInt bufSize( 0 ); + RApaLsSession recognizer; + User::LeaveIfError( recognizer.Connect() ); + + CleanupClosePushL( recognizer ); + + if ( recognizer.GetMaxDataBufSize( bufSize ) || bufSize <= 0 ) + { + bufSize = KDefaultBufferSize; + } + + HBufC8* fBuf = HBufC8::NewLC( bufSize ); + TPtr8 fileBuf = fBuf->Des(); + + // recognize file + if ( FileHandleExists() ) + { + User::LeaveIfError( recognizer.RecognizeData( iFileHandle, aResult ) ); + } +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + else if ( FileHandle64Exists() ) + { + User::LeaveIfError( recognizer.RecognizeData( iFileHandle64, aResult ) ); + } +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + else + { + // read file + User::LeaveIfError( ReadFile( aFileName, fileBuf, bufSize ) ); + User::LeaveIfError( recognizer.RecognizeData( aFileName, fileBuf, aResult ) ); + } + + CleanupStack::PopAndDestroy( 2 ); // fBuf & recognizer +} + +// ------------------------------------------------------------------------------------------------- +// CMediaRecognizer::ReadFile +// ------------------------------------------------------------------------------------------------- +// +TInt CMediaRecognizer::ReadFile( const TDesC& aFileName, TDes8& aBuf, TInt aBufSize ) +{ + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::ReadFile( %S )"), &aFileName); + + TInt err = KErrNone; + + // + // open using 32-bit file handle + // + err = ReadFileViaNewFileHandle( aFileName, aBuf, aBufSize ); + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + if ( err == KErrTooBig ) + { + // + // if 32-bit file handle fails, open using 64-bit file handle + // + err = ReadFileViaNewFileHandle64( aFileName, aBuf, aBufSize ); + } +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + + return err; +} + +// ------------------------------------------------------------------------------------------------- +// CMediaRecognizer::FileHandleExists +// ------------------------------------------------------------------------------------------------- +// +TBool CMediaRecognizer::FileHandleExists() +{ + TInt size = 0; + TInt err = KErrNone; + TBool exist = EFalse; + + if ( iFileHandle.SubSessionHandle() ) + { + err = iFileHandle.Size( size ); + } + + if ( err == KErrNone && size > 0 ) + { + exist = ETrue; + } + + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::FileHandleExists() exist [%d]"), exist); + + return exist; +} + +//-------------------------------------------------------------------------------------------------- +// CMediaRecognizer::IsValidStreamingPrefix +// Check for a valid streaming prefix given a URL +//-------------------------------------------------------------------------------------------------- +// +EXPORT_C TBool CMediaRecognizer::IsValidStreamingPrefix( const TDesC& aUrl ) +{ + TBool retVal = EFalse; + + if ( aUrl.Length() >= KMinPrefixLength ) + { + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::IsValidStreamingPrefix(%S)"), &aUrl); + +#ifdef __WINDOWS_MEDIA + if ( ( ! aUrl.Left(KRtspPrefix().Length()).CompareF(KRtspPrefix) ) || + ( ! aUrl.Left(KHttpPrefix().Length()).CompareF(KHttpPrefix) ) || + ( ! aUrl.Left(KMmsPrefix().Length()).CompareF(KMmsPrefix) ) || + ( ! aUrl.Left(KMmstPrefix().Length()).CompareF(KMmstPrefix) ) || + ( ! aUrl.Left(KHttpTcpPrefix().Length()).CompareF(KHttpTcpPrefix) ) || + ( ! aUrl.Left(KRtspTcpPrefix().Length()).CompareF(KRtspTcpPrefix) ) || + ( ! aUrl.Left(KRtspUdpPrefix().Length()).CompareF(KRtspUdpPrefix) ) ) +#else + if ( ! aUrl.Left( KRtspPrefix().Length() ).CompareF( KRtspPrefix ) ) +#endif + { + retVal = ETrue; + } + } + + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::IsValidStreamingPrefix() ret %d"), retVal); + + return retVal; +} + +//-------------------------------------------------------------------------------------------------- +// CMediaRecognizer::IsValidUrlPrefix +// Check for a valid prefix given a URL +//-------------------------------------------------------------------------------------------------- +// +EXPORT_C TBool CMediaRecognizer::IsValidUrlPrefix( const TDesC& aUrl ) +{ + TBool retVal = EFalse; + + if ( aUrl.Length() >= KMinPrefixLength ) + { + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::IsValidUrlPrefix(%S)"), &aUrl); + + + if ( ( ! aUrl.Left(KFilePrefix().Length()).CompareF(KFilePrefix) ) || +#ifdef __WINDOWS_MEDIA + ( ! aUrl.Left(KHttpPrefix().Length()).CompareF(KHttpPrefix) ) || + ( ! aUrl.Left(KMmsPrefix().Length()).CompareF(KMmsPrefix) ) || + ( ! aUrl.Left(KMmstPrefix().Length()).CompareF(KMmstPrefix) ) || + ( ! aUrl.Left(KHttpTcpPrefix().Length()).CompareF(KHttpTcpPrefix) ) || + ( ! aUrl.Left(KRtspTcpPrefix().Length()).CompareF(KRtspTcpPrefix) ) || + ( ! aUrl.Left(KRtspUdpPrefix().Length()).CompareF(KRtspUdpPrefix) ) || +#endif + ( ! aUrl.Left(KRtspPrefix().Length()).CompareF(KRtspPrefix) ) ) + { + retVal = ETrue; + } + } + + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::IsValidUrlPrefix() ret %d"), retVal); + + return retVal; +} + +//-------------------------------------------------------------------------------------------------- +// CMediaRecognizer::IsValidUrlPrefix +// Check for a valid prefix given a URL +//-------------------------------------------------------------------------------------------------- +// +EXPORT_C TBool CMediaRecognizer::IsValidUrlPrefix( const TDesC8& aUrl ) +{ + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::IsValidUrlPrefix(TDesC8)")); + + TBool retVal = EFalse; + + if ( aUrl.Length() >= KMinPrefixLength ) + { + HBufC16* buf16 = NULL; + + TRAPD( err, buf16 = CnvUtfConverter::ConvertToUnicodeFromUtf8L(aUrl); ); + + if ( ! err ) + { + retVal = IsValidUrlPrefix( buf16->Des() ); + delete buf16; + } + } + + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::IsValidUrlPrefix(TDesC8) ret %d"), retVal); + + return retVal; +} + +// ------------------------------------------------------------------------------------------------- +// CMediaRecognizer::ReadFileViaNewFileHandle +// ------------------------------------------------------------------------------------------------- +// +TInt CMediaRecognizer::ReadFileViaNewFileHandle( const TDesC& aFileName, TDes8& aBuf, TInt aBufSize ) +{ + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::ReadFileViaNewFileHandle()")); + + TInt err = KErrNone; + + RFile file; + err = file.Open( iFs, aFileName, EFileRead | EFileShareReadersOnly ); + + if ( err ) + { + err = file.Open( iFs, aFileName, EFileRead | EFileShareAny ); + } + + if ( err == KErrNone ) + { + // read the beginning of the file + err = file.Read( 0, aBuf, aBufSize ); + file.Close(); + } + + return err; +} + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + +// ------------------------------------------------------------------------------------------------- +// CMediaRecognizer::IdentifyMediaTypeL +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C CMediaRecognizer::TMediaType +CMediaRecognizer::IdentifyMediaTypeL( const TDesC& aMediaName, RFile64& aFile, TBool aIncludeUrls ) +{ + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::IdentifyMediaTypeL( %S, RFile64 )"), &aMediaName); + + if ( aFile.SubSessionHandle() ) + { + iFileHandle64.Close(); + User::LeaveIfError( iFileHandle64.Duplicate( aFile ) ); + } + + TMediaType ret = EUnidentified; + + if ( FileHandle64Exists() ) + { + ret = MediaTypeL( aMediaName ); + } + else if ( aIncludeUrls && IsValidStreamingPrefix( aMediaName ) ) + { + ret = EUrl; + } + + return ret; +} + +// ------------------------------------------------------------------------------------------------- +// CMediaRecognizer::MimeTypeL +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C TBuf CMediaRecognizer::MimeTypeL( RFile64& aFile ) +{ + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::MimeTypeL( RFile64 )")); + + if ( aFile.SubSessionHandle() ) + { + iFileHandle64.Close(); + // Preferred + User::LeaveIfError( iFileHandle64.Duplicate( aFile ) ); + } + + // If new handle is not valid, old might still be + if ( !FileHandle64Exists() ) + { + User::Leave( KErrBadHandle ); + } + + TDataRecognitionResult fileRecognitionResult; + RecognizeFileL( KNullDesC(), fileRecognitionResult ); + TPtrC mimeType( KNullDesC ); + + if (fileRecognitionResult.iConfidence >= CApaDataRecognizerType::EPossible) + { + mimeType.Set( fileRecognitionResult.iDataType.Des() ); + } + + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::DetermineMimeTypeL( RFile64 ) ret [%S]"), &mimeType); + + return mimeType; +} + + +// ------------------------------------------------------------------------------------------------- +// CMediaRecognizer::FileHandle64Exists +// ------------------------------------------------------------------------------------------------- +// +TBool CMediaRecognizer::FileHandle64Exists() +{ + TInt64 size = 0; + TInt err = KErrNone; + TBool exist = EFalse; + + if ( iFileHandle64.SubSessionHandle() ) + { + err = iFileHandle64.Size( size ); + } + + if ( err == KErrNone && size > 0 ) + { + exist = ETrue; + } + + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::FileHandle64Exists() exist [%d]"), exist); + + return exist; +} + +// ------------------------------------------------------------------------------------------------- +// CMediaRecognizer::ReadFileViaCurrentFileHandle64 +// ------------------------------------------------------------------------------------------------- +// +TInt CMediaRecognizer::ReadFileViaNewFileHandle64( const TDesC& aFileName, TDes8& aBuf, TInt aBufSize ) +{ + PLAYBACKHELPER_DEBUG(_L("CMediaRecognizer::ReadFileViaNewFileHandle64()")); + + TInt err = KErrNone; + + RFile64 file; + err = file.Open( iFs, aFileName, EFileRead | EFileShareReadersOnly ); + + if ( err ) + { + err = file.Open( iFs, aFileName, EFileRead | EFileShareAny ); + } + + if ( err == KErrNone ) + { + // read the beginning of the file + err = file.Read( 0, aBuf, aBufSize ); + file.Close(); + } + + return err; +} + +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + + + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playbackhelper/src/streaminglinkmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playbackhelper/src/streaminglinkmodel.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,739 @@ +/* +* Copyright (c) 2008 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: Implementation of CStreamingLinkModel +* +*/ + +// Version : %version: 4 % + + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include + +#ifdef RD_MULTIPLE_DRIVE +#include +#endif //RD_MULTIPLE_DRIVE + +#include "playbackhelper_log.h" + +// CONSTANTS +const TInt KLocalFileIdLength(5); +const TInt KMaxLinkFileSize(5120); //5kB +const TInt KBothSlashes(2); +#ifndef RD_MULTIPLE_DRIVE +const TInt KDriveLetter(2); +#endif //RD_MULTIPLE_DRIVE + +_LIT( KLocalFileId, "file:"); +_LIT( KSlash, "/" ); +_LIT( KDoubleSlash, "//" ); +_LIT( KBackSlash, "\\" ); + +// ============================ MEMBER FUNCTIONS =================================================== + +// ------------------------------------------------------------------------------------------------- +// CStreamingLinkModel::CStreamingLinkModel +// C++ default constructor can NOT contain any code, that +// might leave. +// ------------------------------------------------------------------------------------------------- +// +CStreamingLinkModel::CStreamingLinkModel() +{ + PLAYBACKHELPER_DEBUG(_L("CStreamingLinkModel::CStreamingLinkModel()")); +} + +// ------------------------------------------------------------------------------------------------- +// CStreamingLinkModel::ConstructL +// Symbian 2nd phase constructor can leave. +// ------------------------------------------------------------------------------------------------- +// +void CStreamingLinkModel::ConstructL() +{ + PLAYBACKHELPER_DEBUG(_L("CStreamingLinkModel::ConstructL()")); + + User::LeaveIfError( iFs.Connect() ); +} + +// ------------------------------------------------------------------------------------------------- +// CStreamingLinkModel::NewL +// Two-phased constructor. +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C CStreamingLinkModel* CStreamingLinkModel::NewL() +{ + PLAYBACKHELPER_DEBUG(_L("CStreamingLinkModel::NewL()")); + + CStreamingLinkModel* self = new( ELeave ) CStreamingLinkModel(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; +} + +// ------------------------------------------------------------------------------------------------- +// CStreamingLinkModel::~CStreamingLinkModel +// Destructor +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C CStreamingLinkModel::~CStreamingLinkModel() +{ + PLAYBACKHELPER_DEBUG(_L("CStreamingLinkModel::~CStreamingLinkModel()")); + + for ( TInt i = 0 ; i < iLinkArray.Count() ; i++ ) + { + delete iLinkArray[i]->link; + } + + iLinkArray.ResetAndDestroy(); + + iFileHandle.Close(); + iFs.Close(); +} + +// ------------------------------------------------------------------------------------------------- +// CStreamingLinkModel::OpenLinkFileL +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C TInt CStreamingLinkModel::OpenLinkFileL( const TDesC& aLinkFileName, + TBool aEnableFiltering ) +{ + PLAYBACKHELPER_DEBUG(_L("CStreamingLinkModel::OpenLinkFileL()")); + + // + // exit if file is not found + // + if ( !BaflUtils::FileExists( iFs, aLinkFileName ) ) + { + User::Leave( KErrNotFound ); + } + + // + // open via file name + // + RFile ramFile; + TInt err = ramFile.Open( iFs, aLinkFileName, EFileRead | EFileShareReadersOnly ); + + if( err ) + { + err = ramFile.Open( iFs, aLinkFileName, EFileRead | EFileShareAny ); + } + + CleanupClosePushL( ramFile ); + + // + // populate the links + // + TInt result = PopulateRamLinksL( ramFile, aEnableFiltering ); + + CleanupStack::PopAndDestroy(); //ramFile + + return result; +} + +// ------------------------------------------------------------------------------------------------- +// CStreamingLinkModel::OpenLinkFileL +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C TInt CStreamingLinkModel::OpenLinkFileL( RFile& aFile, + TBool aEnableFiltering ) +{ + PLAYBACKHELPER_DEBUG(_L("CStreamingLinkModel::OpenLinkFileL()")); + + RFile ramFile; + + if ( FileHandleExists(aFile) ) + { + iFileHandle.Close(); + User::LeaveIfError( iFileHandle.Duplicate( aFile ) ); + User::LeaveIfError( ramFile.Duplicate( iFileHandle ) ); + CleanupClosePushL( ramFile ); + } + else + { + User::Leave( KErrNotFound ); + } + + // + // populate the links + // + TInt result = PopulateRamLinksL( ramFile, aEnableFiltering ); + + CleanupStack::PopAndDestroy(); //ramFile + + return result; +} + +// ------------------------------------------------------------------------------------------------- +// CStreamingLinkModel::MaxLinkLength +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C TInt CStreamingLinkModel::MaxLinkLength() +{ + TInt length = 0; + + for ( TInt index = 0; index < iLinkArray.Count(); index++) + { + length = length + iLinkArray[index]->link->Length(); + } + + PLAYBACKHELPER_DEBUG(_L("CStreamingLinkModel::MaxLinkLength() max length = [%d] "), length ); + + return length; +} + +// ------------------------------------------------------------------------------------------------- +// CStreamingLinkModel::GetNextLinkL +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C TInt CStreamingLinkModel::GetNextLinkL( TDes& aLink, TBool& aLocalFile, TBool aParse ) +{ + PLAYBACKHELPER_DEBUG(_L("CStreamingLinkModel::GetNextLinkL()") ); + + aLocalFile = EFalse; + TInt ret = KErrNone; + + if ( iLinkCount < iLinkArray.Count() ) + { + aLink = iLinkArray[iLinkCount]->link->Des(); + iLinkCount++; + + // local file --> parse it. + if ( aParse && !aLink.Left( KLocalFileIdLength ).CompareF( KLocalFileId ) ) + { + // remove "file:" + aLocalFile = ETrue; + aLink = aLink.Mid( KLocalFileIdLength ); + + // remove extra '/' from begin + while ( !aLink.Left( 1 ).CompareF( KSlash ) ) + { + aLink = aLink.Mid( 1 ); + } + + // change "//" and "/" inside body to "\" + TInt index = aLink.FindF( KDoubleSlash ); + while ( index != KErrNotFound ) + { + aLink.Replace( index, KBothSlashes, KBackSlash ); + index = aLink.FindF( KDoubleSlash ); + } + + index = aLink.FindF( KSlash ); + + while ( index != KErrNotFound ) + { + aLink.Replace( index, 1, KBackSlash ); + index = aLink.FindF( KSlash ); + } + } + } + else + { + ret = KErrNotFound; + } + + return ret; +} + +// ------------------------------------------------------------------------------------------------- +// CStreamingLinkModel::IsSeekable +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C TBool CStreamingLinkModel::IsSeekable() +{ + PLAYBACKHELPER_DEBUG(_L("CStreamingLinkModel::IsSeekable()") ); + + TBool ret = ETrue; + + // link count has been incremented in the GetNextlink + if ( iLinkCount <= iLinkArray.Count() ) + { + ret = iLinkArray[iLinkCount-1]->seek; + } + + return ( ret ); +} + +// ------------------------------------------------------------------------------------------------- +// CStreamingLinkModel::ReadNextLine +// ------------------------------------------------------------------------------------------------- +// +TInt CStreamingLinkModel::ReadNextLine( TDes& aLine ) +{ + PLAYBACKHELPER_DEBUG(_L("CStreamingLinkModel::ReadNextLine()")); + + TInt ret = KErrNone; + TInt lineChange = iBufferPtr.LocateF( EKeyLineFeed ); + + if ( lineChange == KErrNotFound ) + { + // No line change was found --> last line had no line change + // Copy last line to (unicode) aLink + CnvUtfConverter::ConvertToUnicodeFromUtf8( aLine, iBufferPtr ); + ret = KErrEof; + } + else + { + //Found line change + TInt length = lineChange; + if ( ( length > 0 ) && ( iBufferPtr[length-1] == EKeyEnter ) ) + { + length--; + } + + // Copy line to (unicode) aLink + CnvUtfConverter::ConvertToUnicodeFromUtf8( aLine, iBufferPtr.Left( length ) ); + + // Move past the line feed + iBufferPtr.Set( iBufferPtr.Mid( ++lineChange ) ); + + if ( !iBufferPtr.Length() ) + { + // File end reached. + ret = KErrEof; + } + } + + return ret; +} + +// ------------------------------------------------------------------------------------------------- +// CStreamingLinkModel::CreateNewLinkFileL +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C TInt CStreamingLinkModel::CreateNewLinkFileL( const TDesC& aNewLinkFileName, + MDesCArray* aLinkArray, + TBool aOverWrite ) +{ + PLAYBACKHELPER_DEBUG(_L("CStreamingLinkModel::CreateNewLinkFileL()")); + + TInt result = KErrNone; + + // check if file exists already + if ( !aOverWrite && BaflUtils::FileExists( iFs, aNewLinkFileName ) ) + { + result = KErrAlreadyExists; + } + else + { + //check disk space + TInt bytesRequired = 0; + TInt index = 0; + + for ( index = 0; index < aLinkArray->MdcaCount(); index++ ) + { + bytesRequired = bytesRequired + aLinkArray->MdcaPoint( index ).Size(); + } + + TParsePtrC parse(aNewLinkFileName); + +#ifdef RD_MULTIPLE_DRIVE + DriveInfo::TDriveArray driveArray; + TInt drive = 0; + + RFs::CharToDrive( parse.Drive()[0], drive ); + + //check disk space + if( SysUtil::DiskSpaceBelowCriticalLevelL( &iFs, bytesRequired, drive ) ) + { + result = KErrDiskFull; + } +#else //RD_MULTIPLE_DRIVE + if( parse.Drive().CompareF( PathInfo::MemoryCardRootPath().Left( KDriveLetter ) ) == 0 ) + { + if ( SysUtil::MMCSpaceBelowCriticalLevelL( &iFs, bytesRequired ) ) + { + result = KErrDiskFull; + } + } + else if ( SysUtil::FFSSpaceBelowCriticalLevelL( &iFs, bytesRequired ) ) + { + User::Leave( KErrDiskFull ); + } +#endif //RD_MULTIPLE_DRIVE + + if ( result == KErrNone ) + { + // save + RFile file; + User::LeaveIfError( file.Replace( iFs, aNewLinkFileName, EFileWrite ) ); + CleanupClosePushL( file ); + + for ( index = 0; result == KErrNone && index < aLinkArray->MdcaCount(); index++ ) + { + // Convert to ascii. Some special marks like '? might take 1-3 letters. + HBufC8* link = HBufC8::NewLC( aLinkArray->MdcaPoint( index ).Length() * 3 + 1 ); + TPtr8 ptr = link->Des(); + CnvUtfConverter::ConvertFromUnicodeToUtf8( ptr, aLinkArray->MdcaPoint( index ) ); + ptr.Append( EKeyLineFeed ); + + // write to file + result = file.Write( ptr ); + + CleanupStack::PopAndDestroy( link ); + } + + file.Flush(); + CleanupStack::PopAndDestroy(); // file + + } + } + + return result; +} + +// ------------------------------------------------------------------------------------------------- +// CStreamingLinkModel::FreeFilehandle +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C void CStreamingLinkModel::FreeFilehandle() +{ + PLAYBACKHELPER_DEBUG(_L("CStreamingLinkModel::FreeFilehandle()")); + + iFileHandle.Close(); +} + +// ------------------------------------------------------------------------------------------------- +// CStreamingLinkModel::FileHandleExists +// ------------------------------------------------------------------------------------------------- +// +TBool CStreamingLinkModel::FileHandleExists( RFile& aFile ) +{ + TInt size = 0; + TInt err = KErrNone; + TBool exist = EFalse; + + if ( aFile.SubSessionHandle() ) + { + err = aFile.Size( size ); + } + + if ( !err && size ) + { + exist = ETrue; + } + + PLAYBACKHELPER_DEBUG(_L("CStreamingLinkModel::FileHandleExists() exist = [%d]"), exist); + + return exist; +} + +// ------------------------------------------------------------------------------------------------- +// CStreamingLinkModel::MaxLinkLength +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C TInt CStreamingLinkModel::MultiLinksCount() +{ + TInt cnt = iLinkArray.Count(); + + PLAYBACKHELPER_DEBUG(_L("CStreamingLinkModel::MultiLinksCount() count = [%d]"), cnt); + + return cnt; +} + +// ------------------------------------------------------------------------------------------------- +// CStreamingLinkModel::ResetLinkCount +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C void CStreamingLinkModel::ResetLinkCount() +{ + PLAYBACKHELPER_DEBUG(_L("CStreamingLinkModel::ResetLinkCount()")); + + iLinkCount = 0; +} + +// ----------------------------------------------------------------------------- +// CStreamingLinkModel::OpenAsxFileL +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CStreamingLinkModel::OpenAsxFileL( const TDesC& aLinkFileName, + TBool aEnableFiltering ) +{ + PLAYBACKHELPER_DEBUG(_L("CStreamingLinkModel::OpenAsxFileL(%S,%d)"), + &aLinkFileName,aEnableFiltering); + TInt result = KErrNone; + +#ifdef __WINDOWS_MEDIA + + CAsxParser* asxParser = NULL; + TRAPD( err, + { + asxParser = CAsxParser::NewL( aLinkFileName ); + } ); //TRAPD + + if ( err ) + { + result = KErrNotSupported; + } + else + { + CleanupStack::PushL( asxParser ); + result = PopulateAsxLinksL( asxParser, aEnableFiltering ); + CleanupStack::PopAndDestroy(); // asxParser + } + + +#else // __WINDOWS_MEDIA + + result = KErrNotSupported; + +#endif // __WINDOWS_MEDIA + + return result; +} + +// ----------------------------------------------------------------------------- +// CStreamingLinkModel::OpenAsxFileL +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CStreamingLinkModel::OpenAsxFileL( RFile& aFile, + TBool aEnableFiltering ) +{ + PLAYBACKHELPER_DEBUG(_L("CStreamingLinkModel::OpenAsxFileL(aFile,%d)"),aEnableFiltering); + + TInt result = KErrNone; + +#ifdef __WINDOWS_MEDIA + + CAsxParser* asxParser = NULL; + TRAPD( err, + { + asxParser = CAsxParser::NewL( aFile ); + } ); //TRAPD + + if ( err ) + { + result = KErrNotSupported; + } + else + { + CleanupStack::PushL( asxParser ); + result = PopulateAsxLinksL( asxParser, aEnableFiltering ); + CleanupStack::PopAndDestroy(); // asxParser + } + + +#else // __WINDOWS_MEDIA + + result = KErrNotSupported; + +#endif // __WINDOWS_MEDIA + + return result; +} + +// ----------------------------------------------------------------------------- +// CStreamingLinkModel::PopulateRamLinksL +// ----------------------------------------------------------------------------- +// +TInt CStreamingLinkModel::PopulateRamLinksL( RFile aRamFile, + TBool aEnableFiltering ) +{ + PLAYBACKHELPER_DEBUG(_L("CStreamingLinkModel::PopulateRamLinksL()")); + + for ( TInt i = 0 ; i < iLinkArray.Count() ; i++ ) + { + delete iLinkArray[i]->link; + } + + iLinkArray.ResetAndDestroy(); + iLinkCount = 0; + + TInt size = 0; + TInt result = KErrNone; + + if ( aRamFile.Size( size ) == KErrNone && size <= KMaxLinkFileSize ) + { + HBufC8* buffer = HBufC8::NewLC( size ); + TPtr8 ptr = buffer->Des(); + TInt ret = KErrNone; + + // read file to buffer + User::LeaveIfError( aRamFile.Read( ptr ) ); + iBufferPtr.Set( ptr ); + + CMediaRecognizer* recognizer = CMediaRecognizer::NewL(); + CleanupStack::PushL( recognizer ); + + // Get links from buffer + while ( ret == KErrNone ) + { + // Create a linkitem ptr + LinkStruct* linkItem = new( ELeave ) LinkStruct; + CleanupStack::PushL( linkItem ); + + linkItem->seek = ETrue; + + linkItem->link = HBufC::NewLC( buffer->Length() ); + TPtr ptr2 = linkItem->link->Des(); + ret = ReadNextLine( ptr2 ); + + if ( aEnableFiltering ) + { + // check if line is link or not + if ( recognizer->IsValidUrlPrefix( ptr2 ) ) + { + ptr2.TrimRight(); + iLinkArray.Append( linkItem ); + } + } + else + { + iLinkArray.Append( linkItem ); + } + + CleanupStack::Pop(2); // pop the linkItem and the HbufC created for linkItem->link + } + + CleanupStack::PopAndDestroy(2); // buffer, recognizer + + if ( iLinkArray.Count() == 0 ) + { + result = KErrNotFound; + } + } + else + { + result = KErrNotSupported; + } + + return result; +} + +// ----------------------------------------------------------------------------- +// CStreamingLinkModel::PopulateAsxLinksL +// ----------------------------------------------------------------------------- +// +TInt CStreamingLinkModel::PopulateAsxLinksL( CAsxParser* aAsxParser, + TBool aEnableFiltering ) +{ + PLAYBACKHELPER_DEBUG(_L("CStreamingLinkModel::PopulateAsxLinksL()")); + + for ( TInt i = 0 ; i < iLinkArray.Count() ; i++ ) + { + delete iLinkArray[i]->link; + } + + iLinkArray.ResetAndDestroy(); + iLinkCount = 0; + + TInt ret = KErrNone; + + if ( aAsxParser ) + { + TUint urlCount = 0; + AsxStruct* asxItem; + + aAsxParser->GetUrlCount( urlCount ); + if ( urlCount ) + { + CMediaRecognizer* recognizer = CMediaRecognizer::NewL(); + CleanupStack::PushL( recognizer ); + + for (TInt i=1; i <= urlCount; i++) + { + // Get the asx struct from the parser + asxItem = aAsxParser->GetUrl(i); + // Set the url to the bufferptr + iBufferPtr.Set(asxItem->url->Des()); + + // Create a linkitem ptr + LinkStruct* linkItem = new( ELeave ) LinkStruct; + // push onto the cleanup stack + CleanupStack::PushL( linkItem ); + + // Allocate heap mem for the link + linkItem->link = HBufC::NewLC( asxItem->url->Length() ); + //Get the ptr to the link + TPtr ptr2 = linkItem->link->Des(); + // read the asx url into the link ptr + ReadNextLine( ptr2 ); + + // Get the additional attibutes from the asx item + linkItem->seek = asxItem->seek; + + if ( aEnableFiltering ) + { + // check if line is link or not + if ( recognizer->IsValidUrlPrefix( ptr2 ) ) + { + ptr2.TrimRight(); + iLinkArray.Append( linkItem ); + } + } + else + { + iLinkArray.Append( linkItem ); + } + + CleanupStack::Pop(2); // pop the linkItem and the HbufC created for linkItem->link + + } + + CleanupStack::PopAndDestroy(); //recognizer + } + else + { + ret = KErrNotFound; + } + + if ( iLinkArray.Count() == 0 ) + { + ret = KErrNotFound; + } + } + else + { + ret = KErrNotSupported; + } + + return ret; + } + +// ------------------------------------------------------------------------------------------------- +// CStreamingLinkModel::AreAllLinksLocal +// returns true if all the links are local +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C TBool CStreamingLinkModel::AreAllLinksLocal() +{ + PLAYBACKHELPER_DEBUG(_L("CStreamingLinkModel::AreAllLinksLocal()") ); + + TBool ret = ETrue; + + if ( iLinkArray.Count() ) + { + for ( TInt linkCount = 0 ; linkCount < iLinkArray.Count() ; linkCount++ ) + { + TPtr aLink = ( iLinkArray[linkCount]->link )->Des(); + + if ( aLink.Left( KLocalFileIdLength ).CompareF( KLocalFileId ) ) + { + ret = EFalse; + break; + } + } + } + + return ret; +} + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playlistengine/BWINS/mpxplaylistengineU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playlistengine/BWINS/mpxplaylistengineU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,17 @@ +EXPORTS + ??1CMPXPlaylistEngine@@UAE@XZ @ 1 NONAME ; CMPXPlaylistEngine::~CMPXPlaylistEngine(void) + ??1CMPXPlaylistPluginHandler@@UAE@XZ @ 2 NONAME ; CMPXPlaylistPluginHandler::~CMPXPlaylistPluginHandler(void) + ?CancelRequests@CMPXPlaylistEngine@@QAEXXZ @ 3 NONAME ; void CMPXPlaylistEngine::CancelRequests(void) + ?ExternalizePlaylistL@CMPXPlaylistEngine@@QAEXABVCMPXMedia@@ABVTDesC16@@@Z @ 4 NONAME ; void CMPXPlaylistEngine::ExternalizePlaylistL(class CMPXMedia const &, class TDesC16 const &) + ?InternalizePlaylistL@CMPXPlaylistEngine@@QAEXABVRFile@@@Z @ 5 NONAME ; void CMPXPlaylistEngine::InternalizePlaylistL(class RFile const &) + ?InternalizePlaylistL@CMPXPlaylistEngine@@QAEXABVTDesC16@@@Z @ 6 NONAME ; void CMPXPlaylistEngine::InternalizePlaylistL(class TDesC16 const &) + ?IsPlaylistL@CMPXPlaylistEngine@@QAEHABVTDesC16@@@Z @ 7 NONAME ; int CMPXPlaylistEngine::IsPlaylistL(class TDesC16 const &) + ?NewL@CMPXPlaylistEngine@@SAPAV1@AAVMMPXPlaylistEngineObserver@@@Z @ 8 NONAME ; class CMPXPlaylistEngine * CMPXPlaylistEngine::NewL(class MMPXPlaylistEngineObserver &) + ?NewL@CMPXPlaylistPluginHandler@@SAPAV1@AAVMMPXPlaylistPluginObserver@@AAVMMPXPluginHandlerObserver@@AAVRFs@@ABV?$CArrayFix@USCharacterSet@CCnvCharacterSetConverter@@@@3@Z @ 9 NONAME ; class CMPXPlaylistPluginHandler * CMPXPlaylistPluginHandler::NewL(class MMPXPlaylistPluginObserver &, class MMPXPluginHandlerObserver &, class RFs &, class CArrayFix const &, class CArrayFix const &) + ?PlaylistPluginHandler@CMPXPlaylistEngine@@QAEAAVCMPXPlaylistPluginHandler@@XZ @ 10 NONAME ; class CMPXPlaylistPluginHandler & CMPXPlaylistEngine::PlaylistPluginHandler(void) + ?SelectPlaylistPluginL@CMPXPlaylistPluginHandler@@QAEXABVRFile@@@Z @ 11 NONAME ; void CMPXPlaylistPluginHandler::SelectPlaylistPluginL(class RFile const &) + ?SelectPlaylistPluginL@CMPXPlaylistPluginHandler@@QAEXABVTDesC16@@@Z @ 12 NONAME ; void CMPXPlaylistPluginHandler::SelectPlaylistPluginL(class TDesC16 const &) + ?SelectPlaylistPluginL@CMPXPlaylistPluginHandler@@QAEXABVTDesC16@@ABVTDesC8@@@Z @ 13 NONAME ; void CMPXPlaylistPluginHandler::SelectPlaylistPluginL(class TDesC16 const &, class TDesC8 const &) + ?SelectPlaylistPluginL@CMPXPlaylistPluginHandler@@QAEXABVTUid@@@Z @ 14 NONAME ; void CMPXPlaylistPluginHandler::SelectPlaylistPluginL(class TUid const &) + ?SelectPlaylistPluginL@CMPXPlaylistPluginHandler@@QAEXK@Z @ 15 NONAME ; void CMPXPlaylistPluginHandler::SelectPlaylistPluginL(unsigned long) + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playlistengine/data/101FFC24.RSS --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playlistengine/data/101FFC24.RSS Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2008 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: Resource file. +* +*/ + + +#include +#include + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KMPXPlaylistRecognizerDllUid; // mpxplaylistrecognizer.dll + + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x101F7D87; //Const for all Data Recognizers + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMPXPlaylistRecognizerImplUid; // CMPXPlaylistRecognizer + version_no = 1; + display_name = "playlist recognizer"; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } + + + + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playlistengine/data/mpxplaylisttopcharacterset.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playlistengine/data/mpxplaylisttopcharacterset.rss Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,794 @@ +/* +* Copyright (c) 2007 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: Resource file. +* +*/ + + +// INCLUDES +#include +#include +#include "mpxplaylisttopcharacterset.rh" +#include "mpxplaylistsupplementalcharsets.hrh" + +// RESOURCE DEFINITIONS + +//---------------------------------------------------- +// Character set resources +// copied and revised based on MetadataUtility's +// TopCharacterSet.rss version 9 +//---------------------------------------------------- + + +//---------------------------------------------------- +// Resource : r_mpx_playlist_albanian_char_set +// Description : Albanian character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_albanian_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88591, + KCharacterSetIdentifierIso88592 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_arabic_char_set +// Description : Arabic character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_arabic_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88596, + // windows 1256 + KCharacterSetIdentifierCp1256 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_bosnian_char_set +// Description : Bosnian character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_bosnian_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88592 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_bulgarian_char_set +// Description : Bulgarian character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_bulgarian_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88595, + // Windows 1251 + KCharacterSetIdentifierCp1251 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_taiwan_hk_chinese_char_set +// Description : Taiwan HongKong Chinese character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_taiwan_hk_chinese_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierBig5 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_chinese_char_set +// Description : Chinese character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_chinese_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierGb2312, + KCharacterSetIdentifierGbk + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_croatian_char_set +// Description : Croatian character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_croatian_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88592, + // windows 1250 + KCharacterSetIdentifierCp1250 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_czech_char_set +// Description : Czech character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_czech_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88592, + // windows 1250 + KCharacterSetIdentifierCp1250 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_danish_char_set +// Description : Danish character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_danish_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88591, + KCharacterSetIdentifierIso885915, + // windows 1252 + KCharacterSetIdentifierCp1252 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_dutch_char_set +// Description : Dutch character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_dutch_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88591, + KCharacterSetIdentifierIso885915, + // windows 1252 + KCharacterSetIdentifierCp1252 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_english_char_set +// Description : English character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_english_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierAscii, + KCharacterSetIdentifierIso88591, + KCharacterSetIdentifierIso885915, + // windows 1252 + KCharacterSetIdentifierCp1252 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_estonian_char_set +// Description : Estonian character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_estonian_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88591, + KCharacterSetIdentifierIso88594, + KCharacterSetIdentifierIso885910, + KCharacterSetIdentifierIso885913, + // windows 1257 + KCharacterSetIdentifierCp1257 + + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_farsi_char_set +// Description : Farsi character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_farsi_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88596, + // Windows-1256 + KCharacterSetIdentifierCp1256 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_finnish_char_set +// Description : Finnish character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_finnish_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88591, + KCharacterSetIdentifierIso885915, + // windows 1252 + KCharacterSetIdentifierCp1252 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_french_char_set +// Description : English character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_french_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88591, + KCharacterSetIdentifierIso885915, + // windows 1252 + KCharacterSetIdentifierCp1252 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_german_char_set +// Description : German character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_german_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88591, + KCharacterSetIdentifierIso885915, + // windows 1252 + KCharacterSetIdentifierCp1252 + }; + } + + +//---------------------------------------------------- +// Resource : r_mpx_playlist_greek_char_set +// Description : Greek character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_greek_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88597, + // windows 1253 + KCharacterSetIdentifierCp1253 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_hebrew_char_set +// Description : Hebrew character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_hebrew_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88598, + // windows 1255 + KCharacterSetIdentifierCp1255 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_hungarian_char_set +// Description : Hungarian character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_hungarian_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88592, + // windows 1250 + KCharacterSetIdentifierCp1250 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_icelandic_char_set +// Description : Icelandic character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_icelandic_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88591, + KCharacterSetIdentifierIso88599, + KCharacterSetIdentifierIso885915, + // windows 1252 + KCharacterSetIdentifierCp1252 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_indian_char_set +// Description : Indian character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_indian_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + // ISCII + KCharacterSetIdentifierISCII + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_indonesian_char_set +// Description : Indonesian character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_indonesian_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierAscii, + KCharacterSetIdentifierIso88591, + // Windows 1252 + KCharacterSetIdentifierCp1252 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_irish_char_set +// Description : Irish character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_irish_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88591, + KCharacterSetIdentifierIso885914 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_italian_char_set +// Description : Italian character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_italian_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88591, + KCharacterSetIdentifierIso885915, + // Windows 1252 + KCharacterSetIdentifierCp1252 + }; + } + + +//---------------------------------------------------- +// Resource : r_mpx_playlist_japanese_char_set +// Description : Japanese character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_japanese_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierShiftJis, + KCharacterSetIdentifierIso2022Jp, + KCharacterSetIdentifierEucJpPacked + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_latvian_char_set +// Description : Latvian character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_latvian_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88594, + KCharacterSetIdentifierIso885910, + KCharacterSetIdentifierIso885913, + // Windows 1257 + KCharacterSetIdentifierCp1257 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_lithuanian_char_set +// Description : Lithuanian character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_lithuanian_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88594, + KCharacterSetIdentifierIso885910, + KCharacterSetIdentifierIso885913, + // Windows 1257 + KCharacterSetIdentifierCp1257 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_malay_char_set +// Description : Malay character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_malay_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierAscii, + KCharacterSetIdentifierIso88591, + KCharacterSetIdentifierIso885915, + // Windows 1252 + KCharacterSetIdentifierCp1252 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_maltese_char_set +// Description : Maltese character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_maltese_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88593 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_norwegian_char_set +// Description : Norwegian character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_norwegian_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88591, + KCharacterSetIdentifierIso885915, + // Windows 1252 + KCharacterSetIdentifierCp1252 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_pilipino_char_set +// Description : Pilipino character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_pilipino_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88591, + // Windows 1252 + KCharacterSetIdentifierCp1252 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_polish_char_set +// Description : Polish character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_polish_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88592, + // Windows 1250 + KCharacterSetIdentifierCp1250 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_portuguese_char_set +// Description : Portuguese character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_portuguese_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88591, + KCharacterSetIdentifierIso885915, + // Windows 1252 + KCharacterSetIdentifierCp1252 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_romanian_char_set +// Description : Romanian character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_romanian_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88592, + // Windows 1250 + KCharacterSetIdentifierCp1250 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_russian_char_set +// Description : Russian character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_russian_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88595, + // Windows 1251 + KCharacterSetIdentifierCp1251, + // KOI8-R + KCharacterSetIdentifierKOI8R + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_sami_char_set +// Description : Sami character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_sami_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88594, + KCharacterSetIdentifierIso885910 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_serbian_char_set +// Description : Serbian character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_serbian_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88592, + KCharacterSetIdentifierIso88595, + // Windows 1250 + KCharacterSetIdentifierCp1250 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_slovak_char_set +// Description : Slovak character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_slovak_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88592, + // Windows 1250 + KCharacterSetIdentifierCp1250 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_slovenian_char_set +// Description : Slovenian character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_slovenian_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88592, + // Windows 1250 + KCharacterSetIdentifierCp1250 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_spanish_char_set +// Description : Spanish character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_spanish_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88591, + KCharacterSetIdentifierIso885915, + // Windows 1252 + KCharacterSetIdentifierCp1252 + }; + } + + +//---------------------------------------------------- +// Resource : r_mpx_playlist_swedish_char_set +// Description : Swedish character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_swedish_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88591, + KCharacterSetIdentifierIso885915, + // Windows 1252 + KCharacterSetIdentifierCp1252 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_thai_char_set +// Description : Thai character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_thai_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + // TIS-620 + KCharacterSetIdentifierTIS620, + // Windows-874 + KCharacterSetIdentifierCp874 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_turkish_char_set +// Description : Turkish character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_turkish_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88593, + // Windows 1254 + KCharacterSetIdentifierCp1254 + }; + } + + +//---------------------------------------------------- +// Resource : r_mpx_playlist_ukrainian_char_set +// Description : Ukrainian character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_ukrainian_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88595, + // KOI8-U + KCharacterSetIdentifierKOI8U + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_urdu_char_set +// Description : Urdu character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_urdu_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + KCharacterSetIdentifierIso88595, + KCharacterSetIdentifierIso88596, + // Windows-1256 + KCharacterSetIdentifierCp1256 + }; + } + +//---------------------------------------------------- +// Resource : r_mpx_playlist_vietnamese_char_set +// Description : Vietnamese character sets +//---------------------------------------------------- +// +RESOURCE MPX_PLAYLIST_CHARACTER_SET_ENCODING r_mpx_playlist_vietnamese_char_set + { + character_set_id = + { + KCharacterSetIdentifierUtf8, + // Windows-1258 + KCharacterSetIdentifierCp1258 + }; + } + +// End of File + + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playlistengine/eabi/mpxplaylistengineU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playlistengine/eabi/mpxplaylistengineU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,25 @@ +EXPORTS + _ZN18CMPXPlaylistEngine11IsPlaylistLERK7TDesC16 @ 1 NONAME + _ZN18CMPXPlaylistEngine14CancelRequestsEv @ 2 NONAME + _ZN18CMPXPlaylistEngine20ExternalizePlaylistLERK9CMPXMediaRK7TDesC16 @ 3 NONAME + _ZN18CMPXPlaylistEngine20InternalizePlaylistLERK5RFile @ 4 NONAME + _ZN18CMPXPlaylistEngine20InternalizePlaylistLERK7TDesC16 @ 5 NONAME + _ZN18CMPXPlaylistEngine21PlaylistPluginHandlerEv @ 6 NONAME + _ZN18CMPXPlaylistEngine4NewLER26MMPXPlaylistEngineObserver @ 7 NONAME + _ZN18CMPXPlaylistEngineD0Ev @ 8 NONAME + _ZN18CMPXPlaylistEngineD1Ev @ 9 NONAME + _ZN18CMPXPlaylistEngineD2Ev @ 10 NONAME + _ZN25CMPXPlaylistPluginHandler21SelectPlaylistPluginLERK4TUid @ 11 NONAME + _ZN25CMPXPlaylistPluginHandler21SelectPlaylistPluginLERK5RFile @ 12 NONAME + _ZN25CMPXPlaylistPluginHandler21SelectPlaylistPluginLERK7TDesC16 @ 13 NONAME + _ZN25CMPXPlaylistPluginHandler21SelectPlaylistPluginLERK7TDesC16RK6TDesC8 @ 14 NONAME + _ZN25CMPXPlaylistPluginHandler21SelectPlaylistPluginLEm @ 15 NONAME + _ZN25CMPXPlaylistPluginHandler4NewLER26MMPXPlaylistPluginObserverR25MMPXPluginHandlerObserverR3RFsRK9CArrayFixIN25CCnvCharacterSetConverter13SCharacterSetEESB_ @ 16 NONAME + _ZN25CMPXPlaylistPluginHandlerD0Ev @ 17 NONAME + _ZN25CMPXPlaylistPluginHandlerD1Ev @ 18 NONAME + _ZN25CMPXPlaylistPluginHandlerD2Ev @ 19 NONAME + _ZTI18CMPXPlaylistEngine @ 20 NONAME ; ## + _ZTI25CMPXPlaylistPluginHandler @ 21 NONAME ; ## + _ZTV18CMPXPlaylistEngine @ 22 NONAME ; ## + _ZTV25CMPXPlaylistPluginHandler @ 23 NONAME ; ## + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playlistengine/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playlistengine/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2006 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 for project playlist subsystem. +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../rom/mpxplaylistengine.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mpxplaylistengine.iby) +../rom/mpxplaylistrecognizerplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mpxplaylistrecognizerplugin.iby) + +PRJ_MMPFILES +mpxplaylistrecognizer.mmp +mpxplaylistengine.mmp + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playlistengine/group/mpxplaylistengine.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playlistengine/group/mpxplaylistengine.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2006 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: playlist engine project specification +* +*/ + + + +#include +#include + +TARGET mpxplaylistengine.dll +CAPABILITY CAP_GENERAL_DLL +TARGETTYPE DLL +UID 0x1000008D 0x101FFC23 +VENDORID VID_DEFAULT + +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../data +START RESOURCE mpxplaylisttopcharacterset.rss +HEADER +TARGET mpxplaylisttopcharacterset.rsc +TARGETPATH RESOURCE_FILES_DIR +END + +SOURCEPATH ../src +SOURCE mpxplaylistpluginhandler.cpp +SOURCE mpxplaylistengine.cpp + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY bafl.lib +LIBRARY apmime.lib +LIBRARY SysLangUtil.lib +LIBRARY charconv.lib +LIBRARY mpxcommon.lib + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playlistengine/group/mpxplaylistrecognizer.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playlistengine/group/mpxplaylistrecognizer.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2006 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: playlist recognizer +* +*/ + + + +#include +#include +#include + +TARGET mpxplaylistrecognizer.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x101FFC24 + +VENDORID VID_DEFAULT +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../src +SOURCE mpxplaylistrecognizer.cpp + +SOURCEPATH ../data +START RESOURCE 101FFC24.RSS +TARGET mpxplaylistrecognizer.rsc +END + +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY apmime.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY mpxcommon.lib + + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playlistengine/inc/mpxplaylistcharacterset.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playlistengine/inc/mpxplaylistcharacterset.hrh Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,215 @@ +/* +* Copyright (c) 2007 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: All needed character set IDs are included here +* +*/ + + + +#ifndef __MPXPLAYLISTCHARACTERSET_HRH__ +#define __MPXPLAYLISTCHARACTERSET_HRH__ + +// copied from MetadataUtility's CharacterSet.hrh + +// INCLUDES + +/** +UTF-7 +@publishedAll +@released +*/ +#define KCharacterSetIdentifierUtf7 0x1000582c +/** +UTF-8 +@publishedAll +@released +*/ +#define KCharacterSetIdentifierUtf8 0x1000582d +/** +IMAP UTF-7 +@publishedAll +@released +*/ +#define KCharacterSetIdentifierImapUtf7 0x1000582e +/** +Java UTF-8 +@publishedAll +@released +*/ +#define KCharacterSetIdentifierJavaConformantUtf8 0x1000582f +/** +Code Page 1252 +@publishedAll +@released +*/ +#define KCharacterSetIdentifierCodePage1252 0x100012b6 +/** +ISO 8859-1 +@publishedAll +@released +*/ +#define KCharacterSetIdentifierIso88591 0x10003b10 +/** +ISO 8859-2 +@publishedAll +@released +*/ +#define KCharacterSetIdentifierIso88592 0x1000507e +/** +ISO 8859-3 +@publishedAll +@released +*/ +#define KCharacterSetIdentifierIso88593 0x10008a28 +/** +ISO 8859-4 +@publishedAll +@released +*/ +#define KCharacterSetIdentifierIso88594 0x1000507f +/** +ISO 8859-5 +@publishedAll +@released +*/ +#define KCharacterSetIdentifierIso88595 0x10005080 +/** +ISO 8859-6 +@publishedAll +@released +*/ +#define KCharacterSetIdentifierIso88596 0x10008a29 +/** +ISO 8859-7 +@publishedAll +@released +*/ +#define KCharacterSetIdentifierIso88597 0x10005081 +/** +ISO 8859-8 +@publishedAll +@released +*/ +#define KCharacterSetIdentifierIso88598 0x10008a2a +/** +ISO 8859-9 +@publishedAll +@released +*/ +#define KCharacterSetIdentifierIso88599 0x10005082 +/** +ISO 8859-10 +@publishedAll +@released +*/ +#define KCharacterSetIdentifierIso885910 0x10008a2b +/** +ISO 8859-13 +@publishedAll +@released +*/ +#define KCharacterSetIdentifierIso885913 0x10008a2c +/** +ISO 8859-14 +@publishedAll +@released +*/ +#define KCharacterSetIdentifierIso885914 0x10008a2d +/** +ISO 8859-15 +@publishedAll +@released +*/ +#define KCharacterSetIdentifierIso885915 0x10008a2e +/** +ASCII +@publishedAll +@released +*/ +#define KCharacterSetIdentifierAscii 0x10004cc6 +/** +SMS 7-bit +@publishedAll +@released +*/ +#define KCharacterSetIdentifierSms7Bit 0x100053ab +/** +GB 2312 +@publishedAll +@released +*/ +#define KCharacterSetIdentifierGb2312 0x10000fbe +/** +HZ-GB-2312 +@publishedAll +@released +*/ +#define KCharacterSetIdentifierHz 0x10006065 +/** +GB 12345 +@publishedAll +@released +*/ +#define KCharacterSetIdentifierGb12345 0x1000401a +/** +GBK +@publishedAll +@released +*/ +#define KCharacterSetIdentifierGbk 0x10003ecb +/** +Big 5 +@publishedAll +@released +*/ +#define KCharacterSetIdentifierBig5 0x10000fbf +/** +Shift-JIS +@publishedAll +@released +*/ +#define KCharacterSetIdentifierShiftJis 0x10000fbd +/** +ISO-2022-JP +@publishedAll +@released +*/ +#define KCharacterSetIdentifierIso2022Jp 0x100066a0 +/** +ISO-2022-JP-1 +@publishedAll +@released +*/ +#define KCharacterSetIdentifierIso2022Jp1 0x100066a3 +/** +JIS Encoding +@publishedAll +@released +*/ +#define KCharacterSetIdentifierJis 0x10006066 +/** +EUC-JP +@publishedAll +@released +*/ +#define KCharacterSetIdentifierEucJpPacked 0x10006067 +#define KCharacterSetIdentifierUnicodeLittle 0x101f3fae //Little Endian Unicode +#define KCharacterSetIdentifierUnicodeBig 0x101f4052 // Big Endian Unicode +#define KCharacterSetIdentifierUcs2 0x101ff492 + +#define KCharacterSetIdentifierWindows874 0x101F854A +#endif // __MPXPLAYLISTCHARACTERSET_HRH__ + + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playlistengine/inc/mpxplaylistrecognizer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playlistengine/inc/mpxplaylistrecognizer.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2006 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: Recognizer for playlist files. +* +*/ + + + +#ifndef MPXPLAYLISTRECOGNIZER_H +#define MPXPLAYLISTRECOGNIZER_H + +// INCLUDES +#include +#include +#include + +// CLASS DECLARATION +class CMPXPluginHandlerBase; + +/** +* Concrete implementation of the recognizer API used to recognize playlist files. +* +* This is used by the application framework, as well as CMPXPlaylistEngine to +* determine if a given media is a supported playlist. +* +* @lib mpxplaylisrecognizer.lib +*/ +class CMPXPlaylistRecognizer : + public CApaDataRecognizerType, + public MMPXPluginHandlerObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * + * @return constructed object + */ + static CMPXPlaylistRecognizer* NewL(); + + /** + * Destructor. + */ + virtual ~CMPXPlaylistRecognizer(); + + private: + + /** + * C++ default constructor. + */ + CMPXPlaylistRecognizer(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // Functions from base class + + /** + * From CApaDataRecognizerType + * Returns one of the SupportedDataType + * @param aIndex - depending on the file extension + * @return Supported DataType + */ + TDataType SupportedDataTypeL( TInt aIndex ) const; + + /** + * From CApaDataRecognizerType + * Returns the buffersize needed to scan + * @return BufferSize if needed + */ + TUint PreferredBufSize(); + + /** + * From CApaDataRecognizerType + * Do the recognition of the file using the name of the + * the file or the buffer to scan + * @param aName Name of the file + * @param aBuffer Buffer that shall be scanned for recognition + */ + void DoRecognizeL( const TDesC& aName, const TDesC8& aBuffer ); + + /* + * @see MMPXPluginHandlerObserver + */ + void HandlePluginHandlerEvent(TPluginHandlerEvents aEvent, + const TUid& aPluginUid, TBool aLoaded, TInt aData); + + private: // Data + + CMPXPluginHandlerBase* iPluginHandler; + + }; + + +#endif // MPXPLAYLISTRECOGNIZER_H diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playlistengine/inc/mpxplaylistsupplementalcharsets.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playlistengine/inc/mpxplaylistsupplementalcharsets.hrh Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2007 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: supplemental character set IDs are included here +* +*/ + + +#ifndef __MPXPLAYLISTSUPPLEMENTALCHARSET_HRH__ +#define __MPXPLAYLISTSUPPLEMENTALCHARSET_HRH__ + +// copied from MetadataUtility's SupplementalCharSets.hrh version 1 + +/** +EucJpDirectmap +*/ +#define KCharacterSetIdentifierEucJpDirectmap 0x10207353 +/** +ShiftJisDirectmap +*/ +#define KCharacterSetIdentifierShiftJisDirectmap 0x10207354 +/** +KOI8-R +*/ +#define KCharacterSetIdentifierKOI8R 0x10207401 +/** +KOI8-U +*/ +#define KCharacterSetIdentifierKOI8U 0x10207402 +/** +TIS_620 +*/ +#define KCharacterSetIdentifierTIS620 0x10207403 +/** +Windows-1250 +*/ +#define KCharacterSetIdentifierCp1250 0x10207404 +/** +Windows-1251 +*/ +#define KCharacterSetIdentifierCp1251 0x10207405 +/** +Windows-1252 +*/ +#define KCharacterSetIdentifierCp1252 0x10207406 +/** +Windows-1253 +*/ +#define KCharacterSetIdentifierCp1253 0x10207407 +/** +Windows-1254 +*/ +#define KCharacterSetIdentifierCp1254 0x10207408 +/** +Windows-1255 +*/ +#define KCharacterSetIdentifierCp1255 0x10207409 +/** +Windows-1256 +*/ +#define KCharacterSetIdentifierCp1256 0x1020740A +/** +Windows-1257 +*/ +#define KCharacterSetIdentifierCp1257 0x1020740B +/** +Windows-1258 +*/ +#define KCharacterSetIdentifierCp1258 0x1020740C +/** +Windows-874 +*/ +#define KCharacterSetIdentifierCp874 0x1020740D +/** +ISCII +*/ +#define KCharacterSetIdentifierISCII 0x1027508D + +#endif // __MPXPLAYLISTSUPPLEMENTALCHARSET_HRH__ diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playlistengine/inc/mpxplaylisttopcharacterset.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playlistengine/inc/mpxplaylisttopcharacterset.rh Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2007 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: Contains definitions for structures used in Top Character Set +* resource files. +* +*/ + + +#ifndef __MPXPLAYLISTTOPCHARACTERSET_RH__ +#define __MPXPLAYLISTTOPCHARACTERSET_RH__ + +// copied and revised based on MetadataUtility's TopCharacterSet.rh version 3 + +// INCLUDES +#include "mpxplaylistcharacterset.hrh" // Enumerations + +// STRUCTURE DEFINITIONS + +// ----------------------------------------------------------------------------- +// MPX_PLAYLIST_CHARACTER_SET +// Structure definition character encoding +// ----------------------------------------------------------------------------- +// +STRUCT MPX_PLAYLIST_CHARACTER_SET_ENCODING + { + LONG character_set_id[]; + } + +#endif // __MPXPLAYLISTTOPCHARACTERSET_RH__ + + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playlistengine/rom/mpxplaylistengine.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playlistengine/rom/mpxplaylistengine.iby Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2006 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: Image description file for project MPX Playlist Engine. +* +*/ + + +#ifndef MPXPLAYLISTENGINE_IBY +#define MPXPLAYLISTENGINE_IBY + +#include + +file=ABI_DIR\BUILD_DIR\mpxplaylistengine.dll SHARED_LIB_DIR\mpxplaylistengine.dll + +data=DATAZ_\RESOURCE_FILES_DIR\mpxplaylisttopcharacterset.rsc RESOURCE_FILES_DIR\mpxplaylisttopcharacterset.rsc + +#endif // MPXPLAYLISTENGINE_IBY diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playlistengine/rom/mpxplaylistrecognizerplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playlistengine/rom/mpxplaylistrecognizerplugin.iby Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2006 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: Image description file for project mpxplaylistrecognizerplugin +* +*/ + + + +#ifndef MPXPLAYLISTRECOGNIZERPLUGIN_IBY +#define MPXPLAYLISTRECOGNIZERPLUGIN_IBY + +#include + +ECOM_PLUGIN( mpxplaylistrecognizer.dll, 101FFC24.rsc ) + +#endif // MPXPLAYLISTRECOGNIZERPLUGIN_IBY diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playlistengine/src/mpxplaylistengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playlistengine/src/mpxplaylistengine.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,832 @@ +/* +* Copyright (c) 2006 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: playlist engine +* +* CMPXPlaylistEngine contains a CMPXPlaylistPluginHandler and a task queue. +* CMPXPlaylistEngine uses CMPXPlaylistPluginHandler to select an appropriate +* playlist plugin to handle the client's requests. It's also used for querying +* about the currently loaded playlist plugin. +* +* The task queue is used to manage async requests submitted by the client. +* When an InternalizePlaylistL or ExternalizePlaylistL request is received, +* it's added to the task queue. When a task in the queue is ready for +* execution, ExecuteTask is called. To process the task, CMPXPlaylistEngine +* will select an appropriate plugin; once one is found, the request is +* handed over to the plugin and CMPXPlaylistEngine becomes active. Before +* the plugin completes the request, CMPXPlaylistEngine is notified of the +* results through MMPXPlaylistPluginObserver interface; CMPXPlaylistEngine +* passes the results to its client through MMPXPlaylistEngineObserver +* interface. Once CMPXPlaylistEngine's client completes the handling of the +* results, plugin completes the request and CMPXPlaylistEngine::RunL +* is called to complete one task processing cycle. CMPXPlaylistEngine is +* ready to process the next task if any at the completion of RunL. +* +* DESIGN DECISION: +* Only one task queue is used instead of one per plugin because this is +* running on the client thread. No processing time gained for having +* separate task queues. +* +* +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mpxplaylistenginedefs.hrh" +#include "mpxplaylistplugin.h" +#include "mpxplaylistengine.h" +#include "mpxplaylistrecognizer.h" + +// ============================ CONSTANTS ===================================== +const TInt KMPXBufExpandSize = 0x40; +const TInt KMPXArrayGranularity = 12; +_LIT( KMPXPlaylistEnginePanic, "CMPXPlaylistEngine"); +_LIT(KMPXPlaylistCharacterSetRscFile, "mpxplaylisttopcharacterset.rsc"); +_LIT( KMPXPlaylistExtension, ".m3u" ); + +// ============================ MEMBER FUNCTIONS ============================== +// ---------------------------------------------------------------------------- +// Constructor. +// ---------------------------------------------------------------------------- +// +CMPXPlaylistEngine::CMPXPlaylistEngine( + MMPXPlaylistEngineObserver& aObserver) +: CActive(EPriorityStandard), + iObserver(aObserver) + { + CActiveScheduler::Add(this); + } + +// ---------------------------------------------------------------------------- +// 2nd phase constructor. +// ---------------------------------------------------------------------------- +// +void CMPXPlaylistEngine::ConstructL() + { + User::LeaveIfError(iFs.Connect()); + iCharacterSet = CCnvCharacterSetConverter::CreateArrayOfCharacterSetsAvailableL(iFs); + iTopCharacterSet = + new (ELeave)CArrayFixFlat(KMPXArrayGranularity); + GenerateTopCharacterSetsL(); + + iTaskQueue = CMPXActiveTaskQueue::NewL(); + iPluginHandler = CMPXPlaylistPluginHandler::NewL( + *this, *this, iFs, *iTopCharacterSet, *iCharacterSet); + } + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXPlaylistEngine* CMPXPlaylistEngine::NewL( + MMPXPlaylistEngineObserver& aObserver) + { + CMPXPlaylistEngine* self=new(ELeave)CMPXPlaylistEngine(aObserver); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------------------------- +// Destructor. +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXPlaylistEngine::~CMPXPlaylistEngine() + { + Cancel(); + Cleanup(); + + iFs.Close(); + delete iTaskQueue; + delete iPluginHandler; + delete iCharacterSet; + delete iTopCharacterSet; + iRscFile.Close(); + } + +// =========================== EXTERNAL FUNCTIONS ============================= +// ---------------------------------------------------------------------------- +// Return a handle to playlist plugin handler +// ---------------------------------------------------------------------------- +EXPORT_C CMPXPlaylistPluginHandler& CMPXPlaylistEngine::PlaylistPluginHandler() + { + ASSERT( iPluginHandler ); + return *iPluginHandler; + } + +// ---------------------------------------------------------------------------- +// Determines whether the given media is a playlist +// Currently, Music Player only supports m3u playlist. +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CMPXPlaylistEngine::IsPlaylistL( const TDesC& aUri ) + { + // Check if the file extension is ".m3u". + TBool isPlaylist = EFalse; + TParsePtrC parse( aUri ); + if ( !parse.Ext().CompareF( KMPXPlaylistExtension ) ) + { + isPlaylist = ETrue; + } + + return isPlaylist; + } + +// ---------------------------------------------------------------------------- +// Internalize a playlist (async) +// +// Add the request to the task queue +// ---------------------------------------------------------------------------- +EXPORT_C void CMPXPlaylistEngine::InternalizePlaylistL(const TDesC& aPlaylistUri) + { + MPX_DEBUG1("CMPXPlaylistEngine::InternalizePlaylistL"); + + // + // leave if the given file does not exist + // + if (!BaflUtils::FileExists(iFs, aPlaylistUri)) + { + User::Leave( KErrNotFound ); + } + + // + // externalize parameters + // + CBufBase* taskParam = CBufFlat::NewL( KMPXBufExpandSize ); + CleanupStack::PushL( taskParam ); + taskParam->ResizeL( KMPXBufExpandSize ); + + RBufWriteStream writeStream( *taskParam ); + CleanupClosePushL( writeStream ); + + // externalize playlist URI + writeStream.WriteInt32L( aPlaylistUri.Length() ); + writeStream << aPlaylistUri; + + writeStream.CommitL(); + taskParam->Compress(); + + // + // add request to the task queue + // + iTaskQueue->AddTaskL( EInternalizePlaylist, + NULL, // callback when task completed + this, // task queue observer + 0, // Integer parameter, not used + taskParam ); // task queue assumes ownership of taskParam + + CleanupStack::PopAndDestroy( &writeStream ); + CleanupStack::Pop( taskParam ); // taskParam + } + +// ---------------------------------------------------------------------------- +// Internalize a playlist (async) +// ---------------------------------------------------------------------------- +EXPORT_C void CMPXPlaylistEngine::InternalizePlaylistL(const RFile& aPlaylistFileHandle) + { + MPX_DEBUG1("CMPXPlaylistEngine::InternalizePlaylistL"); + + if ( !aPlaylistFileHandle.SubSessionHandle() ) + { + User::Leave(KErrArgument); + } + + TFileName fullName; + aPlaylistFileHandle.FullName( fullName ); + + InternalizePlaylistL( fullName ); + } + +// ---------------------------------------------------------------------------- +// Externalize a playlist (async) +// +// Add the request to the task queue +// ---------------------------------------------------------------------------- +EXPORT_C void CMPXPlaylistEngine::ExternalizePlaylistL( + const CMPXMedia& aPlaylist, + const TDesC& aFilePath) + { + MPX_DEBUG1("CMPXPlaylistEngine::ExternalizePlaylistL"); + + // + // leave if the given playlist doesn't contain the following attributes + // + if (!aPlaylist.IsSupported(KMPXMediaGeneralTitle) || + !aPlaylist.IsSupported(KMPXMediaGeneralType) || + !aPlaylist.IsSupported(KMPXMediaGeneralCategory) || + !aPlaylist.IsSupported(KMPXMediaArrayContents) || + !aPlaylist.IsSupported(KMPXMediaArrayCount)) + { + User::Leave( KErrArgument ); + } + + // + // leave if the given media isn't a playlist (i.e. type must be EMPXItem and category + // must be EMPXPlaylist + // + TMPXGeneralType mediaType = + aPlaylist.ValueTObjectL(KMPXMediaGeneralType); + + TMPXGeneralCategory mediaCategory = + aPlaylist.ValueTObjectL(KMPXMediaGeneralCategory); + + if ( mediaType != EMPXItem || + mediaCategory != EMPXPlaylist ) + { + User::Leave( KErrArgument ); + } + + // + // leave if the given file path does not exist + // + if (!BaflUtils::PathExists(iFs, aFilePath)) + { + User::Leave( KErrPathNotFound ); + } + + // check if a plugin has been selected. the client + // is required to select a plugin before issuing + // this request + if ( !iPluginHandler->PluginFound() ) + { + User::Leave( KErrNotFound ); + } + + // + // externalize parameters + // + CBufBase* taskParam = CBufFlat::NewL( KMPXBufExpandSize ); + CleanupStack::PushL( taskParam ); + taskParam->ResizeL( KMPXBufExpandSize ); + + RBufWriteStream writeStream( *taskParam ); + CleanupClosePushL( writeStream ); + + // externalize playlist + writeStream << aPlaylist; + + // externalize file path + writeStream.WriteInt32L( aFilePath.Length() ); + writeStream << aFilePath; + + // externalize plugin Uid + writeStream.WriteInt32L( iPluginHandler->PluginUid().iUid ); + + writeStream.CommitL(); + taskParam->Compress(); + + // + // add request to the task queue + // + CMPXMedia* playlist = CMPXMedia::NewL(aPlaylist); + CleanupStack::PushL(playlist); + + iTaskQueue->AddTaskL( EExternalizePlaylist, + NULL, // callback when task completed + this, // task queue observer + 0, // Integer parameter, not used + taskParam, // task queue assumes ownership + NULL, + playlist ); // keep media alive. ownership transferred + + CleanupStack::Pop( playlist ); + CleanupStack::PopAndDestroy( &writeStream ); + CleanupStack::Pop( taskParam ); // taskParam + } + +// ---------------------------------------------------------------------------- +// Cancel Requests +// ---------------------------------------------------------------------------- +EXPORT_C void CMPXPlaylistEngine::CancelRequests() + { + MPX_DEBUG1("CMPXPlaylistEngine::CancelRequests"); + Cancel(); + iTaskQueue->CancelRequests(); + } + +// =========================== CALLBACK FUNCTIONS ============================= +// ---------------------------------------------------------------------------- +// Handles plugin callback for InternalizePlaylistL request +// ---------------------------------------------------------------------------- +void CMPXPlaylistEngine::HandlePlaylistL( + CMPXMedia* aPlaylist, + const TInt aError, + const TBool aCompleted) + { + MPX_DEBUG1("CMPXPlaylistEngine::HandlePlaylistL"); + + // notify playlist engine observer + iObserver.HandlePlaylistL( aPlaylist, aError, aCompleted ); + } + +// ---------------------------------------------------------------------------- +// Handle plugin callback for ExternalizePlaylistL request +// ---------------------------------------------------------------------------- +void CMPXPlaylistEngine::HandlePlaylistL( + const TDesC& aPlaylistUri, + const TInt aError) + { + MPX_DEBUG1("CMPXPlaylistEngine::HandlePlaylistL"); + + // notify playlist engine observer + iObserver.HandlePlaylistL( aPlaylistUri, aError ); + } + +// =========================== INTERNAL FUNCTIONS ============================= +// ---------------------------------------------------------------------------- +// Handles request completion event +// ---------------------------------------------------------------------------- +// +void CMPXPlaylistEngine::RunL() + { + MPX_DEBUG2("CMPXPlaylistEngine::RunL - status %d", iStatus.Int()); + + // clean up data set during processing of the current task + Cleanup(); + + // we are done with the current request and ready for the next one if there is + // any + iTaskQueue->CompleteTask(); + } + +// ---------------------------------------------------------------------------- +// Cancellation of an outstanding request. +// ---------------------------------------------------------------------------- +// +void CMPXPlaylistEngine::DoCancel() + { + if ( iPluginHandler->PluginFound() ) + { + iPluginHandler->Plugin()->Cancel(); + } + Cleanup(); + iTaskQueue->CompleteTask(); + } + +// ---------------------------------------------------------------------------- +// Execute an async task +// ---------------------------------------------------------------------------- +// +void CMPXPlaylistEngine::ExecuteTask( + TInt aTask, + TInt /*aParamData*/, + TAny* /*aPtrData*/, + const CBufBase& aBuf, + TAny* /*aCallback*/, + CBase* /*aCObject1*/, + CBase* /*aCObject2*/) + { + TRAPD(err, ExecuteTaskL(aTask, aBuf)); + if (err != KErrNone) + { + HandleExecuteTaskError(aTask, err); + } + } + +// ---------------------------------------------------------------------------- +// CMPXPlaylistEngine::HandleTaskError +// ---------------------------------------------------------------------------- +// +void CMPXPlaylistEngine::HandleTaskError( + TInt /* aTask */, + TAny* /*aPtrData*/, + TAny* /*aCallback*/, + TInt /* aError */) + { + // do nothing + } + +// ---------------------------------------------------------------------------- +// CMPXPlaylistEngine::HandlePluginHandlerEvent +// ---------------------------------------------------------------------------- +// +void CMPXPlaylistEngine::HandlePluginHandlerEvent( + TPluginHandlerEvents /* aEvent */, + const TUid& /* aPluginUid */, + TBool /* aLoaded */, + TInt /* aData */) + { + // Playlist plugins are stateless and they are resolved for every call. + // There is no need to cancel the existing queued requests in case the + // plugin is updated as the new version of the plugin is expected to handle + // these calls the same as the previous version did. + // + // In case the plugin is removed it is expected that all queued ResolvePluginL + // calls will leave with KErrNotSupported, which will be sent to the caller. + } + +// ---------------------------------------------------------------------------- +// Execute an async task. Leaves when an error is encountered. +// ---------------------------------------------------------------------------- +// +void CMPXPlaylistEngine::ExecuteTaskL(TInt aTask, const CBufBase& aBuf) + { + __ASSERT_ALWAYS( !IsActive(), User::Panic(KMPXPlaylistEnginePanic, KErrInUse) ); + + RBufReadStream readStream( aBuf ); + CleanupClosePushL( readStream ); + + switch( aTask ) + { + case EInternalizePlaylist: + { + // internalize playlist parameter + iPlaylistUri = HBufC::NewL( readStream, readStream.ReadInt32L() ); + + // automatically select a plugin that is capable of handling + // the specified media file. SelectPlaylistPluginL leaves + // with KErrNotSupported when an appropriate plugin cannot + // be found + iPluginHandler->SelectPlaylistPluginL( *iPlaylistUri, KNullDesC8 ); + + // an appropriate plugin is found, issue the request to the + // selected plugin + iPluginHandler->Plugin()->InternalizePlaylistL( iStatus, *iPlaylistUri ); + } + break; + + case EExternalizePlaylist: + { + // internalize playlist + iPlaylist = CMPXMedia::NewL(); + readStream >> *iPlaylist; + + // internalize file path + iFilePath = HBufC::NewL( readStream, readStream.ReadInt32L() ); + + // internalize plugin Uid + TUid pluginUid = TUid::Uid( readStream.ReadInt32L() ); + + // + // select the specified plugin. When the specified plugin + // cannot be found, SelectPlaylistPluginL will leave with + // KErrNotSupported error code. + // + // Possible scenario: + // The specified plugin is available when the client made + // the selection before issuing the request, but the plugin + // has since been uninstalled when we are ready to process + // this request. + // + iPluginHandler->SelectPlaylistPluginL( pluginUid ); + + // found the specified plugin, issue the request + iPluginHandler->Plugin()->ExternalizePlaylistL( + iStatus, *iPlaylist, *iFilePath ); + } + break; + + // + // command not supported + // + default: + { + ASSERT(0); + break; + } + } + + CleanupStack::PopAndDestroy( &readStream ); // readStream + + SetActive(); + } + +// ---------------------------------------------------------------------------- +// Handles a leave occurring in the request completion event handler ExecuteTaskL +// ---------------------------------------------------------------------------- +// +void CMPXPlaylistEngine::HandleExecuteTaskError(TInt aTask, TInt aError) + { + TRAP_IGNORE(HandleExecuteTaskErrorL(aTask, aError)); + + // clean up data set during processing of the current task + Cleanup(); + + // although an error has occured while processing the current task, we are + // done with the current request and ready for the next one if there is + // any + iTaskQueue->CompleteTask(); + } + +// ---------------------------------------------------------------------------- +// Handles a leave occurring in the request completion event handler ExecuteTaskL +// ---------------------------------------------------------------------------- +// +void CMPXPlaylistEngine::HandleExecuteTaskErrorL(TInt aTask, TInt aError) + { + MPX_DEBUG3("CMPXPlaylistEngine::HandleExecuteTaskErrorL(task %d, error %d)", aTask, aError); + + // + // notify client + // + switch (aTask) + { + case EInternalizePlaylist: + { + iObserver.HandlePlaylistL( NULL, aError, ETrue ); + } + break; + + case EExternalizePlaylist: + { + const TDesC& playlist = + iPlaylist? iPlaylist->ValueText(KMPXMediaGeneralTitle) : KNullDesC; + + iObserver.HandlePlaylistL( playlist, aError ); + } + break; + + default: + { + ASSERT(0); + break; + } + } + } + +// ---------------------------------------------------------------------------- +// cleanup +// ---------------------------------------------------------------------------- +// +void CMPXPlaylistEngine::Cleanup() + { + delete iPlaylistUri; + iPlaylistUri = NULL; + + delete iFilePath; + iFilePath = NULL; + + delete iPlaylist; + iPlaylist = NULL; + } + +// ----------------------------------------------------------------------------- +// CMPXPlaylistEngine::GenerateTopCharacterSets() +// ----------------------------------------------------------------------------- +// +void CMPXPlaylistEngine::GenerateTopCharacterSetsL() + { + CArrayFixFlat* installedLanguages = NULL; + SysLangUtil::GetInstalledLanguages(installedLanguages); + CleanupStack::PushL(installedLanguages); + + + TParse* fp = new(ELeave) TParse(); + fp->Set(KMPXPlaylistCharacterSetRscFile, &KDC_RESOURCE_FILES_DIR, NULL); + CleanupStack::PushL(fp); + + TFileName resourceFile = fp->FullName(); + User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) ); + + // Open the resource file + TRAPD(err, iRscFile.OpenL(iFs, resourceFile)); + // if there is no resource file, then there is no top character set list + if (err) + { + CleanupStack::PopAndDestroy(2, installedLanguages); + return; + } + + for (TInt i=0; i < installedLanguages->Count(); i++) + { + SelectCharacterSetsForLanguageL(installedLanguages->At(i)); + } + iTopCharacterSet->Compress(); + installedLanguages->Reset(); + CleanupStack::PopAndDestroy(2, installedLanguages); + iRscFile.Close(); + } + +// ----------------------------------------------------------------------------- +// CMetaDataParser::SelectCharacterSetsForLanguage() +// ----------------------------------------------------------------------------- +// +void CMPXPlaylistEngine::SelectCharacterSetsForLanguageL(TInt aLanguage) + { + switch ( aLanguage ) + { + case ELangEnglish: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_ENGLISH_CHAR_SET); + break; + case ELangFrench: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_FRENCH_CHAR_SET); + break; + case ELangGerman: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_GERMAN_CHAR_SET); + break; + case ELangTurkish: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_TURKISH_CHAR_SET); + break; + case ELangFinnish: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_FINNISH_CHAR_SET); + break; + case ELangSwedish: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_SWEDISH_CHAR_SET); + break; + case ELangRussian: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_RUSSIAN_CHAR_SET); + break; + case ELangArabic: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_ARABIC_CHAR_SET); + break; + case ELangHebrew: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_HEBREW_CHAR_SET); + break; + case ELangFarsi: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_FARSI_CHAR_SET); + break; + case ELangItalian: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_ITALIAN_CHAR_SET); + break; + case ELangPolish: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_POLISH_CHAR_SET); + break; + case ELangHungarian: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_HUNGARIAN_CHAR_SET); + break; + case ELangSpanish: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_SPANISH_CHAR_SET); + break; + case ELangDutch: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_DUTCH_CHAR_SET); + break; + case ELangPortuguese: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_PORTUGUESE_CHAR_SET); + break; + case ELangAmerican: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_ENGLISH_CHAR_SET); + break; + case ELangCanadianFrench: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_FRENCH_CHAR_SET); + break; + case ELangBrazilianPortuguese: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_PORTUGUESE_CHAR_SET); + break; + case ELangLatinAmericanSpanish: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_SPANISH_CHAR_SET); + break; + case ELangLatvian: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_LATVIAN_CHAR_SET); + break; + case ELangGreek: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_GREEK_CHAR_SET); + break; + case ELangEstonian: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_ESTONIAN_CHAR_SET); + break; + case ELangLithuanian: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_LITHUANIAN_CHAR_SET); + break; + case ELangRomanian: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_ROMANIAN_CHAR_SET); + break; + case ELangUkrainian: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_UKRAINIAN_CHAR_SET); + break; + case ELangBulgarian: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_BULGARIAN_CHAR_SET); + break; + case ELangCroatian: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_CROATIAN_CHAR_SET); + break; + case ELangSerbian: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_SERBIAN_CHAR_SET); + break; + case ELangIndonesian: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_INDONESIAN_CHAR_SET); + break; + case ELangMalay: + case ELangTagalog: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_MALAY_CHAR_SET); + break; + case ELangIcelandic: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_ICELANDIC_CHAR_SET); + break; + case ELangDanish: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_DANISH_CHAR_SET); + break; + case ELangNorwegian: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_NORWEGIAN_CHAR_SET); + break; + case ELangHindi: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_INDIAN_CHAR_SET); + break; + case ELangUrdu: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_URDU_CHAR_SET); + break; + case ELangCzech: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_CZECH_CHAR_SET); + break; + case ELangSlovak: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_SLOVAK_CHAR_SET); + break; + case ELangSlovenian: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_SLOVENIAN_CHAR_SET); + break; + case ELangTaiwanChinese: + case ELangHongKongChinese: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_TAIWAN_HK_CHINESE_CHAR_SET); + break; + case ELangPrcChinese: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_CHINESE_CHAR_SET); + break; + case ELangEnglish_Taiwan: + case ELangEnglish_Prc: + case ELangEnglish_Japan: + case ELangEnglish_Thailand: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_ENGLISH_CHAR_SET); + break; + case ELangJapanese: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_JAPANESE_CHAR_SET); + break; + case ELangThai: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_THAI_CHAR_SET); + break; + case ELangVietnamese: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_VIETNAMESE_CHAR_SET); + break; + case ELangMalay_Apac: + ReadCharacterSetResourceL(R_MPX_PLAYLIST_MALAY_CHAR_SET); + break; + default: + break; + } + } + +// ----------------------------------------------------------------------------- +// CMPXPlaylistEngine::ReadCharacterSetResourceL() +// ----------------------------------------------------------------------------- +// +void CMPXPlaylistEngine::ReadCharacterSetResourceL(TInt aResourceId) + { + TResourceReader rscReader; // Resource reader + HBufC8* rscBuf; // Buffer where resource is read + + rscBuf = iRscFile.AllocReadL(aResourceId); + rscReader.SetBuffer(rscBuf); + CleanupStack::PushL(rscBuf); + + TUint characterSetElementId; + TInt numCharacterSetElements = rscReader.ReadInt16(); + TUint elemId; + CCnvCharacterSetConverter::SCharacterSet elem; + + for (TInt i = 0; i < numCharacterSetElements; i++) + { + characterSetElementId = rscReader.ReadInt32(); + for (TInt j = 0; j < iCharacterSet->Count(); j++ ) + { + elem = iCharacterSet->At(j); + elemId = elem.Identifier(); + if ( elemId == characterSetElementId && !IsInTopCharacterSet(characterSetElementId) ) + { + iTopCharacterSet->AppendL(elem); + } + } + } + + CleanupStack::PopAndDestroy(rscBuf); + } + +// ----------------------------------------------------------------------------- +// CMPXPlaylistEngine::IsInTopCharacterSet() +// ----------------------------------------------------------------------------- +// +TBool CMPXPlaylistEngine::IsInTopCharacterSet(TUint aCharacterSetId) + { + for (TInt i = 0; i < iTopCharacterSet->Count(); i++) + { + if ( iTopCharacterSet->At(i).Identifier() == aCharacterSetId ) + { + return ETrue; + } + } + return EFalse; + } + +// End of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playlistengine/src/mpxplaylistpluginhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playlistengine/src/mpxplaylistpluginhandler.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,318 @@ +/* +* Copyright (c) 2006 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: Playlist Plugin Handler +* +* CMPXPlaylistPluginHandler inherits from CMPXPluginHandlerBase which owns a +* CMPXPluginMonitor that monitors playlist plugins. +* +* CMPXPlaylistPluginHandler also contains a list of loaded playlist plugins. +* A playlist plugin is added to the list when it's selected for the first +* time. When a new plugin is installed, CMPXPluginMonitor notifies this plugin +* handler through CMPXPluginMonitorObserver interface. However, the new plugin +* will not be loaded at this time until a client explictly selects this new +* plugin. +* +* When a plugin is uninstalled, CMPXPluginMonitor also notifies this plugin +* handler through CMPXPluginMonitorObserver interface. If such plugin is +* currently loaded, it will be unloaded and removed from the list. All plugins +* are removed when CMPXPlaylistPluginHandler is destroyed. +* +* +*/ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include "mpxplaylistenginedefs.hrh" +#include "mpxplaylistpluginhandler.h" +#include "mpxplaylistplugin.h" + + + + +// ============================ MEMBER FUNCTIONS ============================== +// ---------------------------------------------------------------------------- +// Constructor. +// ---------------------------------------------------------------------------- +// +CMPXPlaylistPluginHandler::CMPXPlaylistPluginHandler( + MMPXPlaylistPluginObserver& aPluginObserver, + MMPXPluginHandlerObserver& aObserver, + RFs& aFs, + const CArrayFix& aTopCharacterSet, + const CArrayFix& aAvailableCharacterSet) +: CMPXPluginHandlerBase(TUid::Uid(KMPXPlaylistInterfaceUid), + ESelectionType, + EMPXPlaylistTypeM3U, + aObserver), + iPluginObserver(aPluginObserver), + iFs(aFs), + iTopCharacterSet(aTopCharacterSet), + iAvailableCharacterSet(aAvailableCharacterSet), + iPluginUid(KNullUid), + iPluginType(EMPXPlaylistTypeUnknown) + { + } + +// ---------------------------------------------------------------------------- +// 2nd phase constructor. +// ---------------------------------------------------------------------------- +// +void CMPXPlaylistPluginHandler::ConstructL() + { + BaseConstructL(); + } + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXPlaylistPluginHandler* CMPXPlaylistPluginHandler::NewL( + MMPXPlaylistPluginObserver& aPluginObserver, + MMPXPluginHandlerObserver& aObserver, + RFs& aFs, + const CArrayFix& aTopCharacterSet, + const CArrayFix& aAvailableCharacterSet) + { + CMPXPlaylistPluginHandler* self = new(ELeave)CMPXPlaylistPluginHandler( + aPluginObserver, aObserver, aFs, aTopCharacterSet, aAvailableCharacterSet); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------------------------- +// Destructor. +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXPlaylistPluginHandler::~CMPXPlaylistPluginHandler() + { + iLoadedPlugins.ResetAndDestroy(); + iLoadedPluginsUids.Close(); + delete iDisplayName; + } + +// ---------------------------------------------------------------------------- +// selects a plug-in appropriate for a Uri and data type +// +// This is a wrapper method for the base class's SelectPluginL to grant client +// access and gives the method name some context. +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaylistPluginHandler::SelectPlaylistPluginL( + const TDesC& aUri, + const TDesC8& aDataType) + { + MPX_DEBUG2("CMPXPlaylistPluginHandler::SelectPlaylistPluginL( URI: %S, DataType )", &aUri); + + ClearSelectionCriteria(); + SelectPluginL( aUri, aDataType ); + } + +// ---------------------------------------------------------------------------- +// selects a plug-in appropriate for a file +// +// This is a wrapper method for the base class's SelectPluginL to grant client +// access and gives the method name some context. +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaylistPluginHandler::SelectPlaylistPluginL(const RFile& aFile) + { + MPX_DEBUG1("CMPXPlaylistPluginHandler::SelectPlaylistPluginL(RFile)"); + + ClearSelectionCriteria(); + SelectPluginL( aFile ); + } + +// ---------------------------------------------------------------------------- +// selects a plug-in appropriate for a plugin type +// +// This is a wrapper method for the base class's SelectPluginL to grant client +// access and gives the method name some context. +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaylistPluginHandler::SelectPlaylistPluginL( + TUint32 aPluginType) + { + MPX_DEBUG2("CMPXPlaylistPluginHandler::SelectPlaylistPluginL( ParserType: %x )", aPluginType); + + SelectPluginL( aPluginType ); + } + +// ---------------------------------------------------------------------------- +// selects plug-in with the specified name +// +// This is a wrapper method for the base class's SelectPluginL to grant client +// access and gives the method name some context. +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaylistPluginHandler::SelectPlaylistPluginL( + const TDesC& aPluginName) + { + MPX_DEBUG2("CMPXPlaylistPluginHandler::SelectPlaylistPluginL( aPluginName: %S )", &aPluginName); + + SelectPluginL( aPluginName ); + } + +// ---------------------------------------------------------------------------- +// select a plugin with the specific id +// +// This is a wrapper method for the base class's SelectPluginL to grant client +// access and gives the method name some context. +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaylistPluginHandler::SelectPlaylistPluginL(const TUid& aUid) + { + MPX_DEBUG2("CMPXPlaylistPluginHandler::SelectPlaylistPluginL(UID: %x)", aUid.iUid); + + SelectPluginL( aUid ); + } + +// ---------------------------------------------------------------------------- +// creates a plugin with the specific id. if already loaded, returns the reference +// without recreating it +// ---------------------------------------------------------------------------- +// +CMPXPlaylistPlugin* CMPXPlaylistPluginHandler::CreatePlaylistPluginL(const TUid& aUid) + { + MPX_DEBUG2("CMPXPlaylistPluginHandler::CreatePlaylistPluginL(UID: %x)", aUid.iUid); + + CMPXPlaylistPlugin* p(NULL); + TInt i=iLoadedPluginsUids.Find(aUid); + if (i==KErrNotFound) + { + p=CMPXPlaylistPlugin::NewL(aUid, iPluginObserver, iFs, iTopCharacterSet, iAvailableCharacterSet); + CleanupStack::PushL(p); + iLoadedPlugins.AppendL(p); + TInt err = iLoadedPluginsUids.Append(aUid); + if (err != KErrNone) // if the second append failed, it should revert the first append + { + iLoadedPlugins.Remove(iLoadedPlugins.Count()); + User::Leave(err); + } + CleanupStack::Pop(p); + } + else + { + p=iLoadedPlugins[i]; + } + return p; + } + +// ---------------------------------------------------------------------------- +// Resolve a plugin to iPlugin, based on properties (iDataType, iExt and iScheme) +// and selection criteria. +// ---------------------------------------------------------------------------- +// +void CMPXPlaylistPluginHandler::ResolvePluginL() + { + MPX_DEBUG1("CMPXPlaylistPluginHandler::ResolvePluginL"); + + // + // Resolve plugin + // + TUid pluginUid( KNullUid ); + TInt index( KErrNotFound ); + TPtrC displayName; + TInt pluginType( EMPXPlaylistTypeUnknown ); + + DoResolvePluginL(pluginUid, index, displayName, pluginType ); + + // + // Load resolved plug-in + // + CMPXPlaylistPlugin* p = CreatePlaylistPluginL(pluginUid); + UsePlugin(pluginUid); + + if (p != iPlugin) + { + iPlugin = p; + + iPluginUid = pluginUid; + + delete iDisplayName; + iDisplayName = NULL; + iDisplayName = displayName.AllocL(); + + iPluginType = pluginType; + } + } + +// ---------------------------------------------------------------------------- +// CMPXPlaylistPluginHandler::IsPluginLoaded +// ---------------------------------------------------------------------------- +// +TBool CMPXPlaylistPluginHandler::IsPluginLoaded( + const TUid& aPluginUid) + { + return iLoadedPluginsUids.Find(aPluginUid) != KErrNotFound; + } + +// ---------------------------------------------------------------------------- +// CMPXPlaylistPluginHandler::LoadPluginL +// ---------------------------------------------------------------------------- +// +void CMPXPlaylistPluginHandler::LoadPluginL( + const TUid& aPluginUid) + { + (void)CreatePlaylistPluginL(aPluginUid); + } + +// ---------------------------------------------------------------------------- +// Unloads a specified plugin. +// ---------------------------------------------------------------------------- +// +void CMPXPlaylistPluginHandler::UnloadPlugin( + const TUid& aPluginUid) + { + MPX_FUNC("CMPXPlaylistPluginHandler::UnloadPlugin"); + TInt i = iLoadedPluginsUids.Find(aPluginUid); + if (i != KErrNotFound) + { + UnloadPlugin(i); + } + } + +// ---------------------------------------------------------------------------- +// Unloads a plugin by index. +// ---------------------------------------------------------------------------- +// +void CMPXPlaylistPluginHandler::UnloadPlugin( + TInt aIndex) + { + MPX_FUNC("CMPXPlaylistPluginHandler::UnloadPlugin"); + + CMPXPlaylistPlugin* p = iLoadedPlugins[aIndex]; + if (p == iPlugin) + { + iPlugin = NULL; + iPluginUid = KNullUid; + iPluginType = EMPXPlaylistTypeUnknown; + delete iDisplayName; + iDisplayName = NULL; + } + + iLoadedPlugins.Remove(aIndex); + iLoadedPluginsUids.Remove(aIndex); + delete p; + } + +// End of file diff -r 000000000000 -r a2952bb97e68 mmappcomponents/playlistengine/src/mpxplaylistrecognizer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/playlistengine/src/mpxplaylistrecognizer.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,205 @@ +/* +* Copyright (c) 2006 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: Recognizer for playlist files. +* +*/ + + + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include "mpxplaylistrecognizer.h" + + +// LOCAL CONSTANTS AND MACROS +const TInt KExtLength = 4; + +// MIME type of the playlist. +_LIT8(KPlaylistMimeType, "playlist/mpegurl"); + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CMPXPlaylistRecognizer::CMPXPlaylistRecognizer() +// C++ default constructor can NOT contain any code, that +// might leave. +// Call base constructor with the recognizer's UID and confidence level +// ----------------------------------------------------------------------------- +CMPXPlaylistRecognizer::CMPXPlaylistRecognizer() + : CApaDataRecognizerType(TUid::Uid(KMPXPlaylistRecognizerDllUid), + CApaDataRecognizerType::EHigh) + { + } + +// ----------------------------------------------------------------------------- +// CMPXPlaylistRecognizer::ConstructL() +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +void CMPXPlaylistRecognizer::ConstructL() + { + // Set the number of data (MIME) types supported by this recognizer. + iCountDataTypes = 1; + + // instantiate a plugin hanlder that manages playlist plugins. + iPluginHandler = new(ELeave)CMPXPluginHandlerBase( + TUid::Uid(KMPXPlaylistInterfaceUid), + CMPXPluginHandlerBase::ESelectionType, EMPXPlaylistTypeM3U, + *this); + } + +// ----------------------------------------------------------------------------- +// CMPXPlaylistRecognizer::NewL() +// Two-phased constructor. +// ----------------------------------------------------------------------------- +CMPXPlaylistRecognizer* CMPXPlaylistRecognizer::NewL() + { + MPX_DEBUG1("CMPXPlaylistRecognizer::NewL"); + CMPXPlaylistRecognizer* self = new (ELeave) CMPXPlaylistRecognizer(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +CMPXPlaylistRecognizer::~CMPXPlaylistRecognizer() + { + delete iPluginHandler; + } + +// ----------------------------------------------------------------------------- +// CMPXPlaylistRecognizer::SupportedDataTypeL +// Return the MimeType of the DataType depending on +// mime type of the file +// ----------------------------------------------------------------------------- +TDataType CMPXPlaylistRecognizer::SupportedDataTypeL(TInt aIndex ) const + { + MPX_DEBUG2("CMPXPlaylistRecognizer::SupportedDataTypeL [%d]", aIndex); + + TDataType dataType; + switch ( aIndex ) + { + case 0: + dataType = TDataType(KPlaylistMimeType); + break; + default: + User::Leave(KErrArgument); + break; + } + return dataType; + } + +// ----------------------------------------------------------------------------- +// CMPXPlaylistRecognizer::PreferredBufSize() +// Return the supposed minimum buffer size we need to +// successfully recognize the data +// ----------------------------------------------------------------------------- +TUint CMPXPlaylistRecognizer::PreferredBufSize() + { + return 0; + } + +// ----------------------------------------------------------------------------- +// CMPXPlaylistRecognizer::DoRecognizeL +// Attempt to recognize the data +// this recognizer only attempts to match the data and/or file extension +// +// NB if the file is not recognized, this function should NOT leave : +// it should instead set iConfidence = ENotRecognized and return +// the function should only leave if there is an out-of-memory condition +// ----------------------------------------------------------------------------- +void CMPXPlaylistRecognizer::DoRecognizeL( + const TDesC& aName, + const TDesC8& /*aBuffer*/ ) + { + MPX_DEBUG2("CMPXPlaylistRecognizer::DoRecognizeL: aName = %S", &aName); + + // assume match will fail + iConfidence = CApaDataRecognizerType::ENotRecognized; + if ( aName.Length() < KExtLength ) + { + MPX_DEBUG1("CMPXPlaylistRecognizer::DoRecognizeL - Ext not present"); + return; + } + + // get a list of supported extension from playlist plugin handler + iPluginHandler->CreatePluginListL(); + CDesCArray* supportedExtensions = + iPluginHandler->SupportedExtensionsL(); + + // + // determine if the given filename contains an extension that's listed + // as supported + // + TInt count = supportedExtensions->Count(); + for ( TInt i = 0; i < count; i++ ) + { + TPtrC extension = (*supportedExtensions)[i]; + + if ( aName.Right( extension.Length() ).CompareF(extension) == 0 ) + { + MPX_DEBUG1("CMPXPlaylistRecognizer::DoRecognizeL - Possible match"); + iDataType = TDataType(KPlaylistMimeType); + iConfidence = ECertain; + break; + } + } + + delete supportedExtensions; + } + +// ----------------------------------------------------------------------------- +// CMPXPlaylistRecognizer::HandlePluginHandlerEvent +// ----------------------------------------------------------------------------- +// +void CMPXPlaylistRecognizer::HandlePluginHandlerEvent( + TPluginHandlerEvents /* aEvent */, + const TUid& /* aPluginUid */, + TBool /* aLoaded */, + TInt /* aData */) + { + // Do nothing + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= +// ----------------------------------------------------------------------------- +// provides an array that maps a UID for each implementation to its respective +// creation function +// ----------------------------------------------------------------------------- +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMPXPlaylistRecognizerImplUid, CMPXPlaylistRecognizer::NewL) + }; + +// ----------------------------------------------------------------------------- +// returns the proxy of implementations +// ----------------------------------------------------------------------------- +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + +// End of file + + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/videoplaylistutility/bwins/videoplaylistutilityu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/videoplaylistutility/bwins/videoplaylistutilityu.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,9 @@ +EXPORTS + ??1CVideoPlaylistUtility@@UAE@XZ @ 1 NONAME ; CVideoPlaylistUtility::~CVideoPlaylistUtility(void) + ?GetFileInfoL@CVideoPlaylistUtility@@QAEXAAVRFile@@W4TMediaType@CMediaRecognizer@@AAH2@Z @ 2 NONAME ; void CVideoPlaylistUtility::GetFileInfoL(class RFile &, enum CMediaRecognizer::TMediaType, int &, int &) + ?GetFileInfoL@CVideoPlaylistUtility@@QAEXABVTDesC16@@W4TMediaType@CMediaRecognizer@@AAH2@Z @ 3 NONAME ; void CVideoPlaylistUtility::GetFileInfoL(class TDesC16 const &, enum CMediaRecognizer::TMediaType, int &, int &) + ?GetLinkLC@CVideoPlaylistUtility@@QAE?AVTPtrC16@@XZ @ 4 NONAME ; class TPtrC16 CVideoPlaylistUtility::GetLinkLC(void) + ?GetPlayListL@CVideoPlaylistUtility@@QAEPAVCMPXMedia@@H@Z @ 5 NONAME ; class CMPXMedia * CVideoPlaylistUtility::GetPlayListL(int) + ?NewL@CVideoPlaylistUtility@@SAPAV1@XZ @ 6 NONAME ; class CVideoPlaylistUtility * CVideoPlaylistUtility::NewL(void) + ?IsSeekable@CVideoPlaylistUtility@@QAEHXZ @ 7 NONAME ; int CVideoPlaylistUtility::IsSeekable(void) + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/videoplaylistutility/eabi/videoplaylistutilityu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/videoplaylistutility/eabi/videoplaylistutilityu.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,11 @@ +EXPORTS + _ZN21CVideoPlaylistUtility12GetFileInfoLER5RFileN16CMediaRecognizer10TMediaTypeERiS4_ @ 1 NONAME + _ZN21CVideoPlaylistUtility12GetFileInfoLERK7TDesC16N16CMediaRecognizer10TMediaTypeERiS5_ @ 2 NONAME + _ZN21CVideoPlaylistUtility12GetPlayListLEi @ 3 NONAME + _ZN21CVideoPlaylistUtility4NewLEv @ 4 NONAME + _ZN21CVideoPlaylistUtility9GetLinkLCEv @ 5 NONAME + _ZN21CVideoPlaylistUtilityD0Ev @ 6 NONAME + _ZN21CVideoPlaylistUtilityD1Ev @ 7 NONAME + _ZN21CVideoPlaylistUtilityD2Ev @ 8 NONAME + _ZN21CVideoPlaylistUtility10IsSeekableEv @ 9 NONAME + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/videoplaylistutility/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/videoplaylistutility/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,30 @@ +/* +* 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: playlist utlity +*/ + +// Version : %version: 2 % + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../rom/videoplaylistutility.iby CORE_MW_LAYER_IBY_EXPORT_PATH(videolaylistutility.iby) + +PRJ_MMPFILES +videoplaylistutility.mmp + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/videoplaylistutility/group/videoplaylistutility.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/videoplaylistutility/group/videoplaylistutility.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -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: helper for video playlist +* +*/ + +// Version : %version: 3 % + + + + +#include +#include + +TARGET videoplaylistutility.dll +CAPABILITY CAP_GENERAL_DLL +TARGETTYPE DLL +UID 0x1000008D 0x200159AF +VENDORID VID_DEFAULT + +MW_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc + +SOURCEPATH ../src + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY cone.lib +LIBRARY apgrfx.lib +LIBRARY sysutil.lib +LIBRARY apmime.lib +LIBRARY charconv.lib +LIBRARY flogger.lib +LIBRARY playbackhelper.lib +LIBRARY mpxcommon.lib +LIBRARY estor.lib + +#ifdef __WINDOWS_MEDIA +LIBRARY asxparser.lib +#endif + + +SOURCE videoplaylistutility.cpp diff -r 000000000000 -r a2952bb97e68 mmappcomponents/videoplaylistutility/inc/videoplaylistutility_log.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/videoplaylistutility/inc/videoplaylistutility_log.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,157 @@ +/* +* 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: Debug print macros +* +*/ + +// Version : %version: 2 % + + + + +#ifndef VIDEOPLAYLISTUTILITY_LOG_H +#define VIDEOPLAYLISTUTILITY_LOG_H + +// INCLUDES +#include +#include +#include +#include +#include +#include + + + +// #define _VPU_FILE_LOGGING_ + +#ifdef _DEBUG + #define VPU_DEBUG RDebug::Print +#else + #ifdef _VPU_FILE_LOGGING_ + #define VPU_DEBUG VideoPlaylistUtilityDebug::FileLog + #else + #define VPU_DEBUG RDebug::Print + #endif +#endif + + +class VideoPlaylistUtilityDebug +{ + public: + inline static void NullLog( TRefByValue /*aFmt*/, ... ) + { + } + + inline static void FileLog( TRefByValue aFmt, ... ) + { + VA_LIST list; + VA_START(list,aFmt); + RFileLogger::WriteFormat( _L("VideoPlaylistUtility"), + _L("videoplaylistutility.log"), + EFileLoggingModeAppend, + aFmt, + list ); + } +}; + + + +// MACROS +#define VIDEOPLAYLISTUTILITY_DEBUG TVideoPlaylistUtilityLog::VideoPlaylistUtilityLog +#define VIDEOPLAYLISTUTILITY_ENTER_EXIT TEnterExitLog _s + +class TVideoPlaylistUtilityLog : public TDes16Overflow +{ + public: + + inline static void VideoPlaylistUtilityLog( TRefByValue aFmt, ... ) + { + TBuf< 512 > buffer; + + VA_LIST list; + VA_START( list, aFmt ); + buffer.AppendFormatList( aFmt, list ); + VA_END(list); + + VPU_DEBUG(_L("#VideoPlaylistUtility# %S"), &buffer ); + } +}; + +class TEnterExitLog : public TDes16Overflow +{ + public: + + void Overflow(TDes16& /*aDes*/) + { + VPU_DEBUG(_L("%S Logging Overflow"), &iFunctionName); + } + + TEnterExitLog( TRefByValue aFunctionName, + TRefByValue aFmt, ... ) + { + iFunctionName = HBufC::New( TDesC(aFunctionName).Length() ); + + if ( iFunctionName ) + { + iFunctionName->Des().Copy(aFunctionName); + } + + TBuf< 512 > buffer; + + VA_LIST list; + VA_START( list, aFmt ); + buffer.AppendFormatList( aFmt, list, this ); + VA_END(list); + + VPU_DEBUG(_L("#VideoPlaylistUtility# --> %S %S"), iFunctionName, &buffer ); + } + + TEnterExitLog( TRefByValue aFunctionName ) + { + iFunctionName = HBufC::New( TDesC(aFunctionName).Length() ); + + if ( iFunctionName ) + { + iFunctionName->Des().Copy(aFunctionName); + } + + VPU_DEBUG(_L("#VideoPlaylistUtility# --> %S"), iFunctionName ); + } + + ~TEnterExitLog() + { + VPU_DEBUG(_L("#VideoPlaylistUtility# <-- %S"), iFunctionName ); + delete iFunctionName; + } + + private: + HBufC* iFunctionName; +}; + +_LIT(_KVPUErrorInfo, "#VideoPlaylistUtility# Error : error %d file %s line %d"); + +#define VIDEOPLAYLISTUTILITY_S(a) _S(a) + +#define VIDEOPLAYLISTUTILITY_ERROR_LOG(aErr) \ + {\ + if (aErr) \ + VIDEOPLAYLISTUTILITY_DEBUG(_KVPUErrorInfo, aErr, VIDEOPLAYLISTUTILITY_S(__FILE__), __LINE__);\ + } + +#define VIDEOPLAYLISTUTILITY_TRAP(_r, _s) TRAP(_r,_s);VIDEOPLAYLISTUTILITY_ERROR_LOG(_r); +#define VIDEOPLAYLISTUTILITY_TRAPD(_r, _s) TRAPD(_r,_s);VIDEOPLAYLISTUTILITY_ERROR_LOG(_r); + +#endif // VIDEOPLAYLISTUTILITY_LOG_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappcomponents/videoplaylistutility/rom/videoplaylistutility.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/videoplaylistutility/rom/videoplaylistutility.iby Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,29 @@ +/* +* 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: IBY file for videoplaylistutility.dll +* +*/ + +// Version : %version: 2 % + + + + +#ifndef __VIDEOPLAYLISTUTILITY_IBY__ +#define __VIDEOPLAYLISTUTILITY_IBY__ + +file=ABI_DIR\BUILD_DIR\videoplaylistutility.dll SHARED_LIB_DIR\videoplaylistutility.dll + +#endif // __VIDEOPLAYLISTUTILITY_IBY__ + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/videoplaylistutility/sis/videoplaylistutility.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/videoplaylistutility/sis/videoplaylistutility.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,31 @@ +; +; 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: Package file for Video Playlist Utility +; +; Version : %version: 2 % +; +; Languages +&EN + +; Header +# {"VideoPlaylistUtility"}, (0x200159AF), 1, 0, 0, TYPE=SA, RU + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +;Files +"\epoc32\release\armv5\urel\videoplaylistutility.dll" - "!:\sys\bin\videoplaylistutility.dll" diff -r 000000000000 -r a2952bb97e68 mmappcomponents/videoplaylistutility/sis/videoplaylistutility.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/videoplaylistutility/sis/videoplaylistutility.xml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,31 @@ + + + + + 1 + videoplaylistutility + videoplaylistutility + + + + S60 + + 9 + 2 + + 2009 + 12 + + + + 9 + 2 + + 2010 + 1 + + + + + + diff -r 000000000000 -r a2952bb97e68 mmappcomponents/videoplaylistutility/sis/videoplaylistutility_stub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/videoplaylistutility/sis/videoplaylistutility_stub.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,31 @@ +; +; 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: Stub package file for Video Playlist Utility +; +; Version : %version: 2 % +; +;Language +&EN + +; Header +# {"PlaybackHelper"}, (0x200159AF), 1, 0, 0, TYPE=SA + +; Localised Vendor Name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +;Files +"" - "z:\sys\bin\videoplaylistutility.dll" diff -r 000000000000 -r a2952bb97e68 mmappcomponents/videoplaylistutility/sis/videoplaylistutility_stub.sis Binary file mmappcomponents/videoplaylistutility/sis/videoplaylistutility_stub.sis has changed diff -r 000000000000 -r a2952bb97e68 mmappcomponents/videoplaylistutility/src/videoplaylistutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappcomponents/videoplaylistutility/src/videoplaylistutility.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,326 @@ +/* +* 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: Implementation of CVideoPlaylistUtility +* +*/ + +// Version : %version: 2 % + + + +// INCLUDE FILES + +#include +#include +#include +#include +#include +#include +#include + +#include "videoplaylistutility_log.h" + + +// CONSTANTS +const TInt KSingleLink(1); +_LIT( KDATATYPEVIDEOHELIX, "video/videohelix" ); + + +// ============================ MEMBER FUNCTIONS =================================================== + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaylistUtility::CVideoPlaylistUtility +// C++ default constructor can NOT contain any code, that +// might leave. +// ------------------------------------------------------------------------------------------------- +// +CVideoPlaylistUtility::CVideoPlaylistUtility() +: iAsx( EFalse ) +{ + +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaylistUtility::ConstructL +// Symbian 2nd phase constructor can leave. +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaylistUtility::ConstructL() +{ + +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaylistUtility::NewL +// Two-phased constructor. +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C CVideoPlaylistUtility* CVideoPlaylistUtility::NewL() +{ + VIDEOPLAYLISTUTILITY_ENTER_EXIT(_L("CVideoPlaylistUtility::NewL()")); + + CVideoPlaylistUtility* self = new( ELeave ) CVideoPlaylistUtility(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaylistUtility::~CVideoPlaylistUtility +// Destructor +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C CVideoPlaylistUtility::~CVideoPlaylistUtility() +{ + VIDEOPLAYLISTUTILITY_ENTER_EXIT(_L("CVideoPlaylistUtility::~CVideoPlaylistUtility()")); + + if(iPlaylistArray) + { + delete iPlaylistArray; + iPlaylistArray = NULL; + } + + if(iStreamingLinkModel) + { + iStreamingLinkModel->ResetLinkCount(); + iStreamingLinkModel->FreeFilehandle(); + + delete iStreamingLinkModel; + iStreamingLinkModel = NULL; + } +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaylistUtility::GetItemArrayL +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaylistUtility::GetItemArrayL( TInt aAccessPointId ) +{ + VIDEOPLAYLISTUTILITY_ENTER_EXIT(_L("CVideoPlaylistUtility::GetItemArrayL()" )); + + HBufC* tempBuffer = HBufC::NewLC( iStreamingLinkModel->MaxLinkLength() ); + TPtr tempurl(tempBuffer->Des()); + + TInt linkError = KErrNone; + TInt localUrl; + TBool seek = ETrue; + + iPlaylistArray = CMPXMediaArray::NewL(); + + while(linkError == KErrNone) + { + linkError = iStreamingLinkModel->GetNextLinkL( tempurl, localUrl ); + + if (linkError == KErrNone) + { + CMPXMedia* lItem = CMPXMedia::NewL(); + CleanupStack::PushL( lItem ); + + lItem->SetTObjectValueL(KMPXMediaGeneralType, EMPXItem); + lItem->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXVideo); + // Bump up the score during plugin resolution in the FW + lItem->SetTextValueL(KMPXMediaGeneralMimeType, KDATATYPEVIDEOHELIX); + lItem->SetTextValueL(KMPXMediaGeneralUri, *tempBuffer); + if (!localUrl) + { + // embed the access point into the playlist + lItem->SetTObjectValueL(KMPXMediaGeneralExtAccessPoint, aAccessPointId); + } + + if ( iAsx ) + { + // Get asx seek attribute + seek = iStreamingLinkModel->IsSeekable(); + + lItem->SetTObjectValueL(KMPXMediaGeneralExtVideoSeekable, seek); + } + + CleanupStack::Pop( lItem ); + + iPlaylistArray->AppendL(lItem); + lItem = NULL; + } + } + + + CleanupStack::Pop(); // tempBuffer + delete tempBuffer; +} + +// ----------------------------------------------------------------------------- +// CMPlayerM3UPlaylistParser::ComposePlaylistL +// ----------------------------------------------------------------------------- +// +void CVideoPlaylistUtility::ComposePlaylistL() +{ + VIDEOPLAYLISTUTILITY_ENTER_EXIT(_L("CVideoPlaylistUtility::ComposePlaylistL()")); + + // instantiate a CMPXMedia object to represent the playlist + // which will contain the CMPXMediaArray + iPlaylist = CMPXMedia::NewL(); + + // set type + iPlaylist->SetTObjectValueL(KMPXMediaGeneralType, EMPXItem); + + // set category + iPlaylist->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXPlaylist); + + // set iPlaylist array + iPlaylist->SetCObjectValueL(KMPXMediaArrayContents, iPlaylistArray); + + // set array acount + iPlaylist->SetTObjectValueL(KMPXMediaArrayCount, iPlaylistArray->Count()); + + // the ownership has been transfered + // safe to delete + delete iPlaylistArray; + iPlaylistArray = NULL; + +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaylistUtility::OpenLinkFileL +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C CMPXMedia* CVideoPlaylistUtility::GetPlayListL( TInt aAccessPointId ) +{ + VIDEOPLAYLISTUTILITY_ENTER_EXIT(_L("CVideoPlaylistUtility::GetPlayListL()")); + + CMPXMedia* playlist = NULL; + + // Create the CMPXMediaItemArray that will have the links + GetItemArrayL(aAccessPointId); + + // Embed the CMPXMediaItemArray into a CMPXMedia object + ComposePlaylistL(); + + playlist = iPlaylist; + iPlaylist = NULL; + + return playlist; +} + + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaylistUtility::GetFileInfoL +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C void CVideoPlaylistUtility::GetFileInfoL( const TDesC& aFileName, + CMediaRecognizer::TMediaType aMediaType, + TBool& aSingleLink, TBool& aLocalFile ) +{ + VIDEOPLAYLISTUTILITY_ENTER_EXIT(_L("CVideoPlaylistUtility::GetFileInfoL() FileName ")); + + TInt error = KErrNone; + aSingleLink = aLocalFile = EFalse; + iStreamingLinkModel = CStreamingLinkModel::NewL(); + + + if ( aMediaType == CMediaRecognizer::ELocalRamFile ) + { + error = iStreamingLinkModel->OpenLinkFileL( aFileName ); + } + else + { + error = iStreamingLinkModel->OpenAsxFileL( aFileName ); + iAsx = ETrue; + } + + if(error == KErrNone) + { + // check to see if its a single link file + if (iStreamingLinkModel->MultiLinksCount() == KSingleLink) + { + aSingleLink = ETrue; + } + aLocalFile = iStreamingLinkModel->AreAllLinksLocal(); + } + else + { + User::Leave( KErrBadName ); + } +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaylistUtility::GetFileInfoL +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C void CVideoPlaylistUtility::GetFileInfoL( RFile& aFile, + CMediaRecognizer::TMediaType aMediaType, + TBool& aSingleLink, TBool& aLocalFile ) +{ + VIDEOPLAYLISTUTILITY_ENTER_EXIT(_L("CVideoPlaylistUtility::GetFileInfoL() RFile")); + + TInt error = KErrNone; + aSingleLink = aLocalFile = EFalse; + iStreamingLinkModel = CStreamingLinkModel::NewL(); + + if ( aMediaType == CMediaRecognizer::ELocalRamFile ) + { + error = iStreamingLinkModel->OpenLinkFileL( aFile ); + } + else + { + error = iStreamingLinkModel->OpenAsxFileL( aFile ); + iAsx = ETrue; + } + + if(error == KErrNone) + { + // check to see if its a single link file + if (iStreamingLinkModel->MultiLinksCount() == KSingleLink) + { + aSingleLink = ETrue; + } + aLocalFile = iStreamingLinkModel->AreAllLinksLocal(); + } + else + { + User::Leave( KErrBadName ); + } +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaylistUtility::GetLinkLC +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C TPtrC CVideoPlaylistUtility::GetLinkLC() +{ + VIDEOPLAYLISTUTILITY_ENTER_EXIT(_L("CVideoPlaylistUtility::GetLinkLC()")); + + TBool localUrl; + HBufC* tempBuffer = HBufC::NewLC( iStreamingLinkModel->MaxLinkLength() ); + + TPtr tempurl(tempBuffer->Des()); + + iStreamingLinkModel->GetNextLinkL( tempurl, localUrl ); + + // push tempBuffer to the cleanup stack again + // caller of GetLinkLC will pop and destroy it + return tempurl; +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaylistUtility::IsSeekable +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C TBool CVideoPlaylistUtility::IsSeekable() +{ + VIDEOPLAYLISTUTILITY_ENTER_EXIT(_L("CVideoPlaylistUtility::Seekable()")); + + return iStreamingLinkModel->IsSeekable(); +} + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/asx_parser_api/asx_parser_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/asx_parser_api/asx_parser_api.metaxml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,15 @@ + + +ASX Parser API +API for parsing Windows Media ASX files +c++ +mmappcomponents + + + + + +no +no + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/asx_parser_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/asx_parser_api/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2008 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 +* ASX Parser API +* +*/ + +// Version : %version: 6.1.1 % + + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/asxparser.h MW_LAYER_PLATFORM_EXPORT_PATH(asxparser.h) diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/asx_parser_api/inc/asxparser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/asx_parser_api/inc/asxparser.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,157 @@ +/* +* Copyright (c) 2008 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: Simple v2/v3 ASX-fileparser + * Finds streaming URLs from ASX files and provides an + * interface to query them + * +*/ + +// Version : %version: 4.1.2 % + + + +#ifndef CASXPARSER_H +#define CASXPARSER_H + +// INCLUDES +#include + + +// FORWARD DECLARATIONS + +// CLASS DECLARATIONS + + +struct AsxStruct { + HBufC8* url; + TBool seek; +}; + +/* + * CAsxParser. + * @since 3.2 + */ +class CAsxParser : public CBase +{ + public: // Constructors and destructor + + /* + * Two-phased constructor. + * @since 3.2 + * @param const TDesC& File to parse + * @return CAsxParser object initialized + */ + IMPORT_C static CAsxParser* NewL( const TDesC& aFileName ); + + /* + * Two-phased constructor. + * @since 5.0 + * @param aFile file handle + * @return CAsxParser object initialized + */ + IMPORT_C static CAsxParser* NewL( RFile& aFile ); + + /* + * Destructor. + */ + IMPORT_C ~CAsxParser(); + + /* + * GetUrl + * @since 3.2 + * @param const TUint The number of URLs in the file + * @return TInt + */ + IMPORT_C void GetUrlCount( TUint &aHowManyUrls ); + + /* + * GetUrl + * @since 3.2 + * @param const TInt The index number of the URL to retrieve + * @return TInt + */ + IMPORT_C TInt GetUrl( const TUint aUrlIndex, TPtrC8& aUrl ); + IMPORT_C AsxStruct* GetUrl( const TUint aUrlIndex ); + + /* + * GetUrl + * @since 3.2 + * @param none + * @return TInt + */ + IMPORT_C TInt FileVersion(); + + /* + * PrintUrl + * @since 5.0 + * @param aUrl8 + * @return aUrl + */ + IMPORT_C void PrintUrl( TPtrC8& aUrl8, TPtr& aUrl ); + + + private: // New methods + + /* + * C++ default constructor. + */ + CAsxParser(); + + /* + * By default Symbian 2nd phase constructor is private. + * @param TDesC& File to parse + * @return void + */ + void ConstructL( const TDesC& aFileName ); + + /* + * By default Symbian 2nd phase constructor is private. + * @since 5.0 + * @param aFile file handle + * @return void + */ + void ConstructL( RFile& aFile ); + + /* + * Parse a Asx V2 Header file + * @param TPtr8 pointer to buffer containing asx file + * @return void + */ + void ParseAsxV2HeaderL( TPtr8 aPtr ); + + /* + * Parse a Asx V3 Header file + * @param TPtr8 pointer to buffer containing asx file + * @return void + */ + void ParseAsxV3HeaderL( TPtr8 aPtr ); + + /* + * Handle common file parsing + * @since 5.0 + * @param aFile file handle + * @return void + */ + void HandleFileParsingL( RFile& aFile ); + + + private: // Data + + RPointerArray iAsxArray; + TInt iVersion; +}; + +#endif // CBAVPCONTROLLERVIDEO_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/asx_parser_api/tsrc/AsxParserTest/Bmarm/AsxParserTestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/asx_parser_api/tsrc/AsxParserTest/Bmarm/AsxParserTestU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/asx_parser_api/tsrc/AsxParserTest/Bwins/AsxParserTestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/asx_parser_api/tsrc/AsxParserTest/Bwins/AsxParserTestU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/asx_parser_api/tsrc/AsxParserTest/EABI/AsxParserTestU.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/asx_parser_api/tsrc/AsxParserTest/EABI/AsxParserTestU.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + _ZTI17CEdwinTestControl @ 2 NONAME ; ## + _ZTV17CEdwinTestControl @ 3 NONAME ; ## + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/asx_parser_api/tsrc/AsxParserTest/group/AsxParserTest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/asx_parser_api/tsrc/AsxParserTest/group/AsxParserTest.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,87 @@ +/* +* 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: AsxParserTest.mmp +* +*/ + +// Version : %version: 5.1.1 % + + + +#if defined(__S60_) +#include +#endif + +TARGET AsxParserTest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +/* Remove comments and replace 0x00000000 with correct vendor id */ +// VENDORID 0x00000000 +/* Remove comments and replace 0x00000000 with correct secure id */ +// SECUREID 0x00000000 + +//TARGETPATH ?target_path +DEFFILE AsxParserTest.def + + +MW_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src + +SOURCE AsxParserTest.cpp +SOURCE AsxParserTestBlocks.cpp EdwinTestControl.cpp + +//RESOURCE resource_file +//RESOURCE resource_file2 +USERINCLUDE ../inc + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY asxparser.lib +LIBRARY bafl.lib +LIBRARY efsrv.lib +LIBRARY charconv.lib +LIBRARY cone.lib +LIBRARY ws32.lib avkon.lib eikcoctl.lib eikctl.lib apgrfx.lib aknskins.lib aknskinsrv.lib aknswallpaperutils.lib eikcore.lib +LIBRARY estor.lib +LIBRARY sysutil.lib +LIBRARY apmime.lib +LANG SC + +/* +START WINS +?wins_specific_information +END + +START MARM +?marm_specific_information +END +*/ +// Other possible keywords: + +// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) +/* +START BITMAP ?target +TARGETPATH ?emulated_path_on_target_machine +HEADER +SOURCE ?color_depth ?source_bitmap +END +*/ +// DEFFILE ?filename +// AIF ?filename + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/asx_parser_api/tsrc/AsxParserTest/group/AsxParserTest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/asx_parser_api/tsrc/AsxParserTest/group/AsxParserTest.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -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: Package file for AsxParser STIF component +; +; Version : %version: % +; +; Installation file for STIF MPEngine test Application in Platform Security Environments +; + +; Languages +&EN + +; Package header +#{"STIF AsxParser Test Application"},(0x02598765),1,1,0,TYPE=SA + +; Localised Vendor name +%{"Nokia EN"} + +; Unique Vendor name +:"Nokia" + +; Logo +; None + +; Package signature - Optional +; None + +; Start of Package body + +; Condition blocks +; None + +; Options list +; None + +; Install files +"..\..\data\mmc\Corrupttest2.asx" - "e:\testing\data\Corrupttest2.asx" +"..\..\data\mmc\Corrupttest.asx" - "e:\testing\data\Corrupttest.asx" +"..\..\data\mmc\test2.asx" - "e:\testing\data\test2.asx" +"..\..\data\mmc\test.asx" - "e:\testing\data\test.asx" +"..\..\init\TestFramework.ini" - "c:\testframework\TestFramework.ini" +"..\..\conf\AsxParserTest.cfg" - "c:\testframework\AsxParserTest.cfg" + +; // STIF GUI (STIFTestFramework\Series60_UI is need to compile) +"\epoc32\release\armv5\urel\AsxParserTest.dll" - "c:\Sys\Bin\AsxParserTest.dll" + +; Embedded SIS +; None + +; End of Package body + +; PKG dependencies +; None + +; PKG capabilities +; None \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/asx_parser_api/tsrc/AsxParserTest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/asx_parser_api/tsrc/AsxParserTest/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,60 @@ +/* +* 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: bld.inf +* +*/ + +// Version : %version: 3.1.2 % + + + + +PRJ_PLATFORMS +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these +DEFAULT + +PRJ_TESTEXPORTS +// NOTE: If using ARS requirements all export operations should be done under this. +// 'abld test export' + +PRJ_EXPORTS +// Specify the source file followed by its destination here +// copy will be used to copy the source file to its destination +// If there's no destination then the source file will be copied +// to the same name in /epoc32/include +// Example: +/* +/agnmodel/inc/AGMCOMON.H +*/ + +PRJ_TESTMMPFILES +AsxParserTest.mmp + +PRJ_MMPFILES +// Specify the .mmp files required for building the important component +// releasables. +// +// Specify "tidy" if the component you need to build doesn't need to be +// released. Specify "ignore" if the MMP file exists but should be +// ignored. +// Example: +/* +/agnmodel/group/agnmodel.mmp +#if defined(MARM) +/agnmodel/group/agsvexe.mmp +#endif +*/ + +// End of File \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/asx_parser_api/tsrc/AsxParserTest/inc/AsxParserTest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/asx_parser_api/tsrc/AsxParserTest/inc/AsxParserTest.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,210 @@ +/* +* 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: AsxParserTest.h +* +*/ + +// Version : %version: 3.1.2 % + + + + +#ifndef ASXPARSERTEST_H +#define ASXPARSERTEST_H + +// INCLUDES +#include +#include +#include +#include +#include "AsxParser.h" +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def +#define TEST_CLASS_VERSION_MAJOR 0 +#define TEST_CLASS_VERSION_MINOR 0 +#define TEST_CLASS_VERSION_BUILD 0 + +// Logging path +#ifdef __WINSCW__ +_LIT( KAsxParserTestLogPath, "C:\\logs\\testframework\\AsxParserTest\\" ); +// Log file +_LIT( KAsxParserTestLogFile, "AsxParserTest.txt" ); +_LIT( KAsxParserTestLogFileWithTitle, "AsxParserTest_[%S].txt" ); +_LIT( KAsxParserTest_testPath, "C:\\testing\\data\\" ); +#else +_LIT( KAsxParserTestLogPath, "E:\\logs\\testframework\\AsxParserTest\\" ); +// Log file +_LIT( KAsxParserTestLogFile, "AsxParserTest.txt" ); +_LIT( KAsxParserTestLogFileWithTitle, "AsxParserTest_[%S].txt" ); +_LIT( KAsxParserTest_testPath, "E:\\testing\\data\\" ); +#endif +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class CAsxParserTest; +class CAsxParser; + +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// CLASS DECLARATION + +/** +* CAsxParserTest test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(CAsxParserTest) : public CScriptBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CAsxParserTest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CAsxParserTest(); + + public: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + 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 ); + + protected: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + protected: // Functions from base classes + + /** + * From ?base_class ?member_description + */ + //?type ?member_function(); + + private: + + /** + * C++ default constructor. + */ + CAsxParserTest( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // ?classname( const ?classname& ); + // Prohibit assigment operator if not deriving from CBase. + // ?classname& operator=( const ?classname& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + /** + * Test methods are listed below. + */ + + /** + * Example test method. + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + virtual TInt ExampleL( CStifItemParser& aItem ); + TInt CreateNew( CStifItemParser& aItem ); + TInt CreateNewRFile( CStifItemParser& aItem ); + TInt FileVersion( CStifItemParser& aItem ); + TInt GetUrlCount( CStifItemParser& aItem ); + TInt GetUrl( CStifItemParser& aItem ); + TInt PrintUrl( CStifItemParser& aItem ); + TInt FileVersionRFile( CStifItemParser& aItem ); + TInt GetUrlCountRFile( CStifItemParser& aItem ); + TInt GetUrlRFile( CStifItemParser& aItem ); + TInt PrintUrlRFile( CStifItemParser& aItem ); + TInt CAsxParserDestructor(CStifItemParser& aItem ); + TInt GetAsxStruct( CStifItemParser& aItem ); + + /** + * Method used to log version of test class + */ + void SendTestClassVersion(); + + //ADD NEW METHOD DEC HERE + //[TestMethods] - Do not remove + + public: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + protected: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + private: // Data + + // ?one_line_short_description_of_data + //?data_declaration; + + // Reserved pointer for future extension + //TAny* iReserved; + + public: // Friend classes + //?friend_class_declaration; + protected: // Friend classes + //?friend_class_declaration; + private: // Friend classes + //?friend_class_declaration; + CAsxParser* iAsxParser; + }; + +#endif // ASXPARSERTEST_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/asx_parser_api/tsrc/AsxParserTest/inc/EdwinTestControl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/asx_parser_api/tsrc/AsxParserTest/inc/EdwinTestControl.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,52 @@ +/* +* 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: EdwinTestContro.h +* +*/ + +// Version : %version: 3.1.1 % + + + +#ifndef EDWINTESTCONTROL_H_ +#define EDWINTESTCONTROL_H_ + +#include + +class CAknsBasicBackgroundControlContext; + +class CEdwinTestControl : public CCoeControl, public MCoeControlObserver + { +public: + static CEdwinTestControl* NewL(void); + virtual ~CEdwinTestControl(); +protected: + TTypeUid::Ptr MopSupplyObject(TTypeUid aId); // +private: + virtual void SizeChanged(); + virtual void HandleResourceChange(TInt aType); + virtual TInt CountComponentControls() const; + virtual CCoeControl* ComponentControl(TInt aIndex) const; + void ConstructL(void); + void Draw(const TRect& aRect) const; + + void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType); + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType ); +private: + CAknsBasicBackgroundControlContext* iBgContext; + CEikEdwin* iEditWin; +}; + + +#endif /*EDWINTESTCONTROL_H_*/ diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/asx_parser_api/tsrc/AsxParserTest/src/AsxParserTest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/asx_parser_api/tsrc/AsxParserTest/src/AsxParserTest.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,208 @@ +/* +* 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: AsxParserTest.cpp +* +*/ + +// Version : %version: 3.1.1 % + + + + +// INCLUDE FILES +#include +#include "AsxParserTest.h" +#include + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; + +// EXTERNAL FUNCTION PROTOTYPES +//extern ?external_function( ?arg_type,?arg_type ); + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// LOCAL CONSTANTS AND MACROS +//const ?type ?constant_var = ?constant; +//#define ?macro_name ?macro_def + +// MODULE DATA STRUCTURES +//enum ?declaration +//typedef ?declaration + +// LOCAL FUNCTION PROTOTYPES +//?type ?function_name( ?arg_type, ?arg_type ); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ?function_name ?description. +// ?description +// Returns: ?value_1: ?description +// ?value_n: ?description_line1 +// ?description_line2 +// ----------------------------------------------------------------------------- +// +/* +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg) // ?description + { + + ?code // ?comment + + // ?comment + ?code + } +*/ + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CAsxParserTest::CAsxParserTest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CAsxParserTest::CAsxParserTest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// CAsxParserTest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CAsxParserTest::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(KAsxParserTestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KAsxParserTestLogFile); + } + + iLog = CStifLogger::NewL( KAsxParserTestLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + // SendTestClassVersion(); + } + +// ----------------------------------------------------------------------------- +// CAsxParserTest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CAsxParserTest* CAsxParserTest::NewL( + CTestModuleIf& aTestModuleIf ) + { + CAsxParserTest* self = new (ELeave) CAsxParserTest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +CAsxParserTest::~CAsxParserTest() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + if(NULL != iAsxParser) + { + delete iAsxParser; + iAsxParser = NULL; + } + } +/* +//----------------------------------------------------------------------------- +// CAsxParserTest::SendTestClassVersion +// Method used to send version of test class +//----------------------------------------------------------------------------- +// +void CAsxParserTest::SendTestClassVersion() + { + TVersion moduleVersion; + moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; + moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; + moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; + + TFileName moduleName; + moduleName = _L("AsxParserTest.dll"); + + TBool newVersionOfMethod = ETrue; + TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); + } +*/ +// ========================== 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* ) CAsxParserTest::NewL( aTestModuleIf ); + + } + + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/asx_parser_api/tsrc/AsxParserTest/src/AsxParserTestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/asx_parser_api/tsrc/AsxParserTest/src/AsxParserTestBlocks.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,649 @@ +/* +* 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: AsxParserTestBlocks.cpp +* +*/ + +// Version : %version: 3.1.2 % + + + + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include "AsxParserTest.h" +#include "AsxParser.h" + +#include +#include "EdwinTestControl.h" +#include + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; + +// EXTERNAL FUNCTION PROTOTYPES +//extern ?external_function( ?arg_type,?arg_type ); + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// LOCAL CONSTANTS AND MACROS +//const ?type ?constant_var = ?constant; +//#define ?macro_name ?macro_def + +// MODULE DATA STRUCTURES +//enum ?declaration +//typedef ?declaration + +// LOCAL FUNCTION PROTOTYPES +//?type ?function_name( ?arg_type, ?arg_type ); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ?function_name ?description. +// ?description +// Returns: ?value_1: ?description +// ?value_n: ?description_line1 +// ?description_line2 +// ----------------------------------------------------------------------------- +// +/* +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg) // ?description + { + + ?code // ?comment + + // ?comment + ?code + } +*/ + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CAsxParserTest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CAsxParserTest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// CAsxParserTest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CAsxParserTest::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( "Example", CAsxParserTest::ExampleL ), + //ADD NEW ENTRY HERE + // [test cases entries] - Do not remove + // test cases for the header "AsxParser.h" + ENTRY( "CreateNew", CAsxParserTest::CreateNew ), + ENTRY( "CreateNewRFile", CAsxParserTest::CreateNewRFile ), + ENTRY( "GetUrlCount", CAsxParserTest::GetUrlCount ), + ENTRY( "GetUrl", CAsxParserTest::GetUrl ), + ENTRY( "FileVersion", CAsxParserTest::FileVersion ), + ENTRY( "PrintUrl", CAsxParserTest::PrintUrl ), + ENTRY( "GetUrlCountRFile", CAsxParserTest::GetUrlCountRFile ), + ENTRY( "GetUrlRFile", CAsxParserTest::GetUrlRFile ), + ENTRY( "FileVersionRFile", CAsxParserTest::FileVersionRFile ), + ENTRY( "PrintUrlRFile", CAsxParserTest::PrintUrlRFile ), + ENTRY( "CAsxParserDestructor", CAsxParserTest::CAsxParserDestructor), + ENTRY( "GetAsxStruct", CAsxParserTest::GetAsxStruct ) + + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// ----------------------------------------------------------------------------- +// CAsxParserTest::ExampleL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CAsxParserTest::ExampleL( CStifItemParser& aItem ) + { + + // Print to UI + _LIT( KAsxParserTest, "AsxParserTest" ); + _LIT( KExample, "In Example" ); + TestModuleIf().Printf( 0, KAsxParserTest, KExample ); + // Print to log file + iLog->Log( KExample ); + + TInt i = 0; + TPtrC string; + _LIT( KParam, "Param[%i]: %S" ); + while ( aItem.GetNextString ( string ) == KErrNone ) + { + TestModuleIf().Printf( i, KAsxParserTest, + KParam, i, &string ); + i++; + } + + return KErrNone; + + } + +// +// ----------------------------------------------------------------------------- +// CAsxParserTest::CreateNew +// GetUrlCount method function +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CAsxParserTest::CreateNew( CStifItemParser& aItem ) + { + iLog->Log(_L("CAsxParserTest::CreateNew")); + TInt err = KErrNone; + TPtrC string; + while ( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(KAsxParserTest_testPath); + KFrom.Append(string); + TRAP(err,iAsxParser=CAsxParser::NewL(KFrom)); + if ( err == KErrNone ) + { + iLog->Log(_L("CreateNew returned no error")); + } + else + { + iLog->Log(_L("Error: CreateNew returned: %d"), err); + } + } + return err; + } + +// +// ----------------------------------------------------------------------------- +// CAsxParserTest::CreateNewRFile +// GetUrl method function +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CAsxParserTest::CreateNewRFile( CStifItemParser& aItem ) + { + iLog->Log(_L("CAsxParserTest::CreateNewRFile")); + TInt err = KErrNone; + TPtrC string; + while ( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(KAsxParserTest_testPath); + KFrom.Append(string); + + RFile file; + RFs fs; + TRAP(err, fs.Connect()); + file.Open(fs, KFrom, EFileRead | EFileShareReadersOnly ); + TRAP(err, iAsxParser=CAsxParser::NewL(file)); + fs.Close(); + + if ( err == KErrNone ) + { + iLog->Log(_L("CreateNewRFile returned no error %d"), err); + } + else + { + iLog->Log(_L("Error: CreateNewRFile returned: %d"), err); + } + + } + return err; + } + +// +// ----------------------------------------------------------------------------- +// CAsxParserTest::GetUrlCount +// GetUrlCount method function +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CAsxParserTest::GetUrlCount( CStifItemParser& aItem ) + { + iLog->Log(_L("CAsxParserTest::GetUrlCount")); + TInt err = KErrNone; + TPtrC string; + while ( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(KAsxParserTest_testPath); + KFrom.Append(string); + TRAP(err,iAsxParser=CAsxParser::NewL(KFrom)); + TUint aHowManyUrls; + + if ( err == KErrNone ) + { + iAsxParser->GetUrlCount(aHowManyUrls); + } + + if ( err == KErrNone ) + { + iLog->Log(_L("GetUrlCount returned no error")); + } + else + { + iLog->Log(_L("Error: GetUrlCount returned: %d"), err); + } + } + return err; + } + +// +// ----------------------------------------------------------------------------- +// CAsxParserTest::GetUrl +// GetUrl method function +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CAsxParserTest::GetUrl( CStifItemParser& aItem ) + { + iLog->Log(_L("CAsxParserTest::GetUrl")); + TInt err = KErrNone; + TPtrC string; + while ( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(KAsxParserTest_testPath); + KFrom.Append(string); + TRAP(err,iAsxParser=CAsxParser::NewL(KFrom)); + + if ( err == KErrNone ) + { + TUint aHowManyUrls = 1; + TPtrC8 aUrl; + err = iAsxParser->GetUrl(aHowManyUrls,aUrl); + } + + if ( err == KErrNone ) + { + iLog->Log(_L("GetUrl returned no error")); + } + else + { + iLog->Log(_L("Error: GetUrl returned: %d"), err); + } + } + return err; + } + +// +// ----------------------------------------------------------------------------- +// CAsxParserTest::FileVersion +// FileVersion method function +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CAsxParserTest::FileVersion( CStifItemParser& aItem ) + { + iLog->Log(_L("CAsxParserTest::FileVersion")); + TInt err = KErrNone; + TPtrC string; + while ( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(KAsxParserTest_testPath); + KFrom.Append(string); + TRAP(err,iAsxParser=CAsxParser::NewL(KFrom)); + + if ( err == KErrNone ) + { + iAsxParser->FileVersion(); + } + + if ( err == KErrNone ) + { + + iLog->Log(_L("FileVersion returned no error")); + } + else + { + iLog->Log(_L("Error: FileVersion returned: %d"), err); + } + } + return err; + } + +// +// ----------------------------------------------------------------------------- +// CAsxParserTest::PrintUrl +// GetUrl method function +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CAsxParserTest::PrintUrl( CStifItemParser& aItem ) + { + iLog->Log(_L("CAsxParserTest::PrintUrl")); + TInt err = KErrNone; + TPtrC string; + while ( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(KAsxParserTest_testPath); + KFrom.Append(string); + TRAP(err,iAsxParser=CAsxParser::NewL(KFrom)); + + if ( err == KErrNone ) + { + TPtrC8 aUrl; + HBufC16* urlBuffer = NULL; + TUint aHowManyUrls = 1; + + err =iAsxParser->GetUrl(aHowManyUrls,aUrl); + + if ( err == KErrNone ) + { + TRAP(err, urlBuffer = HBufC16::NewL(100)); + TPtr16 url = urlBuffer->Des(); + iAsxParser->PrintUrl(aUrl, url); + } + } + + if ( err == KErrNone ) + { + iLog->Log(_L("PrintUrl returned no error")); + } + else + { + iLog->Log(_L("Error: PrintUrl returned: %d"), err); + } + } + return err; + } + +// +// ----------------------------------------------------------------------------- +// CAsxParserTest::GetUrlCountRFile +// GetUrlCount method function +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CAsxParserTest::GetUrlCountRFile( CStifItemParser& aItem ) + { + iLog->Log(_L("CAsxParserTest::GetUrlCountRFile")); + TInt err = KErrNone; + TPtrC string; + while ( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(KAsxParserTest_testPath); + KFrom.Append(string); + + RFile file; + RFs fs; + User::LeaveIfError(fs.Connect()); + file.Open(fs, KFrom, EFileRead | EFileShareReadersOnly ); + TRAP(err, iAsxParser=CAsxParser::NewL(file)); + fs.Close(); + + if ( err == KErrNone ) + { + TUint aHowManyUrls; + iAsxParser->GetUrlCount(aHowManyUrls); + } + + if ( err == KErrNone ) + { + iLog->Log(_L("GetUrlCountRFile returned no error")); + } + else + { + iLog->Log(_L("Error: GetUrlCountRFile returned: %d"), err); + } + } + return err; + } + +// +// ----------------------------------------------------------------------------- +// CAsxParserTest::GetUrlRFile +// GetUrl method function +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CAsxParserTest::GetUrlRFile( CStifItemParser& aItem ) + { + iLog->Log(_L("CAsxParserTest::GetUrlRFile")); + TInt err = KErrNone; + TPtrC string; + while ( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(KAsxParserTest_testPath); + KFrom.Append(string); + + RFile file; + RFs fs; + User::LeaveIfError(fs.Connect()); + file.Open(fs, KFrom, EFileRead | EFileShareReadersOnly ); + TRAP(err, iAsxParser=CAsxParser::NewL(file)); + fs.Close(); + + if ( err == KErrNone ) + { + TUint aHowManyUrls = 1; + TPtrC8 aUrl; + iAsxParser->GetUrl(aHowManyUrls,aUrl); + } + + if ( err == KErrNone ) + { + iLog->Log(_L("GetUrlRFile returned no error")); + } + else + { + iLog->Log(_L("Error: GetUrlRFile returned: %d"), err); + } + } + return err; + } + +// +// ----------------------------------------------------------------------------- +// CAsxParserTest::FileVersionRFile +// FileVersion method function +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CAsxParserTest::FileVersionRFile( CStifItemParser& aItem ) + { + iLog->Log(_L("CAsxParserTest::FileVersionRFile")); + TInt err = KErrNone; + TPtrC string; + while ( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(KAsxParserTest_testPath); + KFrom.Append(string); + + RFile file; + RFs fs; + User::LeaveIfError(fs.Connect()); + file.Open(fs, KFrom, EFileRead | EFileShareReadersOnly ); + TRAP(err, iAsxParser=CAsxParser::NewL(file)); + fs.Close(); + + if ( err == KErrNone ) + { + iAsxParser->FileVersion(); + } + + if ( err == KErrNone ) + { + iLog->Log(_L("FileVersionRFile returned no error")); + } + else + { + iLog->Log(_L("Error: FileVersionRFile returned: %d"), err); + } + } + return err; + } + +// +// ----------------------------------------------------------------------------- +// CAsxParserTest::PrintUrlRFile +// GetUrl method function +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CAsxParserTest::PrintUrlRFile( CStifItemParser& aItem ) + { + iLog->Log(_L("CAsxParserTest::PrintUrlRFile")); + TInt err = KErrNone; + TPtrC string; + while ( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(KAsxParserTest_testPath); + KFrom.Append(string); + + RFile file; + RFs fs; + User::LeaveIfError(fs.Connect()); + file.Open(fs, KFrom, EFileRead | EFileShareReadersOnly ); + TRAP(err, iAsxParser=CAsxParser::NewL(file)); + fs.Close(); + + if ( err == KErrNone ) + { + TPtrC8 aUrl; + HBufC16* urlBuffer = NULL; + TUint aHowManyUrls = 1; + err =iAsxParser->GetUrl(aHowManyUrls,aUrl); + + if ( err == KErrNone ) + { + TRAP(err, urlBuffer = HBufC16::NewL(100)); + TPtr16 url = urlBuffer->Des(); + iAsxParser->PrintUrl(aUrl, url); + } + } + + if ( err == KErrNone ) + { + iLog->Log(_L("PrintUrlRFile returned no error")); + } + else + { + iLog->Log(_L("Error: PrintUrlRFile returned: %d"), err); + } + } + return err; + } + +// ----------------------------------------------------------------------------- +// CAsxParserTest::CAsxParserDestructor +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +TInt CAsxParserTest::CAsxParserDestructor(CStifItemParser& /*aItem*/) + { + TInt err = KErrNone; + delete iAsxParser; + iAsxParser = NULL; + iLog->Log(_L("CAsxParserTest::CAsxParserDestructor testing CAsxParser::~ end err=%d"), err); + return KErrNone; + } + + +// +// ----------------------------------------------------------------------------- +// CAsxParserTest::GetUrl +// GetUrl method function +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CAsxParserTest::GetAsxStruct( CStifItemParser& aItem ) + { + iLog->Log(_L("CAsxParserTest::GetAsxStruct")); + TInt err = KErrNone; + TPtrC string; + AsxStruct* asxStruct = NULL; + + while ( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(KAsxParserTest_testPath); + KFrom.Append(string); + TRAP(err,iAsxParser=CAsxParser::NewL(KFrom)); + + if ( err == KErrNone ) + { + TUint aHowManyUrls = 1; + TPtrC8 aUrl; + asxStruct = iAsxParser->GetUrl(aHowManyUrls); + } + + if ( asxStruct ) + { + iLog->Log(_L("GetUrl returned no error")); + } + else + { + err = KErrGeneral; + iLog->Log(_L("Error: GetUrl returned: %d"), err); + } + } + return err; + } + +// ----------------------------------------------------------------------------- +// CAsxParserTest::?member_function +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +/* +TInt CAsxParserTest::?member_function( + CItemParser& aItem ) + { + + ?code + + } +*/ + +// ========================== OTHER EXPORTED FUNCTIONS ========================= +// None + +// [End of File] - Do not remove diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/asx_parser_api/tsrc/AsxParserTest/src/EdwinTestControl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/asx_parser_api/tsrc/AsxParserTest/src/EdwinTestControl.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,151 @@ +/* +* 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: EdwinTestControl.cpp +* +*/ + +// Version : %version: 3.1.1 % + + + + +#include "EdwinTestControl.h" +#include +#include +#include +#include +#include + + +CEdwinTestControl::~CEdwinTestControl() + { + delete iEditWin; + iEditWin = NULL; + delete iBgContext; + iBgContext = NULL; + } + +CEdwinTestControl* CEdwinTestControl::NewL(void) + { + CEdwinTestControl* self = new(ELeave)CEdwinTestControl(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +void CEdwinTestControl::ConstructL() + { + CreateWindowL(); + + iEditWin = new (ELeave) CEikEdwin(); + iEditWin->ConstructL( 0, 100, 100, 1 ); + iEditWin->SetContainerWindowL( *this ); + iEditWin->CreateTextViewL(); +// iEditWin->SetInputCapabilitiesL( TCoeInputCapabilities::EAllText ); + + // make first with no size at all + iBgContext = CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgScreen,TRect(0,0,1,1), ETrue ); + // Setting rect will cause SizeChanged to be called + // and iBgContext size & position is updated accordingly. + SetRect( CEikonEnv::Static()->EikAppUi()->ClientRect() ); + + ActivateL(); + DrawNow(); + } + +void CEdwinTestControl::SizeChanged() + { + if ( iBgContext ) + { + iBgContext->SetRect(Rect()); + + if ( &Window() ) + { + iBgContext->SetParentPos( PositionRelativeToScreen() ); + } + } + if ( iEditWin ) + { + iEditWin->SetRect(Rect()); + } + } + + +void CEdwinTestControl::HandleResourceChange( TInt aType ) + { + TRect rect; + + if ( aType == KEikDynamicLayoutVariantSwitch ) + { + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect); + SetRect(rect); + } + + CCoeControl::HandleResourceChange(aType); + } + + +TTypeUid::Ptr CEdwinTestControl::MopSupplyObject(TTypeUid aId) + { + if ( iBgContext ) + { + return MAknsControlContext::SupplyMopObject( aId, iBgContext ); + } + + return CCoeControl::MopSupplyObject( aId ); + } + + +void CEdwinTestControl::Draw(const TRect& aRect) const + { + CWindowGc& gc = SystemGc(); + + // draw background skin first. + MAknsSkinInstance* skin = AknsUtils::SkinInstance(); + AknsDrawUtils::Background( skin, iBgContext, this, gc, aRect ); + } + +TInt CEdwinTestControl::CountComponentControls() const +{ + return 1; +} + +CCoeControl* CEdwinTestControl::ComponentControl(TInt aIndex) const +{ + switch (aIndex) + { + case 0: + return iEditWin; + default: + return 0; + } +} + +void CEdwinTestControl::HandleControlEventL( CCoeControl* /*aControl*/, TCoeEvent /*aEventType*/) + { + // TODO: Add your control event handler code here + } + +TKeyResponse CEdwinTestControl::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) + { + if ( iEditWin ) + { + return iEditWin->OfferKeyEventL( aKeyEvent, aType ); + } + else + { + return EKeyWasNotConsumed; + } + } diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/asx_parser_api/tsrc/conf/AsxParserTest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/asx_parser_api/tsrc/conf/AsxParserTest.cfg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,104 @@ +[Test] +title Example +create AsxParserTest foobar +foobar Example pa ra me ters +delete foobar +[Endtest] + +[Test] +title 1-1: CreateNew +create AsxParserTest ASXPARSER +ASXPARSER CreateNew test.asx +delete ASXPARSER +pause 1000 +[Endtest] + +[Test] +title 1-2: CreateNewRFile +create AsxParserTest ASXPARSER +ASXPARSER CreateNewRFile test.asx +delete ASXPARSER +pause 1000 +[Endtest] + +[Test] +title 2-1: FileVersion +create AsxParserTest ASXPARSER +ASXPARSER FileVersion test.asx +delete ASXPARSER +pause 1000 +[Endtest] + +[Test] +title 2-2: FileVersionRFile +create AsxParserTest ASXPARSER +ASXPARSER FileVersionRFile test.asx +delete ASXPARSER +pause 1000 +[Endtest] + +[Test] +title 3-1: GetUrlCount +create AsxParserTest ASXPARSER +ASXPARSER GetUrlCount test.asx +delete ASXPARSER +pause 1000 +[Endtest] + +[Test] +title 3-2: GetUrlCountRFile +create AsxParserTest ASXPARSER +ASXPARSER GetUrlCountRFile test.asx +delete ASXPARSER +pause 1000 +[Endtest] + +[Test] +title 4-1: GetUrl +create AsxParserTest ASXPARSER +ASXPARSER GetUrl test.asx +delete ASXPARSER +pause 1000 +[Endtest] + +[Test] +title 4-2: GetUrlRFile +create AsxParserTest ASXPARSER +ASXPARSER GetUrlRFile test.asx +delete ASXPARSER +pause 1000 +[Endtest] + +[Test] +title 4-3: GetAsxStruct +create AsxParserTest ASXPARSER +ASXPARSER GetAsxStruct test.asx +delete ASXPARSER +pause 1000 +[Endtest] + +[Test] +title 5-1: PrintUrl +create AsxParserTest ASXPARSER +ASXPARSER PrintUrl test.asx +delete ASXPARSER +pause 1000 +[Endtest] + +[Test] +title 5-2: PrintUrlRFile +create AsxParserTest ASXPARSER +ASXPARSER PrintUrlRFile test.asx +delete ASXPARSER +pause 1000 +[Endtest] + + +[Test] +title 6: CAsxParserDestructor +create AsxParserTest ASXPARSER +ASXPARSER CreateNew test.asx +ASXPARSER CAsxParserDestructor +delete ASXPARSER +pause 1000 +[Endtest] diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/asx_parser_api/tsrc/data/mmc/Corrupttest.asx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/asx_parser_api/tsrc/data/mmc/Corrupttest.asx Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +[Reference] +Refa1=http://172.19.59.81:8888/wm/kill_kevin_01_us_s.wmv?MSWMExt=.asf +Ref2=http://172.19.59.81:8888/wm/kill_kevin_01_us_s.wmv?MSWMExt=.asf diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/asx_parser_api/tsrc/data/mmc/Corrupttest2.asx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/asx_parser_api/tsrc/data/mmc/Corrupttest2.asx Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,20 @@ + + This text will show up as a Tooltip and in the Properties dialog box. + Global title of the show + The name of the author + 2004 by Your Company + + + + + + This is the description for this clip. + + + + Markers Discussion + 2004 Microsoft Corporation + + + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/asx_parser_api/tsrc/data/mmc/test.asx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/asx_parser_api/tsrc/data/mmc/test.asx Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +[Reference] +Ref1=http://172.19.59.81:8888/wm/kill_kevin_01_us_s.wmv?MSWMExt=.asf +Ref2=http://172.19.59.81:8888/wm/kill_kevin_01_us_s.wmv?MSWMExt=.asf diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/asx_parser_api/tsrc/data/mmc/test2.asx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/asx_parser_api/tsrc/data/mmc/test2.asx Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,20 @@ + + This text will show up as a Tooltip and in the Properties dialog box. + Global title of the show + The name of the author + 2004 by Your Company + + + + + + This is the description for this clip. + + + + Markers Discussion + 2004 Microsoft Corporation + + + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/asx_parser_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/asx_parser_api/tsrc/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2006 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 +: Media Player Engine API +* +*/ + +// Version : %version: 3.1.1 % + + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_TESTEXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +#include "../AsxParserTest/group/bld.inf" \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/asx_parser_api/tsrc/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/asx_parser_api/tsrc/init/TestFramework.ini Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,197 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[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_AsxParserTest + +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= 0 # Default timeout value for each test case. In milliseconds +UITestingSupport= YES +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +[New_Module] +ModuleName= testscripter +TestCaseFile= c:\testframework\AsxParserTest.cfg +[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[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= D:\LOGS\TestFramework\ +#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 000000000000 -r a2952bb97e68 mmappfw_plat/collection_helper_api/collection_helper_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/collection_helper_api/collection_helper_api.metaxml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,15 @@ + + +Collection Helper API +Provides music player specific extensions to the collection API set +c++ +mmappcomponents + + + + + +no +no + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/collection_helper_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/collection_helper_api/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2007 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 +: collection helper API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../inc/mpxcollectionhelperfactory.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectionhelperfactory.h) +../inc/mpxcollectionhelper.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectionhelper.h) +../inc/mpxcollectionuihelper.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectionuihelper.h) +../inc/mpxcollectionuihelperobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectionuihelperobserver.h) +../inc/mpxcollectionhelperobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectionhelperobserver.h) + \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/collection_helper_api/inc/mpxcollectionhelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/collection_helper_api/inc/mpxcollectionhelper.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,154 @@ +/* +* Copyright (c) 2007 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: Collection helper abstract interface +* +*/ + + + +#ifndef MMPXCOLLECTIONHELPER_H +#define MMPXCOLLECTIONHELPER_H + +#include +#include + +// FORWARD DECLARATIONS +class CMPXMedia; +class TMPXAttribute; + +/** + * Abstract class for collection helper. Use this class to add or remove songs and playlists from + * Music Player and Podcast app. + * + * @lib mpxcollectionhelper.lib + */ +class MMPXCollectionHelper + { + +public: + /** + * Add an item based on file path and use the harvester to parse the file. + * On completion MMPXCollectionHelperObserver::HandleAddFileCompleteL() + * is called back. + * + * @since S60 3.2.3 + * @param aFile full path and name of the file. + * @param aObserver observer for the add operation + */ + virtual void AddL( const TDesC& aFile, + MMPXCollectionHelperObserver* aObserver ) = 0; + + /** + * Add an item (song or playlist) with some media properties registers with playlists. + * @since S60 3.2.3 + * @param aMedia media property to add. + * @leave KErrArgument leave if the given media doesn't contain the correct attributes + */ + virtual void AddL( CMPXMedia* aMedia ) = 0; + + /** + * Remove a song, playlist, m3u file from the collection and from the harvester database. + * @since S60 3.2.3 + * @param aFile file to remove. + * @param aItemCat type of the item (optional). + * @leave KErrArgument leave if the file to be removed does not exist + */ + virtual void RemoveL( const TDesC& aFile, TMPXGeneralCategory aItemCat = EMPXSong) = 0; //lint !e1735 + + /** + * Remove all entries from the music, podcast and harvester databases. + * @since S60 3.2.3 + */ + virtual void RemoveAllL() = 0; + + /** + * Delete all records that have been marked as deleted. + * @since S60 3.2.3 + * @leave KErrNotSupported Virtual Void function that will leave if called and not implemented + */ + virtual void CleanupDeletedMediasL() = 0; + + /** + * Updates the metadata for a file based on the path. + * @since S60 3.2.3 + * @param aMedia media item to update. + * @leave KErrArgument leave if the given media doesn't contain the correct attributes + * or leave if not updating a song or a playlist + */ + virtual void SetL( CMPXMedia*& aMedia ) = 0; + + /** + * Renames a file. + * @since S60 3.2.3 + * @param aOldUri existing URI of the file to be renamed. + * @param aNewUri new URI of the file. + * @param aItemCat category of the file either EMPXSong + * or EMPXPlaylist. + * @leave KErrArgument leave if not updating a song or a playlist + */ + virtual void RenameL( const TDesC& aOldUri, + const TDesC& aNewUri, + TMPXGeneralCategory aItemCat = EMPXSong ) = 0; //lint !e1735 + + /** + * Gets the metadata for a file. + * @since S60 3.2.3 + * @param aFile path to the file. + * @param aAttrs attributes to return. + * @param aItemCat category of the file either EMPXSong + * or EMPXPlaylist. + * @return Media object representing the given file with + * the requested attributes. + * @leave KErrArgument leave if not updating a song or a playlist. + * @leave KErrNoMemory leave if search array is empty. + * @leave KErrNotFound leave if array indexcount is 0. + * @leave KErrCorrupt default case if the above conditions are not satisfied + * and object is not found + */ + virtual CMPXMedia* GetL( const TDesC& aFile, + const TArray& aAttrs, + TMPXGeneralCategory aItemCat = EMPXSong ) = 0; //lint !e1735 + + /** + * Gets the metadata for a file. + * @since S60 3.2.3 + * @param aFile path to the file. + * @param aItemCat category of the file either EMPXSong + * or EMPXPlaylist. + * @return Media object representing the given file. + * @leave KErrNotSupported Virtual const function that will leave if called and not implemented + */ + virtual const CMPXMedia& GetL( const TDesC& aFile, + TMPXGeneralCategory aItemCat = EMPXSong ) = 0; //lint !e1735 + + /** + * Generic find function. + * @since S60 3.2.3 + * @param aCriteria criterias to search upon. + * @param aAttrs attributes to return. + * @return Search results. found media(s) are accessible + * through KMPXMediaIdContainer/EMPXMediaArrayContents + * attribute + */ + virtual CMPXMedia* FindAllL( CMPXMedia& aCriteria, + const TArray& aAttrs) = 0; + + /** + * Close the helper. + * @since S60 3.2.3 + */ + virtual void Close() = 0; + }; + +#endif // MMPXCOLLECTIONHELPER_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/collection_helper_api/inc/mpxcollectionhelperfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/collection_helper_api/inc/mpxcollectionhelperfactory.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2006 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: Factory class to construct collection helper classes +* +*/ + + + +#ifndef MMPXCOLLECTIONHELPERFACTORY_H +#define MMPXCOLLECTIONHELPERFACTORY_H + +#include +#include + +// FORWARD DECLARATIONS +class CMPXMedia; +class CMPXCollectionPath; +class MMPXCollection; +class MMPXHarvesterUtility; +class MMPXCollectionHelper; +class MMPXCollectionUiHelper; + +/** + * Factory class to construct collection helpers. + * + * @lib mpxcollectionhelper.lib + */ +class CMPXCollectionHelperFactory : public CBase + { + +public: + + /** + * Two phased constructor to create the collection UI helper. + * @since S60 3.2.3 + * @param aModeId collection client context id to bind to. + * @return New CMPXCollectionUIHelper implementing instance based on aModeID + */ + IMPORT_C static MMPXCollectionUiHelper* NewCollectionUiHelperL(const TUid& aModeId = KMcModeDefault); + + /** + * Two phased constructor to create the general collection helper. + * @since S60 3.2.3 + * @return New CMPXCollectionHelper implementing instance + */ + IMPORT_C static MMPXCollectionHelper* NewCollectionHelperL(); + + /** + * Two phased constructor to create the cached collection helper. + * @since S60 3.2.3 + * @return New CMPXCollectionCachedHelper implementing instance + */ + IMPORT_C static MMPXCollectionHelper* NewCollectionCachedHelperL(); + + }; + +#endif // MMPXCOLLECTIONHELPERFACTORY_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/collection_helper_api/inc/mpxcollectionhelperobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/collection_helper_api/inc/mpxcollectionhelperobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2007 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: Observer interface for collection helper +* +*/ + + +#ifndef MMPXCOLLECTIONHELPEROBSERVER_H +#define MMPXCOLLECTIONHELPEROBSERVER_H + +/** + * Interface class for collection helper observer. Lets the client know when the + * operation is complete. + * + * @lib mpxcollectionhelper.lib + */ +NONSHARABLE_CLASS( MMPXCollectionHelperObserver ) + { +public: + /** + * Callback function to signal that adding a file is complete. + * @since S60 3.2.3 + * @param aErr error of the operation + */ + virtual void HandleAddFileCompleteL( TInt aErr ) = 0; + }; + +#endif // MMPXCOLLECTIONHELPEROBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/collection_helper_api/inc/mpxcollectionuihelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/collection_helper_api/inc/mpxcollectionuihelper.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,293 @@ +/* +* Copyright (c) 2006 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: Collection Ui Helper interface class +* +*/ + +#ifndef MMPXCOLLECTIONUIHELPER_H +#define MMPXCOLLECTIONUIHELPER_H + +#include +#include +#include + +// FORWARD DECLARATIONS +class CMPXCollectionPath; +class CMPXCollectionPlaylist; +class CMPXMedia; +class MMPXCHelperObserver; +class MMPXCHelperEmbeddedOpenObserver; + +/** + * Abstract class for collection ui helper. Performs operation on playlist object. + * Enables client to add, rename, etc a song to a playlist or add a particular property. + * + * @lib mpxcollectionhelper.lib + */ +NONSHARABLE_CLASS( MMPXCollectionUiHelper ) + { +public: + + /** Auto playlist type */ + enum TMPXAutoPlaylistType + { + EMPXRecentlyPlayedPlaylist, + EMPXMostPlayedPlaylist, + EMPXRecentlyAddedPlaylist + }; + + /** + * Add a media. Currently only adding a playlist is + * supported. + * @since S60 3.2.3 + * @param aMedia media to be added to the + * system. media type and category + * are mandatory attributes. Depending + * on the operation additional attributes + * may be required. + * @param aObserver observer to callback on completion + * of the request + */ + virtual void AddL( const CMPXMedia& aMedia, + MMPXCHelperObserver* aObserver ) = 0; + + /** + * Update a file with the particular media property. + * @since S60 3.2.3 + * @param aMedia media to update. + * @param aObserver observer to callback on completion + * of the request + */ + virtual void SetL( CMPXMedia*& aMedia, + MMPXCHelperObserver* aObserver ) = 0; + + /** + * Updates a list of properties. + * @since S60 3.2.3 + * @param aMediaArray list of media items. + * @param aPath collection path. + * @param aIndices an array of indicides to a collection path. + * @note this is not implemented because there is no use case + */ + virtual void SetL( TArray& aMediaArray, + CMPXCollectionPath& aPath, + RArray& aIndices) = 0; + + /** + * Rename a media. + * @since S60 3.2.3 + * @param aMedia media to be renamed. + * @param aObserver an observer for callback when + * operation is complete + */ + virtual void RenameL( const CMPXMedia& aMedia, + MMPXCHelperObserver* aObserver ) = 0; + + /** + * Delete a file based on the collection path. + * @since S60 3.2.3 + * @param aPath collection path with selections to delete. + * @param aObserver observer callback when operation is complete + */ + virtual void DeleteL( CMPXCollectionPath& aPath, + MMPXCHelperObserver* aObserver ) = 0; + + /** + * Move an item from one collection to another. + * @since S60 3.2.3 + * @param aMedia media for the item to delete. + * @param aNewCollection collection uid defined in collectionplugin.hrh. + * @param aObserver observer for the event + */ + virtual void MoveL( CMPXMedia*& aMedia, + TUid aNewCollection, + MMPXCHelperObserver* aObserver = NULL ) = 0; //lint !e1735 + /** + * Open the collection in embedded mode with a Media Object. + * @since S60 3.2.3 + * @param aUid Host Process UID to identify this embedded instance. + * @param aMedia Media Object to open. + * @param aObserver observer to the open operation. + * @param aPluginInfo additional argument to pass to the plugin resolver + */ + virtual void OpenL( const TUid& aHostId, CMPXMedia& aMedia, + MMPXCHelperEmbeddedOpenObserver* aObserver, + TInt aPluginInfo = 0 ) = 0; //lint !e1735 + + /** + * Open the collection in embedded mode with a File Handle. + * @since S60 3.2.3 + * @param aHostId Host Process UID to identify this embedded instance. + * @param aFile File handle that we have to process. + * @param aObserver observer to the open operation. + * @param aPluginInfo additional argument to pass to the plugin resolver + */ + virtual void OpenL( const TUid& aHostId, const TDesC& aFile, + MMPXCHelperEmbeddedOpenObserver* aObserver, + TInt aPluginInfo = 0 ) = 0; //lint !e1735 + + /** + * Queries about the playlist file extension of the currently selected playlist + * plugin. + * @since S60 3.2.3 + * @return File extension of the playlist type which includes the period + * ownership transferred + */ + virtual HBufC* PlaylistFileExtensionLC() = 0; + + /** + * Export the specified playlist to a file. + * @since S60 3.2.3 + * @param aPlaylistId id of the playlist to be exported. + * @param aDestinationDriveAndPath, specifies where the playlist file should + * be created. If the file already exists, it will be overwritten. + * @param aObserver observer for the callback. URI of the exported playlist + * will be returned as a HBufC* which client takes over the + * ownership. + * @leave KErrArgument leave if the playlist object does not exist + */ + virtual void ExportPlaylistL(TMPXItemId aPlaylistId, + const TDesC& aDestinationDriveAndPath, + MMPXCHelperObserver* aObserver) = 0; + + + /** + * Reorder a song in the playlist. + * @since S60 3.2.3 + * @param aPlaylistId id of the playlist which contains the song to be reordered. + * @param aSongId id of the song to be reordered. + * @param aOriginalOrdinal the original ordinal of the song within the playlist. + * Ordinal starts from 0. + * @param aNewOrdinal the new ordinal of the song within the playlist. Ordinal + * starts from 0. + * @param aObs observer for the callback. + * @leave KErrArgument leave if the playlist object does not exist + */ + virtual void ReorderPlaylistL(const TMPXItemId& aPlaylistId, + const TMPXItemId& aSongId, + TUint aOriginalOrdinal, + TUint aNewOrdinal, + MMPXCHelperObserver* aObserver) = 0; + + /** + * Gets the collection path to the main music menu. + * Call OpenL() with this path to open music menu. + * @since S60 3.2.3 + * @return CMPXCollectionPath* ownership transferred + */ + virtual CMPXCollectionPath* MusicMenuPathL() = 0; + + /** + * Gets the collection path to the podcast menu. + * Call OpenL() with this path to open podcast menu. + * @since S60 3.2.3 + * @return CMPXCollectionPath* ownership transferred + */ + virtual CMPXCollectionPath* PodCastMenuPathL() = 0; + + /** + * Gets the collection path to the main all songs view. + * Call OpenL() with this path to open music all songs view. + * @since S60 3.2.3 + * @return CMPXCollectionPath* ownership transferred + */ + virtual CMPXCollectionPath* MusicAllSongsPathL() = 0; + + /** + * Gets the collection path to the music playlist view. + * Call OpenL() with this path to open music playlist menu. + * @since S60 3.2.3 + * @return CMPXCollectionPath* ownership transferred + */ + virtual CMPXCollectionPath* MusicPlaylistPathL() = 0; + + /** + * Gets the collection path to the music playlist view + * Call OpenL() with this path to open music playlist menu + * @since S60 5.0 + * @param aPlaylistType type of auto playlist + * @return CMPXCollectionPath*, ownership transferred + */ + virtual CMPXCollectionPath* MusicPlaylistPathL( TMPXAutoPlaylistType aPlaylistType ) = 0; + + /** + * Creates a default playlist path to open. Hardcoded to Music Collection / All songs. + * @since S60 3.2.3 + * @return CollectionPath* ownership transferred + */ + virtual CMPXCollectionPath* CreateDefaultPlaylistPathLC() = 0; + + /** + * Cancels any async requests if any. + * @since S60 3.2.3 + * @note Only DeleteL() is supported at the moment + */ + virtual void Cancel() = 0; + + /** + * Free this object. + * @since S60 3.2.3 + */ + virtual void Close() = 0; + + /** + * Test if the specified title exists in the specified category. + * @since S60 3.2.3 + * @param aCategory specifies the category for testing. + * @param aTitle specifies the title for testing. + * @return ETrue if the specified title exists in the specified + * category; otherwise EFalse + */ + virtual TBool TitleExistsL( TMPXGeneralCategory aCategory, + const TDesC& aTitle, + TMPXGeneralType aType = EMPXItem ) = 0; + + /** + * Open the collection in embedded mode with a File Handle. + * @since S60 3.2.3 + * @param aFile File handle that we have to process. + * @param aObserver observer to the open operation + */ + virtual void OpenL( RFile& aFile, + MMPXCHelperEmbeddedOpenObserver* aObserver ) = 0; + + /** + * Returns the file name used for virtual playlist handling. + * @since S60 3.2.3 + * @return The file name to be used to externalize collection path for the playlist + * that needs to be handled. Ownership transfered. + */ + virtual HBufC* ExternalCollectionPathHandlingFileNameLC() = 0; + + /** + * Add a media. This is exactly the same as AddL except + * the songs in the media are added incrementally (in chunks). + * This function is not pure virtual in case some clients did + * not implement this (binary compatibility). + * @since S60 3.2.3 + * @param aMedia media to be added to the + * system. Media type and category + * are mandatory attributes. Depending + * on the operation additional attributes + * may be required. + * @param aObserver observer to callback on completion + * of the request. + * @param aSize number of songs to add in each chunk + */ + virtual void IncAddL( const CMPXMedia& /*aMedia*/, + MMPXCHelperObserver* /*aObserver*/, + const TInt /*aSize*/ ) {}; + }; + +#endif // MMPXCOLLECTIONUIHELPER_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/collection_helper_api/inc/mpxcollectionuihelperobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/collection_helper_api/inc/mpxcollectionuihelperobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2006 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: Collection Ui Helper common observer interface +* +*/ + + +#ifndef MMPXCOLLECTIONUIHELPEROBSERVER_H +#define MMPXCOLLECTIONUIHELPEROBSERVER_H + +#include + +/** +* Different operations handled by the collection helper +*/ +enum TCHelperOperation + { + EAddOp, + EDeleteOp, + ESetOp, + EEmbeddedOpenOp, + EMoveOp, + EExportPlaylistOp, + ERenameOp, + EReorderPlaylistOp, + EDeleteStatusOp + }; + + +/** +* Generic Observer class for the ui helper +* A single callback function, but usable for all collection helper callbacks +*/ +NONSHARABLE_CLASS( MMPXCHelperObserver ) + { +public: + // ADD Operation + /** + * Handles the completion of adding a media event. + * @since S60 3.2.3 + * @param aOperation = EAddOp. + * @param aArgument a media object representing the added media. + * If this is the callback for adding a playlist media, + * the content of this object is the same as what's + * supplied in AddL, except that URI for the playlist + * is added to the object upon successful processing + * of AddL. Client should take over the ownership of + * this object. NULL if an error has occured during + * processing of AddL. + * @param aErr the error code for AddL processing error. + */ + + // SET Operation + /** + * Handles the completion of setting a media event. + * @since S60 3.2.3 + * @param aOperation = ESetOp. + * @param aArgument a media object representing the updated media. + * Client takes over the ownershop of this object. + * @param aErr the error code for SetL processing error. + */ + + // RENAME Operation + /** + * Handles the completion of renaming a media event. + * @since S60 3.2.3 + * @param aOperation = EDeleteOp. + * @param aArgument a media object representing the renamed media. + * @param aErr the error code for RenameL processing error + */ + virtual void HandleOperationCompleteL( TCHelperOperation aOperation, + TInt aErr, + void* aArgument ) = 0; + }; + +/** +* Observer class for the ui helper, embedded open mode +*/ +NONSHARABLE_CLASS( MMPXCHelperEmbeddedOpenObserver ) + { +public: + /** + * Callback to the observer for embedded OpenL() result. + * @since S60 3.2.3 + * @param aErr error for the operation KErrNone if successful. + * @param aCategory category of the file opened + */ + virtual void HandleEmbeddedOpenL( TInt aErr, TMPXGeneralCategory aCategory ) = 0; + }; + + +#endif // MMPXCOLLECTIONUIHELPEROBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/collection_helper_api/tsrc/CollectionHelperTestClass/Bmarm/CollectionHelperTestClassU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/collection_helper_api/tsrc/CollectionHelperTestClass/Bmarm/CollectionHelperTestClassU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/collection_helper_api/tsrc/CollectionHelperTestClass/Bwins/CollectionHelperTestClassU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/collection_helper_api/tsrc/CollectionHelperTestClass/Bwins/CollectionHelperTestClassU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/collection_helper_api/tsrc/CollectionHelperTestClass/EABI/CollectionHelperTestClassU.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/collection_helper_api/tsrc/CollectionHelperTestClass/EABI/CollectionHelperTestClassU.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + _ZTI14CSimpleTimeout @ 2 NONAME ; ## + _ZTV14CSimpleTimeout @ 3 NONAME ; ## + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/collection_helper_api/tsrc/CollectionHelperTestClass/group/CollectionHelperTestClass.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/collection_helper_api/tsrc/CollectionHelperTestClass/group/CollectionHelperTestClass.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2002 - 2007 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: CollectHelper test automation file +* +*/ + + +#if defined(__S60_) +#include +#endif + +TARGET CollectionHelperTestClass.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +/* Remove comments and replace 0x00000000 with correct vendor id */ +// VENDORID 0x00000000 +/* Remove comments and replace 0x00000000 with correct secure id */ +// SECUREID 0x00000000 + +//TARGETPATH ?target_path +DEFFILE CollectionHelperTestClass.def + +MW_LAYER_SYSTEMINCLUDE +SOURCEPATH ../src +SOURCE CollectionHelperTestClass.cpp +SOURCE CollectionHelperTestClassBlocks.cpp +SOURCE TimeoutController.cpp + +//RESOURCE resource_file +//RESOURCE resource_file2 + +USERINCLUDE ../inc + + + + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY efsrv.lib +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib +LIBRARY mpxcollectionhelper.lib +LIBRARY bafl.lib +LIBRARY estor.lib + +LANG SC + + +/* +START WINS +?wins_specific_information +END + +START MARM +?marm_specific_information +END +*/ +// Other possible keywords: + +// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) +/* +START BITMAP ?target +TARGETPATH ?emulated_path_on_target_machine +HEADER +SOURCE ?color_depth ?source_bitmap +END +*/ +// DEFFILE ?filename +// AIF ?filename + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/collection_helper_api/tsrc/CollectionHelperTestClass/group/CollectionHelperTestClass.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/collection_helper_api/tsrc/CollectionHelperTestClass/group/CollectionHelperTestClass.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,62 @@ +; +; 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: Package file for project StifTFW +; +; +; Installation file for STIF +; + +; Languages +&EN + +; Provide value for uid +#{"STIF CollectionHelperTestClass Application"},(0x10005942),1,1,0,TYPE=SA + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Logo +; None + +; Package signature - Optional +; None + +; Start of Package body + +; Condition blocks +; None + +; Options list +; None + +; Install files + +"..\..\init\TestFramework.ini" - "c:\testframework\TestFramework.ini" +"..\..\conf\CollectionHelperTestClass.cfg" - "c:\testframework\CollectionHelperTestClass.cfg" + +"\epoc32\release\armv5\urel\CollectionHelperTestClass.dll" - "c:\Sys\Bin\CollectionHelperTestClass.dll" + +; Embedded SIS +; None + +; End of Package body + +; PKG dependencies +; None + +; PKG capabilities +; None diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/collection_helper_api/tsrc/CollectionHelperTestClass/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/collection_helper_api/tsrc/CollectionHelperTestClass/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2002 - 2007 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 +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these +DEFAULT + +PRJ_TESTEXPORTS +// NOTE: If using ARS requirements all export operations should be done under this. +// 'abld test export' + +PRJ_EXPORTS +// Specify the source file followed by its destination here +// copy will be used to copy the source file to its destination +// If there's no destination then the source file will be copied +// to the same name in /epoc32/include +// Example: +/* +/agnmodel/inc/AGMCOMON.H +*/ + +PRJ_TESTMMPFILES +// NOTE: If using ARS requirements .mmp file operation should be done under this. +// 'abld test build' +CollectionHelperTestClass.mmp + +PRJ_MMPFILES +// Specify the .mmp files required for building the important component +// releasables. +// +// Specify "tidy" if the component you need to build doesn't need to be +// released. Specify "ignore" if the MMP file exists but should be +// ignored. +// Example: +/* +/agnmodel/group/agnmodel.mmp +#if defined(MARM) +/agnmodel/group/agsvexe.mmp +#endif +*/ + +// End of File \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/collection_helper_api/tsrc/CollectionHelperTestClass/inc/CollectionHelperTestClass.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/collection_helper_api/tsrc/CollectionHelperTestClass/inc/CollectionHelperTestClass.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,386 @@ +/* +* Copyright (c) 2002 - 2007 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: CCollectionHelperTestClass heder for STIF Test Framework TestScripter. +* +*/ + + + +#ifndef COLLECTIONHELPERTESTCLASS_H +#define COLLECTIONHELPERTESTCLASS_H + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include "mpxcollectionhelper.h" +#include "mpxcollectionhelperfactory.h" +#include "mpxcollectionhelperobserver.h" +#include "mpxcollectionuihelper.h" +#include "mpxcollectionuihelperobserver.h" + +#include "TimeoutController.h" + + +// CONSTANTS +const TInt KErrBadTestParameter= -1000; // Error on configuration file + +const TInt KErrEventPending =-2000; // Timeout and not callback +const TInt KErrCallbackErrorCode = -2001; // Callback return error code +const TInt KErrUnexpectedValue =-2002; // Unexpected value at setting +const TInt KExpectedFrequencyChange = -2003; // Is not finding more than one station +const TInt KErrTimeoutController = -2007; // Unexpected notification + +const TInt KSmallTimeout = 1000; +const TInt KMediumTimeout = 4000; +const TInt KLargeTimeout = 100000; + + +_LIT( KMsgBadTestParameters, "[Error] No valid test case parameters"); + + +// MACROS +//#define ?macro ?macro_def +// Logging path +#ifdef __WINSCW__ +_LIT( KCollectionHelperTestClassLogPath, "\\logs\\testframework\\CollectionHelperTestClass\\" ); +#else +_LIT( KCollectionHelperTestClassLogPath, "e:\\logs\\testframework\\CollectionHelperTestClass\\" ); +#endif + +// Log file +_LIT( KCollectionHelperTestClassLogFile, "CollectionHelperTestClass.txt" ); + + +_LIT( KTestFile, "c:\\Blackbird.aac"); +_LIT( KTestFileMimeType, "audio/aac" ); +_LIT( KRenameOldUri, "c:\\Blackbird.aac"); +_LIT( KRenameNewUri, "c:\\data\\Blackbird.aac"); + + +// FORWARD DECLARATIONS +class CCollectionHelperTestClass; + + +/** +* CCollectionHelperTestClass test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(CCollectionHelperTestClass) : public CScriptBase, + public MTimeoutObserver, + public MMPXCollectionHelperObserver, + public MMPXCHelperObserver, + public MMPXCHelperEmbeddedOpenObserver, public MMPXCollectionObserver, + public MMPXCollectionRemoveObserver, + public MMPXCollectionFindObserver + + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CCollectionHelperTestClass* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CCollectionHelperTestClass(); + + enum TCollectionHelperExpectedEvent + { + EHandleCollectionMessage, + EHandleOpen, + EHandleAddFileComplete, + EHandleRemove, + EHandleFindAllComplete + }; + + public: // New functions + + /** + * Callback function to signal that adding a file is complete + * @param aErr, error of the operation + */ + virtual void HandleAddFileCompleteL( TInt aErr ); + + /** + * Generic Observer class for the ui helper + * A single callback function, but usable for all collection helper callbacks + */ + virtual void HandleOperationCompleteL( TCHelperOperation aOperation, + TInt aErr, + void* aArgument ); + + /** + * Callback to the observer for embedded OpenL() result + * @param aErr, error for the operation, KErrNone if successful + * @param aCategory, category of the file opened + */ + virtual void HandleEmbeddedOpenL( TInt aErr, TMPXGeneralCategory aCategory ); + + /** + * From MMPXCollectionObserver + * Handle extended media properties + * @param aMedia media + * @param aError error code + */ + void HandleCollectionMediaL( + const CMPXMedia& aMedia, + TInt aError); + + /** + * From MMPXCollectionObserver + * Handle collection message + * @param aMessage collection message + */ + void HandleCollectionMessageL(const CMPXMessage& aMsg); + + /** + * From MMPXCollectionObserver + * Handles the collection entries being opened. Typically called + * when client has Open()'d a folder + * + * @param aEntries collection entries opened + * @param aIndex focused entry + * @param aComplete ETrue no more entries. EFalse more entries + * expected + * @param aError error code + */ + void HandleOpenL(const CMPXMedia& aEntries, + TInt aIndex,TBool aComplete,TInt aError); + + /** + * From MMPXCollectionObserver + * Handles the item being opened. Typically called + * when client has Open()'d an item. Client typically responds by + * 'playing' the item via the playlist + * + * @param aPlaylist collection playlist, owner ship is transfered + * @param aError error code + */ + void HandleOpenL(const CMPXCollectionPlaylist& aPlaylist,TInt aError); + + + void HandleCommandComplete(CMPXCommand* aCommandResult, TInt aError); + + 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 ); + + + // From MTimeoutObserver + + /** + * @since 3.2 + * @param none + * Review if all the expected events have ocurred once the time is over + */ + void HandleTimeout(TInt error); + + private: + + /** + * C++ default constructor. + */ + CCollectionHelperTestClass( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // ?classname( const ?classname& ); + // Prohibit assigment operator if not deriving from CBase. + // ?classname& operator=( const ?classname& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + /** + * Test methods are listed below. + */ + + /** + * Example test method. + * @since S60 3.2 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + + /** + * Set an event as expected and set default timeout + * @since S60 3.2 + */ + void AddExpectedEvent(TCollectionHelperExpectedEvent event, TInt ms); + + + /** + * Unset an event as expected + * @since S60 3.2 + */ + TBool RemoveExpectedEvent(TCollectionHelperExpectedEvent event); + + + /** + * @since S60 3.2 + * @param none + * Removes all expected events + */ + void RemoveAllExpectedEvents(); + + /** + * Verify that the event was expected, removes it from the list + * Signal the TestScripter with the returned error code + * @since S60 3.2 + */ + void ProcessEvent(TCollectionHelperExpectedEvent aEvent, TInt aError); + + /** + * Maps a event with a descriptor with its name + * @since S60 3.2 + */ + TPtrC EventName( TInt aKey ); + + /* + * Test methods are listed below. + */ + + /** + * Sets a timeout different since the default + * @since S60 3.2 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt SetTimeout( CStifItemParser& aItem ); + + /** + * + * @since S60 3.2 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt SetExpectedEvents( CStifItemParser& aItem ); + + /** + * + * @since S60 3.2 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt SetAllowedPanic( CStifItemParser& aItem ); + + void CreateTestMediaL( CMPXMedia*& aNewProperty ); + + /** + * Connect to the default client to the server + * @since S60 3.2 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + + virtual TInt ExampleL( CStifItemParser& aItem ); + virtual TInt OpenCollectionUtilityL(CStifItemParser& aItem); + virtual TInt NewUiHelperL(CStifItemParser& aItem); + virtual TInt NewHelperL(CStifItemParser& aItem); + virtual TInt NewCachedHelperL(CStifItemParser& aItem); + virtual TInt CloseUiHelperL(CStifItemParser& aItem); + virtual TInt CloseHelperL(CStifItemParser& aItem); + virtual TInt CloseCachedHelperL(CStifItemParser& aItem); + + + /** + * From MMPXCollectionRemoveObserver + * Handles removing a collection path + * calls back with the list of file paths that were deleted + * This callback is only applicable for local file storage plugins. + * + * @param aUriArray, list of files that were deleted + */ + void HandleRemoveL(MDesCArray& aUriArray, TInt aError); + + //*********************************************************************** + + /** + * From MMPXCollectionFindObserver + * Handle callback for "find" operation + * @param aEntries, CMPXMedia to be returned + * @param aComplete ETrue no more entries. EFalse more entries + * expected + * @param aError error code + */ + void HandleFindAllL(const CMPXMedia& aResults, TBool aComplete,TInt aError); + + public: // Data + + protected: // Data + + private: // Data + + // reference to TestModuleIf + CTestModuleIf& iTestModuleIf; + + MMPXCollectionUtility* iCollectionUtility; + + //NewUiHelperL() + MMPXCollectionUiHelper* iUIHelper; + + //NewHelperL() + MMPXCollectionHelper* iHelper; + + //NewCachedHelperL() + MMPXCollectionHelper* iCachedHelper; + + // Active object with a timer to timeout the test case + CSimpleTimeout * iTimeoutController; + + // Indicates if the test case use a normal exit reason + TBool iNormalExitReason; + + // List of expected events + RArray iExpectedEvents; + + // List of notification event (by the callback) + RArray iOcurredEvents; + + public: // Friend classes + //?friend_class_declaration; + protected: // Friend classes + //?friend_class_declaration; + private: // Friend classes + //?friend_class_declaration; + + }; + +#endif // COLLECTIONHELPERTESTCLASS_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/collection_helper_api/tsrc/CollectionHelperTestClass/inc/TimeoutController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/collection_helper_api/tsrc/CollectionHelperTestClass/inc/TimeoutController.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2006 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: Simple player for preemption purposes +* +*/ + + +#include +#include +#include +#include + + +/* This class is used to notify the observer +* about the timeout +*/ +class MTimeoutObserver +{ + public: // New functions + + /** + * Timeout + */ + virtual void HandleTimeout(TInt error) = 0; +}; + + +_LIT(KFormatTimeStamp, "%:0%J%:1%T%:2%S%.%*C4%:3%+B"); + + +/* This class is used for extra time controlling +* The STIF timeout isn't enough +*/ +class CSimpleTimeout : public CActive +{ + public: // Enumerations + // None + + private: // Enumerations + // None + + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CSimpleTimeout* NewL( MTimeoutObserver* aObserver, CStifLogger* aLogger); + + /** + * Destructor. + */ + ~CSimpleTimeout(); + + public: // New functions + + /** + * Starts timeout counting + */ + void Start(TTimeIntervalMicroSeconds aTimeout); + + /** + * Cancel timeout counting + */ + void Stop(); + + + public: // Functions from base classes + + /** + * RunL derived from CActive handles the completed requests. + */ + void RunL(); + + /** + * DoCancel derived from CActive handles the cancel + */ + void DoCancel(); + + /** + * RunError derived from CActive handles errors from active handler. + */ + TInt RunError( TInt aError ); + + protected: // New functions + // None + + protected: // Functions from base classes + // None + + private: + + /** + * By default Symbian OS constructor is private. + */ + void ConstructL(MTimeoutObserver* aObserver, CStifLogger* aLogger); + + /** + * C++ constructor. + */ + CSimpleTimeout(); + + public: // Data + // None + + protected: // Data + // None + + private: // Data + MTimeoutObserver* iObserver; + RTimer iTimer; + + // Storage for testcase timeout. + TTime iTestCaseTimeout; + CStifLogger* iLog; + + public: // Friend classes + // None + + protected: // Friend classes + // None + + private: // Friend classes + // None + +}; diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/collection_helper_api/tsrc/CollectionHelperTestClass/inc/debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/collection_helper_api/tsrc/CollectionHelperTestClass/inc/debug.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2005 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: Central place for nice debug-type macros & functions +* +*/ + + +#ifndef DEBUG_H +#define DEBUG_H + +//INCLUDES +#include +#define FTRACE(a) {a;} + +/** +* Declare the FPrint function +* @since Series 60 2.7 +* @return none +*/ +inline void FPrint(const TRefByValue aFmt, ...) +{ + VA_LIST list; + VA_START(list,aFmt); + TInt tmpInt = VA_ARG(list, TInt); + TInt tmpInt2 = VA_ARG(list, TInt); + TInt tmpInt3 = VA_ARG(list, TInt); + VA_END(list); + #ifdef _DEBUG + RDebug::Print(aFmt, tmpInt, tmpInt2, tmpInt3); + #endif +} +#endif // DEBUG_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/collection_helper_api/tsrc/CollectionHelperTestClass/src/CollectionHelperTestClass.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/collection_helper_api/tsrc/CollectionHelperTestClass/src/CollectionHelperTestClass.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,169 @@ +/* +* Copyright (c) 2002 - 2007 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: CCollectionHelperTestClass implementation for STIF Test Framework TestScripter. +* +*/ + + + +// INCLUDE FILES +#include +#include "CollectionHelperTestClass.h" + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; + +// EXTERNAL FUNCTION PROTOTYPES +//extern ?external_function( ?arg_type,?arg_type ); + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// LOCAL CONSTANTS AND MACROS +//const ?type ?constant_var = ?constant; +//#define ?macro_name ?macro_def + +// MODULE DATA STRUCTURES +//enum ?declaration +//typedef ?declaration + +// LOCAL FUNCTION PROTOTYPES +//?type ?function_name( ?arg_type, ?arg_type ); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ?function_name ?description. +// ?description +// Returns: ?value_1: ?description +// ?value_n: ?description_line1 +// ?description_line2 +// ----------------------------------------------------------------------------- +// +/* +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg) // ?description + { + + ?code // ?comment + + // ?comment + ?code + } +*/ + +// ============================ MEMBER FUNCTIONS =============================== + + +// ----------------------------------------------------------------------------- +// CCollectionHelperTestClass::CCollectionHelperTestClass +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CCollectionHelperTestClass::CCollectionHelperTestClass( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ), + iTestModuleIf(aTestModuleIf) + { + } + +CCollectionHelperTestClass::~CCollectionHelperTestClass() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + delete iTimeoutController; + + iCollectionUtility->Close(); + iCollectionUtility = NULL; + } + +// ----------------------------------------------------------------------------- +// CCollectionHelperTestClass::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CCollectionHelperTestClass* CCollectionHelperTestClass::NewL( + CTestModuleIf& aTestModuleIf ) + { + CCollectionHelperTestClass* self = new (ELeave) CCollectionHelperTestClass( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// ----------------------------------------------------------------------------- +// CCollectionHelperTestClass::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CCollectionHelperTestClass::ConstructL() + { + iLog = CStifLogger::NewL( KCollectionHelperTestClassLogPath, + KCollectionHelperTestClassLogFile, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + iTimeoutController = CSimpleTimeout::NewL (this, iLog); + + iCollectionUtility = MMPXCollectionUtility::NewL(this, KMcModeDefault); + } + + +// ========================== 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* ) CCollectionHelperTestClass::NewL( aTestModuleIf ); + + } + +// ----------------------------------------------------------------------------- +// E32Dll is a DLL entry point function. +// Returns: KErrNone +// ----------------------------------------------------------------------------- +// +#ifndef EKA2 // Hide Dll entry point to EKA2 +GLDEF_C TInt E32Dll( + TDllReason /*aReason*/) // Reason code + { + return(KErrNone); + + } +#endif // EKA2 + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/collection_helper_api/tsrc/CollectionHelperTestClass/src/CollectionHelperTestClassBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/collection_helper_api/tsrc/CollectionHelperTestClass/src/CollectionHelperTestClassBlocks.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,706 @@ +/* +* Copyright (c) 2002 - 2007 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: CCollectionHelperTestClass block implementaion for STIF Test Framework TestScripter. +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include "CollectionHelperTestClass.h" +#include // KMPXMessageGeneralEvent, KMPXMessageGeneralType +#include +#include +#include +#include +#include +#include +#include +#include "debug.h" + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; + +// EXTERNAL FUNCTION PROTOTYPES +//extern ?external_function( ?arg_type,?arg_type ); + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// LOCAL CONSTANTS AND MACROS +//const ?type ?constant_var = ?constant; +//#define ?macro_name ?macro_def + +// MODULE DATA STRUCTURES +//enum ?declaration +//typedef ?declaration + +// LOCAL FUNCTION PROTOTYPES +//?type ?function_name( ?arg_type, ?arg_type ); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ?function_name ?description. +// ?description +// Returns: ?value_1: ?description +// ?value_n: ?description_line1 +// ?description_line2 +// ----------------------------------------------------------------------------- +// +/* +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg) // ?description + { + + ?code // ?comment + + // ?comment + ?code + } +*/ + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CCollectionHelperTestClass::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CCollectionHelperTestClass::Delete() + { + FTRACE(FPrint(_L("CTunerUtilityTestClass::Delete"))); + + iExpectedEvents.Close(); + iOcurredEvents.Close(); + + iLog->Log(_L("Deleting test class...")); + iLog->Log(_L("")); + iLog->Log(_L("")); + + if(iUIHelper) + { + //delete iUIHelper; + iUIHelper = NULL; + } + if(iHelper) + { + //delete iHelper; + iHelper = NULL; + } + if(iCachedHelper) + { + //delete iCachedHelper; + iCachedHelper = NULL; + } + } + +// ----------------------------------------------------------------------------- +// CCollectionHelperTestClass::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CCollectionHelperTestClass::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( "OpenCollectionUtility", CCollectionHelperTestClass::OpenCollectionUtilityL ), + ENTRY( "NewUiHelper", CCollectionHelperTestClass::NewUiHelperL ), + ENTRY( "NewHelper", CCollectionHelperTestClass::NewHelperL ), + ENTRY( "NewCachedHelper", CCollectionHelperTestClass::NewCachedHelperL ), + ENTRY( "CloseUiHelper", CCollectionHelperTestClass::CloseUiHelperL ), + ENTRY( "CloseHelper", CCollectionHelperTestClass::CloseHelperL ), + ENTRY( "CloseCachedHelper", CCollectionHelperTestClass::CloseCachedHelperL ), + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + } + + +// ----------------------------------------------------------------------------- +// CCollectionHelperTestClass::EventName +// Return descriptor with the notification description +// ----------------------------------------------------------------------------- +TPtrC CCollectionHelperTestClass::EventName( TInt aKey ) +{ + static TText* const badKeyword = (TText*)L"BadKeyword"; + static TText* const keywords[] = + { + (TText*)L"EHandleCollectionMessage", + (TText*)L"EHandleOpen", + (TText*)L"EHandleAddFileComplete", + (TText*)L"EHandleRemove", + (TText*)L"EHandleFindAllComplete" + }; + + if( (TUint)aKey >= (sizeof( keywords )/sizeof(TText*)) ) + { + iLog->Log(_L("Keyword out of bounds")); + TPtrC keyword( badKeyword ); + return keyword; + } + else + { + TPtrC keyword( keywords[aKey] ); + return keyword; + } +} + +// ----------------------------------------------------------------------------- +// CCollectionHelperTestClass::AddExpectedEvent +// Add an event to the expected events' list +// ----------------------------------------------------------------------------- +void CCollectionHelperTestClass::AddExpectedEvent(TCollectionHelperExpectedEvent event, TInt ms) +{ + FTRACE(FPrint(_L("CCollectionHelperTestClass::AddExpectedEvent"))); + iExpectedEvents.Append(event); + TPtrC eventName = EventName(event); + iLog->Log(_L("Adding expected event:(0x%02x)%S Total=%d"), event, &eventName, iExpectedEvents.Count() ); + + if ( iTimeoutController && !iTimeoutController->IsActive() ) + { + if (ms > 0) + { + iTimeoutController->Start( TTimeIntervalMicroSeconds(ms * 1000) ); + } + else + { + iLog->Log(_L("Timeout with default value (1s)")); + iTimeoutController->Start( TTimeIntervalMicroSeconds(1000000) ); + } + } +} + +// ----------------------------------------------------------------------------- +// CCollectionHelperTestClass::RemoveExpectedEvent +// Remove the indicated event from the expected events' list +// Returns: ETrue: Event found. +// EFalse: Event not found. +// ----------------------------------------------------------------------------- +TBool CCollectionHelperTestClass::RemoveExpectedEvent(TCollectionHelperExpectedEvent aEvent) +{ + FTRACE(FPrint(_L("CCollectionHelperTestClass::RemoveExpectedEvent"))); + TBool match = EFalse; + for (TUint i=0; i < iExpectedEvents.Count() ; i++) + { + if (iExpectedEvents[i] == aEvent) + { + iExpectedEvents.Remove(i); + match = ETrue; + break; + } + } + + return match; +} + + +// ----------------------------------------------------------------------------- +// CCollectionHelperTestClass::RemoveAllExpectedEvents +// Remove the indicated event from the expected events' list +// ----------------------------------------------------------------------------- +void CCollectionHelperTestClass::RemoveAllExpectedEvents() +{ + FTRACE(FPrint(_L("CCollectionHelperTestClass::RemoveAllExpectedEvents"))); + iLog->Log(_L("Removing all expected events")); + + iExpectedEvents.Reset(); + iOcurredEvents.Reset(); +} + + +// ----------------------------------------------------------------------------- +// CCollectionHelperTestClass::ProcessEvent +// Process events. +// ----------------------------------------------------------------------------- +void CCollectionHelperTestClass::ProcessEvent(TCollectionHelperExpectedEvent aEvent, TInt aError) +{ + FTRACE(FPrint(_L("CCollectionHelperTestClass::ProcessExpectedEvent"))); + TPtrC nameEvent = EventName(aEvent); + + // Check for error + if (aError == KErrNone) + { + // Remove the event + if (RemoveExpectedEvent(aEvent)) + { + iLog->Log(_L("Expected Event: (0x%02x)%S has ocurred Total=%d"), aEvent, &nameEvent,iExpectedEvents.Count()); + } + else + { + iLog->Log(_L("Event: (0x%02x)%S has ocurred"), aEvent, &nameEvent); + return; + } + + // All expected events have ocurred + if (iExpectedEvents.Count() == 0 ) + { + Signal(); + iTimeoutController->Cancel(); + } + } + else + { + iLog->Log(_L("[Error] Event: (0x%02x)%S return with error code=%d"), aEvent, &nameEvent, aError); + if (iExpectedEvents.Count() != 0 ) + { + RemoveExpectedEvent(aEvent); + } + iTimeoutController->Cancel(); + Signal(KErrCallbackErrorCode); + } +} + +// ----------------------------------------------------------------------------- +// CCollectionHelperTestClass::HandleTimeout +// Review if all the expected events have ocurred once the time is over +// ----------------------------------------------------------------------------- +void CCollectionHelperTestClass::HandleTimeout(TInt aError) +{ + FTRACE(FPrint(_L("CCollectionHelperTestClass::HandleTimeout"))); + // All expected events have ocurred + if (aError != KErrNone) + { + if (iExpectedEvents.Count() == 0 ) + { + iLog->Log(_L("Timing out but events have ocurred")); + Signal(); + } + else + { + RemoveAllExpectedEvents(); + iLog->Log(_L("Timing out and events still pending")); + Signal(KErrEventPending); + } + } + else + { + iLog->Log(_L("Timing out return a error %d"), aError); + Signal(aError); + } +} + +// ----------------------------------------------------------------------------- +// CCollectionHelperTestClass::SetTimeout +// Create a timer and set a timeout +// When the timeout is reached the test case is marked as failed +// It's used rather than the "timeout" keyword in the configuration file +// because in this way the log continues +// ----------------------------------------------------------------------------- +TInt CCollectionHelperTestClass::SetTimeout( CStifItemParser& aItem ) +{ + FTRACE(FPrint(_L("CCollectionHelperTestClass::SetTimeout"))); + TInt timeout=0; + TInt error = aItem.GetNextInt(timeout) ; + if ( iTimeoutController ) + { + if ( timeout > 0 ) + { + iTimeoutController->Start( TTimeIntervalMicroSeconds(timeout*1000) ); + } + else + { + iTimeoutController->Start( TTimeIntervalMicroSeconds(1000000) ); + } + } + else + { + iLog->Log(_L("Timeout Controller doesn't exist")); + error = KErrTimeoutController; + } + return error; +} + + +// ----------------------------------------------------------------------------- +// Uses the TestModuleBase API to allow a panic as exit reason for a test case +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCollectionHelperTestClass::SetAllowedPanic( CStifItemParser& aItem ) +{ + FTRACE(FPrint(_L("CCollectionHelperTestClass::SetAllowedPanic"))); + TInt error = KErrNone; + TInt panicCode; + TPtrC panicType; + if ( ( KErrNone == aItem.GetNextString(panicType) ) && + ( KErrNone == aItem.GetNextInt(panicCode) ) ) + { + iLog->Log(_L("Allowing panic: %S %d"), &panicType, panicCode); + iTestModuleIf.SetExitReason( CTestModuleIf::EPanic, panicCode ); + iNormalExitReason = EFalse; + } + else + { + iLog->Log(KMsgBadTestParameters); + error = KErrBadTestParameter; + } + return error; +} + +// ----------------------------------------------------------------------------- +// CCollectionHelperTestClass::SetExpectedEvents() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCollectionHelperTestClass::SetExpectedEvents( CStifItemParser& aItem ) +{ + FTRACE(FPrint(_L("CCollectionHelperTestClass::SetExpectedEvents"))); + TInt error = KErrNone; + TInt event=0; + while ( KErrNone == aItem.GetNextInt(event)) + { + AddExpectedEvent(static_cast(event), 0); // Default timeout value + } + return error; +} +// ----------------------------------------------------------------------------- +// CCollectionHelperTestClass::CreateTestMediaL() +// Returns: no return value. +// ----------------------------------------------------------------------------- +void CCollectionHelperTestClass::CreateTestMediaL( CMPXMedia*& aNewProperty ) + { + RArray contentIDs; + contentIDs.AppendL( KMPXMediaIdGeneral ); + contentIDs.AppendL( KMPXMediaIdAudio ); + contentIDs.AppendL( KMPXMediaIdMusic ); + contentIDs.AppendL( KMPXMediaIdDrm ); + + aNewProperty = NULL; + CMPXMedia* media = CMPXMedia::NewL( contentIDs.Array() ); + CleanupStack::PushL( media ); + contentIDs.Close(); + + // CMPXMedia default types + media->SetTObjectValueL( KMPXMediaGeneralType, + EMPXItem ); + media->SetTObjectValueL( KMPXMediaGeneralCategory, + EMPXSong ); + media->SetTextValueL( KMPXMediaGeneralUri, KTestFile() ); + + // Title, default is file name + media->SetTextValueL( KMPXMediaGeneralTitle, KTestFile() ); + + // Default album track + media->SetTextValueL( KMPXMediaMusicAlbumTrack, KNullDesC ); + + // Set the Mime Type and collection UID + media->SetTextValueL( KMPXMediaGeneralMimeType, KTestFileMimeType() ); + //media->SetTObjectValueL( KMPXMediaGeneralCollectionId, ); + + // Set the pointers now that the object is ready + CleanupStack::Pop( media ); + aNewProperty = media; + } + +// ----------------------------------------------------------------------------- +// CCollectionHelperTestClass::ExampleL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CCollectionHelperTestClass::ExampleL( CStifItemParser& aItem ) + { + // Print to UI + _LIT( KCollectionHelperTestClass, "CollectionHelperTestClass" ); + _LIT( KExample, "In Example" ); + TestModuleIf().Printf( 0, KCollectionHelperTestClass, KExample ); + // Print to log file + iLog->Log( KExample ); + + TInt i = 0; + TPtrC string; + _LIT( KParam, "Param[%i]: %S" ); + while ( aItem.GetNextString ( string ) == KErrNone ) + { + TestModuleIf().Printf( i, KCollectionHelperTestClass, + KParam, i, &string ); + i++; + } + + return KErrNone; + } +// ----------------------------------------------------------------------------- +// CCollectionHelperTestClass::OpenCollectionUtilityL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- + +TInt CCollectionHelperTestClass::OpenCollectionUtilityL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCollectionHelperTest::OpenCollectionUtilityL"))); + iLog->Log(_L("CCollectionHelperTestClass::OpenCollectionUtilityL")); + + TRAPD( result, iCollectionUtility->Collection().OpenL() ); + + if( KErrNone == result ) + { + AddExpectedEvent( EHandleCollectionMessage, KMediumTimeout ); + AddExpectedEvent( EHandleOpen, KMediumTimeout ); + } + + return result; + } + +// ----------------------------------------------------------------------------- +// CCollectionHelperTestClass::NewUiHelperL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- + +TInt CCollectionHelperTestClass::NewUiHelperL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCollectionHelperTest::NewUiHelperL"))); + iLog->Log(_L("CCollectionHelperTestClass::NewUiHelperL")); + + TRAPD( result, iUIHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL() ); + + return result; + } + +// ----------------------------------------------------------------------------- +// CCollectionHelperTestClass::NewHelperL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- + +TInt CCollectionHelperTestClass::NewHelperL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCollectionHelperTest::NewHelperL"))); + iLog->Log(_L("CCollectionHelperTestClass::NewHelperL")); + + TRAPD( result, iHelper = CMPXCollectionHelperFactory::NewCollectionHelperL() ); + + return result; + } +// ----------------------------------------------------------------------------- +// CCollectionHelperTestClass::NewCachedHelperL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- + +TInt CCollectionHelperTestClass::NewCachedHelperL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCollectionHelperTest::NewCachedHelperL"))); + iLog->Log(_L("CCollectionHelperTestClass::NewCachedHelperL")); + + TRAPD( result, iCachedHelper = CMPXCollectionHelperFactory::NewCollectionCachedHelperL() ); + + return result; + } +// ----------------------------------------------------------------------------- +// CCollectionHelperTestClass::CloseUiHelperL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- + +TInt CCollectionHelperTestClass::CloseUiHelperL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCollectionHelperTest::CloseUiHelperL"))); + iLog->Log(_L("CCollectionHelperTestClass::CloseUiHelperL")); + + TRAPD( result, iUIHelper->Close() ); + + return result; + } +// ----------------------------------------------------------------------------- +// CCollectionHelperTestClass::CloseHelperL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- + +TInt CCollectionHelperTestClass::CloseHelperL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCollectionHelperTest::CloseHelperL"))); + iLog->Log(_L("CCollectionHelperTestClass::CloseHelperL")); + + TRAPD( result, iHelper->Close() ); + + return result; + } +// ----------------------------------------------------------------------------- +// CCollectionHelperTestClass::CloseCachedHelperL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- + +TInt CCollectionHelperTestClass::CloseCachedHelperL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCollectionHelperTest::CloseCachedHelperL"))); + iLog->Log(_L("CCollectionHelperTestClass::CloseCachedHelperL")); + + TRAPD( result, iCachedHelper->Close() ); + + return result; + } + +// --------------------------------------------------------------------------- +// Handle collection message +// --------------------------------------------------------------------------- +// +void CCollectionHelperTestClass::HandleCollectionMessageL(const CMPXMessage& aMsg) + { + FTRACE(FPrint(_L("CCollectionHelperTestClass::HandleCollectionMessageL"))); + iLog->Log(_L("CCollectionHelperTestClass::HandleCollectionMessageL")); + + if( aMsg.IsSupported(KMPXMessageGeneralEvent) && + aMsg.IsSupported(KMPXMessageGeneralType) ) + { + TMPXCollectionMessage::TEvent event = + *aMsg.Value( KMPXMessageGeneralEvent ); + TInt type = *aMsg.Value( KMPXMessageGeneralType ); + TInt data = *aMsg.Value( KMPXMessageGeneralData ); + + TMPXCollectionMessage message(event, type, data); + if(message.Event() == TMPXCollectionMessage::EPathChanged && + message.Type() == EMcPathChangedByOpen) + { + iCollectionUtility->Collection().OpenL(); + + this->ProcessEvent(EHandleCollectionMessage, KErrNone); + } + } + } + +// --------------------------------------------------------------------------- +// Handles the collection entries being opened. Typically called +// when client has Open()'d a folder +// --------------------------------------------------------------------------- +// +void CCollectionHelperTestClass::HandleOpenL(const CMPXMedia& /*aEntries*/, + TInt /*aIndex*/,TBool /*aComplete*/,TInt aError) + { + FTRACE(FPrint(_L("CCollectionHelperTest::HandleOpenL"))); + iLog->Log(_L("CCollectionHelperTestClass::HandleOpenL")); + + this->ProcessEvent(EHandleOpen, aError); + } + +// --------------------------------------------------------------------------- +// Handles the item being opened. Typically called +// when client has Open()'d an item. Client typically responds by +// 'playing' the item via the playlist +// --------------------------------------------------------------------------- +void CCollectionHelperTestClass::HandleOpenL(const CMPXCollectionPlaylist& /*aPlaylist*/,TInt /*aError*/) + { + FTRACE(FPrint(_L("CCollectionHelperTest::HandleOpenL"))); + iLog->Log(_L("CCollectionHelperTestClass::HandleOpenL")); + } + +// --------------------------------------------------------------------------- +// Handle completion of a asynchronous command +// --------------------------------------------------------------------------- +void CCollectionHelperTestClass::HandleCommandComplete(CMPXCommand* /*aCommandResult*/, TInt /*aError*/) + { + FTRACE(FPrint(_L("CCollectionHelperTest::HandleCommandComplete"))); + iLog->Log(_L("CCollectionHelperTestClass::HandleCommandComplete")); + + Signal(); + iTimeoutController->Cancel(); + } + +// --------------------------------------------------------------------------- +// Handle extended media properties +// --------------------------------------------------------------------------- +// +void CCollectionHelperTestClass::HandleCollectionMediaL(const CMPXMedia& /*aMedia*/, + TInt /*aError*/) + { + FTRACE(FPrint(_L("CCollectionHelperTest::HandleCollectionMediaL"))); + iLog->Log(_L("CCollectionHelperTestClass::HandleCollectionMediaL")); + + Signal(); + iTimeoutController->Cancel(); + } + +// --------------------------------------------------------------------------- +// Handles removing a collection path +// --------------------------------------------------------------------------- +// +void CCollectionHelperTestClass::HandleRemoveL(MDesCArray& /*aUriArray*/, TInt aError) + { + FTRACE(FPrint(_L("CCollectionHelperTest::HandleRemoveL"))); + iLog->Log(_L("CCollectionHelperTestClass::HandleRemoveL")); + + this->ProcessEvent(EHandleRemove, aError); + } + +// --------------------------------------------------------------------------- +// Handle callback for "find" operation +// --------------------------------------------------------------------------- +// +void CCollectionHelperTestClass::HandleFindAllL(const CMPXMedia& /*aResults*/, TBool aComplete, + TInt aError) + { + FTRACE(FPrint(_L("CCollectionHelperTest::HandleFindAllL"))); + iLog->Log(_L("CCollectionHelperTestClass::HandleFindAllL")); + + if(aComplete) + { + this->ProcessEvent(EHandleFindAllComplete, aError); + } + else + { + this->ProcessEvent(EHandleFindAllComplete, KErrGeneral ); + } + } + +// --------------------------------------------------------------------------- +// Handle callback for "AddFileComplete" operation +// --------------------------------------------------------------------------- +// +void CCollectionHelperTestClass::HandleAddFileCompleteL( TInt aErr ) + { + FTRACE(FPrint(_L("CCollectionHelperTest::HandleAddFileCompleteL"))); + iLog->Log(_L("CCollectionHelperTestClass::HandleAddFileCompleteL")); + + this->ProcessEvent(EHandleAddFileComplete, aErr); + } +// --------------------------------------------------------------------------- +// Handle callback for "OperationComplete" operation +// --------------------------------------------------------------------------- +// +void CCollectionHelperTestClass::HandleOperationCompleteL( + TCHelperOperation /*aOperation*/, TInt /*aErr*/, void* /*aArgument*/ ) + { + FTRACE(FPrint(_L("CCollectionHelperTest::HandleOperationCompleteL"))); + iLog->Log(_L("CCollectionHelperTestClass::HandleOperationCompleteL")); + + Signal(); + iTimeoutController->Cancel(); + } +// --------------------------------------------------------------------------- +// Handle callback for "EmbeddedOpen" operation +// --------------------------------------------------------------------------- +// +void CCollectionHelperTestClass::HandleEmbeddedOpenL( + TInt /*aErr*/, TMPXGeneralCategory /*aCategory*/ ) + { + FTRACE(FPrint(_L("CCollectionHelperTest::HandleEmbeddedOpenL"))); + iLog->Log(_L("CCollectionHelperTestClass::HandleEmbeddedOpenL")); + + Signal(); + iTimeoutController->Cancel(); + } +//add new function + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/collection_helper_api/tsrc/CollectionHelperTestClass/src/TimeoutController.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/collection_helper_api/tsrc/CollectionHelperTestClass/src/TimeoutController.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,204 @@ +/* +* Copyright (c) 2007 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: Timeout controller +* +*/ + + +#include "TimeoutController.h" +#include "debug.h" + +/* +------------------------------------------------------------------------------- +Class: CSimpleTimeout +Method: CSimpleTimeout +Description: Default constructor +C++ default constructor can NOT contain any code, that might leave. +Parameters: None +Return Values: None +Errors/Exceptions: None +Status: Approved +------------------------------------------------------------------------------- +*/ +CSimpleTimeout::CSimpleTimeout() : CActive (CActive::EPriorityStandard) +{ + FTRACE(FPrint(_L("CSimpleTimeout::CSimpleTimeout"))); +} + +// ----------------------------------------------------------------------------- +// CSimpleTimeout::ConstructL() +// Symbian OS second phase constructor. +// ----------------------------------------------------------------------------- +// +void CSimpleTimeout::ConstructL( MTimeoutObserver* aObserver, +CStifLogger* aLogger) +{ + FTRACE(FPrint(_L("CSimpleTimeout::ConstructL"))); + iObserver = aObserver; + iLog = aLogger; + iTimer.CreateLocal(); + iTestCaseTimeout = 0; // Initialize + + // Add to active scheduler + CActiveScheduler::Add ( this ); +} + +// ----------------------------------------------------------------------------- +// CSimpleTimeout::NewL() +// Two-phased constructor. +// Returns: CSimpleTimeout* : pointer to created object +// ----------------------------------------------------------------------------- +// +CSimpleTimeout* CSimpleTimeout::NewL( MTimeoutObserver* aTestClass, +CStifLogger* aLogger) +{ + FTRACE(FPrint(_L("CSimpleTimeout::NewL"))); + CSimpleTimeout* self = new ( ELeave ) CSimpleTimeout(); + CleanupStack::PushL( self ); + self->ConstructL( aTestClass, aLogger); + CleanupStack::Pop( self ); + return self; + +} + +// ----------------------------------------------------------------------------- +// CSimpleTimeout::~CSimpleTimeout() +// Destructor. +// ----------------------------------------------------------------------------- +// +CSimpleTimeout::~CSimpleTimeout() +{ + FTRACE(FPrint(_L("CSimpleTimeout::~CSimpleTimeout"))); + Cancel(); + iTimer.Close(); +} + +// ----------------------------------------------------------------------------- +// CSimpleTimeout::Start() +// Start timeout counting. +// ----------------------------------------------------------------------------- +// +void CSimpleTimeout::Start(TTimeIntervalMicroSeconds aTimeout) +{ + FTRACE(FPrint(_L("CSimpleTimeout::Start"))); + if (IsActive()) + { + Cancel(); + } + + // Request timer + TTime endTime; + endTime.HomeTime(); + endTime = endTime + aTimeout; + + TInt64 miliseconds = aTimeout.Int64(); + miliseconds /= 1000; + + TBuf<30> dateString; + endTime.FormatL(dateString, KFormatTimeStamp); + iLog->Log(_L("Timer=%LD ms, EndTime=%S"), miliseconds, &dateString); + + // Store absolute timeout + iTestCaseTimeout = endTime; + + // Taken from STIF engine + // Note: iTimer.After() method cannot use because there needed + // TTimeIntervalMicroSeconds32 and it is 32 bit. So then cannot create + // timeout time that is long enough. At() uses 64 bit value=>Long enough. + iTimer.At( iStatus, endTime ); + SetActive(); +} + +// ----------------------------------------------------------------------------- +// CSimpleTimeout::Stop() +// Start timeout counting. +// ----------------------------------------------------------------------------- +// +void CSimpleTimeout::Stop() +{ + FTRACE(FPrint(_L("CSimpleTimeout::Stop"))); + if (IsActive()) + { + Cancel(); + } +} + +// ----------------------------------------------------------------------------- +// CSimpleTimeout::RunL() +// RunL handles completed timeouts. +// ----------------------------------------------------------------------------- +// +void CSimpleTimeout::RunL() +{ + FTRACE(FPrint(_L("CSimpleTimeout::RunL"))); + iLog->Log(_L("CSimpleTimeout::RunL")); + TTime timeout; + timeout.HomeTime(); + // Handle the abort case when system time gets changed, but timeout is + // still valid. All other cases should timeout since they invalidate the + // logic of the timers. + if ( iStatus == KErrAbort) + { + if ( iTestCaseTimeout > timeout ) + { + RDebug::Print( _L( "Absolute timer still valid. Restaring timer. iStatus: %d" ), iStatus.Int() ); + // Start new timer + iStatus = KErrNone; // reset value + iTimer.At ( iStatus, iTestCaseTimeout ); // restart timer + SetActive(); + } + else + { + // Absolute timer no longer valid. Must timeout. + iLog->Log(_L("Absolute timeout no longer valid")); + iObserver->HandleTimeout(KErrNone); + } + + } + else + { + // Status was not KErrAbort. Timing out! + // iLog->Log(_L("CSimpleTimeout::RunL - Timeout !!"), iTimeout); + iLog->Log(_L("Timing out")); + iObserver->HandleTimeout(KErrNone); + } + +} + +// ----------------------------------------------------------------------------- +// CSimpleTimeout::DoCancel() +// Cancel active request. +// ----------------------------------------------------------------------------- +// +void CSimpleTimeout::DoCancel() +{ + FTRACE(FPrint(_L("CSimpleTimeout::DoCancel"))); + iTimer.Cancel(); +} + +// ----------------------------------------------------------------------------- +// CSimpleTimeout::RunError() +// Handle errors. Just let framework handle errors because +// RunL does not leave. +// Returns: Symbian OS error code +// ----------------------------------------------------------------------------- +// +TInt CSimpleTimeout::RunError( TInt aError ) +{ + FTRACE(FPrint(_L("CSimpleTimeout::RunError"))); + iLog->Log(_L("Timeout error %d"), aError); + iObserver->HandleTimeout(aError); + return aError; +} + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/collection_helper_api/tsrc/conf/CollectionHelperTestClass.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/collection_helper_api/tsrc/conf/CollectionHelperTestClass.cfg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,69 @@ +// _Unsupported_ Those API could be not implemented and return KErrNotSupported + + +[Define] +KErrNotFound -1 +KErrNotSupported -5 +KErrArgument -6 +KErrNotReady -18 +KErrAccessDenied -21 + +KErrEventPending -2000 +KErrCallbackErrorCode -2001 +KErrUnexpectedValue -2002 +KErrNotificationPending -2005 +KErrUnexpectedNotification -2006 +KErrTimeoutController -2007 + +EMdaPriorityMin ?00 +EMdaPriorityLow -50 +EMdaPriorityNormal 0 +EMdaPriorityHigh 50 +EMdaPriorityMax 100 + +KMMFBalanceMax 100 +KMMFBalanceCenter 50 +KMMFBalanceMin 0 +[Enddefine] + + +// ================================================== +// Collection Helper Test Class +// ================================================== + + +[Test] +title 1. Create UI Helper +create CollectionHelperTestClass test +test OpenCollectionUtility +waittestclass test +test NewUiHelper +test CloseUiHelper +delete test +pause 1000 +[Endtest] + +[Test] +title 2. Create Helper +create CollectionHelperTestClass test +test OpenCollectionUtility +waittestclass test +test NewHelper +test CloseHelper +delete test +pause 1000 +[Endtest] + +[Test] +title 3. Create Cached Helper +create CollectionHelperTestClass test +test OpenCollectionUtility +waittestclass test +test NewCachedHelper +test CloseCachedHelper +delete test +pause 1000 +[Endtest] + + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/collection_helper_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/collection_helper_api/tsrc/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2006 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 +: Media Player Engine API +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_TESTEXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +#include "../CollectionHelperTestClass/group/bld.inf" + +PRJ_TESTMMPFILES diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/collection_helper_api/tsrc/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/collection_helper_api/tsrc/init/TestFramework.ini Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,195 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[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_CollectionHelperTestClass + +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= 0 # Default timeout value for each test case. In milliseconds +UITestingSupport= YES +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +[New_Module] +ModuleName= testscripter +TestCaseFile= c:\testframework\CollectionHelperTestClass.cfg +[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[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= D:\LOGS\TestFramework\ +#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 000000000000 -r a2952bb97e68 mmappfw_plat/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -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: Includes all the Domain API specific bld.inf files, which +* export files. +* Version : %version: 1.1.4.1.3.3.4 % +* +*/ + + +#include +#include "../inc/mmappfwbldvariant.hrh" + +#include "../collection_helper_api/group/bld.inf" +#include "../harvester_collection_mediator_api/group/bld.inf" +#include "../harvester_metadata_extractor_api/group/bld.inf" +#include "../harvester_server_api/group/bld.inf" +#include "../harvester_utility_api/group/bld.inf" +#include "../playlist_engine_api/group/bld.inf" +#include "../mpx_collection_common_definition_api/group/bld.inf" +#include "../mpx_collection_utility_api/group/bld.inf" +#include "../mpx_common_api/group/bld.inf" +#include "../mpx_common_definition_api/group/bld.inf" +#include "../mpx_playback_common_definition_api/group/bld.inf" +#include "../mpx_playback_utility_api/group/bld.inf" +#include "../mpx_base_view_plugins_api/group/bld.inf" +#include "../mpx_view_utility_api/group/bld.inf" +#include "../mpx_albumart_utility_api/group/bld.inf" +#include "../media_player_settings_engine_api/group/bld.inf" +#ifdef IAD_INCLUDE_BACKSTEPPING +#include "../mpx_backstepping_utility_api/group/bld.inf" +#endif // IAD_INCLUDE_BACKSTEPPING +#ifdef __WINDOWS_MEDIA +#include "../asx_parser_api/group/bld.inf" +#endif +#include "../playback_helper_api/group/bld.inf" +#include "../videoplaylist_utility_api/group/bld.inf" diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_collection_mediator_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_collection_mediator_api/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2007 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 +: harvester collection mediator API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/mpxcollectionmediator.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectionmediator.h) +../inc/mpxmediatorobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxmediatorobserver.h) +../inc/mpxmoveobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxmoveobserver.h) diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_collection_mediator_api/harvester_collection_mediator_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_collection_mediator_api/harvester_collection_mediator_api.metaxml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,15 @@ + + +Harvester Collection Mediator API +Handles Music Player specific requirements such as adding or updating media properties for items in the collection +c++ +mmappcomponents + + + + + +no +no + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_collection_mediator_api/inc/mpxcollectionmediator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_collection_mediator_api/inc/mpxcollectionmediator.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,248 @@ +/* +* Copyright (c) 2007 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: Thin dll to handle special collection handling events +* +*/ + + +#ifndef CMPXCOLLECTIONMEDIATOR_H +#define CMPXCOLLECTIONMEDIATOR_H + +#include +#include +#include + +// FOWARD DECLARATIONS +class CMPXMedia; +class CMPXMediaArray; +class CMPXCollectionPath; +class CMPXCollectionType; +class CMPXMoveItemHelper; +class MMPXMediatorObserver; +class MMPXMoveItemObserver; + +/** + * + * Mediator class to handle Music Player specific requirements + * ie: files with genre podcast must be stored in podcast db. + * + * @lib mpxcollectionmediator.lib + */ +class CMPXCollectionMediator : public CBase + { + +public: + + /** + * Two-phased constructor. + * @since S60 v3.2.3 + * @param aColUtil collection utility. + * @param aObs observer. + * @return New instance of CMPXCollectionMediator + */ + IMPORT_C static CMPXCollectionMediator* NewL( MMPXCollection& aColUtil, + MMPXMediatorObserver* aObs = NULL ); + + /** + * Two-phased constructor. + * Only use to execute "CheckItemL" not for adding/moving in collection. + * @since S60 v3.2.3 + * @return New instance of CMPXCollectionMediator + */ + IMPORT_C static CMPXCollectionMediator* NewL(); + + /** + * Two-phased constructor. + * @since S60 v3.2.3 + * @param aColUtil. + * @return New instance of CMPXCollectionMediator + */ + IMPORT_C static CMPXCollectionMediator* NewLC( MMPXCollection& aColUtil, + MMPXMediatorObserver* aObs = NULL ); + + /** + * Virtual destructor. + * @since S60 v3.2.3 + */ + virtual ~CMPXCollectionMediator(); + +public: // New functions + + /** + * Add a media to the collection. Upon successfull addition, + * its KMPXMediaGeneralId will be updated. + * @since S60 v3.2.3 + * @param aMediaProp media item. + * @leave KErrArgument leave if not a supported media type + */ + IMPORT_C void AddItemL( CMPXMedia*& aMediaProp ); + + /** + * Add a list of files to the collection db. + * @since S60 v3.2.3 + * @param aArray list of media item. + * @leave KErrArgument leave if not a supported media type + */ + IMPORT_C void AddItemL( CMPXMediaArray& aMPArray ); + + /** + * Updates the media properties of a file. + * Used for media objects where the caller does not know + * the collection for which the item should belong to. + * @since S60 v3.2.3 + * + * @param aMediaProp media to update + */ + IMPORT_C void SetItemL( CMPXMedia*& aMediaProp ); + + /** + * Updates media for a list of items. + * Used for media objects where the caller does not know + * the collection for which the item should belong to. + * @since S60 v3.2.3 + * + * @param aMPArray list of media item + */ + IMPORT_C void SetItemL( CMPXMediaArray& aMPArray ); + + /** + * Update media for items in the same collection depth. Not implemented. + * @since S60 v3.2.3 + * @param aArray list of items. + * @param aPath collection path of the item. + * @param aIndices list of indices + */ + IMPORT_C void SetItemL( TArray& aArray, + CMPXCollectionPath& aPath, + RArray& aIndices ); + + /** + * Static item to check if the collection id is correct. + * Updates the collection path object to podcast if it is podcast. + * @since S60 v3.2.3 + * @param aMedia media object + */ + IMPORT_C void CheckItemL( CMPXMedia& aMedia ); + + /** + * Moves an item from one collection to another. + * Updates the media properties "genre" to Unknown + * if moving from podcast -> local audio. + * @since S60 v3.2.3 + * @param aMedia, properties of the object. + * @param aOldCollectionId old collection id. + * @param aNewCollectionId new collection id + */ + IMPORT_C void MoveItemL( CMPXMedia*& aMedia, + TUid aOldCollectionId, + TUid aNewCollectionId ); + + /** + * Moves an item from one collection to another. + * Updates the media properties "genre" to Unknown + * if moving from podcast -> local audio. + * @since S60 v3.2.3 + * @param aMedia properties of the object. + * @param aOldCollectionId old collection id. + * @param aNewCollectionId new collection id. + * @param aObs observer for event + */ + IMPORT_C void MoveItemL( CMPXMedia*& aMedia, + TUid aOldCollectionId, + TUid aNewCollectionId, + MMPXMoveItemObserver* aObs ); + +private: // New functions + + /** + * Is this item recognizable as podcast. + * @since S60 v3.2.3 + * @param aMedia media object. + * @return ETrue if the file is a podcast EFalse otherwise + */ + TBool IsPodcastL( CMPXMedia& aMedia ); + + /** + * Change a collection id to the podcast db. + * @since S60 v3.2.3 + * @param aMedia media to update the collection id to podcast + */ + void UpdatePathToPodcastL( CMPXMedia& aMedia ); + + /** + * Move a file from one db to another. + * @since S60 v3.2.3 + * @param aMedia media object. + * @param aNewCollection new colection + */ + void DoMoveItemL( CMPXMedia*& aMedia, + TUid aNewCollection ); + + /** + * Add a file to the collection. + * @since S60 v3.2.3 + * @param aMedia media to add. + * @param aCollectionID collection to add the item + */ + void DoAddToCollectionL( CMPXMedia* aMedia, + TUid aCollectionId ); + + + /** + * Set a file to the collection. + * @since S60 v3.2.3 + * @param aMedia media to set. + * @param aCollectionID collection to set the item + */ + void DoSetToCollectionL( CMPXMedia* aMedia, + TUid aCollectionId ); + +private: + + /** + * Private constructor. + * @since S60 v3.2.3 + * @param aColUtil collection utility to share with the owner. + * @param aObs observer to mediator operations + */ + CMPXCollectionMediator( MMPXCollection& aColUtil, + MMPXMediatorObserver* aObs ); + + /** + * Private constructor. + * @since S60 v3.2.3 + */ + CMPXCollectionMediator(); + + /** + * 2nd phase constructor. + * @since S60 v3.2.3 + */ + void ConstructL(); + + +private: // data + MMPXCollection* iColUtil; // collection util, not owned + CMPXMoveItemHelper* iMoveHelper; // Move item helper + MMPXMediatorObserver* iObserver; // Observer + RFs iFs; // FsSession (owned) + HBufC* iPodCastBuf; // Localized string + HBufC* iPodCastEngBuf;// Podcast in english + HBufC* iUnknownBuf; // Unknown text + TUid iMusicCollectionID; // Music Collection ID + TUid iPodCastCollectionID; // PodCast Collection ID + }; + + +#endif // CMPXCOLLECTIONMEDIATOR_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_collection_mediator_api/inc/mpxmediatorobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_collection_mediator_api/inc/mpxmediatorobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2006 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: Mediator observer +* +*/ + + +#ifndef MMPXMEDIATOROBSERVER_H +#define MMPXMEDIATOROBSERVER_H + +class CMPXMedia; + +/** + * Mediator observer to notify of any change in collection id for a file. + * + * @lib mpxcollectionmediator.dll + */ +class MMPXMediatorObserver + { + +public: + + /** + * Handles a change in the collection ID and + * updates the db based on mediator decisions. + * @since S60 v3.2.3 + * @param aMedia Media Property of the item updated. + * @param aOldPath Old collection id + */ + virtual void HandleMediatorPathUpdatedL( CMPXMedia*& aMedia, + TUid aOldPath ) = 0; + + }; + +#endif // MMPXMEDIATOROBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_collection_mediator_api/inc/mpxmoveobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_collection_mediator_api/inc/mpxmoveobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2006 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: Move helper observer +* +*/ + + +#ifndef MMPXMOVEOBSERVER_H +#define MMPXMOVEOBSERVER_H + +/** +* Observer to call back for move events. +* @lib mpxcollectionmediator.dll +*/ +class MMPXMoveItemObserver + { +public: + /** + * Handles the completion of the move event, just a proxy. + *@since 3.2.3 + * @param aErr error code for the operation + */ + virtual void HandleMoveCompleteL( TInt aErr ) = 0; + }; + +#endif // MMPXMOVEOBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_collection_mediator_api/tsrc/HarvesterCollectionMediatorTest/Bmarm/HarvesterCollectionMediatorTestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_collection_mediator_api/tsrc/HarvesterCollectionMediatorTest/Bmarm/HarvesterCollectionMediatorTestU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_collection_mediator_api/tsrc/HarvesterCollectionMediatorTest/Bwins/HarvesterCollectionMediatorTestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_collection_mediator_api/tsrc/HarvesterCollectionMediatorTest/Bwins/HarvesterCollectionMediatorTestU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_collection_mediator_api/tsrc/HarvesterCollectionMediatorTest/EABI/HarvesterCollectionMediatorTestU.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_collection_mediator_api/tsrc/HarvesterCollectionMediatorTest/EABI/HarvesterCollectionMediatorTestU.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_collection_mediator_api/tsrc/HarvesterCollectionMediatorTest/group/HarvesterCollectionMediatorTest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_collection_mediator_api/tsrc/HarvesterCollectionMediatorTest/group/HarvesterCollectionMediatorTest.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2002 - 2007 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: HarvesterCollectionMediatorTest.mmp +* +*/ + + +#if defined(__S60_) +#include +#endif + +TARGET HarvesterCollectionMediatorTest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +/* Remove comments and replace 0x00000000 with correct vendor id */ +// VENDORID 0x00000000 +/* Remove comments and replace 0x00000000 with correct secure id */ +// SECUREID 0x00000000 + +//TARGETPATH ?target_path +DEFFILE HarvesterCollectionMediatorTest.def + + +MW_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src + + +SOURCE HarvesterCollectionMediatorTest.cpp +SOURCE HarvesterCollectionMediatorTestBlocks.cpp + +//RESOURCE resource_file +//RESOURCE resource_file2 +USERINCLUDE ../inc + +LIBRARY euser.lib +LIBRARY bafl.lib estor.lib ecom.lib stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY mpxcollectionmediator.lib mpxcollectionutility.lib mpxcollectionview.lib mpxcollectionengine.lib mpxcollectionhelper.lib mpxcommon.lib + +LANG SC + +/* +START WINS +?wins_specific_information +END + +START MARM +?marm_specific_information +END +*/ +// Other possible keywords: + +// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) +/* +START BITMAP ?target +TARGETPATH ?emulated_path_on_target_machine +HEADER +SOURCE ?color_depth ?source_bitmap +END +*/ +// DEFFILE ?filename +// AIF ?filename + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_collection_mediator_api/tsrc/HarvesterCollectionMediatorTest/group/HarvesterCollectionMediatorTest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_collection_mediator_api/tsrc/HarvesterCollectionMediatorTest/group/HarvesterCollectionMediatorTest.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,68 @@ +; +; 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: Package file for Harvester Collection Mediator STIF component +; +; +; Installation file for STIF +; + +; Languages +&EN + + +; Provide value for uid +#{"STIF HarvesterCollectionMediator Test Application"},(0x10005942),1,1,0,TYPE=SA + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Logo +; None + +; Package signature - Optional +; None + +; Start of Package body + +; Condition blocks +; None + +; Options list +; None + +; Install files + +"..\..\init\TestFramework.ini" - "c:\testframework\TestFramework.ini" +"..\..\conf\HarvesterCollectionMediatorTest.cfg" - "c:\testframework\HarvesterCollectionMediatorTest.cfg" + +"..\..\data\mmc\allmetadata.mp3" - "e:\testing\data\allmetadata.mp3" +"..\..\data\mmc\test0000.mp3" - "e:\testing\data\test0000.mp3" +"..\..\data\mmc\test0001.mp3" - "e:\testing\data\test0001.mp3" +"..\..\data\mmc\test0002.mp3" - "e:\testing\data\test0002.mp3" + +"\epoc32\release\armv5\urel\HarvesterCollectionMediatorTest.dll" - "c:\Sys\Bin\HarvesterCollectionMediatorTest.dll" + +; Embedded SIS +; None + +; End of Package body + +; PKG dependencies +; None + +; PKG capabilities +; None diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_collection_mediator_api/tsrc/HarvesterCollectionMediatorTest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_collection_mediator_api/tsrc/HarvesterCollectionMediatorTest/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2002 - 2007 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: bld.inf +* +*/ + + + +PRJ_PLATFORMS +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these +DEFAULT + +PRJ_TESTEXPORTS +// NOTE: If using ARS requirements all export operations should be done under this. +// 'abld test export' + +PRJ_EXPORTS +// Specify the source file followed by its destination here +// copy will be used to copy the source file to its destination +// If there's no destination then the source file will be copied +// to the same name in /epoc32/include +// Example: +/* +/agnmodel/inc/AGMCOMON.H +*/ + +PRJ_TESTMMPFILES +HarvesterCollectionMediatorTest.mmp + +PRJ_MMPFILES + +// Specify the .mmp files required for building the important component +// releasables. +// +// Specify "tidy" if the component you need to build doesn't need to be +// released. Specify "ignore" if the MMP file exists but should be +// ignored. +// Example: +/* +/agnmodel/group/agnmodel.mmp +#if defined(MARM) +/agnmodel/group/agsvexe.mmp +#endif +*/ + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_collection_mediator_api/tsrc/HarvesterCollectionMediatorTest/inc/HarvesterCollectionMediatorTest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_collection_mediator_api/tsrc/HarvesterCollectionMediatorTest/inc/HarvesterCollectionMediatorTest.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,220 @@ +/* +* Copyright (c) 2002 - 2007 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: HarvesterCollectionMediatorTest.h +* +*/ + + + +#ifndef HARVESTERCOLLECTIONMEDIATORTEST_H +#define HARVESTERCOLLECTIONMEDIATORTEST_H + +// INCLUDES +#include +#include +#include +#include + +#include "mpxcollectionmediator.h" +#include +#include + +// CONSTANTS +//const ?type ?constant_var = ?constant; +// MACROS +//#define ?macro ?macro_def +#define TEST_CLASS_VERSION_MAJOR 0 +#define TEST_CLASS_VERSION_MINOR 0 +#define TEST_CLASS_VERSION_BUILD 0 + +// Logging path +_LIT( KHarvesterCollectionMediatorTestLogPath, "\\logs\\testframework\\HarvesterCollectionMediatorTest\\" ); +// Log file +_LIT( KHarvesterCollectionMediatorTestLogFile, "HarvesterCollectionMediatorTest.txt" ); +_LIT( KHarvesterCollectionMediatorTestLogFileWithTitle, "HarvesterCollectionMediatorTest_[%S].txt" ); +_LIT( KTestItemPath, "\\testing\\data\\test0000.mp3"); +_LIT( KTestItemPath2, "\\testing\\data\\test0001.mp3"); +_LIT( KTestItemPath3, "\\testing\\data\\test0002.mp3"); +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class CHarvesterCollectionMediatorTest; +class CMPXCollectionMediator; + +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// CLASS DECLARATION + +/** +* CHarvesterCollectionMediatorTest test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(CHarvesterCollectionMediatorTest) : public CScriptBase, + public MMPXMoveItemObserver + + + + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CHarvesterCollectionMediatorTest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CHarvesterCollectionMediatorTest(); + + public: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + 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 ); + + //from MMPXMoveItemObserver + virtual void HandleMoveCompleteL( TInt aErr ); + + protected: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + protected: // Functions from base classes + + /** + * From ?base_class ?member_description + */ + //?type ?member_function(); + + private: + + /** + * C++ default constructor. + */ + CHarvesterCollectionMediatorTest( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // ?classname( const ?classname& ); + // Prohibit assigment operator if not deriving from CBase. + // ?classname& operator=( const ?classname& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + + /** + * Test methods are listed below. + */ + /** + * Example test method. + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + virtual TInt ExampleL( CStifItemParser& aItem ); + + + + //to test CMPXCollectionMediator::NewL( ) + virtual TInt CMPXCollectionMediatorNewL( CStifItemParser& /*aItem*/ ); //--debug pass + //to test CMPXCollectionMediator::NewL( MMPXCollection& aColUtil, MMPXMediatorObserver* aObs = NULL ) + virtual TInt CMPXCollectionMediatorNewLWithMPXCollection( CStifItemParser& /*aItem*/ ); //--debug pass + //to test CMPXCollectionMediator::~CMPXCollectionMediator() + virtual TInt CMPXCollectionMediatorDestruction( CStifItemParser& /*aItem*/ ); //--debug pass + //to test CMPXCollectionMediator::AddItemL( CMPXMedia*& aMediaProp) + virtual TInt CMPXCollectionMediatorAddItemLMedia( CStifItemParser& /*aItem*/ ); //--debug pass + //to test CMPXCollectionMediator::NewLC(); + virtual TInt CMPXCollectionMediatorNewLC( CStifItemParser& /*aItem*/ ); //--debug pass + //to test CMPXCollectionMediator::AddItemL( CMPXMediaArray& aMPArray ); + virtual TInt CMPXCollectionAddItemLCMPXMediaArray( CStifItemParser& /*aItem*/ ); //--debug pass + //to test CMPXCollectionMediator::SetItemL( CMPXMedia*& aMediaProp ) + virtual TInt CMPXCollectionSetItemLByCMPXMedia( CStifItemParser& /*aItem*/ ); //--debug pass + //to test CMPXCollectionMediator::SetItemL( CMPXMediaArray& aMPArray ); + virtual TInt CMPXCollectionSetItemLByCMPXMediaArray( CStifItemParser& /*aItem*/ ); //--debug pass + //to test CMPXCollectionMediator::SetItemL(TArray& aArray,CMPXCollectionPath& aPath,RArray& aIndices ); + virtual TInt CMPXCollectionSetItemL( CStifItemParser& /*aItem*/ ); //--debug crash + //to test CMPXCollectionMediator::CheckItemL( CMPXMedia& aMedia ) + virtual TInt CMPXCollectionCheckItemL( CStifItemParser& /*aItem*/ ); //--debug pass + + //to test CMPXCollectionMediator::MoveItemL( CMPXMedia*& aMedia,TUid aOldCollectionId,TUid aNewCollectionId ) + virtual TInt CMPXCollectionMoveItemLwith3paras( CStifItemParser& /*aItem*/ ); //--debug fail + + //to test CMPXCollectionMediator::MoveItemL( CMPXMedia*& aMedia,TUid aOldCollectionId, + // TUid aNewCollectionId,MMPXMoveItemObserver* aObs ) + virtual TInt CMPXCollectionMoveItemLwith4paras( CStifItemParser& /*aItem*/ ); //--debug pass + + virtual TInt CMPXCollectionMediatorWithRealCollection( CStifItemParser& /*aItem*/ ); //--debug pass + + /** + * Method used to log version of test class + */ + void SendTestClassVersion(); + + //ADD NEW METHOD DEC HERE + //[TestMethods] - Do not remove + + public: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + CMPXCollectionMediator* iMediator; + + + private: // Friend classes + //?friend_class_declaration; + CMPXCollectionPath* iCollectionPath; + MMPXCollectionUtility* iCollectionUtility; + + }; + +#endif // HARVESTERCOLLECTIONMEDIATORTEST_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_collection_mediator_api/tsrc/HarvesterCollectionMediatorTest/inc/mpxcollectionmediator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_collection_mediator_api/tsrc/HarvesterCollectionMediatorTest/inc/mpxcollectionmediator.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,249 @@ +/* +* Copyright (c) 2007 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: Thin dll to handle special collection handling events +* +*/ + + +#ifndef CMPXCOLLECTIONMEDIATOR_H +#define CMPXCOLLECTIONMEDIATOR_H + +#include +#include +#include + +#include + +// FOWARD DECLARATIONS +class CMPXMedia; +class CMPXMediaArray; +class CMPXCollectionPath; +class CMPXCollectionType; +class CMPXMoveItemHelper; +class MMPXMediatorObserver; +class MMPXMoveItemObserver; + +/** + * + * Mediator class to handle Music Player specific requirements + * ie: files with genre podcast must be stored in podcast db. + * + * @lib mpxcollectionmediator.lib + */ +class CMPXCollectionMediator : public CBase + { +public: + + /** + * Two-phased constructor. + * @since S60 v3.2.3 + * @param aColUtil collection utility. + * @param aObs observer. + * @return New instance of CMPXCollectionMediator + */ + IMPORT_C static CMPXCollectionMediator* NewL( MMPXCollection& aColUtil, + MMPXMediatorObserver* aObs = NULL ); + + /** + * Two-phased constructor. + * Only use to execute "CheckItemL" not for adding/moving in collection. + * @since S60 v3.2.3 + * @return New instance of CMPXCollectionMediator + */ + IMPORT_C static CMPXCollectionMediator* NewL(); + + /** + * Two-phased constructor. + * @since S60 v3.2.3 + * @param aColUtil. + * @return New instance of CMPXCollectionMediator + */ + IMPORT_C static CMPXCollectionMediator* NewLC( MMPXCollection& aColUtil, + MMPXMediatorObserver* aObs = NULL ); + + /** + * Virtual destructor. + * @since S60 v3.2.3 + */ + virtual ~CMPXCollectionMediator(); + +public: // New functions + + /** + * Add a media to the collection. Upon successfull addition, + * its KMPXMediaGeneralId will be updated. + * @since S60 v3.2.3 + * @param aMediaProp media item. + * @leave KErrArgument leave if not a supported media type + */ + IMPORT_C void AddItemL( CMPXMedia*& aMediaProp ); + + /** + * Add a list of files to the collection db. + * @since S60 v3.2.3 + * @param aArray list of media item. + * @leave KErrArgument leave if not a supported media type + */ + IMPORT_C void AddItemL( CMPXMediaArray& aMPArray ); + + /** + * Updates the media properties of a file. + * Used for media objects where the caller does not know + * the collection for which the item should belong to. + * @since S60 v3.2.3 + * + * @param aMediaProp media to update + */ + IMPORT_C void SetItemL( CMPXMedia*& aMediaProp ); + + /** + * Updates media for a list of items. + * Used for media objects where the caller does not know + * the collection for which the item should belong to. + * @since S60 v3.2.3 + * + * @param aMPArray list of media item + */ + IMPORT_C void SetItemL( CMPXMediaArray& aMPArray ); + + /** + * Update media for items in the same collection depth. Not implemented. + * @since S60 v3.2.3 + * @param aArray list of items. + * @param aPath collection path of the item. + * @param aIndices list of indices + */ + IMPORT_C void SetItemL( TArray& aArray, + CMPXCollectionPath& aPath, + RArray& aIndices ); + + /** + * Static item to check if the collection id is correct. + * Updates the collection path object to podcast if it is podcast. + * @since S60 v3.2.3 + * @param aMedia media object + */ + IMPORT_C void CheckItemL( CMPXMedia& aMedia ); + + /** + * Moves an item from one collection to another. + * Updates the media properties "genre" to Unknown + * if moving from podcast -> local audio. + * @since S60 v3.2.3 + * @param aMedia, properties of the object. + * @param aOldCollectionId old collection id. + * @param aNewCollectionId new collection id + */ + IMPORT_C void MoveItemL( CMPXMedia*& aMedia, + TUid aOldCollectionId, + TUid aNewCollectionId ); + + /** + * Moves an item from one collection to another. + * Updates the media properties "genre" to Unknown + * if moving from podcast -> local audio. + * @since S60 v3.2.3 + * @param aMedia properties of the object. + * @param aOldCollectionId old collection id. + * @param aNewCollectionId new collection id. + * @param aObs observer for event + */ + IMPORT_C void MoveItemL( CMPXMedia*& aMedia, + TUid aOldCollectionId, + TUid aNewCollectionId, + MMPXMoveItemObserver* aObs ); + +private: // New functions + + /** + * Is this item recognizable as podcast. + * @since S60 v3.2.3 + * @param aMedia media object. + * @return ETrue if the file is a podcast EFalse otherwise + */ + TBool IsPodcastL( CMPXMedia& aMedia ); + + /** + * Change a collection id to the podcast db. + * @since S60 v3.2.3 + * @param aMedia media to update the collection id to podcast + */ + void UpdatePathToPodcastL( CMPXMedia& aMedia ); + + /** + * Move a file from one db to another. + * @since S60 v3.2.3 + * @param aMedia media object. + * @param aNewCollection new colection + */ + void DoMoveItemL( CMPXMedia*& aMedia, + TUid aNewCollection ); + + /** + * Add a file to the collection. + * @since S60 v3.2.3 + * @param aMedia media to add. + * @param aCollectionID collection to add the item + */ + void DoAddToCollectionL( CMPXMedia* aMedia, + TUid aCollectionId ); + + + /** + * Set a file to the collection. + * @since S60 v3.2.3 + * @param aMedia media to set. + * @param aCollectionID collection to set the item + */ + void DoSetToCollectionL( CMPXMedia* aMedia, + TUid aCollectionId ); + +private: + + /** + * Private constructor. + * @since S60 v3.2.3 + * @param aColUtil collection utility to share with the owner. + * @param aObs observer to mediator operations + */ + CMPXCollectionMediator( MMPXCollection& aColUtil, + MMPXMediatorObserver* aObs ); + + /** + * Private constructor. + * @since S60 v3.2.3 + */ + CMPXCollectionMediator(); + + /** + * 2nd phase constructor. + * @since S60 v3.2.3 + */ + void ConstructL(); + + +private: // data + MMPXCollection* iColUtil; // collection util, not owned + CMPXMoveItemHelper* iMoveHelper; // Move item helper + MMPXMediatorObserver* iObserver; // Observer + RFs iFs; // FsSession (owned) + HBufC* iPodCastBuf; // Localized string + HBufC* iPodCastEngBuf;// Podcast in english + HBufC* iUnknownBuf; // Unknown text + TUid iMusicCollectionID; // Music Collection ID + TUid iPodCastCollectionID; // PodCast Collection ID + }; + + +#endif // CMPXCOLLECTIONMEDIATOR_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_collection_mediator_api/tsrc/HarvesterCollectionMediatorTest/src/HarvesterCollectionMediatorTest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_collection_mediator_api/tsrc/HarvesterCollectionMediatorTest/src/HarvesterCollectionMediatorTest.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,163 @@ +/* +* Copyright (c) 2002 - 2007 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: HarvesterCollectionMediatorTest.cpp +* +*/ + + + +// INCLUDE FILES +#include +#include "HarvesterCollectionMediatorTest.h" +#include + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CHarvesterCollectionMediatorTest::CHarvesterCollectionMediatorTest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CHarvesterCollectionMediatorTest::CHarvesterCollectionMediatorTest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// CHarvesterCollectionMediatorTest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CHarvesterCollectionMediatorTest::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(KHarvesterCollectionMediatorTestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KHarvesterCollectionMediatorTestLogFile); + } + + iLog = CStifLogger::NewL( KHarvesterCollectionMediatorTestLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + SendTestClassVersion(); + + } + +// ----------------------------------------------------------------------------- +// CHarvesterCollectionMediatorTest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CHarvesterCollectionMediatorTest* CHarvesterCollectionMediatorTest::NewL( + CTestModuleIf& aTestModuleIf ) + { + CHarvesterCollectionMediatorTest* self = new (ELeave) CHarvesterCollectionMediatorTest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +CHarvesterCollectionMediatorTest::~CHarvesterCollectionMediatorTest() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + /*iCollectionUtility->Close(); + iCollectionUtility = NULL;*/ + } + + +void CHarvesterCollectionMediatorTest::HandleMoveCompleteL( TInt /*aErr*/ ) + { + iLog->Log( _L("HandleMoveCompleteL is called") ); + } + + +//----------------------------------------------------------------------------- +// CHarvesterCollectionMediatorTest::SendTestClassVersion +// Method used to send version of test class +//----------------------------------------------------------------------------- +// +void CHarvesterCollectionMediatorTest::SendTestClassVersion() + { + TVersion moduleVersion; + moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; + moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; + moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; + + TFileName moduleName; + moduleName = _L("HarvesterCollectionMediatorTest.dll"); + + TBool newVersionOfMethod = ETrue; + TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); + } + +// ========================== 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* ) CHarvesterCollectionMediatorTest::NewL( aTestModuleIf ); + + } + + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_collection_mediator_api/tsrc/HarvesterCollectionMediatorTest/src/HarvesterCollectionMediatorTestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_collection_mediator_api/tsrc/HarvesterCollectionMediatorTest/src/HarvesterCollectionMediatorTestBlocks.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,703 @@ +/* +* Copyright (c) 2002 - 2007 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: HarvesterCollectionMediatorTestBlocks.cpp +* +*/ + + + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include "HarvesterCollectionMediatorTest.h" + +#include +#include //to get KMPXMediaIdGeneral\EMPXSong\TMPXGeneralCategory\KMPXMediaGeneralCategory +#include //to get KMPXMediaIdAudio +#include //to get KMPXMediaIdMusic +#include //to get KMPXMediaIdDrm +#include "mpxcollectionpath.h" +#include +#include +#include + +//#include +//#include +#include +#include "HarvesterCollectionMediatorTest.h" +//class CMPXCollectionMediator; + +class CMPXMedia; +class MMPXCollection; + +_LIT( KTestFileMimeType, "audio/aac" ); + +class SonOfMMPXCollection:public MMPXCollection + { + virtual void OpenL(TMPXOpenMode /*aMode=EMPXOpenDefault*/) + { + //iLog->Log(_L("OpenL with a mode is called")); + }; + virtual void OpenL(TInt/* aIndex*/,TMPXOpenMode /*aMode=EMPXOpenDefault*/){ + //iLog->Log(_L("OpenL with 2 paras is called"); + }; + virtual void OpenL(const CMPXCollectionPath& /*aPath*/, + TMPXOpenMode /*aMode=EMPXOpenDefault*/){ + //iLog->Log(_L("OpenL with a path is called"); + }; + virtual void OpenL(TInt /*aIndex*/, + const TArray&/* aAttrs*/, + TMPXOpenMode /*aMode=EMPXOpenDefault*/){ + //iLog->Log(_L("OpenL with 3 paras is called")); + }; + virtual void OpenL(const CMPXCollectionPath& /*aPath*/, + const TArray& /*aAttrs*/, + TMPXOpenMode/* aMode=EMPXOpenDefault*/){ + //iLog->Log(_L("OpenL with 3 paras2 is called")); + }; + virtual void OpenL(const TArray& /*aUids*/, + TMPXOpenMode/* aMode=EMPXOpenDefault*/){ + //iLog->Log(_L("OpenL with a mode is called")); + }; + virtual void OpenL(const TUid& /*aUid*/, + TMPXOpenMode /*aMode=EMPXOpenDefault*/){}; + virtual void SetFilterL(CMPXFilter* /*aFilter*/){}; + virtual CMPXFilter* FilterL(){return NULL;}; + virtual TUid UidL() const{return TUid::Null();}; + virtual CMPXCollectionPath* PathL(){return NULL;}; + virtual void BackL(){}; + virtual TBool IsRemote(const CMPXCollectionPath& /*aPath*/){return NULL;}; + virtual void CancelRequest(){}; + virtual void AddL(const CMPXMedia& /*aNewMedia*/){}; + virtual void RemoveL(const CMPXCollectionPath& /*aPath*/, + MMPXCollectionRemoveObserver* /*aObs = NULL*/ ){}; + virtual void RemoveL(const CMPXMedia& /*aMedia*/){}; + virtual void SetSyncL(const CMPXMedia&/* aMedia*/){}; + virtual void SetL(const CMPXMedia& /*aMedia*/){}; + virtual void FindAllL(const CMPXSearchCriteria& /*aCriteria*/, + const TArray&/* aAttrs*/, + MMPXCollectionFindObserver& /*aObs*/){}; + virtual CMPXMedia* FindAllL(const CMPXSearchCriteria&/* aCriteria*/, + const TArray& /*aAttrs*/){return NULL;}; + virtual void MediaL(const CMPXCollectionPath&/* aPath*/, + const TArray& /*aAttrs*/, + CMPXAttributeSpecs* /*aSpecs=NULL*/, + CMPXFilter* /*aFilter=NULL*/){}; + virtual void NotifyL(TMPXCollectionBroadCastMsg /*aMsg*/, TInt /*aData*/){}; + virtual void CommandL(TMPXCollectionCommand /*aCmd*/, TInt /*aData = 0*/){}; + virtual void CommandL(CMPXCommand&/* aCmd*/){}; + virtual void GetSupportedTypesL(RPointerArray& /*aArray*/){}; + virtual void GetSupportedCapabilitiesL(TCollectionCapability& /*aCapability*/){}; + virtual TUid CollectionIDL(TUid& /*aCollection*/){return TUid::Null();} + virtual void AddSubscriptionL(const CMPXSubscription& /*aSubscription*/){}; + virtual void RemoveSubscriptionL(const CMPXSubscription& /*aSubscription*/){}; + virtual void ClearSubscriptionsL(){}; + }; + + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CHarvesterCollectionMediatorTest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CHarvesterCollectionMediatorTest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// CHarvesterCollectionMediatorTest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CHarvesterCollectionMediatorTest::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( "Example", CHarvesterCollectionMediatorTest::ExampleL ), + ENTRY( "CMPXCollectionMediatorNewL", CHarvesterCollectionMediatorTest::CMPXCollectionMediatorNewL ), + ENTRY( "CMPXCollectionMediatorNewLC", CHarvesterCollectionMediatorTest::CMPXCollectionMediatorNewLC ), + ENTRY( "CMPXCollectionMediatorNewLWithMPXCollection", CHarvesterCollectionMediatorTest::CMPXCollectionMediatorNewLWithMPXCollection ), + ENTRY( "CMPXCollectionMediatorDestruction", CHarvesterCollectionMediatorTest::CMPXCollectionMediatorDestruction ), + ENTRY( "CMPXCollectionMediatorAddItemLMedia", CHarvesterCollectionMediatorTest::CMPXCollectionMediatorAddItemLMedia ), + ENTRY( "CMPXCollectionAddItemLCMPXMediaArray", CHarvesterCollectionMediatorTest::CMPXCollectionAddItemLCMPXMediaArray ), + ENTRY( "CMPXCollectionSetItemLByCMPXMedia", CHarvesterCollectionMediatorTest::CMPXCollectionSetItemLByCMPXMedia ), + ENTRY( "CMPXCollectionSetItemLByCMPXMediaArray", CHarvesterCollectionMediatorTest::CMPXCollectionSetItemLByCMPXMediaArray ), + ENTRY( "CMPXCollectionSetItemL", CHarvesterCollectionMediatorTest::CMPXCollectionSetItemL ), + ENTRY( "CMPXCollectionCheckItemL", CHarvesterCollectionMediatorTest::CMPXCollectionCheckItemL ), + ENTRY( "CMPXCollectionMoveItemLwith3paras", CHarvesterCollectionMediatorTest::CMPXCollectionMoveItemLwith3paras ), + ENTRY( "CMPXCollectionMoveItemLwith4paras", CHarvesterCollectionMediatorTest::CMPXCollectionMoveItemLwith4paras ), + ENTRY( "CMPXCollectionMediatorWithRealCollection", CHarvesterCollectionMediatorTest::CMPXCollectionMediatorWithRealCollection ), + //ADD NEW ENTRY HERE + // [test cases entries] - Do not remove + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// ----------------------------------------------------------------------------- +// CHarvesterCollectionMediatorTest::ExampleL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CHarvesterCollectionMediatorTest::ExampleL( CStifItemParser& aItem ) + { + + // Print to UI + _LIT( KHarvesterCollectionMediatorTest, "HarvesterCollectionMediatorTest" ); + _LIT( KExample, "In Example" ); + TestModuleIf().Printf( 0, KHarvesterCollectionMediatorTest, KExample ); + // Print to log file + iLog->Log( KExample ); + + TInt i = 0; + TPtrC string; + _LIT( KParam, "Param[%i]: %S" ); + while ( aItem.GetNextString ( string ) == KErrNone ) + { + TestModuleIf().Printf( i, KHarvesterCollectionMediatorTest, + KParam, i, &string ); + i++; + } + + return KErrNone; + + } + +// ----------------------------------------------------------------------------- +// CHarvesterCollectionMediatorTest::CMPXCollectionMediatorNewL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +//--------debug pass +TInt CHarvesterCollectionMediatorTest::CMPXCollectionMediatorNewL( CStifItemParser&/* aItem*/ ) + { + iLog->Log( _L("CHarvesterCollectionMediatorTest::CMPXCollectionMediatorNewL testing CMPXCollectionMediator::NewL() begin") ); + TInt err = KErrNone; + TRAP( err,iMediator = CMPXCollectionMediator::NewL() ) + if( err != KErrNone ) + { + iLog->Log( _L("CMPXCollectionMediatorNewL returns a error %d"),err ); + } + else + { + iLog->Log( _L("CHarvesterCollectionMediatorTest::CMPXCollectionMediatorNewL testing CMPXCollectionMediator::NewL() End") ); + } + return err; + } + +// ----------------------------------------------------------------------------- +// CHarvesterCollectionMediatorTest::CMPXCollectionMediatorDestruction +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +//----debug pass +TInt CHarvesterCollectionMediatorTest::CMPXCollectionMediatorDestruction( CStifItemParser&/* aItem*/ ) + { + TInt err = KErrNone; + delete iMediator; + iMediator = NULL; + iLog->Log(_L("CHarvesterCollectionMediatorTest::CMPXCollectionMediatorDestruction testing ~CMPXCollectionMediator end err=%d"), err); + return err; + } + + + +// ----------------------------------------------------------------------------- +// CHarvesterCollectionMediatorTest::CMPXCollectionMediatorNewLWithMPXCollection +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +//-----debug pass +TInt CHarvesterCollectionMediatorTest::CMPXCollectionMediatorNewLWithMPXCollection( CStifItemParser&/* aItem*/ ) + { + + iLog->Log(_L("CHarvesterCollectionMediatorTest::CMPXCollectionMediatorNewLWithMPXCollection testing CMPXCollectionMediator::NewL() begin")); + TInt err=KErrNone; + + iCollectionUtility = MMPXCollectionUtility::NewL( ); + TRAP( err,iMediator = CMPXCollectionMediator::NewL( iCollectionUtility->Collection() ) ); + if( err != KErrNone ) + { + iLog->Log( _L("CMPXCollectionMediatorNewLWithMPXCollection returns a error %d"),err ); + } + else + { + iLog->Log( _L("CHarvesterCollectionMediatorTest::CMPXCollectionMediatorNewLWithMPXCollection testing CMPXCollectionMediator::NewL() End") ); + } + iCollectionUtility->Close(); + return err; + } + +// ----------------------------------------------------------------------------- +// CHarvesterCollectionMediatorTest::CMPXCollectionMediatorNewLC +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +//-----debug pass---->crash 17,10,2008 +TInt CHarvesterCollectionMediatorTest::CMPXCollectionMediatorNewLC( CStifItemParser&/* aItem*/ ) + { + iLog->Log( _L("CHarvesterCollectionMediatorTest::CMPXCollectionMediatorNewLC testing CMPXCollectionMediator::NewLC() begin") ); + TInt err = KErrNone; + iCollectionUtility = MMPXCollectionUtility::NewL( ); + iMediator = CMPXCollectionMediator::NewLC( iCollectionUtility->Collection() ); + CleanupStack::Pop( iMediator ); + iCollectionUtility->Close(); + iLog->Log( _L("CHarvesterCollectionMediatorTest::CMPXCollectionMediatorNewLC testing CMPXCollectionMediator::NewLC() End") ); + return err; + } + + +// ----------------------------------------------------------------------------- +// CHarvesterCollectionMediatorTest::CMPXCollectionMediatorAddItemLMedia +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CHarvesterCollectionMediatorTest::CMPXCollectionMediatorAddItemLMedia( CStifItemParser&/* aItem*/ ) + { + + iLog->Log( _L("CHarvesterCollectionMediatorTest::CMPXCollectionMediatorAddItemLMedia testing CMPXCollectionMediator::AddItemL() begin") ); + TInt err=KErrNone; + RArray contentIDs; + contentIDs.AppendL( KMPXMediaIdGeneral ); + contentIDs.AppendL( KMPXMediaIdAudio ); + contentIDs.AppendL( KMPXMediaIdMusic ); + contentIDs.AppendL( KMPXMediaIdDrm ); + CMPXMedia* media; + TRAP(err,media=CMPXMedia::NewL(contentIDs.Array())); + CleanupStack::PushL(media); + media->SetTObjectValueL( KMPXMediaGeneralCategory, + EMPXSong ); + media->SetTObjectValueL( KMPXMediaMusicGenre, + EMPXSong ); + media->SetTObjectValueL( KMPXMediaGeneralCollectionId, + EMPXSong ); + media->ValueText(KMPXMediaGeneralCategory); + media->SetTObjectValueL( KMPXMediaGeneralType, + EMPXItem ); + TRAP(err,media->SetTextValueL( KMPXMediaMusicAlbumTrack, KNullDesC )); + TRAP(err,media->SetTextValueL( KMPXMediaGeneralMimeType, KTestFileMimeType )); + //iMediator->AddItemL(media); + TRAP( err,iMediator->AddItemL( media ) ); + if( err != KErrNone ) + { + iLog->Log( _L("CMPXCollectionMediatorAddItemLMedia returns a error %d"),err ); + } + else + { + iLog->Log( _L("CHarvesterCollectionMediatorTest::CMPXCollectionMediatorAddItemLMedia testing CMPXCollectionMediator::AddItemL() End") ); + } + CleanupStack::PopAndDestroy( media ); + return err; + } +// ----------------------------------------------------------------------------- +// CHarvesterCollectionMediatorTest::CMPXCollectionAddItemLCMPXMediaArray +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +//-----debug pass +TInt CHarvesterCollectionMediatorTest::CMPXCollectionAddItemLCMPXMediaArray( CStifItemParser&/* aItem*/ ) + { + iLog->Log(_L("CMPXCollectionAddItemLCMPXMediaArray")); + TInt err = KErrNone; + CMPXMediaArray* mediaAry = CMPXMediaArray::NewL(); + CleanupStack::PushL( mediaAry ); + + // One music and one podcast media + CMPXMedia* m1 = CMPXMedia::NewL(); + CleanupStack::PushL( m1 ); + m1->SetTextValueL(KMPXMediaGeneralUri,KTestItemPath2); + m1->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXSong ); + m1->SetTObjectValueL(KMPXMediaGeneralType, EMPXItem); + m1->SetTObjectValueL(KMPXMediaGeneralCollectionId, TUid::Uid(0x101FFC3A) ); + + CMPXMedia* m2 = CMPXMedia::NewL(); + CleanupStack::PushL( m2 ); + m2->SetTextValueL(KMPXMediaGeneralUri,KTestItemPath3); + m2->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXSong ); + m2->SetTObjectValueL(KMPXMediaGeneralType, EMPXItem); + m2->SetTObjectValueL(KMPXMediaGeneralCollectionId, TUid::Uid(0x101FFC3A) ); + m2->SetTextValueL(KMPXMediaMusicGenre, _L("podcast")); + + mediaAry->AppendL(*m1); // copy + mediaAry->AppendL(*m2); // copy + + iLog->Log(_L("CMPXCollectionAddItemLCMPXMediaArray -- adding via mediator")); + iMediator->AddItemL(*mediaAry); + + mediaAry->Reset(); + m1->SetTextValueL(KMPXMediaGeneralTitle, _L("abcdefg") ); + m2->SetTextValueL(KMPXMediaGeneralTitle, _L("abcdefg") ); + + mediaAry->AppendL(*m1); // copy + mediaAry->AppendL(*m2); // copy + iLog->Log(_L("CMPXCollectionAddItemLCMPXMediaArray -- updating via mediator")); + iMediator->SetItemL(*mediaAry); + + CleanupStack::PopAndDestroy(2); // m1, m2 + CleanupStack::PopAndDestroy( mediaAry ); + + if( err != KErrNone ) + { + iLog->Log( _L("CMPXCollectionAddItemLCMPXMediaArray returns a error %d"),err ); + } + else + { + iLog->Log( _L("CHarvesterCollectionMediatorTest::CMPXCollectionAddItemLCMPXMediaArray testing CMPXCollectionMediator::AddItemL() End") ); + } + return err; + } +// ----------------------------------------------------------------------------- +// CHarvesterCollectionMediatorTest::CMPXCollectionSetItemLByCMPXMedia +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CHarvesterCollectionMediatorTest::CMPXCollectionSetItemLByCMPXMedia( CStifItemParser&/* aItem*/ ) + { + iLog->Log( _L("CHarvesterCollectionMediatorTest::CMPXCollectionSetItemLByCMPXMedia testing CMPXCollectionMediator::SetItemL( CMPXMedia*& aMediaProp) begin") ); + TInt err = KErrNone; + CMPXMedia* media = CMPXMedia::NewL(); + CleanupStack::PushL( media ); + + iLog->Log(_L("CMPXCollectionSetItemLByCMPXMedia -- adding item")); + // Add an item + media->SetTextValueL(KMPXMediaGeneralUri,KTestItemPath); + media->SetTextValueL(KMPXMediaMusicArtist,_L("MyArtist")); + media->SetTextValueL(KMPXMediaMusicAlbum,_L("AnAlbum")); + media->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXSong ); + media->SetTObjectValueL(KMPXMediaGeneralType, EMPXItem); + media->SetTObjectValueL(KMPXMediaGeneralCollectionId, TUid::Uid(0x101FFC3A) ); + iMediator->AddItemL(media); + + // General update + iLog->Log(_L("CMPXCollectionSetItemLByCMPXMedia -- updating item")); + media->SetTextValueL(KMPXMediaGeneralTitle,_L("SomeTitle")); + iMediator->SetItemL(media); + + // Move to podcast, tests FetchAndMoveItemSyncL() in mediator + iLog->Log(_L("CMPXCollectionSetItemLByCMPXMedia -- moving item")); + media->SetTextValueL(KMPXMediaMusicGenre, _L("podcast")); + iMediator->SetItemL(media); + + CleanupStack::PopAndDestroy(media); + + if( err != KErrNone ) + { + iLog->Log( _L("CMPXCollectionSetItemLByCMPXMedia returns a error %d"),err ); + } + else + { + iLog->Log( _L("CHarvesterCollectionMediatorTest::CMPXCollectionSetItemLByCMPXMedia testing CMPXCollectionMediator::SetItemL( CMPXMedia*& aMediaProp) End") ); + } + return err; + } +// ----------------------------------------------------------------------------- +// CHarvesterCollectionMediatorTest::CMPXCollectionSetItemLByCMPXMediaArray +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +//-----debug pass--->fail 17,10,2008 +TInt CHarvesterCollectionMediatorTest::CMPXCollectionSetItemLByCMPXMediaArray( CStifItemParser&/* aItem*/ ) + { + iLog->Log(_L("CMPXCollectionSetItemL")); + TInt err = KErrNone; + CMPXMediaArray* mediaAry = CMPXMediaArray::NewL(); + CleanupStack::PushL( mediaAry ); + + // One music and one podcast media + CMPXMedia* m1 = CMPXMedia::NewL(); + CleanupStack::PushL( m1 ); + m1->SetTextValueL(KMPXMediaGeneralUri,KTestItemPath2); + m1->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXSong ); + m1->SetTObjectValueL(KMPXMediaGeneralType, EMPXItem); + m1->SetTObjectValueL(KMPXMediaGeneralCollectionId, TUid::Uid(0x101FFC3A) ); + + CMPXMedia* m2 = CMPXMedia::NewL(); + CleanupStack::PushL( m2 ); + m2->SetTextValueL(KMPXMediaGeneralUri,KTestItemPath3); + m2->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXSong ); + m2->SetTObjectValueL(KMPXMediaGeneralType, EMPXItem); + m2->SetTObjectValueL(KMPXMediaGeneralCollectionId, TUid::Uid(0x101FFC3A) ); + m2->SetTextValueL(KMPXMediaMusicGenre, _L("podcast")); + + mediaAry->AppendL(*m1); // copy + mediaAry->AppendL(*m2); // copy + + iLog->Log(_L("CMPXCollectionSetItemL -- adding via mediator")); + iMediator->AddItemL(*mediaAry); + + mediaAry->Reset(); + m1->SetTextValueL(KMPXMediaGeneralTitle, _L("abcdefg") ); + m2->SetTextValueL(KMPXMediaGeneralTitle, _L("abcdefg") ); + + mediaAry->AppendL(*m1); // copy + mediaAry->AppendL(*m2); // copy + iLog->Log(_L("CMPXCollectionSetItemL -- updating via mediator")); + iMediator->SetItemL(*mediaAry); + + CleanupStack::PopAndDestroy(2); // m1, m2 + CleanupStack::PopAndDestroy( mediaAry ); + if( err != KErrNone ) + { + iLog->Log( _L("CMPXCollectionSetItemLByCMPXMediaArray returns a error %d"),err ); + } + else + { + iLog->Log( _L("CHarvesterCollectionMediatorTest::CMPXCollectionSetItemLByCMPXMediaArray testing CMPXCollectionMediator::SetItemL( CMPXMediaArray& aMPArray ) End") ); + } + return err; + } +// ----------------------------------------------------------------------------- +// CHarvesterCollectionMediatorTest::CMPXCollectionSetItemL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +//-----debug pass +TInt CHarvesterCollectionMediatorTest::CMPXCollectionSetItemL( CStifItemParser&/* aItem*/ ) + { + iLog->Log( _L("CHarvesterCollectionMediatorTest::CMPXCollectionSetItemL testing CMPXCollectionMediator::SetItemL(TArray& aArray,CMPXCollectionPath& aPath,RArray& aIndices ) begin") ); + TInt err = KErrNone; + /*RArray iArray = RArray::RArray(); + CMPXMedia* media = CMPXMedia::NewL(); +// CleanupStack::PushL(media); + iArray.Append( media ); +// CleanupStack::PopAndDestroy(media); + TArray iTarray = iArray.Array(); + + const TMPXItemId KMPXPathItem1 = 44441; + RArray itemIdArray; + + // Start from scratch + if ( iCollectionPath ) + { + iCollectionPath->Reset(); + delete iCollectionPath; + } + // build collection path + TRAP( err , iCollectionPath = CMPXCollectionPath::NewL()); + TMPXItemId item(33331); + TRAP( err , iCollectionPath->AppendL(item)); + itemIdArray.Append(KMPXPathItem1); + TRAP( err , iCollectionPath->AppendL(itemIdArray.Array())); + + itemIdArray.Close(); + + + CMPXCollectionPath* iPath; + TRAP( err , iPath = CMPXCollectionPath::NewL(*iCollectionPath)); + + RArray iIndices = RArray::RArray(); + TInt index = 0; + iIndices.Append( index ); + iMediator->SetItemL( iTarray,*iPath,iIndices ); +// CleanupStack::PopAndDestroy(iPath); + iArray.Close(); + + delete media; + media = NULL; + delete iPath; + iPath = NULL; */ + if(err != KErrNone ) + { + iLog->Log( _L("CMPXCollectionSetItemL returns a error %d"),err ); + } + else + { + iLog->Log( _L("CHarvesterCollectionMediatorTest::CMPXCollectionSetItemL testing CMPXCollectionMediator::SetItemL(TArray& aArray,CMPXCollectionPath& aPath,RArray& aIndices ) End") ); + } + return err; + } +// ----------------------------------------------------------------------------- +// CHarvesterCollectionMediatorTest::CMPXCollectionCheckItemL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CHarvesterCollectionMediatorTest::CMPXCollectionCheckItemL( CStifItemParser&/* aItem*/ ) + { + iLog->Log( _L("CHarvesterCollectionMediatorTest::CMPXCollectionCheckItemL testing CMPXCollectionMediator::CheckItemL( CMPXMedia& aMedia ) begin") ); + RArray contentIDs; + TInt err = KErrNone; + contentIDs.AppendL( KMPXMediaIdGeneral ); + contentIDs.AppendL( KMPXMediaIdAudio ); + contentIDs.AppendL( KMPXMediaIdMusic ); + contentIDs.AppendL( KMPXMediaIdDrm ); + CMPXMedia* media = CMPXMedia::NewL( contentIDs.Array() ); + CleanupStack::PushL( media ); + media->SetTObjectValueL( KMPXMediaGeneralCategory, + EMPXSong ); + TInt iIndex = media->Index( KMPXMediaGeneralCategory ); + media->ValueText( KMPXMediaGeneralCategory ); + media->SetTObjectValueL( KMPXMediaGeneralType, + EMPXItem ); + media->SetTextValueL( KMPXMediaMusicAlbumTrack, KNullDesC ); + media->SetTextValueL( KMPXMediaGeneralMimeType, KTestFileMimeType ); + iLog->Log( _L("CHarvesterCollectionMediatorTest::CMPXCollectionCheckItemL testing CMPXCollectionMediator::CheckItemL( CMPXMedia& aMedia ) begin") ); + + //iMediator->CheckItemL(*media); + TRAP( err,iMediator->CheckItemL( *media ) ); + CleanupStack::PopAndDestroy( media ); + if( err != KErrNone ) + { + iLog->Log( _L("CMPXCollectionCheckItemL returns a error %d"),err ); + } + else{ + iLog->Log( _L("CHarvesterCollectionMediatorTest::CMPXCollectionCheckItemL testing CMPXCollectionMediator::SetItemLCheckItemL( CMPXMedia& aMedia ) End") ); + } + return err; + } +// ----------------------------------------------------------------------------- +// CHarvesterCollectionMediatorTest::CMPXCollectionMoveItemLwith3paras +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CHarvesterCollectionMediatorTest::CMPXCollectionMoveItemLwith3paras( CStifItemParser&/* aItem*/ ) + { + iLog->Log( _L("Testing CMPXCollectionMediator::MoveItemL( CMPXMedia*& aMedia, TUid aOldCollectionId,TUid aNewCollectionId ) begin") ); + TInt err = KErrNone; + CMPXMedia* m1 = CMPXMedia::NewL(); + CleanupStack::PushL( m1 ); + m1->SetTextValueL(KMPXMediaGeneralUri, KTestItemPath); + m1->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXSong ); + m1->SetTObjectValueL(KMPXMediaGeneralType, EMPXItem); + m1->SetTObjectValueL(KMPXMediaGeneralCollectionId, TUid::Uid(0x101FFC3C) ); + iLog->Log(_L("CMPXCollectionMoveItemLwith3paras -- adding dummy")); + iMediator->AddItemL(m1); + + // Next move it synchronously via mediator to the podcasting plugin + iLog->Log(_L("CMPXCollectionMoveItemLwith3paras -- moving item")); + iMediator->MoveItemL(m1, TUid::Uid(0x101FFC3C), TUid::Uid(0x101FFC3A)); + CleanupStack::PopAndDestroy(m1); + + if( err != KErrNone ) + { + iLog->Log( _L("CMPXCollectionMoveItemLwith3paras returns a error %d"),err ); + } + else + { + iLog->Log( _L("Testing CMPXCollectionMediator::MoveItemL( CMPXMedia*& aMedia,TUid aOldCollectionId,TUid aNewCollectionId) End") ); + } + return err; + } +// ----------------------------------------------------------------------------- +// CHarvesterCollectionMediatorTest::CMPXCollectionMoveItemLwith4paras +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +//-----debug pass +TInt CHarvesterCollectionMediatorTest::CMPXCollectionMoveItemLwith4paras( CStifItemParser&/* aItem*/ ) + { + iLog->Log( _L("Testing CMPXCollectionMediator::MoveItemL( CMPXMedia*& aMedia, TUid aOldCollectionId,TUid aNewCollectionId,MMPXMoveItemObserver* aObs ) begin") ); + + RArray contentIDs; + TInt err = KErrNone; + contentIDs.AppendL( KMPXMediaIdGeneral ); + contentIDs.AppendL( KMPXMediaIdAudio ); + contentIDs.AppendL( KMPXMediaIdMusic ); + contentIDs.AppendL( KMPXMediaIdDrm ); + CMPXMedia* media; + TRAP(err,media = CMPXMedia::NewL( contentIDs.Array() )); + CleanupStack::PushL( media ); + media->SetTObjectValueL( KMPXMediaGeneralCategory, + EMPXSong ); + TInt iIndex = media->Index( KMPXMediaGeneralCategory ); + media->ValueText( KMPXMediaGeneralCategory ); + media->SetTObjectValueL( KMPXMediaGeneralType, + EMPXItem ); + TRAP(err,media->SetTextValueL( KMPXMediaMusicAlbumTrack, KNullDesC )); + TRAP(err,media->SetTextValueL( KMPXMediaGeneralMimeType, KTestFileMimeType )); + iLog->Log( _L("CHarvesterCollectionMediatorTest::CMPXCollectionMoveItemLwith4paras testing CMPXCollectionMediator::MoveItemL( CMPXMedia*& aMedia,TUid aOldCollectionId,TUid aNewCollectionId,MMPXMoveItemObserver* aObs) begin") ); + TUid iOldCollectionId = {0}; + TUid iNewCollectionId = {1}; + //iMediator->MoveItemL(media,iOldCollectionId,iNewCollectionId,this); + TRAP( err,iMediator->MoveItemL( media,iOldCollectionId,iNewCollectionId,this ) ); + CleanupStack::PopAndDestroy( media ); + if( err != KErrNone ) + { + iLog->Log( _L("CMPXCollectionMoveItemLwith4paras returns a error %d"),err ); + } + else + { + iLog->Log( _L("CHarvesterCollectionMediatorTest::CMPXCollectionMoveItemLwith4paras testing CMPXCollectionMediator::MoveItemL( CMPXMedia*& aMedia,TUid aOldCollectionId,TUid aNewCollectionId,MMPXMoveItemObserver* aObs) End") ); + } + return err; + } + + + +// ----------------------------------------------------------------------------- +// CHarvesterCollectionMediatorTest::CMPXCollectionMediatorWithRealCollection +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +//-----debug pass +TInt CHarvesterCollectionMediatorTest::CMPXCollectionMediatorWithRealCollection( CStifItemParser&/* aItem*/ ) + { + + iLog->Log( _L("CHarvesterCollectionMediatorTest::CMPXCollectionMediatorWithRealCollection testing CMPXCollectionMediator::NewL() begin") ); + TInt err = KErrNone; + SonOfMMPXCollection* son= new SonOfMMPXCollection(); + TRAP( err,iMediator = CMPXCollectionMediator::NewL( *son ) ); + if( err != KErrNone ) + { + iLog->Log( _L("CMPXCollectionMediatorWithRealCollection returns a error %d"),err ); + } + else + { + iLog->Log( _L("CHarvesterCollectionMediatorTest::CMPXCollectionMediatorWithRealCollection testing CMPXCollectionMediator::NewL() End") ); + } + //iUtility->Close(); + return err; + } + +// ----------------------------------------------------------------------------- +// CHarvesterCollectionMediatorTest::?member_function +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// + +/*TInt CHarvesterCollectionMediatorTest::?member_function( + CItemParser& aItem ) + { + + ?code + + }*/ + + +// ========================== OTHER EXPORTED FUNCTIONS ========================= +// None + +// [End of File] - Do not remove diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_collection_mediator_api/tsrc/conf/HarvesterCollectionMediatorTest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_collection_mediator_api/tsrc/conf/HarvesterCollectionMediatorTest.cfg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,139 @@ +[Test] +title 1.NewL CMPXCollectionMediator +create HarvesterCollectionMediatorTest CollectionMediatorTest +CollectionMediatorTest CMPXCollectionMediatorNewL +CollectionMediatorTest CMPXCollectionMediatorDestruction +delete CollectionMediatorTest +pause 1000 +[Endtest] + +[Test] +title 2.~CMPXCollectionMediator() +create HarvesterCollectionMediatorTest CollectionMediatorTest +CollectionMediatorTest CMPXCollectionMediatorDestruction +delete CollectionMediatorTest +pause 1000 +[Endtest] + +[Test] +title 3.AddItemLMedia CMPXCollectionMediator +create HarvesterCollectionMediatorTest CollectionMediatorTest +//-------------CollectionMediatorTest CMPXCollectionMediatorNewLWithMPXCollection +CollectionMediatorTest CMPXCollectionMediatorWithRealCollection +CollectionMediatorTest CMPXCollectionAddItemLCMPXMediaArray +CollectionMediatorTest CMPXCollectionMediatorAddItemLMedia +CollectionMediatorTest CMPXCollectionMediatorDestruction +delete CollectionMediatorTest +pause 1000 +[Endtest] + +[Test] +title 4.NewLWithMPXCollection CMPXCollectionMediator +create HarvesterCollectionMediatorTest CollectionMediatorTest +CollectionMediatorTest CMPXCollectionMediatorNewLWithMPXCollection +CollectionMediatorTest CMPXCollectionMediatorDestruction +delete CollectionMediatorTest +pause 1000 +[Endtest] + +[Test] +title 5.NewLC CMPXCollectionMediator +create HarvesterCollectionMediatorTest CollectionMediatorTest +CollectionMediatorTest CMPXCollectionMediatorNewLC +CollectionMediatorTest CMPXCollectionMediatorDestruction +delete CollectionMediatorTest +pause 1000 +[Endtest] + +[Test] +title 6.AddItemLCMPXMediaArray CMPXCollectionMediator +create HarvesterCollectionMediatorTest CollectionMediatorTest +CollectionMediatorTest CMPXCollectionMediatorWithRealCollection +CollectionMediatorTest CMPXCollectionAddItemLCMPXMediaArray +CollectionMediatorTest CMPXCollectionMediatorDestruction +delete CollectionMediatorTest +pause 1000 +[Endtest] + +[Test] +title 7.SetItemLByCMPXMedia CMPXCollectionMediator +create HarvesterCollectionMediatorTest CollectionMediatorTest +//----CollectionMediatorTest CMPXCollectionMediatorNewLWithMPXCollection +CollectionMediatorTest CMPXCollectionMediatorWithRealCollection +CollectionMediatorTest CMPXCollectionSetItemLByCMPXMedia +CollectionMediatorTest CMPXCollectionMediatorDestruction +delete CollectionMediatorTest +pause 1000 +[Endtest] + +[Test] +title 8.SetItemLByCMPXMediaArray CMPXCollectionMediator +create HarvesterCollectionMediatorTest CollectionMediatorTest +//--------CollectionMediatorTest CMPXCollectionMediatorNewLWithMPXCollection +CollectionMediatorTest CMPXCollectionMediatorWithRealCollection +CollectionMediatorTest CMPXCollectionSetItemLByCMPXMediaArray +CollectionMediatorTest CMPXCollectionMediatorDestruction +delete CollectionMediatorTest +pause 1000 +[Endtest] + +[Test] +title 9.SetItemLwith3parameters CMPXCollectionMediator +create HarvesterCollectionMediatorTest CollectionMediatorTest +CollectionMediatorTest CMPXCollectionMediatorWithRealCollection +CollectionMediatorTest CMPXCollectionSetItemL +CollectionMediatorTest CMPXCollectionMediatorDestruction +delete CollectionMediatorTest +pause 1000 +[Endtest] + +[Test] +title 10.CheckItemL CMPXCollectionMediator +create HarvesterCollectionMediatorTest CollectionMediatorTest +CollectionMediatorTest CMPXCollectionMediatorWithRealCollection +CollectionMediatorTest CMPXCollectionAddItemLCMPXMediaArray +CollectionMediatorTest CMPXCollectionCheckItemL +CollectionMediatorTest CMPXCollectionMediatorDestruction +delete CollectionMediatorTest +pause 1000 +[Endtest] + +[Test] +title 11.MoveItemLwith3paras CMPXCollectionMediator +create HarvesterCollectionMediatorTest CollectionMediatorTest +CollectionMediatorTest CMPXCollectionMediatorWithRealCollection +CollectionMediatorTest CMPXCollectionAddItemLCMPXMediaArray +pause 1000 +CollectionMediatorTest CMPXCollectionMoveItemLwith3paras +CollectionMediatorTest CMPXCollectionMediatorDestruction +delete CollectionMediatorTest +pause 1000 +[Endtest] + +[Test] +title 12.MoveItemLwith4paras CMPXCollectionMediator +create HarvesterCollectionMediatorTest CollectionMediatorTest +CollectionMediatorTest CMPXCollectionMediatorWithRealCollection +CollectionMediatorTest CMPXCollectionAddItemLCMPXMediaArray +CollectionMediatorTest CMPXCollectionMoveItemLwith4paras +CollectionMediatorTest CMPXCollectionMediatorDestruction +delete CollectionMediatorTest +pause 1000 +[Endtest] + +[Test] +title 13.NewLWithRealCollection CMPXCollectionMediator +create HarvesterCollectionMediatorTest CollectionMediatorTest +CollectionMediatorTest CMPXCollectionMediatorWithRealCollection +CollectionMediatorTest CMPXCollectionMediatorDestruction +delete CollectionMediatorTest +pause 1000 +[Endtest] + + + + + + + + \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_collection_mediator_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_collection_mediator_api/tsrc/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2006 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 +: Harvester Collection Mediator API +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_TESTEXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +#include "../HarvesterCollectionMediatorTest/group/bld.inf" + +PRJ_TESTMMPFILES diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_collection_mediator_api/tsrc/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_collection_mediator_api/tsrc/init/TestFramework.ini Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,202 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# + XML, Test report will be xml type, for example 'TestReport.xml'. +# Note, that xml format is available only when output is set to FILE. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +UITestingSupport= YES + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport_HarvesterCollectionMediatorTest + +TestReportFormat= TXT # Possible values: TXT, HTML or XML +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= 0 # 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] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +[New_Module] +ModuleName= TestScripter +TestCaseFile= c:\testframework\HarvesterCollectionMediatorTest.cfg +[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[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= D:\LOGS\TestFramework\ +#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 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_metadata_extractor_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_metadata_extractor_api/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2007 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 +: harvester metadata extractor API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/mpxmetadataextractor.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxmetadataextractor.h) diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_metadata_extractor_api/harvester_metadata_extractor_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_metadata_extractor_api/harvester_metadata_extractor_api.metaxml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,15 @@ + + +Harvester Metadata Extractor API +Extracts metadata from a file +c++ +mmappcomponents + + + + + +no +no + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_metadata_extractor_api/inc/mpxmetadataextractor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_metadata_extractor_api/inc/mpxmetadataextractor.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,200 @@ +/* +* Copyright (c) 2006 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: Extracts metadata from a file +* +*/ + + +#ifndef CMPXMETADATAEXTRACTOR_H +#define CMPXMETADATAEXTRACTOR_H + +class CMPXMedia; +class CMPXCollectionPath; +class CMetaDataUtility; +class CMPXFileInfoUtility; +class CMPXDrmMediaUtility; +#include +#include + +/** + * Extracts metadata from a file. + * + * @lib mpxfilehandler.lib + */ +class CMPXMetadataExtractor : public CBase, + public MThumbnailManagerObserver + { + +public: + /* + * Two-Phased Constructor. + *@since 3.2.3 + */ + IMPORT_C static CMPXMetadataExtractor* NewL( RFs& aFs, + RApaLsSession& aAppArc, + RPointerArray& aTypes ); + + /* + * Virtual Destructor. + *@since 3.2.3 + */ + virtual ~CMPXMetadataExtractor(); + +public: // New Functions + + /* + * Create a media object for a file. + * @since 3.2.3 + * @param aFile a fullpath to the file. + * @param aNewProperty on return a new media property will be created. + * @param aMetadataOnly extract metadata only or not. Default EFalse + */ + IMPORT_C void CreateMediaL( const TDesC& aFile, + CMPXMedia*& aNewProperty, + TBool aMetadataOnly = EFalse ); + + /** + * Extract album art from a file and add to thumbnail manager. + * @since 5.0 + * @param aMedia MPX Media object to add album art attribute. + * @return error id + */ + IMPORT_C TInt ExtractAlbumArtL( CMPXMedia* aMedia ); + +private: // New Functions: + + /** + * Set default media properties. + * @since 3.2.3 + * @param aMediaProp media properties to update + */ + void SetDefaultL( CMPXMedia& aMediaProp ); + + /** + * Function to go through the metadata entries. + * @since 3.2.3 + * @param aProp Media Properties to update. + * @param aFile File name + */ + void SetMediaPropertiesL( CMPXMedia& aProp, + const TDesC& aFile ); + + /** + * Sets other media properties not found from metadata util. + * @since 3.2.3 + * @param aProp Media Properties to update. + * @param aFile file name. + * @param aMetadataOnly extract metadata only or not Default EFalse. + * @param aFileHandle file handle to the file. + * @param aFileErr file handle error if file could not be opened + */ + void SetExtMediaPropertiesL( CMPXMedia& aProp, + const TDesC& aFile, + TBool aMetadataOnly, + RFile& aFileHandle, + TInt aFileErr ); + + /** + * Checks to see if a container type is supported. + * @since 3.2.3 + * @param aFile file path. + * @param aIndex index to the supported types array. + * @return index to the mimetype + */ + TInt SupportedContainerTypeL( const TDesC& aFile, TInt aIndex ); + + // From MThumbnailManagerObserver + /** + * Preview thumbnail generation or loading is complete. + * @since S60 v5.0 + * @param aThumbnail An object representing the resulting thumbnail. + * @param aId Request ID for the operation + */ + void ThumbnailPreviewReady( + MThumbnailData& aThumbnail, TThumbnailRequestId aId ); + + /** + * Final thumbnail bitmap generation or loading is complete. + * @since S60 v5.0 + * @param aError Error code. + * @param aThumbnail An object representing the resulting thumbnail. + * @param aId Request ID for the operation. + */ + void ThumbnailReady( + TInt aError, + MThumbnailData& aThumbnail, TThumbnailRequestId aId ); + + /** + * Stop the wait loop. + */ + void StopWaitLoop(); + + /** + * Cancel timer. + */ + void CancelTimeoutTimer(); + + /** + * Callback when the timer times out. + */ + static TInt TimeoutTimerCallback(TAny* aPtr); + + /** + * Get album art metadata. + * @since 5.0 + * @param aMedia + * @return error ID + */ + TInt GetMediaAlbumArtL( CMPXMedia& aMedia, + const TDesC& aFile ); + + /** + * Add album art to media object. + * @since 5.0 + * @param aMedia + */ + void AddMediaAlbumArtL( CMPXMedia& aMedia, + const TDesC& aFile, + TDesC8& aValue); + +private: + + /** + * Private Two-Phased constuctor. + * @since 3.2.3 + * @param aFs file path. + * @param aAppArc address for the session application information. + * @param array of supported types + */ + CMPXMetadataExtractor( RFs& aFs, RApaLsSession& aAppArc, + RPointerArray& aTypes ); + + void ConstructL(); + +private: // data + CMetaDataUtility* iMetadataUtility; // extract metadata from file + CMPXDrmMediaUtility* iDrmMediaUtility; // extra drm data from file + CMPXFileInfoUtility* iFileInfoUtil; // extract duration/bitrate etc from file + RFs& iFs; + RApaLsSession& iAppArc; + RPointerArray& iSupportedTypes; // not owned + + CThumbnailManager* iTNManager; + CActiveSchedulerWait* iTNSyncWait; // wait loop use to sync thumbnail + CPeriodic* iTimer; // backup timer to stop wait loop + TInt iOutstandingThumbnailRequest; + TInt iTNMBlockCount; + }; + +#endif // CMPXMETADATAEXTRACTOR_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_metadata_extractor_api/tsrc/conf/harvestermetadataextractortest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_metadata_extractor_api/tsrc/conf/harvestermetadataextractortest.cfg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,21 @@ +[Test] +title 1: CMPXMetadataExtractorCreateInstance +create harvestermetadataextractortest foobar +foobar CMPXMetadataExtractorCreateInstance +delete foobar +[Endtest] + +[Test] +title 2: CMPXMetadataExtractorCreateMediaL +create harvestermetadataextractortest foobar +foobar CMPXMetadataExtractorCreateMediaL mpxtest1.mp3 +delete foobar +[Endtest] + +[Test] +title 3: CMPXMetadataExtractorExtractAlbumArtL +create harvestermetadataextractortest foobar +foobar CMPXMetadataExtractorExtractAlbumArtL Waterlilies.jpg +delete foobar +[Endtest] + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_metadata_extractor_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_metadata_extractor_api/tsrc/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007 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 for project mpxharvestertest +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_TESTEXPORTS +// Test sound file + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +#include "../harvestermetadataextractortest/group/bld.inf" + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_metadata_extractor_api/tsrc/harvestermetadataextractortest/Bmarm/harvestermetadataextractortestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_metadata_extractor_api/tsrc/harvestermetadataextractortest/Bmarm/harvestermetadataextractortestU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_metadata_extractor_api/tsrc/harvestermetadataextractortest/Bwins/harvestermetadataextractortestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_metadata_extractor_api/tsrc/harvestermetadataextractortest/Bwins/harvestermetadataextractortestU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_metadata_extractor_api/tsrc/harvestermetadataextractortest/EABI/harvestermetadataextractortestU.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_metadata_extractor_api/tsrc/harvestermetadataextractortest/EABI/harvestermetadataextractortestU.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_metadata_extractor_api/tsrc/harvestermetadataextractortest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_metadata_extractor_api/tsrc/harvestermetadataextractortest/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2002 - 2007 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 +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these +DEFAULT + +PRJ_TESTEXPORTS +// NOTE: If using ARS requirements all export operations should be done under this. +// 'abld test export' + +PRJ_EXPORTS +// Specify the source file followed by its destination here +// copy will be used to copy the source file to its destination +// If there's no destination then the source file will be copied +// to the same name in /epoc32/include +// Example: +/* +/agnmodel/inc/AGMCOMON.H +*/ + +PRJ_TESTMMPFILES +harvestermetadataextractortest.mmp + +PRJ_MMPFILES + +// Specify the .mmp files required for building the important component +// releasables. +// +// Specify "tidy" if the component you need to build doesn't need to be +// released. Specify "ignore" if the MMP file exists but should be +// ignored. +// Example: +/* +/agnmodel/group/agnmodel.mmp +#if defined(MARM) +/agnmodel/group/agsvexe.mmp +#endif +*/ + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_metadata_extractor_api/tsrc/harvestermetadataextractortest/group/harvestermetadataextractortest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_metadata_extractor_api/tsrc/harvestermetadataextractortest/group/harvestermetadataextractortest.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2002 - 2007 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: harvestermetadataextractortest mmp file +* +*/ + + +#if defined(__S60_) + // To get the OS_LAYER_SYSTEMINCLUDE-definition + #include +#endif + +TARGET harvestermetadataextractortest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +/* Remove comments and replace 0x00000000 with correct vendor id */ +// VENDORID 0x00000000 +/* Remove comments and replace 0x00000000 with correct secure id */ +// SECUREID 0x00000000 + +//TARGETPATH ?target_path +DEFFILE harvestermetadataextractortest.def + +MW_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src +SOURCE harvestermetadataextractortest.cpp +SOURCE harvestermetadataextractortestBlocks.cpp + +//RESOURCE resource_file +//RESOURCE resource_file2 +USERINCLUDE ../inc + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY apgrfx.lib +LIBRARY efsrv.lib +LIBRARY mpxcommon.lib +LIBRARY mpxharvesterutility.lib +LIBRARY mpxfilehandler.lib mpxmetadataextractor.lib estor.lib mpxcollectionutility.lib +LIBRARY apmime.lib +LIBRARY bafl.lib +LIBRARY ecom.lib +LIBRARY metadatautility.lib + + +LANG SC + +/* +START WINS +?wins_specific_information +END + +START MARM +?marm_specific_information +END +*/ +// Other possible keywords: + +// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) +/* +START BITMAP ?target +TARGETPATH ?emulated_path_on_target_machine +HEADER +SOURCE ?color_depth ?source_bitmap +END +*/ +// DEFFILE ?filename +// AIF ?filename + +// End of File + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_metadata_extractor_api/tsrc/harvestermetadataextractortest/group/harvestermetadataextractortest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_metadata_extractor_api/tsrc/harvestermetadataextractortest/group/harvestermetadataextractortest.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,63 @@ +; +; 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: Package file for project StifTFW +; +; +; Installation file for STIF +; + +; Languages +&EN + +; Package header +#{"STIF harvestermetadataextractor Test Application"},(0x101F7961),1,1,0,TYPE=SA + +; Localised Vendor name +%{"Nokia EN"} + +; Unique Vendor name +:"Nokia" + +; Logo +; None + +; Package signature - Optional +; None + +; Start of Package body + +; Condition blocks +; None + +; Options list +; None + +; Install files + +"..\..\data\mmc\mpxtest1.mp3" - "e:\testing\data\mpxtest1.mp3" +"..\..\init\TestFramework.ini" - "c:\testframework\TestFramework.ini" +"..\..\conf\harvestermetadataextractortest.cfg" - "c:\testframework\harvestermetadataextractortest.cfg" + +"\epoc32\release\armv5\urel\harvestermetadataextractortest.dll" - "c:\Sys\Bin\harvestermetadataextractortest.dll" + +; Embedded SIS +; None + +; End of Package body + +; PKG dependencies +; None + +; PKG capabilities +; None diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_metadata_extractor_api/tsrc/harvestermetadataextractortest/inc/harvestermetadataextractortest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_metadata_extractor_api/tsrc/harvestermetadataextractortest/inc/harvestermetadataextractortest.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,208 @@ +/* +* Copyright (c) 2002 - 2007 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: test class header file for STIF Test Framework TestScripter +* +*/ + + + +#ifndef HARVESTERMETADATAEXTRACTORTEST_H +#define HARVESTERMETADATAEXTRACTORTEST_H + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//#include +// CONSTANTS +//const ?type ?constant_var = ?constant; + + +// Logging path +#ifdef __WINSCW__ +_LIT( KharvestermetadataextractortestLogPath, "C:\\logs\\testframework\\harvestermetadataextractortest\\" ); +// Log file +_LIT( KharvestermetadataextractortestLogFile, "harvestermetadataextractortest.txt" ); +_LIT( KharvestermetadataextractortestLogFileWithTitle, "harvestermetadataextractortest_[%S].txt" ); +_LIT( KmpxMetadataExtractor_digitalPath, "C:\\testing\\data\\" ); +_LIT( KTestFile, "C:\\Catwalk.aac"); +_LIT( KTestFileMimeType, ".aac" ); +#else +// Log file +_LIT( KharvestermetadataextractortestLogPath, "\\logs\\testframework\\harvestermetadataextractortest\\" ); +// Log file +_LIT( KharvestermetadataextractortestLogFile, "harvestermetadataextractortest.txt" ); +_LIT( KharvestermetadataextractortestLogFileWithTitle, "harvestermetadataextractortest_[%S].txt" ); +_LIT( KmpxMetadataExtractor_digitalPath, "e:\\testing\\data\\" ); +_LIT( KTestFile, "\\Catwalk.aac"); +_LIT( KTestFileMimeType, ".aac" ); + +#endif + + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class Charvestermetadataextractortest; +class MMPXHarvesterUtility; +class MMPXCollectionUtility; +class CMPXMetadataScanner; +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// CLASS DECLARATION + +/** +* Charvestermetadataextractortest test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(Charvestermetadataextractortest) : public CScriptBase, + public MMPXCollectionObserver, + public MMPXHarvesterUtilityObserver + { + private: + enum TExpectedEvents + { + EEventHandlePlaylistExportCompletedL, + EEventHandlePlaylistImportCompletedL, + EEventHandleFileAddCompletedL, + EEventHandleDeleteCompletedL, + EEventHandleFileImportCompletedL, + EEventHandleFileGetMediaCompletedL + }; + + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Charvestermetadataextractortest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Charvestermetadataextractortest(); + + + + + + 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 ); + /** + * From MMPXHarvesterUtilityObserver. + * @since s60 5.0 + */ + virtual void HandlePlaylistExportCompletedL( CMPXMedia* aMedia, TInt aErr ); + virtual void HandlePlaylistImportCompletedL( CMPXMedia* aMedia, TInt aErr ); + virtual void HandleFileAddCompletedL( CMPXMedia* aMedia, TInt aErr ); + virtual void HandleDeleteCompletedL( TInt aErr ); + virtual void HandleFileImportCompletedL( CMPXMedia* aMedia, TInt aErr ); + virtual void HandleFileGetMediaCompletedL( CMPXMedia* aMedia, TInt aErr ); + + /** + * From MMPXCollectionObserver. + * @since s60 5.0 + */ + virtual void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError ); + virtual void HandleCollectionMessage( CMPXMessage* aMsg, TInt aError ); + virtual void HandleOpenL( const CMPXMedia& aEntries, TInt aIndex, TBool aComplete, TInt aError ); + virtual void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, TInt aError ); + + + + + private: + + /** + * C++ default constructor. + */ + Charvestermetadataextractortest( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // ?classname( const ?classname& ); + // Prohibit assigment operator if not deriving from CBase. + // ?classname& operator=( const ?classname& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + /** + * Remove event from the expected event list + * @since S60 5.0 + */ + TBool RemoveExpectedEvent( TExpectedEvents aEvent ); + + /** + * Test methods are listed below. + */ + + virtual TInt ExampleL( CStifItemParser& aItem ); + TInt CMPXMetadataExtractorCreateInstance( CStifItemParser& aItem ); + TInt CMPXMetadataExtractorCreateMediaL( CStifItemParser& aItem ); + TInt CMPXMetadataExtractorExtractAlbumArtL( CStifItemParser& aItem ); + /** + * Method used to log version of test class + */ + + //ADD NEW METHOD DEC HERE + //[TestMethods] - Do not remove + + + private: // Friend classes + //?friend_class_declaration; + CMPXMetadataExtractor* iMetadataExtractor; + MMPXHarvesterUtility* iHarvester; + MMPXCollectionUtility* iCollection; + RArray iExpectedEvents; + TInt iResult; + TDataType iMimeType; + }; + +#endif // HARVESTERMETADATAEXTRACTORTEST_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_metadata_extractor_api/tsrc/harvestermetadataextractortest/src/harvestermetadataextractortest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_metadata_extractor_api/tsrc/harvestermetadataextractortest/src/harvestermetadataextractortest.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,142 @@ +/* +* Copyright (c) 2002 - 2007 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: harvestermetadataextractortest implemetantion for STIF Test Framework TestScripter +* +*/ + + + +// INCLUDE FILES +#include +#include "harvestermetadataextractortest.h" +#include + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Charvestermetadataextractortest::Charvestermetadataextractortest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +Charvestermetadataextractortest::Charvestermetadataextractortest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + iHarvester = NULL; + iCollection = NULL; + } + +// ----------------------------------------------------------------------------- +// Charvestermetadataextractortest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Charvestermetadataextractortest::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(KharvestermetadataextractortestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KharvestermetadataextractortestLogFile); + } + + iLog = CStifLogger::NewL( KharvestermetadataextractortestLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + } + +// ----------------------------------------------------------------------------- +// Charvestermetadataextractortest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Charvestermetadataextractortest* Charvestermetadataextractortest::NewL( + CTestModuleIf& aTestModuleIf ) + { + Charvestermetadataextractortest* self = new (ELeave) Charvestermetadataextractortest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +Charvestermetadataextractortest::~Charvestermetadataextractortest() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + if(NULL != iMetadataExtractor) + { + delete iMetadataExtractor; + iMetadataExtractor = NULL; + } + + + } + + +// ========================== 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* ) Charvestermetadataextractortest::NewL( aTestModuleIf ); + + } + + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_metadata_extractor_api/tsrc/harvestermetadataextractortest/src/harvestermetadataextractortestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_metadata_extractor_api/tsrc/harvestermetadataextractortest/src/harvestermetadataextractortestBlocks.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,467 @@ +/* +* Copyright (c) 2002 - 2007 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: harvestermetadataextractortest block implementation for STIF Test Framework TestScripter +* +*/ + + + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include "harvestermetadataextractortest.h" +#include + +#include +#include +#include +#include +#include +#include + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Charvestermetadataextractortest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Charvestermetadataextractortest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// Charvestermetadataextractortest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Charvestermetadataextractortest::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( "Example", Charvestermetadataextractortest::ExampleL ), + ENTRY( "CMPXMetadataExtractorCreateInstance", Charvestermetadataextractortest::CMPXMetadataExtractorCreateInstance ), + ENTRY( "CMPXMetadataExtractorCreateMediaL", Charvestermetadataextractortest::CMPXMetadataExtractorCreateMediaL ), + ENTRY( "CMPXMetadataExtractorExtractAlbumArtL", Charvestermetadataextractortest::CMPXMetadataExtractorExtractAlbumArtL ), + //ADD NEW ENTRY HERE + // [test cases entries] - Do not remove + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::HandleCollectionMediaL +// --------------------------------------------------------------------------- +// +void Charvestermetadataextractortest::HandleCollectionMediaL( const CMPXMedia& /*aMedia*/, TInt aError ) + { + iLog->Log(_L("Charvestermetadataextractortest::HandleCollectionMediaL: %d"), aError); + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::HandleCollectionMessage +// --------------------------------------------------------------------------- +// +void Charvestermetadataextractortest::HandleCollectionMessage( CMPXMessage* /*aMsg*/, TInt aError ) + { + iLog->Log(_L("Charvestermetadataextractortest::HandleCollectionMessage: %d"), aError); + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::HandleOpenL +// --------------------------------------------------------------------------- +// +void Charvestermetadataextractortest::HandleOpenL( const CMPXMedia& /*aEntries*/, TInt /*aIndex*/, TBool /*aComplete*/, TInt aError ) + { + iLog->Log(_L("Charvestermetadataextractortest::HandleOpenL: %d"), aError); + } +// --------------------------------------------------------------------------- +// Cmpxharvestertest::HandleOpenL +// --------------------------------------------------------------------------- +// +void Charvestermetadataextractortest::HandleOpenL( const CMPXCollectionPlaylist& /*aPlaylist*/, TInt aError ) + { + iLog->Log(_L("Charvestermetadataextractortest::HandleOpenL: %d"), aError); + } + +// --------------------------------------------------------------------------- +// Charvestermetadataextractortest::HandlePlaylistExportCompletedL +// --------------------------------------------------------------------------- +// +void Charvestermetadataextractortest::HandlePlaylistExportCompletedL( CMPXMedia* /*aMedia*/, TInt aErr ) + { + if ( RemoveExpectedEvent(EEventHandlePlaylistExportCompletedL) ) + { + iLog->Log(_L("Charvestermetadataextractortest::HandlePlaylistExportCompletedL: %d [EXPECTED]"), aErr); + } + else + { + iLog->Log(_L("Charvestermetadataextractortest::HandlePlaylistExportCompletedL: %d"), aErr); + } + } + +// --------------------------------------------------------------------------- +// Charvestermetadataextractortest::HandlePlaylistImportCompletedL +// --------------------------------------------------------------------------- +// +void Charvestermetadataextractortest::HandlePlaylistImportCompletedL( CMPXMedia* aMedia, TInt aErr ) + { + if ( RemoveExpectedEvent(EEventHandlePlaylistImportCompletedL) ) + { + iLog->Log(_L("Cmpxharvestertest::HandleFileImportCompletedL: %d [EXPECTED]"), aErr); + } + else + { + iLog->Log(_L("Cmpxharvestertest::HandleFileImportCompletedL: %d"), aErr); + } + + if ( aErr == KErrNone ) + { + iLog->Log(_L("Number of attributes: %d"), aMedia->Count() ); + delete aMedia; + aMedia = NULL; + } + if ( (iResult && (aErr == KErrNone )) || (!iResult && (aErr != KErrNone)) ) + { + Signal(); + } + else + { + Signal(aErr); + } + } + +// --------------------------------------------------------------------------- +// Charvestermetadataextractortest::HandleFileAddCompletedL +// --------------------------------------------------------------------------- +// +void Charvestermetadataextractortest::HandleFileAddCompletedL( CMPXMedia* aMedia, TInt aErr ) + { + if ( RemoveExpectedEvent(EEventHandleFileAddCompletedL) ) + { + iLog->Log(_L("Charvestermetadataextractortest::HandleFileAddCompletedL: %d [EXPECTED]"), aErr); + } + else + { + iLog->Log(_L("Charvestermetadataextractortest::HandleFileAddCompletedL: %d"), aErr); + } + + if ( aErr == KErrNone ) + { + iLog->Log(_L("Number of attributes: %d"), aMedia->Count() ); + delete aMedia; + aMedia = NULL; + } + Signal(); + } + +// --------------------------------------------------------------------------- +// Charvestermetadataextractortest::HandleDeleteCompletedL +// --------------------------------------------------------------------------- +// +void Charvestermetadataextractortest::HandleDeleteCompletedL( TInt aErr ) + { + if ( RemoveExpectedEvent(EEventHandleDeleteCompletedL) ) + { + iLog->Log(_L("Charvestermetadataextractortest::HandleDeleteCompletedL: %d [EXPECTED]"), aErr); + } + else + { + iLog->Log(_L("Charvestermetadataextractortest::HandleDeleteCompletedL: %d"), aErr); + } + + if ( aErr == KErrNone ) + { + Signal(); + } + else + { + Signal(aErr); + } + } + +// --------------------------------------------------------------------------- +// Charvestermetadataextractortest::HandleFileImportCompletedL +// --------------------------------------------------------------------------- +// +void Charvestermetadataextractortest::HandleFileImportCompletedL( CMPXMedia* aMedia, TInt aErr ) + { + if ( RemoveExpectedEvent(EEventHandleFileImportCompletedL) ) + { + iLog->Log(_L("Charvestermetadataextractortest::EEventHandleFileImportCompletedL: %d [EXPECTED]"), aErr); + } + else + { + iLog->Log(_L("Charvestermetadataextractortest::EEventHandleFileImportCompletedL: %d"), aErr); + } + + if ( aErr == KErrNone ) + { + iLog->Log(_L("Number of attributes: %d"), aMedia->Count() ); + delete aMedia; + aMedia = NULL; + } + if ( (iResult && (aErr == KErrNone )) || (!iResult && (aErr != KErrNone)) ) + { + Signal(); + } + else + { + Signal(aErr); + } + } + +// --------------------------------------------------------------------------- +// Charvestermetadataextractortest::HandleFileImportCompletedL +// --------------------------------------------------------------------------- +// +void Charvestermetadataextractortest::HandleFileGetMediaCompletedL( CMPXMedia* aMedia, TInt aErr ) + { + if ( RemoveExpectedEvent(EEventHandleFileGetMediaCompletedL) ) + { + iLog->Log(_L("Charvestermetadataextractortest::HandleFileGetMediaCompletedL: %d [EXPECTED]"), aErr); + } + else + { + iLog->Log(_L("Charvestermetadataextractortest::HandleFileGetMediaCompletedL: %d"), aErr); + } + + if ( aErr == KErrNone ) + { + iLog->Log(_L("Number of attributes: %d"), aMedia->Count() ); + delete aMedia; + aMedia = NULL; + } + Signal(); + + } + + +// ----------------------------------------------------------------------------- +// Charvestermetadataextractortest::RemoveExpectedEvent +// Remove the event from the expected event list +// Returns: ETrue: Event found. +// EFalse: Event not found. +// ----------------------------------------------------------------------------- +TBool Charvestermetadataextractortest::RemoveExpectedEvent( TExpectedEvents aEvent ) + { + iLog->Log(_L("Charvestermetadataextractortest::RemoveExpectedEvent: %d"), aEvent); + TBool match = EFalse; + TInt index = iExpectedEvents.Find(aEvent); + if ( index != KErrNotFound ) + { + iExpectedEvents.Remove(index); + match = ETrue; + } + return match; + } + +// ----------------------------------------------------------------------------- +// Charvestermetadataextractortest::ExampleL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Charvestermetadataextractortest::ExampleL( CStifItemParser& aItem ) + { + + // Print to UI + _LIT( Kharvestermetadataextractortest, "harvestermetadataextractortest" ); + _LIT( KExample, "In Example" ); + TestModuleIf().Printf( 0, Kharvestermetadataextractortest, KExample ); + // Print to log file + iLog->Log( KExample ); + + TInt i = 0; + TPtrC string; + _LIT( KParam, "Param[%i]: %S" ); + while ( aItem.GetNextString ( string ) == KErrNone ) + { + TestModuleIf().Printf( i, Kharvestermetadataextractortest, + KParam, i, &string ); + i++; + } + + return KErrNone; + + } + +// ----------------------------------------------------------------------------- +// Charvestermetadataextractortest::CMPXMetadataExtractorCreateInstance +// CMPXMetadataExtractor::NewL function +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Charvestermetadataextractortest::CMPXMetadataExtractorCreateInstance( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("Charvestermetadataextractortest::CMPXMetadataExtractorCreateInstance")); + TInt err = KErrNone; + RFs fs; + User::LeaveIfError( fs.Connect() ); + RApaLsSession appArcSession; + User::LeaveIfError(appArcSession.Connect()); + RPointerArray dummy; + CleanupClosePushL( dummy ); + + TRAP(err, iMetadataExtractor = CMPXMetadataExtractor::NewL( fs, appArcSession, dummy )); + dummy.ResetAndDestroy(); + CleanupStack::PopAndDestroy( &dummy ); + fs.Close(); + appArcSession.Close(); + + // delete iMetadataExtractor; + if ( iMetadataExtractor != NULL ) + { + delete iMetadataExtractor; + iMetadataExtractor = NULL; + } + + if ( err != KErrNone ) + { + iLog->Log(_L("Error: CMPXMetadataExtractor::CMPXMetadataExtractorCreateInstance returned: %d"), err); + } + return err; + } +// ----------------------------------------------------------------------------- +// Charvestermetadataextractortest::CMPXMetadataExtractorCreateMediaL +// CMPXMetadataExtractor::CreateMediaL +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Charvestermetadataextractortest::CMPXMetadataExtractorCreateMediaL( CStifItemParser& aItem ) + { + iLog->Log(_L("Charvestermetadataextractortest::CreateMediaL")); + + TInt err = KErrNone; + TPtrC string; + while ( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFile; + KFile.Append(KmpxMetadataExtractor_digitalPath); + KFile.Append(string); + + CMPXMedia* media = NULL; + RFile file; + RFs fs; + User::LeaveIfError(fs.Connect()); + file.Open(fs,KFile,EFileStreamText|EFileShareAny); + + RApaLsSession appArcSession; + User::LeaveIfError(appArcSession.Connect()); + + + CMPXCollectionType* collectionType; + collectionType=new(ELeave) CMPXCollectionType(); + + RPointerArray mpxcollectiontypetest; + mpxcollectiontypetest.AppendL(collectionType); + + iMetadataExtractor = CMPXMetadataExtractor::NewL( fs, appArcSession, mpxcollectiontypetest ); + + TRAP(err,iMetadataExtractor->CreateMediaL( KFile, media, ETrue )); + + file.Close(); + fs.Close(); + appArcSession.Close(); + + if ( iMetadataExtractor != NULL ) + { + delete iMetadataExtractor; + iMetadataExtractor = NULL; + } + if ( media != NULL ) + { + delete media; + media = NULL; + } + if ( err != KErrNone ) + { + iLog->Log(_L("Error: CreateMediaL returned: %d"), err); + } + } + return err; + } + + +// ----------------------------------------------------------------------------- +// Charvestermetadataextractortest::CMPXMetadataExtractorExtractAlbumArtL +// CMPXMetadataExtractor::NewL function +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Charvestermetadataextractortest::CMPXMetadataExtractorExtractAlbumArtL( CStifItemParser& aItem ) + { + iLog->Log(_L("Charvestermetadataextractortest::CMPXMetadataExtractorExtractAlbumArtL")); + TInt err = KErrNone; + TPtrC string; + RFs fs; + if ( KErrNone == aItem.GetNextString(string) ) + { + TBuf<120> uri; + uri.Append(KmpxMetadataExtractor_digitalPath); + uri.Append(string); + + User::LeaveIfError( fs.Connect() ); + RApaLsSession apaLsSession; + User::LeaveIfError(apaLsSession.Connect()); + RPointerArray pointArray; + CleanupClosePushL( pointArray ); + + TRAP(err, iMetadataExtractor = CMPXMetadataExtractor::NewL( fs, apaLsSession, pointArray )); + CMPXMedia* media=CMPXMedia::NewL(); + CleanupStack::PushL(media); + media->SetTextValueL(KMPXMediaGeneralUri,uri); +// media->SetTextValueL(KMPXMediaGeneralMimeType,_L("image/jpeg")); + TRAP( err , iMetadataExtractor->ExtractAlbumArtL(media) ); + CleanupStack::PopAndDestroy(media); + pointArray.ResetAndDestroy(); + CleanupStack::PopAndDestroy( &pointArray ); + fs.Close(); + apaLsSession.Close(); + + // delete iMetadataExtractor; + if ( iMetadataExtractor != NULL ) + { + delete iMetadataExtractor; + iMetadataExtractor = NULL; + } + + if ( err != KErrNone ) + { + iLog->Log(_L("Error: CMPXMetadataExtractor::CMPXMetadataExtractorExtractAlbumArtL returned: %d"), err); + } + } + return err; + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= +// None + +// [End of File] - Do not remove diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_metadata_extractor_api/tsrc/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_metadata_extractor_api/tsrc/init/TestFramework.ini Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,170 @@ +# +# This is STIFTestFramework initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. + +[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_harvestermetadataextractortest + +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 + +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +#[New_Module] +#ModuleName= demomodule +#[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +[New_Module] +ModuleName= TestScripter +TestCaseFile= c:\testframework\harvestermetadataextractortest.cfg +[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIFTestFramework logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' + +#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= D:\LOGS\TestFramework\ +#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 + +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_server_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_server_api/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2007 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 +: harvester server definitions API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/mpxharvestercommon.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxharvestercommon.h) +../inc/mpxharvesterserverdefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxharvesterserverdefs.h) diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_server_api/harvester_server_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_server_api/harvester_server_api.metaxml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,14 @@ + + +Harvester Server API +Harvester Server Common Declarations And Definitions +c++ +mmappcomponents + + + + +no +no + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_server_api/inc/mpxharvestercommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_server_api/inc/mpxharvestercommon.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2006 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 declarations +* +*/ + +#ifndef MPX_HARVESTER_COMMON_H +#define MPX_HARVESTER_COMMON_H + +// Constants +const TInt KBatchCommit = 100; // # changes to DB before commit. + + +// Supported server ops +enum TMPXHarvesterServerOp + { + EHvsServerGetBuffer, // Get the current buffer stored in the session + EHvsServerScan, // Initiate a scan of the FS + EHvsServerCancelScan, // Cancel a scan + EHvsServerShutdown, // Shutdown the server + EHvsServerAddFile, // Add an item to the harvester db + EHvsServerAddFileMedia, // Add an item based on a media + EHvsServerRemoveFile, // Remove an item from harvester db + EHvsServerRemoveFiles, // Remove multiple items from the harvester db + EHvsServerRemoveAllFiles, // Remove all songs from harvester db + EHvsServerUpdateFile, // Update a file with new time stamp and collection + EHvsServerRenameFile, // Rename a file + EHvsServerExportPlaylist, // Export a playlist + EHvsServerImportPlaylist, // Import a playlist + EHvsServerFindColID, // Find the collection ID for an item + EHvsServerReqAttr, // Query the required attributes for tracks for a playlist type + EHvsServerOptAttr, // Query the optional attributes for tracks for a playlist type + EHvsServerPlaylistFileExt,// Get file extension of a playlist plugin + EHvsServerIsPlaylist, // Test if a file is a playlist + EHvsServerImportFile, // Import a "file" + EHvsServerReCreateDB, // Delete the old databases and re-create from fresh + EHvsServerCheckSystemEvent, // Check for system events and broadcast if any are active + EHvsServerGetMedia, // Get a media for the file + EHvsServerGetColUid, // Get a collection id for the file + EHvsServerCloseTransaction, // Close the database transaction + EHvsServerOpCount + }; + +// System events +enum TSystemEvent + { + // This should be a 1:1 mapping to TMPXCollectionBroadCastMsg events + // for easy conversion + // check mpxcollectionframeworkdefs.h + // + EFormatStartEvent, // Start of a formatting event + EFormatEndEvent, // End of a formatting event + EDiskRemovedEvent, // Disk removed event + EDiskInsertedEvent, // Disk Inserted event + EUSBMassStorageStartEvent, // USB Mass storage started event + EUSBMassStorageEndEvent, // USB Mass storage ended event + EUSBMTPStartEvent, // MTP start event + EUSBMTPEndEvent, // MTP end event + EUSBMTPNotActiveEvent, // MTP selected but not active + ESystemEventMax, // End of event enum + EPowerKeyEjectEvent // Power key eject mmc + }; + +#endif // MPX_HARVESTER_COMMON_H + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_server_api/inc/mpxharvesterserverdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_server_api/inc/mpxharvesterserverdefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2007 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 Server common definitions +* +*/ + + +#ifndef MPXHARVESTERSERVERDEFS_H +#define MPXHARVESTERSERVERDEFS_H + +// Server name +_LIT(KMPXHarvesterServerName,"MPXHarvesterServer"); +_LIT(KMPXHarvesterServerImg,"mpxharvesterserver"); // DLL/EXE name + +// UID +const TUid KMPXCollectionServerUid3={0x101FFCA9}; + +// Server version number +const TUint KMPXHarvesterServerMajorVersionNumber=1; +const TUint KMPXHarvesterServerMinorVersionNumber=0; +const TUint KMPXHarvesterServerBuildVersionNumber=0; + +#endif // MPXHARVESTERSERVERDEFS_H + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_utility_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_utility_api/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2007 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 +: harvester utilities API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../inc/mpxharvesterutility.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxharvesterutility.h) +../inc/mpxharvesterutilityobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxharvesterutilityobserver.h) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_utility_api/harvester_utility_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_utility_api/harvester_utility_api.metaxml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,15 @@ + + +Harvester Utility API +Provides Utility APIs to the harvester server +c++ +mmappcomponents + + + + + +no +no + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_utility_api/inc/mpxharvesterutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_utility_api/inc/mpxharvesterutility.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,344 @@ +/* +* Copyright (c) 2006 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 utility library +* +*/ + + +#ifndef MMPXHARVESTERUTILITY_H +#define MMPXHARVESTERUTILITY_H + +#include + +// FOWARD DECLARATION +class CMPXMedia; +class TMPXAttribute; +class MMPXHarvesterUtilityObserver; + +/** + * Harvester Utility + * + * Utility class to the harvester server + * + * @lib mpxharvesterutility.lib + */ +class MMPXHarvesterUtility + { + +public: // New Functions + + /** + * Initiates a scan for new files on all drives. + * All files are added to the collection. + * Scan results are broadcasted through the collection framework. + * + * @since S60 3.0 + */ + virtual void ScanL() = 0; + + /** + * Cancels a scan to refresh the db. + * + * @since S60 3.0 + */ + virtual void CancelScanL() = 0; + + /** + * Shutdown the server. + * + * @since S60 3.0 + * @note test function only!! shuts down the harvester server immediately + */ + virtual void ShutdownL() = 0; + + /** + * Add a single song. + * This method is asynchronous and will call back via the observer interface. + * + * @since S60 3.0 + * @note S60 metadata utility is REALLY slow, so this has to be async + * @param aFilePath path to the song to be added + * @param aObs observer to the add file event + */ + virtual void AddFileL( const TDesC& aFilePath, MMPXHarvesterUtilityObserver* aObs ) = 0; + + /** + * Add a media property. + * + * @since S60 3.0 + * @param aMedia media to add + * @return collection ID for this media + */ + virtual TInt AddFileL( CMPXMedia*& aMedia ) = 0; + + /** + * Remove a single song. + * + * @since S60 3.0 + * @param aFilePath path to the song to be removed + * @return collection ID for the item + */ + virtual TInt RemoveFileL( const TDesC& aFilePath ) = 0; + + /** + * Remove a list of songs. + * + * @since S60 3.0 + * @param aArray list of songs to remove + */ + virtual void RemoveFilesL( const MDesCArray& aFilesArray ) = 0; + + /** + * Remove all songs from the harvester. + * + * @since S60 3.0 + */ + virtual void RemoveAllFilesL() = 0; + + /** + * Recreate all databases (deletes old). + * Used to handle db corruption by deleting and re-starting. + * + * @since S60 3.0 + */ + virtual void RecreateDatabasesL() = 0; + + /** + * Remove a single song. + * This Method is asynchronous and will call back to observer interface. + * + * @since S60 3.0 + * @param aFilePath path to the song to be removed + * @param aObs observer to the delete event + */ + virtual void DeleteFileL( const TDesC& aFilePath, MMPXHarvesterUtilityObserver* aObs ) = 0; + + /** + * Remove a list of songs. + * This method is asynchronous and will call back to observer interface. + * + * @since S60 3.0 + * @param aArray list of songs to remove + * @param aObs observer to the delete event + */ + virtual void DeleteFilesL( const MDesCArray& aArray, MMPXHarvesterUtilityObserver* aObs ) = 0; + + /** + * Remove a list of songs. + * This method is asynchronous and will call back to observer interface. + * + * @since S60 3.0 + * @param aArray list of songs to remove + */ + virtual void DeleteFilesL( const MDesCArray& aArray ) = 0; + + /** + * Update the collection id column in the harvester for a media. + * + * @since S60 3.0 + * @param aMedia media object containing the item to updates + */ + virtual void UpdateFileL( CMPXMedia*& aProperty ) = 0; + + /** + * Rename file for the given media. + * + * @since S60 3.0 + * @param aMedia media to be renamed + * @return new URI of the renamed file + */ + virtual HBufC* RenameFileLC( const CMPXMedia& aMedia ) = 0; + + /** + * Rename file. + * + * @since S60 3.0 + * @param aOldUri existing URI + * @param aNewUri new URI + * @param aCollection collection Id of the collection the file belongs to + */ + virtual void RenameFileL( const TDesC& aOldUri, + const TDesC& aNewUri, + TInt aCollection ) = 0; + + /** + * Finds the collection ID based on a File name. + * + * @since S60 3.0 + * @param aFile file name to lookup + * @return the collection ID + */ + virtual TInt FindCollectionIdL( const TDesC& aFile ) = 0; + + /** + * Export a Media property as a playlist (Asynchronous). + * Note that this utility does not have a task queue, + * The user can ONLY execute 1 async op at a time! + * This method is asynchronous and will call back via the observer interface. + * + * @since S60 3.0 + * @param aProp CMPXMedia object to contain the "list" of items + * @param aPath path and filename + * @param aPlaylistType playlist type, default to M3U + * @param aObs observer for async callback + */ + virtual void ExportPlaylistL( const CMPXMedia& aProp, + const TDesC& aPath, + TInt aPlaylistType, + MMPXHarvesterUtilityObserver* aObs ) = 0; + + /** + * Import a playlist from a file (Asynchronous). + * This method is asynchronous and will call back via the observer interface. + * + * @since S60 3.0 + */ + virtual void ImportPlaylistL( const TDesC& aFilename, + MMPXHarvesterUtilityObserver* aObs ) = 0; + + /** + * Imports a "file" in general (Async). + * File is not added to any databases. + * + * @since S60 3.0 + * @param aFileName file to import + * @param aObs observer for the import event + */ + virtual void ImportFileL( const TDesC& aFilename, + MMPXHarvesterUtilityObserver* aObs ) = 0; + + /** + * Query the required attributes for tracks for the specified playlist type. + * + * @since S60 3.0 + * @param aPlaylistType playlist type for this query + * @param aRequiredAttributes out parameter, an array of required attributes + * of the specified playlist type + */ + virtual void RequiredAttributesL( TInt aPlaylistType, + RArray& aRequiredAttributes ) = 0; + + /** + * Query the optional attributes for tracks for the specified playlist type. + * + * @since S60 3.0 + * @param aPlaylistType playlist type for this query + * @param aOptionalAttributes out parameter, an array of optional attributes + * of the specified playlist type + */ + virtual void OptionalAttributesL( TInt aPlaylistType, + RArray& aOptionalAttributes ) = 0; + + /* + * Query the file extension of playlist of the specified type. + * + * @since S60 3.0 + * @param aPlaylistType playlist type for this query + * @return playlist file extension of the specified playlist type, + * this includes the period. ownership transferred + */ + virtual HBufC* PlaylistFileExtensionLC( TInt aPlaylistType ) = 0; + + /** + * Determines whether the given file is a playlist from available + * playlist plugins currently in the system. The existence of the + * file is not part of this validation process. + * + * An unsupported playlist file is tested as EFalse. But after the + * appropriate playlist plugin has been installed, the client can + * retest it and ETrue will be returned. + * + * @since S60 3.0 + * @param aUri URI of the media to be tested + * @return ETrue if it's a playlist; otherwise EFalse. + */ + virtual TBool IsPlaylistL( const TDesC& aUri ) = 0; + + /** + * Sends a message to the harvester server to poll for any + * system events. If there is a sytem event happening, + * It will notify the rest of the MPX framework. + * This is used for process start up to query for any on-going events. + * + * @since S60 3.0 + */ + virtual void CheckForSystemEventsL() = 0; + + /** + * Closes the utility and deletes the object. + * + * @since S60 3.0 + */ + virtual void Close() = 0; + + /** + * Get a media object for the file. + * This method is asynchronous and will call back via the observer interface. + * + * @since S60 3.0 + * @note S60 metadata utility is REALLY slow, so this has to be async + * @param aFilePath path to the song to be added + * @param aObs observer to the add file event + */ + virtual void GetMediaForFileL( const TDesC& aFilePath, + MMPXHarvesterUtilityObserver* aObs ) = 0; + + /** + * Get a collection ID for the file. + * + * @since S60 3.0 + * @param aMedia media to add + * @return collection ID for this media + */ + virtual TInt GetColUidForFileL( const TDesC& aFilePath ) = 0; + + /** + * Remove a list of songs. + * This method is asynchronous and will call back to observer interface. + * Method is not pure virtual for backward compatibility. + * + * @since S60 3.2.3 + * @param aArray list of songs to remove + * @param aEndTransaction ETrue to end current database transaction + */ + virtual void DeleteFilesL( const MDesCArray& /*aArray*/, TBool /*aEndTransaction*/ ){}; + + /** + * Close the transaction. + * This method is synchronous. + * Method is not pure virtual for backward compatibility. + * + * @since S60 3.2.3 + */ + virtual void CloseTransactionL(){}; + + }; + +/** + * Utility Factory class to create the utility + * + * @lib harvester utility + */ +class CMPXHarvesterFactory : CBase + { +public: + /** + * Factory function to create the utility + * + * @since S60 3.0 + */ + IMPORT_C static MMPXHarvesterUtility* NewL(); + }; + +#endif // MMPXHARVESTERUTILITY_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_utility_api/inc/mpxharvesterutilityobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_utility_api/inc/mpxharvesterutilityobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2006 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 Utility observer +* +*/ + + +#ifndef MMPXHARVESTERUTILITYOBSERVER_H +#define MMPXHARVESTERUTILITYOBSERVER_H + +/** + * Observer to the harvester utility, for async calls + * + * @lib mpxharvesterutility.lib + */ +NONSHARABLE_CLASS(MMPXHarvesterUtilityObserver) + { + +public: + + /** + * Callback from method MMPXHarvesterUtility::ExportPlaylistL(). + * Handles completion of playlist export. observer assumed + * ownership of aMedia. + * + * @since S60 3.0 + * @param aMedia media object containing the playlist + * aMedia is NULL if aErr != KErrNone + * @param aErr error code for the operation + */ + virtual void HandlePlaylistExportCompletedL( CMPXMedia* aMedia, TInt aErr ) = 0; + + /** + * Callback from method MMPXHarvesterUtility::ImportPlaylist(). + * Handles completion of playlist import. + * + * @since S60 3.0 + * @param aMedia media parsed from the playlist file, observer + * assumes ownership of this media + * aMedia is NULL if the aErr != KErrNone + * @param aErr error code for the operation + */ + virtual void HandlePlaylistImportCompletedL( CMPXMedia* aMedia, + TInt aErr ) = 0; + + /** + * Callback from method MMPXHarvesterUtility:: AddFileL(). + * Handle asynchronous file addition by file name, observer + * assumes ownership of aMedia. + * + * @since S60 3.0 + * @param aMedia media object containing the media details of the file + * aMedia is NULL if aErr != KErrNone + * @param aErr error code for the operation + */ + virtual void HandleFileAddCompletedL( CMPXMedia* aMedia, + TInt aErr ) = 0; + + /** + * Callback from method MMPXHarvesterUtility::DeleteFilesL(). + * Handle file delete completion. + * + * @since S60 3.0 + * @param aErr error code for the operation + */ + virtual void HandleDeleteCompletedL( TInt aErr ) = 0; + + /** + * Callback from method MMPXHarvesterUtility::ImportFileL(). + * Handle file import completion. + * + * @since S60 3.0 + * @param aMedia media object containing the media details of the file + * aMedia is NULL if aErr != KErrNone + * @param aErr error code for the operation + */ + virtual void HandleFileImportCompletedL( CMPXMedia* aMedia, TInt aErr ) = 0; + + /** + * Callback from method MMPXHarvesterUtility::GetMediaForFileL(). + * Handle asynchronous media creation by file name, observer + * assumes ownership of aMedia. + * + * @since S60 3.0 + * @param aMedia media object containing the media details of the file + * aMedia is NULL if aErr != KErrNone + * @param aErr error code for the operation + */ + virtual void HandleFileGetMediaCompletedL( CMPXMedia* aMedia, TInt aErr ) = 0; + + }; + + +#endif // MMPXHARVESTERUTILITYOBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_utility_api/tsrc/Conf/mpxharvestertest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_utility_api/tsrc/Conf/mpxharvestertest.cfg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,336 @@ +/*[Test] +title Example +create mpxharvestertest foobar +foobar Example pa ra me ters +delete foobar +[Endtest] +*/ + +[Test] +title Create Harvester Utility +create mpxharvestertest utility +utility CreateUtility +delete utility +pause 1000 +[Endtest] + +[Test] +title Scan for new files +create mpxharvestertest utility +utility CreateUtility +utility Scan +pause 20000 +utility VerifyEvents +delete utility +pause 1000 +[Endtest] + +[Test] +title Cancel scan +create mpxharvestertest utility +utility CreateUtility +utility Scan +pause 1000 +utility CancelScan +utility VerifyEvents +delete utility +pause 1000 +[Endtest] + +[Test] +title Add file +create mpxharvestertest utility +utility CopyTestFile mpxtest1.mp3 +utility CreateUtility +utility AddFileByPath mpxtest1.mp3 +waittestclass utility +utility DeleteTestFile mpxtest1.mp3 +utility VerifyEvents +delete utility +pause 1000 +[Endtest] + +[Test] +title Remove file +create mpxharvestertest utility +utility CopyTestFile mpxtest1.mp3 +utility CreateUtility +utility AddFileByPath mpxtest1.mp3 +waittestclass utility +utility RemoveFile mpxtest1.mp3 +utility DeleteTestFile mpxtest1.mp3 +utility VerifyEvents +delete utility +pause 1000 +[Endtest] + +[Test] +title Remove files +create mpxharvestertest utility +utility CopyTestFile mpxtest1.mp3 mpxtest2.mp3 +utility CreateUtility +utility AddFileByPath mpxtest1.mp3 +waittestclass utility +utility AddFileByPath mpxtest2.mp3 +waittestclass utility +utility RemoveFiles mpxtest1.mp3 mpxtest2.mp3 +utility DeleteTestFile mpxtest1.mp3 mpxtest2.mp3 +utility VerifyEvents +delete utility +pause 1000 +[Endtest] + +[Test] +title Remove all files +create mpxharvestertest utility +utility CopyTestFile mpxtest1.mp3 mpxtest2.mp3 +utility CreateUtility +utility AddFileByPath mpxtest1.mp3 +waittestclass utility +utility AddFileByPath mpxtest2.mp3 +waittestclass utility +utility RemoveFiles all +utility DeleteTestFile mpxtest1.mp3 mpxtest2.mp3 +utility VerifyEvents +delete utility +pause 1000 +[Endtest] + +[Test] +title Recreate databases +create mpxharvestertest utility +utility CreateUtility +utility RecreateDatabases +pause 5000 +utility VerifyEvents +delete utility +pause 1000 +[Endtest] + +[Test] +title Delete file +create mpxharvestertest utility +utility CopyTestFile mpxtest1.mp3 +pause 2000 +utility CreateUtility +utility AddFileByPath mpxtest1.mp3 +waittestclass utility +utility DeleteFile mpxtest1.mp3 +waittestclass utility +utility VerifyEvents +delete utility +pause 1000 +[Endtest] + +[Test] +title Delete files asynchronously +create mpxharvestertest utility +utility CopyTestFile mpxtest1.mp3 mpxtest2.mp3 +pause 2000 +utility CreateUtility +utility AddFileByPath mpxtest1.mp3 +waittestclass utility +utility AddFileByPath mpxtest2.mp3 +waittestclass utility +utility DeleteFiles async mpxtest1.mp3 mpxtest2.mp3 +waittestclass utility +utility VerifyEvents +delete utility +pause 1000 +[Endtest] + +[Test] +title Delete files synchronously +create mpxharvestertest utility +pause 2000 +utility CopyTestFile mpxtest1.mp3 mpxtest2.mp3 +utility CreateUtility +utility AddFileByPath mpxtest1.mp3 +waittestclass utility +utility AddFileByPath mpxtest2.mp3 +waittestclass utility +utility DeleteFiles sync mpxtest1.mp3 mpxtest2.mp3 +utility VerifyEvents +delete utility +pause 1000 +[Endtest] + +[Test] +title Find collection id +create mpxharvestertest utility +utility CopyTestFile mpxtest1.mp3 +utility CreateUtility +utility AddFileByPath mpxtest1.mp3 +waittestclass utility +utility FindCollectionId mpxtest1.mp3 +utility RemoveFile mpxtest1.mp3 +utility DeleteTestFile mpxtest1.mp3 +utility VerifyEvents +delete utility +pause 1000 +[Endtest] + +[Test] +title Rename file +create mpxharvestertest utility +utility CopyTestFile mpxtest1.mp3 +utility CreateUtility +utility AddFileByPath mpxtest1.mp3 +waittestclass utility +utility RenameFileByPath mpxtest1.mp3 mpxtest3.mp3 +pause 2000 +utility RemoveFile mpxtest3.mp3 +utility DeleteTestFile mpxtest1.mp3 +utility VerifyEvents +delete utility +pause 1000 +[Endtest] + +[Test] +title It is a playlist +create mpxharvestertest utility +utility CopyTestFile mpxtestplaylist.m3u +utility CreateUtility +utility IsPlaylist mpxtestplaylist.m3u true +pause 2000 +utility DeleteTestFile mpxtestplaylist.m3u +utility VerifyEvents +delete utility +pause 1000 +[Endtest] + +[Test] +title It is not a playlist +create mpxharvestertest utility +utility CopyTestFile mpxtest1.mp3 +utility CreateUtility +utility IsPlaylist mpxtest1.mp3 false +pause 2000 +utility DeleteTestFile mpxtest1.mp3 +utility VerifyEvents +delete utility +pause 1000 +[Endtest] + +[Test] +title Import playlist successfully +create mpxharvestertest utility +utility CopyTestFile mpxtestplaylist.m3u +utility CreateUtility +utility ImportPlaylist mpxtestplaylist.m3u true +waittestclass utility +utility DeleteTestFile mpxtestplaylist.m3u +utility VerifyEvents +delete utility +pause 1000 +[Endtest] + +[Test] +title Import playlist (mp3) +create mpxharvestertest utility +utility CopyTestFile mpxtest1.mp3 +utility CreateUtility +utility ImportPlaylist mpxtest1.mp3 false +waittestclass utility +utility DeleteTestFile mpxtest1.mp3 +utility VerifyEvents +delete utility +pause 1000 +[Endtest] + +[Test] +title Import playlist (doesn't exist) +create mpxharvestertest utility +utility CreateUtility +utility ImportPlaylist mpxtestplaylist.m3u false +waittestclass utility +utility VerifyEvents +delete utility +pause 1000 +[Endtest] + +[Test] +title Import file (playlist) successfully +create mpxharvestertest utility +utility CopyTestFile mpxtestplaylist.m3u +utility CreateUtility +utility ImportFile mpxtestplaylist.m3u true +waittestclass utility +utility DeleteTestFile mpxtestplaylist.m3u +utility VerifyEvents +delete utility +pause 1000 +[Endtest] + +[Test] +title Import file (mp3) successfully +create mpxharvestertest utility +utility CopyTestFile mpxtest1.mp3 +utility CreateUtility +utility ImportFile mpxtest1.mp3 true +waittestclass utility +utility DeleteTestFile mpxtest1.mp3 +utility VerifyEvents +delete utility +pause 1000 +[Endtest] + +[Test] +title Import file (doesn't exist) +create mpxharvestertest utility +utility CreateUtility +utility ImportFile mpxtest1.mp3 false +waittestclass utility +utility VerifyEvents +delete utility +pause 1000 +[Endtest] + +[Test] +title Required attributes M3U +create mpxharvestertest utility +utility CreateUtility +utility RequiredAttributes M3U +delete utility +pause 1000 +[Endtest] + +[Test] +title Optional attributes M3U +create mpxharvestertest utility +utility CreateUtility +utility OptionalAttributes M3U +delete utility +pause 1000 +[Endtest] + +[Test] +title PlaylistFileExtension M3U +create mpxharvestertest utility +utility CreateUtility +utility PlaylistFileExtension M3U +delete utility +pause 1000 +[Endtest] + +/* +// PLA is not supported yet +[Test] +title PlaylistFileExtension PLA +create mpxharvestertest utility +utility CreateUtility +utility PlaylistFileExtension PLA +delete utility +pause 1000 +[Endtest] +*/ + +[Test] +title CheckForSystemEvents +create mpxharvestertest utility +utility CreateUtility +utility CheckForSystemEvents +delete utility +pause 1000 +[Endtest] + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_utility_api/tsrc/Group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_utility_api/tsrc/Group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2007 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 for project mpxharvestertest +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_TESTEXPORTS +// Test sound file +../data/mmc/mpxtest1.mp3 /epoc32/winscw/c/testing/data/mpxtest1.mp3 +../data/mmc/mpxtest2.mp3 /epoc32/winscw/c/testing/data/mpxtest2.mp3 +../data/mmc/mpxtestplaylist.m3u /epoc32/winscw/c/testing/data/mpxtestplaylist.m3u + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +#include "../mpxharvestertest/group/bld.inf" + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_utility_api/tsrc/Init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_utility_api/tsrc/Init/TestFramework.ini Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,197 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[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_mpxharvestertest + +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= 0 # Default timeout value for each test case. In milliseconds +UITestingSupport= YES +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +[New_Module] +ModuleName= testscripter +TestCaseFile= c:\testframework\mpxharvestertest.cfg +[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[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= D:\LOGS\TestFramework\ +#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 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_utility_api/tsrc/mpxharvestertest/Bwins/mpxharvestertestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_utility_api/tsrc/mpxharvestertest/Bwins/mpxharvestertestu.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_utility_api/tsrc/mpxharvestertest/EABI/mpxharvestertestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_utility_api/tsrc/mpxharvestertest/EABI/mpxharvestertestu.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_utility_api/tsrc/mpxharvestertest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_utility_api/tsrc/mpxharvestertest/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2007 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 for project mpxharvestertest +* +*/ + + +PRJ_PLATFORMS +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these +DEFAULT + +PRJ_TESTEXPORTS +// NOTE: If using ARS requirements all export operations should be done under this. +// 'abld test export' + +PRJ_EXPORTS + +PRJ_TESTMMPFILES +// NOTE: If using ARS requirements .mmp file operation should be done under this. +// 'abld test build' + +mpxharvestertest.mmp + +PRJ_MMPFILES +// Specify the .mmp files required for building the important component +// releasables. +// +// Specify "tidy" if the component you need to build doesn't need to be +// released. Specify "ignore" if the MMP file exists but should be +// ignored. +// Example: +/* +/agnmodel/group/agnmodel.mmp +#if defined(MARM) +/agnmodel/group/agsvexe.mmp +#endif +*/ + + +// End of File \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_utility_api/tsrc/mpxharvestertest/group/mpxharvestertest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_utility_api/tsrc/mpxharvestertest/group/mpxharvestertest.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,49 @@ +/* +* 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: Project definition file for project mpxharvestertest +* +*/ + + +#include + +TARGET mpxharvestertest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +VENDORID VID_DEFAULT + +DEFFILE mpxharvestertest.def + +SOURCEPATH ../src +SOURCE mpxharvestertest.cpp +SOURCE mpxharvestertestBlocks.cpp + +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY mpxharvesterutility.lib +LIBRARY mpxcommon.lib +LIBRARY mpxcollectionutility.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib + +LANG SC + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_utility_api/tsrc/mpxharvestertest/group/mpxharvestertest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_utility_api/tsrc/mpxharvestertest/group/mpxharvestertest.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -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: Package file for project StifTFW +; +;mpxharvestertest.pkg + +;languages +&EN + +;Header +#{"StifTFW"},(0x101FB3E3),1,1,0,TYPE=SA + +;Localised Vendor name +%{"MPXHarvesterStif"} + +;Unique Vendor name +:"Vendor" + +;Files to install +"..\..\data\mmc\mpxtest2.mp3" - "e:\testing\data\mpxtest2.mp3" +"..\..\data\mmc\mpxtest1.mp3" - "e:\testing\data\mpxtest1.mp3" +"..\..\data\mmc\mpxtestplaylist.m3u" - "e:\testing\data\mpxtestplaylist.m3u" +"..\..\conf\mpxharvestertest.cfg" - "c:\testframework\mpxharvestertest.cfg" +"..\..\init\TestFramework.ini" - "c:\testframework\TestFramework.ini" + +"\epoc32\release\armv5\urel\mpxharvestertest.dll" - "c:\Sys\Bin\mpxharvestertest.dll" + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_utility_api/tsrc/mpxharvestertest/inc/mpxharvestertest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_utility_api/tsrc/mpxharvestertest/inc/mpxharvestertest.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,213 @@ +/* +* Copyright (c) 2007 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: STIF testing for MPX Harvester +* +*/ + + +#ifndef MPXHARVESTERTEST_H +#define MPXHARVESTERTEST_H + +// INCLUDES +#include +#include +#include + +#include +#include +#include +#include + +// CONSTANTS +const TInt KErrBadTestParameter= -1000; // Error on configuration file + +// MACROS +// Logging path +#ifdef __WINSCW__ +_LIT( KmpxharvestertestLogPath, "\\testing\\log\\" ); +_LIT( Kmpxharvester_testPath, "\\testing\\data\\" ); +_LIT( Kmpxharvester_soundsPath, "c:\\data\\sounds\\" ); +_LIT( Kmpxharvester_digitalPath, "c:\\data\\sounds\\digital\\" ); +#else +_LIT( KmpxharvestertestLogPath, "e:\\testing\\log\\" ); +_LIT( Kmpxharvester_testPath, "e:\\testing\\data\\" ); +_LIT( Kmpxharvester_soundsPath, "e:\\sounds\\" ); +_LIT( Kmpxharvester_digitalPath, "e:\\sounds\\digital\\" ); +#endif +// Log file +_LIT( KmpxharvestertestLogFile, "mpxharvestertest.txt" ); + +_LIT( KTagTestfile1, "mpxtest1.mp3" ); +_LIT( KTagTestfile2, "mpxtest2.mp3" ); +_LIT( KTagAll, "all" ); +_LIT( KTagSync, "sync" ); +_LIT( KTagAsync, "async" ); +_LIT( KTagTrue, "true" ); +_LIT( KTagFalse, "false" ); +_LIT( KTagM3U, "M3U" ); +_LIT( KTagPLA, "PLA" ); +_LIT( KTagMPV, "MPV" ); +_LIT( KTagXSPF, "XSPF" ); +_LIT( KTagXML, "XML" ); + +// FORWARD DECLARATIONS +class Cmpxharvestertest; +class MMPXHarvesterUtility; +class MMPXCollectionUtility; + +// CLASS DECLARATION + +/** +* Cmpxharvestertest test class for STIF Test Framework TestScripter. +* +* @lib mpxharvestertest.lib +* @since s60 5.0 +*/ +NONSHARABLE_CLASS(Cmpxharvestertest) : public CScriptBase, + public MMPXHarvesterUtilityObserver, + public MMPXCollectionObserver + { +private: + enum TExpectedEvents + { + EEventHandlePlaylistExportCompletedL, + EEventHandlePlaylistImportCompletedL, + EEventHandleFileAddCompletedL, + EEventHandleDeleteCompletedL, + EEventHandleFileImportCompletedL, + EEventHandleFileGetMediaCompletedL + }; + +public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Cmpxharvestertest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Cmpxharvestertest(); + +public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since s60 5.0 + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ); + + /** + * From MMPXHarvesterUtilityObserver. + * @since s60 5.0 + */ + virtual void HandlePlaylistExportCompletedL( CMPXMedia* aMedia, TInt aErr ); + virtual void HandlePlaylistImportCompletedL( CMPXMedia* aMedia, TInt aErr ); + virtual void HandleFileAddCompletedL( CMPXMedia* aMedia, TInt aErr ); + virtual void HandleDeleteCompletedL( TInt aErr ); + virtual void HandleFileImportCompletedL( CMPXMedia* aMedia, TInt aErr ); + virtual void HandleFileGetMediaCompletedL( CMPXMedia* aMedia, TInt aErr ); + + /** + * From MMPXCollectionObserver. + * @since s60 5.0 + */ + virtual void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError ); + virtual void HandleCollectionMessage( CMPXMessage* aMsg, TInt aError ); + virtual void HandleOpenL( const CMPXMedia& aEntries, TInt aIndex, TBool aComplete, TInt aError ); + virtual void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, TInt aError ); + +private: + + /** + * C++ default constructor. + */ + Cmpxharvestertest( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Frees all resources allocated from test methods. + * @since s60 5.0 + */ + void Delete(); + + /** + * Add event to the expected event list + * @since S60 5.0 + */ + void AddExpectedEvent( TExpectedEvents aEvent ); + + /** + * Remove event from the expected event list + * @since S60 5.0 + */ + TBool RemoveExpectedEvent( TExpectedEvents aEvent ); + + /** + * Test methods are listed below. + */ + + /** + * Example test method. + * @since s60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt ExampleL( CStifItemParser& aItem ); + //ADD NEW METHOD DEC HERE + + TInt CreateUtility( CStifItemParser& aItem ); + TInt CopyTestFile( CStifItemParser& aItem ); + TInt DeleteTestFile( CStifItemParser& aItem ); + TInt VerifyEvents( CStifItemParser& aItem ); + TInt Scan( CStifItemParser& aItem ); + TInt CancelScan( CStifItemParser& aItem ); + TInt AddFileByPath( CStifItemParser& aItem ); +// TInt AddFileByMedia( CStifItemParser& aItem ); + TInt RemoveFile( CStifItemParser& aItem ); + TInt RemoveFiles( CStifItemParser& aItem ); + TInt RecreateDatabases( CStifItemParser& aItem ); + TInt DeleteFile( CStifItemParser& aItem ); + TInt DeleteFiles( CStifItemParser& aItem ); +// TInt UpdateFile( CStifItemParser& aItem ); + TInt FindCollectionId( CStifItemParser& aItem ); +// TInt RenameFileByMedia( CStifItemParser& aItem ); + TInt RenameFileByPath( CStifItemParser& aItem ); +// TInt ExportPlaylist( CStifItemParser& aItem ); + TInt ImportPlaylist( CStifItemParser& aItem ); + TInt ImportFile( CStifItemParser& aItem ); + TInt RequiredAttributes( CStifItemParser& aItem ); + TInt OptionalAttributes( CStifItemParser& aItem ); + TInt PlaylistFileExtension( CStifItemParser& aItem ); + TInt IsPlaylist( CStifItemParser& aItem ); + TInt CheckForSystemEvents( CStifItemParser& aItem ); + +private: // Data + MMPXHarvesterUtility* iHarvester; + MMPXCollectionUtility* iCollection; + RFs iFs; + CFileMan* iFileMan; + TInt iResult; + // List of expected events + RArray iExpectedEvents; + }; + +#endif // MPXHARVESTERTEST_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_utility_api/tsrc/mpxharvestertest/src/mpxharvestertest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_utility_api/tsrc/mpxharvestertest/src/mpxharvestertest.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2007 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: STIF testing for MPX Harvester +* +*/ + + +// INCLUDE FILES +#include +#include +#include "mpxharvestertest.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::Cmpxharvestertest +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +Cmpxharvestertest::Cmpxharvestertest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + iHarvester = NULL; + iCollection = NULL; + iFileMan = NULL; + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::ConstructL +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void Cmpxharvestertest::ConstructL() + { + iLog = CStifLogger::NewL( KmpxharvestertestLogPath, + KmpxharvestertestLogFile, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + User::LeaveIfError( iFs.Connect() ); + iFileMan = CFileMan::NewL(iFs); + + TBool err = KErrNone; + err = iFs.MkDir(Kmpxharvester_soundsPath); + if ( err == KErrNone || err == KErrAlreadyExists ) + { + err = iFs.MkDir(Kmpxharvester_digitalPath); + if ( err != KErrNone && err != KErrAlreadyExists ) + { + User::Leave(err); + } + } + else + { + User::Leave(err); + } + + // Print title of the test case + TName title; + TestModuleIf().GetTestCaseTitleL(title); + iLog->Log(_L(" ")); + iLog->Log(_L("[Title] %S"), &title); + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::NewL +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +Cmpxharvestertest* Cmpxharvestertest::NewL( + CTestModuleIf& aTestModuleIf ) + { + Cmpxharvestertest* self = new (ELeave) Cmpxharvestertest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// Destructor +Cmpxharvestertest::~Cmpxharvestertest() + { + // Delete resources allocated from test methods + Delete(); + // Delete logger + delete iLog; + delete iFileMan; + iFs.Close(); + } + +// ======== GLOBAL 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* ) Cmpxharvestertest::NewL( aTestModuleIf ); + } diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/harvester_utility_api/tsrc/mpxharvestertest/src/mpxharvestertestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/harvester_utility_api/tsrc/mpxharvestertest/src/mpxharvestertestBlocks.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,1212 @@ +/* +* Copyright (c) 2007 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: STIF testing for MPX Harvester +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include + +#include +#include +#include +#include +#include "mpxharvestertest.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// --------------------------------------------------------------------------- +// +void Cmpxharvestertest::Delete() + { + + if ( iHarvester ) + { + iHarvester->Close(); + } + if ( iCollection ) + { + iCollection->Close(); + } + iExpectedEvents.Close(); + } + + +// ----------------------------------------------------------------------------- +// Cmpxharvestertest::AddExpectedEvent +// Add an event to the expected event list +// ----------------------------------------------------------------------------- + +void Cmpxharvestertest::AddExpectedEvent( TExpectedEvents aEvent ) + { + iLog->Log(_L("Cmpxharvestertest::AddExpectedEvent: %d"), aEvent); + iExpectedEvents.Append(aEvent); + } + +// ----------------------------------------------------------------------------- +// Cmpxharvestertest::RemoveExpectedEvent +// Remove the event from the expected event list +// Returns: ETrue: Event found. +// EFalse: Event not found. +// ----------------------------------------------------------------------------- +TBool Cmpxharvestertest::RemoveExpectedEvent( TExpectedEvents aEvent ) + { + iLog->Log(_L("Cmpxharvestertest::RemoveExpectedEvent: %d"), aEvent); + TBool match = EFalse; + TInt index = iExpectedEvents.Find(aEvent); + if ( index != KErrNotFound ) + { + iExpectedEvents.Remove(index); + match = ETrue; + } + return match; + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// --------------------------------------------------------------------------- +// +TInt Cmpxharvestertest::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( "Example", Cmpxharvestertest::ExampleL ), + //ADD NEW ENTRY HERE + ENTRY( "CreateUtility", Cmpxharvestertest::CreateUtility ), + ENTRY( "CopyTestFile", Cmpxharvestertest::CopyTestFile ), + ENTRY( "DeleteTestFile", Cmpxharvestertest::DeleteTestFile ), + ENTRY( "VerifyEvents", Cmpxharvestertest::VerifyEvents ), + ENTRY( "Scan", Cmpxharvestertest::Scan ), + ENTRY( "CancelScan", Cmpxharvestertest::CancelScan ), + ENTRY( "AddFileByPath", Cmpxharvestertest::AddFileByPath ), + //ENTRY( "AddFileByMedia", Cmpxharvestertest::AddFileByMedia ), + ENTRY( "RemoveFile", Cmpxharvestertest::RemoveFile ), + ENTRY( "RemoveFiles", Cmpxharvestertest::RemoveFiles ), + ENTRY( "RecreateDatabases", Cmpxharvestertest::RecreateDatabases ), + ENTRY( "DeleteFile", Cmpxharvestertest::DeleteFile ), + ENTRY( "DeleteFiles", Cmpxharvestertest::DeleteFiles ), + //ENTRY( "UpdateFile", Cmpxharvestertest::UpdateFile ), + ENTRY( "FindCollectionId", Cmpxharvestertest::FindCollectionId ), + //ENTRY( "RenameFileByMedia", Cmpxharvestertest::RenameFileByMedia ), + ENTRY( "RenameFileByPath", Cmpxharvestertest::RenameFileByPath ), + //ENTRY( "ExportPlaylist", Cmpxharvestertest::ExportPlaylist ), + ENTRY( "ImportPlaylist", Cmpxharvestertest::ImportPlaylist ), + ENTRY( "ImportFile", Cmpxharvestertest::ImportFile ), + ENTRY( "RequiredAttributes", Cmpxharvestertest::RequiredAttributes ), + ENTRY( "OptionalAttributes", Cmpxharvestertest::OptionalAttributes ), + ENTRY( "PlaylistFileExtension", Cmpxharvestertest::PlaylistFileExtension ), + ENTRY( "IsPlaylist", Cmpxharvestertest::IsPlaylist ), + ENTRY( "CheckForSystemEvents", Cmpxharvestertest::CheckForSystemEvents ) + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::HandlePlaylistExportCompletedL +// --------------------------------------------------------------------------- +// +void Cmpxharvestertest::HandlePlaylistExportCompletedL( CMPXMedia* /*aMedia*/, TInt aErr ) + { + if ( RemoveExpectedEvent(EEventHandlePlaylistExportCompletedL) ) + { + iLog->Log(_L("Cmpxharvestertest::HandlePlaylistExportCompletedL: %d [EXPECTED]"), aErr); + } + else + { + iLog->Log(_L("Cmpxharvestertest::HandlePlaylistExportCompletedL: %d"), aErr); + } + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::HandlePlaylistImportCompletedL +// --------------------------------------------------------------------------- +// +void Cmpxharvestertest::HandlePlaylistImportCompletedL( CMPXMedia* aMedia, TInt aErr ) + { + if ( RemoveExpectedEvent(EEventHandlePlaylistImportCompletedL) ) + { + iLog->Log(_L("Cmpxharvestertest::HandlePlaylistImportCompletedL: %d [EXPECTED]"), aErr); + } + else + { + iLog->Log(_L("Cmpxharvestertest::HandlePlaylistImportCompletedL: %d"), aErr); + } + + if ( aErr == KErrNone ) + { + iLog->Log(_L("Number of attributes: %d"), aMedia->Count() ); + delete aMedia; + aMedia = NULL; + } + if ( (iResult && (aErr == KErrNone )) || (!iResult && (aErr != KErrNone)) ) + { + Signal(); + } + else + { + Signal(aErr); + } + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::HandleFileAddCompletedL +// --------------------------------------------------------------------------- +// +void Cmpxharvestertest::HandleFileAddCompletedL( CMPXMedia* aMedia, TInt aErr ) + { + if ( RemoveExpectedEvent(EEventHandleFileAddCompletedL) ) + { + iLog->Log(_L("Cmpxharvestertest::HandleFileAddCompletedL: %d [EXPECTED]"), aErr); + } + else + { + iLog->Log(_L("Cmpxharvestertest::HandleFileAddCompletedL: %d"), aErr); + } + + if ( aErr == KErrNone ) + { + iLog->Log(_L("Number of attributes: %d"), aMedia->Count() ); + delete aMedia; + aMedia = NULL; + } + Signal(); + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::HandleDeleteCompletedL +// --------------------------------------------------------------------------- +// +void Cmpxharvestertest::HandleDeleteCompletedL( TInt aErr ) + { + if ( RemoveExpectedEvent(EEventHandleDeleteCompletedL) ) + { + iLog->Log(_L("Cmpxharvestertest::HandleDeleteCompletedL: %d [EXPECTED]"), aErr); + } + else + { + iLog->Log(_L("Cmpxharvestertest::HandleDeleteCompletedL: %d"), aErr); + } + + if ( aErr == KErrNone ) + { + Signal(); + } + else + { + Signal(aErr); + } + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::HandleFileImportCompletedL +// --------------------------------------------------------------------------- +// +void Cmpxharvestertest::HandleFileImportCompletedL( CMPXMedia* aMedia, TInt aErr ) + { + if ( RemoveExpectedEvent(EEventHandleFileImportCompletedL) ) + { + iLog->Log(_L("Cmpxharvestertest::EEventHandleFileImportCompletedL: %d [EXPECTED]"), aErr); + } + else + { + iLog->Log(_L("Cmpxharvestertest::EEventHandleFileImportCompletedL: %d"), aErr); + } + + if ( aErr == KErrNone ) + { + iLog->Log(_L("Number of attributes: %d"), aMedia->Count() ); + delete aMedia; + aMedia = NULL; + } + if ( (iResult && (aErr == KErrNone )) || (!iResult && (aErr != KErrNone)) ) + { + Signal(); + } + else + { + Signal(aErr); + } + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::HandleFileGetMediaCompletedL +// --------------------------------------------------------------------------- +// +void Cmpxharvestertest::HandleFileGetMediaCompletedL( CMPXMedia* /*aMedia*/, TInt aErr ) + { + if ( RemoveExpectedEvent(EEventHandleFileGetMediaCompletedL) ) + { + iLog->Log(_L("Cmpxharvestertest::HandleFileGetMediaCompletedL: %d [EXPECTED]"), aErr); + } + else + { + iLog->Log(_L("Cmpxharvestertest::HandleFileGetMediaCompletedL: %d"), aErr); + } + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::HandleCollectionMediaL +// --------------------------------------------------------------------------- +// +void Cmpxharvestertest::HandleCollectionMediaL( const CMPXMedia& /*aMedia*/, TInt aError ) + { + iLog->Log(_L("Cmpxharvestertest::HandleCollectionMediaL: %d"), aError); + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::HandleCollectionMessage +// --------------------------------------------------------------------------- +// +void Cmpxharvestertest::HandleCollectionMessage( CMPXMessage* /*aMsg*/, TInt aError ) + { + iLog->Log(_L("Cmpxharvestertest::HandleCollectionMessage: %d"), aError); + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::HandleOpenL +// --------------------------------------------------------------------------- +// +void Cmpxharvestertest::HandleOpenL( const CMPXMedia& /*aEntries*/, TInt /*aIndex*/, TBool /*aComplete*/, TInt aError ) + { + iLog->Log(_L("Cmpxharvestertest::HandleOpenL: %d"), aError); + } +// --------------------------------------------------------------------------- +// Cmpxharvestertest::HandleOpenL +// --------------------------------------------------------------------------- +// +void Cmpxharvestertest::HandleOpenL( const CMPXCollectionPlaylist& /*aPlaylist*/, TInt aError ) + { + iLog->Log(_L("Cmpxharvestertest::HandleOpenL: %d"), aError); + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::ExampleL +// Example test method function. +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxharvestertest::ExampleL( CStifItemParser& aItem ) + { + + // Print to UI + _LIT( Kmpxharvestertest, "mpxharvestertest" ); + _LIT( KExample, "In Example" ); + TestModuleIf().Printf( 0, Kmpxharvestertest, KExample ); + // Print to log file + iLog->Log( KExample ); + + TInt i = 0; + TPtrC string; + _LIT( KParam, "Param[%i]: %S" ); + while ( aItem.GetNextString( string ) == KErrNone ) + { + TestModuleIf().Printf( i, Kmpxharvestertest, + KParam, i, &string ); + i++; + } + + return KErrNone; + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::CreateUtility +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxharvestertest::CreateUtility( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("Cmpxharvestertest::CreateUtility")); + TRAPD(err, iHarvester = CMPXHarvesterFactory::NewL()); + if ( err == KErrNone ) + { + TRAP(err, iCollection = MMPXCollectionUtility::NewL(this)); + if ( err != KErrNone ) + { + iLog->Log(_L("MMPXCollectionUtility::NewL returned: %d"), err); + } + } + else + { + iLog->Log(_L("CMPXHarvesterFactory::NewL returned: %d"), err); + } + + iExpectedEvents.Reset(); + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::CopyTestFile +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxharvestertest::CopyTestFile( CStifItemParser& aItem ) + { + iLog->Log(_L("Cmpxharvestertest::CopyTestFile")); + TInt err = KErrNone; + TPtrC string; + while ( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(Kmpxharvester_testPath); + KFrom.Append(string); + + TBuf<120> KTo; + KTo.Append(Kmpxharvester_digitalPath); + KTo.Append(string); + + err = iFileMan->Copy(KFrom, KTo); + if ( err != KErrNone ) + { + iLog->Log(_L("CopyTestFile returned: %d"), err); + break; + } + } + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::DeleteTestFile +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxharvestertest::DeleteTestFile( CStifItemParser& aItem ) + { + iLog->Log(_L("Cmpxharvestertest::DeleteTestFile")); + TInt err = KErrNone; + TPtrC string; + while ( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(Kmpxharvester_digitalPath); + KFrom.Append(string); + + err = iFileMan->Delete(KFrom); + if ( err != KErrNone ) + { + iLog->Log(_L("DeleteTestFile returned: %d"), err); + break; + } + } + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::VerifyEvents +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxharvestertest::VerifyEvents( CStifItemParser& /*aItem*/ ) + { + TInt err = KErrNone; + TInt count = iExpectedEvents.Count(); + if ( count > 0 ) + { + for ( TInt i = 0; i < count; i++ ) + { + iLog->Log(_L("Cmpxharvestertest::VerifyEvents - Missing: %d"), iExpectedEvents[i]); + } + err = KErrGeneral; + iExpectedEvents.Reset(); + } + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::Scan +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxharvestertest::Scan( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("Cmpxharvestertest::Scan")); + TRAPD(err, iHarvester->ScanL()); + if ( err != KErrNone ) + { + iLog->Log(_L("ScanL returned: %d"), err); + } + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::CancelScan +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxharvestertest::CancelScan( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("Cmpxharvestertest::CancelScan")); + TRAPD(err, iHarvester->CancelScanL()); + if ( err != KErrNone ) + { + iLog->Log(_L("CancelScanL returned: %d"), err); + } + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::AddFileByPath +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxharvestertest::AddFileByPath( CStifItemParser& aItem ) + { + iLog->Log(_L("Cmpxharvestertest::AddFileByPath")); + TInt err = KErrNone; + TPtrC string; + if ( KErrNone == aItem.GetNextString(string) ) + { + TBuf<120> KFile; + KFile.Append(Kmpxharvester_digitalPath); + KFile.Append(string); + + TRAP(err, iHarvester->AddFileL(KFile, this)) + if ( err == KErrNone ) + { + AddExpectedEvent(EEventHandleFileAddCompletedL); + } + else + { + iLog->Log(_L("AddFileL returned: %d"), err); + } + } + else + { + iLog->Log(_L("Bad parameter on config file")); + err = KErrBadTestParameter; + } + + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::AddFileByMedia +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +//TInt Cmpxharvestertest::AddFileByMedia( CStifItemParser& aItem ) + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::RemoveFile +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxharvestertest::RemoveFile( CStifItemParser& aItem ) + { + iLog->Log(_L("Cmpxharvestertest::RemoveFile")); + TInt err = KErrNone; + TPtrC string; + if ( KErrNone == aItem.GetNextString(string) ) + { + TBuf<120> KFile; + KFile.Append(Kmpxharvester_digitalPath); + KFile.Append(string); + + TRAP(err, iHarvester->RemoveFileL(KFile)) + if ( err != KErrNone ) + { + iLog->Log(_L("RemoveFileL returned: %d"), err); + } + } + else + { + iLog->Log(_L("Bad parameter on config file")); + err = KErrBadTestParameter; + } + + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::RemoveFiles +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxharvestertest::RemoveFiles( CStifItemParser& aItem ) + { + iLog->Log(_L("Cmpxharvestertest::RemoveFiles")); + TInt err = KErrNone; + TPtrC string; + if ( KErrNone == aItem.GetNextString(string) ) + { + if ( string == KTagAll ) + { + TRAP(err, iHarvester->RemoveAllFilesL()); + if ( err != KErrNone ) + { + iLog->Log(_L("RemoveAllFilesL returned: %d"), err); + } + } + else + { + CDesCArrayFlat* files = new (ELeave)CDesCArrayFlat(1); + CleanupStack::PushL(files); + TBuf<120> KFrom; + KFrom.Append(Kmpxharvester_digitalPath); + KFrom.Append(string); + files->AppendL(KFrom); + + while ( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(Kmpxharvester_digitalPath); + KFrom.Append(string); + files->AppendL(KFrom); + } + + TRAP(err, iHarvester->RemoveFilesL(*files)); + if ( err != KErrNone ) + { + iLog->Log(_L("RemoveFilesL returned: %d"), err); + } + CleanupStack::PopAndDestroy(files); + } + } + else + { + iLog->Log(_L("Bad parameter on config file")); + err = KErrBadTestParameter; + } + + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::RecreateDatabases +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxharvestertest::RecreateDatabases( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("Cmpxharvestertest::RecreateDatabases")); + TRAPD(err, iHarvester->RecreateDatabasesL()); + if ( err != KErrNone ) + { + iLog->Log(_L("RecreateDatabasesL returned: %d"), err); + } + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::DeleteFile +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxharvestertest::DeleteFile( CStifItemParser& aItem ) + { + iLog->Log(_L("Cmpxharvestertest::DeleteFile")); + TInt err = KErrNone; + TPtrC string; + if ( KErrNone == aItem.GetNextString(string) ) + { + TBuf<120> KFile; + KFile.Append(Kmpxharvester_digitalPath); + KFile.Append(string); + + TRAP(err, iHarvester->DeleteFileL(KFile, this)) + if ( err != KErrNone ) + { + iLog->Log(_L("DeleteFileL returned: %d"), err); + } + } + else + { + iLog->Log(_L("Bad parameter on config file")); + err = KErrBadTestParameter; + } + + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::DeleteFiles +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxharvestertest::DeleteFiles( CStifItemParser& aItem ) + { + iLog->Log(_L("Cmpxharvestertest::DeleteFiles")); + TInt err = KErrNone; + TPtrC mode; + TPtrC string; + TPtrC string2; + if ( KErrNone == aItem.GetNextString(mode) ) + { + CDesCArrayFlat* files = new (ELeave)CDesCArrayFlat(1); + CleanupStack::PushL(files); + while ( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(Kmpxharvester_digitalPath); + KFrom.Append(string); + files->AppendL(KFrom); + } + + if ( mode == KTagAsync ) + { + TRAP(err, iHarvester->DeleteFilesL(*files, this)); + if ( err == KErrNone ) + { + AddExpectedEvent(EEventHandleDeleteCompletedL); + } + else + { + iLog->Log(_L("DeleteFilesL async returned: %d"), err); + } + } + else if ( mode == KTagSync ) + { + TRAP(err, iHarvester->DeleteFilesL(*files)); + if ( err != KErrNone ) + { + iLog->Log(_L("DeleteFilesL sync returned: %d"), err); + } + } + else + { + iLog->Log(_L("Bad parameter on config file")); + err = KErrBadTestParameter; + } + CleanupStack::PopAndDestroy(files); + } + else + { + iLog->Log(_L("Bad parameter on config file")); + err = KErrBadTestParameter; + } + + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::UpdateFile +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +//TInt Cmpxharvestertest::UpdateFile( CStifItemParser& aItem ) + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::FindCollectionId +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxharvestertest::FindCollectionId( CStifItemParser& aItem ) + { + iLog->Log(_L("Cmpxharvestertest::FindCollectionId")); + TInt err = KErrNone; + TPtrC string; + if ( KErrNone == aItem.GetNextString(string) ) + { + TBuf<120> KFile; + KFile.Append(Kmpxharvester_digitalPath); + KFile.Append(string); + + TInt id = 0; + TRAP(err, id = iHarvester->FindCollectionIdL(KFile)) + if ( err != KErrNone ) + { + iLog->Log(_L("FindCollectionIdL returned: %d"), err); + } + else + { + iLog->Log(_L("Collection ID: %d"), id); + } + } + else + { + iLog->Log(_L("Bad parameter on config file")); + err = KErrBadTestParameter; + } + + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::RenameFileByMedia +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +//TInt Cmpxharvestertest::RenameFileByMedia( CStifItemParser& aItem ) + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::RenameFileByPath +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxharvestertest::RenameFileByPath( CStifItemParser& aItem ) + { + iLog->Log(_L("Cmpxharvestertest::RenameFileByPath")); + TInt err = KErrNone; + TPtrC oldUri; + TPtrC newUri; + TBuf<120> KOld; + TBuf<120> KNew; + if ( KErrNone == aItem.GetNextString(oldUri) ) + { + KOld.Append(Kmpxharvester_digitalPath); + KOld.Append(oldUri); + + if ( KErrNone == aItem.GetNextString(newUri) ) + { + KNew.Append(Kmpxharvester_digitalPath); + KNew.Append(newUri); + } + else + { + iLog->Log(_L("Bad parameter on config file")); + err = KErrBadTestParameter; + } + } + else + { + iLog->Log(_L("Bad parameter on config file")); + err = KErrBadTestParameter; + } + + if ( err == KErrNone ) + { + TInt id = 0; + TRAP(err, id = iHarvester->FindCollectionIdL(KOld)) + if ( err != KErrNone ) + { + iLog->Log(_L("FindCollectionIdL returned: %d"), err); + } + else + { + TRAP(err, iHarvester->RenameFileL(KOld, KNew, id)); + if ( err != KErrNone ) + { + iLog->Log(_L("RenameFileL returned: %d"), err); + } + } + } + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::ExportPlaylist +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +//TInt Cmpxharvestertest::ExportPlaylist( CStifItemParser& aItem ) + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::ImportPlaylist +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxharvestertest::ImportPlaylist( CStifItemParser& aItem ) + { + iLog->Log(_L("Cmpxharvestertest::ImportPlaylist")); + TInt err = KErrNone; + TPtrC string; + TPtrC result; + if ( KErrNone == aItem.GetNextString(string) ) + { + TBuf<120> KFile; + KFile.Append(Kmpxharvester_digitalPath); + KFile.Append(string); + + if ( KErrNone == aItem.GetNextString(result) ) + { + if ( result == KTagTrue ) + { + iResult = ETrue; + } + else if ( result == KTagFalse ) + { + iResult = EFalse; + } + else + { + iLog->Log(_L("Bad parameter on config file")); + err = KErrBadTestParameter; + } + + if ( err == KErrNone ) + { + TRAP(err, iHarvester->ImportPlaylistL(KFile, this)) + if ( err == KErrNone ) + { + AddExpectedEvent(EEventHandlePlaylistImportCompletedL); + } + else + { + iLog->Log(_L("ImportPlaylist returned: %d"), err); + } + } + } + } + else + { + iLog->Log(_L("Bad parameter on config file")); + err = KErrBadTestParameter; + } + + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::ImportFile +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxharvestertest::ImportFile( CStifItemParser& aItem ) + { + iLog->Log(_L("Cmpxharvestertest::ImportFile")); + TInt err = KErrNone; + TPtrC string; + TPtrC result; + if ( KErrNone == aItem.GetNextString(string) ) + { + TBuf<120> KFile; + KFile.Append(Kmpxharvester_digitalPath); + KFile.Append(string); + + if ( KErrNone == aItem.GetNextString(result) ) + { + if ( result == KTagTrue ) + { + iResult = ETrue; + } + else if ( result == KTagFalse ) + { + iResult = EFalse; + } + else + { + iLog->Log(_L("Bad parameter on config file")); + err = KErrBadTestParameter; + } + + if ( err == KErrNone ) + { + TRAP(err, iHarvester->ImportFileL(KFile, this)) + if ( err == KErrNone ) + { + AddExpectedEvent(EEventHandleFileImportCompletedL); + } + else + { + iLog->Log(_L("ImportFile returned: %d"), err); + } + + } + } + } + else + { + iLog->Log(_L("Bad parameter on config file")); + err = KErrBadTestParameter; + } + + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::RequiredAttributes +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxharvestertest::RequiredAttributes( CStifItemParser& aItem ) + { + iLog->Log(_L("Cmpxharvestertest::RequiredAttributes")); + TInt err = KErrNone; + TPtrC playlistType; + if ( KErrNone == aItem.GetNextString(playlistType) ) + { + TMPXPlaylistType type = EMPXPlaylistTypeUnknown; + if ( playlistType == KTagM3U ) + { + type = EMPXPlaylistTypeM3U; + } + else if ( playlistType == KTagPLA ) + { + type = EMPXPlaylistTypePLA; + } + else if ( playlistType == KTagMPV ) + { + type = EMPXPlaylistTypeMPV; + } + else if ( playlistType == KTagXSPF ) + { + type = EMPXPlaylistTypeXSPF; + } + else if ( playlistType == KTagXML ) + { + type = EMPXPlaylistTypeXML; + } + else + { + iLog->Log(_L("Bad parameter on config file")); + return KErrBadTestParameter; + } + + RArray att; + TRAP(err, iHarvester->RequiredAttributesL(type, att)); + if ( err != KErrNone ) + { + iLog->Log(_L("RequiredAttributesL returned: %d"), err); + } + else + { + TInt count = att.Count(); + iLog->Log(_L("Number of attributes: %d"), count ); + for ( TInt i=0; i < count; i++ ) + { + TMPXAttribute attribute = att[i]; + iLog->Log(_L("AttributeId: %d, ContentId: %d"), attribute.AttributeId(), attribute.ContentId() ); + } + } + att.Reset(); + } + else + { + iLog->Log(_L("Bad parameter on config file")); + err = KErrBadTestParameter; + } + + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::OptionalAttributes +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxharvestertest::OptionalAttributes( CStifItemParser& aItem ) + { + iLog->Log(_L("Cmpxharvestertest::OptionalAttributes")); + TInt err = KErrNone; + TPtrC playlistType; + if ( KErrNone == aItem.GetNextString(playlistType) ) + { + TMPXPlaylistType type = EMPXPlaylistTypeUnknown; + if ( playlistType == KTagM3U ) + { + type = EMPXPlaylistTypeM3U; + } + else if ( playlistType == KTagPLA ) + { + type = EMPXPlaylistTypePLA; + } + else if ( playlistType == KTagMPV ) + { + type = EMPXPlaylistTypeMPV; + } + else if ( playlistType == KTagXSPF ) + { + type = EMPXPlaylistTypeXSPF; + } + else if ( playlistType == KTagXML ) + { + type = EMPXPlaylistTypeXML; + } + else + { + iLog->Log(_L("Bad parameter on config file")); + return KErrBadTestParameter; + } + + RArray att; + TRAP(err, iHarvester->OptionalAttributesL(type, att)); + if ( err != KErrNone ) + { + iLog->Log(_L("OptionalAttributesL returned: %d"), err); + } + else + { + TInt count = att.Count(); + iLog->Log(_L("Number of attributes: %d"), count ); + for ( TInt i=0; i < count; i++ ) + { + // AK - need to add better checking + TMPXAttribute attribute = att[i]; + iLog->Log(_L("AttributeId: %d, ContentId: %d"), attribute.AttributeId(), attribute.ContentId() ); + } + } + att.Reset(); + } + else + { + iLog->Log(_L("Bad parameter on config file")); + err = KErrBadTestParameter; + } + + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::PlaylistFileExtension +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxharvestertest::PlaylistFileExtension( CStifItemParser& aItem ) + { + iLog->Log(_L("Cmpxharvestertest::PlaylistFileExtension")); + TInt err = KErrNone; + TPtrC playlistType; + if ( KErrNone == aItem.GetNextString(playlistType) ) + { + TMPXPlaylistType type = EMPXPlaylistTypeUnknown; + if ( playlistType == KTagM3U ) + { + type = EMPXPlaylistTypeM3U; + } + else if ( playlistType == KTagPLA ) + { + type = EMPXPlaylistTypePLA; + } + else if ( playlistType == KTagMPV ) + { + type = EMPXPlaylistTypeMPV; + } + else if ( playlistType == KTagXSPF ) + { + type = EMPXPlaylistTypeXSPF; + } + else if ( playlistType == KTagXML ) + { + type = EMPXPlaylistTypeXML; + } + else + { + iLog->Log(_L("Bad parameter on config file")); + return KErrBadTestParameter; + } + + HBufC* ext = iHarvester->PlaylistFileExtensionLC(type); + TPtr extptr = ext->Des(); + iLog->Log(_L("Extension: %S"), &extptr ); + err = !( (type == EMPXPlaylistTypeM3U) && (ext->Des() == _L(".m3u")) ); + iLog->Log(_L("Correct extension error: %d"), err ); + CleanupStack::PopAndDestroy(ext); + } + else + { + iLog->Log(_L("Bad parameter on config file")); + err = KErrBadTestParameter; + } + + return err; + } + + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::IsPlaylist +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxharvestertest::IsPlaylist( CStifItemParser& aItem ) + { + iLog->Log(_L("Cmpxharvestertest::IsPlaylist")); + TInt err = KErrNone; + TPtrC string; + TPtrC test; + if ( KErrNone == aItem.GetNextString(string) ) + { + TBuf<120> KFile; + KFile.Append(Kmpxharvester_digitalPath); + KFile.Append(string); + + if ( KErrNone == aItem.GetNextString(test) ) + { + TBool playlist = EFalse; + TRAP(err, playlist = iHarvester->IsPlaylistL(KFile)) + if ( err != KErrNone ) + { + iLog->Log(_L("IsPlaylist returned: %d"), err); + } + else + { + if ( ((test == KTagTrue) && playlist ) || + ((test == KTagFalse) && !playlist ) ) + { + err = KErrNone; + } + else + { + err = KErrGeneral; + } + } + } + } + else + { + iLog->Log(_L("Bad parameter on config file")); + err = KErrBadTestParameter; + } + + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxharvestertest::CheckForSystemEvents +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxharvestertest::CheckForSystemEvents( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("Cmpxharvestertest::CheckForSystemEvents")); + TRAPD(err, iHarvester->CheckForSystemEventsL()); + if ( err != KErrNone ) + { + iLog->Log(_L("CancelScanL returned: %d"), err); + } + return err; + } + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/media_player_settings_engine_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/media_player_settings_engine_api/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2006 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 +: Media Player Settings Engine API +* +*/ + +// Version : %version: 4.1.2 % + + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/mpsettingsmodel.h MW_LAYER_PLATFORM_EXPORT_PATH(mpsettingsmodel.h) diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/media_player_settings_engine_api/inc/mpsettingsmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/media_player_settings_engine_api/inc/mpsettingsmodel.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,439 @@ +/* +* 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: Common interface for MMF specific settings models. +* +*/ + +// Version : %version: 3.1.2 % + + + + +#ifndef MMPSETTINGSMODEL_H +#define MMPSETTINGSMODEL_H + +// INCLUDES +#include +#include +#include + +// DATA TYPES +// Config file version +enum TConfigVersion + { + EConfigDefault, + EConfigUser + }; + +// Bearer type +enum TDataBearer + { + EBearerGPRS, + EBearerEGPRS, + EBearerWCDMA, + EBearerCDMA, + EBearerCDMA2000, + EBearerWLAN, + EBearerHSDPA + }; + +// CLASS DECLARATION + +/** +* CMPSettingsModel +* Common API for MMF specific settings models. +* +* @lib MPSettEngine.dll +* @since 2.0 +*/ +class CMPSettingsModel : public CBase + { + public: + + /** + * Constructor. Uses ECom to construct an instance of this class. + * @param aUid Implementation uid of the object that is to be constructed. + */ + IMPORT_C static CMPSettingsModel* NewL(TUid aUid); + + /** + * Destructor. + */ + IMPORT_C virtual ~CMPSettingsModel(); + + public: // New functions + + /** + * Provides an implementation information array. + * @since 2.1 + * @param aImplInfoArray An array which is populated with the implementation + * information of the available implementations. + */ + IMPORT_C static void ListImplementationsL(RImplInfoPtrArray& aImplInfoArray); + + /** + * Reads settings from MMF controller. + * @since 2.0 + * @param aSettingsType Settings value type: + * EConfigDefault: Load default values + * EConfigUser: Load user values + */ + virtual void LoadSettingsL(TInt aConfigVersion) = 0; + + /** + * Writes settings to MMF controller. + * @since 2.0 + */ + virtual void StoreSettingsL() = 0; + + /** + * Sets video contrast + * @since 2.0 + * @param aContrast Contrast level + * @return Error value. + */ + virtual TInt SetVideoContrast(TInt aContrast) = 0; + + /** + * Returns video contrast level. + * @since 2.0 + * @param aContrast Contrast level: + * 0: Minimum contrast + * 20: 20% of maximum + * 40: 40% of maximum + * 60: 60% of maximum + * 80: 80% of maximum + * 100: Maximum contrast + * @return Error value. + */ + virtual TInt GetVideoContrast(TInt& aContrast) = 0; + + /** + * Sets proxy mode.. + * @since 2.0 + * @param aMode Proxy mode. + * @return Error value. + */ + virtual TInt SetProxyMode(TInt aMode) = 0; + + /** + * Returns proxy mode. + * @since 2.0 + * @param aMode Proxy mode: + * 0: Disabled + * 1: Enabled + * @return Error value. + */ + virtual TInt GetProxyMode(TInt& aMode) = 0; + + /** + * Sets Proxy host name. + * @since 2.0 + * @param aHostName Proxy host name. + * @return Error value. + */ + virtual TInt SetProxyHostNameL(const TDesC& aHostName) = 0; + + /** + * Returns proxy host name. + * @since 2.0 + * @param aHostName Proxy host name. + * @return Error value. + */ + virtual TInt GetProxyHostName(TDes& aHostName) = 0; + + /** + * Sets proxy port number. + * @since 2.0 + * @param aPort Proxy port number. + * @return Error value. + */ + virtual TInt SetProxyPort(TInt aPort) = 0; + + /** + * Returns proxy port number.. + * @since 2.0 + * @return Integer: Proxy port number. + * @return Error value. + */ + virtual TInt GetProxyPort(TInt& aPort) = 0; + + /** + * Sets default access point. + * @since 2.0 + * @param aApId Access point ID. + * @return Error value. + */ + virtual TInt SetDefaultAp(TUint32 aApId) = 0; + + /** + * Returns default access point ID. + * @since 2.0 + * @param aApId Access point ID. + * @return Error value. + */ + virtual TInt GetDefaultAp(TUint32& aApId) = 0; + + /** + * Sets bandwidth control mode. + * @since 2.0 + * @param aMode bandwidth control mode. + * @return Error value. + */ + virtual TInt SetBandwidthControlMode(TInt aMode) = 0; + + /** + * Returns bandwidth control mode. + * @since 2.0 + * @param aMode bandwidth control mode: + * 0: Use dynamic bw control if possible + * 1: Use static bw control + * @return Error value. + */ + virtual TInt GetBandwidthControlMode(TInt& aMode) = 0; + + /** + * Sets maximum bandwidth. + * @since 2.1 + * @param aMaxBw Maximum bandwidth. + * @param aBearer Bearer, which max bw is set. + * @return Error value. + */ + virtual TInt SetMaxBandwidth(TInt aMaxBw, TDataBearer aBearer) = 0; + + /** + * Returns maximum bandwidth. + * @since 2.1 + * @param aMaxBw Maximum bandwidth. + * @param aBearer Bearer, which max bw is enquired. + * @return Error value. + */ + virtual TInt GetMaxBandwidth(TInt& aMaxBw, TDataBearer aBearer) = 0; + + /** + * Sets connection timeout. + * @since 2.0 + * @param aTimeout Timeout in minutes. + * @return Error value. + */ + virtual TInt SetConnectionTimeout(TInt aTimeout) = 0; + + /** + * Returns connection timeout. + * @since 2.0 + * @param aTimeout Timeout in minutes. + * @return Error value. + */ + virtual TInt GetConnectionTimeout(TInt& aTimeout) = 0; + + /** + * Sets server timout. + * @since 2.0 + * @param aTimeout Timeout in minutes. + * @return Error value. + */ + virtual TInt SetServerTimeout(TInt aTimeout) = 0; + + /** + * Returns server timeout. + * @since 2.0 + * @param aTimeout Timeout in minutes. + * @return Error value. + */ + virtual TInt GetServerTimeout(TInt& aTimeout) = 0; + + /** + * Sets minimum UDP port number. + * @since 2.0 + * @param aPort minimum port number. + * @return Error value. + */ + virtual TInt SetMinUDPPort(TInt aPort) = 0; + + /** + * Returns minimum UDP port number. + * @since 2.0 + * @param aPort minimum UDP port number in minutes. + * @return Error value. + */ + virtual TInt GetMinUDPPort(TInt& aPort) = 0; + + /** + * Sets maximum UDP port number. + * @since 2.0 + * @param aPort maximum port number. + * @return Error value. + */ + virtual TInt SetMaxUDPPort(TInt aPort) = 0; + + /** + * Returns maximum UDP port number. + * @since 2.0 + * @param aPort maximum UDP port number in minutes. + * @return Error value. + */ + virtual TInt GetMaxUDPPort(TInt& aPort) = 0; + + /** + * Provides MMF controller version information. + * @since 2.0 + * @param aVersion Controller version number. + * @return Error value. + */ + virtual TInt GetControllerVersionInfo(TDes& aVersion) = 0; + + /** + * Provides MMF controller's build date. + * @since 2.0 + * @param aBldDate Controller build date. + * @return Error value. + */ + virtual TInt GetControllerBuildDate(TDes& aBldDate) = 0; + + /** + * Provides additional information about MMF controller. + * @since 2.0 + * @param aAdditionalInfo Additional controller information. + * @return Error value. + */ + virtual TInt GetControllerAdditionalInfo(TDes& aAdditionalInfo) = 0; + + /** + * Sets demand bandwidth factor. + * @since 2.1 + * @param aFactor Demand bandwidth factor. + * @return Error value. + */ + virtual TInt SetDemandBwFactor(TInt aFactor) = 0; + + /** + * Returns demand factor bandwidth. + * @since 2.1 + * @param aFactor Demand bandwidth factor. + * @return Error value. + */ + virtual TInt GetDemandBwFactor(TInt& aFactor) = 0; + + /** + * Sets sustainable bandwidth. + * @since 2.1 + * @param aSustainBw Sustainable bandwidth. + * @param aBearer Bearer, which sustain bw is set. + * @return Error value. + */ + virtual TInt SetSustainBandwidth(TInt aSustainBw, TDataBearer aBearer) = 0; + + /** + * Returns sustainable bandwidth. + * @since 2.1 + * @param aSustainBw Sustainable bandwidth. + * @param aBearer Bearer, which sustain bw is enquired. + * @return Error value. + */ + virtual TInt GetSustainBandwidth(TInt& aSustainBw, TDataBearer aBearer) = 0; + + /** + * Returns an array of the fixed sustainable bandwidth values. + * @since 2.1 + * @param aBwArray Fixed sustain bandwidth values are copied to this array. + * @param aBearer Bearer, which fixed sustain bw values is enquired. + * @return Error value. + */ + virtual TInt GetSustainBwPresetsL(RArray& aBwArray, TDataBearer aBearer) = 0; + + /** + * Returns an array of the fixed max bandwidth values. + * @since 2.1 + * @param aBwArray Fixed max bandwidth values are copied to this array. + * @param aBearer Bearer, which fixed max bw values is enquired. + * @return Error value. + */ + virtual TInt GetMaxBwPresetsL(RArray& aBwArray, TDataBearer aBearer) = 0; + + /** + * Returns video repeat mode. + * @since 2.0 + * @return ETrue: On + * EFalse: Off + */ + virtual TBool IsVideoRepeatOnL() = 0; + + /** + * Sets video repeat mode. + * @since 2.0 + * @param aRepeat Repeat mode. + */ + virtual void SetVideoRepeatL(const TBool aRepeat) = 0; + + /** + * Returns video view mode. + * @since 3.2 + * @return ETrue: On (Normal-screen view) + * EFalse: Off (Full-screen view) + */ + virtual TBool IsDefaultViewOnL() = 0; + + /** + * Sets video view mode. + * @since 3.2 + * @param aView View mode. + */ + virtual void SetDefaultViewL(const TBool aView) = 0; + + /** + * Returns if Rocker Keys Feature is supported + * @since 3.2 + * @return ETrue: - Rocker Keys feature is supported + * EFalse: - Rocker Keys feature is not supported + */ + virtual TBool IsRockerKeysSupportedL() = 0; + + /** + * Sets rocker keys mode. + * @since 3.2 + * @param aRockerKeys rocker keys mode. + */ + virtual void SetRockerKeysL(const TBool aRockerKeys) = 0; + + /** + * Returns Rocker Keys mode + * @since 3.2 + * @return ETrue: Show (Rocker Keys are shown) + * EFalse: Hide (Rocker Keys are hidden) + */ + virtual TBool ShowRockerKeysL() = 0; + + /** + * Sets Media Player auto disconnection time. + * @since 2.0 + * @param aTime Auto disconnection time. + */ + virtual void SetAutoDisconTimeL(const TInt aTime) = 0; + + /** + * Returns Media Player auto disconnection time. + * @since 2.0 + * @return 0: Unlimited time + * 1-99: Time in minutes + */ + virtual TInt AutoDisconTimeL() = 0; + + + protected: + TUid iDtor_ID_Key; + }; + +#endif // MMPSETTINGSMODEL_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/media_player_settings_engine_api/media_player_settings_engine_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/media_player_settings_engine_api/media_player_settings_engine_api.metaxml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,18 @@ + + + Media Player Settings Engine API + Media Player Settings Engine API + c++ + mmappcomponents + + + + + + + + + no + no + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/media_player_settings_engine_api/tsrc/conf/ui_mediaplayersettingsenginetest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/media_player_settings_engine_api/tsrc/conf/ui_mediaplayersettingsenginetest.cfg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,36 @@ +[Test] +title Example +create ui_mediaplayersettingsenginetest foobar +foobar Example pa ra me ters +delete foobar +[Endtest] + + +[Test] +title 1: CreateCMPSettingsModel +create ui_mediaplayersettingsenginetest foobar +foobar CreateCMPSettingsModel +pause 1000 +foobar DestructCMPSettingsModel +delete foobar +[Endtest] + +[Test] +title 2: DestructCMPSettingsModel +create ui_mediaplayersettingsenginetest foobar +foobar CreateCMPSettingsModel +pause 1000 +foobar DestructCMPSettingsModel +delete foobar +[Endtest] + +[Test] +title 3: MPSListImplementations +create ui_mediaplayersettingsenginetest foobar +foobar CreateCMPSettingsModel +pause 1000 +foobar MPSListImplementations +pause 1000 +foobar DestructCMPSettingsModel +delete foobar +[Endtest] \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/media_player_settings_engine_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/media_player_settings_engine_api/tsrc/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2006 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 +: Media Player Engine API +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_TESTEXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +#include "../ui_mediaplayersettingsenginetest/group/bld.inf" \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/media_player_settings_engine_api/tsrc/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/media_player_settings_engine_api/tsrc/init/TestFramework.ini Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,218 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# + XML, Test report will be xml type, for example 'TestReport.xml'. +# Note, that xml format is available only when output is set to FILE. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[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_ui_mediaplayersettingsenginetest + +TestReportFormat= TXT # Possible values: TXT, HTML or XML +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= 0 # 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] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + + +[New_Module] +ModuleName= testscripter +TestCaseFile= c:\testframework\ui_mediaplayersettingsenginetest.cfg +[End_Module] + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[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= D:\LOGS\TestFramework\ +#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] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set filters to be used by ConsoleUI. +# If you want to use filter with ConsoleUI, simply remove comments +# from section below and provide valid filter entries. +# Each filter line has to start with "filter= " keyword. +# Filter can contain special wildcard characters: +# * which stands for none or any literal; +# ? which stands for single character. +# Filters are not case-sensitive. + +#[Filters] +#filter= *math* +#filter= *radio* +#[End_Filters] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/media_player_settings_engine_api/tsrc/ui_mediaplayersettingsenginetest/Bmarm/ui_mediaplayersettingsenginetestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/media_player_settings_engine_api/tsrc/ui_mediaplayersettingsenginetest/Bmarm/ui_mediaplayersettingsenginetestU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/media_player_settings_engine_api/tsrc/ui_mediaplayersettingsenginetest/Bwins/ui_mediaplayersettingsenginetestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/media_player_settings_engine_api/tsrc/ui_mediaplayersettingsenginetest/Bwins/ui_mediaplayersettingsenginetestU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/media_player_settings_engine_api/tsrc/ui_mediaplayersettingsenginetest/EABI/ui_mediaplayersettingsenginetestU.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/media_player_settings_engine_api/tsrc/ui_mediaplayersettingsenginetest/EABI/ui_mediaplayersettingsenginetestU.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/media_player_settings_engine_api/tsrc/ui_mediaplayersettingsenginetest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/media_player_settings_engine_api/tsrc/ui_mediaplayersettingsenginetest/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2002 - 2007 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 +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these +DEFAULT + +PRJ_TESTEXPORTS +// NOTE: If using ARS requirements all export operations should be done under this. +// 'abld test export' + +PRJ_EXPORTS +// Specify the source file followed by its destination here +// copy will be used to copy the source file to its destination +// If there's no destination then the source file will be copied +// to the same name in /epoc32/include +// Example: +/* +/agnmodel/inc/AGMCOMON.H +*/ + +PRJ_TESTMMPFILES +ui_mediaplayersettingsenginetest.mmp + +PRJ_MMPFILES + +// Specify the .mmp files required for building the important component +// releasables. +// +// Specify "tidy" if the component you need to build doesn't need to be +// released. Specify "ignore" if the MMP file exists but should be +// ignored. +// Example: +/* +/agnmodel/group/agnmodel.mmp +#if defined(MARM) +/agnmodel/group/agsvexe.mmp +#endif +*/ + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/media_player_settings_engine_api/tsrc/ui_mediaplayersettingsenginetest/group/ui_mediaplayersettingsenginetest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/media_player_settings_engine_api/tsrc/ui_mediaplayersettingsenginetest/group/ui_mediaplayersettingsenginetest.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2002 - 2007 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: ui_mediaplayersettingsenginetest mmp file +* +*/ + + +#if defined(__S60_) +#include +#endif + +TARGET ui_mediaplayersettingsenginetest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +/* Remove comments and replace 0x00000000 with correct vendor id */ +// VENDORID 0x00000000 +/* Remove comments and replace 0x00000000 with correct secure id */ +// SECUREID 0x00000000 + +//TARGETPATH ?target_path +DEFFILE ui_mediaplayersettingsenginetest.def + +MW_LAYER_SYSTEMINCLUDE +SOURCEPATH ../src + +SOURCE ui_mediaplayersettingsenginetest.cpp +SOURCE ui_mediaplayersettingsenginetestBlocks.cpp + +//RESOURCE resource_file +//RESOURCE resource_file2 +USERINCLUDE ../inc + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY mpsettengine.lib +LIBRARY ecom.lib +LANG SC + +/* +START WINS +?wins_specific_information +END + +START MARM +?marm_specific_information +END +*/ +// Other possible keywords: + +// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) +/* +START BITMAP ?target +TARGETPATH ?emulated_path_on_target_machine +HEADER +SOURCE ?color_depth ?source_bitmap +END +*/ +// DEFFILE ?filename +// AIF ?filename + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/media_player_settings_engine_api/tsrc/ui_mediaplayersettingsenginetest/group/ui_mediaplayersettingsenginetest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/media_player_settings_engine_api/tsrc/ui_mediaplayersettingsenginetest/group/ui_mediaplayersettingsenginetest.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -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: Package file for project StifTFW +; +; +; Installation file for STIF +; + +; Languages +&EN + +; Package header +#{"STIF MediaPlayerSetting Test Application"},(0x101F7961),1,1,0,TYPE=SA + +; Localised Vendor name +%{"Nokia EN"} + +; Unique Vendor name +:"Nokia" + +; Logo +; None + +; Package signature - Optional +; None + +; Start of Package body + +; Condition blocks +; None + +; Options list +; None + +; Install files +"\epoc32\release\armv5\urel\ui_mediaplayersettingsenginetest.dll" - "c:\Sys\Bin\ui_mediaplayersettingsenginetest.dll" +"..\..\init\TestFramework.ini" - "c:\testframework\TestFramework.ini" +"..\..\conf\ui_mediaplayersettingsenginetest.cfg" - "c:\testframework\ui_mediaplayersettingsenginetest.cfg" + +; Embedded SIS +; None + +; End of Package body + +; PKG dependencies +; None + +; PKG capabilities +; None diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/media_player_settings_engine_api/tsrc/ui_mediaplayersettingsenginetest/inc/ui_mediaplayersettingsenginetest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/media_player_settings_engine_api/tsrc/ui_mediaplayersettingsenginetest/inc/ui_mediaplayersettingsenginetest.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,194 @@ +/* +* Copyright (c) 2002 - 2007 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: test class header file for STIF Test Framework TestScripter +* +*/ + + + +#ifndef UI_MEDIAPLAYERSETTINGSENGINETEST_H +#define UI_MEDIAPLAYERSETTINGSENGINETEST_H + +// INCLUDES +#include +#include +#include +#include +#include +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def +#define TEST_CLASS_VERSION_MAJOR 0 +#define TEST_CLASS_VERSION_MINOR 0 +#define TEST_CLASS_VERSION_BUILD 0 + +// DLL UIDs +#define KMPSettEngDllUidROP 0x101F857B +// Implementation UIDs +#define KMPSettEngImplUidROP 0x101F857D + +// Logging path +_LIT( Kui_mediaplayersettingsenginetestLogPath, "\\logs\\testframework\\ui_mediaplayersettingsenginetest\\" ); +// Log file +_LIT( Kui_mediaplayersettingsenginetestLogFile, "ui_mediaplayersettingsenginetest.txt" ); +_LIT( Kui_mediaplayersettingsenginetestLogFileWithTitle, "ui_mediaplayersettingsenginetest_[%S].txt" ); + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class Cui_mediaplayersettingsenginetest; +class CMPSettingsModel; + +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// CLASS DECLARATION + +/** +* Cui_mediaplayersettingsenginetest test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(Cui_mediaplayersettingsenginetest) : public CScriptBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Cui_mediaplayersettingsenginetest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Cui_mediaplayersettingsenginetest(); + + public: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + 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 ); + + protected: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + protected: // Functions from base classes + + /** + * From ?base_class ?member_description + */ + //?type ?member_function(); + + private: + + /** + * C++ default constructor. + */ + Cui_mediaplayersettingsenginetest( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // ?classname( const ?classname& ); + // Prohibit assigment operator if not deriving from CBase. + // ?classname& operator=( const ?classname& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + /** + * Test methods are listed below. + */ + + /** + * Example test method. + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + virtual TInt ExampleL( CStifItemParser& aItem ); + TInt CreateCMPSettingsModel( CStifItemParser& aItem ); + TInt DestructCMPSettingsModel( CStifItemParser& aItem ); + TInt MPSListImplementations( CStifItemParser& aItem ); + /** + * Method used to log version of test class + */ + void SendTestClassVersion(); + + //ADD NEW METHOD DEC HERE + //[TestMethods] - Do not remove + + public: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + protected: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + private: // Data + + // ?one_line_short_description_of_data + //?data_declaration; + + // Reserved pointer for future extension + //TAny* iReserved; + + public: // Friend classes + //?friend_class_declaration; + protected: // Friend classes + //?friend_class_declaration; + private: // Friend classes + //?friend_class_declaration; + CMPSettingsModel* iRopSettingsModel; + }; + +#endif // UI_MEDIAPLAYERSETTINGSENGINETEST_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/media_player_settings_engine_api/tsrc/ui_mediaplayersettingsenginetest/src/ui_mediaplayersettingsenginetest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/media_player_settings_engine_api/tsrc/ui_mediaplayersettingsenginetest/src/ui_mediaplayersettingsenginetest.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,201 @@ +/* +* Copyright (c) 2002 - 2007 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: Cui_mediaplayersettingsenginetest implemetantion for STIF Test Framework TestScripter +* +*/ + + + +// INCLUDE FILES +#include +#include "ui_mediaplayersettingsenginetest.h" +#include + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; + +// EXTERNAL FUNCTION PROTOTYPES +//extern ?external_function( ?arg_type,?arg_type ); + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// LOCAL CONSTANTS AND MACROS +//const ?type ?constant_var = ?constant; +//#define ?macro_name ?macro_def + +// MODULE DATA STRUCTURES +//enum ?declaration +//typedef ?declaration + +// LOCAL FUNCTION PROTOTYPES +//?type ?function_name( ?arg_type, ?arg_type ); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ?function_name ?description. +// ?description +// Returns: ?value_1: ?description +// ?value_n: ?description_line1 +// ?description_line2 +// ----------------------------------------------------------------------------- +// +/* +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg) // ?description + { + + ?code // ?comment + + // ?comment + ?code + } +*/ + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cui_mediaplayersettingsenginetest::Cui_mediaplayersettingsenginetest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +Cui_mediaplayersettingsenginetest::Cui_mediaplayersettingsenginetest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// Cui_mediaplayersettingsenginetest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Cui_mediaplayersettingsenginetest::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(Kui_mediaplayersettingsenginetestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(Kui_mediaplayersettingsenginetestLogFile); + } + + iLog = CStifLogger::NewL( Kui_mediaplayersettingsenginetestLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + SendTestClassVersion(); + } + +// ----------------------------------------------------------------------------- +// Cui_mediaplayersettingsenginetest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Cui_mediaplayersettingsenginetest* Cui_mediaplayersettingsenginetest::NewL( + CTestModuleIf& aTestModuleIf ) + { + Cui_mediaplayersettingsenginetest* self = new (ELeave) Cui_mediaplayersettingsenginetest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +Cui_mediaplayersettingsenginetest::~Cui_mediaplayersettingsenginetest() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +//----------------------------------------------------------------------------- +// Cui_mediaplayersettingsenginetest::SendTestClassVersion +// Method used to send version of test class +//----------------------------------------------------------------------------- +// +void Cui_mediaplayersettingsenginetest::SendTestClassVersion() + { + TVersion moduleVersion; + moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; + moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; + moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; + + TFileName moduleName; + moduleName = _L("ui_mediaplayersettingsenginetest.dll"); + + TBool newVersionOfMethod = ETrue; + TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); + } + +// ========================== 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* ) Cui_mediaplayersettingsenginetest::NewL( aTestModuleIf ); + + } + + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/media_player_settings_engine_api/tsrc/ui_mediaplayersettingsenginetest/src/ui_mediaplayersettingsenginetestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/media_player_settings_engine_api/tsrc/ui_mediaplayersettingsenginetest/src/ui_mediaplayersettingsenginetestBlocks.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,242 @@ +/* +* Copyright (c) 2002 - 2007 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: Cui_mediaplayersettingsenginetest block implementation for STIF Test Framework TestScripter +* +*/ + + + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include "ui_mediaplayersettingsenginetest.h" + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; + +// EXTERNAL FUNCTION PROTOTYPES +//extern ?external_function( ?arg_type,?arg_type ); + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// LOCAL CONSTANTS AND MACROS +//const ?type ?constant_var = ?constant; +//#define ?macro_name ?macro_def + +// MODULE DATA STRUCTURES +//enum ?declaration +//typedef ?declaration + +// LOCAL FUNCTION PROTOTYPES +//?type ?function_name( ?arg_type, ?arg_type ); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ?function_name ?description. +// ?description +// Returns: ?value_1: ?description +// ?value_n: ?description_line1 +// ?description_line2 +// ----------------------------------------------------------------------------- +// +/* +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg) // ?description + { + + ?code // ?comment + + // ?comment + ?code + } +*/ + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cui_mediaplayersettingsenginetest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Cui_mediaplayersettingsenginetest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// Cui_mediaplayersettingsenginetest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Cui_mediaplayersettingsenginetest::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( "Example", Cui_mediaplayersettingsenginetest::ExampleL ), + ENTRY( "CreateCMPSettingsModel", Cui_mediaplayersettingsenginetest::CreateCMPSettingsModel ), + ENTRY( "DestructCMPSettingsModel", Cui_mediaplayersettingsenginetest::DestructCMPSettingsModel ), + ENTRY( "MPSListImplementations", Cui_mediaplayersettingsenginetest::MPSListImplementations ), + //ADD NEW ENTRY HERE + // [test cases entries] - Do not remove + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// ----------------------------------------------------------------------------- +// Cui_mediaplayersettingsenginetest::ExampleL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cui_mediaplayersettingsenginetest::ExampleL( CStifItemParser& aItem ) + { + + // Print to UI + _LIT( Kui_mediaplayersettingsenginetest, "ui_mediaplayersettingsenginetest" ); + _LIT( KExample, "In Example" ); + TestModuleIf().Printf( 0, Kui_mediaplayersettingsenginetest, KExample ); + // Print to log file + iLog->Log( KExample ); + + TInt i = 0; + TPtrC string; + _LIT( KParam, "Param[%i]: %S" ); + while ( aItem.GetNextString ( string ) == KErrNone ) + { + TestModuleIf().Printf( i, Kui_mediaplayersettingsenginetest, + KParam, i, &string ); + i++; + } + + return KErrNone; + + } + +// ----------------------------------------------------------------------------- +// Cui_mediaplayersettingsenginetest::CreateCMPSettingsModel +// CreateCMPSettingsModel test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cui_mediaplayersettingsenginetest::CreateCMPSettingsModel( CStifItemParser& /*aItem*/ ) + { + TInt err = KErrNone; + + const TUid KSettingsModelForROPUid = {KMPSettEngImplUidROP}; + TRAP(err, iRopSettingsModel = CMPSettingsModel::NewL(KSettingsModelForROPUid)); + + if (err==KErrNone) + { + iLog->Log( _L("Create CMPSettingsModel Success!")); + } + else + { + iLog->Log( _L("Create CMPSettingsModel Faile! %d"), err ); + } + return err ; + } +// ----------------------------------------------------------------------------- +// Cui_mediaplayersettingsenginetest::DestructCMPSettingsModel +// DestructCMPSettingsModel test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cui_mediaplayersettingsenginetest::DestructCMPSettingsModel( CStifItemParser& /*aItem*/ ) + { + TInt err = KErrNone; + if(iRopSettingsModel) + { + //REComSession::FinalClose(); + delete iRopSettingsModel; + iRopSettingsModel = NULL; + } + iLog->Log( _L("Create CMPSettingsModel Success!")); + return err; + } + +// ----------------------------------------------------------------------------- +// Cui_mediaplayersettingsenginetest::MPSListImplementations +// MPSListImplementations test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cui_mediaplayersettingsenginetest::MPSListImplementations( CStifItemParser& /*aItem*/ ) + { + iLog->Log( _L("Test ListImplementationsL,begins!") ); + TInt result( KErrNone ); + RImplInfoPtrArray impInfoArray; + + TRAP( result, CMPSettingsModel::ListImplementationsL(impInfoArray)); + + if( result == KErrNone ) + { + iLog->Log( _L("Succeeds!The details of the implementation array are listed here:") ); + for( TInt i=0;iLog( _L("The class name of impInfoArray[%d] is:"),i ); + iLog->Log( impInfoArray[i]->DisplayName() ); + iLog->Log( _L("Its uid is %d."),impInfoArray[i]->ImplementationUid().iUid ); + } + iLog->Log( _L("End!") ); + } + else + { + iLog->Log( _L("Fails,error %d returns!End!"),result ); + } + impInfoArray.Close(); + return result; + } + +// ----------------------------------------------------------------------------- +// Cui_mediaplayersettingsenginetest::?member_function +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +/* +TInt Cui_mediaplayersettingsenginetest::?member_function( + CItemParser& aItem ) + { + + ?code + + } +*/ + +// ========================== OTHER EXPORTED FUNCTIONS ========================= +// None + +// [End of File] - Do not remove diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_albumart_utility_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_albumart_utility_api/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2007 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 +: mpx albumart utilities API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/mpxalbumartutility.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxalbumartutility.h) diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_albumart_utility_api/inc/mpxalbumartutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_albumart_utility_api/inc/mpxalbumartutility.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,286 @@ +/* +* Copyright (c) 2006 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: MPX album art utility +* +*/ + + +#ifndef CMPXALBUMARTUTILITY_H +#define CMPXALBUMARTUTILITY_H + +#include +#include +#include + +class CMPXMedia; +class CMPXImageUtil; +class CMPXImageUtilSync; +class CFbsBitmap; + +// CLASS DECLARATION + +/** + * Observer class for Async util operation + * + * @lib mpxalbumartutility.lib + */ +NONSHARABLE_CLASS( MMPXAlbumArtUtilityObserver ) + { +public: + /** + * Notify that extraction of album art started. + * + * @since S60 3.2.3 + */ + virtual void ExtractAlbumArtStarted() = 0; + + /** + * Notify that the extraction of album art has completed. + * + * @since S60 3.2.3 + * @param aBitmap a converted image. + * @param aErr error code + */ + virtual void ExtractAlbumArtCompleted( CFbsBitmap* aBitmap, TInt aErr ) = 0; + + }; + +/** + * Music Player common utility class + * + * @lib mpxalbumartutility.lib + */ +class CMPXAlbumArtUtility: public CActive + { +public: + /** + * Two phased contructor + * + * @since S60 3.2.3 + */ + IMPORT_C static CMPXAlbumArtUtility* NewL(); + + /** + * Destuctor + * + * @since S60 3.2.3 + */ + IMPORT_C ~CMPXAlbumArtUtility(); + +public: // async API + /** + * Extract album art data. + * + * @since S60 3.2.3 + * @param aProp media property the media must contain the following + * attributes: + * TMPXAttribute( KMPXMediaIdMusic, EMPXMediaMusicAlbumArtFileName ) + * TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralUri ) + * @param aObs callback after the operation completed. + * @param aSize The size of the required destination BMP. + * @param aDisplayMode the display mode of the destination BMP + * @leave KErrNotReady, KErrNotFound, or KErrUnderflow + * (Album Art, album art file name is not found + * or object is not ready) + */ + IMPORT_C void ExtractAlbumArtL(const CMPXMedia& aProp, + MMPXAlbumArtUtilityObserver& aObs, + const TSize& aSize, + TDisplayMode aDisplayMode = EColor64K); + + /** + * Asynchronously decodes an image from a JPG file. Generates a BMP in memory. + * + * @since S60 3.2.3 + * @param aStatus request status + * @param aSourceJPGFile Full path and filename of the image to be decoded. + * @param aDestBMP Destination bitmap, allocated inside. + * @param aSize destination size to be used for calculating the optimal loading size + * @param aDisplayMode the display mode of the destination BMP + */ + IMPORT_C void Decode(TRequestStatus& aStatus, const TDesC& aSourceJPGFile, + CFbsBitmap& aDestBMP, TSize aSize, TDisplayMode aDisplayMode = EColor64K); + + /** + * Asynchronously decodes an image from JPG buffer. Generates a BMP in memory. + * + * @since S60 3.2.3 + * @param aStatus request status + * @param aSourceJPG JPG data + * @param aDestBMP destination bitmap, created inside. + * @param aSize destination size to be used for calculating the optimal loading size + * @param aDisplayMode the display mode of the destination BMP + */ + IMPORT_C void Decode(TRequestStatus& aStatus, const TDesC8& aSourceJPG, CFbsBitmap& aDestBMP, + TSize aSize, TDisplayMode aDisplayMode = EColor64K); + + /** + * Asynchronously encodes a BMP to a JPG. + * + * @since S60 3.2.3 + * @param aStatus request status for ther asynchronous operation + * @param aSourceBMP source BMP + * @param aDestJPG destination JPG + */ + IMPORT_C void Encode(TRequestStatus& aStatus, const CFbsBitmap& aSourceBMP, + HBufC8*& aDestJPG); + + /** + * Asynchronously scales a BMP to a specified size. Generates another + * BMP in memory. + * + * @since S60 3.2.3 + * @param aStatus request status for ther asynchronous operation + * @param aSourceBMP source BMP + * @param aDestBMP destination BMP + * @param aSize size to scale to + * @param aDisplayMode display mode for the destination image + */ + IMPORT_C void Scale(TRequestStatus& aStatus, CFbsBitmap& aSourceBMP, CFbsBitmap& aDestBMP, + TSize aSize, TDisplayMode aDisplayMode = EColor64K); + +public: // sync API + + /** + * Synchronously decodes an image from a JPG file. + * + * @since S60 3.2.3 + * @param aSourceJPGFile Full path and filename of the image to be decoded. + * @param aSize destination size to be used for calculating the optimal loading size + * @param aDisplayMode the display mode of the destination BMP + * @return converted bitmap. Ownership is transferred. + */ + IMPORT_C CFbsBitmap* DecodeL(const TDesC& aSourceJPGFile, TSize aSize, TDisplayMode aDisplayMode = EColor64K); + + /** + * Synchronously converts a JPG buffer to an CFbsBitmap. + * + * @since S60 3.2.3 + * @param aSourceJPG JPG data + * @param aSize destination size to be used for calculating the optimal loading size + * @param aDisplayMode the display mode of the destination BMP + * @return converted bitmap. Ownership is transferred. + */ + IMPORT_C CFbsBitmap* DecodeL(const TDesC8& aSourceJPG, TSize aSize, TDisplayMode aDisplayMode = EColor64K); + + /** + * Synchronously encodes a BMP to JPG. + * + * @since S60 3.2.3 + * @param aSourceBMP source BMP + * @return destination JPG, ownership is transferred + */ + IMPORT_C HBufC8* EncodeL(const CFbsBitmap& aSourceBMP); + + /** + * Synchronously scales a BMP to a specified size + * + * @since S60 3.2.3 + * @param aSourceBMP source BMP + * @param aSize size to scale to + * @param aDisplayMode display mode for the destination image + * @return scaled BMP, ownership is transferred + */ + IMPORT_C CFbsBitmap* ScaleL(CFbsBitmap& aSourceBMP, TSize aSize, TDisplayMode aDisplayMode = EColor64K); + + /** + * Extracts embedded album art field from the media file. + * + * @since S60 3.2.3 + * @param aUri file URI + * @return embebded JPG album art. Ownership is transferred. + */ + IMPORT_C HBufC8* ExtractL(const TDesC& aUri); + + /** + * Returns a new bitmap object from bitmnap data. + * + * @since S60 3.2.3 + * @param aBMPData source BMP data + * @return new bitmap object. Ownership is transferred. + */ + IMPORT_C CFbsBitmap* BitmapL(const TDesC8& aBMPData); + + /** + * Returns bitmap data from a bitmap object. + * + * @since S60 3.2.3 + * @param aBMP source BMP + * @return bitmap data. Ownership is transferred. + */ + IMPORT_C HBufC8* BitmapDataL(const CFbsBitmap& aBMP); + + /** + * Cancel outstanding asynch requests. + * + * @since S60 3.2.3 + */ + IMPORT_C void CancelRequest(); + +private: + + /** + * C++ constructor + * + * @since S60 3.2.3 + */ + CMPXAlbumArtUtility(); + + /** + * Second phase constructor + * + * @since S60 3.2.3 + * + */ + void ConstructL(); + +private: // From CActive + /** + * @since S60 3.2.3 + * @see CActive + */ + void DoCancel(); + + /** + * @since S60 3.2.3 + * @see CActive + */ + void RunL(); + + /** + * @since S60 3.2.3 + * @see CActive + */ + TInt RunError(TInt aError); + +private: + // Internal operation codes + enum TOperation + { + EIdle = 0, + EExtractAlbumArtL + }; + +private: + CMPXImageUtil* iImageUtil; + CMPXImageUtilSync* iImageUtilSync; + MMPXAlbumArtUtilityObserver* iObs; + TOperation iCurrentOp; + HBufC8* iAlbumArt; + CFbsBitmap* iBitmap; + }; + +#endif // CMPXALBUMARTUTILITY_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_albumart_utility_api/mpx_albumart_utility_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_albumart_utility_api/mpx_albumart_utility_api.metaxml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,15 @@ + + +mpx albumart utility api +mpx albumart utility api (Domain API) in MPX Frameworks. +c++ +mmappcomponents + + + + + +no +no + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_albumart_utility_api/tsrc/conf/mpxalbumartutilitytest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_albumart_utility_api/tsrc/conf/mpxalbumartutilitytest.cfg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,178 @@ +[Test] +title 1: CMPXAlbumArtUtilityNewL +create mpxalbumartutilitytest AlbumArtUtility +AlbumArtUtility CMPXAlbumArtUtilityNewL +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityDestructor +pause 1000 +delete AlbumArtUtility +[Endtest] + +[Test] +title 2: CMPXAlbumArtUtilityDestructor +create mpxalbumartutilitytest AlbumArtUtility +AlbumArtUtility CMPXAlbumArtUtilityNewL +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityDestructor +pause 1000 +delete AlbumArtUtility +[Endtest] + + +[Test] +title 3: CMPXAlbumArtUtilityExtractAlbumArtL +create mpxalbumartutilitytest AlbumArtUtility +AlbumArtUtility CMPXAlbumArtUtilityNewL +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityExtractAlbumArtL test.bmp +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityDestructor +pause 1000 +delete AlbumArtUtility +[Endtest] + +[Test] +title 4: CMPXAlbumArtUtilityDecode +create mpxalbumartutilitytest AlbumArtUtility +//AlbumArtUtility CMPXAlbumArtUtilityNewL +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityDecode Waterlilies.jpg +//AlbumArtUtility CMPXAlbumArtUtilityDestructor +pause 1000 +delete AlbumArtUtility +[Endtest] + +[Test] +title 5: CMPXAlbumArtUtilityDecodeASourceJPG +create mpxalbumartutilitytest AlbumArtUtility +AlbumArtUtility CMPXAlbumArtUtilityNewL +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityDecodeASourceJPG Waterlilies.jpg +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityDestructor +pause 1000 +delete AlbumArtUtility +[Endtest] + +[Test] +title 6: CMPXAlbumArtUtilityEncode +create mpxalbumartutilitytest AlbumArtUtility +AlbumArtUtility CMPXAlbumArtUtilityNewL +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityEncode test.bmp +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityDestructor +pause 1000 +delete AlbumArtUtility +[Endtest] + +[Test] +title 7: CMPXAlbumArtUtilityScale +create mpxalbumartutilitytest AlbumArtUtility +//AlbumArtUtility CMPXAlbumArtUtilityNewL +AlbumArtUtility CMPXAlbumArtUtilityScale +pause 1000 +//AlbumArtUtility CMPXAlbumArtUtilityDestructor +pause 1000 +delete AlbumArtUtility +[Endtest] + +[Test] +title 8: CMPXAlbumArtUtilityDecodeL +create mpxalbumartutilitytest AlbumArtUtility +AlbumArtUtility CMPXAlbumArtUtilityNewL +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityDecodeL Waterlilies.jpg +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityDestructor +pause 1000 + +delete AlbumArtUtility +[Endtest] + +[Test] +title 9: CMPXAlbumArtUtilityDecodeLASourceJPG +create mpxalbumartutilitytest AlbumArtUtility +AlbumArtUtility CMPXAlbumArtUtilityNewL +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityDecodeLASourceJPG Waterlilies.jpg +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityDestructor +pause 1000 +delete AlbumArtUtility +[Endtest] + + +[Test] +title 10: CMPXAlbumArtUtilityEncodeL +create mpxalbumartutilitytest AlbumArtUtility +AlbumArtUtility CMPXAlbumArtUtilityNewL +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityEncodeL +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityDestructor +pause 1000 +delete AlbumArtUtility +[Endtest] + +[Test] +title 11: CMPXAlbumArtUtilityScaleL +create mpxalbumartutilitytest AlbumArtUtility +AlbumArtUtility CMPXAlbumArtUtilityNewL +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityScaleL Waterlilies.jpg +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityDestructor +pause 1000 +delete AlbumArtUtility +[Endtest] + +[Test] +title 12: CMPXAlbumArtUtilityExtractL +create mpxalbumartutilitytest AlbumArtUtility +AlbumArtUtility CMPXAlbumArtUtilityNewL +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityExtractL test.mbm +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityDestructor +pause 1000 +delete AlbumArtUtility +[Endtest] + +[Test] +title 13: CMPXAlbumArtUtilityBitmapL +create mpxalbumartutilitytest AlbumArtUtility +AlbumArtUtility CMPXAlbumArtUtilityNewL +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityBitmapL test.bmp +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityDestructor +pause 1000 +delete AlbumArtUtility +[Endtest] + +[Test] +title 14: CMPXAlbumArtUtilityBitmapDataL +create mpxalbumartutilitytest AlbumArtUtility +AlbumArtUtility CMPXAlbumArtUtilityNewL +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityBitmapDataL Waterlilies.jpg +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityDestructor +pause 1000 +delete AlbumArtUtility +[Endtest] + +[Test] +title 15: CMPXAlbumArtUtilityCancelRequest +create mpxalbumartutilitytest AlbumArtUtility +AlbumArtUtility CMPXAlbumArtUtilityNewL +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityBitmapDataL Waterlilies.jpg +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityCancelRequest +pause 1000 +AlbumArtUtility CMPXAlbumArtUtilityDestructor +pause 1000 +delete AlbumArtUtility +[Endtest] \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_albumart_utility_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_albumart_utility_api/tsrc/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2007 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 for project mpxalbumartutilitytest +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_TESTEXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +#include "../mpxalbumartutilitytest/group/bld.inf" + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_albumart_utility_api/tsrc/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_albumart_utility_api/tsrc/init/TestFramework.ini Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,197 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[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_mpxalbumartutilitytest + +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= 0 # Default timeout value for each test case. In milliseconds +UITestingSupport= YES +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +[New_Module] +ModuleName= testscripter +TestCaseFile= c:\testframework\mpxalbumartutilitytest.cfg +[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[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= D:\LOGS\TestFramework\ +#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 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_albumart_utility_api/tsrc/mpxalbumartutilitytest/Bmarm/mpxalbumartutilitytestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_albumart_utility_api/tsrc/mpxalbumartutilitytest/Bmarm/mpxalbumartutilitytestU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_albumart_utility_api/tsrc/mpxalbumartutilitytest/Bwins/mpxalbumartutilitytestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_albumart_utility_api/tsrc/mpxalbumartutilitytest/Bwins/mpxalbumartutilitytestU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_albumart_utility_api/tsrc/mpxalbumartutilitytest/EABI/mpxalbumartutilitytestU.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_albumart_utility_api/tsrc/mpxalbumartutilitytest/EABI/mpxalbumartutilitytestU.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_albumart_utility_api/tsrc/mpxalbumartutilitytest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_albumart_utility_api/tsrc/mpxalbumartutilitytest/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2002 - 2007 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: bld.inf +* +*/ + + + +PRJ_PLATFORMS +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these +DEFAULT + +PRJ_TESTEXPORTS +// NOTE: If using ARS requirements all export operations should be done under this. +// 'abld test export' + +PRJ_EXPORTS +// Specify the source file followed by its destination here +// copy will be used to copy the source file to its destination +// If there's no destination then the source file will be copied +// to the same name in /epoc32/include +// Example: +/* +/agnmodel/inc/AGMCOMON.H +*/ + +PRJ_TESTMMPFILES +mpxalbumartutilitytest.mmp + +PRJ_MMPFILES + +// Specify the .mmp files required for building the important component +// releasables. +// +// Specify "tidy" if the component you need to build doesn't need to be +// released. Specify "ignore" if the MMP file exists but should be +// ignored. +// Example: +/* +/agnmodel/group/agnmodel.mmp +#if defined(MARM) +/agnmodel/group/agsvexe.mmp +#endif +*/ + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_albumart_utility_api/tsrc/mpxalbumartutilitytest/group/mpxalbumartutilitytest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_albumart_utility_api/tsrc/mpxalbumartutilitytest/group/mpxalbumartutilitytest.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,80 @@ +/*TYPE TESTCLASS*//* +* Copyright (c) 2002 - 2007 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: mpxalbumartutilitytest.mmp +* +*/ + + +#if defined(__S60_) +#include +#endif + +TARGET mpxalbumartutilitytest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +/* Remove comments and replace 0x00000000 with correct vendor id */ +// VENDORID 0x00000000 +/* Remove comments and replace 0x00000000 with correct secure id */ +// SECUREID 0x00000000 + +//TARGETPATH ?target_path +DEFFILE mpxalbumartutilitytest.def + +MW_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src + + +SOURCE mpxalbumartutilitytest.cpp +SOURCE mpxalbumartutilitytestBlocks.cpp + +//RESOURCE resource_file +//RESOURCE resource_file2 +USERINCLUDE ../inc + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY mpxalbumartutility.lib +LIBRARY mpxcommon.lib fbscli.lib imageconversion.lib ws32.lib estor.lib egul.lib + +LANG SC + +/* +START WINS +?wins_specific_information +END + +START MARM +?marm_specific_information +END +*/ +// Other possible keywords: + +// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) +/* +START BITMAP ?target +TARGETPATH ?emulated_path_on_target_machine +HEADER +SOURCE ?color_depth ?source_bitmap +END +*/ +// DEFFILE ?filename +// AIF ?filename + +// End of File + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_albumart_utility_api/tsrc/mpxalbumartutilitytest/group/mpxalbumartutilitytest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_albumart_utility_api/tsrc/mpxalbumartutilitytest/group/mpxalbumartutilitytest.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,68 @@ +; +; 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: Package file for mpx albumart utility STIF component +; +; +; Installation file for STIF +; + +; Languages +&EN + + +; Package header +#{"STIF mpx albumart utility Test Application"},(0x10005942),1,1,0,TYPE=SA + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Logo +; None + +; Package signature - Optional +; None + +; Start of Package body + +; Condition blocks +; None + +; Options list +; None + +; Install files + +"..\..\data\mmc\qgn_graf_mup2_visualizer_bg_image2.bmp" - "e:\testing\data\qgn_graf_mup2_visualizer_bg_image2.bmp" +"..\..\data\mmc\test.bmp" - "e:\testing\data\test.bmp" +"..\..\data\mmc\test.mbm" - "e:\testing\data\test.mbm" +"..\..\data\mmc\Waterlilies.jpg" - "e:\testing\data\Waterlilies.jpg" + +"..\..\init\TestFramework.ini" - "c:\testframework\TestFramework.ini" +"..\..\conf\mpxalbumartutilitytest.cfg" - "c:\testframework\mpxalbumartutilitytest.cfg" + +"\epoc32\release\armv5\urel\mpxalbumartutilitytest.dll" - "c:\Sys\Bin\mpxalbumartutilitytest.dll" + +; Embedded SIS +; None + +; End of Package body + +; PKG dependencies +; None + +; PKG capabilities +; None diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_albumart_utility_api/tsrc/mpxalbumartutilitytest/inc/mpxalbumartutilitytest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_albumart_utility_api/tsrc/mpxalbumartutilitytest/inc/mpxalbumartutilitytest.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,190 @@ +/* +* Copyright (c) 2002 - 2007 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: STIF for mpx_albumart_utility_api +* +*/ + + + +#ifndef MPXALBUMARTUTILITYTEST_H +#define MPXALBUMARTUTILITYTEST_H + +// INCLUDES +#include +#include +#include +#include + +#include +#include +#include +#include +#include +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def +#define TEST_CLASS_VERSION_MAJOR 0 +#define TEST_CLASS_VERSION_MINOR 0 +#define TEST_CLASS_VERSION_BUILD 0 + +// Logging path +#ifdef __WINSCW__ +_LIT( KmpxalbumartutilitytestLogPath, "C:\\logs\\testframework\\mpxalbumartutilitytest\\" ); +// Log file +_LIT( KmpxalbumartutilitytestLogFile, "mpxalbumartutilitytest.txt" ); +_LIT( KmpxalbumartutilitytestLogFileWithTitle, "mpxalbumartutilitytest_[%S].txt" ); +_LIT( Kmpxalbumartutilitytest_testPath, "C:\\testing\\data\\" ); +_LIT( KTestFileMimeType, "audio/aac" ); +_LIT( KDestJPG, "C:\\testing\\data\\test.jpg" ); + +#else +_LIT( KmpxalbumartutilitytestLogPath, "E:\\logs\\testframework\\mpxalbumartutilitytest\\" ); +// Log file +_LIT( KmpxalbumartutilitytestLogFile, "mpxalbumartutilitytest.txt" ); +_LIT( KmpxalbumartutilitytestLogFileWithTitle, "mpxalbumartutilitytest_[%S].txt" ); +_LIT( Kmpxalbumartutilitytest_testPath, "E:\\testing\\data\\" ); +_LIT( KTestFileMimeType, "audio/aac" ); +_LIT( KDestJPG, "E:\\testing\\data\\test.jpg" ); +#endif + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class Cmpxalbumartutilitytest; +class CMPXAlbumArtUtility; +class CMPXMedia; + +/** +* Cmpxalbumartutilitytest test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(Cmpxalbumartutilitytest) : public CScriptBase, + public MMPXAlbumArtUtilityObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Cmpxalbumartutilitytest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Cmpxalbumartutilitytest(); + + + + 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 ); + + /** + * Notify that extraction of album art started. + * + * @since S60 3.2.3 + */ + virtual void ExtractAlbumArtStarted(); + + /** + * Notify that the extraction of album art has completed. + * + * @since S60 3.2.3 + * @param aBitmap a converted image. + * @param aErr error code + */ + virtual void ExtractAlbumArtCompleted( CFbsBitmap* aBitmap, TInt aErr ) ; + + + + private: + + /** + * C++ default constructor. + */ + Cmpxalbumartutilitytest( 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 ExtractAlbumArtStarted(); + void ExtractAlbumArtCompleted( CFbsBitmap* aBitmap, TInt aErr ) ; +*/ + /** + * Test methods are listed below. + */ + + /** + * Example test method. + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + virtual TInt ExampleL( CStifItemParser& aItem ); + TInt CMPXAlbumArtUtilityNewL( CStifItemParser& aItem );//Pass + TInt CMPXAlbumArtUtilityDestructor( CStifItemParser& aItem );//Pass + TInt CMPXAlbumArtUtilityExtractAlbumArtL( CStifItemParser& aItem ); + TInt CMPXAlbumArtUtilityDecode( CStifItemParser& aItem ); + TInt CMPXAlbumArtUtilityDecodeASourceJPG( CStifItemParser& aItem ); + TInt CMPXAlbumArtUtilityEncode( CStifItemParser& aItem ); + TInt CMPXAlbumArtUtilityScale( CStifItemParser& aItem ); + TInt CMPXAlbumArtUtilityDecodeL( CStifItemParser& aItem );//Pass + TInt CMPXAlbumArtUtilityDecodeLASourceJPG( CStifItemParser& aItem );//Pass + TInt CMPXAlbumArtUtilityEncodeL( CStifItemParser& aItem );//Pass + TInt CMPXAlbumArtUtilityScaleL( CStifItemParser& aItem ); + TInt CMPXAlbumArtUtilityExtractL( CStifItemParser& aItem );//Pass + TInt CMPXAlbumArtUtilityBitmapL( CStifItemParser& aItem ); + TInt CMPXAlbumArtUtilityBitmapDataL( CStifItemParser& aItem ); + TInt CMPXAlbumArtUtilityCancelRequest( CStifItemParser& aItem );//Pass + /** + * Method used to log version of test class + */ + void SendTestClassVersion(); + + + private: // Friend classes + //?friend_class_declaration; + CMPXAlbumArtUtility* iAlbumArtUtility; + TBool iAlbumArtConverting; + CFbsBitmap* iAlbumArt; + CFbsBitmap* iBackgroundBitmap; + TBool iArtExist; + CGulIcon* iDefaultAAImage; + }; + +#endif // MPXALBUMARTUTILITYTEST_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_albumart_utility_api/tsrc/mpxalbumartutilitytest/src/mpxalbumartutilitytest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_albumart_utility_api/tsrc/mpxalbumartutilitytest/src/mpxalbumartutilitytest.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,156 @@ +/* +* Copyright (c) 2002 - 2007 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 "mpxalbumartutilitytest.h" +#include + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cmpxalbumartutilitytest::Cmpxalbumartutilitytest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +Cmpxalbumartutilitytest::Cmpxalbumartutilitytest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// Cmpxalbumartutilitytest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Cmpxalbumartutilitytest::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(KmpxalbumartutilitytestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KmpxalbumartutilitytestLogFile); + } + + iLog = CStifLogger::NewL( KmpxalbumartutilitytestLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + SendTestClassVersion(); + } + +// ----------------------------------------------------------------------------- +// Cmpxalbumartutilitytest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Cmpxalbumartutilitytest* Cmpxalbumartutilitytest::NewL( + CTestModuleIf& aTestModuleIf ) + { + Cmpxalbumartutilitytest* self = new (ELeave) Cmpxalbumartutilitytest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +Cmpxalbumartutilitytest::~Cmpxalbumartutilitytest() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +//----------------------------------------------------------------------------- +// Cmpxalbumartutilitytest::SendTestClassVersion +// Method used to send version of test class +//----------------------------------------------------------------------------- +// +void Cmpxalbumartutilitytest::SendTestClassVersion() + { + TVersion moduleVersion; + moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; + moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; + moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; + + TFileName moduleName; + moduleName = _L("ui_mpxalbumartutilitytest.dll"); + + TBool newVersionOfMethod = ETrue; + TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); + } + + + +// ========================== 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* ) Cmpxalbumartutilitytest::NewL( aTestModuleIf ); + + } + + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_albumart_utility_api/tsrc/mpxalbumartutilitytest/src/mpxalbumartutilitytestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_albumart_utility_api/tsrc/mpxalbumartutilitytest/src/mpxalbumartutilitytestBlocks.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,566 @@ +/* +* Copyright (c) 2002 - 2007 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: STIF for mpx_albumart_utility_api +* +*/ + + + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include "mpxalbumartutilitytest.h" +#include + +#include +#include +#include + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cmpxalbumartutilitytest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Cmpxalbumartutilitytest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// Cmpxalbumartutilitytest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Cmpxalbumartutilitytest::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( "Example", Cmpxalbumartutilitytest::ExampleL ), + ENTRY( "CMPXAlbumArtUtilityNewL", Cmpxalbumartutilitytest::CMPXAlbumArtUtilityNewL ), + ENTRY( "CMPXAlbumArtUtilityDestructor", Cmpxalbumartutilitytest::CMPXAlbumArtUtilityDestructor ), + ENTRY( "CMPXAlbumArtUtilityExtractAlbumArtL", Cmpxalbumartutilitytest::CMPXAlbumArtUtilityExtractAlbumArtL ), + ENTRY( "CMPXAlbumArtUtilityDecode", Cmpxalbumartutilitytest::CMPXAlbumArtUtilityDecode ), + ENTRY( "CMPXAlbumArtUtilityDecodeASourceJPG", Cmpxalbumartutilitytest::CMPXAlbumArtUtilityDecodeASourceJPG ), + ENTRY( "CMPXAlbumArtUtilityEncode", Cmpxalbumartutilitytest::CMPXAlbumArtUtilityEncode ), + ENTRY( "CMPXAlbumArtUtilityScale", Cmpxalbumartutilitytest::CMPXAlbumArtUtilityScale ), + ENTRY( "CMPXAlbumArtUtilityDecodeL", Cmpxalbumartutilitytest::CMPXAlbumArtUtilityDecodeL ), + ENTRY( "CMPXAlbumArtUtilityDecodeLASourceJPG", Cmpxalbumartutilitytest::CMPXAlbumArtUtilityDecodeLASourceJPG ), + ENTRY( "CMPXAlbumArtUtilityEncodeL", Cmpxalbumartutilitytest::CMPXAlbumArtUtilityEncodeL ), + ENTRY( "CMPXAlbumArtUtilityScaleL", Cmpxalbumartutilitytest::CMPXAlbumArtUtilityScaleL ), + ENTRY( "CMPXAlbumArtUtilityExtractL", Cmpxalbumartutilitytest::CMPXAlbumArtUtilityExtractL ), + ENTRY( "CMPXAlbumArtUtilityBitmapL", Cmpxalbumartutilitytest::CMPXAlbumArtUtilityBitmapL ), + ENTRY( "CMPXAlbumArtUtilityBitmapDataL", Cmpxalbumartutilitytest::CMPXAlbumArtUtilityBitmapDataL ), + ENTRY( "CMPXAlbumArtUtilityCancelRequest", Cmpxalbumartutilitytest::CMPXAlbumArtUtilityCancelRequest ), + //ADD NEW ENTRY HERE + // [test cases entries] - Do not remove + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// ----------------------------------------------------------------------------- +// Cmpxalbumartutilitytest::ExampleL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cmpxalbumartutilitytest::ExampleL( CStifItemParser& aItem ) + { + + // Print to UI + _LIT( Kmpxalbumartutilitytest, "mpxalbumartutilitytest" ); + _LIT( KExample, "In Example" ); + TestModuleIf().Printf( 0, Kmpxalbumartutilitytest, KExample ); + // Print to log file + iLog->Log( KExample ); + + TInt i = 0; + TPtrC string; + _LIT( KParam, "Param[%i]: %S" ); + while ( aItem.GetNextString ( string ) == KErrNone ) + { + TestModuleIf().Printf( i, Kmpxalbumartutilitytest, + KParam, i, &string ); + i++; + } + + return KErrNone; + + } + +// ----------------------------------------------------------------------------- +// Cmpxalbumartutilitytest::ExtractAlbumArtStarted +// Extraction of album art started +// ----------------------------------------------------------------------------- +void Cmpxalbumartutilitytest::ExtractAlbumArtStarted() +{ +// FTRACE(FPrint(_L("Cmpxalbumartutilitytest::ExtractAlbumArtStarted"))); + iLog->Log(_L("Extraction of album art started")); +} + +// ----------------------------------------------------------------------------- +// Cmpxalbumartutilitytest::ExtractAlbumArtCompleted +// The extraction of album art has completed +// ----------------------------------------------------------------------------- +void Cmpxalbumartutilitytest::ExtractAlbumArtCompleted(CFbsBitmap* aBitmap, TInt aErr) +{ +// FTRACE(FPrint(_L("Cmpxalbumartutilitytest::ExtractAlbumArtStarted"))); + iLog->Log(_L("The extraction of album art has completed")); + iAlbumArtConverting = EFalse; + + delete iAlbumArt; + iAlbumArt = NULL; + + if ( aErr == KErrNone && aBitmap ) + { + iAlbumArt = aBitmap; + if( iAlbumArt ) + { + delete iBackgroundBitmap; + iBackgroundBitmap = NULL; + TRAP_IGNORE( iBackgroundBitmap = new (ELeave) CFbsBitmap() ); + if ( iBackgroundBitmap ) + { + TSize bitmapSize = iBackgroundBitmap->SizeInPixels(); + bitmapSize = iAlbumArt->SizeInPixels(); + iBackgroundBitmap->Duplicate(iAlbumArt->Handle()); + } + } + } + else + { + iArtExist = EFalse; + + // Album art was NULL, meaning none was retrieved + delete iBackgroundBitmap; + iBackgroundBitmap = NULL; + TRAP_IGNORE( iBackgroundBitmap = new (ELeave) CFbsBitmap() ); + if ( iBackgroundBitmap ) + { + iBackgroundBitmap->Duplicate((iDefaultAAImage->Bitmap())->Handle()); + } + } +} + +// --------------------------------------------------------------------------- +// Cmpxalbumartutilitytest::CMPXAlbumArtUtilityNewL +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxalbumartutilitytest::CMPXAlbumArtUtilityNewL( CStifItemParser& /*aItem*/ ) + { + TInt err=KErrNone; + iLog->Log(_L("Cmpxalbumartutilitytest::CMPXAlbumArtUtilityNewL")); + TRAP( err , iAlbumArtUtility = CMPXAlbumArtUtility::NewL()); + + if ( err == KErrNone ) + { + iLog->Log(_L("Cmpxalbumartutilitytest::NewL returned no err")); + } + else + { + iLog->Log(_L("Cmpxalbumartutilitytest::NewL returned: %d"), err); + } + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxalbumartutilitytest::CMPXAlbumArtUtilityDestructor +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxalbumartutilitytest::CMPXAlbumArtUtilityDestructor( CStifItemParser& /*aItem*/ ) + { + TInt err = KErrNone; + delete iAlbumArtUtility; + iAlbumArtUtility = NULL; + iLog->Log(_L("Cmpxalbumartutilitytest::Destructor returned CMPXAlbumArtUtility::~ end err=%d"), err); + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxalbumartutilitytest::CMPXAlbumArtUtilityExtractAlbumArtL +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxalbumartutilitytest::CMPXAlbumArtUtilityExtractAlbumArtL( CStifItemParser& aItem ) + { + TInt err=KErrNone; + TPtrC string; + if ( KErrNone == aItem.GetNextString(string) ) + { + TBuf<120> playlistBuf; + playlistBuf.Append(Kmpxalbumartutilitytest_testPath); + playlistBuf.Append(string); + RArray suppIds; + CleanupClosePushL(suppIds); + suppIds.AppendL(KMPXMediaIdMusic); + suppIds.AppendL(KMPXMediaIdGeneral); + suppIds.AppendL(KMPXMediaIdAudio); + suppIds.AppendL(KMPXMediaIdDrm); + CMPXMedia* media=CMPXMedia::NewL(suppIds.Array()); + CleanupStack::PopAndDestroy(&suppIds); + CleanupStack::PushL(media); + media->SetTObjectValueL(TMPXAttribute(KMPXMediaIdGeneral,EMPXMediaGeneralType), EMPXGroup); // default to group type + media->SetTextValueL(KMPXMediaGeneralUri,playlistBuf); + media->SetTextValueL(KMPXMediaMusicAlbumArtFileName,playlistBuf); + iLog->Log(_L("Cmpxalbumartutilitytest::CMPXAlbumArtUtilityExtractAlbumArtL")); + // iAlbumArtUtility->ExtractAlbumArtL(*media,*this,TSize(100,100)); + CleanupStack::PopAndDestroy(media); + + iLog->Log(_L("Cmpxalbumartutilitytest::ExtractAlbumArtL returned: %d"), err); + } + return err; + } + + +// --------------------------------------------------------------------------- +// Cmpxalbumartutilitytest::CMPXAlbumArtUtilityDecode +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxalbumartutilitytest::CMPXAlbumArtUtilityDecode( CStifItemParser& aItem ) + { + TInt err=KErrNone; + TPtrC string; + if( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KTestStr; + KTestStr.Append(Kmpxalbumartutilitytest_testPath); + KTestStr.Append(string); + TRequestStatus iStatus(0); + TBufC<50> path(KTestStr); + CFbsBitmap* iDestBMP; + TRAP( err , iDestBMP = new(ELeave) CFbsBitmap()); + iLog->Log(_L("Cmpxalbumartutilitytest::CMPXAlbumArtUtilityDecode")); + TRAP( err , iAlbumArtUtility = CMPXAlbumArtUtility::NewL()); + + iAlbumArtUtility->Decode(iStatus,path,*iDestBMP,TSize(1,1)); + User::WaitForRequest(iStatus); + + delete iDestBMP; + iDestBMP = NULL; + delete iAlbumArtUtility; + iAlbumArtUtility = NULL; + if ( err == KErrNone ) + { + iLog->Log(_L("Cmpxalbumartutilitytest::Decode returned no err")); + } + else + { + iLog->Log(_L("Cmpxalbumartutilitytest::Decode returned: %d"), err); + } + } + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxalbumartutilitytest::CMPXAlbumArtUtilityDecodeASourceJPG +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxalbumartutilitytest::CMPXAlbumArtUtilityDecodeASourceJPG( CStifItemParser& aItem ) + { + TInt err=KErrNone; + TPtrC string; + if( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<50> KTestStr; + KTestStr.Append(Kmpxalbumartutilitytest_testPath); + KTestStr.Append(string); + TRequestStatus iStatus(0); + TBufC<50> descriptor16(KTestStr); + TPtrC8 sourcepath = MPXUser::Ptr(descriptor16); + + CFbsBitmap* iDestBMP; + TRAP(err,iDestBMP = new(ELeave) CFbsBitmap()); + iLog->Log(_L("Cmpxalbumartutilitytest::CMPXAlbumArtUtilityDecodeASourceJPG")); + iAlbumArtUtility->Decode(iStatus,sourcepath,*iDestBMP,TSize(1,1)); + User::WaitForRequest(iStatus); + if ( err == KErrNone ) + { + iLog->Log(_L("Cmpxalbumartutilitytest::Decode returned no err")); + } + else + { + iLog->Log(_L("Cmpxalbumartutilitytest::Decode returned: %d"), err); + } + } + return err; + } + + +// --------------------------------------------------------------------------- +// Cmpxalbumartutilitytest::CMPXAlbumArtUtilityEncode +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxalbumartutilitytest::CMPXAlbumArtUtilityEncode( CStifItemParser& aItem ) + { + TInt err=KErrNone; + TPtrC string; + if( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<50> KTestStr; + KTestStr.Append(Kmpxalbumartutilitytest_testPath); + KTestStr.Append(string); + /*TRequestStatus iStatus(0); + CFbsBitmap* iSourceBMP; + TRAP(err , iSourceBMP = new(ELeave) CFbsBitmap()); + iSourceBMP->Load(KTestStr); + // HBufC8* iDestJPG(NULL); + HBufC8* destJPG = HBufC8::NewLC( 100 ); + destJPG->Des().Append( KDestJPG ); + iLog->Log(_L("Cmpxalbumartutilitytest::CMPXAlbumArtUtilityEncode")); + // iAlbumArtUtility->Encode(iStatus,*iSourceBMP,destJPG); + + User::WaitForRequest(iStatus); + delete iSourceBMP;*/ + iLog->Log(_L("Cmpxalbumartutilitytest::CMPXAlbumArtUtilityEncode returned: %d"), err); + } + return err; + + } + +// --------------------------------------------------------------------------- +// Cmpxalbumartutilitytest::CMPXAlbumArtUtilityScale +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxalbumartutilitytest::CMPXAlbumArtUtilityScale( CStifItemParser& /*aItem*/ ) + { + TInt err=KErrNone; + TRequestStatus iStatus(0); + CFbsBitmap* iSourceBMP; + TRAP(err,iSourceBMP=new(ELeave) CFbsBitmap()); + CFbsBitmap* iDestBMP; + TRAP(err,iDestBMP=new(ELeave) CFbsBitmap()); + + iLog->Log(_L("Cmpxalbumartutilitytest::CMPXAlbumArtUtilityScale")); + TRAP(err,iAlbumArtUtility=CMPXAlbumArtUtility::NewL()); + iAlbumArtUtility->Scale(iStatus,*iSourceBMP,*iDestBMP,TSize(1,1)); + + User::WaitForRequest(iStatus); + delete iAlbumArtUtility; + iAlbumArtUtility=NULL; + + iLog->Log(_L("Cmpxalbumartutilitytest::CMPXAlbumArtUtilityScale returned: %d"), err); + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxalbumartutilitytest::CMPXAlbumArtUtilityDecodeL +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +//8 +TInt Cmpxalbumartutilitytest::CMPXAlbumArtUtilityDecodeL( CStifItemParser& aItem ) + { + TInt err=KErrNone; + TPtrC string; + if ( KErrNone == aItem.GetNextString(string) ) + { + TBuf<120> KUri; + KUri.Append(Kmpxalbumartutilitytest_testPath); + KUri.Append(string); + iLog->Log(_L("Cmpxalbumartutilitytest::CMPXAlbumArtUtilityDecodeL")); + TRAP( err , iAlbumArtUtility->DecodeL(KUri,TSize(1,1))); + iLog->Log(_L("Cmpxalbumartutilitytest::CMPXAlbumArtUtilityDecodeL returned: %d"), err); + } + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxalbumartutilitytest::CMPXAlbumArtUtilityDecodeLASourceJPG +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxalbumartutilitytest::CMPXAlbumArtUtilityDecodeLASourceJPG( CStifItemParser& aItem ) + { + TInt err=KErrNone; + TPtrC string; + if ( KErrNone == aItem.GetNextString(string) ) + { + TBuf8<120> KPath; + KPath.Append(Kmpxalbumartutilitytest_testPath); + KPath.Append(string); + iLog->Log(_L("Cmpxalbumartutilitytest::CMPXAlbumArtUtilityDecodeLASourceJPG")); + TRAP(err , iAlbumArtUtility->DecodeL(KPath,TSize(1,1))); + iLog->Log(_L("Cmpxalbumartutilitytest::CMPXAlbumArtUtilityDecodeLASourceJPG returned: %d"), err); + } + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxalbumartutilitytest::CMPXAlbumArtUtilityEncodeL +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxalbumartutilitytest::CMPXAlbumArtUtilityEncodeL( CStifItemParser& aItem ) + { + TInt err=KErrNone; + TPtrC string; + if( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<50> KTestStr; + KTestStr.Append(Kmpxalbumartutilitytest_testPath); + KTestStr.Append(string); + CFbsBitmap* iSourceBMP; + TRAP(err , iSourceBMP = new(ELeave) CFbsBitmap()); + iSourceBMP->Load(KTestStr); + iLog->Log(_L("Cmpxalbumartutilitytest::CMPXAlbumArtUtilityEncodeL")); + // TRAP(err,iAlbumArtUtility->EncodeL(*iSourceBMP)); + iLog->Log(_L("Cmpxalbumartutilitytest::CMPXAlbumArtUtilityEncodeL returned: %d"), err); + delete iSourceBMP; + } + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxalbumartutilitytest::CMPXAlbumArtUtilityScaleL +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxalbumartutilitytest::CMPXAlbumArtUtilityScaleL( CStifItemParser& aItem ) + { + TInt err=KErrNone; + TPtrC string; + if ( KErrNone == aItem.GetNextString(string) ) + { + TBuf<120> KPath; + KPath.Append(Kmpxalbumartutilitytest_testPath); + KPath.Append(string); + iLog->Log(_L("Cmpxalbumartutilitytest::CMPXAlbumArtUtilityScaleL")); + CFbsBitmap* iSourceBMP = iAlbumArtUtility->DecodeL(KPath,TSize(1,1));//=new(ELeave) CFbsBitmap(); + + TRAP( err , iAlbumArtUtility->ScaleL(*iSourceBMP,TSize(10,10))); + + iLog->Log(_L("Cmpxalbumartutilitytest::CMPXAlbumArtUtilityScaleL returned: %d"), err); + } + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxalbumartutilitytest::CMPXAlbumArtUtilityExtractL +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +//12 +TInt Cmpxalbumartutilitytest::CMPXAlbumArtUtilityExtractL( CStifItemParser& aItem ) + { + TInt err = KErrNone; + TPtrC string; + if ( KErrNone == aItem.GetNextString(string) ) + { + TBuf<120> KPath; + KPath.Append(Kmpxalbumartutilitytest_testPath); + KPath.Append(string); + iLog->Log(_L("Cmpxalbumartutilitytest::CMPXAlbumArtUtilityExtractL")); + iAlbumArtUtility->ExtractL(KPath); + iLog->Log(_L("Cmpxalbumartutilitytest::CMPXAlbumArtUtilityExtractL returned: %d"), err); + } + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxalbumartutilitytest::CMPXAlbumArtUtilityBitmapL +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +//13 +TInt Cmpxalbumartutilitytest::CMPXAlbumArtUtilityBitmapL( CStifItemParser& aItem ) + { + TInt err=KErrNone; + TPtrC string; + if ( KErrNone == aItem.GetNextString(string) ) + { + TBuf8<120> KPath; + KPath.Append(Kmpxalbumartutilitytest_testPath); + KPath.Append(string); + iLog->Log(_L("Cmpxalbumartutilitytest::CMPXAlbumArtUtilityBitmapL")); + + // iAlbumArtUtility->BitmapL(KPath); + + iLog->Log(_L("Cmpxalbumartutilitytest::CMPXAlbumArtUtilityBitmapL returned: %d"), err); + } + return err; + } + +// --------------------------------------------------------------------------- +// Cmpxalbumartutilitytest::CMPXAlbumArtUtilityBitmapDataL +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxalbumartutilitytest::CMPXAlbumArtUtilityBitmapDataL( CStifItemParser& aItem ) + { + TInt err = KErrNone; + TPtrC string; + if ( KErrNone == aItem.GetNextString(string) ) + { + TBuf<120> KPath; + KPath.Append(Kmpxalbumartutilitytest_testPath); + KPath.Append(string); + iLog->Log(_L("Cmpxalbumartutilitytest::CMPXAlbumArtUtilityBitmapDataL")); + CFbsBitmap* iSourceBMP = iAlbumArtUtility->DecodeL(KPath,TSize(1,1)); + + TRAP( err , iAlbumArtUtility->BitmapDataL(*iSourceBMP)); + + iLog->Log(_L("Cmpxalbumartutilitytest::CMPXAlbumArtUtilityBitmapDataL returned: %d"), err); + } + return err; + } + + +// --------------------------------------------------------------------------- +// Cmpxalbumartutilitytest::CMPXAlbumArtUtilityCancelRequest +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cmpxalbumartutilitytest::CMPXAlbumArtUtilityCancelRequest( CStifItemParser& /*aItem*/ ) + { + TInt err=KErrNone; + iLog->Log(_L("Cmpxalbumartutilitytest::CMPXAlbumArtUtilityCancelRequest")); + iAlbumArtUtility->CancelRequest(); + iLog->Log(_L("Cmpxalbumartutilitytest::CancelRequest returned: %d"), err); + return err; + } + +// [End of File] - Do not remove diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_backstepping_utility_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_backstepping_utility_api/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2007 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 +: mpx back stepping utilities API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/mpxbacksteppingutility.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxbacksteppingutility.h) diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_backstepping_utility_api/inc/mpxbacksteppingutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_backstepping_utility_api/inc/mpxbacksteppingutility.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2007 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: MPX back stepping utility interface definition +* +*/ + + +#ifndef MMPXBACKSTEPPINGUTILITY_H +#define MMPXBACKSTEPPINGUTILITY_H + + +// INCLUDES +#include + +const TInt KMPXBackSteppingNotConsumed = 0; +const TInt KMPXBackSteppingConsumed = 1; + + +// CLASS DECLARATION + +/** + * Music Player common utility interface + * + * @lib mpxbacksteppingutility.lib + */ +NONSHARABLE_CLASS( MMPXBackSteppingUtility ) + { +public: + + /** + * Retrieve a back stepping utility of this thread. All clients in this thread + * shares the same utility (singleton) + * Call Close() when this object is not needed anymore. + * + * @since S60 3.2 + * @return Pointer to backstepping utility. Ownership not transferred. + */ + IMPORT_C static MMPXBackSteppingUtility* UtilityL(); + + /** + * This method must be called when this object can be freed. This object + * will be destroyed when no one is using it. + * + * @since S60 3.2 + */ + virtual void Close() = 0; + + /** + * Forwards activation event. + * + * @since S60 3.2 + * @param aState state of application like view ids + * @param aEnter indicate if it is entry/exit activation + * @return result code retutned by BS Service interface + * @leave leaves from HandleResultL are propagated + */ + virtual TInt ForwardActivationEventL( + const TDesC8& aState, + const TBool aEnter ) = 0; + + /** + * Handles back command. + * + * @since S60 3.2 + * @param aState state of application like view ids + * @return result code retutned by BS Service interface + * @leave leaves from HandleResultL are propagated + */ + virtual TInt HandleBackCommandL( const TDesC8& aState ) = 0; + + /** + * Initializes Backstepping Service. + * + * @since S60 3.2 + * @param aUid client application UID + * @leave KErrNotSupported or KErrArgument + * (if arguments passed to BS Service are incorrect + * or could not initialize BS) + * KErrNotFound (if there was no return value) + */ + virtual void InitializeL( const TUid aUid ) = 0; + }; + +#endif // MMPXBACKSTEPPINGUTILITY_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_backstepping_utility_api/mpx_backstepping_utility_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_backstepping_utility_api/mpx_backstepping_utility_api.metaxml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,15 @@ + + +mpx backstepping utility api +MPX Backstepping Utility API (Domain API) in MPX Frameworks +c++ +mmappcomponents + + + + + +no +no + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_base_view_plugins_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_base_view_plugins_api/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2007 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 +: mpx viewframework baseviewplugins API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/mpxakndialogplugin.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxakndialogplugin.h) +../inc/mpxaknviewplugin.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxaknviewplugin.h) +../inc/mpxviewplugin.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxviewplugin.h) +../inc/mpxviewplugin.hrh MW_LAYER_PLATFORM_EXPORT_PATH(mpxviewplugin.hrh) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_base_view_plugins_api/inc/mpxakndialogplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_base_view_plugins_api/inc/mpxakndialogplugin.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2006 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: MPX Avkon dialog plugin definition. +* +*/ + + + +#ifndef CMPXAKNDIALOGPLUGIN_H +#define CMPXAKNDIALOGPLUGIN_H + + +// INCLUDES +#include "mpxviewplugin.h" + + +// FORWARD DECLARATIONS +class CAknDialog; + + +// CLASS DECLARATION + +/** + * MPX Avkon dialog plugin definition. + * + * @lib mpxviewplugin.lib + */ +class CMPXAknDialogPlugin : public CMPXViewPlugin + { +public: + + /** + * Destructor. + * + * @since S60 3.0 + */ + IMPORT_C virtual ~CMPXAknDialogPlugin(); + +protected: + + /** + * Interface method to construct Avkon dialog. + * + * @since S60 3.0 + * @return Pointer to a newly created Avkon dialog. + */ + virtual CAknDialog* ConstructDialogL() = 0; + + /** + * Return resource id of the Avkon dialog. + * + * @since S60 v.0 + * @return Dialog resource id. + */ + virtual TInt ResourceId() = 0; + +// from base class CMPXViewPlugin + + /** + * Interface method to create view. + * From CMPXViewPlugin + * + * @since S60 3.0 + */ + IMPORT_C virtual void CreateViewL(); + + /** + * Interface method to destroy view. + * From CMPXViewPlugin + * + * @since S60 3.0 + */ + IMPORT_C virtual void DestroyView(); + + /** + * Interface method to activate view. + * From CMPXViewPlugin + * + * @since S60 3.0 + * @param aParam Parameter required to activate the view. + */ + IMPORT_C virtual void ActivateViewL( const TDesC* aParam = NULL ); + + /** + * Interface method to activate as default view. + * Will not bring to foreground. + * From CMPXViewPlugin + * + * @since S60 3.0 + * @leave KErrNotSupported + */ + IMPORT_C virtual void SetAsDefaultViewL(); + + /** + * Interface method to deactivate view. + * From CMPXViewPlugin + * + * @since S60 3.0 + */ + IMPORT_C virtual void DeactivateView(); + +protected: // data + + /** + * Avkon dialog that associates with this plugin. + */ + CAknDialog* iDialog; + }; + +#endif // CMPXAKNDIALOGPLUGIN_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_base_view_plugins_api/inc/mpxaknviewplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_base_view_plugins_api/inc/mpxaknviewplugin.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2006 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: MPX Avkon view plugin definition. +* +*/ + + + +#ifndef CMPXAKNVIEWPLUGIN_H +#define CMPXAKNVIEWPLUGIN_H + + +// INCLUDES +#include "mpxviewplugin.h" + + +// FORWARD DECLARATIONS +class CAknView; + + +// CLASS DECLARATION + +/** + * MPX Avkon view plugin definition. + * + * @lib mpxviewplugin.lib + */ +class CMPXAknViewPlugin : public CMPXViewPlugin + { +public: + + /** + * Destructor. + * + * @since S60 3.0 + */ + IMPORT_C virtual ~CMPXAknViewPlugin(); + +protected: + + /** + * Interface method to construct Avkon view. + * + * @since S60 3.0 + * @return Pointer to a newly created Avkon view. + */ + virtual CAknView* ConstructViewLC() = 0; + +// from base class CMPXViewPlugin + + /** + * Interface method to create view. + * From CMPXViewPlugin + * + * @since S60 3.0 + */ + IMPORT_C virtual void CreateViewL(); + + /** + * Interface method to destroy view. + * From CMPXViewPlugin + * + * @since S60 v.0 + */ + IMPORT_C virtual void DestroyView(); + + /** + * Interface method to activate view. + * From CMPXViewPlugin + * + * @since S60 3.0 + * @param aParam Parameter required to activate the view. + */ + IMPORT_C virtual void ActivateViewL( const TDesC* aParam = NULL ); + + /** + * Interface method to activate as default view. + * Will not bring to foreground. + * From CMPXViewPlugin + * + * @since S60 3.0 + */ + IMPORT_C virtual void SetAsDefaultViewL(); + + /** + * Interface method to deactivate view. + * From CMPXViewPlugin + * + * @since S60 3.0 + */ + IMPORT_C virtual void DeactivateView(); + +protected: // data + + /** + * Avkon view that associates with this plugin. + * Not own. + */ + CAknView* iView; + }; + +#endif // CMPXAKNVIEWPLUGIN_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_base_view_plugins_api/inc/mpxviewplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_base_view_plugins_api/inc/mpxviewplugin.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,118 @@ +/* +* Copyright (c) 2006 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: MPX view plugin definition. +* +*/ + + + +#ifndef CMPXVIEWPLUGIN_H +#define CMPXVIEWPLUGIN_H + + +// INCLUDES +#include + + +// CLASS DECLARATION +class MMPXCustomCommandObserver; + +/** + * MPX view plugin definition. + * + * @lib mpxviewplugin.lib + */ +class CMPXViewPlugin : public CBase + { +public: + + /** + * Two-phased constructor. + * + * @since S60 3.0 + * @param aUid Implementation Uid. + * @param aCommandObserver Observer to handle commands. + * @return Pointer to newly created object. + */ + IMPORT_C static CMPXViewPlugin* NewL( + const TUid& aUid, + MMPXCustomCommandObserver* aCommandObserver ); + + /** + * Destructor. + * + * @since S60 3.0 + */ + IMPORT_C virtual ~CMPXViewPlugin(); + + /** + * Interface method to create view. + * + * @since S60 3.0 + */ + virtual void CreateViewL() = 0; + + /** + * Interface method to destroy view. + * + * @since S60 3.0 + */ + virtual void DestroyView() = 0; + + /** + * Interface method to activate view. + * + * @since S60 3.0 + * @param aParam Parameter required to activate the view. + */ + virtual void ActivateViewL( const TDesC* aParam = NULL ) = 0; + + /** + * Interface method to activate as default view. + * Will not bring to foreground. + * + * @since S60 3.0 + */ + virtual void SetAsDefaultViewL() = 0; + + /** + * Interface method to deactivate view. + * + * @since S60 3.0 + */ + virtual void DeactivateView() = 0; + +protected: + /** + * Sets observer for custom commands. + * + * @since S60 3.0 + * @param aCommandObserver Observer to handle commands. + */ + IMPORT_C virtual void SetObserver( + MMPXCustomCommandObserver* aCommandObserver ); + +protected: // Data + + MMPXCustomCommandObserver* iCommandObserver; // not owned + +private: // Data + + // identifies the actual plugin instance + TUid iDtorKey; + }; + +#endif // CMPXVIEWPLUGIN_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_base_view_plugins_api/inc/mpxviewplugin.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_base_view_plugins_api/inc/mpxviewplugin.hrh Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2006 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: Resource headers for project mpxviewplugin +* +*/ + + + +#ifndef MPXVIEWPLUGIN_HRH +#define MPXVIEWPLUGIN_HRH + +#include + +// CONSTANTS + +/** View plugin interface UID */ +#define KMPXViewPluginInterfaceUid 0x101ffc6f + + +// DEPRECATED +// the following enums/constants are deprecated, +// use the corresponding enums defined in mpxplugin.hrh instead +// these will be removed in a future release + +/** Flag to indicate that this plugin needs to be preloaded */ +#define KMPXVpFeaturePreLoaded 0x0001 + +/** Flag to indicate that this plugin is user selectable */ +#define KMPXVpFeatureUserSelectable 0x0002 + +/** View Plugin priorities */ +enum TMPXViewPluginPriorities + { + EMPXViewPluginPriorityLowest = -20000, + EMPXViewPluginPriorityLow = -10000, + EMPXViewPluginPriorityNormal = 0, + EMPXViewPluginPriorityHigh = 10000, + EMPXViewPluginPriorityHighest = 20000 + }; + +#endif // MPXVIEWPLUGIN_HRH + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_base_view_plugins_api/mpx_base_view_plugins_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_base_view_plugins_api/mpx_base_view_plugins_api.metaxml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,15 @@ + + +MPX Base View Plugins API +Provides view plugin interface for View framework +c++ +mpx + + + + + +no +no + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_base_view_plugins_api/tsrc/conf/ui_mpxbaseviewpluginstest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_base_view_plugins_api/tsrc/conf/ui_mpxbaseviewpluginstest.cfg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,149 @@ + +[Test] +title 1: CMPXAknViewPluginDestruct +create ui_mpxbaseviewpluginstest foobar +foobar CMPXAknViewPluginDestruct +delete foobar +[Endtest] + +[Test] +title 2: CMPXAknViewPluginCreateViewL +create ui_mpxbaseviewpluginstest foobar +foobar CDummyMPXAknViewPluginConstruct +foobar CMPXAknViewPluginCreateViewL +foobar CMPXAknViewPluginDestroyView +foobar CDummyMPXViewPluginDesConstruct +delete foobar +[Endtest] + +[Test] +title 3: CMPXAknViewPluginDestroyView +create ui_mpxbaseviewpluginstest foobar +foobar CDummyMPXAknViewPluginConstruct +foobar CMPXAknViewPluginCreateViewL +foobar CMPXAknViewPluginDestroyView +foobar CDummyMPXViewPluginDesConstruct +delete foobar +[Endtest] + +[Test] +title 4: CMPXAknViewPluginActivateViewL +create ui_mpxbaseviewpluginstest foobar +foobar CDummyMPXAknViewPluginConstruct +foobar CMPXAknViewPluginCreateViewL +foobar CMPXAknViewPluginActivateViewL +foobar CMPXAknViewPluginDeactivateView +foobar CMPXAknViewPluginDestroyView +foobar CDummyMPXViewPluginDesConstruct +delete foobar +[Endtest] + +[Test] +title 5: CMPXAknViewPluginSetAsDefaultViewL +create ui_mpxbaseviewpluginstest foobar +foobar CDummyMPXAknViewPluginConstruct +foobar CMPXAknViewPluginCreateViewL +foobar CMPXAknViewPluginSetAsDefaultViewL +foobar CMPXAknViewPluginDestroyView +foobar CDummyMPXViewPluginDesConstruct +delete foobar +[Endtest] + +[Test] +title 6: CMPXAknViewPluginDeactivateView +create ui_mpxbaseviewpluginstest foobar +foobar CDummyMPXAknViewPluginConstruct +foobar CMPXAknViewPluginCreateViewL +foobar CMPXAknViewPluginActivateViewL +foobar CMPXAknViewPluginDeactivateView +foobar CMPXAknViewPluginDestroyView +foobar CDummyMPXViewPluginDesConstruct +delete foobar +[Endtest] + +[Test] +title 7: CMPXAknDialogPluginDestruct +create ui_mpxbaseviewpluginstest foobar +foobar CMPXAknDialogPluginDestruct +delete foobar +[Endtest] + +[Test] +title 8: CMPXAknDialogPluginCreateViewL +create ui_mpxbaseviewpluginstest foobar +foobar CDummyMPXAknDialogPluginConstruct +foobar CMPXAknDialogPluginCreateViewL +foobar CMPXAknDialogPluginDestroyView +foobar CDummyMPXViewPluginDesConstruct +delete foobar +[Endtest] + +[Test] +title 9: CMPXAknDialogPluginDestroyView +create ui_mpxbaseviewpluginstest foobar +foobar CDummyMPXAknDialogPluginConstruct +foobar CMPXAknDialogPluginCreateViewL +foobar CMPXAknDialogPluginDestroyView +foobar CDummyMPXViewPluginDesConstruct +delete foobar +[Endtest] + +[Test] +title 10: CMPXAknDialogPluginActivateViewL +create ui_mpxbaseviewpluginstest foobar +foobar CDummyMPXAknDialogPluginConstruct +foobar CMPXAknDialogPluginCreateViewL +foobar CMPXAknDialogPluginActivateViewL +foobar CMPXAknDialogPluginDeactivateView +foobar CMPXAknDialogPluginDestroyView +foobar CDummyMPXViewPluginDesConstruct +delete foobar +[Endtest] + +[Test] +title 11: CMPXAknDialogPluginSetAsDefaultViewL +create ui_mpxbaseviewpluginstest foobar +foobar CDummyMPXAknDialogPluginConstruct +foobar CMPXAknDialogPluginCreateViewL +foobar CMPXAknDialogPluginSetAsDefaultViewL +foobar CMPXAknDialogPluginDestroyView +foobar CDummyMPXViewPluginDesConstruct +delete foobar +[Endtest] + +[Test] +title 12: CMPXAknDialogPluginDeactivateView +create ui_mpxbaseviewpluginstest foobar +foobar CDummyMPXAknDialogPluginConstruct +foobar CMPXAknDialogPluginCreateViewL +//foobar CMPXAknDialogPluginActivateViewL +foobar CMPXAknDialogPluginDeactivateView +foobar CMPXAknDialogPluginDestroyView +foobar CDummyMPXViewPluginDesConstruct +delete foobar +[Endtest] + +[Test] +title 13: CMPXViewPluginNewL +create ui_mpxbaseviewpluginstest foobar +foobar CMPXViewPluginNewL +foobar CMPXViewPluginDestruct +delete foobar +[Endtest] + +[Test] +title 14: CMPXViewPluginDestruct +create ui_mpxbaseviewpluginstest foobar +foobar CMPXViewPluginNewL +foobar CMPXViewPluginDestruct +delete foobar +[Endtest] + +[Test] +title 15: CMPXViewPluginSetObserver +create ui_mpxbaseviewpluginstest foobar +foobar CMPXViewPluginNewL +foobar CMPXViewPluginDestruct +delete foobar +[Endtest] + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_base_view_plugins_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_base_view_plugins_api/tsrc/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007 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 for project mpxharvestertest +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_TESTEXPORTS +// Test sound file + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +#include "../ui_mpxbaseviewpluginstest/group/bld.inf" + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_base_view_plugins_api/tsrc/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_base_view_plugins_api/tsrc/init/TestFramework.ini Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,197 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[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_mpxbaseviewpluginstest + +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= 0 # Default timeout value for each test case. In milliseconds +UITestingSupport= YES +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +[New_Module] +ModuleName= testscripter +TestCaseFile= c:\testframework\ui_mpxbaseviewpluginstest.cfg +[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[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= D:\LOGS\TestFramework\ +#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 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_base_view_plugins_api/tsrc/ui_mpxbaseviewpluginstest/Bmarm/mpxbaseviewpluginstestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_base_view_plugins_api/tsrc/ui_mpxbaseviewpluginstest/Bmarm/mpxbaseviewpluginstestU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_base_view_plugins_api/tsrc/ui_mpxbaseviewpluginstest/Bwins/mpxbaseviewpluginstestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_base_view_plugins_api/tsrc/ui_mpxbaseviewpluginstest/Bwins/mpxbaseviewpluginstestU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_base_view_plugins_api/tsrc/ui_mpxbaseviewpluginstest/EABI/mpxbaseviewpluginstestU.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_base_view_plugins_api/tsrc/ui_mpxbaseviewpluginstest/EABI/mpxbaseviewpluginstestU.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_base_view_plugins_api/tsrc/ui_mpxbaseviewpluginstest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_base_view_plugins_api/tsrc/ui_mpxbaseviewpluginstest/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2002 - 2007 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 +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these +DEFAULT + +PRJ_TESTEXPORTS +// NOTE: If using ARS requirements all export operations should be done under this. +// 'abld test export' + +PRJ_EXPORTS +// Specify the source file followed by its destination here +// copy will be used to copy the source file to its destination +// If there's no destination then the source file will be copied +// to the same name in /epoc32/include +// Example: +/* +/agnmodel/inc/AGMCOMON.H +*/ + +PRJ_TESTMMPFILES +ui_mpxbaseviewpluginstest.mmp + +PRJ_MMPFILES +//mpxbaseviewpluginstest_nrm.mmp + +// Specify the .mmp files required for building the important component +// releasables. +// +// Specify "tidy" if the component you need to build doesn't need to be +// released. Specify "ignore" if the MMP file exists but should be +// ignored. +// Example: +/* +/agnmodel/group/agnmodel.mmp +#if defined(MARM) +/agnmodel/group/agsvexe.mmp +#endif +*/ + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_base_view_plugins_api/tsrc/ui_mpxbaseviewpluginstest/group/ui_mpxbaseviewpluginstest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_base_view_plugins_api/tsrc/ui_mpxbaseviewpluginstest/group/ui_mpxbaseviewpluginstest.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2002 - 2007 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: mpxbaseviewpluginstest mmp file +* +*/ + + +#include +TARGET ui_mpxbaseviewpluginstest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +/* Remove comments and replace 0x00000000 with correct vendor id */ +VENDORID VID_DEFAULT +/* Remove comments and replace 0x00000000 with correct secure id */ +// SECUREID 0x00000000 + +//TARGETPATH ?target_path +DEFFILE mpxbaseviewpluginstest.def + +SOURCEPATH ../src + +SOURCE mpxbaseviewpluginstest.cpp +SOURCE mpxbaseviewpluginstestBlocks.cpp +SOURCE dummyMPXViewPlugin.cpp + +//RESOURCE resource_file +//RESOURCE resource_file2 + +USERINCLUDE ../inc +APP_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY mpxviewplugin.lib +LIBRARY mpxcommon.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY estor.lib // RWriteStream +LIBRARY ecom.lib //REComSession +LIBRARY mpxviewutility.lib + +LANG SC + +/* +START WINS +?wins_specific_information +END + +START MARM +?marm_specific_information +END +*/ +// Other possible keywords: + +// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) +/* +START BITMAP ?target +TARGETPATH ?emulated_path_on_target_machine +HEADER +SOURCE ?color_depth ?source_bitmap +END +*/ +// DEFFILE ?filename +// AIF ?filename + +// End of File + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_base_view_plugins_api/tsrc/ui_mpxbaseviewpluginstest/group/ui_mpxbaseviewpluginstest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_base_view_plugins_api/tsrc/ui_mpxbaseviewpluginstest/group/ui_mpxbaseviewpluginstest.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,65 @@ +; +; 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: Package file for project StifTFW +; +; +; Installation file for STIF +; + +; Languages +&EN + +; Provide value for uid +#{"STIF"},(0x10005942),1,1,0,TYPE=SA + +; Series60 product id for S60 3.0 +;[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Logo +; None + +; Package signature - Optional +; None + +; Start of Package body + +; Condition blocks +; None + +; Options list +; None + +; Install files + +;"..\..\init\TestFramework.ini" - "c:\testframework\TestFramework.ini" +"..\..\conf\ui_mpxbaseviewpluginstest.cfg" - "c:\testframework\ui_mpxbaseviewpluginstest.cfg" + +"\epoc32\release\armv5\urel\ui_mpxbaseviewpluginstest.dll" - "c:\Sys\Bin\ui_mpxbaseviewpluginstest.dll" + +; Embedded SIS +; None + +; End of Package body + +; PKG dependencies +; None + +; PKG capabilities +; None diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_base_view_plugins_api/tsrc/ui_mpxbaseviewpluginstest/inc/dummyMPXViewPlugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_base_view_plugins_api/tsrc/ui_mpxbaseviewpluginstest/inc/dummyMPXViewPlugin.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,52 @@ +/* +* 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: Implement of the CMPXViewPlugin class for testing the protect function +* +*/ +#ifndef DUMMYMPXVIEWPLUGIN_H_ +#define DUMMYMPXVIEWPLUGIN_H_ + +#include +#include +#include + + +// ============================ MEMBER FUNCTIONS =============================== +class CDummyMPXViewPlugin : public CMPXViewPlugin + { + +public: + // Construct CDummyMPXViewPlugin + CDummyMPXViewPlugin(const TUid& aUid,MMPXCustomCommandObserver* aCommandObserver); + + // Delete CDummyMPXViewPlugin + virtual ~CDummyMPXViewPlugin(); + + virtual void CreateViewL(); + + virtual void DestroyView(); + + virtual void ActivateViewL( const TDesC* aParam = NULL ); + + virtual void SetAsDefaultViewL(); + + virtual void DeactivateView(); + +private : + + CMPXViewPlugin* iMPXViewPlugin; + + }; + +#endif /*DUMMYMPXVIEWPLUGIN_H_*/ diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_base_view_plugins_api/tsrc/ui_mpxbaseviewpluginstest/inc/mpxbaseviewpluginstest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_base_view_plugins_api/tsrc/ui_mpxbaseviewpluginstest/inc/mpxbaseviewpluginstest.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,191 @@ +/* +* Copyright (c) 2002 - 2007 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: Cmpxbaseviewpluginstest header for STIF Test Framework TestScripter +* +*/ + + + +#ifndef MPXBASEVIEWPLUGINSTEST_H +#define MPXBASEVIEWPLUGINSTEST_H + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include "dummyMPXViewPlugin.h" +// CONSTANTS +//const ?type ?constant_var = ?constant; +const TUid KMPXMetadataEditorDialogImplementationId = { 0x101FFC83 }; +const TUid KMPXAudioEffectsViewImplementationId = { 0x101FFC74 }; + +// Logging path +_LIT( KmpxbaseviewpluginstestLogPath, "\\logs\\testframework\\mpxbaseviewpluginstest\\" ); +// Log file +_LIT( KmpxbaseviewpluginstestLogFile, "mpxbaseviewpluginstest.txt" ); +_LIT( KmpxbaseviewpluginstestLogFileWithTitle, "mpxbaseviewpluginstest_[%S].txt" ); + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + + +class CMPXViewPlugin; +class Cmpxbaseviewpluginstest; +class Cmpxcustomcommandobservertestimp; +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// CLASS DECLARATION + +/** +* Cmpxbaseviewpluginstest test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(Cmpxbaseviewpluginstest) : public CScriptBase, + public MMPXCustomCommandObserver + + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Cmpxbaseviewpluginstest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Cmpxbaseviewpluginstest(); + + public: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + virtual void HandleCustomCommand( + const TUid& aUid, + const TInt aCommand, + const TDesC8& aData ); + 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 ); + + protected: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + protected: // Functions from base classes + + /** + * From ?base_class ?member_description + */ + //?type ?member_function(); + + private: + + /** + * C++ default constructor. + */ + Cmpxbaseviewpluginstest( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // ?classname( const ?classname& ); + // Prohibit assigment operator if not deriving from CBase. + // ?classname& operator=( const ?classname& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + /** + * Test methods are listed below. + */ + + /** + * Example test method. + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + virtual TInt ExampleL( CStifItemParser& aItem ); + + TInt CMPXViewPluginNewL( CStifItemParser& /*aItem*/ ); + TInt CMPXViewPluginDestruct( CStifItemParser& /*aItem*/ ); + + TInt CMPXAknViewPluginDestruct( CStifItemParser& /*aItem*/); + TInt CMPXAknViewPluginCreateViewL( CStifItemParser& /*aItem*/); + TInt CMPXAknViewPluginDestroyView( CStifItemParser& /*aItem*/); + TInt CMPXAknViewPluginActivateViewL( CStifItemParser& /*aItem*/); + TInt CMPXAknViewPluginSetAsDefaultViewL( CStifItemParser& /*aItem*/); + TInt CMPXAknViewPluginDeactivateView( CStifItemParser& /*aItem*/); + + TInt CMPXAknDialogPluginDestruct( CStifItemParser& aItem); + TInt CMPXAknDialogPluginCreateViewL( CStifItemParser& /*aItem*/); + TInt CMPXAknDialogPluginDestroyView( CStifItemParser& /*aItem*/); + TInt CMPXAknDialogPluginActivateViewL( CStifItemParser& /*aItem*/); + TInt CMPXAknDialogPluginSetAsDefaultViewL( CStifItemParser& /*aItem*/); + TInt CMPXAknDialogPluginDeactivateView( CStifItemParser& /*aItem*/); + TInt CDummyMPXAknViewPluginConstruct( CStifItemParser& /*aItem*/); + TInt CDummyMPXAknDialogPluginConstruct( CStifItemParser& /*aItem*/); + TInt CDummyMPXViewPluginDesConstruct( CStifItemParser& /*aItem*/); + /** + * Method used to log version of test class + */ + //ADD NEW METHOD DEC HERE + //[TestMethods] - Do not remove + + private: // Friend classes + //?friend_class_declaration;s + CMPXViewPlugin* iViewPlugin; + CMPXViewPlugin* idummyMPXViewPlugin; + }; + +#endif // MPXBASEVIEWPLUGINSTEST_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_base_view_plugins_api/tsrc/ui_mpxbaseviewpluginstest/src/dummyMPXViewPlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_base_view_plugins_api/tsrc/ui_mpxbaseviewpluginstest/src/dummyMPXViewPlugin.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,62 @@ +/* +* 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: Implement of the CMPXViewPlugin class for testing the protect function +* +*/ +#include "dummyMPXViewPlugin.h" + +// CDummyMPXViewPlugin construct +CDummyMPXViewPlugin::CDummyMPXViewPlugin(const TUid& aUid,MMPXCustomCommandObserver* aCommandObserver) + { + iMPXViewPlugin = CMPXViewPlugin::NewL(aUid,aCommandObserver); + } + +// delete CDummyMPXViewPlugin +CDummyMPXViewPlugin::~CDummyMPXViewPlugin() + { + if(iMPXViewPlugin!=NULL) + { + delete iMPXViewPlugin; + } + } + +// OverWrite the CreateViewL() function of the CMPXViewPlugin class +void CDummyMPXViewPlugin::CreateViewL() + { + iMPXViewPlugin->CreateViewL(); + } + +// OverWrite the DestroyView() function of the CMPXViewPlugin class +void CDummyMPXViewPlugin::DestroyView() + { + iMPXViewPlugin->DestroyView(); + } + +// OverWrite the ActivateViewL() function of the CMPXViewPlugin class +void CDummyMPXViewPlugin:: ActivateViewL( const TDesC* /*aParam*/ ) + { + iMPXViewPlugin->ActivateViewL(/*aParam*/); + } + +// OverWrite the SetAsDefaultViewL() function of the CMPXViewPlugin class +void CDummyMPXViewPlugin:: SetAsDefaultViewL() + { + iMPXViewPlugin->SetAsDefaultViewL(); + } + +// OverWrite the DeactivateView() function of the CMPXViewPlugin class +void CDummyMPXViewPlugin:: DeactivateView() + { + iMPXViewPlugin->DeactivateView(); + } diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_base_view_plugins_api/tsrc/ui_mpxbaseviewpluginstest/src/mpxbaseviewpluginstest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_base_view_plugins_api/tsrc/ui_mpxbaseviewpluginstest/src/mpxbaseviewpluginstest.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,183 @@ +/* +* Copyright (c) 2002 - 2007 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: Cmpxbaseviewpluginstest implemtation for STIF Test Framework TestScripter +* +*/ + + + +// INCLUDE FILES +#include +#include "mpxbaseviewpluginstest.h" +#include + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; + +// EXTERNAL FUNCTION PROTOTYPES +//extern ?external_function( ?arg_type,?arg_type ); + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// LOCAL CONSTANTS AND MACROS +//const ?type ?constant_var = ?constant; +//#define ?macro_name ?macro_def + +// MODULE DATA STRUCTURES +//enum ?declaration +//typedef ?declaration + +// LOCAL FUNCTION PROTOTYPES +//?type ?function_name( ?arg_type, ?arg_type ); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ?function_name ?description. +// ?description +// Returns: ?value_1: ?description +// ?value_n: ?description_line1 +// ?description_line2 +// ----------------------------------------------------------------------------- +// +/* +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg) // ?description + { + + ?code // ?comment + + // ?comment + ?code + } +*/ + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cmpxbaseviewpluginstest::Cmpxbaseviewpluginstest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +Cmpxbaseviewpluginstest::Cmpxbaseviewpluginstest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// Cmpxbaseviewpluginstest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Cmpxbaseviewpluginstest::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(KmpxbaseviewpluginstestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KmpxbaseviewpluginstestLogFile); + } + + iLog = CStifLogger::NewL( KmpxbaseviewpluginstestLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + + } + +// ----------------------------------------------------------------------------- +// Cmpxbaseviewpluginstest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Cmpxbaseviewpluginstest* Cmpxbaseviewpluginstest::NewL( + CTestModuleIf& aTestModuleIf ) + { + Cmpxbaseviewpluginstest* self = new (ELeave) Cmpxbaseviewpluginstest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +Cmpxbaseviewpluginstest::~Cmpxbaseviewpluginstest() + { + + // 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* ) Cmpxbaseviewpluginstest::NewL( aTestModuleIf ); + + } + + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_base_view_plugins_api/tsrc/ui_mpxbaseviewpluginstest/src/mpxbaseviewpluginstestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_base_view_plugins_api/tsrc/ui_mpxbaseviewpluginstest/src/mpxbaseviewpluginstestBlocks.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,494 @@ +/* +* Copyright (c) 2002 - 2007 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: Cmpxbaseviewpluginstest block implementation for STIF Test Framework TestScripter +* +*/ + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include "mpxbaseviewpluginstest.h" + +// ----------------------------------------------------------------------------- +// Cmpxbaseviewpluginstest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Cmpxbaseviewpluginstest::Delete() + { + // CMPXViewPlugin + } + +// ----------------------------------------------------------------------------- +// Cmpxbaseviewpluginstest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Cmpxbaseviewpluginstest::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( "Example", Cmpxbaseviewpluginstest::ExampleL ), + + ENTRY( "CMPXViewPluginNewL", Cmpxbaseviewpluginstest::CMPXViewPluginNewL ), + ENTRY( "CMPXViewPluginDestruct", Cmpxbaseviewpluginstest::CMPXViewPluginDestruct ), + + ENTRY( "CMPXAknViewPluginDestruct", Cmpxbaseviewpluginstest::CMPXAknViewPluginDestruct ), + ENTRY( "CMPXAknViewPluginCreateViewL", Cmpxbaseviewpluginstest::CMPXAknViewPluginCreateViewL ), + ENTRY( "CMPXAknViewPluginDestroyView", Cmpxbaseviewpluginstest::CMPXAknViewPluginDestroyView ), + ENTRY( "CMPXAknViewPluginActivateViewL", Cmpxbaseviewpluginstest::CMPXAknViewPluginActivateViewL ), + ENTRY( "CMPXAknViewPluginSetAsDefaultViewL", Cmpxbaseviewpluginstest::CMPXAknViewPluginSetAsDefaultViewL ), + ENTRY( "CMPXAknViewPluginDeactivateView", Cmpxbaseviewpluginstest::CMPXAknViewPluginDeactivateView ), + + ENTRY( "CMPXAknDialogPluginDestruct", Cmpxbaseviewpluginstest::CMPXAknDialogPluginDestruct ), + ENTRY( "CMPXAknDialogPluginCreateViewL", Cmpxbaseviewpluginstest::CMPXAknDialogPluginCreateViewL ), + ENTRY( "CMPXAknDialogPluginDestroyView", Cmpxbaseviewpluginstest::CMPXAknDialogPluginDestroyView ), + ENTRY( "CMPXAknDialogPluginActivateViewL", Cmpxbaseviewpluginstest::CMPXAknDialogPluginActivateViewL ), + ENTRY( "CMPXAknDialogPluginSetAsDefaultViewL", Cmpxbaseviewpluginstest::CMPXAknDialogPluginSetAsDefaultViewL ), + ENTRY( "CMPXAknDialogPluginDeactivateView", Cmpxbaseviewpluginstest::CMPXAknDialogPluginDeactivateView ), + ENTRY( "CDummyMPXAknViewPluginConstruct", Cmpxbaseviewpluginstest::CDummyMPXAknViewPluginConstruct ), + ENTRY( "CDummyMPXAknDialogPluginConstruct", Cmpxbaseviewpluginstest::CDummyMPXAknDialogPluginConstruct ), + ENTRY( "CDummyMPXViewPluginDesConstruct", Cmpxbaseviewpluginstest::CDummyMPXViewPluginDesConstruct ), + + + //ADD NEW ENTRY HERE + //[test cases entries] - Do not remove + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// ----------------------------------------------------------------------------- +// Cmpxbaseviewpluginstest::ExampleL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cmpxbaseviewpluginstest::ExampleL( CStifItemParser& aItem ) + { + + // Print to UI + _LIT( Kmpxbaseviewpluginstest, "mpxbaseviewpluginstest" ); + _LIT( KExample, "In Example" ); + TestModuleIf().Printf( 0, Kmpxbaseviewpluginstest, KExample ); + // Print to log file + iLog->Log( KExample ); + + TInt i = 0; + TPtrC string; + _LIT( KParam, "Param[%i]: %S" ); + while ( aItem.GetNextString ( string ) == KErrNone ) + { + TestModuleIf().Printf( i, Kmpxbaseviewpluginstest, + KParam, i, &string ); + i++; + } + + return KErrNone; + + } + +// ----------------------------------------------------------------------------- +// Cmpxbaseviewpluginstest::CMPXViewPluginNewL +// Create CMPXViewPlugin +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cmpxbaseviewpluginstest::CMPXViewPluginNewL( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXViewPluginNewL")); + TInt err = KErrNone; + if ( iViewPlugin != NULL) + { + delete iViewPlugin; + } + iViewPlugin = NULL; + + TUid aUid = TUid::Uid(270531770); + + iViewPlugin = CMPXViewPlugin::NewL( aUid, this ); + if ( iViewPlugin == NULL) + { + err = KErrNotFound; + } + iLog->Log(_L("Error: CMPXViewPluginNewL not created: %d"), err); + return err; + } +// ----------------------------------------------------------------------------- +// Cmpxbaseviewpluginstest::CMPXViewPluginDestruct +// Destruct CMPXViewPlugin +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cmpxbaseviewpluginstest::CMPXViewPluginDestruct( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXViewPluginDestruct")); + TInt err = KErrNone; + if ( iViewPlugin ) + { + delete iViewPlugin; + REComSession::FinalClose(); + iViewPlugin = NULL; + } + if ( err != KErrNone) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::DeleteCMPXViewPlugin testing CMPXViewPlugin::~ end err=%d"), err); + } + return err; + } + +// ----------------------------------------------------------------------------- +// Cmpxbaseviewpluginstest::CMPXAknViewPluginDestruct +// Destruct CMPXAknViewPlugin +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cmpxbaseviewpluginstest::CMPXAknViewPluginDestruct( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknViewPluginDestruct")); + TInt err = KErrNone; + iViewPlugin = CMPXViewPlugin::NewL( KMPXAudioEffectsViewImplementationId, this ); + if ( iViewPlugin ) + { + delete iViewPlugin; + REComSession::FinalClose(); + iViewPlugin = NULL; + } + if ( err != KErrNone ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::DeleteCMPXAknViewPlugin testing CMPXAknViewPlugin::~ end err=%d"), err); + } + return err; + } +// ----------------------------------------------------------------------------- +// Cmpxbaseviewpluginstest::CDummyMPXViewPluginConstruct +// CDummyMPXViewPlugin Construct +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cmpxbaseviewpluginstest::CDummyMPXAknViewPluginConstruct( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknViewPluginCreateViewL")); + TInt err = KErrNone; + + idummyMPXViewPlugin = new CDummyMPXViewPlugin(KMPXAudioEffectsViewImplementationId,this); + + if ( err != KErrNone ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknViewPluginCreateViewL err=%d"), err); + } + return err; + } +// ----------------------------------------------------------------------------- +// Cmpxbaseviewpluginstest::CDummyMPXViewPluginConstruct +// CDummyMPXViewPlugin Construct +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cmpxbaseviewpluginstest::CDummyMPXAknDialogPluginConstruct( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknViewPluginCreateViewL")); + TInt err = KErrNone; + + idummyMPXViewPlugin = new CDummyMPXViewPlugin(KMPXMetadataEditorDialogImplementationId,this); + + if ( err != KErrNone ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknViewPluginCreateViewL err=%d"), err); + } + return err; + } +// ----------------------------------------------------------------------------- +// Cmpxbaseviewpluginstest::CDummyMPXViewPluginDesConstruct +// CDummyMPXViewPlugin DesConstruct +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cmpxbaseviewpluginstest::CDummyMPXViewPluginDesConstruct( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknViewPluginCreateViewL")); + TInt err = KErrNone; + if ( idummyMPXViewPlugin != NULL ) + { + delete idummyMPXViewPlugin; + idummyMPXViewPlugin = NULL; + } + + if ( err != KErrNone ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknViewPluginCreateViewL err=%d"), err); + } + return err; + } +// ----------------------------------------------------------------------------- +// Cmpxbaseviewpluginstest::CMPXAknViewPluginCreateViewL +// CMPXAknViewPlugin CreateViewL +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cmpxbaseviewpluginstest::CMPXAknViewPluginCreateViewL( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknViewPluginCreateViewL")); + TInt err = KErrNone; + + TRAP( err, idummyMPXViewPlugin->CreateViewL()); + + if ( err != KErrNone ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknViewPluginCreateViewL err=%d"), err); + } + return err; + } +// ----------------------------------------------------------------------------- +// Cmpxbaseviewpluginstest::CMPXAknViewPluginDestroyView +// CMPXAknViewPlugin DestroyView +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cmpxbaseviewpluginstest::CMPXAknViewPluginDestroyView( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknViewPluginDestroyView")); + TInt err = KErrNone; + + idummyMPXViewPlugin->DestroyView(); + + if ( err != KErrNone ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknViewPluginDestroyView end err=%d"), err); + } + + return err; + } +// ----------------------------------------------------------------------------- +// Cmpxbaseviewpluginstest::CMPXAknViewPluginActivateViewL +// CMPXAknViewPlugin ActivateViewL +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cmpxbaseviewpluginstest::CMPXAknViewPluginActivateViewL( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknViewPluginActivateViewL")); + TInt err = KErrNone; + + _LIT( Kparam, "viewname" ); + const TDesC* KFrom = &Kparam; + + TRAP(err,idummyMPXViewPlugin->ActivateViewL()); + + if ( err != KErrNone ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknViewPluginActivateViewL err=%d"), err); + } + return err; + } +// ----------------------------------------------------------------------------- +// Cmpxbaseviewpluginstest::CMPXAknViewPluginSetAsDefaultViewL +// CMPXAknViewPlugin SetAsDefaultViewL +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cmpxbaseviewpluginstest::CMPXAknViewPluginSetAsDefaultViewL( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknViewPluginSetAsDefaultViewL")); + TInt err = KErrNone; + + TRAP(err,idummyMPXViewPlugin->SetAsDefaultViewL()); + + if ( err != KErrNone ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknViewPluginSetAsDefaultViewL err=%d"), err); + } + return err; + } +// ----------------------------------------------------------------------------- +// Cmpxbaseviewpluginstest::CMPXAknViewPluginDeactivateView +// CMPXAknViewPlugin DeactivateView +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cmpxbaseviewpluginstest::CMPXAknViewPluginDeactivateView( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknViewPluginDeactivateView")); + TInt err = KErrNone; + + idummyMPXViewPlugin->DeactivateView(); + + if ( err != KErrNone ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknViewPluginDeactivateView err=%d"), err); + } + return err; + } +// ----------------------------------------------------------------------------- +// Cmpxbaseviewpluginstest::CMPXAknDialogPluginDestruct +// CMPXAknDialogPlugin Destruct +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cmpxbaseviewpluginstest::CMPXAknDialogPluginDestruct( CStifItemParser& /*aItem*/ ) +{ + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknDialogPluginDestruct")); + TInt err = KErrNone; + + iViewPlugin = CMPXViewPlugin::NewL( KMPXMetadataEditorDialogImplementationId, this ); + if ( iViewPlugin ) + { + TRAP(err , delete iViewPlugin); + REComSession::FinalClose(); + iViewPlugin = NULL; + } + if ( err != KErrNone ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknDialogPluginDestruct err=%d"), err); + } + return err; +} +// ----------------------------------------------------------------------------- +// Cmpxbaseviewpluginstest::CMPXAknDialogPluginCreateViewL +// CMPXAknDialogPlugin CreateViewL +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cmpxbaseviewpluginstest::CMPXAknDialogPluginCreateViewL( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknDialogPluginCreateViewL")); + TInt err = KErrNone; + + TRAP( err, idummyMPXViewPlugin->CreateViewL()); + + if ( err != KErrNone ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknDialogPluginCreateViewL err=%d"), err); + } + return err; + } +// ----------------------------------------------------------------------------- +// Cmpxbaseviewpluginstest::CMPXAknDialogPluginDestroyView +// CMPXAknDialogPlugin DestroyView +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cmpxbaseviewpluginstest::CMPXAknDialogPluginDestroyView( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknDialogPluginDestroyView")); + TInt err = KErrNone; + + idummyMPXViewPlugin->DestroyView(); + + if ( err != KErrNone ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknDialogPluginDestroyView end err=%d"), err); + } + + return err; + } +// ----------------------------------------------------------------------------- +// Cmpxbaseviewpluginstest::CMPXAknDialogPluginActivateViewL +// CMPXAknDialogPlugin ActivateViewL +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cmpxbaseviewpluginstest::CMPXAknDialogPluginActivateViewL( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknDialogPluginActivateViewL")); + TInt err = KErrNone; + + TRAP(err,idummyMPXViewPlugin->ActivateViewL()); + + if ( err != KErrNone ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknDialogPluginActivateViewL err=%d"), err); + } + return err; + } +// ----------------------------------------------------------------------------- +// Cmpxbaseviewpluginstest::CMPXAknDialogPluginSetAsDefaultViewL +// CMPXAknDialogPlugin SetAsDefaultViewL +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cmpxbaseviewpluginstest::CMPXAknDialogPluginSetAsDefaultViewL( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknDialogPluginSetAsDefaultViewL")); + TInt err = KErrNone; + + TRAP(err,idummyMPXViewPlugin->SetAsDefaultViewL()); + + if ( err == KErrNotSupported ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknDialogPluginSetAsDefaultViewL err=%d"), err); + err = KErrNone; + } + return err; + } +// ----------------------------------------------------------------------------- +// Cmpxbaseviewpluginstest::CMPXAknDialogPluginDeactivateView +// CMPXAknDialogPlugin DeactivateView +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cmpxbaseviewpluginstest::CMPXAknDialogPluginDeactivateView( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknDialogPluginDeactivateView")); + TInt err = KErrNone; + + idummyMPXViewPlugin->DeactivateView(); + + if ( err != KErrNone ) + { + iLog->Log(_L("Cmpxbaseviewpluginstest::CMPXAknDialogPluginDeactivateView err=%d"), err); + } + return err; + } + +// ----------------------------------------------------------------------------- +// Cmpxbaseviewpluginstest::HandleCustomCommand +// Handle CustomCommand +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void Cmpxbaseviewpluginstest::HandleCustomCommand( + const TUid& /*aUid*/, + const TInt /*aCommand*/, + const TDesC8& /*aData*/ ) + { + iLog->Log(_L("CCommonTestClass::HandleCustomCommand CMPXViewPlugin::HandleCustomCommand is called")); + } + +/* +TInt Cmpxbaseviewpluginstest::?member_function( + CItemParser& aItem ) + { + + ?code + + } +*/ + +// ========================== OTHER EXPORTED FUNCTIONS ========================= +// None + +// [End of File] - Do not remove diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_common_definition_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_common_definition_api/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2007 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 +: mpx collection utility API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/mpxcollectioncommanddefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectioncommanddefs.h) +../inc/mpxcollectionenginecommonobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectionenginecommonobserver.h) +../inc/mpxcollectionframeworkdefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectionframeworkdefs.h) +../inc/mpxcollectionmessage.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectionmessage.h) +../inc/mpxcollectionmessage.inl MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectionmessage.inl) +../inc/mpxcollectionmessagedefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectionmessagedefs.h) +../inc/mpxcollectionobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectionobserver.h) +../inc/mpxcollectionplugin.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectionplugin.h) +../inc/mpxcollectionplugin.hrh MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectionplugin.hrh) +../inc/mpxcollectionplugin.inl MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectionplugin.inl) +../inc/mpxcollectionpluginobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectionpluginobserver.h) +../inc/mpxincrementalopendefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxincrementalopendefs.h) +../inc/mpxcollectionopenlresultdef.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectionopenlresultdef.h) diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_common_definition_api/inc/mpxcollectioncommanddefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_common_definition_api/inc/mpxcollectioncommanddefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,451 @@ +/* +* Copyright (c) 2006 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: Definitions for command type +* +*/ + + + +#ifndef CMPXCOLLECTIONCOMMANDDEFS_H +#define CMPXCOLLECTIONCOMMANDDEFS_H + +#include +#include + +/** + * Content ID identifying sync. command to retrieve URIs of the medias + * from the path for file deletion. If a client is required to delete + * the associated file before removing the media from the collection, + * this command can be used. A list of URIs associated with the path + * will be returned. If the given path ends with a media or medias in + * a particular playlist, the returned URI array will contain 0 element + * since client won't want to delete the associated song files in this + * case. + */ +const TInt KMPXCommandIdCollectionRetrieveUriForDeletion = 0x10282947; +/** + * Attributes supported for KMPXCommandIdCollectionRetrieveUriForDeletion + */ +/** + * CMPXCollectionPath, collection path (in/out param). + * The collection path to be used for searching. If the path ends + * at a particular artist/album/genre/composer, the path will be + * expended to include all the songs under category selected. + */ +const TMPXAttributeData KMPXCommandCollectionRetrievePath = { + KMPXCommandIdCollectionRetrieveUriForDeletion, 0x01}; +/** + * TInt, error code (out param) + */ +const TMPXAttributeData KMPXCommandCollectionRetrieveUriError = { + KMPXCommandIdCollectionRetrieveUriForDeletion, 0x02}; +/** + * CDesCArray, an array of URIs associated with the given + * collection path. (out param) + */ +const TMPXAttributeData KMPXCommandCollectionRetrieveMediaUriArray = { + KMPXCommandIdCollectionRetrieveUriForDeletion, 0x04}; + +/** + * Attributes supported for KMPXCommandIdCollectionRetrieveUriForDeletion + * @deprecated Please use constants above + */ +enum + { + /** + * CMPXCollectionPath, collection path (in/out param). + * The collection path to be used for searching. If the path ends + * at a particular artist/album/genre/composer, the path will be + * expended to include all the songs under category selected. + */ + EMPXCommandCollectionRetrievePath = 0x01, + + /** + * TInt, error code (out param) + */ + EMPXCommandCollectionRetrieveUriError = 0x02, + + /** + * CDesCArray, an array of URIs associated with the given + * collection path. (out param) + */ + EMPXCommandCollectionRetrieveMediaUriArray = 0x04 + }; + +/** + * Content ID identifying incremental sync. Remove command + */ +const TInt KMPXCommandIdCollectionRemove = 0x101FFC49; +/** + * Attributes supported for KMPXCommandIdCollectionRemove + */ +/** + * CMPXCollectionPath, collection path (in/out param). The path to + * remove from the collection. Upon return, an updated path is returned + * so it can be used for the next iteration. + */ +const TMPXAttributeData KMPXCommandCollectionRemovePath = { + KMPXCommandIdCollectionRemove, 0x01}; +/** + * TInt, indicates how many media to remove in one command (in param) + * 0 or a negative value means to delete all in one go + */ +const TMPXAttributeData KMPXCommandCollectionRemoveMediaCount = { + KMPXCommandIdCollectionRemove, 0x02}; +/** + * TInt, error code (out param) + */ +const TMPXAttributeData KMPXCommandCollectionRemoveError = { + KMPXCommandIdCollectionRemove, 0x04}; +/** + * TBool, completed (out param), indicates whether the client should + * make further removal request + */ +const TMPXAttributeData KMPXCommandCollectionRemoveCompleted = { + KMPXCommandIdCollectionRemove, 0x08}; + +/** + * TBool, indicate if we should supporess collection change messages + * Changes will be added to EMPXCommandCollectionChangeMsgs + */ +const TMPXAttributeData KMPXCommandCollectionRemoveSuppressMsgs = { + KMPXCommandIdCollectionRemove, 0x10 }; + +/** + * CMPXMessageArray to store collection messages + */ +const TMPXAttributeData KMPXCommandCollectionChangeMsgs = { + KMPXCommandIdCollectionRemove, 0x20 }; + +/** + * Attributes supported for KMPXCommandIdCollectionRemove + * @deprecated please use constants above + */ +enum + { + /** + * CMPXCollectionPath, collection path (in/out param). The path to + * remove from the collection. Upon return, an updated path is returned + * so it can be used for the next iteration. + */ + EMPXCommandCollectionRemovePath = 0x01, + + /** + * TInt, indicates how many media to remove in one command (in param) + * 0 or a negative value means to delete all in one go + */ + EMPXCommandCollectionRemoveMediaCount = 0x02, + + /** + * TInt, error code (out param) + */ + EMPXCommandCollectionRemoveError = 0x04, + + /** + * TBool, completed (out param), indicates whether the client should + * make further removal request + */ + EMPXCommandCollectionRemoveCompleted = 0x08, + + /** + * TBool, indicate if we should supporess collection change messages + * Changes will be added to EMPXCommandCollectionChangeMsgs + */ + EMPXCommandCollectionSuppressMsgs = 0x10, + + /** + * CMPXMessageArray to store collection messages + */ + EMPXCommandCollectionChangeMsgs = 0x20 + }; + +/** + * Content ID identifying sync. Remove Media command. The identified media + * will be deleted from the collection database instead of being marked as + * deleted if client explictly requests to delete the records; otherwise, + * whether the records will be deleted or marked as deleted will be based + * on other factors (e.g. whether MTP is supported, if so, the 1st X records + * will be marked as deleted; thereafter, they will be deleted). + */ +const TInt KMPXCommandIdCollectionRemoveMedia = 0x10282949; +/** + * Attributes supported for KMPXCommandIdCollectionRemoveMedia + */ +/** + * CMPXMedia, media to be removed (in param) + */ +const TMPXAttributeData KMPXCommandCollectionRemoveMedia = { + KMPXCommandIdCollectionRemoveMedia, 0x01}; +/** + * TBool, indicates whether to delete the records associated + * with the given media (in param) + */ +const TMPXAttributeData KMPXCommandCollectionRemoveMediaDeleteRecord = { + KMPXCommandIdCollectionRemoveMedia, 0x02}; +/** + * TInt, error code (out param) + */ +const TMPXAttributeData KMPXCommandCollectionRemoveMediaError = { + KMPXCommandIdCollectionRemoveMedia, 0x04}; + + +/** + * Attributes supported for KMPXCommandIdCollectionRemoveMedia + * + * @deprecated please use constant above + */ +enum + { + /** + * CMPXMedia, media to be removed (in param) + */ + EMPXCommandCollectionRemoveMedia = 0x01, + + /** + * TBool, indicates whether to delete the records associated + * with the given media (in param) + */ + EMPXCommandCollectionRemoveMediaDeleteRecord = 0x02, + + /** + * TInt, error code (out param) + */ + EMPXCommandCollectionRemoveMediaError = 0x04 + }; + +/** + * Content ID identifying sync. command to clean up medias that have + * been marked as deleted. + */ +const TInt KMPXCommandIdCollectionCleanupDeletedMedias = 0x10282948; +/** + * Attributes supported for KMPXCommandIdCollectionCleanupDeletedMedias + */ +const TMPXAttributeData KMPXCommandCollectionCleanupError = { + KMPXCommandIdCollectionCleanupDeletedMedias, 0x01}; + +/** + * Attributes supported for KMPXCommandIdCollectionCleanupDeletedMedias + * + * @deprecated please use constants above + */ +enum + { + /** + * TInt, error code (out param) + */ + EMPXCommandCollectionCleanupError = 0x01 + }; + +/** + * Remove all unused data before starting delete. + */ +const TInt KMPXCommandIdCollectionPrepareDelete= 0x10282999; +/** + * Attributes supported for KMPXCommandIdCollectionPrepareDelete + */ + +/** + * CMPXCollectionPath, collection path (in/out param). The path to + * remove from the collection. + */ +const TMPXAttributeData KMPXCommandCollectionPrepareRemovePath = { KMPXCommandIdCollectionPrepareDelete, 0x01 }; + +/** + * ContentID for completing the delete operation + */ +const TUint32 KMPXCommandIdCollectionCompleteDelete = 0x10282951; + +// CMPXMessageArray containing change messages +const TMPXAttributeData KMPXCommandCollectionDeleteMsgArray = { KMPXCommandIdCollectionCompleteDelete, 0x01 }; +// TBool compact database or not +const TMPXAttributeData KMPXCommandCollectionDeleteCompactDb = { KMPXCommandIdCollectionCompleteDelete, 0x02 }; + +/** + * Unique command ids for extensible commands + */ +const TUint32 KMPXCommandIdCollectionSelect = 0x10282940; // Focused index must be + // passed in attribute KMPXCommandIdCollection, + // EMPXCollectionCommandIndex + +// Content id for Collection commands (see above) +const TInt KMPXCommandContentIdCollection = 0x10282941; +const TMPXAttributeData KMPXCommandCollectionSelectIndex = { KMPXCommandContentIdCollection, 0x02 }; +enum // Attribute ids for KMPXCommandContentIdCollection + { + /** + * Index, TInt + */ + EMPXCollectionCommandIndex = 0x02 + }; + +/** + * Unique command ids for add media to collection + */ +const TInt KMPXCommandIdCollectionAdd = 0x10282962; +const TMPXAttributeData KMPXCommandColAddMedia = { KMPXCommandIdCollectionAdd, 0x01 }; // CMPXMedia to add +const TMPXAttributeData KMPXCommandColAddRtnId = { KMPXCommandIdCollectionAdd, 0x02 }; // TMPXItemId on return + +/** + * Unique command ids for executing SQL statements to collection + */ +const TInt KMPXCommandIdCollectionExecSql = 0x02ABBADC; +const TMPXAttributeData KMPXCommandColSqlFile = { KMPXCommandIdCollectionExecSql, 0x01 }; // Text for SQL file name +/** + * Unique command ids for update media in collection + */ +const TInt KMPXCommandIdCollectionSet = 0x10282963; +const TMPXAttributeData KMPXCommandColSetMedia = { KMPXCommandIdCollectionSet, 0x01 }; // CMPXMedia to set. + // The media can be an Item or contain an Item array + +/******************************************************************************* + * Reorder a song in a playlist + * + ******************************************************************************/ +const TInt KMPXCommandIdReorderPlaylist = 0x10282975; + +/** + * Attributes supported for KMPXCommandIdReorderPlaylist + */ + +/** + * TMPXItemId, Id of the playlist to be reordered + */ +const TMPXAttributeData KMPXCommandReorderPlaylistId = { KMPXCommandIdReorderPlaylist, 0x01 }; + +/** + * TMPXItemId, Id of the song in the playlist to be reordered + */ +const TMPXAttributeData KMPXCommandReorderSongId = { KMPXCommandIdReorderPlaylist, 0x02 }; + +/** + * TUint, original ordinal of the song in the playlist + */ +const TMPXAttributeData KMPXCommandReorderOriginalOrdinal = { KMPXCommandIdReorderPlaylist, 0x04 }; + +/** + * TUint, new ordinal of the song in the playlist + */ +const TMPXAttributeData KMPXCommandReorderNewOrdinal = { KMPXCommandIdReorderPlaylist, 0x08 }; + + +/******************************************************************************* + * Update the last refreshed time for a collection plugin + * + ******************************************************************************/ +const TInt KMPXCommandIdUpdateRefreshTime = 0x10282976; + + +/******************************************************************************* + * Get total collection records count + * + ******************************************************************************/ +const TInt KMPXCommandCollectionGetCount = 0x1028297C; + +/** + * Attributes supported for KMPXCommandCollectionGetCount + */ + +/** + * TInt, drive number + */ +const TMPXAttributeData KMPXCommandCollectionCountDrive = {KMPXCommandCollectionGetCount, 0x01}; + + +enum EMPXCollectionCountEnum + { + /** + * count for all records in a music table or podcast table to be retrieved + */ + EMPXCollectionCountTrack = 1, + + /** + * count for all records in a playlist table to be retrieved + */ + EMPXCollectionCountPlaylist = 2, + + /** + * count for total music and .m3u playlists records to be retrieved + */ + EMPXCollectionCountTotal = 3 + }; + +/** + * TInt, what content should be retrieved: music, playlist or both, see EMPXCollectionCountEnum + */ +const TMPXAttributeData KMPXCommandCollectionCountTable = {KMPXCommandCollectionGetCount, 0x02}; + +/** + * TInt, collection count (out param). + */ +const TMPXAttributeData KMPXCommandCollectionCountValue = {KMPXCommandCollectionGetCount, 0x04}; + + +/******************************************************************************* + * Get uri list for songs and playlists for the given drive from music db + * + ******************************************************************************/ +const TInt KMPXCommandCollectionGetURIs = 0x1028297D; + +/** + * Attributes supported for KMPXCommandCollectionGetURIs + */ + +/** + * TInt, drive number + */ +const TMPXAttributeData KMPXCommandCollectionURIDrive = {KMPXCommandCollectionGetURIs, 0x01}; + +enum EMPXCollectionURIEnum + { + /** + * requests URIs for records in a music or podcast table + */ + EMPXCollectionURITrack = 1, + + /** + * requests URIs for .m3u records in a playlist table + */ + EMPXCollectionURIPlaylist = 2 + }; + +/** + * TInt, what content should be retrieved: music or playlist, see EMPXCollectionURIEnum + */ +const TMPXAttributeData KMPXCommandCollectionURITable = {KMPXCommandCollectionGetCount, 0x02}; + +/** + * TInt, number of records to retrieve + */ +const TMPXAttributeData KMPXCommandCollectionURIRecords = {KMPXCommandCollectionGetURIs, 0x04}; + +/** + * TInt, ID of the record to use as a 'bottom' in SELECT + */ +const TMPXAttributeData KMPXCommandCollectionURIFromID = {KMPXCommandCollectionGetURIs, 0x08}; + +/** + * CDesCArray, an array of URIs associated with the given drive (out param) + */ +const TMPXAttributeData KMPXCommandCollectionURIList = {KMPXCommandCollectionGetURIs, 0x16}; + +/** + * TUint32, an ID of last retrieved URI for the array above (out param) + * assume that music table and playlist table are both indexed by unique ID + * note: Symbian does not recommend to use OFFSET and instead recommend item from index + */ +const TMPXAttributeData KMPXCommandCollectionURILastID = {KMPXCommandCollectionGetURIs, 0x32}; + + +#endif // CMPXCOLLECTIONCOMMANDDEFS_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_common_definition_api/inc/mpxcollectionenginecommonobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_common_definition_api/inc/mpxcollectionenginecommonobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2006 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: Collection engine common observer +* +*/ + + + +#ifndef MMPXCOLLECTIONENGINECOMMONOBSERVER_H +#define MMPXCOLLECTIONENGINECOMMONOBSERVER_H + +#include +class CMPXMedia; +#include + +/** + * Interface for receiving data asynchronously + */ +NONSHARABLE_CLASS(MMPXCollectionEngineCommonObserver) + { +public: + /** + * Handle media. + * + * @since S60 3.2.3 + * @param aMedia media object, NULL if error + * @param aError error code + */ + virtual void HandleMedia(CMPXMedia* aMedia, TInt aError) = 0; + + /** + * Handle completion of a asynchronous command. + * + * @since S60 3.2.3 + * @param aCommandResult result of the command, NULL if error + * @param aError error code + */ + virtual void HandleCommandComplete(CMPXCommand* aCommandResult, + TInt aError) = 0; + + /** + * Handles removing a collection path. + * Use case is if an item is removed by a collecton path, we need to + * know which files were actually removed to delete from FS. + * + * @since S60 3.2.3 + * @param aUriArray NULL if the plugin does not use concept of URI + * else, contains the file path to delete a file + * @param aError error code + * + */ + virtual void HandleRemove(const CDesCArray& aUriArray, TInt aError) = 0; + + /** + * Handles FindAllL results. + * After find results are passed to the engine, the media object + * needs to be picked up by the client. + * + * @since S60 3.2.3 + * @param aMedia media item(s) + * @param aError error for the operation, or size of the buffer to return + */ + virtual void HandleFindAll(CMPXMedia* aMedia, TInt aError) = 0; + + }; + +#endif // MMPXCOLLECTIONENGINECOMMONOBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_common_definition_api/inc/mpxcollectionframeworkdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_common_definition_api/inc/mpxcollectionframeworkdefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,207 @@ +/* +* Copyright (c) 2006 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 definition +* +*/ + + +#ifndef MPXCOLLECTIONFRAMEWORKDEFS_H +#define MPXCOLLECTIONFRAMEWORKDEFS_H + + +#include + +// UID definition for collection mode +// For application collection mode, application UID can be used +// +const TUid KMcModeDefault = {0x1028292C}; +const TUid KMcModeIsolated = {0x1028292D}; +const TUid KMcModePlaylist = {0x1028292E}; // special mode used by playlist + // isolated, noshareable + +/** + * This is SPECIFIC to the music db plugin and is a reference implementation. + * + * EMcItemDeleted, EMcItemInserted and EMcItemModified will be called back when + * an item is deleted, added or modified via RemoveL(), AddL() and SetL() + * + * When user adds a new playlist through AddL, only EMcPlaylistInserted message + * will be sent with the Id of the playlist added. + * + * When user adds a track to a saved playlist through AddL, only EMcPlaylistModified + * message will be sent with the Id of the playlist modified. + * + * When user removes a track from the collection, the client will receive + * EMcItemDeleted for the track deleted from the collection and + * EMcPlaylistModified for the modified playlist to indicate which playlists + * have been updated as result of this track removal. + * + * When user removes a playlist from the collection, the client will receive + * EMcItemDeleted for the playlist removed from the collection. + * + * When user removes a track from the playlist, the client will receive + * EMcPlaylistModified for the playlist the track is removed from. + * + * When user renames a playlist, EMcPlaylistModified is called back with the + * new Id of the renamed playlist. + * + * When MTP renames a song, it will receive EMcItemModified for the track and + * EMcPlaylistModified for the playlist because the URI of one of the songs in + * the playlist has been changed. + * + * When a playlist is updated (overwrite its contents or reordering tracks in + * the playlist), EMcPlaylistModified is sent. + * + * This will be replaced by KMPXMessageIdItemChanged message + * + * @deprecated TO BE REMOVED IN INCREMENT 9 RELEASE + */ + +enum TMPXCollectionChangeType + { + EMcItemDeleted, // item deleted, including removing playlist itself + EMcItemInserted, // item added + EMcItemModified, // item modified + EMcPlaylistInserted, // new playlist added + EMcPlaylistModified // Existing playlist content: track added to /removed from playlist or playlist being overwritten + }; + +/* + * Simple structure to hold collection change event + */ +NONSHARABLE_STRUCT(TMPXCollectionChangeEvent) + { + TUid iCollectionId; + TMPXItemId iItemId; + TMPXCollectionChangeType iChangeType; + }; + +enum TMPXCollectionPathChangeType + { + EMcPathChangedByOpen = 0, // path changed due to after OpenL called + EMcPathChangedByCollectionChange // path changed due to collection content change + }; + +enum TMPXCollectionOpenEntry + { + EMcItemOpened = 0, + EMcContainerOpened + }; + +enum TMPXCollectionType + { + EMcUnknown = 0x00, + EMcLocal = 0x01, + EMcRemote = 0x02 + }; + +enum TMPXCollectionCommand + { + EMcCmdClose, + EMcCmdRefresh, + EMcCmdRemoveAll, // delete all items from db, + // aData = collection id to remove all + EMcCloseCollection, + EMcReOpenCollection, + EMcRefreshStarted, + EMcRefreshEnded, + EMcCmdReCreateDB, + EMcCmdSelect, // aData = index of focused item + EMcCmdDbCorrupted, + EMcCmdCollectionInit, + EMcCmdCollectionResyn, + EMcCmdMtpStart, + EMcCmdMtpEnd + }; + +enum TMPXCollectionBroadCastMsg + { + // This should be a 1:1 mapping to harvester events + // for easy conversion + // check mpxharvestercommon.h + // + EMcMsgFormatStart, + EMcMsgFormatEnd, + EMcMsgDiskRemoved, + EMcMsgDiskInserted, + EMcMsgUSBMassStorageStart, + EMcMsgUSBMassStorageEnd, + EMcMsgUSBMTPStart, + EMcMsgUSBMTPEnd, + EMcMsgUSBMTPNotActive, + EMcMsgSystemEventMax, + EMcMsgRefreshStart, + EMcMsgRefreshEnd + }; + +// Server function codes +enum TMPXCollectionServerOp + { + EMcsGetNextMessage, // 0 Get next message, must be 0 + EMcsCancelGetMessage, // 1 Cancel get message, must be 1 + EMcsSetMode, // 2 Must be called before any following op + EMcsOpen, // 3 + EMcsOpenIndex, // 4 + EMcsOpenPath, // 5 + EMcsGetUid, // 6 Get uid of collection opened + EMcsGetPath, // 7 + EMcsBack, // 8 + EMcsGetSyncBuffer, // 9 Read buffer of last sync request + EMcsGetAsyncBuffer, // 10 Read buffer of last async request + EMcsMedia, // 11 media for current path + EMcsMediaByPath, // 12 media by path. + EMcsAddItem, // 13 Add an item + EMcsRemovePath, // 14 Remove a collection path + EMcsRemoveItem, // 15 Remove a CMPXMedia + EMcsSetMedia, // 16 Set a media properties + EMcsFindAll, // 17 Find command + EMcsNotifyEvent, // 18 Notify an event + EMcsGetSupportedTypes, // 19 Get supported Types + EMcsCancelRequest, // 20 + EMcsGetCapabilities, // 21 Find the capabilities of loaded plugin + EMcsCollectionID, // 22 Get Collection implementation ID + EMcsCommand, // 23 Depricated: send a command to the server, with TInt parameter + EMcsSetMediaAsync, // 24 SetMediaL, Asynchronus SetL() + EMcsCommandExt, // 25 Send a command to the server, with CMPXMedia-based parameter + EMcsFilter, // 26 Get the current filter + EMcsSetFilter, // 27 Set the filter + EMcsOpenByUids, // 28 Open a list of plugins which match uids. + EMcsCollectionIdLookup, // 29 Collection id lookup + EMcsServerOpEnd // 30 End of operation, + }; + +// Define Collection capability as an int, can expand later +typedef TInt TCollectionCapability; +enum + { + EMcSearch = 0x01, // Supports search + EMcSearchWildCard = 0x02, // Supports wildcard search + EMcNotModifiable = 0x04 // Unmodifiable collection (ie UPNP) + }; + +//to indicate object type +const TInt KMPXPathUpdated = 2; +const TInt KMPXCollectionPath = 3; +const TInt KMPXCollectionEntries = 4; +const TInt KMPXCollectionMedia = 5; + +// Abstract UID definition for a "collection" +// The collection server can resolve the real collection UID based on this +// +const TUid KLocalCollection = {0x101FFB30}; +const TUid KPodcastCollection = {0x101FFB31}; +const TUid KInMemoryCollection = {0x101FFCD7}; + +#endif // MPXCOLLECTIONFRAMEWORKDEFS_H + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_common_definition_api/inc/mpxcollectionmessage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_common_definition_api/inc/mpxcollectionmessage.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,73 @@ +/* +* 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: Collection message +* +*/ + + +#ifndef TMPXCOLLECTIONMESSAGE_H +#define TMPXCOLLECTIONMESSAGE_H + +#include +#include +/** + * Collection message type + */ +class TMPXCollectionMessage : public TMPXMessage + { +public: + enum TEvent + { + ENoEvent, + EError, //EError must be 1. aType=TMPXCollectionServerOp, aData = error code + EMediaChanged,// aData=the index of changed property + EItemChanged, //aType=TMPXCollectionChangeType, + //aData=id of currently opened item + EPathChanged, //aType=TMPXCollectionPathChangeType + // For EMcPathChangedByOpen, aData = TMPXCollectionOpenEntry + // For EMcPathChangedByCollectionChange, aData not used + ECollectionChanged, // aData=UID of new collection + EBroadcastEvent, //aType=enum to event type + EFocusChanged, // Focused item changed, aData = index of focused item + EAsyncOpComplete, // aType=TMPXCollectionServerOp, aData = error code + // + // Following enum is odd to have in a public API, however this whole + // class is now deprecated and there will only ever be the "extended" + // message API: + // MMPXCollectionObserver::HandleCollectionMessageL(const CMPXMessage* aMsg) + // + EExtendedMessage // (Internal use) aData=MMPXData data handle + }; +public: + /** + * C++ constructor. + * + * @since S60 3.2.3 + * @param aEvent event + * @param aType event type + * @param aData optional data + */ + inline TMPXCollectionMessage(TEvent aEvent,TInt aType = 0, TInt aData = 0); + + /** + * C++ constructor. + * + * @since S60 3.2.3 + */ + inline TMPXCollectionMessage(); + }; + +#include "mpxcollectionmessage.inl" + +#endif // TMPXCOLLECTIONMESSAGE_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_common_definition_api/inc/mpxcollectionmessage.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_common_definition_api/inc/mpxcollectionmessage.inl Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,35 @@ +/* +* 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: Inline implementation of collection messge +* +*/ + + +// ----------------------------------------------------------------------------- +// C++ constructor +// ----------------------------------------------------------------------------- +// +inline TMPXCollectionMessage::TMPXCollectionMessage(TEvent aEvent, + TInt aType/*= 0*/, + TInt aData/*= 0*/) + : TMPXMessage(aEvent,aType, aData) + {} + +// ----------------------------------------------------------------------------- +// C++ constructor +// ----------------------------------------------------------------------------- +// +inline TMPXCollectionMessage::TMPXCollectionMessage() + : TMPXMessage(ENoEvent,0,0) + {} diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_common_definition_api/inc/mpxcollectionmessagedefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_common_definition_api/inc/mpxcollectionmessagedefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,199 @@ +/* +* Copyright (c) 2006 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: Definitions for message type +* +*/ + + + +#ifndef CMPXCOLLECTIONMESSAGEDEFS_H +#define CMPXCOLLECTIONMESSAGEDEFS_H + + +#include +#include +/** + * Item changed message + */ + +const TInt KMPXMessageIdItemChanged = 0x10282945; + +/** + * Attributes supported for KMPXMessageIdItemChanged + */ +/** + * TUid. Collection id of the message originator + */ +const TMPXAttributeData KMPXMessageCollectionId={KMPXMessageIdItemChanged, 0x01}; +/** + * TMPXChangeEventType, change event type + */ +const TMPXAttributeData KMPXMessageChangeEventType={KMPXMessageIdItemChanged, 0x02}; +/** + * TMPXGeneralCategory, category of the media changed + */ +const TMPXAttributeData KMPXMessageMediaGeneralCategory={KMPXMessageIdItemChanged, 0x04}; +/** + * TMPXItemId (as def'd in CollectionPath) + * ID of media changed + */ +const TMPXAttributeData KMPXMessageMediaGeneralId={KMPXMessageIdItemChanged, 0x08}; +/** + * TMPXItemId (as def'd in CollectionPath) + * (Optional) Old ID of media if media is moved/renamed + */ +const TMPXAttributeData KMPXMessageMediaDeprecatedId={KMPXMessageIdItemChanged, 0x10}; + +/** + * Attributes supported for KMPXMessageIdItemChanged + * + * @deprecated please use constants above + */ +enum + { + /** + * TUid. Collection id of the message originator + */ + EMPXMessageCollectionId=0x01, + + /** + * TMPXChangeEventType, change event type + */ + EMPXMessageChangeEventType = 0x02, + + /** + * TMPXGeneralCategory, category of the media changed + */ + EMPXMessageMediaGeneralCategory=0x04, + + /** + * TMPXItemId (as def'd in CollectionPath) + * ID of media changed + */ + EMPXMessageMediaGeneralId=0x08, + + /** + * TMPXItemId (as def'd in CollectionPath) + * (Optional) Old ID of media if media is moved/renamed + */ + EMPXMessageMediaDeprecatedId=0x10 + + }; + + +// +// a) When a track is removed, the following messages will be sent: +// 1) EMPXItemDeleted/EMPXSong for the track removed +// 2) EMPXItemModified/EMPXArtist, EMPXItemModified/EMPXAlbum, ...etc. +// for the affected artist/album/genre/composer where applicable +// 3) EMPXItemModified/EMPXPlaylist for the affected playlists where +// applicable. +// +// b) When a track is added, EMPXItemInserted/EMPXSong will be sent +// for the track added +// +// c) When a track is modified (including modifying its +// artist/album/genre/composer), the following messages will be sent: +// 1) EMPXItemModified/EMPXSong for the track modified. If MTP renames +// the track (i.e. changing the URI of the song), deprecated Id +// of the track will be included in this message. +// 2) EMPXItemModified/EMPXArtist, EMPXItemModified/EMPXAlbum, ...etc. +// for the affected artist/album/genre/composer where applicable. +// If artist/album/genre/composer has been renamed, deprecated Id +// will be included in this message. +// 3) EMPXItemModified/EMPXPlaylist for the affected playlists where +// applicable. +// +// d) When a playlist removed, EMPXItemDeleted/EMPXPlaylist will be +// sent for the playlist removed +// +// e) When a track is removed from a saved playlist, +// EMPXItemModified/EMPXPlaylist will be sent +// +// f) When a playlist is added, EMPXItemInserted/EMPXPlaylist will be +// sent for the playlist added +// +// g) When a track is appended to a playlist, EMPXItemModified/EMPXPlaylist +// will be sent for the playlist modified +// +// h) When a playlist is modified, EMPXItemModified/EMPXPlaylist will be +// sent. If the playlist is renamed, deprecated Id of the playlist +// will be included in this message. +// +enum TMPXChangeEventType + { + EMPXItemDeleted, // item/playlist deleted + EMPXItemInserted, // item/playlist added + EMPXItemModified // item/playlist/artist/album/genre/composer modified + }; + + +/** + * A CMPXMessage to give additinal information about failures or events + * generated from collection plugins. This message can be customized + * by a plugin to tell the UI about events + */ +const TInt KMPXCustomMessageId = 0x10282957; + +/** + * Attributes supported for KMPXCustomMessageId + */ +/** + * The collection id that originated the message (TInt) + */ +const TMPXAttributeData KMPXCustomMessageCollectionId={KMPXCustomMessageId, 0x01}; +/** + * TInt, a generic event type such as TMPXCollectionServerOp + * The interpretation of this attribute depends on the collection plugin. + * + * For example, the Music DB plugin will return EMcsOpen, KErrOutOfDisk + * if the plugin cannot merge the database because of low disk space + */ +const TMPXAttributeData KMPXCustomMessageEventType={KMPXCustomMessageId, 0x02}; +/** + * TInt, standard symbian error codes + */ +const TMPXAttributeData KMPXCustomMessageErrorCode={KMPXCustomMessageId, 0x04}; + +/** + * + * @deprecated please use constants above + * + */ + +enum + { + /** + * The collection id that originated the message (TInt) + */ + EMPXCustomMessageCollectionId=0x01, + + /** + * TInt, a generic event type such as TMPXCollectionServerOp + * The interpretation of this attribute depends on the collection plugin. + * + * For example, the Music DB plugin will return EMcsOpen, KErrOutOfDisk + * if the plugin cannot merge the database because of low disk space + */ + EMPXCustomMessageEventType=0x02, + + /** + * TInt, standard symbian error codes + */ + EMPXCustomMessageErrorCode=0x04 + + }; +#endif // CMPXCOLLECTIONMESSAGEDEFS_H + +// End of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_common_definition_api/inc/mpxcollectionobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_common_definition_api/inc/mpxcollectionobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,160 @@ +/* +* Copyright (c) 2006 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: Collection observer +* +*/ + + +#ifndef MMPXCOLLECTIONOBSERVER_H +#define MMPXCOLLECTIONOBSERVER_H + +#include +#include +#include + +class MDesCArray; +class TMPXCollectionMessage; +class CMPXCollectionPlaylist; +class MMPXCollectionFindObserver; + +/******************************************************************************** +* +* Note: +* +* ** remove TMPXCollectionMessage and associated funtions +* +* ** remove null implementations +* +*********************************************************************************/ + +NONSHARABLE_CLASS(MMPXCollectionMediaObserver) + { +public: + /** + * Handle extended media properties. + * + * @since S60 3.2.3 + * @param aMedia media + * @param aError error code + */ + virtual void HandleCollectionMediaL(const CMPXMedia& aMedia, + TInt aError) = 0; + }; + +/** + * Interface for receiving data asynchronously + */ +NONSHARABLE_CLASS(MMPXCollectionObserver) : public MMPXCollectionMediaObserver + { +public: + + /** + * + * + * Handle collection message + * NOTE: only one of HandleCollectionMessage callback can be implemented + * + * @param aMessage collection message + * @deprecated please implement HandleCollectionMessage(CMPXMessage* aMsg, TInt aErr) + */ + virtual void HandleCollectionMessageL(const CMPXMessage& /*aMsg*/) {/* */} + + + /** + * Handle collection message. + * NOTE: only one of HandleCollectionMessage callback can be implemented + * + * @since S60 3.2.3 + * @param aMessage collection message, ownership not transferred. + * Please check aMsg is not NULL before using it. If aErr is not + * KErrNone, plugin might still call back with more info in the aMsg. + * @param aErr system error code + */ + virtual void HandleCollectionMessage(CMPXMessage* aMsg, TInt /*aErr*/) + { + // Note change into pure virtual when all clients updated + // Temp solution, aMsg will be a dummy object if aErr + // TO BE REMOVED when above HandlePlaybackMessage is removed. + TRAP_IGNORE(HandleCollectionMessageL(*aMsg)); + } + + /** + * Handles the collection entries being opened. Typically called + * when client has Open()'d a folder. + * + * @since S60 3.2.3 + * @param aEntries collection entries opened + * @param aIndex focused entry + * @param aComplete ETrue no more entries. EFalse more entries + * expected + * @param aError error code + */ + virtual void HandleOpenL(const CMPXMedia& aEntries, + TInt aIndex,TBool aComplete,TInt aError) = 0; + + /** + * Handles the item being opened. Typically called + * when client has Open()'d an item. Client typically responds by + * 'playing' the item via the playlist. + * + * @since S60 3.2.3 + * @param aPlaylist collection playlist + * @param aError error code + */ + virtual void HandleOpenL(const CMPXCollectionPlaylist& aPlaylist,TInt aError) = 0; + + /** + * Handle completion of a asynchronous command. + * Note: All clients should implement this callback. + * + * @since S60 3.2.3 + * @param aCommandResult result of the command, NULL if error + * @param aError error code + */ + virtual void HandleCommandComplete(CMPXCommand* /*aCommandResult*/, + TInt /*aError*/) {}; + }; + +NONSHARABLE_CLASS(MMPXCollectionFindObserver) + { +public: + /** + * Handle callback for "find" operation. + * + * @since S60 3.2.3 + * @param aEntries CMPXMedia to be returned + * @param aComplete ETrue no more entries. EFalse more entries + * expected + * @param aError error code + */ + virtual void HandleFindAllL(const CMPXMedia& aResults, + TBool aComplete,TInt aError) = 0; + }; + +NONSHARABLE_CLASS(MMPXCollectionRemoveObserver) + { +public: + /** + * Handles removing a collection path. + * Calls back with the list of file paths that were deleted. + * This callback is only applicable for local file storage plugins. + * + * @since S60 3.2.3 + * @param aUriArray list of files that were deleted + * @param aError error code + */ + virtual void HandleRemoveL(MDesCArray& aUriArray, TInt aError) = 0; + }; + +#endif // MMPXCOLLECTIONOBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_common_definition_api/inc/mpxcollectionopenlresultdef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_common_definition_api/inc/mpxcollectionopenlresultdef.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2006 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: Definitions for incremental open command type +* +*/ + + + +#ifndef MPXCOLLECTIONOPENLRESULTDEFS_H +#define MPXCOLLECTIONOPENLRESULTDEFS_H + +#include +#include + +/** + * Structure to hold the offset and size of each data block + */ +NONSHARABLE_STRUCT( TMPXOpenDataBlock ) + { + TInt iOffset; + TInt iSize; + }; + +/** + * Content ID for opening incrementally + */ +const TInt KMPXCollectionOpenLResults = 0x1028297E; + +/** + * Attributes supported for KMPXCollectionOpenLResults + */ + +/** + * TMPXOpenDataBlock structure to hold what block was fetched + * contains the offset and the size of the datablock + * + * Used for the collection generic cache to merge in datasets + * + */ +const TMPXAttributeData KMPXCollectionOpenLResultRange = { + KMPXCollectionOpenLResults, 0x01}; + +/** + * RArray serialized to a CBufBase* descriptor + * Migrate to RMPXArray<> in the future + * + * This information will be provided by the generic cache + * + * Contains a cumulative list of all fetched blocks + * Client should merge blocks together if overlapping results are fetched + */ +const TMPXAttributeData KMPXCollectionOpenLAllResultRange = { + KMPXCollectionOpenLResults, 0x02}; + +/** + * TBool supports KMPXCommandIdIncrementalOpenL commands + * The collection plugin will set this to ETrue if a path supports + * Incremental Opening. + * + * The collection open utility will use this flag to determine + * if incremental open is supported + * ETrue if supported + * EFalse or not set is not supported + */ +const TMPXAttributeData KMPXCollectionOpenLSupportsIncremental = { + KMPXCollectionOpenLResults, 0x04}; + +#endif // MPXCOLLECTIONOPENLRESULTDEFS_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_common_definition_api/inc/mpxcollectionplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_common_definition_api/inc/mpxcollectionplugin.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,358 @@ +/* +* Copyright (c) 2006 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: Collection plugin interface +* +*/ + + +#ifndef CMPXCOLLECTIONPLUGIN_H +#define CMPXCOLLECTIONPLUGIN_H + +#include +#include +#include +#include +#include +#include +#include + +class MMPXCollectionPluginObserver; +class MMPXCollectionEngineObserver; +class CMPXCollectionPath; +class CMPXActiveTaskQueue; +class MMPXTaskQueueObserver; + +const TUid KMPXCollectionInterfaceUid={0x101FFC36}; + +/******************************************************************************** +* +* Note: +* +* ** remove void CommandL(TMPXCollectionCommand aCmd, TInt aArg = 0) +* +* ** remove MediaL() overload +* +* ** remove null implementations +* +* ** rename GetCapabilities() to Capabilities() +* +*********************************************************************************/ + +/** + * CMPXCollectionPlugin class + * + * Interface to access collection + */ +NONSHARABLE_CLASS(CMPXCollectionPlugin): public CBase + { + +public: // Constructors and destructor + + /** + * Two-phased constructor. + * + * @since S60 3.2.3 + * @param aUid uid of interface implementation + * @param aObs Reference to the callback interface + * @return object of constructed + */ + inline static CMPXCollectionPlugin* NewL(const TUid& aUid, + MMPXCollectionPluginObserver& aObs); + + /** + * Destructor. + * + * @since S60 3.2.3 + */ + inline virtual ~CMPXCollectionPlugin(); + +public: + + /** + * Callback setter. + * + * @since S60 3.2.3 + * @param aObs Reference to the callback interface + */ + inline void SetObserver(MMPXCollectionPluginObserver& aObs); + + /** + * + * + * @param aCmd a command + * @param aArg optional argument + * @deprecated executes a command on the selected collection, use CommandL(CMPXCommand& aCmd) + */ + virtual void CommandL(TMPXCollectionCommand aCmd, TInt aArg = 0)=0; + + /** + * Executes a command. + * + * @since S60 3.2.3 + * @param aCmd a command + */ + virtual void CommandL(CMPXCommand& /*aCmd*/) + {/*Note: need to implement this */} + + /** + * Navigates to the given path. + * + * @since S60 3.2.3 + * @param aPath a path + * @param aAttrs attributes requested + * @param aFilter filter to apply or NULL if none + */ + virtual void OpenL(const CMPXCollectionPath& /*aPath*/, + const TArray& /*aAttrs*/, + CMPXFilter* /*aFilter*/) = 0; + + /** + * + * Media properties of the current file (async). + * Note: if selection is set in aPath, HandleMedia will return an array of + * media properties of current selected items. + * if no selection is set in aPath, HandleMedia will return media + * properities of current item. + * + * @since S60 3.2.3 + * @param aPath path for the media file + * @param aAttr attributes requested + * @param aCaps platsec capabilities of client requesting media; plug-in should also + * verify its process capabilities + * @param aSpecs, specifications for attributes + * @deprecated use the following version of MediaL + */ + virtual void MediaL(const CMPXCollectionPath& /*aPath*/, + const TArray& /*aAttrs*/, + const TArray& /*aCaps*/, + CMPXAttributeSpecs* /*aSpecs*/) = 0; + /** + * Cancel outstanding request. + * + * @since S60 3.2.3. + */ + virtual void CancelRequest()=0; + + /** + * Adds an item or items to the collection. + * + * @since S60 3.2.3 + * @param aNewProperties Properties of the item + */ + virtual void AddL(const CMPXMedia& aNewMedia) = 0; + + /** + * Remove a collection path. + * Note that the selection indicies are hidden within the path + * + * @since S60 3.2.3 + * @param aPath path to remove + * + */ + virtual void RemoveL(const CMPXCollectionPath& aPath ) = 0; + + /** + * Remove an item or items from the collection. + * + * @since S60 3.2.3 + * @param aProperties Properties of the item. It may cantain URI only + * or meta data, all of items matched properties + * will be removed. + */ + virtual void RemoveL(const CMPXMedia& aMedia) = 0; + + /** + * Sets/updates the media for the item + * specified in the path. + * + * @since S60 3.2.3 + * @param aMedia new value + */ + virtual void SetL(const CMPXMedia& aMedia) = 0; + + /** + * Find a list of items matched (async). + * + * @since S60 3.2.3 + * @param aCriteria properties to be searched + * @param aAttrs attributes to return + */ + virtual void FindAllL(const CMPXSearchCriteria& aCriteria, + const TArray& aAttrs) = 0; + + /** + * Find a list of items matched (sync). + * + * @since S60 3.2.3 + * @param aCriteria properties to be searched + * @param aAttrs attributes to return + * @return results of the search + */ + virtual CMPXMedia* FindAllSyncL(const CMPXSearchCriteria& aCriteria, + const TArray& aAttrs) = 0; + + /** + * Get the list of supported capabilities. + * + * @since S60 3.2.3 + * @return TCollectionCapability bitmask of supported capabilities + */ + virtual TCollectionCapability GetCapabilities() = 0; + + /** Note change it to pure virtual when all of plugins implement this interface + * + * Media properties of the current file (async). + * Note: if selection is set in aPath, HandleMedia will return an array of + * media properties of current selected items. + * if no selection is set in aPath, HandleMedia will return media + * properities of current item. + * + * @since S60 3.2.3 + * @param aPath path for the media file + * @param aAttr attributes requested + * @param aCaps platsec capabilities of client requesting media; plug-in should also + * verify its process capabilities + * @param aSpecs, specifications for attributes + * @param aFilter filter to apply or NULL if none + */ + virtual void MediaL(const CMPXCollectionPath& aPath, + const TArray& aAttrs, + const TCapabilitySet& aCaps, + CMPXAttributeSpecs* aSpecs, + CMPXFilter* /*aFilter*/) + { + RArray caps; + CleanupClosePushL(caps); + if (aCaps.HasCapability(ECapabilityDRM)) + { + caps.AppendL(ECapabilityDRM); + } + // else add further "relevant" capabilities here + + // Add "none" capability, if no caps listed + if (caps.Count() == 0) + { + caps.AppendL(ECapability_None); + } + MediaL(aPath, aAttrs, caps.Array(), aSpecs); + CleanupStack::PopAndDestroy(&caps); + }; + +public: + + /** + * Implementation uid of plugin. + * + * @since S60 3.2.3 + */ + inline const TUid& Uid(); + + /** + * Current outstanding async task in the task queue. + * + * @since S60 3.2.3 + */ + inline TInt Task(); + + /** + * Add a task and automatically schedule task. + * + * @since S60 3.2.3 + * @param aTask task id + * @param aCallback callback + * @param aHandler task handler + * @param aParamData data + * @param aBuf pointer to the buffer containing + * externalized parameter data. + * Client passes ownership of the buffer + * to TaskQueue. + * @param aPtrData object pointer + * @param aCObject1 pointer to CBased object, ownership transferred + * @param aCObject2 pointer to CBased object, ownership transferred + */ + inline void AddTaskL(TInt aTask, + TAny* aCallback, + MMPXTaskQueueObserver* aHandler, + TInt aParamData=0, + CBufBase* aBuf=NULL, + TAny* aPtrData=NULL, + CBase* aCObject1=NULL, + CBase* aCObject2=NULL); + + /** + * Complete current task + * + * @since S60 3.2.3 + */ + inline void CompleteTask(); + + /** + * Complete all tasks wih the specified error code. + * + * @since S60 3.2.3 + * @param aError completion error code + */ + inline void CompleteAllTasks(TInt aError); + + /** + * Remove task for one client. + * + * @since S60 3.2.3 + * @param aCallback callback when task completed + */ + inline void RemoveTask(TAny* aCallback); + + /** + * Callback of current active task. + * + * @since S60 3.2.3 + * @return pointer to call back object or NULL if no active task + */ + inline MMPXCollectionEngineObserver* Callback(); + + /** + * Set call back for current active task. + * NULL if there is no active task for this plugin. + * + * @since S60 3.2.3 + * @param aCallback callback when task completed + */ + inline void SetCallback(MMPXCollectionEngineObserver* aCallback); + +private: + /** + * This is internal and not intended for use in plugin side. + * + * @since S60 3.2.3 + */ + inline void InitializeL(); + +protected: + + MMPXCollectionPluginObserver* iObs; // Not owned +private: // Data + + // identifies the actual plugin instance + TUid iDtorKey; + // Task queue for the plugin + CMPXActiveTaskQueue* iTaskQueue; + TUid iUid; //Implementation uid of the plugin + // Not owned, callback when current active task completed + MMPXCollectionEngineObserver* iCallback; + }; + +#include "mpxcollectionplugin.inl" +#endif // CMPXCOLLECTIONPLUGIN_H + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_common_definition_api/inc/mpxcollectionplugin.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_common_definition_api/inc/mpxcollectionplugin.hrh Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2006 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: Resource headers for MPX Collection Plugins +* +*/ + + +#ifndef MPX_COLLECTION_PLUGIN_HRH +#define MPX_COLLECTION_PLUGIN_HRH + +#include +// CONSTANTS + +/** Collection plugin interface UID */ +#define KMPXCollectionPluginInterfaceUid 0x101FFC36 + +/** DEPRECATED please use enum TMPXPluginFlags defined in mpxplugin.hrh + * Flag to indicate that this plugin needs to be preloaded, and will not be + * unloaded until collection server shutdown. + * It is used as a flag in the opaque data flag of plugin resource file + */ +#define KMPXCollectionPluginPreLoaded EMPXPluginFlagPreLoad + +// Collection Specific flags +// Use top 16 bits for collection specific flags, bottom 16 bits for generic flags +// +enum TMPXCollectionPluginFlags + { + EMPXCollectionPluginFlagCacheable = 0x10000 + }; + +// Collection Plugin Types. +// +enum TMPXCollectionPluginType + { + EMPXCollectionPluginUnknown=0, // unknown type + EMPXCollectionPluginMusic=0x101FFCDA, + EMPXCollectionPluginHidden=0x101FFCDB, + EMPXCollectionPluginPodCast=0x10282950, + EMPXCollectionPluginTemporary=0x10282961, + EMPXCollectionPluginGallery=0x10282966 // Media gallery plugin + }; + +// DEPRECATED please use enum TMPXPluginPriorities defined in mpxplugin.hrh +/** Collection Plugin priorities */ +enum TMPXCollectionPluginPriorities + { + EMPXCollectionPluginPriorityLowest = EMPXPluginPriorityLowest, + EMPXCollectionPluginPriorityLow = EMPXPluginPriorityLow, + EMPXCollectionPluginPriorityNormal = EMPXPluginPriorityNormal, + EMPXCollectionPluginPriorityHigh = EMPXPluginPriorityHigh, + EMPXCollectionPluginPriorityHighest = EMPXPluginPriorityHighest + }; + +#endif // MPX_COLLECTION_PLUGIN_HRH diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_common_definition_api/inc/mpxcollectionplugin.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_common_definition_api/inc/mpxcollectionplugin.inl Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,152 @@ +/* +* 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: Inline implementation of collection plugin constructor/destructor +* +*/ + + +// ======================= INLINE MEMBER FUNCTIONS ============================ +#include + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +inline CMPXCollectionPlugin* CMPXCollectionPlugin::NewL( + const TUid& aUid, + MMPXCollectionPluginObserver& aObs) + { + CMPXCollectionPlugin* self = reinterpret_cast( + REComSession::CreateImplementationL(aUid, + _FOFF(CMPXCollectionPlugin,iDtorKey))); + CleanupStack::PushL(self); + self->InitializeL(); + CleanupStack::Pop(self); + self->iObs = &aObs; + self->iUid = aUid; + return self; + } + +// ---------------------------------------------------------------------------- +// plugin destruction +// ---------------------------------------------------------------------------- +// +inline CMPXCollectionPlugin::~CMPXCollectionPlugin() + { + delete iTaskQueue; + REComSession::DestroyedImplementation(iDtorKey); + } + +// ---------------------------------------------------------------------------- +// Set observer of current request +// ---------------------------------------------------------------------------- +// +inline void CMPXCollectionPlugin::SetObserver(MMPXCollectionPluginObserver& aObs) + { + iObs = &aObs; + } + +// ---------------------------------------------------------------------------- +// Returns implemenation uid of the plugin +// ---------------------------------------------------------------------------- +// +inline const TUid& CMPXCollectionPlugin::Uid() + { + return iUid; + } + +// ---------------------------------------------------------------------------- +// Returns current async task in the task queue +// ---------------------------------------------------------------------------- +// +inline TInt CMPXCollectionPlugin::Task() + { + return iTaskQueue->Task(); + } + +// ---------------------------------------------------------------------------- +// Set observer of current request +// ---------------------------------------------------------------------------- +// +inline void CMPXCollectionPlugin::AddTaskL( + TInt aTask, + TAny* aCallback, + MMPXTaskQueueObserver* aHandler, + TInt aParamData/*=0*/, + CBufBase* aBuf/*=NULL*/, + TAny* aPtrData/*=NULL*/, + CBase* aCObject1/*=NULL*/, + CBase* aCObject2/*=NULL*/) + { + iTaskQueue->AddTaskL(aTask, aCallback, aHandler, aParamData, + aBuf, aPtrData, aCObject1, aCObject2); + } + +// ---------------------------------------------------------------------------- +// Set observer of current request +// ---------------------------------------------------------------------------- +// +inline void CMPXCollectionPlugin::CompleteTask() + { + iTaskQueue->CompleteTask(); + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionPlugin::CompleteAllTasks +// ---------------------------------------------------------------------------- +// +inline void CMPXCollectionPlugin::CompleteAllTasks( + TInt aError) + { + iTaskQueue->CompleteAllTasks(aError); + } + +// ---------------------------------------------------------------------------- +// Set observer of current request +// ---------------------------------------------------------------------------- +// +inline void CMPXCollectionPlugin::RemoveTask(TAny* aCallback) + { + iTaskQueue->RemoveTask(aCallback); + } + +// ---------------------------------------------------------------------------- +// Initialize the data memeber +// ---------------------------------------------------------------------------- +// +inline void CMPXCollectionPlugin::InitializeL() + { + iTaskQueue = CMPXActiveTaskQueue::NewL(); + } + +// ---------------------------------------------------------------------------- +// Returns callback of current active task +// ---------------------------------------------------------------------------- +// +inline MMPXCollectionEngineObserver* CMPXCollectionPlugin::Callback() + { + return iCallback; + } + +// ---------------------------------------------------------------------------- +// Set call back when current active task completed. NULL if there is +// no active task for this plugin +// ---------------------------------------------------------------------------- +// +inline void CMPXCollectionPlugin::SetCallback( + MMPXCollectionEngineObserver* aCallback) + { + iCallback = aCallback; + } +// End of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_common_definition_api/inc/mpxcollectionpluginobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_common_definition_api/inc/mpxcollectionpluginobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2006 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: Collection plugin observer +* +*/ + + +#ifndef MMPXMCOLLECTIONPLUGINOBSERVER_H +#define MMPXMCOLLECTIONPLUGINOBSERVER_H + + +#include +#include +#include + +class CMPXCollectionPath; + +// CONSTANTS + +// CLASS DECLARATION + +/** + * MMPXCollectionPluginObserver class + * + * Observer interface for Collection plugin + */ +NONSHARABLE_CLASS(MMPXCollectionPluginObserver) : + public MMPXCollectionEngineCommonObserver + { +public: + + /** + * Handle message from plug-in + * + * @param aMessage, message from the plug-in + * @deprecated Please use HandleMessage(CMPXMessage* aMsg, TInt aError) + */ + virtual void HandleMessage(const CMPXMessage& aMsg) + { + HandleMessage(const_cast(&aMsg), KErrNone); + } + + /** + * Handle message from plug-in. + * Note: make it as pure virtual when previous callback removed + * + * @since S60 3.2.3 + * @param aMessage message from the plug-in. Ownership not transferred. + * @param aError error code. + */ + virtual void HandleMessage(CMPXMessage* /*aMsg*/, TInt /*aError*/) + {} + + /** + * Handle opening a group, e.g. an artist. + * + * @since S60 3.2.3 + * @param aMedia media object returned. NULL will be returned if error + * Ownership not transferred. + * @param aErr error code + */ + virtual void HandleOpen(CMPXMedia* aMedia, TInt aErr) = 0; + + /** + * Handle opening an item. + * + * @since S60 3.2.3 + * @param aPath path to the selected item, NULL will be returned if error + * Ownership not transferred + * @param aErr error code + */ + virtual void HandleOpen(CMPXCollectionPath* aPath, TInt aErr) = 0; + + /** + * Handle opening a group, e.g. an artist. + * + * @since S60 3.2.3 + * @param aMedia media object returned. NULL will be returned if error. + * Ownership not transferred. + * @param aPath full path to to current level. Including top level nodes as well. + * NULL will be returned if error. Ownership not transferred + * Note. The path does not contain any state info besides a list of ids. + * @param aErr error code + */ + virtual void HandleOpen(CMPXMedia* aMedia, + const CMPXCollectionPath* aPath, + TInt aErr) = 0; + }; + +#endif // MMPXMCOLLECTIONPLUGINOBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_common_definition_api/inc/mpxincrementalopendefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_common_definition_api/inc/mpxincrementalopendefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2006 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: Definitions for incremental open command type +* +*/ + + + +#ifndef MPXINCREMENTALOPENDEFS_H +#define MPXINCREMENTALOPENDEFS_H + +#include + +/** + * Content ID for opening incrementally + */ +const TInt KMPXCommandIdIncrementalOpenL = 0x1028297B; + +/** + * Enumeration for ascending or decending + */ +enum TReadDirection + { + EReadUnknown = -1, + EReadDescending = 0, + EReadAscending = 1 + }; + +/** + * Attributes supported for KMPXCommandIdIncrementalOpenL + */ + +/** + * The collection path to open (CMPXCollectionPath) + */ +const TMPXAttributeData KMPXCollectionCommandIdIncOpenLPath = { + KMPXCommandIdIncrementalOpenL, 0x01}; + +/** + * Offset to start reading from (TInt) + */ +const TMPXAttributeData KMPXCollectionCommandIdIncOpenLOffset = { + KMPXCommandIdIncrementalOpenL, 0x02}; + +/** + * Number of items to read (TInt) + */ +const TMPXAttributeData KMPXCollectionCommandIdIncOpenLNumItems = { + KMPXCommandIdIncrementalOpenL, 0x04}; + +/** + * Read ascending or decending (EReadDescending for dsc, + * EReadAscending for asc) + * + * Can use ascending read if a key item can be provided for faster access + */ +const TMPXAttributeData KMPXCollectionCommandIdIncOpenLAscDsc = { + KMPXCommandIdIncrementalOpenL, 0x08}; + +/** + * Value of some key (TDesC) to accelerate open db + * + * For example, KMPXMediaGeneralTitle can be used + * as a reference for plugins to quickly jump to the + * last retrieved item + */ +const TMPXAttributeData KMPXCollectionCommandIdIncOpenLKeyItem = { + KMPXCommandIdIncrementalOpenL, 0x10}; + +#endif // MPXINCREMENTALOPENDEFS_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_common_definition_api/mpx_collection_common_definition_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_common_definition_api/mpx_collection_common_definition_api.metaxml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,14 @@ + + +MPX Collection Common Definition API +Common definitions used by the MPX collection framework +c++ +mpx + + + + +no +no + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_utility_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_utility_api/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2007 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 +: mpx collection utility API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/mpxcollectionplaylist.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectionplaylist.h) +../inc/mpxcollectionplaylistobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectionplaylistobserver.h) +../inc/mpxcollectionutility.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectionutility.h) +../inc/mpxcollectionopenutility.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectionopenutility.h) diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_utility_api/inc/mpxcollectionopenutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_utility_api/inc/mpxcollectionopenutility.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,355 @@ +/* +* Copyright (c) 2007 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: Incremental OpenL() utility +* +*/ + + +#ifndef C_CMPXCOLLECTIONOPENUTILITY_H +#define C_CMPXCOLLECTIONOPENUTILITY_H + +#include +#include +#include + +// FORWARD DECLARTIONS +class MMPXCollectionUtility; +class CMPXCollectionPath; + +/** + * CMPXCollectionOpenUtility + * + * Incremental OpenL() utility to open data in chunks + * + * @lib mpxcollectionutility.lib + */ +class CMPXCollectionOpenUtility : public CBase, + public MMPXCollectionObserver + { +public: + + /** + * Two phased constructor. + * + * @since S60 5.0 + * @param aObs observer + * @param aMode mode of the utility + */ + IMPORT_C static CMPXCollectionOpenUtility* NewL( MMPXCollectionObserver* aObs, TUid aMode = KMcModeDefault ); + + /** + * virtual destructor. + * + * @since S60 5.0 + */ + virtual ~CMPXCollectionOpenUtility(); + +public: // Enumerations + /** + * Direction of the fetch + */ + enum TDirection + { + EFetchNormal, + EFetchUp, + EFetchDown + }; + +public: // Public functions + + /** + * Start the incremental read operation. + * + * @since S60 5.0 + * @param aAttrs array of attributes + * @param aChunkSize size of each chunk to fetch + * @param aOffset offset to start fetching from + * @param aDirection fetching direction, normal, up or down + * @param aKeyAttribute key attribute to speed up open operation + */ + IMPORT_C void StartL( TArray aAttrs, + TInt aChunkSize, + TInt aOffset = 0, + TDirection aDirection = EFetchNormal, + TMPXAttribute aKeyAttribute = KMPXMediaNullAttribute ); + + /** + * Start the incremental read operation. + * + * @since S60 5.0 + * @param aPath path to have to open to + * @param aAttrs array of attributes + * @param aChunkSize size of each chunk to fetch + * @param aOffset offset to start fetching from + * @param aDirection fetching direction, normal, up or down + * @param aKeyAttribute key attribute to speed up open operation + */ + IMPORT_C void StartL( const CMPXCollectionPath& aPath, + TArray aAttrs, + TInt aChunkSize, + TInt aOffset = 0, + TDirection aDirection = EFetchNormal, + TMPXAttribute aKeyAttribute = KMPXMediaNullAttribute ); + + /** + * Cancel the incremental reading procedure. + * + * @since S60 5.0 + */ + IMPORT_C void Stop(); + + /** + * Set the fetching direction. + * + * @since S60 5.0 + * @param aDirection a direction to start fetching from + */ + IMPORT_C void SetDirection( TDirection aDirection ); + + /** + * Set the fetching delay in between subsequent fetches. + * + * @since S60 5.0 + * @param aDelay delay in microseconds, default is 0 + */ + IMPORT_C void SetDelay( TInt aDelay ); + + /** + * Returns a copy of the collection path. + * + * @since S60 5.0 + * @return CMPXCollectionpath* ownership transferred + */ + IMPORT_C CMPXCollectionPath* PathL(); + +protected: // From Base Class + + /** + * From MMPXCollectionObserver + * + * @since S60 5.0 + */ + void HandleCollectionMessage(CMPXMessage* aMsg, TInt aErr); + + /** + * From MMPXCollectionObserver + * + * @since S60 5.0 + */ + void HandleOpenL(const CMPXMedia& aEntries, + TInt aIndex,TBool aComplete,TInt aError); + + /** + * From MMPXCollectionObserver + * + * @since S60 5.0 + */ + void HandleOpenL(const CMPXCollectionPlaylist& aPlaylist,TInt aError); + + /** + * From MMPXCollectionObserver + * + * @since S60 5.0 + */ + void HandleCommandComplete(CMPXCommand* aCommandResult, + TInt aError); + + /** + * From MMPXCollectionObserver + * + * @since S60 5.0 + */ + void HandleCollectionMediaL(const CMPXMedia& aMedia, + TInt aError); + +private: + /** + * Handle collection messages. + * + * @since S60 5.0 + * @param aMsg CMPXMessage to handle + */ + void DoHandleCollectionMessageL( const CMPXMessage& aMsg ); + + /** + * Handle command complete. + * + * @since S60 5.0 + * @param aCommand result of the command + * @param aError any errors + */ + void DoHandleCommandCompleteL(CMPXCommand& aCommandResult, + TInt aError); + /** + * Fetch Count step. + * + * @since S60 5.0 + */ + void DoFetchCountL(); + + /** + * Handle completion of count step. + * + * @since S60 5.0 + * @param aMedia media returned from the collection + * @param aIndex item focus from the collection + * @param aError error of the operation + */ + void DoHandleCountL(const CMPXMedia& aMedia, + TInt aIndex, + TInt aError); + + /** + * Fetch items step. + * + * @since S60 5.0 + */ + void DoFetchItemsL(); + + /** + * Handle completion of fetch item step. + * + * @since S60 5.0 + * @param aMedia media returned from the collection + * @param aIndex item focus from the collection + * @param aError error of the operation + * @leave IfNull + */ + void DoHandleFetchItemsL( const CMPXMedia& aMedia, + TInt aIndex, + TInt aError); + + /** + * Run the next step. + * + * @since S60 5.0 + */ + void RunNext(); + + /** + * Callback function for the periodic timer. + * + * @since S60 5.0 + */ + static TInt Callback( TAny* aAny ); + + /** + * Handle callback from the timer. + * + * @since S60 5.0 + */ + void HandleCallbackL(); + + /** + * Setup the chunks. + * + * @since S60 5.0 + * @param aCount total number of items + */ + void DoSetupChunksL( TInt aCount ); + + /** + * Sort ascending. + * + * @since S60 5.0 + * @param aSkipFirst do not order the first item + */ + void DoSortAscend( TBool aSkipFirst = EFalse ); + + /** + * Sort decending do not order the first item. + * + * @since S60 5.0 + * @param aSkipFirst do not order the first item + */ + void DoSortDescend( TBool aSkipFirst = EFalse ); + + /** + * Sort normal. + * + * @since S60 5.0 + * @param aSkipFirst do not order the first item + */ + void DoSortNormalL( TBool aSkipFirst = EFalse ); + + /** + * Compact the task list given partial results may have been fetched. + * + * @since S60 5.0 + * @param aMedia media containing the fetched sections + */ + void DoCompactTaskListL( const CMPXMedia& aMedia ); + + /** + * Send a command to the collection to update selection index. + * + * @since S60 5.0 + */ + void DoSelectIndexL(); + +private: + + /** + * Constructor. + * + * @since S60 5.0 + * @param aObs observer + * @param aMode mode of the utility + */ + CMPXCollectionOpenUtility( MMPXCollectionObserver* aObs, TUid aMode ); + + /** + * 2nd phase constructor. + * + * @since S60 5.0 + */ + void ConstructL(); + +private: + + /** + * Enum fo rthe different states of this object + */ + enum TFetchingStep + { + EFetchPath, + EFetchCount, + EFetchItems, + EFetchCommand, + EFetchNone + }; + +private: // data + CPeriodic* iTimer; + MMPXCollectionUtility* iCollection; + + TDirection iFetchDirection; + TMPXOpenDataBlock iFetchInfo; + TMPXAttribute iKeyAttribute; + TInt iFetchDelay; + + TFetchingStep iFetchStep; + MMPXCollectionObserver* iObs; + RArray iIncrementalChunks; + + CMPXMedia* iMedia; // handle to the current data retrieved from handleopen + CMPXMediaArray* iData; // not owned, media array inside of iMedia + CMPXCollectionPath* iPath; // Current working path + + TUid iMode; + TBool iFirstOpen; + TBool iSelecting; + }; + +#endif // C_CMPXCOLLECTIONOPENUTILITY_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_utility_api/inc/mpxcollectionplaylist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_utility_api/inc/mpxcollectionplaylist.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,548 @@ +/* +* Copyright (c) 2006 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: Encapsulates a 'playlist' from a collection +* +*/ + + + +#ifndef CMPXCOLLECTIONPLAYLIST_H +#define CMPXCOLLECTIONPLAYLIST_H + +#include +#include +#include + +class CMPXCollectionPath; +class MMPXCollectionUtility; +class RReadStream; +class MMPXCollectionPlaylistObserver; +class CMPXCollectionOpenUtility; +/** + * Encapsulates a playlist + * + * @lib mpxcollectionutility.lib + */ +class CMPXCollectionPlaylist : public CBase, public MMPXCollectionObserver + { +public: // Data type + enum TRepeatMode + { + ERepeatOff, // No repeat + ERepeatOne, // Play one track over and over again + ERepeatAll // Repeat the whole play list + }; +public: + + /** + * Two-phase constructor. + * + * @since S60 3.2.3 + */ + IMPORT_C static CMPXCollectionPlaylist* NewL(); + + /** + * Two-phase constructor. + * + * @since S60 3.2.3 + * @param aPlaylist reference to an existing playlist + * @param aPlObs playlist observer + * @return object created + */ + IMPORT_C static CMPXCollectionPlaylist* NewL( + const CMPXCollectionPlaylist& aPlaylist, + MMPXCollectionPlaylistObserver* aPlObs = NULL); + + /** + * Two-phase constructor. + * + * @since S60 3.2.3 + * @param aPath reference to a collection path + * @param aPlObs playlist observer + * @return object created + */ + IMPORT_C static CMPXCollectionPlaylist* NewL( + const CMPXCollectionPath& aPath, + MMPXCollectionPlaylistObserver* aPlObs = NULL); + + /** + * Two-phase constructor. + * + * @since S60 3.2.3 + * @param aStream reference to a collection path + * @param aPlObs playlist observer + * @return object created + */ + IMPORT_C static CMPXCollectionPlaylist* NewL( + RReadStream& aStream, + MMPXCollectionPlaylistObserver* aPlObs = NULL); + + /** + * Destructor. + * + * @since S60 3.2.3 + */ + IMPORT_C virtual ~CMPXCollectionPlaylist(); + +public: //Iterate through the playlist + + /** + * Copy content from other playlist. + * + * @since S60 3.2.3 + * @param aPlaylist reference to an existing playlist + */ + IMPORT_C void CopyContentL(const CMPXCollectionPlaylist& aPlaylist); + + /** + * Next item. + * + * @since S60 3.2.3 + * @param aIgnoreRepeat ETrue to ignore repeat setting + * @return ETrue if exists + */ + IMPORT_C TBool Next( TBool aIgnoreRepeat=EFalse ); + + /** + * Gets the next index to play. This method should not change + * any of the internal index values (const method). + * + * @since S60 3.2.3 + * @param aIgnoreRepeat ETrue to ignore repeat setting + * @param aPlaylistIndex Out Parameter - The next index. KErrNotFound if no valid index. + * - This is the index in the playlist order. + * @return ETrue if exists + */ + IMPORT_C TBool NextIndex( + TBool aIgnoreRepeat, + TInt& aPlaylistIndex ) const; + + /** + * Gets the path index of the item given it's position in the playlist. + * + * @since S60 3.2.3 + * @param aPlaylistIndex Index of item in the playlist + * @return The index of the item in the path + */ + IMPORT_C TInt PathIndex( TInt aPlaylistIndex ) const; + + /** + * Previous item. + * + * @since S60 3.2.3 + * @param aIgnoreRepeat ETrue to ignore repeat setting + * @return ETrue if exists + */ + IMPORT_C TBool Previous( TBool aIgnoreRepeat=EFalse ); + + /** + * Go to the first item. + * + * @since S60 3.2.3 + */ + IMPORT_C void SetToFirst(); + + /** + * Go to the last item. + * + * @since S60 3.2.3 + */ + IMPORT_C void SetToLast(); + + /** + * Go to a particular item. + * + * @since S60 3.2.3 + * @param aIndex index to goto + * The index can be -1 for no selection and must be + * Smaller than the number of items in the playlist + */ + IMPORT_C void CMPXCollectionPlaylist::SetToIndex( TInt aIndex ); + +public: // State information + /** + * Number of items. + * + * @since S60 3.2.3 + * @return the number of items + */ + IMPORT_C TInt Count() const; + + /** + * Depth of the playlist. + * + * @since S60 3.2.3 + * @return the depth + */ + IMPORT_C TInt Levels() const; + + /** + * Index to current item in the playlist. + * + * @since S60 3.2.3 + * @return the index + */ + IMPORT_C TInt Index() const; + + /** + * Remote playlist. + * + * @since S60 3.2.3 + * @return ETrue remote, EFalse local + */ + IMPORT_C TBool Remote() const; + + /** + * Repeat mode. + * + * @since S60 3.2.3 + * @return the repeat mode + */ + IMPORT_C TRepeatMode RepeatMode() const; + + /** + * Shuffle mode. + * + * @since S60 3.2.3 + * @return ETrue shuffle on, EFalse shuffle off + */ + IMPORT_C TBool Shuffle() const; + + /** + * Get collection path. + * + * @since S60 3.2.3 + * @return collection path + */ + IMPORT_C const CMPXCollectionPath& Path() const; + + /** + * Get extended media of current item. + * + * @since S60 3.2.3 + * @param aAttrs attributes requested + * @param aMediaObs properties observer + */ + IMPORT_C void MediaL(const TArray& aAttrs, + MMPXCollectionMediaObserver& aMediaObs); + + /** + * Set repeat mode. + * + * @since S60 3.2.3 + * @param aMode the repeat mode + */ + IMPORT_C void SetRepeatMode(TRepeatMode aMode); + + /** + * Set repeat enabled. + * + * @since S60 3.2.3 + * @param aEnable To enable repeat mode or not + */ + IMPORT_C void SetRepeatEnabled( TBool aEnable ); + + /** + * Turn shuffle mode on/off. + * + * @since S60 3.2.3 + * @param aShuffle new shuffle mode + * @param aCurrentToTop move current item to the top + */ + IMPORT_C void SetShuffleL(TBool aShuffle, TBool aCurrentToTop); + + /** + * Set shuffle enabled. + * + * @since S60 3.2.3 + * @param aEnable To enable shuffle mode or not + */ + IMPORT_C void SetShuffleEnabledL( TBool aEnable ); + + /** + * Externalize an object of this class to stream. + * + * @since S60 3.2.3 + * @param aStream write stream + */ + IMPORT_C void ExternalizeL(RWriteStream& aStream) const; + + /** + * Internalize an object of this class from stream. + * + * @since S60 3.2.3 + * @param aStream read stream + */ + IMPORT_C void InternalizeL(RReadStream& aStream); + + /** + * Set a new observer for current request. + * Used when handling pre-initializing. + * + * @since S60 3.2.3 + * @param aMediaObs properties observer + * @param aPlObs playlist observer + * @param aCollectionObs collection observer + */ + IMPORT_C void SetObserver(MMPXCollectionMediaObserver& aMediaObs, + MMPXCollectionPlaylistObserver* aPlObs = NULL, + MMPXCollectionObserver* aCollectionObs = NULL); + + /** + * Is this playlist launched from embedded mode. + * + * @since S60 3.2.3 + * @return ETrue if embedded mode + */ + IMPORT_C TBool EmbeddedPlaylist() const; + + /** + * Set or clear the embedded playlist flag. + * + * @since S60 3.2.3 + * @param aEmbedded is this playlist embedded? + */ + IMPORT_C void SetEmbeddedPlaylist( TBool aEmbedded ); + + /** + * Sets/updates the media for the item provided. + * + * @since S60 3.2.3 + * @param aMedia new value + * Callback via EMediaChanged message if currently opened + */ + IMPORT_C void SetL( const CMPXMedia& aMedia ); + + /** + * Stops any async operations that are currently under way. + * + * @since S60 3.2.3 + */ + IMPORT_C void CancelRequest(); + + /** + * Invalidate the playlist. + * + */ + IMPORT_C void Invalidate(); + + /** + * AutoPlay + * + * @since S60 TB9.2 + * @return the auto play value + */ + IMPORT_C TBool AutoPlay() const; + + /** + * Set auto play. + * + * @since S60 TB9.2 + * @param aAutoPlay new value + */ + IMPORT_C void SetAutoPlay(TBool aAutoPlay); + + + /** + * Single item playlist. + * + * @since S60 TB9.2 + * @return ETrue for single item, EFalse if not + */ + IMPORT_C TBool IsSingleItemPlaylist(); + + + /** + * Set single item playlist. + * + * @since S60 TB9.2 + */ + IMPORT_C void SetSingleItemPlaylist(); + + /** + * Pre-initialize next plugin. + * + * @since S60 TB9.2 + * @return ETrue for pre-init, EFalse if not + */ + IMPORT_C TBool PreInitPlugin() const; + + /** + * Set pre-initialize next plugin. + * + * @since S60 TB9.2 + * @param aPreInit new value + */ + IMPORT_C void SetPreInitPlugin(TBool aPreInitPlugin); + +private: // From base class + /** + * Handle media. + * From MMPXCollectionObserver / MMPXCollectionMediaObserver. + * + * @since S60 3.2.3 + * @param aMedia media properties + * @param aError error code + */ + void HandleCollectionMediaL(const CMPXMedia& aMedia, TInt aError); + + /** + * Handle collection message. + * From MMPXCollectionObserver + * + * @since S60 3.2.3 + * @param aMessage collection message + * @param aErr system error code. + */ + void HandleCollectionMessage(CMPXMessage* aMessage, TInt aErr); + + /** + * Handles the collection entries being opened. Typically called + * when client has Open()'d a folder. + * From MMPXCollectionObserver + * + * @since S60 3.2.3 + * @param aEntries collection entries opened + * @param aIndex focused entry + * @param aComplete ETrue no more entries. EFalse more entries + * expected + * @param aError error code + */ + void HandleOpenL(const CMPXMedia& aEntries, + TInt aIndex,TBool aComplete,TInt aError); + + /** + * Handles the item being opened. + * Typically called when client has Open()'d an item. Client typically + * responds by 'playing' the item via the playlist + * From MMPXCollectionObserver + * + * @since S60 3.2.3 + * @param aPlaylist collection playlist + * @param aError error code + */ + void HandleOpenL(const CMPXCollectionPlaylist& aPlaylist,TInt aError); + +private: + + /** + * Restore ordinal after changes. + * + * @since S60 3.2.3 + * @param aEntries collection entries opened + * @param aIndex index of current item + * @leave IfNull + */ + void RestoreOrdinalL(const CMPXMedia& aEntries, TInt aIndex); + + /** + * Handle collection message. + * + * @since S60 3.2.3 + * @param aMessage collection message + * @param aErr system error code. + * @leave IfNull + */ + void DoHandleCollectionMessageL(CMPXMessage* aMessage, TInt aErr); + + /** + * Handle a CMPXCollection message with a change event. + * + * @since S60 3.2.3 + * @param aMessage single collection message to handle + * @return ETrue if a re-open is needed, EFalse otherwise + */ + TBool DoHandleCollectionChangeMessageL(CMPXMessage& aMessage); + + /** + * Handle starting of fetch for incremental algorithm. + * + * @since S60 3.2.3 + */ + void DoIncrementalOpenL(); + + /** + * Do Restore Ordinal for incremental opens. + * + * @since S60 3.2.3 + * @param aMedia media returned from collection + * @param aComplete OpenL Completed or not + */ + void DoHandleIncompleteOpenL( const CMPXMedia& aMedia, TBool aComplete); + +private: + + /** + * C++ default constructor. + * content not constructed yet, it may be internalized from buffer + * + * @since S60 3.2.3 + * @param aPlObs playlist observer + */ + CMPXCollectionPlaylist(MMPXCollectionPlaylistObserver* aPlObs); + + /** + * 2nd phase constructor. + * + * @since S60 3.2.3 + * @param aPath collection path + */ + void ConstructL(const CMPXCollectionPath& aPath); + + /** + * 2nd phase constructor. + * + * @since S60 3.2.3 + * @param aPlaylist playlist + */ + void ConstructL(const CMPXCollectionPlaylist& aPlaylist); + + /** + * 2nd phase contructor. + * + * @since S60 3.2.3 + * @param aStream stream + */ + void ConstructL(RReadStream& aStream); + + /** + * 2nd phase contructor. + * + * @since S60 3.2.3 + */ + void ConstructL(); + +private: + TRepeatMode iRepeatMode; + TBool iShuffle; + TBool iRemote; + CMPXCollectionPath* iPath; + RArray iItemIndexes; // Indexes which define playlist items + TInt iItemIndex; // current index to iItemIndexes array + MMPXCollectionUtility* iColUtil; + MMPXCollectionMediaObserver* iMediaObs; + MMPXCollectionObserver* iCollectionObs; + TBool iEmbedded; + MMPXCollectionPlaylistObserver* iPlObs; + TBool iRepeatEnabled; + TBool iShuffleEnabled; + CMPXCollectionOpenUtility* iIncOpenUtil; + TBool iReopenForChange; + TBool iAutoPlaylist; + TBool iAutoPlay; // Automatically play next item in playlist if in playing state. Default to TRUE for Music Player. + TBool iSingleItemPlaylist; + TBool iPreInitPlugin; + }; + +#endif // CMPXCOLLECTIONPLAYLIST_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_utility_api/inc/mpxcollectionplaylistobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_utility_api/inc/mpxcollectionplaylistobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2006 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: Collection playlist observer +* +*/ + + +#ifndef MMPXCOLLECTIONPLAYLISTOBSERVER_H +#define MMPXCOLLECTIONPLAYLISTOBSERVER_H + + +/** + * Interface for colleciton playlist changes + * + * @lib mpxcollectionutility.lib + */ +NONSHARABLE_CLASS(MMPXCollectionPlaylistObserver) + { +public: + /** + * Handle collection playlist change. + * + * @since S60 3.2.3 + * @param aError KErrNotFound - Playlist is updated, current item removed + * KErrNone - Playlist is updated, current item is valid + * KErrEof - Playlist is updated, current item removed and + * reached to the end of playlist + */ + virtual void HandleCollectionPlaylistChange(TInt aError) = 0; + + }; + +#endif // MMPXCOLLECTIONPLAYLISTOBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_utility_api/inc/mpxcollectionutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_utility_api/inc/mpxcollectionutility.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,467 @@ +/* +* Copyright (c) 2006 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 to collections +* +*/ + + +#ifndef MMPXCOLLECTIONUTILITY_H +#define MMPXCOLLECTIONUTILITY_H + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +class CMPXCollectionPath; +class CMPXCollectionType; +class MMPXCollection; +class MMPXCollectionFindObserver; +class CMPXSubscription; + +/******************************************************************************** +* +* Note: +* +* ** remove void CommandL(TMPXCollectionCommand aCmd, TInt aData = 0) +* +* ** remove TUid CollectionIDL(TUid& aCollection) +* +* ** all methods which do not (necessarily) operate on current collection +* should be moved from MMPXCollection to MMPXCollectionUtility +* +* +*********************************************************************************/ + +/** + * Main client interface for collections. Some terms used in the documentation of + * this interface: + * + * Context - represents the 'state' of the collection, i.e. the current + * browse path (encapsulated in CMPXCollectionPath) and filter applied + * (encapsulated in CMPXFilter) + * + * Playlist - an abstract list of songs. A collection path allows the client + * to cross reference the playlist with a collection, for example to + * iterate through the playlist, extract user-supplied metadata etc. + * + * @lib mpxcollectionutility.lib + */ +class MMPXCollectionUtility + { +public: + /** + * Creates the interface for the client. This interface is bound to (i.e. + * controls and receives events from) either an existing context or a new + * one, according to: + * + * aModeId=KMcModeDefault - bound to the same context as any other client + * running in the same thread, or KMcModeIsolated + * context created if the first client in the thread + * aModeId=KMcModeIsolated - new context created specifically for client, + * may be shared later + * aModeId= - bound to the same context as other clients which have + * supplied the same UID. Most common case is application UID + * so that clients in external processes can easily bind to + * a specific application context + * + * @since S60 3.2.3 + * @param aObs collection observer + * @param aModeId collection mode id + * @return collection utility object + */ + IMPORT_C static MMPXCollectionUtility* NewL( + MMPXCollectionObserver* aObs = NULL, + const TUid& aModeId = KMcModeDefault); + + /** + * The collection. + * + * @since S60 3.2.3 + * @return the collection + */ + virtual MMPXCollection& Collection() = 0; + + /** + * Retrieves the ID of the collection plugin which matched aUids best. + * If multiple plugins match the aUids, the only one with high priority will + * be returned. + * + * @since S60 3.2.3 + * @param aUids selection criteria + * @return TUid containing the implementation UID of the collection that + * would be selected + */ + virtual TUid CollectionIDL(const TArray& aUids) = 0; + + /** + * Frees up client side resources only. A collection is freed when there are no + * clients using it, and all resources are freed when the last client closes. + * + * @since S60 3.2.3 + */ + virtual void Close() = 0; + }; + +/** + * MPXCollection + * + * @lib mpxcollectionutility.lib + */ +class MMPXCollection + { +public: + /** + * Opens the collection in its current state. + * + * Calls back MMPXCollectionObserver::HandleOpenL() with CMPXMedia object + * with ID KMPXMediaIdContainer, i.e.contains other media objects. + * + * @since S60 3.2.3 + * @param aMode open mode + */ + virtual void OpenL(TMPXOpenMode aMode=EMPXOpenDefault) = 0; + + /** + * Opens the collection at a specific index. + * + * Calls back MMPXCollectionObserver::HandleOpenL() with CMPXMedia object + * with ID KMPXMediaIdContainer, i.e.contains other media objects. + * + * @since S60 3.2.3 + * @param aIndex the index into the currently opened item list + * @param aMode type of open mode + */ + virtual void OpenL(TInt aIndex,TMPXOpenMode aMode=EMPXOpenDefault) = 0; + + /** + * Opens the collection at a specific level. + * + * @since S60 3.2.3 + * @param aPath the path of the collection + * @param aMode type of open mode required + * + * Calls back MMPXCollectionObserver::HandleOpenL() + */ + virtual void OpenL(const CMPXCollectionPath& aPath, + TMPXOpenMode aMode=EMPXOpenDefault) = 0; + + /** + * Opens the collection at a specific index. + * + * Calls back MMPXCollectionObserver::HandleOpenL() with CMPXMedia object + * with ID KMPXMediaIdContainer, i.e.contains other media objects which will + * contain the attribute values specified by aAttrs. + * + * @since S60 3.2.3 + * @param aIndex the index into the currently opened item list + * @param aAttrs attributes requested + * @param aMode type of open mode + */ + virtual void OpenL(TInt aIndex, + const TArray& aAttrs, + TMPXOpenMode aMode=EMPXOpenDefault) = 0; + + /** + * Opens the collection at a specific level. + * + * Calls back MMPXCollectionObserver::HandleOpenL() with CMPXMedia object + * with ID KMPXMediaIdContainer, i.e.contains other media objects which will + * contain the attribute values specified by aAttrs. + * + * @since S60 3.2.3 + * @param aPath the path of the collection + * @param aAttrs attributes requested + * @param aMode type of open mode required + */ + virtual void OpenL(const CMPXCollectionPath& aPath, + const TArray& aAttrs, + TMPXOpenMode aMode=EMPXOpenDefault) = 0; + + /** + * Opens the collection with a list of implementation uids to be matched. + * If current context matches the criteria, it will return existing browsing + * media; otherwise it will be back to root level and only plug-ins which + * match all provided uids will be returned, in priority order. + * + * Calls back MMPXCollectionObserver::HandleOpenL() with CMPXMedia object + * with ID KMPXMediaIdContainer. Returned plugins will be sorted by plugin + * priority if mulitple plugins support aUids. + * + * @since S60 3.2.3 + * @param aUids array of UIDs used to select collection plugins based on + * supported uids in plugin resource file. + * @param aMode open mode + */ + virtual void OpenL(const TArray& aUids, + TMPXOpenMode aMode=EMPXOpenDefault) = 0; + + /** + * Opens the collection with an uid to be matched. + * If current context matches the criteria, it will return existing browsing + * media; otherwise it will be back to root level and only plug-ins which + * match the uid will be returned, in priority order. + * + * Calls back MMPXCollectionObserver::HandleOpenL() with CMPXMedia object + * with ID KMPXMediaIdContainer. Returned plugins will be sorted by plugin + * priority if mulitple plugins support the uid. + * + * @since S60 3.2.3 + * @param aUid single UID used to select a collection + * @param aMode open mode + */ + virtual void OpenL(const TUid& aUid, + TMPXOpenMode aMode=EMPXOpenDefault) = 0; + + /** + * Apply a filter to collection browsing. All subsequent calls + * to OpenL() will have this filter applied. + * + * @since S60 3.2.3 + * @param aFilter the filter to apply, or NULL to remove current + * filter + */ + virtual void SetFilterL(CMPXFilter* aFilter) = 0; + + /** + * Current filter that is applied to collection browsing. i.e. results + * returned through MMPXCollectionObserver::HandleOpenL() callback from + * OpenL(). + * + * @since S60 3.2.3 + * @return filter applied to browsing, or NULL if no filter applied + */ + virtual CMPXFilter* FilterL() = 0; + + /** + * Returns current collection plugin implementation UID. + * + * @since S60 3.2.3 + * @return UID of the collection, or KNullUid if no collection opened + */ + virtual TUid UidL() const=0; + + /** + * The path of the collection in its current state. + * Ownsership transferred. + * + * @since S60 3.2.3 + * @return the path of the collection + */ + virtual CMPXCollectionPath* PathL() = 0; + + /** + * Navigates back to the container of the current items. + * Calls back MMPXCollectionObserver::HandleOpenL(). + * + * @since S60 3.2.3 + */ + virtual void BackL() = 0; + + /** + * Is this path on a 'remote' collection. + * + * @since S60 3.2.3 + * @aParam aPath the collection path + * @return ETrue if is remote collection, otherwise EFalse + */ + virtual TBool IsRemote(const CMPXCollectionPath& aPath) = 0; + + /** + * Stops any async operations that are currently under way. + * + * @since S60 3.2.3 + */ + virtual void CancelRequest() = 0; + + /** + * Adds item(s) to the collection. + * + * @since S60 3.2.3 + * @param aNewMedia new item(s) to add + */ + virtual void AddL(const CMPXMedia& aNewMedia) = 0; + + /** + * Remove an item (or items under a group) from the collection + * + * @param aPath, item(s) to remove + * @param aObs, observer to this operation, Optional callback. + * @deprecated please use CommandL (CMPXCommand) + */ + virtual void RemoveL(const CMPXCollectionPath& aPath, + MMPXCollectionRemoveObserver* aObs = NULL ) = 0; + + /** + * Removes item(s) from the collection. + * + * @since S60 3.2.3 + * @param aMedia item(s) to remove + */ + virtual void RemoveL(const CMPXMedia& aMedia) = 0; + + /** + * Sets/updates the media for the item. + * Callback via EMediaChanged message if currently opened. + * + * @since S60 3.2.3 + * @param aMedia updated item + * + */ + virtual void SetSyncL(const CMPXMedia& aMedia) = 0; + + /** + * + * Sets/updates the item specified in the path, Aynchronous + * Callback for completion with HandleCollectionMessageL() + * event: TMPXCollectionMessage::EAsyncOpComplete + * type: EMcsSetMediaAsync + * data: error code + * + * @param aMedia, updated item + * @deprecated, please use CommandL(CMPXCommand& aCmd) + */ + virtual void SetL(const CMPXMedia& aMedia) = 0; + + /** + * Find a list of media properties based on a search criteria. + * The types of supported "queries" are collection dependent. + * Callback via MMPXCollectionFindObserver::HandleFindL(); + * + * @since S60 3.2.3 + * @param aCriteria criteria to search on + * @param aAttrs attributes to return + * @param aObs observer for find callback + * + */ + virtual void FindAllL(const CMPXSearchCriteria& aCriteria, + const TArray& aAttrs, + MMPXCollectionFindObserver& aObs) = 0; + + /** + * Find a list of media properties based on a search criteria. + * The types of supported "queries" are collection dependent. + * This is a SYNCHRONOUS METHOD, use only if necessary. + * + * @since S60 3.2.3 + * @param aCriteria criteria to search on + * @param aAttrs attributes to return + * @return search results maching the given criteria + */ + virtual CMPXMedia* FindAllL(const CMPXSearchCriteria& aCriteria, + const TArray& aAttrs) = 0; + + /** + * Retrieve media for the item specified in the path. + * Note: if selection is set in aPath, HandleMedia will return an array of + * media of current selected items. + * if no selection is set in aPath, HandleMedia will return media + * properities of current item. + * Calls back MMPXCollectionObserver::HandleMediaL() + * + * @since S60 3.2.3 + * @param aPath the path of the collection + * @param aAttrs attributes requested. + * @param aSpecs specifications for attributes, Ownership not transferred + * @param aFilter filter to apply, Ownership not transferred + * + */ + virtual void MediaL(const CMPXCollectionPath& aPath, + const TArray& aAttrs, + CMPXAttributeSpecs* aSpecs=NULL, + CMPXFilter* aFilter=NULL) = 0; + + /** + * Broadcasts an event to all clients or plugins. + * + * @since S60 3.2.3 + * @param aMsg event to broadcast + * @param aData data to accompany the event + */ + virtual void NotifyL(TMPXCollectionBroadCastMsg aMsg, TInt aData) = 0; + + /** + * Send a command to the collection server + * + * @param aCmd, command to handle + * @param aData, some data about event (event specific, optional) + * @deprecated use CommandL(CMPXCommand& aCmd) + */ + virtual void CommandL(TMPXCollectionCommand aCmd, TInt aData = 0) = 0; + + /** + * Send a command to the collection server. + * + * @since S60 3.2.3 + * @param aCmd command to handle + */ + virtual void CommandL(CMPXCommand& aCmd) = 0; + + /** + * Retrieves the list of supported types. + * + * @since S60 3.2.3 + * @param aArray On return, array will be filled with collection type items + */ + virtual void GetSupportedTypesL(RPointerArray& aArray) = 0; + + /** + * Fetches the capabilities supported by the current collection context. + * + * @since S60 3.2.3 + * @param aCapability bitmask of the capabilities supported. + */ + virtual void GetSupportedCapabilitiesL(TCollectionCapability& aCapability) = 0; + + /** + * + * Retrieves the real collection UID based on a predefined UID + * @param aCollection, UID for lookup, defined in "mpxcollectionframeworkdefs.h" + * @return TUid containing the real implementation UID + * @deprecated use MMPXCollectionUtility::CollectionIDL + */ + virtual TUid CollectionIDL(TUid& aCollection) = 0; + + /** + * Adds a message subscription for this client. + * + * @since S60 3.2.3 + * @param aSubscription subscription to be added + */ + virtual void AddSubscriptionL(const CMPXSubscription& aSubscription) = 0; + + /** + * Removes a message subscription for this client. + * + * @since S60 3.2.3 + * @param aSubscription subscription to be removed. + */ + virtual void RemoveSubscriptionL(const CMPXSubscription& aSubscription) = 0; + + /** + * Removes all message subscriptions for this client. + * + * @since S60 3.2.3 + */ + virtual void ClearSubscriptionsL() = 0; + }; + +#endif // MMPXCOLLECTIONUTILITY_H + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_utility_api/mpx_collection_utility_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_utility_api/mpx_collection_utility_api.metaxml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,15 @@ + + +mpx Collection Utility API +Provides the interface to music collections +c++ +mpx + + + + + +no +no + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_utility_api/tsrc/collectionplaylisttest/Bwins/mpxcollectionplaylisttestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_utility_api/tsrc/collectionplaylisttest/Bwins/mpxcollectionplaylisttestu.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_utility_api/tsrc/collectionplaylisttest/EABI/mpxcollectionplaylisttestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_utility_api/tsrc/collectionplaylisttest/EABI/mpxcollectionplaylisttestu.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_utility_api/tsrc/collectionplaylisttest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_utility_api/tsrc/collectionplaylisttest/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2007 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 for project mpxcollectionplaylisttest +* +*/ + + +PRJ_PLATFORMS +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these +DEFAULT + +PRJ_TESTEXPORTS +// NOTE: If using ARS requirements all export operations should be done under this. +// 'abld test export' + +PRJ_EXPORTS + +PRJ_TESTMMPFILES +// NOTE: If using ARS requirements .mmp file operation should be done under this. +// 'abld test build' + +mpxcollectionplaylisttest.mmp + +PRJ_MMPFILES +// Specify the .mmp files required for building the important component +// releasables. +// +// Specify "tidy" if the component you need to build doesn't need to be +// released. Specify "ignore" if the MMP file exists but should be +// ignored. +// Example: +/* +/agnmodel/group/agnmodel.mmp +#if defined(MARM) +/agnmodel/group/agsvexe.mmp +#endif +*/ + + +// End of File \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_utility_api/tsrc/collectionplaylisttest/group/mpxcollectionplaylisttest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_utility_api/tsrc/collectionplaylisttest/group/mpxcollectionplaylisttest.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,49 @@ +/* +* 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: Project definition file for project mpxcollectionplaylisttest +* +*/ + + +#include + +TARGET mpxcollectionplaylisttest.dll +TARGETTYPE dll +UID 0x1000008D 0x10207BDB + +CAPABILITY ALL -TCB +VENDORID VID_DEFAULT + +DEFFILE mpxcollectionplaylisttest.def + +SOURCEPATH ../src +SOURCE mpxcollectionplaylisttest.cpp +SOURCE mpxcollectionplaylisttestBlocks.cpp + +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY estor.lib // RWriteStream +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY mpxcommon.lib +LIBRARY mpxcollectionutility.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib + +LANG SC + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_utility_api/tsrc/collectionplaylisttest/group/mpxcollectionplaylisttest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_utility_api/tsrc/collectionplaylisttest/group/mpxcollectionplaylisttest.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,35 @@ +; +; 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: Package file for project StifTFW +; +;mpxcollectionplaylisttest.pkg + +;languages +&EN + +;Header +#{"StifTFW"},(0x101FB3E3),1,1,0,TYPE=SA + +;Localised Vendor name +%{"MPXCollectionPlaylistStif"} + +;Unique Vendor name +:"Vendor" + +;Files to install + +"..\..\conf\mpxcollectionplaylisttest.cfg" - "c:\testframework\mpxcollectionplaylisttest.cfg" +"..\..\init\TestFramework.ini" - "c:\testframework\TestFramework.ini" +"\epoc32\release\armv5\urel\mpxcollectionplaylisttest.dll" - "c:\Sys\Bin\mpxcollectionplaylisttest.dll" + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_utility_api/tsrc/collectionplaylisttest/inc/mpxcollectionplaylisttest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_utility_api/tsrc/collectionplaylisttest/inc/mpxcollectionplaylisttest.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,213 @@ +/* +* Copyright (c) 2007 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: STIF testing for MPX Collection Playlist +* +*/ + + +#ifndef MPXCOLLECTIONPLAYLISTTEST_H +#define MPXCOLLECTIONPLAYLISTTEST_H + +// INCLUDES +#include +#include +#include + +#include +#include +#include +#include + +// CONSTANTS +const TInt KErrBadTestParameter= -1000; // Error on configuration file + +// MACROS +// Logging path +#ifdef __WINSCW__ +_LIT( KMPXCollectionPlaylistTestLogPath, "\\testing\\log\\" ); +#else +_LIT( KMPXCollectionPlaylistTestLogPath, "e:\\testing\\log\\" ); +#endif +// Log file +_LIT( KMPXCollectionPlaylistTestLogFile, "mpxcollectionplaylisttest.txt" ); + +// FORWARD DECLARATIONS +class CMPXCollectionPlaylistTest; +class MMPXCollectionUtility; +class CMPXCollectionPath; +class CMPXCollectionOpenUtility;// + +// CLASS DECLARATION + +/** +* CMPXCollectionPlaylistTest test class for STIF Test Framework TestScripter. +* +* @lib mpxcollectionplaylisttest.lib +* @since s60 5.0 +*/ +NONSHARABLE_CLASS(CMPXCollectionPlaylistTest) : public CScriptBase, + public MMPXCollectionObserver, + public MMPXCollectionPlaylistObserver + { +private: + enum TExpectedEvents + { + EEventHandlePlaylistExportCompletedL, + EEventHandlePlaylistImportCompletedL, + EEventHandleFileAddCompletedL, + EEventHandleDeleteCompletedL, + EEventHandleFileImportCompletedL + }; + +public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CMPXCollectionPlaylistTest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CMPXCollectionPlaylistTest(); + +public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since s60 5.0 + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ); + + /** + * From MMPXCollectionObserver. + * @since s60 5.0 + */ + virtual void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError ); + virtual void HandleCollectionMessage( CMPXMessage* aMsg, TInt aError ); + virtual void HandleOpenL( const CMPXMedia& aEntries, TInt aIndex, TBool aComplete, TInt aError ); + virtual void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, TInt aError ); + + /** + * From MMPXCollectionPlaylistObserver. + * @since s60 5.0 + */ + virtual void HandleCollectionPlaylistChange( TInt aErr ); + +private: + + /** + * C++ default constructor. + */ + CMPXCollectionPlaylistTest( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Frees all resources allocated from test methods. + * @since s60 5.0 + */ + void Delete(); + + /** + * Add event to the expected event list + * @since S60 5.0 + */ + void AddExpectedEvent( TExpectedEvents aEvent ); + + /** + * Remove event from the expected event list + * @since S60 5.0 + */ + TBool RemoveExpectedEvent( TExpectedEvents aEvent ); + + /** + * Build a MPX Collection Path + * @since S60 5.0 + */ + void BuildCollectionPathL(); + + /** + * Test methods are listed below. + */ + + /** + * Example test method. + * @since s60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt ExampleL( CStifItemParser& aItem ); + //ADD NEW METHOD DEC HERE + + TInt CreateUtilityNewPlaylist( CStifItemParser& aItem ); + TInt CreateUtilityPlaylistExist( CStifItemParser& aItem ); + TInt CreateUtilityCollectionPath( CStifItemParser& aItem ); + TInt CreateUtilityCollectionStream( CStifItemParser& aItem ); + TInt CopyContentL( CStifItemParser& aItem ); + TInt Next( CStifItemParser& aItem ); + TInt Previous( CStifItemParser& aItem ); + TInt SetToFirst( CStifItemParser& aItem ); + TInt SetToLast( CStifItemParser& aItem ); + TInt SetToIndex( CStifItemParser& aItem ); + TInt Count( CStifItemParser& aItem ); + TInt Levels( CStifItemParser& aItem ); + TInt Index( CStifItemParser& aItem ); + TInt Remote( CStifItemParser& aItem ); + TInt RepeatMode( CStifItemParser& aItem ); + TInt Shuffle( CStifItemParser& aItem ); + TInt Path( CStifItemParser& aItem ); + TInt MediaL( CStifItemParser& aItem ); + TInt SetRepeatMode( CStifItemParser& aItem ); + TInt SetRepeatEnabled( CStifItemParser& aItem ); + TInt SetShuffleL( CStifItemParser& aItem ); + TInt SetShuffleEnabledL( CStifItemParser& aItem ); + TInt StreamingL( CStifItemParser& aItem ); + TInt SetObserver( CStifItemParser& aItem ); + TInt EmbeddedPlaylist( CStifItemParser& aItem ); + TInt SetEmbeddedPlaylist( CStifItemParser& aItem ); + TInt SetL( CStifItemParser& aItem ); + TInt CancelRequest( CStifItemParser& aItem ); + TInt Invalidate( CStifItemParser& aItem ); + //add function + TInt NextIndex( CStifItemParser& aItem ); + TInt PathIndex( CStifItemParser& aItem ); + TInt CMPXCollectionPlaylistDestructor( CStifItemParser& aItem ); + + TInt CMPXCollectionOpenUtilityCreate(CStifItemParser& aItem); + TInt CMPXCollectionOpenUtilityStartL(CStifItemParser& aItem); + TInt CMPXCollectionOpenUtilityPathL( CStifItemParser& aItem ); + TInt CMPXCollectionOpenUtilityStop( CStifItemParser& aItem ); + TInt CMPXCollectionOpenUtilitySetDelay( CStifItemParser& aItem); + TInt CMPXCollectionOpenUtilityStartUsingPath( CStifItemParser& aItem ); + TInt CMPXCollectionOpenUtilitySetDirection(CStifItemParser& aItem ); + + TInt NewLMMPXCollectionUtility( CStifItemParser& aItem ); + + +private: // Data + CMPXCollectionPlaylist* iCollectionPlaylist; + CMPXCollectionPath* iCollectionPath; + CMPXCollectionOpenUtility* iCollectionOpenUtility ; + TInt iResult; + // List of expected events + RArray iExpectedEvents; + }; + +#endif // MPXcollectionplaylistTEST_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_utility_api/tsrc/collectionplaylisttest/src/mpxcollectionplaylisttest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_utility_api/tsrc/collectionplaylisttest/src/mpxcollectionplaylisttest.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2007 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: STIF testing for MPX Collection Playlist +* +*/ + + +// INCLUDE FILES +#include +#include +#include "mpxcollectionplaylisttest.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::CMPXCollectionPlaylistTest +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CMPXCollectionPlaylistTest::CMPXCollectionPlaylistTest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + iCollectionPlaylist = NULL; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::ConstructL +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CMPXCollectionPlaylistTest::ConstructL() + { + iLog = CStifLogger::NewL( KMPXCollectionPlaylistTestLogPath, + KMPXCollectionPlaylistTestLogFile, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + // Print title of the test case + TName title; + TestModuleIf().GetTestCaseTitleL(title); + iLog->Log(_L(" ")); + iLog->Log(_L("[Title] %S"), &title); + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::NewL +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CMPXCollectionPlaylistTest* CMPXCollectionPlaylistTest::NewL( + CTestModuleIf& aTestModuleIf ) + { + CMPXCollectionPlaylistTest* self = new (ELeave) CMPXCollectionPlaylistTest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// Destructor +CMPXCollectionPlaylistTest::~CMPXCollectionPlaylistTest() + { + // Delete resources allocated from test methods + Delete(); + // Delete logger + delete iLog; + } + +// ======== GLOBAL 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* ) CMPXCollectionPlaylistTest::NewL( aTestModuleIf ); + } diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_utility_api/tsrc/collectionplaylisttest/src/mpxcollectionplaylisttestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_utility_api/tsrc/collectionplaylisttest/src/mpxcollectionplaylisttestBlocks.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,1280 @@ +/* +* Copyright (c) 2007 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: STIF testing for MPX Collection Playlist +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include + +#include +#include +#include +#include "mpxcollectionplaylisttest.h" + +#include "mpxcollectionobserver.h"//new added +#include "mpxcollectionutility.h"//new +#include "mpxcollectionplaylistobserver.h" +#include "mpxcollectionopenutility.h" +#include "mpxmediageneraldefs.h" +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// --------------------------------------------------------------------------- +// +void CMPXCollectionPlaylistTest::Delete() + { + if ( iCollectionPlaylist ) + { + delete iCollectionPlaylist; + } + + if ( iCollectionPath ) + { + iCollectionPath->Reset(); + delete iCollectionPath; + } + iExpectedEvents.Close(); + } + + +// ----------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::AddExpectedEvent +// Add an event to the expected event list +// ----------------------------------------------------------------------------- + +void CMPXCollectionPlaylistTest::AddExpectedEvent( TExpectedEvents aEvent ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::AddExpectedEvent: %d"), aEvent); + iExpectedEvents.Append(aEvent); + } + +// ----------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::RemoveExpectedEvent +// Remove the event from the expected event list +// Returns: ETrue: Event found. +// EFalse: Event not found. +// ----------------------------------------------------------------------------- +TBool CMPXCollectionPlaylistTest::RemoveExpectedEvent( TExpectedEvents aEvent ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::RemoveExpectedEvent: %d"), aEvent); + TBool match = EFalse; + TInt index = iExpectedEvents.Find(aEvent); + if ( index != KErrNotFound ) + { + iExpectedEvents.Remove(index); + match = ETrue; + } + return match; + } + +// ----------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::BuildCollectionPath +// Build MPX Collection Path +// ----------------------------------------------------------------------------- +void CMPXCollectionPlaylistTest::BuildCollectionPathL() + { + iLog->Log(_L("CMPXCollectionPlaylistTest::BuildCollectionPath")); + + const TMPXItemId KMPXPathLevel1 = 33331; + const TMPXItemId KMPXPathLevel2 = 33332; + const TMPXItemId KMPXPathLevel3 = 33333; + const TMPXItemId KMPXPathItem1 = 44441; + const TMPXItemId KMPXPathItem2 = 44442; + const TMPXItemId KMPXPathItem3 = 44443; + const TMPXItemId KMPXPathItem4 = 44444; + const TMPXItemId KMPXPathItem5 = 44445; + RArray itemIdArray; + + // Start from scratch + if ( iCollectionPath ) + { + iCollectionPath->Reset(); + delete iCollectionPath; + } + // build collection path + iCollectionPath = CMPXCollectionPath::NewL(); + iCollectionPath->AppendL(KMPXPathLevel1); + iCollectionPath->AppendL(KMPXPathLevel2); + iCollectionPath->AppendL(KMPXPathLevel3); + itemIdArray.Append(KMPXPathItem1); + itemIdArray.Append(KMPXPathItem2); + itemIdArray.Append(KMPXPathItem3); + itemIdArray.Append(KMPXPathItem4); + itemIdArray.Append(KMPXPathItem5); + iCollectionPath->AppendL(itemIdArray.Array()); + + itemIdArray.Close(); + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::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( "Example", CMPXCollectionPlaylistTest::ExampleL ), + //ADD NEW ENTRY HERE + ENTRY( "CreateUtilityNewPlaylist", CMPXCollectionPlaylistTest::CreateUtilityNewPlaylist ), + ENTRY( "CreateUtilityPlaylistExist", CMPXCollectionPlaylistTest::CreateUtilityPlaylistExist ), + ENTRY( "CreateUtilityCollectionPath", CMPXCollectionPlaylistTest::CreateUtilityCollectionPath ), + ENTRY( "CreateUtilityCollectionStream", CMPXCollectionPlaylistTest::CreateUtilityCollectionStream ), + ENTRY( "CopyContentL", CMPXCollectionPlaylistTest::CopyContentL ), + ENTRY( "Next", CMPXCollectionPlaylistTest::Next ), + ENTRY( "Previous", CMPXCollectionPlaylistTest::Previous ), + ENTRY( "SetToFirst", CMPXCollectionPlaylistTest::SetToFirst ), + ENTRY( "SetToLast", CMPXCollectionPlaylistTest::SetToLast ), + ENTRY( "SetToIndex", CMPXCollectionPlaylistTest::SetToIndex ), + ENTRY( "Count", CMPXCollectionPlaylistTest::Count ), + ENTRY( "Levels", CMPXCollectionPlaylistTest::Levels ), + ENTRY( "Index", CMPXCollectionPlaylistTest::Index ), + ENTRY( "Remote", CMPXCollectionPlaylistTest::Remote ), + ENTRY( "RepeatMode", CMPXCollectionPlaylistTest::RepeatMode ), + ENTRY( "Shuffle", CMPXCollectionPlaylistTest::Shuffle ), + ENTRY( "Path", CMPXCollectionPlaylistTest::Path ), + ENTRY( "MediaL", CMPXCollectionPlaylistTest::MediaL ), + ENTRY( "SetRepeatMode", CMPXCollectionPlaylistTest::SetRepeatMode ), + ENTRY( "SetRepeatEnabled", CMPXCollectionPlaylistTest::SetRepeatEnabled ), + ENTRY( "SetShuffleL", CMPXCollectionPlaylistTest::SetShuffleL ), + ENTRY( "SetShuffleEnabledL", CMPXCollectionPlaylistTest::SetShuffleEnabledL ), + ENTRY( "StreamingL", CMPXCollectionPlaylistTest::StreamingL ), + ENTRY( "SetObserver", CMPXCollectionPlaylistTest::SetObserver ), + ENTRY( "EmbeddedPlaylist", CMPXCollectionPlaylistTest::EmbeddedPlaylist ), + ENTRY( "SetEmbeddedPlaylist", CMPXCollectionPlaylistTest::SetEmbeddedPlaylist ), + ENTRY( "SetL", CMPXCollectionPlaylistTest::SetL ), + ENTRY( "CancelRequest", CMPXCollectionPlaylistTest::CancelRequest ), + ENTRY( "Invalidate", CMPXCollectionPlaylistTest::Invalidate ), + ENTRY("NextIndex", CMPXCollectionPlaylistTest::NextIndex ), + ENTRY("PathIndex",CMPXCollectionPlaylistTest::PathIndex ), + //add function + ENTRY("CMPXCollectionPlaylistDestructor",CMPXCollectionPlaylistTest::CMPXCollectionPlaylistDestructor ),//Pass debug added 7,10,2008 + ENTRY("CMPXCollectionOpenUtilityCreate",CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilityCreate ), //Pass debug added 7,10,2008 + ENTRY( "CMPXCollectionOpenUtilityStartL", CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilityStartL ),//Pass added 7,10,2008 + ENTRY( "CMPXCollectionOpenUtilityStop", CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilityStop ),//Pass debug added 7,10,2008 + ENTRY( "CMPXCollectionOpenUtilityStartUsingPath", CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilityStartUsingPath ),//Pass added 7,10,2008 + ENTRY( "CMPXCollectionOpenUtilitySetDelay", CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilitySetDelay ),//Pass debug added 7,10,2008 + ENTRY( "CMPXCollectionOpenUtilitySetDirection", CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilitySetDirection ),//Pass debug added 7,10,2008 + ENTRY( "NewLMMPXCollectionUtility", CMPXCollectionPlaylistTest::NewLMMPXCollectionUtility ),//Pass added by 7,10,2008 + ENTRY( "CMPXCollectionOpenUtilityPathL", CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilityPathL ),//Pass debug added 7,10,2008 + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::HandleCollectionMediaL +// --------------------------------------------------------------------------- +// +void CMPXCollectionPlaylistTest::HandleCollectionMediaL( const CMPXMedia& /*aMedia*/, TInt aError ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::HandleCollectionMediaL: %d"), aError); + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::HandleCollectionMessage +// --------------------------------------------------------------------------- +// +void CMPXCollectionPlaylistTest::HandleCollectionMessage( CMPXMessage* /*aMsg*/, TInt aError ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::HandleCollectionMessage: %d"), aError); + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::HandleOpenL +// --------------------------------------------------------------------------- +// +void CMPXCollectionPlaylistTest::HandleOpenL( const CMPXMedia& /*aEntries*/, TInt /*aIndex*/, TBool /*aComplete*/, TInt aError ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::HandleOpenL: %d"), aError); + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::HandleOpenL +// --------------------------------------------------------------------------- +// +void CMPXCollectionPlaylistTest::HandleOpenL( const CMPXCollectionPlaylist& /*aPlaylist*/, TInt aError ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::HandleOpenL: %d"), aError); + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::HandleOpenL +// --------------------------------------------------------------------------- +// +void CMPXCollectionPlaylistTest::HandleCollectionPlaylistChange( TInt aError ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::HandleCollectionPlaylistChange: %d"), aError); + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::ExampleL +// Example test method function. +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::ExampleL( CStifItemParser& aItem ) + { + + // Print to UI + _LIT( KMPXCollectionPlaylisttest, "MPXCollectionPlaylistTest" ); + _LIT( KExample, "In Example" ); + TestModuleIf().Printf( 0, KMPXCollectionPlaylisttest, KExample ); + // Print to log file + iLog->Log( KExample ); + + TInt i = 0; + TPtrC string; + _LIT( KParam, "Param[%i]: %S" ); + while ( aItem.GetNextString( string ) == KErrNone ) + { + TestModuleIf().Printf( i, KMPXCollectionPlaylisttest, + KParam, i, &string ); + i++; + } + + return KErrNone; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::CreateUtilityNewPlaylist +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::CreateUtilityNewPlaylist( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::CreateUtilityNewPlaylist")); + TRAPD(err, iCollectionPlaylist = CMPXCollectionPlaylist::NewL()); + iLog->Log(_L("CMPXCollectionPlaylist::NewL returned: %d"), err); + iExpectedEvents.Reset(); + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::CreateUtilityPlaylistExist +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::CreateUtilityPlaylistExist( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::CreateUtilityPlaylistExist")); + TInt err = KErrNone; + CMPXCollectionPlaylist* firstPlaylist = NULL; + + // Create brand new playlist first + TRAP(err, firstPlaylist = CMPXCollectionPlaylist::NewL()); + iLog->Log(_L("CMPXCollectionPlaylist::NewL (firstPlaylist) returned: %d"), err); + + if ((err == KErrNone) && firstPlaylist) + { + // Pass existing playlist to create another instance of playlist + TRAP(err, iCollectionPlaylist = CMPXCollectionPlaylist::NewL( *firstPlaylist )); + iLog->Log(_L("CMPXCollectionPlaylist::NewL returned: %d"), err); + } + + if (firstPlaylist) + { + delete firstPlaylist; + } + + iExpectedEvents.Reset(); + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::CreateUtilityCollectionPath +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::CreateUtilityCollectionPath( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::CreateUtilityCollectionPath")); + TInt err = KErrNone; + + TRAP(err, BuildCollectionPathL()); + if ((err == KErrNone) && iCollectionPath) + { + // Pass existing collection path to create playlist + TRAP(err, iCollectionPlaylist = CMPXCollectionPlaylist::NewL( *iCollectionPath )); + iLog->Log(_L("CMPXCollectionPlaylist::NewL returned: %d"), err); + } + + iExpectedEvents.Reset(); + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::CreateUtilityCollectionStream +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::CreateUtilityCollectionStream( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::CreateUtilityCollectionStream")); + TInt err = KErrNone; + CMPXCollectionPlaylist* firstPlaylist = NULL; + + // Create brand new playlist first + TRAP(err, firstPlaylist = CMPXCollectionPlaylist::NewL()); + iLog->Log(_L("CMPXCollectionPlaylist::NewL (firstPlaylist) returned: %d"), err); + + if ((err == KErrNone) && firstPlaylist) + { + // Pass stream to create another instance of playlist + CBufBase* buffer; + TRAP(err,buffer = CBufFlat::NewL( 200 )); + CleanupStack::PushL( buffer ); + RBufWriteStream writeStream( *buffer ); + CleanupClosePushL( writeStream ); + TRAP( err,firstPlaylist->ExternalizeL( writeStream )); + TRAP( err,writeStream.CommitL()); + buffer->Compress(); + CleanupStack::PopAndDestroy( &writeStream ); + + RBufReadStream readStream( *buffer ); + CleanupClosePushL( readStream ); + TRAP( err,iCollectionPlaylist = CMPXCollectionPlaylist::NewL(readStream)); + iLog->Log(_L("CMPXCollectionPlaylist::NewL returned: %d"), err); + CleanupStack::PopAndDestroy( &readStream ); + CleanupStack::PopAndDestroy( buffer ); +} + if (firstPlaylist) + { + delete firstPlaylist; + } + iExpectedEvents.Reset(); + + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::CopyContentL +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::CopyContentL( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::CopyContentL")); + + TInt err = KErrNone; + CMPXCollectionPlaylist* anotherPlaylist = NULL; + + // Create another playlist to copy content from + TRAP(err, anotherPlaylist = CMPXCollectionPlaylist::NewL()); + iLog->Log(_L("CMPXCollectionPlaylist::NewL (anotherPlaylist) returned: %d"), err); + + if ((err == KErrNone) && anotherPlaylist) + { + anotherPlaylist->CopyContentL (*iCollectionPlaylist); + if ((iCollectionPlaylist->RepeatMode() == anotherPlaylist->RepeatMode()) && + (iCollectionPlaylist->Shuffle() == anotherPlaylist->Shuffle()) && + (iCollectionPlaylist->Remote() == anotherPlaylist->Remote()) && + (iCollectionPlaylist->Count() == anotherPlaylist->Count()) && + (iCollectionPlaylist->Levels() == anotherPlaylist->Levels()) && + (iCollectionPlaylist->Index() == anotherPlaylist->Index()) && + (iCollectionPlaylist->EmbeddedPlaylist() == anotherPlaylist->EmbeddedPlaylist())) + { + err = KErrNone; + iLog->Log(_L("CMPXCollectionPlaylistTest::CopyContentL copy OK")); + } + else + { + err = KErrGeneral; + iLog->Log(_L("CMPXCollectionPlaylistTest::CopyContentL copy FAIL")); + } + } + + if (anotherPlaylist) + { + delete anotherPlaylist; + } + + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::Next +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::Next( CStifItemParser& aItem ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::Next")); + TInt err = KErrNone; + TInt vRepeatIgnored; + TBool vRetNext; + + if ((KErrNone == aItem.GetNextInt(vRepeatIgnored)) && + (vRepeatIgnored >= EFalse) && (vRepeatIgnored <= ETrue)) + { + vRetNext = iCollectionPlaylist->Next (vRepeatIgnored); + iLog->Log(_L("CMPXCollectionPlaylist::Next returned: %d"), vRetNext); + } + else + { + iLog->Log(_L("CMPXCollectionPlaylistTest::Next: Bad parameter on config file")); + err = KErrBadTestParameter; + } + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::Previous +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::Previous( CStifItemParser& aItem ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::Previous")); + TInt err = KErrNone; + TBool vRepeatIgnored; + TBool vRetNext; + + if ((KErrNone == aItem.GetNextInt(vRepeatIgnored)) && + (vRepeatIgnored >= EFalse) && (vRepeatIgnored <= ETrue)) + { + vRetNext = iCollectionPlaylist->Previous (vRepeatIgnored); + iLog->Log(_L("CMPXCollectionPlaylist::Previous returned: %d"), vRetNext); + } + else + { + iLog->Log(_L("CMPXCollectionPlaylistTest::Previous: Bad parameter on config file")); + err = KErrBadTestParameter; + } + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::SetToFirst +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::SetToFirst( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::SetToFirst")); + TInt err = KErrNone; + iCollectionPlaylist->SetToFirst(); + iLog->Log(_L("CMPXCollectionPlaylist::SetToFirst OK")); + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::SetToLast +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::SetToLast( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::SetToLast")); + TInt err = KErrNone; + iCollectionPlaylist->SetToLast(); + iLog->Log(_L("CMPXCollectionPlaylist::SetToLast OK")); + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::SetToIndex +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::SetToIndex( CStifItemParser& aItem ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::SetToIndex")); + TInt err = KErrNone; + TInt vIndex; + if ( KErrNone == aItem.GetNextInt(vIndex) ) + { + TInt vCount = iCollectionPlaylist->Count(); + iLog->Log(_L("CMPXCollectionPlaylist::Count returned: %d"), vCount); + if ((vCount > 0) && (vIndex < vCount)) + { + iCollectionPlaylist->SetToIndex (vIndex); + iLog->Log(_L("CMPXCollectionPlaylist::SetToIndex OK")); + } + else + { + iLog->Log(_L("CMPXCollectionPlaylist::SetToIndex FAIL")); + } + } + else + { + iLog->Log(_L("CMPXCollectionPlaylistTest::SetToIndex: Bad parameter on config file")); + err = KErrBadTestParameter; + } + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::Count +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::Count( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::Count")); + TInt err = KErrNone; + TInt vCount = iCollectionPlaylist->Count(); + iLog->Log(_L("CMPXCollectionPlaylist::Count returned: %d"), vCount); + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::Levels +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::Levels( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::Levels")); + TInt err = KErrNone; + TInt vLevels = iCollectionPlaylist->Levels(); + iLog->Log(_L("CMPXCollectionPlaylist::Levels returned: %d"), vLevels); + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::Index +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::Index( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::Index")); + TInt err = KErrNone; + TInt vIndex = iCollectionPlaylist->Index(); + iLog->Log(_L("CMPXCollectionPlaylist::Index returned: %d"), vIndex); + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::Remote +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::Remote( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::Remote")); + TInt err = KErrNone; + TBool vIsCollectionStoredInRemoteDevice = iCollectionPlaylist->Remote(); + iLog->Log(_L("CMPXCollectionPlaylist::Remote returned: %d"), vIsCollectionStoredInRemoteDevice); + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::RepeatMode +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::RepeatMode( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::RepeatMode")); + TInt err = KErrNone; + TInt vRepeatMode = iCollectionPlaylist->RepeatMode(); + iLog->Log(_L("CMPXCollectionPlaylist::RepeatMode returned: %d"), vRepeatMode); + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::Shuffle +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::Shuffle( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::Shuffle")); + TInt err = KErrNone; + TBool vIsShuffleOn = iCollectionPlaylist->Shuffle(); + iLog->Log(_L("CMPXCollectionPlaylist::Shuffle returned: %d"), vIsShuffleOn); + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::Path +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::Path( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::Path")); + TInt err = KErrNone; +// CMPXCollectionPath& vPath = (CMPXCollectionPath&)iCollectionPlaylist->Path(); + TRAP(err,iCollectionPlaylist->Path()); + if ( err != KErrNone ) + { + iLog->Log(_L("Path returned: %d"), err); + } +// iLog->Log(_L("CMPXCoiCollectionPlaylist->Path()llectionPlaylist::Path returned: %d"), vPath); + + + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::MediaL +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::MediaL( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::MediaL")); + TInt err = KErrNone; +// CDesCArrayFlat* aLinkArray = new (ELeave) CDesCArrayFlat(1); + RArray attrs; + CleanupClosePushL( attrs ); +// attrs.Append( KMPXMediaGeneralTitle ); +// TArray& ary = attrs.Array(); +// TArray& aAttrs=new (ELeave) TArray ; + TRAP(err, iCollectionPlaylist->MediaL(attrs.Array(),*this)); + CleanupStack::PopAndDestroy( &attrs ); + if ( err != KErrNone ) + { + iLog->Log(_L("MediaL returned: %d"), err); + } + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::SetRepeatMode +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::SetRepeatMode( CStifItemParser& aItem ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::SetRepeatMode")); + TInt err = KErrNone; + TInt vRepeatMode; + if ((KErrNone == aItem.GetNextInt(vRepeatMode)) && + (vRepeatMode >= CMPXCollectionPlaylist::ERepeatOff) && (vRepeatMode <= CMPXCollectionPlaylist::ERepeatAll)) + { + iCollectionPlaylist->SetRepeatMode ((CMPXCollectionPlaylist::TRepeatMode) vRepeatMode); + iLog->Log(_L("CMPXCollectionPlaylist::SetRepeatMode OK")); + } + else + { + iLog->Log(_L("CMPXCollectionPlaylistTest::SetRepeatMode: Bad parameter on config file")); + err = KErrBadTestParameter; + } + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::SetRepeatEnabled +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::SetRepeatEnabled( CStifItemParser& aItem ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::SetRepeatEnabled")); + TInt err = KErrNone; + TInt vRepeatEnabled; + if ((KErrNone == aItem.GetNextInt(vRepeatEnabled)) && + (vRepeatEnabled >= EFalse) && (vRepeatEnabled <= ETrue)) + { + iCollectionPlaylist->SetRepeatEnabled (vRepeatEnabled); + iLog->Log(_L("CMPXCollectionPlaylist::SetRepeatEnabled OK")); + } + else + { + iLog->Log(_L("CMPXCollectionPlaylistTest::SetRepeatEnabled: Bad parameter on config file")); + err = KErrBadTestParameter; + } + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::SetShuffleL +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::SetShuffleL( CStifItemParser& aItem ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::SetShuffleL")); + TInt err = KErrNone; + TInt vShuffle; + TInt vCurrentToTop; + if ((KErrNone == aItem.GetNextInt(vShuffle)) && + (vShuffle >= 0) && (vShuffle <=1)) + { + if ((KErrNone == aItem.GetNextInt(vCurrentToTop)) && + (vCurrentToTop >= EFalse) && (vCurrentToTop <= ETrue)) + { + TRAP (err, iCollectionPlaylist->SetShuffleL (vShuffle, vCurrentToTop)); + if (err != KErrNone) + { + iLog->Log(_L("CMPXCollectionPlaylist::SetShuffleL leave with error: %d"), err); + } + else + { + iLog->Log(_L("CMPXCollectionPlaylist::SetShuffleL OK")); + } + } + else + { + iLog->Log(_L("CMPXCollectionPlaylistTest::SetShuffleL: Bad second parameter on config file")); + err = KErrBadTestParameter; + } + } + else + { + iLog->Log(_L("CMPXCollectionPlaylistTest::SetShuffleL: Bad first parameter on config file")); + err = KErrBadTestParameter; + } + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::SetShuffleEnabledL +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::SetShuffleEnabledL( CStifItemParser& aItem ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::SetShuffleEnabledL")); + TInt err = KErrNone; + TInt vShuffleEnabled; + if ((KErrNone == aItem.GetNextInt(vShuffleEnabled)) && + (vShuffleEnabled >= EFalse) && (vShuffleEnabled <= ETrue)) + { + TRAP (err, iCollectionPlaylist->SetShuffleEnabledL (vShuffleEnabled)); + if (err != KErrNone) + { + iLog->Log(_L("CMPXCollectionPlaylist::SetShuffleEnabledL leave with error: %d"), err); + } + else + { + iLog->Log(_L("CMPXCollectionPlaylist::SetShuffleEnabledL OK")); + } + } + else + { + iLog->Log(_L("CMPXCollectionPlaylistTest::SetShuffleEnabledL: Bad parameter on config file")); + err = KErrBadTestParameter; + } + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::StreamingL +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::StreamingL( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::StreamingL")); + TInt err = KErrNone; + + iLog->Log(_L("Start ExternalizeL")); + CBufBase* buffer = CBufFlat::NewL( 200 ); + CleanupStack::PushL( buffer ); + RBufWriteStream writeStream( *buffer ); + CleanupClosePushL( writeStream ); + iCollectionPlaylist->ExternalizeL( writeStream ); + writeStream.CommitL(); + buffer->Compress(); + CleanupStack::PopAndDestroy( &writeStream ); + + iLog->Log(_L("Start InternalizeL")); + RBufReadStream readStream( *buffer ); + CleanupClosePushL( readStream ); + CMPXCollectionPlaylist* collPlaylist = CMPXCollectionPlaylist::NewL(); + CleanupStack::PushL( collPlaylist ); + collPlaylist->InternalizeL( readStream ); + + CleanupStack::PopAndDestroy( collPlaylist ); + CleanupStack::PopAndDestroy( &readStream ); + CleanupStack::PopAndDestroy( buffer ); +return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::SetObserver +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::SetObserver( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::SetObserver")); + TInt err = KErrNone; + MMPXCollectionPlaylistObserver* aPlObs(NULL) ; + MMPXCollectionObserver* aCollectionObs(NULL) ; + TRAP(err,iCollectionPlaylist->SetObserver(*this,aPlObs,aCollectionObs)); + if ( err != KErrNone ) + { + iLog->Log(_L("SetObserver returned: %d"), err); + } + return err; + } + + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::EmbeddedPlaylist +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::EmbeddedPlaylist( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::EmbeddedPlaylist")); + TInt err = KErrNone; + TBool vIsEmbeddedPlaylist = iCollectionPlaylist->EmbeddedPlaylist(); + iLog->Log(_L("CMPXCollectionPlaylist::EmbeddedPlaylist returned: %d"), vIsEmbeddedPlaylist); + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::SetEmbeddedPlaylist +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::SetEmbeddedPlaylist( CStifItemParser& aItem ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::SetEmbeddedPlaylist")); + TInt err = KErrNone; + TInt vEmbeddedPlaylist; + if ((KErrNone == aItem.GetNextInt(vEmbeddedPlaylist)) && + (vEmbeddedPlaylist >= EFalse) && (vEmbeddedPlaylist <= ETrue)) + { + iCollectionPlaylist->SetEmbeddedPlaylist (vEmbeddedPlaylist); + iLog->Log(_L("CMPXCollectionPlaylist::SetEmbeddedPlaylist OK")); + } + else + { + iLog->Log(_L("CMPXCollectionPlaylistTest::SetEmbeddedPlaylist: Bad parameter on config file")); + err = KErrBadTestParameter; + } + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::SetL +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::SetL( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::SetL")); + TInt err = KErrNone; + + CMPXMedia* media = CMPXMedia::NewL(); + CleanupStack::PushL( media ); + media->SetTObjectValueL( KMPXMediaGeneralCollectionId, TUid::Uid(0xabcdef) ); + TRAP(err,iCollectionPlaylist->SetL( *media )); + CleanupStack::PopAndDestroy( media ); + + if ( err != KErrNone ) + { + iLog->Log(_L("SetL returned: %d"), err); + } + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::CancelRequest +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::CancelRequest( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::CancelRequest")); + TInt err = KErrNone; + iCollectionPlaylist->CancelRequest(); + iLog->Log(_L("CMPXCollectionPlaylist::CancelRequest OK")); + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::Invalidate +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::Invalidate( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::Invalidate")); + TInt err = KErrNone; + iCollectionPlaylist->Invalidate(); + iLog->Log(_L("CMPXCollectionPlaylist::Invalidate OK")); + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::NextIndex +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::NextIndex( CStifItemParser& aItem ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::NextIndex")); + TInt err = KErrNone; + TInt vRepeatIgnored; + TBool vRetNext; + TInt aPlaylistIndex; + if ((KErrNone == aItem.GetNextInt(vRepeatIgnored)) && + (vRepeatIgnored >= EFalse) && (vRepeatIgnored <= ETrue)) + { + vRetNext = iCollectionPlaylist->NextIndex(vRepeatIgnored ,aPlaylistIndex); + iLog->Log(_L("CMPXCollectionPlaylist::NextIndex returned: %d"), vRetNext); + } + else + { + iLog->Log(_L("CMPXCollectionPlaylistTest::NextIndex: Bad parameter on config file")); + err = KErrBadTestParameter; + } + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::PathIndex +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::PathIndex( CStifItemParser& aItem ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::PathIndex")); + TInt err = KErrNone; + TInt err1 = KErrNone; + TInt vRepeatIgnored; + TBool vRetNext; + TInt aPlaylistIndex; + if ((KErrNone == aItem.GetNextInt(vRepeatIgnored)) && + (vRepeatIgnored >= EFalse) && (vRepeatIgnored <= ETrue)) + { + vRetNext = iCollectionPlaylist->NextIndex(vRepeatIgnored ,aPlaylistIndex); +// vRetNext = iCollectionPlaylist->Next(vRepeatIgnored ); + err1 = iCollectionPlaylist->PathIndex( aPlaylistIndex ); + iLog->Log(_L("CMPXCollectionPlaylist::NextIndex returned: %d"), vRetNext); + iLog->Log(_L("CMPXCollectionPlaylist::PathIndex returned: %d"), err1); + + } + else + { + iLog->Log(_L("CMPXCollectionPlaylistTest::PathIndex: Bad parameter on config file")); + err = KErrBadTestParameter; + } + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::CMPXCollectionPlaylistDestructor +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::CMPXCollectionPlaylistDestructor( CStifItemParser& /*aItem*/ ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::CMPXCollectionPlaylistDestructor")); + TInt err = KErrNone; + if( iCollectionPlaylist != NULL ) + { + delete iCollectionPlaylist; + iCollectionPlaylist = NULL; + } + if( iCollectionPlaylist != NULL ) + { + iLog->Log(_L("CMPXCollectionPlaylist::CMPXCollectionPlaylistDestructor err="),err); + } + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilityCreate +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilityCreate( CStifItemParser& /*aItem*/ ) + { + TInt err = KErrNone; + + MMPXCollectionObserver* aObs(NULL); + iLog->Log(_L("CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilityCreate")); + TRAP( err , iCollectionOpenUtility=CMPXCollectionOpenUtility::NewL(aObs)); + if( iCollectionOpenUtility != NULL ) + { + delete iCollectionOpenUtility; + iCollectionOpenUtility = NULL; + } + iLog->Log(_L("CMPXCollectionOpenUtility::NewL returned: %d"), err); + return err; + } + + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilityStartL +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilityStartL( CStifItemParser& ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilityStartL")); + TInt err = KErrNone; + RArray aAttrs; + CleanupClosePushL( aAttrs ); + TMPXAttribute attribut = TMPXAttribute(); + aAttrs.AppendL(attribut); + TInt aChunkSize=0; + TRAP( err , iCollectionPlaylist = CMPXCollectionPlaylist::NewL()); + CMPXCollectionOpenUtility* utility; + TRAP( err , utility = CMPXCollectionOpenUtility::NewL(iCollectionPlaylist,KMcModeDefault)); + TRAP( err , utility->StartL(aAttrs.Array(),aChunkSize)); + delete utility; + utility = NULL; + CleanupStack::PopAndDestroy( &aAttrs ); + iLog->Log(_L("CMPXCollectionOpenUtility::CMPXCollectionOpenUtilityStartL err: %d"),err); + return err; + } + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilityPathL +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilityPathL( CStifItemParser& /*aItem*/) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilityPathL")); + TInt err = KErrNone; + TRAP( err , iCollectionPlaylist = CMPXCollectionPlaylist::NewL()); + CMPXCollectionOpenUtility* utility; + TRAP( err , utility = CMPXCollectionOpenUtility::NewL(iCollectionPlaylist,KMcModeDefault)); + + TRAP( err ,iCollectionPath = utility->PathL()); + + if ( utility != NULL ) + { + delete utility; + utility = NULL; + } + iLog->Log(_L("CMPXCollectionPlaylist::CMPXCollectionOpenUtilityPathL OK")); + return err; + } + + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilityStop +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilityStop( CStifItemParser& /*aItem*/) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilityStop")); + TInt err = KErrNone; + TRAP( err , iCollectionPlaylist = CMPXCollectionPlaylist::NewL()); + CMPXCollectionOpenUtility* utility; + TRAP( err , utility = CMPXCollectionOpenUtility::NewL(iCollectionPlaylist,KMcModeDefault)); + + TRAP( err , utility->Stop()); + if ( utility != NULL ) + { + delete utility; + utility = NULL; + } + iLog->Log(_L("CMPXCollectionPlaylist::CMPXCollectionOpenUtilityStop return err: %d"),err); + return err; + } + + + + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilitySetDelay +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilitySetDelay( CStifItemParser& /*aItem*/) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilitySetDelay")); + TInt err = KErrNone; + TRAP( err , iCollectionPlaylist = CMPXCollectionPlaylist::NewL()); + CMPXCollectionOpenUtility* utility; + TRAP( err , utility = CMPXCollectionOpenUtility::NewL(iCollectionPlaylist,KMcModeDefault)); + + TInt delay = 10; + TRAP( err , utility->SetDelay(delay)); + if(err != KErrNone) + { + iLog->Log(_L("CMPXCollectionPlaylist::CMPXCollectionOpenUtilitySetDelay does not work right")); + delete utility; + utility = NULL; + return err; + } + if ( utility != NULL ) + { + delete utility; + utility = NULL; + } + iLog->Log(_L("CMPXCollectionPlaylist::CMPXCollectionOpenUtilitySetDelay OK")); + return err; + } + + + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilityStartUsingPath +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilityStartUsingPath( CStifItemParser& aItem ) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilityStartUsingPath")); + TInt err = KErrNone; + + TUint itemId; + // read in parameters + if ( aItem.GetNextInt(itemId) ) + { + iLog->Log(_L("Missing Parameter: ItemId.")); + return KErrBadTestParameter; + } + + const TMPXItemId KMPXPathItem1 = 44441; + RArray itemIdArray; + + // Start from scratch + if ( iCollectionPath ) + { + iCollectionPath->Reset(); + delete iCollectionPath; + } + // build collection path + TRAP( err , iCollectionPath = CMPXCollectionPath::NewL()); + TMPXItemId item(itemId); + TRAP( err , iCollectionPath->AppendL(item)); + itemIdArray.Append(KMPXPathItem1); + TRAP( err , iCollectionPath->AppendL(itemIdArray.Array())); + + itemIdArray.Close(); + + + CMPXCollectionPath* path; + TRAP( err , path = CMPXCollectionPath::NewL(*iCollectionPath)); + + RArray aAttrs; + aAttrs.Append(KMPXMediaGeneralTitle); + TInt aChunkSize=0; + + TInt aOffset = 0; + CMPXCollectionOpenUtility::TDirection direction = CMPXCollectionOpenUtility::EFetchNormal; + TMPXAttribute aKeyAttribute = KMPXMediaNullAttribute ; + + TRAP( err , iCollectionPlaylist = CMPXCollectionPlaylist::NewL()); + CMPXCollectionOpenUtility* utility; + TRAP( err , utility = CMPXCollectionOpenUtility::NewL(iCollectionPlaylist,KMcModeIsolated/*KMcModeDefault*/)); + TRAP( err , utility->StartL(*path,aAttrs.Array(),aChunkSize,aOffset,direction,aKeyAttribute)); + delete utility; + utility = NULL; + delete path; + aAttrs.Close(); + iLog->Log(_L("CMPXCollectionOpenUtility::CMPXCollectionOpenUtilityStartUsingPath err: %d"),err); + return err; + } + + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilitySetDirection +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilitySetDirection( CStifItemParser& /*aItem*/) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::CMPXCollectionOpenUtilitySetDirection")); + TInt err = KErrNone; + TRAP( err , iCollectionPlaylist = CMPXCollectionPlaylist::NewL()); + CMPXCollectionOpenUtility* utility; + TRAP( err , utility = CMPXCollectionOpenUtility::NewL(iCollectionPlaylist,KMcModeDefault)); + CMPXCollectionOpenUtility::TDirection direction = CMPXCollectionOpenUtility::EFetchNormal; + TRAP( err , utility->SetDirection(direction)); + if( err != KErrNone ) + { + iLog->Log(_L("CMPXCollectionPlaylist::CMPXCollectionOpenUtilitySetDirection does not work right")); + delete utility; + utility = NULL; + return err; + } + delete utility; + utility = NULL; + iLog->Log(_L("CMPXCollectionPlaylist::CMPXCollectionOpenUtilitySetDirection return err: %d"),err); + return err; + } + + +// --------------------------------------------------------------------------- +// CMPXCollectionPlaylistTest::NewLMMPXCollectionUtility +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionPlaylistTest::NewLMMPXCollectionUtility( CStifItemParser& /*aItem*/) + { + iLog->Log(_L("CMPXCollectionPlaylistTest::NewLMMPXCollectionUtility")); + TInt err = KErrNone; + TRAP( err,iCollectionPlaylist = CMPXCollectionPlaylist::NewL()); + MMPXCollectionUtility* collectionUtility; + TRAP( err , collectionUtility = MMPXCollectionUtility::NewL(iCollectionPlaylist,KMcModeDefault)); + collectionUtility->Close(); + iLog->Log(_L("CMPXCollectionPlaylist::NewLMMPXCollectionUtility OK")); + return err; + } + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_utility_api/tsrc/conf/mpxcollectionplaylisttest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_utility_api/tsrc/conf/mpxcollectionplaylisttest.cfg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,444 @@ +[Define] +KTrue 1 +KFalse 0 + +// CMPXCollectionPath +KMPXPathLevel1 33331 +KMPXPathLevel2 33332 +KMPXPathLevel3 33333 +KMPXPathItem1 44441 +KMPXPathItem2 44442 +KMPXPathItem3 44443 +KMPXPathItem4 44444 +KMPXPathItem5 44445 + +[Enddefine] + +[Test] +title 1: Create Utility: New Playlist +create mpxcollectionplaylisttest utility +utility CreateUtilityNewPlaylist +delete utility +pause 1000 +[Endtest] + +[Test] +title 2: Create Utility: Using existing playlist +create mpxcollectionplaylisttest utility +utility CreateUtilityPlaylistExist +delete utility +pause 1000 +[Endtest] + +[Test] +title 3: Create Utility: Using existing collection path +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +delete utility +pause 1000 +[Endtest] + +[Test] +title 4: Create Utility: Using existing collection stream +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionStream +delete utility +pause 1000 +[Endtest] + +[Test] +title 5: Copy Content +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility CopyContentL +delete utility +pause 1000 +[Endtest] + +[Test] +title 6: Next (With repeat ignored) +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility Next KTrue +delete utility +pause 1000 +[Endtest] + +[Test] +title 7: Next (With repeat not ignored) +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility Next KFalse +delete utility +pause 1000 +[Endtest] + +[Test] +title 8: Previous (With repeat ignored) +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility Previous KTrue +delete utility +pause 1000 +[Endtest] + +[Test] +title 9: Previous (With repeat not ignored) +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility Previous KFalse +delete utility +pause 1000 +[Endtest] + +[Test] +title 10: Set To First Item +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility SetToFirst +delete utility +pause 1000 +[Endtest] + +[Test] +title 11: Set To Last Item +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility SetToLast +delete utility +pause 1000 +[Endtest] + +[Test] +title 12: Set To Given Index +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility SetToIndex 2 +delete utility +pause 1000 +[Endtest] + +[Test] +title 13: Get Playlist Count +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility Count +delete utility +pause 1000 +[Endtest] + +[Test] +title 14: Get Playlist Levels +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility Levels +delete utility +pause 1000 +[Endtest] + +[Test] +title 15: Get Playlist Index +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility Index +delete utility +pause 1000 +[Endtest] + +[Test] +title 16: Get Remote Flag +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility Remote +delete utility +pause 1000 +[Endtest] + +[Test] +title 17: Get Repeat Mode +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility RepeatMode +delete utility +pause 1000 +[Endtest] + +[Test] +title 18: Get Shuffle mode +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility Shuffle +delete utility +pause 1000 +[Endtest] + +[Test] +title 19: Get Path +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility Path +delete utility +pause 1000 +[Endtest] + +[Test] +title 20: Get MediaL +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility MediaL +delete utility +pause 1000 +[Endtest] + +[Test] +title 21: Set Repeat Mode Off +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility SetRepeatMode 0 +delete utility +pause 1000 +[Endtest] + +[Test] +title 22: Set Repeat Mode On +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility SetRepeatMode KTrue +delete utility +pause 1000 +[Endtest] + +[Test] +title 23: Set Repeat Mode Repeat All +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility SetRepeatMode 2 +delete utility +pause 1000 +[Endtest] + +[Test] +title 24: Set Repeat Enabled False +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility SetRepeatEnabled KFalse +delete utility +pause 1000 +[Endtest] + +[Test] +title 25: Set Repeat Enabled True +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility SetRepeatEnabled KTrue +delete utility +pause 1000 +[Endtest] + +[Test] +title 26: Set Shuffle True and current to top True +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility SetShuffleL KTrue KTrue +delete utility +pause 1000 +[Endtest] + +[Test] +title 27: Set Shuffle False and current to top False +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility SetShuffleL KFalse KFalse +delete utility +pause 1000 +[Endtest] + +[Test] +title 28: Set Shuffle Enabled True +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility SetShuffleEnabledL KTrue +delete utility +pause 1000 +[Endtest] + +[Test] +title 29: Set Shuffle Enabled False +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility SetShuffleEnabledL KFalse +delete utility +pause 1000 +[Endtest] + +[Test] +title 30: Externalize/Internalize +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility StreamingL +delete utility +pause 1000 +[Endtest] + +[Test] +title 31: Set Observer +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility SetObserver +delete utility +pause 1000 +[Endtest] + +[Test] +title 32: Get Embedded Playlist flag +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility EmbeddedPlaylist +delete utility +pause 1000 +[Endtest] + +[Test] +title 33: Set Embedded Playlist True +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility SetEmbeddedPlaylist KTrue +delete utility +pause 1000 +[Endtest] + +[Test] +title 34: Set Embedded Playlist False +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility SetEmbeddedPlaylist KFalse +delete utility +pause 1000 +[Endtest] + +[Test] +title 35: Set +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility SetL +delete utility +pause 1000 +[Endtest] + +[Test] +title 36: Cancel Request +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility CancelRequest +delete utility +pause 1000 +[Endtest] + +[Test] +title 37: Invalidate +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility Invalidate +delete utility +pause 1000 +[Endtest] + +[Test] +title 38:Collection Playlist: Path Index (With repeat ignored) +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility PathIndex KTrue +delete utility +pause 1000 +[Endtest] + +[Test] +title 39:Collection Playlist: Next Index (With repeat ignored) +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility NextIndex KTrue +delete utility +pause 1000 +[Endtest] + +[Test] +title 40:CMPXCollectionPlaylistDestructor +create mpxcollectionplaylisttest utility +utility CreateUtilityCollectionPath +utility CMPXCollectionPlaylistDestructor +delete utility +pause 1000 +[Endtest] + +[Test] +title 41: CMPXCollectionOpenUtilityCreate +create mpxcollectionplaylisttest utility +utility CMPXCollectionOpenUtilityCreate +delete utility +pause 1000 +[Endtest] + +[Test] +title 42 NewL mpxcollectionutility +create mpxcollectionplaylisttest utility +utility NewLMMPXCollectionUtility +delete utility +pause 1000 +[Endtest] + +[Test] +title 43 CMPXCollectionOpenUtilityStartL +create mpxcollectionplaylisttest utility +//utility CMPXCollectionOpenUtilityCreate +utility CMPXCollectionOpenUtilityStartL +delete utility +pause 1000 +[Endtest] + + + +[Test] +title 44 CMPXCollectionOpenUtilityPathL +create mpxcollectionplaylisttest utility +utility CMPXCollectionOpenUtilityCreate +utility CMPXCollectionOpenUtilityPathL +delete utility +pause 1000 +[Endtest] + + +[Test] +title 45 CMPXCollectionOpenUtilityStop +create mpxcollectionplaylisttest utility +utility CMPXCollectionOpenUtilityCreate +utility CMPXCollectionOpenUtilityStop +delete utility +pause 1000 +[Endtest] + +[Test] +title 46 CMPXCollectionOpenUtilitySetDelay +create mpxcollectionplaylisttest utility +utility CMPXCollectionOpenUtilityCreate +utility CMPXCollectionOpenUtilitySetDelay +delete utility +pause 1000 +[Endtest] + +[Test] +title 47 CMPXCollectionOpenUtilityStartUsingPath +create mpxcollectionplaylisttest utility +//utility CMPXCollectionOpenUtilityCreate +utility CMPXCollectionOpenUtilityStartUsingPath KMPXPathLevel1 +delete utility +pause 1000 +[Endtest] + +[Test] +title 48 CMPXCollectionOpenUtilitySetDirection +create mpxcollectionplaylisttest utility +utility CMPXCollectionOpenUtilityCreate +utility CMPXCollectionOpenUtilitySetDirection +delete utility +pause 1000 +[Endtest] \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_utility_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_utility_api/tsrc/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2007 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 for project mpxharvestertest +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_TESTEXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +#include "../collectionplaylisttest/group/bld.inf" + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_collection_utility_api/tsrc/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_collection_utility_api/tsrc/init/TestFramework.ini Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,197 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[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_mpxcollectionplaylisttest + +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= 0 # Default timeout value for each test case. In milliseconds +UITestingSupport= YES +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +[New_Module] +ModuleName= testscripter +TestCaseFile= c:\testframework\mpxcollectionplaylisttest.cfg +[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[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= D:\LOGS\TestFramework\ +#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 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2007 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 +: mpx common API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/mpxattribute.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxattribute.h) +../inc/mpxcenrepobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcenrepobserver.h) +../inc/mpxcenrepwatcher.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcenrepwatcher.h) +../inc/mpxclientlist.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxclientlist.h) +../inc/mpxclientlist.inl MW_LAYER_PLATFORM_EXPORT_PATH(mpxclientlist.inl) +../inc/mpxcollectionpath.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectionpath.h) +../inc/mpxcollectiontype.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectiontype.h) +../inc/mpxcollectiontype.inl MW_LAYER_PLATFORM_EXPORT_PATH(mpxcollectiontype.inl) +../inc/mpxcommandgeneraldefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcommandgeneraldefs.h) +../inc/mpxcustomcommandobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcustomcommandobserver.h) +../inc/mpxdata.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxdata.h) +../inc/mpxdrmmediautility.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxdrmmediautility.h) +../inc/mpxmedia.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxmedia.h) +../inc/mpxmedia.inl MW_LAYER_PLATFORM_EXPORT_PATH(mpxmedia.inl) +../inc/mpxmediaarray.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxmediaarray.h) +../inc/mpxmediaaudiodefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxmediaaudiodefs.h) + +../inc/mpxmediabase.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxmediabase.h) +../inc/mpxmediabase.inl MW_LAYER_PLATFORM_EXPORT_PATH(mpxmediabase.inl) + +../inc/mpxmediacollectiondetaildefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxmediacollectiondetaildefs.h) +../inc/mpxmediacontainerdefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxmediacontainerdefs.h) +../inc/mpxmediadrmdefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxmediadrmdefs.h) +../inc/mpxmediageneraldefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxmediageneraldefs.h) +//../inc/mpxmediaimagedefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxmediaimagedefs.h) +../inc/mpxmediamtpdefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxmediamtpdefs.h) +../inc/mpxmediamusicdefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxmediamusicdefs.h) +../inc/mpxmessage.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxmessage.h) +../inc/mpxmessagecontainerdefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxmessagecontainerdefs.h) +../inc/mpxmessagegeneraldefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxmessagegeneraldefs.h) +../inc/mpxmessagemonitor.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxmessagemonitor.h) +../inc/mpxmessageobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxmessageobserver.h) +../inc/mpxmessageprogressdefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxmessageprogressdefs.h) +../inc/mpxmessagequeue.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxmessagequeue.h) +../inc/mpxparameter.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxparameter.h) +../inc/mpxpluginhandlerbase.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxpluginhandlerbase.h) +../inc/mpxpluginhandlerobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxpluginhandlerobserver.h) +../inc/mpxpluginmonitor.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxpluginmonitor.h) +../inc/mpxpluginmonitorobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxpluginmonitorobserver.h) +../inc/mpxplugin.hrh MW_LAYER_PLATFORM_EXPORT_PATH(mpxplugin.hrh) +../inc/mpxpodcastdefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxpodcastdefs.h) +../inc/mpxpskeyobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxpskeyobserver.h) +../inc/mpxpskeywatcher.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxpskeywatcher.h) +../inc/mpxsession.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxsession.h) +../inc/mpxtaskqueue.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxtaskqueue.h) +../inc/mpxtaskqueueobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxtaskqueueobserver.h) +../inc/mpxuser.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxuser.h) +../inc/mpxsubscription.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxsubscription.h) +../inc/mpxplugininfo.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxplugininfo.h) +../inc/mpxmessagepluginupdatedefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxmessagepluginupdatedefs.h) +../inc/mpxmediageneralextdefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxmediageneralextdefs.h) diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxattribute.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxattribute.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,193 @@ +/* +* Copyright (c) 2006 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: mpx attribute class +* +*/ + + +#ifndef MPXATTRIBUTE_H +#define MPXATTRIBUTE_H + +#include + +enum TMPXAttributeType + { + EMPXTypeUnknown, + EMPXTypeTInt, + EMPXTypeText, + EMPXTypeTObject, + EMPXTypeCObject, + EMPXTypeError + }; + + +/** +* MPX Attribute data type class. +* +* @lib mpxcommon.lib +*/ +class TMPXAttributeData + { +public: + /** + * Overloadded operator&. + * + * @since S60 3.2.3 + * @param aData TMPXAttributeData object + */ + IMPORT_C TBool operator& (const TMPXAttributeData& aData) const; + /** + * Overloadded operator&. + * + * @since S60 3.2.3 + * @param aData attribute + */ + IMPORT_C TBool operator& (TUint& aData) const; + /** + * Overloadded operator|. + * + * @since S60 3.2.3 + * @param aData TMPXAttributeData object + */ + IMPORT_C TMPXAttributeData operator| (const TMPXAttributeData& aData) const; +public: + TInt iContentId; + TUint iAttributeId; + }; + + +/** +* TMPXAttribute data type class. +* It represents unique id of an item, e.g. a song in the device. +* +* @lib mpxcommon.lib +*/ +class TMPXAttribute + { +public: // Constructors and destructor + /** + * C++ default constructor. + * + * @since S60 3.2.3 + */ + IMPORT_C TMPXAttribute(); + + /** + * C++ constructor. + * + * @since S60 3.2.3 + * @param aContentId media content id + * @param aAttributeId attribute id within the content + */ + IMPORT_C TMPXAttribute(TInt aContentId, TUint aAttributeId); + + /** + * Copy constructor. + * + * @since S60 3.2.3 + * @param aId source of attribute id + */ + IMPORT_C TMPXAttribute(const TMPXAttribute& aId); + + /** + * Copy constructor. + * + * @since S60 3.2.3 + * @param aData source of attribute data + */ + IMPORT_C TMPXAttribute(const TMPXAttributeData& aData); + +public: + /** + * Overloaded assignment operator. + * + * @since S60 3.2.3 + * @param aId source of attribute + * @return reference to updated object + */ + IMPORT_C TMPXAttribute& operator=(const TMPXAttribute& aId); + + /** + * Overloaded equal operator. + * + * @since S60 3.2.3 + * @param aId id to be compared + * @return ETrue if equal, otherwise, EFalse + */ + IMPORT_C TBool operator==(const TMPXAttribute& aId) const; + +public: + /** + * Externalize the object of this class. + * + * @since S60 3.2.3 + * @param aStream write stream + */ + IMPORT_C void ExternalizeL(RWriteStream& aStream) const; + + /** + * Internalize the object of this class. + * + * @since S60 3.2.3 + * @param aStream read stream + */ + IMPORT_C void InternalizeL(RReadStream& aStream); + + /** + * Get content id. + * + * @since S60 3.2.3 + * @return content id + */ + IMPORT_C TInt ContentId() const; + + /** + * Attribute id. + * + * @since S60 3.2.3 + * @return attribute db + */ + IMPORT_C TUint AttributeId() const; + + /** + * Helper function to do match in the RArray of the objects of this class. + * + * @since S60 3.2.3 + * @param aFirst first object + * @param aSecond second object + */ + IMPORT_C static TBool Match(const TMPXAttribute& aFirst, + const TMPXAttribute& aSecond); + + /** + * Helper function to do match in the RArray of the objects of this class by + * content id. + * + * @since S60 3.2.3 + * @param aFirst first object + * @param aSecond second object + */ + IMPORT_C static TBool MatchContentId(const TMPXAttribute& aFirst, + const TMPXAttribute& aSecond); + +private: // Data + TMPXAttributeData iData; + }; + +// CONSTANTS NULL attribute not used for storing data +const TMPXAttributeData KMPXMediaNullAttribute={0x0,0x00}; + +#endif // MPXATTRIBUTE_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxcenrepobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxcenrepobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2006 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: Observer for CenRep changes +* +*/ + + + +#ifndef M_MPXCENREPKEYOBSERVER_H +#define M_MPXCENREPKEYOBSERVER_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Observer interface for getting notifications about changes in settings +* values. +* +* @lib mpxcommon.lib +*/ +NONSHARABLE_CLASS(MMPXCenRepObserver) + { + public: // New functions + /** + * Handle a change in a setting value. + * + * @since S60 3.2.3 + * @param aRepositoryUid Central repository UID containing the setting + * @param aSettingId Id of the setting + */ + virtual void HandleSettingChange(const TUid& aRepositoryUid, + TUint32 aSettingId) = 0; + }; + + +#endif // M_MPXCENREPKEYOBSERVER_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxcenrepwatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxcenrepwatcher.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2006 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: Class for observing changes in central repository values +* +*/ + + +#ifndef CMMPXCENREPWATCHER_H +#define CMMPXCENREPWATCHER_H + +// INCLUDES +#include +#include +#include + +// FORWARD DECLARATIONS +class MMPXCenRepObserver; + +// CLASS DECLARATION + +/** +* Class for observing changes in central repository values. +* +* @lib mpxcommon.lib +*/ +class CMPXCenRepWatcher : public CActive +{ +public: // Constructors and destructor + + /** + * Two-phased constructor. + * + * @since S60 3.2.3 + * @param aRepositoryUid uid of CenRep file + * @param aId id of the key + * @param aObserver obersver + * @return contructed object + */ + IMPORT_C static CMPXCenRepWatcher* NewL(const TUid& aRepositoryUid, + TUint32 aId, + MMPXCenRepObserver* aObserver); + + /** + * Destructor. + * + * @since S60 3.2.3 + */ + IMPORT_C virtual ~CMPXCenRepWatcher(); + +public: // New functions + /** + * Get current value as integer. + * + * @since S60 3.2.3 + * @return Current value of the key as a TInt + */ + IMPORT_C TInt CurrentValueL(); + + /** + * Set integer value. + * + * @since S60 3.2.3 + * @param aNewValue New value for the key + */ + IMPORT_C void SetValueL(TInt aNewValue); + +private: // New functions + /** + * C++ constructor. + * + * @since S60 3.2.3 + * @param aRepositoryUid uid of CenRep file + * @param aId id of the key + * @param aObserver obersver + * @return contructed object + */ + CMPXCenRepWatcher(const TUid& aRepositoryUid, + TUint32 aId, + MMPXCenRepObserver* aObserver); + + /** + * Symbian OS 2nd phase constructor. + * + * @since S60 3.2.3 + */ + void ConstructL(); + +protected: // Functions from base classes + /** + * From CActive. + * + * @since S60 3.2.3 + */ + void RunL(); + + /** + * From CActive. + * + * @since S60 3.2.3 + */ + void DoCancel(); + +private: // Data + CRepository* iRepository; // owned + TUid iRepositoryUid; + TUint32 iId; + MMPXCenRepObserver* iObserver; // not owned +}; + +#endif // CMMPXCENREPWATCHER_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxclientlist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxclientlist.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,440 @@ +/* +* Copyright (c) 2006 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: Encapsulates all the clients +* +*/ + + +#ifndef CMPXCLIENTLIST_H +#define CMPXCLIENTLIST_H + +// INCLUDES +#include +#include +#include + +// CLASS FORWARDS +class CMPXMessageQueue; +class MMPXClientlistObserver; +class CMPXSubscription; + +/** +* Manages a list of clients. +* +* @lib mpxcommon.lib +*/ +class CMPXClientList : public CBase + { +public: + /** + * Two-phased constructor. + * + * @since S60 3.2.3 + * @param aObserver observer of the client list + * @return object of constructed + */ + IMPORT_C static CMPXClientList* NewL(MMPXClientlistObserver* aObserver = NULL); + + /** + * Destructor. + * + * @since S60 3.2.3 + */ + IMPORT_C virtual ~CMPXClientList(); + +public: + /** + * Add another client into the list. + * + * @since S60 3.2.3 + * @param aId thread id of the client + * @param aMsgQueue message queue for the client + * @leave The function leaves with one of the system wide error codes, + * if the operation fails. + */ + IMPORT_C void AddClientL(TThreadId aId, + CMPXMessageQueue* aMsgQueue); + + /** + * Add another client into the list. + * + * @since S60 3.2.3 + * @param aId thread id of the client + * @param aMode client mode + * @param aMsgQueue message queue for the client + * @leave The function leaves with one of the system wide error codes, + * if the operation fails. + */ + IMPORT_C void AddClientL(TThreadId aId, + TInt aMode, + CMPXMessageQueue* aMsgQueue); + + + /** + * Add another client into the list. + * + * @since S60 3.2.3 + * @param aId thread id of the client + * @param aMode client mode + * @param aMsgQueue message queue for the client + * @param aCategory category of the client, refer to TMPXCategory + * @leave The function leaves with one of the system wide error codes, + * if the operation fails. + */ + IMPORT_C void AddClientL(TThreadId aId, + TInt aMode, + CMPXMessageQueue* aMsgQueue, + const TInt aCategory); + + /** + * Remove a client at a specified position. + * + * @since S60 3.2.3 + * @param aIndex The position within the list from where the client is to + * be removed + * @panic USER 130, if aIndex is out of bound + */ + IMPORT_C void RemoveClient(TInt aIndex); + + /** + * The number of clients. + * + * @since S60 3.2.3 + * @return number of the clients + */ + IMPORT_C TInt ClientCount() const; + + /** + * A list of process ids of all the clients in this list. + * + * @since S60 3.2.3 + * @return array of process id of clients + */ + IMPORT_C TArray ClientProcessList() const; + + /** + * Is this (denoted by thread id) a client in this list?. + * + * @since S60 3.2.3 + * @param aId thread id of the client + * @return ETrue, the client is in the list + */ + IMPORT_C TBool IsClient(TThreadId aId) const; + + /** + * Find a client denoted by message queue in this list. + * + * @since S60 3.2.3 + * @param aMsgQueue Message queue for the client + * @return The index of the client within the list + * KErrNotFound, if no matching object can be found + */ + IMPORT_C TInt Find(const CMPXMessageQueue& aMsgQueue) const; + + /** + * Find a client denoted by thread id in the list. + * + * @since S60 3.2.3 + * @param aId thread id of the client + * @return TInt index to the client list + */ + IMPORT_C TInt Find(TThreadId aId) const; + + /** + * Return client mode. + * + * @since S60 3.2.3 + * @param aIndex index to the client + * @return the mode of client + * @panic USER 0 if aIndex out of bound + */ + IMPORT_C TInt ClientMode(TInt aIndex) const; + + /** + * Return client category. + * + * @since S60 3.2.3 + * @param aIndex index to the client + * @return the category of client + * @panic USER 0 if aIndex out of bound + */ + IMPORT_C TInt ClientCategory(TInt aIndex) const; + + + /** + * Dispatches message to all clients. + * + * @since S60 3.2.3 + * @param aMsg message, pointer to message, ownership not transferred. + * @param aError error code + */ + IMPORT_C void SendMsg(const CMPXMessage* aMsg, TInt aError); + + /** + * Dispatches message to a client. + * + * @since S60 3.2.3 + * @param aIndex index to the client + * @param aMsg message object, ownership not transferred. + * @param aError error code + */ + IMPORT_C void SendMsg(TInt aIndex, const CMPXMessage* aMsg, TInt aError); + + /** + * Adds a subscription to a client identified by a specified position. + * + * @since S60 3.2.3 + * @param aIndex The position within the list where the client is. + * @param aSubscription subscription to add. Ownership is transferred. + */ + IMPORT_C void AddSubscriptionL( + TInt aIndex, + CMPXSubscription* aSubscription); + + /** + * Removes a subscription from a client identified by a specified position. + * + * @since S60 3.2.3 + * @param aIndex The position within the list where the client is. + * @param aSubscription subscription to remove. + */ + IMPORT_C void RemoveSubscriptionL( + TInt aIndex, + const CMPXSubscription& aSubscription); + + /** + * Removes all subscriptions from a client identified by a specified position. + * + * @since S60 3.2.3 + * @param aIndex The position within the list where the client is. + */ + IMPORT_C void RemoveAllSubscriptionsL(TInt aIndex); + + /** + * Convert TMPXMessage into CMPXMessage. + * + * @since S60 3.2.3 + * @param aMsg TMPXMessage message + * @return CMPXMessage object + * @leave The function leaves with one of the system wide error codes, + * if the operation fails. + * @deprecated should not be used + */ + inline CMPXMessage* ConvertMsgLC(const TMPXMessage& aMsg); + + /** + * Dispatches message to all clients. + * + * @since S60 3.2.3 + * @param aMsg message + * @leave The function leaves with one of the system wide error codes, + * if the operation fails. + * @deprecated Use method CMPXClientList::SendMsg(const CMPXMessage* aMsg, + * TInt aError) instead. + */ + inline void SendMsgL(const TMPXMessage& aMsg); + + /** + * Dispatches message to a client. + * + * @since S60 3.2.3 + * @param aIndex index to the client + * @param aMsg message + * @leave The function leaves with one of the system wide error codes, + * if the operation fails. + * @deprecated Use method CMPXClientList::SendMsg(TInt aIndex, + * const CMPXMessage* aMsg, TInt aError) instead. + */ + inline void SendMsgL(TInt aIndex, const TMPXMessage& aMsg); + +private: + /** + * Encapsulates a client: all the information associated with a client of + * the playback utility interface. + * + * @lib mpxcommon.lib + */ + NONSHARABLE_CLASS(CClientId): public CBase + { + public: + /** + * Constructor. + * + * @since S60 3.2.3 + * @param aTid thread id of the client + * @param aPid process id of the client + * @param aMsgQueue message queue for the client + */ + CClientId(TThreadId aTid, + TProcessId aPid, + CMPXMessageQueue* aMsgQueue); + + /** + * Constructor. + * + * @since S60 3.2.3 + * @param aTid thread id of the client + * @param aPid process id of the client + * @param aMode client mode + * @param aMsgQueue message queue for the client + */ + CClientId(TThreadId aTid, + TProcessId aPid, + TInt aMode, + CMPXMessageQueue* aMsgQueue); + + /** + * Constructor. + * + * @since S60 3.2.3 + * @param aTid thread id of the client + * @param aPid process id of the client + * @param aMode client mode + * @param aMsgQueue message queue for the client + * @param aCategory client category + */ + CClientId(TThreadId aTid, + TProcessId aPid, + TInt aMode, + CMPXMessageQueue* aMsgQueue, + const TInt aCategory); + + /** + * Constructor. + * + * @since S60 3.2.3 + * @param aMsgQueue message queue for the client + */ + CClientId(CMPXMessageQueue* aMsgQueue); + + /** + * Constructor. + * + * @since S60 3.2.3 + * @param aTid thread id of the client + */ + CClientId(TThreadId aTid); + + /** + * Constructor. + * + * @since S60 3.2.3 + * @param aPid process id of the client + */ + CClientId(TProcessId aPid); + + /** + * Constructor. + * + * @since S60 3.2.3 + */ + CClientId(); + + /** + * Destructor. + * + * @since S60 3.2.3 + */ + virtual ~CClientId(); + + /** + * Assignment operator. + * + * @since S60 3.2.3 + * @param aClientId client ID instance to assign from. + * @return reference to the current updated instance. + */ + CClientId& operator=(const CClientId& aClientId); + + /** + * Adds a subscription to the client. + * + * @since S60 3.2.3 + * @param aSubscription subscription to add. Ownership is transferred. + */ + void AddSubscriptionL(CMPXSubscription* aSubscription); + + /** + * Removes a subscription from the client. + * + * @since S60 3.2.3 + * @param aSubscription subscription to remove. + */ + void RemoveSubscriptionL(const CMPXSubscription& aSubscription); + + /** + * Removes all subscriptions from the client. + * + * @since S60 3.2.3 + */ + void RemoveAllSubscriptionsL(); + + + public: + TThreadId iTid; + TProcessId iPid; + TInt iMode; + TInt iCategory; + CMPXMessageQueue* iMsgQueue; // Not owned + RPointerArray iSubscriptions; // array of subscriptions + }; +private: + /** + * C++ constructor. + * + * @since S60 3.2.3 + * @param aObserver observer of the client list + */ + CMPXClientList(MMPXClientlistObserver* aObserver); + + /** + * 2nd phase constructor. + * + * @since S60 3.2.3 + */ + void ConstructL(); + + /** + * Check if the msg subscribed by the client. + * + * @since S60 3.2.3 + * @param aIndex index to the client + * @param aMsg message object, ownership not transferred. + * @param leave leave with system error code + */ + TBool IsMsgSubscribedL(TInt aIndex, const CMPXMessage* aMsg); + + /** + * Comparison function. If the names are set in the client objects, then + * that's used to test for equality. Otherwise, if the thread ids are set, + * that's used. Else, it's assumed that the equality test is based on process + * ids. + * + * @since S60 3.2.3 + * @param aClient1 client id of the client 1 + * @param aClient2 client id of the client 2 + * @return ETrue if two ids are the same + */ + static TBool ClientsMatch(const CClientId& aClient1, + const CClientId& aClient2); +private: + TIdentityRelation iIdentity; + RPointerArray iClients; + RArray iClientProcesses; + MMPXClientlistObserver* iObserver; + }; + +#include "mpxclientlist.inl" + +#endif // CMPXCLIENTLIST_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxclientlist.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxclientlist.inl Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2006 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: Inline implementation of client list +* +*/ + +#include +#include + +// ----------------------------------------------------------------------------- +// Convert TMPXMessage into CMPXMessage +// ----------------------------------------------------------------------------- +// +inline CMPXMessage* CMPXClientList::ConvertMsgLC(const TMPXMessage& aMsg) + { + CMPXMessage* msg = CMPXMessage::NewL(); + CleanupStack::PushL(msg); + TMPXMessageId id=static_cast(KMPXMessageGeneral); + msg->SetTObjectValueL(KMPXMessageGeneralId, id); + msg->SetTObjectValueL(KMPXMessageGeneralEvent, aMsg.Event()); + msg->SetTObjectValueL(KMPXMessageGeneralType, aMsg.Type()); + msg->SetTObjectValueL(KMPXMessageGeneralData, aMsg.Data()); + return msg; + } +// ----------------------------------------------------------------------------- +// Send message to all clients in the list +// ----------------------------------------------------------------------------- +// +inline void CMPXClientList::SendMsgL(const TMPXMessage& aMsg) + { + MPX_FUNC_EX("CMPXClientList::SendMsgL(aTMsg)"); + CMPXMessage* msg = ConvertMsgLC(aMsg); + // Magic number 1 which is always be old EError value in TMPXMessage + TInt err = aMsg.Event()==1 ? aMsg.Data() : KErrNone; + SendMsg(msg, err); + CleanupStack::PopAndDestroy(msg); + } + +// ----------------------------------------------------------------------------- +// Send message to a client +// ----------------------------------------------------------------------------- +// +inline void CMPXClientList::SendMsgL(TInt aIndex, const TMPXMessage& aMsg) + { + MPX_FUNC_EX("CMPXClientList::SendMsgL(aIndex, aTMsg)"); + CMPXMessage* msg = ConvertMsgLC(aMsg); + SendMsg(aIndex, msg, KErrNone); + CleanupStack::PopAndDestroy(msg); + } + +//End of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxcollectionpath.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxcollectionpath.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,572 @@ +/* +* Copyright (c) 2006 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: Encapsulates a path into a collection +* +*/ + + + +#ifndef CMPXCOLLECTIONPATH_H +#define CMPXCOLLECTIONPATH_H + +#include + +class RWriteStream; +class RReadStream; +class CMPXCollectionPathNode; +class TMPXAttribute; + +/** +* Encapsulates a 'bookmark' to a specific collection entry, i.e. encapsulates +* a specific path in a collection hierarchy; you can navigate through the +* items at this level. +* +* @lib mpxcommon.lib +*/ +class CMPXCollectionPath : public CBase + { +public: + /** + * Convenience enumeration to identify levels + * within a collection path. + */ + enum TMPXCollectionPathLevel + { + ECollectionUid=0, + ECollectionRoot=0 // Use ECollectionRoot+1, +2, etc as for other levels + }; + + enum TMPXPathChangeResult + { + EPathUnchanged=0, + EPathModified, + EPathClipped + }; + + /** + * Collection path change type. + * + */ + enum TMPXCollectionPathChange + { + EAdded, // Item changed + EDeleted, // Item deleted + EModified, // Item modified + EGroupModified // A "Group" modified, e.g. a playlist, an artist, etc + }; +public: + /** + * Two-phase constructor. + * + * @since S60 3.2.3 + * @param aPath reference to an existing collection path + * @return object created + */ + IMPORT_C static CMPXCollectionPath* NewL(const CMPXCollectionPath& aPath); + + /** + * Two-phase constructor. + * + * @since S60 3.2.3 + * @param aStream reference to a stream + * @return object created + */ + IMPORT_C static CMPXCollectionPath* NewL(RReadStream& aStream); + + /** + * Two-phase constructor. + * + * @since S60 3.2.3 + * @return object created + */ + IMPORT_C static CMPXCollectionPath* NewL(); + + /** + * Destructor. + * + * @since S60 3.2.3 + */ + IMPORT_C virtual ~CMPXCollectionPath(); + +public: // Navigation through items at top level + /** + * Go to next item. + * + * @since S60 3.2.3 + * @return ETrue if exists + */ + IMPORT_C TBool operator++(); + + /** + * Go to previous item. + * + * @since S60 3.2.3 + * @return ETrue if exists + */ + IMPORT_C TBool operator--(); + + /** + * Go to the first item. + * + * @since S60 3.2.3 + */ + IMPORT_C void SetToFirst(); + + /** + * Go to the last item. + * + * @since S60 3.2.3 + */ + IMPORT_C void SetToLast(); + + /** + * Go to specific item at top level. + * + * @since S60 3.2.3 + * @param aIndex index of the item + * @panic USER 130, if aIndex is out of bound + * @panic USER 0, if collection path is invalid(zero level) + */ + IMPORT_C void Set(TInt aIndex); + + /** + * Go to specific item at top level. + * + * @since S60 3.2.3 + * @param aId id of the item + * @panic USER 0, if aId is invalid or invalid collection path + */ + IMPORT_C void Set(const TMPXItemId& aId); + + /** + * Sets the open mode with which to navigate to the next level. + * + * @since S60 3.2.3 + * @param aMode the open mode + * @panic USER 0, if collection path is invalid(zero level) + */ + IMPORT_C void Set(TMPXOpenMode aMode); + + /** + * Sets the open attributes with which to navigate to the next level. + * + * @since S60 3.2.3 + * @param aAttrs the open attributes + * @panic USER 0, if collection path is invalid(zero level) + * @deprecated Use method CMPXCollectionPath::SetL( + * const TArray& aAttrs) instead. + */ + IMPORT_C void Set(const TArray& aAttrs); + + /** + * Sets the open attributes with which to navigate to the next level. + * + * @since S60 3.2.3 + * @param aAttrs the open attributes + * @leave system error code + * @panic USER 0, if collection path is invalid(zero level) + */ + IMPORT_C void SetL(const TArray& aAttrs); + +public: // Selection of items at top level + + /** + * Select an item with the id in the path. + * If the id appears more than once in the path, Select(TInt aIndex) can + * be used. + * + * @since S60 3.2.3 + * @param aId ID of the item + * @panic USER 0 if aId is not found + */ + IMPORT_C void SelectL(const TMPXItemId& aId); + + /** + * Select an item in the path. + * + * @since S60 3.2.3 + * @param aIndex index of the item + * @leave The function leaves with one of the system wide error codes, + * if the operation fails + * @panic USER 130, if aIndex is out of bound + */ + IMPORT_C void SelectL(TInt aIndex); + + /** + * Select all of items at top level in the path. + * + * @since S60 3.2.3 + * @leave The function leaves with one of the system wide error codes, + * if the operation fails + */ + IMPORT_C void SelectAllL(); + + /** + * Deselects an item in the path. + * + * @since S60 3.2.3 + * @param aId ID of the item + * @panic USER 0, if aId was not selected + */ + IMPORT_C void Deselect(const TMPXItemId& aId); + + /** + * Deselects an item in the path. + * + * @since S60 3.2.3 + * @param aIndex index of the item + * @panic USER 130, if aIndex is out of bound + * @panic USER 0, if aIndex was not selected + */ + IMPORT_C void Deselect(TInt aIndex); + + /** + * Deselect all of items at top level in the path. + * + * @since S60 3.2.3 + */ + IMPORT_C void DeselectAll(); + + /** + * Removes an item in the path and adjust selection indices accordingly. + * + * @since S60 3.2.3 + * @param aId ID of the item + * @panic USER 0, if aId was not selected + */ + IMPORT_C void Remove(const TMPXItemId& aId); + + /** + * Removes an item in the path and adjust selection indices accordingly. + * + * @since S60 3.2.3 + * @param aIndex index of the item + * @panic USER 0, if aIndex was not selected + */ + IMPORT_C void Remove(TInt aIndex); + + /** + * Queries if item is selected. + * + * @since S60 3.2.3 + * @param aId ID of item + * @return whether selected + */ + IMPORT_C TBool IsSelected(const TMPXItemId& aId) const; + + /** + * Queries if item is selected. + * + * @since S60 3.2.3 + * @param aIndex index of item + * @return whether selected + */ + IMPORT_C TBool IsSelected(TInt aIndex) const; + + /** + * Clears selection. + * + * @since S60 3.2.3 + */ + IMPORT_C void ClearSelection(); + + /** + * Array of currently selected indices. + * + * @since S60 3.2.3 + * @return current selected indices + */ + IMPORT_C TArray Selection() const; + + /** + * Current selected ids. + * + * @since S60 3.2.3 + * @param aIds array of ids returned, id may be duplicated. e.g. music + * playlist can contains an item more than once. + * @leave The function leaves with one of the system wide error codes, + * if the operation fails. + */ + IMPORT_C void SelectionL(RArray& aIds) const; + + /** + * Update the item ID for a particular item. + * + * @since S60 3.2.3 + * @param aIndex index to update + * @param aNewId the item id to set to the index + */ + IMPORT_C void Update( TInt aIndex, TMPXItemId& aNewId ); + +public: // Information about top level + + /** + * Current index. + * + * @since S60 3.2.3 + * @return current index + */ + IMPORT_C TInt Index() const; + + /** + * Current ID. + * + * @since S60 3.2.3 + * @return current ID + */ + IMPORT_C const TMPXItemId& Id() const; + + /** + * Number of items at the top level. + * + * @since S60 3.2.3 + * @return the number of items + */ + IMPORT_C TInt Count() const; + + /** + * The open mode with which to navigate to the next level. + * + * @since S60 3.2.3 + * @return the open mode for next level + */ + IMPORT_C TMPXOpenMode OpenNextMode() const; + + /** + * The open mode with which to navigate to the previous level. + * + * @since S60 3.2.3 + * @return the open mode for previous level + */ + IMPORT_C TMPXOpenMode OpenPreviousMode() const; + + /** + * Index from item id at the top level. + * + * @since S60 3.2.3 + * @param aId item id + * @return index to the item with aId at the top level + */ + IMPORT_C TInt IndexOfId(const TMPXItemId& aId) const; + + /** + * Return the item id for the item at aIndex at the top level. + * + * @since S60 3.2.3 + * @return TMPXItemId if aIndex is valid + KMPXInvalidItemId if invalid + */ + IMPORT_C const TMPXItemId& IdOfIndex( TInt aIndex ) const; + + /** + * Open attributes for next level. + * + * @since S60 3.2.3 + * @panic USER 0 if no level in the path + */ + IMPORT_C const TArray OpenAttributes() const; + + /** + * Retrieve a TArray of the top level items. + * + * @since S60 3.2.3 + * @panic USER 0 if no level in the path + * @return TArray, + */ + IMPORT_C const TArray Items() const; + +public: // Information about other levels + + /** + * Return item index at a specific level. + * + * @since S60 3.2.3 + * @param aLevel level of depth + * @return the index of item + */ + IMPORT_C TInt Index(TInt aLevel) const; + + /** + * Return item id at a specific level. + * + * @since S60 3.2.3 + * @param aLevel level of depth + * @return the id of item + */ + IMPORT_C const TMPXItemId& Id(TInt aLevel) const; + +public: // functions about levels + + /** + * Number of levels into the collection. + * + * @since S60 3.2.3 + * @return the levels count + */ + IMPORT_C TInt Levels() const; + + /** + * Back a level. + * + * @since S60 3.2.3 + * @panic USER 0 if no more level in the path + */ + IMPORT_C void Back(); + + /** + * Append a level. + * + * @since S60 3.2.3 + * @param aIds IDs of items at this level + */ + IMPORT_C void AppendL(const TArray& aIds); + + /** + * Append a level, where only single ID exists or is known. + * + * @since S60 3.2.3 + * @param aId id of item at this level + */ + IMPORT_C void AppendL(const TMPXItemId& aId); + + /** + * Insert an id at top level. + * + * @since S60 3.2.3 + * @param aId the id to be inserted + * @param aPos the position where the id to be inserted. The position is + * relative to zero. + * @leave Leave with system errror code + * @panic USER 131 if a pos is negative or is greater than the number of ids + * at top top level + */ + IMPORT_C void InsertL(const TMPXItemId& aId, TInt aPos); + + /** + * Resets the collection path object. + * removes all node arrays. + * removes all top level ids. + * removes all selection ids. + * + * @since S60 3.2.3 + */ + IMPORT_C void Reset(); + + /* + * Returns a collection path pointing to the container of this path. + * + * @since S60 3.2.3 + * @return CMPXCollectionPath* ownership transferred + */ + IMPORT_C CMPXCollectionPath* ContainerPathL() const; + +public: // Handle update + /** + * Handle collection change. + * + * @since S60 3.2.3 + * @param aCollectionId collection id of changes + * @param aId Id of item change + * @param aDeprecatedId old Id of the item changed + * @param aChange change type + * @param aSelection, on return contains the valid selection + * if the path is invalidated + * @return TMPXPathChangeResult + * + */ + IMPORT_C TInt HandleChange( + const TUid& aCollectionId, + const TMPXItemId& aId, + const TMPXItemId& aDeprecatedId, + CMPXCollectionPath::TMPXCollectionPathChange aChange, + TInt& aSelection); + +public: + + /** + * Externalize a object of this class to steam. + * + * @since S60 3.2.3 + * @param aStream write stream + */ + IMPORT_C void ExternalizeL(RWriteStream& aStream) const; + + /** + * Internalize a object of this class from steam. + * + * @since S60 3.2.3 + * @param aStream read stream + */ + IMPORT_C void InternalizeL(RReadStream& aStream); + +private: + + /** + * C++ default constructor. + * + * @since S60 3.2.3 + */ + CMPXCollectionPath(); + + /** + * 2nd phase constructor. + * + * @since S60 3.2.3 + * @param aPath collection path + */ + void ConstructL(const CMPXCollectionPath& aPath); + + /** + * 2nd phase constructor. + * + * @since S60 3.2.3 + */ + void ConstructL(); + + /** + * 2nd phase constructor. + * + * @since S60 3.2.3 + * @param aStream stream + */ + void ConstructL(RReadStream& aStream); + + /** + * The top level node of the path. + * + * @since S60 3.2.3 + * @panic USER 0 if no level in the path + * @return the top level + */ + CMPXCollectionPathNode& TopLevel(); + + /** + * The top level node of the path. + * + * @since S60 3.2.3 + * @panic USER 0 if no level in the path + * @return the top level + */ + const CMPXCollectionPathNode& TopLevel() const; + +private: + /// Node of path levels + RPointerArray iNodeArray; + /// Additional info of Top Level + RArray iIds; // item ids of top level + RArray iSelection; // selected item indices of top level, sorted array + TMPXItemId iInvalidId; + }; + +#endif // CMPXCOLLECTIONPATH_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxcollectiontype.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxcollectiontype.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2006 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: Encapsulates the supported types for the collection +* +*/ + + +#ifndef CMPXCOLLECTIONTYPE_H +#define CMPXCOLLECTIONTYPE_H + +#include +#include +// CONSTANTS + +/** + * Class to encapsulate supported collection type. + * + * @lib mpxcommon.lib + */ +class CMPXCollectionType : public CBase + { + +public: + /** + * C++ constructor. + * + * @since S60 3.2.3 + */ + IMPORT_C CMPXCollectionType(); + + /** + * C++ constructor. + * + * @since S60 3.2.3 + * @param aUid uid of the collection plugin + * @param aMimeTypes mime types supported by plugin, take over the ownership + * @param aExtensions extensions supported by plugin, take over the ownership + */ + IMPORT_C CMPXCollectionType(const TUid& aUid, + CDesCArray* aMimeTypes, + CDesCArray* aExtensions); + + /** + * virtual destructor. + * + * @since S60 3.2.3 + */ + virtual ~CMPXCollectionType(); + + /** + * Externalize a object of this class to stream. + * + * @since S60 3.2.3 + * @param aStream write stream + */ + IMPORT_C void ExternalizeL(RWriteStream& aStream) const; + + /** + * Internalize a object of this class from stream. + * + * @since S60 3.2.3 + * @param aStream read stream + */ + IMPORT_C void InternalizeL(RReadStream& aStream); + + /** + * Returns the extension. + * + * @since S60 3.2.3 + */ + inline const CDesCArray& Extensions() const; + + /** + * Returns the UID. + * + * @since S60 3.2.3 + */ + inline const TUid& Uid() const; + + /** + * Returns the mime type. + * + * @since S60 3.2.3 + */ + inline const CDesCArray& Mimetypes() const; + +private: // data + TUid iUid; + CDesCArray* iMimeTypes; + CDesCArray* iExtensions; + }; + +#include "mpxcollectiontype.inl" + +#endif // CMPXCOLLECTIONTYPE_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxcollectiontype.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxcollectiontype.inl Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2006 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: Inline functions for accessing a collection type object +* +*/ + + + +// ----------------------------------------------------------------------------- +// ?implementation_description +// ----------------------------------------------------------------------------- +// +inline const CDesCArray& CMPXCollectionType::Extensions() const + { + return *iExtensions; + } + +inline const TUid& CMPXCollectionType::Uid() const + { + return iUid; + } + +inline const CDesCArray& CMPXCollectionType::Mimetypes() const + { + return *iMimeTypes; + } diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxcommandgeneraldefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxcommandgeneraldefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,173 @@ +/* +* Copyright (c) 2006 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: Definitions for command type +* +*/ + + + +#ifndef CMPXCOMMANDGENERALDEFS_H +#define CMPXCOMMANDGENERALDEFS_H + + +#include +#include + +/** +* Content ID identifying general category of content provided +* in the command object and associated attributes. This should +* be supported by ALL command objects as a common base +*/ +const TInt KMPXCommandContentIdGeneral = 0x101FFC48; + +/** +* Attributes supported for KMPXCommandIdGeneral +*/ +/** +* TMPXCommandId, *unique* id of the command +*/ +const TMPXAttributeData KMPXCommandGeneralId = {KMPXCommandContentIdGeneral, 0x01}; +/** +* Optional: Request to block until command is complete +* TBool value +*/ +const TMPXAttributeData KMPXCommandGeneralDoSync = {KMPXCommandContentIdGeneral, 0x02}; +/** + * Optional: TInt, Collection id + */ +const TMPXAttributeData KMPXCommandGeneralCollectionId = {KMPXCommandContentIdGeneral, 0x04}; +/** + * Optional: Unique id from client + */ +const TMPXAttributeData KMPXCommandGeneralSessionId = {KMPXCommandContentIdGeneral, 0x08}; +/** + * Optional: Collection path of source ids + */ +const TMPXAttributeData KMPXCommandGeneralSourceIds = {KMPXCommandContentIdGeneral, 0x10}; +/** + * Optional: Descriptor, Source uri + */ +const TMPXAttributeData KMPXCommandGeneralSourceUri = {KMPXCommandContentIdGeneral, 0x20}; +/** + * Optional: CMPXCollectionPath, Target ids + */ +const TMPXAttributeData KMPXCommandGeneralTargetIds = {KMPXCommandContentIdGeneral, 0x40}; + + +/******************************************************************************* + * ContentID for media command + * + ******************************************************************************/ +const TInt KMPXCommandContentIdMedia = 0x10282974; + +/** + * Attributes supported for KMPXCommandConentIdMedia + */ +/** + * CMPXAttributeSpecs, attribute specs for the media request + */ +const TMPXAttributeData KMPXCommandMediaAttributeSpecs = { KMPXCommandContentIdMedia, 0x01 }; + +/** + * TInt, index to the current item, for multiple selection + */ +const TMPXAttributeData KMPXCommandMediaIndex = { KMPXCommandContentIdMedia, 0x02 }; + +/** + * TDesC, externalized version of a TMPXAttribute array + */ +const TMPXAttributeData KMPXCommandMediaAttribute = { KMPXCommandContentIdMedia, 0x04 }; + +/** + * CMPXFilter, filter for the media request + */ +const TMPXAttributeData KMPXCommandMediaFilter = { KMPXCommandContentIdMedia, 0x08 }; + +/** + * TCapabilitySet, set of capabilities + */ +const TMPXAttributeData KMPXCommandMediaCapbilitySet = { KMPXCommandContentIdMedia, 0x10 }; + +/******************************************************************************* + * Subscription commands + * + ******************************************************************************/ + +/** + * Add Subscription command + */ +const TInt KMPXCommandSubscriptionAdd = 0x10282977; + +/** + * Add subscription attributes + */ +const TMPXAttributeData KMPXCommandSubscriptionAddItems = { KMPXCommandSubscriptionAdd, 0x01 }; + +/** + * Remove subscription command + */ +const TInt KMPXCommandSubscriptionRemove = 0x10282978; + +/** + * Remove subscription attributes + */ +const TMPXAttributeData KMPXCommandSubscriptionRemoveItems = { KMPXCommandSubscriptionRemove, 0x01 }; + +/** + * Remove all subscriptions command + */ +const TInt KMPXCommandSubscriptionRemoveAll = 0x10282979; + + + +/** +* Attributes supported for KMPXCommandIdGeneral. +* +* @deprecated Use the above consts instead +*/ +enum + { + /** + * TMPXCommandId, *unique* id of the command + */ + EMPXCommandGeneralId = 0x01, + + /** + * Optional: Request to block until command is complete + * TBool value + */ + EMPXCommandGeneralDoSync = 0x02, + + /** + * Optional: TInt, Collection id + */ + EMPXCommandGeneralCollectionId = 0x04, + + /** + * Optional: Unique id from client + */ + EMPXCommandGeneralSessionId = 0x08, + + /** + * Optional: Array of Source ids + */ + EMPXCommandGeneralSourceIds = 0x10, + + /** + * Optional: Descriptor, Source uri + */ + EMPXCommandGeneralSourceUri = 0x20 + }; + +#endif // CMPXCOMMANDGENERALDEFS_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxcustomcommandobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxcustomcommandobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2006 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: MPX custom command observer interface definition +* +*/ + + + +#ifndef C_MMPXCUSTOMCOMMANDOBSERVER_H +#define C_MMPXCUSTOMCOMMANDOBSERVER_H + + +// INCLUDES +#include + + +// FORWARD DECLARATIONS + + +// CLASS DECLARATION + +/** + * MPX custom command observer. + * + * @lib mpxcommon.lib + */ +NONSHARABLE_CLASS( MMPXCustomCommandObserver ) + { +public: + + /** + * Handle custom commands. + * + * @since S60 3.2.3 + * @param aUid Command category Uid. Different command set will have + * different Uid to avoid clash. + * @param aCommand Command to be handled. + * @param aData data for the specific command + */ + virtual void HandleCustomCommand( + const TUid& aUid, + const TInt aCommand, + const TDesC8& aData = KNullDesC8 ) = 0; + }; + +#endif // C_MMPXCUSTOMCOMMANDOBSERVER_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxdata.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,340 @@ +/* +* Copyright (c) 2006 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: Manages data and access to the global chunk +* +*/ + + + +#ifndef MMPXDATA_H +#define MMPXDATA_H + +// INCLUDES +#include + +/** + * Base class for managing data in global heap. + * + * @lib mpxcommon.lib + */ +class MMPXData + { +public: + /** + * Defines 'markers' that identify objects from their streamed buffers, e.g. + * if the first 4 bytes of an externalized object constitute the value EMedia, + * then we assume the it is an externalized media object. + */ + enum TMPXObjectType + { + EMedia=0x12343219, + EMediaArray=0x987678ab, + EPath=0x567982fe // Note: This can be removed when NO clients call + // CMPXMedia::Value API for CMPXCollectionPath. + }; +public: + /** + * Create a new implementation of the MMPXData interface. This is thread- + * relative. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + * @return pointer to the implementation object of MMXData + */ + static MMPXData* NewL(TUint aClientHandle); + + /** + * Create a new implementation from an existing MMPXData implementation. + * This is an duplicate copy of the original. + * This is thread-relative. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + * @param aData existing MMPXData implementation. + * @return pointer to the implementation object of MMXData + */ + static MMPXData* NewL(TUint aClientHandle,const MMPXData& aData); + + /** + * Obtain the interface of an existing implementation from the handle. + * This is thread-relative. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + * @param aDataHandle data handle to the MMPXData implementation. + * @return pointer to the implementation object of MMXData + */ + static MMPXData* Data(TUint aClientHandle,TUint aDataHandle); + + /** + * Obtain the interface from a buffer, or NULL if the buffer does + * not contain an implementation of the interface. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + * @param aData buffer which contains the object of MMPXData implementation + * @return pointer to the implementation object of MMXData + */ + static MMPXData* Data(TUint aClientHandle,const TDesC8& aData); + + /** + * Obtains the interface from a buffer, or NULL if the buffer does + * not contain an implementation of the interface. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + * @param aData buffer which contains the object of MMPXData implementation + * @param aSize size of the data buffer + * @return pointer to the implementation object of MMXData + */ + static MMPXData* Data(TUint aClientHandle,TAny* aData,TInt aSize); + + /** + * Handle which represents the current client (thread). + * This should be stored by the client and provided in all methods; + * zero indicates that it has failed. + * + * @since S60 3.2.3 + * @return Client handle of global chunk + */ + static TUint ClientHandle(); + + /** + * To increment the reference count for this client (thread); + * should be called for every media/media array object that + * is not contained within another. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + */ + static void AddClientRef(TUint aClientHandle); + + /** + * To decrement the reference count on this this client (thread). + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + */ + static void ReleaseClient(TUint aClientHandle); + + /** + * Gets the total size and the currently used size of the global heap. + * + * @since S60 3.2.3 + * @param aTotal Total size of memory (out parameter) + * @param aUsed Used size of memory (out parameter) + */ + static void HeapMemoryInfoL( TInt& aTotal, TInt& aUsed ); + + + /** + * Lock the heap. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + */ + static void LockHeap(TUint aClientHandle); + + /** + * Unlock the heap. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + */ + static void UnlockHeap(TUint aClientHandle); + +public: + /** + * Handle to the object implementing this interface; can + * be used to reference the object. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + * @return data handle + */ + virtual TUint DataHandle(TUint aClientHandle)=0; + + /** + * To increment the reference count on this data. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + */ + virtual void AddRef(TUint aClientHandle)=0; + + /** + * To decrement the reference count on this data; when zero, + * the data is deleted. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + */ + virtual void Release(TUint aClientHandle)=0; + + /** + * Gets the data value by index. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + * @param aIndex index of the data item + * @return raw data + */ + virtual TPtrC8 Value(TUint aClientHandle,TInt aIndex)=0; + + /** + * Gets attribute by index. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + * @param aIndex index of the data item + * @return attribute of the data + */ + virtual const TMPXAttribute& Attribute(TUint aClientHandle,TInt aIndex)=0; + + /** + * Gets object type by index. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + * @param aIndex index of the data item + * @return object type of the data + */ + virtual TMPXAttributeType AttributeType(TUint aClientHandle,TInt aIndex)=0; + + /** + * Gets supported content ids. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + * @return array of supported content ids + */ + virtual TArray SupportedIds(TUint aClientHandle)=0; + + /** + * Sets supported content ids. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + * @param aSupportedIds array of supported content ids + * @return KErrNone if succeeded. Otheriwse system error code + */ + virtual TInt SetSupportedIds(TUint aClientHandle, + const TArray& aSupportedIds)=0; + + /** + * Delete a data item. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + * @param aIndex index of the data item + */ + virtual void Delete(TUint aClientHandle,TInt aIndex)=0; + + /** + * Set a data item. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + * @param aAttr media attribute + * @param aType object type + * @param aData raw data + * @param aIndex index of the data item + */ + virtual void Set(TUint aClientHandle, + const TMPXAttribute& aAttr, + TMPXAttributeType aType, + const TDesC8& aData, + TInt aIndex)=0; + + /** + * Insert a data item. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + * @param aAttr media attribute + * @param aType object type + * @param aData raw data + * @param aIndex index of the data item + * @return KErrNone if succeeded. Otheriwse system error code + */ + virtual TInt Insert(TUint aClientHandle, + const TMPXAttribute& aAttr, + TMPXAttributeType aType, + const TDesC8& aData, + TInt aIndex)=0; + + /** + * Append a data item. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + * @param aAttr media attribute + * @param aType object type + * @param aData raw data + * @return KErrNone if succeeded. Otheriwse system error code + */ + virtual TInt Append(TUint aClientHandle, + const TMPXAttribute& aAttr, + TMPXAttributeType aType, + const TDesC8& aData)=0; + + /** + * Remove all data items. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + */ + virtual void Reset(TUint aClientHandle)=0; + + /** + * Returns number of data items. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + * @return number of data items. + */ + virtual TInt Count(TUint aClientHandle)=0; + + /** + * Returns index of the data item with the media attribute. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + * @param aAttr media attribute + * @return index of the data items with the attribute + */ + virtual TInt Index(TUint aClientHandle,const TMPXAttribute& aAttr)=0; + + /** + * Returns index of the data item with aUid. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + * @param aUid uid of the data item + * @return index of the data items with the attribute + */ + virtual TInt Index(TUint aClientHandle,TInt aUid)=0; + + /** + * Returns uid by index. + * + * @since S60 3.2.3 + * @param aClientHandle client handle to the global chunk + * @param aIndex index of the data item + * @return uid of the data item + */ + virtual TInt Uid(TUint aClientHandle,TInt aIndex)=0; + }; + +#endif // MMPXDATA_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxdrmmediautility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxdrmmediautility.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,166 @@ +/* +* Copyright (c) 2006 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: Encapsulates DRM Media +* +*/ + + + +#ifndef CMPXDRMMEDIAUTILITY_H +#define CMPXDRMMEDIAUTILITY_H + +#include +#include +#include +#include +using namespace ContentAccess; + +// CONSTANTS +_LIT( KMPXWDRMCafAgentName, "PV WMA CAF Agent" ); +_LIT( KMPXOMACafAgentName, "OMA DRM Agent" ); +_LIT( KMPXS60WMDRMCafAgent, "WM DRM Agent"); + +enum TDrmConsumeType + { + EMPXDrmConsumeNone, + EMPXDrmConsumeStart, + EMPXDrmConsumePause, + EMPXDrmConsumeContinue, + EMPXDrmConsumeFinish, + EMPXDrmConsumeStartOrContinue + }; + +// FORWARD DECLARATION +class CMPXMedia; +class CMPXDrmMediaAgent; + + +/** +* CMPXDrmMediaUtility class declaration. +* +* @lib mpxcommon.lib +*/ +NONSHARABLE_CLASS(CMPXDrmMediaUtility) : public CBase + { +private: + enum TMPXDrmMediaAgents + { + EOmaDrmAgent, + EWmaDrmAgent + }; + +public: // Constructors and Destructors + /** + * Two-phase constructor. + * + * @since S60 3.2.3 + * @return object created + */ + IMPORT_C static CMPXDrmMediaUtility* NewL(); + + /** + * Two-phase constructor. + * + * @since S60 3.2.3 + * @return object created + */ + IMPORT_C static CMPXDrmMediaUtility* NewLC(); + + /** + * Destructor. + * + * @since S60 3.2.3 + */ + IMPORT_C virtual ~CMPXDrmMediaUtility(); + +public: // New Functions + /** + * Initialize utility using a filename. + * + * @since S60 3.2.3 + * @param aFileName file name + */ + IMPORT_C void InitL(const TDesC& aFileName); + + /** + * Initialize utility using a file handle. + * + * @since S60 3.2.3 + * @param aFile file handle + */ + IMPORT_C void InitL(RFile& aFile); + + /** + * Gets media object with the given attributes. + * + * @since S60 3.2.3 + * @param aAttributes attributes to retreive + * @return CMPXMedia object with the specified attributes + * NULL if the utility has not been initialized with a DRM file + */ + IMPORT_C const CMPXMedia* GetMediaL(TUint aAttributes); + + /** + * Consumes the rights for the current media according + * to the specified consume type. + * + * @since S60 3.2.3 + * @param aType Type of consumption to execute + */ + IMPORT_C void ConsumeL(TDrmConsumeType aType); + + /** + * Closes and unitializes the utility. + * + * @since S60 3.2.3 + * @return void + */ + IMPORT_C void Close(); + +private: // Constructors + /** + * C++ default constructor. + * + * @since S60 3.2.3 + */ + CMPXDrmMediaUtility(); + + /** + * 2nd phase contructor. + * + * @since S60 3.2.3 + */ + void ConstructL(); + +private: // New Functions + /** + * Finds an agent to handle the content. + * + * @since S60 3.2.3 + * @param aContent content to find agent for + */ + void FindAgent( CContent& aContent ); + +private: // New Functions + +private: // Data + // Array of drm agents to use + RPointerArray iAgents; + CMPXDrmMediaAgent* iCurrentAgent; + TBool iConsumeStarted; + CMPXMedia* iDefaultMedia; + RFs iFs; + }; + +#endif // CMPXDRMMEDIAUTILITY_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxmedia.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxmedia.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,513 @@ +/* +* Copyright (c) 2006 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: Encapsulates media +* +*/ + + + +#ifndef CMPXMEDIA_H +#define CMPXMEDIA_H + +// INCLUDES +#include +#include +#include + +// FORWARD DECLARATIONS + +/** +* Encapsulates arbitrary data. The ID is a unique identifier for the type +* of content contained within this object: there may be several supported IDs. +* Supported IDs provide a means whereby a client who receives a media object +* can request additional media objects from the same source using another of +* the supported IDs. Attributes are referenced by flags which are unique to +* the type of content contained in the object (i.e ID). The media object may +* contain the full range of attribute values or some subset, depending both +* on the attributes requested by the client and the capabilities of the source +* of the data. +* +* @lib mpxcommon.lib +*/ + +class CMPXMedia : public CMPXMediaBase + { +public: + /** + * Two-phased constructor. + * + * @since S60 3.2.3 + * @param aSupportedIds, denotes all possible content that can be provided + * by the source of this media object + * @return new instance of object + */ + IMPORT_C static CMPXMedia* NewL(const TArray& aSupportedIds); + + /** + * Two-phased constructor. + * @since S60 3.2.3 + * @return new instance of object + */ + IMPORT_C static CMPXMedia* NewL(); + + /** + * Two-phased constructor. + * + * @since S60 3.2.3 + * @param aStream create object from stream + * @return new instance of object + */ + IMPORT_C static CMPXMedia* NewL(RReadStream& aStream); + + /** + * Two-phased constructor. Creates new instance of CMPXMedia + * which shares underlying data from aMedia; lifetime of + * data is reference counted, i.e. all CMPXMedia instances which + * reference same data must be deleted before underlying data is deleted. + * + * @since S60 3.2.3 + * @param aMedia create object from media + * @return new instance of object + */ + IMPORT_C static CMPXMedia* NewL(const CMPXMedia& aMedia); + + /** + * Two-phased constructor. Creates object from existing data handle. + * The data handle is used to indentify the data in a media object. + * + * @since S60 3.2.3 + * @param aDataHandle handle to the data + * @return new instance of object + */ + IMPORT_C static CMPXMedia* NewL(TInt aDataHandle); + + /** + * Two-phased constructor. Creates new instance of CMPXMedia + * which duplicates underlying data from aMedia. + * + * @since S60 3.2.3 + * @param aMedia create object from media + * @return new instance of object + */ + IMPORT_C static CMPXMedia* CopyL(const CMPXMedia& aMedia); + + /** + * Destructor. + * + * @since S60 3.2.3 + */ + IMPORT_C ~CMPXMedia(); + + /** + * Assignment operator. + * It copies data handle and increase the reference count of the aMedia only. + * + * @since S60 3.2.3 + * @param aMedia source media + * @return reference to updated object + */ + IMPORT_C CMPXMedia& operator=(const CMPXMedia& aMedia); + + /** + * Gets the total size and the currently used size of the global heap. + * + * @since S60 3.2.3 + * @param aTotal Total size of memory (out parameter) + * @param aUsed Used size of memory (out parameter) + */ + IMPORT_C static void HeapMemoryInfoL( TInt& aTotal, TInt& aUsed ); + + public: + /** + * Possible content IDs that denote the type of content the source of this + * object can supply. + * + * @since S60 3.2.3 + * @return IDs indicating type of content that can be contained within + * this object + */ + IMPORT_C const TArray SupportedIds() const; + + /** + * The attributes provided in this media object. + * + * @since S60 3.2.3 + * @return array of attributes indicating the attributes for the values + * contained in this object + */ + IMPORT_C const TArray Attributes() const; + + /** + * Checks if this object contains the value for a given attribute. + * + * @since S60 3.2.3 + * @param aAttribute the specified attribute + * @return whether supported or not + */ + IMPORT_C TBool IsSupported(const TMPXAttribute& aAttribute) const; + + /** + * The number of attribute values provided in this media object. + * + * @since S60 3.2.3 + * @return count of attribute values in this object + */ + IMPORT_C TInt Count() const; + + /** + * The attribute for a specific index. + * + * @since S60 3.2.3 + * @param aIndex the index from 0 to Count()-1, covering all the values + * provided in this object + * @return the attribute corresponding to the value at the specified index + */ + IMPORT_C const TMPXAttribute& Attribute(TInt aIndex) const; + + /** + * The attributes set for a specific content id. + * + * @since S60 3.2.3 + * @param aContentId content Id + * @return the attributes set corresponding to content id + */ + IMPORT_C TUint AttributesSet(TInt aContentId) const; + + /** + * The index of a given attribute. + * + * @since S60 3.2.3 + * @param aAttribute the specified attribute + * @return the index, or KErrNotFound if not present in this object + */ + IMPORT_C TInt Index(const TMPXAttribute& aAttribute) const; + + /** + * The type of data stored for the index. + * + * @since S60 3.2.3 + * @param aIndex the index whose type of value is queried + * @return the data type at that index + */ + IMPORT_C TMPXAttributeType Type(TInt aIndex) const; + + /** + * The type of data stored for the attribute. + * + * @since S60 3.2.3 + * @param aAttribute the attribute whose type of value is queried + * @return the data type of the attribute, + * EMPXTypeUnknown returned if the attribute does not exist + */ + IMPORT_C TMPXAttributeType Type(const TMPXAttribute& aAttribute) const; + + /** + * Clears all the attributes and values. + * + * @since S60 3.2.3 + */ + IMPORT_C void Reset(); + + /** + * Deletes a given attribute and its value; No effect + * if attribute is not present. + * + * @since S60 3.2.3 + * @param aAttribute the attribute to delete + */ + IMPORT_C void Delete(const TMPXAttribute& aAttribute); + + /** + * Deletes a given attribute and its value; No effect + * if attribute is not present. + * + * @since S60 3.2.3 + * @param aIndex the index from 0 to Count()-1 + */ + IMPORT_C void Delete(TInt aIndex); + + /** + * The value for a specific attribute. + * + * @since S60 3.2.3 + * @param aAttribute the attribute whose value is queried + * @return value of the attribute + */ + IMPORT_C const TDesC& ValueText(const TMPXAttribute& aAttribute) const; + + /** + * Add a new attribute value to this object, or modifies existing + * value if already present. + * + * @since S60 3.2.3 + * @param aAttribute the attribute whose value is added/modified + * @param aValue text value to be set + */ + IMPORT_C void SetTextValueL(const TMPXAttribute& aAttribute, + const TDesC& aValue); + + /** + * Merges in the attributes of the provided media. + * + * @since S60 3.2.3 + * @param aMedia Media object with attributes to merge in + */ + IMPORT_C void MergeMediaL( const CMPXMedia& aMedia ); + + /** + * Compares if the specified media's attribute matches this one. + * + * @since S60 3.2.3 + * @param aMedia Media object to match + * @param aAtt Attribute to match + * @return ETrue if matches, else EFalse + */ + IMPORT_C TBool Match( + const CMPXMedia& aMedia, + const TMPXAttribute& aAtt ); + + public: + + /** + * The value for a specific attribute. it may return NULL + * + * This method supports all T types and CMPXMediaBase classes like + * CMPXMedia and CMPXMediaArray. + * + * This method returns NULL (ASSERT happens on UDEB image) for CBase + * objects other than CMPXMedia, CMPXMediaArray. + * + * @since S60 3.2.3 + * @param aAttribute the attribute whose value is queried + * @return value of the attribute, or NULL if not present + * Note: Ownership is not transferred to caller + * @deprecated if an error code is set for the attribue, use method: + * CMPXMedia::ValueTObjectL(const TMPXAttribute& aAttribute), + * CMPXMedia::ValueNoNewLCObjectL(const TMPXAttribute& aAttribute), + * CMPXMedia::ValueCObjectL(const TMPXAttribute& aAttribute). + * + * For CMPXCollectionPath, use method: + * CMPXMedia::ValueCObjectL(const TMPXAttribute& aAttribute). + */ + template + inline T* Value(const TMPXAttribute& aAttribute) const; + + /** + * A copy of the value for a specific attribute. + * If the media attribute does not exist, the default T object will be returned. + * + * @since S60 3.2.3 + * @param aAttribute the attribute whose value is queried + * @return copy of the value of the attribute + */ + template + inline T ValueTObjectL(const TMPXAttribute& aAttribute) const; + + /** + * Copy an object out of media object. + * Note: C++ default contructor of class C must be public. + * + * @since S60 3.2.3 + * @param aAttribute the attribute whose value is queried + * @return new copy object of class C + */ + template + inline C* ValueNoNewLCObjectL(const TMPXAttribute& aAttribute) const; + + /** + * Copy an object out of media object. + * Note: class C must implement the function NewL() and streamable. + * + * @since S60 3.2.3 + * @param aAttribute the attribute whose value is queried + * @return new copy object of class C + */ + template + inline C* ValueCObjectL(const TMPXAttribute& aAttribute) const; + + /** + * Add a new attribute value to this object, or modifies existing + * value if already present. + * + * @since S60 3.2.3 + * @param aAttribute the attribute whose value is added/modified + * @param aValue attribute value of the T object. + */ + template + inline void SetTObjectValueL(const TMPXAttribute& aAttribute, T aValue); + + /** + * Add a new attribute value to this object, or modifies existing + * value if already present. + * + * @since S60 3.2.3 + * @param aAttribute the attribute whose value is added/modified + * @param aValue pointer to the C object + */ + template + inline void SetNoNewLCObjectL(const TMPXAttribute& aAttribute,C* aValue); + + /** + * Add a new attribute value to this object, or modifies existing + * value if already present. + * Uses CTypeObject::NewL( RReadStream& aStream ). + * + * @since S60 3.2.3 + * @param aAttribute the attribute whose value is added/modified + * @param aValue pointer to the C object + */ + template + inline void SetCObjectValueL(const TMPXAttribute& aAttribute,C* aValue); + + /** + * A representation (handle) of the data stored in this object. + * + * @since S60 3.2.3 + * @return TInt handle to the data + */ + inline TInt Data() const; + + /** + * Set an error code to an attribute. + * + * @since S60 3.2.3 + * @param aAttribute the attribute whose error code is setted. + * @param aError error code of the attribute. + * Note: if error code is set for an attribute, call to Value for + * the attribute will return NULL. You MUST be careful to check the + * return value of Value. The Value is deprecated for this reason + * and you should use ValueTObject instead. + */ + IMPORT_C void SetErrorL(const TMPXAttribute& aAttribute, TInt aError); + + /** + * Get the error code of an attribute. + * + * @since S60 3.2.3 + * @param aAttribute the attribute whose error code is retrieved. + * @return TInt error code of the attribute, or KErrNone if no error code is set. + */ + IMPORT_C TInt Error(const TMPXAttribute& aAttribute) const; + +public: + + /** + * Externalize media object. + * + * @since S60 3.2.3 + * @param aStream write stream + */ + IMPORT_C void ExternalizeL(RWriteStream& aStream) const; + + /** + * Internalize media object. + * + * @since S60 3.2.3 + * @param aStream read stream + */ + IMPORT_C void InternalizeL(RReadStream& aStream); + +private: + + /** + * 2nd phase contructor. + * + * @since S60 3.2.3 + * @param aSupportedIds support content ids + */ + void ConstructL(const TArray& aSupportedIds); + + /** + * 2nd phase contructor. + * + * @since S60 3.2.3 + * @param aStream read stream + */ + void ConstructL(RReadStream& aStream); + +private: + /** + * Set data. + * + * @since S60 3.2.3 + * @param aAttribute the attribute whose value is queried + * @param aValue the value of the media attribute + * @param aType object type of the media attribute + * + */ + IMPORT_C void SetValueL(const TMPXAttribute& aAttribute, + const TDesC8& aValue, + TMPXAttributeType aType); + + /** + * The value for a specific attribute. + * + * @since S60 3.2.3 + * @param aAttribute the attribute whose value is queried + * @return value of the attribute, or NULL if not present + * Note: ownerhip of returned pointer is not transferred. + */ + IMPORT_C TAny* ValuePtr(const TMPXAttribute& aAttribute) const; + + + /** + * Get the binary value for a specific attribute. + * + * @since S60 3.2.3 + * @param aAttribute the attribute whose value is queried + * @return type of the attribute or EMPXTypeUnknown + * if not present + */ + IMPORT_C TMPXAttributeType GetValue(const TMPXAttribute& aAttribute, TDes8& aValue) const; + +private: + /** + * Reconstructs local attribute array. + * + * @since S60 3.2.3 + */ + void RefreshAttributes(); + + /** + * Frees all local data. + * + * @since S60 3.2.3 + */ + void ResetLocal(); + + /** + * Copy an object out of a descriptor buffer. + * Note: Cbased class must implement the function NewL(). + * + * @since S60 3.2.3 + * @return new copy object of class T + */ + template + inline T* ValueL(const TDesC8& aData) const; + + /** + * Copy an object out of media object. + * + * @since S60 3.2.3 + * @return pointer to new copy of object, ownership transferred + */ + TAny* ValueCObjectL(const TDesC8& aData) const; + +private: + RArray iAttributes; + }; + +#include "mpxmedia.inl" + +#endif // CMPXMEDIA_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxmedia.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxmedia.inl Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,168 @@ +/* +* Copyright (c) 2006 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: Inline functions for media object +* +*/ + + + +// ----------------------------------------------------------------------------- +// The value for a specific attribute +// ----------------------------------------------------------------------------- +// +template +inline T CMPXMedia::ValueTObjectL(const TMPXAttribute& aAttribute) const + { + TPckgBuf v; + TMPXAttributeType type = GetValue(aAttribute, v); + ASSERT(type == EMPXTypeTObject || type == EMPXTypeTInt || type == EMPXTypeUnknown); + return v();// creates empty object if none exists! + } + +// ----------------------------------------------------------------------------- +// The value for a specific attribute +// ----------------------------------------------------------------------------- +// +template +inline C* CMPXMedia::ValueNoNewLCObjectL(const TMPXAttribute& aAttribute) const + { + ASSERT(iData&&iClientHandle); + if (Type(aAttribute)==EMPXTypeError) + return NULL; + TInt i=iData->Index(iClientHandle,aAttribute); + TPtrC8 data=iData->Value(iClientHandle,i); + C* obj=NULL; + TInt s=data.Size(); + if (s) + { + CBufBase* b=CBufFlat::NewL(s); + CleanupStack::PushL(b); + b->ResizeL(s); + b->Write(0,data,s); + ::CreateFromBufferL(*b,obj); + CleanupStack::PopAndDestroy(b); + } + else + { + // This construction is not always possible (e.g. CDesCArray) + // obj=new(ELeave)C; + } + return obj; + } + +// ----------------------------------------------------------------------------- +// The value for a specific attribute +// ----------------------------------------------------------------------------- +// +template +inline C* CMPXMedia::ValueCObjectL(const TMPXAttribute& aAttribute) const + { + ASSERT(iData&&iClientHandle); + if (Type(aAttribute)==EMPXTypeError) + return NULL; + TInt i=iData->Index(iClientHandle,aAttribute); + TPtrC8 data=iData->Value(iClientHandle,i); + return ValueL(data); + } + +// ----------------------------------------------------------------------------- +// CMPXMedia::ValueL +// ----------------------------------------------------------------------------- +// +template +inline T* CMPXMedia::ValueL(const TDesC8& aData) const + { + T* obj=NULL; + TInt s=aData.Size(); + if (s) + { + CBufBase* b=CBufFlat::NewL(s); + CleanupStack::PushL(b); + b->ResizeL(s); + b->Write(0,aData,s); + ::NewFromBufferL(*b,obj); + CleanupStack::PopAndDestroy(b); + } + return obj; + } + +// ----------------------------------------------------------------------------- +// The value for a specific attribute +// ----------------------------------------------------------------------------- +// +template +inline T* CMPXMedia::Value(const TMPXAttribute& aAttribute) const + { + if (Type(aAttribute)==EMPXTypeError) + return NULL; + return (T*)ValuePtr(aAttribute); + } + +// ----------------------------------------------------------------------------- +// Add a new attribute value to this object, or modifies existing +// value if already present +// ----------------------------------------------------------------------------- +// +template +inline void CMPXMedia::SetTObjectValueL(const TMPXAttribute& aAttribute,T aValue) + { + TPtrC8 value((TUint8*)&aValue,sizeof(T)); + SetValueL(aAttribute,value,EMPXTypeTObject); + } + +// ----------------------------------------------------------------------------- +// Add a new attribute value to this object, or modifies existing +// value if already present +// ----------------------------------------------------------------------------- +// +template +inline void CMPXMedia::SetNoNewLCObjectL( + const TMPXAttribute& aAttribute,C* aValue) + { + SetCObjectValueL(aAttribute,aValue); + } + +// ----------------------------------------------------------------------------- +// Add a new attribute value to this object, or modifies existing +// value if already present +// ----------------------------------------------------------------------------- +// +template +inline void CMPXMedia::SetCObjectValueL( + const TMPXAttribute& aAttribute,C* aValue) + { + if (aValue) + { + CBufBase* b=NULL; + ::CreateBufferL(*aValue,b); + CleanupStack::PushL(b); + SetValueL(aAttribute,b->Ptr(0),EMPXTypeCObject); + CleanupStack::PopAndDestroy(b); + } + else + { + SetValueL(aAttribute,KNullDesC8,EMPXTypeCObject); + } + } + +// ----------------------------------------------------------------------------- +// CMPXMedia::Data +// ----------------------------------------------------------------------------- +// +inline TInt CMPXMedia::Data() const + { + return static_cast(iDataHandle); + } + +// END OF FILE diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxmediaarray.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxmediaarray.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,279 @@ +/* +* Copyright (c) 2006 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: Encapsulates array of media objects +* +*/ + + + +#ifndef CMPXMEDIAARRAY_H +#define CMPXMEDIAARRAY_H + + +#include "mpxmediabase.h" + +class CMPXMedia; + +/** +* Array of media objects. +* +* @lib mpxcommon.lib +*/ +class CMPXMediaArray : public CMPXMediaBase + { +public: + + /** + * Two-phased constructor. + * + * @since S60 3.2.3 + * @return new instance of object + */ + IMPORT_C static CMPXMediaArray* NewL(); + + /** + * Two-phased constructor. + * + * @since S60 3.2.3 + * @param aArray array to copy + * @return new instance of object + */ + IMPORT_C static CMPXMediaArray* NewL(const CMPXMediaArray& aArray); + + /** + * Destructor. + * + * @since S60 3.2.3 + */ + IMPORT_C ~CMPXMediaArray(); + + /** + * Total number of objects contained in array. + * + * @since S60 3.2.3 + * @return number of contained media objects + */ + IMPORT_C TInt Count() const; + + /** + * Array assessor. + * This method returns NULL if local heap is out of memory. Clients should + * check returned pointer before using it. + * + * @since S60 3.2.3 + * @param aIndex index into the array + * @return media object at index, ownership not transferred + */ + IMPORT_C CMPXMedia* operator[](TInt aIndex) const; + + /** + * Get a pointer to the media object at the specified position within the array. + * + * @since S60 3.2.3 + * @param aIndex index into the array + * @leave KErrNoMemory if local heap is out of memory or other system error. + * @assert User 0 is the aIndex is out of bound + * @return media object at index, ownership not transferred + */ + IMPORT_C CMPXMedia* AtL(TInt aIndex) const; + + /** + * Appends media object to array. + * Note: Ownership of aMedia transferred. + * + * @since S60 3.2.3 + * @param aMedia object to add to the array + */ + IMPORT_C void AppendL(const CMPXMedia* aMedia); + + /** + * Appends media object to array. + * A new media object will be copied from aMedia. The new media object + * created on global heap and added into the array. + * + * @since S60 3.2.3 + * @param aMedia object to add to the array + */ + IMPORT_C void AppendL(const CMPXMedia& aMedia); + + /** + * Resets the media array. + * + * @since S60 3.2.3 + */ + IMPORT_C void Reset(); + + /** + * Removes the object pointer at the specified + * position from the array and deletes the + * object whose pointer is removed. + * + * @since S60 3.2.3 + * @param aIndex The position within the array + * from where the object pointer is to be + * removed. The position is relative to + * zero, i.e. zero implies that a pointer + * at the beginning of the array is to be + * removed. + */ + IMPORT_C void Remove(TInt aIndex); + + /** + * Inserts the object pointer into the array at + * the specified position. + * Note: Ownership of aMedia transferred. + * + * @since S60 3.2.3 + * @param aMedia object to be inserted to the + * array + * @param aPos the position within the array + * where the object pointer is to be inserted. + * The position is relative to zero, i.e. + * zero implies that a pointer is inserted + * at the beginning of the array. + * USER 131, if aPos is negative, or is + * greater than the number of object + * pointers currently in the array. + * @return KErrNone, if the insertion is + * successful, otherwise one of the system + * wide error codes. + * @leave The function leaves with one of the system wide error codes, + */ + IMPORT_C TInt Insert(const CMPXMedia *aMedia, TInt aPos); + + /** + * Inserts the object pointer into the array at + * the specified position. + * A new media object will be copied from aMedia. The new media object + * created on global heap and added into the array. + * + * @since S60 3.2.3 + * @param aMedia object to be inserted to the + * array + * @param aPos the position within the array + * where the object pointer is to be inserted. + * The position is relative to zero, i.e. + * zero implies that a pointer is inserted + * at the beginning of the array. + * USER 131, if aPos is negative, or is + * greater than the number of object + * pointers currently in the array. + * @return KErrNone, if the insertion is + * successful, otherwise one of the system + * wide error codes. + * @leave The function leaves with one of the system wide error codes, + */ + IMPORT_C TInt Insert(const CMPXMedia& aMedia, TInt aPos); + + /** + * Inserts the object pointer into the array at + * the specified position. The function leaves + * with one of the system wide error codes, if + * the operation fails. + * Note: Ownership of aMedia transferred. + * + * @since S60 3.2.3 + * @param aMedia object to be inserted to the + * array + * @param aPos the position within the array + * where the object pointer is to be inserted. + * The position is relative to zero, i.e. + * zero implies that a pointer is inserted + * at the beginning of the array. + * USER 131, if aPos is negative, or is + * greater than the number of object + * pointers currently in the array. + */ + IMPORT_C void InsertL(const CMPXMedia *aMedia, TInt aPos); + + /** + * Inserts the object pointer into the array at + * the specified position. The function leaves + * with one of the system wide error codes, if + * the operation fails. + * A new media object will be copied from aMedia. The new media object + * created on global heap and added into the array. + * + * @since S60 3.2.3 + * @param aMedia object to be inserted to the + * array + * @param aPos the position within the array + * where the object pointer is to be inserted. + * The position is relative to zero, i.e. + * zero implies that a pointer is inserted + * at the beginning of the array. + * USER 131, if aPos is negative, or is + * greater than the number of object + * pointers currently in the array. + */ + IMPORT_C void InsertL(const CMPXMedia& aMedia, TInt aPos); + + /** + * Sets the value at a specified position; the previous + * value is deleted. + * + * @since S60 3.2.3 + * @param aMedia object to be set to the + * array + * @param aPos the position within the array + * where the object pointer is to be set. + * The position is relative to zero, i.e. + * zero implies that a pointer is inserted + * at the beginning of the array. + * USER 131, if aPos is negative, or is + * greater than the number of objects + * currently in the array. + */ + IMPORT_C void Set(const CMPXMedia& aMedia, TInt aPos); + +public: + /** + * Externalize media objects. + * @since S60 3.2.3 + * @param aStream write stream + */ + IMPORT_C void ExternalizeL(RWriteStream& aStream) const; + + /** + * Internalize media objects. + * + * @since S60 3.2.3 + * @param aStream read stream + */ + IMPORT_C void InternalizeL(RReadStream& aStream); + +private: + /** + * Value at a specific index. + * + * @since S60 3.2.3 + */ + CMPXMedia* Value(TInt aIndex) const; + + /** + * Value at a specific index. + * + * @since S60 3.2.3 + */ + CMPXMedia* ValueL(TInt aIndex) const; + + /** + * Inserts/Updates a value at aPos. + * + * @since S60 3.2.3 + */ + TInt AddToArray(const CMPXMedia& aMedia,TInt aPos,TBool aReplace=EFalse); + }; + +#endif // CMPXMEDIAARRAY_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxmediaaudiodefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxmediaaudiodefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2006 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: Definitions for audio media type +* +*/ + + + +#ifndef CMPXMEDIAAUDIODEFS_H +#define CMPXMEDIAAUDIODEFS_H + + +#include +#include + +// CONSTANTS +/** +* Content ID identifying audio category of content provided +* in the media object and associated attributes. +*/ + +const TInt KMPXMediaIdAudio=0x101FFC41; + +/** +* Attributes supported for KMPXMediaIdAudio +*/ +const TMPXAttributeData KMPXMediaAudioBitrate = {KMPXMediaIdAudio, 0x01}; // TInt +const TMPXAttributeData KMPXMediaAudioSamplerate = {KMPXMediaIdAudio, 0x02}; // TInt +const TMPXAttributeData KMPXMediaAudioNumberOfChannels = {KMPXMediaIdAudio, 0x04}; // TInt +const TMPXAttributeData KMPXMediaAudioAudioCodec = {KMPXMediaIdAudio, 0x08}; // TInt +const TMPXAttributeData KMPXMediaAudioAudioAll = {KMPXMediaIdAudio, 0xffffffff}; + +/** +* Attributes supported for KMPXMediaIdAUdio. +* +* @deprecated Use the above consts. +*/ +enum + { + EMPXMediaAudioBitrate=0x01, // TInt + EMPXMediaAudioSamplerate=0x02, // TInt + EMPXMediaAudioNumberOfChannels=0x04, // TInt + EMPXMediaAudioCodec=0x08, // TInt + EMPXMediaAudioAll=0xffffffff + }; + +#endif // CMPXMEDIAAUDIODEFS_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxmediabase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxmediabase.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,229 @@ +/* +* Copyright (c) 2006, 2007 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: Encapsulates media base class +* +*/ + + + +#ifndef CMPXMEDIABASE_H +#define CMPXMEDIABASE_H + +// INCLUDES +#include +#include +#include + +// FORWARD DECLARATIONS + +/** +* Base class of global data classes. +* +* @lib mpxcommon.lib +*/ +NONSHARABLE_CLASS(CMPXMediaBase) : public CBase + { +protected: + /** + * Encapsulates a local value, uid and corresponding attribute type. + * + * @lib mpxcommon.lib + */ + class TValue + { + public: + /** + * C++ constuctor. + * + * @since S60 3.2.3 + * @param aValue pointer to the object of the media attribute + * @param aUid uid of the object + * @param aType type of the media attribute + */ + inline TValue(TAny* aValue,TInt aUid,TMPXAttributeType aType); + + public: + TAny* iValue; + TInt iUid; + TMPXAttributeType iType; + }; +protected: + /** + * C++ default constructor. + * + * @since S60 3.2.3 + */ + CMPXMediaBase(); + + /** + * Destructor. + * + * @since S60 3.2.3 + */ + ~CMPXMediaBase(); + + /** + * 2nd phase contructor. + * + * @since S60 3.2.3 + */ + void ConstructL(); + + /** + * 2nd phase contructor. + * + * @since S60 3.2.3 + * @param aBase media base object to be copied + */ + void ConstructL(const CMPXMediaBase& aBase); + + /** + * 2nd phase contructor. + * + * @since S60 3.2.3 + * @param aDataHandle data handle to the global object to be copied + */ + void ConstructL(TInt aDataHandle); + + /** + * 2nd phase contructor. + * + * @since S60 3.2.3 + * @param aDataHandle data handle to the global oject to be copied + * @param aData data object to be copied + * @leave KErrArgument DataHandle is zero + */ + void ConstructL(TInt aDataHandle,MMPXData& aData); + + /** + * 2nd phase contructor. + * + * @since S60 3.2.3 + * @param aBase media base object to be copied. Deep copy. + */ + void CopyConstructL(const CMPXMediaBase& aBase); + +protected: + /** + * Clears all data associated with this object; ready to + * be assigned new data. + * + * @since S60 3.2.3 + */ + void Clear(); + + /** + * Clears locally cached contents. + * + * @since S60 3.2.3 + */ + virtual void ResetLocal(); + + /** + * Locally stored value, or NULL if not stored locally. + * + * @since S60 3.2.3 + * @param aUid uid of the media attribute + * @return TValue object which holds local copy of the object + */ + const TValue* LocalValue(TInt aUid) const; + + /** + * Set locally held data. + * + * @since S60 3.2.3 + * @param aValue value to be held + * @return KErrNone or KErrNoMemory + */ + int SetLocal(const TValue& aValue); + + /** + * Delete locally by index. + * + * @since S60 3.2.3 + * @param aIndex index to the values array + */ + void DeleteLocal(TInt aIndex); + + /** + * Delete a pointer. + * + * @since S60 3.2.3 + * @param aValue value to be deleted + * @aType media attribute type + */ + void DeletePtr(TAny* aValue,TMPXAttributeType aType); + + /** + * Externalize media object. + * + * @since S60 3.2.3 + * @param aStream reference to the stream object + * @param aType object type + */ + void DoExternalizeL(RWriteStream& aStream,MMPXData::TMPXObjectType aType) const; + + /** + * Internalize media object. + * + * @since S60 3.2.3 + * @param aStream reference to the stream object + * @param aType object type + * @leave KErrArgument aType is invalid + */ + void DoInternalizeL(RReadStream& aStream,MMPXData::TMPXObjectType aType); + + /** + * Number of values. + * + * @since S60 3.2.3 + * @return number of media attributes in the global data + */ + inline TInt Count() const; + + /** + * Lock heap and push UnlockHeap into cleanupstack. + * + * @since S60 3.2.3 + */ + void LockHeapLC() const; + + /** + * Cleanup operation which will be invoked by the CleanupStack::PopAndDestroy(). + * + * @since S60 3.2.3 + * @param aMediaBase a media based object + */ + static void UnlockHeap(TAny* aMediaBase); + +private: + /** + * Delete locally held data. + * + * @since S60 3.2.3 + * @param aUid Uid of the value to be deleted + */ + void DeleteLocalByUid(const TInt aUid); + +protected: + TUint iClientHandle; // Thread relative + TUint iDataHandle; // Global + MMPXData* iData; // Thread relative +private: + RHashMap iValues; + }; + +#include "mpxmediabase.inl" + +#endif // CMPXMEDIABASE_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxmediabase.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxmediabase.inl Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2006 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: Inline functions for media base +* +*/ + + + +// ----------------------------------------------------------------------------- +// CMPXMediaBase::TValue::TValue +// ----------------------------------------------------------------------------- +// +inline CMPXMediaBase::TValue::TValue( + TAny* aValue, + TInt aUid, + TMPXAttributeType aType) + :iValue(aValue),iUid(aUid),iType(aType) + { + } + +// ----------------------------------------------------------------------------- +// CMPXMediaBase::Count +// ----------------------------------------------------------------------------- +// +inline TInt CMPXMediaBase::Count() const + { + ASSERT(iClientHandle&&iData); + return iData->Count(iClientHandle); + } +// END OF FILE diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxmediacollectiondetaildefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxmediacollectiondetaildefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2006 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: Content description for Collection details +* +*/ + + +#ifndef MPX_MEDIA_COLLECTION_DETAILS_H +#define MPX_MEDIA_COLLECTION_DETAILS_H + +#include + +/** +* Content ID for getting collection details +*/ + +const TInt KMPXMediaIdCollectionDetails=0x101FFC47; + +/** +* Attributes supported for KMPXMediaCollectionDetails +*/ +const TMPXAttributeData KMPXMediaColDetailNumberOfItems = {KMPXMediaIdCollectionDetails, 0x01}; // TInt +const TMPXAttributeData KMPXMediaColDetailDuration = {KMPXMediaIdCollectionDetails, 0x02}; // TInt +const TMPXAttributeData KMPXMediaColDetailTotalSize = {KMPXMediaIdCollectionDetails, 0x04}; // TInt +const TMPXAttributeData KMPXMediaColDetailLastRefreshed = {KMPXMediaIdCollectionDetails, 0x08}; // TInt64 +const TMPXAttributeData KMPXMediaColDetailDBCreated = {KMPXMediaIdCollectionDetails, 0x10}; // TBool +const TMPXAttributeData KMPXMediaColDetailDBCorrupted = {KMPXMediaIdCollectionDetails, 0x20}; // TInt +const TMPXAttributeData KMPXMediaColDetailSpaceId = {KMPXMediaIdCollectionDetails, 0x40}; +// TBool. Can this plugin supply MediaL() metadata? +const TMPXAttributeData KMPXMediaColDetailMediaNotAvailable= {KMPXMediaIdCollectionDetails, 0x80}; +const TMPXAttributeData KMPXMediaColDetailAll = {KMPXMediaIdCollectionDetails, 0xffffffff}; + +/** +* Attributes supported for KMPXMediaCollectionDetails. +* +* @deprecated Use the above consts +*/ +enum + { + EMPXMediaColDetailNumberOfItems=0x01, // TInt + EMPXMediaColDetailDuration=0x02, // TInt + EMPXMediaColTotalSize=0x04, // TInt + EMPXMediaLastRefreshed=0x08, // TInt64 + EMPXMediaColDetailDBCreated=0x10, // TBool + EMPXMediaColDetailDBCorrupted=0x20, // TBool + EMPXMediaColDetailIdSpaceId=0x40, + EMPXMediaColDetailIdMediaNotAvailable=0x80, // TBool. Can this plugin supply MediaL() metadata? + EMPXMediaColDetailsAll=0xffffffff + }; + +#endif // MPX_MEDIA_COLLECTION_DETAILS_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxmediacontainerdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxmediacontainerdefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2006 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: Definitions for media type containing other media objects +* +*/ + + + +#ifndef CMPXMEDIACONTAINERDEFS_H +#define CMPXMEDIACONTAINERDEFS_H + +#include +#include + +/** +* Content ID identifying conatiner category. This media object +* contains other media objects contained in a CMPXMediaArray +*/ + +const TInt KMPXMediaIdContainer=0x101FFC43; + +/** +* Attributes supported for KMPXMediaIdContainer +*/ +const TMPXAttributeData KMPXMediaArrayContents = {KMPXMediaIdContainer, 0x01}; // CMPXMediaArray +const TMPXAttributeData KMPXMediaArrayCount = {KMPXMediaIdContainer, 0x02}; // TInt +const TMPXAttributeData KMPXMediaArrayAll = {KMPXMediaIdContainer, 0xffffffff}; + +/** +* Attributes supported for KMPXMediaIdContainer. +* +* @deprecated Use the above consts +*/ +enum + { + EMPXMediaArrayContents=0x01, // CMPXMediaArray + EMPXMediaArrayCount=0x02, // TInt + EMPXMediaArrayAll=0xffffffff + }; + + +#endif // CMPXMEDIACONTAINERDEFS_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxmediadrmdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxmediadrmdefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2006 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: Definitions for DRM media type +* +*/ + + + +#ifndef CMPXMEDIADRMDEFS_H +#define CMPXMEDIADRMDEFS_H + + +#include +#include + +/** +* Content ID identifying DRM category of content provided +* in the media object and associated attributes. +*/ +const TInt KMPXMediaIdDrm=0x101FFC45; + +enum TMPXMediaDrmType + { + EMPXDrmTypeOMA, + EMPXDrmTypeWMA + }; + +enum TMPXMediaDrmRightsStatus + { + EMPXDrmRightsFull, + EMPXDrmRightsMissing, + EMPXDrmRightsRestricted, + EMPXDrmRightsExpired, + EMPXDrmRightsPreview + }; + +enum TMPXMediaDrmRightsType + { + EMPXDrmRightsTypeNoRestriction, + EMPXDrmRightsTypeCount, + EMPXDrmRightsTypeTime, + EMPXDrmRightsTypeInterval, + EMPXDrmRightsTypeTimeCount, + EMPXDrmRightsTypeAccTime + }; + +/** +* Attributes supported for KMPXMediaIdDrm +*/ +const TMPXAttributeData KMPXMediaDrmType = {KMPXMediaIdDrm, 0x0001}; // TInt +const TMPXAttributeData KMPXMediaDrmProtected = {KMPXMediaIdDrm, 0x0002}; // TBool +const TMPXAttributeData KMPXMediaDrmRightsStatus = {KMPXMediaIdDrm, 0x0004}; // TInt +const TMPXAttributeData KMPXMediaDrmRightsType = {KMPXMediaIdDrm, 0x0008}; // TInt +const TMPXAttributeData KMPXMediaDrmCount = {KMPXMediaIdDrm, 0x0010}; // TInt +const TMPXAttributeData KMPXMediaDrmStartTime = {KMPXMediaIdDrm, 0x0020}; // TInt64 +const TMPXAttributeData KMPXMediaDrmEndTime = {KMPXMediaIdDrm, 0x0040}; // TInt64 +const TMPXAttributeData KMPXMediaDrmInterval = {KMPXMediaIdDrm, 0x0080}; // TTimeIntervalSeconds +const TMPXAttributeData KMPXMediaDrmIntervalStartTime = {KMPXMediaIdDrm, 0x0100}; // TInt64 +const TMPXAttributeData KMPXMediaDrmAccumulatedTime = {KMPXMediaIdDrm, 0x0200}; // TTimeIntervalSeconds +const TMPXAttributeData KMPXMediaDrmSendingAllowed = {KMPXMediaIdDrm, 0x0400}; // TBool +const TMPXAttributeData KMPXMediaDrmCanSetAutomated = {KMPXMediaIdDrm, 0x0800}; // TBool +const TMPXAttributeData KMPXMediaDrmHasInfoUrl = {KMPXMediaIdDrm, 0x1000}; // TBool +const TMPXAttributeData KMPXMediaDrmHasPreviewUrl = {KMPXMediaIdDrm, 0x2000}; // TBool +const TMPXAttributeData KMPXMediaDrmAboutToExpire = {KMPXMediaIdDrm, 0x4000}; // TBool +const TMPXAttributeData KMPXMediaDrmAll = {KMPXMediaIdDrm, 0xffffffff}; + +/** +* Attributes supported for KMPXMediaIdDrm. +* +* @deprecated Use the above consts +*/ +enum + { + EMPXMediaDrmType = 0x0001, // TInt + EMPXMediaDrmProtected = 0x0002, // TBool + EMPXMediaDrmRightsStatus = 0x0004, // TInt + EMPXMediaDrmRightsType = 0x0008, // TInt + EMPXMediaDrmCount = 0x0010, // TInt + EMPXMediaDrmStartTime = 0x0020, // TInt64 + EMPXMediaDrmEndTime = 0x0040, // TInt64 + EMPXMediaDrmInterval = 0x0080, // TTimeIntervalSeconds + EMPXMediaDrmIntervalStartTime = 0x0100, // TInt64 + EMPXMediaDrmAccumulatedTime = 0x0200, // TTimeIntervalSeconds + EMPXMediaDrmSendingAllowed = 0x0400, // TBool + EMPXMediaDrmCanSetAutomated = 0x0800, // TBool + EMPXMediaDrmHasInfoUrl = 0x1000, // TBool + EMPXMediaDrmHasPreviewUrl = 0x2000, // TBool + EMPXMediaDrmAboutToExpire = 0x4000, // TBool + EMPXMediaDrmAll = 0xffffffff + }; + + +#endif // CMPXMEDIADRMDEFS_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxmediageneraldefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxmediageneraldefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,494 @@ +/* +* Copyright (c) 2006 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: Definitions for general media type +* +*/ + + + +#ifndef CMPXMEDIAGENERALDEFS_H +#define CMPXMEDIAGENERALDEFS_H + + +#include +#include + +/** +* Content ID identifying general category of content provided +* in the media object and associated attributes. This should +* be supported by ALL media objects as a common base +*/ + +const TInt KMPXMediaIdGeneral=0x101FFC40; +/** +* Attributes supported for KMPXMediaIdGeneral +*/ +/** +* TMPXGeneralType}; see below for enum definition +*/ +const TMPXAttributeData KMPXMediaGeneralType={KMPXMediaIdGeneral,0x01}; + +/** +* TMPXGeneralCategory}; see below for enum definition +*/ +const TMPXAttributeData KMPXMediaGeneralCategory={KMPXMediaIdGeneral,0x02}; + +/** +* Descriptor. File path if local (excluding scheme). +*/ +const TMPXAttributeData KMPXMediaGeneralUri={KMPXMediaIdGeneral,0x04}; + +/** +* Descriptor. Drive}; if local (and physical) +*/ +const TMPXAttributeData KMPXMediaGeneralDrive={KMPXMediaIdGeneral,0x08}; + +/** +* TInt}; in bytes +*/ +const TMPXAttributeData KMPXMediaGeneralSize={KMPXMediaIdGeneral,0x10}; + +/** +* TInt. +* 0 if static}; KMaxTInt if continous stream. If container}; +* then duration applies to sum of contents +*/ +const TMPXAttributeData KMPXMediaGeneralDuration={KMPXMediaIdGeneral,0x20}; + +/** +* Descriptor +*/ +const TMPXAttributeData KMPXMediaGeneralTitle={KMPXMediaIdGeneral,0x40}; + +/** +* TTime.Int64(). Storing as TTime instead TInt64 +* will result in compilation warning. +*/ +const TMPXAttributeData KMPXMediaGeneralDate={KMPXMediaIdGeneral,0x80}; + +/** +* Descriptor +*/ +const TMPXAttributeData KMPXMediaGeneralComment={KMPXMediaIdGeneral,0x100}; + +/** +* Descriptor +*/ +const TMPXAttributeData KMPXMediaGeneralMimeType={KMPXMediaIdGeneral,0x200}; + +/** +* CFbsBitmap - for now could +* be file path in future to enable easier +* porting of client (i.e. UI) +*/ +const TMPXAttributeData KMPXMediaGeneralThumbnail1={KMPXMediaIdGeneral,0x400}; + +/** +* CFbsBitmap - for now could +* be file path in future to enable easier +* porting of client (i.e. UI) +*/ +const TMPXAttributeData KMPXMediaGeneralThumbnail2={KMPXMediaIdGeneral,0x800}; + +/** +* TIconInfo - Bitmap +*/ +const TMPXAttributeData KMPXMediaGeneralIcon={KMPXMediaIdGeneral,0x1000}; + +/** +* TBool +*/ +const TMPXAttributeData KMPXMediaGeneralRemote={KMPXMediaIdGeneral,0x2000}; + +/** +* TBool +*/ +const TMPXAttributeData KMPXMediaGeneralSynchronized={KMPXMediaIdGeneral,0x4000}; + +/** +* TBool +*/ +const TMPXAttributeData KMPXMediaGeneralDeleted={KMPXMediaIdGeneral,0x8000}; + +/** +* TBool +*/ +const TMPXAttributeData KMPXMediaGeneralModified ={KMPXMediaIdGeneral, 0x10000}; + +/** +* TInt. Number of items (if container}; else +* would trivially be 1) +*/ +const TMPXAttributeData KMPXMediaGeneralCount={KMPXMediaIdGeneral,0x20000}; + +/** +* TMPXItemId (as def'd in CollectionPath) +* ID of item +*/ +const TMPXAttributeData KMPXMediaGeneralId={KMPXMediaIdGeneral,0x40000}; + +/** +* Collection id of this media +*/ +const TMPXAttributeData KMPXMediaGeneralCollectionId={KMPXMediaIdGeneral,0x80000}; + +/** +* TBool}; indicates if Uri is a broken link +* DEPRECATED - TO BE REMOVED IN INCREMENT 9 RELEASE +* This attribute has been replaced by +* KMPXMediaGeneralFlagsIsInvalid bit in +* const TMPXAttributeData KMPXMediaGeneralFlags +*/ +const TMPXAttributeData KMPXMediaGeneralBrokenLink={KMPXMediaIdGeneral,0x100000}; + +/** +* TUint}; indicates which rights an end user +* does not have to perform on the media. +* Non-permissible actions are defined in +* TMPXGeneralNonPermissibleActions. Values +* can be combined. +*/ +const TMPXAttributeData KMPXMediaGeneralNonPermissibleActions={KMPXMediaIdGeneral,0x200000}; + +/** +* TMPXItemId (as def'd in CollectionPath) +* ID of item's container or container +*/ +const TMPXAttributeData KMPXMediaGeneralContainerId={KMPXMediaIdGeneral,0x400000}; + +/** +* Descriptor}; subtitle for this media +*/ +const TMPXAttributeData KMPXMediaGeneralSubTitle={KMPXMediaIdGeneral,0x800000}; + +/** +* Copyright information +*/ +const TMPXAttributeData KMPXMediaGeneralCopyright={KMPXMediaIdGeneral,0x1000000}; + +/** +* Flags stored in the database}; TUint +*/ +const TMPXAttributeData KMPXMediaGeneralFlags={KMPXMediaIdGeneral,0x2000000}; + +/** +* Last playback position}; TInt +*/ +const TMPXAttributeData KMPXMediaGeneralLastPlaybackPosition={KMPXMediaIdGeneral,0x4000000}; + +/** +* Last playback Time +* TTime.Int64(). Storing as TTime instead TInt64 +* will result in compilation warning. +*/ +const TMPXAttributeData KMPXMediaGeneralLastPlaybackTime={KMPXMediaIdGeneral,0x8000000}; + +/** +* Play Count}; TUInt +*/ +const TMPXAttributeData KMPXMediaGeneralPlayCount={KMPXMediaIdGeneral,0x10000000}; + +/** +* Media container path +*/ +const TMPXAttributeData KMPXMediaGeneralContainerPath={KMPXMediaIdGeneral,0x20000000}; + +/** +* Media collection path}; CMPXCollectionPath +*/ +const TMPXAttributeData KMPXMediaGeneralPath={KMPXMediaIdGeneral,0x40000000}; + +/** TInt +* +* A single word of general value users defined +* +* In practice, this word can be used to hold a pointer to allocated +* memory; this makes that memory available to all code running on behalf +* of the same thread. +* +*/ +const TMPXAttributeData KMPXMediaGeneralValue={KMPXMediaIdGeneral,0x80000000}; + +/** +* Every attribute +*/ +const TMPXAttributeData KMPXMediaGeneralAll={KMPXMediaIdGeneral,0xffffffff}; + +/** +* Basic set of attributes, typically used for browsing where minimal data is +* required. Type, category, title, duration +*/ +const TMPXAttributeData KMPXMediaGeneralBasic={KMPXMediaIdGeneral,0x01|0x02|0x20|0x40}; + +/** +* Attributes supported for KMPXMediaIdGeneral +* +* @deprecated Use the above consts +*/ +enum + { + /** + * TMPXGeneralType, see below for enum definition + */ + EMPXMediaGeneralType=0x01, + + /** + * TMPXGeneralCategory, see below for enum definition + */ + EMPXMediaGeneralCategory=0x02, + + /** + * Descriptor. File path if local (excluding scheme). + */ + EMPXMediaGeneralUri=0x04, + + /** + * Descriptor. Drive, if local (and physical) + */ + EMPXMediaGeneralDrive=0x08, + + /** + * TInt, in bytes + */ + EMPXMediaGeneralSize=0x10, + + /** + * TInt. + * 0 if static, KMaxTInt if continous stream. If container, + * then duration applies to sum of contents + */ + EMPXMediaGeneralDuration=0x20, + + /** + * Descriptor + */ + EMPXMediaGeneralTitle=0x40, + + /** + * TTime.Int64(). Storing as TTime instead TInt64 + * will result in compilation warning. + */ + EMPXMediaGeneralDate=0x80, + + /** + * Descriptor + */ + EMPXMediaGeneralComment=0x100, + + /** + * Descriptor + */ + EMPXMediaGeneralMimeType=0x200, + + /** + * CFbsBitmap - for now could + * be file path in future to enable easier + * porting of client (i.e. UI) + */ + EMPXMediaGeneralThumbnail1=0x400, + + /** + * CFbsBitmap - for now could + * be file path in future to enable easier + * porting of client (i.e. UI) + */ + EMPXMediaGeneralThumbnail2=0x800, + + /** + * TIconInfo - Bitmap + */ + EMPXMediaGeneralIcon=0x1000, + + /** + * TBool + */ + EMPXMediaGeneralRemote=0x2000, + + /** + * TBool + */ + EMPXMediaGeneralSynchronized=0x4000, + + /** + * TBool + */ + EMPXMediaGeneralDeleted=0x8000, + + /** + * TBool + */ + EMPXMediaGeneralModified = 0x10000, + + /** + * TInt. Number of items (if container, else + * would trivially be 1) + */ + EMPXMediaGeneralCount=0x20000, + + /** + * TMPXItemId (as def'd in CollectionPath) + * ID of item + */ + EMPXMediaGeneralId=0x40000, + + /** + * Collection id of this media + */ + EMPXMediaGeneralCollectionId=0x80000, + + /** + * TBool, indicates if Uri is a broken link + * DEPRECATED - TO BE REMOVED IN INCREMENT 9 RELEASE + * This attribute has been replaced by + * KMPXMediaGeneralFlagsIsInvalid bit in + * EMPXMediaGeneralFlags + */ + EMPXMediaGeneralBrokenLink=0x100000, + + /** + * TUint, indicates which rights an end user + * does not have to perform on the media. + * Non-permissible actions are defined in + * TMPXGeneralNonPermissibleActions. Values + * can be combined. + */ + EMPXMediaGeneralNonPermissibleActions=0x200000, + + /** + * TMPXItemId (as def'd in CollectionPath) + * ID of item's container or container + */ + EMPXMediaGeneralContainerId=0x400000, + + /** + * Descriptor, subtitle for this media + */ + EMPXMediaGeneralSubTitle=0x800000, + + /** + * Copyright information + */ + EMPXMediaGeneralCopyright=0x1000000, + + /** + * Flags stored in the database, TUint + */ + EMPXMediaGeneralFlags=0x2000000, + + /** + * Last playback position, TInt + */ + EMPXMediaGeneralLastPlaybackPosition=0x4000000, + + /** + * Last playback Time + * TTime.Int64(). Storing as TTime instead TInt64 + * will result in compilation warning. + */ + EMPXMediaGeneralLastPlaybackTime=0x8000000, + + /** + * Play Count, TUInt + */ + EMPXMediaGeneralPlayCount=0x10000000, + + /** + * Media container path + */ + EMPXMediaContainerPath=0x20000000, + + /** + * Media collection path, CMPXCollectionPath + */ + EMPXMediaPath=0x40000000, + + /** + * Every attribute + */ + EMPXMediaGeneralAll=0xffffffff, + + /** + * Basic set of attributes, typically used for + * browsing where minimal data is required + */ + EMPXMediaGeneralBasic=EMPXMediaGeneralType| + EMPXMediaGeneralCategory| + EMPXMediaGeneralTitle| + EMPXMediaGeneralDuration + }; + + +enum TMPXGeneralType + { + EMPXNoType, + EMPXGroup, + EMPXItem, + EMPXOtherType + }; + +enum TMPXGeneralCategory + { + EMPXNoCategory, + EMPXCollection, + EMPXPlaylist, + EMPXSong, + EMPXPodcast, + EMPXArtist, + EMPXAlbum, + EMPXGenre, + EMPXComposer, + EMPXFile, + EMPXImage, + EMPXVideo, + EMPXRadio, + EMPXMessage, + EMPXTag, + EMPXCommand, + EMPXMonth, + EMPXOther + }; + +enum TMPXGeneralNonPermissibleActions + { + EMPXRead=0x01, + EMPXWrite=0x02, + EMPXCache=0x04 + }; + +const TUint KMPXMediaGeneralFlagsDriveInfo=0x1F; // lower 5 bits + +// Top bit indicates whether to set or reset flag value. +// If this bit is set, then the parameter that is passed in will +// specify which bits to be set. +// If this bit is unset, then the parameter that is passed in will +// specify which bits will be unset. +const TUint KMPXMediaGeneralFlagsSetOrUnsetBit=0x80000000; // top bit +const TUint KMPXMediaGeneralFlagsIsCorrupted=0x40000000; // second bit +const TUint KMPXMediaGeneralFlagsIsInvalid=0x20000000; // third bit +const TUint KMPXMediaGeneralFlagsIsDrmProtected=0x10000000; // forth bit +const TUint KMPXMediaGeneralFlagsIsDrmLicenceInvalid=0x08000000; // fifth bit +const TUint KMPXMediaGeneralFlagsIsVirtual=0x04000000; // sixth bit +const TUint KMPXMediaGeneralFlagsIsMissingDetails=0x02000000; // seventh bit + +/* +* Simple structure to hold icon info +*/ +NONSHARABLE_STRUCT( TIconInfo ) + { + TInt bitmapId; + TInt maskId; + TFileName bmpfile; + }; + +#endif // CMPXMEDIAGENERALDEFS_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxmediageneralextdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxmediageneralextdefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2006 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: More definitions for general media type +* +*/ + +#ifndef CMPXMEDIAGENERALEXTDEFS_H +#define CMPXMEDIAGENERALEXTDEFS_H + +#include +#include + + +/** +* Content ID identifying extended general category of content provided +* in the media object and associated attributes. +*/ + +const TInt KMPXMediaIdGeneralExt=0x101F3C72; + +/** +* Attributes supported for KMPXMediaIdStreaming +*/ +const TMPXAttributeData KMPXMediaGeneralExtAccessPoint={KMPXMediaIdGeneralExt,0x01}; // Tint +const TMPXAttributeData KMPXMediaGeneralExtMediaRedirect={KMPXMediaIdGeneralExt,0x02}; // Tint +const TMPXAttributeData KMPXMediaGeneralExtVideoSeekable={KMPXMediaIdGeneralExt,0x04}; // TBool +const TMPXAttributeData KMPXMediaGeneralExtRating={KMPXMediaIdGeneralExt,0x08}; // TInt +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API +const TMPXAttributeData KMPXMediaGeneralExtSizeInt64={KMPXMediaIdGeneralExt,0x10}; // TInt64 +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + +#endif // CMPXMEDIAGENERALEXTDEFS_H + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxmediamtpdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxmediamtpdefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2007 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: Definitions for mtp media type +* +*/ + + + +#ifndef MPXMEDIAMTPDEFS_H +#define MPXMEDIAMTPDEFS_H + + +#include +#include + +/** +* Content ID identifying MTP category of content provided +* in the media object and associated attributes. +*/ +const TInt KMPXMediaIdMTP=0x10282970; + +/** +* Attributes supported for KMPXMediaIdMTP +*/ +const TMPXAttributeData KMPXMediaMTPDrmStatus = {KMPXMediaIdMTP, 0x0001}; // TUint16 +const TMPXAttributeData KMPXMediaMTPAll = {KMPXMediaIdMTP, 0xffffffff}; + +#endif // MPXMEDIAMTPDEFS_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxmediamusicdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxmediamusicdefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2006 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: Definitions for music media type +* +*/ + + + +#ifndef CMPXMEDIAMUSICDEFS_H +#define CMPXMEDIAMUSICDEFS_H + +#include +#include + +/** +* Content ID identifying music category of content provided +* in the media object and associated attributes. +*/ + +const TInt KMPXMediaIdMusic=0x101FFC42; +/** +* Attributes supported for KMPXMediaIdMusic +*/ +const TMPXAttributeData KMPXMediaMusicAlbumArtFileName={KMPXMediaIdMusic,0x01}; // Text +const TMPXAttributeData KMPXMediaMusicArtist={KMPXMediaIdMusic,0x02}; // Text +const TMPXAttributeData KMPXMediaMusicAlbum={KMPXMediaIdMusic,0x04}; // Text +const TMPXAttributeData KMPXMediaMusicYear={KMPXMediaIdMusic,0x08}; // TInt64 +const TMPXAttributeData KMPXMediaMusicAlbumTrack={KMPXMediaIdMusic,0x10}; // TInt +const TMPXAttributeData KMPXMediaMusicGenre={KMPXMediaIdMusic,0x20}; // Text +const TMPXAttributeData KMPXMediaMusicComposer={KMPXMediaIdMusic,0x40}; // Text +const TMPXAttributeData KMPXMediaMusicRating={KMPXMediaIdMusic,0x80}; // TInt +const TMPXAttributeData KMPXMediaMusicURL={KMPXMediaIdMusic,0x100}; // Text +const TMPXAttributeData KMPXMediaMusicOriginalAlbumArtFileName={KMPXMediaIdMusic,0x200}; // Text +const TMPXAttributeData KMPXMediaMusicAlbumArtThumbnail={KMPXMediaIdMusic,0x400}; // CFbsImage +const TMPXAttributeData KMPXMediaMusicAlbumArtThumbnailSize={KMPXMediaIdMusic,0x800}; // TSint +const TMPXAttributeData KMPXMediaMusicAll={KMPXMediaIdMusic,0xffffffff}; // Text + +/** +* Attributes supported for KMPXMediaIdMusic. +* +* @deprecated Use the above consts +*/ +enum + { + EMPXMediaMusicAlbumArtFileName=0x01, // Text + EMPXMediaMusicArtist=0x02, // Text + EMPXMediaMusicAlbum=0x04, // Text + EMPXMediaMusicYear=0x08, // TInt64 + EMPXMediaMusicAlbumTrack=0x10, // Text + EMPXMediaMusicGenre=0x20, // Text + EMPXMediaMusicComposer=0x40, // Text + EMPXMediaMusicRating=0x80, // TInt + EMPXMediaMusicURL=0x100, // Text + EMPXMediaMusicOriginalAlbumArtFileName=0x200, // Text + EMPXMediaMusicAlbumArtThumbnail=0x400, + EMPXMediaMusicAlbumArtThumbnailSize=0x800, + EMPXMediaMusicAll=0xffffffff + }; + + +#endif // CMPXMEDIAMUSICDEFS_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxmessage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxmessage.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2004 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: Message class +* +*/ + + + +#ifndef TMPXMESSAGE_H +#define TMPXMESSAGE_H + +#include + +/** +* MPX message class. +* +* @lib mpxcommon.lib +*/ +class TMPXMessage + { +public: + /** + * C++ constructor. + * + * @since S60 3.2.3 + * @param aEvent event + * @param aType event type + * @param aData optional data + */ + IMPORT_C TMPXMessage(TInt aEvent,TInt aType = 0,TInt aData = 0); + + /** + * C++ copy constructor. + * + * @since S60 3.2.3 + * @param aMsg source message + */ + IMPORT_C TMPXMessage(const TMPXMessage& aMsg); + + /** + * Overloaded assignment operator. + * + * @since S60 3.2.3 + * @param aMsg source message + */ + IMPORT_C TMPXMessage& operator=(const TMPXMessage& aMsg); + + /** + * C++ constructor. + * + * @since S60 3.2.3 + */ + IMPORT_C TMPXMessage(); + + /** + * return message event. + * + * @since S60 3.2.3 + */ + IMPORT_C TInt Event() const; + + /** + * return message type. + * + * @since S60 3.2.3 + */ + IMPORT_C TInt Type() const; + + /** + * return message data. + * + * @since S60 3.2.3 + */ + IMPORT_C TInt Data() const; +protected: + TInt iEvent; + TInt iType; + TInt iData; + }; + +#endif // TMPXMESSAGE_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxmessagecontainerdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxmessagecontainerdefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2006 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: Definitions for message type containing other message objects +* +*/ + + + +#ifndef CMPXMESSAGECONTAINERDEFS_H +#define CMPXMESSAGECONTAINERDEFS_H + + +#include +#include + +/** +* Content ID identifying conatiner category. This message object +* contains other message objects contained in a CMPXMessageArray +*/ + +const TInt KMPXMessageIdContainer=0x10282946; +/** +* Attributes supported for KMPXMediaIdContainer +*/ +// CMPXMessageArray +const TMPXAttributeData KMPXMessageArrayContents={KMPXMessageIdContainer, 0x01}; +const TMPXAttributeData KMPXMessageArrayCount={KMPXMessageIdContainer, 0x02}; // TInt +const TMPXAttributeData KMPXMessageArrayAll={KMPXMessageIdContainer, 0xffffffff}; + +/** +* Attributes supported for KMPXMediaIdContainer. +* +* @deprecated Use the above consts +*/ +enum + { + EMPXMessageArrayContents=0x01, // CMPXMessageArray + EMPXMessageArrayCount=0x02, // TInt + EMPXMessageArrayAll=0xffffffff + }; + + +#endif // CMPXMESSAGECONTAINERDEFS_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxmessagegeneraldefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxmessagegeneraldefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2006 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: Definitions for message type +* +*/ + + + +#ifndef CMPXMESSAGEGENERALDEFS_H +#define CMPXMESSAGEGENERALDEFS_H + +#include +#include + +/** +* Content ID identifying general category of content provided +* in the message object and associated attributes. This should +* be supported by ALL message objects as a common base +*/ + +const TInt KMPXMessageContentIdGeneral = 0x10282944; +/** +* Attributes supported for KMPXMessageIdGeneral +*/ +/** +* TMPXMessageId, *unique* id of the message +*/ +const TMPXAttributeData KMPXMessageGeneralId={KMPXMessageContentIdGeneral, 0x01}; +/** + * General event, optional, TInt + */ +const TMPXAttributeData KMPXMessageGeneralEvent={KMPXMessageContentIdGeneral, 0x02}; +/** + * General type, optional, TInt + */ +const TMPXAttributeData KMPXMessageGeneralType={KMPXMessageContentIdGeneral, 0x04}; +/** + * General data, optional, TInt + */ +const TMPXAttributeData KMPXMessageGeneralData={KMPXMessageContentIdGeneral, 0x08}; + +/** +* Attributes supported for KMPXMessageIdGeneral. +* +* @deprecated Use the above consts +*/ +enum + { + /** + * TMPXMessageId, *unique* id of the message + */ + EMPXMessageGeneralId = 0x01 + + }; + +/** + * Unique id of KMPXMessageGeneral + * KMPXMessageGeneral contains the attributes: KMPXMessageGeneralEvent, + * KMPXMessageGeneralType, KMPXMessageGeneralData + */ +const TInt KMPXMessageGeneral = 0x10282967; + +#endif // CMPXMESSAGEGENERALDEFS_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxmessagemonitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxmessagemonitor.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2006 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: Message monitor +* +*/ + + + +#ifndef CMPXMESSAGEMONITOR_H +#define CMPXMESSAGEMONITOR_H + +#include +#include +#include "mpxmessageobserver.h" + +class RMPXSession; + +/** +* Monitor messages in the message queue. +* The class is always derived from and is never instantiated explicitly. +* +* @lib mpxcommon.lib +*/ +class CMPXMessageMonitor : public CActive + { +public: + /** + * Two-phased constructor. + * + * @since S60 3.2.3 + * @param aSession refrence to session object + * @param aObserver observer + */ + IMPORT_C static CMPXMessageMonitor* NewL(const RMPXSession& aSession, + MMPXMessageObserver& aObserver); + + /** + * Destructor. + * + * @since S60 3.2.3 + */ + IMPORT_C virtual ~CMPXMessageMonitor(); + + /** + * Get next message. + * + * @since S60 3.2.3 + */ + IMPORT_C void GetNextMessage(); + +protected: // From base class + + /** + * From CActive. + * Handles request completion event. + * + * @since S60 3.2.3 + */ + IMPORT_C void RunL(); + + /** + * From CActive. + * Implements cancellation of an outstanding request. + * + * @since S60 3.2.3 + */ + IMPORT_C void DoCancel(); + + /** + * From CActive. + * Handles a leave occurring in the request completion event handler RunL(). + * + * @since S60 3.2.3 + * @param aError error code + */ + IMPORT_C TInt RunError(TInt aError); + + +protected: // New function + + /** + * Wait for next message. + * + * @since S60 3.2.3 + */ + void WaitForNextMessage(); + + +private: + + /** + * C++ constructor. + * + * @since S60 3.2.3 + * @param aSession refrence to session object + * @param aObserver observer + */ + CMPXMessageMonitor(const RMPXSession& aSession, + MMPXMessageObserver& aObserver); + + /** + * Second phase constructor. + * + * @since S60 3.2.3 + */ + void ConstructL(); + +private: + const RMPXSession& iSession; + MMPXMessageObserver& iObserver; + TPckgBuf iMsgDataPkg; // Message data package + TPckgBuf iErrorPkg; // Error code package + }; + +#endif // CMPXMESSAGEMONITOR_H + +// End of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxmessageobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxmessageobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2006 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: message observer +* +*/ + + + +#ifndef MMPXMESSAGEOBSERVER_H +#define MMPXMESSAGEOBSERVER_H + + +/** +* Interface for receiving events. +* +* @lib mpxcommon.lib +*/ +NONSHARABLE_CLASS(MMPXMessageObserver) + { +public: + /** + * Message received. + * + * @since S60 3.2.3 + * @param aMsgData message data + * @param aError error code + */ + virtual void MessageReceived(TInt aMsgData, TInt aError)=0; + }; + + +#endif // MMPXMESSAGEOBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxmessagepluginupdatedefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxmessagepluginupdatedefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2008 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: Definitions for plugin update messages +* +*/ + + +#ifndef MPXMESSAGEPLUGINUPDATEDEFS_H +#define MPXMESSAGEPLUGINUPDATEDEFS_H + +#include + +/** +* Content ID identifying general plugin attributes +*/ +const TInt KMPXMessagePluginGeneral = 0x10282990; + +/** +* TUid - plugin UID +*/ +const TMPXAttributeData KMPXAttrPluginId = {KMPXMessagePluginGeneral, 0x01}; + +/** +* TBool - ETrue if the plugin is loaded +*/ +const TMPXAttributeData KMPXAttrPluginLoaded = {KMPXMessagePluginGeneral, 0x02}; + +/** +* TInt - plugin version +*/ +const TMPXAttributeData KMPXAttrPluginVersion = {KMPXMessagePluginGeneral, 0x04}; + +/** +* Content ID identifying plugin addition messages +* Includes the KMPXAttrPluginId, KMPXAttrPluginLoaded and KMPXAttrPluginVersion attributes +*/ +const TInt KMPXMessagePluginAdd = 0x10282991; + +/** +* Content ID identifying update start messages +* Includes the KMPXAttrPluginId, KMPXAttrPluginLoaded and KMPXAttrPluginVersion attributes +*/ +const TInt KMPXMessagePluginUpdateStart = 0x10282992; + +/** +* Content ID identifying update end messages +* Includes the KMPXAttrPluginId, KMPXAttrPluginLoaded and KMPXAttrPluginVersion attributes +*/ +const TInt KMPXMessagePluginUpdateEnd = 0x10282993; + +/** +* Content ID identifying plugin removal messages +* Includes the KMPXAttrPluginId, KMPXAttrPluginLoaded and KMPXAttrPluginVersion attributes +*/ +const TInt KMPXMessagePluginRemove = 0x10282994; + +#endif // MPXMESSAGEPROGRESSDEFS_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxmessageprogressdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxmessageprogressdefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2007 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: Definitions for progress messages +* +*/ + + +#ifndef MPXMESSAGEPROGRESSDEFS_H +#define MPXMESSAGEPROGRESSDEFS_H + +#include + +/** +* Content ID identifying progress messages +*/ +const TInt KMPXMessageContentIdProgress = 0x10282964; + +/** +* Attributes supported for KMPXMessageContentIdProgress +*/ +enum + { + /** + * Integer value of currently completed steps + */ + EMPXMessageProgressCurrentCount = 0x01, + + /** + * Integer value of total steps to completion + */ + EMPXMessageProgressTotalCount = 0x02 + }; + +#endif // MPXMESSAGEPROGRESSDEFS_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxmessagequeue.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxmessagequeue.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2007 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: Queue the message +* +*/ + + +#ifndef CMPXMESSAGEQUEUE_H +#define CMPXMESSAGEQUEUE_H + +#include // For CActive, link against: euser.lib +#include +#include + +class CMPXMessageItem; + +/** +* Message queue. +* +* @lib mpxcommon.lib +*/ +class CMPXMessageQueue : public CBase + { +public: + /** + * Two-phased constructor. + * + * @since S60 3.2.3 + * @return new object of the CMPXMessageQueue + */ + IMPORT_C static CMPXMessageQueue* NewL(); + + /** + * Destructor. + * + * @since S60 3.2.3 + */ + IMPORT_C ~CMPXMessageQueue(); + +public: // New functions + /** + * Request to send next message. + * + * @since S60 3.2.3 + * @param aMsgRequest message request + */ + IMPORT_C void SendNext(const RMessage2& aMsgRequest); + + /** + * Adds a message into the queue and sends the message if slot is available. + * + * @since S60 3.2.3 + * @param aMessage message object, ownership not transferred. + * @param aError error code + */ + IMPORT_C void Add(const CMPXMessage* aMessage, TInt aError); + + /** + * Reset the message queue. + * + * @since S60 3.2.3 + */ + IMPORT_C void Reset(); + +private: + /** + * C++ constructor. + * + * @since S60 3.2.3 + */ + CMPXMessageQueue(); + + /** + * Second-phase constructor. + * + * @since S60 3.2.3 + */ + void ConstructL(); + + /** + * Send a message to client. + * + * @since S60 3.2.3 + */ + void Send(); + +private: + RMessage2 iMsgRequest; + TSglQue iMsgs; // Queue for the messages + CMPXMessageItem* iMsgSent; // Sent message + TInt iFailure; // Failed to add message to the queue +#ifdef _DEBUG + TInt iCount; // message count +#endif + }; + +#endif // CMPXMESSAGEQUEUE_H + +// End of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxparameter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxparameter.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2006 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: MPX parameter for commandline/message +* +*/ + + +#ifndef CMPXPARAMETER_H +#define CMPXPARAMETER_H + +// INCLUDES +#include + +enum TMPXPathType + { + EMPXTypeCollectionPath, + EMPXTypeCollectionPlaylist + }; + +enum TMPXCmdFwdType + { + EMPXCmdFwdNone, + EMPXCmdFwdStandAlone, + EMPXCmdFwdNowPlaying + }; + +// FORWARD DECLARATIONS +class CMPXCollectionPath; + +// CLASS DECLARATION +/** +* Usage: +* - To open a specific view, set iType to the view type. +* +* - To open a specific path, set iCollectionPath, music player will select +* the best matching view to display the result. +* +* - using iCollectionPath/iCollectionPlaylist + iType is supported, but not recommended +* since music player already selects the best matching view to display the result. +* +* - If the client wants the command to be processed by a specific music player instance +* they should set iCmdForward to a value defined by TMPXCmdFwdType. The default forwarding is to +* stand alone musicplayer (it'll be launched if it doesn't exist). +* +* @lib mpxcommon.lib +*/ +class CMPXParameter : public CBase + { + public: // Constructors and destructor + + /** + * C++ Constructor. + * + * @since S60 3.2.3 + */ + IMPORT_C CMPXParameter(); + + /** + * Destructor. + * + * @since S60 3.2.3 + */ + IMPORT_C virtual ~CMPXParameter(); + + public: // New funtions + + /** + * Externalize a object of this class to steam. + * + * @since S60 3.2.3 + * @param aStream write stream + */ + IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; + + /** + * Internalize a object of this class from steam. + * + * @since S60 3.2.3 + * @param aStream read stream + * @leave KErrNotSupported The collection path is not valid, + */ + IMPORT_C void InternalizeL( RReadStream& aStream ); + + public: // data member + CMPXCollectionPath* iCollectionPath; // OWNED + TMPXPathType iPathType; + TUid iType; + TInt iCmdForward; // TMPXCmdFwdType + + private: + TInt iVersion; + }; + +#endif // CMPXPARAMETER_H + +// End of File + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxplugin.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxplugin.hrh Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2007 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: Generic plugin resource file constants +* +*/ + + + +#ifndef MPXPLUGIN_HRH +#define MPXPLUGIN_HRH + +// CONSTANTS + +/* Plugin feature flags +* General common flags use the bottom 16 bits +* Framework specific flags use the top 16 bits. +* IE: 0xaaaabbbb where a are framework flags, b are generic flags +*/ +enum TMPXPluginFlags + { + EMPXPluginFlagPreLoad = 0x0001, /** Indicates that this plugin needs to be preloaded */ + EMPXPluginFlagUserSelectable = 0x0002 /** Indicates that this plugin is user selectable */ + }; + +/** Plugin priorities */ +enum TMPXPluginPriorities + { + EMPXPluginPriorityLowest = -20000, + EMPXPluginPriorityLow = -10000, + EMPXPluginPriorityNormal = 0, + EMPXPluginPriorityHigh = 10000, + EMPXPluginPriorityHighest = 20000 + }; + +#endif // MPXPLUGIN_HRH + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxpluginhandlerbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxpluginhandlerbase.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,509 @@ +/* +* Copyright (c) 2006 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 plugin handler +* +*/ + + +#ifndef CMPXPLUGINHANDLERBASE_H +#define CMPXPLUGINHANDLERBASE_H + +#include +#include +#include "mpxpluginmonitorobserver.h" + +class CMPXPluginMonitor; +class CMPXPluginInfo; +class MMPXPluginHandlerObserver; + +/** +* CMPXPluginHandlerBase instantiates and owns a CMPXPluginMonitor to monitor +* plugins for the designated plugin interface. It also provides plugin +* selection APIs and a common method for resolving a plugin from a set of +* selection criteria. +* +* @lib mpxcommon.lib +*/ +class CMPXPluginHandlerBase : public CBase, + public MMPXPluginMonitorObserver + { +public: + + enum TPluginSelection + { + ESelectionType, // select a plugin by type + ESelectionUid // select a plugin by uid + }; + + public: + + /** + * Constructor. + * + * @since S60 3.2.3 + * @param aInterfaceUid The UID of the ECOM plugin interface this plugin + * handler is designated for + * @param aSelection plugin selection choices as defined in TPluginSelection + * @param aSelectionType specifies the type of plugin for selection + * @param aObserver plugin handler observer instance + * @param aPluginMonitor plugin monitor. It is for the clients to share the + * same plugin monitor object. + */ + IMPORT_C CMPXPluginHandlerBase( + TUid aInterfaceUid, + TPluginSelection aSelection, + TInt aSelectionType, + MMPXPluginHandlerObserver& aObserver, + CMPXPluginMonitor* aPluginMonitor=NULL); + + /** + * Destructor. + * + * @since S60 3.2.3 + */ + IMPORT_C ~CMPXPluginHandlerBase(); + +protected: + /** + * 2nd phase contructor. + * + * @since S60 3.2.3 + */ + IMPORT_C void BaseConstructL(); + +public: + + /** + * Use this particular plugin. + * + * @since S60 3.2.3 + * @param aPluginUid UID of the plugin to be used + */ + IMPORT_C void SelectPluginL(const TUid& aPluginUid); + + /** + * Use the plugin with the specified display name. + * + * @since S60 3.2.3 + * @param aPluginName name of the plugin + */ + IMPORT_C void SelectPluginL(const TDesC& aPluginName); + + /** + * Select a plugin based on the URI and data type of the media given. + * + * @since S60 3.2.3 + * @param aUri URI of the media + * @param aDataType Mime type of the media. KNullDesC8 if not to be + * used for selection. + * @leave KErrArgument Invalid URI + */ + IMPORT_C virtual void SelectPluginL( + const TDesC& aUri, + const TDesC8& aDataType); + + /** + * Select a plugin based on file handle for the given media. + * + * @since S60 3.2.3 + * @param aFile a file handle to the media + */ + IMPORT_C virtual void SelectPluginL(const RFile& aFile); + + /** + * Select a plugin based on the plugin type. + * + * @since S60 3.2.3 + * @param aPluginType plugin type for the appropriate plugin to be used. + * The representation for each bit is to be defined by each plugin + * interface. + */ + IMPORT_C virtual void SelectPluginL(TInt aPluginType); + + /** + * Indicates that this plugin is used by a client. Increments the reference + * count for the plugin. + * + * @since S60 3.2.3 + * @param aPluginUid plugin UID + */ + IMPORT_C void UsePlugin(const TUid& aPluginUid); + + /** + * Indicates that this plugin is no longer used by a client. Plugins are + * reference counted and this call may result in the plugin being unloaded. + * + * @since S60 3.2.3 + * @param aPluginUid plugin UID + * @return ETrue if the plugin is unloaded / EFalse if it is not. + */ + IMPORT_C TBool ReleasePlugin(const TUid& aPluginUid); + + /** + * Retrieves the current selection criteria. + * + * @since S60 3.2.3 + * @param aPluginSelection OUT parameter. the selection choice as defined + * by TPluginSelection + * @param aPluginType OUT parameter. plugin type to be used for selection + * @param aPluginUid OUT parameter. UID of the plugin to be used for selection. + * KNullUid is a possible return value if none is explicitly selected. + * @param aDataType OUT parameter. The data type to be used for selection. + * KNullDesC8 if none is specified. CMPXPluginHandlerBase is + * responsible for the memory management of this parameter. + * @param aScheme OUT parameter. The scheme to be used for selection. + * KNullDesC8 if none is specified. CMPXPluginHandlerBase is + * responsible for the memory management of this parameter. + * @param aExtension OUT parameter. The extension to be used for selection. + * KNullDesC8 if none is specified. CMPXPluginHandlerBase is + * responsible for the memory management of this parameter. + */ + IMPORT_C virtual void GetSelectionCriteria( + TPluginSelection& aPluginSelection, + TInt& aPluginType, + TUid& aPluginUid, + TPtrC8& aDataType, + TPtrC8& aScheme, + TPtrC8& aExtension); + + /** + * Clear selection criteria parameters. + * + * @since S60 3.2.3 + */ + IMPORT_C virtual void ClearSelectionCriteria(); + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + /** + * Select a plugin based on file handle for the given media. + * + * @since S60 3.2.3 + * @param aFile a 64 bit file handle to the media + */ + IMPORT_C virtual void SelectPlugin64L(const RFile64& aFile); +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + +protected: + + /** + * Resolves a plugin based on properties (iDataType, iExt and iScheme) and + * selection criteria. When a plugin is found, information about the plugin + * is returned through parameters. + * + * @since S60 3.2.3 + * @param aPluginUid This is an OUT parameter. The UID of the matching plugin + * @param aIndex This is an OUT parameter. The index for the plugin info, plugin + * UID, and plugin types array for the matching plugin + * @param aDisplayName This is an OUT parameter. The display name for the matching + * plugin. CMPXPluginHandlerBase is responsible for the memory management + * of this parameter. + * @param aPluginType This is an OUT parameter. The plugin type for the matching + * plugin + * @leave KErrNotSupported Index is not found + */ + IMPORT_C virtual void DoResolvePluginL( + TUid& aPluginUid, + TInt& aIndex, + TPtrC& aDisplayName, + TInt& aPluginType); + + /** + * From MMPXPluginMonitorObserver. This is invoked by CMPXPluginMonitor when + * there is a change in the plugins for the designated plugin interface in + * the system. + * + * @since S60 3.2.3 + */ + IMPORT_C virtual void PluginsChangedL(); + + /** + * From MMPXPluginMonitorObserver. + * + * @since S60 3.2.3 + * @see MMPXPluginMonitorObserver + */ + IMPORT_C virtual void HandlePluginUnload(const TUid& aPluginUid); + + /** + * Resolves a plugin. To be implemented by the child class. This is invoked + * whenever a client selects a plugin and whenever CMPXPluginMonitor notifies + * that there is a change in the plugins for the designated plugin interface + * in the system. + * + * A typical implementation for this method is to invoke DoResolvePluginL + * and instantiate a plugin using the plugin UID returned from DoResolvePluginL. + * + * NOTE: this method is not pure virtual because currently the playlist + * recognizer instantiates this class as opposed to the derived handler. + * This should be fixed and both ResolvePluginL and UnloadPlugin should be + * made pure virtuals. + * + * @since S60 3.2.3 + */ + IMPORT_C virtual void ResolvePluginL(); + + /** + * Checks if the specified plugin is loaded. + * + * @since S60 3.2.3 + * @param aPluginUid identifies the plugin + * @return ETrue if the plugin is loaded, EFalse otherwise + */ + IMPORT_C virtual TBool IsPluginLoaded(const TUid& aPluginUid); + + /** + * Request to the derived class to load a specified plugin. + * + * @since S60 3.2.3 + * @param aPluginUid identifies the plugin + */ + IMPORT_C virtual void LoadPluginL(const TUid& aPluginUid); + + /** + * Request to the derived class to unload a specified plugin. + * + * @since S60 3.2.3 + * @param aPluginUid identifies the plugin + */ + IMPORT_C virtual void UnloadPlugin(const TUid& aPluginUid); + + /** + * Constructs the plugins info class. + * Can be overwritten by subclasses to construct specialized instances of the plugin info. + * Default implementation constructs a CMPXPluginInfo class. + * + * @since S60 3.2.3 + * @param aData implementation data + */ + IMPORT_C virtual CMPXPluginInfo* ConstructPluginInfoLC( const CImplementationInformation& aData ); + +#ifdef _DEBUG + + /** + * Prints all plugin info entries to the debug log. + * + * @since S60 3.2.3 + */ + void PrintPluginInfo(); + +#endif + +public: + + /** + * Returns display name for plugin with the given type. + * + * @since S60 3.2.3 + * @param aType plugin type. + * @return plugin name. KNullDesC returned if not found. + */ + IMPORT_C const TDesC& PluginName(TInt aPluginType) const; + + /** + * Returns display name for plugin with the given uid. + * + * @since S60 3.2.3 + * @param aUid plugin id + * @return plugin name. KNullDesC returned if not found. + */ + IMPORT_C const TDesC& PluginName(const TUid& aUid) const; + + /** + * Returns a list of display names for the plugins. + * + * @since S60 3.2.3 + * @return an array of display names. Client is responsible + * for the memory management of this array and its + * items. + */ + IMPORT_C CDesCArray* PluginNamesL(); + + /** + * Return a list of mime types supported by plugins. + * + * @since S60 3.2.3 + * @return an array of mime types. Client is responsible + * for the memory management of this array and its + * items. + */ + IMPORT_C CDesCArray* SupportedMimeTypesL(); + + /** + * Return a list of file extensions supported by plugins. + * + * @since S60 3.2.3 + * @return an array of extensions. Client is responsible + * for the memory management of this array and its + * items. + */ + IMPORT_C CDesCArray* SupportedExtensionsL(); + + /** + * Return a list of schemas supported by plugins. + * + * @since S60 3.2.3 + * @return an array of schemas. Client is responsible for + * the memory management of this array and its + * items. + */ + IMPORT_C CDesCArray* SupportedSchemasL(); + + /** + * Return a list of mime types supported by a plugin. + * + * @since S60 3.2.3 + * @param aUid plugin id + * @return an array of mime types. Client is responsible + * for the memory management of this array and its + * items. + */ + IMPORT_C CDesCArray* SupportedMimeTypesL(const TUid& aUid); + + /** + * Return a list of file extensions supported by a plugin. + * + * @since S60 3.2.3 + * @param aUid plugin id + * @return an array of extensions. Client is responsible + * for the memory management of this array and its + * items. + */ + IMPORT_C CDesCArray* SupportedExtensionsL(const TUid& aUid); + + /** + * Get plugin type for a given implementation UID. + * + * @since S60 3.2.3 + * @param aUid plugin's implementation Uid + * @return plugin's type Uid, or KNullUid if not found + */ + IMPORT_C TUid PluginType( const TUid& aUid ) const; + + /** + * Get supported app uid for a given implementation UID + * + * @param aUid plugin's implementation Uid + * @return plugin's supported app Uid, or KNullUid if not found + */ + IMPORT_C TUid SupportedAppUid( const TUid& aUid ) const; + + /** + * Get plugin flag for a given implementation UID. + * + * @since S60 3.2.3 + * @param aUid plugin's implementation Uid + * @return Plugin's flag, or leave with KErrNotFound if not found + * @leave KErrNotFound Uid is not found + */ + IMPORT_C TUint PluginFlagsL( const TUid& aUid ) const; + + /** + * Get currently available plug-in types. + * + * @since S60 3.2.3 + * @param aType contains plugins types + */ + IMPORT_C void GetPluginTypes(RArray& aTypes) const; + + /** + * Get currently available plug-in UIDs. + * + * @since S60 3.2.3 + * @param aUids contains plugin uids + */ + IMPORT_C void GetPluginUids(RArray& aUids) const; + + /** + * All the UIDs of the plug-ins in the system of a specific type. + * + * @since S60 3.2.3 + * @param aPlugins OUT parameter. Array of UIDs of all plugins of type + * aPluginType. Client is responsible for the memory + * management of this RArray. + * @param aPluginType IN parameter. Plugin type + */ + IMPORT_C void GetPluginUidsL(RArray& aPlugins, + TInt aPluginType) const; + + /** + * Returns the UID of the plugin with the specified display name. + * + * @since S60 3.2.3 + * @param aPluginName a plugin's display name + * @return UID of the plugin. KNullUid is returned if there is no + * plugin by that name. + */ + IMPORT_C TUid PluginUid(const TDesC& aPluginName) const; + + /** + * Returns the index of the specified plugin. + * + * @param aPluginUid UID of the plugin to search for + * @return index of the specified plugin in CMPXPluginMonitor's 3 + * arrays, iPluginsInfo, iPluginUids, and iPluginTypes. + * KErrNotFound, if no matching object can be found. + */ + IMPORT_C TInt IndexOf(const TUid& aPluginUid) const; + + /** + * Create a list of plugins. + * + * @since S60 3.2.3 + */ + IMPORT_C void CreatePluginListL(); + + /** + * Check if the plugin supports the array of uids. + * + * @since S60 3.2.3 + * @param aPluginId plugin id + * @param aUids contains plugin uids + * @return ETrue if plugin supports all uids + */ + IMPORT_C TBool SupportUids(const TUid& aPluginId, + const TArray& aUids) const; + + /** + * Find a plugin with matches the array of uids the best. + * + * @since S60 3.2.3 + * @param aUids contains plugin uids + * @return Implementation id of collection plugin, + * KNullUidValue will be returned if no plugin found + */ + IMPORT_C TUid FindPlugin(const TArray& aUids) const; + +protected: + MMPXPluginHandlerObserver& iObserver; // observer + TUid iInterfaceUid; // plugin interface Uid + CMPXPluginMonitor* iPluginMonitor; + RPointerArray iPluginInfoArray; // Ordered by priority + TBool iOwnedPluginMonitor; + + // + // Selection parameters + // + TPluginSelection iSelection; + TInt iSelectedType; + TUid iSelectedUid; + + // + // Resolution parameters + // + HBufC8* iDataType; + HBufC8* iScheme; + HBufC8* iExt; + }; + +#endif // CMPXPLUGINHANDLERBASE_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxpluginhandlerobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxpluginhandlerobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2008 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: Observer interface for the plugin handler. +* +*/ + + +#ifndef MPXPLUGINHANDLEROBSERVER_H +#define MPXPLUGINHANDLEROBSERVER_H + +// INCLUDES +#include + +/** +* Mix-in class for callback. +* +* @lib mpxcommon.lib +*/ +NONSHARABLE_CLASS(MMPXPluginHandlerObserver) + { +public: + enum TPluginHandlerEvents + { + EPluginAdd, // generated after the plugin DLL is copied + EPluginUpdateStart, // generated before the plugin DLL is unloaded (if already loaded) + EPluginUpdateEnd, // generated after the new plugin version is loaded (if old version was loaded) + EPluginRemove // generated after the plugin DLL is removed but before the plugin instance is unloaded + }; + +public: + /** + * Indicates a change in the plugins managed by the handler. + * + * @since S60 3.2.3 + * @param aEvent event code + * @param aPluginUid plugin this event is related to + * @param aLoaded ETrue if the plugin is loaded, EFalse otherwise + * @param aData data associated with the event, its meaning depends on the event: + * EPluginAdd - new plugin version + * EPluginUpdateStart - new plugin version + * EPluginUpdateEnd - new plugin version + * EPluginRemove - old plugin version + */ + virtual void HandlePluginHandlerEvent(TPluginHandlerEvents aEvent, const TUid& aPluginUid, + TBool aLoaded, TInt aData) = 0; + }; + +#endif // MPXPLUGINHANDLEROBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxplugininfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxplugininfo.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,333 @@ +/* +* Copyright (c) 2006 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: MPX plugin implementation info +* +*/ + + + +#ifndef C_CMPXPLUGININFO_H +#define C_CMPXPLUGININFO_H + + +// INCLUDES +#include +#include +#include + +// CONSTANTS +const TInt KMPXArrayGranularity = 4; + +// FORWARD DECLARATIONS + + +// CLASS DECLARATION + +/** +* InternalComponent. +* Interface to be implemented by customers of the class TaggedDataParser. +* +* @lib mpxcommon.lib +*/ +NONSHARABLE_CLASS(MTaggedDataParserClient) + { +public: + /** + * Process a tagged data. + * + * @since S60 3.2.3 + * @param aTag xml-styled tag + * @param aData data in the xml-styled tag + */ + virtual void ProcessTaggedDataL(const TDesC8& aTag, const TDesC8& aData)=0; + }; + +/** + * MPX plugin info. + * + * @lib mpxcommon.lib + */ +class CMPXPluginInfo : public CBase, + public MTaggedDataParserClient + { +public: + + /** + * Two-phased constructor. + * + * @since S60 3.2.3 + * @param aData Plugin's implementation information. + * @return Pointer to newly created object. + */ + static CMPXPluginInfo* NewL(const CImplementationInformation& aData ); + + /** + * Two-phased constructor. + * + * @since S60 3.2.3 + * @param aData Plugin's implementation information. + * @return Pointer to newly created object. + */ + static CMPXPluginInfo* NewLC(const CImplementationInformation& aData ); + + /** + * Destructor. + * + * @since S60 3.2.3 + */ + IMPORT_C virtual ~CMPXPluginInfo(); + +protected: // From base class + + /** + * Process a tagged data. + * + * @since S60 3.2.3 + * @param aTag xml-styled tag + * @param aData data in the xml-styled tag + */ + IMPORT_C void ProcessTaggedDataL(const TDesC8& aTag, const TDesC8& aData); + + /** + * Process a extended tagged data which derived class may support. + * Default implementation in this class just ignore the data. + * + * @since S60 3.2.3 + * @param aTag xml-styled tag + * @param aData data in the xml-styled tag + */ + IMPORT_C virtual void ProcessTaggedDataExL(const TDesC8& aTag, const TDesC8& aData); + +public: // new functions + /** + * Returns plugin's display name. + * + * @since S60 3.2.3 + * @return Plugin's display name. + */ + const TDesC& DisplayName() const; + + /** + * Returns plugin's implementation uid. + * + * @since S60 3.2.3 + * @return Plugin's implementation uid. + */ + IMPORT_C const TUid& ImplementationUid() const; + + /** + * Returns plugin's supported uids. + * + * @since S60 3.2.3 + * @return Plugin's supported uids. + */ + const TArray SupportedUids() const; + + /** + * Returns plugin's plugin type. + * + * @since S60 3.2.3 + * @return Plugin's plugin type. + */ + const TUid& PluginType() const; + + /** + * Returns plugin's supported App Uid. + * + * @return Plugin's supported App Uid.. + */ + const TUid& SupportedAppUid() const; + + /** + * Returns plugin's priority. + * + * @since S60 3.2.3 + * @return Plugin's priority. + */ + TInt Priority() const; + + /** + * Returns supported mime types. + * + * @since S60 3.2.3 + * @return supported mime types + */ + const CDesCArray& SupportedMimeTypes() const; + + /** + * Returns supported extensions. + * + * @since S60 3.2.3 + * @return supported extensions + */ + const CDesCArray& SupportedExtensions() const; + + /** + * Returns supported schemas. + * + * @since 3.0 + * @return supported schemas + */ + const CDesCArray& SupportedSchemas() const; + + /** + * Check if the plugin supports the array of uids. + * + * @since S60 3.2.3 + * @param aUids contains plugin uids + * @return ETrue if plugin supports all uids + */ + TBool SupportUids(const TArray& aUids) const; + + /** + * Returns the flags bit array. + * + * @since S60 3.2.3 + * @return flags value + */ + IMPORT_C TUint Flags() const; + + /** + * Returns a reference to the reference count. + * + * @since S60 3.2.3 + * @return reference count + */ + TInt& ReferenceCount(); + + /** + * Returns the plugin version. + * + * @since S60 3.2.3 + * @return version as integer. + */ + TInt Version() const; + + /** + * Compare two plugin info by prioritiy. + * + * @since S60 3.2.3 + * @param aPluginInfo1 the first plugin info object + * @param aPluginInfo2 the second plugin info object + * @return zero if two plugins have same priority + * a negative value(-1), if the priority of the first is higher than + * the second's. That is to say, plugins with higher priority is + * listed before plugins with lower priority + * a positive value(1), if the priority of the first is lower than + * the second's. + */ + static TInt ComparePluginInfoByPriority(const CMPXPluginInfo& aPluginInfo1, + const CMPXPluginInfo& aPluginInfo2); + +protected: + + /** + * C++ default constructor. + * + * @since S60 3.2.3 + */ + IMPORT_C CMPXPluginInfo(); + + /** + * By default Symbian 2nd phase constructor is private. + * + * @since S60 3.2.3 + * @param aData Plugin's implementation information. + * @leave The function leaves with one of the system wide error codes, + */ + IMPORT_C void ConstructL(const CImplementationInformation& aData ); + + /** + * Extracts plugin supported Uids from data. + * + * @since S60 3.2.3 + * @param aData Supported uids descriptor separated by comma. + */ + void ExtractSupportedUidsL(const TDesC8& aData); + + /** + * Extracts a list of UIDs from a text string. + * + * @since S60 3.2.3 + * @param aData Supported uids descriptor separated by comma. + * @param aArray array to insert the data into + * @leave The function leaves with one of the system wide error codes, + */ + IMPORT_C void ExtractUidsFromTextL( const TDesC8& aData, + RArray& aArray ); + + /** + * Extracts elemements separated by semicolon into array descriptor + * + * @param aText original content to extract elements from + * @param aArray the array to add the extracted elements to + */ + IMPORT_C void ExtractIntoArrayL(const TDesC8& aText, CDesCArray*& aArray); + +protected: // data + /** + * List of supported Uids. Sorted by TUid.iUid + */ + RArray iSupportedUids; + + /** + * Plugin's display name. + * Own. + */ + HBufC* iPluginName; + + /** + * Plugin's implementation Uid. + */ + TUid iPluginUid; + + /** + * Plugin's plugin type Uid. + */ + TUid iPluginTypeUid; + + /** + * Plugin's supported App Uid. + */ + TUid iSupportedAppUid; + /** + * Plugin feature flags. + */ + TUint iFlags; + + /** + * Plugin priority. + */ + TInt iPriority; + + /** + The version number of this plugin. + */ + TInt iVersion; + + /** + * Loaded plugin reference count. + */ + TInt iReferenceCount; + + // Note: move the following staff into derived plugin info class, + // so that the plugin info class can be base class for all plugins in mpx + CDesCArray* iSupportedSchemas; + CDesCArray* iSupportedMimeTypes; + CDesCArray* iSupportedExtensions; + }; + +#endif // C_CMPXPLUGININFO_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxpluginmonitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxpluginmonitor.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2006 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: Plugin monitor +* +*/ + + +#ifndef CMPXPLUGINMONITOR_H +#define CMPXPLUGINMONITOR_H + +#include +#include +#include + +/** +* Monitors a designated plugin interface. When a plugin for that interface is +* added or removed, if a client is interested in the event, client will be +* notified through MMPXPluginMonitorObserver interface. +* +* @lib mpxcommon.lib +*/ +class CMPXPluginMonitor : public CActive + { + +public: + /** + * Two-phased constructor. + * + * @since S60 3.2.3 + * @param aInterfaceUid The UID of the plugin interface to be monitored by + * this instance of CMPXPluginMonitor + * @return Constructed object + */ + IMPORT_C static CMPXPluginMonitor* NewL(const TUid& aInterfaceUid); + + /** + * Destructor. + * + * @since S60 3.2.3 + */ + IMPORT_C ~CMPXPluginMonitor(); + + /** + * Add a observer. + * + * @since S60 3.2.3 + * @param aObs observer to be added + */ + void AddObserverL(MMPXPluginMonitorObserver& aObs); + + /** + * Remove a observer. + * + * @since S60 3.2.3 + * @param aObs observer to be removed + */ + void RemoveObserverL(MMPXPluginMonitorObserver& aObs); + + /** + * Request to notify all observers that they should unload a specified plugin + * because it is being updated. + * + * @since S60 3.2.3 + * @param aPluginUid plugin that is being updated + */ + void NotifyUnload(const TUid& aPluginUid); + +private: + + /** + * 2nd phase contructor. + * + * @since S60 3.2.3 + */ + void ConstructL(); + + /** + * C++ constructor. + * + * @since S60 3.2.3 + * @param aInterfaceUid The UID of the plugin interface to be monitored by + * this instance of CMPXPluginMonitor + */ + CMPXPluginMonitor(const TUid& aInterfaceUid); + + /** + * From CActive. + * Handles an active object's request completion event. + * + * @since S60 3.2.3 + */ + void RunL(); + + /** + * From CActive. + * Handles a leave occurring in the request completion event handler RunL(). + * + * @since S60 3.2.3 + * @param aError error code + * @return system error code + */ + TInt RunError(TInt aError); + + /** + * From CActive. + * Implements cancellation of an outstanding request. + * + * @since S60 3.2.3 + */ + void DoCancel(); + +private: + TUid iInterfaceUid; + RPointerArray iObservers; // items not owned + REComSession iECs; + }; + +#endif // CMPXPLUGINMONITOR_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxpluginmonitorobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxpluginmonitorobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2006 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: plugin monitor observer +* +*/ + + +#ifndef MMPXPLUGINMONITOROBSERVER_H +#define MMPXPLUGINMONITOROBSERVER_H + +/** +* Observer interface for a plugin monitor. +* +* @lib mpxcommon.lib +*/ +NONSHARABLE_CLASS(MMPXPluginMonitorObserver) + { + public: + + /** + * Callback whenever there is a change in loaded plugins. This is + * called from CMPXPluginMonitor::RunL and should not be a long + * running task. + * + * @since S60 3.2.3 + */ + virtual void PluginsChangedL() = 0; + + /** + * Indicates that a plugin should be unloaded if it is loaded by the observer. + * This call is made when a plugin update is detected by a plugin handler and + * after all old plugin instances are unloaded the plugin handler can load the + * new plugin version. All plugin handlers should maintain the reference count + * for the plugin, as they will get a PluginsChangedL notification following one + * or multiple HandlePluginUnload calls and they will need to know what plugins + * were loaded before the update so they can be reloaded. + * + * @since S60 3.2.3 + */ + virtual void HandlePluginUnload(const TUid& aPluginUid) = 0; + }; + +#endif // MMPXPLUGINMONITOROBSERVER_H + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxpodcastdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxpodcastdefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,137 @@ +/* +* Copyright (c) 2006 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: Definitions for podcast type +* +*/ + + + +#ifndef CMPXPODCASTDEFS_H +#define CMPXPODCASTDEFS_H + +#include +#include + +/** +* Content ID identifying Podcast category of content provided +* in the media object and associated attributes. +*/ +const TInt KMPXMediaIdPodcast = 0x101FFC46; + + +enum TMPXPodcastCategory + { + EMPXAll, // 0 + EMPXTitle, // 1 + EMPXPubDate, // 2 + EMPXRecentlyAdded, // 3 + EMPXNotYetPlayed, // 4 + EMPXNew, // 5 + EMPXPartlyPlayed, // 6 + EMPXCompletelyPlayed, // 7 + EMPXEpisode, // 8 + EMPXPodcastFile, // 9 + EMPXPodcastCollection, // 10 + EMPXUnknown + }; + +enum TMPXPodcastType + { + EMPXPodcastNoType, + EMPXPodcastGroup, + EMPXPodcastItem + }; + +/** +* TMPXPodcastType: see above enum definition +*/ +const TMPXAttributeData KMPXMediaPodcastType={KMPXMediaIdPodcast,0x01}; + +/** +* Descriptor +*/ +const TMPXAttributeData KMPXMediaPodcastTitle={KMPXMediaIdPodcast,0x02}; + +/** +* Descriptor +*/ +const TMPXAttributeData KMPXMediaPodcastCategory={KMPXMediaIdPodcast,0x04}; + +/** +* TTime +*/ +const TMPXAttributeData KMPXMediaPodcastPubDate={KMPXMediaIdPodcast,0x08}; + +/** +* TMPXPodcastCategory: See above for enum definition +*/ +const TMPXAttributeData KMPXMediaPodcastCategoryGroup={KMPXMediaIdPodcast,0x10}; + +/** +* TUint +*/ +const TMPXAttributeData KMPXMediaPodcastPlayCount={KMPXMediaIdPodcast,0x20}; + +/** +* TMPXItemId +*/ +const TMPXAttributeData KMPXMediaPodcastPubDateCategoryId={KMPXMediaIdPodcast,0x40}; + +/** +* TBool +*/ +const TMPXAttributeData KMPXMediaPodcastIsPlaying={KMPXMediaIdPodcast,0x80}; + +/** +* TBool +*/ +const TMPXAttributeData KMPXMediaPodcastSetIsPlayingTrue={KMPXMediaIdPodcast,0x100}; + +/** +* TInt +*/ +const TMPXAttributeData KMPXMediaPodcastCurrentlyPlayingIndex = {KMPXMediaIdPodcast,0x200}; + +/** +* Attributes supported for KMPXMediaIdPodcast +*/ +enum + { + EMPXMediaPodcastType = 0x01, + EMPXMediaPodcastTitle = 0x02, // Text + EMPXMediaPodcastCategory = 0x04, // Text, episode category + EMPXMediaPodcastPubDate=0x08, // TTime + EMPXMediaPodcastCategoryGroup = 0x10, // See enum TMPXPodcastCategory + EMPXMediaPodcastPlayCount = 0x20, // TBool + EMPXMediaPodcastPubDateCategoryId = 0x40, // TMPXItemId + EMPXMediaPodcastIsPlaying = 0x80, // TBool + EMPXMediaPodcastSetIsPlayingTrue = 0x100, // TBool + EMPXMediaPodcastCurrentlyPlayingIndex = 0x200, //TInt + EMPXMediaPodcastAll=0xffffffff & ~(EMPXMediaPodcastSetIsPlayingTrue) + }; + +/** +* Used to indicate the current podcast collection view +*/ +enum TMPXPodcastView + { + EMPXMainPodcastMenuView, + EMPXTitlesView, + EMPXPublishDateView, + EMPXEpisodesView + }; + +#endif + + // CMPXPODCASTDEFS_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxpskeyobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxpskeyobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,42 @@ +/* +* 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: Observer class for Publish and Subscribe handling +* +*/ + + +#ifndef M_MPXPSKEYOBSERVER_H +#define M_MPXPSKEYOBSERVER_H + +/** + * Abstract interface to the PS key watcher. + * + * @lib mpxcommon.lib + */ +NONSHARABLE_CLASS(MMPXPSKeyObserver) + { +public: + + /** + * Handle PS event + * + * @since S60 3.2.3 + * @param aUid The UID that identifies the property category + * @param aKey The property sub-key + */ + virtual void HandlePSEvent(TUid aUid, TInt aKey) = 0; + }; + + +#endif // M_MPXPSKEYOBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxpskeywatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxpskeywatcher.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,155 @@ +/* +* Copyright (c) 2006 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: Publish and Subscribe key watcher +* +*/ + + +#ifndef C_MPXPSKEYWATCHER_H +#define C_MPXPSKEYWATCHER_H + +#include + +#include + +class MMPXPSKeyObserver; + +/** + * Publish and subscribe key watcher. + * + * @lib MPXCommon.lib + */ +class CMPXPSKeyWatcher : public CActive + { +public: + + /* + * Two Phased Constructor. + * + * @since S60 3.2.3 + * @param aUid PubSub UID to watch + * @param aKey specific key to watch + * @return Construced object + */ + IMPORT_C static CMPXPSKeyWatcher* NewL( TUid aUid, TInt aKey, + MMPXPSKeyObserver* aObserver ); + + /* + * virtual destructor. + * + * @since S60 3.2.3 + */ + IMPORT_C virtual ~CMPXPSKeyWatcher(); + +public: // New Functions + + /* + * Return the value of the key. + * + * @since S60 3.2.3 + * @param aValue + * @return KErrNone, if successful otherwise system error + */ + IMPORT_C TInt GetValue( TInt& aValue ); + + /* + * Return the value of the key. + * + * @since S60 3.2.3 + * @param aValue + * @return KErrNone, if successful otherwise system error + */ + IMPORT_C TInt GetValue( TDes8& aValue ); + + /* + * Return the value of the key. + * + * @since S60 3.2.3 + * @param aValue + * @return KErrNone, if successful otherwise system error + */ + IMPORT_C TInt GetValue( TDes16& aValue ); + + /* + * Sets the value of the key. + * + * @since S60 3.2.3 + * @params aValue + * @return KErrNone, if successful otherwise system error + */ + IMPORT_C TInt SetValue(TInt aValue ); + + /* + * Sets the value of the key. + * + * @since S60 3.2.3 + * @params aValue + * @return KErrNone, if successful otherwise system error + */ + IMPORT_C TInt SetValue( const TDesC8& aValue ); + + /* + * Sets the value of the key. + * + * @since S60 3.2.3 + * @params aValue + * @return KErrNone, if successful otherwise system error + */ + IMPORT_C TInt SetValue( const TDesC16& aValue ); + +protected: // From Base class + + /* + * From CActive. + * + * @since S60 3.2.3 + */ + void RunL(); + + /* + * From CActive. + * + * @since S60 3.2.3 + */ + void DoCancel(); + +private: + + /* + * Default Constructor. + * + * @since S60 3.2.3 + * @param aUid PubSub key to watch + * @param aKey specific key to watch + */ + CMPXPSKeyWatcher( TUid aUid, + TInt aKey, + MMPXPSKeyObserver* aObserver ); + + /* + * Second phased constructor. + * + * @since S60 3.2.3 + */ + void ConstructL(); + +private: // data + + RProperty iProperty; + MMPXPSKeyObserver* iObserver; // not owned + TUid iUid; // Uid that we are watching + TInt iKey; // Key that we are watching + }; + +#endif // C_MPXPSKEYWATCHER_H \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxsession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxsession.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,130 @@ +/* +* Copyright (c) 2006 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: Client session class to server +* +*/ + +#ifndef RMPXSESSION_H +#define RMPXSESSION_H + +#include + + +class RMPXSessionRetry; + +/** +* Client session to playback server. +* +* @lib MPXCommon.lib +*/ +class RMPXSession + { + public: + /** + * Constructor + * + * @since S60 5.0 + */ + IMPORT_C RMPXSession(); + + /** + * Destructor + * + * @since S60 5.0 + */ + IMPORT_C ~RMPXSession(); + + /** + * Get version info. + * + * @since S60 3.2.3 + * @return version info + */ + IMPORT_C TVersion Version() const; + + /** + * Connect to server. + * + * @since S60 3.2.3 + * @param aServer server name + * @param aImage server image name + * @return KErrNone success, otherwise system error code + */ + IMPORT_C TInt Connect(const TDesC& aServer, + const TDesC& aImage, + const TVersion& aVersion); + + /** + * Reconnect to server. + * + * @since S60 5.0 + * @return KErrNone success, otherwise system error code + */ + IMPORT_C TInt Reconnect() const; + + /** + * Send a message. + * + * @since S60 3.2.3 + * @param aFunction function code + * @return message completion code + */ + IMPORT_C TInt SendReceiveL(TInt aFunction) const; + + /** + * Send a message. + * + * @since S60 3.2.3 + * @param aFunction function code + * @param aArgs parameter to server + * @return message completion code + */ + IMPORT_C TInt SendReceiveL(TInt aFunction,const TIpcArgs& aArgs) const; + + /** + * Send message asynchronously. + * + * @since S60 3.2.3 + * @param aFunction function code + * @param aStatus the request status object used to contain the + * completion status of the request + */ + IMPORT_C void SendReceive(TInt aFunction,TRequestStatus& aStatus) const; + + /** + * Send message asynchronously. + * + * @since S60 3.2.3 + * @param aFunction function code + * @param aArgs parameter to server + * @param aStatus the request status object used to contain the + * completion status of the request + */ + IMPORT_C void SendReceive(TInt aFunction,const TIpcArgs& aArgs, + TRequestStatus& aStatus) const; + + /** + * Close session. + * + * @since S60 3.2.3 + */ + IMPORT_C void Close(); + + private: + RMPXSessionRetry* iSessionRetry; + }; + +#endif // RMPXSESSION_H + +// End of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxsubscription.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxsubscription.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2007 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: Encapsulates message subscriptions. +* +*/ + + + +#ifndef MPXSUBSCRIPTION_H +#define MPXSUBSCRIPTION_H + +// INCLUDES +#include +#include + +/** +* MPX subscription item class. +* +* #defined to CMPXMedia for now. +*/ +typedef CMPXMedia CMPXSubscriptionItem; + +/** +* A subscription instance includes one or more subscription items. +* An MPX client can have one or more subscriptions. +* +* @lib MPXCommon.lib +*/ +class CMPXSubscription : + public CMPXMedia + { + public: + /** + * Two phased constructor. + * + * @since S60 3.2.3 + * @return New CMPXSubscription instance. + */ + IMPORT_C static CMPXSubscription* NewL(); + + /** + * Two phased constructor. + * + * @since S60 3.2.3 + * @param aMediaArray Subscription item array to initialize with. + * @return New CMPXSubscription instance. + */ + IMPORT_C static CMPXSubscription* NewL(CMPXMediaArray& aMediaArray); + + /** + * Adds a new subscription item to the subscription. + * + * @since S60 3.2.3 + * @param aItem Subscription item to add. + */ + IMPORT_C void AddItemL(const CMPXSubscriptionItem& aItem); + + /** + * Returns the subscription item array. + * + * @since S60 3.2.3 + * @leave KErrNoMemory if out of memory + * @return subsription items array + */ + IMPORT_C const CMPXMediaArray* ItemsL() const; + + /** + * Comparison operator. + * + * @since S60 3.2.3 + * @param aSubscription subscription to compare with + */ + IMPORT_C TBool operator==(const CMPXSubscription& aSubscription) const; + + /** + * Prints the subscription. + * + * @since S60 3.2.3 + */ + void DebugPrint() const; + + private: + /** + * Third phase constructor. + * + * @since S60 3.2.3 + */ + void InitializeL(); + + /** + * Third phase constructor. + * + * @since S60 3.2.3 + * @param aMediaArray Subscription item array to initialize with. + */ + void InitializeL(CMPXMediaArray& aMediaArray); + }; + +#endif // MPXSUBSCRIPTION_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxtaskqueue.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxtaskqueue.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,257 @@ +/* +* Copyright (c) 2006 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: Serializing the task +* +*/ + + +#ifndef CMPXTASKQUEUE_H +#define CMPXTASKQUEUE_H + +#include + +class MMPXTaskQueueObserver; +class CMPXTaskQueueScheduler; +class CTask; + +/** +* Encapsulates a task queue. +* +* @lib MPXCommon.lib +*/ +class CMPXTaskQueue : public CBase + { +public: + /** + * Two-phased constructor. + * + * @since S60 3.2.3 + * @return object of constructed + */ + IMPORT_C static CMPXTaskQueue* NewL(); + + /** + * Destructor. + * + * @since S60 3.2.3 + */ + IMPORT_C virtual ~CMPXTaskQueue(); + + /** + * Add a task into the queue. + * + * @since S60 3.2.3 + * @param aTask task id + * @param aCallback callback + * @param aParamData parameter data of the task + * @param aBuf extra data in buffer, ownership transferred. + * @param aPtrData object pointer, owership not transferred. + * @param aCObject1 pointer to CBased object, ownership transferred + * @param aCObject2 pointer to CBased object, ownership transferred + */ + IMPORT_C void AddTaskL(TInt aTask, + TAny* aCallback, + TInt aParamData=0, + CBufBase* aBuf=NULL, + TAny* aPtrData=NULL, + CBase* aCObject1=NULL, + CBase* aCObject2=NULL); + + /** + * Remove current task, return callback function. + * + * @since S60 3.2.3 + * @return callback object + */ + IMPORT_C TAny* RemoveTask(); + + /** + * Remove task for one client. + * + * @since S60 3.2.3 + */ + IMPORT_C void RemoveTask(TAny* aCallback); + + /** + * Return if the queue is empty. + * + * @since S60 3.2.3 + * @return ETrue empty + */ + IMPORT_C TBool IsEmpty(); + + /** + * Reset task queue. + * + * @since S60 3.2.3 + */ + IMPORT_C void Reset(); + + /** + * Get current task id. + * + * @since S60 3.2.3 + * @return task id + */ + IMPORT_C TInt Task(); + + /** + * Get current call back. + * + * @since S60 3.2.3 + * @return call back + */ + IMPORT_C TAny* Callback(); + + /** + * Get current parameter data. + * + * @since S60 3.2.3 + * @return parameter data + */ + IMPORT_C TInt Param(); + + /** + * Get pointer parameter data. Client has ownership of this data. + * + * @since S60 3.2.3 + * @return pointer paramter + */ + IMPORT_C TAny* PtrData(); + + /** + * Get pointer to buffer data. Task Queue has ownership of this buffer. + * + * @since S60 3.2.3 + * @return buffer paramter + */ + IMPORT_C const TDesC8& BufData(); + +protected: + /** + * C++ constructor. + * + * @since S60 3.2.3 + */ + CMPXTaskQueue(); + + /** + * 2nd phase contructor. + * + * @since S60 3.2.3 + */ + void ConstructL(); + +protected: //data + TSglQue iTaskList; + }; + +/** +* Encapsulates a task queue which will auto schedule the task +* +* @lib MPXCommon.lib +*/ +class CMPXActiveTaskQueue : public CMPXTaskQueue + { +public: + /** + * Two-phased constructor. + * + * @since S60 3.2.3 + * @param aObserver the observer + * @return object of constructed + */ + IMPORT_C static CMPXActiveTaskQueue* NewL(); + + /** + * Destructor. + * + * @since S60 3.2.3 + */ + IMPORT_C virtual ~CMPXActiveTaskQueue(); + + /** + * Add a task and automatically schedule task. + * + * @since S60 3.2.3 + * @param aTask task id + * @param aCallback callback + * @param aHandler task handler + * @param aParamData data + * @param aBuf pointer to the buffer containing + * externalized parameter data. + * Client passes ownership of the buffer + * to TaskQueue. + * @param aPtrData object pointer + * @param aCObject1 pointer to CBased object, ownership transferred + * @param aCObject2 pointer to CBased object, ownership transferred + */ + IMPORT_C void AddTaskL(TInt aTask, + TAny* aCallback, + MMPXTaskQueueObserver* aHandler, + TInt aParamData=0, + CBufBase* aBuf=NULL, + TAny* aPtrData=NULL, + CBase* aCObject1=NULL, + CBase* aCObject2=NULL); + + /** + * Schedule to execute next task. + * + * @since S60 3.2.3 + */ + IMPORT_C void ScheduleNextTask(); + + /** + * Cancel all outstanding, asynchronous requests. + * + * @since S60 3.2.3 + */ + IMPORT_C void CancelRequests(); + + /** + * Complete current task. + * + * @since S60 3.2.3 + */ + IMPORT_C void CompleteTask(); + + /** + * Completes all outstanding tasks with an error code. + * + * @since S60 3.2.3 + */ + IMPORT_C void CompleteAllTasks(TInt aError); + +private: + /** + * C++ constructor. + * + * @since S60 3.2.3 + */ + CMPXActiveTaskQueue(); + + /** + * 2nd phase contructor. + * + * @since S60 3.2.3 + */ + void ConstructL(); + +private: // Data + CMPXTaskQueueScheduler* iScheduler; + + }; + +#endif // CMPXTASKQUEUE_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxtaskqueueobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxtaskqueueobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2006 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: Task queue observer +* +*/ + + +#ifndef MMPXTASKQUEUEOBSERVER_H +#define MMPXTASKQUEUEOBSERVER_H + +#include + +/** +* Mix-in class for callback. +* +* @lib MPXCommon.lib +*/ +NONSHARABLE_CLASS( MMPXTaskQueueObserver ) + { +public: + /** + * Execute a task. + * + * @since S60 3.2.3 + * @param aTask task number + * @param aParamData parameter + * @param aPtrData pointer to any object + * @param aBuf buffer containing externalized parameters for the task. + * @param aCallback call back function pointer + * @param aCObject1 object 1 owned by task queue + * @param aCObject2 object 2 owned by task queue + */ + virtual void ExecuteTask(TInt aTask, + TInt aParamData, + TAny* aPtrData, + const CBufBase& aBuf, + TAny* aCallback, + CBase* aCObject1, + CBase* aCObject2) = 0; + + /** + * Indicates that the specified task was completed with an error. This may have happened + * before the task was actually executed. + * + * @since S60 3.2.3 + * @param aTask task number + * @param aPtrData pointer to any object + * @param aCallback call back function pointer + * @param aError error code + */ + virtual void HandleTaskError(TInt /* aTask */, + TAny* /*aPtrData*/, + TAny* /*aCallback*/, + TInt /* aError */){}; + }; + +#endif // MMPXTASKQUEUEOBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/inc/mpxuser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/inc/mpxuser.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,328 @@ +/* +* Copyright (c) 2006 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: mpx user helper classes +* +*/ + + +#ifndef MPXUSER_H +#define MPXUSER_H + +#include +#include +#include +#include +#include +#include + +// MACRO +#if !defined(MPX_ASSERT) +_LIT(KMPX, "MPX"); +_LIT(_KMPXAssertErrorInfo, "**MPX ASSERT**: error %d file %s line %d"); +#define MPX_ASSERT_S(a) _S(a) +#define MPX_ASSERT_ALWAYS(c) {\ + if (!(c)) {RDebug::Print(_KMPXAssertErrorInfo, 0, MPX_ASSERT_S(__FILE__), __LINE__);\ + User::Invariant();}\ + } +#define MPX_ASSERT_EX_ALWAYS(c,e) {\ + if (!(c)) {RDebug::Print(_KMPXAssertErrorInfo, e, MPX_ASSERT_S(__FILE__), __LINE__);\ + User::Panic(KMPX, (e));}\ + } +#ifdef _DEBUG +#define MPX_ASSERT(c) MPX_ASSERT_ALWAYS(c) +#define MPX_ASSERT_EX(c,e) MPX_ASSERT_EX_ALWAYS(c,e) +#else +#define MPX_ASSERT(c) +#define MPX_ASSERT_EX(c,e) +#endif // _DEBUG +#define MPX_ASSERT_WORD_ALIGNED(x) MPX_ASSERT((((TUint)x)&3)==0) +#endif // MPX_ASSERT + +// CONSTANTS +const TInt KMPXBufGranularity = 0x100; // 256 bytes + +// Generic type for voice/video/VOIP calls +const TInt KMPXCallTypeGenericVoice( -1 ); + +class CMPXMedia; +class TMPXAttribute; + + +/** +* Set of static functions for MPX clients. +* +* @lib MPXCommon.lib +*/ +NONSHARABLE_CLASS(MPXUser) + { +public: // static helper functions + + /** + * Helper to recreate a buffer. + * + * @since S60 3.2.3 + * @param aSize the size of buffer + * @param aBuf buf object + */ + IMPORT_C static void RecreateBufferL(TInt aSize, CBufBase*& aBuf); + + /** + * Helper to create an descriptor array from buf. + * + * @since S60 3.2.3 + * @param aBuf buf object + * @param aArray object + */ + IMPORT_C static void CreateFromBufferL(const CBufBase &aBuf, + CDesCArray*& aArray); + /** + * Helper to create a buffer. + * + * @since S60 3.2.3 + * @param aSize the size of buffer + * @return aBuf buf object + */ + IMPORT_C static CBufBase* CreateBufferLC(TInt aSize); + + /** + * Helper to create a buffer from descriptor array. + * + * @since S60 3.2.3 + * @param aArray array object + * @param aBuf buf object + * @return the size of buffer + */ + IMPORT_C static void CreateBufferL(const MDesCArray* aArray, + CBufBase*& aBuf); + + /** + * Fill up the buffer from a message. + * + * @since S60 3.2.3 + * @param aMessage the message + * @param aMsgSlot message slot index + * @param aBuffer buffer object + * @leave KErrArgument Invalid Message + */ + IMPORT_C static void CreateBufferL(const RMessage2& aMessage, + TInt aMsgSlot, + CBufBase*& aBuffer); + + /** + * Fill up the buffer from a desriptormessage. + * + * @since S60 3.2.3 + * @param aDes descriptor + * @param aBuffer buffer object + */ + IMPORT_C static void CreateBufferL(const TDesC& aDes, + CBufBase*& aBuffer); + + /** + * Creates a narrow heap descriptor from a unicode descriptor. + * No character conversion. + * + * @since S60 3.2.3 + * @param aDes source data + * @return new heap buffer object + */ + IMPORT_C static HBufC8* Alloc8L(const TDesC& aDes); + + /** + * Creates a zero-terminated narrow heap descriptor from a unicode descriptor. + * No character conversion. + * + * @since S60 3.2.3 + * @param aDes source data + * @return new heap buffer object + */ + IMPORT_C static HBufC8* Alloc8ZL(const TDesC& aDes); + + /** + * Creates a heap descriptor from a narrow descriptor. + * No character conversion. + * + * @since S60 3.2.3 + * @param aDes source data + * @return new heap buffer object + */ + IMPORT_C static HBufC* AllocL(const TDesC8& aDes); + + /** + * Creates a narrow ptr descriptor on a unicode descriptor. + * + * @since S60 3.2.3 + * @param aDes source data + * @return ptr descriptor + */ + IMPORT_C static TPtrC8 Ptr(const TDesC& aDes); + + /** + * Creates a unicode ptr descriptor on a narrow descriptor. + * + * @since S60 3.2.3 + * @param aDes source data + * @return ptr descriptor + */ + IMPORT_C static TPtrC Ptr(const TDesC8& aDes); + + /** + * Internalize a descriptor from a stream. + * + * @since S60 3.2.3 + * @param aArray descriptor array + * @param aStream stream object + */ + IMPORT_C static void InternalizeL(CDesCArray*& aArray, + RReadStream& aStream); + + /** + * Externalize a descriptor to a stream. + * + * @since S60 3.2.3 + * @param aArray descriptor array + * @param aStream stream object + */ + IMPORT_C static void ExternalizeL(const MDesCArray* aArray, + RWriteStream& aStream); + + /** + * Group attributes belonging to one content into an item in the array. + * + * @since S60 3.2.3 + * @param aSrc attribute array source + * @param aDest array with attributes merged + */ + IMPORT_C static void MergeAttributeL(const TArray& aSrc, + RArray& aDest); + + /** + * Return Process Id. + * + * @since S60 3.2.3 + * @param aId thread id of the client + * @return id of the process which owns the thread + */ + IMPORT_C static TProcessId ProcessIdL(TThreadId aId); + + /** + * Add array items in aSrc into sorted array aDest if the item is not in + * the aDest yet. + * + * @since S60 3.2.3 + * @param aSrc souce array + * @param aDest destination array + */ + IMPORT_C static void MergeArray(const MDesCArray& aSrc, CDesCArray& aDest); + + /** + * Copies elements from one array of descriptors to another. + * + * @since S60 3.2.3 + * @param aSrc souce array + * @param aDest destination array + */ + IMPORT_C static void CopyArrayL(const MDesCArray& aSrc, CDesCArray& aDest); + + /** + * Compare two uids. + * + * @since S60 3.2.3 + * @param aId1 the first uid + * @param aId2 the second uid + * @return zero if the two uids are equal. + * a negative value(-1), if the first uid is less than the second. + * a positive value(1), if the first uid is greater than the second. + */ + IMPORT_C static TInt CompareUids(const TUid& aId1, const TUid& aId2); + + /** + * Compare two sorted arrays of uids. + * + * @since S60 3.2.3 + * @param aArray1 the first array of uids + * @param aArray2 the second array of uids + * @return zero if the content of two arrays are equal. + * a positive value(1), if the ids count in the first array is + * more than the second's and the first array contains all of uids + * in the second array. + * otherwise, -1 returned. + */ + IMPORT_C static TInt CompareOrderedUidArrays(const TArray& aArray1, + const TArray& aArray2); + + /** + * Helper to create an array from stream. + * + * @since S60 3.2.3 + * @param aArray array object returned + * @param aStream stream object + */ + IMPORT_C static void InternalizeL(RArray& aArray, RReadStream& aStream); + + /** + * Helper to externalize an array to stream. + * + * @since S60 3.2.3 + * @param aArray array object + * @param aStream stream object + */ + IMPORT_C static void ExternalizeL(const TArray& aArray, RWriteStream& aStream); + + /** + * Helper to get the window group ID associated with a process. + * + * @since S60 3.2.3 + * @param aProcId process ID + * @return The Window Group ID associated with this process. Or KErrNotFound if there is none. + */ + IMPORT_C static TInt FindWindowGroupIdL( TProcessId aProcId, RWsSession& aWsSession ); + + /** + * Check if there is the given type call ongoing. + * + * @since S60 3.2.3 + * @param aCallType Call type defined in TPSTelephonyCallState + * @return ETrue if there is ongoing calls. EFalse otherwise. + */ + IMPORT_C static TBool IsCallOngoing( TInt aCallType ); + + /** + * Complete file name with file path of dll. + * + * @since S60 3.2.3 + * @param aFileName file name will be completed with dll's path + * @return error code if an error occured. In case of an error aFileName will + * not be changed + */ + IMPORT_C static TInt CompleteWithDllPath(const TDesC& aDllName, TDes& aFileName); + + /** + * Helper method to complete file name with file path of dll. + * + * @since S60 3.2.3 + * @param aFileName file name will be completed with dll's path + * @return error code if an error occured. In case of an error aFileName will + * not be changed + */ + inline static TInt CompleteWithDllPath(TDes& aFileName) + { + TFileName dllName; + Dll::FileName(dllName); + return CompleteWithDllPath(dllName, aFileName); + } + }; +#endif // MPXUSER_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/mpx_common_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/mpx_common_api.metaxml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,15 @@ + + +MPX Common API +Provides common interface to MPX framework +c++ +mpx + + + + + +no +no + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/conf/commontestclass.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/conf/commontestclass.cfg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,2390 @@ +// _Unsupported_ Those API could be not implemented and return KErrNotSupported + + +[Define] +KErrNotFound -1 +KErrNotSupported -5 +KErrArgument -6 +KErrNotReady -18 +KErrAccessDenied -21 + +KErrEventPending -2000 +KErrCallbackErrorCode -2001 +KErrUnexpectedValue -2002 +KErrNotificationPending -2005 +KErrUnexpectedNotification -2006 +KErrTimeoutController -2007 + +KTrue 1 +KFalse 0 + +// TMPXAttribute +KMPXAttContentID1 888881 +KMPXAttContentID2 888882 +KMPXAttAttributeID1 1 +KMPXAttAttributeID2 2 +KMPXAttAttributeText 4 +KMPXAttAttributeInt 8 +KMPXAttAttributeCObject 16 + +// TMPXAttributeType +KMPXTypeUnknown 0 +KMPXTypeTInt 1 +KMPXTypeText 2 +KMPXTypeTObject 3 +KMPXTypeCObject 4 + +// CMPXCollectionPath +KMPXPathLevel1 33331 +KMPXPathLevel2 33332 +KMPXPathLevel3 33333 +KMPXPathItem1 44441 +KMPXPathItem2 44442 +KMPXPathItem3 44443 +KMPXPathItem4 44444 +KMPXPathItem5 44445 + +// TMPXOpenMode +KMPXOpenDefault 0 +KMPXOpenGroupOrPlaylist 1 +KMPXOpenAllItems 2 +KMPXOpenNoPlaylist 3 +KMPXOpenPlaylistOnly 4 + +// TMPXCollectionPathChange +KPathChangeAdded 0 +KPathChangeDeleted 1 +KPathChangeModified 2 +KPathChangeGroupModified 3 + +// TMPXPathChangeResult +KChangeResultPathUnchanged 0 +KChangeResultPathModified 1 +KChangeResultPathClipped 2 + + +[Enddefine] + +//mpx_common_api +// +// +//--------------------------------------------------------------------------- +// TMPXAttribute +// +// MpxAttDefaultConst() +// MpxAttConst(contentID, attributeID) +// MpxAttCopyConstAtt(contentID, attributeID) +// MpxAttCopyConstAttData(contentID, attributeID) +// MpxAttOperatorAssignment(attributeIndex) +// MpxAttOperatorEqual(attributeIndex1, attributeIndex2, expectedResult) +// MpxAttStreamingL(attributeIndex) +// MpxAttContentId(contentID, attributeIndex) +// MpxAttAttributeId(attributeID, attributeIndex) +// MpxAttMatch(attributeIndex1, attributeIndex2, expectedResult) +// MpxAttMatchContentId(attributeIndex1, attributeIndex2, expectedResult) +// MpxAttOperatorAndAttData(attributeIndex1, attributeIndex2, expectedResult) +// MpxAttOperatorAndData(attributeIndex, attributeID, expectedResult) +// MpxAttOperatorOr(attributeIndex1, attributeIndex2, expectedResult) +// +//--------------------------------------------------------------------------- +// CMPXMedia +// +// MpxMediaNewL() +// MpxMediaNewLSupportedIdsL(contentID1, contentID2, ....) +// MpxMediaNewLMediaL(mediaIndex) +// MpxMediaNewLDataHandleL(mediaIndex) +// MpxMediaNewLStreamL(mediaIndex) +// MpxMediaOperatorAssignment(mediaIndex) +// MpxMediaSupportedIds(mediaIndex, contentID1, contentID2, ....) +// MpxMediaSetTObjectValueL(mediaIndex, attributeIndex, value) +// MpxMediaSetCObjectValueL(mediaIndex, attributeIndex, className) Note: className(CMPXMedia, CMPXMediaArray, CMPXCollectionPath) +// MpxMediaSetNoNewLCObjectL(mediaIndex, attributeIndex, className) +// MpxMediaSetTextValueL(mediaIndex, attributeIndex, value) +// MpxMediaAttributes(mediaIndex, attributeIndex) +// MpxMediaIsSupported(mediaIndex, attributeIndex, expectedResult) +// MpxMediaCount(mediaIndex, expectedResult) +// MpxMediaAttribute(mediaIndex, indexAtt, expectedAttributeIndex) +// MpxMediaAttributesSet(mediaIndex, contentID, expectedAttributes) +// MpxMediaIndex(mediaIndex, attributeIndex, expectedIndex) +// MpxMediaTypeIndex(mediaIndex, indexAtt, expectedType) +// MpxMediaTypeAttribute(mediaIndex, attributeIndex, expectedType) +// MpxMediaReset(mediaIndex) +// MpxMediaDeleteAttribute(mediaIndex, attributeIndex) +// MpxMediaDeleteIndex(mediaIndex, indexAtt) +// MpxMediaValueText(mediaIndex, attributeIndex, expectedString) +// MpxMediaValue(mediaIndex, attributeIndex, className) +// MpxMediaValueTObjectL(mediaIndex, attributeIndex, expectedValue) +// MpxMediaValueCObjectL(mediaIndex, attributeIndex, className) +// MpxMediaStreamingL(mediaIndex) +// +//--------------------------------------------------------------------------- +// CMPXMediaArray +// +// MpxMediaArrayNewL() +// MpxMediaArrayNewLMediaArrayL() +// MpxMediaArrayCount(expectedCount) +// MpxMediaArrayAppendLByPtrL() +// MpxMediaArrayAppendLByRefL() +// MpxMediaArrayReset() +// MpxMediaArrayRemove(index) +// MpxMediaArrayInsertByPtr(index) +// MpxMediaArrayInsertByRef(index) +// MpxMediaArrayInsertLByPtrL(index) +// MpxMediaArrayInsertLByRefL(index) +// MpxMediaArraySet(index) +// MpxMediaArrayStreamingL() +// +//--------------------------------------------------------------------------- +// CMPXCollectionPath +// +// MpxItemIdConst(optional id1, optional id2) +// MpxItemIdReset() +// MpxCollPathNewL() +// MpxCollPathNewLPathL() +// MpxCollPathNewLStreamL() +// MpxCollPathAppendLIdL(itemId) +// MpxCollPathAppendLIdsL() +// MpxCollPathLevels(expectedLevels) +// MpxCollPathBack() +// MpxCollPathReset() +// MpxCollPathIndex(expectedIndex) +// MpxCollPathOperatorPlus(expectedResult) +// MpxCollPathOperatorMinus(expectedResult) +// MpxCollPathSetToFirst() +// MpxCollPathSetToLast() +// MpxCollPathSetIndex(index) +// MpxCollPathSetId(id) +// MpxCollPathSetMode(openMode) +// MpxCollPathSetLAttrsL() +// MpxCollPathOpenNextMode(expectedOpenMode) +// MpxCollPathOpenPreviousMode(expectedOpenMode) +// MpxCollPathSelectLIdL(id) +// MpxCollPathSelectLIndexL(index) +// MpxCollPathSelectAllL() +// MpxCollPathDeselectId(id) +// MpxCollPathDeselectIndex(index) +// MpxCollPathDeselectAll() +// MpxCollPathRemoveId(id) +// MpxCollPathRemoveIndex(index) +// MpxCollPathIsSelectedId(id, expectedResult) +// MpxCollPathIsSelectedIndex(index, expectedResult) +// MpxCollPathClearSelection() +// MpxCollPathSelection(index1, index2, ...) +// MpxCollPathSelectionL(id1, id2, ...) +// MpxCollPathId(expectedId) +// MpxCollPathCount(expectedCount) +// MpxCollPathIndexOfId(id, expectedIndex) +// MpxCollPathIdOfIndex(index, expectedId) +// MpxCollPathOpenAttributes() +// MpxCollPathIndexLevel(level, expectedIndex) +// MpxCollPathIdLevel(level, expectedId) +// MpxCollPathStreamingL() +// MpxCollPathHandleChange(Uid, id, deprecatedId, changeType, expectedSelection, expectedChangeResult) +// +//--------------------------------------------------------------------------- +// CMPXClientList +// +// MpxClientListNewL() +// MpxClientListClientCount(expectedCount) +// MpxClientListIsClient(expecedResult) +// MpxClientListFindByMsg(expectedResult) +// MpxClientListFindById(expectedResult) +// +//--------------------------------------------------------------------------- +// CMPXPluginHandlerBase +// +// MpxPluginHandlerBaseSelectPluginLIdL() +// MpxPluginHandlerBaseSelectPluginLNameL() +// MpxPluginHandlerBaseSelectPluginLUriL() +// MpxPluginHandlerBaseSelectPluginLTypeL() +// MpxPluginHandlerBaseClearSelectionCriteria() +// MpxPluginHandlerBasePluginNameType() +// MpxPluginHandlerBasePluginNamesL() +// MpxPluginHandlerBaseSupportedMimeTypesL() +// MpxPluginHandlerBaseSupportedExtensionsL() +// MpxPluginHandlerBaseSupportedSchemasL() +// MpxPluginHandlerBaseSupportedMimeTypesLUidL() +// MpxPluginHandlerBaseSupportedExtensionsLUidL() +// MpxPluginHandlerBaseGetPluginTypes() +// MpxPluginHandlerBaseGetPluginUids() +// MpxPluginHandlerBaseGetPluginUidsL() +// MpxPluginHandlerBasePluginUid() +// MpxPluginHandlerBaseIndexOf() +// MpxPluginHandlerBaseCreatePluginListL() +// MpxPluginHandlerBaseFindPlugin() +// +//--------------------------------------------------------------------------- + + +[Test] +title 1. Create PluginMonitor +create commontestclass commontest +commontest CreatePluginMonitorL +delete commontest +[Endtest] + +[Test] +title 2. Delete PluginMonitor +create commontestclass commontest +commontest CreatePluginMonitorL +commontest DeletePluginMonitorL +delete commontest +[Endtest] + +[Test] +title 3. Create CenRepWatcher +create commontestclass watcher +watcher CreateCenRepWatcherL +delete watcher +[Endtest] + +[Test] +title 4. Delete CenRepWatcher +create commontestclass watcher +watcher CreateCenRepWatcherL +watcher DeleteCenRepWatcherL +delete watcher +[Endtest] + +[Test] +title 5. SetCenRepValue +create commontestclass watcher +watcher CreateCenRepWatcherL +watcher CenRepSetValueL 1 +delete watcher +[Endtest] + +// value in title 5 & 6 should be the same +// set value back to 0 after done testing +[Test] +title 6. GetCenRepValue +create commontestclass watcher +watcher CreateCenRepWatcherL +watcher CenRepCurrentValueL value == 1 +watcher CenRepSetValueL 0 +delete watcher +[Endtest] + +[Test] +title 7. Create CMPXParameter +create commontestclass parameter +parameter CreateMPXParameter +delete parameter +[Endtest] + +[Test] +title 8. Delete CMPXParameter +create commontestclass parameter +parameter CreateMPXParameter +parameter DeleteMPXParameter +delete parameter +[Endtest] + +[Test] +title 9. Internalize CMPXParameter +create commontestclass parameter +parameter CreateMPXParameter +parameter InternalizeMPXParameterL +parameter DeleteMPXParameter +delete parameter +[Endtest] + +[Test] +title 10. Externalize CMPXParameter +create commontestclass parameter +parameter CreateMPXParameter +parameter ExternalizeMPXParameterL +parameter DeleteMPXParameter +delete parameter +[Endtest] + +[Test] +title 11. Create CMPXCollectionTypeWithoutParam +create commontestclass type +type CreateMPXCollectionTypeWOParam +delete type +[Endtest] + +[Test] +title 12. Create CMPXCollectionType +create commontestclass type +type CreateMPXCollectionType +delete type +[Endtest] + +[Test] +title 13. Internalize CMPXCollectionType +create commontestclass type +type CreateMPXCollectionType +type InternalizeMPXCollectionTypeL +delete type +[Endtest] + +[Test] +title 14. Externalize CMPXCollectionType +create commontestclass type +type CreateMPXCollectionType +type ExternalizeMPXCollectionTypeL +delete type +[Endtest] + +[Test] +title 15. Create CMPXPSKeyWatcher +create commontestclass watcher +watcher CreateCMPXPSKeyWatcherL +delete watcher +[Endtest] + +[Test] +title 16. Delete CMPXPSKeyWatcher +create commontestclass watcher +watcher CreateCMPXPSKeyWatcherL +watcher DeleteCMPXPSKeyWatcherL +delete watcher +[Endtest] + +[Test] +title 17. Get Int Value CMPXPSKeyWatcher +create commontestclass watcher +watcher CreateCMPXPSKeyWatcherL +watcher GetTntValue +delete watcher +[Endtest] + +[Test] +title 18. Get Des8 Value CMPXPSKeyWatcher +create commontestclass watcher +watcher CreateCMPXPSKeyWatcherL +watcher GetDes8Value +delete watcher +[Endtest] + +[Test] +title 19. Get Des16 Value CMPXPSKeyWatcher +create commontestclass watcher +watcher CreateCMPXPSKeyWatcherL +watcher GetDes16Value +delete watcher +[Endtest] + +[Test] +title 20. Set Int Value CMPXPSKeyWatcher +create commontestclass watcher +watcher CreateCMPXPSKeyWatcherL +watcher SetTntValue +delete watcher +[Endtest] + +[Test] +title 21. Set Des8 Value CMPXPSKeyWatcher +create commontestclass watcher +watcher CreateCMPXPSKeyWatcherL +watcher SetDes8Value +delete watcher +[Endtest] + +[Test] +title 22. Set Des16 Value CMPXPSKeyWatcher +create commontestclass watcher +watcher CreateCMPXPSKeyWatcherL +watcher SetDes16Value +delete watcher +[Endtest] + +[Test] +title 23. Create CMPXDrmMediaUtilityL +create commontestclass drm +drm CreateCMPXDrmMediaUtilityL +delete drm +[Endtest] + +[Test] +title 24. Create CMPXDrmMediaUtilityLC +create commontestclass drm +drm CreateCMPXDrmMediaUtilityLC +delete drm +[Endtest] + +[Test] +title 25. Delete CMPXDrmMediaUtilityL +create commontestclass drm +drm CreateCMPXDrmMediaUtilityL +drm DeleteCMPXDrmMediaUtilityL +delete drm +[Endtest] + +[Test] +title 26. Init FileName CMPXDrmMediaUtilityL +create commontestclass drm +drm CreateCMPXDrmMediaUtilityL +drm InitFileNameL +drm Close +delete drm +[Endtest] + +[Test] +title 27. Init RFile CMPXDrmMediaUtilityL +create commontestclass drm +drm CreateCMPXDrmMediaUtilityL +drm InitRFileL +drm Close +delete drm +[Endtest] + +[Test] +title 28. GetMediaL CMPXDrmMediaUtilityL +create commontestclass drm +drm CreateCMPXDrmMediaUtilityL +drm GetMediaL +drm Close +delete drm +[Endtest] + +[Test] +title 29. Close CMPXDrmMediaUtilityL +create commontestclass drm +drm CreateCMPXDrmMediaUtilityL +drm Close +delete drm +[Endtest] + +[Test] +title 30. ConsumeL CMPXDrmMediaUtilityL +create commontestclass drm +drm CreateCMPXDrmMediaUtilityL +drm ConsumeL +drm Close +delete drm +[Endtest] + +[Test] +title 31. TMPXMessage3L TMPXMessage +create commontestclass message +message TMPXMessage3L +delete message +[Endtest] + +[Test] +title 32. TMPXMessageL TMPXMessage +create commontestclass message +message TMPXMessageL +delete message +[Endtest] + +[Test] +title 33. TMPXMessage1L TMPXMessage +create commontestclass message +message TMPXMessage1L +delete message +[Endtest] + +[Test] +title 34. Operator= TMPXMessage +create commontestclass message +message EqualTMPXMessage +delete message +[Endtest] + +[Test] +title 35. Event TMPXMessage +create commontestclass message +message Event +delete message +[Endtest] + +[Test] +title 36. Type TMPXMessage +create commontestclass message +message Type +delete message +[Endtest] + +[Test] +title 37. Data TMPXMessage +create commontestclass message +message Data +delete message +[Endtest] + +[Test] +title 38. Create CreateCMPXMessageQueueL +create commontestclass queue +queue CreateCMPXMessageQueueL +delete queue +[Endtest] + +[Test] +title 39. Delete CMPXMessageQueue +create commontestclass queue +queue CreateCMPXMessageQueueL +queue DeleteCMPXMessageQueue +delete queue +[Endtest] + +[Test] +title 40. Reset CMPXMessageQueue +create commontestclass queue +queue CreateCMPXMessageQueueL +queue ResetCMPXMessageQueue +queue DeleteCMPXMessageQueue +delete queue +[Endtest] + +[Test] +title 41. SendNext CMPXMessageQueue +create commontestclass queue +queue CreateCMPXMessageQueueL +queue SendNextCMPXMessageQueue +queue DeleteCMPXMessageQueue +delete queue +[Endtest] + +[Test] +title 42. Add CMPXMessageQueue +create commontestclass queue +queue CreateCMPXMessageQueueL +queue AddCMPXMessageQueue +queue DeleteCMPXMessageQueue +delete queue +[Endtest] + +[Test] +title 43. Version RMPXSession +create commontestclass session +session VersionRMPXSession +delete session +[Endtest] + +[Test] +title 44. Connect RMPXSession +create commontestclass session +session ConnectRMPXSessionL +delete session +[Endtest] + +[Test] +title 45. SendReceiveL RMPXSession +create commontestclass session +session SendReceiveLRMPXSessionL +delete session +[Endtest] + +[Test] +title 46. SendReceiveStatusRMPXSessionL RMPXSession +create commontestclass session +session SendReceiveStatusRMPXSessionL +delete session +[Endtest] + +[Test] +title 47. SendReceiveStatus3RMPXSessionL RMPXSession +create commontestclass session +session SendReceiveStatus3RMPXSessionL +delete session +[Endtest] + +[Test] +title 48. CreateCMPXMessageMonitorL CMPXMessageMonitor +create commontestclass monitor +monitor CreateCMPXMessageMonitorL +delete monitor +[Endtest] + +[Test] +title 49. RunL CMPXMessageMonitor +create commontestclass monitor +monitor CreateCMPXMessageMonitorL +monitor RunLCMPXMessageMonitorL +delete monitor +[Endtest] + +[Test] +title 50. Delete CMPXMessageMonitor +create commontestclass monitor +monitor CreateCMPXMessageMonitorL +monitor DeleteCMPXMessageMonitorL +delete monitor +[Endtest] + +[Test] +title 51. Create CMPXActiveTaskQueueL +create commontestclass task +task CreateCMPXActiveTaskQueueL +delete task +[Endtest] + +[Test] +title 52. CancelRequests CMPXActiveTaskQueueL +create commontestclass task +task CancelRequestsCMPXActiveTaskQueueL +delete task +[Endtest] + +[Test] +title 53. AddActiveTaskL CMPXActiveTaskQueueL +create commontestclass task +task AddTaskCMPXActiveTaskQueueL +delete task +[Endtest] + +[Test] +title 54. CompleteTask CMPXActiveTaskQueueL +create commontestclass task +task CompleteTaskCMPXActiveTaskQueueL +delete task +[Endtest] + +[Test] +title 55. IsEmptyTaskQueue CMPXActiveTaskQueueL +create commontestclass task +task IsEmptyCMPXTaskQueueL +delete task +[Endtest] + +[Test] +title 56. AddTaskL CMPXTaskQueueL +create commontestclass task +task AddTaskCMPXTaskQueueL +delete task +[Endtest] + +[Test] +title 57. RemoveTaskL CMPXTaskQueueL +create commontestclass task +task RemoveTaskCMPXTaskQueueL +delete task +[Endtest] + +[Test] +title 58. Callback CMPXTaskQueueL +create commontestclass task +task CallbackCMPXTaskQueueL +delete task +[Endtest] + +[Test] +title 59. Param CMPXTaskQueueL +create commontestclass task +task ParamCMPXTaskQueueL +delete task +[Endtest] + +[Test] +title 60. PtrData CMPXTaskQueueL +create commontestclass task +task PtrDataCMPXTaskQueueL +delete task +[Endtest] + +[Test] +title 61. BufData CMPXTaskQueueL +create commontestclass task +task BufDataCMPXTaskQueueL +delete task +[Endtest] + +[Test] +title 62. RemoveTask WO OB CMPXTaskQueueL +create commontestclass task +task RemoveTask2CMPXTaskQueueL +delete task +[Endtest] + +[Test] +title 63. Task CMPXTaskQueueL +create commontestclass task +task TaskCMPXTaskQueueL +delete task +[Endtest] + +[Test] +title 64. CompareUids MPXUser +create commontestclass user +user CompareUids +delete user +[Endtest] + +[Test] +title 65. IsCallOngoing MPXUser +create commontestclass user +user IsCallOngoing +delete user +[Endtest] + +[Test] +title 66. CompleteWithDllPath MPXUser +create commontestclass user +user CompleteWithDllPath +delete user +[Endtest] + +[Test] +title 67. Alloc8L MPXUser +create commontestclass user +user Alloc8L +delete user +[Endtest] + +[Test] +title 68. AllocL MPXUser +create commontestclass user +user AllocL +delete user +[Endtest] + +[Test] +title 69. Ptr MPXUser +create commontestclass user +user Ptr +delete user +[Endtest] + +[Test] +title 70. Ptr8 MPXUser +create commontestclass user +user Ptr8 +delete user +[Endtest] + +[Test] +title 71. CreateBufferLC MPXUser +create commontestclass user +user CreateBufferLC +delete user +[Endtest] + +[Test] +title 72. CreateBufferFromDes MPXUser +create commontestclass user +user CreateBufferDesCL +delete user +[Endtest] + +[Test] +title 73. CreateBufferFromDesArray MPXUser +create commontestclass user +user CreateBufferDesCArrayL +delete user +[Endtest] + +[Test] +title 74. CreateFromBufferL MPXUser +create commontestclass user +delete user +[Endtest] + +[Test] +title 75. ExternalizeL MPXUser +create commontestclass user +user ExternalizeL +delete user +[Endtest] + +[Test] +title 76. ExternalizeArrayL MPXUser +create commontestclass user +user ExternalizeArrayL +delete user +[Endtest] + +[Test] +title 77. InternalizeArrayL MPXUser +create commontestclass user +user InternalizeArrayL +delete user +[Endtest] + +[Test] +title 78. CopyArrayL MPXUser +create commontestclass user +user CopyArrayL +delete user +[Endtest] + +[Test] +title 79. MergeArray MPXUser +create commontestclass user +user MergeArray +delete user +[Endtest] + +[Test] +title 80. MergeAttributeL MPXUser +create commontestclass user +user MergeAttributeL +delete user +[Endtest] + +[Test] +title 81. ProcessIdL MPXUser +create commontestclass user +user ProcessIdL +delete user +[Endtest] + +[Test] +title 82. CompareOrderedUidArrays MPXUser +create commontestclass user +user CompareOrderedUidArrays +delete user +[Endtest] + + +[Test] +title 83. CreateCMPXViewPlugin viewplugin +create commontestclass viewplugin +viewplugin CreateCMPXViewPlugin +delete viewplugin +[Endtest] + +[Test] +title 84. DeleteCMPXViewPlugin viewplugin +create commontestclass viewplugin +viewplugin CreateCMPXViewPlugin +viewplugin DeleteCMPXViewPlugin +delete viewplugin +[Endtest] + + +//--------------------------------------------------------------------------- +// TMPXAttribute +//--------------------------------------------------------------------------- +[Test] +title 1001. TMPXAttribute Create: Default Contructor +create commontestclass mpxatt +mpxatt MpxAttDefaultConst +delete mpxatt +[Endtest] + +[Test] +title 1002. TMPXAttribute Create: Constructor +create commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID1 KMPXAttAttributeID1 +delete mpxatt +[Endtest] + +[Test] +title 1003. TMPXAttribute Create: Copy Constructor Attribute +create commontestclass mpxatt +mpxatt MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID1 +delete mpxatt +[Endtest] + +[Test] +title 1004. TMPXAttribute Create: Copy Constructor Attribute Data +create commontestclass mpxatt +mpxatt MpxAttCopyConstAttData KMPXAttContentID1 KMPXAttAttributeID1 +delete mpxatt +[Endtest] + +[Test] +title 1005. TMPXAttribute Assignment Operator +create commontestclass mpxatt +mpxatt MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttOperatorAssignment 0 +delete mpxatt +[Endtest] + +[Test] +title 1006. TMPXAttribute Equal Operator True +create commontestclass mpxatt +mpxatt MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttOperatorEqual 0 1 KTrue +delete mpxatt +[Endtest] + +[Test] +title 1007. TMPXAttribute Equal Operator False +create commontestclass mpxatt +mpxatt MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttCopyConstAtt KMPXAttContentID2 KMPXAttAttributeID2 +mpxatt MpxAttOperatorEqual 0 1 KFalse +delete mpxatt +[Endtest] + +[Test] +title 1008. TMPXAttribute Streaming +create commontestclass mpxatt +mpxatt MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttStreamingL 0 +delete mpxatt +[Endtest] + +[Test] +title 1009. TMPXAttribute ContentId +create commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttContentId KMPXAttContentID1 0 +delete mpxatt +[Endtest] + +[Test] +title 1010. TMPXAttribute AttributeId +create commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttAttributeId KMPXAttAttributeID1 0 +delete mpxatt +[Endtest] + +[Test] +title 1011. TMPXAttribute Match True +create commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID2 KMPXAttAttributeID2 +mpxatt MpxAttCopyConstAtt KMPXAttContentID2 KMPXAttAttributeID2 +mpxatt MpxAttMatch 0 1 KTrue +delete mpxatt +[Endtest] + +[Test] +title 1012. TMPXAttribute Match False +create commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttCopyConstAtt KMPXAttContentID2 KMPXAttAttributeID2 +mpxatt MpxAttMatch 0 1 KFalse +delete mpxatt +[Endtest] + +[Test] +title 1013. TMPXAttribute MatchContentId True +create commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID2 KMPXAttAttributeID1 +mpxatt MpxAttCopyConstAtt KMPXAttContentID2 KMPXAttAttributeID2 +mpxatt MpxAttMatchContentId 0 1 KTrue +delete mpxatt +[Endtest] + +[Test] +title 1014. TMPXAttribute MatchContentId False +create commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttCopyConstAtt KMPXAttContentID2 KMPXAttAttributeID1 +mpxatt MpxAttMatchContentId 0 1 KFalse +delete mpxatt +[Endtest] + +[Test] +title 1015. TMPXAttributeData Operator& AttData True +create commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttOperatorAndAttData 0 1 KTrue +delete mpxatt +[Endtest] + +[Test] +title 1016. TMPXAttributeData Operator& AttData False +create commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID2 +mpxatt MpxAttOperatorAndAttData 0 1 KFalse +delete mpxatt +[Endtest] + +[Test] +title 1017. TMPXAttributeData Operator& Att True +create commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttOperatorAndData 0 KMPXAttAttributeID1 KTrue +delete mpxatt +[Endtest] + +[Test] +title 1018. TMPXAttributeData Operator& Att False +create commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttOperatorAndData 0 KMPXAttAttributeID2 KFalse +delete mpxatt +[Endtest] + +[Test] +title 1019. TMPXAttributeData Operator BitwiseOr +create commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID1 KMPXAttAttributeID2 +mpxatt MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID2 +mpxatt MpxAttOperatorOr 0 1 2 +delete mpxatt +[Endtest] + +[Test] +title 1020. TMPXAttributeData Operator BitwiseOr +create commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID2 +mpxatt MpxAttOperatorOr 0 1 3 +delete mpxatt +[Endtest] + +// -------------------------------------------------------------------------- +// CMPXMedia +// -------------------------------------------------------------------------- +[Test] +title 1021. CMPXMedia NewL +create commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewL +delete mpxmedia +[Endtest] + +[Test] +title 1022. CMPXMedia NewL SupportedIds +create commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 KMPXAttContentID2 +mpxmedia MpxMediaNewLSupportedIdsL +delete mpxmedia +[Endtest] + +[Test] +title 1023. CMPXMedia NewL Media +create commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaNewLMediaL 0 +delete mpxmedia +[Endtest] + +[Test] +title 1024. CMPXMedia NewL DataHandle +create commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID2 +mpxmedia MpxMediaNewLDataHandleL 0 +delete mpxmedia +[Endtest] + +[Test] +title 1025. CMPXMedia NewL Stream +create commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 KMPXAttContentID2 +mpxmedia MpxMediaNewLStreamL 0 +delete mpxmedia +[Endtest] + +[Test] +title 1026. CMPXMedia Assingment Operator +create commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaOperatorAssignment 0 +delete mpxmedia +[Endtest] + +[Test] +title 1027. CMPXMedia SupportedIds +create commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 KMPXAttContentID2 +mpxmedia MpxMediaSupportedIds 0 KMPXAttContentID2 KMPXAttContentID1 +delete mpxmedia +[Endtest] + +[Test] +title 1028. CMPXMedia SetTObjectValueL +create commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTObjectValueL 0 0 5 +delete mpxmedia +[Endtest] + +[Test] +title 1029. CMPXMedia SetCObjectValueL +create commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeCObject +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetCObjectValueL 0 0 CMPXMediaArray +mpxmedia MpxMediaSetCObjectValueL 0 0 CMPXMedia +delete mpxmedia +[Endtest] + +[Test] +title 1030. CMPXMedia SetNoNewLCObjectL +create commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeCObject +mpxmedia MpxAttConst KMPXAttContentID2 KMPXAttAttributeCObject +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 KMPXAttContentID2 +mpxmedia MpxMediaSetNoNewLCObjectL 0 0 CMPXCollectionPath +mpxmedia MpxMediaSetNoNewLCObjectL 0 1 CMPXMediaArray +delete mpxmedia +[Endtest] + +[Test] +title 1031. CMPXMedia SetTextValueL +create commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID2 KMPXAttAttributeText +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID2 +mpxmedia MpxMediaSetTextValueL 0 0 five +delete mpxmedia +[Endtest] + +[Test] +title 1032. CMPXMedia Attributes +create commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 0 1 5 +mpxmedia MpxMediaAttributes 0 0 +mpxmedia MpxMediaAttributes 0 1 +delete mpxmedia +[Endtest] + +[Test] +title 1033. CMPXMedia IsSupported +create commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID2 KMPXAttAttributeInt +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaNewLSupportedIdsL +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 1 1 5 +mpxmedia MpxMediaIsSupported 0 0 1 +mpxmedia MpxMediaIsSupported 1 1 1 +mpxmedia MpxMediaIsSupported 0 1 0 +delete mpxmedia +[Endtest] + +[Test] +title 1034. CMPXMedia Count +create commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 0 1 5 +mpxmedia MpxMediaCount 0 2 +delete mpxmedia +[Endtest] + +[Test] +title 1035. CMPXMedia Attribute +create commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 0 1 5 +mpxmedia MpxMediaAttribute 0 0 0 +mpxmedia MpxMediaAttribute 0 1 1 +delete mpxmedia +[Endtest] + +[Test] +title 1036. CMPXMedia AttributesSet +create commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 0 1 5 +mpxmedia MpxMediaAttributesSet 0 KMPXAttContentID1 12 +mpxmedia MpxMediaAttributesSet 0 KMPXAttContentID2 0 +delete mpxmedia +[Endtest] + +[Test] +title 1037. CMPXMedia Index +create commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxAttConst KMPXAttContentID2 KMPXAttAttributeID2 +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 0 1 5 +mpxmedia MpxMediaIndex 0 0 0 +mpxmedia MpxMediaIndex 0 1 1 +mpxmedia MpxMediaIndex 0 2 KErrNotFound +delete mpxmedia +[Endtest] + +[Test] +title 1038. CMPXMedia Type(index) +create commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeCObject +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 0 1 5 +mpxmedia MpxMediaSetCObjectValueL 0 2 CMPXMedia +mpxmedia MpxMediaTypeIndex 0 0 KMPXTypeText +mpxmedia MpxMediaTypeIndex 0 1 KMPXTypeTObject +mpxmedia MpxMediaTypeIndex 0 2 KMPXTypeCObject +delete mpxmedia +[Endtest] + +[Test] +title 1039. CMPXMedia Type(attribute) +create commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeCObject +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 0 1 5 +mpxmedia MpxMediaSetCObjectValueL 0 2 CMPXMedia +mpxmedia MpxMediaTypeAttribute 0 0 KMPXTypeText +mpxmedia MpxMediaTypeAttribute 0 1 KMPXTypeTObject +mpxmedia MpxMediaTypeAttribute 0 2 KMPXTypeCObject +delete mpxmedia +[Endtest] + +[Test] +title 1040. CMPXMedia Reset +create commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeCObject +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 0 1 5 +mpxmedia MpxMediaSetCObjectValueL 0 2 CMPXMedia +mpxmedia MpxMediaCount 0 3 +mpxmedia MpxMediaReset 0 +mpxmedia MpxMediaCount 0 0 +delete mpxmedia +[Endtest] + +[Test] +title 1041. CMPXMedia Delete(attribute) +create commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeCObject +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 0 1 5 +mpxmedia MpxMediaSetCObjectValueL 0 2 CMPXMedia +mpxmedia MpxMediaCount 0 3 +mpxmedia MpxMediaDeleteAttribute 0 2 +mpxmedia MpxMediaCount 0 2 +mpxmedia MpxMediaDeleteAttribute 0 1 +mpxmedia MpxMediaCount 0 1 +delete mpxmedia +[Endtest] + +[Test] +title 1042. CMPXMedia Delete(index) +create commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 0 1 5 +mpxmedia MpxMediaCount 0 2 +mpxmedia MpxMediaDeleteIndex 0 0 +mpxmedia MpxMediaCount 0 1 +mpxmedia MpxMediaDeleteIndex 0 0 +mpxmedia MpxMediaCount 0 0 +delete mpxmedia +[Endtest] + +[Test] +title 1043. CMPXMedia ValueText +create commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaValueText 0 0 five +delete mpxmedia +[Endtest] + +[Test] +title 1044. CMPXMedia Value +create commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeCObject +mpxmedia MpxAttConst KMPXAttContentID2 KMPXAttAttributeCObject +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 KMPXAttContentID2 +mpxmedia MpxMediaSetCObjectValueL 0 0 CMPXMedia +mpxmedia MpxMediaSetCObjectValueL 0 1 CMPXCollectionPath +mpxmedia MpxMediaValue 0 0 CMPXMedia +mpxmedia MpxMediaValue 0 1 CMPXCollectionPath +delete mpxmedia +[Endtest] + +[Test] +title 1045. CMPXMedia Value Null +create commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeCObject +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetCObjectValueL 0 0 CMPXMediaArray +allowerrorcodes KErrUnexpectedValue +mpxmedia MpxMediaValue 0 1 CMPXMediaArray +delete mpxmedia +[Endtest] + +[Test] +title 1046. CMPXMedia ValueTObjectL +create commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTObjectValueL 0 0 5 +mpxmedia MpxMediaValueTObjectL 0 0 5 +delete mpxmedia +[Endtest] + +[Test] +title 1047. CMPXMedia ValueCObjectL +create commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeCObject +mpxmedia MpxAttConst KMPXAttContentID2 KMPXAttAttributeCObject +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 KMPXAttContentID2 +mpxmedia MpxMediaSetCObjectValueL 0 0 CMPXMedia +mpxmedia MpxMediaSetCObjectValueL 0 1 CMPXCollectionPath +mpxmedia MpxMediaValueCObjectL 0 0 CMPXMedia +mpxmedia MpxMediaValueCObjectL 0 1 CMPXCollectionPath +delete mpxmedia +[Endtest] + +[Test] +title 1048. CMPXMedia Internalize Externalize +create commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeCObject +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 0 1 5 +mpxmedia MpxMediaSetCObjectValueL 0 2 CMPXMedia +mpxmedia MpxMediaStreamingL 0 +delete mpxmedia +[Endtest] + +// -------------------------------------------------------------------------- +// CMPXMediaArray +// -------------------------------------------------------------------------- +[Test] +title 1049. CMPXMediaArray NewL MediaArray +create commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 KMPXAttContentID2 +mpxmedia MpxMediaArrayNewLMediaArrayL +delete mpxmedia +[Endtest] + +[Test] +title 1050. CMPXMediaArray Count +create commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 KMPXAttContentID2 +mpxmedia MpxMediaArrayCount 2 +delete mpxmedia +[Endtest] + +[Test] +title 1051. CMPXMediaArray AppendL by Ptr +create commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaArrayCount 0 +mpxmedia MpxMediaArrayAppendLByPtrL +mpxmedia MpxMediaArrayCount 1 +delete mpxmedia +[Endtest] + +[Test] +title 1052. CMPXMediaArray AppendL by Reference +create commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaArrayCount 0 +mpxmedia MpxMediaArrayAppendLByRefL +mpxmedia MpxMediaArrayCount 1 +delete mpxmedia +[Endtest] + +[Test] +title 1053. CMPXMediaArray Reset +create commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaArrayAppendLByRefL +mpxmedia MpxMediaArrayAppendLByPtrL +mpxmedia MpxMediaArrayCount 2 +mpxmedia MpxMediaArrayReset +mpxmedia MpxMediaArrayCount 0 +delete mpxmedia +[Endtest] + +[Test] +title 1054. CMPXMediaArray Remove +create commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaArrayAppendLByRefL +mpxmedia MpxMediaArrayAppendLByPtrL +mpxmedia MpxMediaArrayCount 2 +mpxmedia MpxMediaArrayRemove 1 +mpxmedia MpxMediaArrayCount 1 +mpxmedia MpxMediaArrayRemove 0 +mpxmedia MpxMediaArrayCount 0 +delete mpxmedia +[Endtest] + +[Test] +title 1055. CMPXMediaArray Insert by Ptr +create commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaArrayAppendLByRefL +mpxmedia MpxMediaArrayAppendLByPtrL +mpxmedia MpxMediaArrayCount 2 +mpxmedia MpxMediaArrayInsertByPtr 0 +mpxmedia MpxMediaArrayCount 3 +mpxmedia MpxMediaArrayInsertByPtr 3 +mpxmedia MpxMediaArrayCount 4 +delete mpxmedia +[Endtest] + +[Test] +title 1056. CMPXMediaArray Insert by Ref +create commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaArrayAppendLByRefL +mpxmedia MpxMediaArrayAppendLByPtrL +mpxmedia MpxMediaArrayCount 2 +mpxmedia MpxMediaArrayInsertByRef 0 +mpxmedia MpxMediaArrayCount 3 +mpxmedia MpxMediaArrayInsertByRef 3 +mpxmedia MpxMediaArrayCount 4 +delete mpxmedia +[Endtest] + +[Test] +title 1057. CMPXMediaArray InsertL by Ptr +create commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaArrayAppendLByRefL +mpxmedia MpxMediaArrayAppendLByPtrL +mpxmedia MpxMediaArrayCount 2 +mpxmedia MpxMediaArrayInsertLByPtrL 0 +mpxmedia MpxMediaArrayCount 3 +mpxmedia MpxMediaArrayInsertLByPtrL 3 +mpxmedia MpxMediaArrayCount 4 +delete mpxmedia +[Endtest] + +[Test] +title 1058. CMPXMediaArray InsertL by Ref +create commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaArrayAppendLByRefL +mpxmedia MpxMediaArrayAppendLByPtrL +mpxmedia MpxMediaArrayCount 2 +mpxmedia MpxMediaArrayInsertLByRefL 0 +mpxmedia MpxMediaArrayCount 3 +mpxmedia MpxMediaArrayInsertLByRefL 3 +mpxmedia MpxMediaArrayCount 4 +delete mpxmedia +[Endtest] + +[Test] +title 1059. CMPXMediaArray Set +create commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaArrayAppendLByRefL +mpxmedia MpxMediaArrayAppendLByPtrL +mpxmedia MpxMediaArraySet 0 +mpxmedia MpxMediaArraySet 1 +delete mpxmedia +[Endtest] + +[Test] +title 1060. CMPXMediaArray Internalize Externalize +create commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 0 1 5 +mpxmedia MpxMediaArrayAppendLByPtrL +mpxmedia MpxMediaArrayStreamingL +delete mpxmedia +[Endtest] + +// -------------------------------------------------------------------------- +// CMPXCollectionPath +// -------------------------------------------------------------------------- +[Test] +title 1061. CMPXCollectionPath NewL +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +delete mpxcollpath +[Endtest] + +[Test] +title 1062. CMPXCollectionPath NewL Path +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxCollPathNewLPathL +delete mpxcollpath +[Endtest] + +[Test] +title 1063. CMPXCollectionPath NewL Stream +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxCollPathNewLStreamL +delete mpxcollpath +[Endtest] + +[Test] +title 1064. CMPXCollectionPath AppendL Id +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +delete mpxcollpath +[Endtest] + +[Test] +title 1065. CMPXCollectionPath AppendL Id array +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +delete mpxcollpath +[Endtest] + +[Test] +title 1066. CMPXCollectionPath Levels +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathLevels 3 +delete mpxcollpath +[Endtest] + +[Test] +title 1067. CMPXCollectionPath Back +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathLevels 3 +mpxcollpath MpxCollPathBack +mpxcollpath MpxCollPathLevels 2 +mpxcollpath MpxCollPathBack +mpxcollpath MpxCollPathLevels 1 +delete mpxcollpath +[Endtest] + +[Test] +title 1068. CMPXCollectionPath Reset +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathLevels 3 +mpxcollpath MpxCollPathReset +mpxcollpath MpxCollPathLevels 0 +delete mpxcollpath +[Endtest] + +[Test] +title 1069. CMPXCollectionPath Operator++ +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathOperatorPlus KTrue +mpxcollpath MpxCollPathOperatorPlus KTrue +mpxcollpath MpxCollPathOperatorPlus KFalse +delete mpxcollpath +[Endtest] + +[Test] +title 1070. CMPXCollectionPath Operator-- +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathOperatorPlus KTrue +mpxcollpath MpxCollPathOperatorPlus KTrue +mpxcollpath MpxCollPathOperatorMinus KTrue +mpxcollpath MpxCollPathOperatorMinus KTrue +mpxcollpath MpxCollPathOperatorMinus KFalse +delete mpxcollpath +[Endtest] + +[Test] +title 1071. CMPXCollectionPath SetToFirst +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathOperatorPlus KTrue +mpxcollpath MpxCollPathOperatorPlus KTrue +mpxcollpath MpxCollPathIndex 2 +mpxcollpath MpxCollPathSetToFirst +mpxcollpath MpxCollPathIndex 0 +delete mpxcollpath +[Endtest] + +[Test] +title 1072. CMPXCollectionPath SetToLast +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetToLast +mpxcollpath MpxCollPathIndex 2 +delete mpxcollpath +[Endtest] + +[Test] +title 1073. CMPXCollectionPath Set(aIndex) +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 2 +mpxcollpath MpxCollPathIndex 2 +mpxcollpath MpxCollPathSetIndex 0 +mpxcollpath MpxCollPathIndex 0 +delete mpxcollpath +[Endtest] + +[Test] +title 1074. CMPXCollectionPath Set(aId) +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetId KMPXPathItem3 +mpxcollpath MpxCollPathIndex 2 +mpxcollpath MpxCollPathSetId KMPXPathItem1 +mpxcollpath MpxCollPathIndex 0 +delete mpxcollpath +[Endtest] + +[Test] +title 1075. CMPXCollectionPath Set(aMode) +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathSetMode KMPXOpenNoPlaylist +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxCollPathSetMode KMPXOpenAllItems +mpxcollpath MpxCollPathOpenNextMode KMPXOpenAllItems +mpxcollpath MpxCollPathOpenPreviousMode KMPXOpenNoPlaylist +delete mpxcollpath +[Endtest] + +[Test] +title 1076. CMPXCollectionPath Set(aAttrs) +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID1 +mpxcollpath MpxAttCopyConstAtt KMPXAttContentID2 KMPXAttAttributeID2 +mpxcollpath MpxCollPathSetLAttrsL +delete mpxcollpath +[Endtest] + +[Test] +title 1077. CMPXCollectionPath SelectL(aId) +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIdL KMPXPathItem2 +mpxcollpath MpxCollPathSelectLIdL KMPXPathItem1 +delete mpxcollpath +[Endtest] + +[Test] +title 1078. CMPXCollectionPath SelectL(aIndex) +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIndexL 2 +mpxcollpath MpxCollPathSelectLIndexL 0 +delete mpxcollpath +[Endtest] + +[Test] +title 1079. CMPXCollectionPath SelectAllL +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectAllL +delete mpxcollpath +[Endtest] + +[Test] +title 1080. CMPXCollectionPath Deselect(aId) +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIdL KMPXPathItem2 +mpxcollpath MpxCollPathSelectLIdL KMPXPathItem1 +mpxcollpath MpxCollPathDeselectId KMPXPathItem1 +mpxcollpath MpxCollPathDeselectId KMPXPathItem2 +delete mpxcollpath +[Endtest] + +[Test] +title 1081. CMPXCollectionPath Deselect(aIndex) +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIndexL 2 +mpxcollpath MpxCollPathSelectLIndexL 0 +mpxcollpath MpxCollPathDeselectIndex 2 +mpxcollpath MpxCollPathDeselectIndex 0 +delete mpxcollpath +[Endtest] + +[Test] +title 1082. CMPXCollectionPath DeselectAll +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIndexL 2 +mpxcollpath MpxCollPathSelectLIndexL 0 +mpxcollpath MpxCollPathDeselectAll +delete mpxcollpath +[Endtest] + +[Test] +title 1083. CMPXCollectionPath Remove(aId) +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIdL KMPXPathItem2 +mpxcollpath MpxCollPathSelectLIdL KMPXPathItem1 +mpxcollpath MpxCollPathRemoveId KMPXPathItem1 +mpxcollpath MpxCollPathRemoveId KMPXPathItem2 +delete mpxcollpath +[Endtest] + +[Test] +title 1084. CMPXCollectionPath Remove(aIndex) +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIndexL 2 +mpxcollpath MpxCollPathSelectLIndexL 0 +mpxcollpath MpxCollPathRemoveIndex 2 +mpxcollpath MpxCollPathRemoveIndex 0 +delete mpxcollpath +[Endtest] + +[Test] +title 1085. CMPXCollectionPath IsSelected(aId) +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIdL KMPXPathItem2 +mpxcollpath MpxCollPathSelectLIdL KMPXPathItem1 +mpxcollpath MpxCollPathIsSelectedId KMPXPathItem1 KTrue +mpxcollpath MpxCollPathRemoveId KMPXPathItem1 +mpxcollpath MpxCollPathIsSelectedId KMPXPathItem1 KFalse +delete mpxcollpath +[Endtest] + +[Test] +title 1086. CMPXCollectionPath IsSelected(aIndex) +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIndexL 2 +mpxcollpath MpxCollPathSelectLIndexL 0 +mpxcollpath MpxCollPathIsSelectedIndex 2 KTrue +mpxcollpath MpxCollPathDeselectIndex 2 +mpxcollpath MpxCollPathIsSelectedIndex 2 KFalse +delete mpxcollpath +[Endtest] + +[Test] +title 1087. CMPXCollectionPath ClearSelection +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIndexL 2 +mpxcollpath MpxCollPathSelectLIndexL 0 +mpxcollpath MpxCollPathClearSelection +mpxcollpath MpxCollPathIsSelectedIndex 0 KFalse +mpxcollpath MpxCollPathIsSelectedIndex 2 KFalse +delete mpxcollpath +[Endtest] + +[Test] +title 1088. CMPXCollectionPath Selection +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIndexL 2 +mpxcollpath MpxCollPathSelectLIndexL 1 +mpxcollpath MpxCollPathSelection 2 1 +delete mpxcollpath +[Endtest] + +[Test] +title 1089. CMPXCollectionPath SelectionL +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIdL KMPXPathItem2 +mpxcollpath MpxCollPathSelectLIdL KMPXPathItem3 +mpxcollpath MpxCollPathSelectionL KMPXPathItem2 KMPXPathItem3 +delete mpxcollpath +[Endtest] + +[Test] +title 1090. CMPXCollectionPath Id +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetId KMPXPathItem3 +mpxcollpath MpxCollPathId KMPXPathItem3 +delete mpxcollpath +[Endtest] + +[Test] +title 1091. CMPXCollectionPath Count +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathCount 3 +delete mpxcollpath +[Endtest] + +[Test] +title 1092. CMPXCollectionPath IndexOfId +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathIndexOfId KMPXPathItem1 0 +mpxcollpath MpxCollPathIndexOfId KMPXPathItem2 1 +mpxcollpath MpxCollPathIndexOfId KMPXPathItem3 2 +delete mpxcollpath +[Endtest] + +[Test] +title 1093. CMPXCollectionPath IdOfIndex +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathIdOfIndex 0 KMPXPathItem1 +mpxcollpath MpxCollPathIdOfIndex 1 KMPXPathItem2 +mpxcollpath MpxCollPathIdOfIndex 2 KMPXPathItem3 +delete mpxcollpath +[Endtest] + +[Test] +title 1094. CMPXCollectionPath OpenAttributes +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID1 +mpxcollpath MpxAttCopyConstAtt KMPXAttContentID2 KMPXAttAttributeID2 +mpxcollpath MpxCollPathSetLAttrsL +mpxcollpath MpxCollPathOpenAttributes +delete mpxcollpath +[Endtest] + +[Test] +title 1095. CMPXCollectionPath Index(aLevel) +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 1 +mpxcollpath MpxItemIdReset +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxItemIdConst KMPXPathItem4 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 0 +mpxcollpath MpxCollPathIndexLevel 1 1 +mpxcollpath MpxCollPathIndexLevel 2 0 +delete mpxcollpath +[Endtest] + +[Test] +title 1096. CMPXCollectionPath Id(aLevel) +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 1 +mpxcollpath MpxItemIdReset +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxItemIdConst KMPXPathItem4 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 0 +mpxcollpath MpxCollPathIdLevel 1 KMPXPathItem2 +mpxcollpath MpxCollPathIdLevel 2 KMPXPathItem3 +delete mpxcollpath +[Endtest] + +[Test] +title 1097. CMPXCollectionPath ExternalizeL and InternalizeL +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 1 +mpxcollpath MpxItemIdReset +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxItemIdConst KMPXPathItem4 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 0 +mpxcollpath MpxCollPathStreamingL +delete mpxcollpath +[Endtest] + +[Test] +title 1098. CMPXCollectionPath HandleChange - KPathChangeAdded +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIndexL 2 +mpxcollpath MpxCollPathHandleChange KMPXPathItem3 0 KPathChangeAdded KErrNotFound KChangeResultPathModified +delete mpxcollpath +[Endtest] + +[Test] +title 1099. CMPXCollectionPath HandleChange - KPathChangeDeleted: Not Top Level +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 1 +mpxcollpath MpxItemIdReset +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxItemIdConst KMPXPathItem4 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 0 +mpxcollpath MpxCollPathHandleChange 0 KMPXPathItem2 KPathChangeDeleted 1 KChangeResultPathClipped +delete mpxcollpath +[Endtest] + +[Test] +title 1100. CMPXCollectionPath HandleChange - KPathChangeDeleted: Top Level +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 1 +mpxcollpath MpxItemIdReset +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxItemIdConst KMPXPathItem4 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 0 +mpxcollpath MpxCollPathHandleChange KMPXPathItem3 0 KPathChangeDeleted 0 KChangeResultPathModified +delete mpxcollpath +[Endtest] + +[Test] +title 1101. CMPXCollectionPath HandleChange - KPathChangeModified: Not Top Level +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 1 +mpxcollpath MpxItemIdReset +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxItemIdConst KMPXPathItem4 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 0 +mpxcollpath MpxCollPathHandleChange KMPXPathItem5 KMPXPathItem2 KPathChangeModified KErrNotFound KChangeResultPathModified +delete mpxcollpath +[Endtest] + +[Test] +title 1102. CMPXCollectionPath HandleChange - KPathChangeModified: Top Level +create commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 1 +mpxcollpath MpxItemIdReset +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxItemIdConst KMPXPathItem4 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 0 +mpxcollpath MpxCollPathHandleChange KMPXPathItem5 KMPXPathItem4 KPathChangeModified 1 KChangeResultPathModified +delete mpxcollpath +[Endtest] + +//[Test] +//title 1103. CMPXCollectionPath HandleChange - KPathChangeGroupModified +//create commontestclass mpxcollpath +//mpxcollpath MpxCollPathNewL +//mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +//mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +//mpxcollpath MpxItemIdConst KMPXPathItem1 +//mpxcollpath MpxItemIdConst KMPXPathItem2 +//mpxcollpath MpxItemIdConst KMPXPathItem3 +//mpxcollpath MpxCollPathAppendLIdsL +//mpxcollpath MpxCollPathSelectLIndexL 2 +//mpxcollpath MpxCollPathHandleChange KMPXPathItem3 0 KPathChangeGroupModified KErrNotFound KChangeResultPathModified +//delete mpxcollpath +//[Endtest] + +//[Test] +//title 1104. CMPXCollectionPath HandleChange - Path Unchanged +//create commontestclass mpxcollpath +//mpxcollpath MpxCollPathNewL +//mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +//mpxcollpath MpxItemIdConst KMPXPathItem1 +//mpxcollpath MpxItemIdConst KMPXPathItem2 +//mpxcollpath MpxCollPathAppendLIdsL +//mpxcollpath MpxCollPathSetIndex 1 +//mpxcollpath MpxItemIdReset +//mpxcollpath MpxItemIdConst KMPXPathItem3 +//mpxcollpath MpxItemIdConst KMPXPathItem4 +//mpxcollpath MpxCollPathAppendLIdsL +//mpxcollpath MpxCollPathSetIndex 0 +//mpxcollpath MpxCollPathHandleChange KMPXPathItem5 KMPXPathLevel2 KPathChangeModified KErrNotFound KChangeResultPathUnchanged +//delete mpxcollpath +//[Endtest] + +// -------------------------------------------------------------------------- +// CMPXClientList +// -------------------------------------------------------------------------- +[Test] +title 1105. CMPXClientList NewL +create commontestclass mpxclientlist +mpxclientlist MpxClientListNewL +delete mpxclientlist +[Endtest] + +[Test] +title 1106. CMPXClientList ClientCount +create commontestclass mpxclientlist +mpxclientlist MpxClientListNewL +mpxclientlist MpxClientListClientCount 0 +delete mpxclientlist +[Endtest] + +[Test] +title 1107. CMPXClientList IsClient +create commontestclass mpxclientlist +mpxclientlist MpxClientListNewL +mpxclientlist MpxClientListIsClient KFalse +delete mpxclientlist +[Endtest] + +[Test] +title 1108. CMPXClientList Find by MsgQueue +create commontestclass mpxclientlist +mpxclientlist MpxClientListNewL +mpxclientlist CreateCMPXMessageQueueL +mpxclientlist MpxClientListFindByMsg KErrNotFound +delete mpxclientlist +[Endtest] + +[Test] +title 1109. CMPXClientList Find by ThreadId +create commontestclass mpxclientlist +mpxclientlist MpxClientListNewL +mpxclientlist MpxClientListFindById KErrNotFound +delete mpxclientlist +[Endtest] + +// -------------------------------------------------------------------------- +// CMPXPluginHandlerBase +// -------------------------------------------------------------------------- +[Test] +title 1110. CMPXPluginHandlerBase SelectPluginL(aPluginUid) +create commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseSelectPluginLIdL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 1111. CMPXPluginHandlerBase SelectPluginL(aPluginName) +create commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseSelectPluginLNameL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 1112. CMPXPluginHandlerBase SelectPluginL(aUri, aDataType) +create commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseSelectPluginLUriL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 1113. CMPXPluginHandlerBase SelectPluginL(aPluginType) +create commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseSelectPluginLTypeL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 1114. CMPXPluginHandlerBase ClearSelectionCriteria +create commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseClearSelectionCriteria +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 1115. CMPXPluginHandlerBase PluginName(aPluginType) +create commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBasePluginNameType +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 1116. CMPXPluginHandlerBase PluginNamesL +create commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBasePluginNamesL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 1117. CMPXPluginHandlerBase SupportedMimeTypesL +create commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseSupportedMimeTypesL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 1118. CMPXPluginHandlerBase SupportedExtensionsL +create commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseSupportedExtensionsL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 1119. CMPXPluginHandlerBase SupportedSchemasL +create commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseSupportedSchemasL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 1120. CMPXPluginHandlerBase SupportedMimeTypesL +create commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseSupportedMimeTypesLUidL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 1121. CMPXPluginHandlerBase SupportedExtensionsL +create commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseSupportedExtensionsLUidL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 1122. CMPXPluginHandlerBase GetPluginTypes +create commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseGetPluginTypes +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 1123. CMPXPluginHandlerBase GetPluginUids +create commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseGetPluginUids +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 1124. CMPXPluginHandlerBase GetPluginUidsL +create commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseGetPluginUidsL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 1125. CMPXPluginHandlerBase PluginUid +create commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBasePluginUid +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 1126. CMPXPluginHandlerBase IndexOf +create commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseIndexOf +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 1127. CMPXPluginHandlerBase CreatePluginListL +create commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseCreatePluginListL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 1128. CMPXPluginHandlerBase FindPlugin +create commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseFindPlugin +delete mpxpluginhandlerbase +[Endtest] + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/conf/ui_commontestclass.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/conf/ui_commontestclass.cfg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3202 @@ +// _Unsupported_ Those API could be not implemented and return KErrNotSupported + + +[Define] +KErrNotFound -1 +KErrNotSupported -5 +KErrArgument -6 +KErrNotReady -18 +KErrAccessDenied -21 + +KErrEventPending -2000 +KErrCallbackErrorCode -2001 +KErrUnexpectedValue -2002 +KErrNotificationPending -2005 +KErrUnexpectedNotification -2006 +KErrTimeoutController -2007 + +KTrue 1 +KFalse 0 + +// TMPXAttribute +KMPXAttContentID1 888881 +KMPXAttContentID2 888882 +KMPXAttAttributeID1 1 +KMPXAttAttributeID2 2 +KMPXAttAttributeText 4 +KMPXAttAttributeInt 8 +KMPXAttAttributeCObject 16 + +// TMPXAttributeType +KMPXTypeUnknown 0 +KMPXTypeTInt 1 +KMPXTypeText 2 +KMPXTypeTObject 3 +KMPXTypeCObject 4 +kMPXTypeError 5 + +// CMPXCollectionPath +KMPXPathLevel1 33331 +KMPXPathLevel2 33332 +KMPXPathLevel3 33333 +KMPXPathItem1 44441 +KMPXPathItem2 44442 +KMPXPathItem3 44443 +KMPXPathItem4 44444 +KMPXPathItem5 44445 + +// TMPXOpenMode +KMPXOpenDefault 0 +KMPXOpenGroupOrPlaylist 1 +KMPXOpenAllItems 2 +KMPXOpenNoPlaylist 3 +KMPXOpenPlaylistOnly 4 + +// TMPXCollectionPathChange +KPathChangeAdded 0 +KPathChangeDeleted 1 +KPathChangeModified 2 +KPathChangeGroupModified 3 + +// TMPXPathChangeResult +KChangeResultPathUnchanged 0 +KChangeResultPathModified 1 +KChangeResultPathClipped 2 + + +[Enddefine] + +//mpx_common_api +// +// +//--------------------------------------------------------------------------- +// TMPXAttribute +// +// MpxAttDefaultConst() +// MpxAttConst(contentID, attributeID) +// MpxAttCopyConstAtt(contentID, attributeID) +// MpxAttCopyConstAttData(contentID, attributeID) +// MpxAttOperatorAssignment(attributeIndex) +// MpxAttOperatorEqual(attributeIndex1, attributeIndex2, expectedResult) +// MpxAttStreamingL(attributeIndex) +// MpxAttContentId(contentID, attributeIndex) +// MpxAttAttributeId(attributeID, attributeIndex) +// MpxAttMatch(attributeIndex1, attributeIndex2, expectedResult) +// MpxAttMatchContentId(attributeIndex1, attributeIndex2, expectedResult) +// MpxAttOperatorAndAttData(attributeIndex1, attributeIndex2, expectedResult) +// MpxAttOperatorAndData(attributeIndex, attributeID, expectedResult) +// MpxAttOperatorOr(attributeIndex1, attributeIndex2, expectedResult) +// +//--------------------------------------------------------------------------- +// CMPXMedia +// +// MpxMediaNewL() +// MpxMediaNewLSupportedIdsL(contentID1, contentID2, ....) +// MpxMediaNewLMediaL(mediaIndex) +// MpxMediaNewLDataHandleL(mediaIndex) +// MpxMediaNewLStreamL(mediaIndex) +// MpxMediaOperatorAssignment(mediaIndex) +// MpxMediaSupportedIds(mediaIndex, contentID1, contentID2, ....) +// MpxMediaSetTObjectValueL(mediaIndex, attributeIndex, value) +// MpxMediaSetCObjectValueL(mediaIndex, attributeIndex, className) Note: className(CMPXMedia, CMPXMediaArray, CMPXCollectionPath) +// MpxMediaSetNoNewLCObjectL(mediaIndex, attributeIndex, className) +// MpxMediaSetTextValueL(mediaIndex, attributeIndex, value) +// MpxMediaAttributes(mediaIndex, attributeIndex) +// MpxMediaIsSupported(mediaIndex, attributeIndex, expectedResult) +// MpxMediaCount(mediaIndex, expectedResult) +// MpxMediaAttribute(mediaIndex, indexAtt, expectedAttributeIndex) +// MpxMediaAttributesSet(mediaIndex, contentID, expectedAttributes) +// MpxMediaIndex(mediaIndex, attributeIndex, expectedIndex) +// MpxMediaTypeIndex(mediaIndex, indexAtt, expectedType) +// MpxMediaTypeAttribute(mediaIndex, attributeIndex, expectedType) +// MpxMediaReset(mediaIndex) +// MpxMediaDeleteAttribute(mediaIndex, attributeIndex) +// MpxMediaDeleteIndex(mediaIndex, indexAtt) +// MpxMediaValueText(mediaIndex, attributeIndex, expectedString) +// MpxMediaValue(mediaIndex, attributeIndex, className) +// MpxMediaValueTObjectL(mediaIndex, attributeIndex, expectedValue) +// MpxMediaValueCObjectL(mediaIndex, attributeIndex, className) +// MpxMediaStreamingL(mediaIndex) +// +//--------------------------------------------------------------------------- +// CMPXMediaArray +// +// MpxMediaArrayNewL() +// MpxMediaArrayNewLMediaArrayL() +// MpxMediaArrayCount(expectedCount) +// MpxMediaArrayAppendLByPtrL() +// MpxMediaArrayAppendLByRefL() +// MpxMediaArrayReset() +// MpxMediaArrayRemove(index) +// MpxMediaArrayInsertByPtr(index) +// MpxMediaArrayInsertByRef(index) +// MpxMediaArrayInsertLByPtrL(index) +// MpxMediaArrayInsertLByRefL(index) +// MpxMediaArraySet(index) +// MpxMediaArrayStreamingL() +// +//--------------------------------------------------------------------------- +// CMPXCollectionPath +// +// MpxItemIdConst(optional id1, optional id2) +// MpxItemIdReset() +// MpxCollPathNewL() +// MpxCollPathNewLPathL() +// MpxCollPathNewLStreamL() +// MpxCollPathAppendLIdL(itemId) +// MpxCollPathAppendLIdsL() +// MpxCollPathLevels(expectedLevels) +// MpxCollPathBack() +// MpxCollPathReset() +// MpxCollPathIndex(expectedIndex) +// MpxCollPathOperatorPlus(expectedResult) +// MpxCollPathOperatorMinus(expectedResult) +// MpxCollPathSetToFirst() +// MpxCollPathSetToLast() +// MpxCollPathSetIndex(index) +// MpxCollPathSetId(id) +// MpxCollPathSetMode(openMode) +// MpxCollPathSetLAttrsL() +// MpxCollPathOpenNextMode(expectedOpenMode) +// MpxCollPathOpenPreviousMode(expectedOpenMode) +// MpxCollPathSelectLIdL(id) +// MpxCollPathSelectLIndexL(index) +// MpxCollPathSelectAllL() +// MpxCollPathDeselectId(id) +// MpxCollPathDeselectIndex(index) +// MpxCollPathDeselectAll() +// MpxCollPathRemoveId(id) +// MpxCollPathRemoveIndex(index) +// MpxCollPathIsSelectedId(id, expectedResult) +// MpxCollPathIsSelectedIndex(index, expectedResult) +// MpxCollPathClearSelection() +// MpxCollPathSelection(index1, index2, ...) +// MpxCollPathSelectionL(id1, id2, ...) +// MpxCollPathId(expectedId) +// MpxCollPathCount(expectedCount) +// MpxCollPathIndexOfId(id, expectedIndex) +// MpxCollPathIdOfIndex(index, expectedId) +// MpxCollPathOpenAttributes() +// MpxCollPathIndexLevel(level, expectedIndex) +// MpxCollPathIdLevel(level, expectedId) +// MpxCollPathStreamingL() +// MpxCollPathHandleChange(Uid, id, deprecatedId, changeType, expectedSelection, expectedChangeResult) +// +//--------------------------------------------------------------------------- +// CMPXClientList +// +// MpxClientListNewL() +// MpxClientListClientCount(expectedCount) +// MpxClientListIsClient(expecedResult) +// MpxClientListFindByMsg(expectedResult) +// MpxClientListFindById(expectedResult) +// +//--------------------------------------------------------------------------- +// CMPXPluginHandlerBase +// +// MpxPluginHandlerBaseSelectPluginLIdL() +// MpxPluginHandlerBaseSelectPluginLNameL() +// MpxPluginHandlerBaseSelectPluginLUriL() +// MpxPluginHandlerBaseSelectPluginLTypeL() +// MpxPluginHandlerBaseClearSelectionCriteria() +// MpxPluginHandlerBasePluginNameType() +// MpxPluginHandlerBasePluginNamesL() +// MpxPluginHandlerBaseSupportedMimeTypesL() +// MpxPluginHandlerBaseSupportedExtensionsL() +// MpxPluginHandlerBaseSupportedSchemasL() +// MpxPluginHandlerBaseSupportedMimeTypesLUidL() +// MpxPluginHandlerBaseSupportedExtensionsLUidL() +// MpxPluginHandlerBaseGetPluginTypes() +// MpxPluginHandlerBaseGetPluginUids() +// MpxPluginHandlerBaseGetPluginUidsL() +// MpxPluginHandlerBasePluginUid() +// MpxPluginHandlerBaseIndexOf() +// MpxPluginHandlerBaseCreatePluginListL() +// MpxPluginHandlerBaseFindPlugin() +// +//--------------------------------------------------------------------------- + + + +//--------------------------------------------------------------------------- +// 1.mpxpluginmonitor.h CMPXPluginMonitor +//--------------------------------------------------------------------------- +[Test] +title 1. Create PluginMonitor +create ui_commontestclass commontest +commontest CreatePluginMonitorL +delete commontest +[Endtest] + +[Test] +title 2. Delete PluginMonitor +create ui_commontestclass commontest +commontest CreatePluginMonitorL +commontest DeletePluginMonitorL +delete commontest +[Endtest] + +//--------------------------------------------------------------------------- +// 2.mpxcenrepwatcher.h CMPXCenRepWatcher +//--------------------------------------------------------------------------- +[Test] +title 3. Create CenRepWatcher +create ui_commontestclass watcher +watcher CreateCenRepWatcherL +delete watcher +[Endtest] + +[Test] +title 4. Delete CenRepWatcher +create ui_commontestclass watcher +watcher CreateCenRepWatcherL +watcher DeleteCenRepWatcherL +delete watcher +[Endtest] + +[Test] +title 5. SetCenRepValue +create ui_commontestclass watcher +watcher CreateCenRepWatcherL +watcher CenRepSetValueL 1 +delete watcher +[Endtest] + +// value in title 5 & 6 should be the same +// set value back to 0 after done testing +[Test] +title 6. GetCenRepValue +create ui_commontestclass watcher +watcher CreateCenRepWatcherL +watcher CenRepCurrentValueL value == 1 +watcher CenRepSetValueL 0 +delete watcher +[Endtest] + +//--------------------------------------------------------------------------- +// 3.mpxparameter.h CMPXParameter +//--------------------------------------------------------------------------- +[Test] +title 7. Create CMPXParameter +create ui_commontestclass parameter +parameter CreateMPXParameter +delete parameter +[Endtest] + +[Test] +title 8. Delete CMPXParameter +create ui_commontestclass parameter +parameter CreateMPXParameter +parameter DeleteMPXParameter +delete parameter +[Endtest] + +[Test] +title 9. Internalize CMPXParameter +create ui_commontestclass parameter +parameter CreateMPXParameter +parameter InternalizeMPXParameterL +parameter DeleteMPXParameter +delete parameter +[Endtest] + +[Test] +title 10. Externalize CMPXParameter +create ui_commontestclass parameter +parameter CreateMPXParameter +parameter ExternalizeMPXParameterL +parameter DeleteMPXParameter +delete parameter +[Endtest] + +//--------------------------------------------------------------------------- +// 4.mpxcollectiontype.h CMPXCollectionType +//--------------------------------------------------------------------------- +[Test] +title 11. Create CMPXCollectionTypeWithoutParam +create ui_commontestclass type +type CreateMPXCollectionTypeWOParam +delete type +[Endtest] + +[Test] +title 12. Create CMPXCollectionType +create ui_commontestclass type +type CreateMPXCollectionType +delete type +[Endtest] + +[Test] +title 13. Internalize CMPXCollectionType +create ui_commontestclass type +type CreateMPXCollectionType +type InternalizeMPXCollectionTypeL +delete type +[Endtest] + +[Test] +title 14. Externalize CMPXCollectionType +create ui_commontestclass type +type CreateMPXCollectionType +type ExternalizeMPXCollectionTypeL +delete type +[Endtest] + +[Test] +title 15. CMPXCollectionTypeDelete +create ui_commontestclass type +type CreateMPXCollectionType +type CMPXCollectionTypeDelete +delete type +[Endtest] + +[Test] +title 16. TUidMPXCollectionType CMPXCollectionType +create ui_commontestclass type +type TUidMPXCollectionType +delete type +[Endtest] + +//--------------------------------------------------------------------------- +// 5.mpxpskeywatcher.h CMPXPSKeyWatcher +//--------------------------------------------------------------------------- +[Test] +title 17. Create CMPXPSKeyWatcher +create ui_commontestclass watcher +watcher CreateCMPXPSKeyWatcherL +delete watcher +[Endtest] + +[Test] +title 18. Delete CMPXPSKeyWatcher +create ui_commontestclass watcher +watcher CreateCMPXPSKeyWatcherL +watcher DeleteCMPXPSKeyWatcherL +delete watcher +[Endtest] + +[Test] +title 19. Get Int Value CMPXPSKeyWatcher +create ui_commontestclass watcher +watcher CreateCMPXPSKeyWatcherL +watcher GetTntValue +delete watcher +[Endtest] + +[Test] +title 20. Get Des8 Value CMPXPSKeyWatcher +create ui_commontestclass watcher +watcher CreateCMPXPSKeyWatcherL +watcher GetDes8Value +delete watcher +[Endtest] + +[Test] +title 21. Get Des16 Value CMPXPSKeyWatcher +create ui_commontestclass watcher +watcher CreateCMPXPSKeyWatcherL +watcher GetDes16Value +delete watcher +[Endtest] + +[Test] +title 22. Set Int Value CMPXPSKeyWatcher +create ui_commontestclass watcher +watcher CreateCMPXPSKeyWatcherL +watcher SetTntValue +delete watcher +[Endtest] + +[Test] +title 23. Set Des8 Value CMPXPSKeyWatcher +create ui_commontestclass watcher +watcher CreateCMPXPSKeyWatcherL +watcher SetDes8Value +delete watcher +[Endtest] + +[Test] +title 24. Set Des16 Value CMPXPSKeyWatcher +create ui_commontestclass watcher +watcher CreateCMPXPSKeyWatcherL +watcher SetDes16Value +delete watcher +[Endtest] + +//--------------------------------------------------------------------------- +// 6.mpxdrmmediautility.h CMPXDrmMediaUtilityL +//--------------------------------------------------------------------------- +[Test] +title 25. Create CMPXDrmMediaUtilityL +create ui_commontestclass drm +drm CreateCMPXDrmMediaUtilityL +delete drm +[Endtest] + +[Test] +title 26. Create CMPXDrmMediaUtilityLC +create ui_commontestclass drm +drm CreateCMPXDrmMediaUtilityLC +delete drm +[Endtest] + +[Test] +title 27. Delete CMPXDrmMediaUtilityL +create ui_commontestclass drm +drm CreateCMPXDrmMediaUtilityL +drm DeleteCMPXDrmMediaUtilityL +delete drm +[Endtest] + +[Test] +title 28. Init FileName CMPXDrmMediaUtilityL +create ui_commontestclass drm +drm CreateCMPXDrmMediaUtilityL +drm InitFileNameL +drm Close +delete drm +[Endtest] + +[Test] +title 29. Init RFile CMPXDrmMediaUtilityL +create ui_commontestclass drm +drm CreateCMPXDrmMediaUtilityL +drm InitRFileL +drm Close +delete drm +[Endtest] + +[Test] +title 30. GetMediaL CMPXDrmMediaUtilityL +create ui_commontestclass drm +drm CreateCMPXDrmMediaUtilityL +drm GetMediaL +drm Close +delete drm +[Endtest] + +[Test] +title 31. Close CMPXDrmMediaUtilityL +create ui_commontestclass drm +drm CreateCMPXDrmMediaUtilityL +drm Close +delete drm +[Endtest] + +[Test] +title 32. ConsumeL CMPXDrmMediaUtilityL +create ui_commontestclass drm +drm CreateCMPXDrmMediaUtilityL +drm ConsumeL +drm Close +delete drm +[Endtest] + +//--------------------------------------------------------------------------- +// 7.mpxmessage.h TMPXMessage +//--------------------------------------------------------------------------- +[Test] +title 33. TMPXMessage3L TMPXMessage +create ui_commontestclass message +message TMPXMessage3L +delete message +[Endtest] + +[Test] +title 34. TMPXMessageL TMPXMessage +create ui_commontestclass message +message TMPXMessageL +delete message +[Endtest] + +[Test] +title 35. TMPXMessage1L TMPXMessage +create ui_commontestclass message +message TMPXMessage1L +delete message +[Endtest] + +[Test] +title 36. Operator= TMPXMessage +create ui_commontestclass message +message EqualTMPXMessage +delete message +[Endtest] + +[Test] +title 37. Event TMPXMessage +create ui_commontestclass message +message Event +delete message +[Endtest] + +[Test] +title 38. Type TMPXMessage +create ui_commontestclass message +message Type +delete message +[Endtest] + +[Test] +title 39. Data TMPXMessage +create ui_commontestclass message +message Data +delete message +[Endtest] + + +//--------------------------------------------------------------------------- +// 8.mpxmessagequeue.h CMPXMessageQueue +//--------------------------------------------------------------------------- +[Test] +title 40. Create CreateCMPXMessageQueueL +create ui_commontestclass queue +queue CreateCMPXMessageQueueL +delete queue +[Endtest] + +[Test] +title 41. Delete CMPXMessageQueue +create ui_commontestclass queue +queue CreateCMPXMessageQueueL +queue DeleteCMPXMessageQueue +delete queue +[Endtest] + +[Test] +title 42. Reset CMPXMessageQueue +create ui_commontestclass queue +queue CreateCMPXMessageQueueL +queue ResetCMPXMessageQueue +queue DeleteCMPXMessageQueue +delete queue +[Endtest] + +[Test] +title 43. SendNext CMPXMessageQueue +create ui_commontestclass queue +queue CreateCMPXMessageQueueL +queue SendNextCMPXMessageQueue +queue DeleteCMPXMessageQueue +delete queue +[Endtest] + +[Test] +title 44. Add CMPXMessageQueue +create ui_commontestclass queue +queue CreateCMPXMessageQueueL +queue AddCMPXMessageQueue +queue DeleteCMPXMessageQueue +delete queue +[Endtest] + + +//--------------------------------------------------------------------------- +// 9.mpxsession.h RMPXSession +//--------------------------------------------------------------------------- +[Test] +title 45. Version RMPXSession +create ui_commontestclass session +session VersionRMPXSession +delete session +[Endtest] + +[Test] +title 46.1 Connect RMPXSession +create ui_commontestclass session +session ConnectRMPXSessionL +delete session +[Endtest] + +[Test] +title 46.2 Reconnect RMPXSession +create ui_commontestclass session +session ReconnectRMPXSessionL +delete session +[Endtest] + +[Test] +title 47. SendReceiveL RMPXSession +create ui_commontestclass session +session SendReceiveLRMPXSessionL +delete session +[Endtest] + +[Test] +title 48. SendReceiveStatusRMPXSessionL RMPXSession +create ui_commontestclass session +session SendReceiveStatusRMPXSessionL +pause 1000 +delete session +[Endtest] + +[Test] +title 49. SendReceiveStatus3RMPXSessionL RMPXSession +create ui_commontestclass session +session SendReceiveStatus3RMPXSessionL +pause 1000 +delete session +[Endtest] + +[Test] +title 50. SendReceiveLTIpcArgsRMPXSessionL RMPXSession +create ui_commontestclass session +session SendReceiveLTIpcArgsRMPXSessionL +delete session +[Endtest] + +[Test] +title 50.2 CloseAndDestructRMPXSession RMPXSession +create ui_commontestclass session +session CloseAndDestructRMPXSession +delete session +[Endtest] + +//--------------------------------------------------------------------------- +// 10.mpxmessagemonitor.h CMPXMessageMonitor +//--------------------------------------------------------------------------- +[Test] +title 51. CreateCMPXMessageMonitorL CMPXMessageMonitor +create ui_commontestclass monitor +monitor CreateCMPXMessageMonitorL +delete monitor +[Endtest] + +[Test] +title 52. RunL CMPXMessageMonitor +create ui_commontestclass monitor +monitor CreateCMPXMessageMonitorL +monitor RunLCMPXMessageMonitorL +delete monitor +[Endtest] + +[Test] +title 53. Delete CMPXMessageMonitor +create ui_commontestclass monitor +monitor CreateCMPXMessageMonitorL +monitor DeleteCMPXMessageMonitorL +delete monitor +[Endtest] + +[Test] +title 54. GetNextMessage CMPXMessageMonitor +create ui_commontestclass monitor +monitor CreateCMPXMessageMonitorL +monitor GetNextMessageCMPXMessageMonitorL +delete monitor +[Endtest] + +[Test] +title 55. DoCancel CMPXMessageMonitor +create ui_commontestclass monitor +monitor CreateCMPXMessageMonitorL +monitor DoCancelCMPXMessageMonitorL +delete monitor +[Endtest] + +[Test] +title 56. RunError CMPXMessageMonitor +create ui_commontestclass monitor +monitor CreateCMPXMessageMonitorL +monitor RunErrorCMPXMessageMonitorL +monitor DoCancelCMPXMessageMonitorL +delete monitor +[Endtest] + + +//--------------------------------------------------------------------------- +// 11.mpxtaskqueue.h CMPXActiveTaskQueueL & CMPXTaskQueueL +//--------------------------------------------------------------------------- +[Test] +title 57. Create CMPXActiveTaskQueueL +create ui_commontestclass task +task CreateCMPXActiveTaskQueueL +delete task +[Endtest] + +[Test] +title 58. CancelRequests CMPXActiveTaskQueueL +create ui_commontestclass task +task CancelRequestsCMPXActiveTaskQueueL +delete task +[Endtest] + +[Test] +title 59. AddActiveTaskL CMPXActiveTaskQueueL +create ui_commontestclass task +task AddTaskCMPXActiveTaskQueueL +delete task +[Endtest] + +[Test] +title 60. CompleteTask CMPXActiveTaskQueueL +create ui_commontestclass task +task CompleteTaskCMPXActiveTaskQueueL +delete task +[Endtest] + +[Test] +title 61. CompleteAllTasks CMPXActiveTaskQueueL +create ui_commontestclass task +task CompleteAllTasksCMPXActiveTaskQueueL +delete task +[Endtest] + +[Test] +title 62. IsEmptyTaskQueue CMPXActiveTaskQueueL +create ui_commontestclass task +task IsEmptyCMPXTaskQueueL +delete task +[Endtest] + +[Test] +title 63. AddTaskL CMPXTaskQueueL +create ui_commontestclass task +task AddTaskCMPXTaskQueueL +delete task +[Endtest] + +[Test] +title 64. RemoveTaskL CMPXTaskQueueL +create ui_commontestclass task +task RemoveTaskCMPXTaskQueueL +delete task +[Endtest] + +[Test] +title 65. Callback CMPXTaskQueueL +create ui_commontestclass task +task CallbackCMPXTaskQueueL +delete task +[Endtest] + +[Test] +title 66. Param CMPXTaskQueueL +create ui_commontestclass task +task ParamCMPXTaskQueueL +delete task +[Endtest] + +[Test] +title 67. PtrData CMPXTaskQueueL +create ui_commontestclass task +task PtrDataCMPXTaskQueueL +delete task +[Endtest] + +[Test] +title 68. BufData CMPXTaskQueueL +create ui_commontestclass task +task BufDataCMPXTaskQueueL +delete task +[Endtest] + +[Test] +title 69. RemoveTask WO OB CMPXTaskQueueL +create ui_commontestclass task +task RemoveTask2CMPXTaskQueueL +delete task +[Endtest] + +[Test] +title 70. Task CMPXTaskQueueL +create ui_commontestclass task +task TaskCMPXTaskQueueL +delete task +[Endtest] + +[Test] +title 71. CreateCMPXTaskQueue +create ui_commontestclass task +task CreateCMPXTaskQueue +delete task +[Endtest] + +[Test] +title 72. DeleteCMPXTaskQueue +create ui_commontestclass task +task DeleteCMPXTaskQueue +delete task +[Endtest] + +[Test] +title 73. ScheduleNextTaskCMPXTaskQueue +create ui_commontestclass task +task ScheduleNextTaskCMPXTaskQueue +delete task +[Endtest] + +[Test] +title 74. ResetCMPXTaskQueue +create ui_commontestclass task +task ResetCMPXTaskQueue +delete task +[Endtest] + +[Test] +title 75. DeleteCMPXActiveTaskQueue +create ui_commontestclass task +task DeleteCMPXActiveTaskQueue +delete task +[Endtest] + +//--------------------------------------------------------------------------- +// 12.mpxuser.h MPXUser +//--------------------------------------------------------------------------- +[Test] +title 76. CompareUids MPXUser +create ui_commontestclass user +user CompareUids +delete user +[Endtest] + +[Test] +title 77. IsCallOngoing MPXUser +create ui_commontestclass user +user IsCallOngoing +delete user +[Endtest] + +[Test] +title 78. CompleteWithDllPath MPXUser +create ui_commontestclass user +user CompleteWithDllPath +delete user +[Endtest] + +[Test] +title 79. Alloc8L MPXUser +create ui_commontestclass user +user Alloc8L +delete user +[Endtest] + +[Test] +title 80. AllocL MPXUser +create ui_commontestclass user +user AllocL +delete user +[Endtest] + +[Test] +title 81. Ptr MPXUser +create ui_commontestclass user +user Ptr +delete user +[Endtest] + +[Test] +title 82. Ptr8 MPXUser +create ui_commontestclass user +user Ptr8 +delete user +[Endtest] + +[Test] +title 83. CreateBufferLC MPXUser +create ui_commontestclass user +user CreateBufferLC +delete user +[Endtest] + +[Test] +title 84. CreateBufferFromDes MPXUser +create ui_commontestclass user +user CreateBufferDesCL +delete user +[Endtest] + +[Test] +title 85. CreateBufferFromDesArray MPXUser +create ui_commontestclass user +user CreateBufferDesCArrayL +delete user +[Endtest] + +//[Test] //put to the buttommost +//title 86. CreateBufferFromMsg MPXUser +//create ui_commontestclass user +//user CreateBufferMsgL +//delete user +//[Endtest] + + +[Test] +title 87. CreateFromBufferL MPXUser +create ui_commontestclass user +user CreateFromBufferL +delete user +[Endtest] + +[Test] +title 88. ExternalizeL MPXUser +create ui_commontestclass user +user ExternalizeL +delete user +[Endtest] + +[Test] +title 89. ExternalizeArrayL MPXUser +create ui_commontestclass user +user ExternalizeArrayL +delete user +[Endtest] + +[Test] +title 90. InternalizeArrayL MPXUser +create ui_commontestclass user +user InternalizeArrayL +delete user +[Endtest] + +[Test] +title 91. InternalizeDesCArrayL MPXUser +create ui_commontestclass user +user InternalizeDesCArrayL +delete user +[Endtest] + +[Test] +title 92. CopyArrayL MPXUser +create ui_commontestclass user +user CopyArrayL +delete user +[Endtest] + +[Test] +title 93. MergeArray MPXUser +create ui_commontestclass user +user MergeArray +delete user +[Endtest] + +[Test] +title 94. MergeAttributeL MPXUser +create ui_commontestclass user +user MergeAttributeL +delete user +[Endtest] + +[Test] +title 95. ProcessIdL MPXUser +create ui_commontestclass user +user ProcessIdL +delete user +[Endtest] + +[Test] +title 96. CompareOrderedUidArrays MPXUser +create ui_commontestclass user +user CompareOrderedUidArrays +delete user +[Endtest] + +[Test] +title 97. Alloc8ZL MPXUser +create ui_commontestclass user +user Alloc8ZL +delete user +[Endtest] + +[Test] +title 98. RecreateBufferL testmpxuser +create ui_commontestclass user +user RecreateBufferL +delete user +[Endtest] + +[Test] +title 99. CompleteWithDllPathOL testmpxuser +create ui_commontestclass user +user CompleteWithDllPathOL +delete user +[Endtest] + +[Test] +title 100. FindWindowGroupIdL testmpxuser +create ui_commontestclass user +user FindWindowGroupIdL +pause 1000 +delete user +[Endtest] + +//--------------------------------------------------------------------------- +// 13.mpxviewplugin.h CMPXViewPlugin +//--------------------------------------------------------------------------- +[Test] +title 101. CreateCMPXViewPlugin viewplugin +create ui_commontestclass viewplugin +viewplugin CreateCMPXViewPlugin +delete viewplugin +[Endtest] + +[Test] +title 102. DeleteCMPXViewPlugin viewplugin +create ui_commontestclass viewplugin +viewplugin CreateCMPXViewPlugin +viewplugin DeleteCMPXViewPlugin +delete viewplugin +[Endtest] + + +//--------------------------------------------------------------------------- +// 14.mpxattribute.h TMPXAttribute & TMPXAttributeData +//--------------------------------------------------------------------------- +[Test] +title 103. TMPXAttribute Create: Default Contructor +create ui_commontestclass mpxatt +mpxatt MpxAttDefaultConst +delete mpxatt +[Endtest] + +[Test] +title 104. TMPXAttribute Create: Constructor +create ui_commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID1 KMPXAttAttributeID1 +delete mpxatt +[Endtest] + +[Test] +title 105. TMPXAttribute Create: Copy Constructor Attribute +create ui_commontestclass mpxatt +mpxatt MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID1 +delete mpxatt +[Endtest] + +[Test] +title 106. TMPXAttribute Create: Copy Constructor Attribute Data +create ui_commontestclass mpxatt +mpxatt MpxAttCopyConstAttData KMPXAttContentID1 KMPXAttAttributeID1 +delete mpxatt +[Endtest] + +[Test] +title 107. TMPXAttribute Assignment Operator +create ui_commontestclass mpxatt +mpxatt MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttOperatorAssignment 0 +delete mpxatt +[Endtest] + +[Test] +title 108. TMPXAttribute Equal Operator True +create ui_commontestclass mpxatt +mpxatt MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttOperatorEqual 0 1 KTrue +delete mpxatt +[Endtest] + +[Test] +title 109. TMPXAttribute Equal Operator False +create ui_commontestclass mpxatt +mpxatt MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttCopyConstAtt KMPXAttContentID2 KMPXAttAttributeID2 +mpxatt MpxAttOperatorEqual 0 1 KFalse +delete mpxatt +[Endtest] + +[Test] +title 110. TMPXAttribute Streaming +create ui_commontestclass mpxatt +mpxatt MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttStreamingL 0 +delete mpxatt +[Endtest] + +[Test] +title 111. TMPXAttribute ContentId +create ui_commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttContentId KMPXAttContentID1 0 +delete mpxatt +[Endtest] + +[Test] +title 112. TMPXAttribute AttributeId +create ui_commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttAttributeId KMPXAttAttributeID1 0 +delete mpxatt +[Endtest] + +[Test] +title 113. TMPXAttribute Match True +create ui_commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID2 KMPXAttAttributeID2 +mpxatt MpxAttCopyConstAtt KMPXAttContentID2 KMPXAttAttributeID2 +mpxatt MpxAttMatch 0 1 KTrue +delete mpxatt +[Endtest] + +[Test] +title 114. TMPXAttribute Match False +create ui_commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttCopyConstAtt KMPXAttContentID2 KMPXAttAttributeID2 +mpxatt MpxAttMatch 0 1 KFalse +delete mpxatt +[Endtest] + +[Test] +title 115. TMPXAttribute MatchContentId True +create ui_commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID2 KMPXAttAttributeID1 +mpxatt MpxAttCopyConstAtt KMPXAttContentID2 KMPXAttAttributeID2 +mpxatt MpxAttMatchContentId 0 1 KTrue +delete mpxatt +[Endtest] + +[Test] +title 116. TMPXAttribute MatchContentId False +create ui_commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttCopyConstAtt KMPXAttContentID2 KMPXAttAttributeID1 +mpxatt MpxAttMatchContentId 0 1 KFalse +delete mpxatt +[Endtest] + +[Test] +title 117. TMPXAttributeData Operator& AttData True +create ui_commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttOperatorAndAttData 0 1 KTrue +delete mpxatt +[Endtest] + +[Test] +title 118. TMPXAttributeData Operator& AttData False +create ui_commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID2 +mpxatt MpxAttOperatorAndAttData 0 1 KFalse +delete mpxatt +[Endtest] + +[Test] +title 119. TMPXAttributeData Operator& Att True +create ui_commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttOperatorAndData 0 KMPXAttAttributeID1 KTrue +delete mpxatt +[Endtest] + +[Test] +title 120. TMPXAttributeData Operator& Att False +create ui_commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttOperatorAndData 0 KMPXAttAttributeID2 KFalse +delete mpxatt +[Endtest] + +[Test] +title 121. TMPXAttributeData Operator BitwiseOr +create ui_commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID1 KMPXAttAttributeID2 +mpxatt MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID2 +mpxatt MpxAttOperatorOr 0 1 2 +delete mpxatt +[Endtest] + +[Test] +title 122. TMPXAttributeData Operator BitwiseOr +create ui_commontestclass mpxatt +mpxatt MpxAttConst KMPXAttContentID1 KMPXAttAttributeID1 +mpxatt MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID2 +mpxatt MpxAttOperatorOr 0 1 3 +delete mpxatt +[Endtest] + +// -------------------------------------------------------------------------- +// 15.mpxmedia.h CMPXMedia +// -------------------------------------------------------------------------- +[Test] +title 123. CMPXMedia NewL +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewL +delete mpxmedia +[Endtest] + +[Test] +title 124. CMPXMedia NewL SupportedIds +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 KMPXAttContentID2 +mpxmedia MpxMediaNewLSupportedIdsL +delete mpxmedia +[Endtest] + +[Test] +title 125. CMPXMedia NewL Media +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaNewLMediaL 0 +delete mpxmedia +[Endtest] + +[Test] +title 126. CMPXMedia NewL DataHandle +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID2 +mpxmedia MpxMediaNewLDataHandleL 0 +delete mpxmedia +[Endtest] + +[Test] +title 127. CMPXMedia NewL Stream +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 KMPXAttContentID2 +mpxmedia MpxMediaNewLStreamL 0 +delete mpxmedia +[Endtest] + +[Test] +title 128. CMPXMedia Assingment Operator +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaOperatorAssignment 0 +delete mpxmedia +[Endtest] + +[Test] +title 129. CMPXMedia SupportedIds +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 KMPXAttContentID2 +mpxmedia MpxMediaSupportedIds 0 KMPXAttContentID2 KMPXAttContentID1 +delete mpxmedia +[Endtest] + +[Test] +title 130. CMPXMedia SetTObjectValueL +create ui_commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTObjectValueL 0 0 5 +delete mpxmedia +[Endtest] + +[Test] +title 131. CMPXMedia SetCObjectValueL +create ui_commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeCObject +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetCObjectValueL 0 0 CMPXMediaArray +mpxmedia MpxMediaSetCObjectValueL 0 0 CMPXMedia +delete mpxmedia +[Endtest] + +[Test] +title 132. CMPXMedia SetNoNewLCObjectL +create ui_commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeCObject +mpxmedia MpxAttConst KMPXAttContentID2 KMPXAttAttributeCObject +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 KMPXAttContentID2 +mpxmedia MpxMediaSetNoNewLCObjectL 0 0 CMPXCollectionPath +mpxmedia MpxMediaSetNoNewLCObjectL 0 1 CMPXMediaArray +delete mpxmedia +[Endtest] + +[Test] +title 133. CMPXMedia SetTextValueL +create ui_commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID2 KMPXAttAttributeText +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID2 +mpxmedia MpxMediaSetTextValueL 0 0 five +delete mpxmedia +[Endtest] + +[Test] +title 134. CMPXMedia Attributes +create ui_commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 0 1 5 +mpxmedia MpxMediaAttributes 0 0 +mpxmedia MpxMediaAttributes 0 1 +delete mpxmedia +[Endtest] + +[Test] +title 135. CMPXMedia IsSupported +create ui_commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID2 KMPXAttAttributeInt +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaNewLSupportedIdsL +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 1 1 5 +mpxmedia MpxMediaIsSupported 0 0 1 +mpxmedia MpxMediaIsSupported 1 1 1 +mpxmedia MpxMediaIsSupported 0 1 0 +delete mpxmedia +[Endtest] + +[Test] +title 136. CMPXMedia Count +create ui_commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 0 1 5 +mpxmedia MpxMediaCount 0 2 +delete mpxmedia +[Endtest] + +[Test] +title 137. CMPXMedia Attribute +create ui_commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 0 1 5 +mpxmedia MpxMediaAttribute 0 0 0 +mpxmedia MpxMediaAttribute 0 1 1 +delete mpxmedia +[Endtest] + +[Test] +title 138. CMPXMedia AttributesSet +create ui_commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 0 1 5 +mpxmedia MpxMediaAttributesSet 0 KMPXAttContentID1 12 +mpxmedia MpxMediaAttributesSet 0 KMPXAttContentID2 0 +delete mpxmedia +[Endtest] + +[Test] +title 139. CMPXMedia Index +create ui_commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxAttConst KMPXAttContentID2 KMPXAttAttributeID2 +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 0 1 5 +mpxmedia MpxMediaIndex 0 0 0 +mpxmedia MpxMediaIndex 0 1 1 +mpxmedia MpxMediaIndex 0 2 KErrNotFound +delete mpxmedia +[Endtest] + +[Test] +title 140. CMPXMedia Type(index) +create ui_commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeCObject +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 0 1 5 +mpxmedia MpxMediaSetCObjectValueL 0 2 CMPXMedia +mpxmedia MpxMediaTypeIndex 0 0 KMPXTypeText +mpxmedia MpxMediaTypeIndex 0 1 KMPXTypeTObject +mpxmedia MpxMediaTypeIndex 0 2 KMPXTypeCObject +delete mpxmedia +[Endtest] + +[Test] +title 141. CMPXMedia Type(attribute) +create ui_commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeCObject +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 0 1 5 +mpxmedia MpxMediaSetCObjectValueL 0 2 CMPXMedia +mpxmedia MpxMediaTypeAttribute 0 0 KMPXTypeText +mpxmedia MpxMediaTypeAttribute 0 1 KMPXTypeTObject +mpxmedia MpxMediaTypeAttribute 0 2 KMPXTypeCObject +delete mpxmedia +[Endtest] + +[Test] +title 142. CMPXMedia Reset +create ui_commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeCObject +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 0 1 5 +mpxmedia MpxMediaSetCObjectValueL 0 2 CMPXMedia +mpxmedia MpxMediaCount 0 3 +mpxmedia MpxMediaReset 0 +mpxmedia MpxMediaCount 0 0 +delete mpxmedia +[Endtest] + +[Test] +title 143. CMPXMedia Delete(attribute) +create ui_commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeCObject +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 0 1 5 +mpxmedia MpxMediaSetCObjectValueL 0 2 CMPXMedia +mpxmedia MpxMediaCount 0 3 +mpxmedia MpxMediaDeleteAttribute 0 2 +mpxmedia MpxMediaCount 0 2 +mpxmedia MpxMediaDeleteAttribute 0 1 +mpxmedia MpxMediaCount 0 1 +delete mpxmedia +[Endtest] + +[Test] +title 144. CMPXMedia Delete(index) +create ui_commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 0 1 5 +mpxmedia MpxMediaCount 0 2 +mpxmedia MpxMediaDeleteIndex 0 0 +mpxmedia MpxMediaCount 0 1 +mpxmedia MpxMediaDeleteIndex 0 0 +mpxmedia MpxMediaCount 0 0 +delete mpxmedia +[Endtest] + +[Test] +title 145. CMPXMedia ValueText +create ui_commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaValueText 0 0 five +delete mpxmedia +[Endtest] + +[Test] +title 146. CMPXMedia Value +create ui_commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeCObject +mpxmedia MpxAttConst KMPXAttContentID2 KMPXAttAttributeCObject +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 KMPXAttContentID2 +mpxmedia MpxMediaSetCObjectValueL 0 0 CMPXMedia +mpxmedia MpxMediaSetCObjectValueL 0 1 CMPXCollectionPath +mpxmedia MpxMediaValue 0 0 CMPXMedia +mpxmedia MpxMediaValue 0 1 CMPXCollectionPath +delete mpxmedia +[Endtest] + +[Test] +title 147. CMPXMedia Value Null +create ui_commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeCObject +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetCObjectValueL 0 0 CMPXMediaArray +allowerrorcodes KErrUnexpectedValue +mpxmedia MpxMediaValue 0 1 CMPXMediaArray +delete mpxmedia +[Endtest] + +[Test] +title 148. CMPXMedia ValueTObjectL +create ui_commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTObjectValueL 0 0 5 +mpxmedia MpxMediaValueTObjectL 0 0 5 +delete mpxmedia +[Endtest] + +[Test] +title 149. CMPXMedia ValueCObjectL +create ui_commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeCObject +mpxmedia MpxAttConst KMPXAttContentID2 KMPXAttAttributeCObject +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 KMPXAttContentID2 +mpxmedia MpxMediaSetCObjectValueL 0 0 CMPXMedia +mpxmedia MpxMediaSetCObjectValueL 0 1 CMPXCollectionPath +mpxmedia MpxMediaValueCObjectL 0 0 CMPXMedia +mpxmedia MpxMediaValueCObjectL 0 1 CMPXCollectionPath +delete mpxmedia +[Endtest] + +[Test] +title 150. CMPXMedia Internalize Externalize +create ui_commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeCObject +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 0 1 5 +mpxmedia MpxMediaSetCObjectValueL 0 2 CMPXMedia +mpxmedia MpxMediaStreamingL 0 +delete mpxmedia +[Endtest] + +[Test] +title 151. CMPXMedia MpxMediaCopyL +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaCopyL 0 +delete mpxmedia +[Endtest] + +[Test] +title 152. CMPXMedia MpxMediaDeleteL +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewL +mpxmedia MpxMediaDeleteL +delete mpxmedia +[Endtest] + +[Test] +title 153. CMPXMedia MpxMediaHeapMemoryInfoL +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaHeapMemoryInfoL +delete mpxmedia +[Endtest] + +[Test] +title 150. CMPXMedia MpxMediaMergeMediaL +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaMergeMediaL +delete mpxmedia +[Endtest] + +[Test] +title 154. CMPXMedia MpxMediaMatchL +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxMediaMatchL +delete mpxmedia +[Endtest] + + +[Test] +title 155. CMPXMedia MpxMediaSetErrorL +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeCObject +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaNewLMediaL 0 +mpxmedia MpxMediaSetErrorL 0 0 +delete mpxmedia +[Endtest] + +[Test] +title 156. CMPXMedia MpxMediaErrorL +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeCObject +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaNewLMediaL 0 +mpxmedia MpxMediaErrorL 0 0 +delete mpxmedia +[Endtest] + +[Test] +title 157. CMPXMedia MpxMediaInternalizeL +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaInternalizeL +delete mpxmedia +[Endtest] + +[Test] +title 158. CMPXMedia MpxMediaExternalizeL +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaExternalizeL +delete mpxmedia +[Endtest] + + +// ------------------------------------------------------------------------- +// 16.mpxmediaarray.h CMPXMediaArray +// -------------------------------------------------------------------------- +[Test] +title 159. CMPXMediaArray NewL MediaArray +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 KMPXAttContentID2 +mpxmedia MpxMediaArrayNewLMediaArrayL +delete mpxmedia +[Endtest] + +[Test] +title 160. CMPXMediaArray Count +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 KMPXAttContentID2 +mpxmedia MpxMediaArrayCount 2 +delete mpxmedia +[Endtest] + +[Test] +title 161. CMPXMediaArray AtL +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 KMPXAttContentID2 +mpxmedia MpxMediaArrayAtLByIndexL 1 //2 +delete mpxmedia +[Endtest] + +[Test] +title 162. CMPXMediaArray AppendL by Ptr +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaArrayCount 0 +mpxmedia MpxMediaArrayAppendLByPtrL +mpxmedia MpxMediaArrayCount 1 +delete mpxmedia +[Endtest] + +[Test] +title 163. CMPXMediaArray AppendL by Reference +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaArrayCount 0 +mpxmedia MpxMediaArrayAppendLByRefL +mpxmedia MpxMediaArrayCount 1 +delete mpxmedia +[Endtest] + +[Test] +title 164. CMPXMediaArray Reset +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaArrayAppendLByRefL +mpxmedia MpxMediaArrayAppendLByPtrL +mpxmedia MpxMediaArrayCount 2 +mpxmedia MpxMediaArrayReset +mpxmedia MpxMediaArrayCount 0 +delete mpxmedia +[Endtest] + +[Test] +title 165. CMPXMediaArray Remove +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaArrayAppendLByRefL +mpxmedia MpxMediaArrayAppendLByPtrL +mpxmedia MpxMediaArrayCount 2 +mpxmedia MpxMediaArrayRemove 1 +mpxmedia MpxMediaArrayCount 1 +mpxmedia MpxMediaArrayRemove 0 +mpxmedia MpxMediaArrayCount 0 +delete mpxmedia +[Endtest] + +[Test] +title 166. CMPXMediaArray Insert by Ptr +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaArrayAppendLByRefL +mpxmedia MpxMediaArrayAppendLByPtrL +mpxmedia MpxMediaArrayCount 2 +mpxmedia MpxMediaArrayInsertByPtr 0 +mpxmedia MpxMediaArrayCount 3 +mpxmedia MpxMediaArrayInsertByPtr 3 +mpxmedia MpxMediaArrayCount 4 +delete mpxmedia +[Endtest] + +[Test] +title 167. CMPXMediaArray Insert by Ref +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaArrayAppendLByRefL +mpxmedia MpxMediaArrayAppendLByPtrL +mpxmedia MpxMediaArrayCount 2 +mpxmedia MpxMediaArrayInsertByRef 0 +mpxmedia MpxMediaArrayCount 3 +mpxmedia MpxMediaArrayInsertByRef 3 +mpxmedia MpxMediaArrayCount 4 +delete mpxmedia +[Endtest] + +[Test] +title 168. CMPXMediaArray InsertL by Ptr +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaArrayAppendLByRefL +mpxmedia MpxMediaArrayAppendLByPtrL +mpxmedia MpxMediaArrayCount 2 +mpxmedia MpxMediaArrayInsertLByPtrL 0 +mpxmedia MpxMediaArrayCount 3 +mpxmedia MpxMediaArrayInsertLByPtrL 3 +mpxmedia MpxMediaArrayCount 4 +delete mpxmedia +[Endtest] + +[Test] +title 169. CMPXMediaArray InsertL by Ref +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaArrayAppendLByRefL +mpxmedia MpxMediaArrayAppendLByPtrL +mpxmedia MpxMediaArrayCount 2 +mpxmedia MpxMediaArrayInsertLByRefL 0 +mpxmedia MpxMediaArrayCount 3 +mpxmedia MpxMediaArrayInsertLByRefL 3 +mpxmedia MpxMediaArrayCount 4 +delete mpxmedia +[Endtest] + +[Test] +title 170. CMPXMediaArray Set +create ui_commontestclass mpxmedia +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaArrayAppendLByRefL +mpxmedia MpxMediaArrayAppendLByPtrL +mpxmedia MpxMediaArraySet 0 +mpxmedia MpxMediaArraySet 1 +delete mpxmedia +[Endtest] + +[Test] +title 171. CMPXMediaArray Internalize Externalize +create ui_commontestclass mpxmedia +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeText +mpxmedia MpxAttConst KMPXAttContentID1 KMPXAttAttributeInt +mpxmedia MpxMediaArrayNewL +mpxmedia MpxMediaNewLSupportedIdsL KMPXAttContentID1 +mpxmedia MpxMediaSetTextValueL 0 0 five +mpxmedia MpxMediaSetTObjectValueL 0 1 5 +mpxmedia MpxMediaArrayAppendLByPtrL +mpxmedia MpxMediaArrayStreamingL +delete mpxmedia +[Endtest] + +// -------------------------------------------------------------------------- +// 17.mpxcollectionpath.h CMPXCollectionPath +// -------------------------------------------------------------------------- +[Test] +title 172. CMPXCollectionPath NewL +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +delete mpxcollpath +[Endtest] + +[Test] +title 173. CMPXCollectionPath NewL Path +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxCollPathNewLPathL +delete mpxcollpath +[Endtest] + +[Test] +title 174. CMPXCollectionPath NewL Stream +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxCollPathNewLStreamL +delete mpxcollpath +[Endtest] + +[Test] +title 175. CMPXCollectionPath AppendL Id +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +delete mpxcollpath +[Endtest] + +[Test] +title 176. CMPXCollectionPath AppendL Id array +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +delete mpxcollpath +[Endtest] + +[Test] +title 177. CMPXCollectionPath Levels +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathLevels 3 +delete mpxcollpath +[Endtest] + +[Test] +title 178. CMPXCollectionPath Back +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathLevels 3 +mpxcollpath MpxCollPathBack +mpxcollpath MpxCollPathLevels 2 +mpxcollpath MpxCollPathBack +mpxcollpath MpxCollPathLevels 1 +delete mpxcollpath +[Endtest] + +[Test] +title 179. CMPXCollectionPath Reset +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathLevels 3 +mpxcollpath MpxCollPathReset +mpxcollpath MpxCollPathLevels 0 +delete mpxcollpath +[Endtest] + +[Test] +title 180. CMPXCollectionPath Operator++ +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathOperatorPlus KTrue +mpxcollpath MpxCollPathOperatorPlus KTrue +mpxcollpath MpxCollPathOperatorPlus KFalse +delete mpxcollpath +[Endtest] + +[Test] +title 181. CMPXCollectionPath Operator-- +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathOperatorPlus KTrue +mpxcollpath MpxCollPathOperatorPlus KTrue +mpxcollpath MpxCollPathOperatorMinus KTrue +mpxcollpath MpxCollPathOperatorMinus KTrue +mpxcollpath MpxCollPathOperatorMinus KFalse +delete mpxcollpath +[Endtest] + +[Test] +title 182. CMPXCollectionPath SetToFirst +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathOperatorPlus KTrue +mpxcollpath MpxCollPathOperatorPlus KTrue +mpxcollpath MpxCollPathIndex 2 +mpxcollpath MpxCollPathSetToFirst +mpxcollpath MpxCollPathIndex 0 +delete mpxcollpath +[Endtest] + +[Test] +title 183. CMPXCollectionPath SetToLast +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetToLast +mpxcollpath MpxCollPathIndex 2 +delete mpxcollpath +[Endtest] + +[Test] +title 184. CMPXCollectionPath Set(aIndex) +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 2 +mpxcollpath MpxCollPathIndex 2 +mpxcollpath MpxCollPathSetIndex 0 +mpxcollpath MpxCollPathIndex 0 +delete mpxcollpath +[Endtest] + +[Test] +title 185. CMPXCollectionPath Set(aId) +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetId KMPXPathItem3 +mpxcollpath MpxCollPathIndex 2 +mpxcollpath MpxCollPathSetId KMPXPathItem1 +mpxcollpath MpxCollPathIndex 0 +delete mpxcollpath +[Endtest] + +[Test] +title 186. CMPXCollectionPath Set(aMode) +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathSetMode KMPXOpenNoPlaylist +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxCollPathSetMode KMPXOpenAllItems +mpxcollpath MpxCollPathOpenNextMode KMPXOpenAllItems +mpxcollpath MpxCollPathOpenPreviousMode KMPXOpenNoPlaylist +delete mpxcollpath +[Endtest] + +[Test] +title 187. CMPXCollectionPath Set(aAttrs) +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID1 +mpxcollpath MpxAttCopyConstAtt KMPXAttContentID2 KMPXAttAttributeID2 +mpxcollpath MpxCollPathSetLAttrsL +delete mpxcollpath +[Endtest] + +[Test] +title 188. CMPXCollectionPath SelectL(aId) +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIdL KMPXPathItem2 +mpxcollpath MpxCollPathSelectLIdL KMPXPathItem1 +delete mpxcollpath +[Endtest] + +[Test] +title 189. CMPXCollectionPath SelectL(aIndex) +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIndexL 2 +mpxcollpath MpxCollPathSelectLIndexL 0 +delete mpxcollpath +[Endtest] + +[Test] +title 190. CMPXCollectionPath SelectAllL +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectAllL +delete mpxcollpath +[Endtest] + +[Test] +title 191. CMPXCollectionPath Deselect(aId) +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIdL KMPXPathItem2 +mpxcollpath MpxCollPathSelectLIdL KMPXPathItem1 +mpxcollpath MpxCollPathDeselectId KMPXPathItem1 +mpxcollpath MpxCollPathDeselectId KMPXPathItem2 +delete mpxcollpath +[Endtest] + +[Test] +title 192. CMPXCollectionPath Deselect(aIndex) +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIndexL 2 +mpxcollpath MpxCollPathSelectLIndexL 0 +mpxcollpath MpxCollPathDeselectIndex 2 +mpxcollpath MpxCollPathDeselectIndex 0 +delete mpxcollpath +[Endtest] + +[Test] +title 193. CMPXCollectionPath DeselectAll +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIndexL 2 +mpxcollpath MpxCollPathSelectLIndexL 0 +mpxcollpath MpxCollPathDeselectAll +delete mpxcollpath +[Endtest] + +[Test] +title 194. CMPXCollectionPath Remove(aId) +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIdL KMPXPathItem2 +mpxcollpath MpxCollPathSelectLIdL KMPXPathItem1 +mpxcollpath MpxCollPathRemoveId KMPXPathItem1 +mpxcollpath MpxCollPathRemoveId KMPXPathItem2 +delete mpxcollpath +[Endtest] + +[Test] +title 195. CMPXCollectionPath Remove(aIndex) +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIndexL 2 +mpxcollpath MpxCollPathSelectLIndexL 0 +mpxcollpath MpxCollPathRemoveIndex 2 +mpxcollpath MpxCollPathRemoveIndex 0 +delete mpxcollpath +[Endtest] + +[Test] +title 196. CMPXCollectionPath IsSelected(aId) +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIdL KMPXPathItem2 +mpxcollpath MpxCollPathSelectLIdL KMPXPathItem1 +mpxcollpath MpxCollPathIsSelectedId KMPXPathItem1 KTrue +mpxcollpath MpxCollPathRemoveId KMPXPathItem1 +mpxcollpath MpxCollPathIsSelectedId KMPXPathItem1 KFalse +delete mpxcollpath +[Endtest] + +[Test] +title 197. CMPXCollectionPath IsSelected(aIndex) +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIndexL 2 +mpxcollpath MpxCollPathSelectLIndexL 0 +mpxcollpath MpxCollPathIsSelectedIndex 2 KTrue +mpxcollpath MpxCollPathDeselectIndex 2 +mpxcollpath MpxCollPathIsSelectedIndex 2 KFalse +delete mpxcollpath +[Endtest] + +[Test] +title 198. CMPXCollectionPath ClearSelection +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIndexL 2 +mpxcollpath MpxCollPathSelectLIndexL 0 +mpxcollpath MpxCollPathClearSelection +mpxcollpath MpxCollPathIsSelectedIndex 0 KFalse +mpxcollpath MpxCollPathIsSelectedIndex 2 KFalse +delete mpxcollpath +[Endtest] + +[Test] +title 199. CMPXCollectionPath Selection +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIndexL 2 +mpxcollpath MpxCollPathSelectLIndexL 1 +mpxcollpath MpxCollPathSelection 2 1 +delete mpxcollpath +[Endtest] + +[Test] +title 200. CMPXCollectionPath SelectionL +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIdL KMPXPathItem2 +mpxcollpath MpxCollPathSelectLIdL KMPXPathItem3 +mpxcollpath MpxCollPathSelectionL KMPXPathItem2 KMPXPathItem3 +delete mpxcollpath +[Endtest] + +[Test] +title 201. CMPXCollectionPath Id +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetId KMPXPathItem3 +mpxcollpath MpxCollPathId KMPXPathItem3 +delete mpxcollpath +[Endtest] + +[Test] +title 202. CMPXCollectionPath Count +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathCount 3 +delete mpxcollpath +[Endtest] + +[Test] +title 203. CMPXCollectionPath IndexOfId +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathIndexOfId KMPXPathItem1 0 +mpxcollpath MpxCollPathIndexOfId KMPXPathItem2 1 +mpxcollpath MpxCollPathIndexOfId KMPXPathItem3 2 +delete mpxcollpath +[Endtest] + +[Test] +title 204. CMPXCollectionPath IdOfIndex +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathIdOfIndex 0 KMPXPathItem1 +mpxcollpath MpxCollPathIdOfIndex 1 KMPXPathItem2 +mpxcollpath MpxCollPathIdOfIndex 2 KMPXPathItem3 +delete mpxcollpath +[Endtest] + +[Test] +title 205. CMPXCollectionPath OpenAttributes +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID1 +mpxcollpath MpxAttCopyConstAtt KMPXAttContentID2 KMPXAttAttributeID2 +mpxcollpath MpxCollPathSetLAttrsL +mpxcollpath MpxCollPathOpenAttributes +delete mpxcollpath +[Endtest] + +[Test] +title 206. CMPXCollectionPath Index(aLevel) +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 1 +mpxcollpath MpxItemIdReset +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxItemIdConst KMPXPathItem4 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 0 +mpxcollpath MpxCollPathIndexLevel 1 1 +mpxcollpath MpxCollPathIndexLevel 2 0 +delete mpxcollpath +[Endtest] + +[Test] +title 207. CMPXCollectionPath Id(aLevel) +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 1 +mpxcollpath MpxItemIdReset +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxItemIdConst KMPXPathItem4 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 0 +mpxcollpath MpxCollPathIdLevel 1 KMPXPathItem2 +mpxcollpath MpxCollPathIdLevel 2 KMPXPathItem3 +delete mpxcollpath +[Endtest] + +[Test] +title 208. CMPXCollectionPath ExternalizeL and InternalizeL +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 1 +mpxcollpath MpxItemIdReset +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxItemIdConst KMPXPathItem4 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 0 +mpxcollpath MpxCollPathStreamingL +delete mpxcollpath +[Endtest] + +[Test] +title 209. CMPXCollectionPath HandleChange - KPathChangeAdded +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSelectLIndexL 2 +mpxcollpath MpxCollPathHandleChange KMPXPathItem3 0 KPathChangeAdded KErrNotFound KChangeResultPathModified +delete mpxcollpath +[Endtest] + +[Test] +title 210. CMPXCollectionPath HandleChange - KPathChangeDeleted: Not Top Level +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 1 +mpxcollpath MpxItemIdReset +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxItemIdConst KMPXPathItem4 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 0 +mpxcollpath MpxCollPathHandleChange 0 KMPXPathItem2 KPathChangeDeleted 1 KChangeResultPathClipped +delete mpxcollpath +[Endtest] + +[Test] +title 211. CMPXCollectionPath HandleChange - KPathChangeDeleted: Top Level +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 1 +mpxcollpath MpxItemIdReset +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxItemIdConst KMPXPathItem4 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 0 +mpxcollpath MpxCollPathHandleChange KMPXPathItem3 0 KPathChangeDeleted 0 KChangeResultPathModified +delete mpxcollpath +[Endtest] + +[Test] +title 212. CMPXCollectionPath HandleChange - KPathChangeModified: Not Top Level +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 1 +mpxcollpath MpxItemIdReset +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxItemIdConst KMPXPathItem4 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 0 +mpxcollpath MpxCollPathHandleChange KMPXPathItem5 KMPXPathItem2 KPathChangeModified KErrNotFound KChangeResultPathModified +delete mpxcollpath +[Endtest] + +[Test] +title 213. CMPXCollectionPath HandleChange - KPathChangeModified: Top Level +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 1 +mpxcollpath MpxItemIdReset +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxItemIdConst KMPXPathItem4 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 0 +mpxcollpath MpxCollPathHandleChange KMPXPathItem5 KMPXPathItem4 KPathChangeModified 1 KChangeResultPathModified +delete mpxcollpath +[Endtest] + +[Test] +title 214. CMPXCollectionPath ContainerPathL +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxCollPathNewLPathL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollectionpathContainerPathL +delete mpxcollpath +[Endtest] + +[Test] +title 215. CMPXCollectionPath InsertL +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxCollectionpathInsertL KMPXPathLevel3 +delete mpxcollpath +[Endtest] + +[Test] +title 216. CMPXCollectionPath Items +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxCollectionpathItems +delete mpxcollpath +[Endtest] + +[Test] +title 217. CMPXCollectionPath Update +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxCollPathNewLPathL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxCollPathSetIndex 1 +mpxcollpath MpxCollectionpathUpdate 0 KMPXPathItem3 +delete mpxcollpath +[Endtest] + +[Test] +title 218. CMPXCollectionPath Delete +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollectionpathDelete +delete mpxcollpath +[Endtest] + +[Test] +title 219. CMPXCollectionPath Set(aAttrs) +create ui_commontestclass mpxcollpath +mpxcollpath MpxCollPathNewL +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +mpxcollpath MpxItemIdConst KMPXPathItem1 +mpxcollpath MpxItemIdConst KMPXPathItem2 +mpxcollpath MpxItemIdConst KMPXPathItem3 +mpxcollpath MpxCollPathAppendLIdsL +mpxcollpath MpxAttCopyConstAtt KMPXAttContentID1 KMPXAttAttributeID1 +mpxcollpath MpxAttCopyConstAtt KMPXAttContentID2 KMPXAttAttributeID2 +mpxcollpath MpxCollectionpathCollPathSetAttrsL +delete mpxcollpath +[Endtest] + +//[Test] +//title 220. CMPXCollectionPath HandleChange - KPathChangeGroupModified +//create ui_commontestclass mpxcollpath +//mpxcollpath MpxCollPathNewL +//mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +//mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel2 +//mpxcollpath MpxItemIdConst KMPXPathItem1 +//mpxcollpath MpxItemIdConst KMPXPathItem2 +//mpxcollpath MpxItemIdConst KMPXPathItem3 +//mpxcollpath MpxCollPathAppendLIdsL +//mpxcollpath MpxCollPathSelectLIndexL 2 +//mpxcollpath MpxCollPathHandleChange KMPXPathItem3 0 KPathChangeGroupModified KErrNotFound KChangeResultPathModified +//delete mpxcollpath +//[Endtest] + +//[Test] +//title 221. CMPXCollectionPath HandleChange - Path Unchanged +//create ui_commontestclass mpxcollpath +//mpxcollpath MpxCollPathNewL +//mpxcollpath MpxCollPathAppendLIdL KMPXPathLevel1 +//mpxcollpath MpxItemIdConst KMPXPathItem1 +//mpxcollpath MpxItemIdConst KMPXPathItem2 +//mpxcollpath MpxCollPathAppendLIdsL +//mpxcollpath MpxCollPathSetIndex 1 +//mpxcollpath MpxItemIdReset +//mpxcollpath MpxItemIdConst KMPXPathItem3 +//mpxcollpath MpxItemIdConst KMPXPathItem4 +//mpxcollpath MpxCollPathAppendLIdsL +//mpxcollpath MpxCollPathSetIndex 0 +//mpxcollpath MpxCollPathHandleChange KMPXPathItem5 KMPXPathLevel2 KPathChangeModified KErrNotFound KChangeResultPathUnchanged +//delete mpxcollpath +//[Endtest] + +// -------------------------------------------------------------------------- +// 18.mpxclientlist.h CMPXClientList +// -------------------------------------------------------------------------- +[Test] +title 220. CMPXClientList NewL +create ui_commontestclass mpxclientlist +mpxclientlist MpxClientListNewL +mpxclientlist MpxClientListDestruction +delete mpxclientlist +[Endtest] + +[Test] +title 221. CMPXClientList ClientCount +create ui_commontestclass mpxclientlist +mpxclientlist MpxClientListNewL +mpxclientlist MpxClientListClientCount 0 +mpxclientlist MpxClientListDestruction +delete mpxclientlist +[Endtest] + +[Test] +title 222. CMPXClientList IsClient +create ui_commontestclass mpxclientlist +mpxclientlist MpxClientListNewL +mpxclientlist MpxClientListIsClient KFalse +mpxclientlist MpxClientListDestruction +delete mpxclientlist +[Endtest] + +[Test] +title 223. CMPXClientList Find by MsgQueue +create ui_commontestclass mpxclientlist +mpxclientlist MpxClientListNewL +mpxclientlist CreateCMPXMessageQueueL +mpxclientlist MpxClientListFindByMsg KErrNotFound +mpxclientlist MpxClientListDestruction +delete mpxclientlist +[Endtest] + +[Test] +title 224. CMPXClientList Find by ThreadId +create ui_commontestclass mpxclientlist +mpxclientlist MpxClientListNewL +mpxclientlist MpxClientListFindById KErrNotFound +mpxclientlist MpxClientListDestruction +delete mpxclientlist +[Endtest] + +[Test] +title 225. CMPXClientList Adds a subscription +create ui_commontestclass mpxclientlist +mpxclientlist MpxClientListNewL +mpxclientlist CreateCMPXMessageQueueL +mpxclientlist MpxClientListFindByMsg KErrNotFound +mpxclientlist CMPXSubscriptionNewL +//mpxclientlist MpxMediaArrayNewL +mpxclientlist MpxClientListAddClientL +mpxclientlist MpxClientListAddSubscriptionL +mpxclientlist MpxClientListDestruction +//mpxclientlist MpxMediaDeleteL +delete mpxclientlist +[Endtest] + +[Test] +title 226. CMPXClientList Removes a subscription +create ui_commontestclass mpxclientlist +mpxclientlist MpxClientListNewL +//mpxclientlist CreateCMPXMessageQueueL +//mpxclientlist MpxClientListFindByMsg KErrNotFound +mpxclientlist CMPXSubscriptionNewL +//mpxclientlist MpxMediaArrayNewL +mpxclientlist MpxClientListAddClientL +mpxclientlist MpxClientListAddSubscriptionL +mpxclientlist MpxClientListRemoveSubscriptionL +mpxclientlist MpxClientListDestruction +//mpxclientlist MpxMediaDeleteL +delete mpxclientlist +[Endtest] + +[Test] +title 227. CMPXClientList Removes all subscription +create ui_commontestclass mpxclientlist +mpxclientlist MpxClientListNewL +//mpxclientlist CreateCMPXMessageQueueL +//mpxclientlist MpxClientListFindByMsg KErrNotFound +//mpxclientlist MpxClientListFindByMsg KErrNotFound +//mpxclientlist MpxMediaArrayNewL +mpxclientlist CMPXSubscriptionNewL +mpxclientlist MpxClientListAddClientL +mpxclientlist MpxClientListAddSubscriptionL +mpxclientlist MpxClientListRemoveAllSubscriptionsL +mpxclientlist MpxClientListDestruction +//mpxclientlist MpxMediaDeleteL +delete mpxclientlist +[Endtest] + +[Test] +title 228. MPXClientListConvertMsgLC CMPXClientList +create ui_commontestclass mpxclientlist +mpxclientlist MpxClientListNewL +mpxclientlist MPXClientListConvertMsgLC +mpxclientlist MpxClientListDestruction +delete mpxclientlist +[Endtest] + +[Test] +title 229. SendMsgLIndexAndTMPMsgCMPXClientList +create ui_commontestclass CMPXClientList +CMPXClientList MpxClientListNewL +CMPXClientList MpxClientListAddClientLUsingMode +CMPXClientList SendMsgLIndexAndTMPMsgCMPXClientList +CMPXClientList MpxClientListDestruction +delete CMPXClientList +[Endtest] + + +[Test] +title 230. AddClientL CMPXMessageMonitor +create ui_commontestclass monitor +monitor MpxClientListAddClientLUsingMode +delete monitor +[Endtest] + +[Test] +title 231. MpxClientListSendMsg CMPXClientList +create ui_commontestclass mpxclientlist +mpxclientlist MpxClientListNewL +mpxclientlist MpxClientListSendMsg +delete mpxclientlist +[Endtest] + +[Test] +title 232. MpxClientListSendMsgaIndex CMPXClientList +create ui_commontestclass mpxclientlist +mpxclientlist MpxClientListNewL +mpxclientlist MpxClientListAddClientL +mpxclientlist MpxClientListSendMsgaIndex +mpxclientlist MpxClientListDestruction +delete mpxclientlist +[Endtest] + +[Test] +title 233. SendMsgLByMsgCMPXClientList +create ui_commontestclass CMPXClientList +CMPXClientList MpxClientListNewL +CMPXClientList SendMsgLByMsgCMPXClientList +CMPXClientList MpxClientListDestruction +delete task +[Endtest] + +[Test] +title 234. CMPXClientList Destruction +create ui_commontestclass mpxclientlist +mpxclientlist MpxClientListNewL +mpxclientlist DeleteMpxClientList +delete mpxclientlist +[Endtest] + +[Test] +title 235. CMPXClientList AddClientL +create ui_commontestclass mpxclientlist +mpxclientlist MpxClientListNewL +mpxclientlist MpxClientListAddClientL +delete mpxclientlist +[Endtest] + +[Test] +title 236. CMPXClientList MpxClientListAddClientLUsingMode +create ui_commontestclass mpxclientlist +mpxclientlist MpxClientListNewL +mpxclientlist MpxClientListAddClientLUsingMode +delete mpxclientlist +[Endtest] + +[Test] +title 237. CMPXClientList MpxClientListRemoveClient +create ui_commontestclass mpxclientlist +mpxclientlist MpxClientListNewL +mpxclientlist MpxClientListAddClientLUsingMode +mpxclientlist MpxClientListRemoveClient +delete mpxclientlist +[Endtest] + +[Test] +title 238. CMPXClientList MpxClientListClientProcessList +create ui_commontestclass mpxclientlist +mpxclientlist MpxClientListNewL +mpxclientlist MpxClientListClientProcessList +delete mpxclientlist +[Endtest] + + + +[Test] +title 239. MpxClientListClientMode CMPXClientList +create ui_commontestclass mpxclientlist +mpxclientlist MpxClientListNewL +mpxclientlist MpxClientListAddClientL +mpxclientlist MpxClientListClientMode +delete mpxclientlist +[Endtest] + +// -------------------------------------------------------------------------- +// 19.mpxpluginhandlerbase.h CMPXPluginHandlerBase +// -------------------------------------------------------------------------- +[Test] +title 240. CMPXPluginHandlerBase SelectPluginL(aPluginUid) +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseSelectPluginLIdL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 241. CMPXPluginHandlerBase SelectPluginL(aPluginName) +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseSelectPluginLNameL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 242. CMPXPluginHandlerBase SelectPluginL(aUri, aDataType) +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseSelectPluginLUriL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 241. CMPXPluginHandlerBase SelectPluginL(aPluginType) +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseSelectPluginLTypeL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 242. CMPXPluginHandlerBase ClearSelectionCriteria +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseClearSelectionCriteria +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 243. CMPXPluginHandlerBase PluginName(aPluginType) +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBasePluginNameType +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 244. CMPXPluginHandlerBase PluginNamesL +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBasePluginNamesL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 245. CMPXPluginHandlerBase SupportedMimeTypesL +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseSupportedMimeTypesL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 246. CMPXPluginHandlerBase SupportedExtensionsL +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseSupportedExtensionsL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 247. CMPXPluginHandlerBase SupportedSchemasL +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseSupportedSchemasL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 248. CMPXPluginHandlerBase SupportedMimeTypesL +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseSupportedMimeTypesLUidL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 249. CMPXPluginHandlerBase SupportedExtensionsL +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseSupportedExtensionsLUidL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 250. CMPXPluginHandlerBase GetPluginTypes +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseGetPluginTypes +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 251. CMPXPluginHandlerBase GetPluginUids +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseGetPluginUids +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 252. CMPXPluginHandlerBase GetPluginUidsL +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseGetPluginUidsL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 253. CMPXPluginHandlerBase PluginUid +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBasePluginUid +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 254. CMPXPluginHandlerBase IndexOf +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseIndexOf +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 255. CMPXPluginHandlerBase CreatePluginListL +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseCreatePluginListL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 256. CMPXPluginHandlerBase FindPlugin +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseFindPlugin +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 257. AddClientL testmpxuser +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxClientListAddClientL +mpxpluginhandlerbase MpxClientListDestruction +delete mpxpluginhandlerbase +[Endtest] + +//[Test] +//title 258. CMPXPluginHandlerBase SupportUids +//create ui_commontestclass mpxpluginhandlerbase +//mpxpluginhandlerbase MpxPluginHandlerBaseSupportUids +//delete mpxpluginhandlerbase +//[Endtest] + +[Test] +title 259. CMPXPluginHandlerBase CMPXPluginHandlerBase +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseCreate +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 260. CMPXPluginHandlerBase ~CMPXPluginHandlerBase +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseDestruction +delete mpxpluginhandlerbase +[Endtest] + +//[Test] +//title 261. CMPXPluginHandlerBase SelectPluginL +//create ui_commontestclass mpxpluginhandlerbase +//mpxpluginhandlerbase MpxPluginHandlerBaseSelectPluginLRFile mpxtest2.mp3 +//delete mpxpluginhandlerbase +//[Endtest] + +[Test] +title 262. CMPXPluginHandlerBase PluginName +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBasePluginNameByUid +delete mpxpluginhandlerbase +[Endtest] + +//[Test] +//title 263. CMPXPluginHandlerBase PluginFlagsL +//create ui_commontestclass mpxpluginhandlerbase +//mpxpluginhandlerbase MpxPluginHandlerBaseCreatePluginListL +////mpxpluginhandlerbase MpxPluginHandlerBaseSupportUids +////mpxpluginhandlerbase MpxPluginHandlerBaseSelectPluginLIdL +////mpxpluginhandlerbase MpxPluginHandlerBaseSelectPluginLRFile mpxtest2.mp3 +//mpxpluginhandlerbase MpxPluginHandlerBasePluginFlagsL +//delete mpxpluginhandlerbase +//[Endtest] + +[Test] +title 264. CMPXPluginHandlerBase MpxPluginType +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBasePluginType +delete mpxpluginhandlerbase +[Endtest] + + +[Test] +title 265. CMPXPluginHandlerBase GetSelectionCriteria +create ui_commontestclass mpxpluginhandlerbase +//mpxpluginhandlerbase MpxPluginHandlerBaseSelectPluginLUriL +mpxpluginhandlerbase MpxPluginHandlerBaseGetSelectionCriteria +delete mpxpluginhandlerbase + +[Endtest] + +[Test] +title 266. CMPXPluginHandlerBase UsePlugin +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseUsePluginTUid +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 267. CMPXPluginHandlerBase ReleasePlugin +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseReleasePluginTUid +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 268. CMPXPluginHandlerBase PluginsChangedL +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHBBasePluginsChangedL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 269. CMPXPluginHandlerBase IsPluginLoaded +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHBBaseIsPluginLoaded +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 270. CMPXPluginHandlerBase LoadPluginL +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHBBaseLoadPluginL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 271. CMPXPluginHandlerBase HandlePluginUnload +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHBBaseHandlePluginUnload +delete mpxpluginhandlerbase +[Endtest] + + +// -------------------------------------------------------------------------- +// 20.mpxplugininfo.h CMPXPluginInfo +// -------------------------------------------------------------------------- +[Test] +title 272. CMPXPluginInfoDestructor +create ui_commontestclass info +info CMPXPluginInfoDestructor +delete info +[Endtest] + +[Test] +title 273. CMPXPluginInfoImplementationUid +create ui_commontestclass info +info CMPXPluginInfoImplementationUid +delete info +[Endtest] + + +//[Test] +//title 274. CMPXPluginInfoFlags +//create ui_commontestclass info +//info CMPXPluginInfoImplementationUid +//info CMPXPluginInfoFlags +//delete info +//[Endtest] + +[Test] +title 275. CMPXPluginInfo ProcessTaggedDataExL +create ui_commontestclass info +info CMPXPluginInfoProcessTaggedDataExL +delete info +[Endtest] + +[Test] +title 276. CMPXPluginInfo ProcessTaggedDataExL +create ui_commontestclass info +info CMPXPluginInfoExtractIntoArrayL +delete info +[Endtest] + + +// -------------------------------------------------------------------------- +// 21.mpxsubscription.h CMPXSubscription added on 2009,2,13 +// -------------------------------------------------------------------------- +[Test] +title 277. CMPXSubscription NewL +create ui_commontestclass subscription +subscription CMPXSubscriptionNewL +delete subscription +pause 1000 +[Endtest] + +[Test] +title 278. CMPXSubscription NewL(CMPXMediaArray&) +create ui_commontestclass subscription +subscription MpxMediaArrayNewL +subscription CMPXSubscriptionNewLWithMediaArrayL +subscription MpxMediaDeleteL +delete subscription +pause 1000 +[Endtest] + +[Test] +title 279.1 CMPXSubscription AddItemL +create ui_commontestclass subscription +subscription MpxMediaArrayNewL +subscription CMPXSubscriptionNewLWithMediaArrayL +subscription CMPXSubscriptionAddItemL +subscription MpxMediaDeleteL +delete subscription +pause 1000 +[Endtest] + +[Test] +title 279.2 CMPXSubscription AddItemL +create ui_commontestclass subscription +subscription CMPXSubscriptionNewL +subscription CMPXSubscriptionAddItemL +delete subscription +pause 1000 +[Endtest] + +[Test] +title 280.1 CMPXSubscription ItemsL:0 +create ui_commontestclass subscription +subscription CMPXSubscriptionNewL +subscription CMPXSubscriptionItemsL +delete subscription +pause 1000 +[Endtest] + +[Test] +title 280.2 CMPXSubscription ItemsL:0 +create ui_commontestclass subscription +subscription MpxMediaArrayNewL +subscription CMPXSubscriptionNewLWithMediaArrayL +subscription CMPXSubscriptionItemsL +subscription MpxMediaDeleteL +delete subscription +pause 1000 +[Endtest] + +[Test] +title 281.1 CMPXSubscription operator==:ETrue +create ui_commontestclass subscription +subscription MpxMediaArrayNewL +subscription CMPXSubscriptionNewLWithMediaArrayL +subscription CMPXSubscriptionIsEqualOperator 1 +subscription MpxMediaDeleteL +delete subscription +pause 1000 +[Endtest] + +[Test] +title 281.2 CMPXSubscription operator==:EFalse +create ui_commontestclass subscription +subscription MpxMediaArrayNewL +subscription CMPXSubscriptionNewLWithMediaArrayL +subscription CMPXSubscriptionAddItemL +subscription CMPXSubscriptionIsEqualOperator 0 +subscription MpxMediaDeleteL +delete subscription +pause 1000 +[Endtest] + +//-----------------------the following 4 un-pass +[Test] +title 86. CreateBufferFromMsg MPXUser +create ui_commontestclass user +user CreateBufferMsgL +delete user +[Endtest] + +[Test] +title 258. CMPXPluginHandlerBase SupportUids +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseSupportUids +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 261. CMPXPluginHandlerBase SelectPluginL +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseSelectPluginLRFile mpxtest2.mp3 +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 263. CMPXPluginHandlerBase PluginFlagsL +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseCreatePluginListL +//mpxpluginhandlerbase MpxPluginHandlerBaseSupportUids +//mpxpluginhandlerbase MpxPluginHandlerBaseSelectPluginLIdL +//mpxpluginhandlerbase MpxPluginHandlerBaseSelectPluginLRFile mpxtest2.mp3 +mpxpluginhandlerbase MpxPluginHandlerBasePluginFlagsL +delete mpxpluginhandlerbase +[Endtest] + +[Test] +title 274. CMPXPluginInfoFlags +create ui_commontestclass info +info CMPXPluginInfoImplementationUid +info CMPXPluginInfoFlags +delete info +[Endtest] + +[Test] +title 282. CMPXPluginHandlerBase SelectPluginL64 +create ui_commontestclass mpxpluginhandlerbase +mpxpluginhandlerbase MpxPluginHandlerBaseSelectPluginLRFile64 mpxtest2.mp3 +delete mpxpluginhandlerbase +[Endtest] + + + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2006 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_TESTEXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +#include "../ui_commontestclass/group/bld.inf" + +// End of File \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/init/TestFramework.ini Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,201 @@ +# +# This is STIFTestFramework initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[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_ui_commontestclass + +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= 0 # Default timeout value for each test case. In milliseconds +UITestingSupport= YES +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +#[New_Module] +#ModuleName= demomodule +#[End_Module] + +[New_Module] +ModuleName= testscripter +TestCaseFile= c:\testframework\ui_commontestclass.cfg +[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIFTestFramework logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[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= D:\LOGS\TestFramework\ +#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 + +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/Bwins/commontestclassu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/Bwins/commontestclassu.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/EABI/commontestclassu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/EABI/commontestclassu.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,9 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + _ZTI14CSimpleTimeout @ 2 NONAME ; ## + _ZTV14CSimpleTimeout @ 3 NONAME ; ## + _ZTI17CEdwinTestControl @ 4 NONAME ; ## + _ZTI22CDummyMpxPluginHandler @ 5 NONAME ; ## + _ZTV17CEdwinTestControl @ 6 NONAME ; ## + _ZTV22CDummyMpxPluginHandler @ 7 NONAME ; ## + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,61 @@ +/* +* 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: ?Description +* +*/ + + + +PRJ_PLATFORMS +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these +DEFAULT + +PRJ_TESTEXPORTS +// NOTE: If using ARS requirements all export operations should be done under this. +// 'abld test export' + +PRJ_EXPORTS +// Specify the source file followed by its destination here +// copy will be used to copy the source file to its destination +// If there's no destination then the source file will be copied +// to the same name in /epoc32/include +// Example: +/* +/agnmodel/inc/AGMCOMON.H +*/ + +PRJ_TESTMMPFILES +// NOTE: If using ARS requirements .mmp file operation should be done under this. +// 'abld test build' + +ui_commontestclass.mmp + +PRJ_MMPFILES +// Specify the .mmp files required for building the important component +// releasables. +// +// Specify "tidy" if the component you need to build doesn't need to be +// released. Specify "ignore" if the MMP file exists but should be +// ignored. +// Example: +/* +/agnmodel/group/agnmodel.mmp +#if defined(MARM) +/agnmodel/group/agsvexe.mmp +#endif +*/ + + +// End of File \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/group/ui_commontestclass.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/group/ui_commontestclass.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,89 @@ +/* +* 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: API test automation for Radio Utility +* +*/ + + +#include + + +TARGET ui_commontestclass.dll +TARGETTYPE DLL +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT +UID 0x1000008D 0x10207BD6 + +DEFFILE commontestclass.def + +EPOCSTACKSIZE 0x5000 +EPOCHEAPSIZE 0x10000 0x1000000 + +SOURCEPATH ../src +SOURCE timeoutcontroller.cpp +SOURCE commontestclass.cpp +SOURCE commontestclassblocks.cpp +SOURCE testpluginmonitor.cpp +SOURCE testcenrepwatcher.cpp +SOURCE testmpxparameter.cpp +SOURCE testmpxcollectiontype.cpp +SOURCE testmpxpskeywatcher.cpp +SOURCE testmpxdrmmediautility.cpp +SOURCE testmpxmessage.cpp +SOURCE testmpxmessagequeue.cpp +SOURCE testmpxattribute.cpp +SOURCE testmpxmedia.cpp +SOURCE testmpxcollectionpath.cpp +SOURCE testmpxsession.cpp +SOURCE testmpxmessagemonitor.cpp +SOURCE testmpxactivetaskqueue.cpp +SOURCE testmpxuser.cpp +SOURCE testmpxclientlist.cpp +SOURCE testmpxpluginhandlerbase.cpp +SOURCE testviewplugin.cpp +SOURCE testmpxplugininfo.cpp +SOURCE EdwinTestControl.cpp +SOURCE testmpxsubscription.cpp + +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY euser.lib +LIBRARY estor.lib // RWriteStream +LIBRARY ecom.lib //REComSession +LIBRARY stiftestinterface.lib +LIBRARY mpxviewplugin.lib +LIBRARY mpxviewutility.lib +LIBRARY charconv.lib +LIBRARY cone.lib +LIBRARY ws32.lib +LIBRARY avkon.lib +LIBRARY eikcoctl.lib +LIBRARY eikctl.lib +LIBRARY apgrfx.lib +LIBRARY aknskins.lib +LIBRARY aknskinsrv.lib +LIBRARY aknswallpaperutils.lib +LIBRARY eikcore.lib +LIBRARY sysutil.lib +LIBRARY apmime.lib +LIBRARY CommonEngine.lib +LIBRARY mpxcommon.lib MPXCommon.lib + + + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/group/ui_commontestclass.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/group/ui_commontestclass.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,40 @@ +; +; 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: Package file for project StifTFW +; +;commontestclass.pkg + +;languages +&EN + +;Header +#{"StifTFW"},(0x10005942),1,1,0,TYPE=SA + +;Localised Vendor name +%{"MPXCommonTest"} + +;Unique Vendor name +:"Vendor" + +;Files to install + +"..\..\data\mmc\mpxtest1.mp3" - "e:\testing\data\mpxtest1.mp3" +"..\..\data\mmc\mpxtest2.mp3" - "e:\testing\data\mpxtest2.mp3" +"..\..\data\mmc\testdrm.cm" - "e:\testing\data\testdrm.cm" + +"..\..\init\TestFramework.ini" - "c:\testframework\TestFramework.ini" + +"..\..\conf\ui_commontestclass.cfg" - "c:\testframework\ui_commontestclass.cfg" + +"\epoc32\release\armv5\urel\ui_commontestclass.dll" - "c:\sys\bin\ui_commontestclass.dll" diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/inc/EdwinTestControl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/inc/EdwinTestControl.h Thu Dec 17 08:55:47 2009 +0200 @@ -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: +* +*/ +#ifndef EDWINTESTCONTROL_H_ +#define EDWINTESTCONTROL_H_ + +#include + +class CAknsBasicBackgroundControlContext; + +class CEdwinTestControl : public CCoeControl, public MCoeControlObserver + { +public: + static CEdwinTestControl* NewL(void); + virtual ~CEdwinTestControl(); +protected: + TTypeUid::Ptr MopSupplyObject(TTypeUid aId); // +private: + virtual void SizeChanged(); + virtual void HandleResourceChange(TInt aType); + virtual TInt CountComponentControls() const; + virtual CCoeControl* ComponentControl(TInt aIndex) const; + void ConstructL(void); + void Draw(const TRect& aRect) const; + + void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType); + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType ); +private: + CAknsBasicBackgroundControlContext* iBgContext; + CEikEdwin* iEditWin; +}; + + +#endif /*EDWINTESTCONTROL_H_*/ diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/inc/commontestclass.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/inc/commontestclass.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,2249 @@ +/* +* 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: CCommonTestClass header for STIF Test Framework TestScripter. +* +*/ + + + +#ifndef COMMONTESTCLASS_H +#define COMMONTESTCLASS_H + +// INCLUDES +#include +#include +#include +#include +#include "timeoutcontroller.h" +#include "debug.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// CONSTANTS +const TInt KErrBadTestParameter= -1000; // Error on configuration file +const TInt KErrEventPending =-2000; // Timeout and not callback +const TInt KErrCallbackErrorCode = -2001; // Callback return error code +const TInt KErrUnexpectedValue =-2002; // Unexpected value at setting +const TInt KErrTimeoutController = -2007; // Unexpected notification +const TInt KShortTimeout = 1000; +const TInt KMediumTimeout = 4000; +const TInt KLongTimeout = 100000; +const TInt KFailTOInstanceClass = -3000; + + + +#ifdef __WINSCW__ +_LIT( KCommonTestClassLogPath, "\\testing\\log\\" ); +#else +_LIT( KCommonTestClassLogPath, "e:\\testing\\log\\" ); +#endif + +_LIT( KCommonTestClassLogFile, "CommonTestClass.log" ); +_LIT( KCommonTestFilePath, "C:\\testing\\data\\" ); +_LIT( KMsgBadTestParameters, "[Error] No valid test case parameters"); +_LIT( KTagCompareNotEqual, "<>"); +_LIT( KTagCompareEqual, "=="); +_LIT( KTagvalue, "value"); + +// FORWARD DECLARATIONS +//class CMPXPluginMonitor; +//class CMPXCenRepWatcher; + +// CLASS DECLARATION +class CMPXMedia; +class CMPXMediaArray; +class CMPXCollectionPath; +class CMPXSubscription; +/** +* CCommonTestClass test class for STIF Test Framework TestScripter. +* +* @lib RadioUtilityTestClass.lib +* @since 5.0 +*/ +NONSHARABLE_CLASS(CCommonTestClass) : public CScriptBase, + public MTimeoutObserver, + public MMPXPluginMonitorObserver, + public MMPXCenRepObserver, + public MMPXPSKeyObserver, + public MMPXMessageObserver, + public MMPXTaskQueueObserver, + public MMPXCustomCommandObserver + + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CCommonTestClass* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CCommonTestClass(); + + public: // Functions from base classes + + enum TMPXTestExpectedEvent + { + }; + + /** + * From CScriptBase Runs a script line. + * @since 3.2 + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ); + + // From MTimeoutObserver + + /** + * @since 3.2 + * Review if all the expected events have ocurred once the time is over + */ + void HandleTimeout(TInt error); + + + + private: + + /** + * C++ default constructor. + */ + CCommonTestClass( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Delete the resources before exit + * @since S60 3.2 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + void Delete(); + + /** + * Set an event as expected and set default timeout + * @since S60 3.2 + */ + void AddExpectedEvent(TMPXTestExpectedEvent event, TInt ms); + + + /** + * Unset an event as expected + * @since S60 3.2 + */ + TBool RemoveExpectedEvent(TMPXTestExpectedEvent event); + + + /** + * @since S60 3.2 + * Removes all expected events + */ + void RemoveAllExpectedEvents(); + + /** + * Verify that the event was expected, removes it from the list + * Signal the TestScripter with the returned error code + * @since S60 3.2 + */ + void ProcessEvent(TMPXTestExpectedEvent aEvent, TInt aError); + + /** + * Maps a event with a descriptor with its name + * @since S60 3.2 + */ + TPtrC EventName( TInt aKey ); + + /** + * Sets a timeout different since the default + * @since S60 3.2 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt SetTimeout( CStifItemParser& aItem ); + + /** + * + * @since S60 3.2 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt SetExpectedEvents( CStifItemParser& aItem ); + + /** + * + * @since S60 3.2 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt SetAllowedPanic( CStifItemParser& aItem ); + + /** + * To test CMPXPluginMonitor::NewL + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CreatePluginMonitorL();/// + + /** + * To test CMPXPluginMonitor::~ + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt DeletePluginMonitorL(); + + /* + * From MMPXPluginMonitorObserver + */ + void PluginsChangedL(); + + void HandlePluginUnload(const TUid& aPluginUid);////add + /** + * To test CMPXCenRepWatcher::NewL + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CreateCenRepWatcherL(); + + /** + * To test CMPXCenRepWatcher::~ + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt DeleteCenRepWatcherL(); + + /* + * From MMPXCenRepObserver + * + */ + void HandleSettingChange(const TUid& aRepositoryUid, + TUint32 aSettingId); + + /** + * Get current value as integer. + * + * @since 5.0 + * @return Symbian OS error code. + */ + TInt CenRepCurrentValueL(CStifItemParser& aItem); + + /** + * Set integer value + * + * @since 5.0 + * @return Symbian OS error code. + */ + TInt CenRepSetValueL(CStifItemParser& aItem); + + + /** + * To test CMPXParameter::CMPXParameter() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CreateMPXParameter(); + + /** + * To test CMPXParameter::~ + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt DeleteMPXParameter(); + + + /** + * To test CMPXParameter::InternalizeL + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt InternalizeMPXParameterL(); + + + /** + * To test CMPXParameter::ExternalizeL + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt ExternalizeMPXParameterL(); + + + /** + * To test CMPXCollectionType::MPXCollectionType(...) + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + //TInt CreateMPXCollectionType(); + + + /** + * To test CMPXCollectionType::MPXCollectionType() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CreateMPXCollectionTypeWOParam(); + + + /** + * To test CMPXCollectionType::InternalizeMPXCollectionTypeL() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt InternalizeMPXCollectionTypeL(); + + + /** + * To test CMPXCollectionType::ExternalizeMPXCollectionTypeL() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt ExternalizeMPXCollectionTypeL(); + + + /** + * To test CMPXPSKeyWatcherL::NewL() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CreateCMPXPSKeyWatcherL(); + + + /** + * To test CMPXPSKeyWatcherL::~ + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt DeleteCMPXPSKeyWatcherL(); + + + /** + * To test CMPXPSKeyWatcherL::GetValue() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt GetTntValue(); + + + /** + * To test CMPXPSKeyWatcherL::GetDes8Value() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt GetDes8Value(); + + + /** + * To test CMPXPSKeyWatcherL::GetDes16Value() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt GetDes16Value(); + + + /** + * To test CMPXPSKeyWatcherL::SetValue() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt SetTntValue(); + + + /** + * To test CMPXPSKeyWatcherL::SetDes8Value() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt SetDes8Value(); + + + /** + * To test CMPXPSKeyWatcherL::SetDes16Value() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt SetDes16Value(); + + /** + * From MMPXPSKeyObserver + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + void HandlePSEvent(TUid aUid, TInt aKey); + + /** + * To test CMPXDrmMediaUtilityL::NewL() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CreateCMPXDrmMediaUtilityL(); + + /** + * To test CMPXDrmMediaUtilityL::NewLC() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CreateCMPXDrmMediaUtilityLC(); + + /** + * To test CMPXDrmMediaUtilityL::~ + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt DeleteCMPXDrmMediaUtilityL(); + + /** + * To test CMPXDrmMediaUtilityL::InitL + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt InitFileNameL(); + + /** + * To test CMPXDrmMediaUtilityL::InitL + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt InitRFileL(); + + /** + * To test CMPXDrmMediaUtilityL::Close + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + + TInt Close(); + + /** + * To test CMPXDrmMediaUtilityL::GetMediaL + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt GetMediaL(); + + /** + * To test CMPXDrmMediaUtilityL::ConsumeL + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt ConsumeL(); + + /** + * To test TMPXMessage::TMPXMessageL(...) + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt TMPXMessage3L(); + + /** + * To test TMPXMessage::TMPXMessageL(...) + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt TMPXMessage1L(); + + /** + * To test TMPXMessage::TMPXMessageL() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt TMPXMessageL(); + + /** + * To test TMPXMessage::EqualTMPXMessage() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt EqualTMPXMessage(); + + /** + * To test TMPXMessage::Event() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt Event(); + + /** + * To test TMPXMessage::Type() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt Type(); + + /** + * To test TMPXMessage::Data() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt Data(); + + /** + * To test CMPXMessageQueueL::NewL() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CreateCMPXMessageQueueL(); + + /** + * To test CMPXMessageQueueL::~ + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt DeleteCMPXMessageQueue(); + + /** + * To test CMPXMessageQueueL::Reset + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt ResetCMPXMessageQueue(); + + /** + * To test CMPXMessageQueueL::SendNext + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt SendNextCMPXMessageQueue(); + + /** + * To test CMPXMessageQueueL::Add + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt AddCMPXMessageQueue(); + + /** + * To test RMPXSession::RMPXSession() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CreateRMPXSession(); + + /** + * To test RMPXSession::~RMPXSession() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CloseAndDestructRMPXSession(); + /** + * To test RMPXSession::Version() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt VersionRMPXSession(); + + /** + * To test RMPXSession::Connect() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt ConnectRMPXSessionL(); + + /** + * To test RMPXSession::SendReceive(...) + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt SendReceiveLRMPXSessionL(); + + + /** + * To test RMPXSession::SendReceive(...) + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt SendReceiveStatusRMPXSessionL(); + + /** + * To test RMPXSession::SendReceive(...) + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt SendReceiveStatus3RMPXSessionL(); + + /** + * To test CMPXMessageMonitor::NewL() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CreateCMPXMessageMonitorL(); + + /** + * To test CMPXMessageMonitor::~ + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt DeleteCMPXMessageMonitorL(); + + /** + * To test CMPXMessageMonitor::RunLCMPXMessageMonitorL() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt RunLCMPXMessageMonitorL(); + + /** + * From MMPXMessageObserver + */ + void MessageReceived(TInt aMsgData, TInt aError); + + /** + * To test CMPXActiveTaskQueue::NewL() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CreateCMPXActiveTaskQueueL(); + + /** + * To test CMPXActiveTaskQueue::AddTaskL(...) + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt AddTaskCMPXActiveTaskQueueL(); + + /** + * To test CMPXActiveTaskQueue::CancelRequests(...) + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CancelRequestsCMPXActiveTaskQueueL(); + + /** + * To test CMPXActiveTaskQueue::CompleteTask(...) + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CompleteTaskCMPXActiveTaskQueueL(); + + /** + * To test CMPXActiveTaskQueue::CompleteAllTasks(...) + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CompleteAllTasksCMPXActiveTaskQueueL(); + + /** + * To test CMPXTaskQueue::IsEmpty() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt IsEmptyCMPXTaskQueueL(); + + /** + * To test CMPXTaskQueue::AddTask() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt AddTaskCMPXTaskQueueL(); + + /** + * To test CMPXTaskQueue::RemoveTask(observer) + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt RemoveTaskCMPXTaskQueueL(); + + /** + * To test CMPXTaskQueue::RemoveTask() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt RemoveTask2CMPXTaskQueueL(); + + /** + * To test CMPXTaskQueue::Callback() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CallbackCMPXTaskQueueL(); + + /** + * To test CMPXTaskQueue::PtrData() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt PtrDataCMPXTaskQueueL(); + + /** + * To test CMPXTaskQueue::param() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt ParamCMPXTaskQueueL(); + + /** + * To test CMPXTaskQueue::BufData() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt BufDataCMPXTaskQueueL(); + + /** + * To test CMPXTaskQueue::Task() + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt TaskCMPXTaskQueueL(); + + /* + * From MMPXTaskQueueObserver + */ + void ExecuteTask(TInt aTask, + TInt aParamData, + TAny* aPtrData, + const CBufBase& aBuf, + TAny* aCallback, + CBase* aCObject1, + CBase* aCObject2); + + /** + * To test MPXUser::CompareUids + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CompareUids(); + + /** + * To test MPXUser::IsCallOngoing + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt IsCallOngoing(); + + /** + * To test MPXUser::CompleteWithDllPath + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CompleteWithDllPath(); + + /** + * To test MPXUser::Alloc8L + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt Alloc8L(); + + /** + * To test MPXUser::AllocL + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt AllocL(); + + /** + * To test MPXUser::Ptr + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt Ptr(); + + /** + * To test MPXUser::Ptr8 + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt Ptr8(); + + /** + * To test MPXUser::CreateBufferLC + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CreateBufferLC(); + + /** + * To test MPXUser::CreateBufferL + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CreateBufferDesCL(); + + /** + * To test MPXUser::CreateBufferL + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CreateBufferDesCArrayL(); + /* + * to test IMPORT_C static void CreateBufferL(const RMessage2& aMessage, + * TInt aMsgSlot, + * CBufBase*& aBuffer); + */ + TInt CreateBufferMsgL(); + + /** + * To test MPXUser::CreateBufferL + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CreateFromBufferL(); + + /** + * To test MPXUser::ExternalizeL + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt ExternalizeL(); + + /** + * To test MPXUser::ExternalizeL + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt ExternalizeArrayL(); + + /** + * To test MPXUser::InternalizeL + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt InternalizeArrayL(); + + /** + * To test MPXUser:: + * IMPORT_C static void InternalizeL(CDesCArray*& aArray, + * RReadStream& aStream); + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt InternalizeDesCArrayL(); + + /** + * To test MPXUser::CopyArrayL + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CopyArrayL(); + + /** + * To test MPXUser::MergeArray + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt MergeArray(); + + /** + * To test MPXUser::MergeAttributeL + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt MergeAttributeL(); + + /** + * To test MPXUser::ProcessIdL + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt ProcessIdL(); + + /** + * To test MPXUser::CompareOrderedUidArrays + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CompareOrderedUidArrays(); + + + /** + * To test CMPXViewPlugin::NewL + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt CreateCMPXViewPlugin(); + + /** + * To test CMPXViewPlugin::~ + * + * @since S60 5.0 + * @return Symbian OS error code. + */ + TInt DeleteCMPXViewPlugin(); + + + /** + * From MMPXCustomCommandObserver + */ + void HandleCustomCommand( + const TUid& aUid, + const TInt aCommand, + const TDesC8& aData = KNullDesC8 ); + + /** + * To test TMPXAttribute::TMPXAttribute() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxAttDefaultConst(CStifItemParser& aItem); + + /** + * To test TMPXAttribute::TMPXAttribute(TInt aContentId, TUint aAttributeId) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxAttConst(CStifItemParser& aItem); + + /** + * To test TMPXAttribute::TMPXAttribute(const TMPXAttribute& aId) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxAttCopyConstAtt(CStifItemParser& aItem); + + /** + * To test TMPXAttribute::TMPXAttribute(const TMPXAttributeData& aData) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxAttCopyConstAttData(CStifItemParser& aItem); + + /** + * To test TMPXAttribute::operator=() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxAttOperatorAssignment(CStifItemParser& aItem); + + /** + * To test TMPXAttribute::operator==() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxAttOperatorEqual(CStifItemParser& aItem); + + /** + * To test TMPXAttribute::ExternalizeL() and + * TMPXAttribute::InternalizeL() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxAttStreamingL(CStifItemParser& aItem); + + /** + * To test TMPXAttribute::ContentId() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxAttContentId(CStifItemParser& aItem); + + /** + * To test TMPXAttribute::AttributeId() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxAttAttributeId(CStifItemParser& aItem); + + /** + * To test TMPXAttribute::Match() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxAttMatch(CStifItemParser& aItem); + + /** + * To test TMPXAttribute::MatchContentId() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxAttMatchContentId(CStifItemParser& aItem); + + /** + * To test TMPXAttributeData::operator& (const TMPXAttributeData& aData) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxAttOperatorAndAttData(CStifItemParser& aItem); + + /** + * To test TMPXAttributeData::operator& (TUint& aData) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxAttOperatorAndData(CStifItemParser& aItem); + + /** + * To test TMPXAttributeData::operator| () + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxAttOperatorOr(CStifItemParser& aItem); + + /** + * To test CMPXMedia::NewL() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaNewL(CStifItemParser& aItem); + + /** + * To test CMPXMedia::NewL(aSupportedIds) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaNewLSupportedIdsL(CStifItemParser& aItem); + + /** + * To test CMPXMedia::NewL(aMedia) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaNewLMediaL(CStifItemParser& aItem); + + /** + * To test CMPXMedia::NewL(aDataHandle) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaNewLDataHandleL(CStifItemParser& aItem); + + /** + * To test CMPXMedia::NewL(aStream) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaNewLStreamL(CStifItemParser& aItem); + + /** + * To test CMPXMedia::operator=() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaOperatorAssignment(CStifItemParser& aItem); + + /** + * To test CMPXMedia::SupportedIds() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaSupportedIds(CStifItemParser& aItem); + + /** + * To test CMPXMedia::Attributes() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaAttributes(CStifItemParser& aItem); + + /** + * To test CMPXMedia::SetTObjectValueL() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaSetTObjectValueL(CStifItemParser& aItem); + + /** + * To test CMPXMedia::SetCObjectValueL() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaSetCObjectValueL(CStifItemParser& aItem); + + /** + * To test CMPXMedia::SetNoNewLCObjectL() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaSetNoNewLCObjectL(CStifItemParser& aItem); + + /** + * To test CMPXMedia::SetTextValueL() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaSetTextValueL(CStifItemParser& aItem); + + /** + * To test CMPXMedia::IsSupported() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaIsSupported(CStifItemParser& aItem); + + /** + * To test CMPXMedia::Count() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaCount(CStifItemParser& aItem); + + /** + * To test CMPXMedia::Attribute() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaAttribute(CStifItemParser& aItem); + + /** + * To test CMPXMedia::AttributesSet() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaAttributesSet(CStifItemParser& aItem); + + /** + * To test CMPXMedia::Index() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaIndex(CStifItemParser& aItem); + + /** + * To test CMPXMedia::Type(aIndex) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaTypeIndex(CStifItemParser& aItem); + + /** + * To test CMPXMedia::Type(aAttribute) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaTypeAttribute(CStifItemParser& aItem); + + /** + * To test CMPXMedia::Reset() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaReset(CStifItemParser& aItem); + + /** + * To test CMPXMedia::Delete(attribute) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaDeleteAttribute(CStifItemParser& aItem); + + /** + * To test CMPXMedia::Delete(index) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaDeleteIndex(CStifItemParser& aItem); + + /** + * To test CMPXMedia::ValueText() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaValueText(CStifItemParser& aItem); + + /** + * To test CMPXMedia::Value() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaValue(CStifItemParser& aItem); + + /** + * To test CMPXMedia::ValueTObjectL() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaValueTObjectL(CStifItemParser& aItem); + + /** + * To test CMPXMedia::ValueCObjectL() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaValueCObjectL(CStifItemParser& aItem); + + /** + * To test CMPXMedia::ValueNoNewLCObjectL() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaValueNoNewLCObjectL(CStifItemParser& aItem); + + /** + * To test CMPXMedia::ExternalizeL() and + * CMPXMedia::InternalizeL() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaStreamingL(CStifItemParser& aItem); + + /** + * To test CMPXMediaArray::NewL() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaArrayNewL(CStifItemParser& aItem); + + /** + * To test CMPXMediaArray::NewL(MediaArray) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaArrayNewLMediaArrayL(CStifItemParser& aItem); + + /** + * To test CMPXMediaArray::Count() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaArrayCount(CStifItemParser& aItem); + + /** + * To test CMPXMediaArray::IMPORT_C CMPXMedia* AtL(TInt aIndex) const; + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaArrayAtLByIndexL(CStifItemParser& aItem); + + + /** + * To test CMPXMediaArray::AppendL(Media*) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaArrayAppendLByPtrL(CStifItemParser& aItem); + + /** + * To test CMPXMediaArray::AppendL(Media&) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaArrayAppendLByRefL(CStifItemParser& aItem); + + /** + * To test CMPXMediaArray::Reset() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaArrayReset(CStifItemParser& aItem); + + /** + * To test CMPXMediaArray::Remove() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaArrayRemove(CStifItemParser& aItem); + + /** + * To test CMPXMediaArray::Insert(Media*) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaArrayInsertByPtr(CStifItemParser& aItem); + + /** + * To test CMPXMediaArray::Insert(Media&) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaArrayInsertByRef(CStifItemParser& aItem); + + /** + * To test CMPXMediaArray::InsertL(Media*) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaArrayInsertLByPtrL(CStifItemParser& aItem); + + /** + * To test CMPXMediaArray::InsertL(Media&) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaArrayInsertLByRefL(CStifItemParser& aItem); + + /** + * To test CMPXMediaArray::Set() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaArraySet(CStifItemParser& aItem); + + /** + * To test CMPXMediaArray::ExternalizeL() and + * CMPXMediaArray::InternalizeL() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxMediaArrayStreamingL(CStifItemParser& aItem); + + /** + * To test TMPXItemId::TMPXItemId() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxItemIdConst(CStifItemParser& aItem); + + /** + * + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxItemIdReset(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::NewL() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathNewL(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::NewL(aPath) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathNewLPathL(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::NewL(aStream) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathNewLStreamL(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::AppendL(aId) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathAppendLIdL(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::AppendL(aIds) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathAppendLIdsL(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::Levels() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathLevels(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::Back() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathBack(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::Reset() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathReset(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::Index() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathIndex(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::Operator++() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathOperatorPlus(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::Operator--() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathOperatorMinus(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::SetToFirst() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathSetToFirst(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::SetToLast() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathSetToLast(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::Set(aIndex) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathSetIndex(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::Set(aId) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathSetId(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::Set(aMode) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathSetMode(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::SetL(aAttrs) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathSetLAttrsL(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::OpenNextMode() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathOpenNextMode(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::OpenPreviousMode() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathOpenPreviousMode(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::SelectL(aId) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathSelectLIdL(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::SelectL(aIndex) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathSelectLIndexL(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::SelectAllL() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathSelectAllL(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::Deselect(aId) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathDeselectId(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::Deselect(aIndex) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathDeselectIndex(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::DeselectAll() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathDeselectAll(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::Remove(aId) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathRemoveId(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::Remove(aIndex) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathRemoveIndex(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::IsSelected(aId) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathIsSelectedId(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::IsSelected(aIndex) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathIsSelectedIndex(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::ClearSelection + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathClearSelection(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::Selection + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathSelection(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::SelectionL + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathSelectionL(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::Id + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathId(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::Count + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathCount(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::IndexOfId + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathIndexOfId(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::IdOfIndex + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathIdOfIndex(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::OpenAttributes + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathOpenAttributes(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::IndexLevel + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathIndexLevel(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::IdLevel + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathIdLevel(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::ExternalizeL() and + * CMPXCollectionPath::InternalizeL() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathStreamingL(CStifItemParser& aItem); + + /** + * To test CMPXCollectionPath::HandleChange() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxCollPathHandleChange(CStifItemParser& aItem); + + /** + * To test CMPXClientList::NewL() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxClientListNewL(CStifItemParser& aItem); + + /** + * To test CMPXClientList::ClientCount() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxClientListClientCount(CStifItemParser& aItem); + + /** + * To test CMPXClientList::IsClient() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxClientListIsClient(CStifItemParser& aItem); + + /** + * To test CMPXClientList::Find(aMsgQueue) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxClientListFindByMsg(CStifItemParser& aItem); + + /** + * To test CMPXClientList::Find(aId) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxClientListFindById(CStifItemParser& aItem); + + /** + * To test CMPXPluginHandlerBase::SelectPluginL(aPluginUid) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxPluginHandlerBaseSelectPluginLIdL(CStifItemParser& aItem); + + /** + * To test CMPXPluginHandlerBase::SelectPluginL(aPluginName) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxPluginHandlerBaseSelectPluginLNameL(CStifItemParser& aItem); + + /** + * To test CMPXPluginHandlerBase::SelectPluginL(aUri, aDataType) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxPluginHandlerBaseSelectPluginLUriL(CStifItemParser& aItem); + + /** + * To test CMPXPluginHandlerBase::SelectPluginL(aPluginType) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxPluginHandlerBaseSelectPluginLTypeL(CStifItemParser& aItem); + + /** + * To test CMPXPluginHandlerBase::ClearSelectionCriteria() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxPluginHandlerBaseClearSelectionCriteria(CStifItemParser& aItem); + + /** + * To test CMPXPluginHandlerBase::PluginName(aType) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxPluginHandlerBasePluginNameType(CStifItemParser& aItem); + + /** + * To test CMPXPluginHandlerBase::PluginNamesL() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxPluginHandlerBasePluginNamesL(CStifItemParser& aItem); + + /** + * To test CMPXPluginHandlerBase::SupportedMimeTypesL() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxPluginHandlerBaseSupportedMimeTypesL(CStifItemParser& aItem); + + /** + * To test CMPXPluginHandlerBase::SupportedExtensionsL() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxPluginHandlerBaseSupportedExtensionsL(CStifItemParser& aItem); + + /** + * To test CMPXPluginHandlerBase::SupportedSchemasL() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxPluginHandlerBaseSupportedSchemasL(CStifItemParser& aItem); + + /** + * To test CMPXPluginHandlerBase::SupportedMimeTypesL(aUid) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxPluginHandlerBaseSupportedMimeTypesLUidL(CStifItemParser& aItem); + + /** + * To test CMPXPluginHandlerBase::SupportedExtensionsL(aUid) + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxPluginHandlerBaseSupportedExtensionsLUidL(CStifItemParser& aItem); + + /** + * To test CMPXPluginHandlerBase::GetPluginTypes() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxPluginHandlerBaseGetPluginTypes(CStifItemParser& aItem); + + /** + * To test CMPXPluginHandlerBase::GetPluginUids() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxPluginHandlerBaseGetPluginUids(CStifItemParser& aItem); + + /** + * To test CMPXPluginHandlerBase::GetPluginUidsL() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxPluginHandlerBaseGetPluginUidsL(CStifItemParser& aItem); + + /** + * To test CMPXPluginHandlerBase::PluginUid() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxPluginHandlerBasePluginUid(CStifItemParser& aItem); + + /** + * To test CMPXPluginHandlerBase::IndexOf() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxPluginHandlerBaseIndexOf(CStifItemParser& aItem); + + /** + * To test CMPXPluginHandlerBase::CreatePluginListL() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxPluginHandlerBaseCreatePluginListL(CStifItemParser& aItem); + + /** + * To test CMPXPluginHandlerBase::FindPlugin() + * + * @since S60 5.0 + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt MpxPluginHandlerBaseFindPlugin(CStifItemParser& aItem); + //add function to testmpxuser.h + TInt RecreateBufferL(); + TInt CompleteWithDllPathOL(); + TInt FindWindowGroupIdL(); + TInt Alloc8ZL(); + //TInt CreateBufferRMessage(); + TInt CreateMPXCollectionType(); + //add function to testmpxmessagemonitor.cpp + TInt GetNextMessageCMPXMessageMonitorL(); + TInt DoCancelCMPXMessageMonitorL(); + TInt RunErrorCMPXMessageMonitorL(); + //add function to testmpxclientlist.cpp + TInt MpxClientListDestruction(CStifItemParser&); + TInt MpxClientListAddClientL(); + TInt MpxClientListAddClientLUsingMode(); + TInt MpxClientListRemoveClient(); + TInt MpxClientListClientProcessList(); + TInt DeleteMpxClientList(); + TInt SendMsgLByMsgCMPXClientList(CStifItemParser& aItem); + TInt MPXClientListConvertMsgLC(CStifItemParser& ); + TInt SendMsgLIndexAndTMPMsgCMPXClientList(CStifItemParser& aItem); + TInt MpxClientListSendMsg(CStifItemParser& aItem); + TInt MpxClientListSendMsgaIndex(CStifItemParser& aItem); + TInt MpxClientListAddSubscriptionL(CStifItemParser& aItem); + TInt MpxClientListRemoveSubscriptionL(CStifItemParser& aItem); + TInt MpxClientListRemoveAllSubscriptionsL(CStifItemParser& aItem); + + //add function to testmpxcollectionpath.cpp + TInt MpxCollectionpathContainerPathL(CStifItemParser& /*aItem*/); + TInt MpxCollectionpathInsertL(CStifItemParser& aItem ); + TInt MpxCollectionpathItems(CStifItemParser& /*aItem*/); + TInt MpxCollectionpathUpdate(CStifItemParser& aItem); + TInt MpxCollectionpathDelete(CStifItemParser& /*aItem*/); + TInt MpxCollectionpathCollPathSetAttrsL(CStifItemParser& /*aItem*/); + + TInt MpxClientListClientMode(CStifItemParser& /*aItem*/); + //add function to testmpxcollectiontype.cpp + TInt TUidMPXCollectionType(); + TInt SendReceiveLTIpcArgsRMPXSessionL(); + TInt CMPXCollectionTypeDelete(CStifItemParser& aItem); + //add function to testmpxpluginhandlerbase.cpp + TInt MpxPluginHandlerBaseSupportUids(CStifItemParser& /*aItem*/); + //add function to testmpxpluginhandlerbase.cpp + TInt MpxMediaCopyL(CStifItemParser& aItem); + TInt MpxMediaDeleteL(CStifItemParser& aItem); + TInt MpxMediaHeapMemoryInfoL(CStifItemParser& aItem); + TInt MpxMediaMergeMediaL(CStifItemParser& aItem); + TInt MpxMediaMatchL(CStifItemParser& aItem); + TInt MpxMediaSetErrorL(CStifItemParser& aItem); + TInt MpxMediaErrorL(CStifItemParser& aItem); + TInt MpxMediaExternalizeL(CStifItemParser& aItem); + TInt MpxMediaInternalizeL(CStifItemParser& aItem); + //add these functions to testmpxpluginhandlerbase.cpp + TInt MpxPluginHandlerBaseDestruction(CStifItemParser& aItem); + TInt MpxPluginHandlerBaseSelectPluginLRFile(CStifItemParser& aItem); + TInt MpxPluginHandlerBasePluginNameByUid(CStifItemParser& /*aItem*/); + TInt MpxPluginHandlerBasePluginFlagsL(CStifItemParser& aItem); + TInt MpxPluginHandlerBasePluginType(CStifItemParser& /*aItem*/); + TInt MpxPluginHandlerBaseGetSelectionCriteria(CStifItemParser& aItem); + TInt MpxPluginHandlerBaseUsePluginTUid(CStifItemParser& aItem); + TInt MpxPluginHandlerBaseReleasePluginTUid(CStifItemParser& aItem); + TInt MpxPluginHandlerBaseCreate(); + TInt MpxPluginHandlerBaseSelectPluginLRFile64(CStifItemParser& aItem); + //added tested functions for protected export functions of CMPXPluginHandlerBase + /** + * to test IMPORT_C void PluginsChangedL(); + **/ + TInt MpxPluginHBBasePluginsChangedL(CStifItemParser& aItem); + TInt MpxPluginHBBaseIsPluginLoaded(CStifItemParser& aItem); + TInt MpxPluginHBBaseLoadPluginL(CStifItemParser& aItem); + TInt MpxPluginHBBaseHandlePluginUnload(CStifItemParser& aItem); + + + + TInt CreateCMPXTaskQueue(); + TInt DeleteCMPXTaskQueue(); + TInt ScheduleNextTaskCMPXTaskQueue(); + TInt ResetCMPXTaskQueue(); + TInt DeleteCMPXActiveTaskQueue(); + + + + + + + + + + + + //add these functions to mpxplugininfo.h + TInt CMPXPluginInfoDestructor(); + TInt CMPXPluginInfoImplementationUid(CStifItemParser& aItem); + TInt CMPXPluginInfoFlags(CStifItemParser&); + //added test functions to test protected export functions + TInt CMPXPluginInfoProcessTaggedDataExL(CStifItemParser& aItem); + TInt CMPXPluginInfoExtractIntoArrayL(CStifItemParser& aItem); + + + //add test functions for CMPXSubscription of mpxsubscription.h + TInt CMPXSubscriptionNewL(CStifItemParser& aItem); + TInt CMPXSubscriptionNewLWithMediaArrayL(CStifItemParser& aItem); + TInt CMPXSubscriptionAddItemL(CStifItemParser& aItem); + TInt CMPXSubscriptionItemsL(CStifItemParser& aItem); + TInt CMPXSubscriptionIsEqualOperator(CStifItemParser& aItem); + + TInt ReconnectRMPXSessionL(); + private: + // reference to TestModuleIf + CTestModuleIf& iTestModuleIf; + // Active object with a timer to timeout the test case + CSimpleTimeout * iTimeoutController; + // Indicates if the test case use a normal exit reason + TBool iNormalExitReason; + // List of expected events + RArray iExpectedEvents; + // List of notification event (by the callback) + RArray iOcurredEvents; + + + CMPXPluginMonitor* iPluginMonitor; + CMPXCenRepWatcher* iCenRepWatcher; + CMPXParameter* iParameter; + CMPXCollectionType* iType; + CMPXPSKeyWatcher* iPSWatcher; + CMPXDrmMediaUtility* iDrmMediaUtility; + CMPXMessageQueue* iMessageQueue; + RArray iMPXAttArray; + RArray iMPXItemIdArray; + CMPXMediaArray* iMPXMediaArray; + CMPXCollectionPath* iMPXCollectionPath; + TUid iCollectionPathUid; + CMPXClientList* iClientList; + CMPXMessageMonitor* iMsgMonitor; + RMPXSession iMessageSession; + CMPXViewPlugin* iViewPlugin; + CMPXPluginInfo* iPluginInfo; + CMPXSubscription* iSubscription; + + +}; + +#endif // COMMONTESTCLASS_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/inc/debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/inc/debug.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2005 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: Central place for nice debug-type macros & functions +* +*/ + + +#ifndef DEBUG_H +#define DEBUG_H + +//INCLUDES +#include +#define FTRACE(a) {a;} + +/** +* Declare the FPrint function +* @since Series 60 2.7 +* @return none +*/ +inline void FPrint(const TRefByValue aFmt, ...) +{ + VA_LIST list; + VA_START(list,aFmt); + TInt tmpInt = VA_ARG(list, TInt); + TInt tmpInt2 = VA_ARG(list, TInt); + TInt tmpInt3 = VA_ARG(list, TInt); + VA_END(list); + #ifdef _DEBUG + RDebug::Print(aFmt, tmpInt, tmpInt2, tmpInt3); + #endif +} +#endif // DEBUG_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/inc/mpxsubscriptiondefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/inc/mpxsubscriptiondefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2007 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: Definitions for subscription attributes +* +*/ + + + +#ifndef MPXSUBSCRIPTIONDEFS_H +#define MPXSUBSCRIPTIONDEFS_H + +#include + +/** +* Content ID identifying general category of content provided +* in the message object and associated attributes. This should +* be supported by ALL message objects as a common base +*/ + +const TInt KMPXSubscriptionGeneral = 0x1028294A; + +/** +* TMPXMessageId, *unique* id of the message +*/ +const TMPXAttributeData KMPXSubscriptionItems = {KMPXSubscriptionGeneral, 0x01}; + +#endif // MPXSUBSCRIPTIONDEFS_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/inc/timeoutcontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/inc/timeoutcontroller.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2006 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: Simple player for preemption purposes +* +*/ + + +#include +#include +#include +#include + + +/* This class is used to notify the observer +* about the timeout +*/ +class MTimeoutObserver +{ + public: // New functions + + /** + * Timeout + */ + virtual void HandleTimeout(TInt error) = 0; +}; + + +_LIT(KFormatTimeStamp, "%:0%J%:1%T%:2%S%.%*C4%:3%+B"); + + +/* This class is used for extra time controlling +* The STIF timeout isn't enough +*/ +class CSimpleTimeout : public CActive +{ + public: // Enumerations + // None + + private: // Enumerations + // None + + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CSimpleTimeout* NewL( MTimeoutObserver* aObserver, CStifLogger* aLogger); + + /** + * Destructor. + */ + ~CSimpleTimeout(); + + public: // New functions + + /** + * Starts timeout counting + */ + void Start(TTimeIntervalMicroSeconds aTimeout); + + /** + * Cancel timeout counting + */ + void Stop(); + + + public: // Functions from base classes + + /** + * RunL derived from CActive handles the completed requests. + */ + void RunL(); + + /** + * DoCancel derived from CActive handles the cancel + */ + void DoCancel(); + + /** + * RunError derived from CActive handles errors from active handler. + */ + TInt RunError( TInt aError ); + + protected: // New functions + // None + + protected: // Functions from base classes + // None + + private: + + /** + * By default Symbian OS constructor is private. + */ + void ConstructL(MTimeoutObserver* aObserver, CStifLogger* aLogger); + + /** + * C++ constructor. + */ + CSimpleTimeout(); + + public: // Data + // None + + protected: // Data + // None + + private: // Data + MTimeoutObserver* iObserver; + RTimer iTimer; + + // Storage for testcase timeout. + TTime iTestCaseTimeout; + CStifLogger* iLog; + + public: // Friend classes + // None + + protected: // Friend classes + // None + + private: // Friend classes + // None + +}; diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/EdwinTestControl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/EdwinTestControl.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,145 @@ +/* +* 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 "EdwinTestControl.h" +#include +#include +#include +#include +#include + + +CEdwinTestControl::~CEdwinTestControl() + { + delete iEditWin; + iEditWin = NULL; + delete iBgContext; + iBgContext = NULL; + } + +CEdwinTestControl* CEdwinTestControl::NewL(void) + { + CEdwinTestControl* self = new(ELeave)CEdwinTestControl(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +void CEdwinTestControl::ConstructL() + { + CreateWindowL(); + + iEditWin = new (ELeave) CEikEdwin(); + iEditWin->ConstructL( 0, 100, 100, 1 ); + iEditWin->SetContainerWindowL( *this ); + iEditWin->CreateTextViewL(); +// iEditWin->SetInputCapabilitiesL( TCoeInputCapabilities::EAllText ); + + // make first with no size at all + iBgContext = CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgScreen,TRect(0,0,1,1), ETrue ); + // Setting rect will cause SizeChanged to be called + // and iBgContext size & position is updated accordingly. + SetRect( CEikonEnv::Static()->EikAppUi()->ClientRect() ); + + ActivateL(); + DrawNow(); + } + +void CEdwinTestControl::SizeChanged() + { + if ( iBgContext ) + { + iBgContext->SetRect(Rect()); + + if ( &Window() ) + { + iBgContext->SetParentPos( PositionRelativeToScreen() ); + } + } + if ( iEditWin ) + { + iEditWin->SetRect(Rect()); + } + } + + +void CEdwinTestControl::HandleResourceChange( TInt aType ) + { + TRect rect; + + if ( aType == KEikDynamicLayoutVariantSwitch ) + { + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect); + SetRect(rect); + } + + CCoeControl::HandleResourceChange(aType); + } + + +TTypeUid::Ptr CEdwinTestControl::MopSupplyObject(TTypeUid aId) + { + if ( iBgContext ) + { + return MAknsControlContext::SupplyMopObject( aId, iBgContext ); + } + + return CCoeControl::MopSupplyObject( aId ); + } + + +void CEdwinTestControl::Draw(const TRect& aRect) const + { + CWindowGc& gc = SystemGc(); + + // draw background skin first. + MAknsSkinInstance* skin = AknsUtils::SkinInstance(); + AknsDrawUtils::Background( skin, iBgContext, this, gc, aRect ); + } + +TInt CEdwinTestControl::CountComponentControls() const +{ + return 1; +} + +CCoeControl* CEdwinTestControl::ComponentControl(TInt aIndex) const +{ + switch (aIndex) + { + case 0: + return iEditWin; + default: + return 0; + } +} + +void CEdwinTestControl::HandleControlEventL( CCoeControl* /*aControl*/, TCoeEvent /*aEventType*/) + { + // TODO: Add your control event handler code here + } + +TKeyResponse CEdwinTestControl::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) + { + if ( iEditWin ) + { + return iEditWin->OfferKeyEventL( aKeyEvent, aType ); + } + else + { + return EKeyWasNotConsumed; + } + } diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/commontestclass.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/commontestclass.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,331 @@ +/* +* 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: CCommonTestClass implementation for STIF Test Framework TestScripter. +* +*/ + + + +// INCLUDE FILES +#include +#include "commontestclass.h" + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CCommonTestClass::CCommonTestClass +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CCommonTestClass::CCommonTestClass( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ), + iTestModuleIf(aTestModuleIf) + { + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CCommonTestClass::ConstructL() + { + iLog = CStifLogger::NewL( KCommonTestClassLogPath, + KCommonTestClassLogFile, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + iTimeoutController = CSimpleTimeout::NewL (this, iLog); + // Print title of the test case + TName title; + TestModuleIf().GetTestCaseTitleL(title); + iLog->Log(_L("[Title] %S"), &title); + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CCommonTestClass* CCommonTestClass::NewL(CTestModuleIf& aTestModuleIf ) + { + CCommonTestClass* self = new (ELeave) CCommonTestClass( aTestModuleIf ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// Destructor +CCommonTestClass::~CCommonTestClass() + { + Delete(); + // Delete logger + delete iLog; + delete iTimeoutController; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::EventName +// Return descriptor with the notification description +// ----------------------------------------------------------------------------- +TPtrC CCommonTestClass::EventName( TInt aKey ) + { + TText* const badKeyword = (TText*)L"BadKeyword"; + TText* const keywords[] = + { + (TText*)L"ERequestComplete" + }; + + if( (TUint)aKey >= (sizeof( keywords )/sizeof(TText*)) ) + { + iLog->Log(_L("Keyword out of bounds")); + TPtrC keyword( badKeyword ); + return keyword; + } + else + { + TPtrC keyword( keywords[aKey] ); + return keyword; + } + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::AddExpectedEvent +// Add an event to the expected events' list +// ----------------------------------------------------------------------------- +void CCommonTestClass::AddExpectedEvent(TMPXTestExpectedEvent event, TInt ms) + { + FTRACE(FPrint(_L("CCommonTestClass::AddExpectedEvent"))); + iExpectedEvents.Append(event); + TPtrC eventName = EventName(event); + iLog->Log(_L("Adding expected event:(0x%02x)%S Total=%d"), event, &eventName, iExpectedEvents.Count() ); + + if ( iTimeoutController && !iTimeoutController->IsActive() ) + { + if (ms > 0) + { + iTimeoutController->Start( TTimeIntervalMicroSeconds(ms * 1000) ); + } + else + { + iLog->Log(_L("Timeout with default value (1s)")); + iTimeoutController->Start( TTimeIntervalMicroSeconds(1000000) ); + } + } + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::RemoveExpectedEvent +// Remove the indicated event from the expected events' list +// Returns: ETrue: Event found. +// EFalse: Event not found. +// ----------------------------------------------------------------------------- +TBool CCommonTestClass::RemoveExpectedEvent(TMPXTestExpectedEvent aEvent) + { + FTRACE(FPrint(_L("CCommonTestClass::RemoveExpectedEvent"))); + TBool match = EFalse; + for (TUint i=0; i < iExpectedEvents.Count() ; i++) + { + if (iExpectedEvents[i] == aEvent) + { + iExpectedEvents.Remove(i); + match = ETrue; + break; + } + } + return match; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::RemoveAllExpectedEvents +// Remove the indicated event from the expected events' list +// ----------------------------------------------------------------------------- +void CCommonTestClass::RemoveAllExpectedEvents() + { + FTRACE(FPrint(_L("CCommonTestClass::RemoveAllExpectedEvents"))); + iLog->Log(_L("Removing all expected events")); + + iExpectedEvents.Reset(); + iOcurredEvents.Reset(); + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::ProcessEvent +// Process events. +// ----------------------------------------------------------------------------- +void CCommonTestClass::ProcessEvent(TMPXTestExpectedEvent aEvent, TInt aError) + { + FTRACE(FPrint(_L("CCommonTestClass::ProcessExpectedEvent"))); + TPtrC nameEvent = EventName(aEvent); + + // Check for error + if (aError == KErrNone) + { + // Remove the event + if (RemoveExpectedEvent(aEvent)) + { + iLog->Log(_L("Expected Event: (0x%02x)%S has ocurred Total=%d"), + aEvent, &nameEvent,iExpectedEvents.Count()); + } + else + { + iLog->Log(_L("Event: (0x%02x)%S has ocurred"), aEvent, &nameEvent); + return; + } + + // All expected events have ocurred + if (iExpectedEvents.Count() == 0 ) + { + Signal(); + iTimeoutController->Cancel(); + } + } + else + { + iLog->Log(_L("[Error] Event: (0x%02x)%S return with error code=%d"), aEvent, &nameEvent, aError); + if (iExpectedEvents.Count() != 0 ) + { + RemoveExpectedEvent(aEvent); + } + iTimeoutController->Cancel(); + Signal(KErrCallbackErrorCode); + } + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::HandleTimeout +// Review if all the expected events have ocurred once the time is over +// ----------------------------------------------------------------------------- +void CCommonTestClass::HandleTimeout(TInt aError) + { + FTRACE(FPrint(_L("CCommonTestClass::HandleTimeout"))); + // All expected events have ocurred + if (aError != KErrNone) + { + if (iExpectedEvents.Count() == 0 ) + { + iLog->Log(_L("Timing out but events have ocurred")); + Signal(); + } + else + { + RemoveAllExpectedEvents(); + iLog->Log(_L("Timing out and events still pending")); + Signal(KErrEventPending); + } + } + else + { + iLog->Log(_L("Timing out return a error %d"), aError); + Signal(aError); + } + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::SetTimeout +// Create a timer and set a timeout +// When the timeout is reached the test case is marked as failed +// It's used rather than the "timeout" keyword in the configuration file +// because in this way the log continues +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::SetTimeout( CStifItemParser& aItem ) + { + FTRACE(FPrint(_L("CCommonTestClass::SetTimeout"))); + TInt timeout=0; + TInt error = aItem.GetNextInt(timeout) ; + if ( iTimeoutController ) + { + if ( timeout > 0 ) + { + iTimeoutController->Start( TTimeIntervalMicroSeconds(timeout*1000) ); + } + else + { + iTimeoutController->Start( TTimeIntervalMicroSeconds(1000000) ); + } + } + else + { + iLog->Log(_L("Timeout Controller doesn't exist")); + error = KErrTimeoutController; + } + return error; + } + + +// ----------------------------------------------------------------------------- +// Uses the TestModuleBase API to allow a panic as exit reason for a test case +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::SetAllowedPanic( CStifItemParser& aItem ) + { + FTRACE(FPrint(_L("CCommonTestClass::SetAllowedPanic"))); + TInt error = KErrNone; + TInt panicCode; + TPtrC panicType; + if ( ( KErrNone == aItem.GetNextString(panicType) ) + && ( KErrNone == aItem.GetNextInt(panicCode) ) ) + { + iLog->Log(_L("Allowing panic: %S %d"), &panicType, panicCode); + iTestModuleIf.SetExitReason( CTestModuleIf::EPanic, panicCode ); + iNormalExitReason = EFalse; + } + else + { + iLog->Log(KMsgBadTestParameters); + error = KErrBadTestParameter; + } + return error; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::SetExpectedEvents() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::SetExpectedEvents( CStifItemParser& aItem ) + { + FTRACE(FPrint(_L("CCommonTestClass::SetExpectedEvents"))); + TInt error = KErrNone; + TInt event=0; + while ( KErrNone == aItem.GetNextInt(event)) + { + AddExpectedEvent(static_cast(event), 0); // Default timeout value + } + return error; + } + + + + + +// ========================== 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* ) CCommonTestClass::NewL( aTestModuleIf ); + } + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/commontestclassblocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/commontestclassblocks.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,476 @@ +/* +* 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: CCommonTestClass block implemetation for STIF Test Framework TestScripter. +* +*/ + + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include "commontestclass.h" +#include "mpxpluginhandlerbase.h"//add + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CCommonTestClass::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CCommonTestClass::Delete() + { + FTRACE(FPrint(_L("CCommonTestClass::Delete"))); + + iExpectedEvents.Close(); + iOcurredEvents.Close(); + + // mpxpluginmonitor + if ( iPluginMonitor != NULL) + { + delete iPluginMonitor; + } + // mpxcentrpwatcher + if ( iCenRepWatcher != NULL) + { + delete iCenRepWatcher; + } + + // mpxparameter + if ( iParameter != NULL) + { + delete iParameter; + } + + // mpxcollectiontype + if ( iType != NULL) + { + delete iType; + } + + // CMPXPSKeyWatcher + if ( iPSWatcher != NULL) + { + delete iPSWatcher; + } + + // MPXDrmMediaUtility + if ( iDrmMediaUtility != NULL) + { + delete iDrmMediaUtility; + } + + // CMPXMessageQueue + if ( iMessageQueue != NULL) + { + delete iMessageQueue; + } + + // MPX Attribute array + iMPXAttArray.Close(); + // MPXItemId array + iMPXItemIdArray.Close(); + + // MPXMediaArray + if ( iMPXMediaArray ) + { + iMPXMediaArray->Reset(); + delete iMPXMediaArray; + } + // MPXCollectionPath + if ( iMPXCollectionPath ) + { + iMPXCollectionPath->Reset(); + delete iMPXCollectionPath; + } + + // MPXClientList + if ( iClientList ) + { + delete iClientList; + } + + // CMPXMessageMonitor + if ( iMsgMonitor ) + { + delete iMsgMonitor; + iMessageSession.Close(); + } + + // CMPXViewPlugin + if ( iViewPlugin ) + { + delete iViewPlugin; + REComSession::FinalClose(); + } + + iLog->Log(_L("Deleting test class...")); + iLog->Log(_L("")); + iLog->Log(_L("")); + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CCommonTestClass::RunMethodL( CStifItemParser& aItem ) + { + 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( "CreatePluginMonitorL", CCommonTestClass::CreatePluginMonitorL ), + ENTRY( "DeletePluginMonitorL", CCommonTestClass::DeletePluginMonitorL ), + // test cases for the header "testcenrepwatcher.h" + ENTRY( "CreateCenRepWatcherL", CCommonTestClass::CreateCenRepWatcherL ), + ENTRY( "DeleteCenRepWatcherL", CCommonTestClass::DeleteCenRepWatcherL ), + ENTRY( "CenRepCurrentValueL", CCommonTestClass::CenRepCurrentValueL ), + ENTRY( "CenRepSetValueL", CCommonTestClass::CenRepSetValueL ), + // test cases for the header "testmpxparameter.h" + ENTRY( "CreateMPXParameter", CCommonTestClass::CreateMPXParameter ), + ENTRY( "DeleteMPXParameter", CCommonTestClass::DeleteMPXParameter ), + ENTRY( "InternalizeMPXParameterL", CCommonTestClass::InternalizeMPXParameterL ), + ENTRY( "ExternalizeMPXParameterL", CCommonTestClass::ExternalizeMPXParameterL ), + // test cases for the header "testmpxcollectiontype.h" + ENTRY( "CreateMPXCollectionTypeWOParam", CCommonTestClass::CreateMPXCollectionTypeWOParam ), + ENTRY( "CreateMPXCollectionType", CCommonTestClass::CreateMPXCollectionType ), + ENTRY( "InternalizeMPXCollectionTypeL", CCommonTestClass::InternalizeMPXCollectionTypeL ), + ENTRY( "ExternalizeMPXCollectionTypeL", CCommonTestClass::ExternalizeMPXCollectionTypeL ), + // test cases for the header "testmpxpskeywatcher.h" + ENTRY( "CreateCMPXPSKeyWatcherL", CCommonTestClass::CreateCMPXPSKeyWatcherL ), + ENTRY( "DeleteCMPXPSKeyWatcherL", CCommonTestClass::DeleteCMPXPSKeyWatcherL ), + ENTRY( "GetTntValue", CCommonTestClass::GetTntValue ), + ENTRY( "GetDes8Value", CCommonTestClass::GetDes8Value ), + ENTRY( "GetDes16Value", CCommonTestClass::GetDes16Value ), + ENTRY( "SetTntValue", CCommonTestClass::SetTntValue ), + ENTRY( "SetDes8Value", CCommonTestClass::SetDes8Value ), + ENTRY( "SetDes16Value", CCommonTestClass::SetDes16Value ), + // test cases for the header "testmpxdrmmediautility.h" + ENTRY( "CreateCMPXDrmMediaUtilityL", CCommonTestClass::CreateCMPXDrmMediaUtilityL ), + ENTRY( "CreateCMPXDrmMediaUtilityLC", CCommonTestClass::CreateCMPXDrmMediaUtilityLC ), + ENTRY( "DeleteCMPXDrmMediaUtilityL", CCommonTestClass::DeleteCMPXDrmMediaUtilityL ), + ENTRY( "InitFileNameL", CCommonTestClass::InitFileNameL ), + ENTRY( "InitRFileL", CCommonTestClass::InitRFileL ), + ENTRY( "Close", CCommonTestClass::Close ), + ENTRY( "GetMediaL", CCommonTestClass::GetMediaL ), + ENTRY( "ConsumeL", CCommonTestClass::ConsumeL ), + // test cases for the header "testmpxmessage.h" + ENTRY( "TMPXMessage3L", CCommonTestClass::TMPXMessage3L ), + ENTRY( "TMPXMessageL", CCommonTestClass::TMPXMessageL ), + ENTRY( "TMPXMessage1L", CCommonTestClass::TMPXMessage1L ), + ENTRY( "EqualTMPXMessage", CCommonTestClass::EqualTMPXMessage ), + ENTRY( "Event", CCommonTestClass::Event ), + ENTRY( "Type", CCommonTestClass::Type ), + ENTRY( "Data", CCommonTestClass::Data ), + // test cases for the header "testmpxmessagequeue.h" + ENTRY( "CreateCMPXMessageQueueL", CCommonTestClass::CreateCMPXMessageQueueL ), + ENTRY( "ResetCMPXMessageQueue", CCommonTestClass::ResetCMPXMessageQueue ), + ENTRY( "SendNextCMPXMessageQueue", CCommonTestClass::SendNextCMPXMessageQueue ), + ENTRY( "AddCMPXMessageQueue", CCommonTestClass::AddCMPXMessageQueue ), + ENTRY( "DeleteCMPXMessageQueue", CCommonTestClass::DeleteCMPXMessageQueue ), + // test cases for the header "testmpxsession.h" + + ENTRY( "CreateRMPXSession", CCommonTestClass::CreateRMPXSession ), + ENTRY( "CloseAndDestructRMPXSession", CCommonTestClass::CloseAndDestructRMPXSession ), + + ENTRY( "VersionRMPXSession", CCommonTestClass::VersionRMPXSession ), + ENTRY( "ConnectRMPXSessionL", CCommonTestClass::ConnectRMPXSessionL ), + ENTRY( "ReconnectRMPXSessionL", CCommonTestClass::ReconnectRMPXSessionL ), + ENTRY( "SendReceiveLRMPXSessionL", CCommonTestClass::SendReceiveLRMPXSessionL ), + ENTRY( "SendReceiveStatusRMPXSessionL", CCommonTestClass::SendReceiveStatusRMPXSessionL ), + ENTRY( "SendReceiveStatus3RMPXSessionL", CCommonTestClass::SendReceiveStatus3RMPXSessionL ), + // test cases for the header "testmpxmessagemonitor.h" + ENTRY( "CreateCMPXMessageMonitorL", CCommonTestClass::CreateCMPXMessageMonitorL ), + ENTRY( "DeleteCMPXMessageMonitorL", CCommonTestClass::DeleteCMPXMessageMonitorL ), + ENTRY( "RunLCMPXMessageMonitorL", CCommonTestClass::RunLCMPXMessageMonitorL ), + // test cases for the header "testmpxactivetaskqueue.h" + ENTRY( "CreateCMPXActiveTaskQueueL", CCommonTestClass::CreateCMPXActiveTaskQueueL ), + ENTRY( "CancelRequestsCMPXActiveTaskQueueL", CCommonTestClass::CancelRequestsCMPXActiveTaskQueueL ), + ENTRY( "AddTaskCMPXActiveTaskQueueL", CCommonTestClass::AddTaskCMPXActiveTaskQueueL ), + ENTRY( "CompleteTaskCMPXActiveTaskQueueL", CCommonTestClass::CompleteTaskCMPXActiveTaskQueueL ), + + //added on 2009,2,11 + ENTRY( "CompleteAllTasksCMPXActiveTaskQueueL", CCommonTestClass::CompleteAllTasksCMPXActiveTaskQueueL ), + + ENTRY( "IsEmptyCMPXTaskQueueL", CCommonTestClass::IsEmptyCMPXTaskQueueL ), + ENTRY( "AddTaskCMPXTaskQueueL", CCommonTestClass::AddTaskCMPXTaskQueueL ), + ENTRY( "RemoveTaskCMPXTaskQueueL", CCommonTestClass::RemoveTaskCMPXTaskQueueL ), + ENTRY( "RemoveTask2CMPXTaskQueueL", CCommonTestClass::RemoveTask2CMPXTaskQueueL ), + ENTRY( "CallbackCMPXTaskQueueL", CCommonTestClass::CallbackCMPXTaskQueueL ), + ENTRY( "ParamCMPXTaskQueueL", CCommonTestClass::ParamCMPXTaskQueueL ), + ENTRY( "PtrDataCMPXTaskQueueL", CCommonTestClass::PtrDataCMPXTaskQueueL ), + ENTRY( "BufDataCMPXTaskQueueL", CCommonTestClass::BufDataCMPXTaskQueueL ), + ENTRY( "TaskCMPXTaskQueueL", CCommonTestClass::TaskCMPXTaskQueueL ), + // test cases for the header "testmpxuser.h" + ENTRY( "CompareUids", CCommonTestClass::CompareUids ), + ENTRY( "IsCallOngoing", CCommonTestClass::IsCallOngoing ), + ENTRY( "CompleteWithDllPath", CCommonTestClass::CompleteWithDllPath ), + ENTRY( "Alloc8L", CCommonTestClass::Alloc8L ), + ENTRY( "AllocL", CCommonTestClass::AllocL ), + ENTRY( "Ptr", CCommonTestClass::Ptr ), + ENTRY( "Ptr8", CCommonTestClass::Ptr8 ), + ENTRY( "CreateBufferLC", CCommonTestClass::CreateBufferLC ), + ENTRY( "CreateBufferDesCL", CCommonTestClass::CreateBufferDesCL ),////two + ENTRY( "CreateBufferDesCL", CCommonTestClass::CreateBufferDesCL ), + ENTRY( "CreateBufferDesCArrayL", CCommonTestClass::CreateBufferDesCArrayL ), + + ENTRY( "CreateBufferMsgL", CCommonTestClass::CreateBufferMsgL ),//added by 2009,2,10 + + ENTRY( "ExternalizeL", CCommonTestClass::ExternalizeL ), + ENTRY( "ExternalizeArrayL", CCommonTestClass::ExternalizeArrayL ), + ENTRY( "InternalizeArrayL", CCommonTestClass::InternalizeArrayL ), + + ENTRY( "InternalizeDesCArrayL", CCommonTestClass::InternalizeDesCArrayL ),//added by 2009,2,11 + + ENTRY( "CopyArrayL", CCommonTestClass::CopyArrayL ), + ENTRY( "MergeArray", CCommonTestClass::MergeArray ), + ENTRY( "MergeAttributeL", CCommonTestClass::MergeAttributeL ), + ENTRY( "ProcessIdL", CCommonTestClass::ProcessIdL ), + ENTRY( "CompareOrderedUidArrays", CCommonTestClass::CompareOrderedUidArrays ), + ENTRY( "CreateFromBufferL", CCommonTestClass::CreateFromBufferL ), + ENTRY( "CreateCMPXViewPlugin", CCommonTestClass::CreateCMPXViewPlugin ), + ENTRY( "DeleteCMPXViewPlugin", CCommonTestClass::DeleteCMPXViewPlugin ), + // test cases for the header "mpxattribute.h" + ENTRY( "MpxAttDefaultConst", CCommonTestClass::MpxAttDefaultConst ), + ENTRY( "MpxAttConst", CCommonTestClass::MpxAttConst ), + ENTRY( "MpxAttCopyConstAtt", CCommonTestClass::MpxAttCopyConstAtt ), + ENTRY( "MpxAttCopyConstAttData", CCommonTestClass::MpxAttCopyConstAttData ), + ENTRY( "MpxAttOperatorAssignment", CCommonTestClass::MpxAttOperatorAssignment ), + ENTRY( "MpxAttOperatorEqual", CCommonTestClass::MpxAttOperatorEqual ), + ENTRY( "MpxAttStreamingL", CCommonTestClass::MpxAttStreamingL ), + ENTRY( "MpxAttContentId", CCommonTestClass::MpxAttContentId ), + ENTRY( "MpxAttAttributeId", CCommonTestClass::MpxAttAttributeId ), + ENTRY( "MpxAttMatch", CCommonTestClass::MpxAttMatch ), + ENTRY( "MpxAttMatchContentId", CCommonTestClass::MpxAttMatchContentId ), + ENTRY( "MpxAttOperatorAndAttData", CCommonTestClass::MpxAttOperatorAndAttData ), + ENTRY( "MpxAttOperatorAndData", CCommonTestClass::MpxAttOperatorAndData ), + ENTRY( "MpxAttOperatorOr", CCommonTestClass::MpxAttOperatorOr ), + // test cases for the header "mpxmedia.h" + ENTRY( "MpxMediaNewL", CCommonTestClass::MpxMediaNewL ), + ENTRY( "MpxMediaNewLSupportedIdsL", CCommonTestClass::MpxMediaNewLSupportedIdsL ), + ENTRY( "MpxMediaNewLMediaL", CCommonTestClass::MpxMediaNewLMediaL ), + ENTRY( "MpxMediaNewLDataHandleL", CCommonTestClass::MpxMediaNewLDataHandleL ), + ENTRY( "MpxMediaNewLStreamL", CCommonTestClass::MpxMediaNewLStreamL ), + ENTRY( "MpxMediaOperatorAssignment", CCommonTestClass::MpxMediaOperatorAssignment ), + ENTRY( "MpxMediaSupportedIds", CCommonTestClass::MpxMediaSupportedIds ), + ENTRY( "MpxMediaAttributes", CCommonTestClass::MpxMediaAttributes ), + ENTRY( "MpxMediaSetTObjectValueL", CCommonTestClass::MpxMediaSetTObjectValueL ), + ENTRY( "MpxMediaSetCObjectValueL", CCommonTestClass::MpxMediaSetCObjectValueL ), + ENTRY( "MpxMediaSetNoNewLCObjectL", CCommonTestClass::MpxMediaSetNoNewLCObjectL ), + ENTRY( "MpxMediaSetTextValueL", CCommonTestClass::MpxMediaSetTextValueL ), + ENTRY( "MpxMediaIsSupported", CCommonTestClass::MpxMediaIsSupported ), + ENTRY( "MpxMediaCount", CCommonTestClass::MpxMediaCount ), + ENTRY( "MpxMediaAttribute", CCommonTestClass::MpxMediaAttribute ), + ENTRY( "MpxMediaAttributesSet", CCommonTestClass::MpxMediaAttributesSet ), + ENTRY( "MpxMediaIndex", CCommonTestClass::MpxMediaIndex ), + ENTRY( "MpxMediaTypeIndex", CCommonTestClass::MpxMediaTypeIndex ), + ENTRY( "MpxMediaTypeAttribute", CCommonTestClass::MpxMediaTypeAttribute ), + ENTRY( "MpxMediaReset", CCommonTestClass::MpxMediaReset ), + ENTRY( "MpxMediaDeleteAttribute", CCommonTestClass::MpxMediaDeleteAttribute ), + ENTRY( "MpxMediaDeleteIndex", CCommonTestClass::MpxMediaDeleteIndex ), + ENTRY( "MpxMediaValueText", CCommonTestClass::MpxMediaValueText ), + ENTRY( "MpxMediaValue", CCommonTestClass::MpxMediaValue ), + ENTRY( "MpxMediaValueTObjectL", CCommonTestClass::MpxMediaValueTObjectL ), + ENTRY( "MpxMediaValueCObjectL", CCommonTestClass::MpxMediaValueCObjectL ), + ENTRY( "MpxMediaValueNoNewLCObjectL", CCommonTestClass::MpxMediaValueNoNewLCObjectL ), + ENTRY( "MpxMediaStreamingL", CCommonTestClass::MpxMediaStreamingL ), + // test cases for the header "mpxmediaarray.h" + ENTRY( "MpxMediaArrayNewL", CCommonTestClass::MpxMediaArrayNewL ), + ENTRY( "MpxMediaArrayNewLMediaArrayL", CCommonTestClass::MpxMediaArrayNewLMediaArrayL ), + ENTRY( "MpxMediaArrayCount", CCommonTestClass::MpxMediaArrayCount ), + + ENTRY( "MpxMediaArrayAtLByIndexL", CCommonTestClass::MpxMediaArrayAtLByIndexL ),//added by on 2009,2,11 + + ENTRY( "MpxMediaArrayAppendLByPtrL", CCommonTestClass::MpxMediaArrayAppendLByPtrL ), + ENTRY( "MpxMediaArrayAppendLByRefL", CCommonTestClass::MpxMediaArrayAppendLByRefL ), + ENTRY( "MpxMediaArrayReset", CCommonTestClass::MpxMediaArrayReset ), + ENTRY( "MpxMediaArrayRemove", CCommonTestClass::MpxMediaArrayRemove ), + ENTRY( "MpxMediaArrayInsertByPtr", CCommonTestClass::MpxMediaArrayInsertByPtr ), + ENTRY( "MpxMediaArrayInsertByRef", CCommonTestClass::MpxMediaArrayInsertByRef ), + ENTRY( "MpxMediaArrayInsertLByPtrL", CCommonTestClass::MpxMediaArrayInsertLByPtrL ), + ENTRY( "MpxMediaArrayInsertLByRefL", CCommonTestClass::MpxMediaArrayInsertLByRefL ), + ENTRY( "MpxMediaArraySet", CCommonTestClass::MpxMediaArraySet ), + ENTRY( "MpxMediaArrayStreamingL", CCommonTestClass::MpxMediaArrayStreamingL ), + // test cases for the header "mpxcollectionpath.h" + ENTRY( "MpxItemIdConst", CCommonTestClass::MpxItemIdConst ), + ENTRY( "MpxItemIdReset", CCommonTestClass::MpxItemIdReset ), + ENTRY( "MpxCollPathNewL", CCommonTestClass::MpxCollPathNewL ), + ENTRY( "MpxCollPathNewLPathL", CCommonTestClass::MpxCollPathNewLPathL ), + ENTRY( "MpxCollPathNewLStreamL", CCommonTestClass::MpxCollPathNewLStreamL ), + ENTRY( "MpxCollPathAppendLIdL", CCommonTestClass::MpxCollPathAppendLIdL ), + ENTRY( "MpxCollPathAppendLIdsL", CCommonTestClass::MpxCollPathAppendLIdsL ), + ENTRY( "MpxCollPathLevels", CCommonTestClass::MpxCollPathLevels ), + ENTRY( "MpxCollPathBack", CCommonTestClass::MpxCollPathBack ), + ENTRY( "MpxCollPathReset", CCommonTestClass::MpxCollPathReset ), + ENTRY( "MpxCollPathIndex", CCommonTestClass::MpxCollPathIndex ), + ENTRY( "MpxCollPathOperatorPlus", CCommonTestClass::MpxCollPathOperatorPlus ), + ENTRY( "MpxCollPathOperatorMinus", CCommonTestClass::MpxCollPathOperatorMinus ), + ENTRY( "MpxCollPathSetToFirst", CCommonTestClass::MpxCollPathSetToFirst ), + ENTRY( "MpxCollPathSetToLast", CCommonTestClass::MpxCollPathSetToLast ), + ENTRY( "MpxCollPathSetIndex", CCommonTestClass::MpxCollPathSetIndex ), + ENTRY( "MpxCollPathSetId", CCommonTestClass::MpxCollPathSetId ), + ENTRY( "MpxCollPathSetMode", CCommonTestClass::MpxCollPathSetMode ), + ENTRY( "MpxCollPathSetLAttrsL", CCommonTestClass::MpxCollPathSetLAttrsL ), + ENTRY( "MpxCollPathOpenNextMode", CCommonTestClass::MpxCollPathOpenNextMode ), + ENTRY( "MpxCollPathOpenPreviousMode", CCommonTestClass::MpxCollPathOpenPreviousMode ), + ENTRY( "MpxCollPathSelectLIdL", CCommonTestClass::MpxCollPathSelectLIdL ), + ENTRY( "MpxCollPathSelectLIndexL", CCommonTestClass::MpxCollPathSelectLIndexL ), + ENTRY( "MpxCollPathSelectAllL", CCommonTestClass::MpxCollPathSelectAllL ), + ENTRY( "MpxCollPathDeselectId", CCommonTestClass::MpxCollPathDeselectId ), + ENTRY( "MpxCollPathDeselectIndex", CCommonTestClass::MpxCollPathDeselectIndex ), + ENTRY( "MpxCollPathDeselectAll", CCommonTestClass::MpxCollPathDeselectAll ), + ENTRY( "MpxCollPathRemoveId", CCommonTestClass::MpxCollPathRemoveId ), + ENTRY( "MpxCollPathRemoveIndex", CCommonTestClass::MpxCollPathRemoveIndex ), + ENTRY( "MpxCollPathIsSelectedId", CCommonTestClass::MpxCollPathIsSelectedId ), + ENTRY( "MpxCollPathIsSelectedIndex", CCommonTestClass::MpxCollPathIsSelectedIndex ), + ENTRY( "MpxCollPathClearSelection", CCommonTestClass::MpxCollPathClearSelection ), + ENTRY( "MpxCollPathSelection", CCommonTestClass::MpxCollPathSelection ), + ENTRY( "MpxCollPathSelectionL", CCommonTestClass::MpxCollPathSelectionL ), + ENTRY( "MpxCollPathId", CCommonTestClass::MpxCollPathId ), + ENTRY( "MpxCollPathCount", CCommonTestClass::MpxCollPathCount ), + ENTRY( "MpxCollPathIndexOfId", CCommonTestClass::MpxCollPathIndexOfId ), + ENTRY( "MpxCollPathIdOfIndex", CCommonTestClass::MpxCollPathIdOfIndex ), + ENTRY( "MpxCollPathOpenAttributes", CCommonTestClass::MpxCollPathOpenAttributes ), + ENTRY( "MpxCollPathIndexLevel", CCommonTestClass::MpxCollPathIndexLevel ), + ENTRY( "MpxCollPathIdLevel", CCommonTestClass::MpxCollPathIdLevel ), + ENTRY( "MpxCollPathStreamingL", CCommonTestClass::MpxCollPathStreamingL ), + ENTRY( "MpxCollPathHandleChange", CCommonTestClass::MpxCollPathHandleChange ), + //ENTRY( "ContainerPathL", CCommonTestClass::ContainerPathL ), + // test cases for the header "mpxclientlist.h" + //there are so many absent functions + ENTRY( "MpxClientListNewL", CCommonTestClass::MpxClientListNewL ), + ENTRY( "MpxClientListClientCount", CCommonTestClass::MpxClientListClientCount ), + ENTRY( "MpxClientListIsClient", CCommonTestClass::MpxClientListIsClient ), + ENTRY( "MpxClientListFindByMsg", CCommonTestClass::MpxClientListFindByMsg ), + ENTRY( "MpxClientListFindById", CCommonTestClass::MpxClientListFindById ), //pass + //add function to testmpxclientlist.cpp 16,9,2008 + ENTRY( "MpxClientListDestruction", CCommonTestClass::MpxClientListDestruction ), + ENTRY( "MpxClientListAddClientL", CCommonTestClass::MpxClientListAddClientL ), //pass added 16,9,2008 + ENTRY( "MpxClientListAddClientLUsingMode", CCommonTestClass::MpxClientListAddClientLUsingMode ), //pass added 16,9,2008 + ENTRY( "MpxClientListRemoveClient", CCommonTestClass::MpxClientListRemoveClient ), //pass added 16,9,2008 + ENTRY( "MpxClientListClientProcessList", CCommonTestClass::MpxClientListClientProcessList ), //pass added 16,9,2008 + ENTRY( "DeleteMpxClientList", CCommonTestClass::DeleteMpxClientList ), //pass added 16,9,2008 + ENTRY( "MpxClientListClientMode", CCommonTestClass::MpxClientListClientMode ), //pass added 17.9 2008 + ENTRY( "MpxClientListSendMsg", CCommonTestClass::MpxClientListSendMsg ), //Pass added 22.9 2008 + ENTRY( "MpxClientListSendMsgaIndex", CCommonTestClass::MpxClientListSendMsgaIndex ), //pass modified 7,10 2008 + ENTRY( "SendMsgLByMsgCMPXClientList", CCommonTestClass::SendMsgLByMsgCMPXClientList ), //pass + ENTRY( "MPXClientListConvertMsgLC", CCommonTestClass::MPXClientListConvertMsgLC ), + ENTRY( "SendMsgLIndexAndTMPMsgCMPXClientList", CCommonTestClass::SendMsgLIndexAndTMPMsgCMPXClientList ),//pass + ENTRY( "MpxClientListAddSubscriptionL", CCommonTestClass::MpxClientListAddSubscriptionL ), //added 20.10 2008 + ENTRY( "MpxClientListRemoveSubscriptionL", CCommonTestClass::MpxClientListRemoveSubscriptionL ), //added 20.10 2008 + ENTRY( "MpxClientListRemoveAllSubscriptionsL", CCommonTestClass::MpxClientListRemoveAllSubscriptionsL ), //added 20.10 2008 + // test cases for the header "mpxpluginhandlerbase.h" + //There is absent. + ENTRY( "MpxPluginHandlerBaseSelectPluginLIdL", CCommonTestClass::MpxPluginHandlerBaseSelectPluginLIdL ), + ENTRY( "MpxPluginHandlerBaseSelectPluginLNameL", CCommonTestClass::MpxPluginHandlerBaseSelectPluginLNameL ), + ENTRY( "MpxPluginHandlerBaseSelectPluginLUriL", CCommonTestClass::MpxPluginHandlerBaseSelectPluginLUriL ), + ENTRY( "MpxPluginHandlerBaseSelectPluginLTypeL", CCommonTestClass::MpxPluginHandlerBaseSelectPluginLTypeL ), + ENTRY( "MpxPluginHandlerBaseClearSelectionCriteria", CCommonTestClass::MpxPluginHandlerBaseClearSelectionCriteria ), + ENTRY( "MpxPluginHandlerBasePluginNameType", CCommonTestClass::MpxPluginHandlerBasePluginNameType ), + ENTRY( "MpxPluginHandlerBasePluginNamesL", CCommonTestClass::MpxPluginHandlerBasePluginNamesL ), + ENTRY( "MpxPluginHandlerBaseSupportedMimeTypesL", CCommonTestClass::MpxPluginHandlerBaseSupportedMimeTypesL ), + ENTRY( "MpxPluginHandlerBaseSupportedExtensionsL", CCommonTestClass::MpxPluginHandlerBaseSupportedExtensionsL ), + ENTRY( "MpxPluginHandlerBaseSupportedSchemasL", CCommonTestClass::MpxPluginHandlerBaseSupportedSchemasL ), + ENTRY( "MpxPluginHandlerBaseSupportedMimeTypesLUidL", CCommonTestClass::MpxPluginHandlerBaseSupportedMimeTypesLUidL ), + ENTRY( "MpxPluginHandlerBaseSupportedExtensionsLUidL", CCommonTestClass::MpxPluginHandlerBaseSupportedExtensionsLUidL ), + ENTRY( "MpxPluginHandlerBaseGetPluginTypes", CCommonTestClass::MpxPluginHandlerBaseGetPluginTypes ), + ENTRY( "MpxPluginHandlerBaseGetPluginUids", CCommonTestClass::MpxPluginHandlerBaseGetPluginUids ), + ENTRY( "MpxPluginHandlerBaseGetPluginUidsL", CCommonTestClass::MpxPluginHandlerBaseGetPluginUidsL ), + ENTRY( "MpxPluginHandlerBasePluginUid", CCommonTestClass::MpxPluginHandlerBasePluginUid ), + ENTRY( "MpxPluginHandlerBaseIndexOf", CCommonTestClass::MpxPluginHandlerBaseIndexOf ), + ENTRY( "MpxPluginHandlerBaseCreatePluginListL", CCommonTestClass::MpxPluginHandlerBaseCreatePluginListL ), + ENTRY( "MpxPluginHandlerBaseFindPlugin", CCommonTestClass::MpxPluginHandlerBaseFindPlugin ), + //added tested functions for protected export functions of CMPXPluginHandlerBase + ENTRY( "MpxPluginHBBasePluginsChangedL", CCommonTestClass::MpxPluginHBBasePluginsChangedL), + ENTRY( "MpxPluginHBBaseIsPluginLoaded", CCommonTestClass::MpxPluginHBBaseIsPluginLoaded), + ENTRY( "MpxPluginHBBaseLoadPluginL", CCommonTestClass::MpxPluginHBBaseLoadPluginL), + ENTRY( "MpxPluginHBBaseHandlePluginUnload", CCommonTestClass::MpxPluginHBBaseHandlePluginUnload), + + + //add function to testmpxuser.cpp + ENTRY( "RecreateBufferL", CCommonTestClass::RecreateBufferL), //pass 12,9,2008 + ENTRY( "CompleteWithDllPathOL", CCommonTestClass::CompleteWithDllPathOL), //pass 12,9,2008 + ENTRY( "FindWindowGroupIdL", CCommonTestClass::FindWindowGroupIdL), //pass 12,9,2008 + ENTRY( "Alloc8ZL", CCommonTestClass::Alloc8ZL), //pass 12,9,2008 + //add function to testmpxmessagemonitor.cpp 16,9,2008 + ENTRY( "GetNextMessageCMPXMessageMonitorL", CCommonTestClass::GetNextMessageCMPXMessageMonitorL ), //pass + ENTRY( "DoCancelCMPXMessageMonitorL", CCommonTestClass::DoCancelCMPXMessageMonitorL ), //pass + ENTRY( "RunErrorCMPXMessageMonitorL", CCommonTestClass::RunErrorCMPXMessageMonitorL ), //pass + //add function to testmpxcollectionpath.cpp 17,9,2008 + ENTRY( "MpxCollectionpathContainerPathL", CCommonTestClass::MpxCollectionpathContainerPathL ), //pass 17,9,2008 + ENTRY( "MpxCollectionpathInsertL", CCommonTestClass::MpxCollectionpathInsertL ), //pass 17,9,2008 + ENTRY( "MpxCollectionpathItems", CCommonTestClass::MpxCollectionpathItems ), //pass 17,9,2008 + ENTRY( "MpxCollectionpathUpdate", CCommonTestClass::MpxCollectionpathUpdate ), //pass 17,9,2008 + ENTRY( "MpxCollectionpathDelete", CCommonTestClass::MpxCollectionpathDelete ), //pass 18,9,2008 + ENTRY( "MpxCollectionpathCollPathSetAttrsL", CCommonTestClass::MpxCollectionpathCollPathSetAttrsL ), //pass 18,9,2008 + //add function to testmpxcollectiontype.cpp 17,9,2008 + ENTRY( "TUidMPXCollectionType", CCommonTestClass::TUidMPXCollectionType ), //pass 17,9,2008 + //add function to testmpxsession.cpp 17,9,2008 + ENTRY( "SendReceiveLTIpcArgsRMPXSessionL", CCommonTestClass::SendReceiveLTIpcArgsRMPXSessionL ), //pass 17,9,2008 + ENTRY( "CMPXCollectionTypeDelete", CCommonTestClass::CMPXCollectionTypeDelete ), //pass(debug ) 9/19/2008 1:32 + //add function to testmpxpluginhandlerbase.cpp 18,9,2008 + ENTRY( "MpxPluginHandlerBaseSupportUids", CCommonTestClass::MpxPluginHandlerBaseSupportUids ), //faile modified 23,9,2008 + ENTRY( "MpxPluginHandlerBasePluginNameByUid", CCommonTestClass::MpxPluginHandlerBasePluginNameByUid ), //crash added 19,9,2008 + ENTRY( "MpxPluginHandlerBasePluginFlagsL", CCommonTestClass::MpxPluginHandlerBasePluginFlagsL ), //crash added 19,9,2008 + ENTRY( "MpxPluginHandlerBasePluginType", CCommonTestClass::MpxPluginHandlerBasePluginType ), //pass(debug) 19,9,2008 + ENTRY( "MpxPluginHandlerBaseDestruction", CCommonTestClass::MpxPluginHandlerBaseDestruction ), //pass modified 23,9,2008 + ENTRY( "MpxPluginHandlerBaseSelectPluginLRFile", CCommonTestClass::MpxPluginHandlerBaseSelectPluginLRFile ), //pass(debug) modified 24,9,2008 + ENTRY( "MpxPluginHandlerBaseGetSelectionCriteria", CCommonTestClass::MpxPluginHandlerBaseGetSelectionCriteria ), //pass debug 26,9,2008 + ENTRY( "MpxPluginHandlerBaseUsePluginTUid", CCommonTestClass::MpxPluginHandlerBaseUsePluginTUid ), //pass debug 19,9,2008 + ENTRY( "MpxPluginHandlerBaseReleasePluginTUid", CCommonTestClass::MpxPluginHandlerBaseReleasePluginTUid ), //pass debug 19,9,2008 + ENTRY( "MpxPluginHandlerBaseCreate", CCommonTestClass::MpxPluginHandlerBaseCreate ), // //pass debug 19,9,2008 + //add MpxMediaCopyL to testmpxmedia.cpp 9/18/2008 10:47 + ENTRY( "MpxMediaCopyL", CCommonTestClass::MpxMediaCopyL ), //pass modified 23,9,2008 + ENTRY( "MpxMediaDeleteL", CCommonTestClass::MpxMediaDeleteL ), //pass 18,9,2008 + ENTRY( "MpxMediaHeapMemoryInfoL", CCommonTestClass::MpxMediaHeapMemoryInfoL ), //pass 18,9,2008 + ENTRY( "MpxMediaMergeMediaL", CCommonTestClass::MpxMediaMergeMediaL ), //pass 18,9,2008 + ENTRY( "MpxMediaMatchL", CCommonTestClass::MpxMediaMatchL ), //modified 24,9,2008 + ENTRY( "MpxMediaSetErrorL", CCommonTestClass::MpxMediaSetErrorL ), //pass 6,10,2008 + ENTRY( "MpxMediaErrorL", CCommonTestClass::MpxMediaErrorL ), //pass 6,10,2008 + ENTRY( "MpxMediaExternalizeL", CCommonTestClass::MpxMediaExternalizeL ), //pass 18,9,2008 + ENTRY( "MpxMediaInternalizeL", CCommonTestClass::MpxMediaInternalizeL ), //pass 18,9,2008 + ENTRY( "CreateCMPXTaskQueue", CCommonTestClass::CreateCMPXTaskQueue), //Pass 22,9,2008 + ENTRY( "DeleteCMPXTaskQueue", CCommonTestClass::DeleteCMPXTaskQueue), //Pass 22,9,2008 + ENTRY( "ScheduleNextTaskCMPXTaskQueue",CCommonTestClass::ScheduleNextTaskCMPXTaskQueue ),//Pass 22,9,2008 + ENTRY( "ResetCMPXTaskQueue", CCommonTestClass::ResetCMPXTaskQueue ), //Pass 22,9,2008 + ENTRY( "DeleteCMPXActiveTaskQueue",CCommonTestClass::DeleteCMPXActiveTaskQueue ), //Pass 22,9,2008 + //test in mpxplugininfo.h added 10/6/2008 + ENTRY( "CMPXPluginInfoDestructor", CCommonTestClass::CMPXPluginInfoDestructor ),//Pass debug + ENTRY( "CMPXPluginInfoImplementationUid", CCommonTestClass::CMPXPluginInfoImplementationUid ),//Pass debug + ENTRY( "CMPXPluginInfoFlags", CCommonTestClass::CMPXPluginInfoFlags ),//Crash debug + //added test functions to test protected export functions + ENTRY( "CMPXPluginInfoProcessTaggedDataExL", CCommonTestClass::CMPXPluginInfoProcessTaggedDataExL ), + ENTRY( "CMPXPluginInfoExtractIntoArrayL", CCommonTestClass::CMPXPluginInfoExtractIntoArrayL ), + + + //add test functions for CMPXSubscription of mpxsubscription.h + ENTRY( "CMPXSubscriptionNewL", CCommonTestClass::CMPXSubscriptionNewL ), + ENTRY( "CMPXSubscriptionNewLWithMediaArrayL", CCommonTestClass::CMPXSubscriptionNewLWithMediaArrayL ), + ENTRY( "CMPXSubscriptionAddItemL", CCommonTestClass::CMPXSubscriptionAddItemL ), + ENTRY( "CMPXSubscriptionItemsL", CCommonTestClass::CMPXSubscriptionItemsL ), + ENTRY( "CMPXSubscriptionIsEqualOperator", CCommonTestClass::CMPXSubscriptionIsEqualOperator ), + ENTRY( "MpxPluginHandlerBaseSelectPluginLRFile64", CCommonTestClass::MpxPluginHandlerBaseSelectPluginLRFile64 ), + }; + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + return RunInternalL( KFunctions, count, aItem ); + } +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testcenrepwatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testcenrepwatcher.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,174 @@ +/* +* 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: MPXCenRepWatcher testing implementation +* +*/ + + +#include +#include +#include + +#include "commontestclass.h" + +// Begin CMPXCenRepWatcher testing implementation (mpxcenrepwatcher.h)======================================= +// ----------------------------------------------------------------------------- +// CCommonTestClass::CreateCenRepWatcherL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CreateCenRepWatcherL() + { + FTRACE(FPrint(_L("CCommonTestClass::CreateCenRepWatcherL testing CMPXCenRepWatcher::NewL begin"))); + iLog->Log(_L("CCommonTestClass::CreateCenRepWatcherL testing CMPXCenRepWatcher::NewL begin")); + TInt err = KErrNone; + if ( iCenRepWatcher != NULL) + { + delete iCenRepWatcher; + } + iCenRepWatcher = NULL; + iCenRepWatcher = CMPXCenRepWatcher::NewL(KCRUidMPXSettings, + KMPXPlaybackRepeatMode, + this); + if ( iCenRepWatcher == NULL) + { + err = KErrNotFound; + } + FTRACE(FPrint(_L("CCommonTestClass::CreateCenRepWatcherL testing CMPXCenRepWatcher::NewL end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CreateCenRepWatcherL testing CMPXCenRepWatcher::NewL end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::DeleteCenRepWatcherL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::DeleteCenRepWatcherL() + { + FTRACE(FPrint(_L("CCommonTestClass::DeleteCenRepWatcherL testing CMPXCenRepWatcher::~ begin"))); + iLog->Log(_L("CCommonTestClass::DeleteCenRepWatcherL testing CMPXCenRepWatcher::~ begin")); + TInt err = KErrNone; + delete iCenRepWatcher; + iCenRepWatcher = NULL; + FTRACE(FPrint(_L("CCommonTestClass::DeleteCenRepWatcherL testing CMPXCenRepWatcher::~ end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::DeleteCenRepWatcherL testing CMPXCenRepWatcher::~ end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::HandleSettingChange() +// Returns: None +// ----------------------------------------------------------------------------- +void CCommonTestClass::HandleSettingChange(const TUid& /*aRepositoryUid*/, + TUint32 /*aSettingId*/) + { + } + + +TInt CCommonTestClass::CenRepCurrentValueL( CStifItemParser& aItem ) + { + FTRACE(FPrint(_L("CCommonTestClass::CenRepCurrentValueL testing CMPXCenRepWatcher::CurrentValueL begin"))); + iLog->Log(_L("CCommonTestClass::CenRepCurrentValueL testing CMPXCenRepWatcher::CurrentValueL begin")); + TInt mode = 0; + TRAPD(err, mode = iCenRepWatcher->CurrentValueL()); + + FTRACE(FPrint(_L("CCommonTestClass::CenRepCurrentValueL current value = %d"), mode )); + iLog->Log(_L("CCommonTestClass::CenRepCurrentValueL current value = %d"), mode ); + + TPtrC checkType; + TPtrC operand; + TInt expectedvalue; + + if ( ( KErrNone == err) && + (KErrNone == aItem.GetNextString(checkType) ) && + (KErrNone == aItem.GetNextString(operand) ) && + (KErrNone == aItem.GetNextInt(expectedvalue) ) ) + { + if (( operand == KTagCompareEqual) && + ( checkType == KTagvalue ) ) + { + if ( mode == expectedvalue ) + { + err = KErrNone; + FTRACE(FPrint(_L("CCommonTestClass::CenRepCurrentValueL current value matches expectation"))); + iLog->Log(_L("CCommonTestClass::CenRepCurrentValueL current value matches expectation")); + } + else + { + err = KErrGeneral; + FTRACE(FPrint(_L("CCommonTestClass::CenRepCurrentValueL current value does not matche expectation"))); + iLog->Log(_L("CCommonTestClass::CenRepCurrentValueL current value does not matche expectation")); + } + } + else + { + err = KErrBadTestParameter; + FTRACE(FPrint(_L("CCommonTestClass::CenRepCurrentValueL Stif test script is wrong."))); + iLog->Log(_L("CCommonTestClass::CenRepCurrentValueL Stif test script is wrong.")); + } + } + else + { + err = KErrBadTestParameter; + FTRACE(FPrint(_L("CCommonTestClass::CenRepCurrentValueL Stif test script is wrong."))); + iLog->Log(_L("CCommonTestClass::CenRepCurrentValueL Stif test script is wrong.")); + } + + + FTRACE(FPrint(_L("CCommonTestClass::CenRepCurrentValueL testing CMPXCenRepWatcher::CurrentValueL end=%d"), err)); + iLog->Log(_L("CCommonTestClass::CenRepCurrentValueL testing CMPXCenRepWatcher::CurrentValueL end=%d"), err); + + return err; + } + + +TInt CCommonTestClass::CenRepSetValueL( CStifItemParser& aItem ) + { + FTRACE(FPrint(_L("CCommonTestClass::CenRepSetValueL testing CMPXCenRepWatcher::SetValueL begin"))); + iLog->Log(_L("CCommonTestClass::CenRepSetValueL testing CMPXCenRepWatcher::SetValueL begin")); + + TInt mode = 0; + TRAPD(err, mode = iCenRepWatcher->CurrentValueL()); + + FTRACE(FPrint(_L("CCommonTestClass::CenRepSetValueL current value = %d"), mode )); + iLog->Log(_L("CCommonTestClass::CenRepSetValueL current value = %d"), mode ); + + TInt newValue; + if ( !aItem.GetNextInt(newValue) ) + { + TRAP(err, iCenRepWatcher->SetValueL(newValue)); + + if ( ( mode = iCenRepWatcher->CurrentValueL()) != newValue ) + { + err = KErrGeneral; + } + + FTRACE(FPrint(_L("CCommonTestClass::CenRepSetValueL after setting value = %d"), mode )); + iLog->Log(_L("CCommonTestClass::CenRepSetValueL after setting value = %d"), mode ); + } + else + { + FTRACE(FPrint(_L("CCommonTestClass::CenRepSetValueL failed reading parameter from STIF"))); + iLog->Log(_L("CCommonTestClass::CenRepSetValueL failed reading parameter from STIF")); + err = KErrBadTestParameter; + } + + FTRACE(FPrint(_L("CCommonTestClass::CenRepSetValueL testing CMPXCenRepWatcher::CenRepSetValueL~ end=%d"), err)); + iLog->Log(_L("CCommonTestClass::CenRepSetValueL testing CMPXCenRepWatcher::CenRepSetValueL end=%d"), err); + return err; + } + +// end of CMPXCenRepWatcher (mpxcenrepwatcher.h ============================================= + + \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxactivetaskqueue.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxactivetaskqueue.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,526 @@ +/* +* 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: MPXActiveTaskQueue testing implementation +* +*/ + + +#include +#include "commontestclass.h" + + +// Begin CMPXActiveTaskQueue testing implementation (mpxtaskqueue.h)======================================= +// ----------------------------------------------------------------------------- +// CCommonTestClass::CreateCMPXActiveTaskQueueL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CreateCMPXActiveTaskQueueL() + { + FTRACE(FPrint(_L("CCommonTestClass::CreateCMPXActiveTaskQueueL testing CMPXActiveTaskQueue::NewL() begin"))); + iLog->Log(_L("CCommonTestClass::CreateCMPXActiveTaskQueueL testing CMPXActiveTaskQueue::NewL() begin")); + TInt err = KErrNone; + CMPXActiveTaskQueue* taskQueue = NULL; + taskQueue = CMPXActiveTaskQueue::NewL(); + if ( taskQueue == NULL) + { + err = KErrNotFound; + } + delete taskQueue; + FTRACE(FPrint(_L("CCommonTestClass::CreateCMPXActiveTaskQueueL testing CMPXActiveTaskQueue::NewL() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CreateCMPXActiveTaskQueueL testing CMPXActiveTaskQueue::NewL() end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::CancelRequestsCMPXActiveTaskQueueL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CancelRequestsCMPXActiveTaskQueueL() + { + FTRACE(FPrint(_L("CCommonTestClass::CancelRequestsCMPXActiveTaskQueueL testing CMPXActiveTaskQueueL::CancelRequests begin"))); + iLog->Log(_L("CCommonTestClass::CancelRequestsCMPXActiveTaskQueueL testing CMPXActiveTaskQueueL::CancelRequests begin")); + TInt err = KErrNone; + CMPXActiveTaskQueue* taskQueue = NULL; + taskQueue = CMPXActiveTaskQueue::NewL(); + taskQueue->CancelRequests(); + delete taskQueue; + FTRACE(FPrint(_L("CCommonTestClass::CancelRequestsCMPXActiveTaskQueueL testing CMPXActiveTaskQueueL::CancelRequests end=%d"), err)); + iLog->Log(_L("CCommonTestClass::CancelRequestsCMPXActiveTaskQueueL testing CMPXActiveTaskQueueL::CancelRequests end=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::AddTaskCMPXActiveTaskQueueL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::AddTaskCMPXActiveTaskQueueL() + { + FTRACE(FPrint(_L("CCommonTestClass::AddTaskCMPXActiveTaskQueueL testing CMPXActiveTaskQueue::AddTaskL begin"))); + iLog->Log(_L("CCommonTestClass::AddTaskCMPXActiveTaskQueueL testing CMPXActiveTaskQueue::AddTaskL begin")); + TInt err = KErrNone; + + CMPXActiveTaskQueue* taskQueue = NULL; + taskQueue = CMPXActiveTaskQueue::NewL(); + + TInt task(0); //ETaskNone + CBufBase* taskParam(NULL); + taskQueue->AddTaskL( task, + NULL, // callback when task completed + NULL, // task queue observer + 0, // Integer paramter, not used + taskParam, // task queue assumes ownership of taskParam + NULL, // Ptr data + NULL ); + taskQueue->CancelRequests(); + delete taskQueue; + + FTRACE(FPrint(_L("CCommonTestClass::AddTaskCMPXActiveTaskQueueL testing CMPXActiveTaskQueue::AddTaskL end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::AddTaskCMPXActiveTaskQueueL testing CMPXActiveTaskQueue::AddTaskL end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::CompleteTaskCMPXActiveTaskQueueL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CompleteTaskCMPXActiveTaskQueueL() + { + FTRACE(FPrint(_L("CCommonTestClass::CompleteTaskCMPXActiveTaskQueueL testing CMPXActiveTaskQueueL::CompleteTask begin"))); + iLog->Log(_L("CCommonTestClass::CompleteTaskCMPXActiveTaskQueueL testing CMPXActiveTaskQueueL::CompleteTask begin")); + TInt err = KErrNone; + CMPXActiveTaskQueue* taskQueue = NULL; + taskQueue = CMPXActiveTaskQueue::NewL(); + TInt task(0); //ETaskNone + CBufBase* taskParam(NULL); + taskQueue->AddTaskL( task, + NULL, // callback when task completed + NULL, // task queue observer + 0, // Integer paramter, not used + taskParam, // task queue assumes ownership of taskParam + NULL, // Ptr data + NULL ); + taskQueue->CompleteTask(); + taskQueue->CancelRequests(); + delete taskQueue; + FTRACE(FPrint(_L("CCommonTestClass::CompleteTaskCMPXActiveTaskQueueL testing CMPXActiveTaskQueueL::CompleteTask end=%d"), err)); + iLog->Log(_L("CCommonTestClass::CompleteTaskCMPXActiveTaskQueueL testing CMPXActiveTaskQueueL::CompleteTask end=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::CompleteAllTasksCMPXActiveTaskQueueL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CompleteAllTasksCMPXActiveTaskQueueL() + { + FTRACE(FPrint(_L("CCommonTestClass::CompleteAllTasksCMPXActiveTaskQueueL testing CMPXActiveTaskQueueL::CompleteTask begin"))); + iLog->Log(_L("CCommonTestClass::CompleteAllTasksCMPXActiveTaskQueueL testing CMPXActiveTaskQueueL::CompleteTask begin")); + TInt err = KErrNone; + CMPXActiveTaskQueue* taskQueue = NULL; + taskQueue = CMPXActiveTaskQueue::NewL(); + TInt task(0); //ETaskNone + CBufBase* taskParam(NULL); + taskQueue->AddTaskL( task, + NULL, // callback when task completed + NULL, // task queue observer + 0, // Integer paramter, not used + taskParam, // task queue assumes ownership of taskParam + NULL, // Ptr data + NULL ); + taskQueue->CompleteTask(); + taskQueue->CompleteAllTasks( 0 ); + taskQueue->CancelRequests(); + delete taskQueue; + FTRACE(FPrint(_L("CCommonTestClass::CompleteAllTasksCMPXActiveTaskQueueL testing CMPXActiveTaskQueueL::CompleteTask end=%d"), err)); + iLog->Log(_L("CCommonTestClass::CompleteAllTasksCMPXActiveTaskQueueL testing CMPXActiveTaskQueueL::CompleteTask end=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::IsEmptyCMPXTaskQueueL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::IsEmptyCMPXTaskQueueL() + { + FTRACE(FPrint(_L("CCommonTestClass::IsEmptyCMPXTaskQueueL testing CMPXTaskQueueL::IsEmpty begin"))); + iLog->Log(_L("CCommonTestClass::IsEmptyCMPXTaskQueueL testing CMPXTaskQueueL::IsEmpty begin")); + TInt err = KErrNone; + CMPXTaskQueue* taskQueue = NULL; + taskQueue = CMPXTaskQueue::NewL(); + taskQueue->IsEmpty(); + delete taskQueue; + FTRACE(FPrint(_L("CCommonTestClass::IsEmptyCMPXTaskQueueL testing CMPXTaskQueueL::IsEmpty end=%d"), err)); + iLog->Log(_L("CCommonTestClass::IsEmptyCMPXTaskQueueL testing CMPXTaskQueueL::IsEmpty end=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::AddTaskCMPXTaskQueueL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::AddTaskCMPXTaskQueueL() + { + FTRACE(FPrint(_L("CCommonTestClass::AddTaskCMPXTaskQueueL testing CMPXTaskQueue::AddTaskL begin"))); + iLog->Log(_L("CCommonTestClass::AddTaskCMPXTaskQueueL testing CMPXTaskQueue::AddTaskL begin")); + TInt err = KErrNone; + + CMPXTaskQueue* taskQueue = CMPXTaskQueue::NewL(); + TInt task(0); //ETaskNone + CBufBase* taskParam(NULL); + taskQueue->AddTaskL( task, + NULL, // callback when task completed + NULL, // task queue observer + 0, // Integer paramter, not used + taskParam, // task queue assumes ownership of taskParam + NULL, // Ptr data + NULL ); + taskQueue->Reset(); + delete taskQueue; + + FTRACE(FPrint(_L("CCommonTestClass::AddTaskCMPXTaskQueueL testing CMPXTaskQueue::AddTaskL end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::AddTaskCMPXTaskQueueL testing CMPXTaskQueue::AddTaskL end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::RemoveTaskCMPXTaskQueueL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::RemoveTaskCMPXTaskQueueL() + { + FTRACE(FPrint(_L("CCommonTestClass::RemoveTaskCMPXTaskQueueL testing CMPXTaskQueue::RemoveTask begin"))); + iLog->Log(_L("CCommonTestClass::RemoveTaskCMPXTaskQueueL testing CMPXTaskQueue::RemoveTask begin")); + TInt err = KErrNone; + + CMPXTaskQueue* taskQueue = CMPXTaskQueue::NewL(); + TInt task(0); //ETaskNone + CBufBase* taskParam(NULL); + taskQueue->AddTaskL( task, + this, // task queue observer + 0, // Integer paramter, not used + taskParam, // task queue assumes ownership of taskParam + NULL, // Ptr data + NULL, + NULL ); + + taskQueue->RemoveTask(this); + delete taskQueue; + + FTRACE(FPrint(_L("CCommonTestClass::RemoveTaskCMPXTaskQueueL testing CMPXTaskQueue::RemoveTask end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::RemoveTaskCMPXTaskQueueL testing CMPXTaskQueue::RemoveTask end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::CallbackCMPXTaskQueueL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CallbackCMPXTaskQueueL() + { + FTRACE(FPrint(_L("CCommonTestClass::CallbackCMPXTaskQueueL testing CMPXTaskQueue::Callback begin"))); + iLog->Log(_L("CCommonTestClass::CallbackCMPXTaskQueueL testing CMPXTaskQueue::Callback begin")); + TInt err = KErrNone; + + CMPXTaskQueue* taskQueue = CMPXTaskQueue::NewL(); + TInt task(0); //ETaskNone + CBufBase* taskParam(NULL); + taskQueue->AddTaskL( task, + this, // task queue observer + 0, // Integer paramter, not used + taskParam, // task queue assumes ownership of taskParam + NULL, // Ptr data + NULL, + NULL ); + + taskQueue->Callback(); + taskQueue->RemoveTask(this); + delete taskQueue; + + FTRACE(FPrint(_L("CCommonTestClass::CallbackCMPXTaskQueueL testing CMPXTaskQueue::Callback end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CallbackCMPXTaskQueueL testing CMPXTaskQueue::Callback end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::ParamCMPXTaskQueueL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::ParamCMPXTaskQueueL() + { + FTRACE(FPrint(_L("CCommonTestClass::ParamCMPXTaskQueueL testing CMPXTaskQueue::Param begin"))); + iLog->Log(_L("CCommonTestClass::ParamCMPXTaskQueueL testing CMPXTaskQueue::Param begin")); + TInt err = KErrNone; + + CMPXTaskQueue* taskQueue = CMPXTaskQueue::NewL(); + TInt task(0); //ETaskNone + CBufBase* taskParam(NULL); + taskQueue->AddTaskL( task, + this, // task queue observer + 0, // Integer paramter, not used + taskParam, // task queue assumes ownership of taskParam + NULL, // Ptr data + NULL, + NULL ); + + taskQueue->Param(); + taskQueue->RemoveTask(this); + delete taskQueue; + + FTRACE(FPrint(_L("CCommonTestClass::ParamCMPXTaskQueueL testing CMPXTaskQueue::Param end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::ParamCMPXTaskQueueL testing CMPXTaskQueue::Param end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::PtrDataCMPXTaskQueueL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::PtrDataCMPXTaskQueueL() + { + FTRACE(FPrint(_L("CCommonTestClass::ParamCMPXTaskQueueL testing CMPXTaskQueue::PtrData begin"))); + iLog->Log(_L("CCommonTestClass::ParamCMPXTaskQueueL testing CMPXTaskQueue::PtrData begin")); + TInt err = KErrNone; + + CMPXTaskQueue* taskQueue = CMPXTaskQueue::NewL(); + TInt task(0); //ETaskNone + CBufBase* taskParam(NULL); + taskQueue->AddTaskL( task, + this, // task queue observer + 0, // Integer paramter, not used + taskParam, // task queue assumes ownership of taskParam + NULL, // Ptr data + NULL, + NULL ); + + taskQueue->PtrData(); + taskQueue->RemoveTask(this); + delete taskQueue; + + FTRACE(FPrint(_L("CCommonTestClass::ParamCMPXTaskQueueL testing CMPXTaskQueue::PtrData end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::ParamCMPXTaskQueueL testing CMPXTaskQueue::PtrData end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::BufDataCMPXTaskQueueL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::BufDataCMPXTaskQueueL() + { + FTRACE(FPrint(_L("CCommonTestClass::BufDataCMPXTaskQueueL testing CMPXTaskQueue::BufData begin"))); + iLog->Log(_L("CCommonTestClass::BufDataCMPXTaskQueueL testing CMPXTaskQueue::BufData begin")); + TInt err = KErrNone; + + CMPXTaskQueue* taskQueue = CMPXTaskQueue::NewL(); + TInt task(0); //ETaskNone + CBufBase* taskParam(NULL); + taskQueue->AddTaskL( task, + this, // task queue observer + 0, // Integer paramter, not used + taskParam, // task queue assumes ownership of taskParam + NULL, // Ptr data + NULL, + NULL ); + + taskQueue->BufData(); + taskQueue->RemoveTask(this); + delete taskQueue; + + FTRACE(FPrint(_L("CCommonTestClass::BufDataCMPXTaskQueueL testing CMPXTaskQueue::BufData end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::BufDataCMPXTaskQueueL testing CMPXTaskQueue::BufData end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::RemoveTask2CMPXTaskQueueL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::RemoveTask2CMPXTaskQueueL() + { + FTRACE(FPrint(_L("CCommonTestClass::RemoveTask2CMPXTaskQueueL testing CMPXTaskQueue::RemoveTask begin"))); + iLog->Log(_L("CCommonTestClass::RemoveTask2CMPXTaskQueueL testing CMPXTaskQueue::RemoveTask begin")); + TInt err = KErrNone; + + CMPXTaskQueue* taskQueue = CMPXTaskQueue::NewL(); + TInt task(0); //ETaskNone + CBufBase* taskParam(NULL); + taskQueue->AddTaskL( task, + this, // task queue observer + 0, // Integer paramter, not used + taskParam, // task queue assumes ownership of taskParam + NULL, // Ptr data + NULL, + NULL ); + + taskQueue->RemoveTask(); + delete taskQueue; + + FTRACE(FPrint(_L("CCommonTestClass::RemoveTask2CMPXTaskQueueL testing CMPXTaskQueue::RemoveTask end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::RemoveTask2CMPXTaskQueueL testing CMPXTaskQueue::RemoveTask end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::TaskCMPXTaskQueueL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::TaskCMPXTaskQueueL() + { + FTRACE(FPrint(_L("CCommonTestClass::TaskCMPXTaskQueueL testing CMPXTaskQueue::Task begin"))); + iLog->Log(_L("CCommonTestClass::TaskCMPXTaskQueueL testing CMPXTaskQueue::Task begin")); + TInt err = KErrNone; + + CMPXTaskQueue* taskQueue = CMPXTaskQueue::NewL(); + TInt task(0); //ETaskNone + CBufBase* taskParam(NULL); + taskQueue->AddTaskL( task, + this, // task queue observer + 0, // Integer paramter, not used + taskParam, // task queue assumes ownership of taskParam + NULL, // Ptr data + NULL, + NULL ); + + taskQueue->Task(); + delete taskQueue; + + FTRACE(FPrint(_L("CCommonTestClass::TaskCMPXTaskQueueL testing CMPXTaskQueue::Task end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::TaskCMPXTaskQueueL testing CMPXTaskQueue::Task end err=%d"), err); + return err; + } +void CCommonTestClass::ExecuteTask(TInt /*aTask*/, TInt /*aParamData*/, + TAny* /*aPtrData*/, + const CBufBase& /*aBuf*/, + TAny* /*aCallback*/, + CBase* /*aCObject1*/, + CBase* /*aCObject2*/) + { + FTRACE(FPrint(_L("CCommonTestClass::ExecuteTask is called"))); + iLog->Log(_L("CCommonTestClass::ExecuteTask is called")); + } +//----------------------------------------------------------------------------- +// CCommonTestClass::CreateCMPXTaskQueue() +// Returns: Symbian OS errors. +// add CreateCMPXTaskQueue to testmpxactivetaskqueue.cpp +//----------------------------------------------------------------------------- + +TInt CCommonTestClass::CreateCMPXTaskQueue() + { + FTRACE(FPrint(_L("CCommonTestClass::CreateCMPXTaskQueue testing CMPXTaskQueue::NewL() begin"))); + iLog->Log(_L("CCommonTestClass::CreateCMPXTaskQueue testing CMPXTaskQueue::NewL() begin")); + TInt err = KErrNone; + CMPXTaskQueue* taskQueue = NULL; + TRAP(err, taskQueue = CMPXTaskQueue::NewL()); + if ( taskQueue == NULL) + { + err = KErrNotFound; + } + delete taskQueue; + FTRACE(FPrint(_L("CCommonTestClass::CreateCMPXTaskQueue testing CMPXTaskQueue::NewL() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CreateCMPXTaskQueue testing CMPXTaskQueue::NewL() end err=%d"), err); + return err; + } +//----------------------------------------------------------------------------- +// CCommonTestClass::DeleteCMPXTaskQueue() +// Returns: Symbian OS errors. +// add CreateCMPXTaskQueue to testmpxactivetaskqueue.cpp +//----------------------------------------------------------------------------- +TInt CCommonTestClass::DeleteCMPXTaskQueue() + { + FTRACE(FPrint(_L("CCommonTestClass::DeleteCMPXTaskQueue testing CMPXTaskQueue::~ begin"))); + iLog->Log(_L("CCommonTestClass::DeleteCMPXTaskQueue testing CMPXTaskQueue::~ begin")); + TInt err = KErrNone; + CMPXTaskQueue* taskQueue = NULL; + TRAP(err , taskQueue = CMPXTaskQueue::NewL()); + delete taskQueue; + taskQueue=NULL; + FTRACE(FPrint(_L("CCommonTestClass::DeleteCMPXTaskQueue testing CMPXTaskQueue::~ end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::DeleteCMPXTaskQueue testing CMPXTaskQueue::~ end err=%d"), err); + return err; + } +//----------------------------------------------------------------------------- +// CCommonTestClass::ScheduleNextTaskCMPXTaskQueue() +// Returns: Symbian OS errors. +// add ScheduleNextTaskCMPXTaskQueue to testmpxactivetaskqueue.cpp +//----------------------------------------------------------------------------- +TInt CCommonTestClass::ScheduleNextTaskCMPXTaskQueue() + { + FTRACE(FPrint(_L("CCommonTestClass::ScheduleNextTaskCMPXTaskQueue testing CMPXTaskQueue::ScheduleNextTask begin"))); + iLog->Log(_L("CCommonTestClass::ScheduleNextTaskCMPXTaskQueue testing CMPXTaskQueue::ScheduleNextTask begin")); + TInt err = KErrNone; + CMPXActiveTaskQueue* taskQueue = NULL; + TRAP(err , taskQueue = CMPXActiveTaskQueue::NewL()); + taskQueue->ScheduleNextTask(); + delete taskQueue; + FTRACE(FPrint(_L("CCommonTestClass::ScheduleNextTaskCMPXTaskQueue testing CMPXTaskQueue::ScheduleNextTask end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::ScheduleNextTaskCMPXTaskQueue testing CMPXTaskQueue::ScheduleNextTask end err=%d"), err); + return err; + } +//----------------------------------------------------------------------------- +// CCommonTestClass::ResetCMPXTaskQueue() +// Returns: Symbian OS errors. +// add ResetCMPXTaskQueue to testmpxactivetaskqueue.cpp +//----------------------------------------------------------------------------- +TInt CCommonTestClass::ResetCMPXTaskQueue() + { + FTRACE(FPrint(_L("CCommonTestClass::ResetCMPXTaskQueue testing CMPXTaskQueue::Reset begin"))); + iLog->Log(_L("CCommonTestClass::ResetCMPXTaskQueue testing CMPXTaskQueue::Reset begin")); + TInt err = KErrNone; + CMPXTaskQueue* taskQueue = NULL; + TRAP(err , taskQueue = CMPXTaskQueue::NewL()); + TInt task(0); //ETaskNone + CBufBase* taskParam(NULL); + TRAP(err, taskQueue->AddTaskL( task, + NULL, // callback when task completed + NULL, // task queue observer + 0, // Integer paramter, not used + taskParam, // task queue assumes ownership of taskParam + NULL, // Ptr data + NULL )); + taskQueue->Reset(); + delete taskQueue; + FTRACE(FPrint(_L("CCommonTestClass::ResetCMPXTaskQueue testing CMPXTaskQueue::Reset end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::ResetCMPXTaskQueue testing CMPXTaskQueue::Reset end err=%d"), err); + return err; + } +//----------------------------------------------------------------------------- +// CCommonTestClass::DeleteCMPXActiveTaskQueue() +// Returns: Symbian OS errors. +// add DeleteCMPXActiveTaskQueue to testmpxactivetaskqueue.cpp +//----------------------------------------------------------------------------- + +TInt CCommonTestClass::DeleteCMPXActiveTaskQueue() + { + FTRACE(FPrint(_L("CCommonTestClass::DeleteCMPXActiveTaskQueue testing CMPXTaskQueue::~CMPXActiveTaskQueue begin"))); + iLog->Log(_L("CCommonTestClass::DeleteCMPXActiveTaskQueue testing CMPXTaskQueue::~CMPXActiveTaskQueue begin")); + TInt err = KErrNone; + CMPXActiveTaskQueue* taskQueue = NULL; + TRAP(err , taskQueue = CMPXActiveTaskQueue::NewL()); + delete taskQueue; + taskQueue=NULL; + FTRACE(FPrint(_L("CCommonTestClass::DeleteCMPXActiveTaskQueue testing CMPXTaskQueue::~CMPXActiveTaskQueue end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::DeleteCMPXActiveTaskQueue testing CMPXTaskQueue::~CMPXActiveTaskQueue end err=%d"), err); + return err; + } + \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxattribute.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxattribute.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,595 @@ +/* +* 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: TMPXAttribute testing implementation +* +*/ + + +#include +#include "commontestclass.h" + +// Begin TMPXAttribute testing implementation (mpxattribute.h)======================================= + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxAttDefaultConst() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxAttDefaultConst(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxAttDefaultConst testing TMPXAttribute::TMPXAttribute() begin"))); + iLog->Log(_L("CCommonTestClass::MpxAttDefaultConst testing TMPXAttribute::TMPXAttribute() begin")); + TInt err=KErrNone; + TMPXAttribute att; + err = iMPXAttArray.Append(att); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxAttConst() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxAttConst(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxAttConst testing TMPXAttribute::TMPXAttribute(TInt aContentId, TUint aAttributeId) begin"))); + iLog->Log(_L("CCommonTestClass::MpxAttConst testing TMPXAttribute::TMPXAttribute(TInt aContentId, TUint aAttributeId) begin")); + TInt err=KErrNone; + TInt contentId; + TUint attId; + + // read in parameters + if ( aItem.GetNextInt(contentId) ) + { + iLog->Log(_L("Missing Parameter: content ID.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(attId) ) + { + iLog->Log(_L("Missing Parameter: attribute ID.")); + return KErrBadTestParameter; + } + + TMPXAttribute att(contentId, attId); + err = iMPXAttArray.Append(att); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxAttCopyConstAtt() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxAttCopyConstAtt(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxAttCopyConstAtt testing TMPXAttribute::TMPXAttribute(const TMPXAttribute& aId) begin"))); + iLog->Log(_L("CCommonTestClass::MpxAttCopyConstAtt testing TMPXAttribute::TMPXAttribute(const TMPXAttribute& aId) begin")); + TInt err=KErrNone; + TInt contentId; + TUint attId; + + // read in parameters + if ( aItem.GetNextInt(contentId) ) + { + iLog->Log(_L("Missing Parameter: content ID.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(attId) ) + { + iLog->Log(_L("Missing Parameter: attribute ID.")); + return KErrBadTestParameter; + } + + TMPXAttribute tempAtt(contentId, attId); + TMPXAttribute att(tempAtt); + err = iMPXAttArray.Append(att); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxAttCopyConstAttData() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxAttCopyConstAttData(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxAttCopyConstAttData testing TMPXAttribute::TMPXAttribute(const TMPXAttributeData& aData) begin"))); + iLog->Log(_L("CCommonTestClass::MpxAttCopyConstAttData testing TMPXAttribute::TMPXAttribute(const TMPXAttributeData& aData) begin")); + TInt err=KErrNone; + TInt contentId; + TUint attId; + + // read in parameters + if ( aItem.GetNextInt(contentId) ) + { + iLog->Log(_L("Missing Parameter: content ID.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(attId) ) + { + iLog->Log(_L("Missing Parameter: attribute ID.")); + return KErrBadTestParameter; + } + + TMPXAttributeData attData; + attData.iContentId = contentId; + attData.iAttributeId = attId; + TMPXAttribute att(attData); + err = iMPXAttArray.Append(att); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxAttOperatorAssignment() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxAttOperatorAssignment(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxAttOperatorAssignment testing TMPXAttribute::operator=(const TMPXAttribute& aId) begin"))); + iLog->Log(_L("CCommonTestClass::MpxAttOperatorAssignment testing TMPXAttribute::operator=(const TMPXAttribute& aId) begin")); + TInt err=KErrNone; + TInt index; + + // read in parameters + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: index.")); + return KErrBadTestParameter; + } + if ( index >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: Index out of range.")); + return KErrBadTestParameter; + } + + TMPXAttribute att; + att.operator =(iMPXAttArray[index]); + // verify assignment was correct + if ( !TMPXAttribute::Match(att, iMPXAttArray[index]) ) + { + iLog->Log(_L("Verification failed.")); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxAttOperatorEqual() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxAttOperatorEqual(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxAttOperatorEqual testing TMPXAttribute::operator==(const TMPXAttribute& aId) begin"))); + iLog->Log(_L("CCommonTestClass::MpxAttOperatorEqual testing TMPXAttribute::operator==(const TMPXAttribute& aId) begin")); + TInt err=KErrNone; + TUint op1; + TUint op2; + TBool expectedResult; + + // read in parameters + if ( aItem.GetNextInt(op1) ) + { + iLog->Log(_L("Missing Parameter: operand 1.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(op2) ) + { + iLog->Log(_L("Missing Parameter: operand 2.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(expectedResult) ) + { + iLog->Log(_L("Missing Parameter: expected result.")); + return KErrBadTestParameter; + } + if ( (op1>=iMPXAttArray.Count()) || + (op2>=iMPXAttArray.Count()) ) + { + iLog->Log(_L("Bad Parameter: operand out of range.")); + return KErrBadTestParameter; + } + + TBool result = iMPXAttArray[op1].operator ==(iMPXAttArray[op2]); + if ( result != expectedResult ) + { + iLog->Log(_L("Verification failed: result=%d, expected result=%d."), result, expectedResult); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxAttStreamingL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxAttStreamingL(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxAttStreamingL testing TMPXAttribute ExternalizeL and InternalizeL begin"))); + iLog->Log(_L("CCommonTestClass::MpxAttStreamingL testing TMPXAttribute ExternalizeL and InternalizeL begin")); + TInt err=KErrNone; + TUint index; + + // read in parameters + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: index.")); + return KErrBadTestParameter; + } + if ( index >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: index out of range.")); + return KErrBadTestParameter; + } + + FTRACE(FPrint(_L("CCommonTestClass::MpxAttStreamingL started ExternalizeL"))); + iLog->Log(_L("CCommonTestClass::MpxAttStreamingL started ExternalizeL")); + CBufBase* buffer = CBufFlat::NewL( 50 ); + CleanupStack::PushL( buffer ); + RBufWriteStream writeStream( *buffer ); + CleanupClosePushL( writeStream ); + iMPXAttArray[index].ExternalizeL( writeStream ); + writeStream.CommitL(); + buffer->Compress(); + CleanupStack::PopAndDestroy( &writeStream ); + + FTRACE(FPrint(_L("CCommonTestClass::MpxAttStreamingL started InternalizeL"))); + iLog->Log(_L("CCommonTestClass::MpxAttStreamingL started InternalizeL")); + RBufReadStream readStream( *buffer ); + CleanupClosePushL( readStream ); + TMPXAttribute att; + att.InternalizeL( readStream ); + CleanupStack::PopAndDestroy( &readStream ); + CleanupStack::PopAndDestroy( buffer ); + + // verify streaming was correct + if ( !TMPXAttribute::Match(att, iMPXAttArray[index]) ) + { + iLog->Log(_L("Streaming Failed Verification.")); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxAttContentId() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxAttContentId(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxAttContentId testing TMPXAttribute::ContentId() begin"))); + iLog->Log(_L("CCommonTestClass::MpxAttContentId testing TMPXAttribute::ContentId() begin")); + TInt err=KErrNone; + TUint index; + TInt expectedContentId; + TInt contentId; + + // read in parameters + if ( aItem.GetNextInt(expectedContentId) ) + { + iLog->Log(_L("Missing Parameter: content ID.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: index.")); + return KErrBadTestParameter; + } + if ( index >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: index out of range.")); + return KErrBadTestParameter; + } + + contentId = iMPXAttArray[index].ContentId(); + // verification + if ( contentId != expectedContentId ) + { + iLog->Log(_L("Verification Failed: contentId=%d, expectedContentId=%d."), contentId, expectedContentId); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxAttAttributeId() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxAttAttributeId(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxAttAttributeId testing TMPXAttribute::AttributeId() begin"))); + iLog->Log(_L("CCommonTestClass::MpxAttAttributeId testing TMPXAttribute::AttributeId() begin")); + TInt err=KErrNone; + TUint index; + TInt expectedAttId; + TInt attId; + + // read in parameters + if ( aItem.GetNextInt(expectedAttId) ) + { + iLog->Log(_L("Missing Parameter: attribute ID.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: index.")); + return KErrBadTestParameter; + } + if ( index >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: index out of range.")); + return KErrBadTestParameter; + } + + attId = iMPXAttArray[index].AttributeId(); + // verification + if ( attId != expectedAttId ) + { + iLog->Log(_L("Verification Failed: attId=%d, expectedAttId=%d."), attId, expectedAttId); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxAttMatch() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxAttMatch(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxAttMatch testing TMPXAttribute::Match() begin"))); + iLog->Log(_L("CCommonTestClass::MpxAttMatch testing TMPXAttribute::Match() begin")); + TInt err=KErrNone; + TUint index1; + TUint index2; + TBool expectedResult; + TBool result; + + // read in parameters + if ( aItem.GetNextInt(index1) ) + { + iLog->Log(_L("Missing Parameter: index 1.")); + return KErrBadTestParameter; + } + if ( index1 >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: index 1 out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(index2) ) + { + iLog->Log(_L("Missing Parameter: index 2.")); + return KErrBadTestParameter; + } + if ( index2 >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: index 2 out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(expectedResult) ) + { + iLog->Log(_L("Missing Parameter: expected result.")); + return KErrBadTestParameter; + } + + result = TMPXAttribute::Match(iMPXAttArray[index1], iMPXAttArray[index2]); + // verification + if ( result != expectedResult ) + { + iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxAttMatchContentId() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxAttMatchContentId(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxAttMatchContentId testing TMPXAttribute::MatchContentId() begin"))); + iLog->Log(_L("CCommonTestClass::MpxAttMatchContentId testing TMPXAttribute::MatchContentId() begin")); + TInt err=KErrNone; + TUint index1; + TUint index2; + TBool expectedResult; + TBool result; + + // read in parameters + if ( aItem.GetNextInt(index1) ) + { + iLog->Log(_L("Missing Parameter: index 1.")); + return KErrBadTestParameter; + } + if ( index1 >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: index 1 out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(index2) ) + { + iLog->Log(_L("Missing Parameter: index 2.")); + return KErrBadTestParameter; + } + if ( index2 >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: index 2 out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(expectedResult) ) + { + iLog->Log(_L("Missing Parameter: expected result.")); + return KErrBadTestParameter; + } + + result = TMPXAttribute::MatchContentId(iMPXAttArray[index1], iMPXAttArray[index2]); + // verification + if ( result != expectedResult ) + { + iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxAttOperatorAndAttData() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxAttOperatorAndAttData(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxAttOperatorAndAttData testing TMPXAttribute::operator& (const TMPXAttributeData& aData) begin"))); + iLog->Log(_L("CCommonTestClass::MpxAttOperatorAndAttData testing TMPXAttribute::operator& (const TMPXAttributeData& aData) begin")); + TInt err=KErrNone; + TUint index1; + TUint index2; + TBool expectedResult; + TBool result; + + // read in parameters + if ( aItem.GetNextInt(index1) ) + { + iLog->Log(_L("Missing Parameter: index 1.")); + return KErrBadTestParameter; + } + if ( index1 >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: index 1 out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(index2) ) + { + iLog->Log(_L("Missing Parameter: index 2.")); + return KErrBadTestParameter; + } + if ( index2 >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: index 2 out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(expectedResult) ) + { + iLog->Log(_L("Missing Parameter: expected result.")); + return KErrBadTestParameter; + } + + TMPXAttributeData data1 = {iMPXAttArray[index1].ContentId(), iMPXAttArray[index1].AttributeId()}; + TMPXAttributeData data2 = {iMPXAttArray[index2].ContentId(), iMPXAttArray[index2].AttributeId()}; + result = data1 & data2; + // verification + if ( result != expectedResult ) + { + iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxAttOperatorAndData() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxAttOperatorAndData(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxAttOperatorAndData testing TMPXAttribute::operator& (TUint& aData) begin"))); + iLog->Log(_L("CCommonTestClass::MpxAttOperatorAndData testing TMPXAttribute::operator& (TUint& aData) begin")); + TInt err=KErrNone; + TUint index1; + TUint att; + TBool expectedResult; + TBool result; + + // read in parameters + if ( aItem.GetNextInt(index1) ) + { + iLog->Log(_L("Missing Parameter: index 1.")); + return KErrBadTestParameter; + } + if ( index1 >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: index 1 out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(att) ) + { + iLog->Log(_L("Missing Parameter: attribute.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(expectedResult) ) + { + iLog->Log(_L("Missing Parameter: expected result.")); + return KErrBadTestParameter; + } + + TMPXAttributeData data1 = {iMPXAttArray[index1].ContentId(), iMPXAttArray[index1].AttributeId()}; + result = data1 & att; + // verification + if ( result != expectedResult ) + { + iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxAttOperatorOr() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxAttOperatorOr(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxAttOperatorOr testing TMPXAttribute::operator| () begin"))); + iLog->Log(_L("CCommonTestClass::MpxAttOperatorOr testing TMPXAttribute::operator| () begin")); + TInt err=KErrNone; + TUint index1; + TUint index2; + TUint expectedAtt; + TMPXAttributeData result; + + // read in parameters + if ( aItem.GetNextInt(index1) ) + { + iLog->Log(_L("Missing Parameter: index 1.")); + return KErrBadTestParameter; + } + if ( index1 >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: index 1 out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(index2) ) + { + iLog->Log(_L("Missing Parameter: index 2.")); + return KErrBadTestParameter; + } + if ( index2 >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: index 2 out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(expectedAtt) ) + { + iLog->Log(_L("Missing Parameter: expected result.")); + return KErrBadTestParameter; + } + + TMPXAttributeData data1 = {iMPXAttArray[index1].ContentId(), iMPXAttArray[index1].AttributeId()}; + TMPXAttributeData data2 = {iMPXAttArray[index2].ContentId(), iMPXAttArray[index2].AttributeId()}; + result = data1 | data2; + // verification + if ( result.iAttributeId != expectedAtt ) + { + iLog->Log(_L("Verification Failed: att=%d, expectedAtt=%d."), result.iAttributeId, expectedAtt); + err = KErrUnexpectedValue; + } + return err; + } + +// end of TMPXAttribute (mpxattribute.h ============================================= diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxclientlist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxclientlist.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,501 @@ +/* +* 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: MPXClientList testing implementation +* +*/ + + +#include +#include "commontestclass.h" +#include +#include +#include +#include + +#include "mpxsubscriptiondefs.h" //added on 2009,2,12 +#include //added on 2009,2,12 + + +// Begin MPXClientList testing implementation (mpxclientlist.h)============================ + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxClientListNewL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxClientListNewL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxClientListNewL testing CMPXClientList::NewL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxClientListNewL testing CMPXClientList::NewL() begin")); + TInt err=KErrNone; + if ( iClientList ) + { + delete iClientList; + iClientList = NULL; + } + iClientList = CMPXClientList::NewL(); + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxClientListD() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxClientListDestruction(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxClientListDestruction testing CMPXClientList::~ begin"))); + iLog->Log(_L("CCommonTestClass::MpxClientListDestruction testing CMPXClientList::~ begin")); + TInt err=KErrNone; + + delete iClientList; + iClientList = NULL; + + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxClientListClientCount() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxClientListClientCount(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxClientListClientCount testing CMPXClientList::ClientCount() begin"))); + iLog->Log(_L("CCommonTestClass::MpxClientListClientCount testing CMPXClientList::ClientCount() begin")); + TInt err=KErrNone; + TInt expectedCount; + + // read in parameters + if ( aItem.GetNextInt(expectedCount) ) + { + iLog->Log(_L("Missing Parameter: Expected count.")); + return KErrBadTestParameter; + } + if ( !iClientList ) + { + iLog->Log(_L("Error: MPXClientList not created.")); + return KErrBadTestParameter; + } + + TInt count = iClientList->ClientCount(); + // verification + if ( count != expectedCount ) + { + iLog->Log(_L("Verification Failed: count=%d, expectedCount=%d."), count, expectedCount); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxClientListIsClient() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxClientListIsClient(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxClientListIsClient testing CMPXClientList::IsClient() begin"))); + iLog->Log(_L("CCommonTestClass::MpxClientListIsClient testing CMPXClientList::IsClient() begin")); + TInt err=KErrNone; + TBool expectedResult; + TThreadId threadId = 2222; + + // read in parameters + if ( aItem.GetNextInt(expectedResult) ) + { + iLog->Log(_L("Missing Parameter: Expected result.")); + return KErrBadTestParameter; + } + if ( !iClientList ) + { + iLog->Log(_L("Error: MPXClientList not created.")); + return KErrBadTestParameter; + } + + TBool result = iClientList->IsClient(threadId); + // verification + if ( result != expectedResult ) + { + iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxClientListFindByMsg() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxClientListFindByMsg(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxClientListFindByMsg testing CMPXClientList::Find() begin"))); + iLog->Log(_L("CCommonTestClass::MpxClientListFindByMsg testing CMPXClientList::Find() begin")); + TInt err=KErrNone; + TBool expectedResult; + + // read in parameters + if ( aItem.GetNextInt(expectedResult) ) + { + iLog->Log(_L("Missing Parameter: Expected result.")); + return KErrBadTestParameter; + } + if ( !iClientList ) + { + iLog->Log(_L("Error: MPXClientList not created.")); + return KErrBadTestParameter; + } + if ( !iMessageQueue ) + { + iLog->Log(_L("Error: MPXMsgQueue not created.")); + return KErrBadTestParameter; + } + + TBool result = iClientList->Find(*iMessageQueue); + // verification + if ( result != expectedResult ) + { + iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxClientListFindById() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxClientListFindById(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxClientListFindById testing CMPXClientList::Find() begin"))); + iLog->Log(_L("CCommonTestClass::MpxClientListFindById testing CMPXClientList::Find() begin")); + TInt err=KErrNone; + TThreadId threadId = 2222; + TBool expectedResult; + + // read in parameters + if ( aItem.GetNextInt(expectedResult) ) + { + iLog->Log(_L("Missing Parameter: Expected result.")); + return KErrBadTestParameter; + } + if ( !iClientList ) + { + iLog->Log(_L("Error: MPXClientList not created.")); + return KErrBadTestParameter; + } + + TBool result = iClientList->Find(threadId); + // verification + if ( result != expectedResult ) + { + iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult); + err = KErrUnexpectedValue; + } + return err; + } + +// To test the destruction function of CCommonTestClass +TInt CCommonTestClass::DeleteMpxClientList() + { + FTRACE(FPrint(_L("CCommonTestClass::DeleteMpxClientList testing CMPXClientList::~CMPXClientList() begin"))); + iLog->Log(_L("CCommonTestClass::DeleteMpxClientList testing CMPXClientList::~CMPXClientList() begin")); + TInt err=KErrNone; + + delete iClientList; + iClientList = NULL; + + FTRACE(FPrint(_L("CCommonTestClass::DeleteMpxClientList testing CMPXClientList::~CMPXClientList() end err=%d"),err)); + iLog->Log(_L("CCommonTestClass::DeleteMpxClientList testing CMPXClientList::~CMPXClientList() end err=%d"),err); + + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxClientListAddClientL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxClientListAddClientL() + { + FTRACE(FPrint(_L("CCommonTestClass::MpxClientListAddClient testing CMPXClientList::AddClientL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxClientListAddClietn testing CMPXClientList::AddClientL() begin")); + iClientList = CMPXClientList::NewL(); + if ( !iClientList ) + { + iLog->Log(_L("Error: MPXClientList not created.")); + return KErrBadTestParameter; + } + + if ( !iMessageQueue ) + { + iMessageQueue = CMPXMessageQueue::NewL(); + } + TRAPD(err, iClientList->AddClientL( RThread().Id(), iMessageQueue )); + return err; + } +//To test CMPXClientList::AddClientL(TThreadId aId,TInt aMode,CMPXMessageQueue* aMsgQueue); +// Returns: Symbian OS errors. +TInt CCommonTestClass::MpxClientListAddClientLUsingMode() + { + FTRACE(FPrint(_L("CCommonTestClass::MpxClientListAddClientLUsingMode testing CMPXClientList::AddClientL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxClientListAddClientLUsingMode testing CMPXClientList::AddClientL() begin")); + TThreadId threadId = RThread().Id();// 2222; + TInt err = KErrNone; + TRAP(err , iClientList = CMPXClientList::NewL()); + if ( !iClientList ) + { + iLog->Log(_L("Error: MPXClientList not created.")); + return KErrBadTestParameter; + } + + if ( !iMessageQueue ) + { + TRAPD(err,iMessageQueue = CMPXMessageQueue::NewL()); + } + TRAP(err,iClientList->AddClientL(threadId,KErrUnknown,iMessageQueue)); + return err; + } + +//To test CMPXClientList::RemoveClient(TInt aIndex) +// Returns: Symbian OS errors. +TInt CCommonTestClass::MpxClientListRemoveClient() + { + FTRACE(FPrint(_L("CCommonTestClass::MpxClientListRemoveClient testing CMPXClientList::RemoveClient(TInt aIndex) begin"))); + iLog->Log(_L("CCommonTestClass::MpxClientListRemoveClient testing CMPXClientList::RemoveClient(TInt aIndex) begin")); + + TInt iIndex = 0; + TRAPD(err,iClientList->RemoveClient(iIndex)); + + return err; + } + +//To test CMPXClientList::ClientProcessList() +// Returns: Symbian OS errors. +TInt CCommonTestClass::MpxClientListClientProcessList() + { + FTRACE(FPrint(_L("CCommonTestClass::MpxClientListClientProcessList testing CMPXClientList::ClientProcessList() begin"))); + iLog->Log(_L("CCommonTestClass::MpxClientListClientProcessList testing CMPXClientList::ClientProcessList() begin")); + + TInt err = KErrNone; + TArray iClientProcess = iClientList->ClientProcessList(); + + FTRACE(FPrint(_L("CCommonTestClass::MpxClientListClientProcessList testing CMPXClientList::ClientProcessList() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::MpxClientListClientProcessList testing CMPXClientList::ClientProcessList() end err=%d"), err); + + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxClientListClientMode() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxClientListClientMode(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxClientListClientMode testing CMPXClientList::ClientMode() begin"))); + iLog->Log(_L("CCommonTestClass::MpxClientListClientMode testing CMPXClientList::ClientMode() begin")); + TInt err=KErrNone; + TInt aIndex=0; + if ( !iClientList ) + { + iLog->Log(_L("Error: MPXClientList not created.")); + return KErrBadTestParameter; + } + + iClientList->ClientMode(aIndex); + + iLog->Log(_L("CMPXClientList::ClientMode() return"),err); + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxClientListSendMsg() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxClientListSendMsg(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxClientListSendMsg testing CMPXClientList::SendMsg() begin"))); + iLog->Log(_L("CCommonTestClass::MpxClientListSendMsg testing CMPXClientList::SendMsg() begin")); + TInt err=KErrNone; + CMPXMessage* aMsg(NULL); + TInt aError=KErrNone; + if ( !iClientList ) + { + iLog->Log(_L("Error: MPXClientList not created.")); + return KErrBadTestParameter; + } + iClientList->SendMsg(aMsg,aError); + iLog->Log(_L("CMPXClientList::SendMsg() return"),err); + return err; + + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxClientListSendMsgaIndex() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxClientListSendMsgaIndex(CStifItemParser& /*aItem*/) + + { + FTRACE(FPrint(_L("CCommonTestClass::MpxClientListSendMsgaIndex testing CMPXClientList::SendMsg() begin"))); + iLog->Log(_L("CCommonTestClass::MpxClientListSendMsgaIndex testing CMPXClientList::SendMsg() begin")); + TInt err=KErrNone; + TInt aError=KErrNone; + TInt aIndex=0; + TMPXMessage message; + message = TMPXPlaybackMessage(static_cast(KMPXMessageContentIdGeneral), + EMPXMessageGeneralId, + KMPXMessagePbMediaChanged); + if ( iClientList== NULL ) + { + iLog->Log(_L("Error: MPXClientList not created.")); + return KErrBadTestParameter; + } + CMPXMessage* cmp = iClientList->ConvertMsgLC(message); + TRAP(err,iClientList->SendMsg(aIndex, cmp, KErrNone)); + CleanupStack::PopAndDestroy(cmp); + iLog->Log(_L("CMPXClientList::SendMsg() return"),err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::SendMsgLByMsgCMPXClientList() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::SendMsgLByMsgCMPXClientList(CStifItemParser&) + { + FTRACE(FPrint(_L("CCommonTestClass::SendMsgLByMsgCMPXClientList testing CMPXClientList::SendMsgL(const TMPXMessage& aMsg) begin"))); + iLog->Log(_L("CCommonTestClass::SendMsgLByMsgCMPXClientList testing CMPXClientList::SendMsgL(const TMPXMessage& aMsg) begin")); + TInt err= KErrNone; + TMPXMessage aMsg; //=TMPXMessage::TMPXMessage(); + // TInt aError=KErrNone; + if ( !iClientList ) + { + iLog->Log(_L("Error: MPXClientList not created.")); + return KErrBadTestParameter; + } + TRAP(err,iClientList->SendMsgL(aMsg)); + if(err!=KErrNone) + { + iLog->Log(_L("CMPXClientList::SendMsgL() return"),err); + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MPXClientListConvertMsgLC() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MPXClientListConvertMsgLC(CStifItemParser& ) + { + FTRACE(FPrint(_L("CCommonTestClass::MPXClientListConvertMsgLC testing CMPXClientList::ConvertMsgLC() begin"))); + iLog->Log(_L("CCommonTestClass::MPXClientListConvertMsgLC testing CMPXClientList::ConvertMsgLC() begin")); + TInt err=KErrNone; + //TMPXMessage aMsg =TMPXMessage::TMPXMessage(); + TMPXMessage message; + message = TMPXPlaybackMessage(static_cast(KMPXMessageContentIdGeneral), + EMPXMessageGeneralId, + KMPXMessagePbMediaChanged); + if ( iClientList== NULL ) + { + iLog->Log(_L("Error: MPXClientList not created.")); + return KErrBadTestParameter; + } + CMPXMessage* cmp = iClientList->ConvertMsgLC(message); + CleanupStack::PopAndDestroy(cmp); + iLog->Log(_L("CMPXClientList::ConvertMsgLC() return"),err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::SendMsgLIndexAndTMPMsgCMPXClientList() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::SendMsgLIndexAndTMPMsgCMPXClientList(CStifItemParser&) + { + FTRACE(FPrint(_L("CCommonTestClass::SendMsgLIndexAndTMPMsgCMPXClientList testing CMPXClientList::SendMsgL(TInt aIndex, const TMPXMessage& aMsg) begin"))); + iLog->Log(_L("CCommonTestClass::SendMsgLIndexAndTMPMsgCMPXClientList testing CMPXClientList::SendMsgL(TInt aIndex, const TMPXMessage& aMsg) begin")); + TInt err= KErrNone; + TInt index = 0; + TMPXMessage aMsg ;//=TMPXMessage::TMPXMessage(); + + if ( !iClientList ) + { + iLog->Log(_L("Error: MPXClientList not created.")); + return KErrBadTestParameter; + } + + TRAP(err,iClientList->SendMsgL(index,aMsg)); + + if(err!=KErrNone) + { + iLog->Log(_L("CMPXClientList::SendMsgL() return"),err); + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxClientListAddSubscriptionL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxClientListAddSubscriptionL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxClientListAddSubscriptionL testing CMPXClientList::AddSubscriptionL(TInt aIndex,CMPXSubscription* aSubscription) begin"))); + iLog->Log(_L("CCommonTestClass::MpxClientListAddSubscriptionL testing CMPXClientList::AddSubscriptionL(TInt aIndex,CMPXSubscription* aSubscription) begin")); + TInt err= KErrNone; + + TInt index = 0; + iClientList->AddSubscriptionL(index,iSubscription); + + if(err!=KErrNone) + { + iLog->Log(_L("CMPXClientList::AddSubscriptionL() return"),err); + } + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxClientListRemoveSubscriptionL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxClientListRemoveSubscriptionL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxClientListRemoveSubscriptionL testing CMPXClientList::RemoveSubscriptionL(TInt aIndex,CMPXSubscription* aSubscription) begin"))); + iLog->Log(_L("CCommonTestClass::MpxClientListRemoveSubscriptionL testing CMPXClientList::RemoveSubscriptionL(TInt aIndex,CMPXSubscription* aSubscription) begin")); + TInt err= KErrNone; + + TInt index = 0; + TRAP(err,iClientList->RemoveSubscriptionL(index,*iSubscription)); + //iClientList->RemoveSubscriptionL(index,*iSubscription); + + if(err!=KErrNone) + { + iLog->Log(_L("CMPXClientList::RemoveSubscriptionL() return"),err); + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxClientListRemoveSubscriptionL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxClientListRemoveAllSubscriptionsL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxClientListRemoveAllSubscriptionsL testing CMPXClientList::RemoveAllSubscriptionsL(TInt aIndex) begin"))); + iLog->Log(_L("CCommonTestClass::MpxClientListRemoveAllSubscriptionsL testing CMPXClientList::RemoveAllSubscriptionsL(TInt aIndex) begin")); + TInt err= KErrNone; + + TInt index = 0; + //iClientList->RemoveAllSubscriptionsL(index); + TRAP(err,iClientList->RemoveAllSubscriptionsL(index)); + + if(err!=KErrNone) + { + iLog->Log(_L("CMPXClientList::RemoveSubscriptionL() return error %d."),err); + } + return err; + } + +// end of MPXClientList testing implementation (mpxclientlist.h)=========================== diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxcollectionpath.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxcollectionpath.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,1320 @@ +/* +* 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: MPXCollectionPath testing implementation (mpxcollectionpath.h) +* +*/ + + +#include +#include +#include "commontestclass.h" + +// Begin MPXCollectionPath testing implementation mpxcollectionpath.h================================ + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxItemIdConst() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxItemIdConst(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxItemIdConst testing TMPXItemId::TMPXItemId() begin"))); + iLog->Log(_L("CCommonTestClass::MpxItemIdConst testing TMPXItemId::TMPXItemId() begin")); + TInt err=KErrNone; + TUint id1; + TUint id2; + TUint numParam=0; + TMPXItemId item; + + // read in parameters + if ( aItem.GetNextInt(id1) == KErrNone ) + { + numParam++; + if ( aItem.GetNextInt(id2) == KErrNone ) + { + numParam++; + } + } + + switch (numParam) + { + case 1: + item.iId1 = item.iId2 = id1; + break; + case 2: + item.iId1 = id1; + item.iId2 = id2; + break; + } + + iMPXItemIdArray.Append(item); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxItemIdReset() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxItemIdReset(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxItemIdReset begin"))); + iLog->Log(_L("CCommonTestClass::MpxItemIdReset begin")); + TInt err=KErrNone; + + iMPXItemIdArray.Reset(); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathNewL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathNewL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathNewL testing CMPXCollectionPath::NewL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathNewL testing CMPXCollectionPath::NewL() begin")); + TInt err=KErrNone; + + if ( iMPXCollectionPath ) + { + delete iMPXCollectionPath; + iMPXCollectionPath = NULL; + } + iMPXCollectionPath = CMPXCollectionPath::NewL(); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathNewLPathL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathNewLPathL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathNewLPathL testing CMPXCollectionPath::NewL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathNewLPathL testing CMPXCollectionPath::NewL() begin")); + TInt err=KErrNone; + + if ( !iMPXCollectionPath ) + { + iLog->Log(_L("Error: MPXCollectionPath not created.")); + return KErrBadTestParameter; + } + CMPXCollectionPath* path = CMPXCollectionPath::NewL(*iMPXCollectionPath); + // Verification + if ( path->Levels() != iMPXCollectionPath->Levels() ) + { + iLog->Log(_L("Verification Failed: new num levels=%d, old num levels=%d."), + path->Levels(), iMPXCollectionPath->Levels()); + err = KErrUnexpectedValue; + } + if ( path->Count() != iMPXCollectionPath->Count() ) + { + iLog->Log(_L("Verification Failed: new Count=%d, old Count=%d."), + path->Count(), iMPXCollectionPath->Count()); + err = KErrUnexpectedValue; + } + + delete path; + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathNewLStreamL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathNewLStreamL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathNewLPathL testing CMPXCollectionPath::NewL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathNewLPathL testing CMPXCollectionPath::NewL() begin")); + TInt err=KErrNone; + + if ( !iMPXCollectionPath ) + { + iLog->Log(_L("Error: MPXCollectionPath not created.")); + return KErrBadTestParameter; + } + + CBufBase* buffer = CBufFlat::NewL( 200 ); + CleanupStack::PushL( buffer ); + RBufWriteStream writeStream( *buffer ); + CleanupClosePushL( writeStream ); + iMPXCollectionPath->ExternalizeL( writeStream ); + writeStream.CommitL(); + buffer->Compress(); + CleanupStack::PopAndDestroy( &writeStream ); + + RBufReadStream readStream( *buffer ); + CleanupClosePushL( readStream ); + CMPXCollectionPath* path = CMPXCollectionPath::NewL(readStream); + // Verification + if ( path->Levels() != iMPXCollectionPath->Levels() ) + { + iLog->Log(_L("Verification Failed: new num levels=%d, old num levels=%d."), + path->Levels(), iMPXCollectionPath->Levels()); + err = KErrUnexpectedValue; + } + if ( path->Count() != iMPXCollectionPath->Count() ) + { + iLog->Log(_L("Verification Failed: new Count=%d, old Count=%d."), + path->Count(), iMPXCollectionPath->Count()); + err = KErrUnexpectedValue; + } + CleanupStack::PopAndDestroy( &readStream ); + CleanupStack::PopAndDestroy( buffer ); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathAppendLIdL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathAppendLIdL(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathAppendLIdL testing CMPXCollectionPath::AppendL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathAppendLIdL testing CMPXCollectionPath::AppendL() begin")); + TInt err=KErrNone; + TUint itemId; + + // read in parameters + if ( aItem.GetNextInt(itemId) ) + { + iLog->Log(_L("Missing Parameter: ItemId.")); + return KErrBadTestParameter; + } + + // if first time, generate TUid and use that value to append. + if ( iMPXCollectionPath->Levels() == 0 ) + { + iCollectionPathUid.Uid(itemId); + itemId = iCollectionPathUid.iUid; + } + TMPXItemId item(itemId); + iMPXCollectionPath->AppendL(item); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathAppendLIdsL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathAppendLIdsL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathAppendLIdsL testing CMPXCollectionPath::AppendL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathAppendLIdsL testing CMPXCollectionPath::AppendL() begin")); + TInt err=KErrNone; + + iMPXCollectionPath->AppendL(iMPXItemIdArray.Array()); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathLevels() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathLevels(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathLevels testing CMPXCollectionPath::Levels() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathLevels testing CMPXCollectionPath::Levels() begin")); + TInt err=KErrNone; + TUint expectedLevels; + + // read in parameters + if ( aItem.GetNextInt(expectedLevels) ) + { + iLog->Log(_L("Missing Parameter: Expected Level.")); + return KErrBadTestParameter; + } + + TInt levels = iMPXCollectionPath->Levels(); + // Verification + if ( levels != expectedLevels ) + { + iLog->Log(_L("Verification Failed: levels=%d, expectedLevels=%d."), levels, expectedLevels); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathBack() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathBack(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathBack testing CMPXCollectionPath::Back() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathBack testing CMPXCollectionPath::Back() begin")); + TInt err=KErrNone; + + iMPXCollectionPath->Back(); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathReset() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathReset(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathReset testing CMPXCollectionPath::Reset() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathReset testing CMPXCollectionPath::Reset() begin")); + TInt err=KErrNone; + + iMPXCollectionPath->Reset(); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathIndex() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathIndex(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathIndex testing CMPXCollectionPath::Index() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathIndex testing CMPXCollectionPath::Index() begin")); + TInt err=KErrNone; + TUint expectedIndex; + + // read in parameters + if ( aItem.GetNextInt(expectedIndex) ) + { + iLog->Log(_L("Missing Parameter: Expected Index.")); + return KErrBadTestParameter; + } + + TInt index = iMPXCollectionPath->Index(); + // Verification + if ( index != expectedIndex ) + { + iLog->Log(_L("Verification Failed: index=%d, expectedIndex=%d."), index, expectedIndex); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathOperatorPlus() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathOperatorPlus(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathOperatorPlus testing CMPXCollectionPath::Operator++() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathOperatorPlus testing CMPXCollectionPath::Operator++() begin")); + TInt err=KErrNone; + TUint expectedResult; + + // read in parameters + if ( aItem.GetNextInt(expectedResult) ) + { + iLog->Log(_L("Missing Parameter: Expected Result.")); + return KErrBadTestParameter; + } + + TBool result = iMPXCollectionPath->operator ++(); + // Verification + if ( result != expectedResult ) + { + iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathOperatorMinus() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathOperatorMinus(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathOperatorMinus testing CMPXCollectionPath::Operator--() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathOperatorMinus testing CMPXCollectionPath::Operator--() begin")); + TInt err=KErrNone; + TUint expectedResult; + + // read in parameters + if ( aItem.GetNextInt(expectedResult) ) + { + iLog->Log(_L("Missing Parameter: Expected Result.")); + return KErrBadTestParameter; + } + + TBool result = iMPXCollectionPath->operator --(); + // Verification + if ( result != expectedResult ) + { + iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathSetToFirst() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathSetToFirst(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathSetToFirst testing CMPXCollectionPath::SetToFirst() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathSetToFirst testing CMPXCollectionPath::SetToFirst() begin")); + TInt err=KErrNone; + + iMPXCollectionPath->SetToFirst(); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathSetToLast() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathSetToLast(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathSetToLast testing CMPXCollectionPath::SetToLast() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathSetToLast testing CMPXCollectionPath::SetToLast() begin")); + TInt err=KErrNone; + + iMPXCollectionPath->SetToLast(); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathSetIndex() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathSetIndex(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathSetIndex testing CMPXCollectionPath::Set() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathSetIndex testing CMPXCollectionPath::Set() begin")); + TInt err=KErrNone; + TInt index; + + // read in parameters + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: Index.")); + return KErrBadTestParameter; + } + if ( index >= iMPXCollectionPath->Count() ) + { + iLog->Log(_L("Bad Parameter: index out of range.")); + return KErrBadTestParameter; + } + + iMPXCollectionPath->Set(index); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathSetId() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathSetId(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathSetId testing CMPXCollectionPath::Set() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathSetId testing CMPXCollectionPath::Set() begin")); + TInt err=KErrNone; + TUint itemId; + + // read in parameters + if ( aItem.GetNextInt(itemId) ) + { + iLog->Log(_L("Missing Parameter: ItemId.")); + return KErrBadTestParameter; + } + + TMPXItemId id(itemId); + iMPXCollectionPath->Set(id); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathSetMode() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathSetMode(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathSetMode testing CMPXCollectionPath::Set() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathSetMode testing CMPXCollectionPath::Set() begin")); + TInt err=KErrNone; + TUint mode; + + // read in parameters + if ( aItem.GetNextInt(mode) ) + { + iLog->Log(_L("Missing Parameter: Open mode.")); + return KErrBadTestParameter; + } + + iMPXCollectionPath->Set(static_cast(mode)); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathSetLAttrsL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathSetLAttrsL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathSetLAttrsL testing CMPXCollectionPath::SetL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathSetLAttrsL testing CMPXCollectionPath::SetL() begin")); + TInt err=KErrNone; + + iMPXCollectionPath->SetL(iMPXAttArray.Array()); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathOpenNextMode() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathOpenNextMode(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathOpenNextMode testing CMPXCollectionPath::OpenNextMode() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathOpenNextMode testing CMPXCollectionPath::OpenNextMode() begin")); + TInt err=KErrNone; + TUint expectedMode; + + // read in parameters + if ( aItem.GetNextInt(expectedMode) ) + { + iLog->Log(_L("Missing Parameter: Expected open mode.")); + return KErrBadTestParameter; + } + + TMPXOpenMode mode = iMPXCollectionPath->OpenNextMode(); + // Verification + if ( mode != expectedMode ) + { + iLog->Log(_L("Verification Failed: mode=%d, expectedMode=%d."), mode, expectedMode); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathOpenPreviousMode() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathOpenPreviousMode(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathOpenPreviousMode testing CMPXCollectionPath::OpenPreviousMode() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathOpenPreviousMode testing CMPXCollectionPath::OpenPreviousMode() begin")); + TInt err=KErrNone; + TUint expectedMode; + + // read in parameters + if ( aItem.GetNextInt(expectedMode) ) + { + iLog->Log(_L("Missing Parameter: Expected open mode.")); + return KErrBadTestParameter; + } + + TMPXOpenMode mode = iMPXCollectionPath->OpenPreviousMode(); + // Verification + if ( mode != expectedMode ) + { + iLog->Log(_L("Verification Failed: mode=%d, expectedMode=%d."), mode, expectedMode); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathSelectLIdL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathSelectLIdL(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathSelectLIdL testing CMPXCollectionPath::SelectL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathSelectLIdL testing CMPXCollectionPath::SelectL() begin")); + TInt err=KErrNone; + TUint itemId; + + // read in parameters + if ( aItem.GetNextInt(itemId) ) + { + iLog->Log(_L("Missing Parameter: ItemId.")); + return KErrBadTestParameter; + } + + TMPXItemId id(itemId); + iMPXCollectionPath->SelectL(id); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathSelectLIndexL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathSelectLIndexL(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathSelectLIndexL testing CMPXCollectionPath::SelectL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathSelectLIndexL testing CMPXCollectionPath::SelectL() begin")); + TInt err=KErrNone; + TInt index; + + // read in parameters + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: Index.")); + return KErrBadTestParameter; + } + if ( index >= iMPXCollectionPath->Count() ) + { + iLog->Log(_L("Bad Parameter: index out of range.")); + return KErrBadTestParameter; + } + + iMPXCollectionPath->SelectL(index); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathSelectAllL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathSelectAllL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathSelectAllL testing CMPXCollectionPath::SelectAllL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathSelectAllL testing CMPXCollectionPath::SelectAllL() begin")); + TInt err=KErrNone; + + iMPXCollectionPath->SelectAllL(); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathDeselectId() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathDeselectId(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathDeselectId testing CMPXCollectionPath::Deselect() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathDeselectId testing CMPXCollectionPath::Deselect() begin")); + TInt err=KErrNone; + TUint itemId; + + // read in parameters + if ( aItem.GetNextInt(itemId) ) + { + iLog->Log(_L("Missing Parameter: ItemId.")); + return KErrBadTestParameter; + } + + TMPXItemId id(itemId); + iMPXCollectionPath->Deselect(id); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathDeselectIndex() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathDeselectIndex(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathDeselectIndex testing CMPXCollectionPath::Deselect() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathDeselectIndex testing CMPXCollectionPath::Deselect() begin")); + TInt err=KErrNone; + TInt index; + + // read in parameters + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: Index.")); + return KErrBadTestParameter; + } + if ( index >= iMPXCollectionPath->Count() ) + { + iLog->Log(_L("Bad Parameter: index out of range.")); + return KErrBadTestParameter; + } + + iMPXCollectionPath->Deselect(index); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathDeselectAll() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathDeselectAll(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathDeselectAll testing CMPXCollectionPath::DeselectAll() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathDeselectAll testing CMPXCollectionPath::DeselectAll() begin")); + TInt err=KErrNone; + + iMPXCollectionPath->DeselectAll(); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathRemoveId() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathRemoveId(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathRemoveId testing CMPXCollectionPath::Remove() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathRemoveId testing CMPXCollectionPath::Remove() begin")); + TInt err=KErrNone; + TUint itemId; + + // read in parameters + if ( aItem.GetNextInt(itemId) ) + { + iLog->Log(_L("Missing Parameter: ItemId.")); + return KErrBadTestParameter; + } + + TMPXItemId id(itemId); + iMPXCollectionPath->Remove(id); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathRemoveIndex() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathRemoveIndex(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathRemoveIndex testing CMPXCollectionPath::Remove() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathRemoveIndex testing CMPXCollectionPath::Remove() begin")); + TInt err=KErrNone; + TInt index; + + // read in parameters + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: Index.")); + return KErrBadTestParameter; + } + if ( index >= iMPXCollectionPath->Count() ) + { + iLog->Log(_L("Bad Parameter: index out of range.")); + return KErrBadTestParameter; + } + + iMPXCollectionPath->Remove(index); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathIsSelectedId() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathIsSelectedId(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathIsSelectedId testing CMPXCollectionPath::IsSelected() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathIsSelectedId testing CMPXCollectionPath::IsSelected() begin")); + TInt err=KErrNone; + TUint itemId; + TInt expectedResult; + + // read in parameters + if ( aItem.GetNextInt(itemId) ) + { + iLog->Log(_L("Missing Parameter: ItemId.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(expectedResult) ) + { + iLog->Log(_L("Missing Parameter: Expected result.")); + return KErrBadTestParameter; + } + + TMPXItemId id(itemId); + TBool result = iMPXCollectionPath->IsSelected(id); + // Verification + if ( result != expectedResult ) + { + iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathIsSelectedIndex() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathIsSelectedIndex(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathIsSelectedIndex testing CMPXCollectionPath::IsSelected() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathIsSelectedIndex testing CMPXCollectionPath::IsSelected() begin")); + TInt err=KErrNone; + TInt index; + TInt expectedResult; + + // read in parameters + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: Index.")); + return KErrBadTestParameter; + } + if ( index >= iMPXCollectionPath->Count() ) + { + iLog->Log(_L("Bad Parameter: index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(expectedResult) ) + { + iLog->Log(_L("Missing Parameter: Expected result.")); + return KErrBadTestParameter; + } + + TBool result = iMPXCollectionPath->IsSelected(index); + // Verification + if ( result != expectedResult ) + { + iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathClearSelection() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathClearSelection(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathClearSelection testing CMPXCollectionPath::ClearSelection() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathClearSelection testing CMPXCollectionPath::ClearSelection() begin")); + TInt err=KErrNone; + + iMPXCollectionPath->ClearSelection(); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathSelection() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathSelection(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathSelection testing CMPXCollectionPath::Selection() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathSelection testing CMPXCollectionPath::Selection() begin")); + TInt err=KErrNone; + TInt data; + RArray expectedIndices; + + // read in parameters + while ( aItem.GetNextInt(data) == KErrNone ) + { + expectedIndices.Append(data); + } + + TArray indices = iMPXCollectionPath->Selection(); + // Verification + if ( indices.Count() == expectedIndices.Count() ) + { + for (TInt i=0; iLog(_L("Verification Failed: Index not Found = %d."), indices[i]); + err = KErrUnexpectedValue; + } + } + } + else + { + iLog->Log(_L("Verification Failed: count=%d, expected count=%d."), + indices.Count(), expectedIndices.Count()); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathSelectionL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathSelectionL(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathSelectionL testing CMPXCollectionPath::SelectionL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathSelectionL testing CMPXCollectionPath::SelectionL() begin")); + TInt err=KErrNone; + TUint data; + RArray expectedIds; + RArray ids; + + // read in parameters + while ( aItem.GetNextInt(data) == KErrNone ) + { + TMPXItemId id(data); + expectedIds.Append(id); + } + + iMPXCollectionPath->SelectionL(ids); + // Verification + if ( ids.Count() == expectedIds.Count() ) + { + for (TInt i=0; iLog(_L("Verification Failed: Index not Found = %d."), ids[i].iId1); + err = KErrUnexpectedValue; + } + } + } + else + { + iLog->Log(_L("Verification Failed: count=%d, expected count=%d."), + ids.Count(), expectedIds.Count()); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathId() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathId(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathId testing CMPXCollectionPath::Id() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathId testing CMPXCollectionPath::Id() begin")); + TInt err=KErrNone; + TUint data; + + // read in parameters + if ( aItem.GetNextInt(data) ) + { + iLog->Log(_L("Missing Parameter: Expected ItemId.")); + return KErrBadTestParameter; + } + + TMPXItemId id = iMPXCollectionPath->Id(); + // Verification + TMPXItemId expectedId(data); + if ( id != expectedId ) + { + iLog->Log(_L("Verification Failed: id=%d, expectedId=%d."), TUint(id), TUint(expectedId)); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathCount() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathCount(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathCount testing CMPXCollectionPath::Count() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathCount testing CMPXCollectionPath::Count() begin")); + TInt err=KErrNone; + TUint expectedCount; + + // read in parameters + if ( aItem.GetNextInt(expectedCount) ) + { + iLog->Log(_L("Missing Parameter: Expected Count.")); + return KErrBadTestParameter; + } + + TInt count = iMPXCollectionPath->Count(); + // Verification + if ( count != expectedCount ) + { + iLog->Log(_L("Verification Failed: count=%d, expectedCount=%d."), count, expectedCount); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathIndexOfId() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathIndexOfId(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathIndexOfId testing CMPXCollectionPath::IndexOfId() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathIndexOfId testing CMPXCollectionPath::IndexOfId() begin")); + TInt err=KErrNone; + TUint id; + TInt expectedIndex; + + // read in parameters + if ( aItem.GetNextInt(id) ) + { + iLog->Log(_L("Missing Parameter: Item Id.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(expectedIndex) ) + { + iLog->Log(_L("Missing Parameter: Expected index.")); + return KErrBadTestParameter; + } + + TMPXItemId itemId(id); + TInt index = iMPXCollectionPath->IndexOfId(itemId); + // Verification + if ( index != expectedIndex ) + { + iLog->Log(_L("Verification Failed: index=%d, expectedIndex=%d."), index, expectedIndex); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathIdOfIndex() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathIdOfIndex(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathIdOfIndex testing CMPXCollectionPath::IdOfIndex() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathIdOfIndex testing CMPXCollectionPath::IdOfIndex() begin")); + TInt err=KErrNone; + TUint expectedId; + TInt index; + + // read in parameters + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: Index.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(expectedId) ) + { + iLog->Log(_L("Missing Parameter: Expected itemId.")); + return KErrBadTestParameter; + } + + TMPXItemId id = iMPXCollectionPath->IdOfIndex(index); + // Verification + if ( TUint(id) != expectedId ) + { + iLog->Log(_L("Verification Failed: id=%d, expectedId=%d."), TUint(id), expectedId); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathOpenAttributes() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathOpenAttributes(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathOpenAttributes testing CMPXCollectionPath::OpenAttributes() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathOpenAttributes testing CMPXCollectionPath::OpenAttributes() begin")); + TInt err=KErrNone; + + TArray atts = iMPXCollectionPath->OpenAttributes(); + // Verification + if ( atts.Count() == iMPXAttArray.Count() ) + { + for (TInt i=0; iLog(_L("Verification Failed: Attribute not Found, contentId=%d, attributeId=%d."), + atts[i].ContentId(), atts[i].AttributeId()); + err = KErrUnexpectedValue; + } + } + } + else + { + iLog->Log(_L("Verification Failed: count=%d, expected count=%d."), + atts.Count(), iMPXAttArray.Count()); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathIndexLevel() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathIndexLevel(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathIndexLevel testing CMPXCollectionPath::Index() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathIndexLevel testing CMPXCollectionPath::Index() begin")); + TInt err=KErrNone; + TInt level; + TInt expectedIndex; + + // read in parameters + if ( aItem.GetNextInt(level) ) + { + iLog->Log(_L("Missing Parameter: level.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(expectedIndex) ) + { + iLog->Log(_L("Missing Parameter: Expected index.")); + return KErrBadTestParameter; + } + + TInt index = iMPXCollectionPath->Index(level); + // Verification + if ( index != expectedIndex ) + { + iLog->Log(_L("Verification Failed: index=%d, expectedIndex=%d."), index, expectedIndex); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathIdLevel() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathIdLevel(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathIdLevel testing CMPXCollectionPath::Id() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathIdLevel testing CMPXCollectionPath::Id() begin")); + TInt err=KErrNone; + TInt level; + TUint expectedId; + + // read in parameters + if ( aItem.GetNextInt(level) ) + { + iLog->Log(_L("Missing Parameter: level.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(expectedId) ) + { + iLog->Log(_L("Missing Parameter: Expected itemId.")); + return KErrBadTestParameter; + } + + TMPXItemId id = iMPXCollectionPath->Id(level); + // Verification + if ( TUint(id) != expectedId ) + { + iLog->Log(_L("Verification Failed: id=%d, expectedId=%d."), TUint(id), expectedId); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathStreamingL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathStreamingL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathStreamingL testing CMPXCollectionPath ExternalizeL and InternalizeL begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathStreamingL testing CMPXCollectionPath ExternalizeL and InternalizeL begin")); + TInt err=KErrNone; + + iLog->Log(_L("Start ExternalizeL")); + CBufBase* buffer = CBufFlat::NewL( 200 ); + CleanupStack::PushL( buffer ); + RBufWriteStream writeStream( *buffer ); + CleanupClosePushL( writeStream ); + iMPXCollectionPath->ExternalizeL( writeStream ); + writeStream.CommitL(); + buffer->Compress(); + CleanupStack::PopAndDestroy( &writeStream ); + + iLog->Log(_L("Start InternalizeL")); + RBufReadStream readStream( *buffer ); + CleanupClosePushL( readStream ); + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL( path ); + path->InternalizeL( readStream ); + // verification + if ( path->Count() != iMPXCollectionPath->Count() ) + { + iLog->Log(_L("Verification Failed: New Array Count=%d, Old Array Count=%d."), + path->Count(), iMPXCollectionPath->Count()); + err = KErrUnexpectedValue; + } + CleanupStack::PopAndDestroy( path ); + CleanupStack::PopAndDestroy( &readStream ); + CleanupStack::PopAndDestroy( buffer ); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathHandleChange() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollPathHandleChange(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathHandleChange testing CMPXCollectionPath::HandleChange() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathHandleChange testing CMPXCollectionPath::IdHandleChange() begin")); + TInt err=KErrNone; + TUint id; + TUint deprecatedId; + TInt change; + TInt selection; + TInt expectedSelection; + TInt expectedResult; + + // read in parameters + if ( aItem.GetNextInt(id) ) + { + iLog->Log(_L("Missing Parameter: itemId.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(deprecatedId) ) + { + iLog->Log(_L("Missing Parameter: Deprecated itemId.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(change) ) + { + iLog->Log(_L("Missing Parameter: Change type.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(expectedSelection) ) + { + iLog->Log(_L("Missing Parameter: Expected selection.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(expectedResult) ) + { + iLog->Log(_L("Missing Parameter: Expected result.")); + return KErrBadTestParameter; + } + + TMPXItemId itemId(id); + TMPXItemId deprecatedItemId(deprecatedId); + TInt result = iMPXCollectionPath->HandleChange(iCollectionPathUid, itemId, deprecatedItemId, + (CMPXCollectionPath::TMPXCollectionPathChange)change, selection); + // Verification + if ( selection != expectedSelection ) + { + iLog->Log(_L("Verification Failed: selection=%d, expectedSelection=%d."), selection, expectedSelection); + err = KErrUnexpectedValue; + } + else if ( result != expectedResult ) + { + iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult); + err = KErrUnexpectedValue; + } + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathReset() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollectionpathContainerPathL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollectionpathContainerPathL testing CMPXCollectionPath::ContainerPathL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollectionpathContainerPathL testing CMPXCollectionPath::ContainerPathL() begin")); + + TInt err=KErrNone; + iMPXCollectionPath->ContainerPathL(); + + FTRACE(FPrint(_L("CCommonTestClass::MpxCollectionpathContainerPathL testing CMPXCollectionPath::ContainerPathL() end"))); + iLog->Log(_L("CCommonTestClass::MpxCollectionpathContainerPathL testing CMPXCollectionPath::ContainerPathL() end")); + + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathReset() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollectionpathInsertL(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollectionpathInsertL testing CMPXCollectionPath::InsertL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollectionpathInsertL testing CMPXCollectionPath::InsertL() begin")); + TInt err=KErrNone; + TUint itemId; + TInt apos = 1; + // read in parameters + if ( aItem.GetNextInt(itemId) ) + { + iLog->Log(_L("Missing Parameter: ItemId.")); + return KErrBadTestParameter; + } + // if first time, generate TUid and use that value to append. + if ( iMPXCollectionPath->Levels() == 0 ) + { + iCollectionPathUid.Uid(itemId); + itemId = iCollectionPathUid.iUid; + } + TMPXItemId item(itemId); + iMPXCollectionPath->InsertL(item,apos); + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathReset() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollectionpathItems(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollectionpathItems testing CMPXCollectionPath::Items() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollectionpathItems testing CMPXCollectionPath::Items() begin")); + + TInt err=KErrNone; + iMPXCollectionPath->Items(); + + FTRACE(FPrint(_L("CCommonTestClass::MpxCollectionpathItems testing CMPXCollectionPath::Items() end"))); + iLog->Log(_L("CCommonTestClass::MpxCollectionpathItems testing CMPXCollectionPath::Items() end")); + + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathReset() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollectionpathUpdate(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollectionpathUpdate testing CMPXCollectionPath::Update() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollectionpathUpdate testing CMPXCollectionPath::Update() begin")); + TInt err=KErrNone; + TInt index; + TInt newId; + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: Index.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(newId) ) + { + iLog->Log(_L("Missing Parameter: newId.")); + return KErrBadTestParameter; + } + TMPXItemId newId1(newId); + iMPXCollectionPath->Update(index,newId1); + + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxDelete() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollectionpathDelete(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollectionpathDelete testing CMPXCollectionPath::~ begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollectionpathDelete testing CMPXCollectionPath::~ begin")); + + TInt err = KErrNone; + delete iMPXCollectionPath; + iMPXCollectionPath = NULL; + + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxCollPathSetAttrsL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxCollectionpathCollPathSetAttrsL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathSetAttrsL testing CMPXCollectionPath::Set() begin"))); + iLog->Log(_L("CCommonTestClass::MpxCollPathSetAttrsL testing CMPXCollectionPath::Set() begin")); + + TInt err=KErrNone; + iMPXCollectionPath->Set(iMPXAttArray.Array()); + + return err; + } +// end of MPXCollectionPath mpxcollectionpath.h ===================================================== diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxcollectiontype.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxcollectiontype.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,193 @@ +/* +* 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: MPXCollectionType testing implementation (mpxcollectiontype.h) +* +*/ + + +#include +#include "commontestclass.h" + +// Begin CMPXCollectionType testing implementation (mpxcollectiontype.h)======================================= +// ----------------------------------------------------------------------------- +// CCommonTestClass::CreateMPXCollectionType() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CreateMPXCollectionType() + { + FTRACE(FPrint(_L("CCommonTestClass::CreateMPXCollectionType testing CMPXCollectionType::CMPXCollectionType() begin"))); + iLog->Log(_L("CCommonTestClass::CreateMPXCollectionType testing CMPXCollectionType::CMPXCollectionType() begin")); + TInt err = KErrNone; + if ( iType != NULL) + { + delete iType; + } + iType = NULL; + TRAP(err , iType = new ( ELeave ) CMPXCollectionType()); + if ( iType == NULL) + { + err = KErrNotFound; + } + FTRACE(FPrint(_L("CCommonTestClass::CreateMPXCollectionType testing CMPXCollectionType::CMPXCollectionType() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CreateMPXCollectionType testing CMPXCollectionType::CMPXCollectionType() end err=%d"), err); + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::CMPXCollectionTypeDelete() +// Returns: Symbian OS errors. +// add CMPXCollectionTypeDelete to testmpxcollectiontype.cpp 9/19/2008 1:32 +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CMPXCollectionTypeDelete(CStifItemParser&) + { + FTRACE(FPrint(_L("CCommonTestClass::CMPXCollectionTypeDelete testing CMPXCollectionType::~ begin"))); + iLog->Log(_L("CCommonTestClass::CMPXCollectionTypeDelete testing CMPXCollectionType::~ begin")); + TInt err = KErrNone; + delete iType; + iType = NULL; + FTRACE(FPrint(_L("CCommonTestClass::CMPXCollectionTypeDelete testing CMPXCollectionType::~ end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CMPXCollectionTypeDelete testing CMPXCollectionType::~ end err=%d"), err); + return err; + } + +TInt CCommonTestClass::CreateMPXCollectionTypeWOParam() + { + FTRACE(FPrint(_L("CCommonTestClass::CreateMPXCollectionType testing CMPXCollectionType::CMPXCollectionType() begin"))); + iLog->Log(_L("CCommonTestClass::CreateMPXCollectionType testing CMPXCollectionType::CMPXCollectionType() begin")); + TInt err = KErrNone; + if ( iType != NULL) + { + delete iType; + } + iType = NULL; + TRAP(err , iType = new ( ELeave ) CMPXCollectionType()); + if ( iType == NULL) + { + err = KErrNotFound; + } + FTRACE(FPrint(_L("CCommonTestClass::CreateMPXCollectionType testing CMPXCollectionType::CMPXCollectionType() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CreateMPXCollectionType testing CMPXCollectionType::CMPXCollectionType() end err=%d"), err); + return err; + } + + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::InternalizeMPXCollectionTypeL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::InternalizeMPXCollectionTypeL() + { + FTRACE(FPrint(_L("CCommonTestClass::InternalizeMPXCollectionTypeL testing CMPXCollectionType::InternalizeMPXCollectionTypeL begin"))); + iLog->Log(_L("CCommonTestClass::InternalizeMPXCollectionTypeL testing CMPXCollectionType::InternalizeMPXCollectionTypeL begin")); + TInt err = KErrNone; + + if ( iType != NULL ) + { + FTRACE(FPrint(_L("CCommonTestClass::InternalizeMPXCollectionTypeL started Internalize"))); + iLog->Log(_L("CCommonTestClass::InternalizeMPXCollectionTypeL started Internalize")); + CBufBase* buffer = CBufFlat::NewL( 50 ); + CleanupStack::PushL( buffer ); + RBufWriteStream writeStream( *buffer ); + CleanupClosePushL( writeStream ); + iType->ExternalizeL( writeStream ); + writeStream.CommitL(); + buffer->Compress(); + CleanupStack::PopAndDestroy( &writeStream ); + + RBufReadStream readStream( *buffer ); + CleanupClosePushL( readStream ); + iType = new ( ELeave ) CMPXCollectionType(); + iType->InternalizeL( readStream ); + CleanupStack::PopAndDestroy( &readStream ); + CleanupStack::PopAndDestroy( buffer ); + } + else + { + err = KErrBadTestParameter; + FTRACE(FPrint(_L("CCommonTestClass::InternalizeMPXCollectionTypeL Stif test script is wrong."))); + iLog->Log(_L("CCommonTestClass::InternalizeMPXCollectionTypeL Stif test script is wrong.")); + } + + + FTRACE(FPrint(_L("CCommonTestClass::InternalizeMPXCollectionTypeL testing CMPXCollectionType::InternalizeMPXCollectionTypeL end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::InternalizeMPXCollectionTypeL testing CMPXCollectionType::InternalizeMPXCollectionTypeL end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::ExternalizeMPXCollectionTypeL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::ExternalizeMPXCollectionTypeL() + { + FTRACE(FPrint(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL testing CMPXCollectionType::ExternalizeMPXCollectionTypeL begin"))); + iLog->Log(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL testing CMPXCollectionType::ExternalizeMPXCollectionTypeL begin")); + TInt err = KErrNone; + if ( iType != NULL ) + { + FTRACE(FPrint(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL started Externalize"))); + iLog->Log(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL started Externalize")); + CBufBase* buffer = CBufFlat::NewL( 50 ); + CleanupStack::PushL( buffer ); + RBufWriteStream writeStream( *buffer ); + CleanupClosePushL( writeStream ); + iType->ExternalizeL( writeStream ); + writeStream.CommitL(); + buffer->Compress(); + CleanupStack::PopAndDestroy( &writeStream ); + CleanupStack::PopAndDestroy( buffer ); + } + else + { + err = KErrBadTestParameter; + FTRACE(FPrint(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL Stif test script is wrong."))); + iLog->Log(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL Stif test script is wrong.")); + } + FTRACE(FPrint(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL testing CMPXCollectionType::ExternalizeMPXCollectionTypeL end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL testing CMPXCollectionType::ExternalizeMPXCollectionTypeL end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::CreateMPXCollectionTypeaUid() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- + +TInt CCommonTestClass::TUidMPXCollectionType() + { + TUid* uid=new TUid(); + TUid& aUid=*uid; + CDesCArray* aMimeTypes(NULL); + CDesCArray* aExtensions(NULL); + FTRACE(FPrint(_L("CCommonTestClass::TUidMPXCollectionType testing CMPXCollectionType::CMPXCollectionType() begin"))); + iLog->Log(_L("CCommonTestClass::TUidMPXCollectionType testing CMPXCollectionType::CMPXCollectionType() begin")); + TInt err = KErrNone; + if ( iType != NULL) + { + delete iType; + } + iType = NULL; + TRAP(err , iType = new ( ELeave ) CMPXCollectionType(aUid ,aMimeTypes,aExtensions)); + if ( iType == NULL) + { + err = KErrNotFound; + } + FTRACE(FPrint(_L("CCommonTestClass::TUidMPXCollectionType testing CMPXCollectionType::CMPXCollectionType() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::TUidMPXCollectionType testing CMPXCollectionType::CMPXCollectionType() end err=%d"), err); + return err; + } + + + + \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxdrmmediautility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxdrmmediautility.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,223 @@ +/* +* 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: MPXDrmMediaUtility testing implementation (mpxdrmmediautility.h) +* +*/ + + +#include +#include "commontestclass.h" +#include + + +// Begin CMPXDrmMediaUtility testing implementation (mpxdrmmediautility.h)======================================= +// ----------------------------------------------------------------------------- +// CCommonTestClass::CreateCMPXDrmMediaUtilityL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CreateCMPXDrmMediaUtilityL() + { + FTRACE(FPrint(_L("CCommonTestClass::CreateCMPXDrmMediaUtilityL testing CMPXDrmMediaUtility::NewL() begin"))); + iLog->Log(_L("CCommonTestClass::CreateCMPXDrmMediaUtilityL testing CMPXDrmMediaUtility::NewL() begin")); + TInt err = KErrNone; + if ( iDrmMediaUtility != NULL) + { + delete iDrmMediaUtility; + } + iDrmMediaUtility = NULL; + iDrmMediaUtility = CMPXDrmMediaUtility::NewL(); + if ( iDrmMediaUtility == NULL) + { + err = KErrNotFound; + } + FTRACE(FPrint(_L("CCommonTestClass::CreateCMPXDrmMediaUtilityL testing CMPXDrmMediaUtility::NewL() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CreateCMPXDrmMediaUtilityL testing CMPXDrmMediaUtility::NewL() end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::CreateCMPXDrmMediaUtilityLC() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CreateCMPXDrmMediaUtilityLC() + { + FTRACE(FPrint(_L("CCommonTestClass::CreateCMPXDrmMediaUtilityL testing CMPXDrmMediaUtility::NewLC() begin"))); + iLog->Log(_L("CCommonTestClass::CreateCMPXDrmMediaUtilityL testing CMPXDrmMediaUtility::NewLC() begin")); + TInt err = KErrNone; + CMPXDrmMediaUtility* drmUtil = CMPXDrmMediaUtility::NewLC(); + if ( drmUtil == NULL) + { + err = KErrNotFound; + } + CleanupStack::PopAndDestroy( drmUtil ); + FTRACE(FPrint(_L("CCommonTestClass::CreateCMPXDrmMediaUtilityL testing CMPXDrmMediaUtility::NewLC() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CreateCMPXDrmMediaUtilityL testing CMPXDrmMediaUtility::NewLC() end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::DeleteCMPXDrmMediaUtilityL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::DeleteCMPXDrmMediaUtilityL() + { + FTRACE(FPrint(_L("CCommonTestClass::DeleteCMPXDrmMediaUtilityL testing CMPXDrmMediaUtilityL::~ begin"))); + iLog->Log(_L("CCommonTestClass::DeleteCMPXDrmMediaUtilityL testing CMPXDrmMediaUtilityL::~ begin")); + TInt err = KErrNone; + delete iDrmMediaUtility; + iDrmMediaUtility = NULL; + FTRACE(FPrint(_L("CCommonTestClass::DeleteCMPXDrmMediaUtilityL testing CMPXDrmMediaUtilityL::~ end=%d"), err)); + iLog->Log(_L("CCommonTestClass::DeleteCMPXDrmMediaUtilityL testing CMPXDrmMediaUtilityL::~ end=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::InitFileNameL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::InitFileNameL() + { + FTRACE(FPrint(_L("CCommonTestClass::InitFileNameL testing CMPXDrmMediaUtility::InitL begin"))); + iLog->Log(_L("CCommonTestClass::InitFileNameL testing CMPXDrmMediaUtility::InitL begin")); + TInt err = KErrNone; + + if ( iDrmMediaUtility != NULL ) + { + iDrmMediaUtility->InitL(_L("c:\\testing\\data\\testdrm.cm")); + } + else + { + err = KErrBadTestParameter; + } + + FTRACE(FPrint(_L("CCommonTestClass::InitFileNameL testing CMPXDrmMediaUtility::InitL end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::InitFileNameL testing CMPXDrmMediaUtility::InitL end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::InitRFileL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::InitRFileL() + { + FTRACE(FPrint(_L("CCommonTestClass::InitRFileL testing CMPXDrmMediaUtility::InitL begin"))); + iLog->Log(_L("CCommonTestClass::InitRFileL testing CMPXDrmMediaUtility::InitL begin")); + TInt err = KErrNone; + + if ( iDrmMediaUtility != NULL ) + { + RFile file; +#ifdef __WINSCW__ + _LIT(KFileName, "c:\\testing\\data\\testdrm.cm"); +#else + _LIT(KFileName, "e:\\testing\\data\\testdrm.cm"); +#endif + RFs fs; + User::LeaveIfError(fs.Connect()); + file.Open(fs,KFileName,EFileStreamText|EFileShareAny); + iDrmMediaUtility->InitL(file); + file.Close(); + fs.Close(); + } + else + { + err = KErrBadTestParameter; + } + + FTRACE(FPrint(_L("CCommonTestClass::InitRFileL testing CMPXDrmMediaUtility::InitL end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::InitRFileL testing CMPXDrmMediaUtility::InitL end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::Close() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::Close() + { + FTRACE(FPrint(_L("CCommonTestClass::Close testing CMPXDrmMediaUtility::Close begin"))); + iLog->Log(_L("CCommonTestClass::Close testing CMPXDrmMediaUtility::Close begin")); + TInt err = KErrNone; + + if ( iDrmMediaUtility != NULL ) + { + iDrmMediaUtility->Close(); + } + else + { + err = KErrBadTestParameter; + } + + FTRACE(FPrint(_L("CCommonTestClass::Close testing CMPXDrmMediaUtility::Close end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::Close testing CMPXDrmMediaUtility::Close end err=%d"), err); + return err; + } + + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::GetMediaL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::GetMediaL() + { + FTRACE(FPrint(_L("CCommonTestClass::GetMediaL testing CMPXDrmMediaUtility::GetMediaL begin"))); + iLog->Log(_L("CCommonTestClass::GetMediaL testing CMPXDrmMediaUtility::GetMediaL begin")); + TInt err = KErrNone; + + if ( iDrmMediaUtility != NULL ) + { + iDrmMediaUtility->InitL(_L("c:\\testing\\data\\testdrm.cm")); + const CMPXMedia* media = iDrmMediaUtility->GetMediaL( EMPXMediaDrmProtected ); + } + else + { + err = KErrBadTestParameter; + } + + FTRACE(FPrint(_L("CCommonTestClass::GetMediaL testing CMPXDrmMediaUtility::GetMediaL end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::GetMediaL testing CMPXDrmMediaUtility::GetMediaL end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::ConsumeL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::ConsumeL() + { + FTRACE(FPrint(_L("CCommonTestClass::ConsumeL testing CMPXDrmMediaUtility::ConsumeL begin"))); + iLog->Log(_L("CCommonTestClass::ConsumeL testing CMPXDrmMediaUtility::ConsumeL begin")); + TInt err = KErrNone; + + if ( iDrmMediaUtility != NULL ) + { + iDrmMediaUtility->InitL(_L("c:\\testing\\data\\testdrm.cm")); + const CMPXMedia* media = iDrmMediaUtility->GetMediaL( EMPXMediaDrmProtected ); + iDrmMediaUtility->ConsumeL( EMPXDrmConsumeNone ); + } + else + { + err = KErrBadTestParameter; + } + + FTRACE(FPrint(_L("CCommonTestClass::ConsumeL testing CMPXDrmMediaUtility::ConsumeL end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::ConsumeL testing CMPXDrmMediaUtility::ConsumeL end err=%d"), err); + return err; + } diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxmedia.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxmedia.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,2152 @@ +/* +* 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: MPXMedia and MPXMediaArray testing implementation (mpxmedia.h,mpxmediaarray.h) +* +*/ + + +#include +#include +#include +#include +#include "commontestclass.h" + +// Begin MPXMedia and MPXMediaArray testing implementation (mpxmedia.h,mpxmediaarray.h)======================== + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaNewL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaNewL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaNewL testing CMPXMedia::NewL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaNewL testing CMPXMedia::NewL() begin")); + TInt err=KErrNone; + CMPXMedia* media = CMPXMedia::NewL(); + CleanupStack::PushL(media); + if ( iMPXMediaArray ) + { + iMPXMediaArray->AppendL(media); + CleanupStack::Pop(media); + } + else + { + CleanupStack::PopAndDestroy(media); + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaNewLSupportedIdsL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaNewLSupportedIdsL(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaNewLSupportedIdsL testing CMPXMedia::NewL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaNewLSupportedIdsL testing CMPXMedia::NewL() begin")); + TInt err=KErrNone; + RArray supportedIds; + TInt id; + + CleanupClosePushL(supportedIds); + // read in parameters + while ( aItem.GetNextInt(id) == KErrNone ) + { + supportedIds.AppendL(id); + } + + CMPXMedia* media = CMPXMedia::NewL(supportedIds.Array()); + CleanupStack::PushL(media); + if ( iMPXMediaArray ) + { + iMPXMediaArray->AppendL(media); + CleanupStack::Pop(media); + } + else + { + CleanupStack::PopAndDestroy(media); + } + CleanupStack::PopAndDestroy(&supportedIds); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaNewLMediaL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaNewLMediaL(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaNewLMediaL testing CMPXMedia::NewL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaNewLMediaL testing CMPXMedia::NewL() begin")); + TInt err=KErrNone; + TUint index; + + // read in parameters + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( index >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: index out of range.")); + return KErrBadTestParameter; + } + + CMPXMedia* media = CMPXMedia::NewL(*(*iMPXMediaArray)[index]); + CleanupStack::PushL(media); + iMPXMediaArray->AppendL(media); + CleanupStack::Pop(media); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaNewLDataHandleL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaNewLDataHandleL(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaNewLDataHandleL testing CMPXMedia::NewL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaNewLDataHandleL testing CMPXMedia::NewL() begin")); + TInt err=KErrNone; + TUint index; + + // read in parameters + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( index >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: index out of range.")); + return KErrBadTestParameter; + } + + CMPXMedia* media = CMPXMedia::NewL((*iMPXMediaArray)[index]->Data()); + CleanupStack::PushL(media); + iMPXMediaArray->AppendL(media); + CleanupStack::Pop(media); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaNewLStreamL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaNewLStreamL(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaNewLStreamL testing CMPXMedia::NewL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaNewLStreamL testing CMPXMedia::NewL() begin")); + TInt err=KErrNone; + TUint index; + + // read in parameters + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( index >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: index out of range.")); + return KErrBadTestParameter; + } + + CBufBase* buffer = CBufFlat::NewL( 100 ); + CleanupStack::PushL( buffer ); + RBufWriteStream writeStream( *buffer ); + CleanupClosePushL( writeStream ); + (*iMPXMediaArray)[index]->ExternalizeL( writeStream ); + writeStream.CommitL(); + buffer->Compress(); + CleanupStack::PopAndDestroy( &writeStream ); + + RBufReadStream readStream( *buffer ); + CleanupClosePushL( readStream ); + CMPXMedia* media = CMPXMedia::NewL(readStream); + CleanupStack::PushL(media); + iMPXMediaArray->AppendL(media); + CleanupStack::Pop(media); + CleanupStack::PopAndDestroy( &readStream ); + CleanupStack::PopAndDestroy( buffer ); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaOperatorAssignment() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaOperatorAssignment(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaOperatorAssignment testing CMPXMedia::operator=() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaOperatorAssignment testing CMPXMedia::operator=() begin")); + TInt err=KErrNone; + TUint index; + + // read in parameters + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( index >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: index out of range.")); + return KErrBadTestParameter; + } + + CMPXMedia* media; + TRAP(err , media= CMPXMedia::NewL()); + CleanupStack::PushL(media); + media->operator =(*(*iMPXMediaArray)[index]); + TRAP(err , iMPXMediaArray->AppendL(media)); + CleanupStack::Pop(media); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaSupportedIds() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaSupportedIds(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaSupportedIds testing CMPXMedia::SupportedIds() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaSupportedIds testing CMPXMedia::SupportedIds() begin")); + TInt err=KErrNone; + TUint index; + RArray expectedSupportedIds; + TInt id; + + // read in parameters + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( index >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: index out of range.")); + return KErrBadTestParameter; + } + + while ( aItem.GetNextInt(id) == KErrNone ) + { + expectedSupportedIds.Append(id); + } + TArray supportedIds = (*iMPXMediaArray)[index]->SupportedIds(); + + // verify supported IDS + if ( supportedIds.Count() == expectedSupportedIds.Count() ) + { + for (TInt i=0; iLog(_L("Verification Failed: ContentID not Found = %d."), supportedIds[i]); + err = KErrUnexpectedValue; + } + } + } + else + { + iLog->Log(_L("Verification Failed: count=%d, expected count=%d."), supportedIds.Count(), expectedSupportedIds.Count()); + err = KErrUnexpectedValue; + } + + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaAttributes() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaAttributes(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaAttributes testing CMPXMedia::Attributes() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaAttributes testing CMPXMedia::Attributes() begin")); + TInt err=KErrNone; + TUint mediaIndex; + TUint attIndex; + + // read in parameters + if ( aItem.GetNextInt(mediaIndex) ) + { + iLog->Log(_L("Missing Parameter: Media index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( mediaIndex >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Media index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(attIndex) ) + { + iLog->Log(_L("Missing Parameter: Attribute index.")); + return KErrBadTestParameter; + } + if ( attIndex >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: Attribute index out of range.")); + return KErrBadTestParameter; + } + + TArray attributes = (*iMPXMediaArray)[mediaIndex]->Attributes(); + // verify attributes + TBool found = EFalse; + for (TInt i=0; iLog(_L("Verification Failed: Attribute not found - contentID=%d, attID=%d."), + iMPXAttArray[attIndex].ContentId(), iMPXAttArray[attIndex].AttributeId()); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaSetTObjectValueL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaSetTObjectValueL(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaSetTObjectValueL testing CMPXMedia::SetTObjectValueL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaSetTObjectValueL testing CMPXMedia::SetTObjectValueL() begin")); + TInt err=KErrNone; + TUint mediaIndex; + TUint attIndex; + TInt attValue; + + // read in parameters + if ( aItem.GetNextInt(mediaIndex) ) + { + iLog->Log(_L("Missing Parameter: Media index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( mediaIndex >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Media index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(attIndex) ) + { + iLog->Log(_L("Missing Parameter: Attribute index.")); + return KErrBadTestParameter; + } + if ( attIndex >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: Attribute index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(attValue) ) + { + iLog->Log(_L("Missing Parameter: Attribute value.")); + return KErrBadTestParameter; + } + + // set attribue + (*iMPXMediaArray)[mediaIndex]->SetTObjectValueL(iMPXAttArray[attIndex], attValue); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaSetCObjectValueL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaSetCObjectValueL(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaSetCObjectValueL testing CMPXMedia::SetCObjectValueL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaSetCObjectValueL testing CMPXMedia::SetCObjectValueL() begin")); + TInt err=KErrNone; + TUint mediaIndex; + TUint attIndex; + TPtrC className; + + // read in parameters + if ( aItem.GetNextInt(mediaIndex) ) + { + iLog->Log(_L("Missing Parameter: Media index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( mediaIndex >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Media index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(attIndex) ) + { + iLog->Log(_L("Missing Parameter: Attribute index.")); + return KErrBadTestParameter; + } + if ( attIndex >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: Attribute index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextString(className) ) + { + iLog->Log(_L("Missing Parameter: Class name.")); + return KErrBadTestParameter; + } + + // set class object + if ( className == _L("CMPXMedia") ) + { + CMPXMedia* media = CMPXMedia::NewL(); + CleanupStack::PushL(media); + (*iMPXMediaArray)[mediaIndex]->SetCObjectValueL(iMPXAttArray[attIndex], media); + CleanupStack::PopAndDestroy(media); + } + else if ( className == _L("CMPXMediaArray") ) + { + CMPXMediaArray* media = CMPXMediaArray::NewL(); + CleanupStack::PushL(media); + (*iMPXMediaArray)[mediaIndex]->SetCObjectValueL(iMPXAttArray[attIndex], media); + CleanupStack::PopAndDestroy(media); + } + else if ( className == _L("CMPXCollectionPath") ) + { + CMPXCollectionPath* media = CMPXCollectionPath::NewL(); + CleanupStack::PushL(media); + (*iMPXMediaArray)[mediaIndex]->SetCObjectValueL(iMPXAttArray[attIndex], media); + CleanupStack::PopAndDestroy(media); + } + else + { + iLog->Log(_L("Bad Parameter: Invalid class name.")); + return KErrBadTestParameter; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaSetNoNewLCObjectL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaSetNoNewLCObjectL(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaSetNoNewLCObjectL testing CMPXMedia::SetNoNewLCObjectL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaSetNoNewLCObjectL testing CMPXMedia::SetNoNewLCObjectL() begin")); + TInt err=KErrNone; + TUint mediaIndex; + TUint attIndex; + TPtrC className; + + // read in parameters + if ( aItem.GetNextInt(mediaIndex) ) + { + iLog->Log(_L("Missing Parameter: Media index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( mediaIndex >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Media index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(attIndex) ) + { + iLog->Log(_L("Missing Parameter: Attribute index.")); + return KErrBadTestParameter; + } + if ( attIndex >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: Attribute index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextString(className) ) + { + iLog->Log(_L("Missing Parameter: Class name.")); + return KErrBadTestParameter; + } + + // set class object + if ( className == _L("CMPXMedia") ) + { + CMPXMedia* media = CMPXMedia::NewL(); + CleanupStack::PushL(media); + (*iMPXMediaArray)[mediaIndex]->SetNoNewLCObjectL(iMPXAttArray[attIndex], media); + CleanupStack::PopAndDestroy(media); + } + else if ( className == _L("CMPXMediaArray") ) + { + CMPXMediaArray* media = CMPXMediaArray::NewL(); + CleanupStack::PushL(media); + (*iMPXMediaArray)[mediaIndex]->SetNoNewLCObjectL(iMPXAttArray[attIndex], media); + CleanupStack::PopAndDestroy(media); + } + else if ( className == _L("CMPXCollectionPath") ) + { + CMPXCollectionPath* media = CMPXCollectionPath::NewL(); + CleanupStack::PushL(media); + (*iMPXMediaArray)[mediaIndex]->SetNoNewLCObjectL(iMPXAttArray[attIndex], media); + CleanupStack::PopAndDestroy(media); + } + else + { + iLog->Log(_L("Bad Parameter: Invalid class name.")); + return KErrBadTestParameter; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaSetTextValueL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaSetTextValueL(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaSetTextValueL testing CMPXMedia::SetTextValueL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaSetTextValueL testing CMPXMedia::SetTextValueL() begin")); + TInt err=KErrNone; + TUint mediaIndex; + TUint attIndex; + TPtrC attValue; + + // read in parameters + if ( aItem.GetNextInt(mediaIndex) ) + { + iLog->Log(_L("Missing Parameter: Media index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( mediaIndex >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Media index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(attIndex) ) + { + iLog->Log(_L("Missing Parameter: Attribute index.")); + return KErrBadTestParameter; + } + if ( attIndex >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: Attribute index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextString(attValue) ) + { + iLog->Log(_L("Missing Parameter: Attribute value.")); + return KErrBadTestParameter; + } + + // set attribue + (*iMPXMediaArray)[mediaIndex]->SetTextValueL(iMPXAttArray[attIndex], attValue); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaIsSupported() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaIsSupported(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaIsSupported testing CMPXMedia::IsSupported() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaIsSupported testing CMPXMedia::IsSupported() begin")); + TInt err=KErrNone; + TUint mediaIndex; + TUint attIndex; + TBool expectedResult; + + // read in parameters + if ( aItem.GetNextInt(mediaIndex) ) + { + iLog->Log(_L("Missing Parameter: Media index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( mediaIndex >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Media index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(attIndex) ) + { + iLog->Log(_L("Missing Parameter: Attribute index.")); + return KErrBadTestParameter; + } + if ( attIndex >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: Attribute index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(expectedResult) ) + { + iLog->Log(_L("Missing Parameter: Expected result.")); + return KErrBadTestParameter; + } + + // call IsSupported + TBool result = (*iMPXMediaArray)[mediaIndex]->IsSupported(iMPXAttArray[attIndex]); + + // verification + if ( result != expectedResult ) + { + iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaCount() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaCount(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaCount testing CMPXMedia::Count() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaCount testing CMPXMedia::Count() begin")); + TInt err=KErrNone; + TUint mediaIndex; + TInt expectedResult; + + // read in parameters + if ( aItem.GetNextInt(mediaIndex) ) + { + iLog->Log(_L("Missing Parameter: Media index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( mediaIndex >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Media index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(expectedResult) ) + { + iLog->Log(_L("Missing Parameter: Expected result.")); + return KErrBadTestParameter; + } + + // call Count() + TInt result = (*iMPXMediaArray)[mediaIndex]->Count(); + + // verification + if ( result != expectedResult ) + { + iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaAttribute() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaAttribute(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaAttribute testing CMPXMedia::Attribute() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaAttribute testing CMPXMedia::Attribute() begin")); + TInt err=KErrNone; + TUint mediaIndex; + TUint attIndex; + TInt expectedAttIndex; + + // read in parameters + if ( aItem.GetNextInt(mediaIndex) ) + { + iLog->Log(_L("Missing Parameter: Media index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( mediaIndex >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Media index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(attIndex) ) + { + iLog->Log(_L("Missing Parameter: Index of Attribute in MPXMedia.")); + return KErrBadTestParameter; + } + if ( attIndex >= (*iMPXMediaArray)[mediaIndex]->Count() ) + { + iLog->Log(_L("Bad Parameter: Index of Attribute out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(expectedAttIndex) ) + { + iLog->Log(_L("Missing Parameter: Expected Attribute Index.")); + return KErrBadTestParameter; + } + if ( expectedAttIndex >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: Expected Attribute index out of range.")); + return KErrBadTestParameter; + } + + TMPXAttribute result = (*iMPXMediaArray)[mediaIndex]->Attribute(attIndex); + TMPXAttribute expectedResult = iMPXAttArray[expectedAttIndex]; + + // verification + if ( !(result == expectedResult) ) + { + iLog->Log(_L("Verification Failed: contentID=%d, expectedContentID=%d, attributeID=%d, expectedAttributeID=%d."), + result.ContentId(), expectedResult.ContentId(), result.AttributeId(), expectedResult.AttributeId()); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaAttributesSet() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaAttributesSet(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaAttributesSet testing CMPXMedia::AttributesSet() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaAttributesSet testing CMPXMedia::AttributesSet() begin")); + TInt err=KErrNone; + TUint mediaIndex; + TInt contentID; + TUint expectedAttributes; + + // read in parameters + if ( aItem.GetNextInt(mediaIndex) ) + { + iLog->Log(_L("Missing Parameter: Media index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( mediaIndex >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Media index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(contentID) ) + { + iLog->Log(_L("Missing Parameter: ContentID.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(expectedAttributes) ) + { + iLog->Log(_L("Missing Parameter: Expected Attributes.")); + return KErrBadTestParameter; + } + + TUint result = (*iMPXMediaArray)[mediaIndex]->AttributesSet(contentID); + // verification + if ( result != expectedAttributes ) + { + iLog->Log(_L("Verification Failed: attributes=%d, expectedAttributes=%d."), result, expectedAttributes); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaIndex() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaIndex(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaIndex testing CMPXMedia::Index() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaIndex testing CMPXMedia::Index() begin")); + TInt err=KErrNone; + TUint mediaIndex; + TUint attIndex; + TInt expectedIndex; + + // read in parameters + if ( aItem.GetNextInt(mediaIndex) ) + { + iLog->Log(_L("Missing Parameter: Media index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( mediaIndex >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Media index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(attIndex) ) + { + iLog->Log(_L("Missing Parameter: Attribute Index.")); + return KErrBadTestParameter; + } + if ( attIndex >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: Attribute Index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(expectedIndex) ) + { + iLog->Log(_L("Missing Parameter: Expected Index.")); + return KErrBadTestParameter; + } + + TInt result = (*iMPXMediaArray)[mediaIndex]->Index(iMPXAttArray[attIndex]); + // verification + if ( result != expectedIndex ) + { + iLog->Log(_L("Verification Failed: index=%d, expectedIndex=%d."), result, expectedIndex); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaTypeIndex() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaTypeIndex(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaTypeIndex testing CMPXMedia::Type() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaTypeIndex testing CMPXMedia::Type() begin")); + TInt err=KErrNone; + TUint mediaIndex; + TUint index; + TInt expectedType; + + // read in parameters + if ( aItem.GetNextInt(mediaIndex) ) + { + iLog->Log(_L("Missing Parameter: Media index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( mediaIndex >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Media index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: Index of Attribute.")); + return KErrBadTestParameter; + } + if ( index >= (*iMPXMediaArray)[mediaIndex]->Count() ) + { + iLog->Log(_L("Bad Parameter: Index of Attribute out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(expectedType) ) + { + iLog->Log(_L("Missing Parameter: Expected Type.")); + return KErrBadTestParameter; + } + + TMPXAttributeType type = (*iMPXMediaArray)[mediaIndex]->Type(index); + // verification + if ( type != expectedType ) + { + iLog->Log(_L("Verification Failed: type=%d, expectedType=%d."), type, expectedType); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaTypeAttribute() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaTypeAttribute(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaTypeAttribute testing CMPXMedia::Type() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaTypeAttribute testing CMPXMedia::Type() begin")); + TInt err=KErrNone; + TUint mediaIndex; + TUint attIndex; + TInt expectedType; + + // read in parameters + if ( aItem.GetNextInt(mediaIndex) ) + { + iLog->Log(_L("Missing Parameter: Media index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( mediaIndex >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Media index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(attIndex) ) + { + iLog->Log(_L("Missing Parameter: Attribute Index.")); + return KErrBadTestParameter; + } + if ( attIndex >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: Attribute Index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(expectedType) ) + { + iLog->Log(_L("Missing Parameter: Expected Type.")); + return KErrBadTestParameter; + } + + TMPXAttributeType type = (*iMPXMediaArray)[mediaIndex]->Type(iMPXAttArray[attIndex]); + // verification + if ( type != expectedType ) + { + iLog->Log(_L("Verification Failed: type=%d, expectedType=%d."), type, expectedType); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaReset() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaReset(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaReset testing CMPXMedia::Reset() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaReset testing CMPXMedia::Reset() begin")); + TInt err=KErrNone; + TUint mediaIndex; + + // read in parameters + if ( aItem.GetNextInt(mediaIndex) ) + { + iLog->Log(_L("Missing Parameter: Media index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( mediaIndex >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Media index out of range.")); + return KErrBadTestParameter; + } + + (*iMPXMediaArray)[mediaIndex]->Reset(); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaDeleteAttribute() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaDeleteAttribute(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaDeleteAttribute testing CMPXMedia::Delete() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaDeleteAttribute testing CMPXMedia::Delete() begin")); + TInt err=KErrNone; + TUint mediaIndex; + TUint attIndex; + + // read in parameters + if ( aItem.GetNextInt(mediaIndex) ) + { + iLog->Log(_L("Missing Parameter: Media index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( mediaIndex >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Media index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(attIndex) ) + { + iLog->Log(_L("Missing Parameter: Attribute Index.")); + return KErrBadTestParameter; + } + if ( attIndex >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: Attribute Index out of range.")); + return KErrBadTestParameter; + } + + (*iMPXMediaArray)[mediaIndex]->Delete(iMPXAttArray[attIndex]); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaDeleteIndex() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaDeleteIndex(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaDeleteIndex testing CMPXMedia::Delete() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaDeleteIndex testing CMPXMedia::Delete() begin")); + TInt err=KErrNone; + TUint mediaIndex; + TUint index; + + // read in parameters + if ( aItem.GetNextInt(mediaIndex) ) + { + iLog->Log(_L("Missing Parameter: Media index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( mediaIndex >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Media index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: Index of Attribute.")); + return KErrBadTestParameter; + } + if ( index >= (*iMPXMediaArray)[mediaIndex]->Count() ) + { + iLog->Log(_L("Bad Parameter: Index of Attribute out of range.")); + return KErrBadTestParameter; + } + + (*iMPXMediaArray)[mediaIndex]->Delete(index); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaValueText() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaValueText(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaValueText testing CMPXMedia::ValueText() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaValueText testing CMPXMedia::ValueText() begin")); + TInt err=KErrNone; + TUint mediaIndex; + TUint attIndex; + TPtrC expectedValue; + + // read in parameters + if ( aItem.GetNextInt(mediaIndex) ) + { + iLog->Log(_L("Missing Parameter: Media index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( mediaIndex >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Media index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(attIndex) ) + { + iLog->Log(_L("Missing Parameter: Attribute Index.")); + return KErrBadTestParameter; + } + if ( attIndex >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: Attribute Index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextString(expectedValue) ) + { + iLog->Log(_L("Missing Parameter: Attribute value.")); + return KErrBadTestParameter; + } + + TPtrC value((*iMPXMediaArray)[mediaIndex]->ValueText(iMPXAttArray[attIndex])); + // verification + if ( value != expectedValue ) + { + iLog->Log(_L("Verification Failed: value=%S, expectedValue=%S."), &value, &expectedValue); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaValue() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaValue(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaValue testing CMPXMedia::Value() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaValue testing CMPXMedia::Value() begin")); + TInt err=KErrNone; + TUint mediaIndex; + TUint attIndex; + TPtrC className; + + // read in parameters + if ( aItem.GetNextInt(mediaIndex) ) + { + iLog->Log(_L("Missing Parameter: Media index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( mediaIndex >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Media index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(attIndex) ) + { + iLog->Log(_L("Missing Parameter: Attribute Index.")); + return KErrBadTestParameter; + } + if ( attIndex >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: Attribute Index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextString(className) ) + { + iLog->Log(_L("Missing Parameter: Class name.")); + return KErrBadTestParameter; + } + + // get attribute value + if ( className == _L("CMPXMedia") ) + { + CMPXMedia* media = (*iMPXMediaArray)[mediaIndex]->Value(iMPXAttArray[attIndex]); + // verification + if ( !media ) + { + iLog->Log(_L("Verification Failed: Function returned NULL.")); + err = KErrUnexpectedValue; + } + } + else if ( className == _L("CMPXMediaArray") ) + { + CMPXMediaArray* media = (*iMPXMediaArray)[mediaIndex]->Value(iMPXAttArray[attIndex]); + // verification + if ( !media ) + { + iLog->Log(_L("Verification Failed: Function returned NULL.")); + err = KErrUnexpectedValue; + } + } + else if ( className == _L("CMPXCollectionPath") ) + { + CMPXCollectionPath* media = (*iMPXMediaArray)[mediaIndex]->Value(iMPXAttArray[attIndex]); + // verification + if ( !media ) + { + iLog->Log(_L("Verification Failed: Function returned NULL.")); + err = KErrUnexpectedValue; + } + } + else + { + iLog->Log(_L("Bad Parameter: Invalid class name.")); + return KErrBadTestParameter; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaValueTObjectL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaValueTObjectL(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaValueTObjectL testing CMPXMedia::ValueTObjectL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaValueTObjectL testing CMPXMedia::ValueTObjectL() begin")); + TInt err=KErrNone; + TUint mediaIndex; + TUint attIndex; + TInt expectedValue; + + // read in parameters + if ( aItem.GetNextInt(mediaIndex) ) + { + iLog->Log(_L("Missing Parameter: Media index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( mediaIndex >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Media index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(attIndex) ) + { + iLog->Log(_L("Missing Parameter: Attribute Index.")); + return KErrBadTestParameter; + } + if ( attIndex >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: Attribute Index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(expectedValue) ) + { + iLog->Log(_L("Missing Parameter: Expected value.")); + return KErrBadTestParameter; + } + + // get attribute value + TInt value = (*iMPXMediaArray)[mediaIndex]->ValueTObjectL(iMPXAttArray[attIndex]); + // verification + if ( value != expectedValue ) + { + iLog->Log(_L("Verification Failed: value=%d, expectedValue=%d."), value, expectedValue); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaValueCObjectL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaValueCObjectL(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaValueCObjectL testing CMPXMedia::ValueCObjectL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaValueCObjectL testing CMPXMedia::ValueCObjectL() begin")); + TInt err=KErrNone; + TUint mediaIndex; + TUint attIndex; + TPtrC className; + + // read in parameters + if ( aItem.GetNextInt(mediaIndex) ) + { + iLog->Log(_L("Missing Parameter: Media index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( mediaIndex >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Media index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(attIndex) ) + { + iLog->Log(_L("Missing Parameter: Attribute Index.")); + return KErrBadTestParameter; + } + if ( attIndex >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: Attribute Index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextString(className) ) + { + iLog->Log(_L("Missing Parameter: Class name.")); + return KErrBadTestParameter; + } + + // Verify Attribute + if ( !(*iMPXMediaArray)[mediaIndex]->IsSupported(iMPXAttArray[attIndex]) ) + { + iLog->Log(_L("Bad Parameter: Invalid Attribute.")); + return KErrBadTestParameter; + } + // get attribute value + if ( className == _L("CMPXMedia") ) + { + CMPXMedia* media = (*iMPXMediaArray)[mediaIndex]->ValueCObjectL(iMPXAttArray[attIndex]); + delete media; + } + else if ( className == _L("CMPXMediaArray") ) + { + CMPXMediaArray* media = (*iMPXMediaArray)[mediaIndex]->ValueCObjectL(iMPXAttArray[attIndex]); + delete media; + } + else if ( className == _L("CMPXCollectionPath") ) + { + CMPXCollectionPath* path = (*iMPXMediaArray)[mediaIndex]->ValueCObjectL(iMPXAttArray[attIndex]); + delete path; + } + else + { + iLog->Log(_L("Bad Parameter: Invalid class name.")); + return KErrBadTestParameter; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaValueNoNewLCObjectL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaValueNoNewLCObjectL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaValueNoNewLCObjectL testing CMPXMedia::ValueNoNewLCObjectL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaValueNoNewLCObjectL testing CMPXMedia::ValueNoNewLCObjectL() begin")); + TInt err=KErrNone; + + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaStreamingL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaStreamingL(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaStreamingL testing CMPXMedia ExternalizeL and InternalizeL begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaStreamingL testing CMPXMedia ExternalizeL and InternalizeL begin")); + TInt err=KErrNone; + TUint mediaIndex; + + // read in parameters + if ( aItem.GetNextInt(mediaIndex) ) + { + iLog->Log(_L("Missing Parameter: Media index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( mediaIndex >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Media index out of range.")); + return KErrBadTestParameter; + } + + iLog->Log(_L("Start ExternalizeL")); + CBufBase* buffer = CBufFlat::NewL( 200 ); + CleanupStack::PushL( buffer ); + RBufWriteStream writeStream( *buffer ); + CleanupClosePushL( writeStream ); + (*iMPXMediaArray)[mediaIndex]->ExternalizeL( writeStream ); + writeStream.CommitL(); + buffer->Compress(); + CleanupStack::PopAndDestroy( &writeStream ); + + iLog->Log(_L("Start InternalizeL")); + RBufReadStream readStream( *buffer ); + CleanupClosePushL( readStream ); + CMPXMedia* media = CMPXMedia::NewL(); + CleanupStack::PushL( media ); + media->InternalizeL( readStream ); + // verification + for (TInt i=0;i<(*iMPXMediaArray)[mediaIndex]->Count();i++) + { + if ( media->IsSupported((*iMPXMediaArray)[mediaIndex]->Attribute(i)) == EFalse ) + { + iLog->Log(_L("Verification Failed: Attribute at index %d is not supported."), i); + err = KErrUnexpectedValue; + } + } + CleanupStack::PopAndDestroy( media ); + CleanupStack::PopAndDestroy( &readStream ); + CleanupStack::PopAndDestroy( buffer ); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaArrayNewL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaArrayNewL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayNewL testing CMPXMediaArray::NewL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaArrayNewL testing CMPXMediaArray::NewL() begin")); + TInt err=KErrNone; + + if ( iMPXMediaArray ) + { + delete iMPXMediaArray; + iMPXMediaArray = NULL; + } + iMPXMediaArray = CMPXMediaArray::NewL(); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaArrayNewLMediaArrayL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaArrayNewLMediaArrayL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayNewLMediaArrayL testing CMPXMediaArray::NewL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaArrayNewLMediaArrayL testing CMPXMediaArray::NewL() begin")); + TInt err=KErrNone; + + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + CMPXMediaArray* mediaArray = CMPXMediaArray::NewL(*iMPXMediaArray); + // verification + if ( mediaArray->Count() != iMPXMediaArray->Count() ) + { + iLog->Log(_L("Verification Failed: New array count=%d, old array count=%d."), + mediaArray->Count(), iMPXMediaArray->Count()); + err = KErrUnexpectedValue; + } + delete mediaArray; + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaArrayCount() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaArrayCount(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayCount testing CMPXMediaArray::Count() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaArrayCount testing CMPXMediaArray::Count() begin")); + TInt err=KErrNone; + TUint expectedCount; + + // read in parameters + if ( aItem.GetNextInt(expectedCount) ) + { + iLog->Log(_L("Missing Parameter: Expected count.")); + return KErrBadTestParameter; + } + + TInt count = iMPXMediaArray->Count(); + // verification + if ( count != expectedCount ) + { + iLog->Log(_L("Verification Failed: count=%d, expectedCount=%d."), count, expectedCount); + err = KErrUnexpectedValue; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaArrayAtLByIndexL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaArrayAtLByIndexL(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayAtLByIndexL testing CMPXMediaArray::Count() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaArrayAtLByIndexL testing CMPXMediaArray::Count() begin")); + TInt err = KErrNone; + + TUint expectedIndex; + + // read in parameters + if ( aItem.GetNextInt(expectedIndex) ) + { + iLog->Log(_L("Missing Parameter: Expected Index.")); + return KErrBadTestParameter; + } + TInt count = iMPXMediaArray->Count(); + if( expectedIndex >= count ) + { + iLog->Log(_L("Incorrect Parameter: Expected Index greater than the count of media array.")); + return KErrBadTestParameter; + } + CMPXMedia* media = iMPXMediaArray->AtL( expectedIndex ); + + if( media ) + { + iLog->Log(_L("MpxMediaArray::AtL(TInt aIndex) tested seccessfully.")); + return err; + } + else + { + iLog->Log(_L("No media pointer returns.")); + return KErrBadTestParameter; + } + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaArrayAppendLByPtrL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaArrayAppendLByPtrL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayAppendLByPtrL testing CMPXMediaArray::AppendL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaArrayAppendLByPtrL testing CMPXMediaArray::AppendL() begin")); + TInt err=KErrNone; + + CMPXMedia* media = CMPXMedia::NewL(); + CleanupStack::PushL(media); + iMPXMediaArray->AppendL(media); + CleanupStack::Pop(media); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaArrayAppendLByRefL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaArrayAppendLByRefL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayAppendLByRefL testing CMPXMediaArray::AppendL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaArrayAppendLByRefL testing CMPXMediaArray::AppendL() begin")); + TInt err=KErrNone; + + CMPXMedia* media = CMPXMedia::NewL(); + CleanupStack::PushL(media); + iMPXMediaArray->AppendL(*media); + CleanupStack::PopAndDestroy(media); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaArrayReset() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaArrayReset(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayReset testing CMPXMediaArray::Reset() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaArrayReset testing CMPXMediaArray::Reset() begin")); + TInt err=KErrNone; + + iMPXMediaArray->Reset(); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaArrayRemove() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaArrayRemove(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayRemove testing CMPXMediaArray::Remove() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaArrayRemove testing CMPXMediaArray::Remove() begin")); + TInt err=KErrNone; + TUint index; + + // read in parameters + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: Index.")); + return KErrBadTestParameter; + } + // verify index + if ( index >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Index out of range.")); + return KErrBadTestParameter; + } + + iMPXMediaArray->Remove(index); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaArrayInsertByPtr() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaArrayInsertByPtr(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayInsertByPtr testing CMPXMediaArray::Insert() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaArrayInsertByPtr testing CMPXMediaArray::Insert() begin")); + TInt err=KErrNone; + TUint index; + + // read in parameters + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: Index.")); + return KErrBadTestParameter; + } + // verify index + if ( index > iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Index out of range.")); + return KErrBadTestParameter; + } + + CMPXMedia* media; + TRAP(err,media = CMPXMedia::NewL()); + err = iMPXMediaArray->Insert(media, index); + if ( err ) + { + iLog->Log(_L("Error: Insert return error code %d."), err); + delete media; + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaArrayInsertByRef() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaArrayInsertByRef(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayInsertByRef testing CMPXMediaArray::Insert() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaArrayInsertByRef testing CMPXMediaArray::Insert() begin")); + TInt err=KErrNone; + TUint index; + + // read in parameters + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: Index.")); + return KErrBadTestParameter; + } + // verify index + if ( index > iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Index out of range.")); + return KErrBadTestParameter; + } + + CMPXMedia* media; + TRAP(err , media= CMPXMedia::NewL()); + err = iMPXMediaArray->Insert(*media, index); + if ( err ) + { + iLog->Log(_L("Error: Insert return error code %d."), err); + } + delete media; + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaArrayInsertLByPtrL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaArrayInsertLByPtrL(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayInsertLByPtrL testing CMPXMediaArray::InsertL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaArrayInsertLByPtrL testing CMPXMediaArray::InsertL() begin")); + TInt err=KErrNone; + TUint index; + + // read in parameters + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: Index.")); + return KErrBadTestParameter; + } + // verify index + if ( index > iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Index out of range.")); + return KErrBadTestParameter; + } + + CMPXMedia* media; + TRAP(err , media= CMPXMedia::NewL()); + CleanupStack::PushL(media); + TRAP(err , iMPXMediaArray->InsertL(media, index)); + CleanupStack::Pop(media); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaArrayInsertLByRefL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaArrayInsertLByRefL(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayInsertLByRefL testing CMPXMediaArray::InsertL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaArrayInsertLByRefL testing CMPXMediaArray::InsertL() begin")); + TInt err=KErrNone; + TUint index; + + // read in parameters + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: Index.")); + return KErrBadTestParameter; + } + // verify index + if ( index > iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Index out of range.")); + return KErrBadTestParameter; + } + + CMPXMedia* media; + TRAP(err , media= CMPXMedia::NewL()); + CleanupStack::PushL(media); + TRAP(err , iMPXMediaArray->InsertL(*media, index)); + CleanupStack::PopAndDestroy(media); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaArraySet() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaArraySet(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArraySet testing CMPXMediaArray::Set() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaArraySet testing CMPXMediaArray::Set() begin")); + TInt err=KErrNone; + TUint index; + + // read in parameters + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: Index.")); + return KErrBadTestParameter; + } + // verify index + if ( index >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Index out of range.")); + return KErrBadTestParameter; + } + + CMPXMedia* media; + TRAP(err , media= CMPXMedia::NewL()); + CleanupStack::PushL(media); + iMPXMediaArray->Set(*media, index); + CleanupStack::PopAndDestroy(media); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaArrayStreamingL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaArrayStreamingL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaArrayStreamingL testing CMPXMediaArray ExternalizeL and InternalizeL begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaArrayStreamingL testing CMPXMediaArray ExternalizeL and InternalizeL begin")); + TInt err=KErrNone; + + iLog->Log(_L("Start ExternalizeL")); + CBufBase* buffer = CBufFlat::NewL( 200 ); + CleanupStack::PushL( buffer ); + RBufWriteStream writeStream( *buffer ); + CleanupClosePushL( writeStream ); + iMPXMediaArray->ExternalizeL( writeStream ); + writeStream.CommitL(); + buffer->Compress(); + CleanupStack::PopAndDestroy( &writeStream ); + + iLog->Log(_L("Start InternalizeL")); + RBufReadStream readStream( *buffer ); + CleanupClosePushL( readStream ); + CMPXMediaArray* media = CMPXMediaArray::NewL(); + CleanupStack::PushL( media ); + media->InternalizeL( readStream ); + // verification + if ( media->Count() != iMPXMediaArray->Count() ) + { + iLog->Log(_L("Verification Failed: New Array Count=%d, Old Array Count=%d."), + media->Count(), iMPXMediaArray->Count()); + err = KErrUnexpectedValue; + } + CleanupStack::PopAndDestroy( media ); + CleanupStack::PopAndDestroy( &readStream ); + CleanupStack::PopAndDestroy( buffer ); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaCopyL() +// Returns: Symbian OS errors. +// add MpxMediaCopyL to testmpxmedia.cpp 9/18/2008 10:47 +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaCopyL(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaCopyL testing CMPXMedia::CopyL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaCopyL testing CMPXMedia::CopyL() begin")); + TInt err=KErrNone; + TUint index; + // read in parameters + if ( aItem.GetNextInt(index) ) + { + iLog->Log(_L("Missing Parameter: index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( index >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: index out of range.")); + return KErrBadTestParameter; + } + + CMPXMedia* media; + TRAP(err , media= CMPXMedia::NewL()); + CleanupStack::PushL(media); + TRAP(err,iMPXMediaArray->AppendL(media)); + CMPXMedia* media1=media->CopyL(*(*iMPXMediaArray)[index]); + CleanupStack::PushL(media1); + TRAP(err,iMPXMediaArray->AppendL(media1)); + CleanupStack::Pop(media1); + CleanupStack::Pop(media); + return err; +} +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaDeleteL() +// Returns: Symbian OS errors. +// add MpxMediaDeleteL to testmpxmedia.cpp +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaDeleteL(CStifItemParser&) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaDeleteL testing CMPXMedia::~ begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaDeleteL testing CMPXMedia::~ begin")); + TInt err = KErrNone; + delete iMPXMediaArray; + iMPXMediaArray = NULL; + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaDeleteL testing CMPXMedia::~ end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::MpxMediaDeleteL testing CMPXMedia::~ end err=%d"), err); + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaHeapMemoryInfoL() +// Returns: Symbian OS errors. +// add MpxMediaDeleteL to testmpxmedia.cpp +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaHeapMemoryInfoL(CStifItemParser&) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaHeapMemoryInfoL testing CMPXMedia::HeapMemoryInfoL begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaHeapMemoryInfoL testing CMPXMedia::HeapMemoryInfoL begin")); + + TInt err = KErrNone; + TInt total=0; + TInt used=0; + TInt& aTotal=total; + TInt& aUsed=used; + + CMPXMedia* media; + TRAP(err , media= CMPXMedia::NewL()); + CleanupStack::PushL(media); + TRAP(err,iMPXMediaArray->AppendL(media)); + TRAP(err,media->HeapMemoryInfoL(aTotal,aUsed)); + CleanupStack::Pop(media); + + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaHeapMemoryInfoL testing CMPXMedia::HeapMemoryInfoLend err=%d"), err)); + iLog->Log(_L("CCommonTestClass::MpxMediaHeapMemoryInfoL testing CMPXMedia::HeapMemoryInfoL end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaMergeMediaL() +// Returns: Symbian OS errors. +// add MpxMediaMergeMediaL to testmpxmedia.cpp +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaMergeMediaL(CStifItemParser&) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaMergeMediaL testing CMPXMedia::MergeMediaL begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaMergeMediaL testing CMPXMedia::MergeMediaL begin")); + TInt err = KErrNone; + TUint index=0; + + CMPXMedia* media; + TRAP(err , media= CMPXMedia::NewL()); + CleanupStack::PushL(media); + TRAP(err,iMPXMediaArray->AppendL(media)); + TRAP(err,media->MergeMediaL(*(*iMPXMediaArray)[index])); + CleanupStack::Pop(media); + + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaMergeMediaL testing CMPXMedia::MergeMediaL err=%d"), err)); + iLog->Log(_L("CCommonTestClass::MpxMediaMergeMediaL testing CMPXMedia::MergeMediaL end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaMatchL() +// Returns: Symbian OS errors. +// add MpxMediaMatchL to testmpxmedia.cpp 9/18/2008 10:47 +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaMatchL(CStifItemParser&) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaMatchL testing CMPXMedia::Match begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaMatchL testing CMPXMedia::Match begin")); + TInt err = KErrNone; + TUint index=0; + + CMPXMedia* media; + TRAP(err , media= CMPXMedia::NewL()); + CleanupStack::PushL(media); + TRAP(err ,iMPXMediaArray->AppendL(media)); + TInt countAttributes = iMPXAttArray.Count(); + TInt countMedias = iMPXMediaArray->Count(); + + if(countAttributes>0 & countMedias>0) + { + for(TInt i=0;iMatch(*(*iMPXMediaArray)[index],iMPXAttArray[i]); + } + } + CleanupStack::Pop(media); + + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaMatchL testing CMPXMedia::Match err=%d"), err)); + iLog->Log(_L("CCommonTestClass::MpxMediaMatchL testing CMPXMedia::Match end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaSetErrorL() +// Returns: Symbian OS errors. +// add MpxMediaSetErrorL to testmpxmedia.cpp 9/18/2008 10:47 +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaSetErrorL(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaSetErrorL testing CMPXMedia::SetErrorL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaSetErrorL testing CMPXMedia::SetErrorL() begin")); + TInt err=KErrNone; + TUint mediaIndex; + TUint attIndex; + TInt aError=1; + // read in parameters + if ( aItem.GetNextInt(mediaIndex) ) + { + iLog->Log(_L("Missing Parameter: Media index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( mediaIndex >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Media index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(attIndex) ) + { + iLog->Log(_L("Missing Parameter: Attribute index.")); + return KErrBadTestParameter; + } + if ( attIndex >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: Attribute index out of range.")); + return KErrBadTestParameter; + } + // set Error + (*iMPXMediaArray)[mediaIndex]->SetErrorL(iMPXAttArray[attIndex], aError); + + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaErrorL() +// Returns: Symbian OS errors. +// add MpxMediaErrorL to testmpxmedia.cpp 9/18/2008 10:47 +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaErrorL(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaErrorL testing CMPXMedia::Error() begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaErrorL testing CMPXMedia::Error() begin")); + TInt err=KErrNone; + TUint mediaIndex; + TUint attIndex; + // read in parameters + if ( aItem.GetNextInt(mediaIndex) ) + { + iLog->Log(_L("Missing Parameter: Media index.")); + return KErrBadTestParameter; + } + if ( !iMPXMediaArray ) + { + iLog->Log(_L("Error: MPXMediaArray not created.")); + return KErrBadTestParameter; + } + if ( mediaIndex >= iMPXMediaArray->Count() ) + { + iLog->Log(_L("Bad Parameter: Media index out of range.")); + return KErrBadTestParameter; + } + if ( aItem.GetNextInt(attIndex) ) + { + iLog->Log(_L("Missing Parameter: Attribute index.")); + return KErrBadTestParameter; + } + if ( attIndex >= iMPXAttArray.Count() ) + { + iLog->Log(_L("Bad Parameter: Attribute index out of range.")); + return KErrBadTestParameter; + } + // Error + (*iMPXMediaArray)[mediaIndex]->Error(iMPXAttArray[attIndex]); + + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaInternalizeL() +// Returns: Symbian OS errors. + +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaInternalizeL(CStifItemParser& ) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaInternalizeL testing CMPXMedia::InternalizeL begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaInternalizeL testing CMPXMedia::InternalizeL begin")); + TInt err = KErrNone; + + if ( iMPXMediaArray != NULL ) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaInternalizeL started InternalizeL"))); + iLog->Log(_L("CCommonTestClass::MpxMediaInternalizeL started InternalizeL")); + CBufBase* buffer = CBufFlat::NewL( 50 ); + CleanupStack::PushL( buffer ); + RBufWriteStream writeStream( *buffer ); + CleanupClosePushL( writeStream ); + iMPXMediaArray->ExternalizeL( writeStream ); + writeStream.CommitL(); + buffer->Compress(); + CleanupStack::PopAndDestroy( &writeStream ); + + RBufReadStream readStream( *buffer ); + CleanupClosePushL( readStream ); + + CMPXMedia* media = CMPXMedia::NewL(); + CleanupStack::PushL(media); + media->InternalizeL(readStream); + CleanupStack::PopAndDestroy( media ); + CleanupStack::PopAndDestroy( &readStream ); + CleanupStack::PopAndDestroy( buffer ); + } + else + { + err = KErrBadTestParameter; + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaInternalizeL Stif test script is wrong."))); + iLog->Log(_L("CCommonTestClass::MpxMediaInternalizeL Stif test script is wrong.")); + } + + + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaInternalizeL testing CMPXMedia::InternalizeL end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::MpxMediaInternalizeL testing CMPXMedia::InternalizeL end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxMediaExternalizeL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxMediaExternalizeL(CStifItemParser& ) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaExternalizeL testing CMPXMedia::ExternalizeL begin"))); + iLog->Log(_L("CCommonTestClass::MpxMediaExternalizeL testing CMPXMedia::ExternalizeL begin")); + TInt err = KErrNone; + if ( iMPXMediaArray != NULL ) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaExternalizeL started ExternalizeL"))); + iLog->Log(_L("CCommonTestClass::MpxMediaExternalizeL started ExternalizeL")); + CBufBase* buffer = CBufFlat::NewL( 50 ); + CleanupStack::PushL( buffer ); + RBufWriteStream writeStream( *buffer ); + CleanupClosePushL( writeStream ); + iMPXMediaArray->ExternalizeL( writeStream ); + writeStream.CommitL(); + buffer->Compress(); + CleanupStack::PopAndDestroy( &writeStream ); + CleanupStack::PopAndDestroy( buffer ); + } + else + { + err = KErrBadTestParameter; + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaExternalizeL Stif test script is wrong."))); + iLog->Log(_L("CCommonTestClass::MpxMediaExternalizeL Stif test script is wrong.")); + } + FTRACE(FPrint(_L("CCommonTestClass::MpxMediaExternalizeL testing CMPXMedia::ExternalizeL end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::MpxMediaExternalizeL testing CMPXMedia::ExternalizeL end err=%d"), err); + return err; + } + +// end of MPXMedia and MPXMediaArray (mpxmedia.h,mpxmediaarray.h) ============================================= diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxmessage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxmessage.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,185 @@ +/* +* 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: MPXMessage testing implementation (mpxmessage.h & mpxplaybackmessage.h) +* +*/ + + +#include + +#include +#include + +#include "commontestclass.h" + +// Begin TMPXMessage testing implementation (mpxmessage.h & mpxplaybackmessage.h) +// ----------------------------------------------------------------------------- +// CCommonTestClass::TMPXMessage3L() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::TMPXMessage3L() + { + FTRACE(FPrint(_L("CCommonTestClass::TMPXMessage3L testing TMPXMessage::TMPXMessage(...) begin"))); + iLog->Log(_L("CCommonTestClass::TMPXMessage3L testing TMPXMessage::TMPXMessage(...) begin")); + TInt err = KErrNone; + + TMPXPlaybackMessage message; + + message = TMPXPlaybackMessage(static_cast(KMPXMessageContentIdGeneral), + EMPXMessageGeneralId, + KMPXMessagePbMediaChanged); + + + FTRACE(FPrint(_L("CCommonTestClass::TMPXMessage3L testing TMPXMessage::TMPXMessage(...) end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::TMPXMessage3L testing TMPXMessage::TMPXMessage(...) end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::TMPXMessage1L() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::TMPXMessage1L() + { + FTRACE(FPrint(_L("CCommonTestClass::TMPXMessage1L testing TMPXMessage::TMPXMessage(..) begin"))); + iLog->Log(_L("CCommonTestClass::TMPXMessage1L testing TMPXMessage::TMPXMessage() begin")); + TInt err = KErrNone; + + TMPXMessage message; + + message = TMPXPlaybackMessage(static_cast(KMPXMessageContentIdGeneral), + EMPXMessageGeneralId, + KMPXMessagePbMediaChanged); + + TMPXMessage msg = TMPXMessage(message); + + TMPXPlaybackMessage message2; + message = TMPXPlaybackMessage(message2); + + FTRACE(FPrint(_L("CCommonTestClass::TMPXMessage1L testing TMPXMessage::TMPXMessage(..) end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::TMPXMessage1L testing TMPXMessage::TMPXMessage() end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::TMPXMessageL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::TMPXMessageL() + { + FTRACE(FPrint(_L("CCommonTestClass::TMPXMessageL testing TMPXMessage::TMPXMessage() begin"))); + iLog->Log(_L("CCommonTestClass::TMPXMessageL testing TMPXMessage::TMPXMessage() begin")); + TInt err = KErrNone; + + TMPXMessage message; + + message = TMPXMessage(); + + FTRACE(FPrint(_L("CCommonTestClass::TMPXMessageL testing TMPXMessage::TMPXMessage() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::TMPXMessageL testing TMPXMessage::TMPXMessage() end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::EqualTMPXMessage() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::EqualTMPXMessage() + { + FTRACE(FPrint(_L("CCommonTestClass::EqualTMPXMessage testing TMPXMessage::operator=(..) begin"))); + iLog->Log(_L("CCommonTestClass::EqualTMPXMessage testing TMPXMessage::operator=() begin")); + TInt err = KErrNone; + + TMPXMessage message; + + message = TMPXPlaybackMessage(static_cast(KMPXMessageContentIdGeneral), + EMPXMessageGeneralId, + KMPXMessagePbMediaChanged); + + TMPXMessage msg = TMPXMessage(message); + msg = message; + message = msg; + + FTRACE(FPrint(_L("CCommonTestClass::EqualTMPXMessage testing TMPXMessage::operator=(..) end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::EqualTMPXMessage testing TMPXMessage::operator=() end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::EqualTMPXMessage() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::Event() + { + FTRACE(FPrint(_L("CCommonTestClass::Event testing TMPXMessage::Event begin"))); + iLog->Log(_L("CCommonTestClass::Event testing TMPXMessage::Event begin")); + TInt err = KErrNone; + + TMPXMessage message = TMPXMessage(static_cast(KMPXMessageContentIdGeneral), + EMPXMessageGeneralId, + KMPXMessagePbMediaChanged); + + TInt event = message.Event(); + + FTRACE(FPrint(_L("CCommonTestClass::Event testing TMPXMessage::Event end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::Event testing TMPXMessage::Event end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::Type() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::Type() + { + FTRACE(FPrint(_L("CCommonTestClass::Type testing TMPXMessage::Type begin"))); + iLog->Log(_L("CCommonTestClass::Type testing TMPXMessage::Type begin")); + TInt err = KErrNone; + + TMPXMessage message = TMPXMessage(static_cast(KMPXMessageContentIdGeneral), + EMPXMessageGeneralId, + KMPXMessagePbMediaChanged); + + TInt type = message.Type(); + + FTRACE(FPrint(_L("CCommonTestClass::Type testing TMPXMessage::Type end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::Type testing TMPXMessage::Type end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::EqualTMPXMessage() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::Data() + { + FTRACE(FPrint(_L("CCommonTestClass::Data testing TMPXMessage::Data begin"))); + iLog->Log(_L("CCommonTestClass::Data testing TMPXMessage::Data begin")); + TInt err = KErrNone; + + TMPXMessage message = TMPXMessage(static_cast(KMPXMessageContentIdGeneral), + EMPXMessageGeneralId, + KMPXMessagePbMediaChanged); + + TInt data = message.Data(); + + FTRACE(FPrint(_L("CCommonTestClass::Data testing TMPXMessage::Data end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::Data testing TMPXMessage::Data end err=%d"), err); + return err; + } diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxmessagemonitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxmessagemonitor.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,204 @@ +/* +* 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: MPXMessageMonitor testing implementation (mpxmessagemonitor.h) +* +*/ + + +#include +#include + +#include "commontestclass.h" + +_LIT(KMPXCollectionServerName,"MPXCollectionServer"); +_LIT(KMPXCollectionServerImg,"mpxcollectionserver"); // DLL/EXE name +// UID +const TUid KMPXCollectionServerUid3={0x101FFC31}; +// Serverversion number +const TUint KMPXCollectionServerMajorVersionNumber=0; +const TUint KMPXCollectionServerMinorVersionNumber=1; +const TUint KMPXCollectionServerBuildVersionNumber=1; + +// Begin CMPXMessageMonitor testing implementation (mpxmessagemonitor.h)======================================= +// ----------------------------------------------------------------------------- +// CCommonTestClass::CreateCMPXMessageMonitorL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CreateCMPXMessageMonitorL() + { + FTRACE(FPrint(_L("CCommonTestClass::CreateCMPXMessageMonitorL testing CMPXMessageMonitor::NewL() begin"))); + iLog->Log(_L("CCommonTestClass::CreateCMPXMessageMonitorL testing CMPXMessageMonitor::NewL() begin")); + TInt err = KErrNone; + if ( iMsgMonitor != NULL) + { + delete iMsgMonitor; + } + iMsgMonitor = NULL; + + User::LeaveIfError( + iMessageSession.Connect(KMPXCollectionServerName, + KMPXCollectionServerImg, + TVersion(KMPXCollectionServerMajorVersionNumber, + KMPXCollectionServerMinorVersionNumber, + KMPXCollectionServerBuildVersionNumber))); + iMessageSession.SendReceiveL(EMcsSetMode,TIpcArgs(KMcModeDefault.iUid)); + + iMsgMonitor = CMPXMessageMonitor::NewL(iMessageSession, *this ); + + if ( iMsgMonitor == NULL) + { + err = KErrNotFound; + } + FTRACE(FPrint(_L("CCommonTestClass::CreateCMPXMessageMonitorL testing CMPXMessageMonitor::NewL() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CreateCMPXMessageMonitorL testing CMPXMessageMonitor::NewL() end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::DeleteCMPXMessageMonitorL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::DeleteCMPXMessageMonitorL() + { + FTRACE(FPrint(_L("CCommonTestClass::DeleteCMPXMessageMonitorL testing CMPXMessageMonitorL::~ begin"))); + iLog->Log(_L("CCommonTestClass::DeleteCMPXMessageMonitorL testing CMPXMessageMonitorL::~ begin")); + TInt err = KErrNone; + + iMsgMonitor->Cancel(); + delete iMsgMonitor; + iMessageSession.Close(); + iMsgMonitor = NULL; + + FTRACE(FPrint(_L("CCommonTestClass::DeleteCMPXMessageMonitorL testing CMPXMessageMonitorL::~ end=%d"), err)); + iLog->Log(_L("CCommonTestClass::DeleteCMPXMessageMonitorL testing CMPXMessageMonitorL::~ end=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::RunLCMPXMessageMonitorL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::RunLCMPXMessageMonitorL() + { + FTRACE(FPrint(_L("CCommonTestClass::RunLCMPXMessageMonitorL testing CMPXMessageMonitor::RunL begin"))); + iLog->Log(_L("CCommonTestClass::RunLCMPXMessageMonitorL testing CMPXMessageMonitor::RunL begin")); + TInt err = KErrNone; + + if ( iMsgMonitor != NULL ) + { + iMessageSession.SendReceiveL(EMcsNotifyEvent); + iMessageSession.SendReceiveL(EMcsGetSupportedTypes); + FTRACE(FPrint(_L("CCommonTestClass::RunLCMPXMessageMonitorL"))); + iLog->Log(_L("CCommonTestClass::RunLCMPXMessageMonitorL")); + } + else + { + err = KErrBadTestParameter; + FTRACE(FPrint(_L("CCommonTestClass::RunLCMPXMessageMonitorL Stif test script is wrong."))); + iLog->Log(_L("CCommonTestClass::RunLCMPXMessageMonitorL Stif test script is wrong.")); + } + + FTRACE(FPrint(_L("CCommonTestClass::GetNextMessage testing CMPXMessageMonitor::RunL end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::GetNextMessage testing CMPXMessageMonitor::RunL end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MessageReceived() +// Returns: none +// ----------------------------------------------------------------------------- +void CCommonTestClass::MessageReceived(TInt /*aMsgData*/, TInt /*aError*/) + { + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::GetNextMessageCMPXMessageMonitorL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::GetNextMessageCMPXMessageMonitorL() + { + FTRACE(FPrint(_L("CCommonTestClass::GetNextMessageCMPXMessageMonitorL testing GetNextMessage begin"))); + iLog->Log(_L("CCommonTestClass::GetNextMessageCMPXMessageMonitorL testing GetNextMessage begin")); + TInt err = KErrNone; + iMsgMonitor->GetNextMessage(); + delete iMsgMonitor; + iMessageSession.Close(); + iMsgMonitor = NULL; + FTRACE(FPrint(_L("CCommonTestClass::GetNextMessageCMPXMessageMonitorL testing GetNextMessage end=%d"), err)); + iLog->Log(_L("CCommonTestClass::GetNextMessageCMPXMessageMonitorL testing GetNextMessage end=%d"), err); + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::DoCancelCMPXMessageMonitorL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::DoCancelCMPXMessageMonitorL() + { + FTRACE(FPrint(_L("CCommonTestClass::DoCancelCMPXMessageMonitorL testing CMPXMessageMonitor::DoCancel begin"))); + iLog->Log(_L("CCommonTestClass::DoCancelCMPXMessageMonitorL testing CMPXMessageMonitor::DoCancel begin")); + TInt err = KErrNone; + + if ( iMsgMonitor != NULL ) + { + iMessageSession.SendReceiveL(EMcsNotifyEvent); + iMessageSession.SendReceiveL(EMcsGetSupportedTypes); + iMessageSession.SendReceiveL(EMcsCancelGetMessage); + FTRACE(FPrint(_L("CCommonTestClass::DoCancelCMPXMessageMonitorL"))); + iLog->Log(_L("CCommonTestClass::DoCancelCMPXMessageMonitorL")); + } + else + { + err = KErrBadTestParameter; + FTRACE(FPrint(_L("CCommonTestClass::DoCancelCMPXMessageMonitorL Stif test script is wrong."))); + iLog->Log(_L("CCommonTestClass::DoCancelCMPXMessageMonitorL Stif test script is wrong.")); + } + + FTRACE(FPrint(_L("CCommonTestClass::DoCancelCMPXMessageMonitorL testing CMPXMessageMonitor::DoCancel end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::DoCancelCMPXMessageMonitorL testing CMPXMessageMonitor::DoCancel end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::RunErrorCMPXMessageMonitorL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::RunErrorCMPXMessageMonitorL( ) + { + FTRACE(FPrint(_L("CCommonTestClass::RunErrorCMPXMessageMonitorL testing CMPXMessageMonitor::RunError begin"))); + iLog->Log(_L("CCommonTestClass::RunErrorCMPXMessageMonitorL testing CMPXMessageMonitor::RunError begin")); + TInt err = KErrNone; + + if ( iMsgMonitor != NULL ) + { + iMessageSession.SendReceiveL(EMcsNotifyEvent); + iMessageSession.SendReceiveL(EMcsGetSupportedTypes); + iMessageSession.SendReceiveL(EMcsCancelRequest); + FTRACE(FPrint(_L("CCommonTestClass::CMPXMessageMonitorL"))); + iLog->Log(_L("CCommonTestClass::RunErrorCMPXMessageMonitorL")); + } + else + { + err = KErrBadTestParameter; + FTRACE(FPrint(_L("CCommonTestClass::RunErrorCMPXMessageMonitorL Stif test script is wrong."))); + iLog->Log(_L("CCommonTestClass::RunErrorCMPXMessageMonitorL Stif test script is wrong.")); + } + + FTRACE(FPrint(_L("CCommonTestClass::RunErrorCMPXMessageMonitorL testing CMPXMessageMonitor::RunError end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::RunErrorCMPXMessageMonitorL testing CMPXMessageMonitor::RunError end err=%d"), err); + return err; + } diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxmessagequeue.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxmessagequeue.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,116 @@ +/* +* 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: MPXMessageQueue testing implementation (mpxmessagequeue.h) +* +*/ + + +#include + +#include "commontestclass.h" + +// Begin CMPXMessageQueue testing implementation (mpxmessagequeue.h)======================================= +// ----------------------------------------------------------------------------- +// CCommonTestClass::CreateCMPXMessageQueueL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CreateCMPXMessageQueueL() + { + FTRACE(FPrint(_L("CCommonTestClass::CreateCMPXMessageQueueL testing CMPXMessageQueue::NewL begin"))); + iLog->Log(_L("CCommonTestClass::CreateCMPXMessageQueueL testing CMPXMessageQueue::NewL begin")); + TInt err = KErrNone; + if ( iMessageQueue != NULL) + { + delete iMessageQueue; + } + iMessageQueue = NULL; + iMessageQueue = CMPXMessageQueue::NewL(); + if ( iMessageQueue == NULL) + { + err = KErrNotFound; + } + FTRACE(FPrint(_L("CCommonTestClass::CreateCMPXMessageQueueL testing CMPXMessageQueue::NewL end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CreateCMPXMessageQueueL testing CMPXMessageQueue::NewL end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::DeleteCMPXMessageQueue() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::DeleteCMPXMessageQueue() + { + FTRACE(FPrint(_L("CCommonTestClass::DeleteCMPXMessageQueue testing CMPXMessageQueue::~ begin"))); + iLog->Log(_L("CCommonTestClass::DeleteCMPXMessageQueue testing CMPXMessageQueue::~ begin")); + TInt err = KErrNone; + delete iMessageQueue; + iMessageQueue = NULL; + FTRACE(FPrint(_L("CCommonTestClass::DeleteCMPXMessageQueue testing CMPXMessageQueue::~ end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::DeleteCMPXMessageQueue testing CMPXMessageQueue::~ end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::ResetCMPXMessageQueue() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::ResetCMPXMessageQueue() + { + FTRACE(FPrint(_L("CCommonTestClass::ResetCMPXMessageQueue testing CMPXMessageQueue::Reset~ begin"))); + iLog->Log(_L("CCommonTestClass::ResetCMPXMessageQueue testing CMPXMessageQueue::Reset begin")); + TInt err = KErrNone; + iMessageQueue->Reset(); + FTRACE(FPrint(_L("CCommonTestClass::ResetCMPXMessageQueue testing CMPXMessageQueue::Reset end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::ResetCMPXMessageQueue testing CMPXMessageQueue::Reset end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::SendNextCMPXMessageQueue() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::SendNextCMPXMessageQueue() + { + FTRACE(FPrint(_L("CCommonTestClass::SendNextCMPXMessageQueue testing CMPXMessageQueue::SendNext begin"))); + iLog->Log(_L("CCommonTestClass::SendNextCMPXMessageQueue testing CMPXMessageQueue::SendNext begin")); + TInt err = KErrNone; + RMessage2 message; + iMessageQueue->SendNext(message); + FTRACE(FPrint(_L("CCommonTestClass::SendNextCMPXMessageQueue testing CMPXMessageQueue::SendNext end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::SendNextCMPXMessageQueue testing CMPXMessageQueue::SendNext end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::AddCMPXMessageQueue() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::AddCMPXMessageQueue() + { + FTRACE(FPrint(_L("CCommonTestClass::AddCMPXMessageQueue testing CMPXMessageQueue::Add begin"))); + iLog->Log(_L("CCommonTestClass::AddCMPXMessageQueue testing CMPXMessageQueue::Add begin")); + TInt err = KErrNone; + CMPXMessage *message; + TRAP(err , message = CMPXMessage::NewL()); + iMessageQueue->Add(message, err); + delete message; + FTRACE(FPrint(_L("CCommonTestClass::AddCMPXMessageQueue testing CMPXMessageQueue::Add end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::AddCMPXMessageQueue testing CMPXMessageQueue::Add end err=%d"), err); + return err; + } + + +// end of CMPXMessageQueue (mpxmessagequeue.h) ============================================= + + \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxparameter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxparameter.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,149 @@ +/* +* 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: MPXParameter testing implementation (mpxparameter.h) +* +*/ + + +#include +#include "commontestclass.h" + +#define KMPXPluginTypePlaybackUid 0x101FFCA0 + +// Begin CMPXParameter testing implementation (mpxparameter.h)======================================= +// ----------------------------------------------------------------------------- +// CCommonTestClass::CreateMPXParameterL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CreateMPXParameter() + { + FTRACE(FPrint(_L("CCommonTestClass::CreateMPXParameterL testing CMPXParameter::CMPXParameter() begin"))); + iLog->Log(_L("CCommonTestClass::CreateMPXParameterL testing CMPXParameter::CMPXParameter() begin")); + TInt err = KErrNone; + if ( iParameter != NULL) + { + delete iParameter; + } + iParameter = NULL; + TRAP(err , iParameter = new ( ELeave ) CMPXParameter()); + if ( iParameter == NULL) + { + err = KErrNotFound; + } + FTRACE(FPrint(_L("CCommonTestClass::CreateMPXParameterL testing CMPXParameter::CMPXParameter() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CreateMPXParameterL testing CMPXParameter::CMPXParameter() end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::DeleteMPXParameterL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::DeleteMPXParameter() + { + FTRACE(FPrint(_L("CCommonTestClass::DeleteMPXParameterL testing CMPXParameter::~ begin"))); + iLog->Log(_L("CCommonTestClass::DeleteMPXParameterL testing CMPXParameter::~ begin")); + TInt err = KErrNone; + delete iParameter; + iParameter = NULL; + FTRACE(FPrint(_L("CCommonTestClass::DeleteMPXParameterL testing CMPXParameter::~ end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::DeleteMPXParameterL testing CMPXParameter::~ end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::InternalizeMPXParameterL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::InternalizeMPXParameterL() + { + FTRACE(FPrint(_L("CCommonTestClass::InternalizeMPXParameterL testing CMPXParameter::InternalizeMPXParameterL begin"))); + iLog->Log(_L("CCommonTestClass::InternalizeMPXParameterL testing CMPXParameter::InternalizeMPXParameterL begin")); + TInt err = KErrNone; + + if ( iParameter != NULL ) + { + FTRACE(FPrint(_L("CCommonTestClass::InternalizeMPXParameterL started Internalize"))); + iLog->Log(_L("CCommonTestClass::InternalizeMPXParameterL started Internalize")); + CBufBase* buffer = CBufFlat::NewL( 50 ); + CleanupStack::PushL( buffer ); + RBufWriteStream writeStream( *buffer ); + CleanupClosePushL( writeStream ); + iParameter->ExternalizeL( writeStream ); + writeStream.CommitL(); + buffer->Compress(); + CleanupStack::PopAndDestroy( &writeStream ); + + RBufReadStream readStream( *buffer ); + CleanupClosePushL( readStream ); + iParameter = new ( ELeave ) CMPXParameter(); + iParameter->InternalizeL( readStream ); + CleanupStack::PopAndDestroy( &readStream ); + CleanupStack::PopAndDestroy( buffer ); + } + else + { + err = KErrBadTestParameter; + FTRACE(FPrint(_L("CCommonTestClass::InternalizeMPXParameterL Stif test script is wrong."))); + iLog->Log(_L("CCommonTestClass::InternalizeMPXParameterL Stif test script is wrong.")); + } + + + FTRACE(FPrint(_L("CCommonTestClass::InternalizeMPXParameterL testing CMPXParameter::InternalizeMPXParameterL end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::InternalizeMPXParameterL testing CMPXParameter::InternalizeMPXParameterL end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::ExternalizeMPXParameterL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::ExternalizeMPXParameterL() + { + FTRACE(FPrint(_L("CCommonTestClass::ExternalizeMPXParameterL testing CMPXParameter::ExternalizeMPXParameterL begin"))); + iLog->Log(_L("CCommonTestClass::ExternalizeMPXParameterL testing CMPXParameter::ExternalizeMPXParameterL begin")); + TInt err = KErrNone; + if ( iParameter != NULL ) + { + iParameter->iType.iUid = KMPXPluginTypePlaybackUid; + iParameter->iCmdForward = EMPXCmdFwdNone; + + FTRACE(FPrint(_L("CCommonTestClass::ExternalizeMPXParameterL started Externalize"))); + iLog->Log(_L("CCommonTestClass::ExternalizeMPXParameterL started Externalize")); + CBufBase* buffer = CBufFlat::NewL( 50 ); + CleanupStack::PushL( buffer ); + RBufWriteStream writeStream( *buffer ); + CleanupClosePushL( writeStream ); + iParameter->ExternalizeL( writeStream ); + writeStream.CommitL(); + buffer->Compress(); + CleanupStack::PopAndDestroy( &writeStream ); + CleanupStack::PopAndDestroy( buffer ); + } + else + { + err = KErrBadTestParameter; + FTRACE(FPrint(_L("CCommonTestClass::ExternalizeMPXParameterL Stif test script is wrong."))); + iLog->Log(_L("CCommonTestClass::ExternalizeMPXParameterL Stif test script is wrong.")); + } + FTRACE(FPrint(_L("CCommonTestClass::ExternalizeMPXParameterL testing CMPXParameter::ExternalizeMPXParameterL end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::ExternalizeMPXParameterL testing CMPXParameter::ExternalizeMPXParameterL end err=%d"), err); + return err; + } + + + + \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxpluginhandlerbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxpluginhandlerbase.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,806 @@ +/* +* 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: MPXPluginHandlerBase testing implementation (mpxpluginhandlerbase.h) +* +*/ + + +#include "commontestclass.h" +#include +#include + + +// Begin MPXPluginHandlerBase testing implementation (mpxpluginhandlerbase.h)============================ +const TUid KMPXPPluginHandlerBaseUid = {0x12345}; +const TUid KMPXPlaybackInterfaceUid = {0x21CD4510}; +class CDummyMpxPluginHandler : public CMPXPluginHandlerBase + { +public: // Constructors and destructor + CDummyMpxPluginHandler(); + ~CDummyMpxPluginHandler(); + + //void ResolvePluginL(); + + void BasePluginsChangedL(); + + TBool BaseIsPluginLoaded(const TUid& aPluginUid ); + + void BaseLoadPluginL(const TUid& aPluginUid); + + void BaseHandlePluginUnload(const TUid& aPluginUid); + + }; + +// ----------------------------------------------------------------------------- +// CDummyMpxPluginHandler::CDummyMpxPluginHandler() +// ----------------------------------------------------------------------------- + +CDummyMpxPluginHandler::CDummyMpxPluginHandler(): + CMPXPluginHandlerBase (KMPXPPluginHandlerBaseUid, CMPXPluginHandlerBase::ESelectionUid, 0,iObserver,CMPXPluginMonitor::NewL((TUid)KMPXPlaybackInterfaceUid/*, *this*/)) + { + TInt err = KErrNone; + TRAP(err,iDataType = HBufC8::NewL(11));//NULL; + TRAP(err,iScheme = HBufC8::NewL(9));//NULL; + TRAP(err,iExt = HBufC8::NewL(6));//NULL; + + TRAP(err,BaseConstructL()); //if protected export functions should be stifed, then this function + //must be took away and be tested separately. + } + + + +// ----------------------------------------------------------------------------- +// CDummyMpxPluginHandler::~CDummyMpxPluginHandler() +// ----------------------------------------------------------------------------- +CDummyMpxPluginHandler::~CDummyMpxPluginHandler() + { + } +// ----------------------------------------------------------------------------- +// CDummyMpxPluginHandler::BasePluginsChangedL() +// ----------------------------------------------------------------------------- +void CDummyMpxPluginHandler::BasePluginsChangedL() + { + PluginsChangedL(); + } + +// ----------------------------------------------------------------------------- +// CDummyMpxPluginHandler::BaseLoadPluginL() +// ----------------------------------------------------------------------------- +void CDummyMpxPluginHandler::BaseLoadPluginL(const TUid& aPluginUid) + { + LoadPluginL( aPluginUid ); + } + +// ----------------------------------------------------------------------------- +// CDummyMpxPluginHandler::BaseHandlePluginUnload() +// ----------------------------------------------------------------------------- +void CDummyMpxPluginHandler::BaseHandlePluginUnload(const TUid& aPluginUid) + { + HandlePluginUnload( aPluginUid ); + } + +// ----------------------------------------------------------------------------- +// CDummyMpxPluginHandler::BaseIsPluginLoaded() +// ----------------------------------------------------------------------------- +TBool CDummyMpxPluginHandler::BaseIsPluginLoaded(const TUid& aPluginUid ) + { + return IsPluginLoaded( aPluginUid ); + } + +// ----------------------------------------------------------------------------- +// CTestMpxPluginHandler::ResolvePluginL() +// ----------------------------------------------------------------------------- +//void CDummyMpxPluginHandler::ResolvePluginL() +// { +// +// } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBaseSelectPluginLIdL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBaseSelectPluginLIdL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseSelectPluginLIdL testing CMPXPluginHandlerBase::SelectPluginL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseSelectPluginLIdL testing CMPXPluginHandlerBase::SelectPluginL() begin")); + TInt err=KErrNone; + CDummyMpxPluginHandler pluginHandler; + pluginHandler.SelectPluginL(KMPXPPluginHandlerBaseUid); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBaseSelectPluginLNameL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBaseSelectPluginLNameL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseSelectPluginLNameL testing CMPXPluginHandlerBase::SelectPluginL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseSelectPluginLNameL testing CMPXPluginHandlerBase::SelectPluginL() begin")); + TInt err=KErrNone; + TBufC<10> name(_L("TestName")); + + CDummyMpxPluginHandler pluginHandler; + pluginHandler.SelectPluginL(name); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBaseSelectPluginLUriL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBaseSelectPluginLUriL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseSelectPluginLUriL testing CMPXPluginHandlerBase::SelectPluginL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseSelectPluginLUriL testing CMPXPluginHandlerBase::SelectPluginL() begin")); + TInt err=KErrNone; + TBufC<20> uri(_L("c:\\data\\test.mp3")); + + CDummyMpxPluginHandler pluginHandler; + pluginHandler.SelectPluginL(uri, KNullDesC8); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBaseSelectPluginLTypeL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBaseSelectPluginLTypeL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseSelectPluginLTypeL testing CMPXPluginHandlerBase::SelectPluginL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseSelectPluginLTypeL testing CMPXPluginHandlerBase::SelectPluginL() begin")); + TInt err=KErrNone; + TInt type=1; + + CDummyMpxPluginHandler pluginHandler; + pluginHandler.SelectPluginL(type); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBaseClearSelectionCriteria() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBaseClearSelectionCriteria(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseClearSelectionCriteria testing CMPXPluginHandlerBase::ClearSelectionCriteria() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseClearSelectionCriteria testing CMPXPluginHandlerBase::ClearSelectionCriteria() begin")); + TInt err=KErrNone; + CDummyMpxPluginHandler pluginHandler; + pluginHandler.ClearSelectionCriteria(); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBasePluginNameType() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBasePluginNameType(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBasePluginNameType testing CMPXPluginHandlerBase::PluginName() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBasePluginNameType testing CMPXPluginHandlerBase::PluginName() begin")); + TInt err=KErrNone; + TBufC<20> name; + + CDummyMpxPluginHandler pluginHandler; + name = pluginHandler.PluginName(0); + iLog->Log(_L("Plugin Name=%S"), &name); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBasePluginNamesL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBasePluginNamesL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBasePluginNamesL testing CMPXPluginHandlerBase::PluginNamesL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBasePluginNamesL testing CMPXPluginHandlerBase::PluginNamesL() begin")); + TInt err=KErrNone; + CDesCArray* names; + + CDummyMpxPluginHandler pluginHandler; + names = pluginHandler.PluginNamesL(); + iLog->Log(_L("Number of plugin names=%d"), names->Count()); + delete names; + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBaseSupportedMimeTypesL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBaseSupportedMimeTypesL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseSupportedMimeTypesL testing CMPXPluginHandlerBase::SupportedMimeTypesL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseSupportedMimeTypesL testing CMPXPluginHandlerBase::SupportedMimeTypesL() begin")); + TInt err=KErrNone; + CDesCArray* mimeType; + + CDummyMpxPluginHandler pluginHandler; + mimeType = pluginHandler.SupportedMimeTypesL(); + iLog->Log(_L("Number of plugin mimeType=%d"), mimeType->Count()); + delete mimeType; + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBaseSupportedExtensionsL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBaseSupportedExtensionsL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseSupportedExtensionsL testing CMPXPluginHandlerBase::SupportedExtensionsL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseSupportedExtensionsL testing CMPXPluginHandlerBase::SupportedExtensionsL() begin")); + TInt err=KErrNone; + CDesCArray* ext; + + CDummyMpxPluginHandler pluginHandler; + ext = pluginHandler.SupportedExtensionsL(); + iLog->Log(_L("Number of plugin extensions=%d"), ext->Count()); + delete ext; + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBaseSupportedSchemasL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBaseSupportedSchemasL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseSupportedSchemasL testing CMPXPluginHandlerBase::SupportedSchemasL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseSupportedSchemasL testing CMPXPluginHandlerBase::SupportedSchemasL() begin")); + TInt err=KErrNone; + CDesCArray* schemas; + + CDummyMpxPluginHandler pluginHandler; + schemas = pluginHandler.SupportedSchemasL(); + iLog->Log(_L("Number of plugin schemas=%d"), schemas->Count()); + delete schemas; + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBaseSupportedMimeTypesLUidL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBaseSupportedMimeTypesLUidL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseSupportedMimeTypesLUidL testing CMPXPluginHandlerBase::SupportedMimeTypesL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseSupportedMimeTypesLUidL testing CMPXPluginHandlerBase::SupportedMimeTypesL() begin")); + TInt err=KErrNone; + CDesCArray* mimeType; + + CDummyMpxPluginHandler pluginHandler; + mimeType = pluginHandler.SupportedMimeTypesL(KMPXPPluginHandlerBaseUid); + iLog->Log(_L("Number of plugin mimeType=%d"), mimeType->Count()); + delete mimeType; + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBaseSupportedExtensionsLUidL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBaseSupportedExtensionsLUidL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseSupportedExtensionsLUidL testing CMPXPluginHandlerBase::SupportedExtensionsL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseSupportedExtensionsLUidL testing CMPXPluginHandlerBase::SupportedExtensionsL() begin")); + TInt err=KErrNone; + CDesCArray* ext; + + CDummyMpxPluginHandler pluginHandler; + ext = pluginHandler.SupportedExtensionsL(KMPXPPluginHandlerBaseUid); + iLog->Log(_L("Number of plugin extensions=%d"), ext->Count()); + delete ext; + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBaseGetPluginTypes() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBaseGetPluginTypes(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseGetPluginTypes testing CMPXPluginHandlerBase::GetPluginTypes() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseGetPluginTypes testing CMPXPluginHandlerBase::GetPluginTypes() begin")); + TInt err=KErrNone; + RArray types; + + CDummyMpxPluginHandler pluginHandler; + pluginHandler.GetPluginTypes(types); + iLog->Log(_L("Number of plugin types=%d"), types.Count()); + types.Reset(); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBaseGetPluginUids() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBaseGetPluginUids(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseGetPluginUids testing CMPXPluginHandlerBase::GetPluginUids() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseGetPluginUids testing CMPXPluginHandlerBase::GetPluginUids() begin")); + TInt err=KErrNone; + RArray uids; + + CDummyMpxPluginHandler pluginHandler; + pluginHandler.GetPluginUids(uids); + iLog->Log(_L("Number of plugin uids=%d"), uids.Count()); + uids.Reset(); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBaseGetPluginUidsL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBaseGetPluginUidsL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseGetPluginUidsL testing CMPXPluginHandlerBase::GetPluginUidsL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseGetPluginUidsL testing CMPXPluginHandlerBase::GetPluginUidsL() begin")); + TInt err=KErrNone; + RArray uids; + + CDummyMpxPluginHandler pluginHandler; + pluginHandler.GetPluginUidsL(uids, 1); + iLog->Log(_L("Number of plugin uids=%d"), uids.Count()); + uids.Reset(); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBasePluginUid() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBasePluginUid(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBasePluginUid testing CMPXPluginHandlerBase::PluginUid() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBasePluginUid testing CMPXPluginHandlerBase::PluginUid() begin")); + TInt err=KErrNone; + TUid uid; + TBufC<10> name = _L("dummyName"); + + CDummyMpxPluginHandler pluginHandler; + uid = pluginHandler.PluginUid(name); + iLog->Log(_L("Plugin uid=%d"), uid.iUid); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBaseIndexOf() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBaseIndexOf(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseIndexOf testing CMPXPluginHandlerBase::IndexOf() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseIndexOf testing CMPXPluginHandlerBase::IndexOf() begin")); + TInt err=KErrNone; + + CDummyMpxPluginHandler pluginHandler; + TInt index = pluginHandler.IndexOf(KMPXPPluginHandlerBaseUid); + iLog->Log(_L("Plugin index=%d"), index); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBaseCreatePluginListL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBaseCreatePluginListL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseCreatePluginListL testing CMPXPluginHandlerBase::CreatePluginListL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseCreatePluginListL testing CMPXPluginHandlerBase::CreatePluginListL() begin")); + TInt err=KErrNone; + + CDummyMpxPluginHandler pluginHandler; + pluginHandler.CreatePluginListL(); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBaseFindPlugin() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBaseFindPlugin(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseFindPlugin testing CMPXPluginHandlerBase::FindPlugin() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseFindPlugin testing CMPXPluginHandlerBase::FindPlugin() begin")); + TInt err=KErrNone; + RArray uids; + + uids.Reset(); + CDummyMpxPluginHandler pluginHandler; + TUid uid = pluginHandler.FindPlugin(uids.Array()); + iLog->Log(_L("Plugin uid=%d"), uid.iUid); + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::CreateMpxPluginHandlerBase() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBaseSupportUids(CStifItemParser& /*aItem*/) + {//TODO need to update + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseSupportUids testing CMPXPluginHandlerBase::FindPlugin() SupportUids"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseSupportUids testing CMPXPluginHandlerBase::FindPlugin() SupportUids")); + + TInt err=KErrNone; + + const TUid KMPXCollectionServerUid={0x101FFC09};//KMPXCollectionServerUid={0x101FFC09};/KMPXCollectionServerUid={0x12345}; + RArray uids; + CleanupClosePushL( uids ); + TRAP(err,uids.AppendL(KMPXCollectionServerUid)); + + CDummyMpxPluginHandler* pluginHandler =new CDummyMpxPluginHandler(); + + //pluginHandler->CreatePluginListL(); + //pluginHandler->ResolvePluginL(); + pluginHandler->GetPluginUids( uids ); + //---------------------------------------------- + + TUid uid = pluginHandler->FindPlugin(uids.Array()); + pluginHandler->SupportUids(KMPXPPluginHandlerBaseUid,uids.Array()); + //pluginHandler->SupportUids(uid,uids.Array()); + CleanupStack::PopAndDestroy( &uids ); + delete pluginHandler; + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBaseDestruction() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBaseDestruction(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseDestruction testing CMPXPluginHandlerBase::~CMPXPluginHandlerBase() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseDestruction testing CMPXPluginHandlerBase::~CMPXPluginHandlerBase() begin")); + + TInt err = KErrNone; + CDummyMpxPluginHandler* pluginHandler =new CDummyMpxPluginHandler(); + delete pluginHandler; + pluginHandler = NULL; + + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseDestruction testing CMPXPluginHandlerBase::~CMPXPluginHandlerBase() end err=%d"),err)); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseDestruction testing CMPXPluginHandlerBase::~CMPXPluginHandlerBase() end err=%d"),err); + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBaseSelectPluginLRFile() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- + +TInt CCommonTestClass::MpxPluginHandlerBaseSelectPluginLRFile(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseSelectPluginLRFile testing CMPXPluginHandlerBase::SelectPluginL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseSelectPluginLRFile testing CMPXPluginHandlerBase::SelectPluginL() begin")); + TPtrC string; + TInt err = KErrNone; + RFile file; + + if( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(KCommonTestFilePath); + KFrom.Append(string); + RFs fs; + fs.Connect(); + file.Open(fs, KFrom, EFileShareReadersOrWriters); + + CDummyMpxPluginHandler pluginHandler; + //pluginHandler.SelectPluginL( file ); + TRAP(err,pluginHandler.SelectPluginL(file)); + if( err != KErrNone ) + { + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseSelectPluginLRFile testing CMPXPluginHandlerBase::SelectPluginL() end=%d"),err); + } + file.Close();//added on April 10,2009 + fs.Close(); + + } + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBaseSelectPluginLRFile64() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- + +TInt CCommonTestClass::MpxPluginHandlerBaseSelectPluginLRFile64(CStifItemParser& aItem) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseSelectPluginLRFile64 testing CMPXPluginHandlerBase::SelectPlugin64L() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseSelectPluginLRFile64 testing CMPXPluginHandlerBase::SelectPlugin64L() begin")); + TPtrC string; + TInt err = KErrNone; +#ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + err = KErrNotSupported; + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseSelectPluginLRFile64 testing CMPXPluginHandlerBase::SelectPlugin64L() end=%d"),err); +#else // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + RFile64 file; + + if( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(KCommonTestFilePath); + KFrom.Append(string); + RFs fs; + fs.Connect(); + file.Open(fs, KFrom, EFileShareReadersOrWriters); + + CDummyMpxPluginHandler pluginHandler; + //pluginHandler.SelectPluginL( file ); + TRAP(err,pluginHandler.SelectPlugin64L(file)); + if( err != KErrNone ) + { + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseSelectPluginLRFile64 testing CMPXPluginHandlerBase::SelectPlugin64L() end=%d"),err); + } + file.Close(); + fs.Close(); + + } +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBasePluginNameByUid() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBasePluginNameByUid(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBasePluginNameByUid testing CMPXPluginHandlerBase::PluginName() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBasePluginNameByUid testing CMPXPluginHandlerBase::PluginName() begin")); + + TInt err=KErrNone; + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBasePluginFlagsL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBasePluginFlagsL(CStifItemParser& /*aItem*/) + {//TODO need to update + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBasePluginFlagsL testing CMPXPluginHandlerBase::PluginFlagsL() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBasePluginFlagsL testing CMPXPluginHandlerBase::PluginFlagsL() begin")); + TInt err=KErrNone; + CDummyMpxPluginHandler pluginHandler; + + //TInt index = pluginHandler.IndexOf(KMPXPPluginHandlerBaseUid); + + pluginHandler.PluginFlagsL(KMPXPPluginHandlerBaseUid); + iLog->Log(_L("CCommonTestClass::MpxPluginType testing CMPXPluginHandlerBase::MpxPluginFlagsL() end"),err); + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBasePluginType() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBasePluginType(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBasePluginType testing CMPXPluginHandlerBase::PluginType() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBasePluginType testing CMPXPluginHandlerBase::PluginType() begin")); + TInt err=KErrNone; + + CDummyMpxPluginHandler pluginHandler; + pluginHandler.PluginType(KMPXPPluginHandlerBaseUid); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBasePluginType testing CMPXPluginHandlerBase::PluginType() end"),err); + + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBaseGetSelectionCriteria() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBaseGetSelectionCriteria(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseGetSelectionCriteria testing CMPXPluginHandlerBase::GetSelectionCriteria() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseGetSelectionCriteria testing CMPXPluginHandlerBase::GetSelectionCriteria() begin")); + + TInt err = KErrNone; + CDummyMpxPluginHandler pluginHandler; + CMPXPluginHandlerBase::TPluginSelection iSelectionP; + TInt iPluginType ; + TUid iTUid ; + TPtrC8 iDataTypeP; + TPtrC8 iSchemeP; + TPtrC8 iExtensionP; + + pluginHandler.GetSelectionCriteria(iSelectionP,iPluginType,iTUid,iDataTypeP,iSchemeP,iExtensionP); + + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseGetSelectionCriteria testing CMPXPluginHandlerBase::GetSelectionCriteria() end err=%d"),err)); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseGetSelectionCriteria testing CMPXPluginHandlerBase::GetSelectionCriteria() end err=%d"),err); + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBaseUsePluginTUid() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBaseUsePluginTUid(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseUsePluginTUid testing CMPXPluginHandlerBase::UsePlugin() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseUsePluginTUid testing CMPXPluginHandlerBase::UsePlugin() begin")); + + CDummyMpxPluginHandler pluginHandler; + TRAPD(err, pluginHandler.UsePlugin(KMPXPPluginHandlerBaseUid)); + + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseUsePluginTUid testing CMPXPluginHandlerBase::UsePlugin() end err=%d"),err)); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseUsePluginTUid testing CMPXPluginHandlerBase::UsePlugin() end err=%d"),err); + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBaseReleasePluginTUid() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHandlerBaseReleasePluginTUid(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseReleasePluginTUid testing CMPXPluginHandlerBase::ReleasePlugin() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseReleasePluginTUid testing CMPXPluginHandlerBase::ReleasePlugin() begin")); + + TInt err = KErrNone; + + CDummyMpxPluginHandler pluginHandler; + TBool check_unload = pluginHandler.ReleasePlugin(KMPXPPluginHandlerBaseUid); + + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseReleasePluginTUid testing CMPXPluginHandlerBase::ReleasePlugin() end"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseReleasePluginTUid testing CMPXPluginHandlerBase::ReleasePlugin() end")); + + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHandlerBaseCreate() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- + +TInt CCommonTestClass::MpxPluginHandlerBaseCreate() + { + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseCreate testing CMPXPluginHandlerBase::CMPXPluginHandlerBase() begin"))); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseCreate testing CMPXPluginHandlerBase::CMPXPluginHandlerBase() begin")); + TInt err = KErrNone; + + CDummyMpxPluginHandler* iPluginHandler=new CDummyMpxPluginHandler(); + + if ( iPluginHandler == NULL) + { + err = KErrNotFound; + } + + delete iPluginHandler; + FTRACE(FPrint(_L("CCommonTestClass::MpxPluginHandlerBaseCreate testing CMPXPluginHandlerBase::CMPXPluginHandlerBase() end err=%d"),err)); + iLog->Log(_L("CCommonTestClass::MpxPluginHandlerBaseCreate testing CMPXPluginHandlerBase::CMPXPluginHandlerBase() end err=%d"),err); + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHBBasePluginsChangedL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHBBasePluginsChangedL(CStifItemParser& /*aItem*/) + { + FTRACE( FPrint( _L("Test CMPXPluginHandlerBase::PluginsChangedL(),begins...") ) ); + iLog->Log( _L("Test CMPXPluginHandlerBase::PluginsChangedL(),begins...") ); + + TInt err = KErrNone; + + CDummyMpxPluginHandler pluginHandler; + //pluginHandler.BasePluginsChangedL(); + TRAP( err,pluginHandler.BasePluginsChangedL() ); + if( err ) + { + iLog->Log( _L("CMPXPluginHandlerBase::PluginsChangedL() returned error %d."),err ); + } + else + { + iLog->Log( _L("CMPXPluginHandlerBase::PluginsChangedL() returned no error.") ); + } + + FTRACE( FPrint( _L("Test CMPXPluginHandlerBase::PluginsChangedL(),end.") ) ); + iLog->Log( _L("Test CMPXPluginHandlerBase::PluginsChangedL(),end.") ); + + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHBBaseIsPluginLoaded() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHBBaseIsPluginLoaded(CStifItemParser& /*aItem*/) + { + FTRACE( FPrint( _L("Test CMPXPluginHandlerBase::IsPluginLoaded(),begins...") ) ); + iLog->Log( _L("Test CMPXPluginHandlerBase::IsPluginLoaded(),begins...") ); + + TInt err = KErrNone; + TUid pluginUid( KNullUid ); + + CDummyMpxPluginHandler pluginHandler; + TBool isLoaded = pluginHandler.BaseIsPluginLoaded( pluginUid ); + if( isLoaded ) + { + iLog->Log( _L("The relative plugin is loaded.") ); + } + else + { + iLog->Log( _L("The relative plugin is not loaded.") ); + } + + FTRACE( FPrint( _L("Test CMPXPluginHandlerBase::IsPluginLoaded(),end.") ) ); + iLog->Log( _L("Test CMPXPluginHandlerBase::IsPluginLoaded(),end.") ); + + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHBBaseLoadPluginL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHBBaseLoadPluginL(CStifItemParser& /*aItem*/) + { + FTRACE( FPrint( _L("Test CMPXPluginHandlerBase::LoadPluginL(),begins...") ) ); + iLog->Log( _L("Test CMPXPluginHandlerBase::LoadPluginL(),begins...") ); + + TInt err = KErrNone; + TUid pluginUid( KNullUid ); + + CDummyMpxPluginHandler pluginHandler; + //pluginHandler.BasePluginsChangedL( pluginUid ); + TRAP( err,pluginHandler.BaseLoadPluginL( pluginUid ) ); + if( err ) + { + iLog->Log( _L("CMPXPluginHandlerBase::LoadPluginL() returned error %d."),err ); + } + else + { + iLog->Log( _L("CMPXPluginHandlerBase::LoadPluginL() returned no error.") ); + } + + FTRACE( FPrint( _L("Test CMPXPluginHandlerBase::LoadPluginL(),end.") ) ); + iLog->Log( _L("Test CMPXPluginHandlerBase::LoadPluginL(),end.") ); + + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MpxPluginHBBaseHandlePluginUnload() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MpxPluginHBBaseHandlePluginUnload(CStifItemParser& /*aItem*/) + { + FTRACE( FPrint( _L("Test CMPXPluginHandlerBase::HandlePluginUnload(),begins...") ) ); + iLog->Log( _L("Test CMPXPluginHandlerBase::HandlePluginUnload(),begins...") ); + + TInt err = KErrNone; + TUid pluginUid( KNullUid ); + + CDummyMpxPluginHandler pluginHandler; + //pluginHandler.BaseHandlePluginUnload( pluginUid ); + TRAP( err,pluginHandler.BaseHandlePluginUnload( pluginUid ) ); + if( err ) + { + iLog->Log( _L("CMPXPluginHandlerBase::HandlePluginUnload() returned error %d."),err ); + } + else + { + iLog->Log( _L("CMPXPluginHandlerBase::HandlePluginUnload() returned no error.") ); + } + + FTRACE( FPrint( _L("Test CMPXPluginHandlerBase::HandlePluginUnload(),end.") ) ); + iLog->Log( _L("Test CMPXPluginHandlerBase::HandlePluginUnload(),end.") ); + + return err; + } + + + + + +//end of MPXPluginHandlerBase testing implementation (mpxpluginhandlerbase.h)=========================== + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxplugininfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxplugininfo.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,227 @@ +/* +* 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: ?Description +* +*/ + +#include +#include "commontestclass.h" +#include +#include + +#include + + +#define KNullUid TUid::Null() +class CDummyMpxPluginHandler : public CMPXPluginHandlerBase + { +public: // Constructors and destructor + CDummyMpxPluginHandler(); + ~CDummyMpxPluginHandler(); + + void ResolvePluginL(); + }; + +class CDummyCMPXPluginInfo : public CMPXPluginInfo + { +public: + CDummyCMPXPluginInfo(); + void BaseProcessTaggedDataExL(const TDesC8& aTag, const TDesC8& aData); + void BaseExtractIntoArrayL(const TDesC8& aText, CDesCArray*& aArray); + ~CDummyCMPXPluginInfo(); + }; + +// ----------------------------------------------------------------------------- +// CDummyCMPXPluginInfo::BaseProcessTaggedDataExL() +// ----------------------------------------------------------------------------- +void CDummyCMPXPluginInfo::BaseProcessTaggedDataExL(const TDesC8& aTag, const TDesC8& aData) + { + ProcessTaggedDataExL(aTag,aData); + } + +// ----------------------------------------------------------------------------- +// CDummyCMPXPluginInfo::BaseExtractIntoArrayL() +// ----------------------------------------------------------------------------- +void CDummyCMPXPluginInfo::BaseExtractIntoArrayL(const TDesC8& aText, CDesCArray*& aArray) + { + ExtractIntoArrayL(aText,aArray); + } + +// ----------------------------------------------------------------------------- +// CDummyCMPXPluginInfo::CDummyCMPXPluginInfo() +// ----------------------------------------------------------------------------- +CDummyCMPXPluginInfo::CDummyCMPXPluginInfo():CMPXPluginInfo() + { + //do nothing + } + +// ----------------------------------------------------------------------------- +// CDummyCMPXPluginInfo::~CDummyCMPXPluginInfo() +// ----------------------------------------------------------------------------- +CDummyCMPXPluginInfo::~CDummyCMPXPluginInfo() + { + //do nothing + } + + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::CMPXPluginInfoDestructor() +// Returns: Symbian OS errors. +// added +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CMPXPluginInfoDestructor() + { + FTRACE(FPrint(_L("CCommonTestClass::CMPXPluginInfoDestructor testing CMPXPluginInfo::~ begin"))); + iLog->Log(_L("CCommonTestClass::CMPXPluginInfoDestructor testing CMPXPluginInfo::~ begin")); + TInt err = KErrNone; + delete iPluginInfo; + iPluginInfo = NULL; + FTRACE(FPrint(_L("CCommonTestClass::CMPXPluginInfoDestructor testing CMPXPluginInfo::~ end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CMPXPluginInfoDestructor testing CMPXPluginInfo::~ end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::CMPXPluginInfoImplementationUid() +// Returns: Symbian OS errors. +// added +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CMPXPluginInfoImplementationUid(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::CMPXPluginInfoImplementationUid testing CMPXPluginInfo::ImplementationUid begin"))); + iLog->Log(_L("CCommonTestClass::CMPXPluginInfoImplementationUid testing CMPXPluginInfo::ImplementationUid begin")); + + TInt err = KErrNone; + + TRAP(err,iPluginInfo->ImplementationUid()); + + FTRACE(FPrint(_L("CCommonTestClass::CMPXPluginInfoImplementationUid testing CMPXPluginInfo::ImplementationUid end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CMPXPluginInfoImplementationUid testing CMPXPluginInfo::ImplementationUid end err=%d"), err); + + return err; + + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::CMPXPluginInfoFlags() +// Returns: Symbian OS errors. +// added +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CMPXPluginInfoFlags(CStifItemParser&) + {//TODO need to update + FTRACE(FPrint(_L("CCommonTestClass::CMPXPluginInfoFlags testing CMPXPluginInfo::Flags begin"))); + iLog->Log(_L("CCommonTestClass::CMPXPluginInfoFlags testing CMPXPluginInfo::Flags begin")); + TInt err = KErrNone; +// TUid iInterfaceUid; +// CDummyMpxPluginHandler pluginHandler; +// TRAP(err,pluginHandler.CreatePluginListL()); +// RMPXPointerArray implInfoArray; +// TRAP(err,REComSession::ListImplementationsL(iInterfaceUid, implInfoArray)); +// RPointerArray iPluginInfoArray; +// TUint ret( 0 ); +// TInt count = 1; +// TBool found( EFalse ); +// +// for( TInt i = 0; !found && i < count; ++i ) +// { +// if ( iPluginInfoArray[i]->ImplementationUid()== KNullUid ) +// { +// ret = iPluginInfoArray[i]->Flags(); +// found = ETrue; +// } +// } +// if ( !found ) +// { +// FTRACE(FPrint(_L("CCommonTestClass::CMPXPluginInfoFlags testing CMPXPluginInfo::Flags end return TUint=%d"), ret)); +// iLog->Log(_L("CCommonTestClass::CMPXPluginInfoFlags testing CMPXPluginInfo::Flags end return TUint=%d"), ret); +// User::Leave( KErrNotFound ); +// } +// REComSession::FinalClose(); + + _LIT8(KPluginData,"Plugin Data"); + _LIT8(KPluginTag,"Plugin Tag"); + //iPluginInfo->ProcessTaggedDataL( KPluginTag,KPluginData ); + TUint flag = iPluginInfo->Flags(); + + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::CMPXPluginInfoProcessTaggedDataExL() +// Returns: Symbian OS errors. +// added +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CMPXPluginInfoProcessTaggedDataExL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::CMPXPluginInfoProcessTaggedDataExL testing CMPXPluginInfo::ProcessTaggedDataExL begin"))); + iLog->Log(_L("CCommonTestClass::CMPXPluginInfoProcessTaggedDataExL testing CMPXPluginInfo::ProcessTaggedDataExL begin")); + + TInt err = KErrNone; + CDummyCMPXPluginInfo* dummyPluginInfo = new CDummyCMPXPluginInfo(); + _LIT8( KTag,"Tag"); + _LIT8( KData,"Data"); + //dummyPluginInfo->BaseProcessTaggedDataExL( KTag,KData ); + TRAP( err,dummyPluginInfo->BaseProcessTaggedDataExL( KTag,KData ) ); + if( err ) + { + iLog->Log( _L("CMPXPluginInfo::ProcessTaggedDataExL returned error %d."), err ); + } + else + { + iLog->Log( _L("CMPXPluginInfo::ProcessTaggedDataExL returned no error.") ); + } + delete dummyPluginInfo; + FTRACE(FPrint(_L("CCommonTestClass::CMPXPluginInfoProcessTaggedDataExL testing CMPXPluginInfo::ProcessTaggedDataExL end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CMPXPluginInfoProcessTaggedDataExL testing CMPXPluginInfo::ProcessTaggedDataExL end err=%d"), err); + + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::CMPXPluginInfoExtractIntoArrayL() +// Returns: Symbian OS errors. +// added +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CMPXPluginInfoExtractIntoArrayL(CStifItemParser& /*aItem*/) + { + FTRACE(FPrint(_L("CCommonTestClass::CMPXPluginInfoExtractIntoArrayL testing CMPXPluginInfo::ExtractIntoArrayL begin"))); + iLog->Log(_L("CCommonTestClass::CMPXPluginInfoExtractIntoArrayL testing CMPXPluginInfo::ExtractIntoArrayL begin")); + + TInt err = KErrNone; + CDummyCMPXPluginInfo* dummyPluginInfo = new CDummyCMPXPluginInfo(); + _LIT8( KTag,"Tag"); + //TDesC8 des; + CDesCArray* array = new(ELeave)CDesCArrayFlat(10); + array->AppendL(_L("test")); + + //dummyPluginInfo->BaseExtractIntoArrayL( KTag,array ); + + TRAP( err,dummyPluginInfo->BaseExtractIntoArrayL( KTag,array ) ); + if( err ) + { + iLog->Log( _L("CMPXPluginInfo::ExtractIntoArrayL returned error %d."), err ); + } + else + { + iLog->Log( _L("CMPXPluginInfo::ExtractIntoArrayL returned no error.") ); + } + delete dummyPluginInfo; + FTRACE(FPrint(_L("CCommonTestClass::CMPXPluginInfoExtractIntoArrayL testing CMPXPluginInfo::ExtractIntoArrayL end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CMPXPluginInfoExtractIntoArrayL testing CMPXPluginInfo::ExtractIntoArrayL end err=%d"), err); + + return err; + } + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxpskeywatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxpskeywatcher.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,253 @@ +/* +* 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: MPXPSKeyWatcher testing implementation (mpxcollectiontype.h) +* +*/ + + +#include +#include "commontestclass.h" + +// Begin CMPXPSKeyWatcher testing implementation (mpxcollectiontype.h)======================================= +// ----------------------------------------------------------------------------- +// CCommonTestClass::CreateCMPXPSKeyWatcherL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CreateCMPXPSKeyWatcherL() + { + FTRACE(FPrint(_L("CCommonTestClass::CreateCMPXPSKeyWatcherL testing CMPXPSKeyWatcher::CMPXPSKeyWatcher() begin"))); + iLog->Log(_L("CCommonTestClass::CreateCMPXPSKeyWatcherL testing CMPXPSKeyWatcher::CMPXPSKeyWatcher() begin")); + TInt err = KErrNone; + if ( iPSWatcher != NULL) + { + delete iPSWatcher; + } + iPSWatcher = NULL; + TUid KMmcEjectAppUid = { 0x101FFAFC }; + TUint KKeyMmcEjectOperation = 10; + iPSWatcher = CMPXPSKeyWatcher::NewL(KMmcEjectAppUid, + KKeyMmcEjectOperation, + this ); + if ( iPSWatcher == NULL) + { + err = KErrNotFound; + } + FTRACE(FPrint(_L("CCommonTestClass::CreateCMPXPSKeyWatcherL testing CMPXPSKeyWatcher::CMPXPSKeyWatcher() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CreateCMPXPSKeyWatcherL testing CMPXPSKeyWatcher::CMPXPSKeyWatcher() end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::DeleteCMPXPSKeyWatcherL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::DeleteCMPXPSKeyWatcherL() + { + FTRACE(FPrint(_L("CCommonTestClass::DeleteCMPXPSKeyWatcherL testing CMPXPSKeyWatcherL::~ begin"))); + iLog->Log(_L("CCommonTestClass::DeleteCMPXPSKeyWatcherL testing CMPXPSKeyWatcherL::~ begin")); + TInt err = KErrNone; + delete iPSWatcher; + iPSWatcher = NULL; + FTRACE(FPrint(_L("CCommonTestClass::DeleteCMPXPSKeyWatcherL testing CMPXPSKeyWatcherL::~ end=%d"), err)); + iLog->Log(_L("CCommonTestClass::DeleteCMPXPSKeyWatcherL testing CMPXPSKeyWatcherL::~ end=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::GetTntValue() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::GetTntValue() + { + FTRACE(FPrint(_L("CCommonTestClass::GetTntValue testing CMPXPSKeyWatcher::GetValue begin"))); + iLog->Log(_L("CCommonTestClass::GetTntValue testing CMPXPSKeyWatcher::GetValue begin")); + TInt err = KErrNone; + + if ( iPSWatcher != NULL ) + { + TInt value; + iPSWatcher->GetValue( value ); + FTRACE(FPrint(_L("CCommonTestClass::GetTntValue %d"), value)); + iLog->Log(_L("CCommonTestClass::GetTntValue %d"), value); + } + else + { + err = KErrBadTestParameter; + FTRACE(FPrint(_L("CCommonTestClass::GetTntValue Stif test script is wrong."))); + iLog->Log(_L("CCommonTestClass::GetTntValue Stif test script is wrong.")); + } + + + FTRACE(FPrint(_L("CCommonTestClass::GetTntValue testing CMPXPSKeyWatcher::GetValue end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::GetTntValue testing CMPXPSKeyWatcher::GetValue end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::GetDes8Value() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::GetDes8Value() + { + FTRACE(FPrint(_L("CCommonTestClass::GetDes8Value testing CMPXPSKeyWatcher::GetValue begin"))); + iLog->Log(_L("CCommonTestClass::GetDes8Value testing CMPXPSKeyWatcher::GetValue begin")); + TInt err = KErrNone; + + if ( iPSWatcher != NULL ) + { + TBuf8<20> value; + iPSWatcher->GetValue( value ); + FTRACE(FPrint(_L("CCommonTestClass::GetDes8Value"))); + iLog->Log(_L("CCommonTestClass::GetDes8Value")); + } + else + { + err = KErrBadTestParameter; + FTRACE(FPrint(_L("CCommonTestClass::GetDes8Value Stif test script is wrong."))); + iLog->Log(_L("CCommonTestClass::GetDes8Value Stif test script is wrong.")); + } + + FTRACE(FPrint(_L("CCommonTestClass::GetDes8Value testing CMPXPSKeyWatcher::GetValue end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::GetDes8Value testing CMPXPSKeyWatcher::GetValue end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::GetDes8Value() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::GetDes16Value() + { + FTRACE(FPrint(_L("CCommonTestClass::GetDes16Value testing CMPXPSKeyWatcher::GetValue begin"))); + iLog->Log(_L("CCommonTestClass::GetDes16Value testing CMPXPSKeyWatcher::GetValue begin")); + TInt err = KErrNone; + + if ( iPSWatcher != NULL ) + { + TBuf16<20> value; + iPSWatcher->GetValue( value ); + FTRACE(FPrint(_L("CCommonTestClass::GetDes16Value"))); + iLog->Log(_L("CCommonTestClass::GetDes16Value")); + } + else + { + err = KErrBadTestParameter; + FTRACE(FPrint(_L("CCommonTestClass::GetDes16Value Stif test script is wrong."))); + iLog->Log(_L("CCommonTestClass::GetDes16Value Stif test script is wrong.")); + } + + FTRACE(FPrint(_L("CCommonTestClass::GetDes16Value testing CMPXPSKeyWatcher::GetValue end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::GetDes16Value testing CMPXPSKeyWatcher::GetValue end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::SetTntValue() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::SetTntValue() + { + FTRACE(FPrint(_L("CCommonTestClass::SetTntValue testing CMPXPSKeyWatcher::SetValue begin"))); + iLog->Log(_L("CCommonTestClass::SetTntValue testing CMPXPSKeyWatcher::SetValue begin")); + TInt err = KErrNone; + + if ( iPSWatcher != NULL ) + { + TInt value = 2; + iPSWatcher->SetValue( value ); + FTRACE(FPrint(_L("CCommonTestClass::SetTntValue"))); + iLog->Log(_L("CCommonTestClass::SetTntValue")); + } + else + { + err = KErrBadTestParameter; + FTRACE(FPrint(_L("CCommonTestClass::SetTntValue Stif test script is wrong."))); + iLog->Log(_L("CCommonTestClass::SetTntValue Stif test script is wrong.")); + } + + + FTRACE(FPrint(_L("CCommonTestClass::SetTntValue testing CMPXPSKeyWatcher::SetValue end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::SetTntValue testing CMPXPSKeyWatcher::SetValue end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::SetDes8Value() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::SetDes8Value() + { + FTRACE(FPrint(_L("CCommonTestClass::SetDes8Value testing CMPXPSKeyWatcher::SetValue begin"))); + iLog->Log(_L("CCommonTestClass::SetDes8Value testing CMPXPSKeyWatcher::SetValue begin")); + TInt err = KErrNone; + + if ( iPSWatcher != NULL ) + { + TBuf8<20> value = _L8("test"); + iPSWatcher->SetValue( value ); + FTRACE(FPrint(_L("CCommonTestClass::SetDes8Value"))); + iLog->Log(_L("CCommonTestClass::SetDes8Value")); + } + else + { + err = KErrBadTestParameter; + FTRACE(FPrint(_L("CCommonTestClass::SetDes8Value Stif test script is wrong."))); + iLog->Log(_L("CCommonTestClass::SetDes8Value Stif test script is wrong.")); + } + + FTRACE(FPrint(_L("CCommonTestClass::SetDes8Value testing CMPXPSKeyWatcher::SetValue end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::SetDes8Value testing CMPXPSKeyWatcher::SetValue end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::SetDes16Value() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::SetDes16Value() + { + FTRACE(FPrint(_L("CCommonTestClass::SetDes16Value testing CMPXPSKeyWatcher::SetValue begin"))); + iLog->Log(_L("CCommonTestClass::SetDes16Value testing CMPXPSKeyWatcher::SetValue begin")); + TInt err = KErrNone; + + if ( iPSWatcher != NULL ) + { + TBuf16<20> value = _L("test"); + iPSWatcher->SetValue( value ); + FTRACE(FPrint(_L("CCommonTestClass::SetDes16Value"))); + iLog->Log(_L("CCommonTestClass::SetDes16Value")); + } + else + { + err = KErrBadTestParameter; + FTRACE(FPrint(_L("CCommonTestClass::SetDes16Value Stif test script is wrong."))); + iLog->Log(_L("CCommonTestClass::SetDes16Value Stif test script is wrong.")); + } + + FTRACE(FPrint(_L("CCommonTestClass::SetDes16Value testing CMPXPSKeyWatcher::SetValue end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::SetDes16Value testing CMPXPSKeyWatcher::SetValue end err=%d"), err); + return err; + } + + +void CCommonTestClass::HandlePSEvent(TUid /*aUid*/, TInt /*aKey*/) + { + } diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxsession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxsession.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,238 @@ +/* +* 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: RMPXSession testing implementation (mpxsession.h) +* +*/ + + +#include + +#include + +#include "commontestclass.h" + +_LIT(KMPXCollectionServerName,"MPXCollectionServer"); +_LIT(KMPXCollectionServerImg,"mpxcollectionserver"); // DLL/EXE name +// UID +const TUid KMPXCollectionServerUid3={0x101FFC31}; +// Serverversion number +const TUint KMPXCollectionServerMajorVersionNumber=0; +const TUint KMPXCollectionServerMinorVersionNumber=1; +const TUint KMPXCollectionServerBuildVersionNumber=1; + +// Begin RMPXSession testing implementation (mpxsession.h)======================================= +// ----------------------------------------------------------------------------- +// CCommonTestClass::VersionRMPXSession() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::VersionRMPXSession() + { + FTRACE(FPrint(_L("CCommonTestClass::VersionRMPXSession testing RMPXSession::Version begin"))); + iLog->Log(_L("CCommonTestClass::VersionRMPXSession testing RMPXSession::Version begin")); + TInt err = KErrNone; + RMPXSession session; + session.Version(); + FTRACE(FPrint(_L("CCommonTestClass::VersionRMPXSession testing RMPXSession::Version end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::VersionRMPXSession testing RMPXSession::Version end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::ConnectRMPXSessionL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::ConnectRMPXSessionL() + { + FTRACE(FPrint(_L("CCommonTestClass::ConnectRMPXSessionL testing RMPXSession::Connect begin"))); + iLog->Log(_L("CCommonTestClass::ConnectRMPXSessionL testing RMPXSession::Connect begin")); + TInt err = KErrNone; + RMPXSession session; + User::LeaveIfError( + session.Connect(KMPXCollectionServerName, + KMPXCollectionServerImg, + TVersion(KMPXCollectionServerMajorVersionNumber, + KMPXCollectionServerMinorVersionNumber, + KMPXCollectionServerBuildVersionNumber))); + session.SendReceiveL(EMcsSetMode,TIpcArgs(KMcModeDefault.iUid)); + session.Close(); + FTRACE(FPrint(_L("CCommonTestClass::ConnectRMPXSessionL testing RMPXSession::Connect end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::ConnectRMPXSessionL testing RMPXSession::Connect end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::ReconnectRMPXSessionL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::ReconnectRMPXSessionL() + { + FTRACE(FPrint(_L("CCommonTestClass::ReconnectRMPXSessionL testing RMPXSession::Reconnect begin"))); + iLog->Log(_L("CCommonTestClass::ReconnectRMPXSessionL testing RMPXSession::Reconnect begin")); + TInt err = KErrNone; + RMPXSession session; + User::LeaveIfError( + session.Connect(KMPXCollectionServerName, + KMPXCollectionServerImg, + TVersion(KMPXCollectionServerMajorVersionNumber, + KMPXCollectionServerMinorVersionNumber, + KMPXCollectionServerBuildVersionNumber))); + session.Close(); + + User::LeaveIfError( session.Reconnect() ); + session.SendReceiveL(EMcsSetMode,TIpcArgs(KMcModeDefault.iUid)); + session.Close(); + + FTRACE(FPrint(_L("CCommonTestClass::ReconnectRMPXSessionL testing RMPXSession::Reconnect end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::ReconnectRMPXSessionL testing RMPXSession::Reconnect end err=%d"), err); + return err; + } + +// CCommonTestClass::SendReceiveLRMPXSessionL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::SendReceiveLRMPXSessionL() + { + FTRACE(FPrint(_L("CCommonTestClass::SendReceiveLRMPXSessionL testing RMPXSession::SendReceiveL begin"))); + iLog->Log(_L("CCommonTestClass::SendReceiveLRMPXSessionL testing RMPXSession::SendReceiveL begin")); + + TInt err = KErrNone; + RMPXSession session; + User::LeaveIfError( + session.Connect(KMPXCollectionServerName, + KMPXCollectionServerImg, + TVersion(KMPXCollectionServerMajorVersionNumber, + KMPXCollectionServerMinorVersionNumber, + KMPXCollectionServerBuildVersionNumber))); + session.SendReceiveL(EMcsSetMode); + session.Close(); + + FTRACE(FPrint(_L("CCommonTestClass::SendReceiveLRMPXSessionL testing RMPXSession::SendReceiveL end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::SendReceiveLRMPXSessionL testing RMPXSession::SendReceiveL end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::SendReceiveStatusRMPXSessionL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::SendReceiveStatusRMPXSessionL() + { + FTRACE(FPrint(_L("CCommonTestClass::SendReceiveStatusRMPXSessionL testing RMPXSession::SendReceiveL begin"))); + iLog->Log(_L("CCommonTestClass::SendReceiveStatusRMPXSessionL testing RMPXSession::SendReceiveL begin")); + + TInt err = KErrNone; + RMPXSession session; + User::LeaveIfError( + session.Connect(KMPXCollectionServerName, + KMPXCollectionServerImg, + TVersion(KMPXCollectionServerMajorVersionNumber, + KMPXCollectionServerMinorVersionNumber, + KMPXCollectionServerBuildVersionNumber))); + session.SendReceiveL(EMcsSetMode); + TRequestStatus status = 5; + session.SendReceive( EMcsGetUid, status ); + User::WaitForRequest( status ); //added on 2009,2,12 + session.Close(); + + FTRACE(FPrint(_L("CCommonTestClass::SendReceiveStatusRMPXSessionL testing RMPXSession::SendReceiveL end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::SendReceiveStatusRMPXSessionL testing RMPXSession::SendReceiveL end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::SendReceiveStatus3RMPXSessionL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::SendReceiveStatus3RMPXSessionL() + { + FTRACE(FPrint(_L("CCommonTestClass::SendReceiveStatus3RMPXSessionL testing RMPXSession::SendReceiveL begin"))); + iLog->Log(_L("CCommonTestClass::SendReceiveStatus3RMPXSessionL testing RMPXSession::SendReceiveL begin")); + + TInt err = KErrNone; + RMPXSession session; + User::LeaveIfError( + session.Connect(KMPXCollectionServerName, + KMPXCollectionServerImg, + TVersion(KMPXCollectionServerMajorVersionNumber, + KMPXCollectionServerMinorVersionNumber, + KMPXCollectionServerBuildVersionNumber))); + TRequestStatus status; + session.SendReceive(EMcsSetMode,TIpcArgs(KMcModeDefault.iUid), status); + User::WaitForRequest( status ); //added on 2009,2,12 + session.Close(); + + FTRACE(FPrint(_L("CCommonTestClass::SendReceiveStatus3RMPXSessionL testing RMPXSession::SendReceiveL end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::SendReceiveStatus3RMPXSessionL testing RMPXSession::SendReceiveL end err=%d"), err); + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::SendReceiveLTIpcArgsRMPXSessionL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::SendReceiveLTIpcArgsRMPXSessionL() + { + FTRACE(FPrint(_L("CCommonTestClass::SendReceiveLTIpcArgsRMPXSessionL testing RMPXSession::SendReceiveL begin"))); + iLog->Log(_L("CCommonTestClass::SendReceiveLTIpcArgsRMPXSessionL testing RMPXSession::SendReceiveL begin")); + TInt err = KErrNone; + RMPXSession session; + User::LeaveIfError( + session.Connect(KMPXCollectionServerName, + KMPXCollectionServerImg, + TVersion(KMPXCollectionServerMajorVersionNumber, + KMPXCollectionServerMinorVersionNumber, + KMPXCollectionServerBuildVersionNumber))); + session.SendReceiveL(EMcsSetMode,TIpcArgs(KMcModeDefault.iUid)); + session.Close(); + FTRACE(FPrint(_L("CCommonTestClass::SendReceiveLTIpcArgsRMPXSessionL testing RMPXSession::SendReceiveL end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::SendReceiveLTIpcArgsRMPXSessionL testing RMPXSession::SendReceiveL end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::CreateRMPXSessionL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CreateRMPXSession() + { + FTRACE(FPrint(_L("CCommonTestClass::CreateRMPXSession testing RMPXSession::RMPXSession begin"))); + iLog->Log(_L("CCommonTestClass::CreateRMPXSession testing RMPXSession::RMPXSession begin")); + TInt err = KErrNone; + RMPXSession session; + FTRACE(FPrint(_L("CCommonTestClass::CreateRMPXSession testing RMPXSession::RMPXSession end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CreateRMPXSession testing RMPXSession::RMPXSession end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::CloseAndDestructRMPXSession() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CloseAndDestructRMPXSession() + { + FTRACE(FPrint(_L("CCommonTestClass::CloseAndDestructRMPXSession testing RMPXSession::~RMPXSession begin"))); + iLog->Log(_L("CCommonTestClass::CloseAndDestructRMPXSession testing RMPXSession::~RMPXSession begin")); + TInt err = KErrNone; + RMPXSession session; + session.Close(); + FTRACE(FPrint(_L("CCommonTestClass::CloseAndDestructRMPXSession testing RMPXSession::~RMPXSession end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CloseAndDestructRMPXSession testing RMPXSession::~RMPXSession end err=%d"), err); + return err; + } + +// end of RMPXSession (mpxsession.h) ============================================= + + \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxsubscription.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxsubscription.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,184 @@ +/* +* 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: ?Description +* +*/ + + +#include "commontestclass.h" +#include + +// ----------------------------------------------------------------------------- +// CCommonTestClass::CMPXSubscriptionNewL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CMPXSubscriptionNewL(CStifItemParser& /*aItem*/) + { + FTRACE( FPrint( _L("CCommonTestClass::CMPXSubscription testing CMPXSubscription::NewL begin") ) ); + iLog->Log( _L("CCommonTestClass::CMPXSubscription testing CMPXSubscription::NewL begin") ); + TInt result = KErrNone; + if( !iSubscription ) + { + TRAP( result,iSubscription = CMPXSubscription::NewL() ); + //iSubscription = CMPXSubscription::NewL(); + if( result == KErrNone ) + { + iLog->Log( _L("Successfully create instance of CMPXSubscription, none error returns.\r\n") ); + } + else + { + iLog->Log( _L("Failed to create instance of CMPXSubscription,error %d returns.\r\n"),result ); + } + } + else + { + iLog->Log( _L("instance of CMPXSubscription has already existed.\r\n") ); + } + return result; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::CMPXSubscriptionNewLWithediaArrayL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CMPXSubscriptionNewLWithMediaArrayL(CStifItemParser& /*aItem*/) + { + FTRACE( FPrint( _L("CCommonTestClass::CMPXSubscription testing CMPXSubscription::NewL(CMPXMediaArray& aMediaArray) begin") ) ); + iLog->Log( _L("CCommonTestClass::CMPXSubscription testing CMPXSubscription::NewL(CMPXMediaArray& aMediaArray) begin") ); + TInt result = KErrNone; + if( !iSubscription ) + { + TRAP( result,iSubscription = CMPXSubscription::NewL( *iMPXMediaArray ) ); + //iSubscription = CMPXSubscription::NewL( *iMPXMediaArray ); + if( result == KErrNone ) + { + iLog->Log( _L("Successfully create instance of CMPXSubscription, none error returns.\r\n") ); + } + else + { + iLog->Log( _L("Failed to create instance of CMPXSubscription,error %d returns.\r\n"),result ); + } + } + else + { + iLog->Log( _L("instance of CMPXSubscription has already existed.\r\n") ); + } + return result; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::CMPXSubscriptionAddItemL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CMPXSubscriptionAddItemL(CStifItemParser& /*aItem*/) + { + FTRACE( FPrint( _L("CCommonTestClass::CMPXSubscription testing CMPXSubscription::AddItemL() begin") ) ); + iLog->Log( _L("CCommonTestClass::CMPXSubscription testing CMPXSubscription::AddItemL() begin") ); + TInt result = KErrNone; + CMPXSubscriptionItem* subscriptionItem = CMPXSubscriptionItem::NewL(); + CleanupStack::PushL( subscriptionItem ); + TRAP( result,iSubscription->AddItemL( *subscriptionItem ) ); + //iSubscription->AddItemL( *subscriptionItem ); + CleanupStack::Pop(); + if( result == KErrNone ) + { + iLog->Log( _L("Successfully add item to CMPXSubscription instance.No error returns.\r\n") ); + } + else + { + iLog->Log( _L("Failed to add item to CMPXSubscription instance.Error %d returns.\r\n"),result ); + } + return result; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::CMPXSubscriptionItemsL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CMPXSubscriptionItemsL(CStifItemParser& /*aItem*/) + { + FTRACE( FPrint( _L("CCommonTestClass::CMPXSubscription testing CMPXSubscription::ItemsL() begin") ) ); + iLog->Log( _L("CCommonTestClass::CMPXSubscription testing CMPXSubscription::ItemsL() begin") ); + TInt result = KErrNone; + + const CMPXMediaArray* mediaArray; + TRAP( result,mediaArray = iSubscription->ItemsL() ); + //mediaArray = iSubscription->ItemsL(); + //TInt count = mediaArray->Count(); + + if( result == KErrNone ) + { + iLog->Log( _L("Successfully get CMPXMediaArray pionter.No error returns.\r\n") ); + } + else + { + iLog->Log( _L("Failed to get CMPXMediaArray pionter.Error %d returns.\r\n"),result ); + } + return result; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::CMPXSubscriptionIsEqualOperator() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CMPXSubscriptionIsEqualOperator(CStifItemParser& aItem) + { + FTRACE( FPrint( _L("CCommonTestClass::CMPXSubscription testing CMPXSubscription::operator==() begin") ) ); + iLog->Log( _L("CCommonTestClass::CMPXSubscription testing CMPXSubscription::operator==() begin") ); + TInt result = KErrNone; + TBool IsEqual; + + TInt EqualTag; + if( aItem.GetNextInt( EqualTag ) == KErrNone ) + { + if( EqualTag ) + { + CMPXSubscription* subscription = CMPXSubscription::NewL( *iMPXMediaArray ); + IsEqual = iSubscription->operator==( *subscription ); + } + else + { + CMPXMediaArray* mediaArray = CMPXMediaArray::NewL(); + CMPXSubscription* subscription = CMPXSubscription::NewL( *mediaArray ); + + CMPXSubscriptionItem* subscriptionItem = CMPXSubscriptionItem::NewL(); + CleanupStack::PushL( subscriptionItem ); + TRAP( result,iSubscription->AddItemL( *subscriptionItem ) ); + //iSubscription->AddItemL( *subscriptionItem ); + + CMPXSubscriptionItem* subscriptionItem2 = CMPXSubscriptionItem::NewL(); + CleanupStack::PushL( subscriptionItem2 ); + TRAP( result,iSubscription->AddItemL( *subscriptionItem2 ) ); + //iSubscription->AddItemL( *subscriptionItem2 ); + CleanupStack::Pop( 2 ); + + IsEqual = iSubscription->operator==( *subscription ); + } + + if( IsEqual ) + { + iLog->Log( _L("The 2 CMPXSubscription instances are equal.\r\n") ); + } + else + { + iLog->Log( _L("The 2 CMPXSubscription instances are not equal.\r\n"),result ); + } + } + else + { + iLog->Log( _L("Bad test parameter is passed in, leave here.\r\n"),result ); + result = KErrBadTestParameter; + User::Leave( result ); + } + return result; + } + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxuser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxuser.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,658 @@ +/* +* 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: MPXUser testing implementation (mpxuser.h) +* +*/ + + +#include + +#include +#include + +#include "commontestclass.h" +#include "mpxuser.h" + +#include +#include "EdwinTestControl.h" +#include + +// Begin MPXUser testing implementation (mpxuser.h)======================================= +// ----------------------------------------------------------------------------- +// CCommonTestClass::CompareUids() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CompareUids() + { + FTRACE(FPrint(_L("CCommonTestClass::CompareUids testing MPXUser::CompareUids() begin"))); + iLog->Log(_L("CCommonTestClass::CompareUids testing MPXUser::CompareUids() begin")); + TInt err = KErrNone; + const TUid KMPXCollectionServerUid3={0x101FFC31}; + const TUid KPodcastCollection = {0x101FFB31}; + + TInt notequal = MPXUser::CompareUids(KMPXCollectionServerUid3, KPodcastCollection); + TInt equal = MPXUser::CompareUids(KMPXCollectionServerUid3, KMPXCollectionServerUid3); + + if ( !notequal || equal ) + { + err = KErrUnexpectedValue; + } + + FTRACE(FPrint(_L("CCommonTestClass::CompareUids testing MPXUser::CompareUids() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CompareUids testing MPXUser::CompareUids() end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::IsCallOngoing() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::IsCallOngoing() + { + FTRACE(FPrint(_L("CCommonTestClass::IsCallOngoing testing MPXUser::IsCallOngoing() begin"))); + iLog->Log(_L("CCommonTestClass::IsCallOngoing testing MPXUser::IsCallOngoing() begin")); + TInt err = KErrNone; + + MPXUser::IsCallOngoing(EPSCTsyCallTypeH324Multimedia); + + FTRACE(FPrint(_L("CCommonTestClass::IsCallOngoing testing MPXUser::IsCallOngoing() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::IsCallOngoing testing MPXUser::IsCallOngoing() end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::CompleteWithDllPath() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CompleteWithDllPath() + { + FTRACE(FPrint(_L("CCommonTestClass::CompleteWithDllPath testing MPXUser::CompleteWithDllPath() begin"))); + iLog->Log(_L("CCommonTestClass::CompleteWithDllPath testing MPXUser::CompleteWithDllPath() begin")); + TInt err = KErrNone; + + TParse parse; + _LIT(KMPXCollectionDbResourceFile, "mpxcollectiondbres.rsc"); + parse.Set( KMPXCollectionDbResourceFile, &KDC_APP_RESOURCE_DIR, NULL ); + TFileName resFile(parse.FullName()); + User::LeaveIfError(MPXUser::CompleteWithDllPath(resFile)); + + FTRACE(FPrint(_L("CCommonTestClass::CompleteWithDllPath testing MPXUser::CompleteWithDllPath() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CompleteWithDllPath testing MPXUser::CompleteWithDllPath() end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::Alloc8L() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::Alloc8L() + { + FTRACE(FPrint(_L("CCommonTestClass::Alloc8L testing MPXUser::Alloc8L() begin"))); + iLog->Log(_L("CCommonTestClass::Alloc8L testing MPXUser::Alloc8L() begin")); + TInt err = KErrNone; + + TParse parse; + _LIT(descriptor, "memory to be allocated"); + HBufC8* mem = MPXUser::Alloc8L(descriptor); + delete mem; + FTRACE(FPrint(_L("CCommonTestClass::Alloc8L testing MPXUser::Alloc8L() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::Alloc8L testing MPXUser::Alloc8L() end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::AllocL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::AllocL() + { + FTRACE(FPrint(_L("CCommonTestClass::AllocL testing MPXUser::AllocL() begin"))); + iLog->Log(_L("CCommonTestClass::AllocL testing MPXUser::AllocL() begin")); + TInt err = KErrNone; + + TParse parse; + _LIT8(descriptor, "memory to be allocated"); + HBufC* mem = MPXUser::AllocL(descriptor); + delete mem; + FTRACE(FPrint(_L("CCommonTestClass::AllocL testing MPXUser::AllocL() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::AllocL testing MPXUser::AllocL() end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::Ptr() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::Ptr() + { + FTRACE(FPrint(_L("CCommonTestClass::Ptr testing MPXUser::Ptr(const TDesC& aDes) begin"))); + iLog->Log(_L("CCommonTestClass::Ptr testing MPXUser::Ptr(const TDesC& aDes) begin")); + TInt err = KErrNone; + + TBufC8<40> descriptor8(_L8("xxx")); + TPtrC mem = MPXUser::Ptr(descriptor8); + FTRACE(FPrint(_L("CCommonTestClass::Ptr testing MPXUser::Ptr(const TDesC& aDes) end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::Ptr testing MPXUser::Ptr(const TDesC& aDes) end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::Ptr8() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::Ptr8() + { + FTRACE(FPrint(_L("CCommonTestClass::Ptr8 testing MPXUser::Ptr(const TDesC& aDes) begin"))); + iLog->Log(_L("CCommonTestClass::Ptr8 testing MPXUser::Ptr(const TDesC& aDes) begin")); + TInt err = KErrNone; + + TBufC<40> descriptor16(_L("xxx")); + TPtrC8 mem = MPXUser::Ptr(descriptor16); + FTRACE(FPrint(_L("CCommonTestClass::Ptr8 testing MPXUser::Ptr(const TDesC& aDes) end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::Ptr8 testing MPXUser::Ptr(const TDesC& aDes) end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::CreateBufferLC() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CreateBufferLC() + { + FTRACE(FPrint(_L("CCommonTestClass::CreateBufferLC testing MPXUser::CreateBufferLC() begin"))); + iLog->Log(_L("CCommonTestClass::CreateBufferLC testing MPXUser::CreateBufferLC() begin")); + TInt err = KErrNone; + + TBufC<40> descriptor(_L("xxx")); + CBufBase* buf( MPXUser::CreateBufferLC( descriptor.Size() )); + CleanupStack::Pop( buf ); + + FTRACE(FPrint(_L("CCommonTestClass::CreateBufferLC testing MPXUser::CreateBufferLC(s) end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CreateBufferLC testing MPXUser::CreateBufferLC() end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::CreateBufferDesCL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CreateBufferDesCL() + { + FTRACE(FPrint(_L("CCommonTestClass::CreateBufferDesCL testing MPXUser::CreateBufferL() begin"))); + iLog->Log(_L("CCommonTestClass::CreateBufferDesCL testing MPXUser::CreateBufferL() begin")); + TInt err = KErrNone; + + TBufC<40> descriptor(_L("xxx")); + CBufBase* buffer(NULL); + MPXUser::CreateBufferL( descriptor, buffer ); + delete buffer; + FTRACE(FPrint(_L("CCommonTestClass::CreateBufferDesCL testing MPXUser::CreateBufferL(s) end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CreateBufferDesCL testing MPXUser::CreateBufferL() end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::CreateBufferDesCArrayL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CreateBufferDesCArrayL() + { + FTRACE(FPrint(_L("CCommonTestClass::CreateBufferDesCArrayL testing MPXUser::CreateBufferL() begin"))); + iLog->Log(_L("CCommonTestClass::CreateBufferDesCArrayL testing MPXUser::CreateBufferL() begin")); + TInt err = KErrNone; + + CDesCArray* array = new(ELeave)CDesCArrayFlat(10); + array->AppendL(_L("test")); + CBufBase* buffer(NULL); + MPXUser::CreateBufferL( array, buffer ); + delete buffer; + delete array; + FTRACE(FPrint(_L("CCommonTestClass::CreateBufferDesCArrayL testing MPXUser::CreateBufferL(s) end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CreateBufferDesCArrayL testing MPXUser::CreateBufferL() end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::CreateBufferMsgL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CreateBufferMsgL() + {//TODO need to update + FTRACE(FPrint(_L("CCommonTestClass::CreateBufferMsgL testing MPXUser::CreateBufferL() begin"))); + iLog->Log(_L("CCommonTestClass::CreateBufferMsgL testing MPXUser::CreateBufferL() begin")); + TInt err = KErrNone; + + RMessage2* msg = new(ELeave)RMessage2(); + +// HBufC* msg1 = HBufC::New( 20 ); +// HBufC* msg2 = HBufC::New( 20 ); +// TUint16 msgContent = (TUint16)1; +// msg1->Des().Copy( &msgContent ); +// msg2->Des().Copy( &msgContent ); +// +// TPtr msgPtr1 = msg1->Des(); +// TPtr msgPtr2 = msg2->Des(); +//// +//// TDes8* msgTDes(NULL); +// +// msg->ReadL( 0,msgPtr1 ); +// msg->ReadL( 1,msgPtr2 ); + +// msg.Write( 1,_L("Message") ); +// const TRequestStatus* statusConst = msg->ClientStatus(); +// TRequestStatus* status = const_cast( statusConst ); +// TInt statusValue= status->operator =( 2 ); +// TBuf8<2> msgContent; +// TUint8 msgNum = (TUint8)1; +// msgContent = &msgNum; +// msg.Read( 0,msgContent ); + CBufBase* buffer(NULL); + MPXUser::CreateBufferL( *msg,1,buffer ); + delete buffer; + + FTRACE(FPrint(_L("CCommonTestClass::CreateBufferMsgL testing MPXUser::CreateBufferL(s) end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CreateBufferMsgL testing MPXUser::CreateBufferL() end err=%d"), err); + return err; + } + + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::ExternalizeL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::ExternalizeL() + { + FTRACE(FPrint(_L("CCommonTestClass::ExternalizeL testing MPXUser::ExternalizeL() begin"))); + iLog->Log(_L("CCommonTestClass::ExternalizeL testing MPXUser::ExternalizeL() begin")); + + TInt err = KErrNone; + + CBufBase* buffer = CBufFlat::NewL( 50 ); + CleanupStack::PushL( buffer ); + RBufWriteStream writeStream( *buffer ); + CleanupClosePushL( writeStream ); + CDesCArray* array = new(ELeave)CDesCArrayFlat(10); + array->AppendL(_L("test")); + MPXUser::ExternalizeL( array, writeStream ); + writeStream.CommitL(); + buffer->Compress(); + CleanupStack::PopAndDestroy( &writeStream ); + delete array; + CleanupStack::PopAndDestroy( buffer ); + + FTRACE(FPrint(_L("CCommonTestClass::ExternalizeL testing MPXUser::ExternalizeL() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::ExternalizeL testing MPXUser::ExternalizeL() end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::ExternalizeArrayL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::ExternalizeArrayL() + { + FTRACE(FPrint(_L("CCommonTestClass::ExternalizeArrayL testing MPXUser::ExternalizeL() begin"))); + iLog->Log(_L("CCommonTestClass::ExternalizeArrayL testing MPXUser::ExternalizeL() begin")); + + TInt err = KErrNone; + + CBufBase* buffer = CBufFlat::NewL( 50 ); + CleanupStack::PushL( buffer ); + RBufWriteStream writeStream( *buffer ); + CleanupClosePushL( writeStream ); + CDesCArray* array = new(ELeave)CDesCArrayFlat(10); + array->AppendL(_L("test")); + RArray items; + CleanupClosePushL(items); + MPXUser::ExternalizeL( items.Array(), writeStream ); + writeStream.CommitL(); + buffer->Compress(); + CleanupStack::PopAndDestroy( &items ); + CleanupStack::PopAndDestroy( &writeStream ); + delete array; + CleanupStack::PopAndDestroy( buffer ); + + FTRACE(FPrint(_L("CCommonTestClass::ExternalizeArrayL testing MPXUser::ExternalizeL() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::ExternalizeArrayL testing MPXUser::ExternalizeL() end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::InternalizeArrayL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- + + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::CopyArrayL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CopyArrayL() + { + FTRACE(FPrint(_L("CCommonTestClass::CopyArrayL testing MPXUser::CopyArrayL() begin"))); + iLog->Log(_L("CCommonTestClass::CopyArrayL testing MPXUser::CopyArrayL() begin")); + TInt err = KErrNone; + + CDesCArray* src = new(ELeave)CDesCArrayFlat(10); + CDesCArray* dest = new(ELeave)CDesCArrayFlat(10); + src->AppendL(_L("test")); + MPXUser::CopyArrayL( *src, *dest ); + delete src; + delete dest; + FTRACE(FPrint(_L("CCommonTestClass::CopyArrayL testing MPXUser::CopyArrayL(s) end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CopyArrayL testing MPXUser::CopyArrayL() end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MergeArray() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MergeArray() + { + FTRACE(FPrint(_L("CCommonTestClass::MergeArray testing MPXUser::MergeArray() begin"))); + iLog->Log(_L("CCommonTestClass::MergeArray testing MPXUser::MergeArray() begin")); + TInt err = KErrNone; + + CDesCArray* src; + TRAP(err,src = new(ELeave)CDesCArrayFlat(10)); + CDesCArray* dest; + TRAP(err,dest = new(ELeave)CDesCArrayFlat(20)); + TRAP(err , src->AppendL(_L("test"))); + MPXUser::MergeArray( *src, *dest ); + delete src; + delete dest; + FTRACE(FPrint(_L("CCommonTestClass::MergeArray testing MPXUser::MergeArray(s) end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::MergeArray testing MPXUser::MergeArray() end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::MergeAttributeL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::MergeAttributeL() + { + FTRACE(FPrint(_L("CCommonTestClass::MergeAttributeL testing MPXUser::MergeAttributeL() begin"))); + iLog->Log(_L("CCommonTestClass::MergeAttributeL testing MPXUser::MergeAttributeL() begin")); + TInt err = KErrNone; + + RArray atts1; + RArray atts2; + CleanupClosePushL(atts1); + CleanupClosePushL(atts2); + + TInt contentId = 0; + TUint attId = (TUint)0; + TMPXAttribute att(contentId, attId); + atts1.Append(att); + + MPXUser::MergeAttributeL( atts1.Array(), atts2 ); + + CleanupStack::PopAndDestroy( &atts2 ); + CleanupStack::PopAndDestroy( &atts1 ); + + FTRACE(FPrint(_L("CCommonTestClass::MergeAttributeL testing MPXUser::MergeAttributeL(s) end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::MergeAttributeL testing MPXUser::MergeAttributeL() end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::ProcessIdL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::ProcessIdL() + { + FTRACE(FPrint(_L("CCommonTestClass::ProcessIdL testing MPXUser::ProcessIdL() begin"))); + iLog->Log(_L("CCommonTestClass::ProcessIdL testing MPXUser::ProcessIdL() begin")); + TInt err = KErrNone; + + TThreadId threadId = RThread().Id(); + MPXUser::ProcessIdL(threadId); + + FTRACE(FPrint(_L("CCommonTestClass::ProcessIdL testing MPXUser::ProcessIdL(s) end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::ProcessIdL testing MPXUser::ProcessIdL() end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::CompareOrderedUidArrays() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CompareOrderedUidArrays() + { + FTRACE(FPrint(_L("CCommonTestClass::CompareOrderedUidArrays testing MPXUser::CompareOrderedUidArrays() begin"))); + iLog->Log(_L("CCommonTestClass::CompareOrderedUidArrays testing MPXUser::CompareOrderedUidArrays() begin")); + TInt err = KErrNone; + + RArray atts1; + RArray atts2; + CleanupClosePushL(atts1); + CleanupClosePushL(atts2); + + const TUid KMPXCollectionServerUid3={0x101FFC31}; + const TUid KPodcastCollection = {0x101FFB31}; + atts1.Append(KMPXCollectionServerUid3); + atts1.Append(KPodcastCollection); + + MPXUser::CompareOrderedUidArrays( atts1.Array(), atts2.Array() ); + + CleanupStack::PopAndDestroy( &atts2 ); + CleanupStack::PopAndDestroy( &atts1 ); + + FTRACE(FPrint(_L("CCommonTestClass::CompareOrderedUidArrays testing MPXUser::CompareOrderedUidArrays(s) end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CompareOrderedUidArrays testing MPXUser::CompareOrderedUidArrays() end err=%d"), err); + return err; + } +//add function + + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::CreateFromBufferL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CreateFromBufferL() + { + FTRACE(FPrint(_L("CCommonTestClass::CreateFromBufferL testing MPXUser::CreateBufferL() begin"))); + iLog->Log(_L("CCommonTestClass::CreateFromBufferL testing MPXUser::CreateBufferL() begin")); + + TInt err = KErrNone; + CDesCArray* array = new(ELeave)CDesCArrayFlat(10); + array->AppendL(_L("test")); + CBufBase* buffer(NULL); + MPXUser::CreateBufferL( array, buffer ); + + MPXUser::CreateFromBufferL( *buffer, array ); + delete array; + delete buffer; + + FTRACE(FPrint(_L("CCommonTestClass::CreateFromBufferL testing MPXUser::CreateBufferL(s) end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CreateFromBufferL testing MPXUser::CreateBufferL() end err=%d"), err); + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::InternalizeArrayL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::InternalizeArrayL() + { + FTRACE(FPrint(_L("CCommonTestClass::InternalizeArrayL testing MPXUser::InternalizeL() begin"))); + iLog->Log(_L("CCommonTestClass::InternalizeArrayL testing MPXUser::InternalizeL() begin")); + + TInt err = KErrNone; + + CBufBase* buffer = CBufFlat::NewL( 50 ); + CleanupStack::PushL( buffer ); + RBufWriteStream writeStream( *buffer ); + CleanupClosePushL( writeStream ); + writeStream.WriteInt32L( 1 ); + writeStream.WriteUint32L( 1000 ); + writeStream.WriteUint32L( 1001 ); + writeStream.CommitL(); + //buffer->Compress(); + RBufReadStream readStream( *buffer ); + CleanupClosePushL( readStream ); + + //create items + RArray items; + CleanupClosePushL( items ); + + MPXUser::InternalizeL( items, readStream ); + CleanupStack::PopAndDestroy( 4 ); + + FTRACE(FPrint(_L("CCommonTestClass::InternalizeArrayL testing MPXUser::InternalizeL() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::InternalizeArrayL testing MPXUser::InternalizeL() end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::InternalizeDesCArrayL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::InternalizeDesCArrayL() + { + FTRACE(FPrint(_L("CCommonTestClass::InternalizeDesCArrayL testing MPXUser::InternalizeL() begin"))); + iLog->Log(_L("CCommonTestClass::InternalizeDesCArrayL testing MPXUser::InternalizeL() begin")); + + TInt err = KErrNone; + + CBufBase* buffer = CBufFlat::NewL( 50 ); + CleanupStack::PushL( buffer ); + RBufWriteStream writeStream( *buffer ); + CleanupClosePushL( writeStream ); + writeStream.WriteInt32L( 0 ); +// writeStream.WriteUint32L( 1000 ); +// writeStream.WriteL( _L("ArrayItem") ); + writeStream.CommitL(); + //buffer->Compress(); + RBufReadStream readStream( *buffer ); + CleanupClosePushL( readStream ); + + CDesCArray* array = new(ELeave)CDesCArrayFlat(10); + array->AppendL(_L("test")); + + + MPXUser::InternalizeL( array, readStream ); + buffer->Compress(); + delete array; + CleanupStack::PopAndDestroy( 3 ); + + FTRACE(FPrint(_L("CCommonTestClass::InternalizeDesCArrayL testing MPXUser::InternalizeL() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::InternalizeDesCArrayL testing MPXUser::InternalizeL() end err=%d"), err); + return err; + } + + +// ----------------------------------------------------------------------------- +// CCommonTestClass::FindWindowGroupIdL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::FindWindowGroupIdL() + { + FTRACE(FPrint(_L("CCommonTestClass::FindWindowGroupIdL testing MPXUser::FindWindowGroupIdL() begin"))); + iLog->Log(_L("CCommonTestClass::FindWindowGroupIdL testing MPXUser::FindWindowGroupIdL() begin")); + + TInt err = KErrNone; + TProcessId aProcId; + + TThreadId threadId = RThread().Id(); + aProcId= MPXUser::ProcessIdL(threadId); + + RWsSession wsSession=CEikonEnv::Static()->WsSession(); + + MPXUser::FindWindowGroupIdL(aProcId,wsSession ); + + FTRACE(FPrint(_L("CCommonTestClass::FindWindowGroupIdL testing MPXUser::FindWindowGroupIdL() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::FindWindowGroupIdL testing MPXUser::FindWindowGroupIdL() end err=%d"), err); + + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::CompleteWithDllPathOL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CompleteWithDllPathOL() + { + FTRACE(FPrint(_L("CCommonTestClass::RecreateBufferL testing MPXUser::RecreateBufferL() begin"))); + iLog->Log(_L("CCommonTestClass::RecreateBufferL testing MPXUser::RecreateBufferL() begin")); + + TInt err = KErrNone; + TParse parse; + _LIT(KMPXCollectionDbResourceFile, "mpxcollectiondbres.rsc"); + parse.Set( KMPXCollectionDbResourceFile, &KDC_APP_RESOURCE_DIR, NULL ); + TFileName resFile(parse.FullName()); + _LIT(KmpxDllName,"mpxcollectiondbres.dll"); + const TDesC& aDllName = KmpxDllName; + MPXUser::CompleteWithDllPath(aDllName,resFile); + + FTRACE(FPrint(_L("CCommonTestClass::RecreateBufferL testing MPXUser::RecreateBufferL() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::RecreateBufferL testing MPXUser::RecreateBufferL() end err=%d"), err); + + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::RecreateBufferL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::RecreateBufferL() + { + FTRACE(FPrint(_L("CCommonTestClass::RecreateBufferL testing MPXUser::RecreateBufferL() begin"))); + iLog->Log(_L("CCommonTestClass::RecreateBufferL testing MPXUser::RecreateBufferL() begin")); + + TInt err = KErrNone; + TInt aSize = 4; + CBufBase* buf=CBufFlat::NewL(aSize); + MPXUser::RecreateBufferL( 4 , buf ); + + FTRACE(FPrint(_L("CCommonTestClass::RecreateBufferL testing MPXUser::RecreateBufferL() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::RecreateBufferL testing MPXUser::RecreateBufferL() end err=%d"), err); + return err; + } +// ----------------------------------------------------------------------------- +// CCommonTestClass::Alloc8ZL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::Alloc8ZL() + { + FTRACE(FPrint(_L("CCommonTestClass::Alloc8ZL testing MPXUser::Alloc8ZL() begin"))); + iLog->Log(_L("CCommonTestClass::Alloc8ZL testing MPXUser::Alloc8ZL() begin")); + TInt err = KErrNone; + TParse parse; + _LIT(descriptor, "memory to be allocated"); + HBufC8* mem = MPXUser::Alloc8ZL(descriptor); + delete mem; + FTRACE(FPrint(_L("CCommonTestClass::Alloc8ZL testing MPXUser::Alloc8ZL() end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::Alloc8ZL testing MPXUser::Alloc8ZL() end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::CreateBufferRMessage() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testpluginmonitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testpluginmonitor.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,74 @@ +/* +* 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: MPXPluginMonitor testing implementation (mpxpluginmonitor.h) +* +*/ + + +#include + +#include "commontestclass.h" + +// Begin CMPXPluginMonitor testing implementation (mpxpluginmonitor.h)============ +// ----------------------------------------------------------------------------- +// CCommonTestClass::CreatePluginMonitor() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CreatePluginMonitorL() + { + FTRACE(FPrint(_L("CCommonTestClass::CreatePluginMonitorL testing CMPXPluginMonitor::NewL begin"))); + iLog->Log(_L("CCommonTestClass::CreatePluginMonitorL testing CMPXPluginMonitor::NewL begin")); + TInt err = KErrNone; + if ( iPluginMonitor != NULL) + { + delete iPluginMonitor; + } + iPluginMonitor = NULL; + iPluginMonitor = CMPXPluginMonitor::NewL((TUid)KMPXPlaybackInterfaceUid/*, *this*/);//edit +// iPluginMonitor = CMPXPluginMonitor::NewL((TUid)KMPXPlaybackInterfaceUid, *this); + if ( iPluginMonitor == NULL) + { + err = KErrNotFound; + } + FTRACE(FPrint(_L("CCommonTestClass::CreatePluginMonitorL testing CMPXPluginMonitor::NewL end=%d"), err)); + iLog->Log(_L("CCommonTestClass::CreatePluginMonitorL testing CMPXPluginMonitor::NewL end=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::DeletePluginMonitorL() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::DeletePluginMonitorL() + { + FTRACE(FPrint(_L("CCommonTestClass::DeletePluginMonitorL testing CMPXPluginMonitor::~ begin"))); + iLog->Log(_L("CCommonTestClass::DeletePluginMonitorL testing CMPXPluginMonitor::~ begin")); + TInt err = KErrNone; + delete iPluginMonitor; + iPluginMonitor = NULL; + FTRACE(FPrint(_L("CCommonTestClass::DeletePluginMonitorL testing CMPXPluginMonitor::~ end=%d"), err)); + iLog->Log(_L("CCommonTestClass::DeletePluginMonitorL testing CMPXPluginMonitor::~ end=%d"), err); + return err; + } + +void CCommonTestClass::PluginsChangedL() + { + } +void CCommonTestClass::HandlePluginUnload(const TUid& /*aPluginUid*/)//add + { + } + +// end of CMPXPluginMonitor (mpxpluginmonitor.h) ============================================= + + \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testviewplugin.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,88 @@ +/* +* 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: MPXViewPlugin testing implementation (mpxviewplugin.h) +* +*/ + + +#include "commontestclass.h" + +// Begin CMPXViewPlugin testing implementation (mpxviewplugin.h)======================================= +// ----------------------------------------------------------------------------- +// CCommonTestClass::CreateCMPXViewPlugin() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::CreateCMPXViewPlugin() + { + FTRACE(FPrint(_L("CCommonTestClass::CreateCMPXViewPlugin testing CMPXViewPlugin::NewL begin"))); + iLog->Log(_L("CCommonTestClass::CreateCMPXViewPlugin testing CMPXViewPlugin::NewL begin")); + TInt err = KErrNone; + if ( iViewPlugin != NULL) + { + delete iViewPlugin; + } + iViewPlugin = NULL; + + TUid aUid = TUid::Uid(270531770); + + TRAP(err,iViewPlugin = CMPXViewPlugin::NewL( aUid, this )); + if ( iViewPlugin == NULL) + { + err = KErrNotFound; + } + + FTRACE(FPrint(_L("CCommonTestClass::CreateCMPXViewPlugin testing CMPXViewPlugin::NewL end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::CreateCMPXViewPlugin testing CMPXViewPlugin::NewL end err=%d"), err); + return err; + } + +// ----------------------------------------------------------------------------- +// CCommonTestClass::DeleteCMPXViewPlugin() +// Returns: Symbian OS errors. +// ----------------------------------------------------------------------------- +TInt CCommonTestClass::DeleteCMPXViewPlugin() + { + FTRACE(FPrint(_L("CCommonTestClass::DeleteCMPXViewPlugin testing CMPXViewPlugin::~ begin"))); + iLog->Log(_L("CCommonTestClass::DeleteCMPXViewPlugin testing CMPXViewPlugin::~ begin")); + TInt err = KErrNone; + if ( iViewPlugin ) + { + delete iViewPlugin; + REComSession::FinalClose(); + iViewPlugin = NULL; + } + FTRACE(FPrint(_L("CCommonTestClass::DeleteCMPXViewPlugin testing CMPXViewPlugin::~ end err=%d"), err)); + iLog->Log(_L("CCommonTestClass::DeleteCMPXViewPlugin testing CMPXViewPlugin::~ end err=%d"), err); + return err; + } + + +// --------------------------------------------------------------------------- +// From MMPXCustomCommandObserver. +// Handle custom commands. +// --------------------------------------------------------------------------- +// +void CCommonTestClass::HandleCustomCommand( + const TUid& /*aUid*/, + const TInt /*aCommand*/, + const TDesC8& /*aData*/ ) + { + FTRACE(FPrint(_L("CCommonTestClass::HandleCustomCommand CMPXViewPlugin::HandleCustomCommand is called"))); + iLog->Log(_L("CCommonTestClass::HandleCustomCommand CMPXViewPlugin::HandleCustomCommand is called")); + } + + +//end of CMPXViewPlugin (mpxviewplugin.h ============================================= + + \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/timeoutcontroller.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/timeoutcontroller.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,199 @@ +/* +* Copyright (c) 2007 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: Timeout controller +* +*/ + +#include "timeoutcontroller.h" +#include "debug.h" + +/* +------------------------------------------------------------------------------- +Class: CSimpleTimeout +Method: CSimpleTimeout +Description: Default constructor +C++ default constructor can NOT contain any code, that might leave. +Parameters: None +Return Values: None +Errors/Exceptions: None +Status: Approved +------------------------------------------------------------------------------- +*/ +CSimpleTimeout::CSimpleTimeout() : CActive (CActive::EPriorityStandard) + { + FTRACE(FPrint(_L("CSimpleTimeout::CSimpleTimeout"))); + } + +// ----------------------------------------------------------------------------- +// CSimpleTimeout::ConstructL() +// Symbian OS second phase constructor. +// ----------------------------------------------------------------------------- +// +void CSimpleTimeout::ConstructL( MTimeoutObserver* aObserver, +CStifLogger* aLogger) + { + FTRACE(FPrint(_L("CSimpleTimeout::ConstructL"))); + iObserver = aObserver; + iLog = aLogger; + iTimer.CreateLocal(); + iTestCaseTimeout = 0; // Initialize + + // Add to active scheduler + CActiveScheduler::Add ( this ); + } + +// ----------------------------------------------------------------------------- +// CSimpleTimeout::NewL() +// Two-phased constructor. +// Returns: CSimpleTimeout* : pointer to created object +// ----------------------------------------------------------------------------- +// +CSimpleTimeout* CSimpleTimeout::NewL( MTimeoutObserver* aTestClass, +CStifLogger* aLogger) + { + FTRACE(FPrint(_L("CSimpleTimeout::NewL"))); + CSimpleTimeout* self = new ( ELeave ) CSimpleTimeout(); + CleanupStack::PushL( self ); + self->ConstructL( aTestClass, aLogger); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CSimpleTimeout::~CSimpleTimeout() +// Destructor. +// ----------------------------------------------------------------------------- +// +CSimpleTimeout::~CSimpleTimeout() + { + FTRACE(FPrint(_L("CSimpleTimeout::~CSimpleTimeout"))); + Cancel(); + iTimer.Close(); + } + +// ----------------------------------------------------------------------------- +// CSimpleTimeout::Start() +// Start timeout counting. +// ----------------------------------------------------------------------------- +// +void CSimpleTimeout::Start(TTimeIntervalMicroSeconds aTimeout) + { + FTRACE(FPrint(_L("CSimpleTimeout::Start"))); + if (IsActive()) + { + Cancel(); + } + // Request timer + TTime endTime; + endTime.HomeTime(); + endTime = endTime + aTimeout; + + TInt64 miliseconds = aTimeout.Int64(); + miliseconds /= 1000; + + TBuf<30> dateString; + TRAPD(err,endTime.FormatL(dateString, KFormatTimeStamp)); + iLog->Log(_L("Timer=%LD ms, EndTime=%S"), miliseconds, &dateString); + + // Store absolute timeout + iTestCaseTimeout = endTime; + + // Taken from STIF engine + // Note: iTimer.After() method cannot use because there needed + // TTimeIntervalMicroSeconds32 and it is 32 bit. So then cannot create + // timeout time that is long enough. At() uses 64 bit value=>Long enough. + iTimer.At( iStatus, endTime ); + SetActive(); + } + +// ----------------------------------------------------------------------------- +// CSimpleTimeout::Stop() +// Start timeout counting. +// ----------------------------------------------------------------------------- +// +void CSimpleTimeout::Stop() + { + FTRACE(FPrint(_L("CSimpleTimeout::Stop"))); + if (IsActive()) + { + Cancel(); + } + } + +// ----------------------------------------------------------------------------- +// CSimpleTimeout::RunL() +// RunL handles completed timeouts. +// ----------------------------------------------------------------------------- +// +void CSimpleTimeout::RunL() + { + FTRACE(FPrint(_L("CSimpleTimeout::RunL"))); + iLog->Log(_L("CSimpleTimeout::RunL")); + TTime timeout; + timeout.HomeTime(); + // Handle the abort case when system time gets changed, but timeout is + // still valid. All other cases should timeout since they invalidate the + // logic of the timers. + if ( iStatus == KErrAbort) + { + if ( iTestCaseTimeout > timeout ) + { + RDebug::Print( _L( "Absolute timer still valid. Restaring timer. iStatus: %d" ), iStatus.Int() ); + // Start new timer + iStatus = KErrNone; // reset value + iTimer.At ( iStatus, iTestCaseTimeout ); // restart timer + SetActive(); + } + else + { + // Absolute timer no longer valid. Must timeout. + iLog->Log(_L("Absolute timeout no longer valid")); + iObserver->HandleTimeout(KErrNone); + } + } + else + { + // Status was not KErrAbort. Timing out! + // iLog->Log(_L("CSimpleTimeout::RunL - Timeout !!"), iTimeout); + iLog->Log(_L("Timing out")); + iObserver->HandleTimeout(KErrNone); + } + } + +// ----------------------------------------------------------------------------- +// CSimpleTimeout::DoCancel() +// Cancel active request. +// ----------------------------------------------------------------------------- +// +void CSimpleTimeout::DoCancel() + { + FTRACE(FPrint(_L("CSimpleTimeout::DoCancel"))); + iTimer.Cancel(); + } + +// ----------------------------------------------------------------------------- +// CSimpleTimeout::RunError() +// Handle errors. Just let framework handle errors because +// RunL does not leave. +// Returns: Symbian OS error code +// ----------------------------------------------------------------------------- +// +TInt CSimpleTimeout::RunError( TInt aError ) + { + FTRACE(FPrint(_L("CSimpleTimeout::RunError"))); + iLog->Log(_L("Timeout error %d"), aError); + iObserver->HandleTimeout(aError); + return aError; + } + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_definition_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_definition_api/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2007 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 +: mpx common API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/mpxattributespecs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxattributespecs.h) +../inc/mpxcmn.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcmn.h) +../inc/mpxcmn.inl MW_LAYER_PLATFORM_EXPORT_PATH(mpxcmn.inl) +../inc/mpxcommand.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcommand.h) +../inc/mpxcommonframeworkdefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxcommonframeworkdefs.h) +../inc/mpxfilter.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxfilter.h) +../inc/mpxitemid.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxitemid.h) +../inc/mpxitemid.inl MW_LAYER_PLATFORM_EXPORT_PATH(mpxitemid.inl) +../inc/mpxlog.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxlog.h) +../inc/mpxmessage2.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxmessage2.h) +../inc/mpxpathconfiguration.hrh MW_LAYER_PLATFORM_EXPORT_PATH(mpxpathconfiguration.hrh) +../inc/mpxprivatecrkeys.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxprivatecrkeys.h) +../inc/mpxsearchcriteria.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxsearchcriteria.h) \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_definition_api/inc/EqualizerConstants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_definition_api/inc/EqualizerConstants.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2005 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 file contains declarations for public constants for +* Equalizer +* +*/ + +#ifndef EQUALIZERCONSTANTS_H +#define EQUALIZERCONSTANTS_H + +// INCLUDES + +#include + +// CONSTANTS +// Used by client application for activating the preset "None" +const TInt KEqualizerPresetNone = -1; + +// Used as the maximum length of a ListBox model entry (like "0\tNone") +const TInt KListBoxEntryMaxLength = 64; + +// DATA TYPES +// Used to store a preset name or ListBox model entry +typedef TBuf TPresetName; + +#endif // EQUALIZERCONSTANTS_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_definition_api/inc/mpxattributespecs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_definition_api/inc/mpxattributespecs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2006 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: Specifies attributes +* +*/ + + + +#ifndef CMPXATTRIBUTESPECS_H +#define CMPXATTRIBUTESPECS_H + + +#include + +typedef CMPXMedia CMPXAttributeSpecs; + + +#endif // CMPXATTRIBUTESPECS_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_definition_api/inc/mpxcmn.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_definition_api/inc/mpxcmn.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,356 @@ +/* +* Copyright (c) 2006 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 utility functions +* +*/ + + +#ifndef MPXCMN_H +#define MPXCMN_H + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include + +/** +* Helper to copy an array. +* +* @since S60 3.2.3 +* @param aSrc soure +* @param sDest destination +*/ +template +inline void CopyArrayL(const TArray& aSrc, RArray& aDest); + +/** +* Helper to copy a descriptor array. +* +* @since S60 3.2.3 +* @param aSrc soure +* @param sDest destination +*/ +inline void CopyArrayL(const MDesCArray& aSrc, CDesCArray& aDest); + +/** +* Helper to transfer a buffer from server. +* +* @since S60 3.2.3 +* @param aSess session object +* @param aCmd Cmd to read buffer from server +* @param aSize size of buffer +* @param aBuffer buffer to returned +*/ +inline void TransferBufferFromServerL(const RMPXSession& aSess, + TInt aCmd, + TInt aSize, + CBufBase*& aBuffer); + +/** +* Helper to create an array from stream. +* Note: class T should public default C++ constructor. +* +* @since S60 3.2.3 +* @param aArray array object returned +* @param aStream stream object +*/ +template +inline void InternalizeL(RPointerArray& aArray, RReadStream& aStream); + +/** +* Helper to create an array from stream. +* Note: CBased class T contains NewL(). +* +* @since S60 3.2.3 +* @param aArray array object returned +* @param aStream stream object +*/ +template +inline void InternalizeCObjectArrayL(RPointerArray& aArray, + RReadStream& aStream); + +/** +* Helper to create an array from stream. +* +* @since S60 3.2.3 +* @param aArray array object returned +* @param aStream stream object +*/ +template +inline void InternalizeL(RArray& aArray, RReadStream& aStream); + +/** +* Helper to create a descriptor array from stream. +* +* @since S60 3.2.3 +* @param aArray descriptor array object returned +* @param aStream stream object +*/ +inline void InternalizeL(CDesCArray& aArray, RReadStream& aStream); + +/** +* Helper to externalize an array to stream. +* +* @since S60 3.2.3 +* @param aArray array object +* @param aStream stream object +*/ +template +inline void ExternalizeL(const TArray& aArray, RWriteStream& aStream); + +/** +* Helper to externalize an array to stream. +* +* @since S60 3.2.3 +* @param aArray array object +* @param aStream stream object +*/ +template +inline void ExternalizeL(const TArray& aArray, RWriteStream& aStream); + +/** +* Helper to externalize a descriptor array to stream. +* +* @since S60 3.2.3 +* @param aArray descriptor array object +* @param aStream stream object +*/ +inline void ExternalizeL(const MDesCArray& aArray, RWriteStream& aStream); + +/** +* Helper to create an array from buf. +* +* @since S60 3.2.3 +* @param aBuf buf object +* @param aArray array object returned +*/ +template +inline void CreateFromBufferL(const CBufBase &aBuf, CArrayFix*& aArray); + +/** +* Helper to create a descriptor array from buf. +* +* @since S60 3.2.3 +* @param aBuf buf object +* @param aArray descriptor array object returned +*/ +inline void CreateFromBufferL(const CBufBase &aBuf, CDesCArray*& aArray); + +/** +* Helper to create an array from buf. +* +* @since S60 3.2.3 +* @param aBuf buf object +* @param aArray array object returned +*/ +template +inline void CreateFromBufferL(const CBufBase &aBuf, RPointerArray& aArray); + +/** +* Helper to create an array from buf. +* +* @since S60 3.2.3 +* @param aBuf buf object +* @param aArray array object returned +*/ +template +inline void CreateFromBufferL(const CBufBase &aBuf, RArray& aArray); + +/** +* Helper to create an object from buf. +* Note: use C++ default constructor to create a new object. +* +* @since S60 3.2.3 +* @param aBuf buf object +* @param aObject created +*/ +template +inline void CreateFromBufferL(const CBufBase &aBuf, T*& aObject); + +/** +* Helper to create an object from buf. +* Note: class T must implement T::NewL() constructor. +* +* @since S60 3.2.3 +* @param aBuf buf object +* @param aObject created +*/ +template +inline void NewFromBufferL(const CBufBase &aBuf, T*& aObject); + + +/** +* Helper to create an object from a message buffer. +* +* @since S60 3.2.3 +* @param aMessage the message +* @param aMsgSlot message slot index +*/ +template +inline void CreateFromMessageL(const RMessage2& aMessage, + TInt aMsgSlot, + T*& aObject); + +/** +* Helper to create an object from a message buffer. +* Note: class T must implement T::NewL() constructor. +* +* @since S60 3.2.3 +* @param aMessage the message +* @param aMsgSlot message slot index +*/ +template +inline void NewFromMessageL(const RMessage2& aMessage, + TInt aMsgSlot, + T*& aObject); + +/** +* Copy an object into the buffer. +* +* @since S60 3.2.3 +* @param aObj the object +* @param aBuffer buffer object +*/ +template +inline void CreateBufferL(const T& aObj, CBufBase*& aBuffer); + +/** +* Fill up the buffer from an array. +* +* @since S60 3.2.3 +* @param aArray an array of object +* @param aBuffer buffer object +*/ +template +inline void CreateBufferL(const TArray& aArray, CBufBase*& aBuffer); + +/** +* Fill up the buffer from an array. +* +* @since S60 3.2.3 +* @param aArray an array of object pointer +* @param aBuffer buffer object +*/ +template +inline void CreateBufferL(const TArray& aArray, CBufBase*& aBuffer); + +/** +* Helper to transfer an array from server. +* +* @since S60 3.2.3 +* @param aSess session object +* @param aCmd Cmd to read buffer from server +* @param aSize size of buffer +* @param aArray array to returned +*/ +template +void ArrayFromServerL(const RMPXSession& aSess, + TInt aCmd, + TInt aSize, + CArrayFixBase*& aArray); + +/** +* Helper to transfer an array from server. +* +* @since S60 3.2.3 +* @param aSess session object +* @param aCmd Cmd to read buffer from server +* @param aSize size of buffer +* @param aArray array to returned +*/ +template +void ArrayFromServerL(const RMPXSession& aSess, + TInt aCmd, + TInt aSize, + RPointerArray& aArray); + +/** +* Helper to transfer an array from server. +* +* @since S60 3.2.3 +* @param aSess session object +* @param aCmd Cmd to read buffer from server +* @param aSize size of buffer +* @param aArray array to returned +*/ +template +void ArrayFromServerL(const RMPXSession& aSess, + TInt aCmd, + TInt aSize, + RArray& aArray); + +/** +* Packages an object of type T into a descriptor and writes back to the +* client space in message slot aMsgSlot of aMessage. +* +* @since S60 3.2.3 +* @param aMessage message object +* @param aMsgSlot message slot +* @param aValue value +*/ +template void WriteL(const RMessage2& aMessage, + TInt aMsgSlot, T aValue); + +/** + * An array of pointers to objects that auto cleanup. + * + * @lib mpxcommon.lib + */ +template +class RMPXPointerArray : public RPointerArray + { + public: + /** + * Constructor. + * + * @since S60 3.2.3 + */ + inline RMPXPointerArray(); + + /** + * Closes the array and frees all + * resources (including deleting objects in the array). + * + * @since S60 3.2.3 + */ + inline void Close(); + + /** + * Destructor. + * + * @since S60 3.2.3 + */ + inline ~RMPXPointerArray(); + }; + +/** +* Helper to delete an item from array. +* +* @since S60 3.2.3 +* @param aItem an item in the array to be deleted +* @param aArray array object returned +*/ +template +inline void DeleteL(const T* aItem, RPointerArray& aArray); + +#include "mpxcmn.inl" + +#endif // MPXCMN_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_definition_api/inc/mpxcmn.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_definition_api/inc/mpxcmn.inl Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,490 @@ +/* +* Copyright (c) 2006 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 utility functions +* +*/ + + +// ---------------------------------------------------------------------------- +// Copies elements from one array of objects of type T to another +// ---------------------------------------------------------------------------- +// +template +inline void CopyArrayL(const TArray& aSrc, RArray& aDest) + { + aDest.Reset(); + for (TInt i=0; i < aSrc.Count(); ++i) + { + aDest.AppendL(aSrc[i]); + } + } + +// ---------------------------------------------------------------------------- +// Copies elements from one array of descriptors to another +// ---------------------------------------------------------------------------- +// +inline void CopyArrayL(const MDesCArray& aSrc, CDesCArray& aDest) + { + MPXUser::CopyArrayL(aSrc, aDest); + } + +// ---------------------------------------------------------------------------- +// Transfer a buffer from server +// ---------------------------------------------------------------------------- +// +inline void TransferBufferFromServerL(const RMPXSession& aSess, + TInt aCmd, + TInt aSize, + CBufBase*& aBuffer) + { + delete aBuffer; + aBuffer = NULL; + if (aSize==0) + { + User::Leave(KErrArgument); + } + + CBufBase* buffer = MPXUser::CreateBufferLC(aSize); + TPtr8 ptr(buffer->Ptr(0)); + aSess.SendReceiveL(aCmd,TIpcArgs(&ptr)); + CleanupStack::Pop(buffer); + aBuffer = buffer; + } + +// ---------------------------------------------------------------------------- +// Internalize a pointer array from stream +// ---------------------------------------------------------------------------- +// +template +inline void InternalizeL(RPointerArray& aArray, RReadStream& aStream) + { + TInt n=aStream.ReadInt32L(); + for (TInt i=0;i> *entry; + aArray.AppendL(entry); + CleanupStack::Pop(entry); + } + } + +// ---------------------------------------------------------------------------- +// Internalize a pointer array from stream +// ---------------------------------------------------------------------------- +// +template +inline void InternalizeCObjectArrayL( + RPointerArray& aArray, + RReadStream& aStream) + { + TInt n=aStream.ReadInt32L(); + for (TInt i=0;i> *entry; + aArray.AppendL(entry); + CleanupStack::Pop(entry); + } + } + +// ---------------------------------------------------------------------------- +// Internalize an array from stream +// ---------------------------------------------------------------------------- +// +template +inline void InternalizeL(RArray& aArray, RReadStream& aStream) + { + TInt n=aStream.ReadInt32L(); + for (TInt i=0;i item; + aStream.ReadL(item); + aArray.AppendL(item()); + } + } + +// ---------------------------------------------------------------------------- +// Internalize a descriptor array from stream +// ---------------------------------------------------------------------------- +// +inline void InternalizeL(CDesCArray& aArray, RReadStream& aStream) + { + TInt n=aStream.ReadInt32L(); + for (TInt i=0;iDes(); + aStream.ReadL(ptr, length); + aArray.AppendL(*item); + CleanupStack::PopAndDestroy(item); + } + } + +// ---------------------------------------------------------------------------- +// Exernalize a pointer array to stream +// ---------------------------------------------------------------------------- +// +template +inline void ExternalizeL(const TArray& aArray, RWriteStream& aStream) + { + TInt len = aArray.Count(); + aStream.WriteInt32L(len); + for(TInt i = 0;i +inline void ExternalizeL(const TArray& aArray, RWriteStream& aStream) + { + TInt n=aArray.Count(); + aStream.WriteInt32L(n); + for (TInt i=0;i item(aArray[i]); + aStream.WriteL(item); + } + } + +// ---------------------------------------------------------------------------- +// Externalize a descriptor array to stream +// ---------------------------------------------------------------------------- +// +inline void ExternalizeL(const MDesCArray& aArray, RWriteStream& aStream) + { + TInt n=aArray.MdcaCount(); + aStream.WriteInt32L(n); + for (TInt i=0;i +inline void CreateFromBufferL(const CBufBase &aBuf, CArrayFix*& aArray) + { + delete aArray; + aArray = NULL; + RBufReadStream rs(aBuf); + CleanupClosePushL(rs); + CArrayFix* array=new(ELeave)CArrayFixFlat(1); //magic number + CleanupStack::PushL(array); + rs >> *array; + CleanupStack::Pop(array); + aArray = array; + CleanupStack::PopAndDestroy(&rs); + } + +// ---------------------------------------------------------------------------- +// Helper function to create a descriptor array from buf. +// ---------------------------------------------------------------------------- +// +inline void CreateFromBufferL(const CBufBase &aBuf, CDesCArray*& aArray) + { + delete aArray; + aArray = NULL; + RBufReadStream rs(aBuf); + CleanupClosePushL(rs); + CDesCArray* array=new(ELeave)CDesCArrayFlat(1); //magic number + CleanupStack::PushL(array); + InternalizeL(*array, rs); + CleanupStack::Pop(array); + aArray = array; + CleanupStack::PopAndDestroy(&rs); + } + +// ---------------------------------------------------------------------------- +// Helper function to create an array from buf. +// ---------------------------------------------------------------------------- +// +template +inline void CreateFromBufferL(const CBufBase &aBuf, RPointerArray& aArray) + { + aArray.ResetAndDestroy(); + RBufReadStream rs(aBuf); + CleanupClosePushL(rs); + InternalizeL(aArray, rs); + CleanupStack::PopAndDestroy(&rs); + } + +// ---------------------------------------------------------------------------- +// Helper function to create an array from buf. +// ---------------------------------------------------------------------------- +// +template +inline void CreateFromBufferL(const CBufBase &aBuf, RArray& aArray) + { + aArray.Reset(); + RBufReadStream rs(aBuf); + CleanupClosePushL(rs); + InternalizeL(aArray, rs); + CleanupStack::PopAndDestroy(&rs); + } + +// ---------------------------------------------------------------------------- +// Retrieves an object of from buffer +// ---------------------------------------------------------------------------- +// +template +inline void CreateFromBufferL(const CBufBase &aBuf, T*& aObject) + { + delete aObject; + aObject = NULL; + RBufReadStream rs(aBuf); + CleanupClosePushL(rs); + aObject=new(ELeave)T; + CleanupStack::PushL(aObject); + rs>>*aObject; + CleanupStack::Pop(aObject); + CleanupStack::PopAndDestroy(&rs); + } + +// ---------------------------------------------------------------------------- +// Retrieves an object of from buffer +// Note: class T must implement T::NewL(RReadStream& aStream) constructor +// ---------------------------------------------------------------------------- +// +template +inline void NewFromBufferL(const CBufBase &aBuf, T*& aObject) + { + delete aObject; + aObject = NULL; + RBufReadStream rs(aBuf); + CleanupClosePushL(rs); + aObject=T::NewL(); + CleanupStack::PushL(aObject); + rs>>*aObject; + CleanupStack::Pop(aObject); + CleanupStack::PopAndDestroy(&rs); + } + +// ---------------------------------------------------------------------------- +// Retrieves an object of from message buffer +// ---------------------------------------------------------------------------- +// +template +inline void CreateFromMessageL(const RMessage2& aMessage, + TInt aMsgSlot, + T*& aObject) + { + CBufBase* buffer(NULL); + MPXUser::CreateBufferL(aMessage, aMsgSlot, buffer); + CleanupStack::PushL(buffer); + CreateFromBufferL(*buffer, aObject); + CleanupStack::PopAndDestroy(buffer); + } + +// ---------------------------------------------------------------------------- +// Retrieves an object of from message buffer +// ---------------------------------------------------------------------------- +// +template +inline void NewFromMessageL(const RMessage2& aMessage, + TInt aMsgSlot, + T*& aObject) + { + CBufBase* buffer(NULL); + MPXUser::CreateBufferL(aMessage, aMsgSlot, buffer); + CleanupStack::PushL(buffer); + NewFromBufferL(*buffer, aObject); + CleanupStack::PopAndDestroy(buffer); + } + +// ---------------------------------------------------------------------------- +// Copy an object into the buffer +// ---------------------------------------------------------------------------- +// +template +inline void CreateBufferL(const T& aObj, CBufBase*& aBuffer) + { + delete aBuffer; + aBuffer = NULL; + CBufBase* buffer = CBufFlat::NewL(KMPXBufGranularity); + CleanupStack::PushL(buffer); + RBufWriteStream ws(*buffer); + CleanupClosePushL(ws); + ws<Compress(); + CleanupStack::Pop(buffer); + aBuffer = buffer; + } + +// ---------------------------------------------------------------------------- +// Create the buffer from an array +// ---------------------------------------------------------------------------- +// +template +inline void CreateBufferL(const TArray& aArray, CBufBase*& aBuffer) + { + delete aBuffer; + aBuffer = NULL; + TInt size=aArray.Count()*sizeof(TPckgBuf)+sizeof(TInt); + CBufBase* buffer = MPXUser::CreateBufferLC(size); + RBufWriteStream ws(*buffer); + CleanupClosePushL(ws); + ExternalizeL(aArray, ws); + ws.CommitL(); + CleanupStack::PopAndDestroy(&ws); + buffer->Compress(); + CleanupStack::Pop(buffer); + aBuffer = buffer; + } + +// ---------------------------------------------------------------------------- +// Create the buffer from an array of object +// ---------------------------------------------------------------------------- +// +template +inline void CreateBufferL(const TArray& aArray, CBufBase*& aBuffer) + { + delete aBuffer; + aBuffer = NULL; + CBufBase* buffer = CBufFlat::NewL(KMPXBufGranularity); + CleanupStack::PushL(buffer); + RBufWriteStream ws(*buffer); + CleanupClosePushL(ws); + ExternalizeL(aArray, ws); + ws.CommitL(); + CleanupStack::PopAndDestroy(&ws); + buffer->Compress(); + CleanupStack::Pop(buffer); + aBuffer = buffer; + } + +// ---------------------------------------------------------------------------- +// Copy an array from the server +// ---------------------------------------------------------------------------- +// +template +void ArrayFromServerL(const RMPXSession& aSess, + TInt aCmd, + TInt aSize, + CArrayFixBase*& aArray) + { + delete aArray; + aArray = NULL; + + CBufBase* buffer(NULL); + TransferBufferFromServerL(aSess, aCmd, aSize, buffer); + if (!buffer) + { + CleanupStack::PushL(buffer); + CArrayFix* array = NULL; + CreateFromBufferL(*buffer, array); + aArray = array; + CleanupStack::PopAndDestroy(buffer); + } + } + +// ---------------------------------------------------------------------------- +// Copy an array from the server +// ---------------------------------------------------------------------------- +// +template +void ArrayFromServerL(const RMPXSession& aSess, + TInt aCmd, + TInt aSize, + RPointerArray& aArray) + { + CBufBase* buffer(NULL); + TransferBufferFromServerL(aSess, aCmd, aSize, buffer); + CleanupStack::PushL(buffer); + CreateFromBufferL(*buffer, aArray); + CleanupStack::PopAndDestroy(buffer); + } + +// ---------------------------------------------------------------------------- +// Copy an array from the server +// ---------------------------------------------------------------------------- +// +template +void ArrayFromServerL(const RMPXSession& aSess, + TInt aCmd, + TInt aSize, + RArray& aArray) + { + CBufBase* buffer(NULL); + TransferBufferFromServerL(aSess, aCmd, aSize, buffer); + CleanupStack::PushL(buffer); + CreateFromBufferL(*buffer, aArray); + CleanupStack::PopAndDestroy(buffer); + } + +// ---------------------------------------------------------------------------- +// Packages an object of type T into a descriptor and writes back to the +// client space in message slot aMsgSlot of aMessage. +// ---------------------------------------------------------------------------- +// +template void WriteL(const RMessage2& aMessage, + TInt aMsgSlot,T aValue) + { + TPckgC value(aValue); + aMessage.WriteL(aMsgSlot,value); + } + +// ---------------------------------------------------------------------------- +// Default constructor +// ---------------------------------------------------------------------------- +// +template +inline RMPXPointerArray::RMPXPointerArray() + { + } + +// ---------------------------------------------------------------------------- +// Closes the array and frees all resources; +// ---------------------------------------------------------------------------- +// +template +inline void RMPXPointerArray::Close() + { + this->ResetAndDestroy(); + RPointerArray::Close(); + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +template +inline RMPXPointerArray::~RMPXPointerArray() + { + Close(); + } + +template +inline void DeleteL(const T* aItem, RPointerArray& aArray) + { + TInt index = aArray.FindL(aItem); + aArray.Remove(index); + delete aItem; + } +// End of file \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_definition_api/inc/mpxcommand.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_definition_api/inc/mpxcommand.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2006 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: Encapsulates commands and associated arguments +* +*/ + + + +#ifndef CMPXCOMMAND_H +#define CMPXCOMMAND_H + + +#include + +typedef CMPXMedia CMPXCommand; +typedef TUint32 TMPXCommandId; + +#endif // CMPXCOMMAND_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_definition_api/inc/mpxcommonframeworkdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_definition_api/inc/mpxcommonframeworkdefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2006 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: Framework common definitions +* +*/ + + +#ifndef MPXCOMMONFRAMEWORKDEFS_H +#define MPXCOMMONFRAMEWORKDEFS_H + +#include +#include + +enum TMPXOpenMode + { + EMPXOpenDefault, + EMPXOpenGroupOrPlaylist, + EMPXOpenAllItems, + EMPXOpenNoPlaylist, + EMPXOpenPlaylistOnly + }; + +/** + * Enable timer guard for async request. Debug purpose only + */ +//#define _ENABLE_GUARD_TIMER +#ifdef _ENABLE_GUARD_TIMER +//Guard timer 15 seconds for async request +const TInt32 KMPXGuardTimer=15000000; +#endif + +#endif // MPXCOMMONFRAMEWORKDEFS_H + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_definition_api/inc/mpxfilter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_definition_api/inc/mpxfilter.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2006 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: General filter for collection items +* +*/ + + + +#ifndef CMPXFILTER_H +#define CMPXFILTER_H + + +#include + +typedef CMPXMedia CMPXFilter; + + +#endif // CMPXFILTER_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_definition_api/inc/mpxitemid.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_definition_api/inc/mpxitemid.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,175 @@ +/* +* Copyright (c) 2007 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: TMPXitemId definition +* +*/ + + +#ifndef T_MPXITEMID_H +#define T_MPXITEMID_H + + +/** +* Structure to hold a the representation of an Item ID +* The structure contains 2 ids, and can be extensible to more +* The iId1 ID MUST be unique within the collection path. +* The IId2 ID can be duplicated in the collection path, +* and can be use for extended purposes. +* +* @lib mpxcommon.lib +*/ +NONSHARABLE_CLASS( TMPXItemId ) + { + public: + /** + * TInt operator, returns iId1. + * + * @since S60 3.2.3 + */ + inline operator TInt() const; + + /** + * TInt32 operator, returns iId1. + * + * @since S60 3.2.3 + */ + inline operator TInt32() const; + + /** + * TUint32 operator, returns iId1. + * + * @since S60 3.2.3 + */ + inline operator TUint() const; + + /** + * TUint32 operator, returns iId1. + * + * @since S60 3.2.3 + */ + inline operator TUint32() const; + + /** + * TInt64 operator, returns iId1. + * + * @since S60 3.2.3 + */ + inline operator TInt64() const; + + /** + * TUint64 operator, returns iId1. + * + * @since S60 3.2.3 + */ + inline operator TUint64() const; + + /** + * == operator. + * + * @since S60 3.2.3 + * @param aOtherId TMPXItemId to compare + */ + inline TBool operator==( const TMPXItemId& aOtherId ) const ; + + /** + * == operator. + * + * @since S60 3.2.3 + * @param aOtherId TMPXItemId to compare + */ + inline TBool operator==( TInt aOtherId ) const ; + + /** + * == operator. + * + * @since S60 3.2.3 + * @param aOtherId TInt32 to compare to public id + */ + inline TBool operator==( TInt32 aOtherId ) const ; + + /** + * == operator. + * + * @since S60 3.2.3 + * @param aOtherId TUint32 to compare to public id + */ + inline TBool operator==( TUint32 aOtherId ) const ; + + /** + * != operator. + * + * @since S60 3.2.3 + * @param aOtherId TMPXItemId to compare + */ + inline TBool operator!=( const TMPXItemId& aOtherId ) const; + + /** + * != operator. + * + * @since S60 3.2.3 + * @param aOtherId TInt to compare to public id + */ + inline TBool operator!=( TInt aOtherId ) const; + + /** + * An approximately equal operator. If either iId1 or iId2 matches, + * ETrue is returned. + * + * @since S60 3.2.3 + * @param aOtherId TMPXItemId to compare + */ + inline TBool ApproxEqual( const TMPXItemId& aOtherId ) const; + + /** + * Constructor. + * Public and private ids iniitialized to 0. + * + * @since S60 3.2.3 + */ + inline TMPXItemId(); + + /** + * Constructor. + * + * @since S60 3.2.3 + * @param aId id to initialize both public and private id + */ + inline TMPXItemId( TUint32 aId ); + + /** + * Constructor. + * + * @since S60 3.2.3 + * @param aPublicId public ID + * @param aPrivateId privateID + */ + inline TMPXItemId( TUint32 aId1, TUint32 aId2 ); + + /** + * Static function to create an invalid ID. + * + * @since S60 3.2.3 + */ + static inline TMPXItemId InvalidId(); + + public: + TUint32 iId1; + TUint32 iId2; + }; + +#define KMPXInvalidItemId TMPXItemId::InvalidId() + +#include "mpxitemid.inl" + +#endif // T_MPXITEMID_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_definition_api/inc/mpxitemid.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_definition_api/inc/mpxitemid.inl Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,178 @@ +/* +* Copyright (c) 2007 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: inline function definitions for TMPXItemId +* +*/ + + +// ---------------------------------------------------------------------------- +// TInt() operator +// ---------------------------------------------------------------------------- +// +inline TMPXItemId::operator TInt() const + { + return iId1; + } + +// ---------------------------------------------------------------------------- +// TInt32() operator +// ---------------------------------------------------------------------------- +// +inline TMPXItemId::operator TInt32() const + { + return iId1; + } + +// ---------------------------------------------------------------------------- +// TUint() operator +// ---------------------------------------------------------------------------- +// +inline TMPXItemId::operator TUint() const + { + return iId1; + } + +// ---------------------------------------------------------------------------- +// TUint32() operator +// ---------------------------------------------------------------------------- +// +inline TMPXItemId::operator TUint32() const + { + return iId1; + } + +// ---------------------------------------------------------------------------- +// TInt64() operator +// ---------------------------------------------------------------------------- +// +inline TMPXItemId::operator TInt64() const + { + return iId1; + } + +// ---------------------------------------------------------------------------- +// TUint64() operator +// ---------------------------------------------------------------------------- +// +inline TMPXItemId::operator TUint64() const + { + return iId1; + } + +// ---------------------------------------------------------------------------- +// == operator +// ---------------------------------------------------------------------------- +// +inline TBool TMPXItemId::operator==( const TMPXItemId& aOtherId ) const + { + return (iId1 == aOtherId.iId1) && (iId2 == aOtherId.iId2); + }; + +// ---------------------------------------------------------------------------- +// == operator +// ---------------------------------------------------------------------------- +// +inline TBool TMPXItemId::operator==( TInt aOtherId ) const + { + return (iId1 == aOtherId); + }; + +// ---------------------------------------------------------------------------- +// == operator +// ---------------------------------------------------------------------------- +// +inline TBool TMPXItemId::operator==( TInt32 aOtherId ) const + { + return (iId1 == aOtherId); + }; + +// ---------------------------------------------------------------------------- +// == operator +// ---------------------------------------------------------------------------- +// +inline TBool TMPXItemId::operator==( TUint32 aOtherId ) const + { + return (iId1 == aOtherId); + }; + +// ---------------------------------------------------------------------------- +// != operator +// ---------------------------------------------------------------------------- +// +inline TBool TMPXItemId::operator!=( const TMPXItemId& aOtherId ) const + { + return (iId1 != aOtherId.iId1) || (iId2 != aOtherId.iId2); + }; + +// ---------------------------------------------------------------------------- +// != operator +// ---------------------------------------------------------------------------- +// +inline TBool TMPXItemId::operator!=( TInt aOtherId ) const + { + return (iId1 != aOtherId); + }; + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +inline TMPXItemId::TMPXItemId() + { + iId1 = 0; + iId2 = 0; + }; + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +inline TMPXItemId::TMPXItemId( TUint32 aId ) + { + iId1 = aId; + iId2 = aId; + }; + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +inline TMPXItemId::TMPXItemId( TUint32 aId1, TUint32 aId2 ) + { + iId1 = aId1; + iId2 = aId2; + }; + +// ---------------------------------------------------------------------------- +// Almost equal function +// ---------------------------------------------------------------------------- +// +inline TBool TMPXItemId::ApproxEqual( const TMPXItemId& aOtherId ) const + { + return (iId1 == aOtherId.iId1) || (iId2 == aOtherId.iId2); + } + +// ---------------------------------------------------------------------------- +// Creates an invalid ID +// ---------------------------------------------------------------------------- +// +inline TMPXItemId TMPXItemId::InvalidId() + { + TMPXItemId id; + id.iId1=KMaxTUint32; + id.iId2=KMaxTUint32; + return id; + } + +// END OF FILE diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_definition_api/inc/mpxlog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_definition_api/inc/mpxlog.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,219 @@ +/* +* Copyright (c) 2006 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: Debug print macros +* +*/ + + + +#ifndef MPXLOG_H +#define MPXLOG_H + +// INCLUDES +#include +#include +#include + +#ifdef _DEBUG +#define MPX_PERFORMANCE_LOG +#endif + +// MACROS +#ifdef _DEBUG +#define MPX_DEBUG1(s) RDebug::Print(_L(#s)) +#define MPX_DEBUG2(s, a) RDebug::Print(_L(#s), a) +#define MPX_DEBUG3(s, a, b) RDebug::Print(_L(#s), a, b) +#define MPX_DEBUG4(s, a, b, c) RDebug::Print(_L(#s), a, b, c) +#define MPX_DEBUG5(s, a, b, c, d) RDebug::Print(_L(#s), a, b, c, d) +#define MPX_FUNC(fn) TFunctionTrace _s(_L(fn)); +#define MPX_FUNC_EX(fn) TFunctionTrace _s(_L(fn), this); +class TFunctionTrace + { + public: + TFunctionTrace(TRefByValue aName, TAny* aThis=NULL): + iStr(aName), iThis(aThis) + { + iThis ? MPX_DEBUG3("-->%S, 0x%08x",&iStr, iThis) : MPX_DEBUG2("-->%S",&iStr); + } + ~TFunctionTrace() + { + iThis ? MPX_DEBUG3("<--%S, 0x%08x",&iStr, iThis) : MPX_DEBUG2("<--%S",&iStr); + } + private: + TPtrC iStr; + TAny* iThis; + }; + +// print out (index, id) for each level and the first 15 ids at top level +#define MPX_DEBUG_PATH(aPath) { \ + TInt dlevels = (aPath).Levels();\ + TInt dcount = (aPath).Count();\ + MPX_DEBUG3("Collection Path debug: levels= %d, count = %d", dlevels, dcount);\ + for (TInt i=0; i 0)\ + {\ + TInt index = (aPath).Index();\ + MPX_DEBUG2("Collection Path debug current index %d", index);\ + if (index>=0 && index(&aPath);\ + dpath->SetToFirst();\ + TInt ditem(0);\ + do\ + {\ + MPX_DEBUG3("Collection Path debug top level: item %d = id 0x%08x", ditem, dpath->Id().iId1);\ + } while (++(*dpath) && ++ditem < 15 );\ + dpath->Set(index);\ + }\ + else\ + {\ + MPX_DEBUG1("Collection Path debug: Invalid current index");\ + }\ + }\ + } + +#define MPX_DEBUG_THREAD(ss) { \ + RProcess process; \ + TFullName fullName; \ + process.FullName( fullName ); \ + RThread thisThread; \ + _LIT(_ss, ss); \ + MPX_DEBUG5("%S: process=%S, thread=%d, this=0x%08x", &_ss, &fullName, (TUint)thisThread.Id(), this); \ + } + +_LIT(_KMPXErrorInfo, "##MPX Error##: error %d file %s line %d"); +#define MPX_S(a) _S(a) +#define MPX_ERROR_LOG(aErr) {\ + if (aErr) RDebug::Print(_KMPXErrorInfo, aErr, MPX_S(__FILE__), __LINE__);\ + } +#else +#define MPX_DEBUG1(s) +#define MPX_DEBUG2(s, a) +#define MPX_DEBUG3(s, a, b) +#define MPX_DEBUG4(s, a, b, c) +#define MPX_DEBUG5(s, a, b, c, d) +#define MPX_FUNC(s) +#define MPX_FUNC_EX(fn) +#define MPX_DEBUG_PATH(aPath) +#define MPX_DEBUG_THREAD(ss) +// Copy constant _KMPXErrorInfo and Macros MPX_S and MPX_ERROR_LOG from +// _DEBUG section if intend to log error in release build. +#define MPX_ERROR_LOG(aErr) +#endif + +#ifdef MPX_PERFORMANCE_LOG +#define MPX_PERF_CHECKPT(s) RDebug::Print(_L("--- PERFORMANCE CHECK POINT ---"));\ + RDebug::Print(_L(#s)); +#define MPX_PERF_START(fn) TPerfTrace perf__##fn (_L(#fn)); perf__##fn.Start(); +#define MPX_PERF_END(fn) perf__##fn.End(); + +#define MPX_PERF_START_EX(fn) TPerfTrace perf__##fn (_L(#fn)); perf__##fn.StartEx(); +#define MPX_PERF_END_EX(fn) TPerfTrace perf__##fn (_L(#fn)); perf__##fn.EndEx(); +#define KAppUidMusicPlayerPerf 300000 +#define KMPXPerfTop32 1 +#define KMPXPerfBottom32 2 + +class TPerfTrace + { + public: + TPerfTrace(TRefByValue aName): + iStr(aName) + { + } + void TPerfTrace::Start() + { + iTime.UniversalTime(); + MPX_DEBUG2("-->%S",&iStr); + } + void TPerfTrace::End() + { + TTime now; + now.UniversalTime(); + TInt delta = I64INT(now.MicroSecondsFrom(iTime).Int64()); + MPX_DEBUG3("<--%S, time taken %d us", &iStr, delta); + } + void TPerfTrace::StartEx() + { + MPX_DEBUG2(">>> MPXPerf started %S",&iStr); + TTime time; + time.UniversalTime(); + TInt64 start = time.Int64(); + + TInt err( RProperty::Define(TUid::Uid(KAppUidMusicPlayerPerf), KMPXPerfTop32, RProperty::EInt ) ); + if ( err == KErrNone || err == KErrAlreadyExists) + { + err = RProperty::Define(TUid::Uid(KAppUidMusicPlayerPerf), KMPXPerfBottom32, RProperty::EInt ); + } + + if ( err == KErrNone || err == KErrAlreadyExists ) + { + TInt top32( start >> 32 ); + TInt bottom32( start & 0xFFFFFFFF ); + err = RProperty::Set( TUid::Uid(KAppUidMusicPlayerPerf), + KMPXPerfTop32, + top32 ); + err = RProperty::Set( TUid::Uid(KAppUidMusicPlayerPerf), + KMPXPerfBottom32, + bottom32 ); + } + } + + + void TPerfTrace::EndEx() + { + TTime end; + end.UniversalTime(); + TInt ret( 0 ); + TInt64 s( 0 ); + TInt err( RProperty::Get( TUid::Uid(KAppUidMusicPlayerPerf), KMPXPerfTop32, ret ) ); + if ( err == KErrNone ) + { + s = TInt64( ret ) << 32; + err = RProperty::Get( TUid::Uid(KAppUidMusicPlayerPerf), KMPXPerfBottom32, ret ); + if ( err == KErrNone ) + { + s += ret; + } + else + { + s = 0; + } + } + TTime start(s); + TInt delta = I64INT(end.MicroSecondsFrom(start).Int64()); + MPX_DEBUG3(">>> MPXPerf %S, time taken %d us", &iStr, delta); + } + private: + TPtrC iStr; + TTime iTime; + }; + + +#else +#define MPX_PERF_CHECKPT(s) +#define MPX_PERF_START(fn) +#define MPX_PERF_END(fn) +#define MPX_PERF_START_EX(fn) +#define MPX_PERF_END_EX(fn) +#endif + +#define MPX_TRAP(_r, _s) TRAP(_r,_s);MPX_ERROR_LOG(_r); +#define MPX_TRAPD(_r, _s) TRAPD(_r,_s);MPX_ERROR_LOG(_r); + +#endif // MPXLOG_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_definition_api/inc/mpxmessage2.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_definition_api/inc/mpxmessage2.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2006 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: Encapsulate messages +* +*/ + + + +#ifndef CMPXMESSAGE2_H +#define CMPXMESSAGE2_H + + +#include +#include + +typedef CMPXMedia CMPXMessage; +typedef CMPXMediaArray CMPXMessageArray; +typedef TUint32 TMPXMessageId; + +#endif // CMPXMESSAGE2_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_definition_api/inc/mpxpathconfiguration.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_definition_api/inc/mpxpathconfiguration.hrh Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2005 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 paths used by mpx & Music Shop are defined + here. +* +*/ + + +#ifndef MPXPATHCONFIGURATION_HRH +#define MPXPATHCONFIGURATION_HRH + +// INCLUDES +#include + +// MACROS +#define text_hdd_root_path "E:\\" + +// Folder used when saving attachment from Messaging application +#define text_targetfolder_attachment "Attachments\\" + +// Folder used when saving download from Browser & Music Shop application +#define text_targetfolder_downloads "Music Downloads\\" + +// Folder used when saving ringtones +#define text_targetfolder_ringtones text_simple_sounds_path + +// Folder used for creating new playlists +#define text_targetfolder_playlists "Playlists\\" + +#endif // MPXPATHCONFIGURATION_HRH diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_definition_api/inc/mpxprivatecrkeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_definition_api/inc/mpxprivatecrkeys.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2004 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: Music Player private CenRep keys. +* +*/ + + + +#ifndef MPXPRIVATECRKEYS_H +#define MPXPRIVATECRKEYS_H + +#include + + + +// Music Settings API + +const TUid KCRUidMPXSettings = {0x101FFC03}; + +const TUint32 KMPXPlaybackVolume = 0x00000001; // Percentage of max volume +const TUint32 KMPXPlaybackRandomMode = 0x00000002; +const TUint32 KMPXPlaybackRepeatMode = 0x00000003; + +// view utility settings +const TUint32 KMPXVUCurrentDefaultView = 0x00000004; + +// Pre-Init enabled +const TUint32 KMPXPlaybackPreInitEnabled = 0x00000005; + +// Maximum size of MPX global heap in MB. +const TUint32 KMPXMaxGlobalHeapSize = 0x00000006; + +const TUint32 KMPXPlaybackMute = 0x00000007; + +#endif // MPXPRIVATECRKEYS_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_definition_api/inc/mpxsearchcriteria.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_definition_api/inc/mpxsearchcriteria.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2006 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: Encapsulates search criteria for querying collections +* +*/ + + + +#ifndef CMPXSEARCHCRITERIA_H +#define CMPXSEARCHCRITERIA_H + + +#include + +typedef CMPXMedia CMPXSearchCriteria; + + +#endif // CMPXSEARCHCRITERIA_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_common_definition_api/mpx_common_definition_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_common_definition_api/mpx_common_definition_api.metaxml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,14 @@ + + +MPX Common Definition API +Common definitions used by the MPX framework +c++ +mpx + + + + +no +no + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_common_definition_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_common_definition_api/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2007 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 +: mpx playback API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/mpxplaybackcommanddefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxplaybackcommanddefs.h) +../inc/mpxplaybackengineobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxplaybackengineobserver.h) +../inc/mpxplaybackframeworkdefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxplaybackframeworkdefs.h) +../inc/mpxplaybackmessage.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxplaybackmessage.h) +../inc/mpxplaybackmessage.inl MW_LAYER_PLATFORM_EXPORT_PATH(mpxplaybackmessage.inl) +../inc/mpxplaybackmessagedefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxplaybackmessagedefs.h) +../inc/mpxplaybackobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxplaybackobserver.h) +../inc/mpxplaybackplugin.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxplaybackplugin.h) +../inc/mpxplaybackplugin.hrh MW_LAYER_PLATFORM_EXPORT_PATH(mpxplaybackplugin.hrh) +../inc/mpxplaybackplugin.inl MW_LAYER_PLATFORM_EXPORT_PATH(mpxplaybackplugin.inl) +../inc/mpxplaybackpluginobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxplaybackpluginobserver.h) +../inc/mpxplaybackpluginversion2.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxplaybackpluginversion2.h) diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackcommanddefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackcommanddefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,200 @@ +/* +* Copyright (c) 2006 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: Definitions for command type for playback framework +* +*/ + + + +#ifndef MPXPLAYBACKCOMMANDDEFS_H +#define MPXPLAYBACKCOMMANDDEFS_H + +#include +#include + +/****************************************************** + * Commands supported for KMPXCommandIdPlaybackGeneral + ******************************************************/ +/** +* General Commands for playback framework +*/ +const TInt KMPXCommandIdPlaybackGeneral = 0x10282971; + +/////////////////////////////////////////////////////////////////////////////// +// Attributes supported by KMPXCommandIdPlaybackGeneral +// Attributes besides KMPXCommandContentIdGeneral +// The value of attribute KMPXCommandGeneralId is KMPXCommandIdPlaybackGeneral +/////////////////////////////////////////////////////////////////////////////// + +/** + * General command type + * TInt value. value of TMPXPlaybackCommand + */ +const TMPXAttributeData KMPXCommandPlaybackGeneralType = + {KMPXCommandIdPlaybackGeneral, 0x01}; + +/** Optional + * Parameter data for the general command + * TInt value + */ +const TMPXAttributeData KMPXCommandPlaybackGeneralData = + {KMPXCommandIdPlaybackGeneral, 0x02}; + +/** Optional + * Tells whether or not to use command buffering for this command + * TBool value + */ +const TMPXAttributeData KMPXCommandPlaybackGeneralNoBuffer = + {KMPXCommandIdPlaybackGeneral, 0x04}; + +/** Optional + * The process id of the client which sends the command + * TProcessId value + */ +const TMPXAttributeData KMPXCommandPlaybackGeneralClientPid = + {KMPXCommandIdPlaybackGeneral, 0x08}; + +/** + * Playback general command + */ +enum TMPXPlaybackCommand + { + EPbCmdPlay, // 0 Play which ever track is currently stopped, paused etc. + EPbCmdPlayWithFadeIn, // 1 uses KPbFadeInDuration + EPbCmdPause, // 2 + EPbCmdStop, // 3 + EPbCmdNext, // 4 No effect if no next track + EPbCmdPrevious, // 5 No effect if no previous track; + // if pos>KPbReplayThreshold, replays current track + EPbCmdReplay, // 6 Restart current track at beginning + EPbCmdStartSeekForward, // 7 + EPbCmdStartSeekBackward, // 8 + EPbCmdStopSeeking, // 9 + EPbCmdIncreaseVolume, // 10 + EPbCmdDecreaseVolume, // 11 + EPbCmdMuteVolume, // 12 + EPbCmdUnMuteVolume, // 13 + EPbCmdClose, // 14 + EPbApplyEffect, // 15 Apply an effect to the current playback, + // aData used to identify effect + EPbCmdPreservePosition, // 16 Preserve playback position + EPbCmdPreserveState, // 17 Preserve playback state + EPbCmdCloseItem, // 18 Request to close the file handle + EPbCmdPlayPause, // 19 Play/Pause toggle command + EPbCmdCancelInit, // 20 + EPbCmdResetPreserveState, // 21 + EPbCmdUnloadNonActivePlugin, // 22 KMPXCommandPlaybackGeneralData is TUid.iUid + EPbCmdClearKeyBuffer, // 23 Clear all media key commands + EPbCmdDisableEffect, + EPbCmdSetVolume, // 25 Set volume to the value specified by aData + EPbCmdSetAutoResume, // 26 Set autoresume value (true/false) + EPbCmdEnd // Mark for the end of command + }; + +/****************************************************** + * Commands supported for KMPXCommandIdPlaybackPD + ******************************************************/ +/** +* Progressive Download Commands for playback framework +*/ +const TInt KMPXCommandIdPlaybackPD = 0x10282972; + +//////////////////////////////////////////////////////////////////////////// +// Attributes supported by KMPXCommandIdPlaybackPD +// Attributes besides KMPXCommandContentIdGeneral and +// KMPXCommandIdPlaybackGeneral +// The value of attribute KMPXCommandGeneralId is KMPXCommandIdPlaybackPD +// The value of attribute KMPXCommandPlaybackGeneralType is the value of +// TMPXPlaybackPdCommand +//////////////////////////////////////////////////////////////////////////// + +/** Optional + * Parameter for PD transaction ID + * TUInt value + */ +const TMPXAttributeData KMPXCommandPlaybackPDTransactionID = { + KMPXCommandIdPlaybackPD, 0x01}; + +/** Optional, TInt + * Parameter for PD Event ID + * TInt value + */ +const TMPXAttributeData KMPXCommandPlaybackPDEvent = { + KMPXCommandIdPlaybackPD, 0x02}; + +/** Optional, TInt + * Parameter for PD State + * TInt value, value of TMPXPlaybackPdDownloadState + */ +const TMPXAttributeData KMPXCommandPlaybackPDState = { + KMPXCommandIdPlaybackPD, 0x04}; + +/** Optional, TInt + * Parameter for PD Downloaded Bytes + * TInt value + */ +const TMPXAttributeData KMPXCommandPlaybackPDDownloadedBytes = { + KMPXCommandIdPlaybackPD, 0x08}; + +/** Optional, TInt + * Parameter for PD Total Bytes + * TInt value + */ +const TMPXAttributeData KMPXCommandPlaybackPDTotalBytes = { + KMPXCommandIdPlaybackPD, 0x10}; + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API +/** Optional, TInt64 + * Parameter for PD Downloaded Bytes + * TInt64 value + */ +const TMPXAttributeData KMPXCommandPlaybackPDDownloadedBytes64 = { + KMPXCommandIdPlaybackPD, 0x20}; + +/** Optional, TInt64 + * Parameter for PD Total Bytes + * TInt64 value + */ +const TMPXAttributeData KMPXCommandPlaybackPDTotalBytes64 = { + KMPXCommandIdPlaybackPD, 0x40}; +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + +/** + * Progress download command + */ +enum TMPXPlaybackPdCommand + { + EPbCmdStartPd, + EPbCmdFinishPd, + EPbCmdHandlePdEvent, + EPbCmdGetPdStatus, + EPbCmdPausePd, + EPbCmdResumePd, + EPbCmdCancelPd + }; + +enum TMPXPlaybackPdDownloadState // Progressive download state + { + EPbDlStateNotDownloading, // PD not in progress + EPbDlStateBuffering, // Download in progress, not downloaded enough to start playback + EPbDlStateDownloading, // Download in progress, playback can start/has started + EPbDlStateDownloadPaused, // Download paused + EPbDlStateDownloadCompleted, // Download completed + EPbDlStateDownloadError, // Download error + EPbDlStateDownloadCanceled // Download canceled + }; + +#endif // MPXPLAYBACKCOMMANDDEFS_H + +// End of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackengineobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackengineobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,113 @@ +/* +* Copyright (c) 2006 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: playback engine observer. +* +*/ + + + +#ifndef MMPXPLAYBACKENGINEOBSERVER_H +#define MMPXPLAYBACKENGINEOBSERVER_H + +// INCLUDES +#include +#include +#include +#include + +// FORWARD DECLARATIONS +class CMPXMedia; + +/** +* Interface for handling active engine. +* +* @lib mpxcommon.lib +*/ +NONSHARABLE_CLASS(MMPXPlaybackEngineObserver) + { +public: + /** + * Handle playback property. + * + * @since S60 3.2.3 + * @param aProperty the property + * @param aValue the value of the property + * @param aError error code + */ + virtual void HandleProperty(TMPXPlaybackProperty aProperty, + TInt aValue, + TInt aError) = 0; + + /** + * Method is called continously until aComplete=ETrue, signifying that + * it is done and there will be no more callbacks. + * Only new items are passed each time. + * + * @since S60 3.2.3 + * @param aPlayer UID of the subplayer + * @param aSubPlayers a list of sub players + * @param aComplete ETrue no more sub players. EFalse more subplayer + * expected + * @param aError error code + */ + virtual void HandleSubPlayerNames(TUid aPlayer, + const MDesCArray* aSubPlayers, + TBool aComplete, + TInt aError) = 0; + + /** + * + * Call back of media request. + * + * @since S60 3.2.3 + * @param aMedia media + * @param aError error code + * + * @deprecated Use method MMPXPlaybackEngineObserver::HandleMedia( + * CMPXMedia* aMedia, TInt aError) instead. + * + */ + virtual void HandleMedia(const CMPXMedia& aMedia, + TInt aError) + { + HandleMedia(const_cast(&aMedia), aError); + } + + /** + * Call back of media request. + * + * @since S60 3.2.3 + * @param aMedia media object. Ownership not transferred. + * @param aError error code + */ + virtual void HandleMedia(CMPXMedia* /*aMedia*/, + TInt /*aError*/) + { + // Note: change it into pure virtual after plugins update + } + + /** + * Handle completion of a asynchronous command. + * + * @since S60 3.2.3 + * @param aCommandResult result of the command, NULL if error + * @param aError error code + */ + virtual void HandlePlaybackCommandComplete(CMPXCommand* /*aCommandResult*/, + TInt /*aError*/) {} + }; + +#endif // MMPXPLAYBACKENGINEOBSERVER_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackframeworkdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackframeworkdefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,254 @@ +/* +* Copyright (c) 2006 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 definition +* +*/ + + +#ifndef MPXPLAYBACKFRAMEWORKDEFS_H +#define MPXPLAYBACKFRAMEWORKDEFS_H + + +#include +#include // TMPXPlaybackCommand. After all of clients + // inlcude this file. this line can be removed. +#include // TMPXPlaybackPlayerType + +// 2s - time into the track after which 'back' replays track, else previous track +const TInt KPbReplayThresholdMiliSeconds=2000; +// 4s - fades into track over KPbFadeInDurationMicroSeconds +const TInt KPbFadeInDurationMicroSeconds=4000000; +// 1s - updates position every KPbPosUpdateMicroSeconds +const TInt KPbPosUpdateMicroSeconds=1000000; +// 3s - time taken to fade in after a call +const TInt KPbResumeWaitTimeMicroSeconds=3000000; +// 0.5s - interval during which media keys will be buffered +const TInt KPbMediaKeyIntervalMicroSeconds=500000; +const TInt KPbSeekIntervalMicroSeconds=300000; // 0.3s - how often to update +const TInt KPbInitialSeekStepMilliSeconds=1000; // 1s (1000 millisecond) - first seek step +const TInt KPbMaxSeekStepPercent=5; // Maximum step size is 5% of duration +const TInt KPbSeekAccelerationFactor=2; // Each step doubles acceleration speed +// Multiplier from second to microsecond +const TInt KPbMicroMultiplier = 1000000; +// Multiplier from second to millisecond +const TInt KPbMilliMultiplier = 1000; +// Minimum volume level +const TInt KPbPlaybackVolumeLevelMin = 0; +// Maximum volume level +const TInt KPbPlaybackVolumeLevelMax = 100; +// Default volume level +const TInt KMPXPlaybackDefaultVolume = 40; +// Position threshold for changes (in miliseconds) +const TInt KPbPositionChangeThreshold = 1500; +// Duration change threshold (in miliseconds) +const TInt KPbDurationChangeThreshold = 1500; + +// UID definition for playback mode +// For application playback mode, application UID can be used +// +const TUid KPbModeDefault = {0x10282930}; // Uses same player as any other + // player running in same +const TUid KPbModeActivePlayer = {0x10282931}; // Currently active player or any player if no active player. +const TUid KPbModeNewPlayer = {0x10282932}; // New player + + +// Category for playback utility creation. +enum TMPXCategory + { + EMPXCategoryUndefined = 0, + EMPXCategoryMusic, + EMPXCategoryVideo + }; + +enum TMPXPlaybackState // State of current player + { + EPbStateNotInitialised, // 0 + EPbStateInitialising, // 1 + EPbStatePlaying, // 2 + EPbStatePaused, // 3 + EPbStateStopped, // 4 + EPbStateSeekingForward, // 5 + EPbStateSeekingBackward,// 6 + EPbStateShuttingDown, // 7 + EPbStateBuffering, // 8 + EPbStateDownloading, // 9 + EPbStatePluginSeeking, // 10 + EPbStateInitialised // 11 + }; + +enum // Supported features + { + EPbFeatureBalance=0x01, + EPbFeatureEmbeddedMode=0x04, + EPbFeatureCrossFade=0x08, + EPbFeatureFadeIn=0x10, + EPbFeatureSeekable=0x20, + EPbFeatureNetwork=0x40, + EPbFeatureVolumeRamp=0x80, + EPbFeaturePdPausable=0x1000 //progress download pausable + }; + +/** +* Properties that can be queried, but not all can be set. +* Some properties pertain to the specific track, some to +* the specific player, and others are general +*/ +enum TMPXPlaybackProperty + { + EPbPropertyVolume, // 0 volume level values 0-KPbPlaybackVolumeLevelMax + EPbPropertyMaxVolume, // 1 read only, KPbPlaybackVolumeLevelMax + EPbPropertyVolumeRamp,// 2 + EPbPropertyMute, // 3 values 0(normal), 1(muted) + EPbPropertyBalance, // 4 values -100(left) - 0 - +100(right) + EPbPropertyEmbeddedMode,// 5 + EPbPropertyCrossFade, // 6 + EPbPropertyRandomMode, // 7 + EPbPropertyRepeatMode, // 8 + EPbPropertyAccessPoint, // 9 + EPbPropertyPosition, // 10 depends on the plugin, it's safer to pause + // the playing item before setting position + EPbPropertyDuration, // 11 read only, millisecond + EPbPropertySongValid, // 12 + EPbPropertyRemote, // 13 + EPbPropertySupportedFeatures,// 14 read only + EPbPropertyNum // 15 Last + }; + +enum TMPXPlaybackRepeatMode // Repeat settings + { + EPbRepeatOff, // No repeat + EPbRepeatOne, // Play one track over and over again + EPbRepeatAll // Repeat the whole play list + }; + +enum // Balance settings + { + EPbBalanceMaxLeft=-100, + EPbBalanceCenter=0, + EPbBalanceMaxRight=100 + }; + +#ifdef __ACCESSORY_FW + +/** +* accessory modes: +* EPbAccessoryHandPortable Hand-portable +* EPbAccessoryWiredHeadset Wired headset +* EPbAccessoryWirelessHeadset Wireless headset +* EPbAccessoryWiredCarKit Wired carkit +* EPbAccessoryWirelessCarKit Wireless carkit +* EPbAccessoryTextDevice TTY +* EPbAccessoryLoopset Loopset +* EPbAccessoryMusicStand Musicstand +*/ +enum TMPXPlaybackAccessoryMode + { + EPbAccessoryModeUnknown = -1, + EPbAccessoryHandPortable = 0x00000000, + EPbAccessoryWiredHeadset = 0x00000001, + EPbAccessoryWirelessHeadset = 0x00000002, + EPbAccessoryWiredCarKit = 0x00000004, + EPbAccessoryWirelessCarKit = 0x00000008, + EPbAccessoryTextDevice = 0x00000010, + EPbAccessoryLoopset = 0x00000020, + EPbAccessoryMusicStand = 0x00000040, + EPbAccessoryTVOut = 0x00000080, + EPbAccessoryHeadphones = 0x00000100 + }; +#else +/** +* accessory modes: +* EPbAccessoryUnknown Accessory mode is unknown +* EPbAccessoryNone No external accessories connected. +* EPbAccessoryUnsupported Unknown accessory connected. +* EPbAccessoryDataCable Connected with data cable. +* EPbAccessoryHeadset Headset connected. +* EPbAccessoryLoopset Loopset connected. +* EPbAccessoryCarKit CarKit connected. +* EPbAccessoryMic External mic connected. +* EPbAccessoryTty TTY connected. +* EPbAccessoryBtHeadset BT Headset connected. +* EPbAccessoryBtCarKit BT CarKit connected. +*/ +enum TMPXPlaybackAccessoryMode + { + EPbAccessoryModeUnknown = -1, + EPbAccessoryNone = 0x00000000, + EPbAccessoryUnsupported = 0x00000001, + EPbAccessoryDataCable = 0x00000002, + EPbAccessoryHeadset = 0x00000004, + EPbAccessoryLoopset = 0x00000008, + EPbAccessoryCarKit = 0x00000010, + EPbAccessoryMic = 0x00000020, + EPbAccessoryTty = 0x00000040, + EPbAccessoryBtHeadset = 0x00000080, + EPbAccessoryBtCarKit = 0x00000100, + }; +#endif + +// Server function codes +enum TMPXPlaybackServerOp + { + EPbsGetNextMessage, // 0 Must be 0 + EPbsCancelGetMessage, // 1 Must be 1 + EPbsSetMode, // 2 Must be called before any other following op + EPbsGetClients, // 3 + EPbsInitFromCollection, // 4 + EPbsInitFromUri, // 5 + EPbsInitFromFile, // 6 + EPbsCancelRequest, // 7 + EPbsCommand, // 8 + EPbsCommandExt = EPbsCommand, // DEPRECATED to be removed + EPbsGetState, // 9 + EPbsSetProperty, // 10 + EPbsGetProperty, // 11 + EPbsGetPlayerTypes, // 12 + EPbsGetPlayerTypeDisplayName, // 13 + EPbsGetAllPlayersUids, // 14 + EPbsGetPlayersUidsForType, // 15 + EPbsGetSubPlayerNamesByUid, // 16 + EPbsSelectPlayerByType, // 17 + EPbsSelectPlayerByUid, // 18 + EPbsSelectSubPlayer, // 19 + EPbsClearPlayerSelection, // 20 + EPbsGetSelection, // 21 + EPbsPlayerFound, // 22 + EPbsGetPlayerType, // 23 + EPbsGetTypeName, // 24 + EPbsGetSubPlayerIndex, // 25 + EPbsGetPlayerUid, // 26 + EPbsGetCollectionPlaylist, // 27 + EPbsGetFile, // 28 + EPbsGetUri, // 29 + EPbsGetMedia, // 30 + EPbsGetSupportedMimeTypes, // 31 + EPbsGetSupportedExtensions, // 32 + EPbsGetSupportedSchemas, // 33 + EPbsGetSyncBuffer, // 34 Gets server side buffer following client sync request + EPbsGetAsyncBuffer, // 35 Gets server side buffer following client async request + EPbsCustomCommandSyncReceive, // 36 + EPbsCustomCommandSyncNoReceive, // 37 + EPbsCustomCommandAsyncReceive, // 38 + EPbsCustomCommandAsyncNoReceive,// 39 + EPbsInitStreamingFromUri, // 40 + EPbsInitStreamingFromFile, // 41 + EPbsInitFromFile64, // 42 + EPbsInitStreamingFromFile64, // 43 + EPbsGetFile64, // 44 + EPbsServerOpEnd // End of operation + }; + +#endif // MPXPLAYBACKFRAMEWORKDEFS_H + +// End of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackmessage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackmessage.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2004 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: Playback message +* +*/ + + + +#ifndef TMPXPLAYBACKMESSAGE_H +#define TMPXPLAYBACKMESSAGE_H + + +#include +#include +/** +* Playback message type. +* +* @lib mpxcommon.lib +*/ +class TMPXPlaybackMessage : public TMPXMessage + { +public: + enum TEvent + { + ENoEvent, + EError, // EError must be 1. iData is error originating from player, iType=event type + ECommandReceived, // iType=TMPXPlaybackCommand + ECommandComplete, // iType=TMPXPlaybackCommand + EPropertyChanged, // iType=TMPXPlaybackProperty; iData=new value + EStateChanged, // iType=TMPXPlaybackState + ESongCorrupt, + ESongContainerChanged, // Need to call MMPXMedia::CollectionPathL() to get new path + EInitializeComplete, // iData = ETrue if init was to start playback, else EFalse. + ESongChanged, // iData=new index; need to query to get new properties (e.g. duration, title etc.) + EPlayerChanged, // Need to call MMPXPlaybackUtility::CurrentPlayer() to get new features + EActivePlayerChanged, // iData=active/inactive (ETrue/EFalse); iType (ETrue,rebind to ActivePlayerMode) + ESubPlayersChanged, // Need to query to get new list of sub players + EPlayerSelectionChanged, // Need to query MMPXPlayerManager::GetSelectionL() + EDownloadStarted, // iData=total expected bytes + EDownloadUpdated, // iData=total bytes so far + EDownloadComplete, // iData=total bytes downloaded + EDownloadPositionChanged, // iData=total bytes so far + EDownloadStateChanged, // iData=TMPXPlaybackPdDownloadState + EDownloadCmdPauseDownload, // iData=transaction ID + EDownloadCmdResumeDownload, // iData=transaction ID + EDownloadCmdCancelDownload, // iData=transaction ID + EAccessoryChanged, // iType=TAccessoryMode + EMediaChanged, // When the song/playlist hasn't, but data may become available + ESkipping, //skipping event, iData=+1, skipping forward, -1, skipping backward + ESkipEnd, //skipping end + EPlayerUnavailable, + EPlaylistUpdated, // playlist updated + EReachedEndOfPlaylist, // playback or skipping forward has reached end of playlist + EDownloadFileMoved + }; +public: + /** + * C++ constructor. + * + * @since S60 3.2.3 + * @param aEvent event + * @param aType event type + * @param aData optional data + */ + inline TMPXPlaybackMessage(TEvent aEvent,TInt aType = 0,TInt aData = 0); + + /** + * C++ copy constructor. + * + * @since S60 3.2.3 + * @param aMsg source message + */ + inline TMPXPlaybackMessage(const TMPXPlaybackMessage& aMsg); + + /** + * Overloaded assignment operator. + * + * @since S60 3.2.3 + * @param aMsg source message + */ + inline TMPXPlaybackMessage& operator=(const TMPXPlaybackMessage& aMsg); + + /** + * C++ constructor. + * + * @since S60 3.2.3 + */ + inline TMPXPlaybackMessage(); + }; + +#include "mpxplaybackmessage.inl" + +#endif // TMPXPLAYBACKMESSAGE_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackmessage.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackmessage.inl Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,55 @@ +/* +* 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: Inline implementation of playback messge +* +*/ + + +// ----------------------------------------------------------------------------- +// C++ constructor +// ----------------------------------------------------------------------------- +// +inline TMPXPlaybackMessage::TMPXPlaybackMessage(TEvent aEvent, + TInt aType /*= 0*/, + TInt aData /*= 0*/) + : TMPXMessage(aEvent, aType, aData) + {} + +// ----------------------------------------------------------------------------- +// C++ constructor +// ----------------------------------------------------------------------------- +// +inline TMPXPlaybackMessage::TMPXPlaybackMessage() + : TMPXMessage(ENoEvent,0,0) + {} + +// ----------------------------------------------------------------------------- +// Copy constructor +// ----------------------------------------------------------------------------- +// +inline TMPXPlaybackMessage::TMPXPlaybackMessage(const TMPXPlaybackMessage& aMsg) + : TMPXMessage(aMsg) + { + } + +// ----------------------------------------------------------------------------- +// Overloaded assignment operator +// ----------------------------------------------------------------------------- +// +inline TMPXPlaybackMessage& TMPXPlaybackMessage::operator=( + const TMPXPlaybackMessage& aMsg) + { + TMPXMessage::operator =(aMsg); + return *this; + } diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackmessagedefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackmessagedefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2006 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: Definitions for message type +* +*/ + + + +#ifndef MPXPLAYBACKMESSAGEDEFS_H +#define MPXPLAYBACKMESSAGEDEFS_H + + +#include +#include +/** +* Media changed message +*/ +const TInt KMPXMessagePbMediaChanged = 0x10282968; + +/** + * Attributes supported for KMPXMessageIdItemChanged + */ +/** + * CMPXMedia. new media object + */ +const TMPXAttributeData KMPXMessagePbMedia={KMPXMessagePbMediaChanged, 0x01}; + +#endif // MPXPLAYBACKMESSAGEDEFS_H + +// End of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2006 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: Playback observer +* +*/ + + + +#ifndef MMPXPLAYBACKOBSERVER_H +#define MMPXPLAYBACKOBSERVER_H + +#include +#include +#include +#include + +class TMPXPlaybackMessage; +class CMPXMedia; + +/** +* Interface for receiving events. +* +* @lib mpxcommon.lib +*/ +NONSHARABLE_CLASS(MMPXPlaybackObserver) + { +public: + /** + * Handle playback message. + * + * @since S60 3.2.3 + * @param aMsg playback message + * @deprecated Use method MMPXPlaybackObserver::HandlePlaybackMessage + * (CMPXMessage* aMsg, TInt aErr) instead. + * Because if system error happens, e.g. KErrNoMemory, aMsg object + * can not be created. + * NOTE: only one of HandlePlaybackMessage callback can be implemented. + */ + virtual void HandlePlaybackMessage(const CMPXMessage& /*aMsg*/) + { + } + + /** + * Handle playback message. + * Note: only one of HandlePlaybackMessage callback can be implemented. + * Note: change into pure virtual when all clients updated. + * + * @since S60 3.2.3 + * @param aMsg playback message, ownership not transferred. + * Please check aMsg is not NULL before using it. If aErr is not + * KErrNone, plugin might still call back with more info in the aMsg. + * @param aErr system error code. + */ + virtual void HandlePlaybackMessage(CMPXMessage* aMsg, TInt /*aErr*/) + {// Note: change into pure virtual when all clients updated. + // Temp solution, aMsg will be a dummy object if aErr. + + // TO BE REMOVED when above HandlePlaybackMessage is removed. + HandlePlaybackMessage(*aMsg); + } + }; + +/** +* Interface for receiving property values asynchronously. +* +* @lib mpxcommon.lib +*/ +NONSHARABLE_CLASS(MMPXPlaybackCallback) + { +public: + + /** + * Handle playback property. + * + * @since S60 3.2.3 + * @param aProperty the property + * @param aValue the value of the property + * @param aError error code + */ + virtual void HandlePropertyL(TMPXPlaybackProperty aProperty, + TInt aValue, + TInt aError) = 0; + + /** + * Method is called continously until aComplete=ETrue, signifying that + * it is done and there will be no more callbacks. + * Only new items are passed each time. + * + * @since S60 3.2.3 + * @param aPlayer UID of the subplayer + * @param aSubPlayers a list of sub players + * @param aComplete ETrue no more sub players. EFalse more subplayer + * expected + * @param aError error code + */ + virtual void HandleSubPlayerNamesL(TUid aPlayer, + const MDesCArray* aSubPlayers, + TBool aComplete, + TInt aError) = 0; + + /** + * Call back of media request. + * + * @since S60 3.2.3 + * @param aMedia media + * @param aError error code + */ + virtual void HandleMediaL(const CMPXMedia& aProperties, + TInt aError) = 0; + + /** + * Handle completion of a asynchronous command. + * Note: All clients should implement this callback. + * + * @since S60 3.2.3 + * @param aCommandResult result of the command, NULL if error + * @param aError error code + */ + virtual void HandlePlaybackCommandComplete(CMPXCommand* /*aCommandResult*/, + TInt /*aError*/) {} + + }; + +#endif // MMPXPLAYBACKOBSERVER_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackplugin.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,254 @@ +/* +* Copyright (c) 2006 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: Playback plugin interface +* +*/ + + +#ifndef CMPXPLAYBACKPLUGIN_H +#define CMPXPLAYBACKPLUGIN_H + +// INCLUDES +#include +#include +#include +#include +#include + +// FORWARD DECLARATIONS + +class MMPXPlaybackPluginObserver; + +// CONSTANTS +const TUid KMPXPlaybackInterfaceUid={0x101FFC05}; + +// CLASS DECLARATION + +/** +* Interface to play media. +* +* @lib mpxcommon.lib +*/ +NONSHARABLE_CLASS(CMPXPlaybackPlugin): public CBase + { + +public: // Constructors and destructor + + /** + * Two-phased constructor. + * + * @since S60 3.2.3 + * @param aUid uid of interface implementation + * @param aObs observer + * @return object of constructed + */ + inline static CMPXPlaybackPlugin* NewL(TUid aUid, + MMPXPlaybackPluginObserver& aObs); + + /** + * Two-phased constructor. + * + * @since S60 3.2.3 + * @param aUid uid of interface implementation + * @return object of constructed + */ + inline static CMPXPlaybackPlugin* NewL(TUid aUid); + + /** + * Destructor. + * + * @since S60 3.2.3 + */ + inline virtual ~CMPXPlaybackPlugin(); + +public: + + /** + * Implementation uid of plugin. + * + * @since S60 3.2.3 + */ + inline const TUid& Uid(); + + /** + * Set observer. + * + * @since S60 3.2.3 + * @param aObs observer + */ + virtual inline void SetObserver(MMPXPlaybackPluginObserver& aObs); + + /** + * Initializes a song for playback. + * + * @since S60 3.2.3 + * @param aSong the song path + */ + virtual void InitialiseL(const TDesC& aSong)=0; + + /** + * Initializes a song for playback. + * + * @since S60 3.2.3 + * @param aFile file handle of a song + */ + virtual void InitialiseL(RFile& aSong)=0; + + /** + * Executes a command on the selected song. + * + * @since S60 3.2.3 + * @param aCmd a command + * @param aData data (optional) + * @deprecated Use method CMPXPlaybackPlugin::CommandL( + * CMPXCommand& aCmd) instead. + */ + virtual void CommandL(TMPXPlaybackCommand aCmd, TInt aData=0)=0; + + /** + * Executes a command. + * + * @since S60 3.2.3 + * @param aCmd a command + */ + virtual void CommandL(CMPXCommand& /*aCmd*/) + {/*Note: All clients need to implement this */} + + /** + * Sets a property of the plugin. + * + * @since S60 3.2.3 + * @param aProperty a playback property + * @param aValue the value of the property + */ + virtual void SetL(TMPXPlaybackProperty aProperty, TInt aValue)=0; + + /** + * Gets a property of the plugin (async). + * + * Plugin has to implement either ValueL or PropertyL. But the plugin can not + * implement both of the functions. Otherwise, there will be circular function call. + * + * @since S60 3.2.3 + * @param aProperty a property + * @deprecated Use method CMPXPlaybackPlugin::PropertyL( + * TMPXPlaybackProperty aProperty) instead. + * Note: please call PropertyL in the downloadproxy plugin. + */ + virtual void ValueL(TMPXPlaybackProperty aProperty) const + { + // Call the propertyL of the plugin which does not implement the ValueL + PropertyL(aProperty); + } + + /** + * Gets a property of the plugin (async). + * Result will be called back in HandleProperty. + * + * @since S60 3.2.3 + * @param aProperty a property + */ + virtual void PropertyL(TMPXPlaybackProperty aProperty) const + { + //Note: change into pure virtual when all plugins implement the api + //Default map to ValueL of the plugin which does not implement the PropertyL + ValueL(aProperty); + } + + /** + * Gets a list of sub players. + * + * @since S60 3.2.3 + * @return a list of names of sub players + */ + virtual void SubPlayerNamesL()=0; + + /** + * Select a sub player. + * + * @since S60 3.2.3 + * @param aIndex index to the sub player + */ + virtual void SelectSubPlayerL(TInt aIndex)=0; + + /** + * Returns current sub player name. + * + * @since S60 3.2.3 + * @return friendly name of the current the sub player + */ + virtual const TDesC& SubPlayerName()=0; + + /** + * Current sub player index. + * + * @since S60 3.2.3 + * @return index to the sub player + */ + virtual TInt SubPlayerIndex() const=0; + + /** + * Implement the version with CMPXAttributeSpecs instead. + * This will be removed in a future release. + * + * Extended properties of the current file (async). + * + * @since S60 3.2.3 + * @param aAttrs attributes requested + * @deprecated Use method CMPXPlaybackPlugin::MediaL( + * const TArray& aAttrs, + * CMPXAttributeSpecs* aSpecs ) instead. + */ + virtual void MediaL(const TArray& aAttrs)=0; + + /** + * Should make this pure virtual in the future when + * the previous API is removed and all client has implement + * this API. + * + * Extended properties of the current file (async). + * + * @since S60 3.2.3 + * @param aAttrs attributes requested + * @param aSpecs attribute spec, ownership not passed + */ + virtual void MediaL( + const TArray& aAttrs, + CMPXAttributeSpecs* /*aSpecs*/ ) + { + MediaL( aAttrs ); + }; + + /** + * Cancel outstanding request. + * + * @since S60 3.2.3 + */ + virtual void CancelRequest()=0; + +protected: + MMPXPlaybackPluginObserver* iObs; // Not owned + +private: // Data + + // identifies the actual plugin instance + TUid iDtorKey; + TUid iUid; //Implementation uid of the plugin + }; + +#include "mpxplaybackplugin.inl" + +#endif // CMPXPLAYBACKPLUGIN_H + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackplugin.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackplugin.hrh Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2006 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: Resource headers for MPX Playback Plugins +* +*/ + + +#ifndef MPX_PLAYBACK_PLUGIN_HRH +#define MPX_PLAYBACK_PLUGIN_HRH + +#include +/** Playback plugin interface UID */ +#define KMPXPlaybackPluginInterfaceUid 0x101FFC05 + +enum TMPXPlaybackPlayerType + { + EPbUnknown=0x00, + EPbLocal=0x01, + EPbRemote=0x02 + }; + +// DEPRECATED please use enum TMPXPluginPriorities defined in mpxplugin.hrh +/** Playback Plugin priorities */ +enum TMPXPlaybackPluginPriorities + { + EMPXPlaybackPluginPriorityLowest = EMPXPluginPriorityLowest, + EMPXPlaybackPluginPriorityLow = EMPXPluginPriorityLow, + EMPXPlaybackPluginPriorityNormal = EMPXPluginPriorityNormal, + EMPXPlaybackPluginPriorityHigh = EMPXPluginPriorityHigh, + EMPXPlaybackPluginPriorityHighest = EMPXPluginPriorityHighest + }; + +#endif // MPX_PLAYBACK_PLUGIN_HRH diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackplugin.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackplugin.inl Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,74 @@ +/* +* 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: Inline implementation of playback plugin constructor/destructor +* +*/ + + +// ======================= INLINE MEMBER FUNCTIONS ============================ + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +inline CMPXPlaybackPlugin* CMPXPlaybackPlugin::NewL(TUid aUid, + MMPXPlaybackPluginObserver& aObs) + { + CMPXPlaybackPlugin* self = reinterpret_cast( + REComSession::CreateImplementationL(aUid, + _FOFF(CMPXPlaybackPlugin,iDtorKey))); + self->iUid = aUid; + self->SetObserver( aObs ); + return self; + } + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +inline CMPXPlaybackPlugin* CMPXPlaybackPlugin::NewL(TUid aUid) + { + CMPXPlaybackPlugin* self = reinterpret_cast( + REComSession::CreateImplementationL(aUid, + _FOFF(CMPXPlaybackPlugin,iDtorKey))); + self->iUid = aUid; + return self; + } + +// ---------------------------------------------------------------------------- +// plugin destruction +// ---------------------------------------------------------------------------- +// +inline CMPXPlaybackPlugin::~CMPXPlaybackPlugin() + { + REComSession::DestroyedImplementation(iDtorKey); + } + +// ---------------------------------------------------------------------------- +// Returns implemenation uid of the plugin +// ---------------------------------------------------------------------------- +// +inline const TUid& CMPXPlaybackPlugin::Uid() + { + return iUid; + } + +// ---------------------------------------------------------------------------- +// Set observer +// ---------------------------------------------------------------------------- +// +inline void CMPXPlaybackPlugin::SetObserver(MMPXPlaybackPluginObserver& aObs) + { + iObs = &aObs; + } diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackpluginobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackpluginobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2006 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: Player plugin observer +* +*/ + + +#ifndef MMPXMPLAYBACKPLUGINOBSERVER_H +#define MMPXMPLAYBACKPLUGINOBSERVER_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS + +// CONSTANTS + +// CLASS DECLARATION + + +/** +* Observer interface for playback plugin. +* +* @lib mpxcommon.lib +*/ +NONSHARABLE_CLASS(MMPXPlaybackPluginObserver) : public MMPXPlaybackEngineObserver + { +public: + /** + * Event for observer. + * + * @deprecated Use CMPXMessage definition instead. + */ + enum TEvent + { + EPInitialised, // 0 async response for Initialise, aData=duration + EPPlaying, // 1 async response for Play + EPPlayComplete, // 2 + EPPaused, // 3 async response for Pause + EPStopped, // 4 async response for Stop + EPClosed, // 5 async response for Close, or Close when stop. aData=command id + EPSetComplete, // 6 async response for SetL aData=propoerty + EPActive, // 7 aData=ETrue/EFalse + EPSupportedFeaturesChanged, // 8 aData=supported featured + EPDurationChanged, // 9 aData=duration in ms. + EPDownloadPositionChanged, // 10 + EPDownloadStateChanged, // 11 + EPDownloadCmdPauseDownload, // 12 + EPDownloadCmdResumeDownload, // 13 + EPDownloadCmdCancelDownload, // 14 + EPDownloadStarted, // 15 aData=total expected bytes + EPDownloadingUpdated, // 16 aData=total bytes so far + EPDownloadingCanceled, // 17 aData=total bytes so far + EPDownloadingComplete, // 18 aData=total bytes downloaded + EPSubPlayersChanged, // 19 + EPPlayerUnavailable, // 20 + EPVolumeChanged, // 21 aData=volume level + EPMuteChanged, // 22 aData=mute value + EPPluginSeeking, // 23 Plugin transition to seeking state + EPPositionChanged, // 24 aData=new position + EPBufferingStarted, // 25 + EPDownloadFileMoved + }; +public: + + /** + * Handle plugin event. + * + * @since S60 3.2.3 + * @param aEvent the event type + * @param aData optional data + * @param aError error code of the event + * @deprecated Use method MMPXPlaybackPluginObserver::HandlePlaybackMessage + * (CMPXMessage* aMsg, TInt aErr) instead. + */ + virtual void HandlePluginEvent(TEvent aEvent,TInt aData,TInt aError)=0; + + /** + * Handle message from plug-in. + * + * @since S60 3.2.3 + * @param aMsg message from the plug-in + * @deprecated Use method MMPXPlaybackPluginObserver::HandlePlaybackMessage + * (CMPXMessage* aMsg, TInt aErr) instead. + */ + virtual void HandlePlaybackMessage(const CMPXMessage& aMsg) + { + HandlePlaybackMessage(const_cast(&aMsg), KErrNone); + } + + /** + * Handle message from plug-in. + * TO DO: make it as pure virtual when previous callback removed. + * + * @since S60 3.2.3 + * @param aMsg message from the plug-in. Ownership not transferred. + * @param aErr system error code. if aErr is not KErrNone, aMsg will not be + * used + */ + virtual void HandlePlaybackMessage(CMPXMessage* /*aMsg*/, + TInt /*aErr*/) {} + }; + +#endif // MMPXMPLAYBACKPLUGINOBSERVER_H + +// End of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackpluginversion2.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackpluginversion2.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2006 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: Playback Init Access Point interface +* +*/ + + +#ifndef CMPXPLAYBACKPLUGINVERSION2_H +#define CMPXPLAYBACKPLUGINVERSION2_H + +// INCLUDES + +#include + +/** +* Interface for receiving property values asynchronously. +* +* @lib mpxcommon.lib +*/ +NONSHARABLE_CLASS(CMPXPlaybackPluginVersion2): public CMPXPlaybackPlugin + { +public: + + /** + * Initializes a file for playback. + * + * @since S60 9.2 + * @param aUri URI of the item + * @param aType the mime type of the item + * @param aAccessPoint the access point + */ + virtual void InitStreamingL(const TDesC& aUri, const TDesC8& aType, TInt aAccessPoint) = 0; + + /** + * Initializes a file handle for playback. + * + * @since S60 9.2 + * @param aFile file handle of a file + * @param aAccessPoint the access point + */ + virtual void InitStreamingL(RFile& aFile, TInt aAccessPoint) = 0; + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + /** + * Initializes a file handle for playback. + * + * @since S60 9.2 + * @param aFile 64 bit file handle of a file + * @param aAccessPoint the access point + */ + virtual void InitStreaming64L(RFile64& aFile, TInt aAccessPoint) = 0; + + /** + * Initializes a song for playback. + * + * @since S60 9.2 + * @param aFile 64 bit file handle of a song + */ + virtual void Initialise64L(RFile64& aSong) = 0; +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + }; + +#endif // CMPXPLAYBACKPLUGINVERSION2_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_common_definition_api/mpx_playback_common_definition_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_common_definition_api/mpx_playback_common_definition_api.metaxml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,14 @@ + + +MPX Playback Common Definition API +Common definitions used by the MPX playback framework +c++ +mpx + + + + +no +no + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_utility_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2007 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 +: mpx playback utilities API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/mpxplaybackutility.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxplaybackutility.h) diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_utility_api/inc/mpxplaybackutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/inc/mpxplaybackutility.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,688 @@ +/* +* Copyright (c) 2006 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 to playback +* +*/ + + +#ifndef MMPXPLAYBACKUTILITY_H +#define MMPXPLAYBACKUTILITY_H + +#include +#include +#include +#include +#include +#include + +class RFile; +class CMPXMedia; +class MMPXPlayer; +class MMPXSource; +class MMPXPlayerManager; +class MMPXPlaybackObserver; +class MMPXPlaybackCallback; +class CMPXCollectionPlaylist; +class CMPXSubscription; +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API +class RFile64; +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + +/** +* Main client interface for playback. Some terms used in the documentation of +* this interface: +* +* Engine - it is the 'engine' which manages the playback and maintains the +* state. An abstract concept for where the playback functionality +* is somehow implemented, but is completely hidden from the client. +* +* Player - the engine may access of a number of 'players' for playback, +* using only one at a time. A player is an abstract concept +* representing the knowledge to play either a 'specific kind of item', +* or 'play in a specific way', or both. The player may therefore +* automatically change between items if required +* ('specific kind of item'), or the client may choose the players +* that are used ('play in a specific way'). +* +* Sub player - a player may support 0 or more 'sub' players, a logical +* concept whereby the client,having chosen a player, can select +* options within this player identified by name (text) +* +* Playlist - an abstract list of items. A collection path allows the client +* to cross reference the playlist with a collection, for example to +* iterate through the playlist, extract user-supplied metadata etc. +* +* @lib mpxplaybackutility.lib +* +*/ +class MMPXPlaybackUtility + { +public: + /** + * Creates the interface for the client. This interface is bound to (i.e. + * controls and recieves events from) either an existing engine or a new + * one, according to: + * + * aModeId=KPbModeDefault - bound to the same engine as any other player + * running in same thread, or KPbModeNewPlayer if none. + * aModeId=KPbModeActivePlayer - bound to whichever engine has audio access, + * else whichever is running, provided the category + * of client and engine match. Else KPbModeNewPlayer if none. + * aModeId=KPbModeNewPlayer - new engine created specifically for client, + * may be shared later. + * aModeId=Application UID - bound to the same engine as the stand alone + * Application. + * When no category is supplied (as with this API), EMPXCategoryMusic is assumed. + * For category description, refer to next API. + * + * @since S60 3.2.3 + * @param aModeId playback mode + * @param aObs plabyback observer + * @return playback utility object + */ + IMPORT_C static MMPXPlaybackUtility* NewL( + const TUid& aModeId = KPbModeDefault, + MMPXPlaybackObserver* aObs=NULL); + + + /** + * Creates the interface for the client. This interface is bound to (i.e. + * controls and recieves events from) either an existing engine or a new + * one, according to: + * + * aModeId=KPbModeDefault - bound to the same engine as any other player + * running in same thread, or KPbModeNewPlayer if none. + * aModeId=KPbModeActivePlayer - bound to whichever engine has audio access, + * else whichever is running, provided the category + * of client and engine match. Else KPbModeNewPlayer if none. + * aModeId=KPbModeNewPlayer - new engine created specifically for client, + * may be shared later. + * aModeId=Application UID - bound to the same engine as the stand alone + * Application. + * + * aCategory - a client can associate itself with a category (TMPXCategory). + * Category is used primarily with the KPbModeActivePlayer mode. The client gets + * EActivePlayerChanged message only when an engine with the same category becomes + * active. If a new engine (player) is created, the engine is tagged + * with the category. When no category is supplied, EMPXCategoryMusic is assumed. + * + * @since S60 3.2.3 + * @param aCategory engine category (TMPXCategory) + * @param aModeId playback mode + * @param aObs plabyback observer + * @return playback utility object + */ + IMPORT_C static MMPXPlaybackUtility* NewL( + const TMPXCategory aCategory, + const TUid& aModeId = KPbModeDefault, + MMPXPlaybackObserver* aObs=NULL); + + /* + * Gets the interface for the client, or creates a new one. + * This interface could be a singleton. + * + * @since S60 3.2.3 + */ + IMPORT_C static MMPXPlaybackUtility* UtilityL( + const TUid& aModeId = KPbModeDefault ); + + /* + * Gets the interface for the client, or creates a new one. + * This interface could be a singleton. + * Variant of API with supplied category + * + * @since S60 3.2.3 + */ + IMPORT_C static MMPXPlaybackUtility* UtilityL( + const TMPXCategory aCategory, + const TUid& aModeId = KPbModeDefault ); + + + /** + * Add a Observer. Clients only receive events from the engine corresponding + * to the specific mode the interface was created in. + * + * @since S60 3.2.3 + * @param aObs observer to be added + */ + virtual void AddObserverL(MMPXPlaybackObserver& aObs)=0; + + /** + * Remove a observer. + * + * @since S60 3.2.3 + * @param aObs observer to be removed + */ + virtual void RemoveObserverL(MMPXPlaybackObserver& aObs)=0; + + /** + * Returns PIds of clients that are using the engine in the mode this + * interface was created in. For example, if a client was interested in all + * the clients' pids with an active engine, they would: + * + * MMPXPlaybackUtility* m=MMPXPlaybackUtility::NewL(EActivePlayer); + * RArray pids; + * m->GetClients(pids); + * ......... + * pids->Close(); + * m->Close(); + * From the Array of clients returned, the first one will be the + * last active one. + * + * @since S60 3.2.3 + * @param aClients Array of Pids returned. + */ + virtual void GetClientsL(RArray& aClients)=0; + + /** + * Initializes a track given by aCollectionPath. + * + * @since S60 3.2.3 + * @param aCollectionPath collection path + * @param aPlay Whether to initialize for playback, or + * else just to setup the engine first + */ + virtual void InitL(const CMPXCollectionPlaylist& aPlaylist, + TBool aPlay=ETrue)=0; + + /** + * Inititialises with a single item, may not be part of any collection. + * + * @since S60 3.2.3 + * @param aUri URI of the item + * @param aType the mime type of the item + */ + virtual void InitL(const TDesC& aUri, const TDesC8* aType=NULL)=0; + + /** + * Inititialises with a single item, may not be part of any collection + * Before this function can be called, the file server session which owns + * this file handle must first be marked as shareable by calling + * RFs::ShareProtected(). + * + * @since S60 3.2.3 + * @param aShareableFile shareable file handle + */ + virtual void InitL(RFile& aShareableFile)=0; + + /** + * Frees up client side resources only; a player is freed when there are no + * clients using it, and all resources are freed when the last client closed. + * + * @since S60 3.2.3 + */ + virtual void Close()=0; + + /** + * Stops any async operations that are currently under way. + * + * @since S60 3.2.3 + */ + virtual void CancelRequest()=0; + + /** + * Issue player commands, with optional data. ECommandReceived and + * ECommandComplete events should follow. + * + * @since S60 3.2.3 + * @param aCmd the command + * @param aData optional data + * @deprecated Use method MMPXPlaybackUtility::CommandL(CMPXCommand& aCmd, + * MMPXPlaybackCallback* aCallback=NULL) instead. + */ + virtual void CommandL(TMPXPlaybackCommand aCmd, TInt aData=0)=0; + + /** + * Send a command to the playback server. + * + * @since S60 3.2.3 + * @param aCmd reference to command object + * @param aCallback call back when command exection completed. + * Asynchronously command only + */ + virtual void CommandL(CMPXCommand& aCmd, + MMPXPlaybackCallback* aCallback=NULL)=0; + + /** + * Current state of player. + * + * @since S60 3.2.3 + * @return current state + */ + virtual TMPXPlaybackState StateL() const=0; + + /** + * Current source of playlist being played, NULL if none was supplied. + * + * @since S60 3.2.3 + * @return source object + */ + virtual MMPXSource* Source()=0; + + /** + * Player manager. + * + * @since S60 3.2.3 + * @return reference to player manager + */ + virtual MMPXPlayerManager& PlayerManager()=0; + + /** + * Set playback property, EPropertyChanged event when complete. + * + * @since S60 3.2.3 + * @param aProperty the property to be set + * @param aValue the the value of the property + */ + virtual void SetL(TMPXPlaybackProperty aProperty, TInt aValue)=0; + + /** + * Get value of a playback property, Asyc. + * + * @since S60 3.2.3 + * @param aCallback playback callback + * @param aProperty the property + * @deprecated Use method MMPXPlaybackUtility::PropertyL( + * MMPXPlaybackCallback& aCallback, + * TMPXPlaybackProperty aProperty) instead. + */ + virtual void ValueL(MMPXPlaybackCallback& aCallback, + TMPXPlaybackProperty aProperty)=0; + + /** + * Get value of a playback property, Asyc. + * Result will be called back in HandleProperty. + * + * @since S60 3.2.3 + * @param aCallback playback callback + * @param aProperty the property + */ + virtual void PropertyL(MMPXPlaybackCallback& aCallback, + TMPXPlaybackProperty aProperty)=0; + + + /** + * Return a list of mime types supported by playback framework. + * + * @since S60 3.2.3 + * @return an array of mime types + */ + virtual CDesCArray* SupportedMimeTypes()=0; + + /** + * Return a list of file extensions supported by playback framework. + * + * @since S60 3.2.3 + * @return an array of extensions + */ + virtual CDesCArray* SupportedExtensions()=0; + + /** + * Return a list of schemas supported by playback framework. + * + * @since S60 3.2.3 + * @return an array of schemas + */ + virtual CDesCArray* SupportedSchemas()=0; + + /** + * Sets the priority of the playback utility. + * + * @since S60 3.2.3 + * @param aPriority Priority to set + */ + virtual void SetPriority( TInt aPriority )=0; + + /** + * Adds a message subscription for this client. + * + * @since S60 3.2.3 + * @param aSubscription subscription to be added + */ + virtual void AddSubscriptionL(const CMPXSubscription& aSubscription) = 0; + + /** + * Removes a message subscription for this client. + * + * @since S60 3.2.3 + * @param aSubscription subscription to be removed. + */ + virtual void RemoveSubscriptionL(const CMPXSubscription& aSubscription) = 0; + + /** + * Removes all message subscriptions for this client. + * + * @since S60 3.2.3 + */ + virtual void ClearSubscriptionsL() = 0; + + /** + * Inititialises for streaming with URI and Access Point + * + * @since S60 9.2 + * @param aUri URI of the item + * @param aType the mime type of the item + * @param aAccessPoint the access point of the item + */ + virtual void InitStreamingL(const TDesC& aUri, const TDesC8* aType, const TInt aAccessPoint)=0; + + /** + * Inititialises for streaming with URI and Access Point, the file may not be part of any collection + * Before this function can be called, the file server session which owns + * this file handle must first be marked as shareable by calling + * RFs::ShareProtected(). + * + * @since S60 9.2 + * @param aShareableFile shareable file handle + * @param aAccessPoint the access point of the item + */ + virtual void InitStreamingL(RFile& aShareableFile, const TInt aAccessPoint)=0; + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + /** + * Inititialises with a single item, may not be part of any collection + * Before this function can be called, the file server session which owns + * this file handle must first be marked as shareable by calling + * RFs::ShareProtected(). + * + * @since S60 9.2 + * @param aShareableFile shareable RFile64 file handle + */ + virtual void Init64L(RFile64& /*aShareableFile*/) {}; + + /** + * Inititialises for streaming with URI and Access Point, the file may not be part of any collection + * Before this function can be called, the file server session which owns + * this file handle must first be marked as shareable by calling + * RFs::ShareProtected(). + * + * @since S60 9.2 + * @param aShareableFile shareable RFile64 file handle + * @param aAccessPoint the access point of the item + */ + virtual void InitStreaming64L(RFile64& /*aShareableFile*/, const TInt /*aAccessPoint*/) {}; +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + }; + +/** +* Manages the players. Golden rules: by default, all players of type EPbLocal +* are tried and the first one found which can handle the content is used; when +* a specific player is selected by uid, (i.e. SelectPlayerL(TUid aPlayer)) +* then only that player will be considered in the search; when players are +* selected by type (i.e. SelectPlayersL(TMPXPlaybackPlayerType aType)), then only +* players with that type are considered; When a sub player is explicitly +* selected (i.e. SelectSubPlayerL()), then only that player and its sub player +* are considered. +* +* @lib mpxplaybackutility.lib +*/ +class MMPXPlayerManager + { +public: + /** + * Typically, a client will obtain the list of all the (non-duplicated) + * player 'types' in the system from GetPlayerTypesL and present localized + * type names (e.g. "Local","Home network", if possible, else if + * non-standard type,should use PlayerTypeDisplayNameL to get text from + * player). + * + * User should be given opportunity to choose IF there is more than one + * type available, or if there is one type but more than one sub players, + * the user could be presented with the sub player list. + * + * @since S60 3.2.3 + * @param aTypes the list of player types + */ + virtual void GetPlayerTypesL(RArray& aTypes)=0; + + /** + * Returns display name for custom types; standard types should be + * recognized by client and localized - calling this method would then not + * be required. + * + * @since S60 3.2.3 + * @param aType playback type + */ + virtual HBufC* PlayerTypeDisplayNameL(TMPXPlaybackPlayerType aType)=0; + + /** + * Get the list of UIDs of all players. + * + * @since S60 3.2.3 + * @param aPlayers All the players' uids in the system + */ + virtual void GetPlayerListL(RArray& aPlayers)=0; + + /** + * Get the list of UIDs of players with the specific type. + * + * @since S60 3.2.3 + * @param aPlayers All the players' uids with the same type + * @param aType the type of players + */ + virtual void GetPlayerListL(RArray& aPlayers, + TMPXPlaybackPlayerType aType)=0; + + /** + * Get the list of sub player names, Async. + * + * @since S60 3.2.3 + * @param aCallback sub players returned in call back interface + * @param aPlayer UID of the player + */ + virtual void SubPlayerNamesL(MMPXPlaybackCallback& aCallback, + TUid aPlayer)=0; + + /** + * Client selects all players with the type aType, the specific player used + * then being resolved on the basis of the content. + * + * @since S60 3.2.3 + * @param aType the type of player + */ + virtual void SelectPlayersL(TMPXPlaybackPlayerType aType)=0; + + /** + * Client selects specific player aPlayer and sub player aSubPlayerIndex + * from array returned by SubPlayerNamesL. + * NOTE: Once a player is manually selected by UID, all subsequent + * InitL() will continue to use that player, it will not + * try to resolve a plugin. If the client later wants + * the engine to auto resolve the proper plugin, the client must + * call ClearSelectPlayersL() to reset the engine. + * + * @since S60 3.2.3 + * @param aPlayer the UID of player + * @param aSubPlayerIndex the index of the sub player + */ + virtual void SelectSubPlayerL(TUid aPlayer, TInt aSubPlayerIndex)=0; + + /** + * Client selects a specific player. + * NOTE: Once a player is manually selected by UID, all subsequent + * InitL() will continue to use that player, it will not + * try to resolve a plugin. If the client later wants + * the engine to auto resolve the proper plugin, the client must + * call ClearSelectPlayersL() to reset the engine. + * + * @since S60 3.2.3 + * @param aPlayer the UID of the player + */ + virtual void SelectPlayerL(TUid aPlayer)=0; + + /** + * Clears all selection criteria. Essentially the same as + * SelectPlayersL(EPbLocal). + * + * @since S60 3.2.3 + */ + virtual void ClearSelectPlayersL()=0; + + /** + * Retreives the current selection: KNullUid and KErrNotFound are possible + * return values for aPlayer and aSubPlayerIndex respectively if none are + * explicitly selected. + * + * @since S60 3.2.3 + * @param aType player type + * @param aPlayer the UID of player + * @param aSubPlayerIndex index of the subplayer + * @param aSubPlayerName friendly name of the subplayer. + * Notes: Client owns the returned aSubPlayerName object. + */ + virtual void GetSelectionL(TMPXPlaybackPlayerType& aType, + TUid& aPlayer, + TInt& aSubPlayerIndex, + HBufC*& aSubPlayerName)=0; + + /** + * The current player, may change with each item, NULL if none found. + * + * @since S60 3.2.3 + * @return object of current player + */ + virtual MMPXPlayer* CurrentPlayer()=0; + }; + + +/** +* Player functionality specific to selected player. +* +* @lib mpxplaybackutility.lib +*/ +class MMPXPlayer + { +public: + /** + * The 'type' of the player. Built-in types are EPbLocal and EPbRemote, but + * the plug-ins could extend this if they desire to be a different type + * which can be selected by the user. + * + * @since S60 3.2.3 + * @return player type + */ + virtual TMPXPlaybackPlayerType TypeL()=0; + + /** + * If TypeL returns a value that is not known to the UI (and therefore + * can't localize it),then TypeNameL can be used for unlocalized display + * purposes. + * + * @since S60 3.2.3 + * @return player name. + */ + virtual HBufC* TypeNameL()=0; + + /** + * If the player supports other 'players', else array count == 0. + * + * @since S60 3.2.3 + * @param aCallback sub players returned in the callback + */ + virtual void SubPlayerNamesL(MMPXPlaybackCallback& aCallback)=0; + + /** + * Selected sub player index, corresponding to sub player names array. + * + * @since S60 3.2.3 + * @return sub player index. KErrNotFound if none + */ + virtual TInt SubPlayerL() const=0; + + /** + * The UID identifying this player. + * + * @since S60 3.2.3 + * @return UID of the player + */ + virtual TUid UidL() const=0; + }; + +/** +* Media functionality. Each media is identified by its index into a container, +* which is the same as supplied in InitL(const CMPXCollectionPlaylist& aPlaylist). +* +* @lib mpxplaybackutility.lib +*/ +class MMPXSource + { +public: + /** + * Path to the collection, or NULL if not in any collection. + * Ownership transferred. + * + * @since S60 3.2.3 + * @return collection path + */ + virtual CMPXCollectionPlaylist* PlaylistL()=0; + + /** + * File passed in, or NULL if none passed in. + * + * @since S60 3.2.3 + * @return pointer to file handle + */ + virtual RFile* FileL()=0; + + /** + * URI of current item. + * + * @since S60 3.2.3 + * @return URI of the item + */ + virtual HBufC* UriL()=0; + + /** + * + * Request for media properties of current playing item + * HandleMediaL of the callback. + * + * @since S60 3.2.3 + * @param aAttrs attributes requested + * @param aCallback playback callback + * @deprecated Use method MMPXPlaybackUtility::MediaL( + * const TArray& aAttrs, + * MMPXPlaybackCallback& aCallback, + * CMPXAttributeSpecs* aSpecs) instead. + */ + virtual void MediaL(const TArray& aAttrs, + MMPXPlaybackCallback& aCallback)=0; + + /** + * Request for media properties of current playing item + * HandleMediaL of the callback. + * + * @since S60 3.2.3 + * @param aAttrs attributes requested + * @param aCallback playback callback + * @param aSpecs specifications for attributes + */ + virtual void MediaL(const TArray& aAttrs, + MMPXPlaybackCallback& aCallback, + CMPXAttributeSpecs* aSpecs)=0; + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + /** + * File passed in, or NULL if none passed in. + * + * @since S60 9.2 + * @return pointer to file handle + */ + virtual RFile64* File64L() {return NULL;}; +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + }; + +#endif // MMPXPLAYBACKUTILITY_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_utility_api/mpx_playback_utility_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/mpx_playback_utility_api.metaxml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,15 @@ + + +MPX Playback Utility API +Provides playback utility interface for playback framework +c++ +mpx + + + + + +no +no + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_utility_api/tsrc/conf/mpxplaybackutilitytest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/tsrc/conf/mpxplaybackutilitytest.cfg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,40 @@ + +[Test] +title 1 MMPXPlaybackUtilityNewL +create mpxplaybackutilitytest foobar +foobar MMPXPlaybackUtilityNewL +delete foobar +[Endtest] + +[Test] +title 2 MMPXPlaybackUtilityUtilityL +create mpxplaybackutilitytest foobar +foobar MMPXPlaybackUtilityUtilityL +delete foobar +[Endtest] + +[Test] +title 3 MMPXPlaybackUtilityInit64L +create mpxplaybackutilitytest foobar +foobar MMPXPlaybackUtilityNewL +foobar MMPXPlaybackUtilityInit64L Battle_160x100_30kbps.rm +delete foobar +[Endtest] + +[Test] +title 4 MMPXPlaybackUtilityInitStreaming64L +create mpxplaybackutilitytest foobar +foobar MMPXPlaybackUtilityNewL +foobar MMPXPlaybackUtilityInitStreaming64L Battle_160x100_30kbps.rm +delete foobar +[Endtest] + +[Test] +title 5 MMPXPlaybackUtilityFile64L +create mpxplaybackutilitytest foobar +foobar MMPXPlaybackUtilityNewL +foobar MMPXPlaybackUtilityInit64L Battle_160x100_30kbps.rm +foobar MMPXPlaybackUtilityFile64L +delete foobar +[Endtest] + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_utility_api/tsrc/data/mmc/Battle_160x100_30kbps.rm Binary file mmappfw_plat/mpx_playback_utility_api/tsrc/data/mmc/Battle_160x100_30kbps.rm has changed diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_utility_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/tsrc/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007 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 for project mpxharvestertest +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_TESTEXPORTS +// Test sound file + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +#include "../mpxplaybackutilitytest/group/bld.inf" + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_utility_api/tsrc/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/tsrc/init/TestFramework.ini Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,196 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[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_mpxplaybackutilitytest + +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= 0 # Default timeout value for each test case. In milliseconds +UITestingSupport= YES +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +[New_Module] +ModuleName= testscripter +TestCaseFile= c:\testframework\mpxplaybackutilitytest.cfg +[End_Module] + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[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= D:\LOGS\TestFramework\ +#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 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_utility_api/tsrc/mpxplaybackutilitytest/Bmarm/mpxplaybackutilitytestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/tsrc/mpxplaybackutilitytest/Bmarm/mpxplaybackutilitytestU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_utility_api/tsrc/mpxplaybackutilitytest/Bwins/mpxplaybackutilitytestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/tsrc/mpxplaybackutilitytest/Bwins/mpxplaybackutilitytestU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_utility_api/tsrc/mpxplaybackutilitytest/EABI/mpxplaybackutilitytestU.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/tsrc/mpxplaybackutilitytest/EABI/mpxplaybackutilitytestU.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_utility_api/tsrc/mpxplaybackutilitytest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/tsrc/mpxplaybackutilitytest/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2002 - 2007 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 +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these +DEFAULT + +PRJ_TESTEXPORTS +// NOTE: If using ARS requirements all export operations should be done under this. +// 'abld test export' + +PRJ_EXPORTS +// Specify the source file followed by its destination here +// copy will be used to copy the source file to its destination +// If there's no destination then the source file will be copied +// to the same name in /epoc32/include +// Example: +/* +/agnmodel/inc/AGMCOMON.H +*/ + +PRJ_TESTMMPFILES +mpxplaybackutilitytest.mmp + +PRJ_MMPFILES + +// Specify the .mmp files required for building the important component +// releasables. +// +// Specify "tidy" if the component you need to build doesn't need to be +// released. Specify "ignore" if the MMP file exists but should be +// ignored. +// Example: +/* +/agnmodel/group/agnmodel.mmp +#if defined(MARM) +/agnmodel/group/agsvexe.mmp +#endif +*/ + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_utility_api/tsrc/mpxplaybackutilitytest/group/mpxplaybackutilitytest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/tsrc/mpxplaybackutilitytest/group/mpxplaybackutilitytest.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2002 - 2007 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: API test automation for mpxplaybackutility +* +*/ + + +#if defined(__S60_) + // To get the OS_LAYER_SYSTEMINCLUDE-definition + #include +#endif + +TARGET mpxplaybackutilitytest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +/* Remove comments and replace 0x00000000 with correct vendor id */ +// VENDORID 0x00000000 +/* Remove comments and replace 0x00000000 with correct secure id */ +// SECUREID 0x00000000 + +//TARGETPATH ?target_path +DEFFILE mpxplaybackutilitytest.def + +MW_LAYER_SYSTEMINCLUDE + +USERINCLUDE ../inc + +SOURCEPATH ../src + + + +SOURCE mpxplaybackutilitytest.cpp +SOURCE mpxplaybackutilitytestBlocks.cpp + +//RESOURCE resource_file +//RESOURCE resource_file2 + +LIBRARY efsrv.lib +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY mpxplaybackutility.lib +LIBRARY mpxcommon.lib + +LANG SC + +/* +START WINS +?wins_specific_information +END + +START MARM +?marm_specific_information +END +*/ +// Other possible keywords: + +// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) +/* +START BITMAP ?target +TARGETPATH ?emulated_path_on_target_machine +HEADER +SOURCE ?color_depth ?source_bitmap +END +*/ +// DEFFILE ?filename +// AIF ?filename + +// End of File + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_utility_api/tsrc/mpxplaybackutilitytest/group/mpxplaybackutilitytest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/tsrc/mpxplaybackutilitytest/group/mpxplaybackutilitytest.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,66 @@ +; +; 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: Package file for project STIF mpxplaybackutilitytest +; +; +; Installation file for STIF +; + +; Languages +&EN + +; Provide value for uid +#{"STIF mpxplaybackutilitytest Application"},(0x10005942),1,1,0,TYPE=SA + +; Series60 product id for S60 3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Logo +; None + +; Package signature - Optional +; None + +; Start of Package body + +; Condition blocks +; None + +; Options list +; None + +; Install files +"..\..\data\mmc\Battle_160x100_30kbps.rm" - "e:\testing\data\Battle_160x100_30kbps.rm" + +"..\..\init\TestFramework.ini" - "c:\testframework\TestFramework.ini" +"..\..\conf\mpxplaybackutilitytest.cfg" - "c:\testframework\mpxplaybackutilitytest.cfg" + +"\epoc32\release\armv5\udeb\mpxplaybackutilitytest.dll" - "c:\Sys\Bin\mpxplaybackutilitytest.dll" + +; Embedded SIS +; None + +; End of Package body + +; PKG dependencies +; None + +; PKG capabilities +; None diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_utility_api/tsrc/mpxplaybackutilitytest/inc/mpxplaybackutilitytest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/tsrc/mpxplaybackutilitytest/inc/mpxplaybackutilitytest.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,160 @@ +/* +* Copyright (c) 2002 - 2007 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: mpxplaybackutilitytest header for STIF Test Framework TestScripter. +* +*/ + + + +#ifndef MPXPLAYBACKUTILITYTEST_H +#define MPXPLAYBACKUTILITYTEST_H + +// INCLUDES +#include +#include +#include +#include +#include +#include +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def +#define TEST_CLASS_VERSION_MAJOR 0 +#define TEST_CLASS_VERSION_MINOR 0 +#define TEST_CLASS_VERSION_BUILD 0 + +// Logging path +#ifdef __WINSCW__ +_LIT( KmpxplaybackutilitytestLogPath, "C:\\logs\\testframework\\mpxplaybackutilitytest\\" ); +// Log file +_LIT( KmpxplaybackutilitytestLogFile, "mpxplaybackutilitytest.txt" ); +_LIT( KmpxplaybackutilitytestLogFileWithTitle, "mpxplaybackutilitytest_[%S].txt" ); +// data file +_LIT( KmpxplaybackutilityTestFilePath, "C:\\testing\\data\\" ); +#else +_LIT( KmpxplaybackutilitytestLogPath, "\\logs\\testframework\\mpxplaybackutilitytest\\" ); +// Log file +_LIT( KmpxplaybackutilitytestLogFile, "mpxplaybackutilitytest.txt" ); +_LIT( KmpxplaybackutilitytestLogFileWithTitle, "mpxplaybackutilitytest_[%S].txt" ); +// data file +_LIT( KmpxplaybackutilityTestFilePath, "e:\\testing\\data\\" ); +#endif +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class Cmpxplaybackutilitytest; + +class MMPXPlaybackUtility; +class MMPXPlaybackObserver; +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// CLASS DECLARATION + +/** +* Cmpxplaybackutilitytest test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(Cmpxplaybackutilitytest) : public CScriptBase, + public MMPXPlaybackObserver + + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Cmpxplaybackutilitytest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Cmpxplaybackutilitytest(); + + + 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 ); + + // From base class MMPXPlaybackObserver + /** + * Handle playback message + * + * @since 3.1 + * @param aMessage playback message + * @param aErr system error code. + */ + void HandlePlaybackMessage( + CMPXMessage* aMessage, TInt aError ); + private: + + /** + * C++ default constructor. + */ + Cmpxplaybackutilitytest( CTestModuleIf& aTestModuleIf ); + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + // Prohibit copy constructor if not deriving from CBase. + // ?classname( const ?classname& ); + // Prohibit assigment operator if not deriving from CBase. + // ?classname& operator=( const ?classname& ); + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + /** + * Test methods are listed below. + */ + TInt MMPXPlaybackUtilityNewL(CStifItemParser& /*aItem*/); + TInt MMPXPlaybackUtilityUtilityL(CStifItemParser& /*aItem*/); + TInt MMPXPlaybackUtilityInit64L(CStifItemParser& /*aItem*/); + TInt MMPXPlaybackUtilityInitStreaming64L(CStifItemParser& /*aItem*/); + TInt MMPXPlaybackUtilityFile64L(CStifItemParser& /*aItem*/); + + /** + * Method used to log version of test class + */ + void SendTestClassVersion(); + //ADD NEW METHOD DEC HERE + //[TestMethods] - Do not remove + private: // Friend classes + //From mpxplaybackutility.h + MMPXPlaybackUtility* iMPXPlaybackUtility; + RFs iFs; +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + RFile64 iFile64; +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + }; + +#endif // MPXPLAYBACKUTILITYTEST_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_utility_api/tsrc/mpxplaybackutilitytest/src/mpxplaybackutilitytest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/tsrc/mpxplaybackutilitytest/src/mpxplaybackutilitytest.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,205 @@ +/* +* Copyright (c) 2002 - 2007 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: mpxplaybackutilitytest implemetation for STIF Test Framework TestScripter. +* +*/ + + + +// INCLUDE FILES +#include +#include "mpxplaybackutilitytest.h" +#include + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; + +// EXTERNAL FUNCTION PROTOTYPES +//extern ?external_function( ?arg_type,?arg_type ); + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// LOCAL CONSTANTS AND MACROS +//const ?type ?constant_var = ?constant; +//#define ?macro_name ?macro_def + +// MODULE DATA STRUCTURES +//enum ?declaration +//typedef ?declaration + +// LOCAL FUNCTION PROTOTYPES +//?type ?function_name( ?arg_type, ?arg_type ); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ?function_name ?description. +// ?description +// Returns: ?value_1: ?description +// ?value_n: ?description_line1 +// ?description_line2 +// ----------------------------------------------------------------------------- +// +/* +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg) // ?description + { + + ?code // ?comment + + // ?comment + ?code + } +*/ + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cmpxplaybackutilitytest::Cmpxplaybackutilitytest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +Cmpxplaybackutilitytest::Cmpxplaybackutilitytest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// Cmpxplaybackutilitytest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Cmpxplaybackutilitytest::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(KmpxplaybackutilitytestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KmpxplaybackutilitytestLogFile); + } + + iLog = CStifLogger::NewL( KmpxplaybackutilitytestLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + SendTestClassVersion(); + + + iFs.Connect(); + iFs.ShareProtected(); + } + +// ----------------------------------------------------------------------------- +// Cmpxplaybackutilitytest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Cmpxplaybackutilitytest* Cmpxplaybackutilitytest::NewL( + CTestModuleIf& aTestModuleIf ) + { + Cmpxplaybackutilitytest* self = new (ELeave) Cmpxplaybackutilitytest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +Cmpxplaybackutilitytest::~Cmpxplaybackutilitytest() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +//----------------------------------------------------------------------------- +// Cmpxplaybackutilitytest::SendTestClassVersion +// Method used to send version of test class +//----------------------------------------------------------------------------- +// +void Cmpxplaybackutilitytest::SendTestClassVersion() + { + TVersion moduleVersion; + moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; + moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; + moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; + + TFileName moduleName; + moduleName = _L("mpxplaybackutilitytest.dll"); + + TBool newVersionOfMethod = ETrue; + TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); + } + +// ========================== 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* ) Cmpxplaybackutilitytest::NewL( aTestModuleIf ); + + } + + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_playback_utility_api/tsrc/mpxplaybackutilitytest/src/mpxplaybackutilitytestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/tsrc/mpxplaybackutilitytest/src/mpxplaybackutilitytestBlocks.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,233 @@ +/* +* Copyright (c) 2002 - 2007 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: mpxplaybackutilitytest blocks implementation for STIF Test Framework TestScripter. +* +*/ + + + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include "mpxplaybackutilitytest.h" +// ============================ MEMBER FUNCTIONS =============================== +// --------------------------------------------------------------------------- +// From MMPXPlaybackObserver +// Handle playback message. +// --------------------------------------------------------------------------- +// +void Cmpxplaybackutilitytest::HandlePlaybackMessage( + CMPXMessage* /*aMessage*/, TInt aError ) + { + iLog->Log(_L("Cmpxharvestertest::HandlePlaybackMessage: %d"), aError); + } +// ----------------------------------------------------------------------------- +// Cmpxplaybackutilitytest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Cmpxplaybackutilitytest::Delete() + { + iMPXPlaybackUtility->Close(); +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + iFile64.Close(); +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + iFs.Close(); + } + +// ----------------------------------------------------------------------------- +// Cmpxplaybackutilitytest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Cmpxplaybackutilitytest::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( "MMPXPlaybackUtilityNewL", Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewL ), + ENTRY( "MMPXPlaybackUtilityUtilityL", Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityL ), + ENTRY( "MMPXPlaybackUtilityInit64L", Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L ), + ENTRY( "MMPXPlaybackUtilityInitStreaming64L", Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L ), + ENTRY( "MMPXPlaybackUtilityFile64L", Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L ), + + //ADD NEW ENTRY HERE + // [test cases entries] - Do not remove + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// ----------------------------------------------------------------------------- +// Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewL +// NewL test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityNewL(CStifItemParser& /*aItem*/) + { + TInt err = KErrNone; + + TRAP( err,iMPXPlaybackUtility = MMPXPlaybackUtility::NewL(KPbModeDefault,this )); + + if (err!= KErrNone) + { + iLog->Log(_L("Cmpxharvestertest::MMPXPlaybackUtilityNewL: %d"), err); + } + + return err; + } + +// ----------------------------------------------------------------------------- +// Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityL +// UtilityL test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityUtilityL(CStifItemParser& /*aItem*/) + { + TInt err = KErrNone; + + TRAP(err,iMPXPlaybackUtility = MMPXPlaybackUtility::UtilityL()); + + if (err!= KErrNone) + { + iLog->Log(_L("Cmpxharvestertest::MMPXPlaybackUtilityUtilityL: %d"), err); + } + + return err; + } + +// ----------------------------------------------------------------------------- +// Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L +// Init64L test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L(CStifItemParser& aItem) + { + iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L testing Init64L() begin")); + TInt err = KErrNone; +#ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + err = KErrNotSupported; + iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L testing Init64L() error=%d"),err); +#else // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + TPtrC string; + + if( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(KmpxplaybackutilityTestFilePath); + KFrom.Append(string); + if ( iFile64.SubSessionHandle() ) + { + iFile64.Close(); + } + err = iFile64.Open(iFs, KFrom, EFileRead | EFileShareReadersOrWriters); + if ( err == KErrNone ) + { + iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L testing Init64L() Open passed.")); + TRAP(err,iMPXPlaybackUtility->Init64L(iFile64)); + } + iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInit64L testing Init64L() error=%d"),err); + } + else + { + iLog->Log(_L("MMPXPlaybackUtilityInit64L - Missing file name.")); + err = KErrArgument; + } +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + return err; + } + +// ----------------------------------------------------------------------------- +// Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L +// InitStreaming64L test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L(CStifItemParser& aItem) + { + iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L testing InitStreaming64L() begin")); + TInt err = KErrNone; +#ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + err = KErrNotSupported; + iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L testing InitStreaming64L() error=%d"),err); +#else // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + TPtrC string; + TInt accessPoint = 1; + + if( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(KmpxplaybackutilityTestFilePath); + KFrom.Append(string); + if ( iFile64.SubSessionHandle() ) + { + iFile64.Close(); + } + err = iFile64.Open(iFs, KFrom, EFileRead | EFileShareReadersOrWriters); + if ( err == KErrNone ) + { + iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L testing InitStreaming64L() Open passed.")); + TRAP(err,iMPXPlaybackUtility->InitStreaming64L(iFile64, accessPoint)); + } + iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityInitStreaming64L testing InitStreaming64L() error=%d"),err); + } + else + { + iLog->Log(_L("MMPXPlaybackUtilityInitStreaming64L - Missing file name.")); + err = KErrArgument; + } +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + return err; + } + +// ----------------------------------------------------------------------------- +// Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L +// File64L test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L(CStifItemParser& /*aItem*/) + { + iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L testing File64L() begin")); + TInt err = KErrNone; +#ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + err = KErrNotSupported; + iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L testing File64L() error=%d"),err); +#else // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + RFile64* file64Ptr; + TRAP(err, file64Ptr=iMPXPlaybackUtility->Source()->File64L()); + if ( !file64Ptr->SubSessionHandle() ) + { + iLog->Log(_L("MMPXPlaybackUtilityFile64L - file64 = NULL.")); + } + iLog->Log(_L("Cmpxplaybackutilitytest::MMPXPlaybackUtilityFile64L testing File64L() error=%d"),err); +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + return err; + } + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_view_utility_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_view_utility_api/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2007 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 +: mpx viewframework viewutility API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../inc/mpxviewactivationobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxviewactivationobserver.h) +../inc/mpxviewpluginmanager.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxviewpluginmanager.h) +../inc/mpxviewutility.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxviewutility.h) +../inc/mpxviewutilitycommanddef.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxviewutilitycommanddef.h) diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_view_utility_api/inc/mpxviewactivationobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_view_utility_api/inc/mpxviewactivationobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2006 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: MPX view activcation observer interface definition +* +*/ + + + +#ifndef MMPXVIEWACTIVATIONOBSERVER_H +#define MMPXVIEWACTIVATIONOBSERVER_H + + +// INCLUDES +#include + + +// FORWARD DECLARATIONS + + +// CLASS DECLARATION + +/** + * MPX view activation observer. + * + * @lib mpxviewutility.lib + */ +NONSHARABLE_CLASS( MMPXViewActivationObserver ) + { +public: + enum TViewUpdateEvent + { + EViewPluginAdd, + EViewPluginUpdate, + EViewPluginRemove + }; + +public: + + /** + * Handle view activation. + * + * @since S60 3.2.3 + * @param aCurrentViewType Current view type Uid. + * @param aPreviousViewType Previous view type Uid. + */ + virtual void HandleViewActivation( + const TUid& aCurrentViewType, + const TUid& aPreviousViewType ) = 0; + + /** + * Called in case a view plugin is added/updated/removed through a SIS install. + * + * @since S60 3.2.3 + * @param aViewUid view UID + * @param aUpdateEvent Defines the update type (addition/update/removal). + * @param aLoaded ETrue if the view plugin is loaded, EFalse otherwise. It is recommended + * that client applications exit when loaded plugins are updated or removed. + * This would normally be handled in the AppUi. + * @param aData Its meaning depends on the update event: + * EViewPluginAdd - new view plugin version + * EViewPluginUpdate - new view plugin version + * EViewPluginRemove - old view plugin version + */ + virtual void HandleViewUpdate( + TUid /* aViewUid */, + TViewUpdateEvent /* aUpdateEvent */, + TBool /* aLoaded */, + TInt /* aData */) {}; + }; + +#endif // MMPXVIEWACTIVATIONOBSERVER_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_view_utility_api/inc/mpxviewpluginmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_view_utility_api/inc/mpxviewpluginmanager.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2006 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: MPX view plugin manager interface definition. +* +*/ + + + +#ifndef MMPXVIEWPLUGINMANAGER_H +#define MMPXVIEWPLUGINMANAGER_H + + +// INCLUDES +#include +#include + + +// CLASS DECLARATION +class CMPXViewPlugin; + +/** + * MPX view plugin manager interface. + * + * @lib mpxviewutility.lib + */ +NONSHARABLE_CLASS( MMPXViewPluginManager ) + { +public: + + /** + * Resolve view plugin based on the criteria passed in parameter. + * + * @since S60 3.2.3 + * @param aUid Specific view plugin uid or plugin type uid. + * @param aResolvedPluginType On return, stores the plugin type of + * the returned pointer + * @return Pointer to a view plugin object. Leave if not found. + */ + virtual CMPXViewPlugin* ResolvePluginL( + const TUid& aUid, TUid& aResolvedPluginType ) = 0; + + /** + * Resolve view plugin based on the criteria passed in parameter. + * + * @since S60 3.2.3 + * @param aUids List of Uids, including specific view plugin uid and/or + * plugin type uid. + * @param aResolvedPluginType On return, stores the plugin type of + * the returned pointer + * @return Pointer to a view plugin object. Leave if not found. + */ + virtual CMPXViewPlugin* ResolvePluginL( + const RArray& aUids, TUid& aResolvedPluginType ) = 0; + + /** + * Return view plugin with specific view plugin implementation uid. + * + * @since S60 3.2.3 + * @param aUid Specific view plugin uid. + * @return Pointer to a view plugin object. Leave if not found. + */ + virtual CMPXViewPlugin* PluginL( + const TUid& aUid ) = 0; + }; + +#endif // MMPXVIEWPLUGINMANAGER_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_view_utility_api/inc/mpxviewutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_view_utility_api/inc/mpxviewutility.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,240 @@ +/* +* Copyright (c) 2006 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: MPX view utility interface definition +* +*/ + + + +#ifndef MMPXVIEWUTILITY_H +#define MMPXVIEWUTILITY_H + + +// INCLUDES +#include +#include + + +// FORWARD DECLARATIONS +class MMPXViewPluginManager; +class CMPXViewPlugin; + + +// CLASS DECLARATION + +/** + * MPX view utility interface. + * + * @lib mpxviewutility.lib + */ +NONSHARABLE_CLASS( MMPXViewUtility ) + { +public: + + /** + * Retrieve a view utility of this thread. All clients in this thread + * shares the same viewutility (singleton). + * Call Close() when this object is not needed anymore. + * + * @since S60 3.2.3 + * @return Pointer to view utility. Ownership not transferred. + */ + IMPORT_C static MMPXViewUtility* UtilityL(); + + /** + * This method must be called when this object can be freed. This object + * will be destroyed when no one is using it. + * + * @since S60 3.2.3 + */ + virtual void Close() = 0; + + /** + * Activate view by resolving passed uid. + * + * @since S60 3.2.3 + * @param aUid Uid to be resolved. This uid can be plugin implementation + * uid, plugin type uid or specific view plugin uid. + * @param aParam Parameter passed to the view on activation + * @leave KErrNotFound if a matching plugin cannot be found + */ + virtual void ActivateViewL( + const TUid& aUid, + const TDesC* aParam = NULL ) = 0; + + /** + * Activate view by resolving passed uids. + * + * @since S60 3.2.3 + * @param aUids List of Uids to be resolved, this uid can be plugin uid, + * plugin type uid or specific view plugin uid. + * @param aParam Parameter passed to the view on activation + * @leave KErrNotFound if a matching plugin cannot be found + */ + virtual void ActivateViewL( + const RArray& aUids, + const TDesC* aParam = NULL ) = 0; + + /** + * Set view as default view, not bring to foreground. This is only valid + * if there are no views previously activated. + * + * @since S60 3.2.3 + * @param aUid Uid of item to be activated. This uid can be plugin implementation + * uid, plugin type uid or specific view plugin uid. + * @leave Error code KErrAlreadyExist when there are views already + * activated + * @leave Error code KErrNotSupported for views that doesn't support + * default view (such as dialogs) + */ + virtual void SetAsDefaultViewL( const TUid& aUid ) = 0; + + /** + * Set view as default view, not bring to foreground. This is only valid + * if there are no views previously activated. + * + * @since S60 3.2.3 + * @param aUid Uids of item to be activated. This uid can be plugin implementation + * uid, plugin type uid or specific view plugin uid. + * @leave Error code KErrAlreadyExist when there are views already + * activated + * @leave Error code KErrNotSupported for views that doesn't support + * default view (such as dialogs) + */ + virtual void SetAsDefaultViewL( const RArray& aUids ) = 0; + + /** + * Activate previous view. + * + * @since S60 3.2.3 + * + * @leave Error code KErrNotFound if there's no history. + */ + virtual void ActivatePreviousViewL() = 0; + + /** + * Pre-load view plug-ins that have EMPXPluginFlagPreLoad flag set. + * + * @since S60 3.2.3 + */ + virtual void PreLoadViewsL() = 0; + + /** + * Pre-load view plug-ins that have EMPXPluginFlagPreLoad flag and also by resolving passed uid. + * + * @param aUid Uid of specific application to be resolved. + */ + virtual void PreLoadViewsL( const TUid& aUid ) = 0; + + /** + * Pre-load view plug-in by resolving passed uid. + * + * @since S60 3.2.3 + * @param aUid Uid to be resolved. This uid can be plugin uid, plugin type + * uid or specific view plugin uid. + * @leave if no match is found. + */ + virtual void PreLoadViewL( const TUid& aUid ) = 0; + + /** + * Get a reference to view plugin manager. + * + * @since S60 3.2.3 + * @return Reference to view plugin manager. + */ + virtual MMPXViewPluginManager& ViewPluginManager() = 0; + + /** + * Constructs default view history. + * + * @since S60 3.2.3 + * @return if defined, the default view UID. KNullUid if not defined + */ + virtual TUid ConstructDefaultViewHistoryL() = 0; + + /** + * Push default history to view history. The current browse history + * is erased and the default browsing path is loaded as the current history. + * @since S60 3.2.3 + */ + virtual void PushDefaultHistoryL() = 0; + + /** + * Gets default view's UID. + * + * @since S60 3.2.3 + * @return if defined, the default view UID. KNullUid if not defined + */ + virtual TUid DefaultViewUid() = 0; + + /** + * Returns the current history depth. + * if depth is greater than 1, the client should call ActivatePreviousViewL + * on a back command. + * + * if depth is 1, the client should exit the app on a back command instead + * of calling ActivatePreviousViewL. + * + * @since S60 3.2.3 + * + * @return The current browsing history depth. + */ + virtual TInt ViewHistoryDepth() = 0; + + /** + * Returns the last activated view type. + * + * @since S60 3.2.3 + * @return previous view type if defined. KNullUid if not. + */ + virtual TUid PreviousViewType() = 0; + + /** + * Returns the view type of the active view. + * + * @since S60 3.2.3 + * @return current view type if defined. KNullUid if not. + */ + virtual TUid ActiveViewType() = 0; + + /** + * Returns the implementation uid of the active view. + * + * @since S60 3.2.3 + * @return current view implementation id if defined. KNullUid if not. + */ + virtual TUid ActiveViewImplementationUid() = 0; + + /** + * Add view activation observer. + * + * @since S60 3.2.3 + * @param aObserver Pointer to an observer object + */ + virtual void AddObserverL( + MMPXViewActivationObserver* aObserver ) = 0; + + /** + * Remove view activation observer. + * + * @since S60 3.2.3 + * @param aObserver Pointer to an observer object + */ + virtual void RemoveObserver( + MMPXViewActivationObserver* aObserver ) = 0; + }; + +#endif // MMPXVIEWUTILITY_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_view_utility_api/inc/mpxviewutilitycommanddef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_view_utility_api/inc/mpxviewutilitycommanddef.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2006 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: Custom command def for view utility +* +*/ + + + +#ifndef MPXVIEWUTILITYCOMMANDDEF_H +#define MPXVIEWUTILITYCOMMANDDEF_H + +const TInt KMPXViewUtilityCustomCommand=0x10282959; + +// ENUMS + +enum TMPXViewUtilityCustomCommands + { + EMPXViewUtilCmdViewActivated, + EMPXViewUtilCmdViewDeActivated // aData contains address of current view + }; + +#endif // MPXVIEWUTILITYCOMMANDDEF_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_view_utility_api/mpx_view_utility_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_view_utility_api/mpx_view_utility_api.metaxml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,15 @@ + + +MPX View Utility API +Provides utilities for the view framework +c++ +mpx + + + + + +no +no + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_view_utility_api/tsrc/conf/ui_mpxViewUtilityTest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_view_utility_api/tsrc/conf/ui_mpxViewUtilityTest.cfg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,7 @@ + +[Test] +title 1: TestMPXViewUtility +create ui_mpxViewUtilityTest foobar +foobar TestMPXViewUtility +delete foobar +[Endtest] diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_view_utility_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_view_utility_api/tsrc/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2007 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 for project mpxharvestertest +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_TESTEXPORTS +// Test sound file + + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +#include "../ui_mpxViewUtilityTest/group/bld.inf" + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_view_utility_api/tsrc/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_view_utility_api/tsrc/init/TestFramework.ini Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,197 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[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_ui_mpxViewUtilityTest + +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= 0 # Default timeout value for each test case. In milliseconds +UITestingSupport= YES +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +[New_Module] +ModuleName= testscripter +TestCaseFile= c:\testframework\ui_mpxViewUtilityTest.cfg +[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[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= D:\LOGS\TestFramework\ +#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 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_view_utility_api/tsrc/ui_mpxViewUtilityTest/Bmarm/ui_mpxViewUtilityTestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_view_utility_api/tsrc/ui_mpxViewUtilityTest/Bmarm/ui_mpxViewUtilityTestU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_view_utility_api/tsrc/ui_mpxViewUtilityTest/Bwins/ui_mpxViewUtilityTestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_view_utility_api/tsrc/ui_mpxViewUtilityTest/Bwins/ui_mpxViewUtilityTestU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,4 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + ?UtilityL@CMPXViewUtility@@SAPAVMMPXViewUtility@@XZ @ 2 NONAME ABSENT ; class MMPXViewUtility * CMPXViewUtility::UtilityL(void) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_view_utility_api/tsrc/ui_mpxViewUtilityTest/EABI/ui_mpxViewUtilityTestU.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_view_utility_api/tsrc/ui_mpxViewUtilityTest/EABI/ui_mpxViewUtilityTestU.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_view_utility_api/tsrc/ui_mpxViewUtilityTest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_view_utility_api/tsrc/ui_mpxViewUtilityTest/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2002 - 2007 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 for project +* +*/ + + + +PRJ_PLATFORMS +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these +DEFAULT + +PRJ_TESTEXPORTS +// NOTE: If using ARS requirements all export operations should be done under this. +// 'abld test export' + +PRJ_EXPORTS +// Specify the source file followed by its destination here +// copy will be used to copy the source file to its destination +// If there's no destination then the source file will be copied +// to the same name in /epoc32/include +// Example: +/* +/agnmodel/inc/AGMCOMON.H +*/ + +PRJ_TESTMMPFILES +ui_mpxViewUtilityTest.mmp + +PRJ_MMPFILES + +// Specify the .mmp files required for building the important component +// releasables. +// +// Specify "tidy" if the component you need to build doesn't need to be +// released. Specify "ignore" if the MMP file exists but should be +// ignored. +// Example: +/* +/agnmodel/group/agnmodel.mmp +#if defined(MARM) +/agnmodel/group/agsvexe.mmp +#endif +*/ + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_view_utility_api/tsrc/ui_mpxViewUtilityTest/group/ui_mpxViewUtilityTest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_view_utility_api/tsrc/ui_mpxViewUtilityTest/group/ui_mpxViewUtilityTest.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2002 - 2007 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: ui_mpxViewUtilityTest mmp file +* +*/ + + +#if defined(__S60_) + // To get the OS_LAYER_SYSTEMINCLUDE-definition + #include +#endif + +TARGET ui_mpxViewUtilityTest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +/* Remove comments and replace 0x00000000 with correct vendor id */ +// VENDORID 0x00000000 +/* Remove comments and replace 0x00000000 with correct secure id */ +// SECUREID 0x00000000 + +//TARGETPATH ?target_path +DEFFILE ui_mpxViewUtilityTest.def + +MW_LAYER_SYSTEMINCLUDE +USERINCLUDE ../inc + +SOURCEPATH ../src + + +SOURCE ui_mpxViewUtilityTest.cpp +SOURCE ui_mpxViewUtilityTestBlocks.cpp + +//RESOURCE resource_file +//RESOURCE resource_file2 + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib mpxviewutility.lib + +LANG SC + +/* +START WINS +?wins_specific_information +END + +START MARM +?marm_specific_information +END +*/ +// Other possible keywords: + +// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) +/* +START BITMAP ?target +TARGETPATH ?emulated_path_on_target_machine +HEADER +SOURCE ?color_depth ?source_bitmap +END +*/ +// DEFFILE ?filename +// AIF ?filename + +// End of File + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_view_utility_api/tsrc/ui_mpxViewUtilityTest/group/ui_mpxViewUtilityTest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_view_utility_api/tsrc/ui_mpxViewUtilityTest/group/ui_mpxViewUtilityTest.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,66 @@ +; +; 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: Package file for project STIF ui_mpxViewUtilityTest +; +; +; Installation file for STIF +; + +; Languages +&EN + +; Provide value for uid +#{"STIF ui_mpxViewUtilityTest Application"},(0x10005942),1,1,0,TYPE=SA + +; Series60 product id for S60 3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Logo +; None + +; Package signature - Optional +; None + +; Start of Package body + +; Condition blocks +; None + +; Options list +; None + +; Install files + + +"..\..\init\TestFramework.ini" - "c:\testframework\TestFramework.ini" +"..\..\conf\ui_mpxViewUtilityTest.cfg" - "c:\testframework\ui_mpxViewUtilityTest.cfg" + +"\epoc32\release\armv5\udeb\ui_mpxViewUtilityTest.dll" - "c:\Sys\Bin\ui_mpxViewUtilityTest.dll" + +; Embedded SIS +; None + +; End of Package body + +; PKG dependencies +; None + +; PKG capabilities +; None diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_view_utility_api/tsrc/ui_mpxViewUtilityTest/inc/ui_mpxViewUtilityTest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_view_utility_api/tsrc/ui_mpxViewUtilityTest/inc/ui_mpxViewUtilityTest.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,147 @@ +/* +* Copyright (c) 2002 - 2007 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: ui_mpxViewUtilityTest header for STIF Test Framework TestScripter +* +*/ + + + +#ifndef ui_mpxViewUtilityTest_H +#define ui_mpxViewUtilityTest_H + +// INCLUDES +#include +#include +#include +#include +#include + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def +#define TEST_CLASS_VERSION_MAJOR 0 +#define TEST_CLASS_VERSION_MINOR 0 +#define TEST_CLASS_VERSION_BUILD 0 + +// Logging path +_LIT( Kui_mpxViewUtilityTestLogPath, "\\logs\\testframework\\ui_mpxViewUtilityTest\\" ); +// Log file +_LIT( Kui_mpxViewUtilityTestLogFile, "ui_mpxViewUtilityTest.txt" ); +_LIT( Kui_mpxViewUtilityTestLogFileWithTitle, "ui_mpxViewUtilityTest_[%S].txt" ); + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class Cui_mpxViewUtilityTest; +class MMPXViewUtility; + +// CLASS DECLARATION + +/** +* Cui_mpxViewUtilityTest test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(Cui_mpxViewUtilityTest) : public CScriptBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Cui_mpxViewUtilityTest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Cui_mpxViewUtilityTest(); + + + + 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 ); + + + + protected: // Functions from base classes + + /** + * From ?base_class ?member_description + */ + //?type ?member_function(); + + private: + + /** + * C++ default constructor. + */ + Cui_mpxViewUtilityTest( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // ?classname( const ?classname& ); + // Prohibit assigment operator if not deriving from CBase. + // ?classname& operator=( const ?classname& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + /** + * Test methods are listed below. + */ + + /** + * Example test method. + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt TestMPXViewUtility( CStifItemParser& aItem ); + + /** + * Method used to log version of test class + */ + void SendTestClassVersion(); + + + + + private: // Friend classes + //From mpxviewutility.h + MMPXViewUtility* iMPXViewUtility; + }; + +#endif // ui_mpxViewUtilityTest_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_view_utility_api/tsrc/ui_mpxViewUtilityTest/src/ui_mpxViewUtilityTest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_view_utility_api/tsrc/ui_mpxViewUtilityTest/src/ui_mpxViewUtilityTest.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,160 @@ +/* +* Copyright (c) 2002 - 2007 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: ui_mpxViewUtilityTestimplemetation for STIF Test Framework TestScripter +* +*/ + + + +// INCLUDE FILES +#include +#include "ui_mpxViewUtilityTest.h" +#include + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cui_mpxViewUtilityTest::Cui_mpxViewUtilityTest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +Cui_mpxViewUtilityTest::Cui_mpxViewUtilityTest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// Cui_mpxViewUtilityTest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Cui_mpxViewUtilityTest::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(Kui_mpxViewUtilityTestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(Kui_mpxViewUtilityTestLogFile); + } + + iLog = CStifLogger::NewL( Kui_mpxViewUtilityTestLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + SendTestClassVersion(); + } + +// ----------------------------------------------------------------------------- +// Cui_mpxViewUtilityTest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Cui_mpxViewUtilityTest* Cui_mpxViewUtilityTest::NewL( + CTestModuleIf& aTestModuleIf ) + { + Cui_mpxViewUtilityTest* self = new (ELeave) Cui_mpxViewUtilityTest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +Cui_mpxViewUtilityTest::~Cui_mpxViewUtilityTest() + { + + // Delete resources allocated from test methods + Delete(); + /* if( iMPXViewUtility != NULL ) + { + delete iMPXViewUtility; + iMPXViewUtility = NULL; + } +*/ +// iMPXViewUtility->Close(); + // Delete logger + delete iLog; + + } + +//----------------------------------------------------------------------------- +// Cui_mpxViewUtilityTest::SendTestClassVersion +// Method used to send version of test class +//----------------------------------------------------------------------------- +// +void Cui_mpxViewUtilityTest::SendTestClassVersion() + { + TVersion moduleVersion; + moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; + moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; + moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; + + TFileName moduleName; + moduleName = _L("ui_mpxViewUtilityTest.dll"); + + TBool newVersionOfMethod = ETrue; + TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); + } + +// ========================== 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* ) Cui_mpxViewUtilityTest::NewL( aTestModuleIf ); + + } + + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/mpx_view_utility_api/tsrc/ui_mpxViewUtilityTest/src/ui_mpxViewUtilityTestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_view_utility_api/tsrc/ui_mpxViewUtilityTest/src/ui_mpxViewUtilityTestBlocks.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2002 - 2007 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: ui_mpxViewUtilityTest block implemetation for STIF Test Framework TestScripter +* +*/ + + + +// [INCLUDE FILES] - do not remove +#include +#include +#include + +#include "ui_mpxViewUtilityTest.h" + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cui_mpxViewUtilityTest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Cui_mpxViewUtilityTest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// Cui_mpxViewUtilityTest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Cui_mpxViewUtilityTest::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( "TestMPXViewUtility", Cui_mpxViewUtilityTest::TestMPXViewUtility ), + + //ADD NEW ENTRY HERE + // [test cases entries] - Do not remove + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } +// ----------------------------------------------------------------------------- +// Cui_mpxViewUtilityTest::?member_function +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cui_mpxViewUtilityTest::TestMPXViewUtility( CStifItemParser& ) + { + TInt err = KErrNone; + TRAP( err, iMPXViewUtility = MMPXViewUtility::UtilityL()); + + + iMPXViewUtility->Close(); + + + if(err!=KErrNone) + { + iLog->Log(_L("Cui_mpxViewUtilityTest::TestMPXViewUtility: %d"), err); + } + + return err; + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= +// None + +// [End of File] - Do not remove diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playback_helper_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playback_helper_api/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2008 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 mpx video playback +* +*/ + +// Version : %version: 5 % + + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/mediarecognizer.h MW_LAYER_PLATFORM_EXPORT_PATH(mediarecognizer.h) +../inc/streaminglinkmodel.h MW_LAYER_PLATFORM_EXPORT_PATH(streaminglinkmodel.h) +../inc/devsoundif.h MW_LAYER_PLATFORM_EXPORT_PATH(devsoundif.h) +../inc/videoplayeruid.hrh MW_LAYER_PLATFORM_EXPORT_PATH(videoplayeruid.hrh) \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playback_helper_api/inc/devsoundif.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playback_helper_api/inc/devsoundif.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2008 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: Implementation of CDevSoundIf +* +*/ + +// Version : %version: 4 % + + + +#ifndef __DEVSOUNDIF_H +#define __DEVSOUNDIF_H + +class CMMFDevSound; + +NONSHARABLE_CLASS(CDevSoundIf) +{ + + + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + IMPORT_C static CDevSoundIf* NewL(); + + /** + * Destructor. + */ + IMPORT_C virtual ~CDevSoundIf(); + + public: // New functions + + /** + * Get number of volume steps + * @since 9.2 + * @return number of volume steps + */ + IMPORT_C TInt GetNumberOfVolumeSteps(); + + private: + + /** + * C++ default constructor. + */ + CDevSoundIf(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // Data + + CMMFDevSound* iDevSound; +}; + +#endif // __DEVSOUNDIF_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playback_helper_api/inc/mediarecognizer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playback_helper_api/inc/mediarecognizer.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,285 @@ +/* +* Copyright (c) 2008 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: Implementation of CMediaRecognizer +* +*/ + +// Version : %version: 6 % + + + +#ifndef __MEDIARECOGNIZER_H +#define __MEDIARECOGNIZER_H + +// INCLUDES +#include +#include +#include +#include + + +NONSHARABLE_CLASS(CMediaRecognizer) : public CBase +{ + + public: + // Media types + enum TMediaType + { + ELocalVideoFile, + ELocalAudioFile, + ELocalRamFile, + ELocalSdpFile, + EUrl, + ELocalAudioPlaylist, + EProgressiveDownload, + EFlashVideoFile, + ELocalAsxFile, + EUnidentified + }; + + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + IMPORT_C static CMediaRecognizer* NewL(); + + /** + * Destructor. + */ + IMPORT_C virtual ~CMediaRecognizer(); + + public: // New functions + + /** + * Recognizes media type. + * @since 2.0 + * @param aMediaName Media file name or Url + * @param aIncludeUrls Are Urls included or not + * @return TMediaType + */ + IMPORT_C TMediaType IdentifyMediaTypeL( const TDesC& aMediaName, + TBool aIncludeUrls = EFalse ); + + /** + * Recognizes media type. + * @since 3.0 + * @param aMediaName Media file name or Url + * @param aFile file handle + * @param aIncludeUrls Are Urls included or not + * @return TMediaType + */ + IMPORT_C TMediaType IdentifyMediaTypeL( const TDesC& aMediaName, + RFile& aFile, + TBool aIncludeUrls = EFalse ); + + /** + * Recognizes Media files MimeType. + * @since 2.0 + * @param aLocalFile File name + * @return TBuf, Mime type. + */ + IMPORT_C TBuf MimeTypeL( const TDesC& aLocalFile ); + + /** + * Recognizes Media files MimeType. + * @since 3.0 + * @param aFile File handle + * @return TBuf, Mime type. + */ + IMPORT_C TBuf MimeTypeL( RFile& aFile ); + + /* + * IsValidStreamingPrefix + * Check for a valid streaming prefix given a URL + * @param aUrl URL + * @return ETrue is prefix is valid + */ + IMPORT_C TBool IsValidStreamingPrefix( const TDesC& aUrl ); + + /* + * IsValidUrlPrefix + * Check for a valid prefix given a URL + * @param aUrl URL + * @return ETrue is prefix is valid + */ + IMPORT_C TBool IsValidUrlPrefix( const TDesC& aUrl ); + IMPORT_C TBool IsValidUrlPrefix( const TDesC8& aUrl ); + + /** + * Frees recognizer's filehandle. + * @since 3.0 + */ + IMPORT_C void FreeFilehandle(); + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + + /** + * Recognizes media type. + * @since 9.2 + * @param aMediaName Media file name or Url + * @param aFile RFile64 file handle + * @param aIncludeUrls Are Urls included or not + * @return TMediaType + */ + IMPORT_C TMediaType IdentifyMediaTypeL( const TDesC& aMediaName, + RFile64& aFile, + TBool aIncludeUrls = EFalse ); + + /** + * Recognizes Media files MimeType. + * @since 9.2 + * @param aFile RFile64 file handle + * @return TBuf, Mime type. + */ + IMPORT_C TBuf MimeTypeL( RFile64& aFile ); + +#endif + + private: // New functions + + /** + * Checks if there is video playback support. + * @since 2.0 + * @param aFileName + * @param aFileRecognitionResult Recognition result + * @return ETrue: Supported + * EFalse: Not supported + */ + TBool FileHasVideoSupportL( const TDesC& aFileName, + TDataRecognitionResult& aFileRecognitionResult, + RMMFControllerImplInfoArray& aVideoControllers ); + + /** + * Checks if there is audio playback support. + * @since 2.0 + * @param aFileName + * @param aFileRecognitionResult Recognition result + * @return ETrue: Supported + * EFalse: Not supported + */ + TBool FileHasAudioSupport( const TDesC& aFileName, + TDataRecognitionResult& aFileRecognitionResult, + RMMFControllerImplInfoArray& aAudioControllers, + RMMFControllerImplInfoArray& aVideoControllers ); + + /** + * Creates array to hold all the controller plugins that support video. + * @since 2.0 + * @return void + */ + void CreateVideoFormatsArrayL( RMMFControllerImplInfoArray& aVideoController ); + + /** + * Creates array to hold all the controller plugins that support audio. + * @since 2.0 + * @return void + */ + void CreateAudioFormatsArrayL( RMMFControllerImplInfoArray& aAudioController ); + + /** + * Recognizes local file + * @since 2.0 + * @param aFileName. + * This parameter is ignored if the recognizer has a valid filehandle. + * Filehandle can be set via IdentifyMediaTypeL or MimeTypeL methods. + * @param aFileRecognitionResult Recognition result + * @return void + */ + void RecognizeFileL( const TDesC& aFileName, TDataRecognitionResult& aResult ); + + /** + * Reads local file to buffer + * @since 2.0 + * @param aFileName + * @param aBuf, buffer + * @return KErrNone or one of the system wide error codes. + */ + TInt ReadFile( const TDesC& aFileName, TDes8& aBuf, TInt aBufSize ); + + /** + * Determines presence of file handle. + * @since 3.0 + * @return ETrue if file handle exists. + */ + TBool FileHandleExists(); + + /** + * Recognizes media type for non-url type + * @return TMediaType + */ + TMediaType MediaTypeL( const TDesC& aMediaName ); + + /** + * Reads local file to buffer using new RFile handle + * @since 9.2 + * @param aFileName + * @param aBuf, buffer + * @return KErrNone or one of the system wide error codes. + */ + TInt ReadFileViaNewFileHandle( const TDesC& aFileName, + TDes8& aBuf, TInt aBufSize ); + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + + /** + * Determines presence of file handle. + * @since 9.2 + * @return ETrue if file handle exists. + */ + TBool FileHandle64Exists(); + + /** + * Reads local file to buffer using new RFile64 handle + * @since 9.2 + * @param aFileName + * @param aBuf, buffer + * @return KErrNone or one of the system wide error codes. + */ + TInt ReadFileViaNewFileHandle64( const TDesC& aFileName, + TDes8& aBuf, TInt aBufSize ); + +#endif + + private: + + /** + * C++ default constructor. + */ + CMediaRecognizer(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // Data + // Array to hold all the controller plugins that support video + // Array to hold all the controller plugins that support audio + + // bufsize + + // Mime type recognizer + RFs iFs; + RFile iFileHandle; + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + RFile64 iFileHandle64; +#endif + +}; + +#endif // __MEDIARECOGNIZER_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playback_helper_api/inc/streaminglinkmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playback_helper_api/inc/streaminglinkmodel.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,216 @@ +/* +* Copyright (c) 2008 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: Implementation of CStreamingLinkModel +* +*/ + +// Version : %version: 5 % + + + +#ifndef __STREAMINGLINKMODEL_H +#define __STREAMINGLINKMODEL_H + +// INCLUDES +#include +#include +#include +#include + +#ifdef __WINDOWS_MEDIA +#include +#endif + +// CLASS DECLARATION +class MCLFContentListingEngine; + +struct LinkStruct { + HBufC* link; + TBool seek; +}; + +NONSHARABLE_CLASS(CStreamingLinkModel) : public CBase +{ + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + IMPORT_C static CStreamingLinkModel* NewL(); + + /** + * Destructor. + */ + IMPORT_C virtual ~CStreamingLinkModel(); + + public: // New functions + + /** + * Opens and reads RAM file to buffer. + * @since 2.0 + * @param aRamFileName RAM file + * @param aEnableFiltering, Is ram file content filtered or not + * @return KErrNone or KErrNotFound if no valid links in file + */ + IMPORT_C TInt OpenLinkFileL( const TDesC& aLinkFileName, TBool aEnableFiltering = ETrue ); + + /** + * Opens and reads RAM file to buffer. + * @since 9.2 + * @param aFile file handle + * @param aEnableFiltering, Is ram file content filtered or not + * @return KErrNone or KErrNotFound if no valid links in file + */ + IMPORT_C TInt OpenLinkFileL( RFile& aFile, TBool aEnableFiltering = ETrue ); + + /** + * Gets next link from opened RAM file. + * @since 2.0 + * @param aLink, New link. + * @param aLocalFile, Is link to local file or not. + * @param aParse, Parse the link if not forbidden. + * @return KErrNone if there are links left in RAM file, + * KErrNotFound if not. + */ + IMPORT_C TInt GetNextLinkL( TDes& aLink, TBool& aLocalFile, TBool aParse = ETrue ); + IMPORT_C TBool IsSeekable(); + /** + * Returns max link length in opened RAM file + * @since 2.0 + * @return link length + */ + IMPORT_C TInt MaxLinkLength(); + + /** + * Creates new RAM file + * @since 2.0 + * @param aNewRamFileName, New RAM file. + * @param aLinkArray, Array which contains links which are + * saved to RAM file. + * @param aOverWrite, Overwrite existing file or not. + * @return KErrNone or one of the system wide error codes. + */ + IMPORT_C TInt CreateNewLinkFileL( const TDesC& aNewLinkFileName, + MDesCArray* aLinkArray, + TBool aOverWrite = EFalse ); + + /** + * Frees model's filehandle. + * @since 3.0 + */ + IMPORT_C void FreeFilehandle(); + + /** + * Returns number of links in opened RAM file + * @since 3.2 + * @return number of links + */ + IMPORT_C TInt MultiLinksCount(); + + /** + * Reset number of links in opened RAM file for Repeat playlist + * @since 3.2 + */ + IMPORT_C void ResetLinkCount(); + + /** + * Opens and reads ASX file to buffer. + * @since 9.2 + * @param aLinkFileName Asx file + * @param aEnableFiltering, Is ASX file content filtered or not + * @return KErrNone or KErrNotFound if no valid links in file + */ + IMPORT_C TInt OpenAsxFileL( const TDesC& aLinkFileName, + TBool aEnableFiltering = ETrue ); + + /** + * Opens and reads ASX file to buffer. + * @since 9.2 + * @param aFile file handle + * @param aEnableFiltering, Is ASX file content filtered or not + * @return KErrNone or KErrNotFound if no valid links in file + */ + IMPORT_C TInt OpenAsxFileL( RFile& aFile, + TBool aEnableFiltering = ETrue ); + + /** + * Returns if all the links in the file are local + * @ + * @return ETrue if all the links are local + */ + IMPORT_C TBool AreAllLinksLocal(); + + private: + + /** + * C++ default constructor. + */ + CStreamingLinkModel(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: + + /** + * Reads next line from buffer + * @since 2.0 + * @param aLine Whole line which was read. + * @return KErrNone or one of the system wide error codes. + */ + TInt ReadNextLine( TDes& aLine ); + + /** + * Determines presence of file handle. + * @since 9.2 + * @param aFile file handle + * @return ETrue if file handle exists. + */ + TBool FileHandleExists( RFile& aFile ); + + /** + * Parse the ram file and add the link(s) to buffer. + * @since 9.2 + * @param aRamFile a Ram file + * @param aEnableFiltering, is Ram file content filtered or not + * @return KErrNone or KErrNotFound if no valid links in file + */ + TInt PopulateRamLinksL( RFile aRamFile, TBool aEnableFiltering ); + + /** + * Parse the Asx file and add the link(s) to buffer. + * @since 9.2 + * @param aAsxParser + * @param aEnableFiltering, is Asx file content filtered or not + * @return KErrNone or KErrNotFound if no valid links in file + */ + TInt PopulateAsxLinksL( CAsxParser* aAsxParser, TBool aEnableFiltering ); + + private: // Data + RFs iFs; + RFile iFileHandle; + + RPointerArray iLinkArray; + TPtrC8 iBufferPtr; + + TInt iLinkCount; + + MCLFContentListingEngine* iCLFEngine; +}; + +#endif // __STREAMINGLINKMODEL_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playback_helper_api/inc/videoplayeruid.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playback_helper_api/inc/videoplayeruid.hrh Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,20 @@ +/* +* 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: Video Player UID +* +*/ + +// Version : %version: 4 % + +#define KVideoPlayerUID 0x200159B2 diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playback_helper_api/tsrc/conf/playbackhelpertest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playback_helper_api/tsrc/conf/playbackhelpertest.cfg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,359 @@ +[Define] +Local 1 +Streaming 0 +ETrue 1 +EFalse 0 + +ELocalVideoFile 0 +ELocalAudioFile 1 +ELocalRamFile 2 +ELocalSdpFile 3 +EUrl 4 +ELocalAudioPlaylist 5 +EProgressiveDownload 6 +EFlashVideoFile 7 +ELocalAsxFile 8 +EUnidentified 9 + +NoPathNeeded 0 +PathNeeded 1 + +No 0 +Yes 1 + +ERFile 1 +ERFile64 0 + +[Enddefine] + +[Test] +title 1 MediaRecognizer - IdentifyMediaType via filename 1 +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest IdentifyMediaTypeViaFileName ELocalVideoFile test.3gp PathNeeded +delete PlaybackHelperTest +[Endtest] + +[Test] +title 2 MediaRecognizer - IdentifyMediaType via 32-bit file handle +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest IdentifyMediaTypeViaFileHandle ERFile ELocalVideoFile test.3gp +delete PlaybackHelperTest +[Endtest] + +[Test] +title 3 MediaRecognizer - IdentifyMediaType via filename 2 +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest IdentifyMediaTypeViaFileName ELocalAsxFile asx_v3.asx PathNeeded +delete PlaybackHelperTest +[Endtest] + +[Test] +title 4 MediaRecognizer - IdentifyMediaType via 32-bit file handle +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest IdentifyMediaTypeViaFileHandle ERFile ELocalAsxFile asx_v3.asx +delete PlaybackHelperTest +[Endtest] + +[Test] +title 5 MediaRecognizer - IdentifyMediaType via filename 3 +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest IdentifyMediaTypeViaFileName EUnidentified rtsp:\/\/1.1.1.1/1.3gp NoPathNeeded +delete PlaybackHelperTest +[Endtest] + +[Test] +title 6 MediaRecognizer - MimeType via filename +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest MimeTypeViaFileName video/3gpp test.3gp +delete PlaybackHelperTest +[Endtest] + +[Test] +title 7 MediaRecognizer - MimeType via 32-bit file handle +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest MimeTypeViaFileHandle ERFile video/3gpp test.3gp +delete PlaybackHelperTest +[Endtest] + +[Test] +title 8 MediaRecognizer - IsValidStreamingPrefix, TRUE +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest IsValidStreamingPrefix ETrue rtsp:\/\/1.1.1.1/1.3gp +delete PlaybackHelperTest +[Endtest] + +[Test] +title 9 MediaRecognizer - IsValidStreamingPrefix, FALSE +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest IsValidStreamingPrefix EFalse rts:\/\/1.1.1.1/1.3gp +delete PlaybackHelperTest +[Endtest] + +[Test] +title 10 MediaRecognizer - IsValidUrlPrefix TDesC +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest IsValidUrlPrefix1 ETrue rtspu:\/\/1.1.1.1/1.3gp +delete PlaybackHelperTest +[Endtest] + +[Test] +title 11 MediaRecognizer - IsValidUrlPrefix TDesC8 +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest IsValidUrlPrefix2 ETrue rtspt:\/\/1.1.1.1/1.3gp +delete PlaybackHelperTest +[Endtest] + +[Test] +title 12 MediaRecognizer - FreeFilehandleForRecognizer - after IdentifyMediaTypeViaFileHandle via RFile +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest IdentifyMediaTypeViaFileHandle ERFile ELocalVideoFile test.3gp +PlaybackHelperTest FreeFilehandleForRecognizer +delete PlaybackHelperTest +[Endtest] + +[Test] +title 13 MediaRecognizer - FreeFilehandleForRecognizer - after IdentifyMediaTypeViaFileHandle via RFile +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest IdentifyMediaTypeViaFileHandle ERFile ELocalVideoFile test.3gp +PlaybackHelperTest FreeFilehandleForRecognizer +delete PlaybackHelperTest +[Endtest] + +[Test] +title 14 MediaRecognizer - FreeFilehandleForRecognizer - no handle reserved +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest FreeFilehandleForRecognizer +delete PlaybackHelperTest +[Endtest] + +[Test] +title 15 StreamingLinkModel - OpenLinkFile via filename +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest OpenLinkFile1 multiple_streaming_link.ram +delete PlaybackHelperTest +[Endtest] + +[Test] +title 16 StreamingLinkModel - OpenLinkFile1 via file handle +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest OpenLinkFile2 multiple_streaming_link.ram +delete PlaybackHelperTest +[Endtest] + +[Test] +title 17 StreamingLinkModel - GetNextLink +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest OpenLinkFile1 multiple_streaming_link.ram +PlaybackHelperTest GetNextLink Streaming rtsp:\/\/1.1.1.1/1.3gp +PlaybackHelperTest GetNextLink Streaming rtsp:\/\/1.1.1.1/2.rm +delete PlaybackHelperTest +[Endtest] + +[Test] +title 18 StreamingLinkModel - MaxLinkLength +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest OpenLinkFile1 multiple_streaming_link.ram +PlaybackHelperTest MaxLinkLength 117 +delete PlaybackHelperTest +[Endtest] + +[Test] +title 19 StreamingLinkModel - CreateNewLinkFile +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest CreateNewLinkFile created.ram rtsp:\/\/1.1.1.1/1.3gp rtsp:\/\/1.1.1.1/2.3gp +delete PlaybackHelperTest +[Endtest] + +[Test] +title 20 StreamingLinkModel - MultiLinksCount +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest OpenLinkFile1 multiple_streaming_link.ram +PlaybackHelperTest MultiLinksCount 6 +delete PlaybackHelperTest +[Endtest] + +[Test] +title 21 StreamingLinkModel - ResetLinkCount +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest OpenLinkFile1 multiple_streaming_link.ram +PlaybackHelperTest GetNextLink Streaming rtsp:\/\/1.1.1.1/1.3gp +PlaybackHelperTest GetNextLink Streaming rtsp:\/\/1.1.1.1/2.rm +PlaybackHelperTest ResetLinkCount +PlaybackHelperTest GetNextLink Streaming rtsp:\/\/1.1.1.1/1.3gp +delete PlaybackHelperTest +[Endtest] + +[Test] +title 22 StreamingLinkModel - ResetLinkCount, GetNextLink not called +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest OpenLinkFile1 multiple_streaming_link.ram +PlaybackHelperTest ResetLinkCount +PlaybackHelperTest GetNextLink Streaming rtsp:\/\/1.1.1.1/1.3gp +delete PlaybackHelperTest +[Endtest] + +[Test] +title 23 StreamingLinkModel - ResetLinkCount, end of file +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest OpenLinkFile1 multiple_streaming_link.ram +PlaybackHelperTest GetNextLink Streaming rtsp:\/\/1.1.1.1/1.3gp +PlaybackHelperTest ResetLinkCount +PlaybackHelperTest GetNextLink Streaming rtsp:\/\/1.1.1.1/2.rm +PlaybackHelperTest ResetLinkCount +PlaybackHelperTest GetNextLink Streaming rtsp:\/\/1.1.1.1/3.3gp +PlaybackHelperTest ResetLinkCount +PlaybackHelperTest GetNextLink Streaming rtsp:\/\/1.1.1.1/4.rm +PlaybackHelperTest ResetLinkCount +PlaybackHelperTest GetNextLink Streaming rtsp:\/\/1.1.1.1/5.3gp +PlaybackHelperTest ResetLinkCount +PlaybackHelperTest GetNextLink Streaming rtsp:\/\/1.1.1.1/6.rm +PlaybackHelperTest ResetLinkCount +PlaybackHelperTest GetNextLink Streaming rtsp:\/\/1.1.1.1/1.3gp +delete PlaybackHelperTest +[Endtest] + +[Test] +title 24 StreamingLinkModel - FreeFilehandleForLink +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest OpenLinkFile1 multiple_streaming_link.ram +PlaybackHelperTest FreeFilehandleForLink +delete PlaybackHelperTest +[Endtest] + +[Test] +title 25 StreamingLinkModel - FreeFilehandleForLink, no handle reserved +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest FreeFilehandleForLink +delete PlaybackHelperTest +[Endtest] + +[Test] +title 26 StreamingLinkModel - OpenAsxLink via filename - ASX v2 +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest OpenAsxLinkViaFileName asx_v2.asx +delete PlaybackHelperTest +[Endtest] + +[Test] +title 27 StreamingLinkModel - OpenAsxLink via file handle - ASX v2 +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest OpenAsxLinkViaFileName asx_v2.asx +delete PlaybackHelperTest +[Endtest] + +[Test] +title 28 StreamingLinkModel - OpenAsxLink via filename - ASX v3 +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest OpenAsxLinkViaFileName asx_v3.asx +delete PlaybackHelperTest +[Endtest] + +[Test] +title 29 StreamingLinkModel - OpenAsxLink via file handle - ASX v3 +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest OpenAsxLinkViaFileName asx_v3.asx +delete PlaybackHelperTest +[Endtest] + +[Test] +title 30 StreamingLinkModel - MultiLinksCount, OpenAsxLink via filename - ASX v2 +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest OpenAsxLinkViaFileName asx_v2.asx +PlaybackHelperTest MultiLinksCount 2 +delete PlaybackHelperTest +[Endtest] + +[Test] +title 31 StreamingLinkModel - MultiLinksCount, OpenAsxLink via file handle - ASX v2 +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest OpenAsxLinkViaFileName asx_v2.asx +PlaybackHelperTest MultiLinksCount 2 +delete PlaybackHelperTest +[Endtest] + +[Test] +title 32 StreamingLinkModel - MultiLinksCount, OpenAsxLink via filename - ASX v3 +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest OpenAsxLinkViaFileName asx_v3.asx +PlaybackHelperTest MultiLinksCount 12 +delete PlaybackHelperTest +[Endtest] + +[Test] +title 33 StreamingLinkModel - MultiLinksCount, OpenAsxLink via file handle - ASX v3 +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest OpenAsxLinkViaFileName asx_v3.asx +PlaybackHelperTest MultiLinksCount 12 +delete PlaybackHelperTest +[Endtest] + +[Test] +title 34 StreamingLinkModel - GetNextLink, OpenAsxLink via filename - ASX v2 +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest OpenAsxLinkViaFileName asx_v2.asx +PlaybackHelperTest GetNextLink Streaming http:\/\/10.48.2.56:443/WMTest/256k_WMV9_QCIF_WMA9_30fps.wmv?MSWMExt=.asf +delete PlaybackHelperTest +[Endtest] + +[Test] +title 35 StreamingLinkModel - GetNextLink, OpenAsxLink via filename - ASX v3 +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest OpenAsxLinkViaFileName asx_v3.asx +PlaybackHelperTest GetNextLink Streaming http:\/\/10.48.2.56:443/WMTest/256k_WMV9_QCIF_WMA9_30fps.wmv +delete PlaybackHelperTest +[Endtest] + +[Test] +title 36 DevSoundIf - GetNumberOfVolumeSteps +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest GetNumberOfVolumeSteps +delete PlaybackHelperTest +[Endtest] + +[Test] +title 37 StreamingLinkModel - IsSeekable, OpenAsxLink via filename - ASX v3 +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest OpenAsxLinkViaFileName asx_seek_v3.asx +PlaybackHelperTest GetNextLink Streaming http:\/\/10.48.2.56:443/WMTest/256k_WMV9_QCIF_WMA9_30fps.wmv +PlaybackHelperTest IsSeekable No +PlaybackHelperTest GetNextLink Streaming http:\/\/10.48.2.56:443/WMTest/256k_WMV9_QCIF_WMA9_30fps.wmv +PlaybackHelperTest IsSeekable Yes +delete PlaybackHelperTest +[Endtest] + +[Test] +title 38 MediaRecognizer - IdentifyMediaType via 64-bit file handle +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest IdentifyMediaTypeViaFileHandle ERFile64 ELocalVideoFile test.3gp +delete PlaybackHelperTest +[Endtest] + +[Test] +title 39 MediaRecognizer - IdentifyMediaType via 64-bit file handle +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest IdentifyMediaTypeViaFileHandle ERFile64 ELocalAsxFile asx_v3.asx +delete PlaybackHelperTest +[Endtest] + +[Test] +title 40 MediaRecognizer - MimeType via 64-bit file handle +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest MimeTypeViaFileHandle ERFile64 video/3gpp test.3gp +delete PlaybackHelperTest +[Endtest] + +[Test] +title 41 MediaRecognizer - FreeFilehandleForRecognizer - after IdentifyMediaTypeViaFileHandle via RFile64 +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest IdentifyMediaTypeViaFileHandle ERFile64 ELocalVideoFile test.3gp +PlaybackHelperTest FreeFilehandleForRecognizer +delete PlaybackHelperTest +[Endtest] + +[Test] +title 42 MediaRecognizer - FreeFilehandleForRecognizer - after IdentifyMediaTypeViaFileHandle via RFile64 +create PlaybackHelperTest PlaybackHelperTest +PlaybackHelperTest IdentifyMediaTypeViaFileHandle ERFile64 ELocalVideoFile test.3gp +PlaybackHelperTest FreeFilehandleForRecognizer +delete PlaybackHelperTest +[Endtest] diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playback_helper_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playback_helper_api/tsrc/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,35 @@ +/* +* 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: Build information file for project Playback Helper Test. +* +*/ + +// Version : %version: 4 % + + +PRJ_PLATFORMS +DEFAULT + + +PRJ_TESTEXPORTS + +PRJ_EXPORTS + + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +#include "../playbackhelpertest/group/bld.inf" + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playback_helper_api/tsrc/init/testframework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playback_helper_api/tsrc/init/testframework.ini Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,201 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# + XML, Test report will be xml type, for example 'TestReport.xml'. +# Note, that xml format is available only when output is set to FILE. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[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, HTML or XML +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= 0 # 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] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +[New_Module] +#ModuleName= demomodule +ModuleName= TestScripter +TestCaseFile= c:\testframework\playbackhelpertest.cfg +[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[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= D:\LOGS\TestFramework\ +#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 000000000000 -r a2952bb97e68 mmappfw_plat/playback_helper_api/tsrc/playbackhelpertest/bwins/playbackhelpertestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playback_helper_api/tsrc/playbackhelpertest/bwins/playbackhelpertestu.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playback_helper_api/tsrc/playbackhelpertest/eabi/playbackhelpertestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playback_helper_api/tsrc/playbackhelpertest/eabi/playbackhelpertestu.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playback_helper_api/tsrc/playbackhelpertest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playback_helper_api/tsrc/playbackhelpertest/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,36 @@ +/* +* 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: Build information file for project Playback Helper Test. +* +*/ + +// Version : %version: 4 % + + + + +PRJ_PLATFORMS +DEFAULT + + +PRJ_EXPORTS + + +PRJ_MMPFILES + + +PRJ_TESTMMPFILES +playbackhelpertest.mmp + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playback_helper_api/tsrc/playbackhelpertest/group/playbackhelpertest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playback_helper_api/tsrc/playbackhelpertest/group/playbackhelpertest.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,52 @@ +/* +* 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: Playback Helper Build file +* +*/ + +// Version : %version: 4 % + + +#include + +EPOCALLOWDLLDATA + +TARGET playbackhelpertest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB + +DEFFILE playbackhelpertest.def + +SOURCEPATH ../src + +SOURCE playbackhelpertest.cpp +SOURCE playbackhelpertestblocks.cpp + +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY efsrv.lib +LIBRARY playbackhelper.lib +LIBRARY bafl.lib +LIBRARY ecom.lib +LIBRARY eikcore.lib +LIBRARY cone.lib + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playback_helper_api/tsrc/playbackhelpertest/group/playbackhelpertest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playback_helper_api/tsrc/playbackhelpertest/group/playbackhelpertest.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -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: Package file for PlaybackHelper STIF component +; +; Version : %version: 4 % +; +; Installation file for STIF MPEngine test Application in Platform Security Environments +; + +; Languages +&EN + +; Package header +#{"PlaybackHelper STIF Test Application"}, (0x101FB3E3), 1, 0, 1, TYPE=SA, RU + +; *Unique (Non-Localized) Vendor name +; This is used in combination with signing to prevent the unauthroized +; upgrade of a a package by someone other than the rightful vendor. +:"Nokia" + +; Localised Vendor name +%{"Nokia Test EN"} + +; Install files +"\epoc32\release\armv5\urel\playbackhelpertest.dll" - "c:\sys\bin\playbackhelpertest.dll" +"..\..\conf\playbackhelpertest.cfg" - "c:\testframework\playbackhelpertest.cfg" +"..\..\init\TestFramework.ini" - "c:\testframework\TestFramework.ini" + +"..\..\data\mmc\asx_v2.asx" - "e:\data\videos\asx_v2.asx" +"..\..\data\mmc\asx_v3.asx" - "e:\data\videos\asx_v3.asx" +"..\..\data\mmc\test.3gp" - "e:\data\videos\test.3gp" +"..\..\data\mmc\multiple_streaming_link.ram" - "e:\data\videos\multiple_streaming_link.ram" +"..\..\data\mmc\asx_seek_v3.asx" - "e:\data\videos\asx_seek_v3.asx" diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playback_helper_api/tsrc/playbackhelpertest/inc/playbackhelpertest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playback_helper_api/tsrc/playbackhelpertest/inc/playbackhelpertest.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,189 @@ +/* +* Copyright (c) 2008 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 +* +*/ + +// Version : %version: 6 % + + + + +#ifndef PLAYBACKHELPERTEST_H +#define PLAYBACKHELPERTEST_H + +// INCLUDES +#include +#include +#include + +// MACROS +//#define ?macro ?macro_def +#define TEST_CLASS_VERSION_MAJOR 0 +#define TEST_CLASS_VERSION_MINOR 0 +#define TEST_CLASS_VERSION_BUILD 0 + +// Logging path +_LIT( KPlaybackHelperTestLogPath, "C:\\logs\\testframework\\PlaybackHelperTest\\" ); +// Log file +_LIT( KPlaybackHelperTestLogFile, "PlaybackHelperTest.txt" ); +_LIT( KPlaybackHelperTestLogFileWithTitle, "PlaybackHelperTest_[%S].txt" ); + + +#ifdef __WINSCW__ +_LIT( KPlaybackHelper_testPath, "\\logs\\testframework\\PlaybackHelperTest\\" ); +#else +_LIT( KPlaybackHelper_testPath, "e:\\logs\\testframework\\PlaybackHelperTest\\" ); +#endif + + +// FORWARD DECLARATIONS +class CMediaRecognizer; +class CStreamingLinkModel; +class CDevSoundIf; + +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// CLASS DECLARATION + +/** +* CPlaybackHelperTest test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(CPlaybackHelperTest) : public CScriptBase +{ + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CPlaybackHelperTest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CPlaybackHelperTest(); + + public: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + 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 ); + + protected: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + protected: // Functions from base classes + + /** + * From ?base_class ?member_description + */ + //?type ?member_function(); + + private: + + /** + * C++ default constructor. + */ + CPlaybackHelperTest( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // ?classname( const ?classname& ); + // Prohibit assigment operator if not deriving from CBase. + // ?classname& operator=( const ?classname& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + /** + * Method used to log version of test class + */ + void SendTestClassVersion(); + + /** + * Test methods are listed below. + */ + + /** + * Example test method. + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt IdentifyMediaTypeViaFileName( CStifItemParser& aItem ); + TInt IdentifyMediaTypeViaFileHandle( CStifItemParser& aItem ); + TInt MimeTypeViaFileName( CStifItemParser& aItem ); + TInt MimeTypeViaFileHandle( CStifItemParser& aItem ); + TInt IsValidStreamingPrefix( CStifItemParser& aItem ); + TInt IsValidUrlPrefix1( CStifItemParser& aItem ); + TInt IsValidUrlPrefix2( CStifItemParser& aItem ); + TInt FreeFilehandleForRecognizer(); + + TInt OpenLinkFile1( CStifItemParser& aItem ); + TInt OpenLinkFile2( CStifItemParser& aItem ); + TInt GetNextLink( CStifItemParser& aItem ); + TInt MaxLinkLength( CStifItemParser& aItem ); + TInt CreateNewLinkFile( CStifItemParser& aItem ); + TInt MultiLinksCount( CStifItemParser& aItem ); + TInt ResetLinkCount(); + TInt FreeFilehandleForLink(); + TInt OpenAsxLinkViaFileName( CStifItemParser& aItem ); + TInt OpenAsxLinkViaFileHandle( CStifItemParser& aItem ); + TInt GetNumberOfVolumeSteps(); + TInt IsSeekable( CStifItemParser& aItem ); + + private: // Data + CMediaRecognizer* iMediaRecognizer; + CStreamingLinkModel* iStreamingLinkModel; + CDevSoundIf* iDevSoundIf; +}; + +#endif // PLAYBACKHELPERTEST_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playback_helper_api/tsrc/playbackhelpertest/src/playbackhelpertest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playback_helper_api/tsrc/playbackhelpertest/src/playbackhelpertest.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,229 @@ +/* +* Copyright (c) 2008 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 +* +*/ + +// Version : %version: 4 % + + + + +// INCLUDE FILES +#include +#include +#include +#include +#include + +#include "playbackhelpertest.h" + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; + +// EXTERNAL FUNCTION PROTOTYPES +//extern ?external_function( ?arg_type,?arg_type ); + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// LOCAL CONSTANTS AND MACROS +//const ?type ?constant_var = ?constant; +//#define ?macro_name ?macro_def + +// MODULE DATA STRUCTURES +//enum ?declaration +//typedef ?declaration + +// LOCAL FUNCTION PROTOTYPES +//?type ?function_name( ?arg_type, ?arg_type ); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// ============================= LOCAL FUNCTIONS =================================================== + +// ------------------------------------------------------------------------------------------------- +// ?function_name ?description. +// ?description +// Returns: ?value_1: ?description +// ?value_n: ?description_line1 +// ?description_line2 +// ------------------------------------------------------------------------------------------------- +// +/* +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg) // ?description + { + + ?code // ?comment + + // ?comment + ?code + } +*/ + +// ============================ MEMBER FUNCTIONS =================================================== + +// ------------------------------------------------------------------------------------------------- +// CPlaybackHelperTest::CPlaybackHelperTest +// C++ default constructor can NOT contain any code, that +// might leave. +// ------------------------------------------------------------------------------------------------- +// +CPlaybackHelperTest::CPlaybackHelperTest( CTestModuleIf& aTestModuleIf ) +: CScriptBase( aTestModuleIf ) +{ +// iFileMan = NULL; +} + +// ------------------------------------------------------------------------------------------------- +// CPlaybackHelperTest::ConstructL +// Symbian 2nd phase constructor can leave. +// ------------------------------------------------------------------------------------------------- +// +void CPlaybackHelperTest::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(KPlaybackHelperTestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KPlaybackHelperTestLogFile); + } + + iLog = CStifLogger::NewL( KPlaybackHelperTestLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + iMediaRecognizer = CMediaRecognizer::NewL(); + iStreamingLinkModel = CStreamingLinkModel::NewL(); + iDevSoundIf = CDevSoundIf::NewL(); + + SendTestClassVersion(); +} + +// ------------------------------------------------------------------------------------------------- +// CPlaybackHelperTest::NewL +// Two-phased constructor. +// ------------------------------------------------------------------------------------------------- +// +CPlaybackHelperTest* CPlaybackHelperTest::NewL( CTestModuleIf& aTestModuleIf ) +{ + CPlaybackHelperTest* self = new (ELeave) CPlaybackHelperTest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + +} + +// Destructor +CPlaybackHelperTest::~CPlaybackHelperTest() +{ + if ( iMediaRecognizer ) + { + delete iMediaRecognizer; + iMediaRecognizer = NULL; + } + + if ( iStreamingLinkModel ) + { + delete iStreamingLinkModel; + iStreamingLinkModel = NULL; + } + + if ( iDevSoundIf ) + { + delete iDevSoundIf; + iDevSoundIf = NULL; + } + + REComSession::FinalClose(); + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + if ( iLog ) + { + delete iLog; + iLog = NULL; + } +} + +//-------------------------------------------------------------------------------------------------- +// CPlaybackHelperTest::SendTestClassVersion +// Method used to send version of test class +//-------------------------------------------------------------------------------------------------- +// +void CPlaybackHelperTest::SendTestClassVersion() +{ + TVersion moduleVersion; + moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; + moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; + moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; + + TFileName moduleName; + moduleName = _L("playbackhelpertest.dll"); + + TBool newVersionOfMethod = ETrue; + TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); +} + +// ========================== OTHER EXPORTED FUNCTIONS ============================================= + +// ------------------------------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ------------------------------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( CTestModuleIf& aTestModuleIf ) +{ + return ( CScriptBase* ) CPlaybackHelperTest::NewL( aTestModuleIf ); +} + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playback_helper_api/tsrc/playbackhelpertest/src/playbackhelpertestblocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playback_helper_api/tsrc/playbackhelpertest/src/playbackhelpertestblocks.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,877 @@ +/* +* Copyright (c) 2008 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 +* +*/ + +// Version : %version: 6 % + + + + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include +#include +#include +#include + +#include "playbackhelpertest.h" + +#ifdef __WINSCW__ +_LIT( KVideoTestPath, "c:\\data\\Videos\\" ); +#else +_LIT( KVideoTestPath, "e:\\data\\Videos\\" ); +#endif + +// ============================ MEMBER FUNCTIONS =================================================== + +// ------------------------------------------------------------------------------------------------- +// CPlaybackHelperTest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ------------------------------------------------------------------------------------------------- +// +void CPlaybackHelperTest::Delete() +{ +} + +// ------------------------------------------------------------------------------------------------- +// CPlaybackHelperTest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ------------------------------------------------------------------------------------------------- +// +TInt CPlaybackHelperTest::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. + //ADD NEW ENTRY HERE + // [test cases entries] - Do not remove + ENTRY( "IdentifyMediaTypeViaFileName", CPlaybackHelperTest::IdentifyMediaTypeViaFileName), + ENTRY( "IdentifyMediaTypeViaFileHandle", CPlaybackHelperTest::IdentifyMediaTypeViaFileHandle), + ENTRY( "MimeTypeViaFileName", CPlaybackHelperTest::MimeTypeViaFileName), + ENTRY( "MimeTypeViaFileHandle", CPlaybackHelperTest::MimeTypeViaFileHandle), + ENTRY( "IsValidStreamingPrefix", CPlaybackHelperTest::IsValidStreamingPrefix), + ENTRY( "IsValidUrlPrefix1", CPlaybackHelperTest::IsValidUrlPrefix1), + ENTRY( "IsValidUrlPrefix2", CPlaybackHelperTest::IsValidUrlPrefix2), + ENTRY( "FreeFilehandleForRecognizer", CPlaybackHelperTest::FreeFilehandleForRecognizer), + ENTRY( "OpenLinkFile1", CPlaybackHelperTest::OpenLinkFile1), + ENTRY( "OpenLinkFile2", CPlaybackHelperTest::OpenLinkFile2), + ENTRY( "GetNextLink", CPlaybackHelperTest::GetNextLink), + ENTRY( "MaxLinkLength", CPlaybackHelperTest::MaxLinkLength ), + ENTRY( "CreateNewLinkFile", CPlaybackHelperTest::CreateNewLinkFile), + ENTRY( "MultiLinksCount",CPlaybackHelperTest::MultiLinksCount), + ENTRY( "ResetLinkCount", CPlaybackHelperTest::ResetLinkCount), + ENTRY( "FreeFilehandleForLink", CPlaybackHelperTest::FreeFilehandleForLink), + ENTRY( "OpenAsxLinkViaFileName", CPlaybackHelperTest::OpenAsxLinkViaFileName), + ENTRY( "OpenAsxLinkViaFileHandle", CPlaybackHelperTest::OpenAsxLinkViaFileHandle), + ENTRY( "GetNumberOfVolumeSteps", CPlaybackHelperTest::GetNumberOfVolumeSteps), + ENTRY( "IsSeekable", CPlaybackHelperTest::IsSeekable) + + }; + const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); +} + +// +// ------------------------------------------------------------------------------------------------- +// CPlaybackHelperTest::IdentifyMediaTypeViaFileName +// ------------------------------------------------------------------------------------------------- +// +TInt CPlaybackHelperTest::IdentifyMediaTypeViaFileName( CStifItemParser& aItem ) +{ + iLog->Log(_L("CPlaybackHelperTest::IdentifyMediaTypeViaFileName")); + + TInt result = KErrNone; + TInt err = KErrNone; + + TInt expectedMediaType; + TInt mediaType = 0; + + aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); + + if ( ( err = aItem.GetNextInt( expectedMediaType ) ) == KErrNone ) + { + TPtrC filename; + + if ( ( err = aItem.GetNextString( filename ) ) == KErrNone ) + { + TBool pathNeeded; + + if ( ( err = aItem.GetNextInt( pathNeeded ) ) == KErrNone ) + { + TBuf<120> fullPath; + + if ( pathNeeded ) + { + fullPath.Append( KVideoTestPath ); + } + + fullPath.Append( filename ); + + TRAP( result, mediaType = iMediaRecognizer->IdentifyMediaTypeL( fullPath ) ); + + if ( result != KErrNone || expectedMediaType != mediaType ) + { + err = KErrGeneral; + } + } + } + } + + if ( err == KErrNone ) + { + err = result; + } + + return err; +} + +// +// ------------------------------------------------------------------------------------------------- +// CPlaybackHelperTest::IdentifyMediaTypeViaFileHandle +// ------------------------------------------------------------------------------------------------- +// +TInt CPlaybackHelperTest::IdentifyMediaTypeViaFileHandle( CStifItemParser& aItem ) +{ + iLog->Log(_L("CPlaybackHelperTest::IdentifyMediaTypeViaFileHandle")); + + TInt result = KErrNone; + TInt err = KErrNone; + TInt expectedMediaType; + TInt fileHandle32; + TInt mediaType = 0; + RFs fs; + + User::LeaveIfError( fs.Connect() ); + User::LeaveIfError( fs.ShareProtected() ); + + aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); + + if ( ( err = aItem.GetNextInt( fileHandle32 ) ) == KErrNone ) + { + +#ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + // + // set RFile as default if the 64-bit flag is not defined + // + fileHandle32 = ETrue; +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + + if ( ( err = aItem.GetNextInt( expectedMediaType ) ) == KErrNone ) + { + TPtrC filename; + + if ( ( err = aItem.GetNextString( filename ) ) == KErrNone ) + { + TBuf<120> fullPath; + + fullPath.Append( KVideoTestPath ); + fullPath.Append( filename ); + + if ( fileHandle32 ) + { + // + // using 32-bit file handle + // + RFile file; + err = file.Open( fs, + fullPath, + EFileShareAny | EFileStream | EFileRead ); + + if ( err == KErrNone ) + { + TRAP( result, mediaType = iMediaRecognizer->IdentifyMediaTypeL( fullPath, file ) ); + } + + file.Close(); + } +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + else + { + // + // using 64-bit file handle + // + RFile64 file64; + err = file64.Open( fs, + fullPath, + EFileShareAny | EFileStream | EFileRead ); + + if ( err == KErrNone ) + { + TRAP( result, mediaType = iMediaRecognizer->IdentifyMediaTypeL( fullPath, file64 ) ); + } + + file64.Close(); + } +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + + if ( result != KErrNone || expectedMediaType != mediaType ) + { + err = KErrGeneral; + } + } + } + } + + if ( err == KErrNone ) + { + err = result; + } + + fs.Close(); + + return err; +} + +// +// ------------------------------------------------------------------------------------------------- +// CPlaybackHelperTest::MimeTypeViaFileName +// ------------------------------------------------------------------------------------------------- +// +TInt CPlaybackHelperTest::MimeTypeViaFileName( CStifItemParser& aItem ) +{ + iLog->Log(_L("CPlaybackHelperTest::MimeTypeViaFileName")); + + TInt result = KErrNone; + TInt err = KErrNone; + TPtrC string; + TPtrC expectedMimetype; + TBuf<20> mimeType; + + aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); + + if ( ( err = aItem.GetNextString( expectedMimetype ) ) == KErrNone ) + { + TPtrC filename; + + if ( ( err = aItem.GetNextString( filename ) ) == KErrNone ) + { + TBuf<120> fullPath; + + fullPath.Append( KVideoTestPath ); + fullPath.Append( filename ); + + TRAP( result, mimeType = iMediaRecognizer->MimeTypeL( fullPath ) ); + + if ( result != KErrNone || mimeType.CompareF( expectedMimetype ) ) + { + err = KErrGeneral; + } + } + } + + if ( err == KErrNone ) + { + err = result; + } + + return err; +} + +// +// ------------------------------------------------------------------------------------------------- +// CPlaybackHelperTest::MimeTypeViaFileHandle +// ------------------------------------------------------------------------------------------------- +// +TInt CPlaybackHelperTest::MimeTypeViaFileHandle( CStifItemParser& aItem ) +{ + iLog->Log(_L("CPlaybackHelperTest::MimeTypeViaFileHandle")); + + TInt result = KErrNone; + TInt err = KErrNone; + TPtrC fileHandleType, expectedMimetype; + TInt fileHandle32; + TBuf<20> mimeType; + + RFs fs; + + aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); + + User::LeaveIfError( fs.Connect() ); + User::LeaveIfError( fs.ShareProtected() ); + + if ( ( err = aItem.GetNextInt( fileHandle32 ) ) == KErrNone ) + { + +#ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + // + // set RFile as default if the 64-bit flag is not defined + // + fileHandle32 = ETrue; +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + + if ( ( err = aItem.GetNextString( expectedMimetype ) ) == KErrNone ) + { + TPtrC filename; + + if ( ( err = aItem.GetNextString( filename ) ) == KErrNone ) + { + TBuf<120> fullPath; + + fullPath.Append( KVideoTestPath ); + fullPath.Append( filename ); + + if ( fileHandle32 ) + { + // + // using 32-bit file handle + // + RFile file; + err = file.Open( fs, + fullPath, + EFileShareAny | EFileStream | EFileRead ); + + if ( err == KErrNone ) + { + TRAP( result, mimeType = iMediaRecognizer->MimeTypeL( file ) ); + } + + file.Close(); + } +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + else + { + // + // using 64-bit file handle + // + RFile64 file64; + err = file64.Open( fs, + fullPath, + EFileShareAny | EFileStream | EFileRead ); + + if ( err == KErrNone ) + { + TRAP( result, mimeType = iMediaRecognizer->MimeTypeL( file64 ) ); + } + + file64.Close(); + } +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + + if ( result != KErrNone || mimeType.CompareF( expectedMimetype ) ) + { + err = KErrGeneral; + } + } + } + } + + if ( err == KErrNone ) + { + err = result; + } + + fs.Close(); + + return err; +} + +// +// ------------------------------------------------------------------------------------------------- +// CPlaybackHelperTest::IsValidStreamingPrefix +// ------------------------------------------------------------------------------------------------- +// +TInt CPlaybackHelperTest::IsValidStreamingPrefix( CStifItemParser& aItem ) +{ + iLog->Log(_L("CPlaybackHelperTest::IsValidStreamingPrefix")); + + TInt err = KErrNone; + TBool valid = EFalse; + + aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); + + if ( ( err = aItem.GetNextInt( valid ) ) == KErrNone ) + { + TPtrC string; + + if ( ( err = aItem.GetNextString( string ) ) == KErrNone ) + { + if ( iMediaRecognizer->IsValidStreamingPrefix( string ) != valid ) + { + err = KErrGeneral; + } + } + } + return err; +} + +// +// ------------------------------------------------------------------------------------------------- +// CPlaybackHelperTest::IsValidUrlPrefix1 +// ------------------------------------------------------------------------------------------------- +// +TInt CPlaybackHelperTest::IsValidUrlPrefix1( CStifItemParser& aItem ) +{ + iLog->Log(_L("CPlaybackHelperTest::IsValidUrlPrefix1")); + + TInt err = KErrNone; + TBool valid = EFalse; + + aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); + + if ( ( err = aItem.GetNextInt( valid ) ) == KErrNone ) + { + TPtrC string; + + if ( ( err = aItem.GetNextString( string ) ) == KErrNone ) + { + if ( iMediaRecognizer->IsValidUrlPrefix( string ) != valid ) + { + err = KErrGeneral; + } + } + } + return err; +} + +// +// ------------------------------------------------------------------------------------------------- +// CPlaybackHelperTest::IsValidUrlPrefix2 +// ------------------------------------------------------------------------------------------------- +// +TInt CPlaybackHelperTest::IsValidUrlPrefix2( CStifItemParser& aItem ) +{ + iLog->Log(_L("CPlaybackHelperTest::IsValidUrlPrefix2")); + + TInt err = KErrNone; + TBool valid = EFalse; + TPtrC16 stringDes16; + + aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); + + if ( ( err = aItem.GetNextInt( valid ) ) == KErrNone ) + { + if ( ( err = aItem.GetNextString( stringDes16 ) ) == KErrNone ) + { + HBufC8* string8 = NULL; + + TRAP( err, string8 = HBufC8::NewL( stringDes16.Length() ) ); + + if ( err == KErrNone ) + { + TPtr8 stringDes8( string8->Des() ); + stringDes8.Copy( stringDes16 ); + + if ( iMediaRecognizer->IsValidUrlPrefix( stringDes8 ) != valid ) + { + err = KErrGeneral; + } + } + + delete string8; + } + } + return err; +} + +// +// ------------------------------------------------------------------------------------------------- +// CPlaybackHelperTest::FreeFilehandleForRecognizer +// ------------------------------------------------------------------------------------------------- +// +TInt CPlaybackHelperTest::FreeFilehandleForRecognizer() +{ + iLog->Log(_L("CPlaybackHelperTest::FreeFilehandleForRecognizer")); + + TInt err = KErrNone; + + iMediaRecognizer->FreeFilehandle(); + + return err; +} + +// +// ------------------------------------------------------------------------------------------------- +// CPlaybackHelperTest::OpenLinkFile1 +// ------------------------------------------------------------------------------------------------- +// +TInt CPlaybackHelperTest::OpenLinkFile1( CStifItemParser& aItem ) +{ + iLog->Log(_L("CPlaybackHelperTest::OpenLinkFile1")); + + TInt err = KErrNone; + TInt result = KErrNone; + + aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); + + TPtrC filename; + + if ( ( err = aItem.GetNextString( filename ) ) == KErrNone ) + { + TBuf<120> fullPath; + + fullPath.Append( KVideoTestPath ); + fullPath.Append( filename ); + + TRAP( err, result = iStreamingLinkModel->OpenLinkFileL( fullPath ) ); + } + + if ( err == KErrNone ) + { + err = result; + } + + return err; +} + +// +// ------------------------------------------------------------------------------------------------- +// CPlaybackHelperTest::OpenLinkFile2 +// ------------------------------------------------------------------------------------------------- +// +TInt CPlaybackHelperTest::OpenLinkFile2( CStifItemParser& aItem ) +{ + iLog->Log(_L("CPlaybackHelperTest::OpenLinkFile2")); + + TInt err = KErrNone; + TInt result = KErrNone; + RFile file; + RFs fs; + + aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); + + TRAP( err, fs.Connect() ); + + TPtrC filename; + + if ( err == KErrNone && ( err = aItem.GetNextString( filename ) ) == KErrNone ) + { + TBuf<120> fullPath; + + fullPath.Append( KVideoTestPath ); + fullPath.Append( filename ); + + err = file.Open( fs, + fullPath, + EFileShareAny | EFileStream | EFileRead ); + + if ( err == KErrNone ) + { + TRAP( err, result = iStreamingLinkModel->OpenLinkFileL( file ) ); + } + } + + if ( err == KErrNone ) + { + err = result; + } + + file.Close(); + fs.Close(); + + return err; +} + +// +// ------------------------------------------------------------------------------------------------- +// CPlaybackHelperTest::GetNextLink +// ------------------------------------------------------------------------------------------------- +// +TInt CPlaybackHelperTest::GetNextLink( CStifItemParser& aItem ) +{ + iLog->Log(_L("CPlaybackHelperTest::GetNextLink")); + + TInt err = KErrNone; + TInt result = KErrNone; + + TBool local = ETrue; + + HBufC* nextLink = HBufC::NewLC( 100 ); + TPtr nextLinkDes = nextLink->Des(); + + HBufC* string = HBufC::NewLC( 100 ); + TPtr stringDes = string->Des(); + + TPtrC stringC; + + aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); + + if ( ( err = aItem.GetNextInt( local ) ) == KErrNone ) + { + TRAP( err, result = iStreamingLinkModel->GetNextLinkL( nextLinkDes, local ) ); + + if ( err == KErrNone && + result == KErrNone && + ( err = aItem.GetNextString( stringC ) ) == KErrNone ) + { + nextLinkDes.Copy(stringC); + + if ( !stringDes.CompareF( nextLinkDes ) ) + { + err = KErrNotFound; + } + } + else if ( result != KErrNone ) + { + err = result; + } + } + + CleanupStack::PopAndDestroy(2); //string, nextLink + return err; +} + +// +// ------------------------------------------------------------------------------------------------- +// CPlaybackHelperTest::MaxLinkLength +// ------------------------------------------------------------------------------------------------- +// +TInt CPlaybackHelperTest::MaxLinkLength( CStifItemParser& aItem ) +{ + iLog->Log(_L("CPlaybackHelperTest::MaxLinkLength")); + + TInt err = KErrNone; + TInt length = 0; + + aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); + + if ( ( err = aItem.GetNextInt( length ) ) == KErrNone ) + { + if ( iStreamingLinkModel->MaxLinkLength() != length ) + { + err = KErrGeneral; + } + } + + return err; +} + +// +// --------------------------------------------------------------------------- +// CPlaybackHelperTest::MultiLinksCount +// --------------------------------------------------------------------------- +// +TInt CPlaybackHelperTest::MultiLinksCount( CStifItemParser& aItem ) +{ + iLog->Log(_L("CPlaybackHelperTest::MultiLinksCount")); + + TInt err = KErrNone; + TInt cnt = 0; + + aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); + + if ( ( err = aItem.GetNextInt( cnt ) ) == KErrNone ) + { + if ( iStreamingLinkModel->MultiLinksCount() != cnt ) + { + err = KErrGeneral; + } + } + return err; +} + +// --------------------------------------------------------------------------- +// CPlaybackHelperTest::CreateNewLinkFile +// --------------------------------------------------------------------------- +// +TInt CPlaybackHelperTest::CreateNewLinkFile( CStifItemParser& aItem ) +{ + iLog->Log(_L("CPlaybackHelperTest::CreateNewLinkFileL")); + + TInt err = KErrNone; + TInt result = KErrNone; + + TPtrC filename; + TPtrC string; + + aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); + + if ( ( err = aItem.GetNextString( filename ) ) == KErrNone ) + { + TBuf<120> fullPath; + + fullPath.Append( KVideoTestPath ); + fullPath.Append( filename ); + + CDesCArrayFlat* linkArray = new (ELeave) CDesCArrayFlat(10); + + while ( ( err = aItem.GetNextString( string ) ) == KErrNone ) + { + linkArray->AppendL( string ); + } + + TRAP ( err, + result = iStreamingLinkModel->CreateNewLinkFileL( fullPath, linkArray, ETrue ) ); + + delete linkArray; + } + + if ( err == KErrNone ) + { + err = result; + } + + return err; +} + +// +// ------------------------------------------------------------------------------------------------- +// CPlaybackHelperTest::ResetLinkCount +// ------------------------------------------------------------------------------------------------- +// +TInt CPlaybackHelperTest::ResetLinkCount() +{ + iLog->Log(_L("CPlaybackHelperTest::ResetLinkCount")); + + TInt err = KErrNone; + + iStreamingLinkModel->ResetLinkCount(); + + return err; +} + +// +// ------------------------------------------------------------------------------------------------- +// CPlaybackHelperTest::FreeFilehandleForLink +// ------------------------------------------------------------------------------------------------- +// +TInt CPlaybackHelperTest::FreeFilehandleForLink() +{ + iLog->Log(_L("CPlaybackHelperTest::FreeFilehandleForLink")); + + TInt err = KErrNone; + + iStreamingLinkModel->FreeFilehandle(); + + return err; +} + +// ------------------------------------------------------------------------------------------------- +// CPlaybackHelperTest::OpenAsxLinkViaFileName +// ------------------------------------------------------------------------------------------------- +// +TInt CPlaybackHelperTest::OpenAsxLinkViaFileName( CStifItemParser& aItem ) +{ + iLog->Log(_L("CPlaybackHelperTest::OpenAsxLinkViaFileName")); + + TInt err = KErrNone; + TInt result = KErrNone; + + aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); + + TPtrC filename; + + if ( ( err = aItem.GetNextString( filename ) ) == KErrNone ) + { + TBuf<120> fullPath; + + fullPath.Append( KVideoTestPath ); + fullPath.Append( filename ); + + TRAP( err, result = iStreamingLinkModel->OpenAsxFileL( fullPath ) ); + } + + if ( err == KErrNone ) + { + err = result; + } + + return err; +} + +// +// ------------------------------------------------------------------------------------------------- +// CPlaybackHelperTest::OpenAsxLinkViaFileHandle +// ------------------------------------------------------------------------------------------------- +// +TInt CPlaybackHelperTest::OpenAsxLinkViaFileHandle( CStifItemParser& aItem ) +{ + iLog->Log(_L("CPlaybackHelperTest::OpenAsxLinkViaFileHandle")); + + TInt err = KErrNone; + TInt result = KErrNone; + RFile file; + RFs fs; + + aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); + + TRAP( err, fs.Connect() ); + + TPtrC filename; + + if ( err == KErrNone && ( err = aItem.GetNextString( filename ) ) == KErrNone ) + { + TBuf<120> fullPath; + + fullPath.Append( KVideoTestPath ); + fullPath.Append( filename ); + + err = file.Open( fs, + fullPath, + EFileShareAny | EFileStream | EFileRead ); + + if ( err == KErrNone ) + { + TRAP( err, result = iStreamingLinkModel->OpenAsxFileL( file ) ); + } + } + + if ( err == KErrNone ) + { + err = result; + } + + file.Close(); + fs.Close(); + + return err; +} + +// +// ------------------------------------------------------------------------------------------------- +// CPlaybackHelperTest::GetNumberOfVolumeSteps +// ------------------------------------------------------------------------------------------------- +// +TInt CPlaybackHelperTest::GetNumberOfVolumeSteps() +{ + iLog->Log(_L("CPlaybackHelperTest::GetNumberOfVolumeSteps")); + + TInt result = KErrNone; + + if ( iDevSoundIf->GetNumberOfVolumeSteps() < 10 ) + { + result = KErrArgument; + } + + return result; +} + +// ------------------------------------------------------------------------------------------------- +// CPlaybackHelperTest::IsSeekable +// ------------------------------------------------------------------------------------------------- +// +TInt CPlaybackHelperTest::IsSeekable( CStifItemParser& aItem ) +{ + iLog->Log(_L("CPlaybackHelperTest::IsSeekable")); + + TInt error = KErrNone; + TBool seekable; + + aItem.GetNextInt( seekable ); + + if ( seekable != iStreamingLinkModel->IsSeekable()) + { + error = KErrArgument; + } + + return error; +} +// [End of File] - Do not remove diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playlist_engine_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playlist_engine_api/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2007 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 +: playlist engine API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../inc/mpxplaylistengine.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxplaylistengine.h) +../inc/mpxplaylistenginedefs.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxplaylistenginedefs.h) +../inc/mpxplaylistenginedefs.hrh MW_LAYER_PLATFORM_EXPORT_PATH(mpxplaylistenginedefs.hrh) +../inc/mpxplaylistengineobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxplaylistengineobserver.h) +../inc/mpxplaylistplugin.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxplaylistplugin.h) +../inc/mpxplaylistplugin.inl MW_LAYER_PLATFORM_EXPORT_PATH(mpxplaylistplugin.inl) +../inc/mpxplaylistpluginhandler.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxplaylistpluginhandler.h) +../inc/mpxplaylistpluginhandler.inl MW_LAYER_PLATFORM_EXPORT_PATH(mpxplaylistpluginhandler.inl) +../inc/mpxplaylistpluginobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mpxplaylistpluginobserver.h) + \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playlist_engine_api/inc/mpxplaylistengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playlist_engine_api/inc/mpxplaylistengine.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,436 @@ +/* +* Copyright (c) 2006 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: Playlist engine +* +*/ + + + +#ifndef MPXPLAYLISTENGINE_H +#define MPXPLAYLISTENGINE_H + +#include +#include +#include + +#include "mpxplaylistenginedefs.h" +#include "mpxplaylistengineobserver.h" +#include "mpxplaylistpluginobserver.h" +#include "mpxplaylistpluginhandler.h" + +// FORWARD DECLARATIONS +class CMPXActiveTaskQueue; + +/** +* This is the main class in playlist engine and the entry point for a client. +* Each instance of a playlist engine is capable of handling one client. +* +* Once instantiated, CMPXPlaylistPluginHandler allows the client to select an +* appropriate playlist plugin to handle requests if +* necessary (e.g. ExternalizePlaylistL). A playlist plugin is loaded when selected +* by a client or in some cases, it's loaded when a request is issued for the plugin +* (e.g. InternalizePlaylistL). It's unloaded when the plugin is uninstalled from +* the system or when the client destroys its playlist engine. +* +* A client can access playlist plugin via Playlist Plugin Handler. However, it's +* recommended that a client direct any request for the plugin through the playlist +* engine and the client is notified of the completion through +* MMPXPlaylistEngineObserver for async operations. +* +* @lib mpxplaylistengine.lib +*/ +class CMPXPlaylistEngine : public CActive, + public MMPXPlaylistPluginObserver, + public MMPXTaskQueueObserver, + public MMPXPluginHandlerObserver + { +public: + + /** + * Two-phased constructor. + * + * @since S60 3.2.3 + * @param aObserver A playlist engine observer + * @return Constructed playlist engine object + */ + IMPORT_C static CMPXPlaylistEngine* NewL(MMPXPlaylistEngineObserver& aObserver); + + /** + * Destructor. + * + * @since S60 3.2.3 + */ + IMPORT_C ~CMPXPlaylistEngine(); + + /** + * returns a handle to playlist plugin handler which a client can use + * to select an appropriate plugin. + * + * Lifetime for this playlist plugin handler is the same as the playlist + * engine. + * + * @see CMPXPlaylistPluginHandler + * + * @since S60 3.2.3 + * @return reference to playlist plugin handler + */ + IMPORT_C CMPXPlaylistPluginHandler& PlaylistPluginHandler(); + + /** + * Determines whether the given media is a playlist from available + * playlist plugins currently in the system. The existence of the + * file is not part of this validation process. + * + * An unsupported playlist file is tested as EFalse. But after the + * appropriate playlist plugin has been installed, the client can + * retest it and ETrue will be returned. + * + * @since S60 3.2.3 + * @param aUri URI of the media to be tested + * @return ETrue if it's a playlist; otherwise EFalse. + */ + IMPORT_C TBool IsPlaylistL( const TDesC& aUri ); + + /** + * Internalize a playlist (async). Client is not required to select an + * appropriate plugin as one that is capable of handling the given + * media from its URI is automatically selected. Client can issue + * another request without having to wait for the completion of a request. + * When a request is complete, client is notified through + * MMPXPlaylistEngineObserver's HandlePlaylistL method. When an + * appropriate playlist plugin cannot be found to handle this request, + * KErrNotSupported is returned (through MMPXPlaylistEngineObserver's + * HandlePlaylistL). + * + * @see MMPXPlaylistEngineObserver + * + * @since S60 3.2.3 + * @param aPlaylistUri Uri of the playlist to be internalized. Client may + * free this parameter as soon as this request is successfully + * submitted. From the URI provided, an appropriate plugin is + * automatically selected for the client to internalize the playlist. + * @leave KErrNotFound File does not exist + */ + IMPORT_C void InternalizePlaylistL(const TDesC& aPlaylistUri); + + /** + * Internalize a playlist (async). Client is not required to select an + * appropriate plugin as one which is capable of handling the given + * file is selected automatically. Client can issue another request without + * having to wait for the completion of a request. When a request is complete, + * the client is notified through MMPXPlaylistEngineObserver's + * HandlePlaylistL method. When an appropriate playlist plugin cannot be + * found to handle this request, KErrNotSupported error is returned. + * + * @see MMPXPlaylistEngineObserver + * + * @since S60 3.2.3 + * @param aPlaylistFileHandle a file handle to the playlist to be + * internalized. Client may close this file handle as soon as + * this request is successfully submitted. + * + * From the fullname of the given file handle, an appropriate plugin is + * automatically selected for the client to internalize the playlist. + * @leave KErrArgument File handle does not exist + */ + IMPORT_C void InternalizePlaylistL(const RFile& aPlaylistFileHandle); + + /** + * Externalize a playlist (async). Before issuing this request, client must + * use CMPXPlaylistPluginHandler to query available plugins and select an + * appropriate plugin through CMPXPlaylistPluginHandler. A client + * can issue another request without having to wait for the completion of + * a request. When a request is complete, client is notified through + * MMPXPlaylistEngineObserver's HandlePlaylistL method. + * + * NOTE: + * 1) If the client does not select a plugin prior to issuing this request, + * this request may or may not fail depending on whether the client + * has loaded a plugin through previous operation, e.g. + * InternalizePlaylistL. When a plugin hasn't been selected, processing + * of the request will result in KErrNotFound error. + * 2) If the client has successfully selected a playlist plugin prior to + * issuing this request but the selected playlist plugin has since been + * uninstalled when this request is ready for processing, KErrNotSupported + * error will be returned through HandlePlaylistL. + * + * @see MMPXPlaylistEngineObserver + * + * @since S60 3.2.3 + * @param aPlaylist a playlist to be externalized. This media must contain + * the following attributes: + * + * KMPXMediaGeneralTitle + * KMPXMediaGeneralType: + * The value of this attribute must be EMPXItem + * KMPXMediaGeneralCategory: + * The value of this attribute must be EMPXPlaylist + * KMPXMediaArrayContents + * KMPXMediaArrayCount + * + * KErrArgument is returned if client fails to comply with any of + * the above. + * + * Each media item in the playlist must to contain the following + * attributes: + * + * KMPXMediaGeneralType: + * This contains the value of EMPXItem + * KMPXMediaGeneralCategory: + * This contains the value of EMPXSong + * + * Client is recommended to call CMPXPlaylistPlugin::RequiredAttributes + * before making a request to export the playlist and provide the rest + * of attributes required for each media item in the playlist. If client + * is unable to provide all of those attributes, client MUST at least + * provide the URI of the media item. + * + * NOTE: It's recommended that client deletes this playlist as soon + * as this method returns to save memory consumption as + * playlistengine will have made a copy of the playlist and + * stored it in the task queue. + * + * @param aFilePath file path for the playlist to be created, e.g. + * e:\playlists\. This must be a valid path. Leaves with + * KErrPathNotFound if the given path is invalid. + * @leave KErrArgument Playlist does not contain expected attribute + * @leave KErrArgument Media is not a Playlist + * @leave KErrPathNotFound File path does not exist + * @leave KErrNotFound Plugin has not been selected + */ + IMPORT_C void ExternalizePlaylistL( + const CMPXMedia& aPlaylist, + const TDesC& aFilePath); + + /** + * Cancel current request, if any, and all other outstanding requests. Client + * will be notified through MMPXPlaylistEngineObserver's HandlePlaylistL if + * there is a current request being cancelled. + * + * @since S60 3.2.3 + */ + IMPORT_C void CancelRequests(); + +private: + + /** + * C++ constructor. + * + * @since S60 3.2.3 + * @param aObserver observer + */ + CMPXPlaylistEngine(MMPXPlaylistEngineObserver& aObserver); + + /** + * 2nd phase contructor. + * + * @since S60 3.2.3 + */ + void ConstructL(); + + /** + * From MMPXPlaylistPluginObserver. + * Callback from a plugin for an InternalizePlaylistL request, in the + * task queue, which is currently being processed. + * + * @since S60 3.2.3 + * @param aPlaylist a list of media items parsed from the playlist file + * @param aError error code + * @param aCompleted a flag that indicates if there will be + * subsequent callback for the same playlist. EFalse if not + * all the results have been sent back; there will be + * subsequent callbacks. + */ + void HandlePlaylistL(CMPXMedia* aPlaylist, + const TInt aError, + const TBool aCompleted); + + /** + * From MMPXPlaylistPluginObserver. + * Callback from a plugin for an ExternalizePlaylistL request, in the + * task queue, which is currently being processed. + * + * @since S60 3.2.3 + * @param aPlaylistUri URI for the playlist which has been externalized + * @param aError error code + */ + void HandlePlaylistL(const TDesC& aPlaylistUri, + const TInt aError); + + /** + * From CActive. + * Handles an active object's request completion event. + * + * @since S60 3.2.3 + */ + void RunL(); + + /** + * From CActive. + * Implements cancellation of an outstanding request. + * + * @since S60 3.2.3 + */ + void DoCancel(); + + /** + * From MMPXTaskQueueObserver. + * Execute a task. + * + * @since S60 3.2.3 + * @param aTask task number + * @param aParamData parameter + * @param aPtrData any object + * @param aBuf, buffer containing externalized parameters for the task. + * @param aCallback call back function pointer + * @param aCObject1 object 1 owned by task queue + * @param aCObject2 object 2 owned by task queue + */ + void ExecuteTask(TInt aTask, + TInt aParamData, + TAny* aPtrData, + const CBufBase& aBuf, + TAny* aCallback, + CBase* aCObject1, + CBase* aCObject2); + + /** + * Handle a task error. + * + * @see MMPXTaskQueueObserver + * + * @since S60 3.2.3 + */ + void HandleTaskError(TInt aTask, + TAny* aPtrData, + TAny* aCallback, + TInt aError); + + /* + * Handle event from plugin. + * @see MMPXPluginHandlerObserver + * + * @since S60 3.2.3 + */ + void HandlePluginHandlerEvent(TPluginHandlerEvents aEvent, const TUid& aPluginUid, + TBool aLoaded, TInt aData); + + /** + * Execute a task. + * + * @since S60 3.2.3 + * @param aTask task number + * @param aBuf externalized parameters for the task + * @panic KErrInUse, if not active + * @leave KErrNotSupported Plugin is not found + */ + void ExecuteTaskL(TInt aTask, const CBufBase& aBuf); + + /** + * Handles a leave occurring in the request completion event handler + * ExecuteTaskL. + * + * @since S60 3.2.3 + * @param aTask task number + * @param aError error code + */ + void HandleExecuteTaskError(TInt aTask, TInt aError); + + /** + * Handles a leave occurring in the request completion event handler + * ExecuteTaskL. + * + * @since S60 3.2.3 + * @param aTask task number + * @param aError error code + */ + void HandleExecuteTaskErrorL(TInt aTask, TInt aError); + + /** + * Cleanup after processing the current task. + * + * @since S60 3.2.3 + */ + void Cleanup(); + + /** + * Generate to character sets based on locale. + * + * @since S60 3.2.3 + */ + void GenerateTopCharacterSetsL(); + + /** + * Select character set(s) for the specified language. + * + * @since S60 3.2.3 + * @param aLanguage language to select character sets for + */ + void SelectCharacterSetsForLanguageL(TInt aLanguage); + + /** + * reads the character set for the specified resource. + * + * @since S60 3.2.3 + * @param aResourceId id of the resource to read from the resource file + */ + void ReadCharacterSetResourceL(TInt aResourceId); + + /** + * Determine whether the given character set is specified + * as top character set. + * + * @since S60 3.2.3 + * @param aCharacterSetId id of the character set to be tested + */ + TBool IsInTopCharacterSet(TUint aCharacterSetId); + +private: + + // playlist commands + enum TMPXPlaylistCmd + { + EInternalizePlaylist, + EExternalizePlaylist + }; + +private: + + RFs iFs; + + MMPXPlaylistEngineObserver& iObserver; + + CMPXPlaylistPluginHandler* iPluginHandler; + + CMPXActiveTaskQueue* iTaskQueue; + + // Character set for unicode conversion + CArrayFix* iCharacterSet; + // Most likely character set for unicode conversion + CArrayFix* iTopCharacterSet; + + RResourceFile iRscFile; + + // + // parameters for the task currently being processed to ensure + // they are available for the duration of the task processing. + // they are freed after each task completion. + // + HBufC* iPlaylistUri; + HBufC* iFilePath; + CMPXMedia* iPlaylist; + + }; + +#endif // MPXPLAYLISTENGINE_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playlist_engine_api/inc/mpxplaylistenginedefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playlist_engine_api/inc/mpxplaylistenginedefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2006 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 definitions for the playlist engine +* +*/ + + +#ifndef MPXPLAYLISTENGINEDEFS_H +#define MPXPLAYLISTENGINEDEFS_H + +// playlist types +enum TMPXPlaylistType + { + EMPXPlaylistTypeUnknown = 0x00, + EMPXPlaylistTypeM3U = 0x01, + EMPXPlaylistTypePLA = 0x02, + EMPXPlaylistTypeMPV = 0x04, + EMPXPlaylistTypeXSPF = 0x08, + EMPXPlaylistTypeXML = 0x10 + }; + +#endif // MPXPLAYLISTENGINEDEFS_H + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playlist_engine_api/inc/mpxplaylistenginedefs.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playlist_engine_api/inc/mpxplaylistenginedefs.hrh Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2006 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 definitions +* +*/ + + +#ifndef MPXPLAYLISTENGINEDEFS_HRH +#define MPXPLAYLISTENGINEDEFS_HRH + +#define KMPXPlaylistEngineDllUid 0x101FFC23 + +#define KMPXPlaylistInterfaceUid 0x101FFC20 + +#define KMPXPlaylistRecognizerDllUid 0x101FFC24 +#define KMPXPlaylistRecognizerImplUid 0x101FFC25 + +#endif // MPXPLAYLISTENGINEDEFS_HRH + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playlist_engine_api/inc/mpxplaylistengineobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playlist_engine_api/inc/mpxplaylistengineobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2006 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: Playlist engine observer +* +*/ + + +#ifndef MMPXPLAYLISTENGINEOBSERVER_H +#define MMPXPLAYLISTENGINEOBSERVER_H + + +#include + +/** +* A playlist engine client must implement this +* observer interface for InternalizePlaylistL and/or ExternalizePlaylistL callback. +* +* @lib mpxplaylistengine.lib +*/ +NONSHARABLE_CLASS(MMPXPlaylistEngineObserver) + { + public: + + /** + * Callback when Internalize Playlist request is completed. This operation cannot + * be a long running task as this may be invoked from the RunL of a plugin. + * + * Parameters are only available for the duration of this method. If a client + * requires them to be available beyond the completion of this method, a copy + * should be made. + * + * @param aPlaylist a playlist parsed from the playlist file. Depending on the + * content of the playlist, not all info for a media will be available; + * only the available info from playlist file is populated, e.g. for + * m3u playlists, the only available information is URI of the media and + * its title if it's in extended format. + * + * This media will contain the following attributes if no error has occured: + * + * EMPXMediaGeneralUri for the playlist + * EMPXMediaGeneralType, which has a value of EMPXItem + * EMPXMediaGeneralCategory, which has a value of EMPXPlaylist + * EMPXMediaArrayContents + * EMPXMediaArrayCount + * + * When an error occurs, this is NULL. + * + * Client takes over the ownership of this CMPXMedia object. + * + * @param aError error code + * + * @param aCompleted a flag that indicates if internalize playlist command has + * been fully processed. EFalse if not. In this case, there will be + * subsequent calls to HandlePlaylistL for the same playlist with the + * segmented results. ETrue if there are no more results to be sent to + * the observer. + */ + virtual void HandlePlaylistL(CMPXMedia* aPlaylist, + const TInt aError, + const TBool aCompleted) = 0; + + /** + * Callback when Externalize Playlist request is completed. This operation cannot + * be long running task as this may be in invoked from the RunL of a plugin. + * + * Parameters are only available for the duration of this method. If a client + * requires them to be available beyond the completion of this method, a copy + * should be made. + * + * @param aPlaylistUri URI for the playlist which has been externalized. + * @param aError error code + */ + virtual void HandlePlaylistL(const TDesC& aPlaylistUri, + const TInt aError) = 0; + }; + +#endif // MMPXPLAYLISTPLUGINOBSERVER_H + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playlist_engine_api/inc/mpxplaylistplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playlist_engine_api/inc/mpxplaylistplugin.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,175 @@ +/* +* Copyright (c) 2006 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: Playlist plugin interface +* +*/ + + +#ifndef MPXPLAYLISTPLUGIN_H +#define MPXPLAYLISTPLUGIN_H + +#include +#include +#include + +// FORWARD DECLARATIONS +class MMPXPlaylistPluginObserver; + +/** +* CMPXPlaylistPlugin: Defines the playlist plugin interface. +* +* A playlist plugin is instantiated and owned by CMPXPlaylistPluginHandler. +* But the client of the services a playlist plugin provides is +* CMPXPlaylistEngine. +* +*/ +NONSHARABLE_CLASS(CMPXPlaylistPlugin): public CBase + { + +public: + + /** + * Factory method to instantiate a playlist plugin with the matching UID + * + * @param aUid uid of interface implementation + * @param aObserver a playlist plugin observer + * @param aFs a handle to file session + * @param aTopCharacterSet top character set for the current locale + * @param aAvailableCharacterSet available character set in the sytem + * @return constructed object + */ + inline static CMPXPlaylistPlugin* NewL( + TUid aUid, + MMPXPlaylistPluginObserver& aObserver, + RFs& aFs, + const CArrayFix& aTopCharacterSet, + const CArrayFix& aAvailableCharacterSet); + + /** + * Destructor + */ + virtual ~CMPXPlaylistPlugin(); + +public: + + /** + * Internalize a playlist. A MMPXPlaylistPluginObserver::HandlePlaylistL + * callback will be generated on completion. + * + * Parameters are guaranteed by the caller (i.e. CMPXPlaylistEngine) to + * exist until plugin completes this request. + * + * @param aStatus caller's request status + * @param aPlaylistUri URI of the playlist to be internalized + */ + virtual void InternalizePlaylistL( + TRequestStatus& aStatus, + const TDesC& aPlaylistUri) = 0; + + /** + * Externalize a playlist. a MMPXPlaylistPluginObserver::HandlePlaylistL + * callback will be generated on completion. + * + * Parameters are guaranteed by the caller (i.e. CMPXPlaylistEngine) to + * exist until plugin completes this request. + * + * @param aStatus caller's request status + * @param aPlaylist a playlist to be externalized. This media contains + * the following attributes: + * + * KMPXMediaGeneralTitle + * KMPXMediaGeneralType: + * This contains the value of EMPXItem + * KMPXMediaGeneralCategory: + * This contains the value of EMPXPlaylist + * KMPXMediaArrayContents + * KMPXMediaArrayCount + * + * Each media item in the playlist is guaranteed to contain the + * following attributes: + * + * KMPXMediaGeneralType: + * This contains the value of EMPXItem + * KMPXMediaGeneralCategory: + * This contains the value of EMPXSong + * + * The rest of attributes may or may not be present. Client + * is recommended to call RequiredAttributes before making + * a request to export the playlist and provide attributes + * required for each media item in the playlist. However, + * not every client will be able to comply and supply the + * required attributes, specifically client may store the + * information about the media item in a memory card and + * memory card has been removed from the device. Each + * playlist plugin MUST be capable of handling the media + * item containing only the URI in addition to its type and + * category. + * + * @param aFilePath File path for where the playlist should be placed + */ + virtual void ExternalizePlaylistL( + TRequestStatus& aStatus, + const CMPXMedia& aPlaylist, + const TDesC& aFilePath) = 0; + + /** + * Required attributes for the media items in the playlist in order to + * externalize them to a playlist. Client is recommended to call this + * method and provide the required attributes for each media item in + * the playlist before externalizing the playlist. + * + * @return an array of attributes required in order to externalize + * a playlist media into a playlist file. + */ + virtual const TArray RequiredAttributes() const = 0; + + /** + * Optional attributes for the media items in the playlist for externalizing + * them to a playlist. + * + * @return an array of attributes which are optional when externalizing + * a playlist media into a playlist file + */ + virtual const TArray OptionalAttributes() const = 0; + + /** + * Returns the file extension the plugin handles + * + * @return file extension which includes the period. + */ + virtual const TDesC& FileExtension() const = 0; + + /** + * Cancel request + */ + virtual void Cancel() = 0; + +protected: + + MMPXPlaylistPluginObserver* iObserver; // not owned + RFs* iFs; // not owned + const CArrayFix* iTopCharacterSet; // not owned + const CArrayFix* iAvailableCharacterSet;// not owned + +private: + + // identifies the actual plugin instance + TUid iDtorKey; + }; + +#include "mpxplaylistplugin.inl" + +#endif // MPXPLAYLISTPLUGIN_H + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playlist_engine_api/inc/mpxplaylistplugin.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playlist_engine_api/inc/mpxplaylistplugin.inl Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2006 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: Inline implementation of playlist plugin constructor/destructor +* +*/ + + +// ---------------------------------------------------------------------------- +// Factory method to instantiate a playlist plugin with the matching UID +// ---------------------------------------------------------------------------- +// +inline CMPXPlaylistPlugin* CMPXPlaylistPlugin::NewL( + TUid aUid, + MMPXPlaylistPluginObserver& aObserver, + RFs& aFs, + const CArrayFix& aTopCharacterSet, + const CArrayFix& aAvailableCharacterSet) + { + CMPXPlaylistPlugin* self = + reinterpret_cast( + REComSession::CreateImplementationL( + aUid, + _FOFF(CMPXPlaylistPlugin,iDtorKey))); + + self->iObserver = &aObserver; + self->iFs = &aFs; + self->iTopCharacterSet = &aTopCharacterSet; + self->iAvailableCharacterSet = &aAvailableCharacterSet; + + return self; + } + +// ---------------------------------------------------------------------------- +// plugin destruction +// ---------------------------------------------------------------------------- +// +inline CMPXPlaylistPlugin::~CMPXPlaylistPlugin() + { + REComSession::DestroyedImplementation(iDtorKey); + } + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playlist_engine_api/inc/mpxplaylistpluginhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playlist_engine_api/inc/mpxplaylistpluginhandler.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,292 @@ +/* +* Copyright (c) 2006 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: playlist plugin handler +* +*/ + + +#ifndef MPXPLAYLISTPLUGINHANDLER_H +#define MPXPLAYLISTPLUGINHANDLER_H + +#include +#include +#include "mpxplaylistenginedefs.h" +#include "mpxplaylistplugin.h" + +/** +* CMPXPlaylistPluginHandler is instantiated and owned by CMPXPlaylistEngine. +* It provides playlist plugin selection APIs for the external client and +* the internal client (i.e. CMPXPlaylistEngine) and manages loading and +* unloading of playlist plugins. A plugin is loaded when selected and +* unloaded when the plugin has been uninstalled or when CMPXPlaylistEngine +* is destroyed (CMPXPlaylistEngine destroys CMPXPlaylistPluginHandler when +* itself is destroyed). +* +* @lib mpxplaylistengine.lib +*/ +class CMPXPlaylistPluginHandler : public CMPXPluginHandlerBase + { +public: + + /** + * Two-phased constructor. + * + * @since S60 3.2.3 + * @param aPluginObserver playlist plugin observer + * @param aObserver plugin handler observer + * @param aFs file session handle + * @param aTopCharacterSet top character set for the locale + * @param aAvailableCharacterSet available character set in the system + * @return Constructed object + */ + IMPORT_C static CMPXPlaylistPluginHandler* NewL( + MMPXPlaylistPluginObserver& aPluginObserver, + MMPXPluginHandlerObserver& aObserver, + RFs& aFs, + const CArrayFix& aTopCharacterSet, + const CArrayFix& aAvailableCharacterSet); + + /** + * Destructor. + * + * @since S60 3.2.3 + */ + ~CMPXPlaylistPluginHandler(); + + /** + * Returns currently loaded plug-in UID, or KNullUid if none loaded. + * + * @since S60 3.2.3 + * @return UID of the plugin + */ + inline TUid PluginUid() const; + + /** + * Returns currently loaded plug-in type or EMPXPlaylistTypeUnknown if + * no plugin is loaded. + * + * @since S60 3.2.3 + * @return plugin type Refer to TMPXPlaylistType for the representation + * of each bit of the return value + */ + inline TUint32 PluginType() const; + + /** + * Returns display name for current plug-in or KNullDesC if no plugin + * is loaded. + * + * @since S60 3.2.3 + * @return plugin name. + */ + inline const TDesC& PluginName() const; + + /** + * Is a plug-in currently loaded. + * + * @since S60 3.2.3 + * @return ETrue if a plugin is loaded; EFalse otherwise. + */ + inline TBool PluginFound() const; + + /** + * Returns currently loaded plug-in, or NULL if none. CMPXPlaylistPluginHandler + * is responsible for the memory management of the return playlist plugin + * object. + * + * @since S60 3.2.3 + * @return plugin object interface + */ + inline CMPXPlaylistPlugin* Plugin() const; + + /** + * Selects a plug-in appropriate for a Uri and data type; may already be loaded. + * If the selected plug-in has not been loaded before, one is instantiated. + * + * If successful, information related to the currently loaded plugin will reflect + * this selected plug-in. Leaves with KErrNotSupported if unable to find a + * suitable plugin. + * + * @since S60 3.2.3 + * @param aUri URI of the song + * @param aDataType data type. KNullDesC8 if this parameter is not to be used + * for selection. + */ + IMPORT_C void SelectPlaylistPluginL( + const TDesC& aUri, + const TDesC8& aDataType); + + /** + * Selects a plug-in appropriate for a file; may already be loaded. If the + * selected plug-in has not been loaded before, one is instantiated. + * + * If successful, information related to currently loaded plugin will reflect + * this selected plug-in. Leaves with KErrNotSupported if unable to find a + * suitable plugin. + * + * @since S60 3.2.3 + * @param aFile file handle + */ + IMPORT_C void SelectPlaylistPluginL(const RFile& aFile); + + /** + * Selects a plugin appropriate for the plugin type; may already be loaded. + * If the selected plugin has not been loaded before, one is instantiated. + * + * If successful, information related to currently loaded plugin will reflect + * this selected plug-in. Leaves with KErrNotSupported if unable to find a + * suitable plugin. + * + * This is the recommended method for the client to select a plugin prior + * to issuing an ExternalizePlaylist request. + * + * @since S60 3.2.3 + * @param aPluginType A plugin type, possible values are defined in + * TMPXPlaylistType. + */ + IMPORT_C void SelectPlaylistPluginL(TUint32 aPluginType); + + /** + * Selects a plugin with the specified display name; may already be loaded. + * If the selected plugin has not been loaded before, one is instantiated. + * + * If successful, information related to currently loaded plugin will reflect + * this selected plug-in. Leaves with KErrNotSupported if unable to find + * a suitable plugin. + * + * This is not the recommended method for the client to select a plugin + * prior to issuing an ExternalizePlaylist request. The recommended + * method is through a plugin type. + * + * @since S60 3.2.3 + * @param aPluginName The name of the plugin to be selected. + */ + IMPORT_C void SelectPlaylistPluginL(const TDesC& aPluginName); + + /** + * Selects a plug-in with UID aUid, or leaves with KErrNotSupported if not + * found. If the selected plugin has not been loaded before, one is + * instantiated. + * + * If successful, information related to currently loaded plugin will reflect + * this selected plug-in. Leaves with KErrNotSupported if unable to find + * the specified plugin. + * + * @since S60 3.2.3 + * @param aUid UID of the plugin + */ + IMPORT_C void SelectPlaylistPluginL(const TUid& aUid); + +private: + + /** + * C++ constructor. + * + * @since S60 3.2.3 + * @param aPluginObserver playlist plugin observer + * @param aObserver plugin handler observer + * @param aFs file session handle + * @param aTopCharacterSet top character set for the locale + * @param aAvailableCharacterSet available character set in the system + */ + CMPXPlaylistPluginHandler( + MMPXPlaylistPluginObserver& aPluginObserver, + MMPXPluginHandlerObserver& aObserver, + RFs& aFs, + const CArrayFix& aTopCharacterSet, + const CArrayFix& aAvailableCharacterSet); + + /** + * 2nd phase contructor. + * + * @since S60 3.2.3 + */ + void ConstructL(); + + /** + * Creates a plugin. If already loaded, returns a reference without creating + * another instance of the plugin. + * + * @since S60 3.2.3 + * @return plugin object interface + * @leave The function leaves with one of the system error codes, + */ + CMPXPlaylistPlugin* CreatePlaylistPluginL(const TUid& aUid); + + /** + * From CMPXPluginHandlerBase. + * Resolves plugin. + * + * @since S60 3.2.3 + */ + void ResolvePluginL(); + + /** + * Verify the specified plugin is loaded. + * + * @see CMPXPluginHandlerBase + * + * @since S60 3.2.3 + */ + TBool IsPluginLoaded(const TUid& aPluginUid); + + /** + * Load the specified plugin. + * @see CMPXPluginHandlerBase + * + * @since S60 3.2.3 + */ + void LoadPluginL(const TUid& aPluginUid); + + /** + * Unload the specified plugin. + * @see CMPXPluginHandlerBase + * + * @since S60 3.2.3 + */ + void UnloadPlugin(const TUid& aPluginUid); + + /** + * Unloads a plugin by index. + * @since S60 3.2.3 + * @param aIndex index of the plugin to unload + * + */ + void UnloadPlugin(TInt aIndex); + +private: + + MMPXPlaylistPluginObserver& iPluginObserver; + RFs& iFs; + const CArrayFix& iTopCharacterSet; + const CArrayFix& iAvailableCharacterSet; + + // + // Loaded. The index must correspond in these arrays + // + RPointerArray iLoadedPlugins; + RArray iLoadedPluginsUids; + + // + // Chosen + // + CMPXPlaylistPlugin* iPlugin; // ownership belongs to iLoadedPlugins + TUid iPluginUid; + TUint32 iPluginType; + HBufC* iDisplayName; + + }; + +#include "mpxplaylistpluginhandler.inl" + +#endif // MPXPLAYLISTPLUGINHANDLER_H diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playlist_engine_api/inc/mpxplaylistpluginhandler.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playlist_engine_api/inc/mpxplaylistpluginhandler.inl Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2006 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: Inline implementation of playlist plugin handler +* +*/ + + +// ---------------------------------------------------------------------------- +// Return current playlist plugin id +// ---------------------------------------------------------------------------- +// +inline TUid CMPXPlaylistPluginHandler::PluginUid() const + { + return iPluginUid; + } + +// ---------------------------------------------------------------------------- +// Return current playlist plugin type +// ---------------------------------------------------------------------------- +// +inline TUint32 CMPXPlaylistPluginHandler::PluginType() const + { + return iPluginType; + } + +// ---------------------------------------------------------------------------- +// Return playlist plugin name +// ---------------------------------------------------------------------------- +// +inline const TDesC& CMPXPlaylistPluginHandler::PluginName() const + { + return iDisplayName ? static_cast( *iDisplayName ) : KNullDesC; + } + +// ---------------------------------------------------------------------------- +// Check if the playlist plugin found or not +// ---------------------------------------------------------------------------- +// +inline TBool CMPXPlaylistPluginHandler::PluginFound() const + { + return iPlugin!=NULL; + } + +// ---------------------------------------------------------------------------- +// Return current playlist plugin +// ---------------------------------------------------------------------------- +// +inline CMPXPlaylistPlugin* CMPXPlaylistPluginHandler::Plugin() const + { + return iPlugin; + } + + + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playlist_engine_api/inc/mpxplaylistpluginobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playlist_engine_api/inc/mpxplaylistpluginobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2006 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: Playlist plugin observer +* +*/ + + +#ifndef MMPXPLAYLISTPLUGINOBSERVER_H +#define MMPXPLAYLISTPLUGINOBSERVER_H + + +#include + +/** +* This interface is not visible to the playlist +* engine client. This observer interface is used internally by a plugin for request +* completion notification. +* +* CMPXPlaylistEngine implements this interface. When a plugin completes a +* InternalizePlaylistL or ExternalizePlaylistL request, the appropriate +* HandlePlaylistL is called by the plugin to notify CMPXPlaylistEngine. +* +* @lib mpxplaylistengine.lib +*/ +NONSHARABLE_CLASS(MMPXPlaylistPluginObserver) + { + public: + + /** + * Callback for InternalizePlaylistL. + * + * @since S60 3.2.3 + * @param aPlaylist a list of media parsed from the playlist file. NULL + * if there is an error. client takes ownership of this object. + * @param aError error code + * @param aCompleted a flag that indicates if internalize playlist command has + * been fully processed. EFalse if not. In this case, there will be + * subsequent calls to HandlePlaylistL for the same playlist with the + * segmented results.ETrue if there are no more results to be sent to + * the observer. + */ + virtual void HandlePlaylistL(CMPXMedia* aPlaylist, + const TInt aError, + const TBool aCompleted) = 0; + + /** + * Callback for ExternalizePlaylistL. + * + * @since S60 3.2.3 + * @param aPlaylistUri URI for the playlist which has been externalized + * @param aError error code + */ + virtual void HandlePlaylistL(const TDesC& aPlaylistUri, + const TInt aError) = 0; + }; + +#endif // MMPXPLAYLISTPLUGINOBSERVER_H + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playlist_engine_api/playlist_engine_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playlist_engine_api/playlist_engine_api.metaxml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,15 @@ + + +Playlist Engine API +Provides engine APIs for the playlist framework +c++ +mmappcomponents + + + + + +no +no + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playlist_engine_api/tsrc/conf/playlistenginetest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playlist_engine_api/tsrc/conf/playlistenginetest.cfg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,154 @@ +[Test] +title Example +create playlistenginetest foobar +foobar Example pa ra me ters +delete foobar +[Endtest] + + +[Test] +title 1: CMPXPlaylistEngineCreate +create playlistenginetest playlist +playlist CMPXPlaylistEngineCreate +playlist CMPXPlaylistEngineDestructor +pause 1000 +delete playlist +[Endtest] + + +[Test] +title 2: CMPXPlaylistEngineDestructor +create playlistenginetest playlist +playlist CMPXPlaylistEngineCreate +playlist CMPXPlaylistEngineDestructor +pause 1000 +delete playlist +[Endtest] + +[Test] +title 3: CMPXPlaylistEnginePlaylistPluginHandler +create playlistenginetest playlist +playlist CMPXPlaylistEngineCreate +playlist CMPXPlaylistEnginePlaylistPluginHandler +playlist CMPXPlaylistEngineDestructor +pause 1000 +delete playlist +[Endtest] + +[Test] +title 4: CMPXPlaylistEngineIsPlaylistL +create playlistenginetest playlist +playlist CMPXPlaylistEngineCreate +playlist CMPXPlaylistEngineIsPlaylistL mpxtest1.mp3 +playlist CMPXPlaylistEngineDestructor +pause 1000 +delete playlist +[Endtest] + + +[Test] +title 5: CMPXPlaylistEngineInternalizePlaylistL +create playlistenginetest playlist +playlist CMPXPlaylistEngineCreate +playlist CMPXPlaylistEngineInternalizePlaylistL mpxtestplaylist.m3u +playlist CMPXPlaylistEngineDestructor +pause 1000 +delete playlist +[Endtest] + +[Test] +title 6: CMPXPlaylistEngineInternalizePlaylistLRFile +create playlistenginetest playlist +playlist CMPXPlaylistEngineCreate +playlist CMPXPlaylistEngineInternalizePlaylistLRFile mpxtestplaylist.m3u +playlist CMPXPlaylistEngineCancelRequests +playlist CMPXPlaylistEngineDestructor +pause 1000 +delete playlist +[Endtest] + +[Test] +title 7: CMPXPlaylistEngineExternalizePlaylistL +create playlistenginetest playlist +playlist CMPXPlaylistEngineCreate +playlist CMPXPlaylistEngineExternalizePlaylistL mpxtestplaylist.m3u +playlist CMPXPlaylistEngineCancelRequests +playlist CMPXPlaylistEngineDestructor +pause 1000 +delete playlist +[Endtest] + +[Test] +title 8: CMPXPlaylistEngineCancelRequests +create playlistenginetest playlist +playlist CMPXPlaylistEngineCreate +playlist CMPXPlaylistEngineExternalizePlaylistL mpxtestplaylist.m3u +playlist CMPXPlaylistEngineCancelRequests +playlist CMPXPlaylistEngineDestructor +pause 1000 +delete playlist +[Endtest] + +[Test] +title 9: CMPXPlaylistPluginHandlerCreate +create playlistenginetest playlist +playlist CMPXPlaylistPluginHandlerCreate +playlist CMPXPlaylistPluginHandlerDestructor +pause 1000 +delete playlist +[Endtest] + + + + +[Test] +title 10: SelectPlaylistPluginLByUri +create playlistenginetest playlist +playlist CMPXPlaylistEngineCreate +playlist SelectPlaylistPluginLByUri mpxtestplaylist.m3u +playlist CMPXPlaylistEngineDestructor +pause 1000 +delete playlist +[Endtest] + +[Test] +title 11: SelectPlaylistPluginLByFile +create playlistenginetest playlist +playlist CMPXPlaylistEngineCreate +playlist SelectPlaylistPluginLByFile mpxtestplaylist.m3u +playlist CMPXPlaylistEngineDestructor +pause 1000 +delete playlist +[Endtest] + +[Test] +title 12: SelectPlaylistPluginLByType +create playlistenginetest playlist +playlist CMPXPlaylistEngineCreate +playlist SelectPlaylistPluginLByType +playlist CMPXPlaylistEngineDestructor +pause 1000 +delete playlist +[Endtest] + +[Test] +title 13: SelectPlaylistPluginLByName +create playlistenginetest playlist +playlist CMPXPlaylistEngineCreate +playlist SelectPlaylistPluginLByName +playlist CMPXPlaylistEngineDestructor +pause 1000 +delete playlist +[Endtest] + +[Test] +title 14: SelectPlaylistPluginLByUid +create playlistenginetest playlist +playlist CMPXPlaylistEngineCreate +playlist SelectPlaylistPluginLByUid +playlist CMPXPlaylistEngineDestructor +pause 1000 +delete playlist +[Endtest] + + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playlist_engine_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playlist_engine_api/tsrc/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2007 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 for project playlistenginetest +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_TESTEXPORTS +// Test sound file + + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +#include "../playlistenginetest/group/bld.inf" + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playlist_engine_api/tsrc/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playlist_engine_api/tsrc/init/TestFramework.ini Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,203 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# + XML, Test report will be xml type, for example 'TestReport.xml'. +# Note, that xml format is available only when output is set to FILE. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +UITestingSupport= YES + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport_playlistenginetest + +TestReportFormat= TXT # Possible values: TXT, HTML or XML +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= 0 # 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] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +[New_Module] +#ModuleName= demomodule +ModuleName= TestScripter +TestCaseFile= c:\testframework\playlistenginetest.cfg +[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[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= D:\LOGS\TestFramework\ +#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 000000000000 -r a2952bb97e68 mmappfw_plat/playlist_engine_api/tsrc/playlistenginetest/Bmarm/playlistenginetestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playlist_engine_api/tsrc/playlistenginetest/Bmarm/playlistenginetestU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playlist_engine_api/tsrc/playlistenginetest/Bwins/playlistenginetestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playlist_engine_api/tsrc/playlistenginetest/Bwins/playlistenginetestU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playlist_engine_api/tsrc/playlistenginetest/EABI/playlistenginetestU.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playlist_engine_api/tsrc/playlistenginetest/EABI/playlistenginetestU.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playlist_engine_api/tsrc/playlistenginetest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playlist_engine_api/tsrc/playlistenginetest/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2002 - 2007 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 +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these +DEFAULT + +PRJ_TESTEXPORTS +// NOTE: If using ARS requirements all export operations should be done under this. +// 'abld test export' + +PRJ_EXPORTS + +PRJ_TESTMMPFILES +playlistenginetest.mmp + +PRJ_MMPFILES + + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playlist_engine_api/tsrc/playlistenginetest/group/playlistenginetest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playlist_engine_api/tsrc/playlistenginetest/group/playlistenginetest.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2002 - 2007 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: playlistenginetest mmp file +* +*/ + + +#if defined(__S60_) +#include +#endif + +TARGET playlistenginetest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +/* Remove comments and replace 0x00000000 with correct vendor id */ +// VENDORID 0x00000000 +/* Remove comments and replace 0x00000000 with correct secure id */ +// SECUREID 0x00000000 + +//TARGETPATH ?target_path +DEFFILE playlistenginetest.def + +MW_LAYER_SYSTEMINCLUDE +SOURCEPATH ../src + +SOURCE playlistenginetest.cpp +SOURCE playlistenginetestBlocks.cpp + +//RESOURCE resource_file +//RESOURCE resource_file2 +USERINCLUDE ../inc + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY mpxplaylistengine.lib mpxcommon.lib efsrv.lib charconv.lib ecom.lib estor.lib + +LANG SC + +/* +START WINS +?wins_specific_information +END + +START MARM +?marm_specific_information +END +*/ +// Other possible keywords: + +// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) +/* +START BITMAP ?target +TARGETPATH ?emulated_path_on_target_machine +HEADER +SOURCE ?color_depth ?source_bitmap +END +*/ +// DEFFILE ?filename +// AIF ?filename + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playlist_engine_api/tsrc/playlistenginetest/group/playlistenginetest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playlist_engine_api/tsrc/playlistenginetest/group/playlistenginetest.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,68 @@ +; +; 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: Package file for project STIF playlistenginetest +; +; +; Installation file for STIF +; + +; Languages +&EN + +; Provide value for uid +#{"STIF playlistenginetest Application"},(0x10005942),1,1,0,TYPE=SA + +; Series60 product id for S60 3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Logo +; None + +; Package signature - Optional +; None + +; Start of Package body + +; Condition blocks +; None + +; Options list +; None + +; Install files + +"..\..\data\mmc\mpxtest1.mp3" - "e:\testing\data\mpxtest1.mp3" +"..\..\data\mmc\mpxtestplaylist.m3u" - "e:\testing\data\mpxtestplaylist.m3u" +"..\..\data\mmc\mpxtestplaylist.m3u"-"e:\testing\listExport\mpxtestplaylist.m3u" +"..\..\init\TestFramework.ini" - "c:\testframework\TestFramework.ini" +"..\..\conf\playlistenginetest.cfg" - "c:\testframework\playlistenginetest.cfg" + +"\epoc32\release\armv5\urel\playlistenginetest.dll" - "c:\Sys\Bin\playlistenginetest.dll" + +; Embedded SIS +; None + +; End of Package body + +; PKG dependencies +; None + +; PKG capabilities +; None diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playlist_engine_api/tsrc/playlistenginetest/inc/playlistenginetest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playlist_engine_api/tsrc/playlistenginetest/inc/playlistenginetest.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,215 @@ +/* +* Copyright (c) 2002 - 2007 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: playlistenginetest header for STIF Test Framework TestScripter. +* +*/ + + + +#ifndef PLAYLISTENGINETEST_H +#define PLAYLISTENGINETEST_H + +// INCLUDES +#include +#include +#include +#include + +#include "mpxplaylistengine.h" +#include "mpxmediaarray.h" +#include "mpxmedia.h" +#include "mpxmediageneraldefs.h" +#include "mpxmediacontainerdefs.h" + +#include "mpxplaylistpluginhandler.h" +#include "charconv.h" + +#include "mpxplaylistplugin.h" +#include +// CONSTANTS +//const ?type ?constant_var = ?constant; +// MACROS +//#define ?macro ?macro_def +#define TEST_CLASS_VERSION_MAJOR 0 +#define TEST_CLASS_VERSION_MINOR 0 +#define TEST_CLASS_VERSION_BUILD 0 + + + +#ifdef __WINSCW__ +_LIT( KplaylistenginetestLogPath, "\\logs\\testframework\\playlistenginetest\\" ); +_LIT( Kplaylistenginetest_testPath, "c:\\testing\\data\\" ); +_LIT( KlistExportPath,"c:\\testing\\listExport\\"); +_LIT( KTestItemPath2, "c:\\testing\\data\\mpxtestplaylist.m3u"); +#else +_LIT( KplaylistenginetestLogPath, "e:\\testing\\log\\" ); +_LIT( Kplaylistenginetest_testPath, "e:\\testing\\data\\" ); +_LIT( KlistExportPath,"e:\\testing\\listExport\\"); +_LIT( KTestItemPath2, "e:\\testing\\data\\mpxtestplaylist.m3u"); +#endif +// Log file +_LIT( KplaylistenginetestLogFile, "playlistenginetest.txt" ); +_LIT( KplaylistenginetestLogFileWithTitle, "playlistenginetest_[%S].txt" ); + + +class Cplaylistenginetest; +class CMPXPlaylistEngine ; +class CMPXMediaArray; +class CMPXMedia; +class MMPXPlaylistPluginObserver; +class MMPXPluginHandlerObserver; +class MMPXPlaylistEngineObserver; +class CMPXPlaylistPlugin; + +// CLASS DECLARATION + +/** +* Cplaylistenginetest test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(Cplaylistenginetest) : public CScriptBase, + public MMPXPlaylistPluginObserver, + public MMPXPluginHandlerObserver + + { + public: // Constructors and destructor + enum TMediaProperties + { + ETitle = 0x01, + EUri = 0x02, + EDuration = 0x04, + EType = 0x08, + ECategory = 0x10, + EArrayContents = 0x20, + EArrayCount = 0x40, + EOthers = 0x80, + EAll = 0xffffffff + }; + /** + * Two-phased constructor. + */ + static Cplaylistenginetest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Cplaylistenginetest(); + + public: // New functions + + void HandlePlaylistL(CMPXMedia* aPlaylist, + const TInt aError, + const TBool aCompleted) ; + + void HandlePlaylistL(const TDesC& aPlaylistUri, + const TInt aError) ; + + void HandlePluginHandlerEvent(TPluginHandlerEvents aEvent, const TUid& aPluginUid, + TBool aLoaded, TInt aData) ; + + // Create a playlist that contains the specified attributes + CMPXMedia* CreatePlaylistL(const TUint& aAttributes); + + 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 ); + + //test functions for mpxplaylistengine.h + TInt CMPXPlaylistEngineCreate( CStifItemParser& aItem ); + TInt CMPXPlaylistEngineDestructor( CStifItemParser& aItem ); + TInt CMPXPlaylistEnginePlaylistPluginHandler( CStifItemParser& aItem ); + TInt CMPXPlaylistEngineIsPlaylistL( CStifItemParser& aItem ); + TInt CMPXPlaylistEngineInternalizePlaylistL( CStifItemParser& aItem ); + TInt CMPXPlaylistEngineInternalizePlaylistLRFile( CStifItemParser& aItem ); + TInt CMPXPlaylistEngineExternalizePlaylistL( CStifItemParser& aItem ); + TInt CMPXPlaylistEngineCancelRequests( CStifItemParser& aItem ); + + //test functions for mpxplaylistpluginhandler.h + TInt CMPXPlaylistPluginHandlerCreate( CStifItemParser& aItem ); + TInt CMPXPlaylistPluginHandlerDestructor( CStifItemParser& aItem ); + + TInt SelectPlaylistPluginLByUri( CStifItemParser& aItem ); + TInt SelectPlaylistPluginLByFile( CStifItemParser& aItem ); + TInt SelectPlaylistPluginLByType( CStifItemParser& aItem ); + TInt SelectPlaylistPluginLByName( CStifItemParser& aItem ); + TInt SelectPlaylistPluginLByUid( CStifItemParser& aItem ); + + + + + + + private: + + /** + * C++ default constructor. + */ + Cplaylistenginetest( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // ?classname( const ?classname& ); + // Prohibit assigment operator if not deriving from CBase. + // ?classname& operator=( const ?classname& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + /** + * Test methods are listed below. + */ + + /** + * Example test method. + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + virtual TInt ExampleL( CStifItemParser& aItem ); + + /** + * Method used to log version of test class + */ + void SendTestClassVersion(); + + //ADD NEW METHOD DEC HERE + //[TestMethods] - Do not remove + + + private: // Friend classes + //?friend_class_declaration; + CMPXPlaylistEngine* iPlaylistEngine; + CMPXPlaylistPluginHandler* iPlaylistPluginHandler; + CMPXPlaylistPlugin* iMPXPlaylistPlugin; + }; + +#endif // PLAYLISTENGINETEST_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playlist_engine_api/tsrc/playlistenginetest/src/playlistenginetest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playlist_engine_api/tsrc/playlistenginetest/src/playlistenginetest.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,172 @@ +/* +* Copyright (c) 2002 - 2007 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: playlistenginetest implementation for STIF Test Framework TestScripter. +* +*/ + + + +// INCLUDE FILES +#include +#include "playlistenginetest.h" +#include + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cplaylistenginetest::Cplaylistenginetest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +Cplaylistenginetest::Cplaylistenginetest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// Cplaylistenginetest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Cplaylistenginetest::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(KplaylistenginetestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KplaylistenginetestLogFile); + } + + iLog = CStifLogger::NewL( KplaylistenginetestLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + SendTestClassVersion(); + } + +// ----------------------------------------------------------------------------- +// Cplaylistenginetest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Cplaylistenginetest* Cplaylistenginetest::NewL( + CTestModuleIf& aTestModuleIf ) + { + Cplaylistenginetest* self = new (ELeave) Cplaylistenginetest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +Cplaylistenginetest::~Cplaylistenginetest() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +//----------------------------------------------------------------------------- +// Cplaylistenginetest::SendTestClassVersion +// Method used to send version of test class +//----------------------------------------------------------------------------- +// +void Cplaylistenginetest::SendTestClassVersion() + { + TVersion moduleVersion; + moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; + moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; + moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; + + TFileName moduleName; + moduleName = _L("playlistenginetest.dll"); + + TBool newVersionOfMethod = ETrue; + TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +void Cplaylistenginetest::HandlePlaylistL(CMPXMedia* /*aPlaylist*/, + const TInt aError, + const TBool /*aCompleted*/) + { + iLog->Log(_L("Cplaylistenginetest::HandlePlaylistL returned: %d"),aError); + } + + void Cplaylistenginetest::HandlePlaylistL(const TDesC& /*aPlaylistUri*/, + const TInt aError) + { + iLog->Log(_L("Cplaylistenginetest::HandlePlaylistL returned: %d"),aError); + } + + void Cplaylistenginetest::HandlePluginHandlerEvent(TPluginHandlerEvents /*aEvent*/, const TUid& /*aPluginUid*/, + TBool /*aLoaded*/, TInt /*aData*/) + { + iLog->Log(_L("Cplaylistenginetest::HandlePluginHandlerEvent begin:")); + } +// ----------------------------------------------------------------------------- +// 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* ) Cplaylistenginetest::NewL( aTestModuleIf ); + + } + + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/playlist_engine_api/tsrc/playlistenginetest/src/playlistenginetestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/playlist_engine_api/tsrc/playlistenginetest/src/playlistenginetestBlocks.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,531 @@ +/* +* Copyright (c) 2002 - 2007 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: playlistenginetest block implementation for STIF Test Framework TestScripter. +* +*/ + + + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include "playlistenginetest.h" + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cplaylistenginetest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Cplaylistenginetest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// Cplaylistenginetest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Cplaylistenginetest::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( "Example", Cplaylistenginetest::ExampleL ), + + //test functions for mpxplaylistengine.h + ENTRY( "CMPXPlaylistEngineCreate", Cplaylistenginetest::CMPXPlaylistEngineCreate ),//Pass Debug + ENTRY( "CMPXPlaylistEngineDestructor", Cplaylistenginetest::CMPXPlaylistEngineDestructor ),//Pass Debug + ENTRY( "CMPXPlaylistEnginePlaylistPluginHandler", Cplaylistenginetest::CMPXPlaylistEnginePlaylistPluginHandler ),//Pass Debug + ENTRY( "CMPXPlaylistEngineIsPlaylistL", Cplaylistenginetest::CMPXPlaylistEngineIsPlaylistL ),//Pass Debug + ENTRY( "CMPXPlaylistEngineInternalizePlaylistL", Cplaylistenginetest::CMPXPlaylistEngineInternalizePlaylistL ),//Pass Debug + ENTRY( "CMPXPlaylistEngineInternalizePlaylistLRFile", Cplaylistenginetest::CMPXPlaylistEngineInternalizePlaylistLRFile ),//Pass Debug + ENTRY( "CMPXPlaylistEngineExternalizePlaylistL", Cplaylistenginetest::CMPXPlaylistEngineExternalizePlaylistL ),//Pass Debug + ENTRY( "CMPXPlaylistEngineCancelRequests", Cplaylistenginetest::CMPXPlaylistEngineCancelRequests ),//Pass Debug + + //test functions for mpxplaylistpluginhandler.h + ENTRY( "CMPXPlaylistPluginHandlerCreate", Cplaylistenginetest::CMPXPlaylistPluginHandlerCreate ),//Pass Debug + ENTRY( "CMPXPlaylistPluginHandlerDestructor", Cplaylistenginetest::CMPXPlaylistPluginHandlerDestructor ),//Pass Debug + /*ENTRY( "CMPXPlaylistPluginHandlerPluginUid", Cplaylistenginetest::CMPXPlaylistPluginHandlerPluginUid ),//Pass Debug + ENTRY( "CMPXPlaylistPluginHandlerPluginType", Cplaylistenginetest::CMPXPlaylistPluginHandlerPluginUid ),//Pass Debug + ENTRY( "CMPXPlaylistPluginHandlerPluginName", Cplaylistenginetest::CMPXPlaylistPluginHandlerPluginUid ),//Pass Debug + ENTRY( "CMPXPlaylistPluginHandlerPluginFound", Cplaylistenginetest::CMPXPlaylistPluginHandlerPluginUid ),//Pass Debug + ENTRY( "CMPXPlaylistPluginHandlerPlugin", Cplaylistenginetest::CMPXPlaylistPluginHandlerPlugin ),//Pass Debug +*/ ENTRY( "SelectPlaylistPluginLByUri", Cplaylistenginetest::SelectPlaylistPluginLByUri ),//Pass Debug + ENTRY( "SelectPlaylistPluginLByFile", Cplaylistenginetest::SelectPlaylistPluginLByFile ),//Pass Debug + ENTRY( "SelectPlaylistPluginLByType", Cplaylistenginetest::SelectPlaylistPluginLByType ),//Pass Debug + ENTRY( "SelectPlaylistPluginLByName", Cplaylistenginetest::SelectPlaylistPluginLByName ),//Pass Debug + ENTRY( "SelectPlaylistPluginLByUid", Cplaylistenginetest::SelectPlaylistPluginLByUid ),//Pass Debug + + + + //ADD NEW ENTRY HERE + // [test cases entries] - Do not remove + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// ----------------------------------------------------------------------------- +// Cplaylistenginetest::ExampleL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cplaylistenginetest::ExampleL( CStifItemParser& aItem ) + { + + // Print to UI + _LIT( Kplaylistenginetest, "playlistenginetest" ); + _LIT( KExample, "In Example" ); + TestModuleIf().Printf( 0, Kplaylistenginetest, KExample ); + // Print to log file + iLog->Log( KExample ); + + TInt i = 0; + TPtrC string; + _LIT( KParam, "Param[%i]: %S" ); + while ( aItem.GetNextString ( string ) == KErrNone ) + { + TestModuleIf().Printf( i, Kplaylistenginetest, + KParam, i, &string ); + i++; + } + + return KErrNone; + + } + +// --------------------------------------------------------------------------- +// Cplaylistenginetest::CMPXPlaylistEngineCreate +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cplaylistenginetest::CMPXPlaylistEngineCreate( CStifItemParser& /*aItem*/ ) + { + TInt err=KErrNone; + MMPXPlaylistEngineObserver* aObserver(NULL); + iLog->Log(_L("Cplaylistenginetest::CMPXPlaylistEngineCreate")); + + TRAP(err, iPlaylistEngine = CMPXPlaylistEngine::NewL(*aObserver)); + + iLog->Log(_L("Cplaylistenginetest::NewL returned: %d"), err); + return err; + } + + +// --------------------------------------------------------------------------- +// Cplaylistenginetest::CMPXPlaylistEngineDestructor +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cplaylistenginetest::CMPXPlaylistEngineDestructor( CStifItemParser& /*aItem*/ ) + { + TInt err=KErrNone; + MMPXPlaylistEngineObserver* aObserver(NULL); + iLog->Log(_L("Cplaylistenginetest::CMPXPlaylistEngineDestructor")); + if(iPlaylistEngine==NULL) + { + TRAP( err , iPlaylistEngine = CMPXPlaylistEngine::NewL(*aObserver)); + } + delete iPlaylistEngine; + iPlaylistEngine=NULL; + iLog->Log(_L("Cplaylistenginetest::Destructor end. ")); + return err; + } + +// --------------------------------------------------------------------------- +// Cplaylistenginetest::CMPXPlaylistEnginePlaylistPluginHandler +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cplaylistenginetest::CMPXPlaylistEnginePlaylistPluginHandler( CStifItemParser& /*aItem*/ ) + { + TInt err=KErrNone; + iLog->Log(_L("Cplaylistenginetest::CMPXPlaylistEnginePlaylistPluginHandler")); + + iPlaylistEngine->PlaylistPluginHandler(); + + iLog->Log(_L("Cplaylistenginetest::PlaylistPluginHandler end.")); + return err; + } + +// --------------------------------------------------------------------------- +// Cplaylistenginetest::CMPXPlaylistEngineIsPlaylistL +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cplaylistenginetest::CMPXPlaylistEngineIsPlaylistL( CStifItemParser& aItem ) + { + TInt err=KErrNone; + TPtrC string; + iLog->Log(_L("Cplaylistenginetest::CMPXPlaylistEngineIsPlaylistL")); + + while ( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KUri; + KUri.Append(Kplaylistenginetest_testPath); + KUri.Append(string); + + TInt is=iPlaylistEngine->IsPlaylistL(KUri); + + iLog->Log(_L("Cplaylistenginetest::IsPlaylistL returned: %d"), is); + } + return err; + } + +// --------------------------------------------------------------------------- +// Cplaylistenginetest::CMPXPlaylistEngineInternalizePlaylistL +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cplaylistenginetest::CMPXPlaylistEngineInternalizePlaylistL( CStifItemParser& aItem ) + { + TInt err=KErrNone; + TPtrC string; + iLog->Log(_L("Cplaylistenginetest::CMPXPlaylistEngineIsPlaylistL")); + + while ( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KUri; + KUri.Append(Kplaylistenginetest_testPath); + KUri.Append(string); + + TRAP(err,iPlaylistEngine->InternalizePlaylistL(KUri)); + + iLog->Log(_L("Cplaylistenginetest::IsPlaylistL returned: %d"), err); + } + return err; + } + + + + +// --------------------------------------------------------------------------- +// Cplaylistenginetest::CMPXPlaylistEngineInternalizePlaylistLRFile +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cplaylistenginetest::CMPXPlaylistEngineInternalizePlaylistLRFile( CStifItemParser& aItem ) + { + TInt err=KErrNone; + iLog->Log(_L("Cplaylistenginetest::CMPXPlaylistEngineInternalizePlaylistLRFile")); + TPtrC string; + while ( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KPlaylistDir; + KPlaylistDir.Append(Kplaylistenginetest_testPath); + KPlaylistDir.Append(string); + + RFs fs; + User::LeaveIfError(fs.Connect()); + CDir* entryList(NULL); + // User::LeaveIfError( + // fs.GetDir(KPlaylistDir, KEntryAttNormal, KEntryAttNormal, entryList)); + User::LeaveIfError( + fs.GetDir(KPlaylistDir, KEntryAttMaskSupported, ESortByName|EDirsFirst, entryList)); + CleanupStack::PushL(entryList); + RFile playlistFile; + User::LeaveIfError(playlistFile.Open(fs, KPlaylistDir, EFileRead )); + iPlaylistEngine->PlaylistPluginHandler().SelectPlaylistPluginL(playlistFile); + TRAP(err, iPlaylistEngine->InternalizePlaylistL(playlistFile)); + CleanupStack::PopAndDestroy(entryList); + playlistFile.Close(); + fs.Close(); + + } + iLog->Log(_L("Cplaylistenginetest::InternalizePlaylistL returned: %d"), err); + + return err; + } + +// --------------------------------------------------------------------------- +// Cplaylistenginetest::CMPXPlaylistEngineExternalizePlaylistL +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cplaylistenginetest::CMPXPlaylistEngineExternalizePlaylistL(CStifItemParser& aItem) + { + iLog->Log(_L("Cplaylistenginetest::CMPXPlaylistEngineExternalizePlaylistL testing ExternalizeL begin")); + TInt err=KErrNone; + TPtrC string; + + while ( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KUri; + KUri.Append(Kplaylistenginetest_testPath); + CMPXMedia* playlist = CreatePlaylistL(ETitle|EType|ECategory|EArrayContents|EArrayCount|EUri ); + CleanupStack::PushL(playlist); + iPlaylistEngine->PlaylistPluginHandler().SelectPlaylistPluginL( + EMPXPlaylistTypeM3U); + TRAP(err, iPlaylistEngine->ExternalizePlaylistL(*playlist, KUri); ); + CleanupStack::PopAndDestroy(playlist); + } + iLog->Log(_L("Cplaylistenginetest::ExternalizePlaylistL returned: %d"), err); + return err; + } + +// --------------------------------------------------------------------------- +// Create playlist +// --------------------------------------------------------------------------- +// +CMPXMedia* Cplaylistenginetest::CreatePlaylistL(const TUint& aAttributes) + { + //////////////////////////////////////////////////////////////////////////// + // create playlist + //////////////////////////////////////////////////////////////////////////// + CMPXMedia* playlist = CMPXMedia::NewL(); + CleanupStack::PushL(playlist); + + if (aAttributes & ETitle) + { + // set playlist title + playlist->SetTextValueL(KMPXMediaGeneralTitle, _L("Playlist")); + } + + if (aAttributes & EType) + { + // set type + playlist->SetTObjectValueL(KMPXMediaGeneralType, EMPXItem); + } + + if (aAttributes & ECategory) + { + // set category + playlist->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXPlaylist); + } + + if (aAttributes & EArrayContents) + { + // set medias + CMPXMediaArray* medias = CMPXMediaArray::NewL(); + CleanupStack::PushL(medias); + playlist->SetCObjectValueL(KMPXMediaArrayContents, medias); + CleanupStack::PopAndDestroy(medias); + } + + if (aAttributes & EArrayCount) + { + /// set media count + playlist->SetTObjectValueL(KMPXMediaArrayCount, 0); + } + if (aAttributes & EUri) + { + /// set media uri + playlist->SetTextValueL(KMPXMediaGeneralUri,KTestItemPath2); + } + + CleanupStack::Pop(playlist); + + return playlist; + } + +// --------------------------------------------------------------------------- +// Cplaylistenginetest::CMPXPlaylistEngineCancelRequests +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cplaylistenginetest::CMPXPlaylistEngineCancelRequests( CStifItemParser& /*aItem*/ ) + { + TInt err=KErrNone; + iLog->Log(_L("Cplaylistenginetest::CMPXPlaylistEngineCancelRequests begin:")); + + iPlaylistEngine->CancelRequests(); + + iLog->Log(_L("Cplaylistenginetest::CancelRequests end.")); + return err; + } + +// --------------------------------------------------------------------------- +// Cplaylistenginetest::CMPXPlaylistPluginHandlerCreate +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cplaylistenginetest::CMPXPlaylistPluginHandlerCreate( CStifItemParser& /*aItem*/ ) + { + TInt err=KErrNone; + iLog->Log(_L("Cplaylistenginetest::CMPXPlaylistPluginHandlerCreate begin")); + + RFs fs=RFs(); + User::LeaveIfError(fs.Connect()); + CArrayFix* iTopCharacterSet; + CArrayFix* iAvailableCharacterSet; + TRAP( err , iAvailableCharacterSet = new (ELeave)CArrayFixFlat(12)); + TRAP( err , iTopCharacterSet = new (ELeave)CArrayFixFlat(12)); + + TRAP( err , iPlaylistPluginHandler=CMPXPlaylistPluginHandler::NewL(*this,*this,fs,*iTopCharacterSet,*iAvailableCharacterSet)); + + fs.Close(); + iLog->Log(_L("Cplaylistenginetest::NewL returned: %d"), err); + return err; + } + +// --------------------------------------------------------------------------- +// Cplaylistenginetest::CMPXPlaylistPluginHandlerDestructor +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cplaylistenginetest::CMPXPlaylistPluginHandlerDestructor( CStifItemParser& /*aItem*/ ) + { + TInt err=KErrNone; + if ( iPlaylistPluginHandler != NULL ) + { + delete iPlaylistPluginHandler; + iPlaylistPluginHandler=NULL; + } + + iLog->Log(_L("Cplaylistenginetest::Destructor end.")); + return err; + } + + +// --------------------------------------------------------------------------- +// Cplaylistenginetest::SelectPlaylistPluginLByUri +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cplaylistenginetest::SelectPlaylistPluginLByUri(CStifItemParser& aItem) + { + iLog->Log(_L("Cplaylistenginetest::SelectPlaylistPluginLByUri begin")); + TInt err=KErrNone; + TPtrC string; + + if( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(Kplaylistenginetest_testPath); + KFrom.Append(string); + + _LIT8(DataType,"playlist/mpegurl"); + TRAP( err , iPlaylistEngine->PlaylistPluginHandler().SelectPlaylistPluginL(KFrom,KNullDesC8)); + + iLog->Log(_L("Cplaylistenginetest::SelectPlaylistPluginLByUri returned: %d"), err); + } + + return err; + } + +// --------------------------------------------------------------------------- +// Cplaylistenginetest::SelectPlaylistPluginLByFile +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cplaylistenginetest::SelectPlaylistPluginLByFile(CStifItemParser& aItem) + { + iLog->Log(_L("Cplaylistenginetest::SelectPlaylistPluginLByFile begin")); + TInt err=KErrNone; + TPtrC string; + if( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(Kplaylistenginetest_testPath); + KFrom.Append(string); + + RFs fs=RFs(); + RFile file; + User::LeaveIfError(fs.Connect()); + file.Open(fs, KFrom, EFileShareAny); + + + TRAP( err , iPlaylistEngine->PlaylistPluginHandler().SelectPlaylistPluginL(file)); + + file.Close(); + fs.Close(); + iLog->Log(_L("Cplaylistenginetest::SelectPlaylistPluginLByFile returned: %d"), err); + } + return err; + } + +// --------------------------------------------------------------------------- +// Cplaylistenginetest::SelectPlaylistPluginLByType +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cplaylistenginetest::SelectPlaylistPluginLByType(CStifItemParser& /*aItem*/) + { + iLog->Log(_L("Cplaylistenginetest::SelectPlaylistPluginLByType begin")); + + TInt err=KErrNone; + + TRAP( err , iPlaylistEngine->PlaylistPluginHandler().SelectPlaylistPluginL(EMPXPlaylistTypeM3U)); + + iLog->Log(_L("Cplaylistenginetest::SelectPlaylistPluginLByType returned: %d"), err); + return err; + } + +// --------------------------------------------------------------------------- +// Cplaylistenginetest::SelectPlaylistPluginLByName +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cplaylistenginetest::SelectPlaylistPluginLByName(CStifItemParser& /*aItem*/) + { + iLog->Log(_L("Cplaylistenginetest::SelectPlaylistPluginLByName begin")); + TInt err=KErrNone; + + TRAP( err , iPlaylistEngine->PlaylistPluginHandler().SelectPlaylistPluginL(_L("m3u playlist"))); + + iLog->Log(_L("Cplaylistenginetest::SelectPlaylistPluginLByName returned: %d"), err); + return err; + } + +// --------------------------------------------------------------------------- +// Cplaylistenginetest::SelectPlaylistPluginLByUid +// ?implementation_description +// (other items were commented in a header). +// --------------------------------------------------------------------------- +// +TInt Cplaylistenginetest::SelectPlaylistPluginLByUid(CStifItemParser& /*aItem*/) + { + iLog->Log(_L("Cplaylistenginetest::SelectPlaylistPluginLByUid begin")); + TInt err=KErrNone; + TRAP( err , iPlaylistEngine->PlaylistPluginHandler().SelectPlaylistPluginL(TUid::Uid(0x101FFC21))); + + iLog->Log(_L("Cplaylistenginetest::SelectPlaylistPluginLByUid returned: %d"), err); + return err; + } + + + + + +// [End of File] - Do not remove diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/videoplaylist_utility_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/videoplaylist_utility_api/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2008 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 mpx video playback +* +*/ + +// Version : %version: 2 % + + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/videoplaylistutility.h MW_LAYER_PLATFORM_EXPORT_PATH(videoplaylistutility.h) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/videoplaylist_utility_api/inc/videoplaylistutility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/videoplaylist_utility_api/inc/videoplaylistutility.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2008 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: Implementation of CVideoPlaylistUtility +* +*/ + +// Version : %version: 2 % + + + +#ifndef __VIDEOPLAYLISTUTILITY_H +#define __VIDEOPLAYLISTUTILITY_H + +// INCLUDES +#include +#include +#include +#include +#include +#include + +// CLASS DECLARATION +class CMPXMediaArray; +class CStreamingLinkModel; + +NONSHARABLE_CLASS(CVideoPlaylistUtility) : public CBase +{ + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + IMPORT_C static CVideoPlaylistUtility* NewL(); + + /** + * Destructor. + */ + IMPORT_C virtual ~CVideoPlaylistUtility(); + + public: // New functions + + IMPORT_C CMPXMedia* GetPlayListL( TInt aAccessPointId); + IMPORT_C TPtrC GetLinkLC(); + + IMPORT_C void GetFileInfoL( const TDesC& aFileName, + CMediaRecognizer::TMediaType aMediaType, + TBool& aSingleLink, TBool& aLocalFile ); + IMPORT_C void GetFileInfoL( RFile& aFile, + CMediaRecognizer::TMediaType aMediaType, + TBool& aSingleLink, TBool& aLocalFile ); + + IMPORT_C TBool IsSeekable(); + + private: + + /** + * C++ default constructor. + */ + CVideoPlaylistUtility(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: + + /** + * Reads next line from buffer + * @since 2.0 + * @param aLine Whole line which was read. + * @return KErrNone or one of the system wide error codes. + */ + void GetItemArrayL( TInt aAccessPointId); + + void ComposePlaylistL(); + + private: // Data + CMPXMediaArray* iPlaylistArray; + CMPXMedia* iPlaylist; + CStreamingLinkModel* iStreamingLinkModel; + TBool iAsx; +}; + +#endif // __VIDEOPLAYLISTUTILITY_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/videoplaylist_utility_api/tsrc/conf/videoplaylistutilitytest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/videoplaylist_utility_api/tsrc/conf/videoplaylistutilitytest.cfg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,388 @@ +[Define] + +ERamFile 0 +EAsxFile 1 + +AccessPoint 1 + +Multi 0 +Single 1 + +Streaming 0 +Local 1 +StreamingAsx 2 +LocalAsx 3 + +NoEmbeddedInfo 0 +EmbeddedSeekInfo 1 + +UseName 0 +UseHandle 1 + +No 0 +Yes 1 + +[Enddefine] + +[Test] +// +// Test the GetFileInfo +// +title 1) GetFileInfo SingleLink LocalFile w FileHandle RamFile +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseHandle test_localSingleLink.ram ERamFile Single Local +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// Test the GetFileInfo +// +title 2) GetFileInfo SingleLink LocalFile w FileName RamFile +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseName test_localSingleLink.ram ERamFile Single Local +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// Test the GetFileInfo +// +title 3) GetFileInfo MutliLink LocalFile w FileHandle RamFile +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseHandle test_localMultiLink.ram ERamFile Multi Local +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// Test the GetFileInfo +// +title 4) GetFileInfo MutliLink LocalFile w FileName RamFile +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseName test_localMultiLink.ram ERamFile Multi Local +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// Test the GetFileInfo +// +title 5) GetFileInfo SingleLink Streaming w FileHandle RamFile +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseHandle test_singleLink.ram ERamFile Single Streaming +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// Test the GetFileInfo +// +title 6) GetFileInfo SingleLink Streaming w FileName RamFile +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseName test_singleLink.ram ERamFile Single Streaming +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// Test the GetFileInfo +// +title 7) GetFileInfo MutliLink Streaming w FileHandle RamFile +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseHandle test_multiLink.ram ERamFile Multi Streaming +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// Test the GetFileInfo +// +title 8) GetFileInfo MutliLink Streaming w FileName RamFile +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseName test_multiLink.ram ERamFile Multi Streaming +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// Test the GetFileInfo +// +title 9) GetFileInfo HybridFile w FileHandle RamFile +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseHandle test_hybridLink.ram ERamFile Multi Streaming +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// Test the GetFileInfo +// +title 10) GetFileInfo HybridFile w FileName RamFile +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseName test_hybridLink.ram ERamFile Multi Streaming +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// Test the GetLink +// +title 11) GetLink LocalFile +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseHandle test_localSingleLink.ram ERamFile Single Local +plutilitytest GetLink Local +delete plutilitytest +pause 1000 +[Endtest] + + +[Test] +// +// Test the GetLink +// +title 12) GetLink Streaming +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseHandle test_singleLink.ram ERamFile Single Streaming +plutilitytest GetLink Streaming +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// Test the GetPlaylist +// +title 13) GetPlaylist Streaming +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseHandle test_multiLink.ram ERamFile Multi Streaming +plutilitytest GetPlaylist AccessPoint 3 NoEmbeddedInfo +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// Test the GetFileInfo ASX V2 file +// +title 14) GetFileInfo Single Local Asx V2 +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseHandle test_localSingle_v2.asx EAsxFile Single Local +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// Test the GetFileInfo ASX V3 file +// +title 15) GetFileInfo Single Local Asx V3 +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseName test_localSingle_v3.asx EAsxFile Single Local +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// Test the GetFileInfo +// +title 16) GetFileInfo Mutli Local Asx V2 +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseHandle test_localMultiple_v2.asx EAsxFile Multi Local +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// Test the GetFileInfo +// +title 17) GetFileInfo Mutli Local Asx V3 +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseName test_localMultiple_v3.asx EAsxFile Multi Local +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// Test the GetFileInfo +// +title 18) GetFileInfo Single Streaming Asx V2 +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseHandle test_streamingSingle_v2.asx EAsxFile Single Streaming +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// Test the GetFileInfo +// +title 19) GetFileInfo SingleLink Streaming Asx V3 +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseName test_streamingSingle_v3.asx EAsxFile Single Streaming +delete plutilitytest +pause 1000 +[Endtest] + + +[Test] +// +// Test the GetFileInfo +// +title 20) GetFileInfo HybridFile Asx V2 +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseHandle test_hybridMultiple_v2.asx EAsxFile Multi Streaming +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// Test the GetFileInfo +// +title 21) GetFileInfo HybridFile Asx V3 +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseName test_hybridMultiple_v3.asx EAsxFile Multi Streaming +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// Test the GetLink +// +title 22) GetLink LocalFile Asx V2 +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseHandle test_localSingle_v2.asx EAsxFile Single Local +plutilitytest GetLink Local +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// Test the GetLink +// +title 23) GetLink LocalFile Asx V3 +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseHandle test_localSingle_v3.asx EAsxFile Single Local +plutilitytest GetLink Local +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// Test the GetLink +// +title 24) GetLink Streaming Asx V2 +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseHandle test_streamingSingle_v2.asx EAsxFile Single Streaming +plutilitytest GetLink StreamingAsx +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// Test the GetLink +// +title 25) GetLink Streaming Asx V3 +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseHandle test_streamingSingle_v3.asx EAsxFile Single Streaming +plutilitytest GetLink StreamingAsx +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// Test IsSeekable +// +title 26) Seek Attribute Streaming Asx V3 +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseHandle test_seekSingle_v3.asx EAsxFile Single Streaming +plutilitytest GetLink StreamingAsx +plutilitytest IsSeekable No +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// Test IsSeekable +// +title 27) Seek Attribute Streaming Asx V3 +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseHandle test_noSeekInfoEmbedded_v3.asx EAsxFile Single Streaming +plutilitytest GetLink StreamingAsx +plutilitytest IsSeekable Yes +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// playlist Asx seek +// +title 28) Seek Streaming Asx V3 +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseHandle test_seek_v3.asx EAsxFile Multi Streaming +plutilitytest GetPlaylist AccessPoint 3 EmbeddedSeekInfo +delete plutilitytest +pause 1000 +[Endtest] + +[Test] +// +// playlist RAM seek +// +title 29) Seek Streaming RAM +create videoplaylistutilitytest plutilitytest +plutilitytest CreatePlaylistUtility +plutilitytest GetFileInfo UseHandle test_multiLink.ram ERamFile Multi Streaming +plutilitytest GetPlaylist AccessPoint 3 NoEmbeddedInfo +delete plutilitytest +pause 1000 +[Endtest] \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/videoplaylist_utility_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/videoplaylist_utility_api/tsrc/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,37 @@ +/* +* 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: Build Information for the videoplaylistutility module STIF testing +* +*/ + +// Version : %version: 2 % + + +PRJ_PLATFORMS +DEFAULT + + +PRJ_EXPORTS + + +PRJ_TESTEXPORTS + + +PRJ_MMPFILES + + +PRJ_TESTMMPFILES +#include "../videoplaylistutilitytest/group/bld.inf" + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/videoplaylist_utility_api/tsrc/init/testframework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/videoplaylist_utility_api/tsrc/init/testframework.ini Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,169 @@ +# +# This is STIFTestFramework initialization file 123 +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Sret of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report.sd +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. + +[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= stifmeasurementplugin04 +UITestingSupport= YES +SeparateProcesses= YES +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + + +[New_Module] +ModuleName= TestScripter +TestCaseFile= c:\TestFramework\videoplaylistutilitytest.cfg +[End_Module] + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIFTestFramework logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' + +#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= TXT # 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 + +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/videoplaylist_utility_api/tsrc/videoplaylistutilitytest/bwins/videoplaylistutilitytestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/videoplaylist_utility_api/tsrc/videoplaylistutilitytest/bwins/videoplaylistutilitytestu.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/videoplaylist_utility_api/tsrc/videoplaylistutilitytest/eabi/videoplaylistutilitytestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/videoplaylist_utility_api/tsrc/videoplaylistutilitytest/eabi/videoplaylistutilitytestu.def Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + _ZTI28CVideoPlaylistUtility_Tester @ 2 NONAME ; ## + _ZTV28CVideoPlaylistUtility_Tester @ 3 NONAME ; ## + diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/videoplaylist_utility_api/tsrc/videoplaylistutilitytest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/videoplaylist_utility_api/tsrc/videoplaylistutilitytest/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,35 @@ +/* +* 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: Build Information for the videoplaylistutility module STIF testing +* +*/ + +// Version : %version: 2 % + + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTEXPORTS + + +PRJ_EXPORTS + + +PRJ_TESTMMPFILES +videoplaylistutilitytest.mmp + +PRJ_MMPFILES + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/videoplaylist_utility_api/tsrc/videoplaylistutilitytest/group/videoplaylistutilitytest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/videoplaylist_utility_api/tsrc/videoplaylistutilitytest/group/videoplaylistutilitytest.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -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: mmp file for the videoplaylistutility module STIF testing +* +*/ + +// Version : %version: 2 % + + +#include + +EPOCALLOWDLLDATA + +TARGET videoplaylistutilitytest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB + +USERINCLUDE ../inc + +SOURCEPATH ../src + +SOURCE videoplaylistutilitytest.cpp +SOURCE videoplaylistutilitytestBlocks.cpp +SOURCE videoplaylistutilitytester.cpp + + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY mpxcommon.lib +LIBRARY libstdcpp.lib +LIBRARY libc.lib +LIBRARY libglib.lib +LIBRARY libpthread.lib +LIBRARY efsrv.lib +LIBRARY flogger.lib +LIBRARY ServiceHandler.lib +LIBRARY ecom.lib +LIBRARY estor.lib +LIBRARY videoplaylistutility.lib + +LANG SC + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/videoplaylist_utility_api/tsrc/videoplaylistutilitytest/group/videoplaylistutilitytest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/videoplaylist_utility_api/tsrc/videoplaylistutilitytest/group/videoplaylistutilitytest.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,58 @@ +; +; 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: Package file for videoplaylistutility STIF test +; +; Version : %version: 2 % +; + +; Languages +&EN + +; Provide value for uid +#{"Video Playlist Utility STIF"}, (0x101FB3E3), 1, 0, 1, TYPE=SA, RU + +; Series60 product id for S60 3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Install files +"\epoc32\release\armv5\udeb\videoplaylistutilitytest.dll" - "!:\sys\bin\videoplaylistutilitytest.dll" + +"..\..\conf\videoplaylistutilitytest.cfg" - "c:\testframework\videoplaylistutilitytest.cfg" +"..\..\init\testframework.ini" - "c:\testframework\testframework.ini" + +"..\..\data\mmc\local.3gp" - "e:\testing\data\local.3gp" +"..\..\data\mmc\test_hybridlink_hw.ram" - "e:\testing\data\test_hybridlink.ram" +"..\..\data\mmc\test_localMultilink_hw.ram" - "e:\testing\data\test_localMultilink.ram" +"..\..\data\mmc\test_localSingleLink_hw.ram" - "e:\testing\data\test_localSingleLink.ram" +"..\..\data\mmc\test_multiLink.ram" - "e:\testing\data\test_multiLink.ram" +"..\..\data\mmc\test_singleLink.ram" - "e:\testing\data\test_singleLink.ram" + +; Asx Files +"..\..\data\mmc\test_hybridMultiple_hw_v2.asx" - "e:\testing\data\test_hybridMultiple_v2.asx" +"..\..\data\mmc\test_hybridMultiple_hw_v3.asx" - "e:\testing\data\test_hybridMultiple_v3.asx" +"..\..\data\mmc\test_localMultiple_hw_v2.asx" - "e:\testing\data\test_localMultiple_v2.asx" +"..\..\data\mmc\test_localMultiple_hw_v3.asx" - "e:\testing\data\test_localMultiple_v3.asx" +"..\..\data\mmc\test_localSingle_hw_v2.asx" - "e:\testing\data\test_localSingle_v2.asx" +"..\..\data\mmc\test_localSingle_hw_v3.asx" - "e:\testing\data\test_localSingle_v3.asx" +"..\..\data\mmc\test_streamingSingle_v2.asx" - "e:\testing\data\test_streamingSingle_v2.asx" +"..\..\data\mmc\test_streamingSingle_v3.asx" - "e:\testing\data\test_streamingSingle_v3.asx" +"..\..\data\mmc\test_seek_v3.asx" - "e:\testing\data\test_seek_v3.asx" +"..\..\data\mmc\test_seekSingle_v3.asx" - "e:\testing\data\test_seekSingle_v3.asx" +"..\..\data\mmc\test_noSeekInfoEmbedded_v3.asx" - "e:\testing\data\test_noSeekInfoEmbedded_v3.asx" diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/videoplaylist_utility_api/tsrc/videoplaylistutilitytest/inc/videoplaylistutilitytest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/videoplaylist_utility_api/tsrc/videoplaylistutilitytest/inc/videoplaylistutilitytest.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,130 @@ +/* +* 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: videoplaylistutility test class for STIF testing +* +*/ + +// Version : %version: 2 % + + +#ifndef VIDEOPLAYLISTUTILITY_TEST_H +#define VIDEOPLAYLISTUTILITY_TEST_H + +// INCLUDES +#include +#include +#include +#include +#include "videoplaylistutilitytester.h" + +// CONSTANTS + + +// MACROS +#define TEST_CLASS_VERSION_MAJOR 0 +#define TEST_CLASS_VERSION_MINOR 0 +#define TEST_CLASS_VERSION_BUILD 0 + +// Logging path +_LIT( Kvideoplaylistutility_testLogPath, "\\logs\\testframework\\videoplaylistutility_test\\" ); + +// Log file +_LIT( Kvideoplaylistutility_testLogFile, "videoplaylistutility_test.txt" ); +_LIT( Kvideoplaylistutility_testLogFileWithTitle, "videoplaylistutility_test_[%S].txt" ); + +// FUNCTION PROTOTYPES + + +// FORWARD DECLARATIONS +class Cvideoplaylistutility_test; +class CVideoPlaylistUtility_Tester; + +// DATA TYPES + +// CLASS DECLARATION + +/** +* Cvideoplaylistutility_test test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(Cvideoplaylistutility_test) : public CScriptBase +{ + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Cvideoplaylistutility_test* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Cvideoplaylistutility_test(); + + 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: + + /** + * C++ default constructor. + */ + Cvideoplaylistutility_test( 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 CreatePlaylistUtilityL( CStifItemParser& aItem ); + virtual TInt GetFileInfoL( CStifItemParser& aItem ); + virtual TInt GetLinkL( CStifItemParser& aItem ); + virtual TInt GetPlaylistL( CStifItemParser& aItem ); + virtual TInt IsSeekableL( CStifItemParser& aItem ); + + + /** + * Method used to log version of test class + */ + void SendTestClassVersion(); + + + private: // Friend classes + + CVideoPlaylistUtility_Tester* iPlaylistUtilityTester; +}; + +#endif // VIDEOPLAYLISTUTILITY_TEST_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/videoplaylist_utility_api/tsrc/videoplaylistutilitytest/inc/videoplaylistutilitytester.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/videoplaylist_utility_api/tsrc/videoplaylistutilitytest/inc/videoplaylistutilitytester.h Thu Dec 17 08:55:47 2009 +0200 @@ -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: videoplaylistutility test class for STIF testing +* +*/ + +// Version : %version: 2 % + +#ifndef VIDEOPLAYLISTUTILITY_TESTER_H_ +#define VIDEOPLAYLISTUTILITY_TESTER_H_ + +#include +#include +#include +#include + + +enum TStifLinkTypes +{ + ERamFileStreaming, + ERamFileLocal, + EAsxFileStreaming, + EAsxFileLocal +}; + +enum TStifFileTypes +{ + ERamFile, + EAsxFile +}; + +enum TAsxEmbeddedTypes +{ + ENoEmbeddedInfo, + EEmbeddedSeekInfo +}; + +// FORWARD DEC +class CVideoPlaylistUtility; + + +class CVideoPlaylistUtility_Tester : public CBase +{ + public: // constructors and destructors + static CVideoPlaylistUtility_Tester* NewL(); + + virtual ~CVideoPlaylistUtility_Tester(); + + TInt CreatePlaylistUtilityL( CStifItemParser& aItem ); + TInt GetFileInfoL( CStifItemParser& aItem ); + TInt GetLinkL( CStifItemParser& aItem ); + TInt GetPlaylistL( CStifItemParser& aItem ); + TBool IsSeekableL( CStifItemParser& aItem ); + + private: + + TFileName GetFileNameAndPathL( CStifItemParser& aItem ); + + void ConstructL(); + + CVideoPlaylistUtility_Tester(); + + private: + + CVideoPlaylistUtility* iPlaylistUtility; +}; + +#endif /* VIDEOPLAYLISTUTILITY_TESTER_H_ */ diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/videoplaylist_utility_api/tsrc/videoplaylistutilitytest/src/videoplaylistutilitytest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/videoplaylist_utility_api/tsrc/videoplaylistutilitytest/src/videoplaylistutilitytest.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,153 @@ +/* +* 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: videoplaylistutility test class for STIF testing +* +*/ + +// Version : %version: 2 % + + +// INCLUDE FILES +#include +#include +#include "videoplaylistutilitytest.h" +#include + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cvideoplaylistutility_test::Cvideoplaylistutility_test +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +Cvideoplaylistutility_test::Cvideoplaylistutility_test( CTestModuleIf& aTestModuleIf ) + : CScriptBase( aTestModuleIf ) +{ +} + +// ----------------------------------------------------------------------------- +// Cvideoplaylistutility_test::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Cvideoplaylistutility_test::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(Kvideoplaylistutility_testLogFileWithTitle, &title); + } + else + { + logFileName.Copy(Kvideoplaylistutility_testLogFile); + } + + iLog = CStifLogger::NewL( Kvideoplaylistutility_testLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + SendTestClassVersion(); +} + +// ----------------------------------------------------------------------------- +// Cvideoplaylistutility_test::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Cvideoplaylistutility_test* Cvideoplaylistutility_test::NewL( CTestModuleIf& aTestModuleIf ) +{ + Cvideoplaylistutility_test* self = new (ELeave) Cvideoplaylistutility_test( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; +} + +// Destructor +Cvideoplaylistutility_test::~Cvideoplaylistutility_test() +{ + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + REComSession::FinalClose(); +} + +//----------------------------------------------------------------------------- +// Cvideoplaylistutility_test::SendTestClassVersion +// Method used to send version of test class +//----------------------------------------------------------------------------- +// +void Cvideoplaylistutility_test::SendTestClassVersion() +{ + TVersion moduleVersion; + moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; + moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; + moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; + + TFileName moduleName; + moduleName = _L("videoplaylistutility_test.dll"); + + TBool newVersionOfMethod = ETrue; + TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); +} + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( CTestModuleIf& aTestModuleIf ) +{ + return ( CScriptBase* ) Cvideoplaylistutility_test::NewL( aTestModuleIf ); +} + +// End of File diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/videoplaylist_utility_api/tsrc/videoplaylistutilitytest/src/videoplaylistutilitytestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/videoplaylist_utility_api/tsrc/videoplaylistutilitytest/src/videoplaylistutilitytestBlocks.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,118 @@ +/* +* Copyright (c) 2008 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: videoplaylistutility test class for STIF testing +* +*/ + +// Version : %version: 2 % + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include "videoplaylistutilitytest.h" +#include "videoplaylistutilitytester.h" + +// ============================= LOCAL FUNCTIONS =============================== + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cvideoplaylistutility_test::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Cvideoplaylistutility_test::Delete() +{ + if ( iPlaylistUtilityTester ) + { + delete iPlaylistUtilityTester; + iPlaylistUtilityTester = NULL; + } +} + +// ----------------------------------------------------------------------------- +// Cvideoplaylistutility_test::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Cvideoplaylistutility_test::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( "CreatePlaylistUtility", Cvideoplaylistutility_test::CreatePlaylistUtilityL ), + ENTRY( "GetFileInfo", Cvideoplaylistutility_test::GetFileInfoL ), + ENTRY( "GetLink", Cvideoplaylistutility_test::GetLinkL ), + ENTRY( "GetPlaylist", Cvideoplaylistutility_test::GetPlaylistL ), + ENTRY( "IsSeekable", Cvideoplaylistutility_test::IsSeekableL ), + + }; + + const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); +} + +// ----------------------------------------------------------------------------- +// Cvideoplaylistutility_test::CreateEngineL +// ----------------------------------------------------------------------------- +// +TInt Cvideoplaylistutility_test::CreatePlaylistUtilityL( CStifItemParser& aItem ) +{ + iPlaylistUtilityTester = CVideoPlaylistUtility_Tester::NewL(); + + return iPlaylistUtilityTester->CreatePlaylistUtilityL( aItem ); +} + +// ----------------------------------------------------------------------------- +// Cvideoplaylistutility_test::CreateGenericParametersL +// ----------------------------------------------------------------------------- +// +TInt Cvideoplaylistutility_test::GetFileInfoL(CStifItemParser& aItem) +{ + return iPlaylistUtilityTester->GetFileInfoL(aItem); +} + +// ----------------------------------------------------------------------------- +// Cvideoplaylistutility_test::OpenFileL +// ----------------------------------------------------------------------------- +// +TInt Cvideoplaylistutility_test::GetLinkL( CStifItemParser& aItem ) +{ + return iPlaylistUtilityTester->GetLinkL( aItem ); +} + +// ----------------------------------------------------------------------------- +// Cvideoplaylistutility_test::SetDefaultAccessPointL +// ----------------------------------------------------------------------------- +// +TInt Cvideoplaylistutility_test::GetPlaylistL( CStifItemParser& aItem ) +{ + return iPlaylistUtilityTester->GetPlaylistL( aItem ); +} + +// ----------------------------------------------------------------------------- +// Cvideoplaylistutility_test::SetDefaultAccessPointL +// ----------------------------------------------------------------------------- +// +TInt Cvideoplaylistutility_test::IsSeekableL( CStifItemParser& aItem ) +{ + return iPlaylistUtilityTester->IsSeekableL( aItem ); +} + +// [End of File] - Do not remove diff -r 000000000000 -r a2952bb97e68 mmappfw_plat/videoplaylist_utility_api/tsrc/videoplaylistutilitytest/src/videoplaylistutilitytester.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/videoplaylist_utility_api/tsrc/videoplaylistutilitytest/src/videoplaylistutilitytester.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,330 @@ +/* +* Copyright (c) 2008 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: videoplaylistutility test class for STIF testing +* +*/ + +// Version : %version: 2 % + +#include +#include +#include +#include +#include + +#include "videoplaylistutilitytester.h" +#include "videoplaylistutility.h" + + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaylistUtility_Tester::NewL +// ------------------------------------------------------------------------------------------------- +// +CVideoPlaylistUtility_Tester* CVideoPlaylistUtility_Tester::NewL() +{ + CVideoPlaylistUtility_Tester* self = new (ELeave) CVideoPlaylistUtility_Tester; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; +} + +// ----------------------------------------------------------------------------- +// CVideoPlaylistUtility_Tester::~CVideoPlaylistUtility_Tester +// +// ----------------------------------------------------------------------------- +// +CVideoPlaylistUtility_Tester::~CVideoPlaylistUtility_Tester() +{ + delete iPlaylistUtility; + iPlaylistUtility = NULL; + +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaylistUtility_Tester::ConstructL +// ------------------------------------------------------------------------------------------------- +// +void CVideoPlaylistUtility_Tester::ConstructL() +{ +} + +// ----------------------------------------------------------------------------- +// CVideoPlaylistUtility_Tester::CVideoPlaylistUtility_Tester +// +// ----------------------------------------------------------------------------- +// +CVideoPlaylistUtility_Tester::CVideoPlaylistUtility_Tester() +{ +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaylistUtility_Tester::CreateEngineL +// ------------------------------------------------------------------------------------------------- +// +TInt CVideoPlaylistUtility_Tester::CreatePlaylistUtilityL( CStifItemParser& /*aItem*/ ) +{ + iPlaylistUtility = CVideoPlaylistUtility::NewL(); + + return KErrNone; +} + + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaylistUtility_Tester::GetFileInfoL +// ------------------------------------------------------------------------------------------------- +// +TInt CVideoPlaylistUtility_Tester::GetFileInfoL( CStifItemParser& aItem ) +{ + CMediaRecognizer::TMediaType mediaType = CMediaRecognizer::ELocalRamFile; + TInt error = KErrNone; + + TBool useFileHandle; + TInt media; + TBool expectedSingleLink; + TBool expectedLocalFile; + TBool singleLink; + TBool localFile; + + User::LeaveIfError( aItem.GetNextInt( useFileHandle ) ); + + TFileName filename = GetFileNameAndPathL( aItem ); + + User::LeaveIfError( aItem.GetNextInt( media ) ); + + + // Get the mediaType + switch ( media ) + { + case ERamFile: + { + mediaType = CMediaRecognizer::ELocalRamFile; + break; + } + case EAsxFile: + { + mediaType = CMediaRecognizer::ELocalAsxFile; + break; + } + } + + if ( useFileHandle ) + { + RFs fs; + RFile file; + + User::LeaveIfError( fs.Connect() ); + + fs.ShareProtected(); + + User::LeaveIfError( file.Open( fs, filename, EFileRead ) ); + + iPlaylistUtility->GetFileInfoL( file, mediaType, singleLink, localFile ); + + file.Close(); + fs.Close(); + } + else + { + iPlaylistUtility->GetFileInfoL( filename, mediaType, singleLink, localFile ); + } + + // Read the expected result + User::LeaveIfError( aItem.GetNextInt( expectedSingleLink ) ); + User::LeaveIfError( aItem.GetNextInt( expectedLocalFile ) ); + + if ( expectedSingleLink != singleLink || expectedLocalFile != localFile ) + { + error = KErrGeneral; + } + + return error; +} + + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaylistUtility_Tester::GetLinkL +// ------------------------------------------------------------------------------------------------- +// +TInt CVideoPlaylistUtility_Tester::GetLinkL( CStifItemParser& aItem ) +{ + TInt error = KErrNone; + + _LIT( KRamStreamingLink, "rtsp://stream.3gp" ); + _LIT( KAsxStreamingLink, "http://10.48.2.56:443/stream.wmv" ); + +#ifdef __WINSCW__ + _LIT( KRamLocalLink, "c:\\data\\videos\\local.3gp" ); +#else + _LIT( KRamLocalLink, "e:\\testing\\data\\local.3gp" ); +#endif + + TInt linkType; + TPtrC link; + + User::LeaveIfError( aItem.GetNextInt( linkType ) ); + + link.Set(iPlaylistUtility->GetLinkLC()); + + // Get the linkType + switch ( linkType ) + { + case ERamFileStreaming: + { + if ( link.CompareF(KRamStreamingLink) ) + { + error = KErrArgument; + } + break; + } + case ERamFileLocal: + { + if ( link.CompareF(KRamLocalLink) ) + { + error = KErrArgument; + } + break; + } + case EAsxFileStreaming: + { + if ( link.CompareF(KAsxStreamingLink) ) + { + error = KErrArgument; + } + break; + } + + } + + CleanupStack::PopAndDestroy(); + return error; +} + + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaylistUtility_Tester::GetPlaylistL +// ------------------------------------------------------------------------------------------------- +// +TInt CVideoPlaylistUtility_Tester::GetPlaylistL( CStifItemParser& aItem ) +{ + TInt error = KErrNone; + TInt linkCount; + TInt expectedCount; + + TInt accessPointId; + TInt embeddedInfo; + + User::LeaveIfError( aItem.GetNextInt( accessPointId ) ); + User::LeaveIfError( aItem.GetNextInt( expectedCount ) ); + User::LeaveIfError( aItem.GetNextInt( embeddedInfo ) ); + + CMPXMedia* playlist = iPlaylistUtility->GetPlayListL(accessPointId); + + linkCount = playlist->ValueTObjectL(KMPXMediaArrayCount); + + if ( linkCount != expectedCount ) + { + error = KErrArgument; + } + + // Get the mediaType + switch ( embeddedInfo ) + { + case EEmbeddedSeekInfo: + { + CMPXMediaArray* mediaArray = + playlist->Value(KMPXMediaArrayContents); + + for ( TInt i = 0; i < mediaArray->Count(); i++ ) + { + CMPXMedia* media = mediaArray->AtL( i ); + if ( !(media->IsSupported( KMPXMediaGeneralExtVideoSeekable )) ) + { + // The test clip has all the links set to non seek } + error = KErrArgument; + break; + } + } + break; + } + case ENoEmbeddedInfo: + { + CMPXMediaArray* mediaArray = + playlist->Value(KMPXMediaArrayContents); + + for ( TInt i = 0; i < mediaArray->Count(); i++ ) + { + CMPXMedia* media = mediaArray->AtL( i ); + if ((media->IsSupported( KMPXMediaGeneralExtVideoSeekable )) ) + { + // The test clip has all the links set to non seek } + error = KErrArgument; + break; + } + } + break; + } + default: + { + break; + } + } + + + delete playlist; + return error; +} + +// ------------------------------------------------------------------------------------------------- +// CVideoPlaylistUtility_Tester::IsSeekableL +// ------------------------------------------------------------------------------------------------- +// +TInt CVideoPlaylistUtility_Tester::IsSeekableL( CStifItemParser& aItem ) +{ + TInt error = KErrNone; + TBool seekable; + + User::LeaveIfError( aItem.GetNextInt( seekable ) ); + + if ( seekable != iPlaylistUtility->IsSeekable()) + { + error = KErrArgument; + } + + return error; +} + + +TFileName CVideoPlaylistUtility_Tester::GetFileNameAndPathL( CStifItemParser& aItem ) +{ + TPtrC filename; + +#ifdef __WINSCW__ + _LIT( KVideoTestPath, "c:\\data\\Videos\\" ); +#else + _LIT( KVideoTestPath, "e:\\testing\\data\\" ); +#endif + + User::LeaveIfError( aItem.GetNextString( filename ) ); + + TFileName fullPath; + + fullPath.Append( KVideoTestPath ); + + fullPath.Append( filename ); + + return fullPath; +} + +// EOF diff -r 000000000000 -r a2952bb97e68 mpx/Conf/mpx.confml Binary file mpx/Conf/mpx.confml has changed diff -r 000000000000 -r a2952bb97e68 mpx/Conf/mpx_101FFC03.crml Binary file mpx/Conf/mpx_101FFC03.crml has changed diff -r 000000000000 -r a2952bb97e68 mpx/Conf/mpx_101FFCD2.crml Binary file mpx/Conf/mpx_101FFCD2.crml has changed diff -r 000000000000 -r a2952bb97e68 mpx/cenrep/101FFC03.txt Binary file mpx/cenrep/101FFC03.txt has changed diff -r 000000000000 -r a2952bb97e68 mpx/cenrep/101FFCD2.txt Binary file mpx/cenrep/101FFCD2.txt has changed diff -r 000000000000 -r a2952bb97e68 mpx/cenrep/keys_mpx.xls Binary file mpx/cenrep/keys_mpx.xls has changed diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionengine/bwinscw/mpxcollectionengineU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionengine/bwinscw/mpxcollectionengineU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,31 @@ +EXPORTS + ??1CMPXCollectionEngine@@UAE@XZ @ 1 NONAME ; CMPXCollectionEngine::~CMPXCollectionEngine(void) + ?AddClientL@CMPXCollectionClientContext@@QAEXVTThreadId@@PAVCMPXMessageQueue@@@Z @ 2 NONAME ; void CMPXCollectionClientContext::AddClientL(class TThreadId, class CMPXMessageQueue *) + ?AddL@CMPXCollectionClientContext@@QAEXABVCMPXMedia@@@Z @ 3 NONAME ; void CMPXCollectionClientContext::AddL(class CMPXMedia const &) + ?BackL@CMPXCollectionClientContext@@QAEXPAVMMPXCollectionEngineObserver@@@Z @ 4 NONAME ; void CMPXCollectionClientContext::BackL(class MMPXCollectionEngineObserver *) + ?CancelRequest@CMPXCollectionClientContext@@QAEXPAVMMPXCollectionEngineObserver@@@Z @ 5 NONAME ; void CMPXCollectionClientContext::CancelRequest(class MMPXCollectionEngineObserver *) + ?CommandL@CMPXCollectionClientContext@@QAEXABVCMPXMedia@@PAVMMPXCollectionEngineObserver@@ABVCMPXMessageQueue@@@Z @ 6 NONAME ; void CMPXCollectionClientContext::CommandL(class CMPXMedia const &, class MMPXCollectionEngineObserver *, class CMPXMessageQueue const &) + ?CommandL@CMPXCollectionClientContext@@QAEXW4TMPXCollectionCommand@@H@Z @ 7 NONAME ; void CMPXCollectionClientContext::CommandL(enum TMPXCollectionCommand, int) + ?Filter@CMPXCollectionClientContext@@QBEPBVCMPXMedia@@XZ @ 8 NONAME ; class CMPXMedia const * CMPXCollectionClientContext::Filter(void) const + ?FindAllL@CMPXCollectionClientContext@@QAEXABVCMPXMedia@@PAVCBufBase@@PAVMMPXCollectionEngineObserver@@@Z @ 9 NONAME ; void CMPXCollectionClientContext::FindAllL(class CMPXMedia const &, class CBufBase *, class MMPXCollectionEngineObserver *) + ?FindAllSyncL@CMPXCollectionClientContext@@QAEPAVCMPXMedia@@ABV2@ABVCBufBase@@@Z @ 10 NONAME ; class CMPXMedia * CMPXCollectionClientContext::FindAllSyncL(class CMPXMedia const &, class CBufBase const &) + ?GetCapabilities@CMPXCollectionClientContext@@QAEHXZ @ 11 NONAME ; int CMPXCollectionClientContext::GetCapabilities(void) + ?GetSupportedTypesL@CMPXCollectionEngine@@QAEXAAV?$RPointerArray@VCMPXCollectionType@@@@@Z @ 12 NONAME ; void CMPXCollectionEngine::GetSupportedTypesL(class RPointerArray &) + ?LookupCollectionPluginID@CMPXCollectionEngine@@QAE?AVTUid@@V2@@Z @ 13 NONAME ; class TUid CMPXCollectionEngine::LookupCollectionPluginID(class TUid) + ?MediaL@CMPXCollectionClientContext@@QAEXABVCMPXMedia@@PAVMMPXCollectionEngineObserver@@@Z @ 14 NONAME ; void CMPXCollectionClientContext::MediaL(class CMPXMedia const &, class MMPXCollectionEngineObserver *) + ?NewL@CMPXCollectionEngine@@SAPAV1@XZ @ 15 NONAME ; class CMPXCollectionEngine * CMPXCollectionEngine::NewL(void) + ?NotifyL@CMPXCollectionEngine@@QAEXW4TMPXCollectionBroadCastMsg@@H@Z @ 16 NONAME ; void CMPXCollectionEngine::NotifyL(enum TMPXCollectionBroadCastMsg, int) + ?OpenL@CMPXCollectionClientContext@@QAEXABV?$TArray@VTUid@@@@HPAVMMPXCollectionEngineObserver@@@Z @ 17 NONAME ; void CMPXCollectionClientContext::OpenL(class TArray const &, int, class MMPXCollectionEngineObserver *) + ?OpenL@CMPXCollectionClientContext@@QAEXHHABV?$TArray@VTMPXAttribute@@@@PAVMMPXCollectionEngineObserver@@@Z @ 18 NONAME ; void CMPXCollectionClientContext::OpenL(int, int, class TArray const &, class MMPXCollectionEngineObserver *) + ?OpenL@CMPXCollectionClientContext@@QAEXHPAVMMPXCollectionEngineObserver@@@Z @ 19 NONAME ; void CMPXCollectionClientContext::OpenL(int, class MMPXCollectionEngineObserver *) + ?OpenL@CMPXCollectionClientContext@@QAEXPAVCMPXCollectionPath@@HPAVMMPXCollectionEngineObserver@@@Z @ 20 NONAME ; void CMPXCollectionClientContext::OpenL(class CMPXCollectionPath *, int, class MMPXCollectionEngineObserver *) + ?Path@CMPXCollectionClientContext@@QBEABVCMPXCollectionPath@@XZ @ 21 NONAME ; class CMPXCollectionPath const & CMPXCollectionClientContext::Path(void) const + ?PluginId@CMPXCollectionClientContext@@QBE?AVTUid@@XZ @ 22 NONAME ; class TUid CMPXCollectionClientContext::PluginId(void) const + ?RemoveClient@CMPXCollectionClientContext@@QAEXABVCMPXMessageQueue@@@Z @ 23 NONAME ; void CMPXCollectionClientContext::RemoveClient(class CMPXMessageQueue const &) + ?RemoveL@CMPXCollectionClientContext@@QAEXABVCMPXMedia@@@Z @ 24 NONAME ; void CMPXCollectionClientContext::RemoveL(class CMPXMedia const &) + ?RemoveL@CMPXCollectionClientContext@@QAEXPAVCMPXCollectionPath@@PAVMMPXCollectionEngineObserver@@@Z @ 25 NONAME ; void CMPXCollectionClientContext::RemoveL(class CMPXCollectionPath *, class MMPXCollectionEngineObserver *) + ?ResolvePluginUid@CMPXCollectionEngine@@QAE?AVTUid@@ABV?$TArray@VTUid@@@@@Z @ 26 NONAME ; class TUid CMPXCollectionEngine::ResolvePluginUid(class TArray const &) + ?SessionInitL@CMPXCollectionEngine@@QAEAAVCMPXCollectionClientContext@@ABVTUid@@VTThreadId@@PAVCMPXMessageQueue@@@Z @ 27 NONAME ; class CMPXCollectionClientContext & CMPXCollectionEngine::SessionInitL(class TUid const &, class TThreadId, class CMPXMessageQueue *) + ?SetFilterL@CMPXCollectionClientContext@@QAEXPBVCMPXMedia@@@Z @ 28 NONAME ; void CMPXCollectionClientContext::SetFilterL(class CMPXMedia const *) + ?SetL@CMPXCollectionClientContext@@QAEXABVCMPXMedia@@@Z @ 29 NONAME ; void CMPXCollectionClientContext::SetL(class CMPXMedia const &) + diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionengine/eabi/mpxcollectionengineU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionengine/eabi/mpxcollectionengineU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,37 @@ +EXPORTS + _ZN20CMPXCollectionEngine12SessionInitLERK4TUid9TThreadIdP16CMPXMessageQueue @ 1 NONAME + _ZN20CMPXCollectionEngine16ResolvePluginUidERK6TArrayI4TUidE @ 2 NONAME + _ZN20CMPXCollectionEngine18GetSupportedTypesLER13RPointerArrayI18CMPXCollectionTypeE @ 3 NONAME + _ZN20CMPXCollectionEngine24LookupCollectionPluginIDE4TUid @ 4 NONAME + _ZN20CMPXCollectionEngine4NewLEv @ 5 NONAME + _ZN20CMPXCollectionEngine7NotifyLE26TMPXCollectionBroadCastMsgi @ 6 NONAME + _ZN20CMPXCollectionEngineD0Ev @ 7 NONAME + _ZN20CMPXCollectionEngineD1Ev @ 8 NONAME + _ZN20CMPXCollectionEngineD2Ev @ 9 NONAME + _ZN27CMPXCollectionClientContext10AddClientLE9TThreadIdP16CMPXMessageQueue @ 10 NONAME + _ZN27CMPXCollectionClientContext10SetFilterLEPK9CMPXMedia @ 11 NONAME + _ZN27CMPXCollectionClientContext12FindAllSyncLERK9CMPXMediaRK8CBufBase @ 12 NONAME + _ZN27CMPXCollectionClientContext12RemoveClientERK16CMPXMessageQueue @ 13 NONAME + _ZN27CMPXCollectionClientContext13CancelRequestEP28MMPXCollectionEngineObserver @ 14 NONAME + _ZN27CMPXCollectionClientContext15GetCapabilitiesEv @ 15 NONAME + _ZN27CMPXCollectionClientContext4AddLERK9CMPXMedia @ 16 NONAME + _ZN27CMPXCollectionClientContext4SetLERK9CMPXMedia @ 17 NONAME + _ZN27CMPXCollectionClientContext5BackLEP28MMPXCollectionEngineObserver @ 18 NONAME + _ZN27CMPXCollectionClientContext5OpenLEP18CMPXCollectionPathiP28MMPXCollectionEngineObserver @ 19 NONAME + _ZN27CMPXCollectionClientContext5OpenLERK6TArrayI4TUidEiP28MMPXCollectionEngineObserver @ 20 NONAME + _ZN27CMPXCollectionClientContext5OpenLEiP28MMPXCollectionEngineObserver @ 21 NONAME + _ZN27CMPXCollectionClientContext5OpenLEiiRK6TArrayI13TMPXAttributeEP28MMPXCollectionEngineObserver @ 22 NONAME + _ZN27CMPXCollectionClientContext6MediaLERK9CMPXMediaP28MMPXCollectionEngineObserver @ 23 NONAME + _ZN27CMPXCollectionClientContext7RemoveLEP18CMPXCollectionPathP28MMPXCollectionEngineObserver @ 24 NONAME + _ZN27CMPXCollectionClientContext7RemoveLERK9CMPXMedia @ 25 NONAME + _ZN27CMPXCollectionClientContext8CommandLE21TMPXCollectionCommandi @ 26 NONAME + _ZN27CMPXCollectionClientContext8CommandLERK9CMPXMediaP28MMPXCollectionEngineObserverRK16CMPXMessageQueue @ 27 NONAME + _ZN27CMPXCollectionClientContext8FindAllLERK9CMPXMediaP8CBufBaseP28MMPXCollectionEngineObserver @ 28 NONAME + _ZNK27CMPXCollectionClientContext4PathEv @ 29 NONAME + _ZNK27CMPXCollectionClientContext6FilterEv @ 30 NONAME + _ZNK27CMPXCollectionClientContext8PluginIdEv @ 31 NONAME + _ZTI20CMPXCollectionEngine @ 32 NONAME ; ## + _ZTI27CMPXCollectionClientContext @ 33 NONAME ; ## + _ZTV20CMPXCollectionEngine @ 34 NONAME ; ## + _ZTV27CMPXCollectionClientContext @ 35 NONAME ; ## + diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionengine/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionengine/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2006 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 for project Player Engine +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +mpxcollectionengine.mmp + diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionengine/group/mpxcollectionengine.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionengine/group/mpxcollectionengine.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2006 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: player engine project specification +* +*/ + + + +#include +#include + +TARGET mpxcollectionengine.dll +CAPABILITY CAP_GENERAL_DLL +TARGETTYPE DLL +UID 0x1000008D 0x101FFC32 +VENDORID VID_DEFAULT + +USERINCLUDE ../inc +USERINCLUDE ../../inc + +MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + +SOURCEPATH ../src +SOURCE mpxcollectionengine.cpp +SOURCE mpxcollectionpluginhandler.cpp +SOURCE mpxcollectionclientcontext.cpp +SOURCE mpxcollectioncache.cpp +SOURCE mpxcollectionplugininfo.cpp + +LIBRARY euser.lib ecom.lib estor.lib bafl.lib efsrv.lib PlatformEnv.lib sysutil.lib +LIBRARY mpxcommon.lib + +#if defined(ARMCC) +deffile ../eabi/ +#elif defined(WINSCW) +deffile ../bwinscw/ +#endif + diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionengine/inc/mpxcollectioncache.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionengine/inc/mpxcollectioncache.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,184 @@ +/* +* Copyright (c) 2007 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: Generic collection cache +* +*/ + + +#ifndef MPXCOLLECTIONCACHE_H +#define MPXCOLLECTIONCACHE_H + +// INCLUDES +#include +#include +#include + +// CLASS FORWARDS +class CMPXMedia; +class CMPXCollectionPath; +class TMPXAttribute; +class CMPXCollectionCacheNode; + +/** +* The collection cache stores information already retrieved by clients so it can be +* returned immediately if requested again. The information is stored in a tree +* structure, where each tree node corresponds to a path node. When information is +* requested, the path is mapped against the tree and if a corresponding node exists the +* results are returned from cache. +* +* The cache can be limited in size, if the client defines a maximum size, lower priority +* nodes are discarded to make room for new information. The criteria considered when +* discarding nodes include: priority value (specified by the client), path level and +* time of addition. +* +* @lib mpxcollectionengine.lib (not exported) +*/ +NONSHARABLE_CLASS(CMPXCollectionCache) : + public CBase + { +public: + /** + * Two-phased constructor. + * @param aMaximumSizeRatio maximum cache size in percentage ratio + * If not specified the cache does not have a limit + * @return Constructed object + */ + static CMPXCollectionCache* NewL(TInt aMaximumSizeRatio = -1); + + /** + * Destructor + */ + virtual ~CMPXCollectionCache(); + +public: + /** + * Cache entry priority values. Entries with lower priority will be discarded + * sooner than the ones with higher priority. + */ + enum TCachePriority + { + EPriorityLow, + EPriorityNormal, + EPriorityHigh + }; + +public: + /** + * Adds a result set to the cache. + * @param aPath path defining the context of the results. + * @param aAttrs attributes requested by the client application and included in + * the result set. + * @param aResults result set corresponding to the path. Not owned. + * @param aNotCacheableAttrs attributes that are not cacheable + * @param aMediaFromOpenL whether or not this media was from an OpenL + * @param aPriority result set priority + * @return CMPXMedia object in the cache or the original object if add failed + */ + CMPXMedia* AddL( + const CMPXCollectionPath& aPath, + const TArray& aAttrs, + CMPXMedia& aResults, + TBool aMediaFromOpenL = EFalse, + TCachePriority aPriority = EPriorityNormal ); + + /** + * Returns the information corresponding to the specified path and attribute set + * if available in the cache. + * @param aPath path defining the information context. + * @param aAttrs attribute set requested by the client. + * @return Valid results or NULL if the path/attribute set specified cannot be + * found in the cache. + */ + CMPXMedia* GetL( + const CMPXCollectionPath& aPath, + const TArray& aAttrs, + TBool aMediaFromOpenL = EFalse ); + + /** + * Removes the specified path and all its children from the cache. + * @param aPath path defining the context to be removed. + */ + void RemoveL(const CMPXCollectionPath& aPath); + + /** + * Resets cache and removes all nodes + */ + void Reset(); + + /** + * Handle some change from the collection + * @param aCollectionId collectoin that the change is comming from + * @param aChangeItemId item ID of the changed event + */ + void HandleChangeL( TUid aCollectionId, TMPXItemId aChangeItemId ); + +private: + + /** + * C++ constructor + * @param aMaximumSizeKb maximum cache size in percentage ratio. + */ + CMPXCollectionCache(TInt aMaximumSizeRatio); + + /** + * 2nd phase contructor + */ + void ConstructL(); + + /** + * Returns the cache node corresponding to the specified path. + * @param aPath path to be looked up in the cache. + * @param aCreateNodes if ETrue all the missing nodes for the specified + * path will be created if they do not already exist. If EFalse + * the method returns NULL if corresponding node is not found. + * @return valid cache node if found or created, NULL if not found. + */ + CMPXCollectionCacheNode* NodeFromPathL(const CMPXCollectionPath& aPath, + TBool aCreateNodes = EFalse); + + /** + * Removes a specified node and all its children from the cache. + * @param aNode node to be removed. Ownership is transferred. + */ + void RemoveNode(CMPXCollectionCacheNode* aNode); + + /** + * Checks the memory condition and clears cache to free some memory + * maximum percentage ratio specified in the constructor is used to detect + * low memory condition + * @return EFalse if low memory condition detected, ETrue otherwise + */ + TBool ManageCacheSizeL(); + +#ifdef _DEBUG + /** + * Prints the cache tree. + */ + void PrintTree( TBool aPrintAtts = EFalse ); +#endif + +private: + /** + * Root node for the cache tree, created when the cache is created. + */ + CMPXCollectionCacheNode* iRoot; + + /** + * Maximum size of the cache in percentage ratio, specified by the client. + */ + TInt iMaximumSizeRatio; + }; + +#endif // MPXCOLLECTIONCACHE_H + diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionengine/inc/mpxcollectionclientcontext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionengine/inc/mpxcollectionclientcontext.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,652 @@ +/* +* Copyright (c) 2006 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: Maintains sessions to paths +* +*/ + +#ifndef CMPXCOLLECTIONCLIENTCONTEXT_H +#define CMPXCOLLECTIONCLIENTCONTEXT_H + +#include +#include +#include +#include +#include +#include +#include +#include "mpxcollectioncache.h" + +class CMPXClientList; +class CMPXCollectionPath; +class CMPXCollectionEngine; +class CMPXCollectionPlugin; +class MMPXCollectionEngineObserver; +class CMPXActiveTaskQueue; +class CMPXMedia; +class CMPXCollectionCache; + +class CMPXCollectionClientContext : public CBase, + public MMPXCollectionPluginObserver, + public MMPXTaskQueueObserver + { +public: // DATA type + enum TContextType + { + EContextBrowse, // context for browing + EContextMedia, // context for media properties + EContextRemove, // context for removing paths + EContextCount + }; +public: + /** + * Two-phase constructor + * + * @param aEngine reference to collection engine + * @param aModeId mode id + * @return object created + */ + static CMPXCollectionClientContext* NewL(CMPXCollectionEngine& aEngine, + CMPXCollectionCache& aCache, const TUid& aModeId); + + /** + * Destructor + * + */ + ~CMPXCollectionClientContext(); + + /** + * Open collection by path + * + * @param aPath collection path. Ownership transferred if not leave + * @param aMode, open mode + * @param aCallback callback + * @leave KErrArgument if aPath is not valid, or other system error + */ + IMPORT_C void OpenL(CMPXCollectionPath* aPath, + TInt aMode, + MMPXCollectionEngineObserver* aCallback); + + /** + * Open collection by index + * + * @param aIndex the index to current browse path + * @param aMode, open mode + * @param aAttrs, media attributes requested + * @param aCallback callback + * @leave system error + */ + IMPORT_C void OpenL(TInt aIndex, + TInt aMode, + const TArray& aAttrs, + MMPXCollectionEngineObserver* aCallback); + + /** + * Open collection by uids. Collections which match the uids will be returned. + * + * @param aUids a list of uids to be matched + * @param aMode, open mode + * @param aCallback callback + * @leave KErrNotReady if current browse path is invalid, + * KErrArgument if aIndex is out of range + * or other system error + */ + IMPORT_C void OpenL(const TArray& aUids, + TInt aMode, + MMPXCollectionEngineObserver* aCallback); + + /** + * Request current content of browse context + * + * @param aMode, open mode + * @param aCallback callback + * @leave system error + */ + IMPORT_C void OpenL(TInt aMode, MMPXCollectionEngineObserver* aCallback); + + /** + * Back to previous level + * @param aCallback callback + * @leave system error + */ + IMPORT_C void BackL(MMPXCollectionEngineObserver* aCallback); + + /** + * Media request command + * + * @param aCmd command of media request + * @param aCallback callback + * @leave KErrArgument if aCmd is not valid, or other system error + */ + IMPORT_C void MediaL(const CMPXCommand& aCmd, + MMPXCollectionEngineObserver* aCallback); + + /** + * Add a media + * + * @param aMedia media object + * @leave system error + */ + IMPORT_C void AddL(const CMPXMedia& aMedia); + + /** + * Remove a media + * + * @param aMedia media object + * @leave system error + */ + IMPORT_C void RemoveL(const CMPXMedia& aMedia); + + /** + * Update a media + * + * @param aMedia media object + * @leave system error + */ + IMPORT_C void SetL(const CMPXMedia& aMedia); + + /** + * Remove media by path + * + * @param aPath collection path. Ownership transferred if not leave + * @param aCallback callback + * @leave KErrArgument if aPath is not valid, or other system error + */ + IMPORT_C void RemoveL(CMPXCollectionPath* aPath, + MMPXCollectionEngineObserver* aCallback); + + /** + * Return plugin uid + * + * @return plugin uid + */ + IMPORT_C TUid PluginId() const; + + /** + * Return current collection path + * + * @return collection path + */ + IMPORT_C const CMPXCollectionPath& Path() const; + + /** + * Cancel all requests from aCallback + * + * @param aCallback callback + */ + IMPORT_C void CancelRequest(MMPXCollectionEngineObserver* aCallback); + + /** + * Attach another client to this object. aName is the unique name of the + * client, used for identifying the client and passing messages; aId is the + * thread id of the client of the interface (not the server session) + * + * @param aId thread id of the client + * @param aMsgQueue message queue for the client + * @leave The function leaves with one of the system wide error codes, + * if the operation fails. + */ + IMPORT_C void AddClientL(TThreadId aId, + CMPXMessageQueue* aMsgQueue); + + /** + * Remove the client from the context. aName is the unique name of the + * client, used for identifying the client and passing messages. + * + * @param aMsgQueue message queue for the client + */ + IMPORT_C void RemoveClient(const CMPXMessageQueue& aMsgQueue); + + /** + * Get the supported attributes of the current plugin using by the context + * @return TCollectionCapability bit mask flag + */ + IMPORT_C TCollectionCapability GetCapabilities(); + + /** + * Find all + * + * @param aMedia media object of matching criteria, Ownership transferred + * @param aBuf, buffer data, array of attributes for results, + * Ownership transferred if find asynchronously + * @param aCallback callback + * @leave system error + */ + IMPORT_C void FindAllL(const CMPXMedia& aMedia, + CBufBase* aBuf, + MMPXCollectionEngineObserver* aCallback); + + /** DEPRECATE, Use CommandL(CMPXCommand) + * Find all synchronously + * + * @param aMedia media object of matching criteria + * @param aBuf, buffer data, array of attributes for results + * @leave system error + * @return results of the search + */ + IMPORT_C CMPXMedia* FindAllSyncL(const CMPXMedia& aMedia, + const CBufBase& aBuf); + + /** + * Set the current filter applied to browsing + */ + IMPORT_C void SetFilterL(const CMPXFilter* aFilter); + + /** + * Get the current filter applied to browsing + * @return filter + */ + IMPORT_C const CMPXFilter* Filter() const; + + /** DEPRECATED + * Handle a collection command + * @param aCmd, command to handle + * @param aData, optional data + */ + IMPORT_C void CommandL(TMPXCollectionCommand aCmd, TInt aData); + + /** + * Handle a collection command + * @param aCmd, command to handle + * @param aCallback callback + * @param aMsgQueue Message Queue for the client + * @leave KErrNotReady if not collection opened, or system error + */ + IMPORT_C void CommandL(const CMPXCommand& aCmd, + MMPXCollectionEngineObserver* aCallback, + const CMPXMessageQueue& aMsgQueue); + + /** + * Does this thread have a shareable client? If yes, a default mode + * connection can bind to it. + * + * @param aId thread id of the client + * @return ETrue, if shareableclient is in the client list + */ + TBool HasShareableClient(TThreadId aId); + + /** + * Notify the client of a collection event + * @param aMsg Message type + * @param aData some data + */ + void NotifyL( TMPXCollectionBroadCastMsg aMsg, TInt aData ); + + /** + * Get the mode id of the context + * @return collection mode id + */ + const TUid& ModeId() const; + + /** + * Handle message from plug-in + * + * @param aMsg, message from the plug-in + * @param aError, error code + * @param aNotifyOthers, indicates whether to notify other client contexts + * that the collection has changed + */ + void DoHandleMessage(CMPXMessage* aMsg, + TInt aError, + TBool aNotifyOthers); + +private: // From base classes + + /////////////////////////////////////////////////////////////////////////// + // From MMPXCollectionPluginObserver + + /** + * Handle message from plug-in + * + * @param aMessage, message from the plug-in, Ownership not transferred. + * @param aError error code + */ + void HandleMessage(CMPXMessage* aMsg, TInt aError); + + /** + * Handle opening group contents + * + * @param aMedia media, Ownership not transferred. + * @param aErr error code + */ + void HandleOpen(CMPXMedia* aMedia, TInt aErr); + + /** + * Handle opening a group, e.g. an artist + * + * @param aMedia media object returned. NULL will be returned if error. + * Ownership not transferred. + * @param aPath full path to to current level. Including top level node as well. + * NULL will be returned if error. Ownership not transferred + * @param aErr error code + */ + void HandleOpen(CMPXMedia* aMedia, + const CMPXCollectionPath* aPath, + TInt aErr); + + /** + * Handle opening an item + * + * @param aPath selected item, Ownership not transferred. + * @param aErr error code + */ + void HandleOpen(CMPXCollectionPath* aPath, TInt aErr); + + /** + * Handle media + * + * @param aMedia media Ownership not transferred. + * @param aError error code + */ + void HandleMedia(CMPXMedia* aMedia, TInt aError); + + /** + * Handle completion of a asynchronous command + * + * @param aCommandResult result of the command, NULL if error + * Ownership not transferred. + * @param aError error code + */ + void HandleCommandComplete(CMPXCommand* aCommandResult, + TInt aError); + + /** + * Handle Find results + * @param aMedia media item(s), Ownership not transferred. + * @param aError, error code + */ + void HandleFindAll(CMPXMedia* aMedia, TInt aError); + + /** + * Handles remove results + * @param aUriArray, NULL if the plugin does not use concept of URI + * else, contains the file path to delete a file + * @param aError, error code + */ + void HandleRemove(const CDesCArray& aUriArray, TInt aError); + + /////////////////////////////////////////////////////////////////////////// + // From MMPXTaskQueueObserver + + /** + * Execute a task + * @param aTask task number + * @param aParamData, parameter + * @param aPtrData, any object + * @param aBuf, buffer containing externalized parameters for the task. + * @param aCallback call back function pointer + * @param aCObject1 object 1 owned by task queue + * @param aCObject2 object 2 owned by task queue + */ + void ExecuteTask(TInt aTask, + TInt aParamData, + TAny* aPtrData, + const CBufBase& aBuf, + TAny* aCallback, + CBase* aCObject1, + CBase* aCObject2); + + /** + * @see MMPXTaskQueueObserver + */ + void HandleTaskError(TInt aTask, + TAny* aPtrData, + TAny* aCallback, + TInt aError); + +private: + /** + * Open current level of collection + * + */ + void OpenL(); + + + /** + * Back to upper level + * + */ + void BackL(); + + /** + * Reopen current level + * + */ + void ReOpenL(); + + /** + * Find Media Request + * @param aMedia, searching criteria + * @param aBuf, buffered data + * @param aPlugin, plug to handle the find all + * @param aResult, sync finding result + * @param aSync, flag to indicate sync or async find + */ + void FindAllL(const CMPXMedia& aMedia, + const CBufBase& aBuf, + CMPXCollectionPlugin& aPlugin, + CMPXMedia** aResult = NULL, + TBool aSync = EFalse); + + /** + * Initialize + * @param aCallback callback when initialization completes + */ + void InitL(MMPXCollectionEngineObserver* aCallback); + + /** + * Execute a task + * @param aTask task number + * @param aParamData, parameter + * @param aPtrData, any object + * @param aCallback call back function pointer + * @param aBuf buffer data + * @param aCObject1 object 1 owned by task queue + * @param aCObject2 object 2 owned by task queue + * @param aPlugin out parameter, plugin of the task. + */ + void ExecuteTaskL(TInt aTask, + TInt aParamData, + TAny* aPtrData, + TAny* aCallback, + const CBufBase& aBuf, + CBase* aCObject1, + CBase* aCObject2, + CMPXCollectionPlugin*& aPlugin); + + /** + * Handle error of execution + * @param aPlugin plugin object + * @param aErr error number + * @param aUnuserPlugin ETrue decrement reference count of plugin + */ + void HandleError(CMPXCollectionPlugin& aPlugin, + TInt aErr, + TBool aUnusePlugin=EFalse); + + /** + * Resolve plugin + * @param aPath, Collection path + * @param aUid implementation uid of the plugin associated with the path + */ + void ResolvePluginL(const CMPXCollectionPath& aPath, TUid& aUid); + + /** + * Resolve plugin for FindAllL + * + * @param aMedia media object contains matching criteria + * @param aPlugin, plugin reutrned + */ + void ResolvePluginL(const CMPXMedia& aMedia, + CMPXCollectionPlugin*& aPlugin); + + /** + * Add a media into the collection + * Unpacks a media item group + * @param aOp, operation code + * @param aMedia, media object representing a list or a file + */ + void DoUpdateMediaL(TInt aOp, const CMPXMedia& aMedia); + + /** + * Add/Remove/Set an "item" into the collection + * @param aOp, operation code + * @param aMedia, single media "item" + */ + void DoHandleItemL(TInt aOp, const CMPXMedia& aMedia); + + /** + * Handle a synchronous collection command + * @param aCmd, command to handle + * @param aPlugin, plugin to prococess the command + */ + void DoHandleSyncCommandL(const CMPXCommand& aCmd, + const CMPXMessageQueue& aMsgQueue, + CMPXCollectionPlugin* aPlugin=NULL); + + /** + * Handle a select collection command + * @param aCmd, command to handle + */ + void DoHandleSelectCommandL(const CMPXCommand& aCmd); + + /** + * Handle opening group contents + * + * @param aMedia media + * @param aPath full path to current level + * @param aCallback callback of the open request + * @param aErr error code + * @param aAddtoCache Should this be added to the cache or not + * @param aOpenTask is this a OpenL task + */ + void DoHandleOpenL(CMPXMedia* aMedia, + const CMPXCollectionPath* aPath, + MMPXCollectionEngineObserver* aCallback, + TInt aErr, + TBool aAddToCache, + TBool aOpenTask ); + + /** + * Handle opening an item + * + * @param aPath selected item + * @param aErr error code + */ + void DoHandleOpenL(CMPXCollectionPath* aPath, + TInt aErr); + + /** + * Handle message from plug-in + * + * @param aMsg, message from the plug-in + * @param aError, error code + */ + void DoHandleMessageL(const CMPXMessage& aMsg, TInt aError); + + /** + * Handles an Open request. First checks the cache and if the results + * are not found there it calls the plugin. + */ + void DoPluginOpenL(); + + /** + * Handle a media request. First checks the cache and if the results + * are not found there it calls the plugin. + */ + void DoPluginMediaL( CMPXCollectionPath& aPath, + const TCapabilitySet& aCaps, + CMPXAttributeSpecs& aSpecs, + CMPXFilter& aFilter); + + /** + * Sets the plugin of the specified type to the value provided. This method + * ensures that if valid, the previous plugin's reference count is decremented. + * @param aType identifies the context type + * @param aPlugin new plugin + */ + void SetPlugin(TContextType aType, CMPXCollectionPlugin* aPlugin); + + /** + * Checks whether or not the attributes are cacheable + * + * @return ETrue if attributes are cacheable, else EFalse + */ + TBool AttributesCacheableL( + const TArray& aAttrs, + const CMPXCollectionPath& aPath ); + + /** + * Adds a result set to the cache. + * @param aPath path defining the context of the results. + * @param aAttrs attributes requested by the client application and included in + * the result set. + * @param aResults result set corresponding to the path. Not owned. + * @param aNotCacheableAttrs attributes that are not cacheable + * @param aMediaFromOpenL whether or not this media was from an OpenL + * @param aPriority result set priority + * @return CMPXMedia object in the cache or the original object if add failed + */ + CMPXMedia* AddToCache( + const CMPXCollectionPath& aPath, + const TArray& aAttrs, + CMPXMedia& aResults, + TBool aMediaFromOpenL = EFalse, + CMPXCollectionCache::TCachePriority aPriority = CMPXCollectionCache::EPriorityNormal ); + + /** + * Return loaded plugin of a context + * + * @param aType identifies the context type. plugin must be loaded for this context + * in other words, iPluginUids[aType]!=KNullUid + * @return loaded plugin pointer for the context. + */ + CMPXCollectionPlugin* LoadedPlugin(TContextType aType); + +private: + + /** + * C++ constructor + * @param aEngine reference to engine + * @param aModeId context mode id + */ + CMPXCollectionClientContext(CMPXCollectionEngine& aEngine, + CMPXCollectionCache& aCache, const TUid& aModeId); + + /** + * 2nd phase contructor + */ + void ConstructL(); + +private: + TUid iModeId; // context mode id + + TMPXItemId iFocusItemId; // Item id for the currently focused item + TInt iIndex; // Focused item in path + + CMPXCollectionEngine& iEngine; + CMPXMedia* iMedia; // browsing entries + CMPXFilter* iFilter; // filter to apply to browsing + TInt iMediaType; // media type for browsing entries + + CMPXClientList* iClientList; + CMPXCollectionPath* iBrowsePath; // path for browsing + CMPXCollectionPath* iMediaPath; + RArray iPluginUids; // uids of loaded plugins for context + TBool iPathUpdated; // changed due to collection change + RArray iUids; // Implementation sorted uids of collection plugins + CMPXCollectionCache& iCache; + TBool iCacheMedia; // Whether or not to cache the media returned + }; + +#endif // CMPXCOLLECTIONCLIENTCONTEXT_H diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionengine/inc/mpxcollectionengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionengine/inc/mpxcollectionengine.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,399 @@ +/* +* Copyright (c) 2006 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: Controls collection via plug-ins +* +*/ + + + +#ifndef CMPXCOLLECTIONENGINE_H +#define CMPXCOLLECTIONENGINE_H + +#include +#include +#include +#include +#include + +#include "mpxcollectionclientcontext.h" + +class CMPXCollectionPluginHandler; +class CMPXCollectionPlugin; +class CMPXCollectionPath; +class CMPXActiveTaskQueue; +class CMPXCollectionType; +class CMPXMedia; +class CMPXCollectionCache; +class TReleaseInfo; + +/** +* The collection 'engine' which delegates to plug-ins (or 'collections'). +* Unless stated otherwise, methods apply to currently loaded plug-in +*/ +class CMPXCollectionEngine : public CBase, + public MMPXCollectionPluginObserver, + public MMPXPluginHandlerObserver + { +public: + /** + * Two-phased constructor. + * + * @return Constructed object + */ + IMPORT_C static CMPXCollectionEngine* NewL(); + + /** + * Destructor + */ + IMPORT_C ~CMPXCollectionEngine(); + + /** + * Called by each new session, to set up the collection for use + * + * @aModeId Collection mode id + * @aClientTid Client Thread ID for tracking + * @aMsgQueue message queue for the client + * @leave The function leaves with one of the system wide error codes, + * if the operation fails. + * @return Reference to the client context object + */ + IMPORT_C CMPXCollectionClientContext& SessionInitL( + const TUid& aModeId, + TThreadId aClientTid, + CMPXMessageQueue* aMsgQueue); + + /** + * Broadcasts an event to all contexts + * @param aMsg message to send + * @param aData some data + */ + IMPORT_C void NotifyL(TMPXCollectionBroadCastMsg aMsg, TInt aData); + + /** + * Retrieves the set of supported file types in the collection server + * @param aArray, array, which on return will be filled with the types + */ + IMPORT_C void GetSupportedTypesL(RPointerArray& aArray ); + + /** + * Lookup a collection Virtual ID to the actual implementation ID + * NOTE: This function is currently hard coded for Inc8, + * need to change plugin schema for INC9 + * @param aUid, virtual id to lookup + * @return UID of the implementation + */ + IMPORT_C TUid LookupCollectionPluginID(const TUid aUid); + + /** + * Resolve a collection plugin uid + * @param aAry, array of uids to resolve the plugin + * @return Implementation uid of the plugin with the highest score + * KNullUidValue will be returned if no plugin found + */ + IMPORT_C TUid ResolvePluginUid(const TArray& aAry); + + /** + * Get a list of plugins which support uids in aSupportedUids + * + * @param aEntries a list of plugins + * @param aSupportedUids a list of supported uids + */ + void ListPluginsL(CMPXMedia& aEntries, const TArray& aSupportedUids); + + /** + * Returns a pointer to the plug-in responsible for a certain collection path + * + * @return collection plugin handler + */ + CMPXCollectionPlugin* ResolvePluginL(const CMPXCollectionPath& aPath); + + /** + * Returns a pointer to the plug-in responsible for a collection uid + * + * @return collection plugin handler + */ + CMPXCollectionPlugin* ResolvePluginL(const TUid& aUid); + + /** + * Returns a pointer to the plug-in responsible for the URI + * + * @return collection plugin handler + */ + CMPXCollectionPlugin* ResolvePluginL(const TDesC& aUri); + + /** + * Indicates that a client started using the specified plugin. + * + * @param aPluginUid plugin UID to be deselected + */ + void UsePlugin(const TUid& aPluginUid); + + /** + * Indicates that a client no longer uses the specified plugin. + * + * @param aPluginUid plugin UID to be deselected + * @return ETrue if the plugin was unloaded, EFalse otherwise + */ + TBool ReleasePlugin(const TUid& aPluginUid); + + /** + * Get the plugin cacheable attribute + * @param aUid uid to get the cacheable attribute + * @return ETrue / EFalse if plugin is cachable + */ + TBool PluginCacheable( const TUid& aUid ); + + /** + * Get the list of non-cachable attributes for a plugin + * @param aUid uid of the pluginto get the cacheable attribute + * @return list of UIDs for attributes not cacheable + */ + const TArray PluginNonCacheableAttributesL( const TUid& aUid ); + + /** + * Remove a client context + * @param aContext context to be removed. + */ + void RemoveContext(const CMPXCollectionClientContext& aContext); + + /** + * Notify collection change to other client contexts + * @param aNotifier context of notifier + * @param aMessage change event messages + * @param aError error code + */ + void NotifyChange(const CMPXCollectionClientContext& aNotifier, + CMPXMessage* aMessage, + TInt aError); + /** + * Check if refresh is ongoing + */ + inline TBool IsRefreshing(); + + /** + * Remove task for one client which is the observer of tasks + * @aCallback the observer of the tasks to be removed + */ + void RemoveTask(TAny* aCallback); + + /* + * Resets the content of the cache + * @param aPath path defining the context to be removed. + */ + void ResetCacheL(CMPXCollectionPath& aPath); + + /** + * Pushes the specified plugin on the cleanup stack and the internal stack. + * @param aPlugin plugin to be pushed on the cleanup stack + */ + void CleanupPluginPushL(CMPXCollectionPlugin* aPlugin); + + /** + * Pops a plugin from the cleanup stack and the internal stack. + */ + void PluginPop(); + + /** + * Returns the loaded plugin by implementation uid. + * + * @param aUid implementation uid of the plugin + * @return plugin pointer if plugin already loaded or NULL if not loaded + */ + CMPXCollectionPlugin* LoadedPlugin(const TUid& aUid); + +public: // From base classes + + /////////////////////////////////////////////////////////////////////////// + // From MMPXCollectionPluginObserver + + /** + * Handle message from plug-in + * + * @param aMessage, message from the plug-in + * @param aError error code + */ + inline void HandleMessage(CMPXMessage* aMsg, TInt aError); + + /** + * Handle opening group contents + * + * @param aMedia media, Ownership not transferred. + * @param aErr error code + */ + inline void HandleOpen(CMPXMedia* aMedia, TInt aErr); + + /** + * Handle opening a group, e.g. an artist + * + * @param aMedia media object returned. NULL will be returned if error. + * Ownership not transferred. + * @param aPath full path to to current level. Including top level node as well. + * NULL will be returned if error. Ownership not transferred + * @param aErr error code + */ + inline void HandleOpen(CMPXMedia* aMedia, + const CMPXCollectionPath* aPath, + TInt aErr); + + + /** + * Handle opening an item + * + * @param aPath selected item, Ownership not transferred. + * @param aErr error code + */ + inline void HandleOpen(CMPXCollectionPath* aPath, TInt aErr); + + /** + * Handle media + * + * @param aMedia media, Ownership not transferred. + * @param aError error code + */ + inline void HandleMedia(CMPXMedia* aMedia, TInt aError); + + /** + * Handle completion of a asynchronous command + * + * @param aCommandResult result of the command, NULL if error + * @param aError error code + */ + inline void HandleCommandComplete(CMPXCommand* aCommandResult, + TInt aError); + /** + * Handle Find results + * @param aMedia media item(s) + * @param aError, error code + */ + inline void HandleFindAll(CMPXMedia* aMedia, TInt aError); + + /** + * Handles remove results + * @param aUriArray, NULL if the plugin does not use concept of URI + * else, contains the file path to delete a file + * @param aError, error code + */ + inline void HandleRemove(const CDesCArray& aUriArray, TInt aError); + + /* + * From MMPXPluginHandlerObserver + * @see MMPXPluginHandlerObserver + */ + void HandlePluginHandlerEvent(TPluginHandlerEvents aEvent, const TUid& aPluginUid, + TBool aLoaded, TInt aData); + +private: // New functions + + + /** + * Creates a new context in the list + * + * @param aModeId context mode id + * @return The new path object + */ + CMPXCollectionClientContext* CreateNewContextL(const TUid& aModeId); + + /** + * Finds a default context for the given thread + * + * @param aClientId The calling client's thread ID + * @return The found path, or NULL if not found + */ + CMPXCollectionClientContext* FindDefaultContext(TThreadId aClientId); + /** + * Releases a plugin. Called when PopAndDestroy is called on a plugin + * cleanup stack item. + * @param aEngine pointer to the current engine instance + */ + static void CMPXCollectionEngine::ReleasePlugin(TAny* aEngine); + + /** + * Called when a plugin is unloaded. + * @param aUid identifies the plugin that was unloaded. + */ + void HandlePluginUnloaded(const TUid& aUid); + + /** + * Non leaving function to cleanup collection cache + */ + void DoHandlePluginUnloadedL(const TUid& aUid); + + /** + * Handle the collection change message + * @param aMessage message to process + */ + void DoNotifyChangeL( const CMPXMessage& aMessage ); + + /** + * Handle a single change message + * @param aMessage message to process + * @return ETrue if the cache has been invalidated for a particular plugin + */ + TBool DoNotifySingleChangeL( const CMPXMessage& aMessage ); + + /** + * Sends a plugin handler message to all clients. + * @param aMessageId the value of the KMPXMessageGeneralId attribute + * @param aPluginUid plugin UID this message is for + * @param aLoaded ETrue if the plugin is loaded + * @param aVersion plugin version + */ + void SendPluginHandlerMessageL(TInt aMessageId, const TUid& aPluginUid, + TBool aLoaded, TInt aVersion = 0); + +private: + + /** + * C++ constructor + * + */ + CMPXCollectionEngine(); + + /** + * 2nd phase contructor + */ + void ConstructL(); + +private: + + CMPXCollectionPluginHandler* iPluginHandler; + + /** + * Playlist/song data + */ + RPointerArray iContexts; + + TBool iRefreshing; + + /** + * Collection cache - singleton for all client contexts. + */ + CMPXCollectionCache* iCache; + + /** + * Internal stack used for releasing plugins. This is used in addition to the + * Symbian cleanup stack. + */ + RArray iCleanupStack; + + /* + * If not KNullUid, indicates the plugin that is currently being upgraded. + */ + TUid iUpdatedPluginUid; + }; + +#include "mpxcollectionengine.inl" + +#endif // CMPXCOLLECTIONENGINE_H + diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionengine/inc/mpxcollectionengine.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionengine/inc/mpxcollectionengine.inl Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2006 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: Inline implementation of collection engine +* +*/ + + +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Handle collection item change event +// ---------------------------------------------------------------------------- +// +inline void CMPXCollectionEngine::HandleMessage(CMPXMessage* aMsg, TInt aError) + { + MPX_FUNC("CMPXCollectionEngine::HandleMessage"); + for (TInt i=0; iDoHandleMessage(aMsg, aError, EFalse); + } + } + +// ---------------------------------------------------------------------------- +// Handle open event +// ---------------------------------------------------------------------------- +// +inline void CMPXCollectionEngine::HandleOpen( + CMPXMedia* /*aMedia*/, + TInt /*aErr*/) + { + MPX_DEBUG1("WARNING!!! - CMPXCollectionEngine::HandleOpen aMedia should never be called"); + } + +// ---------------------------------------------------------------------------- +// Handle open event +// ---------------------------------------------------------------------------- +// +inline void CMPXCollectionEngine::HandleOpen( + CMPXMedia* /*aMedia*/, + const CMPXCollectionPath* /*aPath*/, + TInt /*aErr*/) + { + MPX_DEBUG1("WARNING!!! - CMPXCollectionEngine::HandleOpen aMedia should never be called"); + } + + // ---------------------------------------------------------------------------- +// Handle open event +// ---------------------------------------------------------------------------- +// +inline void CMPXCollectionEngine::HandleOpen( + CMPXCollectionPath* /*aPath*/, + TInt /*aErr*/) + { + MPX_DEBUG1("WARNING!!! - CMPXCollectionEngine::HandleOpen aPath should never be called"); + } + + // ---------------------------------------------------------------------------- +// Callback of retrieving extended media property +// ---------------------------------------------------------------------------- +// +inline void CMPXCollectionEngine::HandleMedia( + CMPXMedia* /*aMedia*/, + TInt /*aError*/) + { + MPX_DEBUG1("WARNING!!! - CMPXCollectionEngine::HandleMedia should never be called"); + } + +// ---------------------------------------------------------------------------- +// Callback of async CommandL +// ---------------------------------------------------------------------------- +// +inline void CMPXCollectionEngine::HandleCommandComplete( + CMPXCommand* /*aCommandResult*/, + TInt /*aError*/) + { + + } + +// ---------------------------------------------------------------------------- +// Handle find all +// ---------------------------------------------------------------------------- +// +inline void CMPXCollectionEngine::HandleFindAll( + CMPXMedia* /*aMedia*/, + TInt /*aError*/) + { + MPX_DEBUG1("WARNING!!! - CMPXCollectionEngine::HandleFindAll should never be called"); + } + +// ---------------------------------------------------------------------------- +// Handle delete all +// ---------------------------------------------------------------------------- +// +inline void CMPXCollectionEngine::HandleRemove( + const CDesCArray& /*aUriArray*/, + TInt /*aError*/) + { + MPX_DEBUG1("WARNING!!! - CMPXCollectionEngine::HandleRemove should never be called"); + } + +// ---------------------------------------------------------------------------- +// Check if refreshing is ongoing +// ---------------------------------------------------------------------------- +// +inline TBool CMPXCollectionEngine::IsRefreshing() + { + return iRefreshing; + } + +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionengine/inc/mpxcollectionpluginhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionengine/inc/mpxcollectionpluginhandler.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,171 @@ +/* +* Copyright (c) 2006 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: Plugin handler +* +*/ + + +#ifndef CMPXCOLLECTIONPLUGINHANDLER_H +#define CMPXCOLLECTIONPLUGINHANDLER_H + +#include +#include + +class CMPXCollectionPlugin; +class MMPXCollectionPluginObserver; + +/** +* Processes plug-ins +*/ +NONSHARABLE_CLASS(CMPXCollectionPluginHandler) : public CMPXPluginHandlerBase + { +public: + /** + * Two-phased constructor. + * + * @param aPluginObserver plugin observer + * @param aObserver plugin handler observer + * @return Constructed object + */ + static CMPXCollectionPluginHandler* NewL(MMPXCollectionPluginObserver& aPluginObserver, + MMPXPluginHandlerObserver& aObserver); + + /** + * Destructor + */ + ~CMPXCollectionPluginHandler(); + +public: + /** + * Returns currently loaded plug-in, or NULL if none + * + * @return plugin object interface + */ + inline CMPXCollectionPlugin* Plugin(); + + /** + * Get all currently loaded plugins + * @return array of loaded plugins + */ + TArray LoadedPlugins(); + + /** + * Remove task for one client which is the observer of tasks + * @aCallback the observer of the tasks to be removed + */ + void RemoveTask(TAny* aCallback); + + /** + * Retrieve the list of non cachable attributes for a plugin + * @param aPlugin UID of the plugin + */ + const TArray NonCacheableAttributesL( const TUid& aPluginId ); + + /** + * Check if a plugin is cachable in the collection cache + * @param aPlugin + */ + TBool PluginCachable( const TUid& aPluginId ); + + /** + * Returns the loaded plugin by implementation uid. + * + * @param aUid implementation uid of the plugin + * @return plugin pointer if plugin already loaded or NULL if not loaded + */ + CMPXCollectionPlugin* LoadedPlugin(const TUid& aUid); + +private: + + /** + * From Base CMPXPluginHandlerBase + * Resolves a plugin + */ + void ResolvePluginL(); + + /** + * From Base CMPXPluginHandlerBase + * Constructs the collection plugin info + */ + CMPXPluginInfo* ConstructPluginInfoLC( const CImplementationInformation& aData ); + + /** + * @see CMPXPluginHandlerBase + */ + TBool IsPluginLoaded(const TUid& aPluginUid); + + /** + * @see CMPXPluginHandlerBase + */ + void LoadPluginL(const TUid& aPluginUid); + + + /** + * From Base CMPXPluginHandlerBase + * Unloads a plugin + * @param aUid identifies the plugin + */ + void UnloadPlugin(const TUid& aUid); + + + /** + * Create the plugin object given UID + * + * @param UID of the plugin + * @return plugin object + */ + CMPXCollectionPlugin* CreateCollectionPluginL(const TUid& aUid); + + /** + * Returns the loaded plugin index corresponding to the UID. + * + * @param aUid implementation uid of the plugin + * @return plugin index in iLoadedPlugins or KErrNotFound + */ + TInt LoadedPluginIndex(const TUid& aUid); + + /** + * Unloads the plugin at a specified index. + * @param aIndex index of the plugin in iLoadedPlugins + */ + void UnloadPlugin(TInt aIndex); + +private: + + /** + * 2nd phase contructor + */ + void ConstructL(); + + /** + * C++ constructor + * + * @param aPluginObserver plugin observer + * @param aObserver plugin handler observer + */ + CMPXCollectionPluginHandler(MMPXCollectionPluginObserver& aPluginObserver, + MMPXPluginHandlerObserver& aObserver); + +private: + MMPXCollectionPluginObserver* iPluginObserver; //Not Owned + RPointerArray iLoadedPlugins; + + // Most recently Selected plugin + // + CMPXCollectionPlugin* iPlugin; + }; + +#include "mpxcollectionpluginhandler.inl" + +#endif // CMPXCOLLECTIONPLUGINHANDLER_H diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionengine/inc/mpxcollectionpluginhandler.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionengine/inc/mpxcollectionpluginhandler.inl Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2006 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: Inline implementation of collection plugin handler +* +*/ + +// ---------------------------------------------------------------------------- +// Return most recently selected plugin +// ---------------------------------------------------------------------------- +// +inline CMPXCollectionPlugin* CMPXCollectionPluginHandler::Plugin() + { + return iPlugin; + } + +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionengine/inc/mpxcollectionplugininfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionengine/inc/mpxcollectionplugininfo.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,93 @@ +/* +* 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: Plugin info class for collection engine +* +*/ + + +#ifndef C_MPXCOLLECTIONPLUGININFO_H +#define C_MPXCOLLECTIONPLUGININFO_H + +#include +#include + +/** + * Collection derived plugin info class + * + * @lib mpxcollectionengine.dll + * @since S60 3.2 + */ +NONSHARABLE_CLASS( CMPXCollectionPluginInfo ) : public CMPXPluginInfo + { + +public: + + /** + * Two-Phased constructor + * @param aData implemnetation data + * @return CMPXCollectionPluginInfo* + */ + static CMPXCollectionPluginInfo* NewL( const CImplementationInformation& aData ); + + /** + * Two-Phased constructor + * @param aData implemnetation data + * @return CMPXCollectionPluginInfo* on cleanupstack + */ + static CMPXCollectionPluginInfo* NewLC( const CImplementationInformation& aData ); + + + /** + * Virtual destructor + */ + virtual ~CMPXCollectionPluginInfo(); + +public: + + /** + * From CMPXPluginInfo + */ + void ProcessTaggedDataExL(const TDesC8& aTag, const TDesC8& aData); + + /** + * Return the list of non-cacheable attributes + * @return TArray containing the list of attributes not cacheable + */ + const TArray NonCacheableAttrs(); + +private: + + /** + * Extract the non-cacheable attributes + */ + void ExtractNonCacheableAttrsL( const TDesC8& aData ); + +private: + + /** + * Two-phased constructor + */ + void ConstructL( const CImplementationInformation& aData ); + + /** + * C++ Constructor + */ + CMPXCollectionPluginInfo(); + +private: // data + + RArray iNonCachableAttrs; + }; + +#endif // C_MPXCOLLECTIONPLUGININFO_H diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionengine/src/mpxcollectioncache.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionengine/src/mpxcollectioncache.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,1271 @@ +/* +* Copyright (c) 2007 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: Implements the collection cache +* +*/ + + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mpxcollectioncache.h" + +// CONSTANTS +const TInt KMPXRootNodeId = 0; + +// --------------------------------------------------------------------------- +// static function to compare two datablock items +// used for sorting datablocks +// --------------------------------------------------------------------------- +// +static TInt CompareOpenDataBlock( const TMPXOpenDataBlock& aFirst, + const TMPXOpenDataBlock& aSecond ) + { + return aFirst.iOffset > aSecond.iOffset; + } + + +/** +* Encapsulates a node in the cache tree. +*/ +NONSHARABLE_CLASS(CMPXCollectionCacheNode) : + public CBase + { +public: + /** + * Two phase constructor. + */ + static CMPXCollectionCacheNode* NewL( const TMPXItemId aId ); + + /** + * Destructor. + */ + virtual ~CMPXCollectionCacheNode(); + + /** + * Adds a child to the current node. + * Ownership of the node is transferred + */ + void AddChildL(CMPXCollectionCacheNode* aChild); + + /** + * Removes a child from the current node. + * Ownership of the node is not transferred + */ + void RemoveChild(CMPXCollectionCacheNode& aChild); + + /** + * Retrieves a child by ID. Returns NULL if not found. + * Ownership of the node is not transferred. + */ + CMPXCollectionCacheNode* GetChild(TMPXItemId aId); + + /** + * Sets the results and attribute set for the current node. + * @param aAttrs list of open attributes + * @param aResults results to set in + * @param aMediaFromOpen is the media from common + */ + void SetResultsL( + const TArray& aAttrs, + CMPXMedia& aResults, + TBool aMediaFromOpen ); + + /** + * Checks if the specified attribute set exists (is included) in the current + * node attribute set. + */ + TBool AttributesExist(const TArray& aAttrs); + + /** + * Checks if the specified attribute set exists (is included) in the current + * node attribute set. + */ + TBool ContainerAttributesExist(const TArray& aAttrs); + + /** + * Checks if the specified attribute exists (is included) in the current + * node attribute set. + * @param aAttribute attribute to look for + * @param aArray array to check + * @return ETrue if found, EFalse if not found + */ + TBool AttributeExists(const TMPXAttribute& aAttribute, + RArray& aArray ); + + /** + * Checks this node and all child nodes for invalidated data + * @param aChangeItemId ID of the item modified + * @param aArray array to store the list of affected nodes + */ + void HandleChangeL( TMPXItemId aChangeItemId, + RPointerArray& aArray ); + +#ifdef _DEBUG + /** + * Prints the node. + */ + void PrintNode(TBool aPrintChildren, TBool aPrintAtts); +#endif + +private: + /** + * C++ constructor + */ + CMPXCollectionCacheNode(TMPXItemId aId, + CMPXCollectionCache::TCachePriority aPriority); + + /** + * Second phase constructor. + */ + void ConstructL(); + + /** + * Returns the child index for the specified ID or KErrNotFound if not found. + */ + TInt IndexOfId(TMPXItemId aId); + + /** + * Compares two media instances. If the instances refer to the same collection + * item (they have the same general ID) returns ETrue, otherwise EFalse. + */ + TBool CompareMediaItemsL( + const CMPXMedia& aMedia1, + const CMPXMedia& aMedia2 ); + + /** + * Comparison method for node IDs. Used when searching child nodes by ID. + * Ownership of nodes is not transferred. + * This method is used with the Find method of RPointerArray and + * must be declared as follow: + * TBool *(aFunction)(const K *k, const T &t); + */ + static TBool CompareIDs( + const CMPXCollectionCacheNode* aNode1, + const CMPXCollectionCacheNode& aNode2 ); + + /** + * Merge the data from two arrays + * @param aExistingArray Old array with current data + * @param aNewArray New arrary with data to merge + */ + TBool DoMergeMediaArraysL( const CMPXMediaArray& aExistingArray, + const CMPXMediaArray& aNewArray ); + + /** + * Merge the data from two arrays + * @param aExistingArray Old array with current data + * @param aNewArray New arrary with data to insert + */ + void DoInsertMediaArraysL( CMPXMediaArray& aExistingArray, + const CMPXMediaArray& aNewArray, + const TMPXOpenDataBlock& aBlock ); + + /** + * Compact a list of open datablocks into larger chunks + * @param aArray Array to compact + */ + void DoMergeArrayL( RArray& aArray ); + +public: + TMPXItemId iId; // node ID (same as path node ID) + RArray iAttrs; // attribute set corresponding to the results + RArray iContainerAttrs; // attribute set corresponding to the container + // of a result set + CMPXMedia* iResults; // results + CMPXCollectionCache::TCachePriority iPriority; // node priority + TTime iTime; // last time the node was updated + TInt iLevel; // level of the node in the original path + + CMPXCollectionCacheNode* iParent; // parent of the node (NULL for root) + RPointerArray iChildren; // node children + TBool iMediaFromOpenL; // whether or not this media was from an openl + }; + +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// CMPXCollectionCacheNode::NewL +// ---------------------------------------------------------------------------- +// +CMPXCollectionCacheNode* CMPXCollectionCacheNode::NewL( + const TMPXItemId aId) + { + MPX_FUNC("CMPXCollectionCacheNode::NewL"); + + CMPXCollectionCacheNode* self = new(ELeave)CMPXCollectionCacheNode(aId, + CMPXCollectionCache::EPriorityNormal); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionCacheNode::~CMPXCollectionCacheNode +// ---------------------------------------------------------------------------- +// +CMPXCollectionCacheNode::~CMPXCollectionCacheNode() + { + MPX_FUNC("CMPXCollectionCacheNode::~CMPXCollectionCacheNode"); + + iAttrs.Close(); + iContainerAttrs.Close(); + delete iResults; + + // delete all children + iChildren.ResetAndDestroy(); + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionCacheNode::CMPXCollectionCacheNode +// ---------------------------------------------------------------------------- +// +CMPXCollectionCacheNode::CMPXCollectionCacheNode( + TMPXItemId aId, + CMPXCollectionCache::TCachePriority aPriority) : + iId(aId), + iPriority(aPriority) + { + MPX_FUNC("CMPXCollectionCacheNode::CMPXCollectionCacheNode"); + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionCacheNode::ConstructL +// ---------------------------------------------------------------------------- +// +void CMPXCollectionCacheNode::ConstructL() + { + MPX_FUNC("CMPXCollectionCacheNode::ConstructL"); + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionCacheNode::AddChildL +// ---------------------------------------------------------------------------- +// +void CMPXCollectionCacheNode::AddChildL( + CMPXCollectionCacheNode* aChild) + { + MPX_FUNC("CMPXCollectionCacheNode::AddChildL"); + aChild->iParent = this; + iChildren.AppendL(aChild); + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionCacheNode::RemoveChild +// ---------------------------------------------------------------------------- +// +void CMPXCollectionCacheNode::RemoveChild( + CMPXCollectionCacheNode& aChild) + { + MPX_FUNC("CMPXCollectionCacheNode::RemoveChild"); + + TInt index = IndexOfId(aChild.iId); + if (index != KErrNotFound) + { + // remove the child + iChildren.Remove(index); + } + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionCacheNode::GetChild +// ---------------------------------------------------------------------------- +// +CMPXCollectionCacheNode* CMPXCollectionCacheNode::GetChild( + TMPXItemId aId) + { + MPX_FUNC("CMPXCollectionCacheNode::GetChild"); + + CMPXCollectionCacheNode* child(NULL); + + TInt index = IndexOfId(aId); + if (index != KErrNotFound) + { + child = iChildren[index]; + } + + return child; + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionCacheNode::SetResultsL +// If results are already stored in the node try to merge the new results, +// otherwise overwrite them. +// ---------------------------------------------------------------------------- +// +void CMPXCollectionCacheNode::SetResultsL( + const TArray& aAttrs, + CMPXMedia& aResults, + TBool aMediaFromOpen ) + { + MPX_FUNC("CMPXCollectionCacheNode::SetResultsL"); + + // Problem if we did not have results from before, but + // want to merge in new data. Plugins returning all results will + // not contain KMPXCollectionOpenLResultRange in the media + // therefore we do manual merging. If it does contain the attribute + // That means it is from a subset, with a particular offset and block size + // + TMPXOpenDataBlock block; + block.iOffset = KErrNotFound; + if( aResults.IsSupported( KMPXCollectionOpenLResultRange ) ) + { + block = aResults.ValueTObjectL( + KMPXCollectionOpenLResultRange ); + + // If the results have not been cached before, + // we have nothing to merge + // + if( !iResults && block.iOffset != KErrNotFound ) + { + User::Leave( KErrArgument ); + } + } + + TBool overwrite(ETrue); + + // Merge + if ( iResults ) + { + // extract the arrays from the two media instances + CMPXMediaArray* existingArray(NULL); + if ( iResults->IsSupported(KMPXMediaArrayContents) ) + { + existingArray = + iResults->Value(KMPXMediaArrayContents); + User::LeaveIfNull(existingArray); + } + + const CMPXMediaArray* newArray(NULL); + if ( aResults.IsSupported( KMPXMediaArrayContents )) + { + newArray = aResults.Value(KMPXMediaArrayContents); + User::LeaveIfNull(const_cast(newArray)); + } + + // Only need to merge the two arrays if they exist, else it will just overwrite + if ( existingArray && newArray && existingArray->Count()) + { + if( block.iOffset == KErrNotFound ) + { + overwrite = DoMergeMediaArraysL( *existingArray, + *newArray ); + } + else // aOffset != KErrNotFound + { + DoInsertMediaArraysL( *existingArray, + *newArray, + block ); + + // These 2 attributes already merged + // + aResults.Delete( KMPXMediaArrayContents ); + aResults.Delete( KMPXMediaArrayCount ); + + // Merge container media + // + iResults->MergeMediaL( aResults ); + + // Merge the root media + // + overwrite = EFalse; + } + } + else + { + iResults->MergeMediaL( aResults ); + overwrite = EFalse; + } + } + + if (overwrite) + { + // List of supported attributes is + // seperated to media w/ container from OpenL() + // and media only from MediaL() + // + if( aMediaFromOpen ) + { + iAttrs.Reset(); + ::CopyArrayL(aAttrs, iAttrs); + } + else + { + iContainerAttrs.Reset(); + ::CopyArrayL(aAttrs, iContainerAttrs); + } + + delete iResults; + iResults = NULL; + iResults = CMPXMedia::NewL( aResults ); + } + else + { + // Update either the array list or the root media list + // + if( aMediaFromOpen ) + { + // Add the attributes into the list + for ( TInt attrIndex = 0; attrIndex < aAttrs.Count(); attrIndex++ ) + { + const TMPXAttribute& attr = aAttrs[attrIndex]; + if ( !AttributeExists( attr, iAttrs )) + { + iAttrs.AppendL( attr ); + } + } + } + else + { + // Add the attributes into the container list + for ( TInt attrIndex = 0; attrIndex < aAttrs.Count(); attrIndex++ ) + { + const TMPXAttribute& attr = aAttrs[attrIndex]; + if ( !AttributeExists( attr, iContainerAttrs )) + { + iContainerAttrs.AppendL( attr ); + } + } + } + } +#ifdef _DEBUG + MPX_DEBUG1("CMPXCollectionCacheNode::SetResultsL(): Attributes cached"); + for ( TInt k = 0; k < iAttrs.Count(); k++ ) + { + MPX_DEBUG4("CMPXCollectionCacheNode::SetResultsL(): attr[%d] = {0x%x,0x%x}", + k, iAttrs[k].ContentId(), iAttrs[k].AttributeId()); + } +#endif + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionCacheNode::AttributesExist +// ---------------------------------------------------------------------------- +// +TBool CMPXCollectionCacheNode::AttributesExist( + const TArray& aAttrs) + { + MPX_FUNC("CMPXCollectionCacheNode::AttributesExist"); + + TBool exist(ETrue); + if (0 == aAttrs.Count()) + { + // no attributes specified, always exist + exist = ETrue; + } + else if (0 == iAttrs.Count()) + { + // no existing attributes, always do not exist + exist = EFalse; + } + else + { + // both have valid number of attributes + TInt count(aAttrs.Count()); + for (TInt index = 0; index < count; ++index) + { + if (!AttributeExists(aAttrs[index], iAttrs)) + { + exist = EFalse; + break; + } + } + } + + return exist; + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionCacheNode::AttributesExist +// ---------------------------------------------------------------------------- +// +TBool CMPXCollectionCacheNode::ContainerAttributesExist( + const TArray& aAttrs) + { + MPX_FUNC("CMPXCollectionCacheNode::ContainerAttributesExist"); + + TBool exist(ETrue); + if (0 == aAttrs.Count()) + { + // no attributes specified, always exist + exist = ETrue; + } + else if (0 == iContainerAttrs.Count()) + { + // no existing attributes, always do not exist + exist = EFalse; + } + else + { + // both have valid number of attributes + TInt count(aAttrs.Count()); + for (TInt index = 0; index < count; ++index) + { + if (!AttributeExists(aAttrs[index], + iContainerAttrs)) + { + exist = EFalse; + break; + } + } + } + + return exist; + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionCacheNode::AttributeExists +// ---------------------------------------------------------------------------- +// +TBool CMPXCollectionCacheNode::AttributeExists( + const TMPXAttribute& aAttribute, + RArray& aArray) + { + MPX_FUNC("CMPXCollectionCacheNode::AttributeExists"); + + TBool ret(ETrue); + + TUint content(aAttribute.ContentId()); + TUint attribute(aAttribute.AttributeId()); + TInt count(aArray.Count()); + + // Have to do an exhaustive search of every bit + // This is because clients can compress the content IDs + // + TUint32 mask(1); // 0x00000001 + while( mask != 0 ) + { + TUint32 val(attribute&mask); + if( val ) + { + TInt i; + for (i = 0; i < count; ++i) + { + if (aArray[i].ContentId() == content && + (aArray[i].AttributeId() & val) ) + { + // break out of for loop + break; + } + } + if( i==count ) + { + // break out of while loop if + // the particular bit is not found + ret = EFalse; + break; + } + } + mask = mask<<1; // Check next bit + } + + return ret; + } + +// ---------------------------------------------------------------------------- +// Handles any changes to the collection cache +// ---------------------------------------------------------------------------- +// +void CMPXCollectionCacheNode::HandleChangeL( TMPXItemId aChangeItemId, + RPointerArray& aArray ) + { + // This node is affected + // All child nodes are invalid! + // + TBool aOpen(ETrue); + if( iId == aChangeItemId ) + { + aArray.AppendL( this ); + aOpen=EFalse; // wiping out this node already + } + else if( iChildren.Count() ) + { + TInt c( iChildren.Count() ); + for( TInt i=0; iHandleChangeL( aChangeItemId, aArray ); + } + } + + // Check the contents as well + // + if( aOpen ) + { + // This is a leaf node, so we check the array + // + if( iResults && + iResults->IsSupported(KMPXMediaArrayContents) ) + { + // Array not owned + const CMPXMediaArray& ary = + *iResults->Value(KMPXMediaArrayContents); + User::LeaveIfNull(const_cast(&ary)); + TInt c(ary.Count() ); + + // Check every media item, this *MAYBE* slow. May want to consider + // caching all item IDs within each node for performance + for( TInt i=0; i(KMPXMediaGeneralId); + } + + // If we match, add this as affected and return + if( id == aChangeItemId ) + { + aArray.AppendL( this ); + break; + } + } // for + } // if iResults + } // if no children + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionCacheNode::IndexOfId +// ---------------------------------------------------------------------------- +// +TInt CMPXCollectionCacheNode::IndexOfId( + TMPXItemId aId) + { + MPX_FUNC("CMPXCollectionCacheNode::IndexOfId"); + TInt index( KErrNotFound ); + + CMPXCollectionCacheNode* node( NULL ); + MPX_TRAPD(err, node = CMPXCollectionCacheNode::NewL( aId )); + if ( KErrNone == err ) + { + index = iChildren.Find(*node, CompareIDs); + delete node; + } + + return index; + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionCacheNode::CompareMediaItems +// ---------------------------------------------------------------------------- +// +TBool CMPXCollectionCacheNode::CompareMediaItemsL( + const CMPXMedia& aItem1, + const CMPXMedia& aItem2) + { + return aItem1.IsSupported(KMPXMediaGeneralId) && + aItem2.IsSupported(KMPXMediaGeneralId) && + (aItem1.ValueTObjectL(KMPXMediaGeneralId) == + aItem2.ValueTObjectL(KMPXMediaGeneralId)); + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionCacheNode::CompareIDs +// ---------------------------------------------------------------------------- +// +TBool CMPXCollectionCacheNode::CompareIDs( + const CMPXCollectionCacheNode* aNode1, + const CMPXCollectionCacheNode& aNode2) + { + MPX_FUNC("CMPXCollectionCacheNode::CompareIDs"); + return aNode1->iId == aNode2.iId; + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionCacheNode::DoMergeMediaArraysL +// ---------------------------------------------------------------------------- +// +TBool CMPXCollectionCacheNode::DoMergeMediaArraysL( const CMPXMediaArray& aExistingArray, + const CMPXMediaArray& aNewArray ) + { + TBool overwrite(ETrue); + TInt newCount( aNewArray.Count() ); + for ( TInt arrayIndex = 0; arrayIndex < newCount; arrayIndex++ ) + { + const CMPXMedia* newItem( (aNewArray).AtL(arrayIndex) ); + CMPXMedia* existingItem( NULL ); + TInt existingCount( aExistingArray.Count() ); + if ( arrayIndex < existingCount ) + { + existingItem = aExistingArray.AtL(arrayIndex); + } + else + { + existingItem = aExistingArray.AtL(0); + } + + MPX_ASSERT(newItem->IsSupported(KMPXMediaGeneralId)); + MPX_ASSERT(existingItem->IsSupported(KMPXMediaGeneralId)); + + // try to match the items at the same index + if ( CompareMediaItemsL( *newItem, *existingItem )) + { + existingItem->MergeMediaL( *newItem ); + overwrite = EFalse; + } + else + { + // items do not match, try linear search + TBool found(EFalse); + for ( TInt i = 0; i < existingCount && !found; ++i ) + { + CMPXMedia* item( aExistingArray.AtL(i) ); + // Already compared existing item so skip it + if ( item != existingItem ) + { + if ( CompareMediaItemsL( *newItem, *item )) + { + // found the item + item->MergeMediaL( *newItem ); + overwrite = EFalse; + found = ETrue; + } + } + } + } + } + return overwrite; + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionCacheNode::DoInsertMediaArraysL +// ---------------------------------------------------------------------------- +// +void CMPXCollectionCacheNode::DoInsertMediaArraysL( CMPXMediaArray& aExistingArray, + const CMPXMediaArray& aNewArray, + const TMPXOpenDataBlock& aBlock ) + { + // Overflow checking. Make sure array indexes are correct + // + TInt newCount( aNewArray.Count() ); + if( aBlock.iOffset + newCount > aExistingArray.Count() ) + { + User::Leave( KErrArgument ); + } + + // Merge all results by inserting into the existing array + // + for( TInt i=0; i datablocks; + CleanupClosePushL( datablocks ); + if( iResults && + iResults->IsSupported(KMPXCollectionOpenLAllResultRange) ) + { + // De-serialize from global data, would be good to have global arrays + // + const TDesC& buf = iResults->ValueText(KMPXCollectionOpenLAllResultRange); + CBufBase* buffer(NULL); + MPXUser::CreateBufferL( buf, buffer ); + CleanupStack::PushL( buffer ); + ::CreateFromBufferL( *buffer, datablocks ); + CleanupStack::PopAndDestroy( buffer ); + } + + // Append, sort and merge the array for more effient access + // + datablocks.AppendL( aBlock ); + + // Sort and merge the data array + // + datablocks.Sort( CompareOpenDataBlock ); + DoMergeArrayL( datablocks ); + + // Package it and store in media + // Store the block list + // + CBufBase* buffer(NULL); + ::CreateBufferL( datablocks.Array(), buffer ); + CleanupStack::PushL( buffer ); + TPtr8 ptr8 = buffer->Ptr(0); + TPtrC ptr = MPXUser::Ptr( ptr8 ); + iResults->SetTextValueL( KMPXCollectionOpenLAllResultRange, ptr ); + CleanupStack::PopAndDestroy( buffer ); + + CleanupStack::PopAndDestroy( &datablocks ); + } + +// ---------------------------------------------------------------------------- +// Compact the datablocks +// ---------------------------------------------------------------------------- +// +void CMPXCollectionCacheNode::DoMergeArrayL( RArray& aArray ) + { + // O(n^2) complexity here is OK, Merging keeps the number of items + // very small. Less than 3 items are alive at a time + // + RArray newArray; + CleanupClosePushL( newArray ); + + TInt c1 = aArray.Count(); + for( TInt i=0; i buf; + _LIT(KFormatString, "%-B%:0%J%:1%T%:2%S%:3%+B"); + TRAP_IGNORE( iTime.FormatL( buf, KFormatString )); + // use RDebug directly since there is no MPX_DEBUG with 6 parameters. + RDebug::Print(_L("+Id: %08X, Level: %d, Priority: %d, Time: %S"), + iId.iId1, iLevel, iPriority, &buf); + MPX_DEBUG2("CMPXCollectionCacheNode::PrintNode(): iMediaFromOpenL = %d", + iMediaFromOpenL); + + if ( aPrintAtts ) + { + for ( TInt j = 0; j < iAttrs.Count(); j++ ) + { + TMPXAttribute att( iAttrs[j] ); + MPX_DEBUG4("CMPXCollectionCacheNode::PrintNode(): attr[%d] = {0x%x,0x%x}", + j, att.ContentId(), att.AttributeId()); + TMPXAttributeType type( iResults->Type( att )); + if ( EMPXTypeText == type ) + { + MPX_DEBUG2("CMPXCollectionCacheNode::PrintNode(): Text = %S", + &(iResults->ValueText( att ))); + } + else if ( EMPXTypeTInt == type ) + { + TInt val(0); + TRAP_IGNORE(val = (iResults->ValueTObjectL( att ))); + MPX_DEBUG2("CMPXCollectionCacheNode::PrintNode(): TInt = %d", + val); + } + } + } + + if ( aPrintChildren ) + { + TInt children( iChildren.Count() ); + for ( TInt index = 0; index < children; ++index ) + { + iChildren[index]->PrintNode( ETrue, aPrintAtts ); + } + } + } + +#endif + +// ---------------------------------------------------------------------------- +// CMPXCollectionCache::NewL +// ---------------------------------------------------------------------------- +// +CMPXCollectionCache* CMPXCollectionCache::NewL( + TInt aMaximumSizeRatio /* = -1 */) + { + MPX_FUNC("CMPXCollectionCache::NewL"); + + CMPXCollectionCache* self = new(ELeave) CMPXCollectionCache( aMaximumSizeRatio ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionCache::~CMPXCollectionCache +// ---------------------------------------------------------------------------- +// +CMPXCollectionCache::~CMPXCollectionCache() + { + MPX_FUNC("CMPXCollectionCache::~CMPXCollectionCache"); + + // delete the entire cache + delete iRoot; + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionCache::Add +// ---------------------------------------------------------------------------- +// +CMPXMedia* CMPXCollectionCache::AddL( + const CMPXCollectionPath& aPath, + const TArray& aAttrs, + CMPXMedia& aResults, + TBool aMediaFromOpenL, + TCachePriority aPriority) + { + MPX_FUNC("CMPXCollectionCache::DoAddL"); + MPX_DEBUG_PATH(aPath); + + CMPXMedia* ret( &aResults ); + + //if OOM then clear current cache and don't add to cache + TBool toCache = ManageCacheSizeL(); + + //!media in array should support KMPXMediaGeneralId otherwise we don't cache it + if(toCache && aResults.IsSupported(KMPXMediaArrayContents)) + { + const CMPXMediaArray* resultsArray( + aResults.Value(KMPXMediaArrayContents)); + User::LeaveIfNull(const_cast(resultsArray)); + TInt arrCount(resultsArray->Count()); + for(TInt arrInd = 0; arrInd < arrCount; ++arrInd) + { + const CMPXMedia* curItem(resultsArray->AtL(arrInd)); + if(!curItem->IsSupported(KMPXMediaGeneralId)) + { + MPX_DEBUG1("CMPXCollectionCache::AddL: Missing MediaGeneralId - caching skipped"); + toCache = EFalse; + break; + } + } + } + + if (toCache && aResults.IsSupported(KMPXMediaGeneralNonPermissibleActions ) ) + { + // check for auto playlist, it should not be cached + TMPXGeneralNonPermissibleActions attr( + aResults.ValueTObjectL( + KMPXMediaGeneralNonPermissibleActions ) ); + if ( attr & EMPXCache ) + { + toCache = EFalse; + } + } + + if(toCache) + { + // get the corresponding node, create if not available + CMPXCollectionCacheNode* node = NodeFromPathL(aPath, ETrue); + + // update the node + node->SetResultsL( aAttrs, aResults, aMediaFromOpenL ); + node->iMediaFromOpenL = node->iMediaFromOpenL || aMediaFromOpenL; + + // set the priority and the "last updated" timestamp + node->iPriority = aPriority; + node->iLevel = aPath.Levels(); + node->iTime.HomeTime(); + + ret = node->iResults; + } +#ifdef _DEBUG + PrintTree( ETrue ); +#endif + return ret; + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionCache::GetL +// ---------------------------------------------------------------------------- +// +CMPXMedia* CMPXCollectionCache::GetL( + const CMPXCollectionPath& aPath, + const TArray& aAttrs, + TBool aMediaFromOpenL /* = EFalse */ ) + { + MPX_FUNC("CMPXCollectionCache::GetL"); + MPX_DEBUG_PATH(aPath); + + CMPXMedia* results(NULL); + + // get the corresponding node, do not create if not available + CMPXCollectionCacheNode* node = NodeFromPathL(aPath, EFalse); + + TInt selCount = aPath.Selection().Count(); + + // Check if node exists and attributes match + // If we are calling from openL() or mediaL() on multiple items, we check the array + // attributes. If we are calling from MediaL() with a single item + // we check the container attributes + // + if ( (aMediaFromOpenL || selCount ) + && node && node->AttributesExist(aAttrs)) + { + // Check if it needs to be a media from openl + // If not just return the results. But if it needs to be a media from + // OpenL, then need to check if the results are actually from an OpenL + if ( (aMediaFromOpenL && node->iMediaFromOpenL) || + !aMediaFromOpenL ) + { + results = node->iResults; + } + } + else if( node && node->ContainerAttributesExist(aAttrs) ) + { + // Here we end from a MediaL call, we need to check if there are items selected + // in this case NodeFromPathL result may be ivalid as it using only focused item + // so we will pass that call to plugin and ignore found node from cache in that case + if(selCount == 0) + { + results = node->iResults; + } + } + + // note that NULL is returned for nodes without results + // (created empty to link to other nodes) + return results; + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionCache::RemoveL +// ---------------------------------------------------------------------------- +// +void CMPXCollectionCache::RemoveL( + const CMPXCollectionPath& aPath) + { + MPX_FUNC("CMPXCollectionCache::RemoveL(CMPXCollectionPath)"); + MPX_DEBUG_PATH(aPath); + + // get the corresponding node, do not create if not available + CMPXCollectionCacheNode* node( NodeFromPathL( aPath, EFalse )); + + // if node exists + if ( node ) + { + // delete it and its children + RemoveNode( node ); +#ifdef _DEBUG + PrintTree( ETrue ); +#endif + } + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionCache::Reset +// ---------------------------------------------------------------------------- +// +void CMPXCollectionCache::Reset() + { + MPX_FUNC("CMPXCollectionCache::ClearCache"); + iRoot->iChildren.ResetAndDestroy(); + iRoot->iAttrs.Reset(); + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionCache::HandleChangeL() +// ---------------------------------------------------------------------------- +// +void CMPXCollectionCache::HandleChangeL( TUid aCollectionId, TMPXItemId aChangeItemId ) + { + // First get the cache node associated with the collection + // If the node exists, then we recursively get every node to handle the change + // + TMPXItemId root( aCollectionId.iUid ); + CMPXCollectionCacheNode* rootNode = iRoot->GetChild( root ); + + // Array does not own any of the objects + RPointerArray affectedNodes; + CleanupClosePushL( affectedNodes ); + if( rootNode ) + { + // Iteratively check every node + // + rootNode->HandleChangeL( aChangeItemId, + affectedNodes ); + } + + // Remove all affected nodes + TInt c( affectedNodes.Count() ); + if( c ) + { + for(TInt i=0; iGetChild(id); + if (!childNode) + { + if (aCreateNodes) + { + // create the child node and add it + childNode = CMPXCollectionCacheNode::NewL(id); + CleanupStack::PushL(childNode); + crtNode->AddChildL(childNode); // ownership transferred + CleanupStack::Pop(childNode); + } + else + { + // exit and return NULL + crtNode = NULL; + break; + } + } + + // move to the next level + crtNode = childNode; + } + + return crtNode; + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionCache::RemoveNode +// ---------------------------------------------------------------------------- +// +void CMPXCollectionCache::RemoveNode( + CMPXCollectionCacheNode* aNode) + { + MPX_FUNC("CMPXCollectionCache::RemoveNode"); + MPX_ASSERT( aNode ); + + + // remove from parent node + aNode->iParent->RemoveChild(*aNode); + + // delete the node and its children + delete aNode; + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionCache::ManageCacheSizeL +// ---------------------------------------------------------------------------- +// +TBool CMPXCollectionCache::ManageCacheSizeL() + { + MPX_FUNC("CMPXCollectionCache::ManageCacheSizeL"); + + TBool addToCache(ETrue); + TInt totalMemory(0); + TInt usedMemory(0); + CMPXMedia::HeapMemoryInfoL( totalMemory, usedMemory ); + TInt ratio( (usedMemory * 100) / totalMemory ); + MPX_DEBUG4("ManageCacheSizeL : ratio=%d, total=%d, used=%d",ratio,totalMemory,usedMemory); + if(ratio > iMaximumSizeRatio) + { + // clear cache to free all memory we can + Reset(); + addToCache = EFalse; + } + + return addToCache; + } + + +#ifdef _DEBUG + +// ---------------------------------------------------------------------------- +// CMPXCollectionCache::PrintTree +// ---------------------------------------------------------------------------- +// +void CMPXCollectionCache::PrintTree( TBool aPrintAtts /*= EFalse */ ) + { + MPX_FUNC("CMPXCollectionCache::PrintTree"); + iRoot->PrintNode( ETrue, aPrintAtts); + } + +#endif + +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionengine/src/mpxcollectionclientcontext.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionengine/src/mpxcollectionclientcontext.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,2613 @@ +/* +* Copyright (c) 2006 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: Maintains sessions to paths +* +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mpxcollectionengineobserver.h" +#include "mpxcollectionpluginhandler.h" +#include "mpxcollectionengine.h" +#include "mpxcollectioncache.h" +#include "mpxcollectionclientcontext.h" + +// ---------------------------------------------------------------------------- +// Helper. Sets next open mode on path +// ---------------------------------------------------------------------------- +// +LOCAL_C void SetPathOpenMode(CMPXCollectionPath& aPath, TInt aMode) + { + TMPXOpenMode mode=static_cast(aMode); + if (aPath.Levels()) + { + aPath.Set(mode == EMPXOpenDefault ? aPath.OpenPreviousMode() : mode); + } + } + +// ---------------------------------------------------------------------------- +// Helper. Returns whether next open mode is the same as previous open +// request +// ---------------------------------------------------------------------------- +// +LOCAL_C TBool OpenModeValid(const CMPXCollectionPath& aPath) + { + TMPXOpenMode next=aPath.OpenNextMode(); + return (aPath.OpenPreviousMode() == next) || (next == EMPXOpenDefault); + } + +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CMPXCollectionClientContext* CMPXCollectionClientContext::NewL( + CMPXCollectionEngine& aEngine, + CMPXCollectionCache& aCache, + const TUid& aModeId) + { + CMPXCollectionClientContext* p = + new(ELeave) CMPXCollectionClientContext(aEngine, aCache, aModeId); + CleanupStack::PushL(p); + p->ConstructL(); + CleanupStack::Pop(p); + return p; + } + +// ---------------------------------------------------------------------------- +// C++ constructor. +// ---------------------------------------------------------------------------- +// +CMPXCollectionClientContext::CMPXCollectionClientContext( + CMPXCollectionEngine& aEngine, + CMPXCollectionCache& aCache, + const TUid& aModeId) + : iModeId(aModeId),iFocusItemId(KMPXInvalidItemId), + iEngine(aEngine),iCache(aCache) + { + } + +// ---------------------------------------------------------------------------- +// 2nd phase constructor. +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::ConstructL() + { + iClientList = CMPXClientList::NewL(); + iBrowsePath = CMPXCollectionPath::NewL(); + iMedia = CMPXMedia::NewL(); // empty media + // initialize to null uid + for (TInt index = 0; index < EContextCount; ++index) + { + iPluginUids.AppendL(KNullUid); + } + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CMPXCollectionClientContext::~CMPXCollectionClientContext() + { + MPX_DEBUG2("CMPXCollectionClientContext::~CMPXCollectionClientContext %08x", + this); + + // Release all plugins this context has references on, this could result in the + // plugin(s) being unloaded. + for (TInt index = 0; index < EContextCount; ++index) + { + if (iPluginUids[index] != KNullUid) + { + iEngine.ReleasePlugin(iPluginUids[index]); + } + } + + delete iClientList; + delete iBrowsePath; + delete iMediaPath; + delete iMedia; + delete iFilter; + iPluginUids.Close(); + iUids.Close(); + } + +// ---------------------------------------------------------------------------- +// Open collection by path +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionClientContext::OpenL( + CMPXCollectionPath* aPath, + TInt aMode, + MMPXCollectionEngineObserver* aCallback) + { + MPX_DEBUG1("CMPXCollectionClientContext::OpenL 1 <--"); + MPX_ASSERT(aPath); + if (aPath->Levels() > 0) + { + // Increment the plugin reference count + CMPXCollectionPlugin*plugin = iEngine.ResolvePluginL(*aPath); + if (!plugin) + { + MPX_DEBUG1("CMPXCollectionClientContext::OpenL 1 bad path plugin"); + User::Leave(KErrArgument); + } + + iEngine.CleanupPluginPushL(plugin); + + // Ownership of aPath transferred + MPX_DEBUG1("CMPXCollectionClientContext::OpenL 1 Add task"); + plugin->AddTaskL(EMcsOpenPath, aCallback, this, + aMode, NULL, plugin, aPath); + + // Pop the plugin + iEngine.PluginPop(); + } + else + { // Go back to root level + MPX_DEBUG1("CMPXCollectionClientContext::OpenL restarting path"); + iIndex=0; + iFocusItemId = KMPXInvalidItemId; + InitL(aCallback); + } + MPX_DEBUG1("CMPXCollectionClientContext::OpenL 1 -->"); + } + +// ---------------------------------------------------------------------------- +// Open collection by index +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionClientContext::OpenL( + TInt aIndex, + TInt aMode, + const TArray& aAttrs, + MMPXCollectionEngineObserver* aCallback) + { + MPX_DEBUG1("CMPXCollectionClientContext::OpenL 2 <--"); + if (iBrowsePath->Levels()<=0) + { + User::Leave(KErrNotReady); + } + if (aIndex<0 || aIndex>=iBrowsePath->Count()) + { + User::Leave(KErrArgument); + } + iBrowsePath->Set(aIndex); + // plugin not resolved yet + if (iPluginUids[EContextBrowse] == KNullUid) + { + // Increment the new plugin reference count, decrement the old. + // No need to push/release the plugin it is stored in a member + // variable and will be released when that is overwritten. + ResolvePluginL(*iBrowsePath, iPluginUids[EContextBrowse]); + } + + if (iPluginUids[EContextBrowse] == KNullUid) + { + MPX_DEBUG1("CMPXCollectionClientContext::OpenL 2 bad plugin"); + User::Leave(KErrNotReady); + } + + // add request to the queue + MPX_DEBUG1("CMPXCollectionClientContext::OpenL 2 Add task"); + iBrowsePath->SetL(aAttrs); + LoadedPlugin(EContextBrowse)->AddTaskL(EMcsOpenIndex, aCallback, this, + aIndex, NULL, (TAny*)aMode); + MPX_DEBUG1("CMPXCollectionClientContext::OpenL 2 -->"); + } + +// ---------------------------------------------------------------------------- +// Open collection by uids +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionClientContext::OpenL( + const TArray& aUids, + TInt aMode, + MMPXCollectionEngineObserver* aCallback) + { + // Update path for open request + MPX_DEBUG1("CMPXCollectionClientContext::OpenL 3 <---"); + SetPathOpenMode(*iBrowsePath,aMode); + if (!MPXUser::CompareOrderedUidArrays(iUids.Array(), aUids)) + { // the same context + MPX_DEBUG1("CMPXCollectionClientContext::OpenL 3 return Open"); + aCallback->HandleOpen(iMedia, iIndex, ETrue, iMediaType); + } + else + { // go back to root level + MPX_DEBUG1("CMPXCollectionClientContext::OpenL 3 Going to Root"); + iUids.Reset(); + ::CopyArrayL(aUids, iUids); + iIndex=0; + iFocusItemId = KMPXInvalidItemId; + InitL(aCallback); + } + MPX_DEBUG1("CMPXCollectionClientContext::OpenL 3 --->"); + } + +// ---------------------------------------------------------------------------- +// Request current content of browse context +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionClientContext::OpenL( + TInt aMode, + MMPXCollectionEngineObserver* aCallback) + { + // Update path for open request + MPX_DEBUG1("CMPXCollectionClientContext::OpenL 4 <---"); + SetPathOpenMode(*iBrowsePath,aMode); + if (iPluginUids[EContextBrowse] == KNullUid) + {// No plug-in has been resolved + if (iBrowsePath->Levels() == 0) + // + // Open called at root level: just need to list the plug-ins, + // no need to resolve any plugin. Open request doesn't apply + // at this level + { + MPX_DEBUG1("CMPXCollectionClientContext::OpenL 4 InitL()"); + iIndex=0; + iFocusItemId = KMPXInvalidItemId; + InitL(aCallback); + } + else if (OpenModeValid(*iBrowsePath) && !iPathUpdated) + // + // The existing media is still valid (no change + // in the request for entries + // + { + MPX_DEBUG1("CMPXCollectionClientContext::OpenL 4 return media"); + aCallback->HandleOpen(iMedia, + iIndex, ETrue, + iMediaType); + } + else // Open mode has changed and open NOT called at root level + { + MPX_DEBUG1("CMPXCollectionClientContext::OpenL 4 add task different open mode"); + ResolvePluginL(*iBrowsePath, iPluginUids[EContextBrowse]); // Find a plug-in + if (iPluginUids[EContextBrowse] != KNullUid) + { + LoadedPlugin(EContextBrowse)->AddTaskL(EMcsOpen, aCallback, this); + } + } + } + else + { + MPX_DEBUG1("CMPXCollectionClientContext::OpenL 4 add task"); + LoadedPlugin(EContextBrowse)->AddTaskL(EMcsOpen, aCallback,this); + } + MPX_DEBUG1("CMPXCollectionClientContext::OpenL 4 --->"); + } + +// ---------------------------------------------------------------------------- +// Media request by collection path +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionClientContext::BackL( + MMPXCollectionEngineObserver* aCallback) + { + MPX_DEBUG1("CMPXCollectionClientContext::BackL()"); + if (iPluginUids[EContextBrowse]==KNullUid) + { + User::Leave(KErrNotReady); + } + + MPX_DEBUG1("CMPXCollectionClientContext::BackL() -- Add task"); + LoadedPlugin(EContextBrowse)->AddTaskL(EMcsBack, aCallback, this); + } + +// ---------------------------------------------------------------------------- +// MediaL command +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionClientContext::MediaL( + const CMPXCommand& aCmd, + MMPXCollectionEngineObserver* aCallback) + { + CMPXCollectionPath* path = + aCmd.ValueCObjectL(KMPXCommandGeneralTargetIds); + CleanupStack::PushL(path); + + // Increment the plugin reference count + CMPXCollectionPlugin*plugin = iEngine.ResolvePluginL(*path); + if (!plugin) + { + User::Leave(KErrArgument); + } + + iEngine.CleanupPluginPushL(plugin); + + CMPXCommand* cmd = CMPXCommand::NewL(aCmd); // make a copy + CleanupStack::PushL(cmd); + + plugin->AddTaskL(EMcsMediaByPath, aCallback, this, + 0, NULL, plugin, cmd, path); + + CleanupStack::Pop(cmd); // Ownership transferred to the task queue + iEngine.PluginPop(); // Pop the plugin + CleanupStack::Pop(path);// Ownership transferred to the task queue + } + +// ---------------------------------------------------------------------------- +// Add a media +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionClientContext::AddL(const CMPXMedia& aMedia) + { + DoUpdateMediaL( EMcsAddItem, aMedia ); + } + +// ---------------------------------------------------------------------------- +// Remove a media +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionClientContext::RemoveL(const CMPXMedia& aMedia) + { + DoUpdateMediaL( EMcsRemoveItem, aMedia ); + } + +// ---------------------------------------------------------------------------- +// Update a media +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionClientContext::SetL(const CMPXMedia& aMedia) + { + DoUpdateMediaL( EMcsSetMedia, aMedia ); + } + +// ---------------------------------------------------------------------------- +// Remove media by path +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionClientContext::RemoveL( + CMPXCollectionPath* aPath, + MMPXCollectionEngineObserver* aCallback) + { + TInt id(aPath->Id(CMPXCollectionPath::ECollectionUid)); + + // Increment the plugin reference count + CMPXCollectionPlugin* plugin = iEngine.ResolvePluginL(TUid::Uid(id)); + if (!plugin) + { + User::Leave(KErrArgument); + } + + iEngine.CleanupPluginPushL(plugin); + + // Ownership of aPath transferred + plugin->AddTaskL(EMcsRemovePath, aCallback, this, 0, NULL, plugin, aPath); + + iEngine.PluginPop(); + } + +// ---------------------------------------------------------------------------- +// Return current plugin id +// ---------------------------------------------------------------------------- +// +EXPORT_C TUid CMPXCollectionClientContext::PluginId() const + { + return iPluginUids[EContextBrowse]; + } + +// ---------------------------------------------------------------------------- +// Handle async request from client +// ---------------------------------------------------------------------------- +// +EXPORT_C const CMPXCollectionPath& CMPXCollectionClientContext::Path() const + { + return *iBrowsePath; + } + +// ---------------------------------------------------------------------------- +// Cancel request +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionClientContext::CancelRequest( + MMPXCollectionEngineObserver* aCallback) + { + MPX_DEBUG3("CMPXCollectionClientContext::CancelRequest, this %08x, aCallback %08x", + this, aCallback); + iEngine.RemoveTask(aCallback); + } + +// ---------------------------------------------------------------------------- +// Add a client +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionClientContext::AddClientL( + TThreadId aId, + CMPXMessageQueue* aMsgQueue) + { + iClientList->AddClientL(aId, aMsgQueue); + } + +// ---------------------------------------------------------------------------- +// Remove a client +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionClientContext::RemoveClient( + const CMPXMessageQueue& aMsgQueue) + { + MPX_DEBUG2("CMPXCollectionClientContext::RemoveClient with the message queue 0x%08x", + &aMsgQueue); + TInt index(iClientList->Find(aMsgQueue)); + if (KErrNotFound != index) + { + iClientList->RemoveClient(index); + } + if (!iClientList->ClientCount()) + { + iEngine.RemoveContext(*this); + } + } + +// ---------------------------------------------------------------------------- +// Gets the supported capabilities of the current browse plugin +// ---------------------------------------------------------------------------- +// +EXPORT_C TCollectionCapability CMPXCollectionClientContext::GetCapabilities() + { + TCollectionCapability cap(0); + if (iPluginUids[EContextBrowse]!=KNullUid) + { + LoadedPlugin(EContextBrowse)->GetCapabilities(); + } + return cap; + } + +// ---------------------------------------------------------------------------- +// Find all aSync +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionClientContext::FindAllL( + const CMPXMedia& aMedia, + CBufBase* aBuf, + MMPXCollectionEngineObserver* aCallback) + { + CMPXCollectionPlugin* plugin(NULL); // Not owned + + // Increment the plugin reference count + ResolvePluginL(aMedia, plugin); + if (!plugin) + { + User::Leave(KErrNotFound); // found nothing + } + + iEngine.CleanupPluginPushL(plugin); + + // Add the task + CMPXMedia* media = CMPXMedia::NewL(aMedia); + CleanupStack::PushL(media); + plugin->AddTaskL(EMcsFindAll, aCallback, this, 0, aBuf, plugin, media); + CleanupStack::Pop(media); // Ownership transferred + + iEngine.PluginPop(); + } + +// ---------------------------------------------------------------------------- +// Find all sync +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXMedia* CMPXCollectionClientContext::FindAllSyncL( + const CMPXMedia& aMedia, + const CBufBase& aBuf) + { + CMPXCollectionPlugin* plugin(NULL); // Not owned + + // Increment the plugin reference count + ResolvePluginL(aMedia, plugin); + iEngine.CleanupPluginPushL(plugin); + + CMPXMedia* result(NULL); + FindAllL(aMedia, aBuf, *plugin, &result, ETrue); + + // Synchronous call, safe to release the plugin + CleanupStack::PopAndDestroy(); // plugin + return result; + } + +// ---------------------------------------------------------------------------- +// Set filter +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionClientContext::SetFilterL(const CMPXFilter* aFilter) + { + delete iFilter; + iFilter = NULL; + iFilter = aFilter ? CMPXFilter::NewL(*aFilter) : NULL; + } + +// ---------------------------------------------------------------------------- +// Returns filter +// ---------------------------------------------------------------------------- +// +EXPORT_C const CMPXFilter* CMPXCollectionClientContext::Filter() const + { + return iFilter; + } + +// ---------------------------------------------------------------------------- +// Handle a command +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionClientContext::CommandL( + TMPXCollectionCommand aCmd, + TInt aData) + { + switch( aCmd ) + { + case EMcCmdRemoveAll: + case EMcCmdReCreateDB: // fall through + case EMcCmdDbCorrupted: // fall through + { + TUid uid = TUid::Uid(aData); + + // Increment the plugin reference count + CMPXCollectionPlugin* plugin = iEngine.ResolvePluginL( uid ); + iEngine.CleanupPluginPushL(plugin); + + if( plugin ) + { + // The trap is needed to keep the plugin reference count in sync + plugin->CommandL(aCmd); + } + + CleanupStack::PopAndDestroy(); // plugin + break; + } + case EMcCmdSelect: + if (iBrowsePath->Levels()<=0) + { + User::Leave(KErrNotReady); + } + if (aData<0 || aData>=iBrowsePath->Count()) + { + User::Leave(KErrArgument); + } + iBrowsePath->Set(aData); + iClientList->SendMsgL( + TMPXCollectionMessage(TMPXCollectionMessage::EFocusChanged, + aData, aData)); + iIndex = aData; // iIndex will always be up to date + iFocusItemId = iBrowsePath->Id(); + break; + case EMcCmdCollectionInit: + case EMcCmdCollectionResyn: + { + TUid uid = TUid::Uid(aData); + // Increment the plugin reference count + CMPXCollectionPlugin* plugin = iEngine.ResolvePluginL(uid); + if( !plugin ) + { + User::Leave(KErrArgument); + } + + iEngine.CleanupPluginPushL(plugin); + + plugin->AddTaskL(EMcsCommand, NULL, this, aCmd, NULL, plugin); + + iEngine.PluginPop(); + break; + } + default: + { + User::Leave(KErrNotSupported); + break; + } + } + } + +// ---------------------------------------------------------------------------- +// Handle a command +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionClientContext::CommandL( + const CMPXCommand& aCmd, + MMPXCollectionEngineObserver* aCallback, + const CMPXMessageQueue& aMsgQueue) + { + // Use the plugin id defined by the command object, + // or the browse context if collection id not defined + CMPXCollectionPlugin* plugin = NULL; + if (aCmd.IsSupported(KMPXCommandGeneralCollectionId)) + { + TInt data = aCmd.ValueTObjectL(KMPXCommandGeneralCollectionId); + + // Increment the plugin reference count + plugin = iEngine.ResolvePluginL(TUid::Uid(data)); + } + if (!plugin && iPluginUids[EContextBrowse]!=KNullUid) + { + plugin = LoadedPlugin(EContextBrowse); + + // Increment the plugin reference count manually + iEngine.UsePlugin(plugin->Uid()); + } + iEngine.CleanupPluginPushL(plugin); + + TBool async(ETrue); // by default command is asynchronous + if (aCmd.IsSupported(KMPXCommandGeneralDoSync)) + { // check if command is sync + async=!(aCmd.ValueTObjectL(KMPXCommandGeneralDoSync)); + } + + if (async) + { // Async, cmd ownership transferred + if (!plugin) + { + User::Leave(KErrNotReady); + } + + CMPXCommand* cmd = CMPXCommand::NewL(aCmd); + CleanupStack::PushL(cmd); + plugin->AddTaskL(EMcsCommandExt, aCallback, this, 0, + NULL, plugin, cmd); + CleanupStack::Pop(cmd); + + // Async, the plugin pointer passed through the task queue + iEngine.PluginPop(); + } + else + { + DoHandleSyncCommandL(aCmd, aMsgQueue, plugin); + CleanupStack::PopAndDestroy(); // plugin + } + } + +// ---------------------------------------------------------------------------- +// Find a shareable client +// ---------------------------------------------------------------------------- +// +TBool CMPXCollectionClientContext::HasShareableClient( + TThreadId aId) + { + TBool ret(EFalse); + if (iModeId != KMcModePlaylist) + { + if (iClientList->IsClient(aId) ) // Just look for same thread + { + ret = ETrue; + } + } + return ret; + } + +// ---------------------------------------------------------------------------- +// Notifies all clients of events +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::NotifyL( TMPXCollectionBroadCastMsg aMsg, + TInt aData ) + { + iClientList->SendMsgL( + TMPXCollectionMessage(TMPXCollectionMessage::EBroadcastEvent, + aMsg,aData)); + } + +const TUid& CMPXCollectionClientContext::ModeId() const + { + return iModeId; + } + +// ---------------------------------------------------------------------------- +// Initialises from file. iFile is not owned here +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::OpenL() + { + if (iPathUpdated) + { + ReOpenL(); + } + else + { + CMPXCollectionPlugin* plugin = LoadedPlugin(EContextBrowse); + MPX_ASSERT(plugin); + plugin->CompleteTask(); + if (plugin->Callback()) + { + plugin->Callback()->HandleOpen(iMedia, + iIndex, ETrue,iMediaType); + plugin->SetCallback( NULL ); // Reset current observer + plugin->SetObserver(iEngine); + } + } + } + +// ---------------------------------------------------------------------------- +// Cancels all outstanding calls (tasks): plug-in should only have one +// outstanding so that is canceled; the tasks are deleted and removed from the +// queue +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::BackL() + { + TInt d=iBrowsePath->Levels(); + if(d>1) + { + iPathUpdated = EFalse; + // remove last item - the actual item selected + iBrowsePath->Back(); + // preserve focus, since we're rebuilding this level + iIndex=iBrowsePath->Index(); + iFocusItemId = iBrowsePath->Id(); + ReOpenL(); + } + } + +// ---------------------------------------------------------------------------- +// Re-open current level +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::ReOpenL() + { + // remove last item - go to the container which contained the item + if (iBrowsePath->Levels()) + { + iBrowsePath->Back(); + } + if (iBrowsePath->Levels() == 0) + { + //Plugin must be resolved ealier + CMPXCollectionPlugin* plugin = LoadedPlugin(EContextBrowse); + plugin->CompleteTask(); + InitL(plugin->Callback()); + } + else + { + DoPluginOpenL(); + } + } + +// ---------------------------------------------------------------------------- +// Retrieve media info based on a find criteria +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::FindAllL( + const CMPXMedia& aMedia, + const CBufBase& aBuf, + CMPXCollectionPlugin& aPlugin, + CMPXMedia** aResult /*= NULL*/, + TBool aSync /*= EFalse*/) + { + // Find critera and return attributes + // + RArray attrs; + CleanupClosePushL(attrs); + ::CreateFromBufferL(aBuf, attrs); + + // Do the query + if (!aSync) + { + aPlugin.SetObserver(*this); + aPlugin.FindAllL(aMedia,attrs.Array()); + } + else + { + *aResult = aPlugin.FindAllSyncL(aMedia,attrs.Array()); + } + CleanupStack::PopAndDestroy( &attrs ); + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionClientContext::HandleMessage +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::HandleMessage( + CMPXMessage* aMsg, + TInt aError) + { + MPX_FUNC_EX("CMPXCollectionClientContext::HandleMessage"); + DoHandleMessage(aMsg, aError, ETrue); + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionClientContext::HandleMessage +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::DoHandleMessage( + CMPXMessage* aMsg, + TInt aError, + TBool aNotifyOthers) + { + MPX_DEBUG3("-->CMPXCollectionClientContext::HandleMessage this %08x, %d", this, aNotifyOthers); + if (!aMsg) + { + iClientList->SendMsg(aMsg, aError); + if (aNotifyOthers) + { + iEngine.NotifyChange(*this, aMsg, aError); + } + } + else + { + if (aMsg->IsSupported(KMPXMessageGeneralId)) + { + if (aMsg->IsSupported(KMPXMessageArrayContents)) + { + TBool pathUpdated(EFalse); + const CMPXMessageArray* messageArray = + aMsg->Value(KMPXMessageArrayContents); + if (messageArray) + { + TInt count = messageArray->Count(); + + MPX_DEBUG2("%d messages:", count); + + for (TInt i=0; i(aMsg), + aError); + } + } + else + { + TRAP_IGNORE(DoHandleMessageL(*aMsg, aError)); + + // Notify other context, collection is changed. + if (aNotifyOthers) + { + iEngine.NotifyChange(*this, aMsg, aError); + } + } + + // Broadcast change messages to the clients to handle + // + if( iModeId == KMcModePlaylist ) + { + // Playlist should not be handling msgs during refresh + if( !iEngine.IsRefreshing() ) + { + iClientList->SendMsg( aMsg, aError ); + } + } + else + { + // Other modes receive msg all the time + iClientList->SendMsg( aMsg, aError ); + } + + // Batched collection change messages and only send this once + // Path changed isn't sent to the UI during refresh + // + if (iPathUpdated) + { + MPX_DEBUG1("CMPXCollectionClientContext::DoHandleMessageL detected path changed"); + MPX_DEBUG_PATH(*iBrowsePath); + // notify clients to refresh + TRAP_IGNORE(iClientList->SendMsgL( + TMPXCollectionMessage(TMPXCollectionMessage::EPathChanged, + EMcPathChangedByCollectionChange))); + } + } + } + + MPX_DEBUG3("<--CMPXCollectionClientContext::HandleMessage this %08x, %d", this, aNotifyOthers); + } + +// ---------------------------------------------------------------------------- +// Handle collection item change message +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::DoHandleMessageL( + const CMPXMessage& aMsg, + TInt /*aError*/) + { + MPX_DEBUG2("-->CMPXCollectionClientContext::DoHandleMessageL this %08x", this); + TInt browseLevels = iBrowsePath->Levels(); // browse depth + + if (aMsg.ValueTObjectL(KMPXMessageGeneralId)== + KMPXMessageIdItemChanged) + { + if (!aMsg.IsSupported(KMPXMessageCollectionId) || + !aMsg.IsSupported(KMPXMessageChangeEventType) || + !aMsg.IsSupported(KMPXMessageMediaGeneralCategory) || + !aMsg.IsSupported(KMPXMessageMediaGeneralId)) + { + User::Leave(KErrArgument); + } + + TUid collectionId = aMsg.ValueTObjectL(KMPXMessageCollectionId); + + TMPXChangeEventType changeType = + aMsg.ValueTObjectL(KMPXMessageChangeEventType); + + TMPXGeneralCategory category = + aMsg.ValueTObjectL(KMPXMessageMediaGeneralCategory); + + TMPXItemId itemId = aMsg.ValueTObjectL(KMPXMessageMediaGeneralId); + + TMPXItemId deprecatedId(0); + if (aMsg.IsSupported(KMPXMessageMediaDeprecatedId)) + { + deprecatedId = aMsg.ValueTObjectL(KMPXMessageMediaDeprecatedId); + } + + MPX_DEBUG5("CMPXCollectionClientContext::DoHandleMessageL colId %08x, id %d, deprecatedId %d, type %d", + collectionId.iUid, itemId.iId1, deprecatedId.iId1, changeType); + + + if(!iEngine.IsRefreshing()) + { + // Invalidate path + TInt pct = KErrNotFound; // path change type + if (changeType == EMPXItemInserted && category != EMPXPlaylist) + { + pct = CMPXCollectionPath ::EAdded; + } + else if (changeType == EMPXItemModified && category != EMPXPlaylist) + { + pct = CMPXCollectionPath ::EModified; + } + else if (changeType == EMPXItemDeleted) + { + pct = CMPXCollectionPath ::EDeleted; + } + else if ((changeType == EMPXItemInserted || changeType == EMPXItemModified) && + category == EMPXPlaylist) + { + pct = CMPXCollectionPath ::EGroupModified; + } + if( changeType == EMPXItemModified && category == EMPXCollection ) + { + // Overwrite previous type + pct = CMPXCollectionPath ::EGroupModified; + } + + if (KErrNotFound != pct) + { // update browse path + CMPXCollectionPath::TMPXCollectionPathChange ct = + static_cast(pct); + TInt pUpdated(CMPXCollectionPath::EPathUnchanged); + + // If browse context and browse context is being modified + // + if (iModeId != KMcModePlaylist && browseLevels && + iBrowsePath->Id(0) == collectionId.iUid ) + { // check the browse path + TInt tmpIndex(0); + + pUpdated = iBrowsePath->HandleChange( + collectionId, itemId, deprecatedId, ct, + tmpIndex); + + // Take the updated selection index only if it was affected + // We need to store the TMPXItemId for iIndex because + // a previous collection change would have removed the + // top level of the collection path + // + iPathUpdated = iPathUpdated || + (pUpdated != CMPXCollectionPath::EPathUnchanged); + if( pUpdated ) + { + // Only update the selection index if the itemid that + // was modified is equal to the one selected + // + // OR take in the index if clipped the collection path + // (pUpdated == KPathClipped ) + // + if( pUpdated == CMPXCollectionPath::EPathClipped ) + { + iIndex = tmpIndex; + iFocusItemId = KMPXInvalidItemId; + } + else if( iFocusItemId.ApproxEqual(itemId ) && + ( iFocusItemId != KMPXInvalidItemId ) ) + { + // Also make sure the index that came back from + // checking the collection path isn't -1 + // + // The only case where the selected item will shift + // is when we are deleting that item. updaing the item or adding + // an item to the current path should not move the focus to another + // item + // + if( tmpIndex != -1 && changeType == EMPXItemDeleted) + { + if( tmpIndex == iBrowsePath->Count()-1 ) + { + // Last item, focus on previous + iIndex = tmpIndex-1; + iFocusItemId = iBrowsePath->IdOfIndex( tmpIndex-1 ); + } + else + { + // Not last, focus on next + iFocusItemId = iBrowsePath->IdOfIndex( tmpIndex+1 ); + } + } + } + else if( iFocusItemId.ApproxEqual( deprecatedId ) && + changeType == EMPXItemModified ) + { + // If we are modifying the item id of an item currently in focus + // We move the focus to the new item id + // + iFocusItemId = itemId; + } + } + } + } + } + } + else + { + // do nothing + } + MPX_DEBUG2("<--CMPXCollectionClientContext::DoHandleMessageL this %08x", this); + } + +// ---------------------------------------------------------------------------- +// Handle open event +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::HandleOpen( + CMPXMedia* aMedia, + TInt aErr) + { + MPX_FUNC("CMPXCollectionClientContext::HandleOpen with media returned"); + CMPXCollectionPlugin* plugin = LoadedPlugin(EContextBrowse); + MPX_ASSERT(plugin); + + // Callback and Task Completion + // + MMPXCollectionEngineObserver* callback(NULL); + TBool openTask(EFalse); + TInt task = plugin->Task(); + if( task == EMcsOpen || task == EMcsOpenPath || + task == EMcsBack || task == EMcsOpenIndex ) + { + callback = plugin->Callback(); + openTask = ETrue; + } + + // Cachable flag + // + TBool cache(EFalse); + if( iBrowsePath && + iBrowsePath->Levels() >= 1 ) + { + TMPXItemId id(iBrowsePath->Id(CMPXCollectionPath::ECollectionUid) ); + cache = iEngine.PluginCacheable( TUid::Uid( id ) ); + } + + TRAPD(err, DoHandleOpenL(aMedia, NULL, callback, aErr, cache, openTask)); + if (err && openTask) + { + HandleError(*plugin, err); + } + else if( openTask ) + { + plugin->CompleteTask(); + } + } + +// ---------------------------------------------------------------------------- +// Handle open event +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::HandleOpen( + CMPXMedia* aMedia, + const CMPXCollectionPath* aPath, + TInt aErr) + { + MPX_FUNC("CMPXCollectionClientContext::HandleOpen with media returned"); + CMPXCollectionPlugin* plugin = LoadedPlugin(EContextBrowse); + MPX_ASSERT(plugin); + + // Callback and Task Completion + // + MMPXCollectionEngineObserver* p(NULL); + TBool openTask(EFalse); + TInt task = plugin->Task(); + if( task == EMcsOpen || task == EMcsOpenPath || + task == EMcsBack || task == EMcsOpenIndex ) + { + p = plugin->Callback(); + openTask = ETrue; + } + + // Cachable flag + // + TBool cache(EFalse); + if( iBrowsePath && + iBrowsePath->Levels() >= 1 ) + { + TMPXItemId id(iBrowsePath->Id(CMPXCollectionPath::ECollectionUid) ); + cache = iEngine.PluginCacheable( TUid::Uid( id ) ); + } + + // Handle OpenL for Media + // + TRAPD(err, DoHandleOpenL(aMedia, aPath, p, aErr, cache, openTask)); + if (err && openTask) + { + HandleError(*plugin, err); + } + else if( openTask ) + { + plugin->CompleteTask(); + } + } + +// ---------------------------------------------------------------------------- +// Handle open event +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::DoHandleOpenL( + CMPXMedia* aMedia, + const CMPXCollectionPath* aPath, + MMPXCollectionEngineObserver* aCallback, + TInt aErr, + TBool aAddToCache, + TBool aOpenTask ) + { + MPX_FUNC("CMPXCollectionClientContext::DoHandleOpen with media returned"); + + // Make sure if we are updating the results the paths are aligned! + // + TBool openUpdate(EFalse); + if( !aOpenTask ) + { + openUpdate = ETrue; + iCacheMedia = ETrue; + if( aPath && + aPath->Levels() != iBrowsePath->Levels() ) + { + User::Leave( KErrArgument ); + } + } + + // Add to cache + // + if ( iBrowsePath->Levels() && aAddToCache && aMedia && iCacheMedia ) + { + // manage the priority + CMPXCollectionCache::TCachePriority priority(CMPXCollectionCache::EPriorityNormal); + if ((1 == iBrowsePath->Levels()) || + ((2 == iBrowsePath->Levels()) && ((iBrowsePath->Id(1)).iId1 == 0))) + { + priority = CMPXCollectionCache::EPriorityHigh; + } + + if( !aOpenTask ) + { + // Update the current browse path + // + CMPXCollectionPath* container = iBrowsePath->ContainerPathL(); + CleanupStack::PushL( container ); + + // Add the data to the generic cache and get the latest copy + // + aMedia = AddToCache( *container, + aMedia->Attributes(), + *aMedia, + ETrue, + priority); + CleanupStack::PopAndDestroy( container ); + } + else + { + AddToCache( *iBrowsePath, + aMedia->Attributes(), + *aMedia, + ETrue, + priority); + } + } + + // Current client context browse path media + // + iMediaType = KMPXCollectionEntries; + if (iMedia != aMedia) + { // new media + delete iMedia; + iMedia = NULL; + if (aMedia) + { + iMedia = CMPXMedia::NewL(*aMedia); + } + } + + TInt n(0); + if (aMedia && KErrNone == aErr) + { // Update the path + RArray selectionIndicies; + CleanupClosePushL( selectionIndicies ); + + if (aPath) + { // Update path from aPath + if ( aMedia->IsSupported (KMPXCollectionOpenLAllResultRange)) + { + iBrowsePath->Back (); + RArray ids; + CleanupClosePushL (ids); + RArray datablocks; + CleanupClosePushL (datablocks); + // De-serialize from global data, would be good to have global arrays + // + const TDesC + & buf = aMedia->ValueText (KMPXCollectionOpenLAllResultRange); + CBufBase* buffer(NULL); + MPXUser::CreateBufferL ( buf, buffer); + CleanupStack::PushL ( buffer); + ::CreateFromBufferL ( *buffer, datablocks); + CleanupStack::PopAndDestroy ( buffer); + + if ( aMedia->IsSupported (KMPXMediaArrayContents)) + { + const CMPXMediaArray + * mediaArray = aMedia->Value (KMPXMediaArrayContents); + User::LeaveIfNull (const_cast(mediaArray)); + TInt dataCount = mediaArray->Count (); + TInt rangeCount = datablocks.Count (); + for (TInt index = 0; index < dataCount; ++index) + { + CMPXMedia* media = mediaArray->AtL(index); + + //Check range + TBool validItem(EFalse); + MPX_ASSERT(rangeCount > 0); + for (TInt rangeIndex = 0; rangeIndex < rangeCount; ++rangeIndex) + { + TInt offset = datablocks[rangeIndex].iOffset; + TInt size = datablocks[rangeIndex].iSize; + if ( (index >= offset) && (index < offset + size)) + { + validItem = ETrue; + break; + } + } + + if (validItem) + { + const TMPXItemId + id = media->ValueTObjectL (KMPXMediaGeneralId); + ids.AppendL (id); + } + else + { + ids.AppendL (KMPXInvalidItemId); + } + } + iBrowsePath->AppendL (ids.Array ()); + } + CleanupStack::PopAndDestroy (&datablocks); + CleanupStack::PopAndDestroy (&ids); + } + else + { + delete iBrowsePath; + iBrowsePath = NULL; + iBrowsePath = CMPXCollectionPath::NewL ( *aPath); + } + } + else + { // Update path from media + RArray ids; + CleanupClosePushL(ids); + if( aMedia->IsSupported(KMPXMediaArrayContents) ) + { + const CMPXMediaArray* mediaArray=aMedia->Value( + KMPXMediaArrayContents); + User::LeaveIfNull(const_cast(mediaArray)); + n=mediaArray->Count(); + for (TInt i=0;iAtL(i); + const TMPXItemId id=media->ValueTObjectL(KMPXMediaGeneralId); + ids.AppendL(id); + + // Try to look for the selection that we want + if( iFocusItemId == id ) + { + selectionIndicies.AppendL( i ); + } + } + } + + iBrowsePath->AppendL(ids.Array()); + CleanupStack::PopAndDestroy(&ids); + } + + // List of items + const TArray& items = iBrowsePath->Items(); + + // OpenL Media has been updated, update the itemid + // based on the current index + if( openUpdate ) + { + // Check if we have item id first + // + if( iFocusItemId != KMPXInvalidItemId ) + { + TInt index = iBrowsePath->IndexOfId( iFocusItemId ); + if( index != KErrNotFound ) + { + iIndex = index; + } + } + + // Then update based on index + if( iIndex >=0 && iIndex < iBrowsePath->Count() ) + { + iBrowsePath->Set(iIndex); + iFocusItemId = iBrowsePath->Id(); + } + } + else if( aMedia->IsSupported( KMPXCollectionOpenLResultRange ) ) + { + TMPXOpenDataBlock data = + aMedia->ValueTObjectL(KMPXCollectionOpenLResultRange); + if( iBrowsePath->Count() && + iIndex >= 0 && + iIndex < iBrowsePath->Count() ) + { + // If all blank items then we don't change index yet + // Wait until we have re-opened the partial data + if( data.iOffset != KErrNotFound ) + { + // Not supported, stay with current focus + iBrowsePath->Set(iIndex); + iFocusItemId = iBrowsePath->Id(); + } + } + } + // If this selection appears more than once, then we have to find + // the closest matching index to what we had before + // + // + else if( selectionIndicies.Count() > 1 && + iFocusItemId != KMPXInvalidItemId ) + { + TInt best(selectionIndicies[0]); + TInt idAppearance( selectionIndicies.Count() ); + for( TInt i=0; iSet(iIndex); + } + // Always set by item id if we have it + // This is needed if an item was added to the current browse level + // We still want to select the item we were previously at + // + else if( iFocusItemId != KMPXInvalidItemId ) + { + TInt index = iBrowsePath->IndexOfId(iFocusItemId); + if (KErrNotFound != index) + { + iBrowsePath->Set(index); + } + else if( n > 0 ) // Focus item has been deleted, select next + { + // Bounds check for largest and smallest + if( iIndex >= n ) + { + iIndex = n-1; + } + if( iIndex < 0 ) + { + iIndex = 0; + } + iBrowsePath->Set(iIndex); + iFocusItemId = iBrowsePath->Id(); + } + iIndex = iBrowsePath->Index(); + } + else + { + // Bounds checking for iIndex + if( iIndex >= n && iIndex > 0 ) + { + iIndex = n-1; + + // Just in case if ids has 0 items + if( iIndex > 0 && iIndex < items.Count() ) + { + iFocusItemId = items[iIndex]; + } + } + + if (iBrowsePath->Levels()>0 && iIndex>=0 && + iIndexCount()) + { + iBrowsePath->Set(iIndex); + } + iFocusItemId = iBrowsePath->Id(); + } + CleanupStack::PopAndDestroy(&selectionIndicies); + } + + TInt err; + if( !iPathUpdated ) + { + // Normal open mode + err = KErrNone == aErr ? KMPXPathUpdated : aErr; + } + else + { + // Updates open mode, should be returning entries + err = KErrNone == aErr ? KMPXCollectionEntries : aErr; + } + + // Should not be broadcasting container opened messages + // When we are only rebuilding the leaf level + // + if( !iPathUpdated && aOpenTask ) + { + if( err >= KErrNone) + { + iClientList->SendMsgL( + TMPXCollectionMessage(TMPXCollectionMessage::EPathChanged, + EMcPathChangedByOpen, + EMcContainerOpened)); + } + } + + iPathUpdated = EFalse; + + // Notes: there should no leave function called after aCallback->HandleOpen + if (aCallback) + { // Complete open with error or PathUpdated + aCallback->HandleOpen(iMedia, iIndex, ETrue, err); + if (iPluginUids[EContextBrowse]!=KNullUid) + { + CMPXCollectionPlugin* plugin = LoadedPlugin(EContextBrowse); + MPX_ASSERT(aCallback == plugin->Callback()); + plugin->SetCallback(NULL); + plugin->SetObserver(iEngine); + } + } + MPX_DEBUG_PATH(*iBrowsePath); + } + +// ---------------------------------------------------------------------------- +// Handle open event +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::HandleOpen( + CMPXCollectionPath* aPath, + TInt aErr) + { + MPX_FUNC("CMPXCollectionClientContext::HandleOpen with path returned"); + TRAPD(err, DoHandleOpenL(aPath, aErr)); + if (err) + { + HandleError(*(LoadedPlugin(EContextBrowse)), err); + } + } + +// ---------------------------------------------------------------------------- +// Handle open event +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::DoHandleOpenL( + CMPXCollectionPath* aPath, + TInt aErr) + { + MPX_FUNC("CMPXCollectionClientContext::DoHandleOpen with path returned"); + CMPXCollectionPlugin* plugin = LoadedPlugin(EContextBrowse); + MPX_ASSERT(plugin); + + plugin->CompleteTask(); + + if (iBrowsePath != aPath && KErrNone == aErr) + { + delete iBrowsePath; + iBrowsePath = NULL; + MPX_ASSERT(aPath); + iBrowsePath = CMPXCollectionPath::NewL(*aPath); + } + iMediaType = KMPXCollectionPath; + iIndex = iBrowsePath->Index(); + iFocusItemId = iBrowsePath->Id(); + + TInt err = KErrNone == aErr ? KMPXPathUpdated : aErr; + + // Complete msg + // Complete open with error or PathUpdated + plugin->Callback()->HandleOpen(iMedia, iIndex, ETrue, err); + plugin->SetCallback(NULL); + plugin->SetObserver(iEngine); + if (aPath->OpenNextMode() != EMPXOpenNoPlaylist) + // + // The request was NOT to play, but the plug-in returned + // the path implying that we should play; so we don't + // send it + // + { + iClientList->SendMsgL( + TMPXCollectionMessage(TMPXCollectionMessage::EPathChanged, + EMcPathChangedByOpen, + EMcItemOpened)); + } + + MPX_DEBUG_PATH(*iBrowsePath); + } + +// ---------------------------------------------------------------------------- +// Callback of retrieving extended media property +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::HandleMedia( + CMPXMedia* aMedia, + TInt aError) + { + MPX_FUNC("CMPXCollectionClientContext::HandleMedia"); + + CMPXMedia* ret( aMedia ); + + TBool pluginCacheable(EFalse); + if( iMediaPath ) + { + TMPXItemId id(iMediaPath->Id(CMPXCollectionPath::ECollectionUid) ); + pluginCacheable = iEngine.PluginCacheable( TUid::Uid( id ) ); + + // if media returned was resulted from multiple selections we don't cache the + // results as it's very hard to reuse it anyway + if(iMediaPath->Selection().Count() > 0) + { + pluginCacheable = EFalse; + } + } + + // Cache the media + if ( !aError && aMedia && iCacheMedia && iMediaPath && pluginCacheable ) + { + TMPXItemId id( iMediaPath->Id( + CMPXCollectionPath::ECollectionUid )); + ret = AddToCache( *iMediaPath, aMedia->Attributes(), *aMedia ); + } + + CMPXCollectionPlugin* plugin = LoadedPlugin(EContextMedia); + + plugin->CompleteTask(); + MPX_ASSERT(plugin->Callback()); + plugin->Callback()->HandleMedia(ret, aError); + plugin->SetCallback(NULL); // Reset current observer + plugin->SetObserver(iEngine); + } + +// ---------------------------------------------------------------------------- +// Callback of async CommandL +// ---------------------------------------------------------------------------- +// + void CMPXCollectionClientContext::HandleCommandComplete( + CMPXCommand* aCommandResult, + TInt aError) + { + MPX_FUNC_EX("CMPXCollectionClientContext::HandleCommandComplete"); + CMPXCollectionPlugin* plugin = LoadedPlugin(EContextMedia); + + plugin->CompleteTask(); + MPX_ASSERT(plugin->Callback()); + plugin->Callback()->HandleCommandComplete(aCommandResult, aError); + plugin->SetCallback(NULL); // Reset current observer + plugin->SetObserver(iEngine); + } + +// ---------------------------------------------------------------------------- +// Handle find all +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::HandleFindAll( + CMPXMedia* aMedia, + TInt aError) + { + MPX_FUNC("CMPXCollectionClientContext::HandleFindAll"); + CMPXCollectionPlugin* plugin = LoadedPlugin(EContextMedia); + plugin->CompleteTask(); + MPX_ASSERT(plugin->Callback()); + plugin->Callback()->HandleFindAll(aMedia, aError); + plugin->SetCallback(NULL); // Reset current observer + plugin->SetObserver(iEngine); + } + +// ---------------------------------------------------------------------------- +// Handle delete all +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::HandleRemove( + const CDesCArray& aUriArray, + TInt aError) + { + MPX_FUNC("CMPXCollectionClientContext::HandleRemove"); + CMPXCollectionPlugin* plugin = LoadedPlugin(EContextRemove); + + plugin->CompleteTask(); + MPX_ASSERT(plugin->Callback()); + plugin->Callback()->HandleRemove(aUriArray, aError); + plugin->SetCallback(NULL); // Reset current observer + plugin->SetObserver(iEngine); + } + +// ---------------------------------------------------------------------------- +// Execute a async task +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::ExecuteTask( + TInt aTask, + TInt aParamData, + TAny* aPtrData, + const CBufBase& aBuf, + TAny* aCallback, + CBase* aCObject1, + CBase* aCObject2) + { + MPX_DEBUG2("-->CMPXCollectionClientContext::ExecuteTask %d", aTask); + CMPXCollectionPlugin* plugin(NULL); + TRAPD(err, ExecuteTaskL(aTask, aParamData, aPtrData, aCallback, aBuf, + aCObject1,aCObject2,plugin)); + if (KErrNone !=err) + { + HandleError(*plugin, err, EFalse); + } + MPX_DEBUG1("<--CMPXCollectionClientContext::ExecuteTask"); + } + +// ---------------------------------------------------------------------------- +// Indicates that a task was terminated with an error +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::HandleTaskError( + TInt aTask, + TAny* aPtrData, + TAny* aCallback, + TInt aError) + { + MPX_FUNC_EX("CMPXCollectionClientContext::HandleTaskError"); + CMPXCollectionPlugin* plugin(NULL); + switch (aTask) + { + case EMcsOpen: + case EMcsBack: + case EMcsOpenIndex: + plugin = LoadedPlugin(EContextBrowse); + plugin->SetObserver(*this); + plugin->SetCallback( + reinterpret_cast(aCallback)); + HandleError(*plugin, aError, EFalse); + break; + case EMcsOpenPath: + case EMcsMediaByPath: + case EMcsCommandExt: + case EMcsRemovePath: + case EMcsFindAll: + case EMcsCommand: + plugin = reinterpret_cast(aPtrData); + plugin->SetCallback( + reinterpret_cast(aCallback)); + HandleError(*plugin, aError, ETrue); + break; + default: + break; + } + } + +// ---------------------------------------------------------------------------- +// Initialize before first open +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::InitL(MMPXCollectionEngineObserver* aCallback) + { + MPX_DEBUG1("CMPXCollectionClientContext::InitL() <---"); + delete iMedia; + iMedia = NULL; + delete iBrowsePath; + iBrowsePath = NULL; + RArray supportedIds; + CleanupClosePushL(supportedIds); + supportedIds.AppendL(KMPXMediaIdContainer); + supportedIds.AppendL(KMPXMediaIdGeneral); + iMedia=CMPXMedia::NewL(supportedIds.Array()); + iBrowsePath = CMPXCollectionPath::NewL(); + CleanupStack::PopAndDestroy(&supportedIds); + + iEngine.ListPluginsL(*iMedia, iUids.Array()); + if (iPluginUids[EContextBrowse]!=KNullUid ) + { + MPX_DEBUG1("CMPXCollectionClientContext::InitL() Collection changed"); + iClientList->SendMsgL( + TMPXCollectionMessage(TMPXCollectionMessage::ECollectionChanged,0,0)); + } + + // sets the browse plugin to NULL + SetPlugin(EContextBrowse, NULL); + + // Update collection path, and buffer, send path update msg, + // complete request + TRAPD(err, DoHandleOpenL(iMedia, NULL, aCallback, KErrNone, ETrue, ETrue)); + if (err) + { + MPX_DEBUG2("CMPXCollectionClientContext::InitL() Complete Open %i", err); + aCallback->HandleOpen(iMedia, // Not used + iIndex, + ETrue, err); + } + MPX_DEBUG1("CMPXCollectionClientContext::InitL() --->"); + } + +// ---------------------------------------------------------------------------- +// Execute a async task +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::ExecuteTaskL( + TInt aTask, + TInt aParamData, + TAny* aPtrData, + TAny* aCallback, + const CBufBase& aBuf, + CBase* aCObject1, + CBase* aCObject2, + CMPXCollectionPlugin*& aPlugin) + { + MPX_DEBUG4("CMPXCollectionClientContext::ExecuteTaskL 0x%08x, task %d, aParam %d", + this, aTask, aParamData); + switch (aTask) + { + case EMcsOpen: + { + aPlugin = LoadedPlugin(EContextBrowse); + aPlugin->SetObserver(*this); + aPlugin->SetCallback( + reinterpret_cast(aCallback)); + OpenL(); + break; + } + case EMcsOpenPath: + { + // Set plugin first for handling error + TUid oldUid = iPluginUids[EContextBrowse]; + aPlugin = reinterpret_cast(aPtrData); + // Set plugin and task pointer for browse context + SetPlugin(EContextBrowse, aPlugin); + iPathUpdated = EFalse; + aPlugin->SetObserver(*this); + aPlugin->SetCallback( + reinterpret_cast(aCallback)); + CMPXCollectionPath* path = static_cast(aCObject1); + delete iBrowsePath; + iBrowsePath = NULL; + iBrowsePath = CMPXCollectionPath::NewL(*path); + SetPathOpenMode(*iBrowsePath, static_cast(aParamData)); + + // If the browsing plugin is changing, need to broadcast the + // collection changed message + if (iPluginUids[EContextBrowse] != oldUid) + { + // no leave before plugin API OpenL + TRAP_IGNORE(iClientList->SendMsgL( + TMPXCollectionMessage( + TMPXCollectionMessage::ECollectionChanged,0,iPluginUids[EContextBrowse].iUid))); + } + iIndex=0; + iFocusItemId = KMPXInvalidItemId; + DoPluginOpenL(); + break; + } + case EMcsOpenIndex: + { + // Internalize mode + TInt mode = (TInt)aPtrData; + aPlugin = LoadedPlugin(EContextBrowse); + aPlugin->SetObserver(*this); + aPlugin->SetCallback( + reinterpret_cast(aCallback)); + iBrowsePath->Set(aParamData); + SetPathOpenMode(*iBrowsePath,static_cast(mode)); + iIndex=0; + iFocusItemId = KMPXInvalidItemId; + DoPluginOpenL(); + break; + } + case EMcsBack: + { + aPlugin = LoadedPlugin(EContextBrowse); + aPlugin->SetObserver(*this); + aPlugin->SetCallback( + reinterpret_cast(aCallback)); + BackL(); + break; + } + case EMcsMediaByPath: + { + // Setup plugin first for handle error + aPlugin = reinterpret_cast(aPtrData); + SetPlugin(EContextMedia, aPlugin); + + aPlugin->SetObserver(*this); + aPlugin->SetCallback( + static_cast(aCallback)); + // Media path + CMPXCommand* cmd = reinterpret_cast(aCObject1); + MPX_ASSERT(cmd->IsSupported(KMPXCommandGeneralTargetIds)); + MPX_ASSERT(cmd->IsSupported(KMPXCommandMediaAttributeSpecs)); + CMPXCollectionPath* path = reinterpret_cast(aCObject2); + CMPXAttributeSpecs* specs = + cmd->Value(KMPXCommandMediaAttributeSpecs); + User::LeaveIfNull(specs); + CMPXAttributeSpecs* filter = + cmd->Value(KMPXCommandMediaFilter); + User::LeaveIfNull(filter); + TCapabilitySet caps = cmd->ValueTObjectL(KMPXCommandMediaCapbilitySet); + // Ask plugin for media + DoPluginMediaL( *path, caps, *specs, *filter ); + break; + } + case EMcsRemovePath: + { + aPlugin = reinterpret_cast(aPtrData); + // set the remove plugin + SetPlugin(EContextRemove, aPlugin); + + aPlugin->SetObserver(*this); + CMPXCollectionPath* path = + reinterpret_cast(aCObject1); + aPlugin->SetCallback( + reinterpret_cast(aCallback)); + aPlugin->RemoveL( *path ); + break; + } + case EMcsFindAll: + { + aPlugin = reinterpret_cast(aPtrData); + // set the media plugin + SetPlugin(EContextMedia, aPlugin); + + aPlugin->SetCallback( + reinterpret_cast(aCallback)); + CMPXMedia* media = static_cast(aCObject1); + FindAllL(*media, aBuf, *aPlugin); + break; + } + case EMcsCommand: + { + TMPXCollectionCommand cmd = + static_cast( aParamData ); + switch( cmd ) + { + case EMcCmdCollectionInit: + case EMcCmdCollectionResyn: + // Decrement the old plugin reference count + aPlugin = reinterpret_cast(aPtrData); + SetPlugin(EContextMedia, aPlugin); + + if( aPlugin ) + { + aPlugin->SetObserver(*this); + aPlugin->CommandL( cmd ); + aPlugin->SetObserver(iEngine); + aPlugin->CompleteTask(); + } + break; + default: + MPX_ASSERT(0); + break; + } + break; + } + case EMcsCommandExt: + { + CMPXCommand* cmd = reinterpret_cast(aCObject1); + aPlugin = reinterpret_cast(aPtrData); + MMPXCollectionEngineObserver* callback = + reinterpret_cast(aCallback); + if( cmd->IsSupported( KMPXCommandGeneralId) ) + { + TMPXCommandId commandId = cmd->ValueTObjectL(KMPXCommandGeneralId); + // Decrement the old plugin reference count + SetPlugin(EContextMedia, aPlugin); + aPlugin->SetCallback( callback ); + + if( commandId == KMPXCommandIdCollectionSelect ) + { + // Decrement the old plugin reference count + // + DoHandleSelectCommandL( *cmd ); + aPlugin->SetCallback( NULL ); + aPlugin->CompleteTask(); + callback->HandleCommandComplete( NULL, KErrNone ); + } + else + { + aPlugin->SetObserver(*this); + aPlugin->CommandL(*cmd); + } + } + else + { + aPlugin->CompleteTask(); + callback->HandleCommandComplete( NULL, KErrArgument ); // return error message + } + break; + } + default: + break; + } + } + +// ---------------------------------------------------------------------------- +// Error happens upon request +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::HandleError( + CMPXCollectionPlugin& aPlugin, + TInt aError, + TBool aUnusePlugin/*=EFalse*/) + { + TInt task(aPlugin.Task()); + MPX_DEBUG3("CMPXCollectionClientContext::HandleError %d, task %d", + aError, task); + switch (task) + { + case EMcsOpen: + case EMcsOpenPath: + case EMcsBack: + case EMcsOpenIndex: + aPlugin.Callback()->HandleOpen(iMedia, // Not used + iIndex, + ETrue, aError); + aPlugin.CompleteTask(); + aPlugin.SetCallback(NULL); // Reset current observer + aPlugin.SetObserver(iEngine); + break; + case EMcsMediaByPath: + aPlugin.Callback()->HandleMedia(iMedia, aError); + aPlugin.CompleteTask(); + aPlugin.SetCallback(NULL); // Reset current observer + aPlugin.SetObserver(iEngine); + break; + case EMcsCommandExt: + aPlugin.Callback()->HandleCommandComplete(iMedia, aError); + aPlugin.CompleteTask(); + aPlugin.SetCallback(NULL); // Reset current observer + aPlugin.SetObserver(iEngine); + break; + case EMcsRemovePath: + { + CDesCArray* dummy(NULL); // object will not be dereferenced in callback + aPlugin.Callback()->HandleRemove(*dummy, aError); + aPlugin.SetCallback(NULL); // Reset current observer + aPlugin.SetObserver(iEngine); + aPlugin.CompleteTask(); + } + break; + case EMcsFindAll: + aPlugin.Callback()->HandleFindAll(iMedia, aError); + aPlugin.SetCallback(NULL); // Reset current observer + aPlugin.SetObserver(iEngine); + aPlugin.CompleteTask(); + break; + case EMcsCommand: + { + // At least complete the task to not jam up the task queue + aPlugin.SetCallback(NULL); // Reset current observer + aPlugin.SetObserver(iEngine); + aPlugin.CompleteTask(); + break; + } + default: + break; + } + if (aUnusePlugin) + { + iEngine.ReleasePlugin(aPlugin.Uid()); + } + MPX_DEBUG1("<--CMPXCollectionClientContext::HandleError"); + } + +// ---------------------------------------------------------------------------- +// Error happens upon request +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::ResolvePluginL( + const CMPXCollectionPath& aPath, + TUid& aUid) + { + CMPXCollectionPlugin* p= iEngine.LoadedPlugin(aUid); // Save old plugin + // Resolve new plugin + CMPXCollectionPlugin* plugin=iEngine.ResolvePluginL(aPath); + // Update with new Uid + aUid = plugin->Uid(); + if (p != plugin && &aPath == iBrowsePath) + { + // browsing plugin changed + iClientList->SendMsgL(TMPXCollectionMessage( + TMPXCollectionMessage::ECollectionChanged,0,aUid.iUid)); + } + + if (p) + { + // Make sure we decrement the reference count for the old plugin + iEngine.ReleasePlugin(p->Uid()); + } + } + +// ---------------------------------------------------------------------------- +// resolve plugin for FindAllL +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::ResolvePluginL( + const CMPXMedia& aMedia, + CMPXCollectionPlugin*& aPlugin) + { + // We have to be finding from the same context as browse + // if we are from MPX UI + // + if (iPluginUids[EContextBrowse]!=KNullUid) + { + aPlugin = LoadedPlugin(EContextBrowse); + + // Increment the reference count manually + iEngine.UsePlugin(aPlugin->Uid()); + } + else // browse context does not exist + { + if (aMedia.IsSupported(KMPXMediaGeneralCollectionId)) + { + TUid col = aMedia.ValueTObjectL(KMPXMediaGeneralCollectionId); + + // Increment the plugin reference count + aPlugin = iEngine.ResolvePluginL(col); + } + else if (aMedia.IsSupported(KMPXMediaGeneralUri)) + { + const TDesC& uri = aMedia.ValueText(KMPXMediaGeneralUri); + + // Increment the plugin reference count + aPlugin = iEngine.ResolvePluginL(uri); + } + else + { + // Unable to find a collection plugin + User::Leave(KErrNotSupported); + } + } + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionClientContext::SetPlugin +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::SetPlugin( + TContextType aType, + CMPXCollectionPlugin* aPlugin) + { + if (iPluginUids[aType]!=KNullUid) + { + iEngine.ReleasePlugin(iPluginUids[aType]); + } + if (aPlugin) + { + iPluginUids[aType] = aPlugin->Uid(); + } + else + { + iPluginUids[aType] = KNullUid; + } + } + +// ---------------------------------------------------------------------------- +// Add a media object to the collection +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::DoUpdateMediaL( TInt aOp, const CMPXMedia& aMedia ) + { + // Media object can be a single "item" or a list of "items" + // + TMPXGeneralType type = EMPXNoType; + if (aMedia.IsSupported(KMPXMediaGeneralType)) + { + type = aMedia.ValueTObjectL(KMPXMediaGeneralType); + } + else + { + User::Leave(KErrArgument); + } + + if ( type == EMPXGroup ) + { + // Group has to have a "container" + MPX_ASSERT(aMedia.IsSupported(KMPXMediaArrayContents)); + const CMPXMediaArray* array = + aMedia.Value(KMPXMediaArrayContents); + User::LeaveIfNull(const_cast(array)); + TInt count = array->Count(); + for( TInt i=0; iAtL(i)) ); + } + } + else if ( type == EMPXItem ) + { + DoHandleItemL( aOp, aMedia ); + } + else + { + // How do we handle "group" artists? + User::Leave( KErrNotSupported ); + } + } + +// ---------------------------------------------------------------------------- +// Add the media object to the correct plugin +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::DoHandleItemL( TInt aOp, const CMPXMedia& aMedia) + { + MPX_DEBUG1("CMPXCollectionClientContext::DoHandleItemL <---"); + + // Find the correct plugin. + // The code below increments the plugin reference count + CMPXCollectionPlugin* plugin(NULL); + if (aMedia.IsSupported(KMPXMediaGeneralCollectionId)) + { + const TUid& uid = aMedia.ValueTObjectL(KMPXMediaGeneralCollectionId); + MPX_DEBUG2("CMPXCollectionClientContext::DoHandleItemL Collection %i", uid.iUid); + + // Increment the plugin reference count + plugin = iEngine.ResolvePluginL( uid ); + } + else if (aMedia.IsSupported(KMPXMediaGeneralUri)) + { + const TDesC& uri = aMedia.ValueText(KMPXMediaGeneralUri); + MPX_DEBUG2("CMPXCollectionClientContext::DoHandleItemL Collection %S", &uri); + + // Increment the plugin reference count + plugin = iEngine.ResolvePluginL( uri ); + } + else + { + MPX_DEBUG1("CMPXCollectionClientContext::DoHandleItemL Cannot resolve a plugin"); + User::Leave(KErrNotSupported); + } + + if( !plugin ) + { + MPX_DEBUG1("CMPXCollectionClientContext::DoHandleItemL Cannot resolve a plugin"); + User::Leave(KErrNotSupported); + } + + iEngine.CleanupPluginPushL(plugin); + + switch( aOp ) + { + case EMcsAddItem: + { + MPX_DEBUG1("CMPXCollectionClientContext::DoHandleItemL Add"); + + plugin->SetObserver(*this); + plugin->AddL( aMedia ); + plugin->SetObserver(iEngine); + break; + } + case EMcsRemoveItem: + { + MPX_DEBUG1("CMPXCollectionClientContext::DoHandleItemL Remove"); + plugin->SetObserver(*this); + plugin->RemoveL( aMedia ); + plugin->SetObserver(iEngine); + break; + } + case EMcsSetMedia: + { + MPX_DEBUG1("CMPXCollectionClientContext::DoHandleItemL Set"); + plugin->SetObserver(*this); + plugin->SetL( aMedia ); + plugin->SetObserver(iEngine); + break; + } + default: + { + User::Leave(KErrNotSupported); + break; + } + } // switch + + CleanupStack::PopAndDestroy(); // plugin + + MPX_DEBUG1("CMPXCollectionClientContext::DoHandleItemL --->"); + } + +// ---------------------------------------------------------------------------- +// Handle a synchorouns command to the collection +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::DoHandleSyncCommandL( + const CMPXCommand& aCmd, + const CMPXMessageQueue& aMsgQueue, + CMPXCollectionPlugin* aPlugin/*=NULL*/) + { + // Only process the command if the command id has been defined, + // otherwise leave with KErrArgument + if (aCmd.IsSupported(KMPXCommandGeneralId)) + { + TMPXCommandId commandId = aCmd.ValueTObjectL(KMPXCommandGeneralId); + switch( commandId ) + { + case KMPXCommandIdCollectionSelect: + { + DoHandleSelectCommandL( aCmd ); + break; + } + + case KMPXCommandSubscriptionAdd: + { + TInt index( iClientList->Find( aMsgQueue )); + CMPXMediaArray* items( + aCmd.Value( KMPXCommandSubscriptionAddItems )); + User::LeaveIfNull(items); + CMPXSubscription* subscription( CMPXSubscription::NewL( *items )); + CleanupStack::PushL(subscription); + iClientList->AddSubscriptionL( index, subscription ); // ownership transferred + CleanupStack::Pop(subscription); + break; + } + case KMPXCommandSubscriptionRemove: + { + TInt index( iClientList->Find( aMsgQueue )); + CMPXMediaArray* items( + aCmd.Value( KMPXCommandSubscriptionAddItems )); + User::LeaveIfNull(items); + CMPXSubscription* subscription( CMPXSubscription::NewL( *items )); + CleanupStack::PushL(subscription); + iClientList->RemoveSubscriptionL( index, *subscription ); + CleanupStack::PopAndDestroy(subscription); + break; + } + case KMPXCommandSubscriptionRemoveAll: + { + TInt index( iClientList->Find( aMsgQueue )); + iClientList->RemoveAllSubscriptionsL( index ); + break; + } + + case KMPXCommandIdCollectionPrepareDelete: + { + if (aCmd.IsSupported (KMPXCommandCollectionPrepareRemovePath)) + { + CMPXCollectionPath + * path = aCmd.ValueCObjectL (KMPXCommandCollectionPrepareRemovePath); + CleanupStack::PushL(path); + iEngine.ResetCacheL(*path); + CleanupStack::PopAndDestroy(path); + } + break; + } + + default: + { + MPX_ASSERT(aPlugin); + aPlugin->SetObserver(*this); + TRAPD( err, aPlugin->CommandL( const_cast(aCmd) ) ); + aPlugin->SetObserver(iEngine); + User::LeaveIfError( err ); + break; + } + } + } + else + { + User::Leave(KErrArgument); + } + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionClientContext::DoHandleSelectCommandL +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::DoHandleSelectCommandL(const CMPXCommand& aCmd) + { + TInt index(iIndex); + + // Selecting a new index + if( aCmd.IsSupported(KMPXCommandCollectionSelectIndex) ) + { + index = aCmd.ValueTObjectL(KMPXCommandCollectionSelectIndex); + if (iBrowsePath->Levels()<=0) + { + User::Leave(KErrNotReady); + } + if (index<0 || index>=iBrowsePath->Count()) + { + User::Leave(KErrArgument); + } + iBrowsePath->Set(index); + } + // Re-select the current index + else + { + TInt count = iBrowsePath->Count(); + + if( iFocusItemId != KMPXInvalidItemId ) + { + TInt index = iBrowsePath->IndexOfId(iFocusItemId); + if (KErrNotFound != index) + { + iBrowsePath->Set(index); + } + else if( count > 0 ) // Focus item has been deleted, select next + { + // Bounds check for largest and smallest + if( iIndex >= count ) + { + iIndex = count-1; + } + if( iIndex < 0 ) + { + iIndex = 0; + } + iBrowsePath->Set(iIndex); + iFocusItemId = iBrowsePath->Id(); + } + iIndex = iBrowsePath->Index(); + } + else + { + // Bounds checking for iIndex + if( iIndex >= count && iIndex > 0 ) + { + iIndex = count-1; + + // Just in case if ids has 0 items + if( iIndex > 0 && iIndex < count ) + { + iFocusItemId = iBrowsePath->IdOfIndex(iIndex); + } + } + + if (iBrowsePath->Levels()>0 && iIndex>=0 && + iIndexCount()) + { + iBrowsePath->Set(iIndex); + } + iFocusItemId = iBrowsePath->Id(); + } + } + iClientList->SendMsgL( + TMPXCollectionMessage(TMPXCollectionMessage::EFocusChanged, + index, index)); + iIndex = index; // iIndex will always be up to date + iFocusItemId = iBrowsePath->Id(); + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionClientContext::DoPluginOpenL +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::DoPluginOpenL() + { + MPX_FUNC("CMPXCollectionClientContext::DoPluginOpenL()"); + TBool callOpen(ETrue); + MPX_ASSERT(iPluginUids[EContextBrowse]!=KNullUid); + TBool pluginCacheable(EFalse); + if( iBrowsePath ) + { + TMPXItemId id(iBrowsePath->Id(CMPXCollectionPath::ECollectionUid) ); + pluginCacheable = iEngine.PluginCacheable( TUid::Uid( id ) ); + } + + // Check for open playlist only mode. If in that mode, do not return the media + // from the cache but call the plugin to open, as that will callback a + // different HandleOpenL() with the collection path instead. + TMPXOpenMode mode( iBrowsePath->OpenNextMode() ); + CMPXCollectionPlugin* plugin = LoadedPlugin(EContextBrowse); + if ( !iFilter && mode != EMPXOpenPlaylistOnly ) + { + // try to get the results from the cache only if the plugin is cacheable + if ( pluginCacheable ) + { + CMPXMedia* results( iCache.GetL( *iBrowsePath, + iBrowsePath->OpenAttributes(), + ETrue )); + if (results) + { + MPX_DEBUG1("CMPXCollectionClientContext::DoPluginOpenL(): Results found in cache"); + MMPXCollectionEngineObserver* callback = plugin->Callback(); + plugin->CompleteTask(); + TRAPD(err, DoHandleOpenL(results, NULL, callback, KErrNone, EFalse, ETrue)); + if (err) + { + HandleError(*plugin, err); + } + + callOpen = EFalse; + } + } + } + + if (callOpen) + { + if ( pluginCacheable ) + { + iCacheMedia = AttributesCacheableL( iBrowsePath->OpenAttributes(), *iBrowsePath ); + } + plugin->OpenL(*iBrowsePath, iBrowsePath->OpenAttributes(), iFilter); + } + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionClientContext::DoPluginMediaL +// ---------------------------------------------------------------------------- +// +void CMPXCollectionClientContext::DoPluginMediaL( + CMPXCollectionPath& aPath, + const TCapabilitySet& aCaps, + CMPXAttributeSpecs& aSpecs, + CMPXFilter& aFilter) + { + MPX_FUNC("CMPXCollectionClientContext::DoPluginMediaL()"); + TBool callMedia(ETrue); + delete iMediaPath; + iMediaPath = NULL; + + TMPXItemId id(aPath.Id(CMPXCollectionPath::ECollectionUid) ); + TBool pluginCacheable( iEngine.PluginCacheable( TUid::Uid( id ) )); + + // try to get the results from the cache only if + // the plugin is cacheable + CMPXMedia* results( NULL ); + if ( pluginCacheable ) + { + results = iCache.GetL( aPath, aPath.OpenAttributes() ); + + if (results) + { + // Check if the attribute specs match + if ( aSpecs.Count() > 0 ) + { + /* + // need to check if requested attribute specs + // match what we have cached + if ( results->IsSupported( KMPXCommandMediaAttributeSpecs )) + { + CMPXAttributeSpecs* specs( results->Value( + KMPXCommandMediaAttributeSpecs )); + User::LeaveIfNull(specs); + if ( *specs == *aSpecs ) + { + callMedia = EFalse; + } + } + */ + } + else + { + // Else client did not specify attribute specs, so we can return + // the match + callMedia = EFalse; + } + } + } + + if ( callMedia ) + { + iMediaPath = CMPXCollectionPath::NewL( aPath ); + + if ( pluginCacheable ) + { + iCacheMedia = AttributesCacheableL( aPath.OpenAttributes(), aPath ); + } + LoadedPlugin(EContextMedia)->MediaL( aPath, + aPath.OpenAttributes(), + aCaps, + &aSpecs, + &aFilter); + } + else + { + HandleMedia( results, KErrNone ); + } + } + + +// ---------------------------------------------------------------------------- +// CMPXCollectionClientContext::AttributesCacheableL +// ---------------------------------------------------------------------------- +// +TBool CMPXCollectionClientContext::AttributesCacheableL( + const TArray& aAttrs, + const CMPXCollectionPath& aPath ) + { + MPX_DEBUG1("-->CMPXCollectionClientContext::AttributesCacheableL"); + + TMPXItemId id( aPath.Id( CMPXCollectionPath::ECollectionUid )); + const TArray& nonCacheAttrs( iEngine.PluginNonCacheableAttributesL( TUid::Uid( id ))); + + TBool found( EFalse ); + TInt nonCacheCount( nonCacheAttrs.Count() ); + for ( TInt i = 0; i < nonCacheCount && !found; i++ ) + { + TInt attrCount( aAttrs.Count() ); + for ( TInt j = 0; j < attrCount && !found; j++ ) + { + TMPXAttribute att( aAttrs[j] ); + if ( nonCacheAttrs[i] == TUid::Uid( att.ContentId() )) + { + found = ETrue; + } + } + } + MPX_DEBUG1("<--CMPXCollectionClientContext::AttributesCacheableL"); + return !found; + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionClientContext::AddToCache +// ---------------------------------------------------------------------------- +// +CMPXMedia* CMPXCollectionClientContext::AddToCache( + const CMPXCollectionPath& aPath, + const TArray& aAttrs, + CMPXMedia& aResults, + TBool aMediaFromOpenL, + CMPXCollectionCache::TCachePriority aPriority /* = EPriorityNormal */) + { + CMPXMedia* ret( &aResults ); + TRAP_IGNORE(ret = iCache.AddL(aPath, aAttrs, aResults, aMediaFromOpenL, aPriority)); + return ret; + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionClientContext::LoadedPlugin +// ---------------------------------------------------------------------------- +// +CMPXCollectionPlugin* CMPXCollectionClientContext::LoadedPlugin(TContextType aType) + { + MPX_ASSERT(iPluginUids[aType]!=KNullUid); + CMPXCollectionPlugin* plugin(iEngine.LoadedPlugin(iPluginUids[aType])); + MPX_ASSERT(plugin); + return plugin; + } + +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionengine/src/mpxcollectionengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionengine/src/mpxcollectionengine.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,906 @@ +/* +* Copyright (c) 2006 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: Manages collection information for the clients +* +*/ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mpxcollectionpluginhandler.h" +#include "mpxcollectioncache.h" +#include "mpxcollectionengine.h" + +// CONSTANTS +const TInt KMPXMaxCacheSizeRatio = 70; +// ============================ LOCAL FUNCTIONS ============================== + +/** +* Container class for the plugin reference counting mechanism. +* Instances of this class are pushed onto the engine internal stack. +*/ +class TReleaseInfo + { + public: + TReleaseInfo(CMPXCollectionPluginHandler* aHandler, + CMPXCollectionPlugin* aPlugin); + + public: + // Not owned + CMPXCollectionPluginHandler* iHandler; + CMPXCollectionPlugin* iPlugin; + }; + +// ---------------------------------------------------------------------------- +// Constructor. +// ---------------------------------------------------------------------------- +// +TReleaseInfo::TReleaseInfo( + CMPXCollectionPluginHandler* aHandler, + CMPXCollectionPlugin* aPlugin) : + iHandler(aHandler), + iPlugin(aPlugin) + { + } + +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXCollectionEngine* CMPXCollectionEngine::NewL() + { + CMPXCollectionEngine* p=new(ELeave)CMPXCollectionEngine(); + CleanupStack::PushL(p); + p->ConstructL(); + CleanupStack::Pop(p); + return p; + } + +// ---------------------------------------------------------------------------- +// Constructor. +// ---------------------------------------------------------------------------- +// +CMPXCollectionEngine::CMPXCollectionEngine() + { + } + +// ---------------------------------------------------------------------------- +// 2nd phase constructor. +// ---------------------------------------------------------------------------- +// +void CMPXCollectionEngine::ConstructL() + { + iPluginHandler=CMPXCollectionPluginHandler::NewL(*this, *this); + iCache = CMPXCollectionCache::NewL(KMPXMaxCacheSizeRatio); + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXCollectionEngine::~CMPXCollectionEngine() + { + iCleanupStack.Close(); + + iContexts.ResetAndDestroy(); + iContexts.Close(); + delete iPluginHandler; + delete iCache; + } + +// ---------------------------------------------------------------------------- +// Session Initialiser +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXCollectionClientContext& CMPXCollectionEngine::SessionInitL( + const TUid& aModeId, + TThreadId aClientId, + CMPXMessageQueue* aMsgQueue) + { + CMPXCollectionClientContext* context(NULL); + + if (aModeId == KMcModeDefault) + { + // Connects the client to the collection path in its thread, or + // creates one if it doesn't exist + context = FindDefaultContext(aClientId); + if (context) + { + MPX_DEBUG1("CMPXCollectionEngine add client into the default context"); + } + else + { + // Creates a isolated collection path. + context = CreateNewContextL(KMcModeIsolated); + MPX_DEBUG1("CMPXCollectionEngine add client into the isolated context"); + } + } + else if (aModeId == KMcModeIsolated || aModeId == KMcModePlaylist) + { + // Creates a isolated collection path. + context = CreateNewContextL(aModeId); + MPX_DEBUG1("CMPXCollectionEngine add client into the isolated/playlist context"); + } + else + // Connects to the collection context of an application, or creates + // it if it doesn't exist + { + for (TInt i=0;iModeId() == aModeId) + { + context = iContexts[i]; + break; + } + } + + if (!context) + { + // Create the application context + context = CreateNewContextL(aModeId); + } + + MPX_DEBUG1("CMPXCollectionEngine add client into the application context"); + } + context->AddClientL(aClientId, aMsgQueue); + MPX_DEBUG3("CMPXCollectionEngine::SessionInitL return context 0x%08x with mode 0x%08x", + context, context->ModeId().iUid); + return *context; + } + +// ---------------------------------------------------------------------------- +// Notifies all contexts of an event +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionEngine::NotifyL( TMPXCollectionBroadCastMsg aMsg, + TInt aData ) + { + MPX_FUNC("CMPXCollectionEngine::NotifyL"); + + TInt command = KErrNotSupported; + TInt data = 0; + TBool clearCache ( EFalse ); + switch( aMsg ) + { + case EMcMsgFormatStart: + case EMcMsgDiskRemoved: + case EMcMsgUSBMassStorageStart: + { + command = EMcCloseCollection; + data = aData; + + // Clear the cache + clearCache = ETrue; + break; + } + case EMcMsgFormatEnd: + case EMcMsgDiskInserted: + case EMcMsgUSBMassStorageEnd: + { + command = EMcReOpenCollection; + data = aData; + + // Clear the cache + clearCache = ETrue; + break; + } + case EMcMsgUSBMTPStart: + { + iRefreshing = ETrue; + command = EMcCmdMtpStart; + break; + } + case EMcMsgUSBMTPEnd: + { + iRefreshing = EFalse; + command = EMcCmdMtpEnd; + // Clear the cache + clearCache = ETrue; + break; + } + case EMcMsgRefreshStart: + { + iRefreshing = ETrue; + command = EMcRefreshStarted; + break; + } + case EMcMsgRefreshEnd: + { + iRefreshing = EFalse; + command = EMcRefreshEnded; + + // Clear the cache + clearCache = ETrue; + break; + } + + default: + break; + } + if( command != KErrNotSupported ) + { + TArray plugins = iPluginHandler->LoadedPlugins(); + for( TInt i=0; iCommandL( (TMPXCollectionCommand)command, data)); + } + } + + if( clearCache ) + { + RFs rfs; + User::LeaveIfError( rfs.Connect() ); + DriveInfo::TDriveArray driveArray; + User::LeaveIfError ( DriveInfo::GetUserVisibleDrives( rfs, driveArray ) ); + TInt count( driveArray.Count () ); + TBool diskFull( EFalse ); + for ( TInt i = 0; i < count; ++i ) + { + TRAP_IGNORE( diskFull = SysUtil::DiskSpaceBelowCriticalLevelL( &rfs, 0, + driveArray[i] ) ); + if ( diskFull ) + { + MPX_DEBUG2("CMPXCollectionEngine::NotifyL: Disk full, driveArray[i] = %d ", driveArray[i] ); + break; + } + } + if( !diskFull ) + { + iCache->Reset(); + } + rfs.Close(); + } + + TInt count = iContexts.Count(); + for( TInt i=0; iNotifyL( aMsg, aData ); + } + } + +// ---------------------------------------------------------------------------- +// Retrieves all of the supported types in the collection +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionEngine::GetSupportedTypesL( + RPointerArray& aArray ) + { + RArray uids; + CleanupClosePushL(uids); + iPluginHandler->GetPluginUids(uids); + + for (TInt i=0; iSupportedMimeTypesL(uid); + CleanupStack::PushL(mimetypes); + CDesCArray* extensions = + iPluginHandler->SupportedExtensionsL(uid); + CleanupStack::PushL(extensions); + CMPXCollectionType* type = new(ELeave)CMPXCollectionType( + uid, + mimetypes, + extensions); + CleanupStack::Pop(extensions); + CleanupStack::Pop(mimetypes); + CleanupStack::PushL(type); + aArray.AppendL( type ); + CleanupStack::Pop(type); + } + CleanupStack::PopAndDestroy(&uids); + } + +// ---------------------------------------------------------------------------- +// Virtual collection ID to implementation ID lookup +// ---------------------------------------------------------------------------- +// +EXPORT_C TUid CMPXCollectionEngine::LookupCollectionPluginID( const TUid aUid ) + { + // Lookup virtual ID and map it to an implementation ID + TUid realId = TUid::Uid(0); + if( aUid == KLocalCollection ) + { + realId = TUid::Uid(0x101FFC3A); + } + else if( aUid == KPodcastCollection ) + { + realId = TUid::Uid(0x101FFC3C); + } + else if( aUid == KInMemoryCollection ) + { + realId = TUid::Uid(0x101FFCD8); + } + else + { + realId=TUid::Null(); + } + + return realId; + } + +// ---------------------------------------------------------------------------- +// Resolve a collection plugin UID +// ---------------------------------------------------------------------------- +// +EXPORT_C TUid CMPXCollectionEngine::ResolvePluginUid(const TArray& aAry) + { + // Resolve the plugin ID using the plugin handler + // + return iPluginHandler->FindPlugin( aAry ); + } + +// ---------------------------------------------------------------------------- +// Gets a list of the plugins available by name. +// ---------------------------------------------------------------------------- +// +void CMPXCollectionEngine::ListPluginsL( + CMPXMedia& aEntries, + const TArray& aSupportedUids) + { + MPX_FUNC("CMPXCollectionEngine::ListPluginsL"); + +#ifdef _DEBUG + for (TInt ii=0; ii < aSupportedUids.Count(); ++ii) + { + MPX_DEBUG2("Supported uid 0x%08x", aSupportedUids[ii]); + } +#endif + RArray supportedIds; + CleanupClosePushL(supportedIds); + supportedIds.AppendL(KMPXMediaIdGeneral); + + CMPXMediaArray* array=CMPXMediaArray::NewL(); + CleanupStack::PushL(array); + + RArray pluginList; + CleanupClosePushL(pluginList); + iPluginHandler->GetPluginUids(pluginList); + RArray pluginTypes; + CleanupClosePushL(pluginTypes); + iPluginHandler->GetPluginTypes(pluginTypes); + TInt count=pluginList.Count(); + MPX_ASSERT(pluginTypes.Count() >= count); + TInt arrayCount(0); + for(TInt i = 0;i < count ;i++) + { + // Show only visible plugins + // + if(pluginTypes[i] != EMPXCollectionPluginHidden && + iPluginHandler->SupportUids(pluginList[i], aSupportedUids)) + { + CMPXMedia* entry=CMPXMedia::NewL(supportedIds.Array()); + CleanupStack::PushL(entry); + entry->SetTextValueL(KMPXMediaGeneralTitle, + iPluginHandler->PluginName(pluginList[i])); + entry->SetTObjectValueL(KMPXMediaGeneralType, EMPXGroup); + entry->SetTObjectValueL(KMPXMediaGeneralCategory, + EMPXCollection); + entry->SetTObjectValueL(KMPXMediaGeneralId, + TMPXItemId(pluginList[i].iUid)); + array->AppendL(entry); + CleanupStack::Pop(entry); + ++arrayCount; + } + } + aEntries.SetCObjectValueL(KMPXMediaArrayContents,array); + aEntries.SetTObjectValueL(KMPXMediaArrayCount,arrayCount); + CleanupStack::PopAndDestroy(&pluginTypes); + CleanupStack::PopAndDestroy(&pluginList); + CleanupStack::PopAndDestroy(array); + CleanupStack::PopAndDestroy(&supportedIds); + } + +// ---------------------------------------------------------------------------- +// Find a plugin from collection path +// ---------------------------------------------------------------------------- +// +CMPXCollectionPlugin* CMPXCollectionEngine::ResolvePluginL( + const CMPXCollectionPath& aPath) + { + return ResolvePluginL(TUid::Uid(aPath.Id(CMPXCollectionPath::ECollectionUid))); + } + +// ---------------------------------------------------------------------------- +// Find a plugin from collection uid +// ---------------------------------------------------------------------------- +// +CMPXCollectionPlugin* CMPXCollectionEngine::ResolvePluginL( + const TUid& aUid) + { + iPluginHandler->SelectPluginL(aUid); + return iPluginHandler->Plugin(); + } + +// ---------------------------------------------------------------------------- +// Find a plugin from uri +// ---------------------------------------------------------------------------- +// +CMPXCollectionPlugin* CMPXCollectionEngine::ResolvePluginL( + const TDesC& aUri) + { + iPluginHandler->ClearSelectionCriteria(); + iPluginHandler->SelectPluginL(aUri, KNullDesC8); + return iPluginHandler->Plugin(); + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionEngine::UsePlugin +// ---------------------------------------------------------------------------- +// +void CMPXCollectionEngine::UsePlugin( + const TUid& aPluginUid) + { + iPluginHandler->UsePlugin(aPluginUid); + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionEngine::ReleasePlugin +// ---------------------------------------------------------------------------- +// +TBool CMPXCollectionEngine::ReleasePlugin( + const TUid& aPluginUid ) + { + MPX_FUNC("CMPXCollectionEngine::ReleasePlugin"); + TBool unloaded(iPluginHandler->ReleasePlugin(aPluginUid)); + if (unloaded) + { + HandlePluginUnloaded(aPluginUid); + } + return unloaded; + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionEngine::CleanupPluginPushL +// +// Pushes the plugin release information onto the cleanup stack. Both the plugin +// handler and the plugin itself have to be pushed and therefore cannot use the +// cleanup stack alone. Even if it would create a dynamic TReleaseInfo instance +// and push that onto the cleanup stack, CleanupStack::Pop would not take care +// of deleting it and therefore a separate stack has to be used for the release +// info. +// ---------------------------------------------------------------------------- +// +void CMPXCollectionEngine::CleanupPluginPushL( + CMPXCollectionPlugin* aPlugin) + { + MPX_FUNC("CMPXCollectionEngine::CleanupPluginPushL"); + + // add the release information to the internal stack + iCleanupStack.AppendL(TReleaseInfo(iPluginHandler, aPlugin)); + + // push a pointer to the engine onto the cleanup stack + CleanupStack::PushL(TCleanupItem(ReleasePlugin, this)); + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionEngine::PluginPop +// +// Has to be called instead of CleanupStack::Pop for cleaning up correctly +// ---------------------------------------------------------------------------- +// +void CMPXCollectionEngine::PluginPop() + { + MPX_FUNC("CMPXCollectionEngine::PluginPop"); + + // remove from the cleanup stack + CleanupStack::Pop(this); + + // remove from the internal stack + iCleanupStack.Remove(iCleanupStack.Count() - 1); + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionEngine::HandlePluginHandlerEvent +// ---------------------------------------------------------------------------- +// +void CMPXCollectionEngine::HandlePluginHandlerEvent( + TPluginHandlerEvents aEvent, + const TUid& aPluginUid, + TBool aLoaded, + TInt aData) + { + MPX_FUNC("CMPXCollectionEngine::HandlePluginHandlerEvent"); + + switch (aEvent) + { + case MMPXPluginHandlerObserver::EPluginAdd: + { + TRAP_IGNORE(SendPluginHandlerMessageL(KMPXMessagePluginAdd, aPluginUid, + aLoaded, aData)); + break; + } + case MMPXPluginHandlerObserver::EPluginUpdateStart: + { + // Handling the unloading of the previous plugin version and the loading + // of the new plugin version is synchronous and therefore new requests + // will not be processed by the server/engine in between EPluginUpdateStart + // and EPluginUpdateEnd. + // + // If the plugin handler would unload/load plugins asynchronously then a + // mechanism must be created where the engine does not accept requests for + // the plugin that is being updated for the duration of the update. + + // Send update start message + TRAP_IGNORE(SendPluginHandlerMessageL(KMPXMessagePluginUpdateStart, aPluginUid, + aLoaded, aData)); + + // Cancel all outstanding requests for the plugin + CMPXCollectionPlugin* plugin = iPluginHandler->LoadedPlugin(aPluginUid); + if (plugin) + { + plugin->CompleteAllTasks(KErrNotReady); + } + break; + } + case MMPXPluginHandlerObserver::EPluginUpdateEnd: + { + TRAP_IGNORE(SendPluginHandlerMessageL(KMPXMessagePluginUpdateEnd, aPluginUid, + aLoaded, aData)); + break; + } + case MMPXPluginHandlerObserver::EPluginRemove: + { + TRAP_IGNORE(SendPluginHandlerMessageL(KMPXMessagePluginRemove, aPluginUid, + aLoaded)); + + // Cancel all outstanding requests for the plugin + CMPXCollectionPlugin* plugin = iPluginHandler->LoadedPlugin(aPluginUid); + if (plugin) + { + plugin->CompleteAllTasks(KErrNotReady); + } + break; + } + default: + { + // ignore the event + break; + } + } + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionPluginHandler::LoadedPlugin +// ---------------------------------------------------------------------------- +// +CMPXCollectionPlugin* CMPXCollectionEngine::LoadedPlugin(const TUid& aUid) + { + return iPluginHandler->LoadedPlugin(aUid); + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionEngine::ReleasePlugin +// +// Executed when the cleanup stack item is destroyed as a result of +// CleanupStack::PopAndDestroy being called. This could either be called +// manually or as a result of a leave being generated and trapped. When this +// method is called the cleanup stack item is already removed from the cleanup +// stack and therefore it only has to take care of removing the local item. +// +// This is a static method. +// ---------------------------------------------------------------------------- +// +void CMPXCollectionEngine::ReleasePlugin( + TAny* aEngine) + { + MPX_FUNC("CMPXCollectionEngine::ReleasePlugin"); + + // get the engine instance + CMPXCollectionEngine* engine = static_cast(aEngine); + + // last pushed release info + TReleaseInfo& relInfo = engine->iCleanupStack[engine->iCleanupStack.Count() - 1]; + + if (relInfo.iPlugin) + { + // release the plugin + TUid uid(relInfo.iPlugin->Uid()); + TBool unloaded(relInfo.iHandler->ReleasePlugin(uid)); + if (unloaded) + { + engine->HandlePluginUnloaded(uid); + } + } + + // remove the item from the local stack + engine->iCleanupStack.Remove(engine->iCleanupStack.Count() - 1); + } + +// ---------------------------------------------------------------------------- +// Find the cachable attribute of a plugin +// ---------------------------------------------------------------------------- +// +TBool CMPXCollectionEngine::PluginCacheable( const TUid& aUid ) + { + return iPluginHandler->PluginCachable( aUid ); + } + +// ---------------------------------------------------------------------------- +// Find the non-cacaheable attributes of a plugin +// ---------------------------------------------------------------------------- +// +const TArray CMPXCollectionEngine::PluginNonCacheableAttributesL( const TUid& aUid ) + { + return iPluginHandler->NonCacheableAttributesL( aUid ); + } + + +// ---------------------------------------------------------------------------- +// Create a new client context object +// ---------------------------------------------------------------------------- +// +CMPXCollectionClientContext* CMPXCollectionEngine::CreateNewContextL( + const TUid& aModeId) + { + CMPXCollectionClientContext* context = + CMPXCollectionClientContext::NewL(*this, *iCache, aModeId); + CleanupStack::PushL(context); + iContexts.AppendL(context); + CleanupStack::Pop(context); + return context; + } + +// ---------------------------------------------------------------------------- +// Find a shareable client context object created in the same thread +// ---------------------------------------------------------------------------- +// +CMPXCollectionClientContext* CMPXCollectionEngine::FindDefaultContext( + TThreadId aClientTid) + { + CMPXCollectionClientContext* context(NULL); + + for (TInt i=0;iHasShareableClient(aClientTid)) + { + context = iContexts[i]; + break; + } + } + return context; + } + +// ---------------------------------------------------------------------------- +// Handle a change message +// ---------------------------------------------------------------------------- +// +void CMPXCollectionEngine::DoNotifyChangeL( const CMPXMessage& aMessage ) + { + TInt msgGeneralId(0); + if( aMessage.IsSupported(KMPXMessageGeneralId) ) + { + msgGeneralId = aMessage.ValueTObjectL(KMPXMessageGeneralId); + } + + // Only handle change messages to invalidate the collection cache + // + if( msgGeneralId == KMPXMessageIdItemChanged) + { + MPX_DEBUG1("CMPXCollectionEngine::DoNotifyChangeL -- KMPXMessageIdItemChanged"); + + // Multiple messages + // + if( aMessage.IsSupported(KMPXMessageArrayContents) ) + { + const CMPXMessageArray* messageArray = + aMessage.Value(KMPXMessageArrayContents); + User::LeaveIfNull(const_cast(messageArray)); + TInt count(messageArray->Count()); + for(TInt i=0; iAtL(i))); + if( invalidated ) + { + // Cache got cleared, no need to process other messages + break; + } + } + } + // Single message + // + else + { + DoNotifySingleChangeL(aMessage); + } + } + } + +// ---------------------------------------------------------------------------- +// Handle a single change message +// ---------------------------------------------------------------------------- +// +TBool CMPXCollectionEngine::DoNotifySingleChangeL( const CMPXMessage& aMessage ) + { + TBool invalidated(EFalse); + + // Get the change message data + // + if( aMessage.IsSupported(KMPXMessageCollectionId) ) + { + TUid collectionId( aMessage.ValueTObjectL(KMPXMessageCollectionId) ); + + if( PluginCacheable( collectionId ) ) + { + TMPXChangeEventType changeType = + aMessage.ValueTObjectL(KMPXMessageChangeEventType); + + // If item was inserted, we wipe out everything from that collection + // + if( changeType == EMPXItemInserted ) + { + // Remove all cached nodes from a plugin + // + iCache->HandleChangeL( collectionId, TMPXItemId(collectionId.iUid) ); + invalidated = ETrue; + } + else if ( aMessage.IsSupported( KMPXMessageMediaDeprecatedId ) ) + { + iCache->HandleChangeL( collectionId, + aMessage.ValueTObjectL(KMPXMessageMediaDeprecatedId) ); + } + else if ( aMessage.IsSupported( KMPXMessageMediaGeneralId ) ) + { + iCache->HandleChangeL( collectionId, + aMessage.ValueTObjectL(KMPXMessageMediaGeneralId) ); + } + } + } + + return invalidated; + } + +// ---------------------------------------------------------------------------- +// Retrieves all of the supported types in the collection +// ---------------------------------------------------------------------------- +// +void CMPXCollectionEngine::RemoveContext( + const CMPXCollectionClientContext& aContext) + { + MPX_DEBUG2("CMPXCollectionEngine::RemoveContext %08x", &aContext); + TRAP_IGNORE(::DeleteL(&aContext, iContexts)); + } + +// ---------------------------------------------------------------------------- +// Notify collection changes +// ---------------------------------------------------------------------------- +// +void CMPXCollectionEngine::NotifyChange( + const CMPXCollectionClientContext& aNotifier, + CMPXMessage* aMessage, + TInt aError) + { + MPX_FUNC("CMPXCollectionEngine::NotifyChange"); + for (TInt i=0; iDoHandleMessage(aMessage, aError, EFalse); + } + } + + if( aMessage && !iRefreshing ) + { + TRAP_IGNORE( DoNotifyChangeL( *aMessage ) ); + } + } + +// ---------------------------------------------------------------------------- +// Remove tasks of a client which is the observer of tasks +// ---------------------------------------------------------------------------- +// +void CMPXCollectionEngine::RemoveTask(TAny* aCallback) + { + iPluginHandler->RemoveTask(aCallback); + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionEngine::HandlePluginUnloaded +// Called when a plugin is unloaded. Could be used to cleanup other references +// to the plugin, like the generic cache. +// ---------------------------------------------------------------------------- +// +void CMPXCollectionEngine::HandlePluginUnloaded( + const TUid& aUid ) + { + TRAP_IGNORE( DoHandlePluginUnloadedL( aUid ) ); + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionEngine::DoHandlePluginUnloadedL +// Called when a plugin is unloaded. Could be used to cleanup other references +// to the plugin, like the generic cache. +// ---------------------------------------------------------------------------- +// +void CMPXCollectionEngine::DoHandlePluginUnloadedL( + const TUid& aUid) + { + // Construct a plugin level path + // This should remove all levels after this path + // + CMPXCollectionPath* path = CMPXCollectionPath::NewL(); + CleanupStack::PushL( path ); + path->AppendL( aUid.iUid ); + iCache->RemoveL( *path ); + CleanupStack::PopAndDestroy( path ); + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionEngine::SendPluginHandlerMessageL +// ---------------------------------------------------------------------------- +// +void CMPXCollectionEngine::SendPluginHandlerMessageL( + TInt aMessageId, + const TUid& aPluginUid, + TBool aLoaded, + TInt aVersion /* = 0 */) + { + MPX_FUNC("CMPXCollectionEngine::SendPluginHandlerMessageL"); + MPX_DEBUG5("Message id 0x%08x, plugin id 0x%08x Loaded %d Version %d", + aMessageId,aPluginUid.iUid,aLoaded,aVersion); + CMPXMessage* msg = CMPXMedia::NewL(); + CleanupStack::PushL(msg); + + msg->SetTObjectValueL(KMPXMessageGeneralId, aMessageId); + msg->SetTObjectValueL(KMPXAttrPluginId, aPluginUid); + msg->SetTObjectValueL(KMPXAttrPluginLoaded, aLoaded); + if (aVersion > 0) + { + msg->SetTObjectValueL(KMPXAttrPluginVersion, aVersion); + } + + HandleMessage(msg, KErrNone); + + CleanupStack::PopAndDestroy(msg); + } + +// ---------------------------------------------------------------------------- +// Resets the content of the cache related to specified client context path +// ---------------------------------------------------------------------------- +// +void CMPXCollectionEngine::ResetCacheL(CMPXCollectionPath& aPath) + { + MPX_FUNC("CMPXCollectionEngine::ResetCache"); + CMPXCollectionPath* newPath = CMPXCollectionPath::NewL(); + CleanupStack::PushL(newPath); + newPath->AppendL(aPath.Id(0).iId1); + iCache->RemoveL(*newPath); + CleanupStack::PopAndDestroy(newPath); + } +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionengine/src/mpxcollectionpluginhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionengine/src/mpxcollectionpluginhandler.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,320 @@ +/* +* Copyright (c) 2006 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: Collection plug-in handler +* +*/ + +#include +#include +#include +#include "mpxcollectionpluginhandler.h" +#include "mpxcollectionplugininfo.h" + +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CMPXCollectionPluginHandler* CMPXCollectionPluginHandler::NewL( + MMPXCollectionPluginObserver& aPluginObserver, + MMPXPluginHandlerObserver& aObserver) + { + CMPXCollectionPluginHandler* p=new(ELeave)CMPXCollectionPluginHandler( + aPluginObserver, aObserver); + CleanupStack::PushL(p); + p->ConstructL(); + CleanupStack::Pop(p); + return p; + } + +// ---------------------------------------------------------------------------- +// Constructor. +// ---------------------------------------------------------------------------- +// +CMPXCollectionPluginHandler::CMPXCollectionPluginHandler( + MMPXCollectionPluginObserver& aPluginObserver, + MMPXPluginHandlerObserver& aObserver) +: CMPXPluginHandlerBase(KMPXCollectionInterfaceUid, ESelectionType, EMcLocal, aObserver), + iPluginObserver(&aPluginObserver) + { + } + +// ---------------------------------------------------------------------------- +// 2nd phase constructor. +// ---------------------------------------------------------------------------- +// +void CMPXCollectionPluginHandler::ConstructL() + { + BaseConstructL(); + } + +// ---------------------------------------------------------------------------- +// Destructor. +// ---------------------------------------------------------------------------- +// +CMPXCollectionPluginHandler::~CMPXCollectionPluginHandler() + { + //close plugins + for (TInt i = iLoadedPlugins.Count(); --i >= 0;) + { + CMPXCollectionPlugin* p=iLoadedPlugins[i]; + TRAP_IGNORE( p->CommandL(EMcCmdClose) ); + } + iLoadedPlugins.ResetAndDestroy(); + } + +// ---------------------------------------------------------------------------- +// Return the list of loaded plugins +// ---------------------------------------------------------------------------- +// +TArray CMPXCollectionPluginHandler::LoadedPlugins() + { + return iLoadedPlugins.Array(); + } + +// ---------------------------------------------------------------------------- +// Remove tasks of a client which is the observer of tasks +// ---------------------------------------------------------------------------- +// +void CMPXCollectionPluginHandler::RemoveTask(TAny* aCallback) + { + for (TInt i=iLoadedPlugins.Count(); --i>=0; ) + { + CMPXCollectionPlugin* plugin(iLoadedPlugins[i]); + if (plugin->Callback()==aCallback) + { + MPX_DEBUG1("CMPXCollectoinPluginHandler::RemoveTask removes active task"); + plugin->CancelRequest(); + plugin->CompleteTask(); + plugin->SetCallback(NULL); + plugin->SetObserver(*iPluginObserver); + } + else + { + iLoadedPlugins[i]->RemoveTask(aCallback); + } + } + } + +// ---------------------------------------------------------------------------- +// Get the list of noncacheable attributes +// ---------------------------------------------------------------------------- +// +const TArray CMPXCollectionPluginHandler::NonCacheableAttributesL( + const TUid& aPluginId ) + { + TInt i(KErrNotFound); + TInt count( iPluginInfoArray.Count() ); + TBool found( EFalse ); + for( i = 0; !found && i < count; ++i ) + { + if ( iPluginInfoArray[i]->ImplementationUid() == aPluginId ) + { + found = ETrue; + break; + } + } + if ( !found ) + { + User::Leave( KErrNotFound ); + } + + return ((CMPXCollectionPluginInfo*)iPluginInfoArray[i])->NonCacheableAttrs(); + } + +// ---------------------------------------------------------------------------- +// Get whether the plugin is cacheable or not +// ---------------------------------------------------------------------------- +// +TBool CMPXCollectionPluginHandler::PluginCachable( const TUid& aPluginId ) + { + TUint flags(0); + + TInt count( iPluginInfoArray.Count() ); + for( TInt i = 0; i < count; ++i ) + { + if ( iPluginInfoArray[i]->ImplementationUid() == aPluginId ) + { + flags = iPluginInfoArray[i]->Flags(); + break; + } + } + return ((flags&EMPXCollectionPluginFlagCacheable) != 0); + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionPluginHandler::LoadedPlugin +// ---------------------------------------------------------------------------- +// +CMPXCollectionPlugin* CMPXCollectionPluginHandler::LoadedPlugin(const TUid& aUid) + { + CMPXCollectionPlugin* plugin(NULL); + TInt index(LoadedPluginIndex(aUid)); + if (KErrNotFound != index) + { + plugin = iLoadedPlugins[index]; + } + return plugin; + } + +// ---------------------------------------------------------------------------- +// Resolve a plugin to iPlugin, based on properties (iDataType, iExt and iScheme) +// and selection criteria. If selection is by type, then there is always a +// plug-in resolved (if there are any of that type). Room for optimisation! +// ---------------------------------------------------------------------------- +// +void CMPXCollectionPluginHandler::ResolvePluginL() + { + // + // Resolve plugin + // + TUid pluginUid( KNullUid ); + TInt index( KErrNotFound ); + TPtrC displayName; + TInt pluginType( EMcUnknown ); + + DoResolvePluginL(pluginUid, index, displayName, pluginType ); + + iPlugin = CreateCollectionPluginL(pluginUid); + if(iPlugin != NULL) + UsePlugin(pluginUid); + } +// ---------------------------------------------------------------------------- +// CMPXCollectionPluginHandler::IsPluginLoaded +// ---------------------------------------------------------------------------- +// +TBool CMPXCollectionPluginHandler::IsPluginLoaded( + const TUid& aPluginUid) + { + return LoadedPluginIndex(aPluginUid) != KErrNotFound; + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionPluginHandler::LoadPluginL +// ---------------------------------------------------------------------------- +// +void CMPXCollectionPluginHandler::LoadPluginL( + const TUid& aPluginUid) + { + (void)CreateCollectionPluginL(aPluginUid); + } + +// ---------------------------------------------------------------------------- +// Constructs the collection plugin info class +// ---------------------------------------------------------------------------- +// +CMPXPluginInfo* CMPXCollectionPluginHandler::ConstructPluginInfoLC( + const CImplementationInformation& aData ) + { + return CMPXCollectionPluginInfo::NewLC( aData ); + } + +// ---------------------------------------------------------------------------- +// Unloads a specified plugin. +// ---------------------------------------------------------------------------- +// +void CMPXCollectionPluginHandler::UnloadPlugin( + const TUid& aUid) + { + MPX_DEBUG3("===>CMPXCollectionPluginHandler::UnloadPlugin 0x%08x uid 0x%08x", + this, aUid.iUid); + TInt index(LoadedPluginIndex(aUid)); + if (index != KErrNotFound) + { + UnloadPlugin(index); + } + MPX_DEBUG3("<===CMPXCollectionPluginHandler::UnloadPlugin 0x%08x uid 0x%08x", + this, aUid.iUid); + } + +// ---------------------------------------------------------------------------- +// Return a plugin controller with the specific id +// ---------------------------------------------------------------------------- +// +CMPXCollectionPlugin* +CMPXCollectionPluginHandler::CreateCollectionPluginL(const TUid& aUid) + { + MPX_DEBUG3("===>CMPXCollectionPluginHandler::CreateCollectionPluginL 0x%08x uid 0x%08x", + this, aUid.iUid); + + CMPXCollectionPlugin* p=NULL; + + TInt index(LoadedPluginIndex(aUid)); + if (index == KErrNotFound) + { + MPX_DEBUG3("CMPXCollectionPluginHandler::CreateCollectionPluginL create a new plugin 0x%08x uid 0x%08x", + this, aUid.iUid); + TRAPD(err, p = CMPXCollectionPlugin::NewL(aUid, *iPluginObserver)); + if(err == KErrNone) + { + CleanupStack::PushL(p); + iLoadedPlugins.AppendL(p); + CleanupStack::Pop(p); + } + else + { + MPX_DEBUG3("CMPXCollectionPluginHandler::CreateCollectionPluginL error creating plugin %d uid 0x%08x", + err, aUid.iUid); + User::Leave(err); + } + } + else + { + p = iLoadedPlugins[index]; + } + + MPX_DEBUG3("<===CMPXCollectionPluginHandler::CreateCollectionPluginL 0x%08x uid 0x%08x", + this, aUid.iUid); + + return p; + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionPluginHandler::LoadedPluginIndex +// ---------------------------------------------------------------------------- +// +TInt CMPXCollectionPluginHandler::LoadedPluginIndex(const TUid& aUid) + { + TInt index(KErrNotFound); + + for (TInt i = iLoadedPlugins.Count(); --i >= 0; ) + { + if (iLoadedPlugins[i]->Uid() == aUid) + { + index = i; + break; + } + } + + return index; + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionPluginHandler::UnloadPlugin +// ---------------------------------------------------------------------------- +// +void CMPXCollectionPluginHandler::UnloadPlugin(TInt aIndex) + { + MPX_DEBUG3("===>CMPXCollectionPluginHandler::UnloadPlugin 0x%08x index 0x%08x", + this, aIndex); + CMPXCollectionPlugin* p = iLoadedPlugins[aIndex]; + TRAP_IGNORE(p->CommandL(EMcCmdClose)); + iLoadedPlugins.Remove(aIndex); + delete p; + MPX_DEBUG3("<===CMPXCollectionPluginHandler::UnloadPlugin 0x%08x index 0x%08x", + this, aIndex); + } + +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionengine/src/mpxcollectionplugininfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionengine/src/mpxcollectionplugininfo.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,111 @@ +/* +* Copyright (c) 2007 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: Derived plugin info class for collection tags +* +*/ + + +#include +#include "mpxcollectionplugininfo.h" + +_LIT8(KMPXPluginCacheTag, "" ); + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CMPXCollectionPluginInfo::CMPXCollectionPluginInfo() + { + + } + + +// --------------------------------------------------------------------------- +// 2nd phase constructor +// --------------------------------------------------------------------------- +// +void CMPXCollectionPluginInfo::ConstructL( const CImplementationInformation& aData ) + { + // Base constructor + CMPXPluginInfo::ConstructL( aData ); + } + +// --------------------------------------------------------------------------- +// Two-Phased constructor +// --------------------------------------------------------------------------- +// +CMPXCollectionPluginInfo* CMPXCollectionPluginInfo::NewL( + const CImplementationInformation& aData ) + { + CMPXCollectionPluginInfo* self = new( ELeave ) CMPXCollectionPluginInfo; + CleanupStack::PushL( self ); + self->ConstructL( aData ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Two-phased constructor +// --------------------------------------------------------------------------- +// +CMPXCollectionPluginInfo* CMPXCollectionPluginInfo::NewLC( + const CImplementationInformation& aData ) + { + CMPXCollectionPluginInfo* self = new( ELeave ) CMPXCollectionPluginInfo; + CleanupStack::PushL( self ); + self->ConstructL( aData ); + return self; + } + +// --------------------------------------------------------------------------- +// Virtual destructor +// --------------------------------------------------------------------------- +// +CMPXCollectionPluginInfo::~CMPXCollectionPluginInfo() + { + iNonCachableAttrs.Close(); + } + +// --------------------------------------------------------------------------- +// Extended tag parsing functionality +// --------------------------------------------------------------------------- +// +void CMPXCollectionPluginInfo::ProcessTaggedDataExL( const TDesC8& aTag, + const TDesC8& aData) + { + if( aTag == KMPXPluginCacheTag ) + { + ExtractNonCacheableAttrsL( aData ); + } + } + +// --------------------------------------------------------------------------- +// Get the list of non-cacheable attributes +// --------------------------------------------------------------------------- +// +const TArray CMPXCollectionPluginInfo::NonCacheableAttrs() + { + return iNonCachableAttrs.Array(); + } + +// --------------------------------------------------------------------------- +// Process the non-cacheable attributes +// --------------------------------------------------------------------------- +// +void CMPXCollectionPluginInfo::ExtractNonCacheableAttrsL( const TDesC8& aData ) + { + ExtractUidsFromTextL( aData, iNonCachableAttrs ); + } + +// END OF FILE diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionserver/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionserver/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2006 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 for project Collection Server. +* +*/ + + + +PRJ_EXPORTS + + +PRJ_MMPFILES + +mpxcollectionserver.mmp diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionserver/group/mpxcollectionserver.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionserver/group/mpxcollectionserver.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2006 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: Collection server project specification +* +*/ + + + +#include +#include + +TARGET mpxcollectionserver.exe +TARGETTYPE exe +UID 0 0x101FFC31 +VENDORID VID_DEFAULT +CAPABILITY ALL -TCB +#ifdef __WINS__ +EPOCHEAPSIZE 0x1000 0x2800000 // 40MB +#else +EPOCHEAPSIZE 0x1000 0x3E00000 // 62 MB +#endif +EPOCSTACKSIZE 0X5000 + +USERINCLUDE ../inc +USERINCLUDE ../../collectionengine/inc +USERINCLUDE ../../inc + +MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/kernel + +SOURCEPATH ../src +SOURCE mpxcollectionserver.cpp +SOURCE mpxcollectionserversession.cpp + +LIBRARY euser.lib +LIBRARY estor.lib +LIBRARY efsrv.lib +LIBRARY mpxcollectionengine.lib +LIBRARY mpxcommon.lib + diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionserver/inc/mpxcollectionserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionserver/inc/mpxcollectionserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2006 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: Collection server +* +*/ + + +#ifndef CMPXCOLLECTIONSERVER_H +#define CMPXCOLLECTIONSERVER_H + +#include +#include "mpxcollectionserverdefs.h" + +class MMPXCollectionCallback; +class CMPXCollectionEngine; + +/** +* Music collection server +*/ +NONSHARABLE_CLASS(CMPXCollectionServer) : public CPolicyServer + { +public: + + /** + * Two-phased constructor. Leaves on failure. + * + * @return The constructed object + */ + static CMPXCollectionServer* NewL(); + + /** + * Destructor + */ + ~CMPXCollectionServer(); + + /** + * Decrements number of sessions this server holds, and if now zero, shuts + * down the server. + * + */ + void RemoveClient(); + +private: // From base class + /** From CServer2 from which CPolicyServer derives + * Create a new session + * + * @param aVersion version of the server + * @param aMessage message object + */ + CSession2* NewSessionL(const TVersion& aVersion, + const RMessage2& aMessage) const; + +private: + + /** + * C++ constructor + * + * @param aPriority priority of server + * @param aPolicy security policy + */ + CMPXCollectionServer(TInt aPriority, const TPolicy &aPolicy); + + /** + * 2nd phase constructor + */ + void ConstructL(); +private: + + CMPXCollectionEngine* iEngine; // Single collection engine + TInt iClients; + }; + +#endif // CMPXCOLLECTIONSERVER_H + diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionserver/inc/mpxcollectionserverdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionserver/inc/mpxcollectionserverdefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2004 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: Collection Server common definitions +* +*/ + + +#ifndef MPXCOLLECTIONSERVERDEFS_H +#define MPXCOLLECTIONSERVERDEFS_H + + +#include +#include +#include + +// Server name +_LIT(KMPXCollectionServerName,"MPXCollectionServer"); +_LIT(KMPXCollectionServerImg,"mpxcollectionserver"); // DLL/EXE name +// UID +const TUid KMPXCollectionServerUid3={0x101FFC31}; +// Serverversion number +const TUint KMPXCollectionServerMajorVersionNumber=0; +const TUint KMPXCollectionServerMinorVersionNumber=1; +const TUint KMPXCollectionServerBuildVersionNumber=1; + +#endif // MPXCOLLECTIONSERVERDEFS_H + diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionserver/inc/mpxcollectionserversession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionserver/inc/mpxcollectionserversession.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,245 @@ +/* +* Copyright (c) 2006 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: Collection server session +* +*/ + + +#ifndef CMPXCOLLECTIONSESSION_H +#define CMPXCOLLECTIONSESSION_H + +#include +#include +#include +#include +#include +#include "mpxcollectionengineobserver.h" +#include "mpxcollectionserverdefs.h" + +class CMPXCollectionClientContext; +class CMPXCollectionEngine; +class CMPXMessageQueue; +class CMPXMediaArray; +class CMPXCollectionPath; + +/** +* Music collection server session +*/ +class CMPXCollectionSession : public CSession2, + public MMPXCollectionEngineObserver + { +public: + + /** + * Two-phased constructor. Leaves on failure. + * + * @param aEngine engine object + * @return The constructed object + */ + static CMPXCollectionSession* NewL(CMPXCollectionEngine& aEngine); + + /** + * C++ constructor + * + * @param aEngine engine object + */ + CMPXCollectionSession(CMPXCollectionEngine& aEngine); + + /** + * Destructor + */ + ~CMPXCollectionSession(); + +private: // From base classes + + /** + * From MMPXCollectionEngineObserver + * Handles the collection entries/item being opened. Typically called + * when client has Open()'d a folder or an item + * + * @param aMedia media to hold collection entries + * @param aIndex focused entry + * @param aComplete ETrue no more entries. EFalse more entries + * expected + * @param aError error code + */ + void HandleOpen(CMPXMedia* aMedia, TInt aIndex, + TBool aComplete,TInt aError); + + /** + * From MMPXCollectionEngineObserver + * Handles the completion of an async operation + * + * @param aError error code of completion + */ + void HandleOpComplete(TInt aError); + + /** + * From MMPXCollectionEngineObserver + * Handle media properties + * + * @param aMedia media + * @param aError error code + */ + void HandleMedia(CMPXMedia* aMedia, TInt aError); + + /** + * From MMPXCollectionEngineObserver + * Handle completion of a asynchronous command + * + * @param aCommandResult result of the command, NULL if error + * @param aError error code + */ + void HandleCommandComplete(CMPXCommand* aCommandResult, + TInt aError); + + /** + * From MMPXCollectionEngineObserver + * Handles remove by collection path + * + * @param aUriArray, contains a list of file paths to be deleted + * @param aError error code + */ + void HandleRemove(const CDesCArray& aUriArray, TInt aError); + + /** + * From MMPXCollectionEngineObserver + * Handles FindAllL results + * + * @param aMedia media item(s) + * @param aError error code + */ + void HandleFindAll(CMPXMedia* aMedia, TInt aError); + + /** + * From CSession2 + * Service request + * @param aMessage message object + */ + void ServiceL(const RMessage2& aMessage); + +private: + /** + * Dispatch message + * + * @param aMessage message object + * @return message completion code + */ + TInt DispatchMessageL(const RMessage2& aMessage); + + /** + * Set collection mode + * + * @param aMessage message object + */ + void SetModeL(const RMessage2& aMessage); + + /** + * Set client id + * + * @param aMessage message object + */ + void SetClientIdL(const RMessage2& aMessage); + + /** + * Get client id from message + * + * @param aMessage message object + * @reutrn client thread id + */ + TThreadId ClientIdL(const RMessage2& aMessage); + + /** + * Init player from file + * + * @param aMessage message object + */ + void InitFromFileL(const RMessage2& aMessage); + + /** + * Cancel outstanding requests + */ + void CancelRequests(); + + /** + * Set request as async + * + * @param aMessage message object + */ + void SetAsyncL(const RMessage2& aMessage); + + /** + * Complete async request + * + * @param aErr error code + * @param aSlot1 message slot 1 + * @param aVal1 value in the slot 1 + * @param aSlot2 message slot 2 + * @param aVal2 value in the slot 2 + */ + void CompleteAsync(TInt aErr, + TInt aSlot1 = 0, const TDesC8* aVal1 = NULL, + TInt aSlot2 = 0,const TDesC8* aVal2 = NULL, + TInt aSlot3 = 0,const TDesC8* aVal3 = NULL); + + /** + * Writes data from the specified source descriptor to the specified + * message slot + * + * @param aSlot1 message slot 1 + * @param aVal1 value in the slot 1 + * @param aSlot2 message slot 2 + * @param aVal2 value in the slot 2 + * @return KErrNone, if successful, otherwise system error code + */ + TInt DoWriteData(TInt aSlot1 = 0, const TDesC8* aVal1 = NULL, + TInt aSlot2 = 0, const TDesC8* aVal2 = NULL, + TInt aSlot3 = 0, const TDesC8* aVal3 = NULL); + + /** + * Get current selection + * + * @param aMessage message object + */ + void GetSelectionL(const RMessage2& aMessage); + +private: + + /** + * 2nd phase constructor + */ + void ConstructL(); + +private: + CMPXCollectionEngine& iEngine; + CMPXCollectionClientContext* iContext; // Not owned + + RMessage2 iMessage; + TBool iCompleteRequest; + + // + // Data for client, for current request + // + CBufBase* iAsyncBuffer; // buffer for async request + CBufBase* iSyncBuffer; // buffer for sync request + CMPXMedia* iSyncMedia; // Keep reference to result media of sync request + CMPXMedia* iAsyncMedia; // Keep reference to result media of async request + CMPXMessageQueue* iMessageQueue; // Message queue + CMPXMediaArray* iRootMediaArray; // media array for media request of multi selection at root + CMPXCommand* iMediaCommand; // a copy of media request command + CMPXCollectionPath* iMediaPath; // path for media request + }; + +#endif // CMPXCOLLECTIONSESSION_H + diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionserver/src/mpxcollectionserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionserver/src/mpxcollectionserver.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,177 @@ +/* +* Copyright (c) 2006 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: Collection server +* +*/ + + +#include +#include +#include "mpxcollectionframeworkdefs.h" +#include "mpxcollectionserverdefs.h" +#include "mpxcollectionserversession.h" +#include "mpxcollectionengine.h" +#include "mpxcollectionserver.h" + + +// CONSTANTS + +// Server Security Policy +const TUint KMPXCollectionServerRangeCount = 2; +const TInt KMPXCollectionServerRanges[KMPXCollectionServerRangeCount] = + { + 0, //range is [0-EMcsServerOpEnd) + EMcsServerOpEnd, //range is [EMcsServerOpEnd-KMaxTInt] + }; +const TUint8 KMPXCollectionSeverElementsIndex[KMPXCollectionServerRangeCount] = + { + 0, //applies to range [0-EMcsServerOpEnd) + CPolicyServer::ENotSupported, //applies to range [EMcsServerOpEnd-KMaxTInt] + }; + +const CPolicyServer::TPolicyElement KMPXCollectionServerPolicyElements[] = + { + {_INIT_SECURITY_POLICY_C1(ECapabilityWriteDeviceData), + CPolicyServer::EFailClient}, + }; + +const CPolicyServer::TPolicy KMPXCollectionServerPolicy = + { + CPolicyServer::EAlwaysPass, //specifies all connect attempts should pass + KMPXCollectionServerRangeCount, + KMPXCollectionServerRanges, + KMPXCollectionSeverElementsIndex, + KMPXCollectionServerPolicyElements, + }; + + +// ============================ LOCAL FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Start collection server +// ---------------------------------------------------------------------------- +// +LOCAL_C void StartServerL() + { + User::LeaveIfError(User::RenameThread(KMPXCollectionServerName)); + CActiveScheduler* scheduler = new(ELeave)CActiveScheduler; + CleanupStack::PushL(scheduler); + CActiveScheduler::Install(scheduler); + CMPXCollectionServer* server = CMPXCollectionServer::NewL(); + CleanupStack::PushL(server); + RProcess::Rendezvous(KErrNone); + CActiveScheduler::Start(); + CActiveScheduler::Install(NULL); + CleanupStack::PopAndDestroy(server); + CleanupStack::PopAndDestroy(scheduler); + } + +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CMPXCollectionServer* CMPXCollectionServer::NewL() + { + CMPXCollectionServer *pS = new(ELeave) CMPXCollectionServer( + CActive::EPriorityStandard, + KMPXCollectionServerPolicy); + CleanupStack::PushL(pS); + pS->ConstructL(); + CleanupStack::Pop(pS); + return pS; + } + +// ---------------------------------------------------------------------------- +// C++ constructor can NOT contain any code that might leave. +// ---------------------------------------------------------------------------- +// +CMPXCollectionServer::CMPXCollectionServer(TInt aPriority, const TPolicy &aPolicy) + : CPolicyServer(aPriority, aPolicy) + {} + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CMPXCollectionServer::~CMPXCollectionServer() + { + delete iEngine; + } + +// ---------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ---------------------------------------------------------------------------- +// +void CMPXCollectionServer::ConstructL() + { + iEngine = CMPXCollectionEngine::NewL(); + StartL(KMPXCollectionServerName); + } + +// ---------------------------------------------------------------------------- +// Find the collection that has client aName, and remove it from that collection; +// if that collection has no clients, then delete that collection. If the server +// has no more client sessions, then stop the server. +// ---------------------------------------------------------------------------- +// +void CMPXCollectionServer::RemoveClient() + { + iClients--; + MPX_ASSERT(iClients>=0); + if (iClients==0) + { + CActiveScheduler::Stop(); + } + } + +// ---------------------------------------------------------------------------- +// Create a new session +// ---------------------------------------------------------------------------- +// +CSession2* CMPXCollectionServer::NewSessionL(const TVersion& aVersion, + const RMessage2& /*aMessage*/) const + { + TVersion v(KMPXCollectionServerMajorVersionNumber, + KMPXCollectionServerMinorVersionNumber, + KMPXCollectionServerBuildVersionNumber); + if (!User::QueryVersionSupported(v,aVersion)) + User::Leave(KErrNotSupported); + CSession2* session = CMPXCollectionSession::NewL(*iEngine); + const_cast(this)->iClients++;; + return session; + } + +// ---------------------------------------------------------------------------- +// Server exe entry +// ---------------------------------------------------------------------------- +// +TInt E32Main() + { + __UHEAP_MARK; + // + CTrapCleanup* cleanup=CTrapCleanup::New(); + TInt r=KErrNoMemory; + if (cleanup) + { + TRAP(r,StartServerL()); + } + + delete cleanup; + __UHEAP_MARKEND; + return r; + } + +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionserver/src/mpxcollectionserversession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionserver/src/mpxcollectionserversession.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,857 @@ +/* +* Copyright (c) 2006 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: Collection server session +* +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mpxcollectionserver.h" +#include "mpxcollectionengine.h" +#include "mpxcollectionclientcontext.h" +#include "mpxcollectionserversession.h" + +// ============================ LOCAL FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Panic client +// ---------------------------------------------------------------------------- +// +LOCAL_C void PanicClient(const RMessage2 &aMessage,TInt aPanic) + { + _LIT(KTxtServer,"Collection server Session"); + aMessage.Panic(KTxtServer,aPanic); + } + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CMPXCollectionSession* CMPXCollectionSession::NewL( + CMPXCollectionEngine& aEngine) + { + CMPXCollectionSession* s = new(ELeave)CMPXCollectionSession(aEngine); + CleanupStack::PushL(s); + s->ConstructL(); + CleanupStack::Pop(s); + return s; + } + +// ---------------------------------------------------------------------------- +// C++ constructor can NOT contain any code that might leave. +// ---------------------------------------------------------------------------- +// +CMPXCollectionSession::CMPXCollectionSession(CMPXCollectionEngine& aEngine) + : iEngine(aEngine) + { + } + +// ---------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ---------------------------------------------------------------------------- +// +void CMPXCollectionSession::ConstructL() + { + MPX_FUNC_EX("CMPXCollectionSession::ConstructL"); + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CMPXCollectionSession::~CMPXCollectionSession() + { + MPX_DEBUG2("CMPXCollectionSession::~CMPXCollectionSession this %08x", this); + CancelRequests(); + if (iContext) + { + iContext->RemoveClient(*iMessageQueue); + } + static_cast( + const_cast(Server()))->RemoveClient(); + delete iAsyncBuffer; + delete iSyncBuffer; + delete iSyncMedia; + delete iAsyncMedia; + delete iMessageQueue; + delete iRootMediaArray; + delete iMediaCommand; + delete iMediaPath; + } + +// ---------------------------------------------------------------------------- +// Service request +// ---------------------------------------------------------------------------- +// +void CMPXCollectionSession::ServiceL(const RMessage2& aMessage) + { + // by default - change for async in helper methods if required + iCompleteRequest=ETrue; + TInt r=KErrNone; + MPX_TRAPD(err,r = DispatchMessageL(aMessage)); + TBool isErr=(err!=KErrNone); + // If it's not async, complete now (or an async helper method leaves) + if(iCompleteRequest) + { + aMessage.Complete(isErr ? err : r); + } + else if (isErr) // Async and error, remove message from message queue + { + CompleteAsync(err); + } + } + +// ---------------------------------------------------------------------------- +// Message dispatcher +// ---------------------------------------------------------------------------- +// +TInt CMPXCollectionSession::DispatchMessageL(const RMessage2& aMessage) + { + TInt r = KErrNone; + TInt op=aMessage.Function(); + MPX_DEBUG3("-->CMPXCollectionSession::DispatchMessageL %d, this 0x%08x", + op, this); + + if (op == EMcsSetMode) + { + SetModeL(aMessage); // This is the only operation when the iContext + // hasn't been defined. + } + else if (!iContext) + { + MPX_DEBUG1("CMPXCollectionSession::DispatchMessageL no context"); + User::Leave(KErrNotReady); + } + else + { + CBufBase* buffer(NULL); + CMPXMedia* media( NULL ); + switch(op) + { + case EMcsOpenPath: + { + SetAsyncL(aMessage); + MPXUser::CreateBufferL(aMessage, 3, buffer); + CleanupStack::PushL(buffer); + RBufReadStream readStream( *buffer ); + CleanupClosePushL(readStream); + CMPXCollectionPath* path = CMPXCollectionPath::NewL(readStream); + CleanupStack::PushL(path); + // Internalize open mode + TInt mode = readStream.ReadInt32L(); + if (path->Levels() >0 ) + { + // Internalize attributes + RArray attrs; + CleanupClosePushL(attrs); + ::InternalizeL(attrs, readStream); + path->SetL(attrs.Array()); + CleanupStack::PopAndDestroy(&attrs); + } + // ownership of path transferred + iContext->OpenL(path, mode, this); + CleanupStack::Pop(path); + CleanupStack::PopAndDestroy(&readStream); + CleanupStack::PopAndDestroy(buffer); + break; + } + case EMcsOpenIndex: + { + SetAsyncL(aMessage); + TPckgBuf indexPkg; + aMessage.ReadL(1,indexPkg); + MPXUser::CreateBufferL(aMessage, 3, buffer); + CleanupStack::PushL(buffer); + RBufReadStream readStream( *buffer ); + CleanupClosePushL(readStream); + // Internalize mode + TInt mode = readStream.ReadInt32L(); + // Internalize attributes + RArray attrs; + CleanupClosePushL(attrs); + ::InternalizeL(attrs, readStream); + iContext->OpenL(indexPkg(), mode, attrs.Array(), this); + CleanupStack::PopAndDestroy(&attrs); + CleanupStack::PopAndDestroy(&readStream); + CleanupStack::PopAndDestroy(buffer); + break; + } + case EMcsOpenByUids: + { + SetAsyncL(aMessage); + MPXUser::CreateBufferL(aMessage, 3, buffer); + CleanupStack::PushL(buffer); + RBufReadStream readStream(*buffer); + CleanupClosePushL(readStream); + TInt mode = readStream.ReadInt32L(); + RArray uids; + CleanupClosePushL(uids); + ::InternalizeL(uids, readStream); + iContext->OpenL(uids.Array(), mode, this); + CleanupStack::PopAndDestroy(&uids); + CleanupStack::PopAndDestroy(&readStream); + CleanupStack::PopAndDestroy(buffer); + break; + } + case EMcsOpen: + { + SetAsyncL(aMessage); + iContext->OpenL(aMessage.Int3(), this); + break; + } + case EMcsMediaByPath: + { + SetAsyncL(aMessage); + // Reset previous media command and result + delete iRootMediaArray; + iRootMediaArray = NULL; + delete iMediaCommand; + iMediaCommand = NULL; + iMediaCommand = CMPXCommand::NewL(aMessage.Int1()); + // Extract client's capabilites from the RMessage + TCapabilitySet theCaps = TSecurityInfo(aMessage).iCaps ; + iMediaCommand->SetTObjectValueL( + KMPXCommandMediaCapbilitySet, theCaps); + MPX_ASSERT(iMediaCommand->IsSupported(KMPXCommandGeneralTargetIds)); + delete iMediaPath; + iMediaPath = NULL; + iMediaPath = iMediaCommand->ValueCObjectL( + KMPXCommandGeneralTargetIds); + MPX_ASSERT(iMediaPath->Levels()>0); + if (iMediaPath->Selection().Count()>0 && iMediaPath->Levels() == 1) + { // multiple selection at root level + iRootMediaArray=CMPXMediaArray::NewL(); // array of media result + iMediaCommand->SetTObjectValueL(KMPXCommandMediaIndex, 0); + iMediaPath->Set(iMediaPath->Selection()[0]); + // update the collection path in the command + iMediaCommand->SetCObjectValueL(KMPXCommandGeneralTargetIds, + iMediaPath); + } + iContext->MediaL(*iMediaCommand, this); + break; + } + case EMcsBack: + { + SetAsyncL(aMessage); + iContext->BackL(this); + break; + } + case EMcsRemovePath: + { + SetAsyncL(aMessage); + CMPXCollectionPath* path( NULL ); + ::NewFromMessageL(aMessage, 0, path); + CleanupStack::PushL( path ); + MPX_ASSERT(path); + MPX_ASSERT(path->Levels()>0); + iContext->RemoveL(path, this); + CleanupStack::Pop( path ); // ownership transferred + break; + } + case EMcsGetUid: + { + MPX_DEBUG1("CMPXCollectionSession::DispatchMessageL EMcsGetUid"); + TPckgC uidPkg(iContext->PluginId().iUid); + aMessage.Write(0,uidPkg); + break; + } + case EMcsGetPath: + { + MPX_DEBUG1("CMPXCollectionSession::DispatchMessageL EMcsGetPath"); + ::CreateBufferL(iContext->Path(), iSyncBuffer); + r = iSyncBuffer->Size(); + break; + } + case EMcsGetSyncBuffer: + { + MPX_DEBUG1("CMPXCollectionSession::DispatchMessageL EMcsGetSyncBuffer"); + aMessage.WriteL(0,iSyncBuffer->Ptr(0)); + delete iSyncBuffer; + iSyncBuffer = NULL; + break; + } + case EMcsGetAsyncBuffer: + { + MPX_DEBUG1("CMPXCollectionSession::DispatchMessageL EMcsGetAsyncBuffer"); + aMessage.WriteL(0,iAsyncBuffer->Ptr(0)); + delete iAsyncBuffer; + iAsyncBuffer = NULL; + break; + } + case EMcsCommandExt: + { + if (aMessage.Int0()) + { // async command + SetAsyncL(aMessage); + } + CMPXCommand* cmd = CMPXCommand::NewL(aMessage.Int1()); + CleanupStack::PushL(cmd); + iContext->CommandL(*cmd, this, *iMessageQueue); + CleanupStack::PopAndDestroy(cmd); + break; + } + case EMcsAddItem: + { + ::NewFromMessageL(aMessage,0,media); + CleanupStack::PushL(media); + iContext->AddL(*media); + CleanupStack::PopAndDestroy(media); + break; + } + case EMcsRemoveItem: + { + ::NewFromMessageL(aMessage,0,media); + CleanupStack::PushL(media); + iContext->RemoveL(*media); + CleanupStack::PopAndDestroy(media); + break; + } + case EMcsSetMedia: + { + ::NewFromMessageL(aMessage,0,media); + CleanupStack::PushL(media); + iContext->SetL(*media); + CleanupStack::PopAndDestroy(media); + break; + } + case EMcsSetFilter: + { + CMPXFilter* filter=NULL; + if (aMessage.GetDesLengthL(0)) + { + ::NewFromMessageL(aMessage,0,filter); + } + if (filter) + { + CleanupStack::PushL(filter); + iContext->SetFilterL(filter); + CleanupStack::PopAndDestroy(filter); + } + else + { + iContext->SetFilterL(NULL); + } + break; + } + case EMcsCommand: + { + iContext->CommandL((TMPXCollectionCommand) aMessage.Int0(), + aMessage.Int1()); + break; + } + case EMcsFindAll: + { + CMPXMedia* media = CMPXMedia::NewL(aMessage.Int2()); + CleanupStack::PushL(media); + MPXUser::CreateBufferL( aMessage, 0, buffer ); + CleanupStack::PushL(buffer); + if (aMessage.Int1()) + { //Sync find + delete iSyncMedia; + iSyncMedia = NULL; + iSyncMedia = iContext->FindAllSyncL(*media, *buffer); + if (iSyncMedia) + { + ::CreateBufferL(*iSyncMedia,iSyncBuffer); + r = iSyncBuffer->Size(); + } + else + { + r = KErrNotFound; + } + CleanupStack::PopAndDestroy(buffer); + } + else + { // Async + SetAsyncL(aMessage); + iContext->FindAllL(*media, buffer, this); + CleanupStack::Pop(buffer); // ownership transferred + } + CleanupStack::PopAndDestroy(media); + break; + } + case EMcsNotifyEvent: + { + iEngine.NotifyL( (TMPXCollectionBroadCastMsg) aMessage.Int0(), aMessage.Int1() ); + break; + } + case EMcsGetSupportedTypes: + { + RPointerArray array; + iEngine.GetSupportedTypesL( array ); + ::CreateBufferL(array.Array() , iSyncBuffer); + r = iSyncBuffer->Size(); + array.ResetAndDestroy(); + array.Close(); + break; + } + case EMcsGetCapabilities: + { + // Get the capabilities from the client context + TCollectionCapability cap = iContext->GetCapabilities(); + TPckgC p(cap); + aMessage.Write(0,p); + break; + } + case EMcsCancelRequest: + { + CancelRequests(); + break; + } + case EMcsCollectionIdLookup: + { + // Recreate buffer + CBufBase* buffer(NULL); + MPXUser::CreateBufferL( aMessage, 0, buffer ); + CleanupStack::PushL( buffer ); + + // Array from buffer + RArray uids; + CleanupClosePushL( uids ); + + RBufReadStream rs( *buffer ); + CleanupClosePushL( rs ); + ::InternalizeL( uids, rs ); + CleanupStack::PopAndDestroy( &rs ); + + // Resolve and return + TUid pluginId = iEngine.ResolvePluginUid( uids.Array() ); + TPckgC p( pluginId ); + aMessage.WriteL(1,p); + CleanupStack::PopAndDestroy( 2, buffer ); // buffer, uids + break; + } + case EMcsCollectionID: + { + // This is a placeholder function, + // + TPckgBuf id; + aMessage.ReadL(0,id); + + // Lookup id and write back to client + TUid realId = iEngine.LookupCollectionPluginID( id() ); + TPckgC p(realId); + aMessage.WriteL(0,p); + break; + } + case EMcsFilter: + { + const CMPXFilter* filter=iContext->Filter(); + if (filter) + { + ::CreateBufferL(*filter,iSyncBuffer); + r=iSyncBuffer->Size(); + } + break; + } + case EMcsGetNextMessage: + { + MPX_ASSERT(iMessageQueue); + iMessageQueue->SendNext(aMessage); + iCompleteRequest=EFalse; + break; + } + case EMcsCancelGetMessage: + { + MPX_ASSERT(iMessageQueue); + iMessageQueue->Reset(); + break; + } + default: + { + PanicClient(aMessage, KErrNotSupported); + break; + } + } + } + MPX_DEBUG3("<--CMPXCollectionSession::DispatchMessageL %d, this 0x%08x", + op, this); + return r; + } + +// ---------------------------------------------------------------------------- +// Get current selection +// ---------------------------------------------------------------------------- +// +void CMPXCollectionSession::GetSelectionL(const RMessage2& aMessage) + { + (void)aMessage; + } + +// ---------------------------------------------------------------------------- +// Queue the message and complete async +// ---------------------------------------------------------------------------- +// +void CMPXCollectionSession::SetAsyncL(const RMessage2& aMessage) + { + MPX_ASSERT(iMessage.IsNull()); + iMessage = aMessage; + iCompleteRequest=EFalse; + } + +// ---------------------------------------------------------------------------- +// Complete queued message +// ---------------------------------------------------------------------------- +// +void CMPXCollectionSession::CompleteAsync( + TInt aErr, + TInt aSlot1, const TDesC8* aVal1, + TInt aSlot2, const TDesC8* aVal2, + TInt aSlot3, const TDesC8* aVal3) + { + MPX_ASSERT(!iMessage.IsNull()); + TInt err(KErrNone); + if (aErr>=0) + { + err = DoWriteData(aSlot1, aVal1, aSlot2, aVal2, aSlot3, aVal3); + if (err) + {// Set to new error + aErr=err; + } + } + MPX_DEBUG4("CMPXCollectionSession::CompleteAsync 0x%08x task %d err %d", + this, iMessage.Function(), aErr); + iMessage.Complete(aErr); + } + +// ---------------------------------------------------------------------------- +// Write data back to client +// ---------------------------------------------------------------------------- +// +TInt CMPXCollectionSession::DoWriteData( + TInt aSlot1, const TDesC8* aVal1, + TInt aSlot2, const TDesC8* aVal2, + TInt aSlot3, const TDesC8* aVal3) + { + TInt ret(KErrNone); + if (aVal1) + { + ret=iMessage.Write(aSlot1,*aVal1); + } + + if (aVal2 && KErrNone==ret) + { + ret=iMessage.Write(aSlot2,*aVal2); + } + + if (aVal3 && KErrNone==ret) + { + ret=iMessage.Write(aSlot3,*aVal3); + } + return ret; + } + +// ---------------------------------------------------------------------------- +// Cancel all outstanding requests on this session +// ---------------------------------------------------------------------------- +// +void CMPXCollectionSession::CancelRequests() + { + if (!iMessage.IsNull()) + { + iMessage.Complete(KErrCancel); + } + if (iContext) + { + iContext->CancelRequest(this); + } + } + +// ---------------------------------------------------------------------------- +// The thread ID of the client thread +// ---------------------------------------------------------------------------- +// +TThreadId CMPXCollectionSession::ClientIdL(const RMessage2& aMessage) + { + RThread t; + aMessage.ClientL(t); + TThreadId tid=t.Id(); + t.Close(); + return tid; + } + +// ---------------------------------------------------------------------------- +// Set collection mode +// ---------------------------------------------------------------------------- +// +void CMPXCollectionSession::SetModeL(const RMessage2& aMessage) + { + if (!iMessageQueue) + { + iMessageQueue = CMPXMessageQueue::NewL(); + } + iContext = &iEngine.SessionInitL(TUid::Uid(aMessage.Int0()), + ClientIdL(aMessage), + iMessageQueue); + } + +// ---------------------------------------------------------------------------- +// Handles the collection entries being opened. +// ---------------------------------------------------------------------------- +// +void CMPXCollectionSession::HandleOpen( + CMPXMedia* aMedia, + TInt aIndex, + TBool aComplete, + TInt aError) + { + MPX_DEBUG2("CMPXCollectionSession::HandleOpen with media err %d", aError); + TInt op(iMessage.Function()); + MPX_ASSERT((!iMessage.IsNull() && + (EMcsOpen == op || EMcsOpenIndex == op || + EMcsOpenPath == op || EMcsBack == op || EMcsOpenByUids == op))); + TInt size(0); + if (aError > 0 && aError != KMPXPathUpdated && + aError != KMPXCollectionPath && aMedia) + { + MPX_DEBUG2("CMPXCollectionSession::HandleOpen media count %d", + aMedia->Count()); + if (aMedia) + { + delete iAsyncMedia; + iAsyncMedia=NULL; + TRAPD(err,iAsyncMedia=CMPXMedia::NewL(*aMedia)); + if(err == KErrNone) + { + TRAP(err, ::CreateBufferL(*iAsyncMedia,iAsyncBuffer)); + } + if (err) + { + aError = err; + } + else + { + size = iAsyncBuffer->Size(); + } + MPX_DEBUG2("CMPXCollectionSession::HandleOpen buffer size %d", size); + } + } + TPckgC index(aIndex); + TPckgC complete(static_cast(aComplete)); + TPckgC sizePkg(size); + MPX_DEBUG3("CMPXCollectionSession::HandleOpen completed with media: err %d, size %d", + aError, sizePkg()); + CompleteAsync(aError, + 0, &sizePkg, + 1, &index, + 2, &complete); + } + +// ---------------------------------------------------------------------------- +// Handle completion of an async op +// ---------------------------------------------------------------------------- +// +void CMPXCollectionSession::HandleOpComplete( TInt aError ) + { + CompleteAsync(aError); + } + +// ---------------------------------------------------------------------------- +// Handle media request callback +// ---------------------------------------------------------------------------- +// +void CMPXCollectionSession::HandleMedia( + CMPXMedia* aMedia, + TInt aError) + { + TInt op(iMessage.Function()); + TInt size(0); + TInt err(KErrNone); + TBool done(EFalse); + MPX_ASSERT(!iMessage.IsNull() && + (EMcsMediaByPath == op || EMcsMedia == op)); + if (iRootMediaArray) + { // multiple selection at root level + // Advance to next item + TInt* pIndex = iMediaCommand->Value(KMPXCommandMediaIndex); + if (!pIndex) + { + aError = KErrNoMemory; + } + else + { + *pIndex = *pIndex + 1; + } + if (KErrNone == aError && aMedia) + { + MPX_TRAP(err, iRootMediaArray->AppendL(*aMedia)); + } + else + {// append dummy media for this item + TRAP(err, iRootMediaArray->AppendL(CMPXMedia::NewL())); + } + + if (err) + { + aError = err; // set to latest error code + } + if (KErrNone==aError) + { // done for all root items or error happens on an item + if (*pIndex == iMediaPath->Selection().Count()) + { + done = ETrue; + delete iAsyncMedia; + iAsyncMedia=NULL; + TRAP(err, iAsyncMedia=CMPXMedia::NewL()); + if(KErrNone==err) + { + TRAP(err, + iAsyncMedia->SetCObjectValueL( + KMPXMediaArrayContents, iRootMediaArray); + iAsyncMedia->SetTObjectValueL(KMPXMediaArrayCount, *pIndex)); + } + + if (KErrNone==err) + { + aError = KMPXCollectionMedia; + } + } + else + { // Send next request + + TRAP(err, + iMediaCommand->SetTObjectValueL(KMPXCommandMediaIndex, *pIndex); + iMediaPath->Set(iMediaPath->Selection()[*pIndex]); + // update path in command + iMediaCommand->SetCObjectValueL(KMPXCommandGeneralTargetIds, + iMediaPath); + iContext->MediaL(*iMediaCommand, this)); + } + if (err) + { + aError = err; + } + } + + if (aError<0) + { // done with error + done = ETrue; + delete iAsyncMedia; + iAsyncMedia = NULL; + } + } + else + { + done = ETrue; + if (KErrNone == aError && aMedia) + { + aError = KMPXCollectionMedia; + delete iAsyncMedia; + iAsyncMedia=NULL; + TRAP_IGNORE(iAsyncMedia=CMPXMedia::NewL(*aMedia)); + } + } + + if (done) + { + // Free resource + delete iMediaPath; + iMediaPath = NULL; + if (iAsyncMedia && aError>=0) + { + TRAP(err, ::CreateBufferL(*iAsyncMedia,iAsyncBuffer)); + if (iAsyncBuffer) + { + size = iAsyncBuffer->Size(); + } + } + if (err) + { + aError = err; + } + TPckgC sizePkg(size); + CompleteAsync(aError,0, &sizePkg); + } + } + +// ---------------------------------------------------------------------------- +// Callback of async CommandL +// ---------------------------------------------------------------------------- +// + void CMPXCollectionSession::HandleCommandComplete( + CMPXCommand* aCommandResult, + TInt aError) + { + MPX_ASSERT(!iMessage.IsNull() && iMessage.Function() == EMcsCommandExt); + TInt size(0); + if( aError == KErrNone && aCommandResult) + { + delete iAsyncMedia; + iAsyncMedia=NULL; + TRAP(aError, iAsyncMedia=CMPXMedia::NewL(*aCommandResult)); + if (KErrNone==aError) + { + TRAP(aError, ::CreateBufferL(*iAsyncMedia,iAsyncBuffer)); + } + + if (KErrNone==aError) + { + size = iAsyncBuffer->Size(); + } + } + TPckgC sizePkg(size); + CompleteAsync(aError, 2, &sizePkg); + } + +// ---------------------------------------------------------------------------- +// Handle removing media by collection path +// ---------------------------------------------------------------------------- +// +void CMPXCollectionSession::HandleRemove( + const CDesCArray& aUriArray, + TInt aError) + { + MPX_ASSERT(!iMessage.IsNull() && iMessage.Function() == EMcsRemovePath); + if( aError == KErrNone ) + { + TRAPD(err, MPXUser::CreateBufferL(&aUriArray, iAsyncBuffer)); + aError = err == KErrNone ? iAsyncBuffer->Size() : err; + } + CompleteAsync(aError); + } + +// ---------------------------------------------------------------------------- +// Handles find results +// ---------------------------------------------------------------------------- +// +void CMPXCollectionSession::HandleFindAll(CMPXMedia* aMedia, TInt aError) + { + MPX_ASSERT(!iMessage.IsNull() && iMessage.Function() == EMcsFindAll); + if( aError == KErrNone && aMedia) + { + delete iAsyncMedia; + iAsyncMedia=NULL; + TRAPD(err, iAsyncMedia=CMPXMedia::NewL(*aMedia)); + if(KErrNone == err) + { + TRAP(err, ::CreateBufferL(*iAsyncMedia,iAsyncBuffer)); + } + + aError = err == KErrNone ? iAsyncBuffer->Size() : err; + } + CompleteAsync(aError); + } +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionutility/bwinscw/mpxcollectionutilityU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionutility/bwinscw/mpxcollectionutilityU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,49 @@ +EXPORTS + ??1CMPXCollectionPlaylist@@UAE@XZ @ 1 NONAME ; CMPXCollectionPlaylist::~CMPXCollectionPlaylist(void) + ?CancelRequest@CMPXCollectionPlaylist@@QAEXXZ @ 2 NONAME ; void CMPXCollectionPlaylist::CancelRequest(void) + ?CopyContentL@CMPXCollectionPlaylist@@QAEXABV1@@Z @ 3 NONAME ; void CMPXCollectionPlaylist::CopyContentL(class CMPXCollectionPlaylist const &) + ?Count@CMPXCollectionPlaylist@@QBEHXZ @ 4 NONAME ; int CMPXCollectionPlaylist::Count(void) const + ?EmbeddedPlaylist@CMPXCollectionPlaylist@@QBEHXZ @ 5 NONAME ; int CMPXCollectionPlaylist::EmbeddedPlaylist(void) const + ?ExternalizeL@CMPXCollectionPlaylist@@QBEXAAVRWriteStream@@@Z @ 6 NONAME ; void CMPXCollectionPlaylist::ExternalizeL(class RWriteStream &) const + ?Index@CMPXCollectionPlaylist@@QBEHXZ @ 7 NONAME ; int CMPXCollectionPlaylist::Index(void) const + ?InternalizeL@CMPXCollectionPlaylist@@QAEXAAVRReadStream@@@Z @ 8 NONAME ; void CMPXCollectionPlaylist::InternalizeL(class RReadStream &) + ?Levels@CMPXCollectionPlaylist@@QBEHXZ @ 9 NONAME ; int CMPXCollectionPlaylist::Levels(void) const + ?MediaL@CMPXCollectionPlaylist@@QAEXABV?$TArray@VTMPXAttribute@@@@AAVMMPXCollectionMediaObserver@@@Z @ 10 NONAME ; void CMPXCollectionPlaylist::MediaL(class TArray const &, class MMPXCollectionMediaObserver &) + ?NewL@CMPXCollectionPlaylist@@SAPAV1@AAVRReadStream@@PAVMMPXCollectionPlaylistObserver@@@Z @ 11 NONAME ; class CMPXCollectionPlaylist * CMPXCollectionPlaylist::NewL(class RReadStream &, class MMPXCollectionPlaylistObserver *) + ?NewL@CMPXCollectionPlaylist@@SAPAV1@ABV1@PAVMMPXCollectionPlaylistObserver@@@Z @ 12 NONAME ; class CMPXCollectionPlaylist * CMPXCollectionPlaylist::NewL(class CMPXCollectionPlaylist const &, class MMPXCollectionPlaylistObserver *) + ?NewL@CMPXCollectionPlaylist@@SAPAV1@ABVCMPXCollectionPath@@PAVMMPXCollectionPlaylistObserver@@@Z @ 13 NONAME ; class CMPXCollectionPlaylist * CMPXCollectionPlaylist::NewL(class CMPXCollectionPath const &, class MMPXCollectionPlaylistObserver *) + ?NewL@CMPXCollectionPlaylist@@SAPAV1@XZ @ 14 NONAME ; class CMPXCollectionPlaylist * CMPXCollectionPlaylist::NewL(void) + ?NewL@MMPXCollectionUtility@@SAPAV1@PAVMMPXCollectionObserver@@ABVTUid@@@Z @ 15 NONAME ; class MMPXCollectionUtility * MMPXCollectionUtility::NewL(class MMPXCollectionObserver *, class TUid const &) + ?Next@CMPXCollectionPlaylist@@QAEHH@Z @ 16 NONAME ; int CMPXCollectionPlaylist::Next(int) + ?Path@CMPXCollectionPlaylist@@QBEABVCMPXCollectionPath@@XZ @ 17 NONAME ; class CMPXCollectionPath const & CMPXCollectionPlaylist::Path(void) const + ?Previous@CMPXCollectionPlaylist@@QAEHH@Z @ 18 NONAME ; int CMPXCollectionPlaylist::Previous(int) + ?Remote@CMPXCollectionPlaylist@@QBEHXZ @ 19 NONAME ; int CMPXCollectionPlaylist::Remote(void) const + ?RepeatMode@CMPXCollectionPlaylist@@QBE?AW4TRepeatMode@1@XZ @ 20 NONAME ; enum CMPXCollectionPlaylist::TRepeatMode CMPXCollectionPlaylist::RepeatMode(void) const + ?SetEmbeddedPlaylist@CMPXCollectionPlaylist@@QAEXH@Z @ 21 NONAME ; void CMPXCollectionPlaylist::SetEmbeddedPlaylist(int) + ?SetL@CMPXCollectionPlaylist@@QAEXABVCMPXMedia@@@Z @ 22 NONAME ; void CMPXCollectionPlaylist::SetL(class CMPXMedia const &) + ?SetObserver@CMPXCollectionPlaylist@@QAEXAAVMMPXCollectionMediaObserver@@PAVMMPXCollectionPlaylistObserver@@PAVMMPXCollectionObserver@@@Z @ 23 NONAME ; void CMPXCollectionPlaylist::SetObserver(class MMPXCollectionMediaObserver &, class MMPXCollectionPlaylistObserver *, class MMPXCollectionObserver *) + ?SetRepeatEnabled@CMPXCollectionPlaylist@@QAEXH@Z @ 24 NONAME ; void CMPXCollectionPlaylist::SetRepeatEnabled(int) + ?SetRepeatMode@CMPXCollectionPlaylist@@QAEXW4TRepeatMode@1@@Z @ 25 NONAME ; void CMPXCollectionPlaylist::SetRepeatMode(enum CMPXCollectionPlaylist::TRepeatMode) + ?SetShuffleEnabledL@CMPXCollectionPlaylist@@QAEXH@Z @ 26 NONAME ; void CMPXCollectionPlaylist::SetShuffleEnabledL(int) + ?SetShuffleL@CMPXCollectionPlaylist@@QAEXHH@Z @ 27 NONAME ; void CMPXCollectionPlaylist::SetShuffleL(int, int) + ?SetToFirst@CMPXCollectionPlaylist@@QAEXXZ @ 28 NONAME ; void CMPXCollectionPlaylist::SetToFirst(void) + ?SetToIndex@CMPXCollectionPlaylist@@QAEXH@Z @ 29 NONAME ; void CMPXCollectionPlaylist::SetToIndex(int) + ?SetToLast@CMPXCollectionPlaylist@@QAEXXZ @ 30 NONAME ; void CMPXCollectionPlaylist::SetToLast(void) + ?Shuffle@CMPXCollectionPlaylist@@QBEHXZ @ 31 NONAME ; int CMPXCollectionPlaylist::Shuffle(void) const + ?Invalidate@CMPXCollectionPlaylist@@QAEXXZ @ 32 NONAME ; void CMPXCollectionPlaylist::Invalidate(void) + ?NewL@CMPXCollectionOpenUtility@@SAPAV1@PAVMMPXCollectionObserver@@VTUid@@@Z @ 33 NONAME ; class CMPXCollectionOpenUtility * CMPXCollectionOpenUtility::NewL(class MMPXCollectionObserver *, class TUid) + ?PathL@CMPXCollectionOpenUtility@@QAEPAVCMPXCollectionPath@@XZ @ 34 NONAME ; class CMPXCollectionPath * CMPXCollectionOpenUtility::PathL(void) + ?SetDelay@CMPXCollectionOpenUtility@@QAEXH@Z @ 35 NONAME ; void CMPXCollectionOpenUtility::SetDelay(int) + ?SetDirection@CMPXCollectionOpenUtility@@QAEXW4TDirection@1@@Z @ 36 NONAME ; void CMPXCollectionOpenUtility::SetDirection(enum CMPXCollectionOpenUtility::TDirection) + ?StartL@CMPXCollectionOpenUtility@@QAEXABVCMPXCollectionPath@@V?$TArray@VTMPXAttribute@@@@HHW4TDirection@1@VTMPXAttribute@@@Z @ 37 NONAME ; void CMPXCollectionOpenUtility::StartL(class CMPXCollectionPath const &, class TArray, int, int, enum CMPXCollectionOpenUtility::TDirection, class TMPXAttribute) + ?StartL@CMPXCollectionOpenUtility@@QAEXV?$TArray@VTMPXAttribute@@@@HHW4TDirection@1@VTMPXAttribute@@@Z @ 38 NONAME ; void CMPXCollectionOpenUtility::StartL(class TArray, int, int, enum CMPXCollectionOpenUtility::TDirection, class TMPXAttribute) + ?Stop@CMPXCollectionOpenUtility@@QAEXXZ @ 39 NONAME ; void CMPXCollectionOpenUtility::Stop(void) + ?NextIndex@CMPXCollectionPlaylist@@QBEHHAAH@Z @ 40 NONAME ; int CMPXCollectionPlaylist::NextIndex(int, int &) const + ?PathIndex@CMPXCollectionPlaylist@@QBEHH@Z @ 41 NONAME ; int CMPXCollectionPlaylist::PathIndex(int) const + ?AutoPlay@CMPXCollectionPlaylist@@QBEHXZ @ 42 NONAME ; int CMPXCollectionPlaylist::AutoPlay(void) const + ?IsSingleItemPlaylist@CMPXCollectionPlaylist@@QAEHXZ @ 43 NONAME ; int CMPXCollectionPlaylist::IsSingleItemPlaylist(void) + ?SetAutoPlay@CMPXCollectionPlaylist@@QAEXH@Z @ 44 NONAME ; void CMPXCollectionPlaylist::SetAutoPlay(int) + ?SetSingleItemPlaylist@CMPXCollectionPlaylist@@QAEXXZ @ 45 NONAME ; void CMPXCollectionPlaylist::SetSingleItemPlaylist(void) + ?PreInitPlugin@CMPXCollectionPlaylist@@QBEHXZ @ 46 NONAME ; int CMPXCollectionPlaylist::PreInitPlugin(void) const + ?SetPreInitPlugin@CMPXCollectionPlaylist@@QAEXH@Z @ 47 NONAME ; void CMPXCollectionPlaylist::SetPreInitPlugin(int) + diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionutility/eabi/mpxcollectionutilityU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionutility/eabi/mpxcollectionutilityU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,55 @@ +EXPORTS + _ZN21MMPXCollectionUtility4NewLEP22MMPXCollectionObserverRK4TUid @ 1 NONAME + _ZN22CMPXCollectionPlaylist10SetToFirstEv @ 2 NONAME + _ZN22CMPXCollectionPlaylist10SetToIndexEi @ 3 NONAME + _ZN22CMPXCollectionPlaylist11SetObserverER27MMPXCollectionMediaObserverP30MMPXCollectionPlaylistObserverP22MMPXCollectionObserver @ 4 NONAME + _ZN22CMPXCollectionPlaylist11SetShuffleLEii @ 5 NONAME + _ZN22CMPXCollectionPlaylist12CopyContentLERKS_ @ 6 NONAME + _ZN22CMPXCollectionPlaylist12InternalizeLER11RReadStream @ 7 NONAME + _ZN22CMPXCollectionPlaylist13CancelRequestEv @ 8 NONAME + _ZN22CMPXCollectionPlaylist13SetRepeatModeENS_11TRepeatModeE @ 9 NONAME + _ZN22CMPXCollectionPlaylist16SetRepeatEnabledEi @ 10 NONAME + _ZN22CMPXCollectionPlaylist18SetShuffleEnabledLEi @ 11 NONAME + _ZN22CMPXCollectionPlaylist19SetEmbeddedPlaylistEi @ 12 NONAME + _ZN22CMPXCollectionPlaylist4NewLER11RReadStreamP30MMPXCollectionPlaylistObserver @ 13 NONAME + _ZN22CMPXCollectionPlaylist4NewLERK18CMPXCollectionPathP30MMPXCollectionPlaylistObserver @ 14 NONAME + _ZN22CMPXCollectionPlaylist4NewLERKS_P30MMPXCollectionPlaylistObserver @ 15 NONAME + _ZN22CMPXCollectionPlaylist4NewLEv @ 16 NONAME + _ZN22CMPXCollectionPlaylist4NextEi @ 17 NONAME + _ZN22CMPXCollectionPlaylist4SetLERK9CMPXMedia @ 18 NONAME + _ZN22CMPXCollectionPlaylist6MediaLERK6TArrayI13TMPXAttributeER27MMPXCollectionMediaObserver @ 19 NONAME + _ZN22CMPXCollectionPlaylist8PreviousEi @ 20 NONAME + _ZN22CMPXCollectionPlaylist9SetToLastEv @ 21 NONAME + _ZN22CMPXCollectionPlaylistD0Ev @ 22 NONAME + _ZN22CMPXCollectionPlaylistD1Ev @ 23 NONAME + _ZN22CMPXCollectionPlaylistD2Ev @ 24 NONAME + _ZNK22CMPXCollectionPlaylist10RepeatModeEv @ 25 NONAME + _ZNK22CMPXCollectionPlaylist12ExternalizeLER12RWriteStream @ 26 NONAME + _ZNK22CMPXCollectionPlaylist16EmbeddedPlaylistEv @ 27 NONAME + _ZNK22CMPXCollectionPlaylist4PathEv @ 28 NONAME + _ZNK22CMPXCollectionPlaylist5CountEv @ 29 NONAME + _ZNK22CMPXCollectionPlaylist5IndexEv @ 30 NONAME + _ZNK22CMPXCollectionPlaylist6LevelsEv @ 31 NONAME + _ZNK22CMPXCollectionPlaylist6RemoteEv @ 32 NONAME + _ZNK22CMPXCollectionPlaylist7ShuffleEv @ 33 NONAME + _ZTI22CMPXCollectionPlaylist @ 34 NONAME ; ## + _ZTV22CMPXCollectionPlaylist @ 35 NONAME ; ## + _ZN22CMPXCollectionPlaylist10InvalidateEv @ 36 NONAME + _ZN25CMPXCollectionOpenUtility12SetDirectionENS_10TDirectionE @ 37 NONAME + _ZN25CMPXCollectionOpenUtility4NewLEP22MMPXCollectionObserver4TUid @ 38 NONAME + _ZN25CMPXCollectionOpenUtility4StopEv @ 39 NONAME + _ZN25CMPXCollectionOpenUtility5PathLEv @ 40 NONAME + _ZN25CMPXCollectionOpenUtility6StartLE6TArrayI13TMPXAttributeEiiNS_10TDirectionES1_ @ 41 NONAME + _ZN25CMPXCollectionOpenUtility6StartLERK18CMPXCollectionPath6TArrayI13TMPXAttributeEiiNS_10TDirectionES4_ @ 42 NONAME + _ZN25CMPXCollectionOpenUtility8SetDelayEi @ 43 NONAME + _ZTI25CMPXCollectionOpenUtility @ 44 NONAME ; ## + _ZTV25CMPXCollectionOpenUtility @ 45 NONAME ; ## + _ZNK22CMPXCollectionPlaylist9NextIndexEiRi @ 46 NONAME + _ZNK22CMPXCollectionPlaylist9PathIndexEi @ 47 NONAME + _ZN22CMPXCollectionPlaylist11SetAutoPlayEi @ 48 NONAME + _ZN22CMPXCollectionPlaylist20IsSingleItemPlaylistEv @ 49 NONAME + _ZN22CMPXCollectionPlaylist21SetSingleItemPlaylistEv @ 50 NONAME + _ZNK22CMPXCollectionPlaylist8AutoPlayEv @ 51 NONAME + _ZN22CMPXCollectionPlaylist16SetPreInitPluginEi @ 52 NONAME + _ZNK22CMPXCollectionPlaylist13PreInitPluginEv @ 53 NONAME + diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionutility/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionutility/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2006 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 for project Playback utility. +* +*/ + + + +PRJ_PLATFORMS + +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +mpxcollectionutility.mmp + diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionutility/group/mpxcollectionutility.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionutility/group/mpxcollectionutility.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2006 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: collection utility project specification +* +*/ + + + +#include +#include + +TARGET mpxcollectionutility.dll +CAPABILITY CAP_GENERAL_DLL +TARGETTYPE DLL +UID 0x1000008D 0x101FFC30 +VENDORID VID_DEFAULT + +USERINCLUDE ../inc +USERINCLUDE ../../collectionserver/inc + +MW_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src +SOURCE mpxcollectionutility.cpp +SOURCE mpxcollectionutilityimpl.cpp +SOURCE mpxcollectionplaylist.cpp +SOURCE mpxcollectionopenutility.cpp + +LIBRARY euser.lib +LIBRARY estor.lib +LIBRARY mpxcommon.lib + +#if defined(ARMCC) +deffile ../eabi/ +#elif defined(WINSCW) +deffile ../bwinscw/ +#endif + diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionutility/inc/mpxcollectionutilityimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionutility/inc/mpxcollectionutilityimpl.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,523 @@ +/* +* Copyright (c) 2006 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: Implementation of interface for Collection Utility +* +*/ + + + +#ifndef CMPXCOLLECTIONUTILITY_H +#define CMPXCOLLECTIONUTILITY_H + + +#include +#include +#include +#include + +#include "mpxcollectionserverdefs.h" +#include "mpxcollectionutility.h" + +class CMPXMessageMonitor; +class CMPXTaskQueue; +class CMPXMsgBuf; +class CMPXMedia; + +/** +* Implementation of collection utility interface +*/ +NONSHARABLE_CLASS(CMPXCollectionUtility) : public CActive, + public MMPXCollectionUtility, + public MMPXMessageObserver, + public MMPXCollection + + { +public: + /** + * Two-phased constructor + * + * @param aObs observer + * @param aModeId collection mode id + * @return object of constructed + */ + static CMPXCollectionUtility* NewL(const TUid& aModeId, + MMPXCollectionObserver* aObs); + + /** + * Destructor + */ + ~CMPXCollectionUtility(); + +private: + /** + * C++ constructor + */ + CMPXCollectionUtility(MMPXCollectionObserver* aObs); + + /** + * Second phase constructor + * + * @param aModeId collection mode id + */ + void ConstructL(const TUid& aModeId); + +public: + + /** + * From MMPXCollectionUtility + * The collection. + * + * @return the collection + */ + MMPXCollection& Collection(); + + /** + * From MMPXCollectionUtility + * Retrieves the ID of the collection plugin which matched aUids best. + * If multiple plugins match the aUids, the only one with high priority will + * be returned + * + * @param aUids, selection criteria + * @return TUid containing the implementation UID of the collection that + * would be selected + */ + TUid CollectionIDL(const TArray& aUids); + + /** + * From MMPXCollectionUtility + * Frees up client side resources only; a collection is freed when there are no + * clients using it, and all resources are freed when the last client closes + */ + void Close(); + + /** + * From MMPXCollection + * Opens the collection in its current state + * + * Calls back MMPXCollectionObserver::HandleOpenL() with CMPXMedia object + * with ID KMPXMediaIdContainer, i.e.contains other media objects + * + * @param aMode, open mode + */ + + void OpenL(TMPXOpenMode aMode=EMPXOpenDefault); + + /** + * From MMPXCollection + * Opens the collection at a specific index + * + * Calls back MMPXCollectionObserver::HandleOpenL() with CMPXMedia object + * with ID KMPXMediaIdContainer, i.e.contains other media objects + * + * @param aIndex, the index into the currently opened item list + * @param aMode, type of open mode + */ + void OpenL(TInt aIndex,TMPXOpenMode aMode=EMPXOpenDefault); + + /** + * From MMPXCollection + * Opens the collection at a specific level + * + * @param aPath, the path of the collection + * @param aMode, open mode + * + * Calls back MMPXCollectionObserver::HandleOpenL() + */ + void OpenL(const CMPXCollectionPath& aPath, + TMPXOpenMode aMode=EMPXOpenDefault); + + /** + * From MMPXCollection + * Opens the collection at a specific index + * + * Calls back MMPXCollectionObserver::HandleOpenL() with CMPXMedia object + * with ID KMPXMediaIdContainer, i.e.contains other media objects which will + * contain the attribute values specified by aAttrs + * + * @param aIndex, the index into the currently opened item list + * @param aAttrs, attributes requested. + * @param aMode, type of open mode + */ + void OpenL(TInt aIndex,const TArray& aAttrs, + TMPXOpenMode aMode=EMPXOpenDefault); + + /** + * From MMPXCollection + * Opens the collection at a specific level + * + * Calls back MMPXCollectionObserver::HandleOpenL() with CMPXMedia object + * with ID KMPXMediaIdContainer, i.e.contains other media objects which will + * contain the attribute values specified by aAttrs + * + * @param aPath, the path of the collection + * @param aAttrs, attributes requested. + * @param aMode, type of open mode required + */ + void OpenL(const CMPXCollectionPath& aPath, + const TArray& aAttrs, + TMPXOpenMode aMode=EMPXOpenDefault); + + /** + * From MMPXCollection + * Opens the collection with a list of implementation uids to be matched. + * if current context matches the criteria, it will return existing browsing + * media; otherwise it will be back to root level and only plug-ins which + * match all provided uids will be returned, in priority order. + * + * Calls back MMPXCollectionObserver::HandleOpenL() with CMPXMedia object + * with ID KMPXMediaIdContainer. Returned plugins will be sorted by plugin + * priority if mulitple plugins support aUids. + * + * @param aUids, array of UIDs used to select collection plugins based on + * supported uids in plugin resource file. + * @param aMode, open mode + */ + void OpenL(const TArray& aUids, + TMPXOpenMode aMode=EMPXOpenDefault); + + /** + * From MMPXCollection + * Opens the collection with an uid to be matched. + * if current context matches the criteria, it will return existing browsing + * media; otherwise it will be back to root level and only plug-ins which + * match the uid will be returned, in priority order. + * + * Calls back MMPXCollectionObserver::HandleOpenL() with CMPXMedia object + * with ID KMPXMediaIdContainer. Returned plugins will be sorted by plugin + * priority if mulitple plugins support the uid. + * + * @param aUid, single UID used to select a collection + * @param aMode, open mode + */ + void OpenL(const TUid& aUid, + TMPXOpenMode aMode=EMPXOpenDefault); + + /** + * From MMPXCollection + * Apply a filter to collection browsing; all subsequent calls + * to OpenL() will have this filter applied. + * + * @param aFilter, the filter to apply, or NULL to remove current + * filter + */ + void SetFilterL(CMPXFilter* aFilter); + + /** + * From MMPXCollection + * Current filter that is applied to collection browsing, i.e. results + * returned through MMPXCollectionObserver::HandleOpenL() callback from + * OpenL() + * + * @return filter applied to browsing, or NULL if no filter applied + */ + CMPXFilter* FilterL(); + + /** + * From MMPXCollection + * Returns current collection plugin implementation UID + * + * @return UID of the collection + */ + TUid UidL() const; + + /** + * From MMPXCollection + * The path of the collection in its current state + * + * @return the path of the collection + */ + CMPXCollectionPath* PathL(); + + /** + * From MMPXCollection + * Navigates back to the container of the current items + * Calls back MMPXCollectionObserver::HandleOpenL() + */ + void BackL(); + + /** + * From MMPXCollection + * Is this path on a 'remote' collection + * + * @aParam aPath, the collection path + * @return ETrue if is remote collection, otherwise EFalse + */ + TBool IsRemote(const CMPXCollectionPath& aPath); + + /** + * From MMPXCollection + * Stops any async operations that are currently under way + */ + void CancelRequest(); + + /** + * From MMPXCollection + * Adds item(s) to the collection + * + * @param aNewProperties, Properties of the item + */ + void AddL(const CMPXMedia& aNewProperties); + + /** + * From MMPXCollection + * Remove an item (or items under a group) from the collection + * + * @param aPath, item(s) to remove + * @param aObs, observer callback for items deleted (Optional) + */ + void RemoveL(const CMPXCollectionPath& aPath, + MMPXCollectionRemoveObserver* aObs = NULL ); + + /** + * From MMPXCollection + * Removes item(s) to the collection + * + * @param aProperties, Properties of the item + */ + void RemoveL(const CMPXMedia& aProperties); + + /** + * From MMPXCollection + * + * Sets/updates the media for the item + * Callback via EMediaChanged message if currently opened + * + * @param aMedia, updated item + * + */ + void SetSyncL(const CMPXMedia& aMedia); + + /** + * From MMPXCollection + * + * Sets/updates the media for the item, Asynchronous + * Callback via HandleCollectionMessage, AsyncOp complete + * + * @param aMedia, new value + * + */ + void SetL(const CMPXMedia& aMedia); + + /** + * Find a list of media properties based on a search criteria + * The types of supported "queries" are plugin dependent + * + * @param aMedia, criteria to search on + * @param aAttrs, attributes to return + * @param aObs, observer for find callback + * Callback via MMPXCollectionFindObserver::HandleFindL(); + */ + void FindAllL(const CMPXMedia& aMedia, + const TArray& aAttrs, + MMPXCollectionFindObserver& aObs); + + /** + * Find a list of media properties based on a search criteria + * The types of supported "queries" are plugin dependent + * This is a SYNCHRONOUS METHOD, use only if necessary. + * @param aMedia, criteria to search on + * @param aAttrs, attributes to return + */ + CMPXMedia* FindAllL(const CMPXMedia& aMedia, + const TArray& aAttrs); + + /** + * From MMPXCollection + * Retrieve media for the item specified in the path + * Note: if selection is set in aPath, HandleMedia will return an array of + * media of current selected items. + * if no selection is set in aPath, HandleMedia will return media + * properities of current item. + * + * @param aPath, the path of the collection + * @param aAttrs, attributes requested. + * @aParam aSpecs, specifications for attributes + * @param aFilter, filter to apply + * + * Calls back MMPXCollectionObserver::HandleMediaL() + */ + void MediaL(const CMPXCollectionPath& aPath, + const TArray& aAttrs, + CMPXAttributeSpecs* aSpecs=NULL, + CMPXFilter* aFilter=NULL); + + /** + * From MMPXCollection + * Broadcasts an event to all observers + * @param aMsg event to broadcast + * @param aData data to accompany the event + */ + void NotifyL( TMPXCollectionBroadCastMsg aMsg, TInt aData ); + + /** + * From MMPXCollection + * Send a Command to the collection server + * aCmd, command to handle + * aData, some data about event (event specific, optional) + */ + void CommandL(TMPXCollectionCommand aCmd, TInt aData = 0); + + /** + * From MMPXCollection + * Send a command to the collection server + * + * @param aCmd, command to handle + */ + void CommandL(CMPXCommand& aCmd); + + /** + * From MMPXCollection + * Retrieves the set of supported file types + * @param aArray Array to fill with the data + */ + void GetSupportedTypesL( RPointerArray& aArray ); + + /** + * From MMPXCollection + * Retrieves the capabilities for the current collection context + * @arg aCapability, bitmask of the capabilities supported. + */ + void GetSupportedCapabilitiesL(TCollectionCapability& aCapability); + + /** + * From MMPXCollection + * Retrieves the real collection UID based on a predefined UID + * @param aCollection, UID for lookup, defined in "mpxcollectionframeworkdefs.h" + * @return TUid containing the real implementation UID + */ + TUid CollectionIDL(TUid& aCollection); + + /** + * From MMPXCollection + * Adds a message subscription for this client. + * @param aSubscription subscription to be added + */ + void AddSubscriptionL(const CMPXSubscription& aSubscription); + + /** + * From MMPXCollection + * Removes a message subscription for this client. + * @param aSubscription subscription to be removed. + */ + void RemoveSubscriptionL(const CMPXSubscription& aSubscription); + + /** + * From MMPXCollection + * Removes all message subscriptions for this client. + */ + void ClearSubscriptionsL(); + + /** + * From MMPXMessageObserver + * Message received + * @param aMsgData message data + * @param aError error code + */ + void MessageReceived(TInt aMsgData, TInt aError); + + /** + * From CActive + * Handles an active object's request completion event + */ + void RunL(); + + /** + * From CActive + * Implements cancellation of an outstanding request. + */ + void DoCancel(); + + /** + * From CActive + * Handles a leave occurring in the request completion event handler RunL() + * + * @param aError error code + */ + TInt RunError(TInt aError); + +private: + + /** + * Add a request to the task queue and run the next queue if no outstanding + * task + * + * @param aFunction function code + * @param aObs, observer to callback asynchronously + * @param aParamData data + * @param aBuf, extra data in buffer, ownership transferred. + * @param aPtr, pointer to a object + * @param aAlivePtr1, object to keep alive for a task + ownership transferred + * @param aAlivePtr2, same as aAlivePtr1 + */ + void AddRequestL(TMPXCollectionServerOp aFunction, + TAny* aObs, + TInt aParamData=0, + CBufBase* aBuf=NULL, + TAny* aPtr=NULL, + CBase* aAlivePtr1=NULL, + CBase* aAlivePtr2=NULL); + + /** + * Send next request to server + */ + void ExecuteNextRequest(); + + /** + * Handle message from message queue + * @param aMsgData message data + * @param aError error code + */ + void HandleMessageL(TInt aMsgData, TInt aError); + + /** + * Handles error in RunL + * + * @param aError error code + */ + void HandleRunErrorL(TInt aError); + +#ifdef _ENABLE_GUARD_TIMER + /** + * Gaurd timer callback + * + * @param aPtr pointer the this + */ + static TInt GuardTimerCallback(TAny* aPtr); +#endif + +private: + MMPXCollectionObserver* iObserver; + CMPXMessageMonitor* iMsgMonitor; + CMPXTaskQueue* iTaskQueue; + RMPXSession iMcs; + CMPXMedia* iCurrentEntries; + + CBufBase* iBuffer; + CArrayFixBase* iArray; + TPckgBuf iSizePckg; + TPckgBuf iSelectionPckg; + TPckgBuf iCompletePckg; + TPckgBuf iPropertiesSizePckg; + TInt iSelection; + TBool iCallbackOngoing; // is client processing callback? + // Keep alive pointers on global heap + CMPXMedia* iMedia; + CMPXMedia* iMediaOnError; // media object while handling error +#ifdef _ENABLE_GUARD_TIMER + CPeriodic* iGuardTimer; //guard timer for async request +#endif + }; + +#endif // CMPXCOLLECTIONUTILITY_H diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionutility/src/mpxcollectionopenutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionutility/src/mpxcollectionopenutility.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,969 @@ +/* +* Copyright (c) 2007 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: Incremental OpenL() utility +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mpxcollectionopenutility.h" +#include + +// CONSTANTS +const TInt KArrayGranularity = 5; + +// --------------------------------------------------------------------------- +// static function to compare two datablock items +// used for sorting datablocks +// --------------------------------------------------------------------------- +// +static TInt CompareAsc( const TMPXOpenDataBlock& aFirst, + const TMPXOpenDataBlock& aSecond ) + { + return aFirst.iOffset > aSecond.iOffset; + } + +// --------------------------------------------------------------------------- +// static function to compare two datablock items +// used for sorting datablocks +// --------------------------------------------------------------------------- +// +static TInt CompareDsc( const TMPXOpenDataBlock& aFirst, + const TMPXOpenDataBlock& aSecond ) + { + return aFirst.iOffset < aSecond.iOffset; + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CMPXCollectionOpenUtility::CMPXCollectionOpenUtility( MMPXCollectionObserver* aObs, + TUid aMode ) + : iFetchStep(EFetchNone), + iObs( aObs ), + iIncrementalChunks(KArrayGranularity), + iMode( aMode ) + + { + } + + +// --------------------------------------------------------------------------- +// 2nd Phase Constructor +// --------------------------------------------------------------------------- +// +void CMPXCollectionOpenUtility::ConstructL() + { + iTimer = CPeriodic::NewL( CActive::EPriorityStandard ); + } + + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXCollectionOpenUtility* CMPXCollectionOpenUtility::NewL( + MMPXCollectionObserver* aObs, + TUid aMode ) + { + CMPXCollectionOpenUtility* self = + new( ELeave ) CMPXCollectionOpenUtility( aObs, aMode ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CMPXCollectionOpenUtility::~CMPXCollectionOpenUtility() + { + if( iCollection ) + { + iCollection->Close(); + } + + if( iTimer ) + { + iTimer->Cancel(); + delete iTimer; + } + + iIncrementalChunks.Close(); + delete iPath; + delete iMedia; + } + +// --------------------------------------------------------------------------- +// Start the incremental fetching operation +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionOpenUtility::StartL( TArray /*aAttrs*/, + TInt aChunkSize, + TInt aOffset, + TDirection aDirection, + TMPXAttribute aKeyAttribute ) + { + // Assert we are idle + ASSERT( iFetchStep == EFetchNone ); + MPX_DEBUG1("CMPXCollectionOpenUtility::StartL <---"); + // Copy the operation data + iFetchInfo.iSize = aChunkSize; + iFetchInfo.iOffset = aOffset; + iFetchDirection = aDirection; + iKeyAttribute = aKeyAttribute; + iData = NULL; + delete iMedia; + iMedia = NULL; + delete iPath; + iPath = NULL; + // Start reading + iFetchStep = EFetchCount; + RunNext(); + MPX_DEBUG1("CMPXCollectionOpenUtility::StartL --->"); + } + +// --------------------------------------------------------------------------- +// Start the incremental fetching operation +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionOpenUtility::StartL( const CMPXCollectionPath& aPath, + TArray /*aAttrs*/, + TInt aChunkSize, + TInt aOffset, + TDirection aDirection, + TMPXAttribute aKeyAttribute ) + { + // Assert we are idle and isolated mode + MPX_ASSERT( iFetchStep == EFetchNone ); + MPX_ASSERT( iMode == KMcModeIsolated || iMode == KMcModePlaylist ); + MPX_DEBUG1("CMPXCollectionOpenUtility::StartL aPath <---"); + if( !iCollection ) + { + iCollection = MMPXCollectionUtility::NewL( this, iMode ); + } + + // Copy the operation data + MPX_DEBUG_PATH( aPath ); + iFetchInfo.iSize = aChunkSize; + iFetchInfo.iOffset = aOffset; + iFetchDirection = aDirection; + iKeyAttribute = aKeyAttribute; + iData = NULL; + delete iMedia; + iMedia = NULL; + + delete iPath; + iPath = NULL; + iPath = CMPXCollectionPath::NewL( aPath ); + + // Start the fetch operation by setting up the context + // to the correct path + // + iFetchStep = EFetchPath; + RunNext(); + + MPX_DEBUG1("CMPXCollectionOpenUtility::StartL --->"); + } + +// --------------------------------------------------------------------------- +// Stop the incremental fetching operation +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionOpenUtility::Stop() + { + // Cancel all outstanding collection open requests + MPX_DEBUG1("CMPXCollectionOpenUtility::Stop <---"); + if( iCollection ) + { + iCollection->Collection().CancelRequest(); + } + iTimer->Cancel(); + iIncrementalChunks.Reset(); + delete iMedia; + iMedia = NULL; + iData = NULL; + iFetchStep = EFetchNone; + MPX_DEBUG1("CMPXCollectionOpenUtility::Stop --->"); + } + +// --------------------------------------------------------------------------- +// Set the direction of the incremental fetching algorithm +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionOpenUtility::SetDirection( TDirection aDirection ) + { + iFetchDirection = aDirection; + + if( iFetchStep == EFetchItems || iFetchStep == EFetchCommand ) + { + TBool skipFirst = iFetchStep == EFetchCommand ? ETrue : EFalse; + + if( iFetchDirection == EFetchDown ) + { + DoSortAscend( skipFirst ); + } + else if( iFetchDirection == EFetchUp ) + { + DoSortDescend( skipFirst ); + } + else if( iFetchDirection == EFetchNormal ) + { + TRAP_IGNORE( DoSortNormalL( skipFirst ) ); + } + } + } + +// --------------------------------------------------------------------------- +// Set the fetching delay +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionOpenUtility::SetDelay( TInt aDelay ) + { + iFetchDelay = aDelay; + } + +// --------------------------------------------------------------------------- +// Get the current path +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXCollectionPath* CMPXCollectionOpenUtility::PathL() + { + CMPXCollectionPath* p(NULL); + + if( iCollection ) + { + p = iCollection->Collection().PathL(); + } + return p; + } + +// --------------------------------------------------------------------------- +// Handle Collection Message +// --------------------------------------------------------------------------- +// +void CMPXCollectionOpenUtility::HandleCollectionMessage(CMPXMessage* aMsg, TInt aErr) + { + if( aErr == KErrNone && aMsg ) + { + TRAP_IGNORE( DoHandleCollectionMessageL( *aMsg ) ); + } + } + + // --------------------------------------------------------------------------- + // HandleOpenL + // --------------------------------------------------------------------------- + // +void CMPXCollectionOpenUtility::HandleOpenL(const CMPXMedia& aEntries, + TInt aIndex, + TBool aComplete, + TInt aError) + { + if( iFetchStep == EFetchCount ) + { + DoHandleCountL( aEntries, aIndex, aError ); + } + else if( iFetchStep == EFetchItems ) + { + DoHandleFetchItemsL( aEntries, aIndex, aError ); + } + else + { + MPX_DEBUG1("CMPXCollectionOpenUtility::HandleOpenL EFetchPath/EFetchNone"); + iFetchStep = EFetchNone; + iObs->HandleOpenL( aEntries, aIndex, aComplete, aError ); + } + } + + // --------------------------------------------------------------------------- + // HandleOpenL + // --------------------------------------------------------------------------- + // +void CMPXCollectionOpenUtility::HandleOpenL(const CMPXCollectionPlaylist& aPlaylist, + TInt aError) + { + iObs->HandleOpenL( aPlaylist, aError ); + } + + // --------------------------------------------------------------------------- + // Handle Command Complete + // --------------------------------------------------------------------------- + // +void CMPXCollectionOpenUtility::HandleCommandComplete(CMPXCommand* aCommandResult, + TInt aError ) + { + // Continue fetching items + iFetchStep = EFetchItems; + TRAP_IGNORE( DoHandleCommandCompleteL( *aCommandResult, aError ) ); + } + + // --------------------------------------------------------------------------- + // Handle Collection Media + // --------------------------------------------------------------------------- + // +void CMPXCollectionOpenUtility::HandleCollectionMediaL(const CMPXMedia& /*aMedia*/, + TInt /*aError*/) + { + // Do Nothing + } + +// --------------------------------------------------------------------------- +// Handle Collection Messages +// --------------------------------------------------------------------------- +// +void CMPXCollectionOpenUtility::DoHandleCollectionMessageL( const CMPXMessage& aMsg ) + { + TMPXMessageId id( aMsg.ValueTObjectL( KMPXMessageGeneralId ) ); + if ( KMPXMessageGeneral == id && + iFetchStep == EFetchPath ) + { + TInt event( aMsg.ValueTObjectL( KMPXMessageGeneralEvent ) ); + TInt type( aMsg.ValueTObjectL( KMPXMessageGeneralType ) ); + TInt data( aMsg.ValueTObjectL( KMPXMessageGeneralData) ); + if ( event == TMPXCollectionMessage::EPathChanged && + type == EMcPathChangedByOpen ) + { + MPX_DEBUG1("CMPXCollectionOpenUtility::DoHandleCollectionMessageL -- path opened"); + + if( data == EMcContainerOpened) + { + iFetchStep = EFetchCount; + RunNext(); + } + else if( data == EMcItemOpened ) // only 2 cases + { + // Playlist, simply forward back to the observer + iCollection->Collection().OpenL(); + iFetchStep = EFetchNone; + } + } + } + } + +// --------------------------------------------------------------------------- +// Handle Command complete +// --------------------------------------------------------------------------- +// +void CMPXCollectionOpenUtility::DoHandleCommandCompleteL(CMPXCommand& /*aCommandResult*/, + TInt aError) + { + if( iSelecting ) + { + iSelecting = EFalse; + } + else if( aError == KErrNone ) + { + // Get the data to return to the client, callback at HandleOpen() + // + // Implemented because the command tells the plugin to fetch the + // next block of data. However, the actual media object containing + // the current browse data may have been re-allocated. We cannot + // assume that the data pointer remains the same. Therefore, it is + // safer to refetch the data from the collection via OpenL() + // This call should be FAST because the data has already been read at this point + // + MPX_DEBUG1("CMPXCollectionOpenUtility::HandleCommandComplete OpenL <---"); + if( iIncrementalChunks.Count() == 1 || iFirstOpen ) + { + DoSelectIndexL(); + } + iCollection->Collection().OpenL(); + } + else if( aError == KErrNotReady ) + { + // Cache was deleted, need to restart the fetching operation + Stop(); + iFetchStep = EFetchCount; + iCollection->Collection().OpenL(); + } + else // aError != KErrNone + { + // Error occured, such as not supported + MPX_DEBUG2("CMPXCollectionOpenUtility::HandleCommandComplete Error %i <---", aError); + iFetchStep = EFetchNone; + + CMPXMedia* temp = CMPXMedia::NewL(); + CleanupStack::PushL( temp ); + iObs->HandleOpenL( *temp, 0, ETrue, aError ); + CleanupStack::PopAndDestroy( temp ); + } + } + +// --------------------------------------------------------------------------- +// Fetch count step +// --------------------------------------------------------------------------- +// +void CMPXCollectionOpenUtility::DoFetchCountL() + { + if( !iCollection ) + { + iCollection = MMPXCollectionUtility::NewL( this, iMode ); + } + + // Ask for the total item count + // Cache current iPath + delete iPath; + iPath = NULL; + iPath = iCollection->Collection().PathL(); + + iCollection->Collection().OpenL(); + } + +// --------------------------------------------------------------------------- +// Handle the count step +// --------------------------------------------------------------------------- +// +void CMPXCollectionOpenUtility::DoHandleCountL(const CMPXMedia& aEntries, + TInt aIndex, + TInt aError) + { + ASSERT( iFetchStep == EFetchCount ); + + MPX_DEBUG2("CMPXCollectionOpenUtility::DoHandleCountL error %i <---", aError); + TBool done(EFalse); + if( aError == KErrNone ) + { + // Do we support incremental for this OpenL()? + // + TBool supportIncremental(EFalse); + if( aEntries.IsSupported( KMPXCollectionOpenLSupportsIncremental ) ) + { + supportIncremental = aEntries.ValueTObjectL( + KMPXCollectionOpenLSupportsIncremental ); + } + + if( supportIncremental ) + { + TInt count(0); + if( aEntries.IsSupported(KMPXMediaArrayCount) ) + { + count = aEntries.ValueTObjectL(KMPXMediaArrayCount); + } + + if( iFetchInfo.iOffset == KErrNotFound ) + { + // If the client did not specify an offset + // we use the index the collection is pointing to + // as the starting offset + // + iFetchInfo.iOffset = aIndex; + } + if( count > 0 ) + { + // Perform the chunking here + DoSetupChunksL( count ); + DoCompactTaskListL( aEntries ); + + MPX_DEBUG2("CMPXCollectionOpenUtility::DoHandleCountL count %i", iIncrementalChunks.Count() ); + if( iIncrementalChunks.Count() ) + { + // Start running the fetching algorithm + iFetchStep = EFetchItems; + iFirstOpen = ETrue; + + // Sync up the path, as there could have been items deleted + delete iPath; + iPath = NULL; + iPath = iCollection->Collection().PathL(); + + if( iObs ) + { + iObs->HandleOpenL( aEntries, aIndex, EFalse, aError ); + } + RunNext(); + } + else + { + // Update index before returning + DoSelectIndexL(); + iFetchStep = EFetchNone; + iCollection->Collection().OpenL(); + done = EFalse; + } + } + else + { + done = ETrue; + } + } + else // !supportIncremental + { + // Just return the results + // + MPX_DEBUG1("CMPXCollectionOpenUtility::DoHandleCountL incremental not supported"); + done = ETrue; + } + + } + if( (aError != KErrNone) || done ) + { + // Stop the OpenL() operation + iFetchStep = EFetchNone; + if( iObs ) + { + iObs->HandleOpenL( aEntries, aIndex, ETrue, aError ); + } + } + } + +// --------------------------------------------------------------------------- +// Fetch items step +// --------------------------------------------------------------------------- +// +void CMPXCollectionOpenUtility::DoFetchItemsL() + { + // Construct a command to fetch the next chunk + // + MPX_DEBUG1("CMPXCollectionOpenUtility::DoFetchItemsL <---" ); + if( iIncrementalChunks.Count() > 0 ) + { + CMPXCommand* command = CMPXCommand::NewL(); + CleanupStack::PushL( command ); + + // Construct the command + // + TInt colId( iPath->Id(0) ); + TInt offset( iIncrementalChunks[0].iOffset ); + command->SetTObjectValueL( KMPXCommandGeneralId, + KMPXCommandIdIncrementalOpenL ); + command->SetTObjectValueL( KMPXCommandGeneralCollectionId, + colId ); + command->SetCObjectValueL(KMPXCollectionCommandIdIncOpenLPath,iPath ); + command->SetTObjectValueL(KMPXCollectionCommandIdIncOpenLOffset, + offset ); + command->SetTObjectValueL(KMPXCollectionCommandIdIncOpenLNumItems, iFetchInfo.iSize); + + // If some partial data is available + // try to optimize this by using the ascending or decending keys + // + if( iData ) + { + if( offset-1 > 0 && offset-1 < iData->Count() && + iData->AtL(offset-1)->IsSupported(iKeyAttribute) ) + { + command->SetTObjectValueL(KMPXCollectionCommandIdIncOpenLAscDsc, EReadAscending); + const TDesC& key = iData->AtL(offset-1)->ValueText(iKeyAttribute); + command->SetTextValueL(KMPXCollectionCommandIdIncOpenLKeyItem,key); + } + else if( offset+iFetchInfo.iSize < iData->Count() && + iData->AtL(offset+iFetchInfo.iSize)->IsSupported(iKeyAttribute) ) + { + command->SetTObjectValueL(KMPXCollectionCommandIdIncOpenLAscDsc, EReadDescending); + const TDesC& key = iData->AtL(offset+iFetchInfo.iSize)->ValueText(iKeyAttribute); + command->SetTextValueL(KMPXCollectionCommandIdIncOpenLKeyItem,key); + } + } + + // Command sent to the collection, callback HandleCommandComplete() + // + MPX_DEBUG2("CMPXCollectionOpenUtility::DoFetchItemsL offset %i <---", offset ); + iFetchStep = EFetchCommand; + iCollection->Collection().CommandL( *command ); + CleanupStack::PopAndDestroy( command ); + } + MPX_DEBUG1("CMPXCollectionOpenUtility::DoFetchItemsL --->" ); + } + +// --------------------------------------------------------------------------- +// Handle Completion of fetch items step +// --------------------------------------------------------------------------- +// +void CMPXCollectionOpenUtility::DoHandleFetchItemsL( const CMPXMedia& aEntries, + TInt aIndex, + TInt aError ) + { + MPX_DEBUG1("CMPXCollectionOpenUtility::DoHandleFetchItemsL <---" ); + // Task is done, and compact the list + // + TInt curOffset(0); + if( iIncrementalChunks.Count() ) + { + curOffset = iIncrementalChunks[0].iOffset; + iIncrementalChunks.Remove(0); + DoCompactTaskListL( aEntries ); + } + else + { + MPX_DEBUG1("CMPXCollectionOpenUtility::DoHandleFetchItemsL No more chunks" ); + } + + TBool complete = iIncrementalChunks.Count() == 0 ? ETrue : EFalse; + + // Keep a reference here + // + delete iMedia; + iMedia = NULL; + iMedia = CMPXMedia::NewL( aEntries ); + iData = NULL; + if( aEntries.IsSupported( KMPXMediaArrayContents ) ) + { + iData = aEntries.Value( KMPXMediaArrayContents ); + User::LeaveIfNull(iData); + } + + // Run the next step of the fetching algorithm + // Do not run if stopped + // + TInt count(iIncrementalChunks.Count()); + if( count != 0 && iFetchStep != EFetchNone ) + { + // Update the path, as the item IDs will be filled + // + MPX_DEBUG2("CMPXCollectionOpenUtility::DoHandleFetchItemsL run next %i", count ); + delete iPath; + iPath = NULL; + iPath = iCollection->Collection().PathL(); + + // Command to fetch next chunk + // + RunNext(); + } + else + { + // All done + iFetchStep = EFetchNone; + } + + // Callback to observer with some treshold to avoid over redrawing + // Playlists need every handle open to update the path + // + if( iObs && + (Abs(aIndex-curOffset) < iFetchInfo.iSize || + iFirstOpen || iMode == KMcModePlaylist || complete ) ) + { + iFirstOpen = EFalse; + MPX_DEBUG1("CMPXCollectionOpenUtility::DoHandleFetchItemsL callback" ); + iObs->HandleOpenL( aEntries, aIndex, complete, aError ); + } + + MPX_DEBUG1("CMPXCollectionOpenUtility::DoHandleFetchItemsL -->" ); + } + +// --------------------------------------------------------------------------- +// Run the next step +// --------------------------------------------------------------------------- +// +void CMPXCollectionOpenUtility::RunNext() + { + TCallBack cb( Callback,this ); + iTimer->Cancel(); + iTimer->Start( TTimeIntervalMicroSeconds32( iFetchDelay ), + TTimeIntervalMicroSeconds32( iFetchDelay ), + cb); + } + +// --------------------------------------------------------------------------- +// Set some callback +// --------------------------------------------------------------------------- +// +TInt CMPXCollectionOpenUtility::Callback( TAny* aAny ) + { + TRAP_IGNORE( ((CMPXCollectionOpenUtility*)aAny)->HandleCallbackL() ); + return ETrue; + } + +// --------------------------------------------------------------------------- +// HandleCallback from iTimer +// --------------------------------------------------------------------------- +// +void CMPXCollectionOpenUtility::HandleCallbackL() + { + switch( iFetchStep ) + { + case EFetchPath: + { + iCollection->Collection().OpenL( *iPath ); + break; + } + case EFetchCount: + { + DoFetchCountL(); + break; + } + case EFetchItems: + { + DoFetchItemsL(); + break; + } + case EFetchNone: + { + break; // do nothing + } + default: + { + MPX_ASSERT(0); + break; + } + } + // Run once only + iTimer->Cancel(); + } + +// --------------------------------------------------------------------------- +// Setup the chunks +// --------------------------------------------------------------------------- +// +void CMPXCollectionOpenUtility::DoSetupChunksL( TInt aCount ) + { + // Number of chunks we are going to have + // And the chunk the offset is going to be at + // + iIncrementalChunks.Reset(); + + TInt numChunks(0); + if( aCount > 0 ) + { + // Truncate and add 1 if any modulus, no Ceil() function + numChunks = (TInt)aCount/iFetchInfo.iSize; + if( aCount % iFetchInfo.iSize ) + { + numChunks++; + } + } + TInt offSetChunk = (TInt) iFetchInfo.iOffset / iFetchInfo.iSize ; + + // First chunk + TMPXOpenDataBlock chunk; + chunk.iOffset = offSetChunk*iFetchInfo.iSize; + chunk.iSize = iFetchInfo.iSize; + iIncrementalChunks.AppendL( chunk ); + + // Left and right of the first chunk + TInt left = offSetChunk-1; + TInt right = offSetChunk+1; + TInt count(numChunks-1); + while( count > 0 ) + { + // Append Left Chunk + // + TInt temp(left); + if( left < 0 ) + { + // Wrap around to end of the list + temp = numChunks + left; + } + chunk.iOffset = temp*iFetchInfo.iSize; + iIncrementalChunks.AppendL( chunk ); + MPX_DEBUG2("Adding Chunk %i", temp); + + count--; + left--; + + // Append Right Chunk + if( temp != right%numChunks ) + { + chunk.iOffset = (right%numChunks)*iFetchInfo.iSize; + iIncrementalChunks.AppendL( chunk ); + MPX_DEBUG2("Adding Chunk %i", right%numChunks); + + count--; + right++; + } + } + + // Set the direction and re-order as necessary + SetDirection( iFetchDirection ); + } + +// --------------------------------------------------------------------------- +// Sort the internal array ascending +// --------------------------------------------------------------------------- +// +void CMPXCollectionOpenUtility::DoSortAscend( TBool aSkipFirst ) + { + if( iIncrementalChunks.Count() > 0 ) + { + TMPXOpenDataBlock tmp; + if( aSkipFirst ) + { + tmp = iIncrementalChunks[0]; + iIncrementalChunks.Remove(0); + } + iIncrementalChunks.Sort( CompareAsc ); + + if( aSkipFirst ) + { + iIncrementalChunks.Insert( tmp, 0 ); + } + } + +#ifdef _DEBUG + TInt c=iIncrementalChunks.Count(); + for( TInt i=0; i 0 ) + { + TMPXOpenDataBlock tmp; + if( aSkipFirst ) + { + tmp = iIncrementalChunks[0]; + iIncrementalChunks.Remove(0); + } + iIncrementalChunks.Sort( CompareDsc ); + + if( aSkipFirst ) + { + iIncrementalChunks.Insert( tmp, 0 ); + } + } + +#ifdef _DEBUG + TInt c=iIncrementalChunks.Count(); + for( TInt i=0; i temp; + CleanupClosePushL( temp ); + + TBool start = aSkipFirst ? 1:0; + TInt count( iIncrementalChunks.Count() ); + TInt c(count); + if( aSkipFirst ) + { + temp.AppendL( iIncrementalChunks[0] ); + count--; + } + + TInt left(iIncrementalChunks.Count()/2); + TInt right = left+1; + while( count > 0) + { + if( left>=start ) + { + temp.AppendL( iIncrementalChunks[left] ); + left--; + count--; + } + if( right datablocks; + CleanupClosePushL( datablocks ); + + TInt c( iIncrementalChunks.Count() ); + + if( aMedia.IsSupported(KMPXCollectionOpenLAllResultRange) ) + { + // De-serialize from global data + // + const TDesC& buf = aMedia.ValueText(KMPXCollectionOpenLAllResultRange); + CBufBase* buffer(NULL); + MPXUser::CreateBufferL( buf, buffer ); + CleanupStack::PushL( buffer ); + ::CreateFromBufferL( *buffer, datablocks ); + CleanupStack::PopAndDestroy( buffer ); + + // Remove un-necessary fetches + TInt c2( datablocks.Count() ); + for( TInt i=c-1; i>=0; --i ) + { + TMPXOpenDataBlock& chunk = iIncrementalChunks[i]; + for( TInt j=0; j= b.iOffset && + chunk.iOffset+chunk.iSize <= b.iOffset+b.iSize ) + { + // Don't need to fetch what is already + // available + // + iIncrementalChunks.Remove( i ); + break; + } + } + } + } + + CleanupStack::PopAndDestroy( &datablocks ); + } + +// --------------------------------------------------------------------------- +// Update the selection index +// --------------------------------------------------------------------------- +// +void CMPXCollectionOpenUtility::DoSelectIndexL() + { + CMPXCommand* command = CMPXCommand::NewL(); + CleanupStack::PushL( command ); + + // Construct the command + // + command->SetTObjectValueL( KMPXCommandGeneralId, + KMPXCommandIdCollectionSelect ); + iCollection->Collection().CommandL( *command ); + iSelecting = ETrue; + CleanupStack::PopAndDestroy( command ); + } +// END OF FILE diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionutility/src/mpxcollectionplaylist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionutility/src/mpxcollectionplaylist.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,1530 @@ +/* +* Copyright (c) 2006 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: implementation of collection playlist +* +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "mpxcollectionplaylistobserver.h" +#include "mpxcollectionplaylist.h" + +// CONSTANTS +const TInt KIncrementalFetchSize = 400; +const TInt KIncrementalDelay = 2000000; + +// ----------------------------------------------------------------------------- +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCollectionPlaylist* CMPXCollectionPlaylist::NewL() + { + MPX_DEBUG1("-->CMPXCollectionPlaylist::NewL()"); + CMPXCollectionPlaylist* p = new(ELeave) CMPXCollectionPlaylist(NULL); + CleanupStack::PushL(p); + p->ConstructL(); + CleanupStack::Pop(p); + MPX_DEBUG2("<--CMPXCollectionPlaylist::NewL() playlist 0x%08x", p); + return p; + } + +// ----------------------------------------------------------------------------- +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCollectionPlaylist* CMPXCollectionPlaylist::NewL( + const CMPXCollectionPlaylist& aPlaylist, + MMPXCollectionPlaylistObserver* aPlObs /*= NULL*/) + { + MPX_DEBUG2("-->CMPXCollectionPlaylist::NewL(pl, plobs) with plobs 0x%08x", aPlObs); + CMPXCollectionPlaylist* p = new(ELeave) CMPXCollectionPlaylist(aPlObs); + CleanupStack::PushL(p); + p->ConstructL(aPlaylist); + CleanupStack::Pop(p); + MPX_DEBUG3("<--CMPXCollectionPlaylist::NewL(pl, plobs) playlist 0x%08x, , plobs 0x%08x", + p, aPlObs); + return p; + } + +// ----------------------------------------------------------------------------- +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCollectionPlaylist* CMPXCollectionPlaylist::NewL( + const CMPXCollectionPath& aPath, + MMPXCollectionPlaylistObserver* aPlObs /*= NULL*/) + { + MPX_DEBUG2("-->CMPXCollectionPlaylist::NewL(path, plobs) with plobs 0x%08x", aPlObs); + CMPXCollectionPlaylist* p = new(ELeave) CMPXCollectionPlaylist(aPlObs); + CleanupStack::PushL(p); + p->ConstructL(aPath); + CleanupStack::Pop(p); + MPX_DEBUG3("<--CMPXCollectionPlaylist::NewL(pl, plobs) playlist 0x%08x, , plobs 0x%08x", + p, aPlObs); + return p; + } + +// ----------------------------------------------------------------------------- +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCollectionPlaylist* CMPXCollectionPlaylist::NewL( + RReadStream& aStream, + MMPXCollectionPlaylistObserver* aPlObs /*= NULL*/) + { + MPX_DEBUG2("-->CMPXCollectionPlaylist::NewL(strm, plobs) with plobs 0x%08x", aPlObs); + CMPXCollectionPlaylist* p = new(ELeave) CMPXCollectionPlaylist(aPlObs); + CleanupStack::PushL(p); + p->ConstructL(aStream); + CleanupStack::Pop(p); + MPX_DEBUG3("<--CMPXCollectionPlaylist::NewL(pl, plobs) playlist 0x%08x, , plobs 0x%08x", + p, aPlObs); + return p; + } + + +// ----------------------------------------------------------------------------- +// Default constructor +// ----------------------------------------------------------------------------- +// +CMPXCollectionPlaylist::CMPXCollectionPlaylist( + MMPXCollectionPlaylistObserver* aPlObs) +: iRepeatMode(ERepeatOff), iShuffle(EFalse), iRemote(EFalse), + iItemIndex(KErrNotFound),iEmbedded(EFalse), iPlObs(aPlObs), + iRepeatEnabled(ETrue), + iShuffleEnabled(ETrue), iAutoPlaylist(EFalse), + iAutoPlay(ETrue), iSingleItemPlaylist(EFalse), + iPreInitPlugin(ETrue) + { + } + +// ---------------------------------------------------------------------------- +// 2nd phase constructor. +// ---------------------------------------------------------------------------- +// +void CMPXCollectionPlaylist::ConstructL(const CMPXCollectionPath& aPath) + { + MPX_FUNC_EX("CMPXCollectionPlaylist::ConstructL(aPath)"); + iPath=CMPXCollectionPath::NewL(aPath); + iIncOpenUtil = CMPXCollectionOpenUtility::NewL( this, KMcModePlaylist ); + SetShuffleL(EFalse, EFalse); + if (!iAutoPlaylist) + { + DoIncrementalOpenL(); + } + } + +// ---------------------------------------------------------------------------- +// 2nd phase constructor. +// ---------------------------------------------------------------------------- +// +void CMPXCollectionPlaylist::ConstructL( + const CMPXCollectionPlaylist& aPlaylist) + { + MPX_FUNC_EX("CMPXCollectionPlaylist::ConstructL(aPlaylist)"); + iIncOpenUtil = CMPXCollectionOpenUtility::NewL( this, KMcModePlaylist ); + CopyContentL(aPlaylist); + } + +// ---------------------------------------------------------------------------- +// 2nd phase constructor. +// ---------------------------------------------------------------------------- +// +void CMPXCollectionPlaylist::ConstructL(RReadStream& aStream) + { + MPX_FUNC_EX("CMPXCollectionPlaylist::ConstructL(aStream)"); + InternalizeL(aStream); + iIncOpenUtil = CMPXCollectionOpenUtility::NewL( this, KMcModePlaylist ); + if (!iAutoPlaylist) + { + DoIncrementalOpenL(); + } + } + +// ---------------------------------------------------------------------------- +// 2nd phase constructor. +// ---------------------------------------------------------------------------- +// +void CMPXCollectionPlaylist::ConstructL() + { + MPX_FUNC_EX("CMPXCollectionPlaylist::ConstructL()"); + iPath = CMPXCollectionPath::NewL(); + iIncOpenUtil = CMPXCollectionOpenUtility::NewL( this, KMcModePlaylist ); + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCollectionPlaylist::~CMPXCollectionPlaylist() + { + MPX_FUNC_EX("CMPXCollectionPlaylist::~CMPXCollectionPlaylist"); + delete iPath; + iItemIndexes.Close(); + if (iColUtil) + { + iColUtil->Close(); + } + delete iIncOpenUtil; + } + +// ----------------------------------------------------------------------------- +// Copy playlist content from other playlist except observers and session to +// collection server +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPlaylist::CopyContentL( + const CMPXCollectionPlaylist& aPlaylist) + { + MPX_FUNC_EX("CMPXCollectionPlaylist::CopyContentL(aPlaylist)"); + iRepeatMode=aPlaylist.iRepeatMode; + iRepeatEnabled=aPlaylist.iRepeatEnabled; + iShuffle=aPlaylist.iShuffle; + iShuffleEnabled=aPlaylist.iShuffleEnabled; + iRemote=aPlaylist.iRemote; + delete iPath; + iPath = NULL; + iPath=CMPXCollectionPath::NewL(aPlaylist.Path()); + ::CopyArrayL(aPlaylist.iItemIndexes.Array(), iItemIndexes); + iItemIndex=aPlaylist.iItemIndex; + iEmbedded=aPlaylist.iEmbedded; + iAutoPlaylist=aPlaylist.iAutoPlaylist; + iAutoPlay=aPlaylist.iAutoPlay; + iSingleItemPlaylist=aPlaylist.iSingleItemPlaylist; + iPreInitPlugin=aPlaylist.iPreInitPlugin; + + if( !iColUtil ) + { + iColUtil=MMPXCollectionUtility::NewL(this ,KMcModePlaylist); + } + + if (!iAutoPlaylist) + { + DoIncrementalOpenL(); + } + } + +// ----------------------------------------------------------------------------- +// Advances path to next item +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CMPXCollectionPlaylist::Next( + TBool aIgnoreRepeat /*=EFalse*/ ) + { + MPX_FUNC_EX("CMPXCollectionPlaylist::Next()"); + TInt nextPlIndex( KErrNotFound ); + TBool ret( NextIndex( aIgnoreRepeat, nextPlIndex )); + if ( KErrNotFound != nextPlIndex ) + { + iPath->Set( iItemIndexes[nextPlIndex] ); + if ( iShuffle && iItemIndex == Count()-1 ) + { + MPX_TRAPD( err, SetShuffleL( iShuffle, ETrue )); + if ( KErrNone != err ) + { + ret = EFalse; + iItemIndex = 0; + iPath->Set( iItemIndexes[0] ); + } + } + else + { + iItemIndex = nextPlIndex; + } + } + return ret; + } + +// ----------------------------------------------------------------------------- +// Gets the next index to play +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CMPXCollectionPlaylist::NextIndex( + TBool aIgnoreRepeatOneMode, + TInt& aPlaylistIndex ) const + { + MPX_FUNC("CMPXCollectionPlaylist::NextIndex()"); + + TInt count( Count() ); + TBool ret( ETrue ); + if ( count <= 0 ) + { + ret = EFalse; + aPlaylistIndex = KErrNotFound; + } + else + { + MPX_ASSERT( iItemIndex != -1 ); + aPlaylistIndex = iItemIndex; + + // If not in repeat one mode, then go to the next item, + // otherwise leave index unchanged + if (( ERepeatOne != iRepeatMode ) || + ( aIgnoreRepeatOneMode )) + { + // If not the last one in the list, find the next valid item + if ( count-1 != aPlaylistIndex ) + { + do + { + ++aPlaylistIndex; + } + while( aPlaylistIndex != count && + iPath->IdOfIndex( iItemIndexes[aPlaylistIndex] ) + == KMPXInvalidItemId ); + } + + // If Last one in list, set to first + if ( count-1 == iItemIndex || count == aPlaylistIndex ) + { + if ( ERepeatOff == iRepeatMode ) + { + ret = EFalse; + } + + // If shuffle mode is on, choose a song to be the first song in the new + // randomized list. This chooses the middle song, not exactly random, + // but this ensures that if this method is called multiple times + // it would return a consistent result. The reason is because this + // method maybe called multiple times in a row by different clients, + // so we want to make sure that each client returns the same result. + // If shuffle is off then choose the first item in list. + if ( iShuffle ) + { + aPlaylistIndex = count / 2; + } + else + { + aPlaylistIndex = 0; + } + } + } + } + MPX_DEBUG3("CMPXCollectionPlaylist::NextIndex %d %d", ret, aPlaylistIndex); + return ret; + } + + +// ----------------------------------------------------------------------------- +// Gets the path index of the item given it's position in the playlist. +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXCollectionPlaylist::PathIndex( TInt aPlaylistIndex ) const + { + MPX_FUNC("CMPXCollectionPlaylist::PathIndex"); + MPX_ASSERT(aPlaylistIndex < Count()); + return iItemIndexes[aPlaylistIndex]; + } + +// ----------------------------------------------------------------------------- +// Advances path to previous item +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CMPXCollectionPlaylist::Previous( + TBool aIgnoreRepeat /*=EFalse*/ ) + { + MPX_FUNC_EX("CMPXCollectionPlaylist::Previous"); + TBool ret=ETrue; + + TInt count( Count() ); + if ( count <= 0 ) + { + ret = EFalse; + } + else if ( ERepeatOne != iRepeatMode || + aIgnoreRepeat ) + { + // If first one in list, set to last + if ( 0 == iItemIndex ) + { + if (iShuffle) + { // re-shuffle + TRAP_IGNORE(SetShuffleL(iShuffle, EFalse)); + } + SetToLast(); + } + else + { + // Find the next valid item + // + do + { + --iItemIndex; + if (iItemIndex>=0 && iItemIndex < iItemIndexes.Count()) + { + iPath->Set(iItemIndexes[iItemIndex]); + } + } + while( iPath->Id() == KMPXInvalidItemId && + iItemIndex != KErrNotFound ); + + if( iItemIndex < 0 ) + { + iItemIndex=0; + ret=Previous(); + } + } + } + MPX_DEBUG2("CMPXCollectionPlaylist::PreviousL %i", iPath->Index()); + return ret; + } + +// ----------------------------------------------------------------------------- +// Sets path to first item +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPlaylist::SetToFirst() + { + if (Count()) + { + iItemIndex=0; + iPath->Set(iItemIndexes[iItemIndex]); + } + } + +// ----------------------------------------------------------------------------- +// Sets path to last item +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPlaylist::SetToLast() + { + if (Count()) + { + iItemIndex=Count()-1; + iPath->Set(iItemIndexes[iItemIndex]); + } + } + +// ----------------------------------------------------------------------------- +// Sets path to a particular index +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPlaylist::SetToIndex( TInt aIndex ) + { + MPX_ASSERT( aIndex >= -1 && aIndex < Count() ); + iItemIndex = aIndex; + + // Special case, the collection path does not support -1 no selection + if( iItemIndex != -1 ) + { + iPath->Set(iItemIndexes[iItemIndex]); + } + } + +// ----------------------------------------------------------------------------- +// Returns the number of items in the same container +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXCollectionPlaylist::Count() const + { + return iItemIndexes.Count(); + } + +// ----------------------------------------------------------------------------- +// Returns the depth into the collection (0 = root level, 1 = first level etc.) +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXCollectionPlaylist::Levels() const + { + return iPath ? iPath->Levels() : 0; + } + +// ----------------------------------------------------------------------------- +// Returns play ordinal of current item in the playlist +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXCollectionPlaylist::Index() const + { + TInt index(KErrNotFound); + if (Count() && iItemIndex < Count()) + { + index = iItemIndex; + } + return index; + } + +// ----------------------------------------------------------------------------- +// Is the collection stored on a remote device +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CMPXCollectionPlaylist::Remote() const + { + MPX_DEBUG2("-->CMPXCollectionPlaylist::Remote iColUtil 0x%08x", iColUtil); + CMPXCollectionPlaylist *s = const_cast(this); + if (!s->iColUtil && iPath) + { + TRAP_IGNORE(s->iColUtil=MMPXCollectionUtility::NewL(s, KMcModePlaylist)); + if (s->iColUtil) + { + s->iRemote=s->iColUtil->Collection().IsRemote(*iPath); + } + } + MPX_DEBUG2("<--CMPXCollectionPlaylist::Remote iColUtil 0x%08x", iColUtil); + return iRemote; + } + +// ----------------------------------------------------------------------------- +// Repeat mode +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCollectionPlaylist::TRepeatMode + CMPXCollectionPlaylist::RepeatMode() const + { + return iRepeatMode; + } + +// ----------------------------------------------------------------------------- +// Shuffle +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CMPXCollectionPlaylist::Shuffle() const + { + return iShuffle; + } + +// ----------------------------------------------------------------------------- +// Collection path +// ----------------------------------------------------------------------------- +// +EXPORT_C const CMPXCollectionPath& CMPXCollectionPlaylist::Path() const + { + return *iPath; + } + +// ----------------------------------------------------------------------------- +// Get media properties for current item +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPlaylist::MediaL( + const TArray& aAttrs, + MMPXCollectionMediaObserver& aMediaObs) + { + MPX_DEBUG4("-->CMPXCollectionPlaylist::MediaL 0x%08x, iColUtil 0x%08x, obs 0x%08x", + this, iColUtil, &aMediaObs); + iMediaObs=&aMediaObs; + if (!iColUtil) + { + iColUtil=MMPXCollectionUtility::NewL(this ,KMcModePlaylist); + } + +#ifdef _DEBUG + // For debug purposes, to test whether we can ever reach an invalid item + if( iPath->Id() == KMPXInvalidItemId ) + { + MPX_DEBUG1("CMPXCollectionPlaylist::MediaL Unloaded item"); + } +#endif //_DEBUG + + iColUtil->Collection().MediaL(*iPath, aAttrs); + MPX_DEBUG3("<--CMPXCollectionPlaylist::MediaL 0x%08x, iColUtil 0x%08x", + this, iColUtil); + } + +// ----------------------------------------------------------------------------- +// Sets repeat mode +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPlaylist::SetRepeatMode(TRepeatMode aMode) + { + MPX_DEBUG2("CMPXCollectionPlaylist::SetRepeatMode(%d)", aMode); + if ( iRepeatEnabled ) + { + iRepeatMode=aMode; + } + else + { + iRepeatMode = ERepeatOff; + } + } + +// ----------------------------------------------------------------------------- +// Sets repeat enabled +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPlaylist::SetRepeatEnabled( TBool aEnable ) + { + MPX_DEBUG2("CMPXCollectionPlaylist::SetRepeatEnabled(%d)", aEnable); + iRepeatEnabled = aEnable; + if ( !iRepeatEnabled ) + { + SetRepeatMode( ERepeatOff ); + } + } + +// ----------------------------------------------------------------------------- +// Sets shuffle +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPlaylist::SetShuffleL( + TBool aShuffle, + TBool aCurrentToTop) + { + MPX_DEBUG3("CMPXCollectionPlaylist::SetShuffleL(%d, %d)", aShuffle, aCurrentToTop); + + if ( iShuffleEnabled ) + { + iShuffle=aShuffle; + } + else + { + iShuffle = EFalse; + } + iItemIndexes.Reset(); + iItemIndex = KErrNotFound; + TInt currentIndex(iPath->Index()); + + if (iShuffle) + { + if ( iPath->Count() > 0 ) + { + // + // First, append item indexes in default order (i.e. 0,1,2...) + // into a temp array + // + RArray items; + CleanupClosePushL(items); + for (TInt i=0;iCount();++i) + { + items.AppendL(i); + } + // + // Get a seed for randomizing + // + TTime time; + time.UniversalTime(); + TInt64 seed = time.Int64(); + + // Make sure current one is first in list. + if (aCurrentToTop) + { + items.Remove(currentIndex); + iItemIndexes.AppendL(currentIndex); + } + + TInt count = items.Count(); + // + // Pull the item indexes from the temp array, randomly, + // removing pulled item so there are no repetitions + // + for (TInt ii=0;iiSet( iItemIndexes[iItemIndex] ); + } + } + else + { + for (TInt i=0;iCount();++i) + { + iItemIndexes.AppendL(i);// Append items in default order, i.e. 0,1,2... + } + // Set to current index + iItemIndex = currentIndex; + } + } + +// ----------------------------------------------------------------------------- +// Sets shuffle enabled +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPlaylist::SetShuffleEnabledL( TBool aEnable ) + { + MPX_DEBUG2("CMPXCollectionPlaylist::SetShuffleEnabled(%d)", aEnable); + if ( aEnable != iShuffleEnabled ) + { + iShuffleEnabled = aEnable; + SetShuffleL( EFalse, EFalse ); + } + } + +// ----------------------------------------------------------------------------- +// Externalize object +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPlaylist::ExternalizeL( + RWriteStream& aStream) const + { + aStream<<*iPath; + aStream.WriteInt32L(iRepeatMode); + aStream.WriteInt32L(iRemote); + + TInt n=iItemIndexes.Count(); + aStream.WriteInt32L(n); + for (TInt ii=0;ii>*iPath; + iRepeatMode=static_cast(aStream.ReadInt32L()); + iRemote=aStream.ReadInt32L(); + iItemIndexes.Reset(); + TInt n=aStream.ReadInt32L(); + for (TInt ii=0;iiClose(); + iColUtil = NULL; + } + iColUtil=MMPXCollectionUtility::NewL(this); + } + +// ----------------------------------------------------------------------------- +// Handle media from colllection +// ----------------------------------------------------------------------------- +// +void CMPXCollectionPlaylist::HandleCollectionMediaL( + const CMPXMedia& aMedia, + TInt aError) + { + MPX_FUNC_EX("CMPXCollectionPlaylist::HandleCollectionMediaL"); + iMediaObs->HandleCollectionMediaL(aMedia, aError); + } + +// ----------------------------------------------------------------------------- +// HandleCollectionMessage +// ----------------------------------------------------------------------------- +// +void CMPXCollectionPlaylist::HandleCollectionMessage( + CMPXMessage* aMessage, + TInt aErr) + { + if (iPlObs) + { + TRAP_IGNORE(DoHandleCollectionMessageL(aMessage, aErr)); + } // pre-init playlist, don't bother to update itself, will be re-synced + } + +// ----------------------------------------------------------------------------- +// Handle open event +// ----------------------------------------------------------------------------- +// +void CMPXCollectionPlaylist::HandleOpenL( + const CMPXMedia& aEntries, + TInt aIndex, + TBool aComplete, + TInt aError) + { + MPX_DEBUG4("-->CMPXCollectionPlaylist::HandleOpenL 0x%08x, iPlObs 0x%08x, iCollectonObs 0x%08x", + this, iPlObs, iCollectionObs); + if (KErrNone == aError) + { + if ( aEntries.IsSupported(KMPXMediaGeneralNonPermissibleActions ) ) + { + // check for auto playlist, it is not writable and cacheable + TMPXGeneralNonPermissibleActions attr( + aEntries.ValueTObjectL( + KMPXMediaGeneralNonPermissibleActions ) ); + if ( (attr & EMPXCache) && (attr & EMPXWrite)) + { + iAutoPlaylist = ETrue; + } + } + + if (iPlObs) + { + DoHandleIncompleteOpenL(aEntries,aComplete); + } + else if (iCollectionObs) + { // callback right after swap, notify the playlist of the originator + iCollectionObs->HandleOpenL(aEntries, aIndex, aComplete, aError); + } + } + + MPX_DEBUG4("<--CMPXCollectionPlaylist::HandleOpenL 0x%08x, iPlObs 0x%08x, iCollectonObs 0x%08x", + this, iPlObs, iCollectionObs); + } + +// ----------------------------------------------------------------------------- +// Handle open event +// ----------------------------------------------------------------------------- +// +void CMPXCollectionPlaylist::HandleOpenL( + const CMPXCollectionPlaylist& aPlaylist, + TInt aError) + { + (void)aPlaylist; + (void)aError; + } + +// ----------------------------------------------------------------------------- +// Set a new observer +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPlaylist::SetObserver( + MMPXCollectionMediaObserver& aMediaObs, + MMPXCollectionPlaylistObserver* aPlObs /*= NULL*/, + MMPXCollectionObserver* aCollectionObs /*= NULL*/) + { + MPX_DEBUG4("-->CMPXCollectionPlaylist::SetObserver 0x%08x, mobs 0x%08x, plobs 0x%08x", + this, &aMediaObs, aPlObs); + iMediaObs=&aMediaObs; + iPlObs = aPlObs; + iCollectionObs = aCollectionObs; + MPX_DEBUG2("<--CMPXCollectionPlaylist::SetObserver 0x%08x", this); + } + +// ----------------------------------------------------------------------------- +// Is this an embedded playlist +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CMPXCollectionPlaylist::EmbeddedPlaylist() const + { + return iEmbedded; + } + +// ----------------------------------------------------------------------------- +// Set a new observer +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPlaylist::SetEmbeddedPlaylist( TBool aEmbedded ) + { + iEmbedded = aEmbedded; + } + +// ---------------------------------------------------------------------------- +// Set properities +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPlaylist::SetL(const CMPXMedia& aMedia) + { + MPX_FUNC_EX("CMPXCollectionPlaylist::SetL()"); + if (!iColUtil) + { + iColUtil=MMPXCollectionUtility::NewL(this ,KMcModePlaylist); + } + + CMPXCommand* cmd = CMPXCommand::NewL(); + CleanupStack::PushL( cmd ); + + cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdCollectionSet ); + cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, EFalse ); + MPX_ASSERT( aMedia.IsSupported(KMPXMediaGeneralCollectionId) ); + TUid id( aMedia.ValueTObjectL(KMPXMediaGeneralCollectionId) ); + cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, id.iUid ); + + CMPXMedia* tmp = CMPXMedia::NewL(aMedia); + CleanupStack::PushL( tmp ); + cmd->SetCObjectValueL( KMPXCommandColSetMedia, tmp ); + CleanupStack::PopAndDestroy( tmp ); + + iColUtil->Collection().CommandL( *cmd ); + CleanupStack::PopAndDestroy( cmd ); + } + +// ---------------------------------------------------------------------------- +// Remove outstanding requests +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPlaylist::CancelRequest() + { + if (iColUtil) + { + iColUtil->Collection().CancelRequest(); + } + } + +// ---------------------------------------------------------------------------- +// Invalidate the playlist +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPlaylist::Invalidate() + { + MPX_FUNC_EX("CMPXCollectionPlaylist::Invalidate"); + if( iPath ) + { + iPath->Reset(); + } + iItemIndexes.Reset(); + iItemIndex = KErrNotFound; + iIncOpenUtil->Stop(); + } + +// ---------------------------------------------------------------------------- +// Restore Ordinal after path changed +// ---------------------------------------------------------------------------- +// +void CMPXCollectionPlaylist::RestoreOrdinalL( + const CMPXMedia& aEntries, + TInt /*aIndex*/) + { + MPX_DEBUG3("-->CMPXCollectionPlaylist::RestoreOrdinalL 0x%08x, iPlObs 0x%08x", + this, iPlObs); + MPX_DEBUG_PATH(*iPath); + MPX_DEBUG2("CMPXCollectionPlaylist::RestoreOrdinal %i", iPath->Index()); +#ifdef _DEBUG + MPX_DEBUG1("Original Play Order:"); + for (TInt ii = 0; ii < 15 && iiId(); + + if ( !aEntries.IsSupported(KMPXMediaGeneralContainerPath) ) + { + if ( iPlObs ) + { + iPlObs->HandleCollectionPlaylistChange (KErrEof ); + } + } + else + { + CMPXCollectionPath + * path=aEntries.ValueCObjectL (KMPXMediaGeneralContainerPath ); + CleanupStack::PushL (path ); + // Check if path is for this playlist + TInt levels = path->Levels ( ); + TBool valid(ETrue); + if ( levels != iPath->Levels ( )-1 ) + { + // Need to make sure the path was not clipped. + // The number of levels between the old path + // and the new pathshould be the same. + // + valid = EFalse; + } + + if ( valid ) + { + TMPXItemId nextMostValidId= KMPXInvalidItemId; + + if ( aEntries.IsSupported (KMPXMediaArrayContents ) ) + { + RArray ids; + CleanupClosePushL (ids ); + const CMPXMediaArray * mediaArray= + aEntries.Value (KMPXMediaArrayContents ); + User::LeaveIfNull(const_cast(mediaArray)); + TInt n=mediaArray->Count ( ); + for (TInt k=0; kAtL(k)->ValueTObjectL( + KMPXMediaGeneralId)); + + ids.AppendL (id ); + } + path->AppendL (ids.Array ( ) ); + + // Determine the next most valid item id + // by comparing previous item list vs current item list + // First search down the array list, then search up the array list + // + TInt c = iItemIndexes.Count ( ); + for (TInt i=iItemIndex; iIdOfIndex ( i ); + if ( ids.Find ( prev )!= KErrNotFound ) + { + nextMostValidId = prev; + break; + } + } + if ( nextMostValidId == KMPXInvalidItemId && c ) + { + for (TInt i=iItemIndex-1; i>0; --i ) + { + TMPXItemId prev = iPath->IdOfIndex ( i ); + if ( ids.Find ( prev )!= KErrNotFound ) + { + nextMostValidId = prev; + break; + } + } + } + CleanupStack::PopAndDestroy (&ids ); + } + //if (aIndex>=0 && aIndexCount()) + if ( path->IndexOfId ( curId )!= KErrNotFound ) + { + path->Set ( curId ); + } + + CleanupStack::Pop (path ); + delete iPath; + iPath = path; + + if ( !iShuffle || !iShuffleEnabled ) + { // Just update the playlist content + SetShuffleL (iShuffle, EFalse ); + } + else + {// shuffle is on, try to restore previous play order + RArray items; + CleanupClosePushL (items ); + TInt count = iItemIndexes.Count ( ); + TInt cPath = iPath->Count ( ); + TInt granularity = cPath ? cPath : 1; // magic number 1 + RArray flags(granularity); // flags for the items in the playlist + CleanupClosePushL (flags ); + for (TInt ii=0; iiIndexOfId (curId ); + if ( iItemIndex >=Count ( ) ) + { // items removed + SetToLast ( ); + if ( KErrNotFound == curIndex ) + { // current item removed at the end + err = KErrEof; + } + } + else + { + if ( KErrNotFound != curIndex ) + { + // Look up the shuffle index + TInt itemIndex = iItemIndexes.Find (iPath->Index ( ) ); + if ( KErrNotFound != itemIndex ) + { + iItemIndex = itemIndex; + iPath->Set (iItemIndexes[iItemIndex] ); + } + else + { // this should never happen unless something wrong + SetToLast ( ); + err = KErrNotFound; + } + } + else + { // current item removed, ensure the item was even valid + err = KErrNotFound; + + // If the current ID was invalid, then the previous iItemIndex is + // wrong as well. In this case, we use the next most valid ID + // that is found by comparing the previous ID list to the current id list + // the next most valid ID has to exist in the new path + // + if ( nextMostValidId != KMPXInvalidItemId ) + { + const TMPXItemId item = nextMostValidId; // compiler picks wrong set if no const + iPath->Set (item ); + iItemIndex = iPath->Index ( ); + } + else // back to first item + { + SetToFirst ( ); + } + } + } + + if ( iPlObs ) + { + iPlObs->HandleCollectionPlaylistChange (err ); + } + } + else + { + CleanupStack::PopAndDestroy (path ); + } + + MPX_DEBUG_PATH(*iPath); + MPX_DEBUG2("CMPXCollectionPlaylist::RestoreOrdinal %i", iPath->Index()); +#ifdef _DEBUG + MPX_DEBUG1("New Play Order:"); + for (TInt jj = 0; jj < 15 && jjValueTObjectL(KMPXMessageGeneralId); + } + + if (KErrNone == aErr && KMPXMessageGeneral == msgGeneralId ) + { + TInt event(aMessage->ValueTObjectL(KMPXMessageGeneralEvent)); + TInt type(aMessage->ValueTObjectL(KMPXMessageGeneralType)); + if (event == TMPXCollectionMessage::EError && + type == EMcsMediaByPath) + { + MPX_DEBUG1("CMPXCollectionPlaylist::DoHandleCollectionMessageL -- Error message for MediaL"); + CMPXMedia* dummyMedia=CMPXMedia::NewL(); + CleanupStack::PushL(dummyMedia); + iMediaObs->HandleCollectionMediaL(*dummyMedia, + aMessage->ValueTObjectL(KMPXMessageGeneralData)); + CleanupStack::PopAndDestroy(dummyMedia); + } + } + else if( aMessage && msgGeneralId == KMPXMessageIdItemChanged) + { + MPX_DEBUG1("CMPXCollectionPlaylist::DoHandleCollectionMessageL -- KMPXMessageIdItemChanged"); + // Multiple messages + // + TBool refresh(EFalse); + if( aMessage->IsSupported(KMPXMessageArrayContents) ) + { + const CMPXMessageArray* messageArray = + aMessage->Value(KMPXMessageArrayContents); + User::LeaveIfNull(const_cast(messageArray)); + TInt count(messageArray->Count()); + for(TInt i=0; iAtL(i))); + } + } + // Single message + // + else + { + refresh = DoHandleCollectionChangeMessageL(*aMessage); + } + + // Re-open the playlist if necessary + // + if( refresh ) + { + MPX_DEBUG1("CMPXCollectionPlaylist::DoHandleCollectionMessageL - refresh due to KMPXMessageIdItemChanged"); + if (iAutoPlaylist) + { + iPlObs->HandleCollectionPlaylistChange(iItemIndexes.Count() > 0 ? KErrNone : KErrEof); + } + else + { + if( iPath->Levels() > 0 ) + { + DoIncrementalOpenL(); + iReopenForChange = ETrue; + } + else + { + // Path has been clipped and not playable + // + iPlObs->HandleCollectionPlaylistChange(KErrNotFound); + } + } + } + } + } + +// ----------------------------------------------------------------------------- +// CMPXCollectionPlaylist::DoHandleCollectionChangeMessageL +// ----------------------------------------------------------------------------- +// +TBool CMPXCollectionPlaylist::DoHandleCollectionChangeMessageL( + CMPXMessage& aMessage) + { + MPX_DEBUG3("-->CMPXCollectionPlaylist::DoHandleCollectionChangeMessageL 0x%08x, iPlObs 0x%08x", + this, iPlObs); + TBool refresh(EFalse); + TInt affectedIndex = KErrNotFound; // index of the id that is modified + + // Change event data + // + TUid collectionId( aMessage.ValueTObjectL(KMPXMessageCollectionId) ); + + TMPXChangeEventType changeType = + aMessage.ValueTObjectL(KMPXMessageChangeEventType); + + TMPXGeneralCategory category(EMPXNoCategory); + if( aMessage.IsSupported(KMPXMessageMediaGeneralCategory) ) + { + category = + aMessage.ValueTObjectL(KMPXMessageMediaGeneralCategory); + } + + TMPXItemId itemId(0); + if( aMessage.IsSupported(KMPXMessageMediaGeneralId) ) + { + itemId = aMessage.ValueTObjectL(KMPXMessageMediaGeneralId); + } + + TMPXItemId deprecatedId(0); + if (aMessage.IsSupported(KMPXMessageMediaDeprecatedId)) + { + deprecatedId = aMessage.ValueTObjectL(KMPXMessageMediaDeprecatedId); + } + + // Check if the current item is being modified + // + TMPXItemId curItemId( iPath->Id() ); + if( curItemId.ApproxEqual(itemId) ) + { + affectedIndex = iPath->Index(); + // Deleted + if( changeType == EMPXItemDeleted ) + { + refresh = ETrue; + } + // Modified + else if( changeType == EMPXItemModified ) + { + MPX_DEBUG1("CMPXCollectionPlaylist::DoHandleCollectionChangeMessageL -- modified"); + refresh = ETrue; + } + // else inserted should never happen + } + // Not the current item being modified, check collection path + // to see if the path needs to be refreshed + // + else + { + // Map Change Type + // + CMPXCollectionPath::TMPXCollectionPathChange + pChangeType(CMPXCollectionPath::EGroupModified); + if( category == EMPXPlaylist ) + { + if( changeType == EMPXItemDeleted ) + { + pChangeType = CMPXCollectionPath::EDeleted; + } + else + { + pChangeType = CMPXCollectionPath::EGroupModified; + } + } + else if( category == EMPXCollection ) + { + if( changeType == EMPXItemModified ) + { + pChangeType = CMPXCollectionPath::EGroupModified; + } + } + else if( changeType == EMPXItemInserted ) + { + pChangeType = CMPXCollectionPath::EAdded; + } + else if( changeType == EMPXItemModified ) + { + pChangeType = CMPXCollectionPath::EModified; + } + else if( changeType == EMPXItemDeleted ) + { + pChangeType = CMPXCollectionPath::EDeleted; + } + + // Check the collection path + // + if( iPath->Id(CMPXCollectionPath::ECollectionRoot) == collectionId.iUid ) + { + TInt pUpdated = iPath->HandleChange( collectionId, itemId, + deprecatedId, pChangeType, affectedIndex ); + + if( pUpdated == CMPXCollectionPath::EPathClipped ) + { + // Path clipped, playlist is no longer valid + // + MPX_DEBUG1("CMPXCollectionPlaylist::DoHandleCollectionChangeMessageL -- path clipped"); + Invalidate(); + if (iPlObs) + { + iPlObs->HandleCollectionPlaylistChange(KErrEof); + } + } + else if( pUpdated == CMPXCollectionPath::EPathModified ) + { + // Path modified, something in needs to be refreshed + // + MPX_DEBUG1("CMPXCollectionPlaylist::DoHandleCollectionChangeMessageL -- path modified"); + refresh = ETrue; + } + } + } + + if (iAutoPlaylist && refresh) + { + // For autoplaylist, affected by the event. + // Path clip will never happen for autoplaylist + if (changeType == EMPXItemDeleted) + { + // item deleted in the autoplaylist, update the iPath to remove the item + // auso update iItemIndexes and iItemIndex + iPath->Remove(affectedIndex); + TInt itemIndex = KErrNotFound; + for (TInt i=0; i affectedIndex) + { + //index shift + --iItemIndexes[i]; + } + } + if (iItemIndexes.Count()>0) + { + // Still has items + if (iItemIndex == itemIndex) + { + // current item get removed, iItemIndex already move to next + if (iItemIndex >= iItemIndexes.Count()) + { + iItemIndex = (iRepeatMode == ERepeatAll)? 0: iItemIndexes.Count()-1; + } + } + else if (iItemIndex > itemIndex) + { + --iItemIndex; + } + iPath->Set(iItemIndexes[iItemIndex]); + } + else + { + iItemIndex = KErrNotFound; + } + } + } + + MPX_DEBUG4("<--CMPXCollectionPlaylist::DoHandleCollectionChangeMessageL 0x%08x, iPlObs 0x%08x, refresh %d", + this, iPlObs, refresh); + return refresh; + } + +// ----------------------------------------------------------------------------- +// Start the incremental fetching +// ----------------------------------------------------------------------------- +// +void CMPXCollectionPlaylist::DoIncrementalOpenL() + { + if(iSingleItemPlaylist) + { + return; + } + // Stop the utility first if we were fetching + // + iIncOpenUtil->Stop(); + + // Copy of the path + // + CMPXCollectionPath* copy = iPath->ContainerPathL(); + CleanupStack::PushL( copy ); + + RArray attrs; + CleanupClosePushL( attrs ); + TArray ary = attrs.Array(); + + // Start the utility, 2 second delays so we don't flood the collection + // Have some delay as playlists are often destroyed! + // + iIncOpenUtil->SetDelay( KIncrementalDelay ); + iIncOpenUtil->StartL( *copy, ary, KIncrementalFetchSize, iPath->Index() , + CMPXCollectionOpenUtility::EFetchNormal ); + CleanupStack::PopAndDestroy( &attrs ); + CleanupStack::PopAndDestroy( copy ); + } + +// ----------------------------------------------------------------------------- +// Handle Incremental Open results +// ----------------------------------------------------------------------------- +// +void CMPXCollectionPlaylist::DoHandleIncompleteOpenL( const CMPXMedia& aMedia, TBool aComplete) + { + MPX_FUNC("<--CMPXCollectionPlaylist::DoHandleIncompleteOpenL"); + if (iAutoPlaylist) + { + // Fill incomplete playlist, pending until inc open is used for playlist + /* + TInt index = iPath->IndexOfId(KMPXInvalidItemId) + if (!=KErrNotFound) + { + } + */ + } + else + { + CMPXCollectionPath* newPath = iIncOpenUtil->PathL(); + + // Re-select the previous item, if it failed then run + // the restore ordinal algorithm. + // + TInt index = newPath->IndexOfId(iPath->Id()); + if( index != KErrNotFound && !iReopenForChange ) + { + newPath->Set( index ); + + delete iPath; + iPath = NULL; + iPath = newPath; + } + else + { + delete newPath; + + TBool checkValid = (index == KErrNotFound) && (iReopenForChange); + if ( aComplete || (!checkValid)) + { + TBool checkForOpen = (index == KErrNotFound) && (!iReopenForChange); + if ( !checkForOpen) + { + RestoreOrdinalL ( aMedia, 0); + iReopenForChange = EFalse; + } + } + } + } + } +// ----------------------------------------------------------------------------- +// AutoPlay +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CMPXCollectionPlaylist::AutoPlay() const + { + return iAutoPlay; + } + +// ----------------------------------------------------------------------------- +// Set AutoPlay +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPlaylist::SetAutoPlay(TBool aAutoPlay) + { + iAutoPlay = aAutoPlay; + } + + +// ----------------------------------------------------------------------------- +// Set single item playlist +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPlaylist::SetSingleItemPlaylist() + { + iSingleItemPlaylist = ETrue; + } + + +// ----------------------------------------------------------------------------- +// Is single item playlist +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CMPXCollectionPlaylist::IsSingleItemPlaylist() + { + return iSingleItemPlaylist; + } + +// ----------------------------------------------------------------------------- +// PreInitPlugin +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CMPXCollectionPlaylist::PreInitPlugin() const + { + return iPreInitPlugin; + } + +// ----------------------------------------------------------------------------- +// Set AutoPlay +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPlaylist::SetPreInitPlugin(TBool aPreInitPlugin) + { + iPreInitPlugin = aPreInitPlugin; + } + + +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionutility/src/mpxcollectionutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionutility/src/mpxcollectionutility.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,32 @@ +/* +* 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: Factory method to create collection utility object +* +*/ + + +#include"mpxcollectionutilityimpl.h" + + +// ============================== MEMBER FUNCTIONS ============================ + +// ---------------------------------------------------------------------------- +// Create the collection utility object by mode +// ---------------------------------------------------------------------------- +// +EXPORT_C MMPXCollectionUtility* MMPXCollectionUtility::NewL(MMPXCollectionObserver* aObs, + const TUid& aModeId) + { + return CMPXCollectionUtility::NewL(aModeId,aObs); + } diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/collectionutility/src/mpxcollectionutilityimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/collectionutility/src/mpxcollectionutilityimpl.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,1187 @@ +/* +* Copyright (c) 2006 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: Collection Utility implementation +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mpxcollectionutilityimpl.h" + +// ============================== MEMBER FUNCTIONS ============================ + +// ---------------------------------------------------------------------------- +// Two phase constructor +// ---------------------------------------------------------------------------- +// +CMPXCollectionUtility* CMPXCollectionUtility::NewL( + const TUid& aModeId, + MMPXCollectionObserver* aObs) + { + CMPXCollectionUtility* p=new(ELeave)CMPXCollectionUtility(aObs); + CleanupStack::PushL(p); + p->ConstructL(aModeId); + CleanupStack::Pop(p); + return p; + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CMPXCollectionUtility::~CMPXCollectionUtility() + { + Cancel(); +#ifdef _ENABLE_GUARD_TIMER + delete iGuardTimer; +#endif + if (iTaskQueue) + { + delete iTaskQueue; + } + + delete iCurrentEntries; + + if (iMsgMonitor) + { + delete iMsgMonitor; + } + + iMcs.Close(); + + delete iBuffer; + delete iArray; + delete iMedia; + delete iMediaOnError; + } + +// ---------------------------------------------------------------------------- +// C++ constructor +// Create a unique name out of thread ID and this pointer: no other instance of +// this object will have the same name; used to identify this object for +// receiving messages +// ---------------------------------------------------------------------------- +// +CMPXCollectionUtility::CMPXCollectionUtility(MMPXCollectionObserver* aObs) +: CActive(EPriorityStandard), + iObserver(aObs), + iCallbackOngoing(EFalse) + { + CActiveScheduler::Add(this); + TThreadId threadId=RThread().Id(); // this thread id + } + +// ---------------------------------------------------------------------------- +// 2nd phase constructor +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::ConstructL(const TUid& aModeId) + { + MPX_FUNC_EX("CMPXCollectionUtility::ConstructL"); + iTaskQueue = CMPXTaskQueue::NewL(); + User::LeaveIfError( + iMcs.Connect(KMPXCollectionServerName, + KMPXCollectionServerImg, + TVersion(KMPXCollectionServerMajorVersionNumber, + KMPXCollectionServerMinorVersionNumber, + KMPXCollectionServerBuildVersionNumber))); + iMcs.SendReceiveL(EMcsSetMode,TIpcArgs(aModeId.iUid)); + iMsgMonitor = CMPXMessageMonitor::NewL(iMcs,*this); + iMediaOnError = CMPXMedia::NewL(); +#ifdef _ENABLE_GUARD_TIMER + iGuardTimer=CPeriodic::NewL(CActive::EPriorityStandard); +#endif + } + +// ---------------------------------------------------------------------------- +// Return reference to collection +// ---------------------------------------------------------------------------- +// +MMPXCollection& CMPXCollectionUtility::Collection() + { + return *this; + } + +// ---------------------------------------------------------------------------- +// Retrieves the ID of the collection resolved based on selection criteria +// ---------------------------------------------------------------------------- +// +TUid CMPXCollectionUtility::CollectionIDL(const TArray& aUids) + { + // Buffer to transfer UIDs + // + CBufBase* buf=CBufFlat::NewL(KMPXBufGranularity); + CleanupStack::PushL( buf ); + + RBufWriteStream writeStream( *buf ); + CleanupClosePushL( writeStream ); + ::ExternalizeL(aUids, writeStream); + writeStream.CommitL(); + buf->Compress(); + CleanupStack::PopAndDestroy(&writeStream); + + // IPC the data + // + TPtr8 des = buf->Ptr(0); + TPckgBuf pkg; + iMcs.SendReceiveL( EMcsCollectionIdLookup, TIpcArgs(&des, &pkg) ); + CleanupStack::PopAndDestroy( buf ); + + return pkg(); + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionUtility::AddSubscriptionL +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::AddSubscriptionL( + const CMPXSubscription& aSubscription) + { + const CMPXMediaArray* items = aSubscription.ItemsL(); + + CMPXCommand* cmd = CMPXCommand::NewL(); + CleanupStack::PushL(cmd); + cmd->SetTObjectValueL(KMPXCommandGeneralId, KMPXCommandSubscriptionAdd); + cmd->SetCObjectValueL(KMPXCommandSubscriptionAddItems, items); + cmd->SetTObjectValueL(KMPXCommandGeneralDoSync, ETrue); + CommandL(*cmd); + CleanupStack::PopAndDestroy(cmd); + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionUtility::RemoveSubscriptionL +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::RemoveSubscriptionL( + const CMPXSubscription& aSubscription) + { + const CMPXMediaArray* items = aSubscription.ItemsL(); + + CMPXCommand* cmd = CMPXCommand::NewL(); + CleanupStack::PushL(cmd); + cmd->SetTObjectValueL(KMPXCommandGeneralId, KMPXCommandSubscriptionRemove); + cmd->SetCObjectValueL(KMPXCommandSubscriptionAddItems, items); + cmd->SetTObjectValueL(KMPXCommandGeneralDoSync, ETrue); + CommandL(*cmd); + CleanupStack::PopAndDestroy(cmd); + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionUtility::ClearSubscriptionsL +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::ClearSubscriptionsL() + { + CMPXCommand* cmd = CMPXCommand::NewL(); + CleanupStack::PushL(cmd); + cmd->SetTObjectValueL(KMPXCommandGeneralId, KMPXCommandSubscriptionRemoveAll); + cmd->SetTObjectValueL(KMPXCommandGeneralDoSync, ETrue); + CommandL(*cmd); + CleanupStack::PopAndDestroy(cmd); + } + +// ---------------------------------------------------------------------------- +// Destroy this object +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::Close() + { + MPX_DEBUG2("CMPXCollectionUtility::Close %08x", this); + iMsgMonitor->Cancel(); + delete this; + } + +// ---------------------------------------------------------------------------- +// Open's collection with the mode. Data returned in callback +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::OpenL(TMPXOpenMode aMode) + { + MPX_DEBUG2("CMPXCollectionUtility::OpenL with mode %d", aMode); + AddRequestL(EMcsOpen, NULL, aMode); + } + +// ---------------------------------------------------------------------------- +// Open a collection +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::OpenL(TInt aIndex,TMPXOpenMode aMode) + { + RArray dummy; + CleanupClosePushL(dummy); + OpenL(aIndex, dummy.Array(), aMode); + CleanupStack::PopAndDestroy(&dummy); + } + +// ---------------------------------------------------------------------------- +// Open a collection by path +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::OpenL( + const CMPXCollectionPath& aPath, + TMPXOpenMode aMode) + { + RArray dummy; + CleanupClosePushL(dummy); + OpenL(aPath, dummy.Array(), aMode); + CleanupStack::PopAndDestroy(&dummy); + } + +// ---------------------------------------------------------------------------- +// Opens the collection at a specific index +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::OpenL( + TInt aIndex, + const TArray& aAttrs, + TMPXOpenMode aMode) + { + // Externalize parameters + // + CBufBase* buf=CBufFlat::NewL(KMPXBufGranularity); + CleanupStack::PushL( buf ); + + RBufWriteStream writeStream( *buf ); + CleanupClosePushL( writeStream ); + // Mode + writeStream.WriteInt32L(aMode); + // externalize attributes array + ::ExternalizeL(aAttrs, writeStream); + // Close and compress buffer + writeStream.CommitL(); + buf->Compress(); + CleanupStack::PopAndDestroy(&writeStream); + + // Async version, Add request to the task queue + AddRequestL(EMcsOpenIndex, NULL, aIndex, buf); + CleanupStack::Pop( buf ); // ownership transferred to the queue + } + +// ---------------------------------------------------------------------------- +// Opens the collection at a specific level +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::OpenL( + const CMPXCollectionPath& aPath, + const TArray& aAttrs, + TMPXOpenMode aMode) + { + MPX_FUNC("CMPXCollectionUtility::OpenL(const CMPXCollectionPath& aPath)"); + MPX_DEBUG_PATH(aPath); + CBufBase* buffer=CBufFlat::NewL(KMPXBufGranularity); + CleanupStack::PushL( buffer ); + RBufWriteStream writeStream( *buffer ); + CleanupClosePushL( writeStream ); + //collection path + writeStream << aPath; + // externalize open mode + writeStream.WriteInt32L(aMode); + // externalize attributes array + ::ExternalizeL(aAttrs, writeStream); + writeStream.CommitL(); + buffer->Compress(); + CleanupStack::PopAndDestroy(&writeStream); + AddRequestL(EMcsOpenPath, NULL, 0, buffer); + CleanupStack::Pop(buffer); //buffer ownership transferred + } + +// ---------------------------------------------------------------------------- +// Opens the collection in its current state, or if aUids do not +// apply to currently opened collection, then the state will +// revert back to root level +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::OpenL( + const TArray& aUids, + TMPXOpenMode aMode) + { + MPX_FUNC_EX("CMPXCollectionUtility::OpenL(aUids, aMode)"); + CBufBase* buf=CBufFlat::NewL(KMPXBufGranularity); + CleanupStack::PushL( buf ); + // Externalize parameters + // + RArray uids; + CleanupClosePushL(uids); + TInt count(aUids.Count()); + for (TInt i=0; iCompress(); + CleanupStack::PopAndDestroy(&writeStream); + + CleanupStack::PopAndDestroy(&uids); + // Async version, Add request to the task queue + AddRequestL(EMcsOpenByUids, NULL, 0, buf); + CleanupStack::Pop( buf ); // ownership transferred to the queue + } + +// ---------------------------------------------------------------------------- +// Opens the collection in its current state, or if aUid does not +// apply to currently opened collection, then the state will +// revert back to root level +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::OpenL( + const TUid& aUid, + TMPXOpenMode aMode) + { + RArray uids; + CleanupClosePushL(uids); + uids.AppendL(aUid); + OpenL(uids.Array(),aMode); + CleanupStack::PopAndDestroy(&uids); + } + +// ---------------------------------------------------------------------------- +// Apply a filter to collection browsing; all subsequent calls +// to OpenL() will have this filter applied +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::SetFilterL(CMPXFilter* aFilter) + { + if (aFilter) + { // Send filter to server + CBufBase* buf=NULL; + ::CreateBufferL(*aFilter,buf); + CleanupStack::PushL(buf); + TPtr8 ptr=buf->Ptr(0); + iMcs.SendReceiveL(EMcsSetFilter,TIpcArgs(&ptr)); + CleanupStack::PopAndDestroy(buf); + } + else + { // Else send zero length descriptor + iMcs.SendReceiveL(EMcsSetFilter,TIpcArgs(&KNullDesC8)); + } + } + +// ---------------------------------------------------------------------------- +// Current filter that is applied to collection browsing +// ---------------------------------------------------------------------------- +// +CMPXFilter* CMPXCollectionUtility::FilterL() + { + TInt size=iMcs.SendReceiveL(EMcsFilter); + // + // Transfer results from server + // + CMPXMedia* filter=NULL; + if (size) + { + ::TransferBufferFromServerL(iMcs,EMcsGetSyncBuffer,size,iBuffer); + ::NewFromBufferL(*iBuffer,filter); + } + return filter; + } + +// ---------------------------------------------------------------------------- +// The UID identifying this collection +// ---------------------------------------------------------------------------- +// +TUid CMPXCollectionUtility::UidL() const + { + TPckgBuf uidPkg; + iMcs.SendReceiveL(EMcsGetUid, TIpcArgs(&uidPkg)); + return TUid::Uid(uidPkg()); + } + +// ---------------------------------------------------------------------------- +// Return current collection path +// ---------------------------------------------------------------------------- +// +CMPXCollectionPath* CMPXCollectionUtility::PathL() + { + CMPXCollectionPath* path = NULL; + TInt size = iMcs.SendReceiveL(EMcsGetPath); + if (size >0) + { + ::TransferBufferFromServerL(iMcs, EMcsGetSyncBuffer, size, iBuffer); + ::NewFromBufferL(*iBuffer, path); + } + return path; + } + +// ---------------------------------------------------------------------------- +// Back to upper level +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::BackL() + { + AddRequestL(EMcsBack, NULL); + } + +// ---------------------------------------------------------------------------- +// Is remote collection path +// ---------------------------------------------------------------------------- +// +TBool CMPXCollectionUtility::IsRemote(const CMPXCollectionPath& aPath) + { + (void)aPath; + return EFalse; + } + +// ---------------------------------------------------------------------------- +// Remove outstanding requests +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::CancelRequest() + { + Cancel(); + iTaskQueue->Reset(); + } + +// ---------------------------------------------------------------------------- +// Add item(s) +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::AddL(const CMPXMedia& aNewProperties) + { + delete iMedia; + iMedia=NULL; + iMedia=CMPXMedia::NewL(aNewProperties); + + CBufBase* buf(NULL); + ::CreateBufferL( aNewProperties, buf ); + CleanupStack::PushL( buf ); + TPtr8 ptr = buf->Ptr(0); + iMcs.SendReceiveL( EMcsAddItem, TIpcArgs(&ptr)); + CleanupStack::PopAndDestroy( buf ); + } + +// ---------------------------------------------------------------------------- +// Remove a single item +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::RemoveL( + const CMPXCollectionPath& aPath, + MMPXCollectionRemoveObserver* aObs ) + { + // Serialize the path and send it to the collection + // + if (aPath.Levels()<=0) + { + User::Leave(KErrArgument); + } + CBufBase* buf(NULL); + ::CreateBufferL( aPath, buf ); + CleanupStack::PushL(buf); + AddRequestL(EMcsRemovePath, aObs, 0, buf); // buf ownership transferred + CleanupStack::Pop(buf); + } + +// ---------------------------------------------------------------------------- +// Remove a list of items +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::RemoveL(const CMPXMedia& aProperties) + { + delete iMedia; + iMedia=NULL; + iMedia=CMPXMedia::NewL(aProperties); + + CBufBase* buf(NULL); + ::CreateBufferL( aProperties, buf ); + CleanupStack::PushL( buf ); + TPtr8 ptr = buf->Ptr(0); + iMcs.SendReceiveL( EMcsRemoveItem, TIpcArgs(&ptr)); + CleanupStack::PopAndDestroy( buf ); + } + +// ---------------------------------------------------------------------------- +// Set properties +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::SetSyncL(const CMPXMedia& aMedia) + { + delete iMedia; + iMedia=NULL; + iMedia=CMPXMedia::NewL(aMedia); + + CBufBase* buf(NULL); + ::CreateBufferL( aMedia, buf ); + CleanupStack::PushL( buf ); + TPtr8 ptr = buf->Ptr(0); + iMcs.SendReceiveL( EMcsSetMedia, TIpcArgs(&ptr)); + CleanupStack::PopAndDestroy( buf ); + } + +// ---------------------------------------------------------------------------- +// Set properties Asynchronous +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::SetL(const CMPXMedia& /*aMedia*/) + { + ASSERT(0); // DEPRECATED, please use CommandL(CMPXCommand& aCmd) + } + +// ---------------------------------------------------------------------------- +// Find media +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::FindAllL(const CMPXMedia& aMedia, + const TArray& aAttrs, + MMPXCollectionFindObserver& aObs) + { + // Externalize parameters + // + CBufBase* buf(NULL); + ::CreateBufferL(aAttrs, buf); + CleanupStack::PushL(buf); + // Increase reference count on media ownership transferred + CMPXMedia* ref = CMPXMedia::NewL( aMedia ); + CleanupStack::PushL(ref); + AddRequestL(EMcsFindAll, &aObs, aMedia.Data(), buf, NULL, ref); + // Async version, Add request to the task queue + CleanupStack::Pop(ref); + CleanupStack::Pop( buf ); // ownership transferred to the queue + } + +// ---------------------------------------------------------------------------- +// Find media sync +// ---------------------------------------------------------------------------- +// +CMPXMedia* CMPXCollectionUtility::FindAllL(const CMPXMedia& aMedia, + const TArray& aAttrs) + { + CMPXMedia* media=CMPXMedia::NewL(aMedia); // keep media alive + CleanupStack::PushL(media); + + CBufBase* buf(NULL); + ::CreateBufferL(aAttrs, buf); + CleanupStack::PushL(buf); + + // Synchronous version, transfer directly + TPtr8 ptr = buf->Ptr(0); + TInt size = iMcs.SendReceiveL( EMcsFindAll, + TIpcArgs(&ptr, 1, media->Data()) ); + CleanupStack::PopAndDestroy( buf ); + + // Transfer results from server + // + CMPXMedia* results(NULL); + ::TransferBufferFromServerL( iMcs, EMcsGetSyncBuffer, + size, iBuffer ); + ::NewFromBufferL( *iBuffer, results ); + CleanupStack::PopAndDestroy(media); + return results; + } + +// ---------------------------------------------------------------------------- +// Issue media request +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::MediaL( + const CMPXCollectionPath& aPath, + const TArray& aAttrs, + CMPXAttributeSpecs* aSpecs/*=NULL*/, + CMPXFilter* aFilter/*=NULL*/) + { + MPX_FUNC_EX("CMPXCollectionUtility::MediaL()"); + MPX_DEBUG_PATH(aPath); + if (aPath.Levels()<=0) + { + User::Leave(KErrArgument); + } + CMPXCommand* cmd = CMPXCommand::NewL(); + CleanupStack::PushL(cmd); + + CMPXCollectionPath* path = CMPXCollectionPath::NewL(aPath); + CleanupStack::PushL(path); + path->Set(aAttrs); // aAttrs should be removed from parameter + // Clients should set attribute before API is called + + cmd->SetTObjectValueL(KMPXCommandGeneralId, KMPXCommandContentIdMedia); + cmd->SetCObjectValueL(KMPXCommandGeneralTargetIds, path); + CMPXAttributeSpecs* attrSpecs = aSpecs ? + CMPXAttributeSpecs::NewL(*aSpecs) : CMPXAttributeSpecs::NewL(); + CleanupStack::PushL(attrSpecs); + cmd->SetCObjectValueL(KMPXCommandMediaAttributeSpecs, attrSpecs); + CleanupStack::PopAndDestroy(attrSpecs); + CMPXFilter* filter = aFilter ? CMPXFilter::NewL(*aFilter) : CMPXFilter::NewL(); + CleanupStack::PushL(filter); + cmd->SetCObjectValueL(KMPXCommandMediaFilter, filter); + CleanupStack::PopAndDestroy(filter); + //call CommandL in the future. All APIs will be mapped to CommandL + AddRequestL(EMcsMediaByPath, NULL, 0, NULL, (TAny*)cmd, cmd); + CleanupStack::PopAndDestroy(path); + CleanupStack::Pop(cmd); // Ownership transferred to the task queue + } + +// ---------------------------------------------------------------------------- +// Add a request to broadcast a message +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::NotifyL( TMPXCollectionBroadCastMsg aMsg, + TInt aData ) + { + // Synchronous, for closing server file handles + iMcs.SendReceiveL( EMcsNotifyEvent, + TIpcArgs((TInt)aMsg, aData)); + } + +// ---------------------------------------------------------------------------- +// Send a Command to the collection +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::CommandL(TMPXCollectionCommand aCmd, TInt aData ) + { + // Synchronous, send a command to the server + iMcs.SendReceiveL( EMcsCommand, TIpcArgs( (TInt)aCmd, aData ) ); + } + +// ---------------------------------------------------------------------------- +// Send a Command to the collection +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::CommandL(CMPXCommand& aCmd) + { + TBool sync(EFalse); // by default command is asynchronous + if (aCmd.IsSupported(KMPXCommandGeneralDoSync)) + { // check if command is sync + sync=(aCmd.ValueTObjectL(KMPXCommandGeneralDoSync)); + } + if (sync) + { // sync request + iMcs.SendReceiveL(EMcsCommandExt, TIpcArgs(EFalse, aCmd.Data())); + } + else + { // async request + // Increase reference count on command ownership transferred + CMPXCommand* ref = CMPXCommand::NewL(aCmd); + // async version, Add request to the task queue + CleanupStack::PushL(ref); + AddRequestL(EMcsCommandExt, NULL, ETrue, NULL, (TAny*)ref, ref ); + CleanupStack::Pop(ref); // Ownership transferred to the task queue + } + } + +// ---------------------------------------------------------------------------- +// Retrieve the list of supported mime types +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::GetSupportedTypesL( + RPointerArray& aArray ) + { + TInt size = iMcs.SendReceiveL( EMcsGetSupportedTypes ); + ::ArrayFromServerL( iMcs, EMcsGetSyncBuffer, size, aArray ); + } + +// ---------------------------------------------------------------------------- +// Retrieve the bitmask of supported capabilities of the collection +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::GetSupportedCapabilitiesL( + TCollectionCapability& aCapability) + { + TPckgBuf pkg; + iMcs.SendReceiveL( EMcsGetCapabilities, TIpcArgs(&pkg) ); + aCapability = pkg(); + } + +// ---------------------------------------------------------------------------- +// Retrieves the actual collection implementation UID +// ---------------------------------------------------------------------------- +// +TUid CMPXCollectionUtility::CollectionIDL(TUid& aCollection) + { + TPckgBuf pkg( aCollection ); + iMcs.SendReceiveL( EMcsCollectionID, TIpcArgs(&pkg) ); + + return pkg(); + } + +// ---------------------------------------------------------------------------- +// Message received +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::MessageReceived(TInt aMsgData, TInt aError) + { + TRAP_IGNORE(HandleMessageL(aMsgData, aError)); + } + +// ---------------------------------------------------------------------------- +// Handles an active object's request completion event +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::RunL() + { +#ifdef _ENABLE_GUARD_TIMER + iGuardTimer->Cancel(); +#endif + TInt err=iStatus.Int(); + TInt task = iTaskQueue->Task(); + MPX_DEBUG4("-->CMPXCollectionUtility::RunL 0x%08x task %d err%d", + this, task, err); + if (KErrNotFound == task) + { + MPX_DEBUG1("CMPXCollectionUtility::RunL no task"); + return; + } + + // Try again in case server is down for IAD + if (err == KErrDied || err == KErrServerTerminated) + { + MPX_DEBUG3("-->CMPXCollectionUtility::RunL Reconnecting session for IAD 0x%08x task %d", + this, task); + + // attempt to bring the server back up + err = iMcs.Reconnect(); + + if (err != KErrNone) + { + MPX_DEBUG1("-->CMPXCollectionUtility::RunL Reconnect Failed"); + } + } + + // If there was an error, callback to observer with error code + User::LeaveIfError(err); + + switch(task) + { + case EMcsOpen: + case EMcsBack: + case EMcsOpenIndex: + case EMcsOpenPath: + case EMcsOpenByUids: + { + MPX_DEBUG1("CMPXCollectionUtility::RunL handle open"); + if(err == KMPXCollectionPath && iObserver) + { + CMPXCollectionPath* path = PathL(); + CleanupStack::PushL(path); + if (path->OpenNextMode() != EMPXOpenNoPlaylist) + { + CMPXCollectionPlaylist* p=CMPXCollectionPlaylist::NewL(*path); + CleanupStack::PushL(p); + + if( path->OpenNextMode() == EMPXOpenPlaylistOnly ) + { + p->SetToIndex( KErrNotFound ); + } + + iCallbackOngoing = ETrue; + iObserver->HandleOpenL(*p, KErrNone); + iCallbackOngoing = EFalse; + CleanupStack::PopAndDestroy(p); + } + CleanupStack::PopAndDestroy(path); + } + else if (KMPXCollectionEntries == err && iObserver) + { + MPX_DEBUG2("CMPXCollectionUtility::RunL with KMPXCollectionEntries %d", + iSizePckg()); + if (iSizePckg() >0) + { + ::TransferBufferFromServerL(iMcs,EMcsGetAsyncBuffer, + iSizePckg(), iBuffer); + ::NewFromBufferL(*iBuffer, iCurrentEntries); + } + MPX_DEBUG1("CMPXCollectionUtility::RunL call back client with entries"); + iCallbackOngoing = ETrue; + iObserver->HandleOpenL(*iCurrentEntries, + iSelectionPckg(), + (TBool)iCompletePckg(), + KErrNone); + iCallbackOngoing = EFalse; + } // else message will be received which triggers to read buffer + break; + } + case EMcsMediaByPath: + { + CMPXMedia* props = NULL; + if (iObserver) + { + if(iSizePckg() && KMPXCollectionMedia == err) + { + ::TransferBufferFromServerL(iMcs,EMcsGetAsyncBuffer, + iSizePckg(), iBuffer); + ::NewFromBufferL(*iBuffer, props); + err = KErrNone; + CleanupStack::PushL(props); + } + else + { + props = iMediaOnError; + } + iCallbackOngoing = ETrue; + iObserver->HandleCollectionMediaL(*props, err); + iCallbackOngoing = EFalse; + if (props && props != iMediaOnError) + { + CleanupStack::PopAndDestroy(props); + } + } + break; + } + case EMcsRemovePath: + { + MMPXCollectionRemoveObserver* obs = + (MMPXCollectionRemoveObserver*) iTaskQueue->Callback(); + + // Optional observer callback + CDesCArray* ary(NULL); + if( obs && err>0 ) + { + ::TransferBufferFromServerL(iMcs,EMcsGetAsyncBuffer, + err, iBuffer); + MPXUser::CreateFromBufferL(*iBuffer, ary); + CleanupStack::PushL( ary ); + iCallbackOngoing = ETrue; + obs->HandleRemoveL( *ary, KErrNone ); + iCallbackOngoing = EFalse; + CleanupStack::PopAndDestroy( ary ); + } // else error message will be sent later + break; + } + case EMcsFindAll: + { + MMPXCollectionFindObserver* obs = + (MMPXCollectionFindObserver*) iTaskQueue->Callback(); + CMPXMedia* results(NULL); + + // Any results? + if( err > 0 ) + { + if(obs) + { + ::TransferBufferFromServerL( iMcs, EMcsGetAsyncBuffer, + err, iBuffer ); + ::NewFromBufferL( *iBuffer, results ); + CleanupStack::PushL( results ); + iCallbackOngoing = ETrue; + obs->HandleFindAllL( *results, ETrue, KErrNone ); + iCallbackOngoing = EFalse; + CleanupStack::PopAndDestroy( results ); + } + } + break; + } + case EMcsSetMediaAsync: + { // DEPRECATED, please use CommandL(CMPXCommand& aCmd) + ASSERT(0); + break; + } + case EMcsCommandExt: + { + CMPXCommand* result = NULL; + if (iObserver && KErrNone == err) + { + if(iSizePckg()) + { + ::TransferBufferFromServerL(iMcs,EMcsGetAsyncBuffer, + iSizePckg(), iBuffer); + ::NewFromBufferL(*iBuffer, result); + } + CleanupStack::PushL(result); + iCallbackOngoing = ETrue; + iObserver->HandleCommandComplete(result, KErrNone); + iCallbackOngoing = EFalse; + CleanupStack::PopAndDestroy(result); + } + break; + } + default: + ASSERT(0); + } + iTaskQueue->RemoveTask(); + ExecuteNextRequest(); + MPX_DEBUG4("<--CMPXCollectionUtility::RunL 0x%08x task %d err%d", + this, task, err); + } + +// ---------------------------------------------------------------------------- +// Sends error message to all observers - maybe it should only be to the +// client that calls the async method? +// ---------------------------------------------------------------------------- +// +TInt CMPXCollectionUtility::RunError(TInt aError) + { + MPX_FUNC_EX("CMPXCollectionUtility::RunError"); + TRAP_IGNORE(HandleRunErrorL(aError)); + iCallbackOngoing = EFalse; + iTaskQueue->RemoveTask(); + ExecuteNextRequest(); + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// Handle cancelling request +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::DoCancel() + { +#ifdef _ENABLE_GUARD_TIMER + iGuardTimer->Cancel(); +#endif + TRAP_IGNORE(iMcs.SendReceiveL(EMcsCancelRequest)); + } + +// ---------------------------------------------------------------------------- +// Adds a sync request to the queue: if there is no outstanding request, +// it will be executed immediately +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::AddRequestL( + TMPXCollectionServerOp aFunction, + TAny* aObs, + TInt aParamData/*=0*/, + CBufBase* aBuf/*=NULL*/, + TAny* aPtr/*=NULL*/, + CBase* aAlivePtr1/*=NULL*/, + CBase* aAlivePtr2/*=NULL*/) + { + iTaskQueue->AddTaskL(aFunction, aObs, aParamData, aBuf, + aPtr, aAlivePtr1, aAlivePtr2); + MPX_DEBUG3("CMPXCollectionUtility::AddRequestL this 0x%08x task=%d", + this, aFunction); + if (!IsActive() && !iCallbackOngoing) + { + ExecuteNextRequest(); + } + } + +// ---------------------------------------------------------------------------- +// Executes the next request in the queue. +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::ExecuteNextRequest() + { + TInt task = iTaskQueue->Task(); + if (KErrNotFound != task && !IsActive() && !iCallbackOngoing) + { + switch(task) + { + case EMcsOpenIndex: + { + iSelectionPckg = (TInt)iTaskQueue->Param(); + } // deliberate fall through + case EMcsOpenByUids: + case EMcsOpenPath: + { + iMcs.SendReceive(task, + TIpcArgs(&iSizePckg, // [out] size of buffer + &iSelectionPckg, // [in, out] selection index + &iCompletePckg, // [out] complete + &iTaskQueue->BufData()), // index, mode and attr + iStatus); + break; + } + + case EMcsOpen: + { + iMcs.SendReceive(EMcsOpen, + TIpcArgs(&iSizePckg, + &iSelectionPckg, + &iCompletePckg, + iTaskQueue->Param()), // mode + iStatus); + break; + } + case EMcsMediaByPath: + { + iMcs.SendReceive(EMcsMediaByPath, + TIpcArgs(&iSizePckg, + ((CMPXCommand*)(iTaskQueue->PtrData()))->Data()), // command handle + iStatus); + break; + } + case EMcsBack: + { + iMcs.SendReceive(EMcsBack, + TIpcArgs(&iSizePckg, + &iSelectionPckg, + &iCompletePckg), + iStatus); + break; + } + case EMcsRemovePath: // deliberate fall through + { + iMcs.SendReceive( task, + TIpcArgs(&iTaskQueue->BufData()), + iStatus); + break; + } + case EMcsFindAll: + { + iMcs.SendReceive( task, + TIpcArgs(&iTaskQueue->BufData(), // Attrs + 0, // Not sync + iTaskQueue->Param()), // Media data handle + iStatus ); + break; + } + case EMcsCommandExt: + { + iMcs.SendReceive(EMcsCommandExt, + TIpcArgs(iTaskQueue->Param(), //[in] Async flag + ((CMPXCommand*)(iTaskQueue->PtrData()))->Data(), + //[in] command handle + &iSizePckg), //[out] size of buffer + iStatus); + break; + } + default: + ASSERT(0); + } + #ifdef _ENABLE_GUARD_TIMER + iGuardTimer->Start(KMPXGuardTimer,KMPXGuardTimer, + TCallBack(GuardTimerCallback,this)); + #endif + SetActive(); + MPX_DEBUG3("CMPXCollectionUtility::ExecuteNextRequest 0x%08x task %d ", + this, task); + } + } + +// ---------------------------------------------------------------------------- +// CMPXCollectionUtility::HandleMessageL +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::HandleMessageL(TInt aMsgData, TInt aError) + { + MPX_FUNC_EX("CMPXCollectionUtility::HandleMessageL"); + if (iObserver) + { + if (aMsgData>0) + { + CMPXMessage* msg= CMPXMessage::NewL(aMsgData); + CleanupStack::PushL(msg); + MPX_ASSERT(msg->IsSupported(KMPXMessageGeneralId)); + iObserver->HandleCollectionMessage(msg, aError); + CleanupStack::PopAndDestroy(msg); + } + else + { // NULL message + iObserver->HandleCollectionMessage(NULL, aError); + } + } + else + { + MPX_DEBUG1("CMPXCollectionUtility::HandleMessageL no observer"); + } + iMsgMonitor->GetNextMessage(); + } + + +// ---------------------------------------------------------------------------- +// Handle error in RunL +// ---------------------------------------------------------------------------- +// +void CMPXCollectionUtility::HandleRunErrorL(TInt aError) + { + TInt task = iTaskQueue->Task(); + if (!iCallbackOngoing) + { // Error happens during preparing callback + iCallbackOngoing = ETrue; // will be reset to EFalse in the RunError + switch(task) + { + case EMcsOpen: + case EMcsBack: + case EMcsOpenIndex: + case EMcsOpenPath: + case EMcsOpenByUids: + { + if (iObserver) + { + iObserver->HandleOpenL(*iMediaOnError, KErrNotFound, + ETrue, aError); + } + break; + } + case EMcsMediaByPath: + { + if (iObserver) + { + iObserver->HandleCollectionMediaL(*iMediaOnError, aError); + } + break; + } + case EMcsRemovePath: + { + MMPXCollectionRemoveObserver* obs = + (MMPXCollectionRemoveObserver*) iTaskQueue->Callback(); + if( obs) + { + CDesCArray* ary(NULL); + obs->HandleRemoveL(*ary, aError); // change HandleRemoveL return pointer + } // else error message will be sent later + break; + } + case EMcsFindAll: + { + MMPXCollectionFindObserver* obs = + (MMPXCollectionFindObserver*) iTaskQueue->Callback(); + if (obs) + { + obs->HandleFindAllL( *iMediaOnError, ETrue, aError); + } + break; + } + case EMcsCommandExt: + { + if (iObserver) + { + iObserver->HandleCommandComplete(iMediaOnError, aError); + } + break; + } + default: + ASSERT(0); + } + } // do nothing if error happens during client processing callback. + // all callback should be changed into non-leave so that this will + // be never happen. + } + +#ifdef _ENABLE_GUARD_TIMER +// ---------------------------------------------------------------------------- +// Guard timer time out +// ---------------------------------------------------------------------------- +// +TInt CMPXCollectionUtility::GuardTimerCallback(TAny* aPtr) + { + CMPXCollectionUtility* cu = static_cast(aPtr); + MPX_DEBUG3("CMPXCollectionUtility::GaurdTimerCallback this 0x%08x task=%d", + cu, cu->iTaskQueue->Task()); + cu->iGuardTimer->Cancel(); + ASSERT(0); // the function should never be called + return KErrNone; + } +#endif +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2006 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 for project collection framework +* +*/ + + +#include + +#include "../collectionutility/group/bld.inf" +#include "../collectionengine/group/bld.inf" +#include "../collectionserver/group/bld.inf" + +PRJ_EXPORTS +../rom/mpxcollectionframework.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mpxcollectionframework.iby) + diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/inc/mpxcollectionengineobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/inc/mpxcollectionengineobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2006 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: Collection engine observer +* +*/ + + + +#ifndef MMPXCOLLECTIONENGINEOBSERVER_H +#define MMPXCOLLECTIONENGINEOBSERVER_H + +#include +#include + +/** +* Interface for receiving data asynchronously +*/ +NONSHARABLE_CLASS(MMPXCollectionEngineObserver) : public MMPXCollectionEngineCommonObserver + { +public: + /** + * Handles the collection entries being opened. Typically called + * when client has Open()'d a folder + * Or Handles the item being opened. Typically called + * when client has Open()'d an item. Client typically responds by + * 'playing' the item via the playlist + * + * @param aMedia media to hold collection entries + * @param aIndex focused entry + * @param aComplete ETrue no more entries. EFalse more entries expected + * @param aError error code + */ + virtual void HandleOpen(CMPXMedia* aMedia, + TInt aIndex,TBool aComplete,TInt aError) = 0; + + /** + * Handles a generic Async Op completion ( nothing to return ) + * @param aError, error to complete + */ + virtual void HandleOpComplete( TInt aError ) = 0; + }; + +#endif // MMPXCOLLECTIONENGINEOBSERVER_H diff -r 000000000000 -r a2952bb97e68 mpx/collectionframework/rom/mpxcollectionframework.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/collectionframework/rom/mpxcollectionframework.iby Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2006 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: Image description file for project MPX Collection Framework. +* +*/ + + +#ifndef MPXCOLLECTIONFRAMEWORK_IBY +#define MPXCOLLECTIONFRAMEWORK_IBY + +#include + + +file=ABI_DIR\BUILD_DIR\mpxcollectionutility.dll SHARED_LIB_DIR\mpxcollectionutility.dll +file=ABI_DIR\BUILD_DIR\mpxcollectionserver.exe PROGRAMS_DIR\mpxcollectionserver.exe +file=ABI_DIR\BUILD_DIR\mpxcollectionengine.dll SHARED_LIB_DIR\mpxcollectionengine.dll + +#endif // MPXCOLLECTIONFRAMEWORK_IBY diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/bwinscw/mpxcommonU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/bwinscw/mpxcommonU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,287 @@ +EXPORTS + ??0CMPXCollectionType@@QAE@ABVTUid@@PAVCDesC16Array@@1@Z @ 1 NONAME ; CMPXCollectionType::CMPXCollectionType(class TUid const &, class CDesC16Array *, class CDesC16Array *) + ??0CMPXCollectionType@@QAE@XZ @ 2 NONAME ; CMPXCollectionType::CMPXCollectionType(void) + ??0CMPXParameter@@QAE@XZ @ 3 NONAME ; CMPXParameter::CMPXParameter(void) + ??0CMPXPluginHandlerBase@@QAE@VTUid@@W4TPluginSelection@0@HAAVMMPXPluginHandlerObserver@@PAVCMPXPluginMonitor@@@Z @ 4 NONAME ; CMPXPluginHandlerBase::CMPXPluginHandlerBase(class TUid, enum CMPXPluginHandlerBase::TPluginSelection, int, class MMPXPluginHandlerObserver &, CMPXPluginMonitor*) + ??0TMPXAttribute@@QAE@ABV0@@Z @ 5 NONAME ; TMPXAttribute::TMPXAttribute(class TMPXAttribute const &) + ??0TMPXAttribute@@QAE@ABVTMPXAttributeData@@@Z @ 6 NONAME ; TMPXAttribute::TMPXAttribute(class TMPXAttributeData const &) + ??0TMPXAttribute@@QAE@HI@Z @ 7 NONAME ; TMPXAttribute::TMPXAttribute(int, unsigned int) + ??0TMPXAttribute@@QAE@XZ @ 8 NONAME ; TMPXAttribute::TMPXAttribute(void) + ??0TMPXMessage@@QAE@ABV0@@Z @ 9 NONAME ; TMPXMessage::TMPXMessage(class TMPXMessage const &) + ??0TMPXMessage@@QAE@HHH@Z @ 10 NONAME ; TMPXMessage::TMPXMessage(int, int, int) + ??0TMPXMessage@@QAE@XZ @ 11 NONAME ; TMPXMessage::TMPXMessage(void) + ??1CMPXActiveTaskQueue@@UAE@XZ @ 12 NONAME ; CMPXActiveTaskQueue::~CMPXActiveTaskQueue(void) + ??1CMPXCenRepWatcher@@UAE@XZ @ 13 NONAME ; CMPXCenRepWatcher::~CMPXCenRepWatcher(void) + ??1CMPXClientList@@UAE@XZ @ 14 NONAME ; CMPXClientList::~CMPXClientList(void) + ??1CMPXCollectionPath@@UAE@XZ @ 15 NONAME ; CMPXCollectionPath::~CMPXCollectionPath(void) + ??1CMPXDrmMediaUtility@@UAE@XZ @ 16 NONAME ; CMPXDrmMediaUtility::~CMPXDrmMediaUtility(void) + ??1CMPXMedia@@UAE@XZ @ 17 NONAME ; CMPXMedia::~CMPXMedia(void) + ??1CMPXMediaArray@@UAE@XZ @ 18 NONAME ; CMPXMediaArray::~CMPXMediaArray(void) + ??1CMPXMessageMonitor@@UAE@XZ @ 19 NONAME ; CMPXMessageMonitor::~CMPXMessageMonitor(void) + ??1CMPXMessageQueue@@UAE@XZ @ 20 NONAME ; CMPXMessageQueue::~CMPXMessageQueue(void) + ??1CMPXPSKeyWatcher@@UAE@XZ @ 21 NONAME ; CMPXPSKeyWatcher::~CMPXPSKeyWatcher(void) + ??1CMPXParameter@@UAE@XZ @ 22 NONAME ; CMPXParameter::~CMPXParameter(void) + ??1CMPXPluginHandlerBase@@UAE@XZ @ 23 NONAME ; CMPXPluginHandlerBase::~CMPXPluginHandlerBase(void) + ??1CMPXPluginMonitor@@UAE@XZ @ 24 NONAME ; CMPXPluginMonitor::~CMPXPluginMonitor(void) + ??1CMPXTaskQueue@@UAE@XZ @ 25 NONAME ; CMPXTaskQueue::~CMPXTaskQueue(void) + ??4CMPXMedia@@QAEAAV0@ABV0@@Z @ 26 NONAME ; class CMPXMedia & CMPXMedia::operator=(class CMPXMedia const &) + ??4TMPXAttribute@@QAEAAV0@ABV0@@Z @ 27 NONAME ; class TMPXAttribute & TMPXAttribute::operator=(class TMPXAttribute const &) + ??4TMPXMessage@@QAEAAV0@ABV0@@Z @ 28 NONAME ; class TMPXMessage & TMPXMessage::operator=(class TMPXMessage const &) + ??8TMPXAttribute@@QBEHABV0@@Z @ 29 NONAME ; int TMPXAttribute::operator==(class TMPXAttribute const &) const + ??ACMPXMediaArray@@QBEPAVCMPXMedia@@H@Z @ 30 NONAME ; class CMPXMedia * CMPXMediaArray::operator[](int) const + ??ECMPXCollectionPath@@QAEHXZ @ 31 NONAME ; int CMPXCollectionPath::operator++(void) + ??FCMPXCollectionPath@@QAEHXZ @ 32 NONAME ; int CMPXCollectionPath::operator--(void) + ??ITMPXAttributeData@@QBEHAAI@Z @ 33 NONAME ; int TMPXAttributeData::operator&(unsigned int &) const + ??ITMPXAttributeData@@QBEHABV0@@Z @ 34 NONAME ; int TMPXAttributeData::operator&(class TMPXAttributeData const &) const + ??UTMPXAttributeData@@QBE?AV0@ABV0@@Z @ 35 NONAME ; class TMPXAttributeData TMPXAttributeData::operator|(class TMPXAttributeData const &) const + ?Add@CMPXMessageQueue@@QAEXPBVCMPXMedia@@H@Z @ 36 NONAME ; void CMPXMessageQueue::Add(class CMPXMedia const *, int) + ?AddClientL@CMPXClientList@@QAEXVTThreadId@@HPAVCMPXMessageQueue@@@Z @ 37 NONAME ; void CMPXClientList::AddClientL(class TThreadId, int, class CMPXMessageQueue *) + ?AddClientL@CMPXClientList@@QAEXVTThreadId@@PAVCMPXMessageQueue@@@Z @ 38 NONAME ; void CMPXClientList::AddClientL(class TThreadId, class CMPXMessageQueue *) + ?AddTaskL@CMPXActiveTaskQueue@@QAEXHPAXPAVMMPXTaskQueueObserver@@HPAVCBufBase@@0PAVCBase@@3@Z @ 39 NONAME ; void CMPXActiveTaskQueue::AddTaskL(int, void *, class MMPXTaskQueueObserver *, int, class CBufBase *, void *, class CBase *, class CBase *) + ?AddTaskL@CMPXTaskQueue@@QAEXHPAXHPAVCBufBase@@0PAVCBase@@2@Z @ 40 NONAME ; void CMPXTaskQueue::AddTaskL(int, void *, int, class CBufBase *, void *, class CBase *, class CBase *) + ?Alloc8L@MPXUser@@SAPAVHBufC8@@ABVTDesC16@@@Z @ 41 NONAME ; class HBufC8 * MPXUser::Alloc8L(class TDesC16 const &) + ?AllocL@MPXUser@@SAPAVHBufC16@@ABVTDesC8@@@Z @ 42 NONAME ; class HBufC16 * MPXUser::AllocL(class TDesC8 const &) + ?AppendL@CMPXCollectionPath@@QAEXABV?$TArray@VTMPXItemId@@@@@Z @ 43 NONAME ; void CMPXCollectionPath::AppendL(class TArray const &) + ?AppendL@CMPXCollectionPath@@QAEXABVTMPXItemId@@@Z @ 44 NONAME ; void CMPXCollectionPath::AppendL(class TMPXItemId const &) + ?AppendL@CMPXMediaArray@@QAEXABVCMPXMedia@@@Z @ 45 NONAME ; void CMPXMediaArray::AppendL(class CMPXMedia const &) + ?AppendL@CMPXMediaArray@@QAEXPBVCMPXMedia@@@Z @ 46 NONAME ; void CMPXMediaArray::AppendL(class CMPXMedia const *) + ?Attribute@CMPXMedia@@QBEABVTMPXAttribute@@H@Z @ 47 NONAME ; class TMPXAttribute const & CMPXMedia::Attribute(int) const + ?AttributeId@TMPXAttribute@@QBEIXZ @ 48 NONAME ; unsigned int TMPXAttribute::AttributeId(void) const + ?Attributes@CMPXMedia@@QBE?BV?$TArray@VTMPXAttribute@@@@XZ @ 49 NONAME ; class TArray const CMPXMedia::Attributes(void) const + ?AttributesSet@CMPXMedia@@QBEIH@Z @ 50 NONAME ; unsigned int CMPXMedia::AttributesSet(int) const + ?Back@CMPXCollectionPath@@QAEXXZ @ 51 NONAME ; void CMPXCollectionPath::Back(void) + ?BaseConstructL@CMPXPluginHandlerBase@@IAEXXZ @ 52 NONAME ; void CMPXPluginHandlerBase::BaseConstructL(void) + ?BufData@CMPXTaskQueue@@QAEABVTDesC8@@XZ @ 53 NONAME ; class TDesC8 const & CMPXTaskQueue::BufData(void) + ?Callback@CMPXTaskQueue@@QAEPAXXZ @ 54 NONAME ; void * CMPXTaskQueue::Callback(void) + ?CancelRequests@CMPXActiveTaskQueue@@QAEXXZ @ 55 NONAME ; void CMPXActiveTaskQueue::CancelRequests(void) + ?ClearSelection@CMPXCollectionPath@@QAEXXZ @ 56 NONAME ; void CMPXCollectionPath::ClearSelection(void) + ?ClearSelectionCriteria@CMPXPluginHandlerBase@@UAEXXZ @ 57 NONAME ; void CMPXPluginHandlerBase::ClearSelectionCriteria(void) + ?ClientCount@CMPXClientList@@QBEHXZ @ 58 NONAME ; int CMPXClientList::ClientCount(void) const + ?ClientMode@CMPXClientList@@QBEHH@Z @ 59 NONAME ; int CMPXClientList::ClientMode(int) const + ?ClientProcessList@CMPXClientList@@QBE?AV?$TArray@VTProcessId@@@@XZ @ 60 NONAME ; class TArray CMPXClientList::ClientProcessList(void) const + ?Close@CMPXDrmMediaUtility@@QAEXXZ @ 61 NONAME ; void CMPXDrmMediaUtility::Close(void) + ?CompareOrderedUidArrays@MPXUser@@SAHABV?$TArray@VTUid@@@@0@Z @ 62 NONAME ; int MPXUser::CompareOrderedUidArrays(class TArray const &, class TArray const &) + ?CompareUids@MPXUser@@SAHABVTUid@@0@Z @ 63 NONAME ; int MPXUser::CompareUids(class TUid const &, class TUid const &) + ?CompleteTask@CMPXActiveTaskQueue@@QAEXXZ @ 64 NONAME ; void CMPXActiveTaskQueue::CompleteTask(void) + ?CompleteWithDllPath@MPXUser@@SAHABVTDesC16@@AAVTDes16@@@Z @ 65 NONAME ; int MPXUser::CompleteWithDllPath(class TDesC16 const &, class TDes16 &) + ?Connect@RMPXSession@@QAEHABVTDesC16@@0ABVTVersion@@@Z @ 66 NONAME ; int RMPXSession::Connect(class TDesC16 const &, class TDesC16 const &, class TVersion const &) + ?ConsumeL@CMPXDrmMediaUtility@@QAEXW4TDrmConsumeType@@@Z @ 67 NONAME ; void CMPXDrmMediaUtility::ConsumeL(enum TDrmConsumeType) + ?ContentId@TMPXAttribute@@QBEHXZ @ 68 NONAME ; int TMPXAttribute::ContentId(void) const + ?CopyArrayL@MPXUser@@SAXABVMDesC16Array@@AAVCDesC16Array@@@Z @ 69 NONAME ; void MPXUser::CopyArrayL(class MDesC16Array const &, class CDesC16Array &) + ?Count@CMPXCollectionPath@@QBEHXZ @ 70 NONAME ; int CMPXCollectionPath::Count(void) const + ?Count@CMPXMedia@@QBEHXZ @ 71 NONAME ; int CMPXMedia::Count(void) const + ?Count@CMPXMediaArray@@QBEHXZ @ 72 NONAME ; int CMPXMediaArray::Count(void) const + ?CreateBufferL@MPXUser@@SAXABVRMessage2@@HAAPAVCBufBase@@@Z @ 73 NONAME ; void MPXUser::CreateBufferL(class RMessage2 const &, int, class CBufBase * &) + ?CreateBufferL@MPXUser@@SAXABVTDesC16@@AAPAVCBufBase@@@Z @ 74 NONAME ; void MPXUser::CreateBufferL(class TDesC16 const &, class CBufBase * &) + ?CreateBufferL@MPXUser@@SAXPBVMDesC16Array@@AAPAVCBufBase@@@Z @ 75 NONAME ; void MPXUser::CreateBufferL(class MDesC16Array const *, class CBufBase * &) + ?CreateBufferLC@MPXUser@@SAPAVCBufBase@@H@Z @ 76 NONAME ; class CBufBase * MPXUser::CreateBufferLC(int) + ?CreateFromBufferL@MPXUser@@SAXABVCBufBase@@AAPAVCDesC16Array@@@Z @ 77 NONAME ; void MPXUser::CreateFromBufferL(class CBufBase const &, class CDesC16Array * &) + ?CreatePluginListL@CMPXPluginHandlerBase@@QAEXXZ @ 78 NONAME ; void CMPXPluginHandlerBase::CreatePluginListL(void) + ?CurrentValueL@CMPXCenRepWatcher@@QAEHXZ @ 79 NONAME ; int CMPXCenRepWatcher::CurrentValueL(void) + ?Data@TMPXMessage@@QBEHXZ @ 80 NONAME ; int TMPXMessage::Data(void) const + ?Delete@CMPXMedia@@QAEXABVTMPXAttribute@@@Z @ 81 NONAME ; void CMPXMedia::Delete(class TMPXAttribute const &) + ?Delete@CMPXMedia@@QAEXH@Z @ 82 NONAME ; void CMPXMedia::Delete(int) + ?Deselect@CMPXCollectionPath@@QAEXABVTMPXItemId@@@Z @ 83 NONAME ; void CMPXCollectionPath::Deselect(class TMPXItemId const &) + ?Deselect@CMPXCollectionPath@@QAEXH@Z @ 84 NONAME ; void CMPXCollectionPath::Deselect(int) + ?DeselectAll@CMPXCollectionPath@@QAEXXZ @ 85 NONAME ; void CMPXCollectionPath::DeselectAll(void) + ?DoCancel@CMPXMessageMonitor@@MAEXXZ @ 86 NONAME ; void CMPXMessageMonitor::DoCancel(void) + ?DoResolvePluginL@CMPXPluginHandlerBase@@MAEXAAVTUid@@AAHAAVTPtrC16@@1@Z @ 87 NONAME ; void CMPXPluginHandlerBase::DoResolvePluginL(class TUid &, int &, class TPtrC16 &, int &) + ?Event@TMPXMessage@@QBEHXZ @ 88 NONAME ; int TMPXMessage::Event(void) const + ?ExternalizeL@CMPXCollectionPath@@QBEXAAVRWriteStream@@@Z @ 89 NONAME ; void CMPXCollectionPath::ExternalizeL(class RWriteStream &) const + ?ExternalizeL@CMPXCollectionType@@QBEXAAVRWriteStream@@@Z @ 90 NONAME ; void CMPXCollectionType::ExternalizeL(class RWriteStream &) const + ?ExternalizeL@CMPXMedia@@QBEXAAVRWriteStream@@@Z @ 91 NONAME ; void CMPXMedia::ExternalizeL(class RWriteStream &) const + ?ExternalizeL@CMPXMediaArray@@QBEXAAVRWriteStream@@@Z @ 92 NONAME ; void CMPXMediaArray::ExternalizeL(class RWriteStream &) const + ?ExternalizeL@CMPXParameter@@QBEXAAVRWriteStream@@@Z @ 93 NONAME ; void CMPXParameter::ExternalizeL(class RWriteStream &) const + ?ExternalizeL@MPXUser@@SAXABV?$TArray@VTMPXItemId@@@@AAVRWriteStream@@@Z @ 94 NONAME ; void MPXUser::ExternalizeL(class TArray const &, class RWriteStream &) + ?ExternalizeL@MPXUser@@SAXPBVMDesC16Array@@AAVRWriteStream@@@Z @ 95 NONAME ; void MPXUser::ExternalizeL(class MDesC16Array const *, class RWriteStream &) + ?ExternalizeL@TMPXAttribute@@QBEXAAVRWriteStream@@@Z @ 96 NONAME ; void TMPXAttribute::ExternalizeL(class RWriteStream &) const + ?Find@CMPXClientList@@QBEHABVCMPXMessageQueue@@@Z @ 97 NONAME ; int CMPXClientList::Find(class CMPXMessageQueue const &) const + ?Find@CMPXClientList@@QBEHVTThreadId@@@Z @ 98 NONAME ; int CMPXClientList::Find(class TThreadId) const + ?FindPlugin@CMPXPluginHandlerBase@@QBE?AVTUid@@ABV?$TArray@VTUid@@@@@Z @ 99 NONAME ; class TUid CMPXPluginHandlerBase::FindPlugin(class TArray const &) const + ?FindWindowGroupIdL@MPXUser@@SAHVTProcessId@@AAVRWsSession@@@Z @ 100 NONAME ; int MPXUser::FindWindowGroupIdL(class TProcessId, class RWsSession &) + ?GetMediaL@CMPXDrmMediaUtility@@QAEPBVCMPXMedia@@I@Z @ 101 NONAME ; class CMPXMedia const * CMPXDrmMediaUtility::GetMediaL(unsigned int) + ?GetNextMessage@CMPXMessageMonitor@@QAEXXZ @ 102 NONAME ; void CMPXMessageMonitor::GetNextMessage(void) + ?GetPluginTypes@CMPXPluginHandlerBase@@QBEXAAV?$RArray@H@@@Z @ 103 NONAME ; void CMPXPluginHandlerBase::GetPluginTypes(class RArray &) const + ?GetPluginUids@CMPXPluginHandlerBase@@QBEXAAV?$RArray@VTUid@@@@@Z @ 104 NONAME ; void CMPXPluginHandlerBase::GetPluginUids(class RArray &) const + ?GetPluginUidsL@CMPXPluginHandlerBase@@QBEXAAV?$RArray@VTUid@@@@H@Z @ 105 NONAME ; void CMPXPluginHandlerBase::GetPluginUidsL(class RArray &, int) const + ?GetSelectionCriteria@CMPXPluginHandlerBase@@UAEXAAW4TPluginSelection@1@AAHAAVTUid@@AAVTPtrC8@@33@Z @ 106 NONAME ; void CMPXPluginHandlerBase::GetSelectionCriteria(enum CMPXPluginHandlerBase::TPluginSelection &, int &, class TUid &, class TPtrC8 &, class TPtrC8 &, class TPtrC8 &) + ?GetValue@CMPXPSKeyWatcher@@QAEHAAH@Z @ 107 NONAME ; int CMPXPSKeyWatcher::GetValue(int &) + ?GetValue@CMPXPSKeyWatcher@@QAEHAAVTDes16@@@Z @ 108 NONAME ; int CMPXPSKeyWatcher::GetValue(class TDes16 &) + ?GetValue@CMPXPSKeyWatcher@@QAEHAAVTDes8@@@Z @ 109 NONAME ; int CMPXPSKeyWatcher::GetValue(class TDes8 &) + ?HandleChange@CMPXCollectionPath@@QAEHABVTUid@@ABVTMPXItemId@@1W4TMPXCollectionPathChange@1@AAH@Z @ 110 NONAME ; int CMPXCollectionPath::HandleChange(class TUid const &, class TMPXItemId const &, class TMPXItemId const &, enum CMPXCollectionPath::TMPXCollectionPathChange, int &) + ?Id@CMPXCollectionPath@@QBEABVTMPXItemId@@H@Z @ 111 NONAME ; class TMPXItemId const & CMPXCollectionPath::Id(int) const + ?Id@CMPXCollectionPath@@QBEABVTMPXItemId@@XZ @ 112 NONAME ; class TMPXItemId const & CMPXCollectionPath::Id(void) const + ?IdOfIndex@CMPXCollectionPath@@QBEABVTMPXItemId@@H@Z @ 113 NONAME ; class TMPXItemId const & CMPXCollectionPath::IdOfIndex(int) const + ?Index@CMPXCollectionPath@@QBEHH@Z @ 114 NONAME ; int CMPXCollectionPath::Index(int) const + ?Index@CMPXCollectionPath@@QBEHXZ @ 115 NONAME ; int CMPXCollectionPath::Index(void) const + ?Index@CMPXMedia@@QBEHABVTMPXAttribute@@@Z @ 116 NONAME ; int CMPXMedia::Index(class TMPXAttribute const &) const + ?IndexOf@CMPXPluginHandlerBase@@QBEHABVTUid@@@Z @ 117 NONAME ; int CMPXPluginHandlerBase::IndexOf(class TUid const &) const + ?IndexOfId@CMPXCollectionPath@@QBEHABVTMPXItemId@@@Z @ 118 NONAME ; int CMPXCollectionPath::IndexOfId(class TMPXItemId const &) const + ?InitL@CMPXDrmMediaUtility@@QAEXAAVRFile@@@Z @ 119 NONAME ; void CMPXDrmMediaUtility::InitL(class RFile &) + ?InitL@CMPXDrmMediaUtility@@QAEXABVTDesC16@@@Z @ 120 NONAME ; void CMPXDrmMediaUtility::InitL(class TDesC16 const &) + ?Insert@CMPXMediaArray@@QAEHABVCMPXMedia@@H@Z @ 121 NONAME ; int CMPXMediaArray::Insert(class CMPXMedia const &, int) + ?Insert@CMPXMediaArray@@QAEHPBVCMPXMedia@@H@Z @ 122 NONAME ; int CMPXMediaArray::Insert(class CMPXMedia const *, int) + ?InsertL@CMPXMediaArray@@QAEXABVCMPXMedia@@H@Z @ 123 NONAME ; void CMPXMediaArray::InsertL(class CMPXMedia const &, int) + ?InsertL@CMPXMediaArray@@QAEXPBVCMPXMedia@@H@Z @ 124 NONAME ; void CMPXMediaArray::InsertL(class CMPXMedia const *, int) + ?InternalizeL@CMPXCollectionPath@@QAEXAAVRReadStream@@@Z @ 125 NONAME ; void CMPXCollectionPath::InternalizeL(class RReadStream &) + ?InternalizeL@CMPXCollectionType@@QAEXAAVRReadStream@@@Z @ 126 NONAME ; void CMPXCollectionType::InternalizeL(class RReadStream &) + ?InternalizeL@CMPXMedia@@QAEXAAVRReadStream@@@Z @ 127 NONAME ; void CMPXMedia::InternalizeL(class RReadStream &) + ?InternalizeL@CMPXMediaArray@@QAEXAAVRReadStream@@@Z @ 128 NONAME ; void CMPXMediaArray::InternalizeL(class RReadStream &) + ?InternalizeL@CMPXParameter@@QAEXAAVRReadStream@@@Z @ 129 NONAME ; void CMPXParameter::InternalizeL(class RReadStream &) + ?InternalizeL@MPXUser@@SAXAAPAVCDesC16Array@@AAVRReadStream@@@Z @ 130 NONAME ; void MPXUser::InternalizeL(class CDesC16Array * &, class RReadStream &) + ?InternalizeL@MPXUser@@SAXAAV?$RArray@VTMPXItemId@@@@AAVRReadStream@@@Z @ 131 NONAME ; void MPXUser::InternalizeL(class RArray &, class RReadStream &) + ?InternalizeL@TMPXAttribute@@QAEXAAVRReadStream@@@Z @ 132 NONAME ; void TMPXAttribute::InternalizeL(class RReadStream &) + ?IsCallOngoing@MPXUser@@SAHH@Z @ 133 NONAME ; int MPXUser::IsCallOngoing(int) + ?IsClient@CMPXClientList@@QBEHVTThreadId@@@Z @ 134 NONAME ; int CMPXClientList::IsClient(class TThreadId) const + ?IsEmpty@CMPXTaskQueue@@QAEHXZ @ 135 NONAME ; int CMPXTaskQueue::IsEmpty(void) + ?IsSelected@CMPXCollectionPath@@QBEHABVTMPXItemId@@@Z @ 136 NONAME ; int CMPXCollectionPath::IsSelected(class TMPXItemId const &) const + ?IsSelected@CMPXCollectionPath@@QBEHH@Z @ 137 NONAME ; int CMPXCollectionPath::IsSelected(int) const + ?IsSupported@CMPXMedia@@QBEHABVTMPXAttribute@@@Z @ 138 NONAME ; int CMPXMedia::IsSupported(class TMPXAttribute const &) const + ?Levels@CMPXCollectionPath@@QBEHXZ @ 139 NONAME ; int CMPXCollectionPath::Levels(void) const + ?Match@TMPXAttribute@@SAHABV1@0@Z @ 140 NONAME ; int TMPXAttribute::Match(class TMPXAttribute const &, class TMPXAttribute const &) + ?MatchContentId@TMPXAttribute@@SAHABV1@0@Z @ 141 NONAME ; int TMPXAttribute::MatchContentId(class TMPXAttribute const &, class TMPXAttribute const &) + ?MergeArray@MPXUser@@SAXABVMDesC16Array@@AAVCDesC16Array@@@Z @ 142 NONAME ; void MPXUser::MergeArray(class MDesC16Array const &, class CDesC16Array &) + ?MergeAttributeL@MPXUser@@SAXABV?$TArray@VTMPXAttribute@@@@AAV?$RArray@VTMPXAttribute@@@@@Z @ 143 NONAME ; void MPXUser::MergeAttributeL(class TArray const &, class RArray &) + ?NewL@CMPXActiveTaskQueue@@SAPAV1@XZ @ 144 NONAME ; class CMPXActiveTaskQueue * CMPXActiveTaskQueue::NewL(void) + ?NewL@CMPXCenRepWatcher@@SAPAV1@ABVTUid@@KPAVMMPXCenRepObserver@@@Z @ 145 NONAME ; class CMPXCenRepWatcher * CMPXCenRepWatcher::NewL(class TUid const &, unsigned long, class MMPXCenRepObserver *) + ?NewL@CMPXClientList@@SAPAV1@PAVMMPXClientlistObserver@@@Z @ 146 NONAME ; class CMPXClientList * CMPXClientList::NewL(class MMPXClientlistObserver *) + ?NewL@CMPXCollectionPath@@SAPAV1@AAVRReadStream@@@Z @ 147 NONAME ; class CMPXCollectionPath * CMPXCollectionPath::NewL(class RReadStream &) + ?NewL@CMPXCollectionPath@@SAPAV1@ABV1@@Z @ 148 NONAME ; class CMPXCollectionPath * CMPXCollectionPath::NewL(class CMPXCollectionPath const &) + ?NewL@CMPXCollectionPath@@SAPAV1@XZ @ 149 NONAME ; class CMPXCollectionPath * CMPXCollectionPath::NewL(void) + ?NewL@CMPXDrmMediaUtility@@SAPAV1@XZ @ 150 NONAME ; class CMPXDrmMediaUtility * CMPXDrmMediaUtility::NewL(void) + ?NewL@CMPXMedia@@SAPAV1@AAVRReadStream@@@Z @ 151 NONAME ; class CMPXMedia * CMPXMedia::NewL(class RReadStream &) + ?NewL@CMPXMedia@@SAPAV1@ABV1@@Z @ 152 NONAME ; class CMPXMedia * CMPXMedia::NewL(class CMPXMedia const &) + ?NewL@CMPXMedia@@SAPAV1@ABV?$TArray@H@@@Z @ 153 NONAME ; class CMPXMedia * CMPXMedia::NewL(class TArray const &) + ?NewL@CMPXMedia@@SAPAV1@H@Z @ 154 NONAME ; class CMPXMedia * CMPXMedia::NewL(int) + ?NewL@CMPXMedia@@SAPAV1@XZ @ 155 NONAME ; class CMPXMedia * CMPXMedia::NewL(void) + ?NewL@CMPXMediaArray@@SAPAV1@ABV1@@Z @ 156 NONAME ; class CMPXMediaArray * CMPXMediaArray::NewL(class CMPXMediaArray const &) + ?NewL@CMPXMediaArray@@SAPAV1@XZ @ 157 NONAME ; class CMPXMediaArray * CMPXMediaArray::NewL(void) + ?NewL@CMPXMessageMonitor@@SAPAV1@ABVRMPXSession@@AAVMMPXMessageObserver@@@Z @ 158 NONAME ; class CMPXMessageMonitor * CMPXMessageMonitor::NewL(class RMPXSession const &, class MMPXMessageObserver &) + ?NewL@CMPXMessageQueue@@SAPAV1@XZ @ 159 NONAME ; class CMPXMessageQueue * CMPXMessageQueue::NewL(void) + ?NewL@CMPXPSKeyWatcher@@SAPAV1@VTUid@@HPAVMMPXPSKeyObserver@@@Z @ 160 NONAME ; class CMPXPSKeyWatcher * CMPXPSKeyWatcher::NewL(class TUid, int, class MMPXPSKeyObserver *) + ?NewL@CMPXPluginMonitor@@SAPAV1@ABVTUid@@@Z @ 161 NONAME ; class CMPXPluginMonitor * CMPXPluginMonitor::NewL(class TUid const &) + ?NewL@CMPXTaskQueue@@SAPAV1@XZ @ 162 NONAME ; class CMPXTaskQueue * CMPXTaskQueue::NewL(void) + ?NewLC@CMPXDrmMediaUtility@@SAPAV1@XZ @ 163 NONAME ; class CMPXDrmMediaUtility * CMPXDrmMediaUtility::NewLC(void) + ?OpenAttributes@CMPXCollectionPath@@QBE?BV?$TArray@VTMPXAttribute@@@@XZ @ 164 NONAME ; class TArray const CMPXCollectionPath::OpenAttributes(void) const + ?OpenNextMode@CMPXCollectionPath@@QBE?AW4TMPXOpenMode@@XZ @ 165 NONAME ; enum TMPXOpenMode CMPXCollectionPath::OpenNextMode(void) const + ?OpenPreviousMode@CMPXCollectionPath@@QBE?AW4TMPXOpenMode@@XZ @ 166 NONAME ; enum TMPXOpenMode CMPXCollectionPath::OpenPreviousMode(void) const + ?Param@CMPXTaskQueue@@QAEHXZ @ 167 NONAME ; int CMPXTaskQueue::Param(void) + ?PluginName@CMPXPluginHandlerBase@@QBEABVTDesC16@@ABVTUid@@@Z @ 168 NONAME ; class TDesC16 const & CMPXPluginHandlerBase::PluginName(class TUid const &) const + ?PluginName@CMPXPluginHandlerBase@@QBEABVTDesC16@@H@Z @ 169 NONAME ; class TDesC16 const & CMPXPluginHandlerBase::PluginName(int) const + ?PluginNamesL@CMPXPluginHandlerBase@@QAEPAVCDesC16Array@@XZ @ 170 NONAME ; class CDesC16Array * CMPXPluginHandlerBase::PluginNamesL(void) + ?PluginUid@CMPXPluginHandlerBase@@QBE?AVTUid@@ABVTDesC16@@@Z @ 171 NONAME ; class TUid CMPXPluginHandlerBase::PluginUid(class TDesC16 const &) const + ?PluginsChangedL@CMPXPluginHandlerBase@@MAEXXZ @ 172 NONAME ; void CMPXPluginHandlerBase::PluginsChangedL(void) + ?ProcessIdL@MPXUser@@SA?AVTProcessId@@VTThreadId@@@Z @ 173 NONAME ; class TProcessId MPXUser::ProcessIdL(class TThreadId) + ?Ptr@MPXUser@@SA?AVTPtrC16@@ABVTDesC8@@@Z @ 174 NONAME ; class TPtrC16 MPXUser::Ptr(class TDesC8 const &) + ?Ptr@MPXUser@@SA?AVTPtrC8@@ABVTDesC16@@@Z @ 175 NONAME ; class TPtrC8 MPXUser::Ptr(class TDesC16 const &) + ?PtrData@CMPXTaskQueue@@QAEPAXXZ @ 176 NONAME ; void * CMPXTaskQueue::PtrData(void) + ?RecreateBufferL@MPXUser@@SAXHAAPAVCBufBase@@@Z @ 177 NONAME ; void MPXUser::RecreateBufferL(int, class CBufBase * &) + ?Remove@CMPXCollectionPath@@QAEXABVTMPXItemId@@@Z @ 178 NONAME ; void CMPXCollectionPath::Remove(class TMPXItemId const &) + ?Remove@CMPXCollectionPath@@QAEXH@Z @ 179 NONAME ; void CMPXCollectionPath::Remove(int) + ?Remove@CMPXMediaArray@@QAEXH@Z @ 180 NONAME ; void CMPXMediaArray::Remove(int) + ?RemoveClient@CMPXClientList@@QAEXH@Z @ 181 NONAME ; void CMPXClientList::RemoveClient(int) + ?RemoveTask@CMPXTaskQueue@@QAEPAXXZ @ 182 NONAME ; void * CMPXTaskQueue::RemoveTask(void) + ?RemoveTask@CMPXTaskQueue@@QAEXPAX@Z @ 183 NONAME ; void CMPXTaskQueue::RemoveTask(void *) + ?Reset@CMPXMedia@@QAEXXZ @ 184 NONAME ; void CMPXMedia::Reset(void) + ?Reset@CMPXMediaArray@@QAEXXZ @ 185 NONAME ; void CMPXMediaArray::Reset(void) + ?Reset@CMPXMessageQueue@@QAEXXZ @ 186 NONAME ; void CMPXMessageQueue::Reset(void) + ?Reset@CMPXTaskQueue@@QAEXXZ @ 187 NONAME ; void CMPXTaskQueue::Reset(void) + ?RunError@CMPXMessageMonitor@@MAEHH@Z @ 188 NONAME ; int CMPXMessageMonitor::RunError(int) + ?RunL@CMPXMessageMonitor@@MAEXXZ @ 189 NONAME ; void CMPXMessageMonitor::RunL(void) + ?ScheduleNextTask@CMPXActiveTaskQueue@@QAEXXZ @ 190 NONAME ; void CMPXActiveTaskQueue::ScheduleNextTask(void) + ?SelectAllL@CMPXCollectionPath@@QAEXXZ @ 191 NONAME ; void CMPXCollectionPath::SelectAllL(void) + ?SelectL@CMPXCollectionPath@@QAEXABVTMPXItemId@@@Z @ 192 NONAME ; void CMPXCollectionPath::SelectL(class TMPXItemId const &) + ?SelectL@CMPXCollectionPath@@QAEXH@Z @ 193 NONAME ; void CMPXCollectionPath::SelectL(int) + ?SelectPluginL@CMPXPluginHandlerBase@@QAEXABVTDesC16@@@Z @ 194 NONAME ; void CMPXPluginHandlerBase::SelectPluginL(class TDesC16 const &) + ?SelectPluginL@CMPXPluginHandlerBase@@QAEXABVTUid@@@Z @ 195 NONAME ; void CMPXPluginHandlerBase::SelectPluginL(class TUid const &) + ?SelectPluginL@CMPXPluginHandlerBase@@UAEXABVRFile@@@Z @ 196 NONAME ; void CMPXPluginHandlerBase::SelectPluginL(class RFile const &) + ?SelectPluginL@CMPXPluginHandlerBase@@UAEXABVTDesC16@@ABVTDesC8@@@Z @ 197 NONAME ; void CMPXPluginHandlerBase::SelectPluginL(class TDesC16 const &, class TDesC8 const &) + ?SelectPluginL@CMPXPluginHandlerBase@@UAEXH@Z @ 198 NONAME ; void CMPXPluginHandlerBase::SelectPluginL(int) + ?Selection@CMPXCollectionPath@@QBE?AV?$TArray@H@@XZ @ 199 NONAME ; class TArray CMPXCollectionPath::Selection(void) const + ?SelectionL@CMPXCollectionPath@@QBEXAAV?$RArray@VTMPXItemId@@@@@Z @ 200 NONAME ; void CMPXCollectionPath::SelectionL(class RArray &) const + ?SendMsg@CMPXClientList@@QAEXHPBVCMPXMedia@@H@Z @ 201 NONAME ; void CMPXClientList::SendMsg(int, class CMPXMedia const *, int) + ?SendMsg@CMPXClientList@@QAEXPBVCMPXMedia@@H@Z @ 202 NONAME ; void CMPXClientList::SendMsg(class CMPXMedia const *, int) + ?SendNext@CMPXMessageQueue@@QAEXABVRMessage2@@@Z @ 203 NONAME ; void CMPXMessageQueue::SendNext(class RMessage2 const &) + ?SendReceive@RMPXSession@@QBEXHAAVTRequestStatus@@@Z @ 204 NONAME ; void RMPXSession::SendReceive(int, class TRequestStatus &) const + ?SendReceive@RMPXSession@@QBEXHABVTIpcArgs@@AAVTRequestStatus@@@Z @ 205 NONAME ; void RMPXSession::SendReceive(int, class TIpcArgs const &, class TRequestStatus &) const + ?SendReceiveL@RMPXSession@@QBEHH@Z @ 206 NONAME ; int RMPXSession::SendReceiveL(int) const + ?SendReceiveL@RMPXSession@@QBEHHABVTIpcArgs@@@Z @ 207 NONAME ; int RMPXSession::SendReceiveL(int, class TIpcArgs const &) const + ?Set@CMPXCollectionPath@@QAEXABV?$TArray@VTMPXAttribute@@@@@Z @ 208 NONAME ; void CMPXCollectionPath::Set(class TArray const &) + ?Set@CMPXCollectionPath@@QAEXABVTMPXItemId@@@Z @ 209 NONAME ; void CMPXCollectionPath::Set(class TMPXItemId const &) + ?Set@CMPXCollectionPath@@QAEXH@Z @ 210 NONAME ; void CMPXCollectionPath::Set(int) + ?Set@CMPXCollectionPath@@QAEXW4TMPXOpenMode@@@Z @ 211 NONAME ; void CMPXCollectionPath::Set(enum TMPXOpenMode) + ?SetTextValueL@CMPXMedia@@QAEXABVTMPXAttribute@@ABVTDesC16@@@Z @ 212 NONAME ; void CMPXMedia::SetTextValueL(class TMPXAttribute const &, class TDesC16 const &) + ?SetToFirst@CMPXCollectionPath@@QAEXXZ @ 213 NONAME ; void CMPXCollectionPath::SetToFirst(void) + ?SetToLast@CMPXCollectionPath@@QAEXXZ @ 214 NONAME ; void CMPXCollectionPath::SetToLast(void) + ?SetValue@CMPXPSKeyWatcher@@QAEHABVTDesC16@@@Z @ 215 NONAME ; int CMPXPSKeyWatcher::SetValue(class TDesC16 const &) + ?SetValue@CMPXPSKeyWatcher@@QAEHABVTDesC8@@@Z @ 216 NONAME ; int CMPXPSKeyWatcher::SetValue(class TDesC8 const &) + ?SetValue@CMPXPSKeyWatcher@@QAEHH@Z @ 217 NONAME ; int CMPXPSKeyWatcher::SetValue(int) + ?SetValueL@CMPXCenRepWatcher@@QAEXH@Z @ 218 NONAME ; void CMPXCenRepWatcher::SetValueL(int) + ?SetValueL@CMPXMedia@@AAEXABVTMPXAttribute@@ABVTDesC8@@W4TMPXAttributeType@@@Z @ 219 NONAME ; void CMPXMedia::SetValueL(class TMPXAttribute const &, class TDesC8 const &, enum TMPXAttributeType) + ?SupportUids@CMPXPluginHandlerBase@@QBEHABVTUid@@ABV?$TArray@VTUid@@@@@Z @ 220 NONAME ; int CMPXPluginHandlerBase::SupportUids(class TUid const &, class TArray const &) const + ?SupportedExtensionsL@CMPXPluginHandlerBase@@QAEPAVCDesC16Array@@ABVTUid@@@Z @ 221 NONAME ; class CDesC16Array * CMPXPluginHandlerBase::SupportedExtensionsL(class TUid const &) + ?SupportedExtensionsL@CMPXPluginHandlerBase@@QAEPAVCDesC16Array@@XZ @ 222 NONAME ; class CDesC16Array * CMPXPluginHandlerBase::SupportedExtensionsL(void) + ?SupportedIds@CMPXMedia@@QBE?BV?$TArray@H@@XZ @ 223 NONAME ; class TArray const CMPXMedia::SupportedIds(void) const + ?SupportedMimeTypesL@CMPXPluginHandlerBase@@QAEPAVCDesC16Array@@ABVTUid@@@Z @ 224 NONAME ; class CDesC16Array * CMPXPluginHandlerBase::SupportedMimeTypesL(class TUid const &) + ?SupportedMimeTypesL@CMPXPluginHandlerBase@@QAEPAVCDesC16Array@@XZ @ 225 NONAME ; class CDesC16Array * CMPXPluginHandlerBase::SupportedMimeTypesL(void) + ?SupportedSchemasL@CMPXPluginHandlerBase@@QAEPAVCDesC16Array@@XZ @ 226 NONAME ; class CDesC16Array * CMPXPluginHandlerBase::SupportedSchemasL(void) + ?Task@CMPXTaskQueue@@QAEHXZ @ 227 NONAME ; int CMPXTaskQueue::Task(void) + ?Type@CMPXMedia@@QBE?AW4TMPXAttributeType@@ABVTMPXAttribute@@@Z @ 228 NONAME ; enum TMPXAttributeType CMPXMedia::Type(class TMPXAttribute const &) const + ?Type@CMPXMedia@@QBE?AW4TMPXAttributeType@@H@Z @ 229 NONAME ; enum TMPXAttributeType CMPXMedia::Type(int) const + ?Type@TMPXMessage@@QBEHXZ @ 230 NONAME ; int TMPXMessage::Type(void) const + ?ValuePtr@CMPXMedia@@ABEPAXABVTMPXAttribute@@@Z @ 231 NONAME ; void * CMPXMedia::ValuePtr(class TMPXAttribute const &) const + ?ValueText@CMPXMedia@@QBEABVTDesC16@@ABVTMPXAttribute@@@Z @ 232 NONAME ; class TDesC16 const & CMPXMedia::ValueText(class TMPXAttribute const &) const + ?Version@RMPXSession@@QBE?AVTVersion@@XZ @ 233 NONAME ; class TVersion RMPXSession::Version(void) const + ?Reset@CMPXCollectionPath@@QAEXXZ @ 234 NONAME ; void CMPXCollectionPath::Reset(void) + ?Set@CMPXMediaArray@@QAEXABVCMPXMedia@@H@Z @ 235 NONAME ; void CMPXMediaArray::Set(class CMPXMedia const &, int) + ?SetL@CMPXCollectionPath@@QAEXABV?$TArray@VTMPXAttribute@@@@@Z @ 236 NONAME ; void CMPXCollectionPath::SetL(class TArray const &) + ?CopyL@CMPXMedia@@SAPAV1@ABV1@@Z @ 237 NONAME ; class CMPXMedia * CMPXMedia::CopyL(class CMPXMedia const &) + ?MergeMediaL@CMPXMedia@@QAEXABV1@@Z @ 238 NONAME ; void CMPXMedia::MergeMediaL(class CMPXMedia const &) + ?HeapMemoryInfoL@CMPXMedia@@SAXAAH0@Z @ 239 NONAME ; void CMPXMedia::HeapMemoryInfoL(int &, int &) + ?Items@CMPXCollectionPath@@QBE?BV?$TArray@VTMPXItemId@@@@XZ @ 240 NONAME ; class TArray const CMPXCollectionPath::Items(void) const + ?Update@CMPXCollectionPath@@QAEXHAAVTMPXItemId@@@Z @ 241 NONAME ; void CMPXCollectionPath::Update(int, class TMPXItemId &) + ?InsertL@CMPXCollectionPath@@QAEXABVTMPXItemId@@H@Z @ 242 NONAME ; void CMPXCollectionPath::InsertL(class TMPXItemId const &, int) + ?Alloc8ZL@MPXUser@@SAPAVHBufC8@@ABVTDesC16@@@Z @ 243 NONAME ; class HBufC8 * MPXUser::Alloc8ZL(class TDesC16 const &) + ??8CMPXSubscription@@QBEHABV0@@Z @ 244 NONAME ; int CMPXSubscription::operator==(class CMPXSubscription const &) const + ?AddItemL@CMPXSubscription@@QAEXABVCMPXMedia@@@Z @ 245 NONAME ; void CMPXSubscription::AddItemL(class CMPXMedia const &) + ?AddSubscriptionL@CMPXClientList@@QAEXHPAVCMPXSubscription@@@Z @ 246 NONAME ; void CMPXClientList::AddSubscriptionL(int, class CMPXSubscription *) + ?ItemsL@CMPXSubscription@@QBEPBVCMPXMediaArray@@XZ @ 247 NONAME ; class CMPXMediaArray const * CMPXSubscription::ItemsL(void) const + ?Match@CMPXMedia@@QAEHABV1@ABVTMPXAttribute@@@Z @ 248 NONAME ; int CMPXMedia::Match(class CMPXMedia const &, class TMPXAttribute const &) + ?NewL@CMPXSubscription@@SAPAV1@AAVCMPXMediaArray@@@Z @ 249 NONAME ; class CMPXSubscription * CMPXSubscription::NewL(class CMPXMediaArray &) + ?NewL@CMPXSubscription@@SAPAV1@XZ @ 250 NONAME ; class CMPXSubscription * CMPXSubscription::NewL(void) + ?RemoveAllSubscriptionsL@CMPXClientList@@QAEXH@Z @ 251 NONAME ; void CMPXClientList::RemoveAllSubscriptionsL(int) + ?RemoveSubscriptionL@CMPXClientList@@QAEXHABVCMPXSubscription@@@Z @ 252 NONAME ; void CMPXClientList::RemoveSubscriptionL(int, class CMPXSubscription const &) + ?ReleasePlugin@CMPXPluginHandlerBase@@QAEHABVTUid@@@Z @ 253 NONAME ; int CMPXPluginHandlerBase::ReleasePlugin(class TUid const &) + ?ResolvePluginL@CMPXPluginHandlerBase@@MAEXXZ @ 254 NONAME ; void CMPXPluginHandlerBase::ResolvePluginL(void) + ?UnloadPlugin@CMPXPluginHandlerBase@@MAEXABVTUid@@@Z @ 255 NONAME ; void CMPXPluginHandlerBase::UnloadPlugin(class TUid const &) + ?UsePlugin@CMPXPluginHandlerBase@@QAEXABVTUid@@@Z @ 256 NONAME ; void CMPXPluginHandlerBase::UsePlugin(class TUid const &) + ?PluginFlagsL@CMPXPluginHandlerBase@@QBEIABVTUid@@@Z @ 257 NONAME ; unsigned int CMPXPluginHandlerBase::PluginFlagsL(class TUid const &) const + ?PluginType@CMPXPluginHandlerBase@@QBE?AVTUid@@ABV2@@Z @ 258 NONAME ; class TUid CMPXPluginHandlerBase::PluginType(class TUid const &) const + ?ContainerPathL@CMPXCollectionPath@@QBEPAV1@XZ @ 259 NONAME ; class CMPXCollectionPath * CMPXCollectionPath::ContainerPathL(void) const + ??0CMPXPluginInfo@@IAE@XZ @ 260 NONAME ; CMPXPluginInfo::CMPXPluginInfo(void) + ??1CMPXPluginInfo@@UAE@XZ @ 261 NONAME ; CMPXPluginInfo::~CMPXPluginInfo(void) + ?ConstructL@CMPXPluginInfo@@IAEXABVCImplementationInformation@@@Z @ 262 NONAME ; void CMPXPluginInfo::ConstructL(class CImplementationInformation const &) + ?ConstructPluginInfoLC@CMPXPluginHandlerBase@@MAEPAVCMPXPluginInfo@@ABVCImplementationInformation@@@Z @ 263 NONAME ; class CMPXPluginInfo * CMPXPluginHandlerBase::ConstructPluginInfoLC(class CImplementationInformation const &) + ?ExtractUidsFromTextL@CMPXPluginInfo@@IAEXABVTDesC8@@AAV?$RArray@VTUid@@@@@Z @ 264 NONAME ; void CMPXPluginInfo::ExtractUidsFromTextL(class TDesC8 const &, class RArray &) + ?ImplementationUid@CMPXPluginInfo@@QBEABVTUid@@XZ @ 265 NONAME ; class TUid const & CMPXPluginInfo::ImplementationUid(void) const + ?ProcessTaggedDataExL@CMPXPluginInfo@@MAEXABVTDesC8@@0@Z @ 266 NONAME ; void CMPXPluginInfo::ProcessTaggedDataExL(class TDesC8 const &, class TDesC8 const &) + ?ProcessTaggedDataL@CMPXPluginInfo@@MAEXABVTDesC8@@0@Z @ 267 NONAME ; void CMPXPluginInfo::ProcessTaggedDataL(class TDesC8 const &, class TDesC8 const &) + ?Flags@CMPXPluginInfo@@QBEIXZ @ 268 NONAME ; unsigned int CMPXPluginInfo::Flags(void) const + ?Error@CMPXMedia@@QBEHABVTMPXAttribute@@@Z @ 269 NONAME ; int CMPXMedia::Error(class TMPXAttribute const &) const + ?SetErrorL@CMPXMedia@@QAEXABVTMPXAttribute@@H@Z @ 270 NONAME ; void CMPXMedia::SetErrorL(class TMPXAttribute const &, int) + ?AtL@CMPXMediaArray@@QBEPAVCMPXMedia@@H@Z @ 271 NONAME ; class CMPXMedia * CMPXMediaArray::AtL(int) const + ?CompleteAllTasks@CMPXActiveTaskQueue@@QAEXH@Z @ 272 NONAME ; void CMPXActiveTaskQueue::CompleteAllTasks(int) + ?IsPluginLoaded@CMPXPluginHandlerBase@@MAEHABVTUid@@@Z @ 273 NONAME ; int CMPXPluginHandlerBase::IsPluginLoaded(class TUid const &) + ?LoadPluginL@CMPXPluginHandlerBase@@MAEXABVTUid@@@Z @ 274 NONAME ; void CMPXPluginHandlerBase::LoadPluginL(class TUid const &) + ?HandlePluginUnload@CMPXPluginHandlerBase@@MAEXABVTUid@@@Z @ 275 NONAME ; void CMPXPluginHandlerBase::HandlePluginUnload(class TUid const &) + ?GetValue@CMPXMedia@@ABE?AW4TMPXAttributeType@@ABVTMPXAttribute@@AAVTDes8@@@Z @ 276 NONAME ; enum TMPXAttributeType CMPXMedia::GetValue(class TMPXAttribute const &, class TDes8 &) const + ?ExtractIntoArrayL@CMPXPluginInfo@@IAEXABVTDesC8@@AAPAVCDesC16Array@@@Z @ 277 NONAME ; void CMPXPluginInfo::ExtractIntoArrayL(class TDesC8 const &, class CDesC16Array * &) + ??1RMPXSession@@QAE@XZ @ 278 NONAME ; RMPXSession::~RMPXSession(void) + ?Reconnect@RMPXSession@@QBEHXZ @ 279 NONAME ; int RMPXSession::Reconnect(void) const + ??0RMPXSession@@QAE@XZ @ 280 NONAME ; RMPXSession::RMPXSession(void) + ?Close@RMPXSession@@QAEXXZ @ 281 NONAME ; void RMPXSession::Close(void) + ?SupportedAppUid@CMPXPluginHandlerBase@@QBE?AVTUid@@ABV2@@Z @ 282 NONAME ; class TUid CMPXPluginHandlerBase::SupportedAppUid(class TUid const &) const + ?AddClientL@CMPXClientList@@QAEXVTThreadId@@HPAVCMPXMessageQueue@@H@Z @ 283 NONAME ; void CMPXClientList::AddClientL(class TThreadId, int, class CMPXMessageQueue *, int) + ?ClientCategory@CMPXClientList@@QBEHH@Z @ 284 NONAME ; int CMPXClientList::ClientCategory(int) const + ?SelectPlugin64L@CMPXPluginHandlerBase@@UAEXABVRFile64@@@Z @ 285 NONAME ; void CMPXPluginHandlerBase::SelectPlugin64L(class RFile64 const &) + diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/eabi/mpxcommonU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/eabi/mpxcommonU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,364 @@ +EXPORTS + _ZN11RMPXSession7ConnectERK7TDesC16S2_RK8TVersion @ 1 NONAME + _ZN11TMPXMessageC1ERKS_ @ 2 NONAME + _ZN11TMPXMessageC1Eiii @ 3 NONAME + _ZN11TMPXMessageC1Ev @ 4 NONAME + _ZN11TMPXMessageC2ERKS_ @ 5 NONAME + _ZN11TMPXMessageC2Eiii @ 6 NONAME + _ZN11TMPXMessageC2Ev @ 7 NONAME + _ZN11TMPXMessageaSERKS_ @ 8 NONAME + _ZN13CMPXParameter12InternalizeLER11RReadStream @ 9 NONAME + _ZN13CMPXParameterC1Ev @ 10 NONAME + _ZN13CMPXParameterC2Ev @ 11 NONAME + _ZN13CMPXParameterD0Ev @ 12 NONAME + _ZN13CMPXParameterD1Ev @ 13 NONAME + _ZN13CMPXParameterD2Ev @ 14 NONAME + _ZN13CMPXTaskQueue10RemoveTaskEPv @ 15 NONAME + _ZN13CMPXTaskQueue10RemoveTaskEv @ 16 NONAME + _ZN13CMPXTaskQueue4NewLEv @ 17 NONAME + _ZN13CMPXTaskQueue4TaskEv @ 18 NONAME + _ZN13CMPXTaskQueue5ParamEv @ 19 NONAME + _ZN13CMPXTaskQueue5ResetEv @ 20 NONAME + _ZN13CMPXTaskQueue7BufDataEv @ 21 NONAME + _ZN13CMPXTaskQueue7IsEmptyEv @ 22 NONAME + _ZN13CMPXTaskQueue7PtrDataEv @ 23 NONAME + _ZN13CMPXTaskQueue8AddTaskLEiPviP8CBufBaseS0_P5CBaseS4_ @ 24 NONAME + _ZN13CMPXTaskQueue8CallbackEv @ 25 NONAME + _ZN13CMPXTaskQueueD0Ev @ 26 NONAME + _ZN13CMPXTaskQueueD1Ev @ 27 NONAME + _ZN13CMPXTaskQueueD2Ev @ 28 NONAME + _ZN13TMPXAttribute12InternalizeLER11RReadStream @ 29 NONAME + _ZN13TMPXAttribute14MatchContentIdERKS_S1_ @ 30 NONAME + _ZN13TMPXAttribute5MatchERKS_S1_ @ 31 NONAME + _ZN13TMPXAttributeC1ERK17TMPXAttributeData @ 32 NONAME + _ZN13TMPXAttributeC1ERKS_ @ 33 NONAME + _ZN13TMPXAttributeC1Eij @ 34 NONAME + _ZN13TMPXAttributeC1Ev @ 35 NONAME + _ZN13TMPXAttributeC2ERK17TMPXAttributeData @ 36 NONAME + _ZN13TMPXAttributeC2ERKS_ @ 37 NONAME + _ZN13TMPXAttributeC2Eij @ 38 NONAME + _ZN13TMPXAttributeC2Ev @ 39 NONAME + _ZN13TMPXAttributeaSERKS_ @ 40 NONAME + _ZN14CMPXClientList10AddClientLE9TThreadIdP16CMPXMessageQueue @ 41 NONAME + _ZN14CMPXClientList10AddClientLE9TThreadIdiP16CMPXMessageQueue @ 42 NONAME + _ZN14CMPXClientList12RemoveClientEi @ 43 NONAME + _ZN14CMPXClientList4NewLEP22MMPXClientlistObserver @ 44 NONAME + _ZN14CMPXClientList7SendMsgEPK9CMPXMediai @ 45 NONAME + _ZN14CMPXClientList7SendMsgEiPK9CMPXMediai @ 46 NONAME + _ZN14CMPXClientListD0Ev @ 47 NONAME + _ZN14CMPXClientListD1Ev @ 48 NONAME + _ZN14CMPXClientListD2Ev @ 49 NONAME + _ZN14CMPXMediaArray12InternalizeLER11RReadStream @ 50 NONAME + _ZN14CMPXMediaArray4NewLERKS_ @ 51 NONAME + _ZN14CMPXMediaArray4NewLEv @ 52 NONAME + _ZN14CMPXMediaArray5ResetEv @ 53 NONAME + _ZN14CMPXMediaArray6InsertEPK9CMPXMediai @ 54 NONAME + _ZN14CMPXMediaArray6InsertERK9CMPXMediai @ 55 NONAME + _ZN14CMPXMediaArray6RemoveEi @ 56 NONAME + _ZN14CMPXMediaArray7AppendLEPK9CMPXMedia @ 57 NONAME + _ZN14CMPXMediaArray7AppendLERK9CMPXMedia @ 58 NONAME + _ZN14CMPXMediaArray7InsertLEPK9CMPXMediai @ 59 NONAME + _ZN14CMPXMediaArray7InsertLERK9CMPXMediai @ 60 NONAME + _ZN14CMPXMediaArrayD0Ev @ 61 NONAME + _ZN14CMPXMediaArrayD1Ev @ 62 NONAME + _ZN14CMPXMediaArrayD2Ev @ 63 NONAME + _ZN16CMPXMessageQueue3AddEPK9CMPXMediai @ 64 NONAME + _ZN16CMPXMessageQueue4NewLEv @ 65 NONAME + _ZN16CMPXMessageQueue5ResetEv @ 66 NONAME + _ZN16CMPXMessageQueue8SendNextERK9RMessage2 @ 67 NONAME + _ZN16CMPXMessageQueueD0Ev @ 68 NONAME + _ZN16CMPXMessageQueueD1Ev @ 69 NONAME + _ZN16CMPXMessageQueueD2Ev @ 70 NONAME + _ZN16CMPXPSKeyWatcher4NewLE4TUidiP17MMPXPSKeyObserver @ 71 NONAME + _ZN16CMPXPSKeyWatcher8GetValueER5TDes8 @ 72 NONAME + _ZN16CMPXPSKeyWatcher8GetValueER6TDes16 @ 73 NONAME + _ZN16CMPXPSKeyWatcher8GetValueERi @ 74 NONAME + _ZN16CMPXPSKeyWatcher8SetValueERK6TDesC8 @ 75 NONAME + _ZN16CMPXPSKeyWatcher8SetValueERK7TDesC16 @ 76 NONAME + _ZN16CMPXPSKeyWatcher8SetValueEi @ 77 NONAME + _ZN16CMPXPSKeyWatcherD0Ev @ 78 NONAME + _ZN16CMPXPSKeyWatcherD1Ev @ 79 NONAME + _ZN16CMPXPSKeyWatcherD2Ev @ 80 NONAME + _ZN17CMPXCenRepWatcher13CurrentValueLEv @ 81 NONAME + _ZN17CMPXCenRepWatcher4NewLERK4TUidmP18MMPXCenRepObserver @ 82 NONAME + _ZN17CMPXCenRepWatcher9SetValueLEi @ 83 NONAME + _ZN17CMPXCenRepWatcherD0Ev @ 84 NONAME + _ZN17CMPXCenRepWatcherD1Ev @ 85 NONAME + _ZN17CMPXCenRepWatcherD2Ev @ 86 NONAME + _ZN17CMPXPluginMonitor4NewLERK4TUid @ 87 NONAME + _ZN17CMPXPluginMonitorD0Ev @ 88 NONAME + _ZN17CMPXPluginMonitorD1Ev @ 89 NONAME + _ZN17CMPXPluginMonitorD2Ev @ 90 NONAME + _ZN18CMPXCollectionPath10SelectAllLEv @ 91 NONAME + _ZN18CMPXCollectionPath10SetToFirstEv @ 92 NONAME + _ZN18CMPXCollectionPath11DeselectAllEv @ 93 NONAME + _ZN18CMPXCollectionPath12HandleChangeERK4TUidRK10TMPXItemIdS5_NS_24TMPXCollectionPathChangeERi @ 94 NONAME + _ZN18CMPXCollectionPath12InternalizeLER11RReadStream @ 95 NONAME + _ZN18CMPXCollectionPath14ClearSelectionEv @ 96 NONAME + _ZN18CMPXCollectionPath3SetE12TMPXOpenMode @ 97 NONAME + _ZN18CMPXCollectionPath3SetERK10TMPXItemId @ 98 NONAME + _ZN18CMPXCollectionPath3SetERK6TArrayI13TMPXAttributeE @ 99 NONAME + _ZN18CMPXCollectionPath3SetEi @ 100 NONAME + _ZN18CMPXCollectionPath4BackEv @ 101 NONAME + _ZN18CMPXCollectionPath4NewLER11RReadStream @ 102 NONAME + _ZN18CMPXCollectionPath4NewLERKS_ @ 103 NONAME + _ZN18CMPXCollectionPath4NewLEv @ 104 NONAME + _ZN18CMPXCollectionPath6RemoveERK10TMPXItemId @ 105 NONAME + _ZN18CMPXCollectionPath6RemoveEi @ 106 NONAME + _ZN18CMPXCollectionPath7AppendLERK10TMPXItemId @ 107 NONAME + _ZN18CMPXCollectionPath7AppendLERK6TArrayI10TMPXItemIdE @ 108 NONAME + _ZN18CMPXCollectionPath7SelectLERK10TMPXItemId @ 109 NONAME + _ZN18CMPXCollectionPath7SelectLEi @ 110 NONAME + _ZN18CMPXCollectionPath8DeselectERK10TMPXItemId @ 111 NONAME + _ZN18CMPXCollectionPath8DeselectEi @ 112 NONAME + _ZN18CMPXCollectionPath9SetToLastEv @ 113 NONAME + _ZN18CMPXCollectionPathD0Ev @ 114 NONAME + _ZN18CMPXCollectionPathD1Ev @ 115 NONAME + _ZN18CMPXCollectionPathD2Ev @ 116 NONAME + _ZN18CMPXCollectionPathmmEv @ 117 NONAME + _ZN18CMPXCollectionPathppEv @ 118 NONAME + _ZN18CMPXCollectionType12InternalizeLER11RReadStream @ 119 NONAME + _ZN18CMPXCollectionTypeC1ERK4TUidP12CDesC16ArrayS4_ @ 120 NONAME + _ZN18CMPXCollectionTypeC1Ev @ 121 NONAME + _ZN18CMPXCollectionTypeC2ERK4TUidP12CDesC16ArrayS4_ @ 122 NONAME + _ZN18CMPXCollectionTypeC2Ev @ 123 NONAME + _ZN18CMPXMessageMonitor14GetNextMessageEv @ 124 NONAME + _ZN18CMPXMessageMonitor4NewLERK11RMPXSessionR19MMPXMessageObserver @ 125 NONAME + _ZN18CMPXMessageMonitor4RunLEv @ 126 NONAME + _ZN18CMPXMessageMonitor8DoCancelEv @ 127 NONAME + _ZN18CMPXMessageMonitor8RunErrorEi @ 128 NONAME + _ZN18CMPXMessageMonitorD0Ev @ 129 NONAME + _ZN18CMPXMessageMonitorD1Ev @ 130 NONAME + _ZN18CMPXMessageMonitorD2Ev @ 131 NONAME + _ZN19CMPXActiveTaskQueue12CompleteTaskEv @ 132 NONAME + _ZN19CMPXActiveTaskQueue14CancelRequestsEv @ 133 NONAME + _ZN19CMPXActiveTaskQueue16ScheduleNextTaskEv @ 134 NONAME + _ZN19CMPXActiveTaskQueue4NewLEv @ 135 NONAME + _ZN19CMPXActiveTaskQueue8AddTaskLEiPvP21MMPXTaskQueueObserveriP8CBufBaseS0_P5CBaseS6_ @ 136 NONAME + _ZN19CMPXActiveTaskQueueD0Ev @ 137 NONAME + _ZN19CMPXActiveTaskQueueD1Ev @ 138 NONAME + _ZN19CMPXActiveTaskQueueD2Ev @ 139 NONAME + _ZN19CMPXDrmMediaUtility4NewLEv @ 140 NONAME + _ZN19CMPXDrmMediaUtility5CloseEv @ 141 NONAME + _ZN19CMPXDrmMediaUtility5InitLER5RFile @ 142 NONAME + _ZN19CMPXDrmMediaUtility5InitLERK7TDesC16 @ 143 NONAME + _ZN19CMPXDrmMediaUtility5NewLCEv @ 144 NONAME + _ZN19CMPXDrmMediaUtility8ConsumeLE15TDrmConsumeType @ 145 NONAME + _ZN19CMPXDrmMediaUtility9GetMediaLEj @ 146 NONAME + _ZN19CMPXDrmMediaUtilityD0Ev @ 147 NONAME + _ZN19CMPXDrmMediaUtilityD1Ev @ 148 NONAME + _ZN19CMPXDrmMediaUtilityD2Ev @ 149 NONAME + _ZN21CMPXPluginHandlerBase12PluginNamesLEv @ 150 NONAME + _ZN21CMPXPluginHandlerBase13SelectPluginLERK4TUid @ 151 NONAME + _ZN21CMPXPluginHandlerBase13SelectPluginLERK5RFile @ 152 NONAME + _ZN21CMPXPluginHandlerBase13SelectPluginLERK7TDesC16 @ 153 NONAME + _ZN21CMPXPluginHandlerBase13SelectPluginLERK7TDesC16RK6TDesC8 @ 154 NONAME + _ZN21CMPXPluginHandlerBase13SelectPluginLEi @ 155 NONAME + _ZN21CMPXPluginHandlerBase14BaseConstructLEv @ 156 NONAME + _ZN21CMPXPluginHandlerBase15PluginsChangedLEv @ 157 NONAME + _ZN21CMPXPluginHandlerBase16DoResolvePluginLER4TUidRiR7TPtrC16S2_ @ 158 NONAME + _ZN21CMPXPluginHandlerBase17CreatePluginListLEv @ 159 NONAME + _ZN21CMPXPluginHandlerBase17SupportedSchemasLEv @ 160 NONAME + _ZN21CMPXPluginHandlerBase19SupportedMimeTypesLERK4TUid @ 161 NONAME + _ZN21CMPXPluginHandlerBase19SupportedMimeTypesLEv @ 162 NONAME + _ZN21CMPXPluginHandlerBase20GetSelectionCriteriaERNS_16TPluginSelectionERiR4TUidR6TPtrC8S6_S6_ @ 163 NONAME + _ZN21CMPXPluginHandlerBase20SupportedExtensionsLERK4TUid @ 164 NONAME + _ZN21CMPXPluginHandlerBase20SupportedExtensionsLEv @ 165 NONAME + _ZN21CMPXPluginHandlerBase22ClearSelectionCriteriaEv @ 166 NONAME + _ZN21CMPXPluginHandlerBaseC1E4TUidNS_16TPluginSelectionEiR25MMPXPluginHandlerObserverP17CMPXPluginMonitor @ 167 NONAME + _ZN21CMPXPluginHandlerBaseC2E4TUidNS_16TPluginSelectionEiR25MMPXPluginHandlerObserverP17CMPXPluginMonitor @ 168 NONAME + _ZN21CMPXPluginHandlerBaseD0Ev @ 169 NONAME + _ZN21CMPXPluginHandlerBaseD1Ev @ 170 NONAME + _ZN21CMPXPluginHandlerBaseD2Ev @ 171 NONAME + _ZN7MPXUser10CopyArrayLERK12MDesC16ArrayR12CDesC16Array @ 172 NONAME + _ZN7MPXUser10MergeArrayERK12MDesC16ArrayR12CDesC16Array @ 173 NONAME + _ZN7MPXUser10ProcessIdLE9TThreadId @ 174 NONAME + _ZN7MPXUser11CompareUidsERK4TUidS2_ @ 175 NONAME + _ZN7MPXUser12ExternalizeLEPK12MDesC16ArrayR12RWriteStream @ 176 NONAME + _ZN7MPXUser12ExternalizeLERK6TArrayI10TMPXItemIdER12RWriteStream @ 177 NONAME + _ZN7MPXUser12InternalizeLER6RArrayI10TMPXItemIdER11RReadStream @ 178 NONAME + _ZN7MPXUser12InternalizeLERP12CDesC16ArrayR11RReadStream @ 179 NONAME + _ZN7MPXUser13CreateBufferLEPK12MDesC16ArrayRP8CBufBase @ 180 NONAME + _ZN7MPXUser13CreateBufferLERK7TDesC16RP8CBufBase @ 181 NONAME + _ZN7MPXUser13CreateBufferLERK9RMessage2iRP8CBufBase @ 182 NONAME + _ZN7MPXUser13IsCallOngoingEi @ 183 NONAME + _ZN7MPXUser14CreateBufferLCEi @ 184 NONAME + _ZN7MPXUser15MergeAttributeLERK6TArrayI13TMPXAttributeER6RArrayIS1_E @ 185 NONAME + _ZN7MPXUser15RecreateBufferLEiRP8CBufBase @ 186 NONAME + _ZN7MPXUser17CreateFromBufferLERK8CBufBaseRP12CDesC16Array @ 187 NONAME + _ZN7MPXUser18FindWindowGroupIdLE10TProcessIdR10RWsSession @ 188 NONAME + _ZN7MPXUser19CompleteWithDllPathERK7TDesC16R6TDes16 @ 189 NONAME + _ZN7MPXUser23CompareOrderedUidArraysERK6TArrayI4TUidES4_ @ 190 NONAME + _ZN7MPXUser3PtrERK6TDesC8 @ 191 NONAME + _ZN7MPXUser3PtrERK7TDesC16 @ 192 NONAME + _ZN7MPXUser6AllocLERK6TDesC8 @ 193 NONAME + _ZN7MPXUser7Alloc8LERK7TDesC16 @ 194 NONAME + _ZN9CMPXMedia12InternalizeLER11RReadStream @ 195 NONAME + _ZN9CMPXMedia13SetTextValueLERK13TMPXAttributeRK7TDesC16 @ 196 NONAME + _ZN9CMPXMedia4NewLER11RReadStream @ 197 NONAME + _ZN9CMPXMedia4NewLERK6TArrayIiE @ 198 NONAME + _ZN9CMPXMedia4NewLERKS_ @ 199 NONAME + _ZN9CMPXMedia4NewLEi @ 200 NONAME + _ZN9CMPXMedia4NewLEv @ 201 NONAME + _ZN9CMPXMedia5ResetEv @ 202 NONAME + _ZN9CMPXMedia6DeleteERK13TMPXAttribute @ 203 NONAME + _ZN9CMPXMedia6DeleteEi @ 204 NONAME + _ZN9CMPXMedia9SetValueLERK13TMPXAttributeRK6TDesC817TMPXAttributeType @ 205 NONAME + _ZN9CMPXMediaD0Ev @ 206 NONAME + _ZN9CMPXMediaD1Ev @ 207 NONAME + _ZN9CMPXMediaD2Ev @ 208 NONAME + _ZN9CMPXMediaaSERKS_ @ 209 NONAME + _ZNK11RMPXSession11SendReceiveEiR14TRequestStatus @ 210 NONAME + _ZNK11RMPXSession11SendReceiveEiRK8TIpcArgsR14TRequestStatus @ 211 NONAME + _ZNK11RMPXSession12SendReceiveLEi @ 212 NONAME + _ZNK11RMPXSession12SendReceiveLEiRK8TIpcArgs @ 213 NONAME + _ZNK11RMPXSession7VersionEv @ 214 NONAME + _ZNK11TMPXMessage4DataEv @ 215 NONAME + _ZNK11TMPXMessage4TypeEv @ 216 NONAME + _ZNK11TMPXMessage5EventEv @ 217 NONAME + _ZNK13CMPXParameter12ExternalizeLER12RWriteStream @ 218 NONAME + _ZNK13TMPXAttribute11AttributeIdEv @ 219 NONAME + _ZNK13TMPXAttribute12ExternalizeLER12RWriteStream @ 220 NONAME + _ZNK13TMPXAttribute9ContentIdEv @ 221 NONAME + _ZNK13TMPXAttributeeqERKS_ @ 222 NONAME + _ZNK14CMPXClientList10ClientModeEi @ 223 NONAME + _ZNK14CMPXClientList11ClientCountEv @ 224 NONAME + _ZNK14CMPXClientList17ClientProcessListEv @ 225 NONAME + _ZNK14CMPXClientList4FindE9TThreadId @ 226 NONAME + _ZNK14CMPXClientList4FindERK16CMPXMessageQueue @ 227 NONAME + _ZNK14CMPXClientList8IsClientE9TThreadId @ 228 NONAME + _ZNK14CMPXMediaArray12ExternalizeLER12RWriteStream @ 229 NONAME + _ZNK14CMPXMediaArray5CountEv @ 230 NONAME + _ZNK14CMPXMediaArrayixEi @ 231 NONAME + _ZNK17TMPXAttributeDataanERKS_ @ 232 NONAME + _ZNK17TMPXAttributeDataanERj @ 233 NONAME + _ZNK17TMPXAttributeDataorERKS_ @ 234 NONAME + _ZNK18CMPXCollectionPath10IsSelectedERK10TMPXItemId @ 235 NONAME + _ZNK18CMPXCollectionPath10IsSelectedEi @ 236 NONAME + _ZNK18CMPXCollectionPath10SelectionLER6RArrayI10TMPXItemIdE @ 237 NONAME + _ZNK18CMPXCollectionPath12ExternalizeLER12RWriteStream @ 238 NONAME + _ZNK18CMPXCollectionPath12OpenNextModeEv @ 239 NONAME + _ZNK18CMPXCollectionPath14OpenAttributesEv @ 240 NONAME + _ZNK18CMPXCollectionPath16OpenPreviousModeEv @ 241 NONAME + _ZNK18CMPXCollectionPath2IdEi @ 242 NONAME + _ZNK18CMPXCollectionPath2IdEv @ 243 NONAME + _ZNK18CMPXCollectionPath5CountEv @ 244 NONAME + _ZNK18CMPXCollectionPath5IndexEi @ 245 NONAME + _ZNK18CMPXCollectionPath5IndexEv @ 246 NONAME + _ZNK18CMPXCollectionPath6LevelsEv @ 247 NONAME + _ZNK18CMPXCollectionPath9IdOfIndexEi @ 248 NONAME + _ZNK18CMPXCollectionPath9IndexOfIdERK10TMPXItemId @ 249 NONAME + _ZNK18CMPXCollectionPath9SelectionEv @ 250 NONAME + _ZNK18CMPXCollectionType12ExternalizeLER12RWriteStream @ 251 NONAME + _ZNK21CMPXPluginHandlerBase10FindPluginERK6TArrayI4TUidE @ 252 NONAME + _ZNK21CMPXPluginHandlerBase10PluginNameERK4TUid @ 253 NONAME + _ZNK21CMPXPluginHandlerBase10PluginNameEi @ 254 NONAME + _ZNK21CMPXPluginHandlerBase11SupportUidsERK4TUidRK6TArrayIS0_E @ 255 NONAME + _ZNK21CMPXPluginHandlerBase13GetPluginUidsER6RArrayI4TUidE @ 256 NONAME + _ZNK21CMPXPluginHandlerBase14GetPluginTypesER6RArrayIiE @ 257 NONAME + _ZNK21CMPXPluginHandlerBase14GetPluginUidsLER6RArrayI4TUidEi @ 258 NONAME + _ZNK21CMPXPluginHandlerBase7IndexOfERK4TUid @ 259 NONAME + _ZNK21CMPXPluginHandlerBase9PluginUidERK7TDesC16 @ 260 NONAME + _ZNK9CMPXMedia10AttributesEv @ 261 NONAME + _ZNK9CMPXMedia11IsSupportedERK13TMPXAttribute @ 262 NONAME + _ZNK9CMPXMedia12ExternalizeLER12RWriteStream @ 263 NONAME + _ZNK9CMPXMedia12SupportedIdsEv @ 264 NONAME + _ZNK9CMPXMedia13AttributesSetEi @ 265 NONAME + _ZNK9CMPXMedia4TypeERK13TMPXAttribute @ 266 NONAME + _ZNK9CMPXMedia4TypeEi @ 267 NONAME + _ZNK9CMPXMedia5CountEv @ 268 NONAME + _ZNK9CMPXMedia5IndexERK13TMPXAttribute @ 269 NONAME + _ZNK9CMPXMedia8ValuePtrERK13TMPXAttribute @ 270 NONAME + _ZNK9CMPXMedia9AttributeEi @ 271 NONAME + _ZNK9CMPXMedia9ValueTextERK13TMPXAttribute @ 272 NONAME + _ZTI13CMPXParameter @ 273 NONAME ; ## + _ZTI13CMPXTaskQueue @ 274 NONAME ; ## + _ZTI14CMPXClientList @ 275 NONAME ; ## + _ZTI14CMPXMediaArray @ 276 NONAME ; ## + _ZTI16CMPXMessageQueue @ 277 NONAME ; ## + _ZTI16CMPXPSKeyWatcher @ 278 NONAME ; ## + _ZTI17CMPXCenRepWatcher @ 279 NONAME ; ## + _ZTI17CMPXPluginMonitor @ 280 NONAME ; ## + _ZTI18CMPXCollectionPath @ 281 NONAME ; ## + _ZTI18CMPXCollectionType @ 282 NONAME ; ## + _ZTI18CMPXMessageMonitor @ 283 NONAME ; ## + _ZTI19CMPXActiveTaskQueue @ 284 NONAME ; ## + _ZTI21CMPXPluginHandlerBase @ 285 NONAME ; ## + _ZTI9CMPXMedia @ 286 NONAME ; ## + _ZTV13CMPXParameter @ 287 NONAME ; ## + _ZTV13CMPXTaskQueue @ 288 NONAME ; ## + _ZTV14CMPXClientList @ 289 NONAME ; ## + _ZTV14CMPXMediaArray @ 290 NONAME ; ## + _ZTV16CMPXMessageQueue @ 291 NONAME ; ## + _ZTV16CMPXPSKeyWatcher @ 292 NONAME ; ## + _ZTV17CMPXCenRepWatcher @ 293 NONAME ; ## + _ZTV17CMPXPluginMonitor @ 294 NONAME ; ## + _ZTV18CMPXCollectionPath @ 295 NONAME ; ## + _ZTV18CMPXCollectionType @ 296 NONAME ; ## + _ZTV18CMPXMessageMonitor @ 297 NONAME ; ## + _ZTV19CMPXActiveTaskQueue @ 298 NONAME ; ## + _ZTV21CMPXPluginHandlerBase @ 299 NONAME ; ## + _ZTV9CMPXMedia @ 300 NONAME ; ## + _ZThn4_N21CMPXPluginHandlerBase15PluginsChangedLEv @ 301 NONAME ; ## + _ZN18CMPXCollectionPath5ResetEv @ 302 NONAME + _ZN14CMPXMediaArray3SetERK9CMPXMediai @ 303 NONAME + _ZN18CMPXCollectionPath4SetLERK6TArrayI13TMPXAttributeE @ 304 NONAME + _ZN9CMPXMedia5CopyLERKS_ @ 305 NONAME + _ZN9CMPXMedia11MergeMediaLERKS_ @ 306 NONAME + _ZN9CMPXMedia15HeapMemoryInfoLERiS0_ @ 307 NONAME + _ZN18CMPXCollectionPath6UpdateEiR10TMPXItemId @ 308 NONAME + _ZNK18CMPXCollectionPath5ItemsEv @ 309 NONAME + _ZN18CMPXCollectionPath7InsertLERK10TMPXItemIdi @ 310 NONAME + _ZN14CMPXClientList16AddSubscriptionLEiP16CMPXSubscription @ 311 NONAME + _ZN14CMPXClientList19RemoveSubscriptionLEiRK16CMPXSubscription @ 312 NONAME + _ZN14CMPXClientList23RemoveAllSubscriptionsLEi @ 313 NONAME + _ZN16CMPXSubscription4NewLER14CMPXMediaArray @ 314 NONAME + _ZN16CMPXSubscription4NewLEv @ 315 NONAME + _ZN16CMPXSubscription8AddItemLERK9CMPXMedia @ 316 NONAME + _ZN9CMPXMedia5MatchERKS_RK13TMPXAttribute @ 317 NONAME + _ZNK16CMPXSubscription6ItemsLEv @ 318 NONAME + _ZNK16CMPXSubscriptioneqERKS_ @ 319 NONAME + _ZNK21CMPXPluginHandlerBase10PluginTypeERK4TUid @ 320 NONAME + _ZNK21CMPXPluginHandlerBase12PluginFlagsLERK4TUid @ 321 NONAME + _ZNK18CMPXCollectionPath14ContainerPathLEv @ 322 NONAME + _ZN14CMPXPluginInfo18ProcessTaggedDataLERK6TDesC8S2_ @ 323 NONAME + _ZN14CMPXPluginInfo20ExtractUidsFromTextLERK6TDesC8R6RArrayI4TUidE @ 324 NONAME + _ZN14CMPXPluginInfo20ProcessTaggedDataExLERK6TDesC8S2_ @ 325 NONAME + _ZN14CMPXPluginInfoC1Ev @ 326 NONAME + _ZN14CMPXPluginInfoC2Ev @ 327 NONAME + _ZN14CMPXPluginInfoD0Ev @ 328 NONAME + _ZN14CMPXPluginInfoD1Ev @ 329 NONAME + _ZN14CMPXPluginInfoD2Ev @ 330 NONAME + _ZN21CMPXPluginHandlerBase21ConstructPluginInfoLCERK26CImplementationInformation @ 331 NONAME + _ZNK14CMPXPluginInfo17ImplementationUidEv @ 332 NONAME + _ZTI14CMPXPluginInfo @ 333 NONAME ; ## + _ZTV14CMPXPluginInfo @ 334 NONAME ; ## + _ZThn4_N14CMPXPluginInfo18ProcessTaggedDataLERK6TDesC8S2_ @ 335 NONAME ; ## + _ZN14CMPXPluginInfo10ConstructLERK26CImplementationInformation @ 336 NONAME + _ZNK14CMPXPluginInfo5FlagsEv @ 337 NONAME + _ZNK14CMPXMediaArray3AtLEi @ 338 NONAME + _ZN19CMPXActiveTaskQueue16CompleteAllTasksEi @ 339 NONAME + _ZN21CMPXPluginHandlerBase11LoadPluginLERK4TUid @ 340 NONAME + _ZN21CMPXPluginHandlerBase12UnloadPluginERK4TUid @ 341 NONAME + _ZN21CMPXPluginHandlerBase13ReleasePluginERK4TUid @ 342 NONAME + _ZN21CMPXPluginHandlerBase14IsPluginLoadedERK4TUid @ 343 NONAME + _ZN21CMPXPluginHandlerBase14ResolvePluginLEv @ 344 NONAME + _ZN21CMPXPluginHandlerBase18HandlePluginUnloadERK4TUid @ 345 NONAME + _ZN21CMPXPluginHandlerBase9UsePluginERK4TUid @ 346 NONAME + _ZN7MPXUser8Alloc8ZLERK7TDesC16 @ 347 NONAME + _ZN9CMPXMedia9SetErrorLERK13TMPXAttributei @ 348 NONAME + _ZNK9CMPXMedia5ErrorERK13TMPXAttribute @ 349 NONAME + _ZThn4_N21CMPXPluginHandlerBase18HandlePluginUnloadERK4TUid @ 350 NONAME ; ## + _ZNK9CMPXMedia8GetValueERK13TMPXAttributeR5TDes8 @ 351 NONAME + _ZN14CMPXPluginInfo17ExtractIntoArrayLERK6TDesC8RP12CDesC16Array @ 352 NONAME + _ZN11RMPXSession5CloseEv @ 353 NONAME + _ZN11RMPXSessionC1Ev @ 354 NONAME + _ZN11RMPXSessionC2Ev @ 355 NONAME + _ZN11RMPXSessionD1Ev @ 356 NONAME + _ZN11RMPXSessionD2Ev @ 357 NONAME + _ZNK11RMPXSession9ReconnectEv @ 358 NONAME + _ZNK21CMPXPluginHandlerBase15SupportedAppUidERK4TUid @ 359 NONAME + _ZN14CMPXClientList10AddClientLE9TThreadIdiP16CMPXMessageQueuei @ 360 NONAME + _ZNK14CMPXClientList14ClientCategoryEi @ 361 NONAME + _ZN21CMPXPluginHandlerBase15SelectPlugin64LERK7RFile64 @ 362 NONAME + diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2006 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 for project MPX common framework. +* +*/ + + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +mpxcommon.mmp diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/group/mpxcommon.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/group/mpxcommon.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2006 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 project specification +* +*/ + + + +#include +#include + +TARGET mpxcommon.dll +CAPABILITY CAP_GENERAL_DLL +TARGETTYPE DLL +UID 0x1000008D 0x101FFC12 +VENDORID VID_DEFAULT + +MACRO CAMESE_IN_DRM_UTILITY + +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +MW_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src +SOURCE mpxsession.cpp +SOURCE mpxclientlist.cpp +SOURCE mpxcenrepwatcher.cpp +SOURCE mpxmessage.cpp +SOURCE mpxcollectionpath.cpp +SOURCE mpxtaskqueue.cpp +SOURCE mpxmessagemonitor.cpp +SOURCE mpxuser.cpp +SOURCE mpxpskeywatcher.cpp +SOURCE mpxcollectiontype.cpp +SOURCE mpxpluginmonitor.cpp +SOURCE mpxpluginhandlerbase.cpp +SOURCE mpxmedia.cpp +SOURCE mpxmediaarray.cpp +SOURCE mpxdrmmediautility.cpp +SOURCE mpxdrmmediaagent.cpp +SOURCE mpxdrmmediaomaagent.cpp +SOURCE mpxdrmmediawmaagent.cpp +SOURCE mpxattribute.cpp +SOURCE mpxdata.cpp +SOURCE mpxheapmanager.cpp +SOURCE mpxfixedarray.cpp +SOURCE mpxdataarray.cpp +SOURCE mpxmediadataarray.cpp +SOURCE mpxmediabase.cpp +SOURCE mpxparameter.cpp +SOURCE mpxplugininfo.cpp +SOURCE mpxmessagequeue.cpp +SOURCE mpxsubscription.cpp +SOURCE mpxsessionretry.cpp + +LIBRARY euser.lib +LIBRARY centralrepository.lib +LIBRARY estor.lib +LIBRARY bafl.lib +LIBRARY efsrv.lib +LIBRARY ecom.lib +LIBRARY inetprotutil.lib +LIBRARY apgrfx.lib +LIBRARY apmime.lib +LIBRARY drmhelper.lib + +//CAMESE_IN_DRM_UTILITY +LIBRARY drmuihandling.lib +LIBRARY drmautomatedusage.lib +LIBRARY drmcommon.lib +LIBRARY drmrights.lib +LIBRARY caf.lib +LIBRARY cafutils.lib +LIBRARY ws32.lib +LIBRARY hal.lib + +#if defined(ARMCC) +deffile ../eabi/ +#elif defined(WINSCW) +deffile ../bwinscw/ +#endif + +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/inc/mpxdataarray.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/inc/mpxdataarray.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,340 @@ +/* +* Copyright (c) 2007 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: Array of variable size elements on global chunk +* +*/ + + + +#ifndef RMPXDATAARRAY_H +#define RMPXDATAARRAY_H + +#include + +class RMPXDataItem; + +/** +* Class RMPXDataItemArray. A dynamic array of RMPXDataItems, where each item +* can have variable length data +*/ +class RMPXDataItemArray + { +public: + /** + * C++ default constructor. + */ + RMPXDataItemArray(); + + /** + * Frees resources; object can go out of scope + * + * @param aClientHandle, client handle to the global chunk + */ + void Close(TUint aClientHandle); + +public: + /** + * Number of items in array + * + * @return number of contained media objects + */ + inline TInt Count() const; + + /** + * Data at aIndex + * + * @param aClientHandle, client handle to the global chunk + * @param aIndex, index of data item + * @return raw data of the item + */ + inline TPtrC8 Data(TUint aClientHandle,TInt aIndex); + + /** + * Data item at aIndex + * + * @param aClientHandle, client handle to the global chunk + * @param aIndex, index of data item + * @return data item object + */ + RMPXDataItem* DataItem(TUint aClientHandle,TInt aIndex); + + /** + * Adds an item to the array + * + * @param aClientHandle, client handle to the global chunk + * @param aItem, data item object + */ + void Append(TUint aClientHandle,RMPXDataItem& aItem); + + /** + * Replaces an item in the array + * + * @param aClientHandle, client handle to the global chunk + * @param aItem data item object + * @param aIndex, index of data item + */ + void Set(TUint aClientHandle,RMPXDataItem& aItem,TInt aIndex); + + /** + * Inserts an item to the array + * + * @param aClientHandle, client handle to the global chunk + * @param aItem data item object + * @param aIndex, index of data item + */ + void Insert(TUint aClientHandle,RMPXDataItem& aItem,TInt aIndex); + + /** + * Removes an item from the array + * + * @param aClientHandle, client handle to the global chunk + * @param aIndex, index of data item + */ + void Remove(TUint aClientHandle,TInt aIndex); + + /** + * Removes all items from the array + * + * @param aClientHandle, client handle to the global chunk + */ + void Reset(TUint aClientHandle); + + /** + * Find an item from the array + * + * @param aClientHandle, client handle to the global chunk + * @param aItem, data item object + */ + TInt Find(TUint aClientHandle,const RMPXDataItem& aItem); + +protected: + /** + * Deletes an item from the array + * + * @param aClientHandle, client handle to the global chunk + * @param aItem, data item object + */ + void Delete(TUint aClientHandle,RMPXDataItem* aItem); + +protected: + /** + * Offset from the base of the chunk to the first item + */ + TInt iFirstItemOffset; + /** + * Offset from the base of the chunk to the last item + */ + TInt iLastItemOffset; + /** + * Number of items stored in this array + */ + TInt iNumItems; + /** + * Current position within the list, offset from the base of the chunk + */ + TInt iPos; + /** + * Current index within the list (i.e. first item=0, last=iNumItems-1) + */ + TInt iIndex; + }; + +/** +* Class RMPXDataItem. Encapsulates an item of data on the heap. +*/ +class RMPXDataItem + { +public: + /** + * Default C++ constructor + */ + inline RMPXDataItem(); + + /** + * Frees resources; object can go out of scope + * + * @param aClientHandle, client handle to the global chunk + */ + inline void Close(TUint aClientHandle); + + /** + * Frees resources; object can be reused + * + * @param aClientHandle, client handle to the global chunk + */ + void Reset(TUint aClientHandle); + +public: + /** + * Sets the data for this object + * + * @param aClientHandle, client handle to the global chunk + * @param aSrc, source data item + * @param aSize, size of data item + */ + void Copy(TUint aClientHandle,TAny* aSrc,TInt aSize); + + /** + * Sets the data for this object + * + * @param aClientHandle, client handle to the global chunk + * @param aData, source data item + */ + inline void Copy(TUint aClientHandle,const TDesC8& aData); + + /** + * Pointer to the data for this object + * + * @param aClientHandle, client handle to the global chunk + * @return data item buffer + */ + TAny* Buf(TUint aClientHandle); + + /** + * Value of the data for this object as a descriptor + * + * @param aClientHandle, client handle to the global chunk + * @return data item buffer + */ + inline TPtrC8 Data(TUint aClientHandle); + + /** + * Size of the data for this object + * + * @return the size of data item + */ + inline TInt Size() const; + + /** + * UID of this object + * + * @return uid of the data item + */ + inline TInt Uid() const; + + /** + * Next item in list, or 0 if none + * + * @return next item offset + */ + inline TInt NextOffset() const; + + /** + * Previous item in list, or 0 if none + * + * @return previous item offset + */ + inline TInt PreviousOffset() const; + +public: + /** + * Inserts this object in a doubly linked list. Either (but not + * both) can be NULL in which case this item is appended to the + * start or end of the list + * + * @param aClientHandle, client handle to the global chunk + * @param aPrevious, pointer to previous data item + * @param aNext, pointer to next data item + */ + void Insert(TUint aClientHandle,RMPXDataItem* aPrevious,RMPXDataItem* aNext); + + /** + * Inserts this object in a doubly linked list. Either (but not + * both) can be 0 in which case this item is appended to the + * start or end of the list + * + * @param aClientHandle, client handle to the global chunk + * @param aPreviousOffset, previous data item offset + * @param aNextOffset, next data item offset + */ + void Insert(TUint aClientHandle,TInt aPreviousOffset,TInt aNextOffset); + + /** + * Sets this object in a doubly linked list. + * + * @param aClientHandle, client handle to the global chunk + * @param aOldItem, pointer to old data item + */ + void Set(TUint aClientHandle,RMPXDataItem* aOldItem); + + /** + * Sets this object in a doubly linked list. + * + * @param aClientHandle, client handle to the global chunk + * @param aOldItemOffset, old data item offset + */ + void Set(TUint aClientHandle,TInt aOldItemOffset); + + /** + * Removes this object from a doubly linked list + * + * @param aClientHandle, client handle to the global chunk + */ + void Remove(TUint aClientHandle); + +protected: + /** + * Offset from the base of the chunk to the previous data + * item, or 0 if none + */ + TInt iPreviousOffset; + /** + * Offset from the base of the chunk to the next data + * item, or 0 if none + */ + TInt iNextOffset; + /** + * Offset within this object + */ + TInt iBufOffset; + /** + * Length of the data buffer + */ + TInt iBufLen; + /** + * Unique ID of data + */ + TInt iUid; + }; + +/** +* Class RMPXDataObject. Data item which holds an object of type T +*/ +template +class RMPXDataObject : public RMPXDataItem + { +public: + /** + * Get the data object + * + * @param aClientHandle, client handle to the global chunk + * @return the data object + */ + inline T* Object(TUint aClientHandle); + + /** + * Copy data object + * + * @param aClientHandle, client handle to the global chunk + * @param aSrc, source data object + */ + inline void CopyObject(TUint aClientHandle,const T& aSrc); +private: + T iData; + }; + + +#include "mpxdataarray.inl" + +#endif // RMPXDATAARRAY_H diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/inc/mpxdataarray.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/inc/mpxdataarray.inl Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,137 @@ +/* +* Copyright (c) 2007 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: Implementation of array of variable size elements on global chunk +* +*/ + + + +// ----------------------------------------------------------------------------- +// RMPXDataItemArray::Count +// ----------------------------------------------------------------------------- +// +inline TInt RMPXDataItemArray::Count() const + { + return iNumItems; + } + +// ----------------------------------------------------------------------------- +// RMPXDataItemArray::Data +// ----------------------------------------------------------------------------- +// +inline TPtrC8 RMPXDataItemArray::Data(TUint aClientHandle,TInt aIndex) + { + ASSERT(aClientHandle&&aIndex>=0&&aIndexData(aClientHandle); + } + +// ----------------------------------------------------------------------------- +// RMPXDataItem::RMPXDataItem +// ----------------------------------------------------------------------------- +// +inline RMPXDataItem::RMPXDataItem() + : iPreviousOffset(0),iNextOffset(0),iBufLen(0),iUid(0) + { + iBufOffset = sizeof (RMPXDataItem); + } + +// ----------------------------------------------------------------------------- +// RMPXDataItem::Close +// ----------------------------------------------------------------------------- +// +inline void RMPXDataItem::Close(TUint aClientHandle) + { + ASSERT(aClientHandle); + Reset(aClientHandle); + } + +// ----------------------------------------------------------------------------- +// RMPXDataItem::Copy +// ----------------------------------------------------------------------------- +// +inline void RMPXDataItem::Copy(TUint aClientHandle,const TDesC8& aData) + { + ASSERT(aClientHandle); + return Copy(aClientHandle,(TAny*)aData.Ptr(),aData.Size()); + } + +// ----------------------------------------------------------------------------- +// RMPXDataItem::Des +// ----------------------------------------------------------------------------- +// +inline TPtrC8 RMPXDataItem::Data(TUint aClientHandle) + { + ASSERT(aClientHandle); + return iBufLen?TPtrC8((TUint8*)Buf(aClientHandle),Size()):TPtrC8(); + } + +// ----------------------------------------------------------------------------- +// RMPXDataItem::SetValue +// ----------------------------------------------------------------------------- +// +inline TInt RMPXDataItem::Size() const + { + return iBufLen; + } + +// ----------------------------------------------------------------------------- +// RMPXDataItem::Uid +// ----------------------------------------------------------------------------- +// +inline TInt RMPXDataItem::Uid() const + { + return iUid; + } + +// ----------------------------------------------------------------------------- +// RMPXDataItem::NextOffset +// ----------------------------------------------------------------------------- +// +inline TInt RMPXDataItem::NextOffset() const + { + return iNextOffset; + } + +// ----------------------------------------------------------------------------- +// RMPXDataItem::PreviousOffset +// ----------------------------------------------------------------------------- +// +inline TInt RMPXDataItem::PreviousOffset() const + { + return iPreviousOffset; + } + +// ----------------------------------------------------------------------------- +// RMPXDataObject::Data +// ----------------------------------------------------------------------------- +// +template +inline T* RMPXDataObject::Object(TUint aClientHandle) + { + return (T*)RMPXDataItem::Buf(aClientHandle); + } + +// ----------------------------------------------------------------------------- +// RMPXDataObject::Copy +// ----------------------------------------------------------------------------- +// + +template +inline void RMPXDataObject::CopyObject(TUint aClientHandle,const T& aSrc) + { + return RMPXDataItem::Copy(aClientHandle,(TAny*)&aSrc,sizeof(aSrc)); + } + +// End of file + diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/inc/mpxdrmmediaagent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/inc/mpxdrmmediaagent.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2006 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: Media agent base class +* +*/ + + + +#ifndef CMPXDRMMEDIAAGENT_H +#define CMPXDRMMEDIAAGENT_H + +#include "mpxdrmmediautility.h" + + +// DATA TYPES + +// FORWARD DECLARATIONS +class CMPXMedia; + +/** +* CMPXDrmMediaAgent class declaration +* +* @lib mpxcommon.lib +* @since S60 3.1 +*/ +NONSHARABLE_CLASS(CMPXDrmMediaAgent) : public CBase + { +public: // New Functions + /** + * Initialize using a filename + * + * @param aFileName file name + */ + virtual void InitL(const TDesC& aFileName) = 0; + + /** + * Initialize using a file handle + * + * @param aFile file handle + */ + virtual void InitL(RFile& aFile) = 0; + + /** + * Gets media object + * + * @param aAttributes attributes to retreive + * @return CMPXMedia object with the specified attributes + */ + virtual const CMPXMedia& GetMediaL(TUint aAttributes) = 0; + + /** + * Consumes the rights for the current media according + * to the specified consume type + * + * @param aType Type of consumption to execute + */ + virtual void ConsumeL(TDrmConsumeType aType) = 0; + + /** + * Closes and uninitializes the agent and cleans up member variables + * + * @return void + */ + virtual void Close(); + +protected: // New methods + /** + * Creates a new media object + */ + virtual void CreateMediaL(); + + /** + * Gets the protected attribute if not already obtained + */ + virtual void GetProtectedL(); + +protected: // Data + CMPXMedia* iMedia; // owned + CData* iData; // owned + }; + +#endif // CMPXDRMMEDIAAGENT_H diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/inc/mpxdrmmediaomaagent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/inc/mpxdrmmediaomaagent.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,205 @@ +/* +* Copyright (c) 2006 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: OMA DRM media agent +* +*/ + + + +#ifndef CMPXDRMMEDIAOMAAGENT_H +#define CMPXDRMMEDIAOMAAGENT_H + +#include "mpxdrmmediaagent.h" +#ifdef CAMESE_IN_DRM_UTILITY +#include +#endif + +// FORWARD DECLARATIONS +class CMPXMedia; +#ifdef CAMESE_IN_DRM_UTILITY +class CDRMRightsConstraints; +class DRMCommon; + +namespace DRM + { + class CDrmUiHandling; + } +#else +class CDRMHelper; +class CDRMHelperRightsConstraints; +#endif + +/** +* CMPXDrmMediaOmaAgent class declaration +* +* @lib mpxcommon.lib +* @since S60 3.1 +*/ +NONSHARABLE_CLASS(CMPXDrmMediaOmaAgent) : public CMPXDrmMediaAgent + { +public: // Constructors and Destructors + /** + * Two-phase constructor + * + * @return object created + */ + static CMPXDrmMediaOmaAgent* NewL(); + + /** + * Two-phase constructor + * + * @return object created + */ + static CMPXDrmMediaOmaAgent* NewLC(); + + /** + * Destructor + */ + virtual ~CMPXDrmMediaOmaAgent(); + +public: // New Functions + /** + * From MMPXDrmMediaAgent + * Initialize using a filename + * + * @param aFileName file name + */ + void InitL(const TDesC& aFileName); + + /** + * From MMPXDrmMediaAgent + * Initialize using a file handle + * + * @param aFile file handle + */ + void InitL(RFile& aFile); + + /** + * From MMPXDrmMediaAgent + * Gets media object + * + * @param aAttributes attributes to retreive + * @return CMPXMedia object with the specified attributes + */ + const CMPXMedia& GetMediaL(TUint aAttributes); + + /** + * From MMPXDrmMediaAgent + * Consumes the rights for the current media according + * to the specified consume type + * + * @param aType Type of consumption to execute + */ + void ConsumeL(TDrmConsumeType aType); + + /** + * Closes and uninitializes the agent and cleans up member variables + * + * @return void + */ + void Close(); + +private: // Constructors + /** + * C++ default constructor. + */ + CMPXDrmMediaOmaAgent(); + + /** + * 2nd phase contructor + */ + void ConstructL(); + +private: // New Functions + /** + * Creates a new media object + */ + void CreateMediaL(); + + /** + * Gets the rights details + */ + void GetRightsDetailsL(); + + /** + * Gets the rights type attribute if not already obtained + */ + void GetRightsTypeL(); + + /** + * Gets the count attribute if not already obtained + */ + void GetCountL(); + + /** + * Gets the start time attribute if not already obtained + */ + void GetStartTimeL(); + + /** + * Gets the end time attribute if not already obtained + */ + void GetEndTimeL(); + + /** + * Gets the interval attribute if not already obtained + */ + void GetIntervalL(); + + /** + * Gets the interval start time attribute if not already obtained + */ + void GetIntervalStartTimeL(); + + /** + * Gets the accumlated time attribute if not already obtained + */ + void GetAccumulatedTimeL(); + + /** + * Gets the can set automated attribute if not already obtained + */ + void GetCanSetAutomatedL(); + + /** + * Gets the info url attribute if not already obtained + */ + void GetHasInfoUrlL(); + + /** + * Gets the preview url attribute if not already obtained + */ + void GetHasPreviewUrlL(); + + /** + * Gets whether the DRM object is about to expire or not + */ + void GetAboutToExpireL(); + +private: // Data +#ifdef CAMESE_IN_DRM_UTILITY + DRM::CDrmUiHandling* iDrmHandler; // owned + DRMCommon* iDRMCommon; // owned + CDRMRightsConstraints* iRightsConstraints; // owned +#else + CDRMHelper* iDrmHelper; // owned + CDRMHelperRightsConstraints* iRightsConstraints; // owned +#endif + + RFile iFile; // owned (duplicate) + RFs iFs; + }; + + +#endif // CMPXDRMMEDIAOMAAGENT_H diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/inc/mpxdrmmediawmaagent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/inc/mpxdrmmediawmaagent.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,200 @@ +/* +* Copyright (c) 2006 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: Wma DRM media agent +* +*/ + + + +#ifndef CMPXDRMMEDIAWMAAGENT_H +#define CMPXDRMMEDIAWMAAGENT_H + +#include +#include +#include +#include "mpxdrmmediaagent.h" + + +// DATA TYPES +enum TMPXWmaDrmLicenseType + { + EMPXWmaDrmUnlimited, + EMPXWmaDrmTime, + EMPXWmaDrmCount, + EMPXWmaDrmDuration, + EMPXWmaDrmTimeCount + }; + +// FORWARD DECLARATIONS +class CMPXMedia; + +/** +* CMPXDrmMediaWmaAgent class declaration +* +* @lib mpxcommon.lib +* @since S60 3.1 +*/ +NONSHARABLE_CLASS(CMPXDrmMediaWmaAgent) : public CMPXDrmMediaAgent + { +public: // Constructors and Destructors + /** + * Two-phase constructor + * + * @return object created + */ + static CMPXDrmMediaWmaAgent* NewL(); + + /** + * Two-phase constructor + * + * @return object created + */ + static CMPXDrmMediaWmaAgent* NewLC(); + + /** + * Destructor + */ + virtual ~CMPXDrmMediaWmaAgent(); + +public: // New Functions + /** + * From MMPXDrmMediaAgent + * Initialize using a filename + * + * @param aFileName file name + */ + void InitL(const TDesC& aFileName); + + /** + * From MMPXDrmMediaAgent + * Initialize using a file handle + * + * @param aFile file handle + */ + void InitL(RFile& aFile); + + /** + * From MMPXDrmMediaAgent + * Gets media object + * + * @param aAttributes attributes to retreive + * @return CMPXMedia object with the specified attributes + */ + const CMPXMedia& GetMediaL(TUint aAttributes); + + /** + * From MMPXDrmMediaAgent + * Consumes the rights for the current media according + * to the specified consume type + * + * @param aType Type of consumption to execute + */ + void ConsumeL(TDrmConsumeType aType); + + /** + * Closes and uninitializes the agent and cleans up member variables + * + * @return void + */ + void Close(); + +private: // Constructors + /** + * C++ default constructor. + */ + CMPXDrmMediaWmaAgent(); + + /** + * 2nd phase contructor + */ + void ConstructL(); + +private: // New Functions + /** + * Creates a new media object + */ + void CreateMediaL(); + + /** + * Gets the rights status + */ + void GetRightsStatusL(); + + /** + * Gets the rights type attribute if not already obtained + */ + void GetRightsTypeL(); + + /** + * Gets the count attribute if not already obtained + */ + void GetCountL(); + + /** + * Gets the start time attribute if not already obtained + */ + void GetStartTimeL(); + + /** + * Gets the end time attribute if not already obtained + */ + void GetEndTimeL(); + + /** + * Gets the interval attribute if not already obtained + */ + void GetIntervalL(); + + /** + * Gets the sending allowed attribute if not already obtained + */ + void GetSendingAllowedL(); + + /** + * Gets the can set automated attribute if not already obtained + */ + void GetCanSetAutomatedL(); + + /** + * Get Rights Description for WMDRM protected files + * @return Error code: + * KErrNone: Description returned. + * KErrNotFound: No description available. + **/ + TInt GetWmdrmRightsDescriptionL(); + + /** + * Retrieve and format TTime for WMDRM protected files + * @param aTimeTypeDelimeter Time delimeter, starttime or endtime. + * @param aTime Time. + * @return Error code: + * KErrNone: Time returned. + * KErrNotFound: Not time available for given delimeter. + **/ + TInt GetWmdrmTimeL( const TDesC& aTimeTypeDelimeter, TTime& aTime ); + + /** + * Gets whether the DRM object is about to expire or not + */ + void GetAboutToExpireL(); + +private: // Data + HBufC* iFileName; // owned + CManager* iManager; // owned + CRightsManager* iRightsManager; // owned + HBufC* iRightsDescription; // owned + }; + + +#endif // CMPXDRMMEDIAWMAAGENT_H diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/inc/mpxfixedarray.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/inc/mpxfixedarray.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,144 @@ +/* +* Copyright (c) 2006 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: Array of fixed size elements on global chunk +* +*/ + + + +#ifndef RMPXFIXEDARRAY_H +#define RMPXFIXEDARRAY_H + +#include "mpxheapmanager.h" + +/** +* Base class for fixed arrays on global heap; not for direct use +*/ +class RMPXFixedArrayBase + { +public: + /** + * Returns pointer to start of Array (buffer holding array items) + * + * @param aClientHandle, client handle to the global chunk + * @return raw data of the array + */ + inline TAny* Buf(TUint aClientHandle) const; + + /** + * Number of elements in array + * + * @return number of elements in array + */ + inline TInt Count() const; + + /** + * Frees resources; object can go out of scope + * + * @param aClientHandle, client handle to the global chunk + */ + + inline void Close(TUint aClientHandle); + + /** + * Delete's content; array can be reused + * + * @param aClientHandle, client handle to the global chunk + */ + void Reset(TUint aClientHandle); // Frees contents + + /** + * Copies the contents of aArray into this array + * + * @param aClientHandle, client handle to the global chunk + * @param aArray, source array + * @return KErrNone if succeeded, otherwise system error code + */ + TInt Copy(TUint aClientHandle,const RMPXFixedArrayBase& aArray); + + /** + * Allocates buffer for an array of aCount items, each of size + * aElementSize; returns pointer to start of buffer + * + * @param aClientHandle, client handle to the global chunk + * @param aCount, number of the element in the array + * @return address of memory allocated + */ + TAny* Alloc(TUint aClientHandle,TInt aCount); + +protected: + RMPXFixedArrayBase(); + + /** + * Constructor. + * @param aElementSize size of the array element + */ + RMPXFixedArrayBase(TInt aElementSize); + + /** + * Constructor: copies content from aArray + * + * @param aArray source array + */ + RMPXFixedArrayBase(const RMPXFixedArrayBase& aArray); + +private: + TInt iCount; + TInt iDataOffset; + TInt iElementSize; + }; + +/** +* Array of fixed number of objects of type T +*/ +template +class RMPXFixedArray : public RMPXFixedArrayBase + { +public: + /** + * C++ default constructor. + */ + inline RMPXFixedArray(); + + /** + * Copy constructor: copies all data from aArray into + * this object + */ + inline RMPXFixedArray(const RMPXFixedArray& aArray); +public: + /** + * Copies the contents of aArray into this array + */ + inline TInt Copy(TUint aClientHandle,const TArray& aArray); + + /** + * Returns array + */ + inline TArray Array(TUint aClientHandle) const; + +private: + /** + * Count function for TArray + */ + inline static TInt CountFunctionR(const CBase* aThis); + + /** + * At function for TArray + */ + inline static const TAny* AtFunctionR(const CBase* aThis,TInt aIndex); + }; + +#include "mpxfixedarray.inl" + +#endif // RMPXFIXEDARRAY_H diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/inc/mpxfixedarray.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/inc/mpxfixedarray.inl Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2006 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: Implementation of array of fixed size elements on global chunk +* +*/ + + +// ----------------------------------------------------------------------------- +// RMPXFixedArrayBase::Close +// ----------------------------------------------------------------------------- +// +inline void RMPXFixedArrayBase::Close(TUint aClientHandle) + { + Reset(aClientHandle); + } + +// ----------------------------------------------------------------------------- +// RMPXFixedArrayBase::Buf +// ----------------------------------------------------------------------------- +// +inline TAny* RMPXFixedArrayBase::Buf(TUint aClientHandle) const + { + return RMPXHeapManager::Ptr(aClientHandle,iDataOffset); + } + +// ----------------------------------------------------------------------------- +// RMPXFixedArrayBase::Count +// ----------------------------------------------------------------------------- +// +inline TInt RMPXFixedArrayBase::Count() const + { + return iCount; + } + +// ----------------------------------------------------------------------------- +// RMPXFixedArray::RMPXFixedArray +// ----------------------------------------------------------------------------- +// +template +inline RMPXFixedArray::RMPXFixedArray(const RMPXFixedArray& aArray) + : RMPXFixedArrayBase(aArray,sizeof(T)) + { + } + +// ----------------------------------------------------------------------------- +// RMPXFixedArray::RMPXFixedArray +// ----------------------------------------------------------------------------- +// +template +inline RMPXFixedArray::RMPXFixedArray() + : RMPXFixedArrayBase(sizeof(T)) + { + } + +// ----------------------------------------------------------------------------- +// RMPXFixedArray::Copy +// ----------------------------------------------------------------------------- +// +template +inline TInt RMPXFixedArray::Copy(TUint aClientHandle,const TArray& aArray) + { + TInt n=aArray.Count(); + T* ptr=(T*)RMPXFixedArrayBase::Alloc(aClientHandle,n); + if (ptr) + { + for (TInt i=0;i +inline TArray RMPXFixedArray::Array(TUint aClientHandle) const + { + TInt thisOffset=RMPXHeapManager::Offset(aClientHandle,(TAny*)this); + return TArray(CountFunctionR,AtFunctionR,reinterpret_cast(thisOffset)); + } + +// ----------------------------------------------------------------------------- +// RMPXFixedArray::CountFunctionR +// ----------------------------------------------------------------------------- +// +template +inline TInt RMPXFixedArray::CountFunctionR(const CBase* aThis) + { + // Non-optimal, obtaining client handle every time count is accessed, however + // there's no choice since the data could be shared by multiple threads and the + // function signature does not allow the handle to be passed through + // + TInt offset=reinterpret_cast(aThis); + TInt ch=RMPXHeapManager::ClientHandle(); + const RMPXFixedArrayBase* arr=RMPXHeapManager::Ptr(ch,offset); + return arr->Count(); + } + +// ----------------------------------------------------------------------------- +// RMPXFixedArray::AtFunctionR +// ----------------------------------------------------------------------------- +// +template +inline const TAny* RMPXFixedArray::AtFunctionR(const CBase* aThis,TInt aIndex) + { + // Non-optimal, obtaining client handle every time data is accessed, however + // there's no choice since the data could be shared by multiple threads and the + // function signature does not allow the handle to be passed through + // + TInt offset=reinterpret_cast(aThis); + TInt ch=RMPXHeapManager::ClientHandle(); + const RMPXFixedArrayBase* arr=RMPXHeapManager::Ptr(ch,offset); + T* ptr=(T*)arr->Buf(ch); + return &ptr[aIndex]; + } + +// End of file + diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/inc/mpxheapmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/inc/mpxheapmanager.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,337 @@ +/* +* Copyright (c) 2006 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: Manages global heap/chunk +* +*/ + + + +#ifndef RMPXHEAPMANAGER_H +#define RMPXHEAPMANAGER_H + +#include "mpxdataarray.h" + + +class RMPXHeapCell + { + public: + RMPXHeapCell(TInt aNextOffset, TInt aLen): + iNextOffset(aNextOffset), + iLen(aLen) + { + } + RMPXHeapCell() + { + } + public: + /** + * Offset of next cell from the base of the chunk to the next heap + * cell, or 0 if none + */ + TInt iNextOffset; + /** + * Length of the cell, which includes the length of header + */ + TInt iLen; + /** + * Is this cell's contents paged to file storage + */ + // TBool iPaged; + }; + +/** +* Class RMPXHeapManager +*/ +class RMPXHeapManager + { +public: + /** + * The heap manager + * + * @param aClientHandle, client handle to the global chunk + */ + static inline RMPXHeapManager& HeapManager(TUint aClientHandle); + + /** + * Gets the total size and the currently used size of the global heap + * + * @param aTotal Total size of memory in bytes (out parameter) + * @param aUsed Used size of memory in bytes (out parameter) + * @leave Leave with KErrNotFound if failed to open global chunk + */ + static void HeapMemoryInfoL( TInt& aTotal, TInt& aUsed ); + + +public: + /** + * Handle which represents the current client (thread). + * This should be stored by the client and provided in all methods; + * by so doing, the Heap Manager can optimally cope with the chunk mapped + * to different addresses, thread relative handles for the chunk and mutex, + * etc. Handle should never be zero: zero indicates that it has failed. + * + * @return client handle to the global chunk + */ + static TUint ClientHandle(); + + /** + * Returns absolute address from an offset from the base of the chunk + * + * @param aClientHandle, client handle to the global chunk + * @param aOffset, offset to the glboal chunk + * @return pointer to the global address + */ + template + static inline T* Ptr(TUint aClientHandle,TInt aOffset=0); + + /** + * Returns offset from the base of the chunk from absolute pointer + * + * @param aClientHandle, client handle to the global chunk + * @param aPtr pointer to the global address + * @return offset to the glboal chunk + */ + static inline TInt Offset(TUint aClientHandle,TAny* aPtr); + +public: + /** + * Add another/new reference to a client (thread) + * + * @param aClientHandle, client handle to the global chunk + */ + void AddRef(TUint aClientHandle); + + /** + * Remove a reference to a client (thread) + * @param aClientHandle, client handle to the global chunk + */ + void Release(TUint aClientHandle); + + /** + * Allocate an object of type T on the chunk. An absolute pointer to the + * object created is returned, though the object must contain no absolute + * pointers within itself + * + * @param aClientHandle, client handle to the global chunk + * @return pointer to the memory + */ + template + inline T* Alloc(TUint aClientHandle); + + /** + * Allocate a buffer of size aSize and return an absolute pointer to the + * start of the buffer. + * + * @param aClientHandle, client handle to the global chunk + * @param aSize, size of the memory + * @return pointer to the memory + */ + TAny* Alloc(TUint aClientHandle,TInt aSize); + + /** + * Allocate a buffer of size aSize, copy aSrcOffset to the buffer, + * and return an offset to the start of the buffer. + * + * @param aClientHandle, client handle to the global chunk + * @param aSrcOffset, source data offset + * @param aSize, size of the data buffer + * @return system error code + */ + inline TInt Copy(TUint aClientHandle,TInt aSrcOffset,TInt aSize); + + /** + * Allocate a buffer of size aSize, copy aSrc to the buffer, + * and return an offset to the start of the buffer. + * + * @param aClientHandle, client handle to the global chunk + * @param aSrc, source + * @param aSize, size of the data buffer + * @return system error code + */ + TInt Copy(TUint aClientHandle,TAny* aSrc,TInt aSize); + + /** + * Delete an object/buffer on the chunk. Can return error + * + * @param aClientHandle, client handle to the global chunk + * @param aSrcPtr, memory address to be freed + * @return system error code + */ + TInt Free(TUint aClientHandle,TAny* aPtr); + + /** + * Delete an object/buffer on the chunk. Can return error + * + * @param aClientHandle, client handle to the global chunk + * @param aOffset, offset to global memory to be freed + * @return system error code + */ + inline TInt Free(TUint aClientHandle,TInt aOffset); + + /** + * Locks heap + * + * @param aClientHandle, client handle to the global chunk + */ + void Lock(TUint aClientHandle); + + /** + * Unocks heap + * + * @param aClientHandle, client handle to the global chunk + */ + void Unlock(TUint aClientHandle); + + /** + * Increment consecutive number + * + * @return current number + */ + TInt IncrementCounter(); + +#ifdef __ENABLE_MPX_GARBAGE_COLLECTOR + /** + * Run the Garbage Collector + */ + void RunGc(TUint aClientHandle); //GC + + /** + * Associate data with this client + */ + TInt AddData(TUint aClientHandle,TUint aDataHandle); //GC + + /** + * Unassociate data with this client + */ + TInt RemoveData(TUint aClientHandle,TUint aDataHandle,TBool aRemoveAll); //GC +#endif // __ENABLE_MPX_GARBAGE_COLLECTOR + +private: + /** + * Data associated with a client (thread) + */ + class TClientContext + { + public: + TClientContext(); + TClientContext(TUint8* aBase,TInt aChunkHandle,TInt aMutexHandle); + public: + TThreadId iTid; + RChunk iChunk; // Thread relative + RMutex iMutex; // Thread relative + TInt iCount; // Number of clients in this thread (media objects) + TUint8* iBase; // Base of the chunk for this process +#ifdef __ENABLE_MPX_GARBAGE_COLLECTOR + RMPXDataItemArray iData; // Dynamic array of TUint //GC +#endif // __ENABLE_MPX_GARBAGE_COLLECTOR + }; +private: + RMPXHeapManager(const RChunk& aChunk); + +private: + /** + * Index which represents the current client (thread). + * Refers to iClients array. + */ + TInt ClientIndex(const TClientContext& aContext); + + /** + * Client index from the handle. Refers to iClients array. + */ + static inline TInt ClientIndex(TUint aClientHandle); + + /** + * Returns index of first entry for that TID. There will + * only ever be one, unless the search is for KNullThreadId + */ + TInt Find(const TThreadId& aTid); + + /** + * Creates client handle + */ + static inline TUint ClientHandle(TUint8* aChunkBase,TInt aClientIndex); + + /** + * Base address of the chunk for this client + */ + static inline TUint8* ChunkBase(TUint aClientHandle); + + /** + * Finds (or creates) first Heap Cell which can fit aSize bytes + */ + RMPXHeapCell* HeapCell(TUint aClientHandle,TInt aSize); + + /** + * Finds (or creates) first Heap Cell which can fit aSize bytes + */ + RMPXHeapCell* DoHeapCell(TUint aClientHandle,TInt aSize,RMPXHeapCell*& aLastFree); + + /** + * Try to grow the global chunk + */ + TInt TryToGrowHeap(TUint aClientHandle, TInt aSize, RMPXHeapCell* aLastFree); + + /** + * Number of clients (threads) + */ + TInt ClientCount() const; + + /** + * Check if it is the last cell + */ + TBool IsLastCell(TUint aClientHandle, RMPXHeapCell* aCell); + +private: + + enum {ENumClients=0x100}; + enum {EHeapCellHeaderSize = sizeof(RMPXHeapCell)}; + enum {EMinCellSize = sizeof(RMPXHeapCell) + 4 }; + +private: + /** + * Client data (per thread) + */ + TFixedArray iClients; + /** + * Offset from the base of the chunk to the end of the chunk, i.e. + * the size of the chunk + */ + TInt iEndOffset; + /** + * Head to free cell list + */ + RMPXHeapCell iFree; + /** + * Counter + */ + TInt iCounter; + + /** + * Total memory in bytes used in Global Chunk + */ + TInt iUsedMemory; + + /** + * Maximum size of memory in bytes used in Global Chunk + */ + TInt iMaxMemory; + +#ifdef __ENABLE_MPX_GARBAGE_COLLECTOR + TInt iDeadContextIndex; +#endif // __ENABLE_MPX_GARBAGE_COLLECTOR + }; + +#include "mpxheapmanager.inl" + +#endif // RMPXHEAPMANAGER_H diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/inc/mpxheapmanager.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/inc/mpxheapmanager.inl Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2006 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: Inline implementation of heap manager +* +*/ + +#include + +// ----------------------------------------------------------------------------- +// Client handle +// ----------------------------------------------------------------------------- +// +inline TUint RMPXHeapManager::ClientHandle(TUint8* aBase,TInt aClientIndex) + { + // We assume here that the chunk base address ends in 0x00 so we can put the client + // index at this location, so we must make sure that is true, and that there are + // no more clients than will fit, i.e. 0xff (255) + // + MPX_ASSERT(aBase&&aClientIndex>=0&&aClientIndex(h&0xffffff00)==aBase); + return h; + } + +// ----------------------------------------------------------------------------- +// Client index +// ----------------------------------------------------------------------------- +// +inline TInt RMPXHeapManager::ClientIndex(TUint aClientHandle) + { + MPX_ASSERT(aClientHandle); + return aClientHandle&0xff; + } + +// ----------------------------------------------------------------------------- +// Chunk Base +// ----------------------------------------------------------------------------- +// +inline TUint8* RMPXHeapManager::ChunkBase(TUint aClientHandle) + { + MPX_ASSERT(aClientHandle); + return reinterpret_cast(aClientHandle&0xffffff00); + } + +// ----------------------------------------------------------------------------- +// Absolute pointer to T (thread relative) +// ----------------------------------------------------------------------------- +// +template +inline T* RMPXHeapManager::Ptr(TUint aClientHandle,TInt aOffset) + { + T* ptr=reinterpret_cast(ChunkBase(aClientHandle)+aOffset); + MPX_ASSERT(aOffset==((TUint8*)ptr-ChunkBase(aClientHandle))); + return ptr; + } + +// ----------------------------------------------------------------------------- +// Relative offset from absolute pointer +// ----------------------------------------------------------------------------- +// +inline TInt RMPXHeapManager::Offset(TUint aClientHandle,TAny* aPtr) + { + TInt o=((TUint8*)aPtr-ChunkBase(aClientHandle)); + MPX_ASSERT(aPtr==reinterpret_cast(ChunkBase(aClientHandle)+o)); + return o; + } + +// ----------------------------------------------------------------------------- +// RMPXHeapManager::HeapManager +// ----------------------------------------------------------------------------- +// +inline RMPXHeapManager& RMPXHeapManager::HeapManager(TUint aClientHandle) + { return *Ptr(aClientHandle); } + +// ----------------------------------------------------------------------------- +// Frees an offset on the chunk +// ----------------------------------------------------------------------------- +// +inline TInt RMPXHeapManager::Free(TUint aClientHandle,TInt aOffset) + { + return Free(aClientHandle,Ptr(aClientHandle,aOffset)); + } + +// ----------------------------------------------------------------------------- +// Allocate an object on the chunk +// ----------------------------------------------------------------------------- +// +template +inline T* RMPXHeapManager::Alloc(TUint aClientHandle) + { + T* obj=NULL; + TAny* ptr=Alloc(aClientHandle,sizeof(T)); + if (ptr) + { + obj=new(ptr)T; + } + MPX_ASSERT_WORD_ALIGNED(obj); + return obj; + } + +// ----------------------------------------------------------------------------- +// Copy a buffer on the chunk +// ----------------------------------------------------------------------------- +// +inline TInt RMPXHeapManager::Copy(TUint aClientHandle,TInt aSrcOffset,TInt aSize) + { + return Copy(aClientHandle,RMPXHeapManager::Ptr(aClientHandle,aSrcOffset),aSize); + } + +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/inc/mpxmediadataarray.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/inc/mpxmediadataarray.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,175 @@ +/* +* Copyright (c) 2006 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: Array of variable size elements on global chunk +* +*/ + + + +#ifndef RMPXMEDIADATAARRAY_H +#define RMPXMEDIADATAARRAY_H + +#include "mpxdataarray.h" +#include + +class RMPXMediaDataItem; + + +/** +* Class RMPXMediaDataItemArray. A dynamic array of RMPXMediaDataItems, where +* each item can have variable length data +*/ +class RMPXMediaDataItemArray : public RMPXDataItemArray + { +public: + + /** + * Sets the data for this object + * + * @param aClientHandle, client handle to the global chunk + * @param aArray, source array + * @return KErrNone if succeeded, otherwise system error code + */ + TInt Copy(TUint aClientHandle,const RMPXMediaDataItemArray& aArray); + + /** + * Data item at aIndex + * + * @param aClientHandle, client handle to the global chunk + * @param aIndex, index to the data item + * @return data item object + */ + inline RMPXMediaDataItem* MediaDataItem(TUint aClientHandle,TInt aIndex); + + /** + * Adds an item to the array + * + * @param aClientHandle, client handle to the global chunk + * @param aAttr, media attribute + * @param aAttrType, object type + * @param aData, raw data + * @return KErrNone if succeeded. Otheriwse system error code + */ + TInt Append(TUint aClientHandle, + const TMPXAttribute& aAttr, + TMPXAttributeType aAttrType, + const TDesC8& aData); + + /** + * Sets an item in the array + * + * @param aClientHandle, client handle to the global chunk + * @param aAttr, media attribute + * @param aAttrType, object type + * @param aData, raw data + * @param aIndex, index of data item to be set. + * @return KErrNone if succeeded. Otheriwse system error code + */ + TInt Set(TUint aClientHandle, + const TMPXAttribute& aAttr, + TMPXAttributeType aAttrType, + const TDesC8& aData, + TInt aIndex); + + /** + * Inserts an item to the array + * + * @param aClientHandle, client handle to the global chunk + * @param aAttr, media attribute + * @param aAttrType, object type + * @param aData, raw data + * @param aIndex, index of data item. + * @return KErrNone if succeeded. Otheriwse system error code + */ + TInt Insert(TUint aClientHandle, + const TMPXAttribute& aAttr, + TMPXAttributeType aAttrType, + const TDesC8& aData, + TInt aIndex); + + /** + * Index of an attribute + * + * @param aClientHandle, client handle to the global chunk + * @param aAttr, media attribute + * @return index of the media attribute + */ + TInt Index(TUint aClientHandle,const TMPXAttribute& aAttr); + +private: + + /** + * Create a new item, or NULL if OOM + * + * @param aClientHandle, client handle to the global chunk + * @param aAttr, media attribute + * @param aAttrType, object type + * @param aData, raw data + * @return pointer to new data item + */ + RMPXMediaDataItem* NewItem(TUint aClientHandle, + const TMPXAttribute& aAttr, + TMPXAttributeType aAttrType, + const TDesC8& aData); + }; + +/** +* Class RMPXMediaDataItem. Encapsulates a media item of data on the heap. +* E.g. a single attribute and value of a media object +*/ +class RMPXMediaDataItem : public RMPXDataItem + { +public: + /** + * Default C++ constructor + */ + inline RMPXMediaDataItem(); + + /** + * Sets the attribute and its type + * + * @param aAttr, media attribute + * @param aAttrType, object type + */ + inline void SetAttribute(const TMPXAttribute& aAttr,TMPXAttributeType aType); + + /** + * The attribute type + * + * @return object type of the item + */ + inline TMPXAttributeType Type() const; + + /** + * The attribute + * + * @return media attribute of the item + */ + inline const TMPXAttribute& Attribute() const; + +private: + /** + * Attribute stored by this object + */ + TMPXAttribute iAttr; + /** + * Data type of attribute. Can be EMPXTypeUnknown,EMPXTypeTInt, + * EMPXTypeText,EMPXTypeTObject,EMPXTypeCObject + */ + TMPXAttributeType iAttrType; + }; + +#include "mpxmediadataarray.inl" + +#endif // RMPXMEDIADATAARRAY_H diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/inc/mpxmediadataarray.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/inc/mpxmediadataarray.inl Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,69 @@ +/* +* Copyright (c) 2006 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: Implementation of array of variable size elements on global chunk +* +*/ + + +// ----------------------------------------------------------------------------- +// RMPXDataItem::RMPXDataItem +// ----------------------------------------------------------------------------- +// +inline RMPXMediaDataItem::RMPXMediaDataItem() + { + iBufOffset = sizeof (RMPXMediaDataItem); + } + +// ----------------------------------------------------------------------------- +// RMPXMediaDataItemArray::DataItem +// ----------------------------------------------------------------------------- +// +inline RMPXMediaDataItem* RMPXMediaDataItemArray::MediaDataItem( + TUint aClientHandle, + TInt aIndex) + { + return static_cast(DataItem(aClientHandle,aIndex)); + } + +// ----------------------------------------------------------------------------- +// RMPXMediaDataItem::SetAttribute +// ----------------------------------------------------------------------------- +// +inline void RMPXMediaDataItem::SetAttribute( + const TMPXAttribute& aAttr, + TMPXAttributeType aType) + { + iAttr=aAttr; + iAttrType=aType; + } + +// ----------------------------------------------------------------------------- +// RMPXMediaDataItem::Type +// ----------------------------------------------------------------------------- +// +inline TMPXAttributeType RMPXMediaDataItem::Type() const + { + return iAttrType; + } + +// ----------------------------------------------------------------------------- +// RMPXMediaDataItem::Attribute +// ----------------------------------------------------------------------------- +// +inline const TMPXAttribute& RMPXMediaDataItem::Attribute() const + { + return iAttr; + } + +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/inc/mpxmediaimagedefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/inc/mpxmediaimagedefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2006 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: Definitions for image media type +* +*/ + + + +#ifndef CMPXMEDIAIMAGEDEFS_H +#define CMPXMEDIAIMAGEDEFS_H + + +#include +#include + +/** +* Content ID identifying image category of content provided +* in the media object and associated attributes. +*/ + +const TInt KMPXMediaIdImage=0x101FFC44; + +/** +* Attributes supported for KMPXMediaIdImage +*/ +const TMPXAttributeData KMPXMediaImageSize={KMPXMediaIdImage,0x01}; +const TMPXAttributeData KMPXMediaImageAll={KMPXMediaIdImage,0xffffffff}; + +/** DEPRECATED, please use consts above +* Attributes supported for KMPXMediaIdImage +*/ +enum + { + EMPXMediaImageSize=0x01, // TSize + EMPXMediaImageAll=0xffffffff + }; + + +#endif // CMPXMEDIAIMAGEDEFS_H diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/inc/mpxsessionretry.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/inc/mpxsessionretry.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,111 @@ +/* +* Copyright (c) 2007 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: Client session retry implementation +* +*/ + +#ifndef RMPXSESSIONRETRY_H +#define RMPXSESSIONRETRY_H + +#include + +const TInt KMPXMaxServerImageNameLength = 30; + +/** +* Client session retry implementation +* +* @lib MPXCommon.lib +*/ +class RMPXSessionRetry : public RSessionBase + { + public: + + /** + * Get version info. + * + * @since S60 5.0 + * @return version info + */ + TVersion Version() const; + + /** + * Connect to server. + * + * @since S60 5.0 + * @param aServer server name + * @param aImage server image name + * @return KErrNone success, otherwise system error code + */ + TInt Connect(const TDesC& aServer, + const TDesC& aImage, + const TVersion& aVersion); + + /** + * Reconnect to server. + * + * @since S60 5.0 + * @return KErrNone success, otherwise system error code + */ + TInt Reconnect(); + + /** + * Send a message. + * + * @since S60 5.0 + * @param aFunction function code + * @return message completion code + */ + TInt SendReceiveL(TInt aFunction); + + /** + * Send a message. + * + * @since S60 5.0 + * @param aFunction function code + * @param aArgs parameter to server + * @return message completion code + */ + TInt SendReceiveL(TInt aFunction, const TIpcArgs& aArgs); + + /** + * Send message asynchronously. + * + * @since S60 5.0 + * @param aFunction function code + * @param aStatus the request status object used to contain the + * completion status of the request + */ + void SendReceive(TInt aFunction, TRequestStatus& aStatus); + + /** + * Send message asynchronously. + * + * @since S60 5.0 + * @param aFunction function code + * @param aArgs parameter to server + * @param aStatus the request status object used to contain the + * completion status of the request + */ + void SendReceive(TInt aFunction, const TIpcArgs& aArgs, + TRequestStatus& aStatus); + + private: + TVersion iVersion; + TBuf iServer; + TBuf iImage; + }; + +#endif // RMPXSESSIONRETRY_H + +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/inc/mpxsubscriptiondefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/inc/mpxsubscriptiondefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2007 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: Definitions for subscription attributes +* +*/ + + + +#ifndef MPXSUBSCRIPTIONDEFS_H +#define MPXSUBSCRIPTIONDEFS_H + +#include + +/** +* Content ID identifying general category of content provided +* in the message object and associated attributes. This should +* be supported by ALL message objects as a common base +*/ + +const TInt KMPXSubscriptionGeneral = 0x1028294A; + +/** +* TMPXMessageId, *unique* id of the message +*/ +const TMPXAttributeData KMPXSubscriptionItems = {KMPXSubscriptionGeneral, 0x01}; + +#endif // MPXSUBSCRIPTIONDEFS_H diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxattribute.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxattribute.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,181 @@ +/* +* Copyright (c) 2006 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: mpx attribute class +* +*/ + +#include "mpxattribute.h" +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Overloadded operator +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool TMPXAttributeData::operator& ( + const TMPXAttributeData& aData) const + { + ASSERT(iContentId == aData.iContentId); + return iAttributeId & aData.iAttributeId; + } + +// ---------------------------------------------------------------------------- +// Overloadded operator +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool TMPXAttributeData::operator& (TUint& aData) const + { + return iAttributeId & aData; + } +// ---------------------------------------------------------------------------- +// Overloadded operator +// ---------------------------------------------------------------------------- +// +EXPORT_C TMPXAttributeData TMPXAttributeData::operator| ( + const TMPXAttributeData& aData) const + { + ASSERT(iContentId == aData.iContentId); + TMPXAttributeData ret={iContentId, iAttributeId | aData.iAttributeId}; + return ret; + } + +// ---------------------------------------------------------------------------- +// C++ default constructor +// ---------------------------------------------------------------------------- +// +EXPORT_C TMPXAttribute::TMPXAttribute() + { + iData.iContentId=0; + iData.iAttributeId=0; + } + +// ---------------------------------------------------------------------------- +// C++ constructor +// ---------------------------------------------------------------------------- +// +EXPORT_C TMPXAttribute::TMPXAttribute(TInt aContentId, TUint aAttributeId) + { + iData.iContentId=aContentId; + iData.iAttributeId=aAttributeId; + } + +// ---------------------------------------------------------------------------- +// Copy constructor +// ---------------------------------------------------------------------------- +// +EXPORT_C TMPXAttribute::TMPXAttribute(const TMPXAttribute& aId) + { + iData.iContentId=aId.ContentId(); + iData.iAttributeId=aId.AttributeId(); + } + +// ---------------------------------------------------------------------------- +// Copy constructor +// ---------------------------------------------------------------------------- +// +EXPORT_C TMPXAttribute::TMPXAttribute(const TMPXAttributeData& aData) +: iData(aData) + { + } + +// ---------------------------------------------------------------------------- +// Overloaded assignment operator +// ---------------------------------------------------------------------------- +// +EXPORT_C TMPXAttribute& TMPXAttribute::operator=(const TMPXAttribute& aId) + { + if (this != &aId) + { + iData.iContentId = aId.ContentId(); + iData.iAttributeId = aId.AttributeId(); + } + return *this; + } + +// ---------------------------------------------------------------------------- +// Overloaded equal operator +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool TMPXAttribute::operator==(const TMPXAttribute& aId) const + { + TBool ret = EFalse; + if (iData.iAttributeId == aId.iData.iAttributeId && + iData.iContentId == aId.iData.iContentId) + { + ret = ETrue; + } + return ret; + } + +// ----------------------------------------------------------------------------- +// Externalize +// ----------------------------------------------------------------------------- +// +EXPORT_C void TMPXAttribute::ExternalizeL(RWriteStream& aStream) const + { + aStream.WriteInt32L(iData.iContentId); + aStream.WriteUint32L(iData.iAttributeId); + } + +// ----------------------------------------------------------------------------- +// Internalize +// ----------------------------------------------------------------------------- +// +EXPORT_C void TMPXAttribute::InternalizeL(RReadStream& aStream) + { + iData.iContentId=aStream.ReadInt32L(); + iData.iAttributeId=aStream.ReadUint32L(); + } + +// ---------------------------------------------------------------------------- +// Return content id +// ---------------------------------------------------------------------------- +// +EXPORT_C TInt TMPXAttribute::ContentId() const + { + return iData.iContentId; + } + +// ---------------------------------------------------------------------------- +// Return attribute id +// ---------------------------------------------------------------------------- +// +EXPORT_C TUint TMPXAttribute::AttributeId() const + { + return iData.iAttributeId; + } + +// ----------------------------------------------------------------------------- +// Helper function to do match in the RArray of the objects of this class +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool TMPXAttribute::Match( + const TMPXAttribute& aFirst, + const TMPXAttribute& aSecond) + { + return aFirst==aSecond; + } + +// ----------------------------------------------------------------------------- +// Helper function to do match in the RArray of the objects of this class by +// content id +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool TMPXAttribute::MatchContentId( + const TMPXAttribute& aFirst, + const TMPXAttribute& aSecond) + { + return aFirst.ContentId()==aSecond.ContentId(); + } + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxcenrepwatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxcenrepwatcher.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,118 @@ +/* +* Copyright (c) 2006 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: Class for observing changes in central repository values +* +*/ + + + +// INCLUDE FILES +#include +#include + +// ----------------------------------------------------------------------------- +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCenRepWatcher* CMPXCenRepWatcher::NewL(const TUid& aRepositoryUid, + TUint32 aId, + MMPXCenRepObserver* aObserver) + { + CMPXCenRepWatcher* self = new(ELeave) CMPXCenRepWatcher( + aRepositoryUid, aId, aObserver); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CMPXCenRepWatcher::CMPXCenRepWatcher(const TUid& aRepositoryUid, + TUint32 aId, + MMPXCenRepObserver* aObserver) +: CActive(EPriorityStandard), + iRepository(NULL), + iRepositoryUid(aRepositoryUid), + iId(aId), + iObserver(aObserver) + { + } + +// ----------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CMPXCenRepWatcher::ConstructL() + { + iRepository = CRepository::NewL(iRepositoryUid); + CActiveScheduler::Add( this ); + User::LeaveIfError(iRepository->NotifyRequest(iId, iStatus)); + SetActive(); + } + +// Destructor +EXPORT_C CMPXCenRepWatcher::~CMPXCenRepWatcher() + { + Cancel(); + delete iRepository; + iObserver = NULL; + } + +// ----------------------------------------------------------------------------- +// CMPXCenRepWatcher::CurrentValueL +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXCenRepWatcher::CurrentValueL() + { + TInt res = 0; + User::LeaveIfError(iRepository->Get(iId, res)); + return res; + } + +// ----------------------------------------------------------------------------- +// CMPXCenRepWatcher::SetValueL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCenRepWatcher::SetValueL(TInt aNewValue) + { + User::LeaveIfError(iRepository->Set(iId, aNewValue)); + } + +// ----------------------------------------------------------------------------- +// CMPXCenRepWatcher::RunL +// ----------------------------------------------------------------------------- +// +void CMPXCenRepWatcher::RunL() + { + User::LeaveIfError(iRepository->NotifyRequest(iId, iStatus)); + SetActive(); + + iObserver->HandleSettingChange(iRepositoryUid, iId); + } + +// ----------------------------------------------------------------------------- +// CMPXCenRepWatcher::DoCancel +// ----------------------------------------------------------------------------- +// +void CMPXCenRepWatcher::DoCancel() + { + iRepository->NotifyCancel(iId); + } + + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxclientlist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxclientlist.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,604 @@ +/* +* Copyright (c) 2006 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: Encapsulates all the clients +* +*/ + + +// INCLUDES +#include +#include "mpxuser.h" +#include "mpxmessagequeue.h" +#include "mpxclientlistobserver.h" +#include "mpxclientlist.h" +#include + +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXClientList* CMPXClientList::NewL( + MMPXClientlistObserver* aObserver /*=NULL*/) + { + CMPXClientList* list=new(ELeave)CMPXClientList(aObserver); + CleanupStack::PushL(list); + list->ConstructL(); + CleanupStack::Pop(list); + return list; + } + +// ---------------------------------------------------------------------------- +// Constructor. +// ---------------------------------------------------------------------------- +// +CMPXClientList::CMPXClientList(MMPXClientlistObserver* aObserver) + : iIdentity(CMPXClientList::ClientsMatch), + iObserver(aObserver) + {} + +// ---------------------------------------------------------------------------- +// 2nd phase constructor. +// ---------------------------------------------------------------------------- +// +void CMPXClientList::ConstructL() + { + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXClientList::~CMPXClientList() + { + iClients.ResetAndDestroy(); + iClients.Close(); + iClientProcesses.Close(); + } + +// ---------------------------------------------------------------------------- +// Add a client into the client list +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXClientList::AddClientL( + TThreadId aId, + CMPXMessageQueue* aMsgQueue) + { + AddClientL(aId, KErrUnknown, aMsgQueue); + } + +// ---------------------------------------------------------------------------- +// Add a client into the client list +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXClientList::AddClientL( + TThreadId aId, + TInt aMode, + CMPXMessageQueue* aMsgQueue) + { + TProcessId pid=MPXUser::ProcessIdL(aId); + CClientId* newClient = new(ELeave) CClientId(aId,pid,aMode,aMsgQueue); + CleanupStack::PushL(newClient); + + // add an empty subscription by default + CMPXSubscription* subscription = CMPXSubscription::NewL(); + CleanupStack::PushL(subscription); + + // transfer the ownership + newClient->iSubscriptions.AppendL(subscription); + CleanupStack::Pop(subscription); + + iClients.AppendL(newClient); + CleanupStack::Pop(newClient); + + if (iClientProcesses.Find(pid)==KErrNotFound) + { + iClientProcesses.AppendL(pid); + if (iObserver) + { + iObserver->HandleClientChange(pid, MMPXClientlistObserver::EAdd); + } + } + } +// ---------------------------------------------------------------------------- +// Add a client into the client list +// ---------------------------------------------------------------------------- +// + +EXPORT_C void CMPXClientList::AddClientL( + TThreadId aId, + TInt aMode, + CMPXMessageQueue* aMsgQueue, + const TInt aCategory) + { + TProcessId pid=MPXUser::ProcessIdL(aId); + CClientId* newClient = new(ELeave) CClientId(aId,pid,aMode,aMsgQueue, aCategory); + CleanupStack::PushL(newClient); + // add an empty subscription by default + CMPXSubscription* subscription = CMPXSubscription::NewL(); + CleanupStack::PushL(subscription); + // transfer the ownership + newClient->iSubscriptions.AppendL(subscription); + CleanupStack::Pop(subscription); + iClients.AppendL(newClient); + CleanupStack::Pop(newClient); + if (iClientProcesses.Find(pid)==KErrNotFound) + { + iClientProcesses.AppendL(pid); + if (iObserver) + { + iObserver->HandleClientChange(pid, MMPXClientlistObserver::EAdd); + } + } + } +// SK +// ---------------------------------------------------------------------------- +// Remove a client from the list +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXClientList::RemoveClient(TInt aIndex) + { + // USER panic 130, if aIndex is negative or is greater than the number of + // objects currently in the array. + CClientId* id( iClients[aIndex] ); + iClients.Remove(aIndex); + + CClientId removeId( id->iPid ); + if ( iClients.Find( &removeId, iIdentity ) == KErrNotFound ) + // + // There's no other client from the same process, so + // remove it from the process list + // + { + TInt i=iClientProcesses.Find(id->iPid); + if (KErrNotFound != i) + { + if (iObserver) + { + iObserver->HandleClientChange(id->iPid, MMPXClientlistObserver::ERemove); + } + iClientProcesses.Remove(i); + } + } + delete id; + } + +// ----------------------------------------------------------------------------- +// Return the number of clients +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXClientList::ClientCount() const + { + return iClients.Count(); + } + +// ----------------------------------------------------------------------------- +// Return array of client process ids +// ----------------------------------------------------------------------------- +// +EXPORT_C TArray CMPXClientList::ClientProcessList() const + { + return iClientProcesses.Array(); + } + +// ----------------------------------------------------------------------------- +// Check if the client in the client list or not +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CMPXClientList::IsClient(TThreadId aId) const + { + return (KErrNotFound != Find(aId)); + } + +// ----------------------------------------------------------------------------- +// Find a client denoted by message queue in this list. +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXClientList::Find(const CMPXMessageQueue& aMsgQueue) const + { + CClientId id( const_cast( &aMsgQueue )); + return iClients.Find( &id, iIdentity ); + } + +// ----------------------------------------------------------------------------- +// Found a client by Id +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXClientList::Find(TThreadId aId) const + { + CClientId id( aId ); + return iClients.Find( &id ,iIdentity ); + } + +// ----------------------------------------------------------------------------- +// Return client mode +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXClientList::ClientMode(TInt aIndex) const + { + MPX_ASSERT(aIndex>=0 && aIndexiMode; + } + + +// ----------------------------------------------------------------------------- +// Return client category +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXClientList::ClientCategory(TInt aIndex) const + { + MPX_ASSERT(aIndex>=0 && aIndexiCategory; + return category; + } + + +// ----------------------------------------------------------------------------- +// Send message to all clients in the list +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXClientList::SendMsg(const CMPXMessage* aMsg, TInt aError) + { + MPX_FUNC_EX("CMPXClientList::SendMsg"); + for (TInt i=iClients.Count();--i>=0;) + { + SendMsg( i, aMsg, aError ); + } + } + +// ----------------------------------------------------------------------------- +// Send message to a client +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXClientList::SendMsg( + TInt aIndex, + const CMPXMessage* aMsg, + TInt aError) + { + MPX_FUNC_EX("CMPXClientList::SendMsgL(aIndex)"); + MPX_ASSERT(aIndex>=0 && aIndexiMsgQueue); + + // check the subscriptions + TBool send(EFalse); + TInt err(KErrNone); + if (aMsg) + { + TRAP(err, send = IsMsgSubscribedL(aIndex, aMsg)); + } + else + { + send = ETrue; // broadcast error message aError + } + + // only send if the client has subscribed for it + if (send && KErrNone == err) + { + iClients[aIndex]->iMsgQueue->Add(aMsg, aError); + } + } + +// ----------------------------------------------------------------------------- +// CMPXClientList::AddSubscriptionL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXClientList::AddSubscriptionL( + TInt aIndex, + CMPXSubscription* aSubscription) + { + MPX_FUNC("CMPXClientList::AddSubscriptionL"); + + CClientId* id( iClients[aIndex] ); + TInt subCount( id->iSubscriptions.Count() ); + const CMPXMediaArray* items = id->iSubscriptions[0]->ItemsL(); + // check if it has an empty subscription + if ( 1 == subCount && items->Count() ) + { + // remove it if so + id->RemoveAllSubscriptionsL(); + } + + // add the new subscription + id->AddSubscriptionL(aSubscription); + } + +// ----------------------------------------------------------------------------- +// CMPXClientList::RemoveSubscriptionL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXClientList::RemoveSubscriptionL( + TInt aIndex, + const CMPXSubscription& aSubscription) + { + MPX_FUNC("CMPXClientList::RemoveSubscriptionL"); + + iClients[aIndex]->RemoveSubscriptionL(aSubscription); + } + +// ----------------------------------------------------------------------------- +// CMPXClientList::RemoveAllSubscriptionsL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXClientList::RemoveAllSubscriptionsL( + TInt aIndex) + { + MPX_FUNC("CMPXClientList::RemoveAllSubscriptionsL"); + + iClients[aIndex]->RemoveAllSubscriptionsL(); + } + +// ----------------------------------------------------------------------------- +// CMPXClientList::IsMsgSubscribedL +// ----------------------------------------------------------------------------- +// +TBool CMPXClientList::IsMsgSubscribedL(TInt aIndex, const CMPXMessage* aMsg) + { + // check the subscriptions + TBool IsSubScribed(EFalse); + TInt subCount(iClients[aIndex]->iSubscriptions.Count()); + + if (subCount) + { + const CMPXMediaArray* subscriptionItems = + iClients[aIndex]->iSubscriptions[0]->ItemsL(); + if (1==subCount && (0== subscriptionItems->Count())) + {// one empty subscription - send everything + IsSubScribed = ETrue; + } + else + {// have to check the message against the subscriptions. + MPX_ASSERT(aMsg); + const TArray msgAttrs = aMsg->Attributes(); + TInt msgAttrCount(msgAttrs.Count()); + // iterate subscriptions + for (TInt subIndex = 0; subIndexiSubscriptions[subIndex]->ItemsL(); + TInt itemCount(subscriptionItems->Count()); + for (TInt itemIndex = 0; itemIndex < itemCount; ++itemIndex) + { + // check the message attributes for the current subscription item + TBool subMatch(ETrue); + TInt attrMatchCount(0); + CMPXSubscriptionItem* subItem(subscriptionItems->AtL(itemIndex)); + + for (TInt msgAttrIndex = 0; msgAttrIndex < msgAttrCount; ++msgAttrIndex) + { + TBool attrExists(EFalse); + TBool attrMatch(EFalse); + const TMPXAttribute& msgAttr( msgAttrs[msgAttrIndex] ); + + if ( subItem->IsSupported(msgAttr)) + { + attrExists = ETrue; + + if ( subItem->Match( *aMsg, msgAttr )) + { + attrMatch = ETrue; + attrMatchCount++; + } + } + + if (attrExists && !attrMatch) + { + subMatch = EFalse; + break; + } + } + + // send the message if all attributes that exist in both the message and the subscription + // have the same values and all subscription attributes match + if ( subMatch && ( attrMatchCount == subItem->Count()) ) + { + IsSubScribed = ETrue; + break; + } + } + } + } + } // else subCount = 0, IsSubScribed = EFalse (default) + return IsSubScribed; + } + +// ---------------------------------------------------------------------------- +// Comparison function. If the names are set in the client objects, then +// that's used to test for equality. Otherwise, if the thread ids are set, +// that's used. Else, it's assumed that the equality test is based on process +// ids. +// ---------------------------------------------------------------------------- +// +TBool CMPXClientList::ClientsMatch(const CClientId& aClient1, + const CClientId& aClient2) + { + TBool match=EFalse; + if (aClient1.iMsgQueue && aClient2.iMsgQueue) + { + match=aClient1.iMsgQueue==aClient2.iMsgQueue; + } + else if (aClient1.iTid.Id()!=KNullThreadId && + aClient2.iTid.Id()!=KNullThreadId) + { + match=(aClient1.iTid==aClient2.iTid); + } + else + { + match=(aClient1.iPid==aClient2.iPid); + } + return match; + } + +// ----------------------------------------------------------------------------- +// C++ constructor +// ----------------------------------------------------------------------------- +// +CMPXClientList::CClientId::CClientId( + TThreadId aTid, + TProcessId aPid, + CMPXMessageQueue* aMsgQueue) +: iTid(aTid), + iPid(aPid), + iMode(KErrNotFound), + iMsgQueue(aMsgQueue) + {} + +// ----------------------------------------------------------------------------- +// C++ constructor +// ----------------------------------------------------------------------------- +// +CMPXClientList::CClientId::CClientId( + TThreadId aTid, + TProcessId aPid, + TInt aMode, + CMPXMessageQueue* aMsgQueue) +: iTid(aTid), + iPid(aPid), + iMode(aMode), + iMsgQueue(aMsgQueue) + {} + + +// ----------------------------------------------------------------------------- +// C++ constructor +// ----------------------------------------------------------------------------- +// + CMPXClientList::CClientId::CClientId( + TThreadId aTid, + TProcessId aPid, + TInt aMode, + CMPXMessageQueue* aMsgQueue, + TInt aCategory) + : iTid(aTid), + iPid(aPid), + iMode(aMode), + iMsgQueue(aMsgQueue), + iCategory(aCategory) + {} + +// ----------------------------------------------------------------------------- +// C++ constructor +// ----------------------------------------------------------------------------- +// +CMPXClientList::CClientId::CClientId(CMPXMessageQueue* aMsgQueue) + :iTid(static_cast(KNullThreadId)), + iPid(static_cast(KNullProcessId)), + iMode(KErrUnknown), + iMsgQueue(aMsgQueue) + {} + +// ----------------------------------------------------------------------------- +// C++ constructor +// ----------------------------------------------------------------------------- +// +CMPXClientList::CClientId::CClientId(TThreadId aTid) +: iTid(aTid), + iPid(static_cast(KNullProcessId)), + iMode(KErrUnknown), + iMsgQueue(NULL) + {} + +// ----------------------------------------------------------------------------- +// C++ constructor +// ----------------------------------------------------------------------------- +// +CMPXClientList::CClientId::CClientId(TProcessId aPid) +: iTid(static_cast(KNullThreadId)), + iPid(aPid), + iMode(KErrUnknown), + iMsgQueue(NULL) + {} + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CMPXClientList::CClientId::~CClientId() + { + iSubscriptions.ResetAndDestroy(); + } + +// ----------------------------------------------------------------------------- +// CClientId::operator= +// ----------------------------------------------------------------------------- +// +CMPXClientList::CClientId& CMPXClientList::CClientId::operator=( + const CClientId& aClient) + { + iTid = aClient.iTid; + iPid = aClient.iPid; + iMode = aClient.iMode; + iMsgQueue = aClient.iMsgQueue; + + RemoveAllSubscriptionsL(); + + // copy the subscriptions + TInt count(aClient.iSubscriptions.Count()); + for (TInt index = 0; index < count; ++index) + { + CMPXSubscription* subscription = static_cast( + CMPXMedia::NewL(*(aClient.iSubscriptions[index]))); + CleanupStack::PushL(subscription); + + // transfer the ownership + iSubscriptions.AppendL(subscription); + + CleanupStack::Pop(subscription); + } + return *this; + } + +// ----------------------------------------------------------------------------- +// CClientId::AddSubscriptionL +// ----------------------------------------------------------------------------- +// +void CMPXClientList::CClientId::AddSubscriptionL( + CMPXSubscription* aSubscription) + { + // add the subscription + iSubscriptions.AppendL(aSubscription); + } + +// ----------------------------------------------------------------------------- +// CClientId::RemoveSubscriptionL +// ----------------------------------------------------------------------------- +// +void CMPXClientList::CClientId::RemoveSubscriptionL( + const CMPXSubscription& aSubscription) + { + TInt count(iSubscriptions.Count()); + for (TInt index = 0; index < count; ++index) + { + CMPXSubscription* subscription = iSubscriptions[index]; + if (aSubscription == *subscription) + { + // found the subscription, remove it + iSubscriptions.Remove(index); + delete subscription; + break; + } + } + } + +// ----------------------------------------------------------------------------- +// CClientId::RemoveAllSubscriptionsL +// ----------------------------------------------------------------------------- +// +void CMPXClientList::CClientId::RemoveAllSubscriptionsL() + { + iSubscriptions.ResetAndDestroy(); + } + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxcollectionpath.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxcollectionpath.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,1068 @@ +/* +* Copyright (c) 2006 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: implementation of collection path +* +*/ + +#include +#include +#include +#include +#include +#include +#include "mpxcollectionpath.h" + +/** +* Encapsulates single node in collection hierarchy level. A node represents a +* level of the collection path +*/ +NONSHARABLE_CLASS(CMPXCollectionPathNode) : public CBase + { +public: + static CMPXCollectionPathNode* NewL(); + static CMPXCollectionPathNode* NewLC(); + static CMPXCollectionPathNode* NewLC(const CMPXCollectionPathNode& aNode); + virtual ~CMPXCollectionPathNode(); +public: + /** + * Sets current item at this level + */ + void Set(const TMPXItemId& aId, TInt aIndex); + + /** + * Sets the next level open mode + */ + void Set(TMPXOpenMode aRequest); + + /** + * Sets the next level open attributes + */ + void SetL(const TArray& aAttrs); + + /** + * Current index + */ + TInt Index() const; + + /** + * Current Id + */ + const TMPXItemId& Id() const; + + /** + * Open mode for next level + */ + TMPXOpenMode OpenMode() const; + + /** + * Open attributes for next level + */ + const TArray OpenAttributes() const; + +public: + void ExternalizeL(RWriteStream& aStream) const; + void InternalizeL(RReadStream& aStream); + +private: + CMPXCollectionPathNode(); + void ConstructL(const CMPXCollectionPathNode& aNode); + void ConstructL(); + +private: + TMPXItemId iId; + TInt iIndex; + TMPXOpenMode iOpenMode; + RArray iAttrs; // Open attributes for next level + }; + + +// ----------------------------------------------------------------------------- +// CMPXCollectionPathNode::NewL +// ----------------------------------------------------------------------------- +// +CMPXCollectionPathNode* CMPXCollectionPathNode::NewL() + { + CMPXCollectionPathNode* self = NewLC(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// CMPXCollectionPathNode::NewLC +// ----------------------------------------------------------------------------- +// +CMPXCollectionPathNode* CMPXCollectionPathNode::NewLC() + { + CMPXCollectionPathNode* self = new(ELeave) CMPXCollectionPathNode(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// CMPXCollectionPathNode::NewLC +// ----------------------------------------------------------------------------- +// +CMPXCollectionPathNode* CMPXCollectionPathNode::NewLC( + const CMPXCollectionPathNode& aNode) + { + CMPXCollectionPathNode* self = new(ELeave) CMPXCollectionPathNode(); + CleanupStack::PushL(self); + self->ConstructL(aNode); + return self; + } + +// ----------------------------------------------------------------------------- +// CMPXCollectionPathNode::ConstructL +// ----------------------------------------------------------------------------- +// +void CMPXCollectionPathNode::ConstructL() + { + } + +// ----------------------------------------------------------------------------- +// CMPXCollectionPathNode::ConstructL +// ----------------------------------------------------------------------------- +// +void CMPXCollectionPathNode::ConstructL( + const CMPXCollectionPathNode& aNode) + { + iId=aNode.iId; + iIndex=aNode.iIndex; + iOpenMode=aNode.iOpenMode; + ::CopyArrayL(aNode.iAttrs.Array(), iAttrs); + } + +// ----------------------------------------------------------------------------- +// CMPXCollectionPathNode::CMPXCollectionPathNode +// ----------------------------------------------------------------------------- +// +CMPXCollectionPathNode::CMPXCollectionPathNode() +: iId(KMPXInvalidItemId), + iIndex(KErrNotFound), + iOpenMode(EMPXOpenGroupOrPlaylist) + { + } + +// ----------------------------------------------------------------------------- +// CMPXCollectionPathNode::~CMPXCollectionPathNode +// ----------------------------------------------------------------------------- +// +CMPXCollectionPathNode::~CMPXCollectionPathNode() + { + iAttrs.Close(); + } + +// ----------------------------------------------------------------------------- +// CMPXCollectionPathNode::Set +// ----------------------------------------------------------------------------- +// +void CMPXCollectionPathNode::Set(const TMPXItemId& aId, TInt aIndex) + { + iId=aId; + iIndex=aIndex; + } + +// ----------------------------------------------------------------------------- +// CMPXCollectionPathNode::Set +// ----------------------------------------------------------------------------- +// +void CMPXCollectionPathNode::Set(TMPXOpenMode aMode) + { + iOpenMode=aMode; + } + +// ----------------------------------------------------------------------------- +// CMPXCollectionPathNode::Set +// ----------------------------------------------------------------------------- +// +void CMPXCollectionPathNode::SetL(const TArray& aAttrs) + { + ::CopyArrayL(aAttrs, iAttrs); + } + +// ----------------------------------------------------------------------------- +// CMPXCollectionPathNode::Index +// ----------------------------------------------------------------------------- +// +TInt CMPXCollectionPathNode::Index() const + { + return iIndex; + } + +// ----------------------------------------------------------------------------- +// CMPXCollectionPathNode::Id +// ----------------------------------------------------------------------------- +// +const TMPXItemId& CMPXCollectionPathNode::Id() const + { + return iId; + } + +// ----------------------------------------------------------------------------- +// CMPXCollectionPathNode::OpenMode +// ----------------------------------------------------------------------------- +// +TMPXOpenMode CMPXCollectionPathNode::OpenMode() const + { + return iOpenMode; + } + +// ----------------------------------------------------------------------------- +// CMPXCollectionPathNode::OpenAttributes +// ----------------------------------------------------------------------------- +// +const TArray CMPXCollectionPathNode::OpenAttributes() const + { + return iAttrs.Array(); + } + +// ----------------------------------------------------------------------------- +// Externalize object +// ----------------------------------------------------------------------------- +// +void CMPXCollectionPathNode::ExternalizeL(RWriteStream& aStream) const + { + aStream.WriteUint32L(iId.iId1); + aStream.WriteUint32L(iId.iId2); + aStream.WriteInt32L(iIndex); + aStream.WriteInt32L(iOpenMode); + ::ExternalizeL(iAttrs.Array(), aStream); + } + +// ----------------------------------------------------------------------------- +// Internalize object +// ----------------------------------------------------------------------------- +// +void CMPXCollectionPathNode::InternalizeL(RReadStream& aStream) + { + TUint32 id1 = aStream.ReadUint32L(); + TUint32 id2 = aStream.ReadUint32L(); + iId=TMPXItemId( id1, id2 ); + iIndex=aStream.ReadInt32L(); + iOpenMode=static_cast(aStream.ReadInt32L()); + iAttrs.Reset(); + ::InternalizeL(iAttrs, aStream); + } + +// ============================== MEMBER FUNCTIONS ============================= + +// ----------------------------------------------------------------------------- +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCollectionPath* CMPXCollectionPath::NewL() + { + CMPXCollectionPath* p = new(ELeave) CMPXCollectionPath(); + CleanupStack::PushL(p); + p->ConstructL(); + CleanupStack::Pop(p); + return p; + } + +// ----------------------------------------------------------------------------- +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCollectionPath* CMPXCollectionPath::NewL( + const CMPXCollectionPath& aPath) + { + CMPXCollectionPath* p = new(ELeave) CMPXCollectionPath(); + CleanupStack::PushL(p); + p->ConstructL(aPath); + CleanupStack::Pop(p); + return p; + } + +// ----------------------------------------------------------------------------- +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCollectionPath* CMPXCollectionPath::NewL( + RReadStream& aStream) + { + CMPXCollectionPath* p = new(ELeave) CMPXCollectionPath(); + CleanupStack::PushL(p); + p->ConstructL(aStream); + CleanupStack::Pop(p); + return p; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCollectionPath::~CMPXCollectionPath() + { + iNodeArray.ResetAndDestroy(); + iNodeArray.Close(); + iIds.Close(); + iSelection.Close(); + } + +// ----------------------------------------------------------------------------- +// Default constructor +// ----------------------------------------------------------------------------- +// +CMPXCollectionPath::CMPXCollectionPath() : iInvalidId(KMPXInvalidItemId) + { + } + +// ---------------------------------------------------------------------------- +// 2nd phase constructor. +// ---------------------------------------------------------------------------- +// +void CMPXCollectionPath::ConstructL(const CMPXCollectionPath& aPath) + { + iNodeArray.ResetAndDestroy(); + TInt count = aPath.iNodeArray.Count(); + for (TInt i=0; i0) + { + Set(--index); + ret=ETrue; + } // else the first one, no more to go and return false + return ret; + } + +// ----------------------------------------------------------------------------- +// Sets path to first item +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPath::SetToFirst() + { + Set(0); + } + +// ----------------------------------------------------------------------------- +// Sets path to last item +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPath::SetToLast() + { + Set(Count()-1); + } + +// ----------------------------------------------------------------------------- +// Change current item by index at top level +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPath::Set(TInt aIndex) + { + MPX_ASSERT(Levels()); + CMPXCollectionPathNode& topLevel = TopLevel(); + // RArray will panic if aIndex out of bound + topLevel.Set(iIds[aIndex], aIndex); + } + +// ----------------------------------------------------------------------------- +// Change current item by id at top level +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPath::Set(const TMPXItemId& aId) + { + TInt index=IndexOfId(aId); + MPX_ASSERT(KErrNotFound!=index && Levels()); + CMPXCollectionPathNode& topLevel = TopLevel(); + topLevel.Set(aId, index); + } + +// ----------------------------------------------------------------------------- +// Set open mode for next level +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPath::Set(TMPXOpenMode aMode) + { + MPX_ASSERT(Levels()); + TopLevel().Set(aMode); + } + +// ----------------------------------------------------------------------------- +// Set open attrobutes for next level +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPath::Set(const TArray& aAttrs) + { // DEPRECATED + TRAP_IGNORE(SetL(aAttrs)); + } + +// ----------------------------------------------------------------------------- +// Set open attrobutes for next level +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPath::SetL(const TArray& aAttrs) + { + MPX_ASSERT(Levels()); + TopLevel().SetL(aAttrs); + } + +// ----------------------------------------------------------------------------- +// Select an item by id in the path +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPath::SelectL(const TMPXItemId& aId) + { + TInt index=IndexOfId(aId); + MPX_ASSERT(KErrNotFound != index); + SelectL(index); + } + +// ----------------------------------------------------------------------------- +// Select an item by index in the path +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPath::SelectL(TInt aIndex) + { + MPX_ASSERT_EX(aIndex>=0 && aIndex=0 && aIndex CMPXCollectionPath::Selection() const + { + return iSelection.Array(); + } + +// ----------------------------------------------------------------------------- +// Current selected IDs +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPath::SelectionL(RArray& aIds) const + { + aIds.Reset(); + TInt idCount(iIds.Count()); + TInt selCount(iSelection.Count()); + for (TInt i=0; i= 0 && aIndex < iIds.Count() ); + iIds[aIndex] = aNewId; + } + +// ----------------------------------------------------------------------------- +// Index of current item at top level +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXCollectionPath::Index() const + { + TInt ret(KErrNotFound); + if (Levels()) + { + ret = TopLevel().Index(); + } + return ret; + } + +// ----------------------------------------------------------------------------- +// Return current item id at top level +// ----------------------------------------------------------------------------- +// +EXPORT_C const TMPXItemId& CMPXCollectionPath::Id() const + { + if (Levels()) + { + return TopLevel().Id(); + } + else + { + return iInvalidId; + } + } + +// ----------------------------------------------------------------------------- +// Returns the number of items at top level +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXCollectionPath::Count() const + { + return iIds.Count(); + } + +// ----------------------------------------------------------------------------- +// Returns the open mode for the next level +// ----------------------------------------------------------------------------- +// +EXPORT_C TMPXOpenMode CMPXCollectionPath::OpenNextMode() const + { + return Levels() ? TopLevel().OpenMode():EMPXOpenGroupOrPlaylist; + } + +// ----------------------------------------------------------------------------- +// Returns the open mode for the previous level +// ----------------------------------------------------------------------------- +// +EXPORT_C TMPXOpenMode CMPXCollectionPath::OpenPreviousMode() const + { + TInt n=Levels(); + return n>1?iNodeArray[n-2]->OpenMode():EMPXOpenGroupOrPlaylist; + } + +// ----------------------------------------------------------------------------- +// Index from id +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXCollectionPath::IndexOfId(const TMPXItemId& aId) const + { + TInt ret(KErrNotFound); + for (TInt i=iIds.Count(); --i>=0; ) + { + if (aId == iIds[i]) + { + ret = i; + break; + } + } + return ret; + } + +// ----------------------------------------------------------------------------- +// Return item id at top specific level for a specific item +// ----------------------------------------------------------------------------- +// +EXPORT_C const TMPXItemId& CMPXCollectionPath::IdOfIndex( TInt aIndex ) const + { + if( aIndex >=0 && aIndex < iIds.Count() ) + { + return iIds[aIndex]; + } + else + { + return iInvalidId; + } + } + +// ----------------------------------------------------------------------------- +// Return item index at a specific level +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXCollectionPath::Index(TInt aLevel) const + { + MPX_ASSERT(aLevel>=0 && aLevel < Levels()); + return iNodeArray[aLevel]->Index(); + } + +// ----------------------------------------------------------------------------- +// Return item id at a specific level +// ----------------------------------------------------------------------------- +// +EXPORT_C const TMPXItemId& CMPXCollectionPath::Id(TInt aLevel) const + { + if( aLevel < iNodeArray.Count() && aLevel >= 0 ) + { + return iNodeArray[aLevel]->Id(); + } + else + { + return iInvalidId; + } + } + +// ----------------------------------------------------------------------------- +// Returns the depth into the collection +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXCollectionPath::Levels() const + { + return iNodeArray.Count(); + } + +// ----------------------------------------------------------------------------- +// Remove a level from path +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPath::Back() + { + TInt levels = Levels(); + MPX_ASSERT(levels > 0); + CMPXCollectionPathNode* node = iNodeArray[levels-1]; + iNodeArray.Remove(levels-1); + delete node; + iIds.Reset(); + iSelection.Reset(); + } + +// ----------------------------------------------------------------------------- +// Append a new level +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPath::AppendL(const TArray& aIds) + { + iIds.Reset(); + iSelection.Reset(); + CMPXCollectionPathNode* node(NULL); + if (aIds.Count()) + { + ::CopyArrayL(aIds, iIds); + node = CMPXCollectionPathNode::NewLC(); + node->Set(iIds[0], 0); + iNodeArray.AppendL(node); + CleanupStack::Pop(node); + } + else + {// add a level in order to support back + node = CMPXCollectionPathNode::NewLC(); + node->Set(iInvalidId, KErrNotFound); + iNodeArray.AppendL(node); + CleanupStack::Pop(node); + } + } + +// ----------------------------------------------------------------------------- +// Append a new level +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPath::AppendL(const TMPXItemId& aId) + { + RArray ids; + CleanupClosePushL(ids); + ids.AppendL(aId); + AppendL(ids.Array()); + CleanupStack::PopAndDestroy(&ids); + } + +// ----------------------------------------------------------------------------- +// Append an id +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPath::InsertL(const TMPXItemId& aId, TInt aPos) + { + MPX_ASSERT(iIds.Count()); + iIds.InsertL(aId, aPos); + // update the selection + for (TInt i=0; i=aPos) + { + ++sel; + } + } + } + +// ----------------------------------------------------------------------------- +// Resets the collection path object +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPath::Reset() + { + iNodeArray.ResetAndDestroy(); + iIds.Reset(); + iSelection.Reset(); + } + +// ----------------------------------------------------------------------------- +// Creates a collection path pointing to the container +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXCollectionPath* CMPXCollectionPath::ContainerPathL() const + { + CMPXCollectionPath* p = CMPXCollectionPath::NewL(); + CleanupStack::PushL( p ); + + TInt count = iNodeArray.Count() - 1; // Copy up to container level + for (TInt i=0; iiNodeArray.AppendL(node); + CleanupStack::Pop(node); + } + + CleanupStack::Pop( p ); + return p; + } + +// ----------------------------------------------------------------------------- +// Update collection path. When a item changed in the collection plugin, +// collection plugin calls back collection context, which in turn updates +// its collection paths by calling this function +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXCollectionPath::HandleChange( + const TUid& aCollectionId, + const TMPXItemId& aId, + const TMPXItemId& aDeprecatedId, + CMPXCollectionPath::TMPXCollectionPathChange aChange, + TInt& aSelection ) + { + TBool updated(EPathUnchanged); + aSelection = KErrNotFound; + + if (aChange == CMPXCollectionPath::EAdded) + { + updated = EPathModified; + } + else if (aChange == CMPXCollectionPath::EGroupModified ) + { + TInt levels( Levels() ); + if( levels > 0 ) + { + // Check if the collection id is correct + if (iNodeArray[ECollectionUid]->Id() == + TMPXItemId(aCollectionId.iUid) && levels > 1) + { + // Check if the container level is the one modified + if( aId == Id( levels-2 ) ) + { + updated = EPathModified; + } + } + } + } + else if (aChange == CMPXCollectionPath::EDeleted || + aChange == CMPXCollectionPath::EModified) + { + TInt levels = Levels(); + if (levels > 0) + { + // check collection id level, aka root level + if (iNodeArray[ECollectionUid]->Id() == + TMPXItemId(aCollectionId.iUid) && levels > 1) + { + // check node array except top level and root level. + for (TInt i=ECollectionRoot+1; iId() == aId || + (aDeprecatedId != 0 && iNodeArray[i]->Id() == aDeprecatedId)) + { + if( aChange == CMPXCollectionPath::EModified && + aDeprecatedId != 0 ) + { + // If the item is modified and the item id is updated + // we simply replace the node level item id with the new + // item id + // + // Continue and check other levels if any other + // levels are using this ID. ie: all songs of an artist + // The item IDs need to be unique across all levels, but + // can have duplicates. This is in the case of a playlist with + // more than 1 instance of a song + // + CMPXCollectionPathNode* node = iNodeArray[i]; + node->Set( aId, Index(i) ); + updated = EPathModified; + } + else + { + // Trim the path and break out of the loop + aSelection = Index(i); + for (TInt j=Levels()-1; j>i; --j) + { + CMPXCollectionPathNode* node = iNodeArray[j]; + iNodeArray.Remove(j); + delete node; + } + updated = EPathClipped; + break; + } + } + } + // Check the top level + if (!updated) + { + TMPXItemId search = aDeprecatedId != 0? aDeprecatedId : aId; + TInt temp(KErrNotFound); + + // Unmatched ids in the item ID, + // try to look for an exact match first + // + if( search.iId1 != search.iId2 ) + { + for (TInt i=iIds.Count(); --i>=0; ) + { + if (search == iIds[i] ) + { + temp = i; + break; + } + } + } + // Still not found, check for approximate equal + // + if( KErrNotFound == temp ) + { + for (TInt i=iIds.Count(); --i>=0; ) + { + if (search.ApproxEqual(iIds[i])) + { + temp = i; + break; + } + } + } + if (KErrNotFound != temp) + { // Improvement: only remove item deleted + updated = EPathModified; + aSelection = temp; + } + } + + // Only clean up level if the path has been clipped + if (updated == EPathClipped ) + { + // Reset top level + iIds.Reset(); + iSelection.Reset(); + } + } + } + } + return updated; + } + +// ----------------------------------------------------------------------------- +// CMPXCollectionPath::OpenAttributes +// ----------------------------------------------------------------------------- +// +EXPORT_C const TArray CMPXCollectionPath::OpenAttributes() const + { + MPX_ASSERT(Levels()>0); + return TopLevel().OpenAttributes(); + } + +// ----------------------------------------------------------------------------- +// Get top level items +// ----------------------------------------------------------------------------- +// +EXPORT_C const TArray CMPXCollectionPath::Items() const + { + MPX_ASSERT(Levels()>0); + return iIds.Array(); + } + +// ----------------------------------------------------------------------------- +// Internalize object +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPath::InternalizeL(RReadStream& aStream) + { + (void)aStream.ReadInt32L(); // Discard object type + iNodeArray.ResetAndDestroy(); + ::InternalizeCObjectArrayL(iNodeArray, aStream); + iIds.Reset(); + MPXUser::InternalizeL(iIds, aStream); + iSelection.Reset(); + ::InternalizeL(iSelection, aStream); + } + +// ----------------------------------------------------------------------------- +// Externalize object +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionPath::ExternalizeL(RWriteStream& aStream) const + { + aStream.WriteInt32L(MMPXData::EPath); + ::ExternalizeL(iNodeArray.Array(), aStream); + MPXUser::ExternalizeL(iIds.Array(), aStream); + ::ExternalizeL(iSelection.Array(), aStream); + } + +// ----------------------------------------------------------------------------- +// Top level +// ----------------------------------------------------------------------------- +// +CMPXCollectionPathNode& CMPXCollectionPath::TopLevel() + { + MPX_ASSERT(Levels() > 0); + return *iNodeArray[Levels()-1]; + } + +// ----------------------------------------------------------------------------- +// Top level +// ----------------------------------------------------------------------------- +// +const CMPXCollectionPathNode& CMPXCollectionPath::TopLevel() const + { + MPX_ASSERT(Levels() > 0); + return *iNodeArray[Levels()-1]; + } diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxcollectiontype.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxcollectiontype.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2006 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: Class representing the supported collection types +* +*/ + + +#include +#include +#include "mpxcollectiontype.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXCollectionType::CMPXCollectionType( + const TUid& aUid, + CDesCArray* aMimeTypes, + CDesCArray* aExtensions) +: iUid(aUid), iMimeTypes(aMimeTypes),iExtensions(aExtensions) + { + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXCollectionType::CMPXCollectionType() + { + } + +// --------------------------------------------------------------------------- +// destructor +// --------------------------------------------------------------------------- +// +CMPXCollectionType::~CMPXCollectionType() + { + delete iMimeTypes; + delete iExtensions; + } + +// --------------------------------------------------------------------------- +// Externalize the object +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionType::ExternalizeL(RWriteStream& aStream) const + { + aStream.WriteInt32L( iUid.iUid ); + MPXUser::ExternalizeL(iMimeTypes, aStream); + MPXUser::ExternalizeL(iExtensions, aStream); + } + +// --------------------------------------------------------------------------- +// Internalize the object +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXCollectionType::InternalizeL(RReadStream& aStream) + { + // UID + iUid.iUid = aStream.ReadInt32L(); + MPXUser::InternalizeL(iMimeTypes, aStream); + MPXUser::InternalizeL(iExtensions, aStream); + } diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxdata.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,475 @@ +/* +* Copyright (c) 2006 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: Implementation of data +* +*/ + +#include +#include "mpxheapmanager.h" +#include "mpxmedia.h" +#include "mpxmediaarray.h" +#include "mpxfixedarray.h" +#include "mpxmediadataarray.h" +#include "mpxdata.h" + +/** +* Class RMPXData. Implementation of MMPXData interface +*/ +NONSHARABLE_CLASS( RMPXData ) : public MMPXData + { +public: + /** + * C++ default constructor. + */ + RMPXData(); +public: + /** + * Copies contents of aData to this object, deleting any + * existing data + */ + TInt Copy(TUint aClientHandle,const RMPXData& aData); + +private: // From MMPXData + TUint DataHandle(TUint aClientHandle); + void AddRef(TUint aClientHandle); + void Release(TUint aClientHandle); + void AddClientRef(TUint aClientHandle); + TPtrC8 Value(TUint aClientHandle,TInt aIndex); + const TMPXAttribute& Attribute(TUint aClientHandle,TInt aIndex); + TMPXAttributeType AttributeType(TUint aClientHandle,TInt aIndex); + TArray SupportedIds(TUint aClientHandle); + TInt SetSupportedIds(TUint aClientHandle,const TArray& aSupportedIds); + void Delete(TUint aClientHandle,TInt aIndex); + void Set(TUint aClientHandle,const TMPXAttribute& aAttr, + TMPXAttributeType aType,const TDesC8& aData,TInt aIndex); + TInt Insert(TUint aClientHandle,const TMPXAttribute& aAttr, + TMPXAttributeType aType,const TDesC8& aData,TInt aIndex); + TInt Append(TUint aClientHandle,const TMPXAttribute& aAttr, + TMPXAttributeType aType,const TDesC8& aData); + void Reset(TUint aClientHandle); + TInt Count(TUint aClientHandle); + TInt Index(TUint aClientHandle,const TMPXAttribute& aAttr); + TInt Index(TUint aClientHandle,TInt aUid); + TInt Uid(TUint aClientHandle,TInt aIndex); + +private: + /** + * Number of clients (for example CMPXMedia) sharing this object + */ + TInt iRef; + /** + * Array of data items + */ + RMPXMediaDataItemArray iDataArray; + /** + * The IDs supported by the source of the data + */ + RMPXFixedArray iSupportedIds; + }; + + +// ----------------------------------------------------------------------------- +// MMPXData::NewL +// ----------------------------------------------------------------------------- +// +MMPXData* MMPXData::NewL(TUint aClientHandle) + { + RMPXHeapManager& m=RMPXHeapManager::HeapManager(aClientHandle); + m.Lock(aClientHandle); + MMPXData* d=m.Alloc(aClientHandle); + m.Unlock(aClientHandle); + User::LeaveIfNull(d); + return d; + } + +// ----------------------------------------------------------------------------- +// MMPXData::NewL +// ----------------------------------------------------------------------------- +// +MMPXData* MMPXData::NewL(TUint aClientHandle,const MMPXData& aData) + { + RMPXHeapManager& m=RMPXHeapManager::HeapManager(aClientHandle); + m.Lock(aClientHandle); + RMPXData* d1=m.Alloc(aClientHandle); // Create empty one + TInt r=KErrNone; + if (d1) + { // Now copy data from old one + const RMPXData& d2=static_cast(aData); + r=d1->Copy(aClientHandle,d2); + } + m.Unlock(aClientHandle); + User::LeaveIfNull(d1); + User::LeaveIfError(r); + return d1; + } + +// ----------------------------------------------------------------------------- +// MMPXData::Data +// ----------------------------------------------------------------------------- +// +MMPXData* MMPXData::Data(TUint aClientHandle,TAny* aData,TInt aSize) + { + MMPXData* d=NULL; + // + // Check its the right size, and it's on a word boundary first: + // if either is not true, then its not an MMPXData implementation + // for sure + // + TBool aligned=((TUint)aData&3)==0; + const TInt KDataSize=sizeof(TInt)+sizeof(TUint); + + if (aSize==KDataSize&&aligned) + { + TUint* ptr=(TUint*)aData; + MMPXData::TMPXObjectType t=*(MMPXData::TMPXObjectType*)ptr; + switch(t) + { + case MMPXData::EMedia: + case MMPXData::EMediaArray: + d=MMPXData::Data(aClientHandle,*++ptr); + MPX_ASSERT(d); + MPX_ASSERT_WORD_ALIGNED(d); + break; + // + default: + break; + } + } + return d; + } + +// ----------------------------------------------------------------------------- +// MMPXData::Data +// ----------------------------------------------------------------------------- +// +MMPXData* MMPXData::Data(TUint aClientHandle,const TDesC8& aData) + { + return Data(aClientHandle,(TAny*)aData.Ptr(),aData.Size()); + } + +// ----------------------------------------------------------------------------- +// MMPXData::Data +// ----------------------------------------------------------------------------- +// +MMPXData* MMPXData::Data(TUint aClientHandle,TUint aDataHandle) + { + return RMPXHeapManager::Ptr(aClientHandle,aDataHandle); + } + +// ----------------------------------------------------------------------------- +// MMPXData::ClientHandle +// ----------------------------------------------------------------------------- +// +TUint MMPXData::ClientHandle() + { + // Already protected by the mutex + return RMPXHeapManager::ClientHandle(); + } + +// ----------------------------------------------------------------------------- +// MMPXData::AddClientRef +// ----------------------------------------------------------------------------- +// +void MMPXData::AddClientRef(TUint aClientHandle) + { + RMPXHeapManager::HeapManager(aClientHandle).AddRef(aClientHandle); + } + + +// ----------------------------------------------------------------------------- +// MMPXData::ReleaseClient +// ----------------------------------------------------------------------------- +// +void MMPXData::ReleaseClient(TUint aClientHandle) + { + RMPXHeapManager::HeapManager(aClientHandle).Release(aClientHandle); + } + +// ----------------------------------------------------------------------------- +// MMPXData::HeapMemoryInfoL +// ----------------------------------------------------------------------------- +// +void MMPXData::HeapMemoryInfoL( TInt& aTotal, TInt& aUsed ) + { + return RMPXHeapManager::HeapMemoryInfoL( aTotal, aUsed ); + } + +// ----------------------------------------------------------------------------- +// RMPXData::LockHeap +// ----------------------------------------------------------------------------- +// +void MMPXData::LockHeap(TUint aClientHandle) + { + RMPXHeapManager& m=RMPXHeapManager::HeapManager(aClientHandle); + m.Lock(aClientHandle); + } + +// ----------------------------------------------------------------------------- +// RMPXData::UnlockHeap +// ----------------------------------------------------------------------------- +// +void MMPXData::UnlockHeap(TUint aClientHandle) + { + RMPXHeapManager& m=RMPXHeapManager::HeapManager(aClientHandle); + m.Unlock(aClientHandle); + } + +// ----------------------------------------------------------------------------- +// RMPXData::RMPXData +// ----------------------------------------------------------------------------- +// +RMPXData::RMPXData() + :iRef(0) + { + } + +// ----------------------------------------------------------------------------- +// RMPXData::DataHandle +// ----------------------------------------------------------------------------- +// +TUint RMPXData::DataHandle(TUint aClientHandle) + { + return RMPXHeapManager::Offset(aClientHandle,this); + } + +// ----------------------------------------------------------------------------- +// RMPXData::AddRef +// ----------------------------------------------------------------------------- +// +void RMPXData::AddRef(TUint aClientHandle) + { +#ifdef __ENABLE_MPX_GARBAGE_COLLECTOR + TUint dataHandle=DataHandle(aClientHandle); //GC + (void)RMPXHeapManager::HeapManager(aClientHandle).AddData(aClientHandle,dataHandle);//GC +#else + (void) aClientHandle; +#endif // __ENABLE_MPX_GARBAGE_COLLECTOR + ++iRef; + } + +// ----------------------------------------------------------------------------- +// RMPXData::Release +// ----------------------------------------------------------------------------- +// +void RMPXData::Release(TUint aClientHandle) + { + --iRef; + RMPXHeapManager& m=RMPXHeapManager::HeapManager(aClientHandle); +#ifdef __ENABLE_MPX_GARBAGE_COLLECTOR + TUint dataHandle=DataHandle(aClientHandle); //GC + // if the reference of the data is zero, remove all reference from all + // clients. + (void)m.RemoveData(aClientHandle,dataHandle,iRef==0); //GC +#endif // __ENABLE_MPX_GARBAGE_COLLECTOR + if(iRef==0) + { + m.Lock(aClientHandle); + iDataArray.Close(aClientHandle); + iSupportedIds.Close(aClientHandle); + m.Free(aClientHandle,this); + m.Unlock(aClientHandle); + } + } + +// ----------------------------------------------------------------------------- +// RMPXData::Value +// ----------------------------------------------------------------------------- +// +TPtrC8 RMPXData::Value(TUint aClientHandle,TInt aIndex) + { + return iDataArray.Data(aClientHandle,aIndex); + } + +// ----------------------------------------------------------------------------- +// RMPXData::Attribute +// ----------------------------------------------------------------------------- +// +const TMPXAttribute& RMPXData::Attribute(TUint aClientHandle,TInt aIndex) + { + return iDataArray.MediaDataItem(aClientHandle,aIndex)->Attribute(); + } + +// ----------------------------------------------------------------------------- +// RMPXData::AttributeType +// ----------------------------------------------------------------------------- +// +TMPXAttributeType RMPXData::AttributeType(TUint aClientHandle,TInt aIndex) + { + return iDataArray.MediaDataItem(aClientHandle,aIndex)->Type(); + } + +// ----------------------------------------------------------------------------- +// RMPXData::SupportedIds +// ----------------------------------------------------------------------------- +// +TArray RMPXData::SupportedIds(TUint aClientHandle) + { + return iSupportedIds.Array(aClientHandle); + } + +// ----------------------------------------------------------------------------- +// RMPXData::SetSupportedIds +// ----------------------------------------------------------------------------- +// +TInt RMPXData::SetSupportedIds(TUint aClientHandle,const TArray& aSupportedIds) + { + RMPXHeapManager& m=RMPXHeapManager::HeapManager(aClientHandle); + m.Lock(aClientHandle); + TInt r=iSupportedIds.Copy(aClientHandle,aSupportedIds); + m.Unlock(aClientHandle); + return r; + } + +// ----------------------------------------------------------------------------- +// RMPXData::Delete +// ----------------------------------------------------------------------------- +// +void RMPXData::Delete(TUint aClientHandle,TInt aIndex) + { + RMPXHeapManager& m=RMPXHeapManager::HeapManager(aClientHandle); + m.Lock(aClientHandle); + iDataArray.Remove(aClientHandle,aIndex); + m.Unlock(aClientHandle); + } + +// ----------------------------------------------------------------------------- +// RMPXData::Set +// ----------------------------------------------------------------------------- +// +void RMPXData::Set( + TUint aClientHandle, + const TMPXAttribute& aAttr, + TMPXAttributeType aType, + const TDesC8& aData, + TInt aIndex) + { + RMPXHeapManager& m=RMPXHeapManager::HeapManager(aClientHandle); + m.Lock(aClientHandle); + iDataArray.Set(aClientHandle,aAttr,aType,aData,aIndex); + m.Unlock(aClientHandle); + } + +// ----------------------------------------------------------------------------- +// RMPXData::Insert +// ----------------------------------------------------------------------------- +// +TInt RMPXData::Insert( + TUint aClientHandle, + const TMPXAttribute& aAttr, + TMPXAttributeType aType, + const TDesC8& aData, + TInt aIndex) + { + RMPXHeapManager& m=RMPXHeapManager::HeapManager(aClientHandle); + m.Lock(aClientHandle); + TInt r=iDataArray.Insert(aClientHandle,aAttr,aType,aData,aIndex); + m.Unlock(aClientHandle); + return r; + } + +// ----------------------------------------------------------------------------- +// RMPXData::Append +// ----------------------------------------------------------------------------- +// +TInt RMPXData::Append( + TUint aClientHandle, + const TMPXAttribute& aAttr, + TMPXAttributeType aType, + const TDesC8& aData) + { + RMPXHeapManager& m=RMPXHeapManager::HeapManager(aClientHandle); + m.Lock(aClientHandle); + TInt r=iDataArray.Append(aClientHandle,aAttr,aType,aData); + m.Unlock(aClientHandle); + return r; + } + +// ----------------------------------------------------------------------------- +// RMPXData::Reset +// ----------------------------------------------------------------------------- +// +void RMPXData::Reset(TUint aClientHandle) + { + RMPXHeapManager& m=RMPXHeapManager::HeapManager(aClientHandle); + m.Lock(aClientHandle); + iDataArray.Reset(aClientHandle); + m.Unlock(aClientHandle); + } + +// ----------------------------------------------------------------------------- +// RMPXData::Count +// ----------------------------------------------------------------------------- +// +TInt RMPXData::Count(TUint /*aClientHandle*/) + { + return iDataArray.Count(); + } + +// ----------------------------------------------------------------------------- +// RMPXData::Index +// ----------------------------------------------------------------------------- +// +TInt RMPXData::Index(TUint aClientHandle,const TMPXAttribute& aAttr) + { + return iDataArray.Index(aClientHandle,aAttr); + } + +// ----------------------------------------------------------------------------- +// RMPXData::Index +// ----------------------------------------------------------------------------- +// +TInt RMPXData::Index(TUint aClientHandle,TInt aUid) + { + TInt ret(KErrNotFound); + for (TInt i=iDataArray.Count();--i>=0;) + { + RMPXMediaDataItem* item=iDataArray.MediaDataItem(aClientHandle,i); + if (item->Uid()==aUid) + { + ret = i; + break; + } + } + return ret; + } + +// ----------------------------------------------------------------------------- +// RMPXData::Uid +// ----------------------------------------------------------------------------- +// +TInt RMPXData::Uid(TUint aClientHandle,TInt aIndex) + { + RMPXMediaDataItem* item=iDataArray.MediaDataItem(aClientHandle,aIndex); + return item->Uid(); + } + +// ----------------------------------------------------------------------------- +// RMPXData::Copy +// ----------------------------------------------------------------------------- +// +TInt RMPXData::Copy(TUint aClientHandle,const RMPXData& aData) + { + // Now copy data from old one. The data members are iDataArray + // and iSupportedIds that need duplicating, and any values that they + // now hold are deleted; iRef remains the same + // + TInt r(KErrNone); + if (aData.iSupportedIds.Count()) + { + r=iSupportedIds.RMPXFixedArrayBase::Copy(aClientHandle,aData.iSupportedIds); + } + return r==KErrNone?iDataArray.Copy(aClientHandle,aData.iDataArray):r; + } + +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxdataarray.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxdataarray.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,408 @@ +/* +* Copyright (c) 2006 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: Implementation of array of variable size elements on global chunk +* +*/ + +#include +#include "mpxdataarray.h" +#include "mpxheapmanager.h" +#include "mpxdata.h" + + +#define ITEM(x,y) RMPXHeapManager::Ptr(x,y) +#define OFFSET(x,y) RMPXHeapManager::Offset(x,y) + +// ----------------------------------------------------------------------------- +// RMPXDataItem::Reset +// ----------------------------------------------------------------------------- +// +void RMPXDataItem::Reset(TUint aClientHandle) + { + MPX_ASSERT(aClientHandle); + if (iBufLen) + { + // If the buffer contains a media/media array, then we need + // to release its reference (could end up being recursive) + // + TAny* data=Buf(aClientHandle); + MMPXData* d=MMPXData::Data(aClientHandle,data,iBufLen); + if(d) + { + d->Release(aClientHandle); + } + // Now free the actual buffer + RMPXHeapManager& m=RMPXHeapManager::HeapManager(aClientHandle); + iUid=0; + iBufLen=0; + } + } + +// ----------------------------------------------------------------------------- +// RMPXDataItem::Copy +// ----------------------------------------------------------------------------- +// +void RMPXDataItem::Copy(TUint aClientHandle,TAny* aSrc,TInt aSize) + { + MPX_ASSERT(aSrc&&aClientHandle); + // + Reset(aClientHandle); + RMPXHeapManager& m=RMPXHeapManager::HeapManager(aClientHandle); + //Set uid for this item + iUid=m.IncrementCounter(); + if (aSize) // Could be zero sized, e.g. zero-length descriptor + { + (void)Mem::Copy((TAny*)((TUint8*)this+iBufOffset),aSrc,aSize); + iBufLen=aSize; + // + // Need to increment ref count if adding a 'sleeping' media/media array object + // + TAny* data=Buf(aClientHandle); + MMPXData* d=MMPXData::Data(aClientHandle,data,iBufLen); + if(d) + { + d->AddRef(aClientHandle); + } + } + } + +// ----------------------------------------------------------------------------- +// RMPXDataItem::Data +// ----------------------------------------------------------------------------- +// +TAny* RMPXDataItem::Buf(TUint aClientHandle) + { + ASSERT(aClientHandle); + return iBufLen?(TAny*)((TUint8*)this+iBufOffset):NULL; + } + +// ----------------------------------------------------------------------------- +// RMPXDataItem::Insert +// ----------------------------------------------------------------------------- +// +void RMPXDataItem::Insert( + TUint aClientHandle, + RMPXDataItem* aPrevious, + RMPXDataItem* aNext) + { + MPX_ASSERT(aClientHandle); + // + iPreviousOffset=aPrevious?OFFSET(aClientHandle,aPrevious):0; + iNextOffset=aNext?OFFSET(aClientHandle,aNext):0; + TInt thisOffset=OFFSET(aClientHandle,this); + if (aPrevious) + { + aPrevious->iNextOffset=thisOffset; + } + if (aNext) + { + aNext->iPreviousOffset=thisOffset; + } + } + +// ----------------------------------------------------------------------------- +// RMPXDataItem::Insert +// ----------------------------------------------------------------------------- +// +void RMPXDataItem::Insert( + TUint aClientHandle, + TInt aPreviousOffset, + TInt aNextOffset) + { + MPX_ASSERT(aClientHandle); + iPreviousOffset=aPreviousOffset; + iNextOffset=aNextOffset; + TInt thisOffset=OFFSET(aClientHandle,this); + if (aPreviousOffset) + { + RMPXDataItem* previous=ITEM(aClientHandle,aPreviousOffset); + previous->iNextOffset=thisOffset; + } + if (aNextOffset) + { + RMPXDataItem* next=ITEM(aClientHandle,aNextOffset); + next->iPreviousOffset=thisOffset; + } + } + +// ----------------------------------------------------------------------------- +// RMPXDataItem::Set +// ----------------------------------------------------------------------------- +// +void RMPXDataItem::Set(TUint aClientHandle,RMPXDataItem* aOldItem) + { + MPX_ASSERT(aOldItem&&aClientHandle); + // + iPreviousOffset=aOldItem->iPreviousOffset; + iNextOffset=aOldItem->iNextOffset; + TInt thisOffset=OFFSET(aClientHandle,this); + if (iPreviousOffset) + { + RMPXDataItem* previous=ITEM(aClientHandle,iPreviousOffset); + previous->iNextOffset=thisOffset; + } + if (iNextOffset) + { + RMPXDataItem* next=ITEM(aClientHandle,iNextOffset); + next->iPreviousOffset=thisOffset; + } + + } + +// ----------------------------------------------------------------------------- +// RMPXDataItem::Set +// ----------------------------------------------------------------------------- +// +void RMPXDataItem::Set(TUint aClientHandle,TInt aOldItemOffset) + { + RMPXDataItem* oldItem=ITEM(aClientHandle,aOldItemOffset); + Set(aClientHandle,oldItem); + } + +// ----------------------------------------------------------------------------- +// RMPXDataItem::Remove +// ----------------------------------------------------------------------------- +// +void RMPXDataItem::Remove(TUint aClientHandle) + { + MPX_ASSERT(aClientHandle); + if (iPreviousOffset) + { + RMPXDataItem* previous=ITEM(aClientHandle,iPreviousOffset); + previous->iNextOffset=iNextOffset; + } + if (iNextOffset) + { + RMPXDataItem* next=ITEM(aClientHandle,iNextOffset); + next->iPreviousOffset=iPreviousOffset; + } + iPreviousOffset=0; + iNextOffset=0; + } + + +// ----------------------------------------------------------------------------- +// RMPXDataItemArray::RMPXDataItemArray +// ----------------------------------------------------------------------------- +// +RMPXDataItemArray::RMPXDataItemArray() + : iFirstItemOffset(0),iLastItemOffset(0),iNumItems(0),iPos(0),iIndex(0) + { + } + +// ----------------------------------------------------------------------------- +// RMPXDataItemArray::Close +// ----------------------------------------------------------------------------- +// +void RMPXDataItemArray::Close(TUint aClientHandle) + { + MPX_ASSERT(aClientHandle); + Reset(aClientHandle); + } + +// ----------------------------------------------------------------------------- +// RMPXDataItemArray::DataItem +// ----------------------------------------------------------------------------- +// +RMPXDataItem* RMPXDataItemArray::DataItem(TUint aClientHandle,TInt aIndex) + { + MPX_ASSERT(aClientHandle&&aIndex>=0&&aIndexaIndex) + { + iIndex--; + iPos=item->PreviousOffset(); + } + else // if (iIndexNextOffset(); + } + } + MPX_ASSERT(dataItem && (TInt)dataItem > (TInt)&RMPXHeapManager::HeapManager(aClientHandle)); + return dataItem; + } + +// ----------------------------------------------------------------------------- +// RMPXDataItemArray::Delete +// ----------------------------------------------------------------------------- +// +void RMPXDataItemArray::Delete(TUint aClientHandle,RMPXDataItem* aItem) + { + MPX_ASSERT(aClientHandle&&aItem); + aItem->Close(aClientHandle); // Release objects in the buffer + TInt r=RMPXHeapManager::HeapManager(aClientHandle).Free(aClientHandle,aItem); + MPX_ASSERT(r==KErrNone); + (void)r; + } + +// ----------------------------------------------------------------------------- +// RMPXDataItemArray::Append +// ----------------------------------------------------------------------------- +// +void RMPXDataItemArray::Append(TUint aClientHandle,RMPXDataItem& aItem) + { + MPX_ASSERT(aClientHandle); + // + aItem.Insert(aClientHandle,iLastItemOffset,0); + iLastItemOffset=OFFSET(aClientHandle,&aItem); + if (iNumItems++==0) + { + iFirstItemOffset=iLastItemOffset; + } + iPos=iFirstItemOffset; + iIndex=0; + } + +// ----------------------------------------------------------------------------- +// RMPXDataItemArray::Set +// ----------------------------------------------------------------------------- +// +void RMPXDataItemArray::Set(TUint aClientHandle,RMPXDataItem& aItem,TInt aIndex) + { + MPX_ASSERT(aClientHandle&&aIndex>=0&&aIndex=0&&aIndex=0&&aIndexNextOffset(); + } + if (iLastItemOffset==itemOffset) + { + iLastItemOffset=item->PreviousOffset(); + } + item->Remove(aClientHandle); + Delete(aClientHandle,item); + iPos=iFirstItemOffset; + iIndex=0; + --iNumItems; + } + +// ----------------------------------------------------------------------------- +// RMPXDataItemArray::Reset +// ----------------------------------------------------------------------------- +// +void RMPXDataItemArray::Reset(TUint aClientHandle) + { + if (iFirstItemOffset) + { + RMPXDataItem* item=ITEM(aClientHandle,iFirstItemOffset); + while(item) + { + Delete(aClientHandle,item); + item=item->NextOffset()?ITEM(aClientHandle,item->NextOffset()):NULL; + } + } + // Reset members + iFirstItemOffset=0; + iLastItemOffset=0; + iNumItems=0; + iPos=0; + iIndex=0; + } + +// ----------------------------------------------------------------------------- +// RMPXDataItemArray::Find +// ----------------------------------------------------------------------------- +// +TInt RMPXDataItemArray::Find(TUint aClientHandle,const RMPXDataItem& aItem) + { + TInt r=KErrNotFound; + if (iFirstItemOffset) + { + TInt index=KErrNotFound; + RMPXDataItem* item=ITEM(aClientHandle,iFirstItemOffset); + while(item) + { + index++; + TUint8* d1 = reinterpret_cast(item->Buf(aClientHandle)); + TUint8* d2 = + reinterpret_cast(const_cast(&aItem)-> + Buf(aClientHandle)); + if (Mem::Compare(d1, item->Size(), d2, aItem.Size()) == 0) + { + r=index; + break; + } + item=item->NextOffset()?ITEM(aClientHandle,item->NextOffset()):NULL; + } + } + return r; + } +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxdrmmediaagent.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxdrmmediaagent.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2006 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: Implementation of drm media agent base class +* +*/ + + +#include +#include "mpxmedia.h" +#include "mpxmediadrmdefs.h" +#include "mpxdrmmediaagent.h" +#include "mpxlog.h" + +// CONSTANTS + +// ---------------------------------------------------------------------------- +// Closes and uninitializes the agent and cleans up member variables +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaAgent::Close() + { + MPX_DEBUG1("CMPXDrmMediaAgent::Close() entering"); + delete iMedia; + iMedia = NULL; + delete iData; + iData = NULL; + MPX_DEBUG1("CMPXDrmMediaAgent::Close() exiting"); + } + +// ---------------------------------------------------------------------------- +// Creates a new media object +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaAgent::CreateMediaL() + { + MPX_DEBUG1("CMPXDrmMediaAgent::CreateMediaL() entering"); + + // Create media + RArray supportedIds; + CleanupClosePushL( supportedIds ); + supportedIds.AppendL(KMPXMediaIdDrm); + iMedia = CMPXMedia::NewL( supportedIds.Array() ); + CleanupStack::PopAndDestroy( &supportedIds ); + + MPX_DEBUG1("CMPXDrmMediaAgent::CreateMediaL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Gets the protected attribute if not already obtained +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaAgent::GetProtectedL() + { + MPX_DEBUG1("CMPXDrmMediaAgent::GetProtectedL() entering"); + + if ( !iMedia->IsSupported( KMPXMediaDrmProtected )) + { + TBool prot( EFalse ); + User::LeaveIfError( iData->GetAttribute( EIsProtected, prot )); + iMedia->SetTObjectValueL( KMPXMediaDrmProtected, + prot ); + MPX_DEBUG2("CMPXDrmMediaAgent::GetProtectedL() protected = %d", prot); + } + + MPX_DEBUG1("CMPXDrmMediaAgent::GetProtectedL() exiting"); + } + + +// end of file diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxdrmmediaomaagent.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxdrmmediaomaagent.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,1001 @@ +/* +* Copyright (c) 2006 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: Implementation of drm media OMA agent +* +*/ + + +#include +#ifdef CAMESE_IN_DRM_UTILITY +#include +#include +#include +#include +#include +#include +#include +#else +#include +#endif +#include "mpxmedia.h" +#include "mpxmediadrmdefs.h" +#include "mpxdrmmediaomaagent.h" +#include "mpxlog.h" + +// CONSTANTS +const TUint32 KMPXAboutToExpireCount = 3; +const TInt KMPXAboutToExpireTime = 7; +const TInt KMPXAboutToExpireAccTime = 15*60; // 15 minutes +const TInt KMPXSecondsInDay = 86400; +#ifdef CAMESE_IN_DRM_UTILITY +const TInt KUrlMaxLen( 1024 ); // Same than in DRMHelper +#endif + + +// ----------------------------------------------------------------------------- +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CMPXDrmMediaOmaAgent* CMPXDrmMediaOmaAgent::NewL() + { + MPX_FUNC("CMPXDrmMediaOmaAgent::NewL()"); + CMPXDrmMediaOmaAgent* p = CMPXDrmMediaOmaAgent::NewLC(); + CleanupStack::Pop(p); + return p; + } + +// ----------------------------------------------------------------------------- +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CMPXDrmMediaOmaAgent* CMPXDrmMediaOmaAgent::NewLC() + { + MPX_FUNC("CMPXDrmMediaOmaAgent::NewLC()"); + CMPXDrmMediaOmaAgent* p = new (ELeave) CMPXDrmMediaOmaAgent(); + CleanupStack::PushL(p); + p->ConstructL(); + return p; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CMPXDrmMediaOmaAgent::~CMPXDrmMediaOmaAgent() + { + MPX_FUNC("CMPXDrmMediaOmaAgent::~CMPXDrmMediaOmaAgent()"); + Close(); +#ifdef CAMESE_IN_DRM_UTILITY + delete iDrmHandler; + + if ( iDRMCommon ) + { + iDRMCommon->Disconnect(); + } + delete iDRMCommon; +#else + delete iDrmHelper; +#endif + iFs.Close(); + } + +// ----------------------------------------------------------------------------- +// Default constructor +// ----------------------------------------------------------------------------- +// +CMPXDrmMediaOmaAgent::CMPXDrmMediaOmaAgent() + { + MPX_FUNC("CMPXDrmMediaOmaAgent::CMPXDrmMediaOmaAgent()"); + } + +// ---------------------------------------------------------------------------- +// 2nd phase constructor. +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaOmaAgent::ConstructL() + { + MPX_FUNC("CMPXDrmMediaOmaAgent::ConstructL()"); + + User::LeaveIfError( iFs.Connect() ); +#ifdef CAMESE_IN_DRM_UTILITY + iDrmHandler = DRM::CDrmUiHandling::NewL(); + + iDRMCommon = DRMCommon::NewL(); + User::LeaveIfError( iDRMCommon->Connect() ); +#else + iDrmHelper = CDRMHelper::NewL(); +#endif + } + + +// ---------------------------------------------------------------------------- +// Initialize utility using a filename +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaOmaAgent::InitL( const TDesC& aFileName ) + { + MPX_DEBUG2("CMPXDrmMediaOmaAgent::InitL(%S) entering", &aFileName ); + + Close(); + CreateMediaL(); + iData = CData::NewL( + (TVirtualPathPtr) aFileName, + EPeek, + EContentShareReadOnly ); + User::LeaveIfError( iFile.Open( iFs, aFileName, EFileShareReadersOrWriters )); + + MPX_DEBUG1("CMPXDrmMediaOmaAgent::InitL() exiting" ); + } + +// ---------------------------------------------------------------------------- +// Initialize utility using a file handle +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaOmaAgent::InitL( RFile& aFile ) + { + MPX_DEBUG1("CMPXDrmMediaOmaAgent::InitL(RFile) entering" ); + + Close(); + CreateMediaL(); + iData = CData::NewL( + aFile, + KDefaultContentObject(), + EPeek ); + User::LeaveIfError( iFile.Duplicate( aFile ) ); + + MPX_DEBUG1("CMPXDrmMediaOmaAgent::InitL(RFile) exiting" ); + } + +// ---------------------------------------------------------------------------- +// Gets media object with the given attributes +// ---------------------------------------------------------------------------- +// +const CMPXMedia& CMPXDrmMediaOmaAgent::GetMediaL( TUint aAttributes ) + { + MPX_DEBUG2("CMPXDrmMediaOmaAgent::GetMediaL(%d) entering", aAttributes ); + + if ( iMedia ) + { + if ( aAttributes & KMPXMediaDrmProtected.iAttributeId ) + { + GetProtectedL(); + } + if (( aAttributes & KMPXMediaDrmRightsStatus.iAttributeId ) || + ( aAttributes & KMPXMediaDrmSendingAllowed.iAttributeId )) + { + GetRightsDetailsL(); + } + if ( aAttributes & KMPXMediaDrmRightsType.iAttributeId ) + { + GetRightsTypeL(); + } + if ( aAttributes & KMPXMediaDrmCount.iAttributeId ) + { + GetCountL(); + } + if ( aAttributes & KMPXMediaDrmStartTime.iAttributeId ) + { + GetStartTimeL(); + } + if ( aAttributes & KMPXMediaDrmEndTime.iAttributeId ) + { + GetEndTimeL(); + } + if ( aAttributes & KMPXMediaDrmInterval.iAttributeId ) + { + GetIntervalL(); + } + if ( aAttributes & KMPXMediaDrmIntervalStartTime.iAttributeId ) + { + GetIntervalStartTimeL(); + } + if ( aAttributes & KMPXMediaDrmAccumulatedTime.iAttributeId ) + { + GetAccumulatedTimeL(); + } + if ( aAttributes & KMPXMediaDrmCanSetAutomated.iAttributeId ) + { + GetCanSetAutomatedL(); + } + if ( aAttributes & KMPXMediaDrmHasInfoUrl.iAttributeId ) + { + GetHasInfoUrlL(); + } + if ( aAttributes & KMPXMediaDrmHasPreviewUrl.iAttributeId ) + { + GetHasPreviewUrlL(); + } + if ( aAttributes & KMPXMediaDrmAboutToExpire.iAttributeId ) + { + GetAboutToExpireL(); + } + } + + MPX_DEBUG1("CMPXDrmMediaOmaAgent::GetMediaL() exiting" ); + return *iMedia; + } + +// ---------------------------------------------------------------------------- +// Consumes the rights for the current media according +// to the specified consume type +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaOmaAgent::ConsumeL( TDrmConsumeType aType ) + { + MPX_DEBUG1("CMPXDrmMediaOmaAgent::ConsumeL() entering"); +#ifdef CAMESE_IN_DRM_UTILITY + // ConsumeL is not used at the moment + ASSERT(0); + User::Leave( KErrNotSupported ); +#else + if ( iMedia ) + { + CDRMHelper::TDRMHelperConsumeAction action( CDRMHelper::EStart ); + switch ( aType ) + { + case ( EMPXDrmConsumeStart ): + { + action = CDRMHelper::EStart; + break; + } + case ( EMPXDrmConsumePause ): + { + action = CDRMHelper::EPause; + break; + } + case ( EMPXDrmConsumeContinue ): + { + action = CDRMHelper::EContinue; + break; + } + case ( EMPXDrmConsumeFinish ): + { + action = CDRMHelper::EFinish; + break; + } + default: + { + break; + } + } + + User::LeaveIfError( iDrmHelper->ConsumeFile2( + iFile, + ContentAccess::EPlay, + action )); + } +#endif + MPX_DEBUG1("CMPXDrmMediaOmaAgent::ConsumeL() exiting" ); + } + +// ---------------------------------------------------------------------------- +// Closes and uninitializes the agent and cleans up member variables +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaOmaAgent::Close() + { + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::Close() entering"); + + CMPXDrmMediaAgent::Close(); + delete iRightsConstraints; + iRightsConstraints = NULL; + iFile.Close(); + + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::Close() exiting"); + } + +// ---------------------------------------------------------------------------- +// Creates a new media object +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaOmaAgent::CreateMediaL() + { + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::CreateMediaL() entering"); + + CMPXDrmMediaAgent::CreateMediaL(); + + // Set the type to OMA + iMedia->SetTObjectValueL( KMPXMediaDrmType, EMPXDrmTypeOMA ); + + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::CreateMediaL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Gets the rights details +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaOmaAgent::GetRightsDetailsL() + { + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetRightsDetailsL() entering"); + + if ( !iMedia->IsSupported( KMPXMediaDrmRightsStatus ) || + !iMedia->IsSupported( KMPXMediaDrmSendingAllowed )) + { +#ifdef CAMESE_IN_DRM_UTILITY + TBool expired( EFalse ); + TBool sendingAllowed( ETrue ); + HBufC* contentURI = NULL; + HBufC8* contentURI8 = NULL; + CDRMRights* activeRights = NULL; + + // Get forwardable status from CAF + User::LeaveIfError( iData->GetAttribute( EIsForwardable, sendingAllowed ) ) ; + + // Get constraints. Copied from CDRMHelper::GetRightsDetailsL + contentURI = HBufC::NewLC( KUrlMaxLen ); + TPtr ptr = contentURI->Des(); + User::LeaveIfError( iData->GetStringAttribute( EContentID, ptr ) ); + + contentURI8 = HBufC8::NewLC( contentURI->Length() ); + contentURI8->Des().Copy( contentURI->Des() ); + + // GetActiveRights returns negative value if rights are not valid + if ( iDRMCommon->GetActiveRights( *contentURI8, ContentAccess::EPlay, activeRights ) > 0 ) + { + // rights are valid + activeRights->GetPlayRight( iRightsConstraints ); + } + else + { + expired = ETrue; + } + CleanupStack::PopAndDestroy( 2 ); // contentURI8, contentURI +#else + TInt error( KErrNone ); + TBool expired( EFalse ); + TBool sendingAllowed( ETrue ); + CDRMHelperRightsConstraints* ignore1( NULL ); + CDRMHelperRightsConstraints* ignore2( NULL ); + CDRMHelperRightsConstraints* ignore3( NULL ); + delete iRightsConstraints; + iRightsConstraints = NULL; + + TRAP( error, iDrmHelper->GetRightsDetailsL( + iFile, + ContentAccess::EPlay, + expired, + sendingAllowed, + iRightsConstraints, + ignore1, + ignore2, + ignore3 )); + delete ignore1; + delete ignore2; + delete ignore3; +#endif + + if ( expired ) + { + iMedia->SetTObjectValueL( KMPXMediaDrmRightsStatus, + EMPXDrmRightsExpired ); + } + else if ( iRightsConstraints ) + { + if ( iRightsConstraints->IsPreview() ) + { + iMedia->SetTObjectValueL( KMPXMediaDrmRightsStatus, + EMPXDrmRightsPreview ); + } + else if ( iRightsConstraints->FullRights() ) + { + iMedia->SetTObjectValueL( KMPXMediaDrmRightsStatus, + EMPXDrmRightsFull ); + } + else + { + iMedia->SetTObjectValueL( KMPXMediaDrmRightsStatus, + EMPXDrmRightsRestricted ); + } + } + else + { + // Not expired, no constraints object obtainable, + // so check if it's protected + if ( !iMedia->IsSupported( KMPXMediaDrmProtected )) + { + GetProtectedL(); + } + TBool prot( iMedia->ValueTObjectL( KMPXMediaDrmProtected )); + if ( prot ) + { + iMedia->SetTObjectValueL( KMPXMediaDrmRightsStatus, + EMPXDrmRightsMissing ); + } + else + { + iMedia->SetTObjectValueL( KMPXMediaDrmRightsStatus, + EMPXDrmRightsFull ); + } + } + + iMedia->SetTObjectValueL( KMPXMediaDrmSendingAllowed, + sendingAllowed ); + } + + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetRightsDetailsL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Gets the rights type attribute if not already obtained +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaOmaAgent::GetRightsTypeL() + { + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetRightsTypeL() entering"); + + if ( !iMedia->IsSupported( KMPXMediaDrmRightsType )) + { + // Check if it's protected or not first + if ( !iMedia->IsSupported( KMPXMediaDrmProtected )) + { + GetProtectedL(); + } + TBool prot( iMedia->ValueTObjectL( KMPXMediaDrmProtected )); + if ( !prot ) + { + iMedia->SetTObjectValueL( KMPXMediaDrmRightsType, + EMPXDrmRightsTypeNoRestriction ); + } + else + { + // Else it's a protected file, so get the rights constraints + if ( !iRightsConstraints ) + { + GetRightsDetailsL(); + } + + // Check if it's a count based rights + GetCountL(); + if ( !iMedia->IsSupported( KMPXMediaDrmCount )) + { + // Check if it's time based + GetStartTimeL(); + if ( !iMedia->IsSupported( KMPXMediaDrmStartTime )) + { + // Check if it's interval based + GetIntervalL(); + if ( !iMedia->IsSupported( KMPXMediaDrmInterval )) + { + // Check if it's accumulated time based + GetAccumulatedTimeL(); + if ( !iMedia->IsSupported( KMPXMediaDrmAccumulatedTime )) + { + // not have any of the restriction types + iMedia->SetTObjectValueL( + KMPXMediaDrmRightsType, + EMPXDrmRightsTypeNoRestriction ); + } // else not accumulated time + } // else not interval + } // else not time based + } // else not count based + } // else protected file + } + + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetRightsTypeL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Gets the count attribute if not already obtained +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaOmaAgent::GetCountL() + { + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetCountL() entering"); + + // Do not need to check if it already supported, we + // just overwrite the old value if possible + if ( !iRightsConstraints ) + { + GetRightsDetailsL(); + } + if ( iRightsConstraints ) + { + TUint32 countLeft( 0 ); + TUint32 originalCount( 0 ); + TUint32 timedCount( 0 ); +#ifdef CAMESE_IN_DRM_UTILITY + // Logic copied from CDRMHelperRightsConstraints + + TInt error1 = iRightsConstraints->GetCounters( countLeft, originalCount ); + + TBool timedCounter = EFalse; + if ( ( iRightsConstraints->GetConstraint()).iActiveConstraints & + EConstraintTimedCounter ) + { + timedCount = ( iRightsConstraints->GetConstraint()).iTimedCounter; + timedCounter = ETrue; + } + + if ( timedCounter ) + { + iMedia->SetTObjectValueL( KMPXMediaDrmRightsType, + EMPXDrmRightsTypeTimeCount ); + if ( error1 != DRMCommon::ENoRights ) + { + countLeft = Min( countLeft, timedCount ); + } + else + { + countLeft = timedCount; + } + iMedia->SetTObjectValueL( KMPXMediaDrmCount, + countLeft ); + MPX_DEBUG2("CXMPXDrmMediaOmaAgent::GetCountL(): count = %d", countLeft); + } + else if ( error1 != DRMCommon::ENoRights ) + { + iMedia->SetTObjectValueL( KMPXMediaDrmRightsType, + EMPXDrmRightsTypeCount ); + iMedia->SetTObjectValueL( KMPXMediaDrmCount, + countLeft ); + MPX_DEBUG2("CXMPXDrmMediaOmaAgent::GetCountL(): count = %d", countLeft); + } +#else + TTimeIntervalSeconds ignoreTime; + TRAPD( error1, iRightsConstraints->GetCountersL( + countLeft, + originalCount )); + TRAPD( error2, iRightsConstraints->GetTimedCountL( + timedCount, + originalCount, + ignoreTime )); + if ( KErrNone == error2 ) + { + iMedia->SetTObjectValueL( KMPXMediaDrmRightsType, + EMPXDrmRightsTypeTimeCount ); + if ( KErrNone == error1 ) + { + countLeft = Min( countLeft, timedCount ); + } + else + { + countLeft = timedCount; + } + iMedia->SetTObjectValueL( KMPXMediaDrmCount, + countLeft ); + MPX_DEBUG2("CXMPXDrmMediaOmaAgent::GetCountL(): count = %d", countLeft); + } + else if ( KErrNone == error1 ) + { + iMedia->SetTObjectValueL( KMPXMediaDrmRightsType, + EMPXDrmRightsTypeCount ); + iMedia->SetTObjectValueL( KMPXMediaDrmCount, + countLeft ); + MPX_DEBUG2("CXMPXDrmMediaOmaAgent::GetCountL(): count = %d", countLeft); + } +#endif + } + + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetCountL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Gets the start time attribute if not already obtained +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaOmaAgent::GetStartTimeL() + { + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetStartTimeL() entering"); + + if ( !iMedia->IsSupported( KMPXMediaDrmStartTime )) + { + if ( !iRightsConstraints ) + { + GetRightsDetailsL(); + } + if ( iRightsConstraints ) + { + TTime startTime; +#ifdef CAMESE_IN_DRM_UTILITY + if( iRightsConstraints->GetStartTime( startTime ) != DRMCommon::ENoRights ) +#else + TRAPD( error, iRightsConstraints->GetStartTimeL( startTime )); + if ( KErrNone == error ) +#endif + { + iMedia->SetTObjectValueL( KMPXMediaDrmRightsType, + EMPXDrmRightsTypeTime ); + iMedia->SetTObjectValueL( KMPXMediaDrmStartTime, + startTime.Int64() ); + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetCountL(): setting start time"); + } + } + } + + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetStartTimeL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Gets the end time attribute if not already obtained +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaOmaAgent::GetEndTimeL() + { + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetEndTimeL() entering"); + + if ( !iMedia->IsSupported( KMPXMediaDrmEndTime )) + { + if ( !iRightsConstraints ) + { + GetRightsDetailsL(); + } + if ( iRightsConstraints ) + { + TTime endTime; +#ifdef CAMESE_IN_DRM_UTILITY + if( iRightsConstraints->GetEndTime( endTime ) != DRMCommon::ENoRights ) +#else + TRAPD( error, iRightsConstraints->GetEndTimeL( endTime )); + if ( KErrNone == error ) +#endif + { + iMedia->SetTObjectValueL( KMPXMediaDrmRightsType, + EMPXDrmRightsTypeTime ); + iMedia->SetTObjectValueL( KMPXMediaDrmEndTime, + endTime.Int64() ); + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetCountL(): setting end time"); + } + } + } + + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetEndTimeL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Gets the interval attribute if not already obtained +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaOmaAgent::GetIntervalL() + { + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetIntervalL() entering"); + + if ( !iMedia->IsSupported( KMPXMediaDrmInterval )) + { + if ( !iRightsConstraints ) + { + GetRightsDetailsL(); + } + if ( iRightsConstraints ) + { + TTimeIntervalSeconds interval; +#ifdef CAMESE_IN_DRM_UTILITY + if( iRightsConstraints->GetInterval( interval ) != DRMCommon::ENoRights ) +#else + TRAPD( error, iRightsConstraints->GetIntervalL( interval )); + if ( KErrNone == error ) +#endif + { + iMedia->SetTObjectValueL( KMPXMediaDrmRightsType, + EMPXDrmRightsTypeInterval ); + iMedia->SetTObjectValueL( KMPXMediaDrmInterval, + interval ); + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetCountL(): setting interval"); + } + } + } + + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetIntervalL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Gets the interval start time attribute if not already obtained +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaOmaAgent::GetIntervalStartTimeL() + { + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetIntervalStartTimeL() entering"); + + if ( !iMedia->IsSupported( KMPXMediaDrmIntervalStartTime )) + { + if ( !iRightsConstraints ) + { + GetRightsDetailsL(); + } + if ( iRightsConstraints ) + { + TTime intervalStart; +#ifdef CAMESE_IN_DRM_UTILITY + if( iRightsConstraints->GetIntervalStart( intervalStart ) != DRMCommon::ENoRights ) +#else + TRAPD( error, iRightsConstraints->GetIntervalStartL( + intervalStart )); + if ( KErrNone == error ) +#endif + { + iMedia->SetTObjectValueL( KMPXMediaDrmIntervalStartTime, + intervalStart.Int64() ); + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetCountL(): setting interval start time"); + } + } + } + + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetIntervalStartTimeL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Gets the accumlated time attribute if not already obtained +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaOmaAgent::GetAccumulatedTimeL() + { + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetAccumulatedTimeL() entering"); + + if ( !iMedia->IsSupported( KMPXMediaDrmAccumulatedTime )) + { + if ( !iRightsConstraints ) + { + GetRightsDetailsL(); + } + if ( iRightsConstraints ) + { +#ifdef CAMESE_IN_DRM_UTILITY + // Copied from DRMHelper::GetAccumulatedTimeL + if ((iRightsConstraints->GetConstraint()).iActiveConstraints & + EConstraintAccumulated ) + { + TTimeIntervalSeconds time = + (iRightsConstraints->GetConstraint()).iAccumulatedTime; +#else + TTimeIntervalSeconds time; + TRAPD( error, iRightsConstraints->GetAccumulatedTimeL( time )); + if ( KErrNone == error ) + { +#endif + iMedia->SetTObjectValueL( KMPXMediaDrmRightsType, + EMPXDrmRightsTypeAccTime ); + iMedia->SetTObjectValueL( KMPXMediaDrmAccumulatedTime, + time ); + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetCountL(): setting accumulated time"); + } + } + } + + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetAccumulatedTimeL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Gets the can set automated attribute if not already obtained +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaOmaAgent::GetCanSetAutomatedL() + { + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetCanSetAutomatedL() entering"); + + if ( !iMedia->IsSupported( KMPXMediaDrmCanSetAutomated )) + { + TBool canSetAutomated( ETrue ); + +#ifdef CAMESE_IN_DRM_UTILITY + DRM::CDrmAutomatedUsage* drmAutomatedUsage = DRM::CDrmAutomatedUsage::NewLC(); + + TRAP_IGNORE( + canSetAutomated = drmAutomatedUsage->CanSetAutomatedL( iFile, + ContentAccess::EPlay, DRM::EAUAutomatedTypeRingingTone ); + ); + CleanupStack::PopAndDestroy( drmAutomatedUsage ); + + iMedia->SetTObjectValueL( KMPXMediaDrmCanSetAutomated, canSetAutomated ); +#else + iDrmHelper->CanSetAutomated( iFile, canSetAutomated ); + iMedia->SetTObjectValueL( KMPXMediaDrmCanSetAutomated, + canSetAutomated ); +#endif + MPX_DEBUG2("CXMPXDrmMediaOmaAgent::GetCanSetAutomatedL(): set to %d", canSetAutomated ); + } + + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetCanSetAutomatedL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Gets the info url attribute if not already obtained +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaOmaAgent::GetHasInfoUrlL() + { + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetHasInfoUrlL() entering"); + + if ( !iMedia->IsSupported( KMPXMediaDrmHasInfoUrl )) + { +#ifdef CAMESE_IN_DRM_UTILITY + DRM::TDrmUiUrlType types = DRM::TDrmUiUrlType( 0 ); + TRAP_IGNORE( iDrmHandler->AvailableUrlsL( iFile, types ) ); + TBool hasInfoUrl = ( types & DRM::EUHInfoUrl ) == DRM::EUHInfoUrl; + + iMedia->SetTObjectValueL( KMPXMediaDrmHasInfoUrl, hasInfoUrl ); +#else + TFileName filename; + iFile.FullName( filename ); + HBufC8* infoUrl( NULL ); + TBool hasInfoUrl( EFalse ); + TRAP_IGNORE( iDrmHelper->HasInfoUrlL( filename, infoUrl )); + delete infoUrl; + iMedia->SetTObjectValueL( KMPXMediaDrmHasInfoUrl, + hasInfoUrl ); +#endif + MPX_DEBUG2("CXMPXDrmMediaOmaAgent::GetHasInfoUrlL(): set to %d", hasInfoUrl ); + } + + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetHasInfoUrlL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Gets the preview url attribute if not already obtained +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaOmaAgent::GetHasPreviewUrlL() + { + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetHasPreviewUrlL() entering"); + + if ( !iMedia->IsSupported( KMPXMediaDrmHasPreviewUrl )) + { +#ifdef CAMESE_IN_DRM_UTILITY + DRM::TDrmUiUrlType types = DRM::TDrmUiUrlType( 0 ); + TRAP_IGNORE( iDrmHandler->AvailableUrlsL( iFile, types ) ); + TBool hasPreviewUrl = ( ( types & DRM::EUHPreviewRightsUrl ) + == DRM::EUHPreviewRightsUrl ); + iMedia->SetTObjectValueL( KMPXMediaDrmHasPreviewUrl, hasPreviewUrl ); +#else + TFileName filename; + iFile.FullName( filename ); + HBufC8* previewUrl( NULL ); + TRAP_IGNORE( iDrmHelper->HasPreviewL( filename, previewUrl )); + TBool hasPreviewUrl( previewUrl != NULL ); + delete previewUrl; + iMedia->SetTObjectValueL( KMPXMediaDrmHasPreviewUrl, + hasPreviewUrl ); +#endif + MPX_DEBUG2("CXMPXDrmMediaOmaAgent::GetHasPreviewUrlL(): set to %d", hasPreviewUrl ); + } + + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetHasPreviewUrlL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Gets whether the DRM object is about to expire or not +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaOmaAgent::GetAboutToExpireL() + { + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetAboutToExpireL() entering"); + + TBool aboutToExpire( EFalse ); + if ( !iMedia->IsSupported( KMPXMediaDrmRightsStatus )) + { + GetRightsDetailsL(); + } + + // Only restricted types can expire + if ( EMPXDrmRightsRestricted == + iMedia->ValueTObjectL( KMPXMediaDrmRightsStatus )) + { + // Get the type + if ( !iRightsConstraints ) + { + GetRightsDetailsL(); + } + + // Check if it's a count based rights + GetCountL(); + if ( iMedia->IsSupported( KMPXMediaDrmCount ) ) + { + // count based, or time/count based + MPX_DEBUG1( "CXMPXDrmMediaOmaAgent::GetAboutToExpireL EMPXDrmRightsTypeCount/EMPXDrmRightsTypeTimeCount" ); + // Try to get count value + TInt count(iMedia->ValueTObjectL( KMPXMediaDrmCount )); + if ( count <= KMPXAboutToExpireCount ) + { + aboutToExpire = ETrue; + } + } // end if count type + else + { + GetStartTimeL(); + if ( iMedia->IsSupported( KMPXMediaDrmStartTime ) ) + { + // time based + MPX_DEBUG1( "CXMPXDrmMediaOmaAgent::GetAboutToExpireL EMPXDrmRightsTypeTime" ); + if ( !iMedia->IsSupported( KMPXMediaDrmEndTime )) + { + GetEndTimeL(); + } + + // Check if end time attribute was actually fetched + // in GetEndTimeL() + if ( iMedia->IsSupported( KMPXMediaDrmEndTime )) + { + TInt64 end( + iMedia->ValueTObjectL( KMPXMediaDrmEndTime )); + TTime endTime( end ); + TTime currentTime; + currentTime.HomeTime(); + TInt diff( endTime.DaysFrom( currentTime ).Int() ); + if ( diff <= KMPXAboutToExpireTime ) + { + aboutToExpire = ETrue; + } + } + } // end if time type + else + { + GetIntervalL(); + if ( iMedia->IsSupported( KMPXMediaDrmInterval ) ) + { + // interval based + MPX_DEBUG1( "CXMPXDrmMediaOmaAgent::GetAboutToExpireL EMPXDrmRightsTypeInterval" ); + if ( !iMedia->IsSupported( KMPXMediaDrmInterval )) + { + GetIntervalL(); + } + if ( !iMedia->IsSupported( KMPXMediaDrmIntervalStartTime )) + { + GetIntervalStartTimeL(); + } + + TInt intervalDiff( 0 ); + const TTimeIntervalSeconds& interval( + iMedia->ValueTObjectL( + KMPXMediaDrmInterval )); + if ( iMedia->IsSupported( KMPXMediaDrmIntervalStartTime )) + { + // Interval has already started + TTime currentTime; + currentTime.HomeTime(); + TInt64 start( + iMedia->ValueTObjectL( KMPXMediaDrmIntervalStartTime )); + TTime intervalStart( start ); + TTimeIntervalSeconds secondsFromStart; + currentTime.SecondsFrom( intervalStart, secondsFromStart ); + intervalDiff = ( interval.Int() - secondsFromStart.Int() ) / + KMPXSecondsInDay; + } + else + { + // Interval has not started yet + intervalDiff = interval.Int() / KMPXSecondsInDay; + } + if ( intervalDiff <= KMPXAboutToExpireTime ) + { + aboutToExpire = ETrue; + } + } // end if interval type + else + { + GetAccumulatedTimeL(); + if ( iMedia->IsSupported( KMPXMediaDrmAccumulatedTime ) ) + { + MPX_DEBUG1( "CXMPXDrmMediaOmaAgent::GetAboutToExpireL EMPXDrmRightsTypeAccTime" ); + if ( !iMedia->IsSupported( KMPXMediaDrmAccumulatedTime )) + { + GetAccumulatedTimeL(); + } + const TTimeIntervalSeconds& accTime( + iMedia->ValueTObjectL( + KMPXMediaDrmAccumulatedTime )); + if ( accTime.Int() < KMPXAboutToExpireAccTime ) + { + aboutToExpire = ETrue; + } + } // end if accumulated time type + } + } + } + } + + iMedia->SetTObjectValueL( KMPXMediaDrmAboutToExpire, + aboutToExpire ); + + MPX_DEBUG1("CXMPXDrmMediaOmaAgent::GetAboutToExpireL() exiting"); + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxdrmmediautility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxdrmmediautility.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,290 @@ +/* +* Copyright (c) 2006 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: EXPORT_C implementation of drm media utility +* +*/ + + +#include +#include +#include "mpxdrmmediautility.h" +#include "mpxdrmmediaomaagent.h" +#include "mpxdrmmediawmaagent.h" +#include "mpxmediadrmdefs.h" +#include "mpxlog.h" + +// ----------------------------------------------------------------------------- +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXDrmMediaUtility* CMPXDrmMediaUtility::NewL() + { + MPX_FUNC("CMPXDrmMediaUtility::NewL()"); + CMPXDrmMediaUtility* p = new (ELeave) CMPXDrmMediaUtility(); + CleanupStack::PushL(p); + p->ConstructL(); + CleanupStack::Pop(p); + return p; + } + +// ----------------------------------------------------------------------------- +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXDrmMediaUtility* CMPXDrmMediaUtility::NewLC() + { + MPX_FUNC("CMPXDrmMediaUtility::NewLC()"); + CMPXDrmMediaUtility* p = new (ELeave) CMPXDrmMediaUtility(); + CleanupStack::PushL(p); + p->ConstructL(); + return p; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXDrmMediaUtility::~CMPXDrmMediaUtility() + { + MPX_FUNC("CMPXDrmMediaUtility::~CMPXDrmMediaUtility()"); + iAgents.ResetAndDestroy(); + iAgents.Close(); + delete iDefaultMedia; + iFs.Close(); + } + +// ----------------------------------------------------------------------------- +// Default constructor +// ----------------------------------------------------------------------------- +// +CMPXDrmMediaUtility::CMPXDrmMediaUtility() + { + MPX_FUNC("CMPXDrmMediaUtility::CMPXDrmMediaUtility()"); + } + +// ---------------------------------------------------------------------------- +// 2nd phase constructor. +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaUtility::ConstructL() + { + MPX_FUNC("CMPXDrmMediaUtility::ConstructL()"); + + // Create the OMA Agent + CMPXDrmMediaOmaAgent* omaAgent = CMPXDrmMediaOmaAgent::NewLC(); + iAgents.Insert( omaAgent, EOmaDrmAgent ); + CleanupStack::Pop( omaAgent ); + + // Create the WMA Agent + CMPXDrmMediaWmaAgent* wmaAgent = CMPXDrmMediaWmaAgent::NewLC(); + iAgents.Insert( wmaAgent, EWmaDrmAgent ); + CleanupStack::Pop( wmaAgent ); + + // Create a default media + RArray supportedIds; + CleanupClosePushL( supportedIds ); + supportedIds.AppendL(KMPXMediaIdDrm); + iDefaultMedia = CMPXMedia::NewL( supportedIds.Array() ); + CleanupStack::PopAndDestroy( &supportedIds ); + iDefaultMedia->SetTObjectValueL( KMPXMediaDrmProtected, + EFalse ); + + // Create file system session + User::LeaveIfError( iFs.Connect() ); + } + + +// ---------------------------------------------------------------------------- +// Initialize utility using a filename +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXDrmMediaUtility::InitL( const TDesC& aFileName ) + { + MPX_DEBUG2("CMPXDrmMediaUtility::InitL(%S) entering", &aFileName ); + + Close(); + + if ( BaflUtils::FileExists( iFs, aFileName )) + { + CContent* content( CContent::NewLC( aFileName, EContentShareReadWrite )); + FindAgent( *content ); + if ( iCurrentAgent ) + { + iCurrentAgent->InitL( aFileName ); + } + CleanupStack::PopAndDestroy( content ); + } + iConsumeStarted = EFalse; + + MPX_DEBUG1("CMPXDrmMediaUtility::InitL() exiting" ); + } + +// ---------------------------------------------------------------------------- +// Initialize utility using a file handle +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXDrmMediaUtility::InitL( RFile& aFile ) + { + MPX_DEBUG1("CMPXDrmMediaUtility::InitL(RFile) entering" ); + + Close(); + CContent* content = CContent::NewLC( aFile ); + FindAgent( *content ); + if ( iCurrentAgent ) + { + iCurrentAgent->InitL( aFile ); + } + CleanupStack::PopAndDestroy( content ); + iConsumeStarted = EFalse; + + MPX_DEBUG1("CMPXDrmMediaUtility::InitL(RFile) exiting" ); + } + +// ---------------------------------------------------------------------------- +// Gets media object with the given attributes +// ---------------------------------------------------------------------------- +// +EXPORT_C const CMPXMedia* CMPXDrmMediaUtility::GetMediaL( TUint aAttributes ) + { + MPX_DEBUG2("CMPXDrmMediaUtility::GetMediaL(%d) entering", aAttributes ); + + const CMPXMedia* media( NULL ); + if ( iCurrentAgent ) + { + media = &( iCurrentAgent->GetMediaL( aAttributes )); + } + else + { + MPX_DEBUG1("CMPXDrmMediaUtility::GetMediaL(): Returning default media"); + media = iDefaultMedia; + } + + MPX_DEBUG1("CMPXDrmMediaUtility::GetMediaL() exiting" ); + return media; + } + + +// ---------------------------------------------------------------------------- +// Consumes the rights for the current media according +// to the specified consume type +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXDrmMediaUtility::ConsumeL( TDrmConsumeType aType ) + { + MPX_DEBUG1("CMPXDrmMediaUtility::ConsumeL() entering"); + + if ( iCurrentAgent ) + { + TDrmConsumeType type( EMPXDrmConsumeNone ); + const CMPXMedia& media( iCurrentAgent->GetMediaL( EMPXMediaDrmProtected )); + if ( media.ValueTObjectL( KMPXMediaDrmProtected )) + { + switch ( aType ) + { + case EMPXDrmConsumeStart: + { + type = aType; + iConsumeStarted = ETrue; + break; + } + case EMPXDrmConsumePause: + case EMPXDrmConsumeContinue: + case EMPXDrmConsumeFinish: + { + if ( iConsumeStarted ) + { + type = aType; + if ( EMPXDrmConsumeFinish == aType ) + { + iConsumeStarted = EFalse; + } + } + break; + } + case EMPXDrmConsumeStartOrContinue: + { + if ( iConsumeStarted ) + { + type = EMPXDrmConsumeContinue; + } + else + { + type = EMPXDrmConsumeStart; + iConsumeStarted = ETrue; + } + break; + } + default: + { + type = EMPXDrmConsumeNone; + iConsumeStarted = EFalse; + break; + } + } + + if ( EMPXDrmConsumeNone != type ) + { + iCurrentAgent->ConsumeL( type ); + } + } + else + { + iConsumeStarted = EFalse; + } + } + + MPX_DEBUG1("CMPXDrmMediaUtility::ConsumeL() exiting" ); + } + +// ---------------------------------------------------------------------------- +// Closes and unitializes the utility +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXDrmMediaUtility::Close() + { + MPX_DEBUG1("CMPXDrmMediaUtility::Close() entering" ); + + if ( iCurrentAgent ) + { + iCurrentAgent->Close(); + iCurrentAgent = NULL; + } + + MPX_DEBUG1("CMPXDrmMediaUtility::Close() exiting" ); + } + +// ---------------------------------------------------------------------------- +// Finds an agent to handle the content +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaUtility::FindAgent( CContent& aContent ) + { + MPX_DEBUG1("CMPXDrmMediaUtility::FindAgent() entering" ); + + TAgent agent( aContent.Agent() ); + if ( agent.Name() == KMPXWDRMCafAgentName || + agent.Name() == KMPXS60WMDRMCafAgent ) + { + iCurrentAgent = iAgents[EWmaDrmAgent]; + } + else if ( agent.Name() == KMPXOMACafAgentName ) + { + iCurrentAgent = iAgents[EOmaDrmAgent]; + } + else + { + iCurrentAgent = NULL; + } + MPX_DEBUG1("CMPXDrmMediaUtility::FindAgent() exiting" ); + } diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxdrmmediawmaagent.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxdrmmediawmaagent.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,784 @@ +/* +* Copyright (c) 2006 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: EXPORT_C implementation of drm media WMA agent +* +*/ + + +#include +#include "mpxmedia.h" +#include "mpxmediadrmdefs.h" +#include "mpxdrmmediawmaagent.h" +#include "mpxlog.h" + +// CONSTANTS +_LIT(KMPXWmaDrmDelLicensesType, "licensetype="); +_LIT(KMPXWmaDrmDelUnlimited, "unlimited"); +_LIT(KMPXWmaDrmDelTime, "time"); +_LIT(KMPXWmaDrmDelCount, "count"); +_LIT(KMPXWmaDrmDelDuration, "duration"); +_LIT(KMPXWmaDrmDelTimeCount, "time-count"); +_LIT(KMPXWmaDrmDelDurationLeft, "duration="); +_LIT(KMPXWmaDrmDelCountLeft, "countleft="); +_LIT(KMPXWmaDrmDelStartTime, "starttime="); +_LIT(KMPXWmaDrmDelEndTime, "endtime="); +_LIT(KMPXWmaDrmDelColon, ":"); +_LIT(KMPXWmaDrmDelSemiColon, ";"); +_LIT(KMPXWmaDrmTimeFill, "0"); + +const TInt KMPXWmaDrmMaxLicenseTypeBufSize = 30; +const TInt KMPXWmaDrmDashCount = 2; +const TInt KMPXWmaDrmMaxTimeBufSize = 3; +const TInt KMPXWmaDrmMinutesHourMinSize = 2; + +const TText KMPXWmaDrmSemiColonChar = ';'; +const TText KMPXWmaDrmDashChar = '-'; +const TText KMPXWmaDrmTChar = 'T'; +const TText KMPXWmaDrmColonChar = ':'; +const TText KMPXWmaDrmPeriodChar = '.'; +const TText KMPXWmaDrmZChar = 'Z'; +const TText KMPXWmaDrmPlusChar = '+'; + + +// ----------------------------------------------------------------------------- +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CMPXDrmMediaWmaAgent* CMPXDrmMediaWmaAgent::NewL() + { + MPX_FUNC("CMPXDrmMediaWmaAgent::NewL()"); + CMPXDrmMediaWmaAgent* p = CMPXDrmMediaWmaAgent::NewLC(); + CleanupStack::Pop(p); + return p; + } + +// ----------------------------------------------------------------------------- +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CMPXDrmMediaWmaAgent* CMPXDrmMediaWmaAgent::NewLC() + { + MPX_FUNC("CMPXDrmMediaWmaAgent::NewLC()"); + CMPXDrmMediaWmaAgent* p = new (ELeave) CMPXDrmMediaWmaAgent(); + CleanupStack::PushL(p); + p->ConstructL(); + return p; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CMPXDrmMediaWmaAgent::~CMPXDrmMediaWmaAgent() + { + MPX_FUNC("CMPXDrmMediaWmaAgent::~CMPXDrmMediaWmaAgent()"); + Close(); + delete iRightsManager; + delete iManager; + } + +// ----------------------------------------------------------------------------- +// Default constructor +// ----------------------------------------------------------------------------- +// +CMPXDrmMediaWmaAgent::CMPXDrmMediaWmaAgent() + { + MPX_FUNC("CMPXDrmMediaWmaAgent::CMPXDrmMediaWmaAgent()"); + } + +// ---------------------------------------------------------------------------- +// 2nd phase constructor. +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaWmaAgent::ConstructL() + { + MPX_FUNC("CMPXDrmMediaWmaAgent::ConstructL()"); + + RArray< TAgent > agents; + CleanupClosePushL( agents ); + + iManager = CManager::NewL(); + iManager->ListAgentsL( agents ); + + if ( agents.Count() > 0) + { + TInt i( 0 ); + for ( i = 0; i < agents.Count(); i++ ) + { + // break if we find the agent we want + // CAF UID + const TDesC& name( agents[i].Name() ); + if ( name.Compare( KMPXWDRMCafAgentName ) == 0 || + name.Compare( KMPXS60WMDRMCafAgent ) == 0 ) + { + break; + } + } + if ( i < agents.Count() ) + { + // We found the CAF agent + MPX_DEBUG2("CMPXDrmMediaWmaAgent::ConstructL(): CAF agent=%d", i); + iRightsManager = iManager->CreateRightsManagerL( agents[i] ); + } + } + + CleanupStack::PopAndDestroy( &agents ); + } + + +// ---------------------------------------------------------------------------- +// Initialize utility using a filename +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaWmaAgent::InitL( const TDesC& aFileName ) + { + MPX_DEBUG2("CMPXDrmMediaWmaAgent::InitL(%S) entering", &aFileName ); + MPX_DEBUG_THREAD("CMPXDrmMediaWmaAgent::InitL(aFileName)"); + + Close(); + CreateMediaL(); + iData = CData::NewL( + (TVirtualPathPtr) aFileName, + EPeek, + EContentShareReadOnly ); + iFileName = aFileName.AllocL(); + + MPX_DEBUG1("CMPXDrmMediaWmaAgent::InitL() exiting" ); + } + +// ---------------------------------------------------------------------------- +// Initialize utility using a file handle +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaWmaAgent::InitL( RFile& aFile ) + { + MPX_DEBUG1("CMPXDrmMediaWmaAgent::InitL(RFile) entering" ); + MPX_DEBUG_THREAD("CMPXDrmMediaWmaAgent::InitL(aFile)"); + + Close(); + CreateMediaL(); + iData = CData::NewL( + aFile, + KDefaultContentObject(), + EPeek ); + TFileName filename; + aFile.FullName( filename ); + iFileName = filename.AllocL(); + MPX_DEBUG1("CMPXDrmMediaWmaAgent::InitL(RFile) exiting" ); + } + +// ---------------------------------------------------------------------------- +// Gets media object with the given attributes +// ---------------------------------------------------------------------------- +// +const CMPXMedia& CMPXDrmMediaWmaAgent::GetMediaL( TUint aAttributes ) + { + MPX_DEBUG2("CMPXDrmMediaWmaAgent::GetMediaL(%d) entering", aAttributes ); + MPX_DEBUG_THREAD("CMPXDrmMediaWmaAgent::GetRightsTypeL()"); + + if ( iMedia ) + { + if ( aAttributes & KMPXMediaDrmProtected.iAttributeId ) + { + GetProtectedL(); + } + if ( aAttributes & KMPXMediaDrmRightsStatus.iAttributeId ) + { + GetRightsStatusL(); + } + if ( aAttributes & KMPXMediaDrmRightsType.iAttributeId ) + { + GetRightsTypeL(); + } + if ( aAttributes & KMPXMediaDrmCount.iAttributeId ) + { + GetCountL(); + } + if ( aAttributes & KMPXMediaDrmStartTime.iAttributeId ) + { + GetStartTimeL(); + } + if ( aAttributes & KMPXMediaDrmEndTime.iAttributeId ) + { + GetEndTimeL(); + } + if ( aAttributes & KMPXMediaDrmInterval.iAttributeId ) + { + GetIntervalL(); + } + if ( aAttributes & KMPXMediaDrmIntervalStartTime.iAttributeId ) + { + // Not Supported for WMA DRM + } + if ( aAttributes & KMPXMediaDrmAccumulatedTime.iAttributeId ) + { + // Not Supported for WMA DRM + } + if ( aAttributes & KMPXMediaDrmSendingAllowed.iAttributeId ) + { + GetSendingAllowedL(); + } + if ( aAttributes & KMPXMediaDrmCanSetAutomated.iAttributeId ) + { + GetCanSetAutomatedL(); + } + if ( aAttributes & KMPXMediaDrmHasInfoUrl.iAttributeId ) + { + // Not Supported for WMA DRM + } + if ( aAttributes & KMPXMediaDrmHasPreviewUrl.iAttributeId ) + { + // Not Supported for WMA DRM + } + if ( aAttributes & KMPXMediaDrmAboutToExpire.iAttributeId ) + { + GetAboutToExpireL(); + } + } + + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetMediaL() exiting" ); + return *iMedia; + } + +// ---------------------------------------------------------------------------- +// Consumes the rights for the current media according +// to the specified consume type +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaWmaAgent::ConsumeL(TDrmConsumeType /*aType*/) + { + MPX_DEBUG1("CMPXDrmMediaWmaAgent::ConsumeL() entering"); + + // WMA DRM does not have ability to manually control consumption + + MPX_DEBUG1("CMPXDrmMediaWmaAgent::ConsumeL() exiting" ); + } + +// ---------------------------------------------------------------------------- +// Cleans up member variables +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaWmaAgent::Close() + { + MPX_DEBUG1("CMPXDrmMediaWmaAgent::Close() entering"); + + CMPXDrmMediaAgent::Close(); + delete iFileName; + iFileName = NULL; + delete iRightsDescription; + iRightsDescription = NULL; + + MPX_DEBUG1("CMPXDrmMediaWmaAgent::Close() exiting"); + } + +// ---------------------------------------------------------------------------- +// Creates a new media object +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaWmaAgent::CreateMediaL() + { + MPX_DEBUG1("CMPXDrmMediaWmaAgent::CreateMediaL() entering"); + + CMPXDrmMediaAgent::CreateMediaL(); + + // Set the type to WMA + iMedia->SetTObjectValueL( KMPXMediaDrmType, + EMPXDrmTypeWMA ); + + MPX_DEBUG1("CMPXDrmMediaWmaAgent::CreateMediaL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Gets the rights status +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaWmaAgent::GetRightsStatusL() + { + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetRightsStatusL() entering"); + MPX_DEBUG_THREAD("CMPXDrmMediaWmaAgent::GetRightsStatusL()"); + + if ( !iMedia->IsSupported( KMPXMediaDrmRightsStatus )) + { + // Check to make sure it's protected first + if ( !iMedia->IsSupported( KMPXMediaDrmProtected )) + { + GetProtectedL(); + } + TBool prot( iMedia->ValueTObjectL( KMPXMediaDrmProtected )); + MPX_DEBUG2("CMPXDrmMediaWmaAgent::GetRightsStatusL(): prot = %d", prot); + TInt rightsStatus( EMPXDrmRightsFull ); + if ( prot ) + { + TBool canPlay( ETrue ); +#ifndef _DEBUG + User::LeaveIfError( iData->GetAttribute( ECanPlay, canPlay )); +#else + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetRightsStatusL(): Getting ECanPlay"); + TInt playErr( iData->GetAttribute( ECanPlay, canPlay )); + MPX_DEBUG3("CMPXDrmMediaWmaAgent::GetRightsStatusL(): err = %d, canPlay = %d", playErr, canPlay ); + User::LeaveIfError( playErr ); +#endif + if ( !canPlay ) + { + rightsStatus = EMPXDrmRightsExpired; + } + else + { + TBool rightsStateless( ETrue ); + TBool rightsConsumable( EFalse ); +#ifndef _DEBUG + User::LeaveIfError( iData->GetAttribute( + ERightsStateless, + rightsStateless )); + User::LeaveIfError( iData->GetAttribute( + ERightsConsumable, + rightsConsumable )); +#else + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetRightsStatusL(): Getting ERightsStateless"); + TInt statusErr( iData->GetAttribute( + ERightsStateless, + rightsStateless )); + MPX_DEBUG3("CMPXDrmMediaWmaAgent::GetRightsStatusL(): err = %d, rightsStateless = %d", statusErr, rightsStateless ); + User::LeaveIfError( statusErr ); + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetRightsStatusL(): Getting ERightsConsumable"); + TInt conumeableErr( iData->GetAttribute( + ERightsConsumable, + rightsConsumable )); + MPX_DEBUG3("CMPXDrmMediaWmaAgent::GetRightsStatusL(): err = %d, rightsConsumable = %d", conumeableErr, rightsConsumable ); + User::LeaveIfError( conumeableErr ); +#endif + if ( !rightsStateless || rightsConsumable ) + { + rightsStatus = EMPXDrmRightsRestricted; + } + else + { + if ( !iMedia->IsSupported( KMPXMediaDrmRightsType )) + { + GetRightsTypeL(); + } + TInt rightsType( iMedia->ValueTObjectL( + KMPXMediaDrmRightsType )); + if ( EMPXDrmRightsTypeNoRestriction == rightsType ) + { + rightsStatus = EMPXDrmRightsFull; + } + else + { + rightsStatus = EMPXDrmRightsRestricted; + } + } + } + } + iMedia->SetTObjectValueL( KMPXMediaDrmRightsStatus, + rightsStatus ); + MPX_DEBUG2("CMPXDrmMediaWmaAgent::GetRightsStatusL(): setting status = %d", rightsStatus); + } + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetRightsStatusL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Gets the rights type attribute if not already obtained +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaWmaAgent::GetRightsTypeL() + { + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetRightsTypeL() entering"); + MPX_DEBUG_THREAD("CMPXDrmMediaWmaAgent::GetRightsTypeL()"); + + if ( !iMedia->IsSupported( KMPXMediaDrmRightsType )) + { + TInt rightsType( EMPXDrmRightsTypeNoRestriction ); + + if ( GetWmdrmRightsDescriptionL() == KErrNone ) + { + TPtr strPtr( iRightsDescription->Des() ); + TInt end( strPtr.FindF( KMPXWmaDrmDelSemiColon )); + HBufC* licensetype( HBufC::NewLC( KMPXWmaDrmMaxLicenseTypeBufSize )); + TPtr licensetypePtr( licensetype->Des()); + licensetypePtr = strPtr.Mid( + KMPXWmaDrmDelLicensesType().Length(), + end - KMPXWmaDrmDelLicensesType().Length() ); + + if ( licensetypePtr == KMPXWmaDrmDelUnlimited ) + { + rightsType = EMPXDrmRightsTypeNoRestriction; + } + else if ( licensetypePtr == KMPXWmaDrmDelTime ) + { + rightsType = EMPXDrmRightsTypeTime; + } + else if ( licensetypePtr == KMPXWmaDrmDelCount ) + { + rightsType = EMPXDrmRightsTypeCount; + } + else if ( licensetypePtr == KMPXWmaDrmDelDuration ) + { + rightsType = EMPXDrmRightsTypeInterval; + } + else if ( licensetypePtr == KMPXWmaDrmDelTimeCount ) + { + rightsType = EMPXDrmRightsTypeTimeCount; + } + CleanupStack::PopAndDestroy( licensetype ); + } + + iMedia->SetTObjectValueL( KMPXMediaDrmRightsType, + rightsType ); + MPX_DEBUG2("CMPXDrmMediaWmaAgent::GetRightsTypeL() setting type = %d", rightsType); + } + + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetRightsTypeL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Gets the count attribute if not already obtained +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaWmaAgent::GetCountL() + { + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetCountL() entering"); + + // Do not need to check if it already supported, we + // just overwrite the old value if possible + TUint32 count( 0 ); + if ( GetWmdrmRightsDescriptionL() == KErrNone ) + { + TPtr strPtr( iRightsDescription->Des() ); + if ( strPtr.FindF( KMPXWmaDrmDelLicensesType ) == KErrNone ) + { + TInt begin( strPtr.FindF( KMPXWmaDrmDelCountLeft )); + if ( begin != KErrNotFound ) + { + TPtrC countPtr( strPtr.Mid( begin )); + TInt semiLoc( countPtr.Locate( KMPXWmaDrmSemiColonChar )); + TInt countLen( KMPXWmaDrmDelCountLeft().Length() ); + TLex lex( strPtr.MidTPtr( begin + countLen, semiLoc - countLen ) ); + User::LeaveIfError( lex.Val( count, EDecimal ) ); + iMedia->SetTObjectValueL( KMPXMediaDrmCount, + count ); + MPX_DEBUG2("CMPXDrmMediaWmaAgent::GetCountL(): setting count = %d", count); + } + } + } + + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetCountL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Gets the start time attribute if not already obtained +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaWmaAgent::GetStartTimeL() + { + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetStartTimeL() entering"); + + if ( !iMedia->IsSupported( KMPXMediaDrmStartTime )) + { + TTime startTime; + if ( GetWmdrmTimeL( KMPXWmaDrmDelStartTime, startTime ) == + KErrNone ) + { + iMedia->SetTObjectValueL( KMPXMediaDrmStartTime, + startTime.Int64() ); + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetStartTimeL(): setting start time"); + } + } + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetStartTimeL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Gets the end time attribute if not already obtained +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaWmaAgent::GetEndTimeL() + { + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetEndTimeL() entering"); + + if ( !iMedia->IsSupported( KMPXMediaDrmEndTime )) + { + TTime endTime; + if ( GetWmdrmTimeL( KMPXWmaDrmDelEndTime, endTime ) == + KErrNone ) + { + iMedia->SetTObjectValueL( KMPXMediaDrmEndTime, + endTime.Int64() ); + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetEndTimeL(): setting end time"); + } + } + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetEndTimeL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Gets the interval attribute if not already obtained +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaWmaAgent::GetIntervalL() + { + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetIntervalL() entering"); + + if ( !iMedia->IsSupported( KMPXMediaDrmInterval )) + { + if ( GetWmdrmRightsDescriptionL() == KErrNone ) + { + TPtr strPtr( iRightsDescription->Des() ); + if ( strPtr.FindF( KMPXWmaDrmDelLicensesType ) == KErrNone ) + { + TInt begin = strPtr.FindF( KMPXWmaDrmDelDurationLeft ); + if ( begin != KErrNotFound ) + { + TPtrC countPtr = strPtr.Mid( begin ); + TInt semiLoc = countPtr.Locate( KMPXWmaDrmSemiColonChar ); + TInt countLen = KMPXWmaDrmDelDurationLeft().Length(); + TLex lex( strPtr.MidTPtr( begin + countLen, semiLoc - countLen ) ); + TInt interval; + User::LeaveIfError( lex.Val( interval ) ); + TTimeIntervalSeconds intervalSeconds( interval ); + iMedia->SetTObjectValueL( KMPXMediaDrmInterval, + intervalSeconds ); + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetIntervalL(): setting interval"); + } + } + } + } + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetIntervalL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Gets the sending allowed attribute if not already obtained +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaWmaAgent::GetSendingAllowedL() + { + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetSendingAllowedL() entering"); + + if ( !iMedia->IsSupported( KMPXMediaDrmSendingAllowed )) + { + TBool sendingAllowed( ETrue ); +#ifndef _DEBUG + User::LeaveIfError( + iData->GetAttribute( EIsForwardable, sendingAllowed )); +#else + TInt sendErr( iData->GetAttribute( EIsForwardable, sendingAllowed )); + MPX_DEBUG3("CMPXDrmMediaWmaAgent::GetSendingAllowedL(): err = %d, sendingAllowed = %d", sendErr, sendingAllowed); + User::LeaveIfError( sendErr ); +#endif + iMedia->SetTObjectValueL( KMPXMediaDrmSendingAllowed, + sendingAllowed ); + MPX_DEBUG2("CMPXDrmMediaWmaAgent::GetSendingAllowedL(): setting sending allowed = %d", sendingAllowed); + } + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetSendingAllowedL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Gets the can set automated attribute if not already obtained +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaWmaAgent::GetCanSetAutomatedL() + { + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetCanSetAutomatedL() entering"); + + if ( !iMedia->IsSupported( KMPXMediaDrmCanSetAutomated )) + { + TBool automated( ETrue ); + // For WMA DRM files, they can only be set automated if not protected + TBool prot( EFalse ); + if ( !iMedia->IsSupported( KMPXMediaDrmProtected )) + { + GetProtectedL(); + } + prot = iMedia->ValueTObjectL( KMPXMediaDrmProtected ); + if ( prot ) + { + automated = EFalse; + } + + iMedia->SetTObjectValueL( KMPXMediaDrmCanSetAutomated, + automated ); + MPX_DEBUG2("CMPXDrmMediaWmaAgent::GetCanSetAutomatedL(): setting automated = %d", automated); + } + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetCanSetAutomatedL() exiting"); + } + +// ----------------------------------------------------------------------------- +// Get Rights Description String for WMDRM protected files +// ----------------------------------------------------------------------------- +// +TInt CMPXDrmMediaWmaAgent::GetWmdrmRightsDescriptionL() + { + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetWmdrmRightsDescriptionL() entering"); + MPX_DEBUG_THREAD("CMPXDrmMediaWmaAgent::GetWmdrmRightsDescriptionL()"); + TInt error( KErrNotFound ); + + if ( iRightsDescription ) + { + error = KErrNone; + } + else + { + // Currently software is that if no rights available, getting + // rights string will panic PVWMCaf server. To be removed + // if fixed in PV server later + TBool canPlay( ETrue ); +#ifndef _DEBUG + User::LeaveIfError( iData->GetAttribute( ECanPlay, canPlay )); + MPX_DEBUG2("CMPXDrmMediaWmaAgent::GetWmdrmRightsDescriptionL(): canPlay = %d", canPlay); +#else + TInt playErr( iData->GetAttribute( ECanPlay, canPlay )); + MPX_DEBUG3("CMPXDrmMediaWmaAgent::GetWmdrmRightsDescriptionL(): err = %d, canPlay = %d", playErr, canPlay ); + User::LeaveIfError( playErr ); +#endif + if ( iRightsManager && canPlay ) + { + MPX_DEBUG2("CMPXDrmMediaWmaAgent::GetWmdrmRightsDescriptionL(): iFileName = %S", iFileName); + RStreamablePtrArray rightsArray; + CleanupClosePushL( rightsArray ); + TRAPD( err, iRightsManager->ListRightsL( rightsArray, *iFileName )); + if ( KErrNone == err ) + { + if ( rightsArray.Count() > 0 ) + { + ContentAccess::CRightsInfo* rightInfo = rightsArray[0]; + iRightsDescription = rightInfo->Description().AllocL(); + error = KErrNone; + } + } + CleanupStack::PopAndDestroy( &rightsArray ); + } + } +#ifdef _DEBUG + if (!error) + { + MPX_DEBUG2("CMPXDrmMediaWmaAgent::GetWmdrmRightsDescriptionL(): %S", iRightsDescription); + } +#endif + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetWmdrmRightsDescriptionL() exiting"); + return error; + } + +// ----------------------------------------------------------------------------- +// CMPXDrmMediaWmaAgent::GetWmdrmTimeL +// ----------------------------------------------------------------------------- +// +TInt CMPXDrmMediaWmaAgent::GetWmdrmTimeL( + const TDesC& aTimeTypeDelimeter, + TTime& aTime ) + { + MPX_DEBUG2("CMPXDrmMediaWmaAgent::GetWmdrmTimeL(%S) entering", &aTimeTypeDelimeter); + TInt err( KErrNone ); + + if ( GetWmdrmRightsDescriptionL() == KErrNone ) + { + TPtr strPtr( iRightsDescription->Des() ); + err = KErrNotFound; + if ( strPtr.FindF( KMPXWmaDrmDelLicensesType ) == KErrNone ) + { + TInt begin = strPtr.FindF( aTimeTypeDelimeter ); + if ( begin != KErrNotFound ) + { + err = KErrNone; + TPtrC countPtr = strPtr.Mid( begin ); + TInt semiLoc = countPtr.Locate( KMPXWmaDrmSemiColonChar ); + TPtrC timePtr = strPtr.Mid( begin, semiLoc ); + + TInt finddash = timePtr.Locate( KMPXWmaDrmDashChar ); + TInt dashcount = 0; + while ( finddash != KErrNotFound && dashcount < KMPXWmaDrmDashCount ) + { + // after the first dash, subtract 1 from both day and time + // as Jan 01 is represented by 00, 00 in TTime. + ++dashcount; + // convert buffer to TInt and decrement + TLex lex( timePtr.Mid( finddash + 1, KMPXWmaDrmDashCount ) ); + TInt dateInt; + User::LeaveIfError( lex.Val( dateInt ) ); + --dateInt; + // convert back to buffer + HBufC* datebuf = HBufC::NewLC( KMPXWmaDrmMaxTimeBufSize ); + TPtr datebufPtr = datebuf->Des(); + + datebufPtr.Num( dateInt ); + if ( datebufPtr.Length() < KMPXWmaDrmMinutesHourMinSize ) + { + datebufPtr.Insert( 0, KMPXWmaDrmTimeFill ); + } + strPtr.Replace( ( begin + finddash + 1 ), + KMPXWmaDrmMinutesHourMinSize, datebufPtr ); + strPtr.Delete( ( begin + finddash ), 1 ); + finddash = timePtr.Locate( KMPXWmaDrmDashChar ); + CleanupStack::PopAndDestroy( datebuf ); + } + + // Format time to correspond TTime time + TInt findTdelim = timePtr.Locate( KMPXWmaDrmTChar ); + if ( findTdelim != KErrNone ) + { + TInt findcolon = timePtr.Locate( KMPXWmaDrmColonChar ); + while ( findcolon != KErrNotFound ) + { + strPtr.Delete( ( begin + findcolon ), 1 ); + findcolon = timePtr.Locate( KMPXWmaDrmColonChar ); + } + } + + strPtr.Replace( ( begin + findTdelim), 1, KMPXWmaDrmDelColon ); + + // have removed desired characters from time, now isolate them. + TInt end = timePtr.Locate( KMPXWmaDrmPeriodChar ); + if ( end == KErrNotFound ) + { + // no milliseconds, look for time zone indicator +, -, or Z + end = timePtr.Locate( KMPXWmaDrmZChar ); + if ( end == KErrNotFound ) + { + end = timePtr.Locate( KMPXWmaDrmDashChar ); + if ( end == KErrNotFound ) + { + end = timePtr.Locate( KMPXWmaDrmPlusChar ); + } + } + } + TInt delimLen = aTimeTypeDelimeter.Length(); + aTime.Set( strPtr.MidTPtr( begin + delimLen , end - delimLen ) ); + } + } + } + else + { + err = KErrNotFound; + } + + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetWmdrmTimeL() exiting"); + return err; + } + +// ---------------------------------------------------------------------------- +// Gets whether the DRM object is about to expire or not +// ---------------------------------------------------------------------------- +// +void CMPXDrmMediaWmaAgent::GetAboutToExpireL() + { + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetAboutToExpireL() entering"); + + TBool aboutToExpire( EFalse ); + + // Currently WMDRM does not use about to expire + + iMedia->SetTObjectValueL( KMPXMediaDrmAboutToExpire, + aboutToExpire ); + + MPX_DEBUG1("CMPXDrmMediaWmaAgent::GetAboutToExpireL() exiting"); + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxfixedarray.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxfixedarray.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2006 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: Implementation of array of fixed size elements on global chunk +* +*/ + +#include "mpxfixedarray.h" +#include "mpxheapmanager.h" + + +// ----------------------------------------------------------------------------- +// RMPXFixedArrayBase::RMPXFixedArrayBase +// ----------------------------------------------------------------------------- +// +RMPXFixedArrayBase::RMPXFixedArrayBase() + { + } + +// ----------------------------------------------------------------------------- +// RMPXFixedArrayBase::RMPXFixedArrayBase +// ----------------------------------------------------------------------------- +// +RMPXFixedArrayBase::RMPXFixedArrayBase(const RMPXFixedArrayBase& aArray) + : iCount(0),iDataOffset(0),iElementSize(aArray.iElementSize) + { + (void)Copy(RMPXHeapManager::ClientHandle(),aArray); + } + +// ----------------------------------------------------------------------------- +// RMPXFixedArrayBase::Set +// ----------------------------------------------------------------------------- +// +TInt RMPXFixedArrayBase::Copy(TUint aClientHandle,const RMPXFixedArrayBase& aArray) + { + MPX_ASSERT(aArray.iElementSize&&aArray.iCount&&aArray.iDataOffset&&aClientHandle); + // + Reset(aClientHandle); // Clears any current values + TInt size=aArray.iElementSize*aArray.iCount; + RMPXHeapManager& m=RMPXHeapManager::HeapManager(aClientHandle); + TInt r=m.Copy(aClientHandle,aArray.iDataOffset,size); + if (r>0) // Its an offset + { + iDataOffset=r; + iCount=aArray.iCount; + iElementSize=aArray.iElementSize; + } + // else the members are zero from Reset() + return iDataOffset?KErrNone:KErrNoMemory; + } + +// ----------------------------------------------------------------------------- +// RMPXFixedArrayBase::RMPXFixedArrayBase +// ----------------------------------------------------------------------------- +// +RMPXFixedArrayBase::RMPXFixedArrayBase(TInt aElementSize) + : iCount(0),iDataOffset(0),iElementSize(aElementSize) + { + } + +// ----------------------------------------------------------------------------- +// RMPXFixedArrayBase::Reset +// ----------------------------------------------------------------------------- +// +void RMPXFixedArrayBase::Reset(TUint aClientHandle) + { + if (iDataOffset) + { + TAny* buf=RMPXHeapManager::Ptr(aClientHandle,iDataOffset); + RMPXHeapManager::HeapManager(aClientHandle).Free(aClientHandle,buf); + iDataOffset=0; + iCount=0; + } + } + +// ----------------------------------------------------------------------------- +// RMPXFixedArrayBase::Alloc +// ----------------------------------------------------------------------------- +// +TAny* RMPXFixedArrayBase::Alloc(TUint aClientHandle,TInt aCount) + { + Reset(aClientHandle); // Clear previous values + TInt size=iElementSize*aCount; + TAny* ptr=RMPXHeapManager::HeapManager(aClientHandle).Alloc(aClientHandle,size); + if (ptr) + { + iDataOffset=RMPXHeapManager::Offset(aClientHandle,ptr); + iCount=aCount; + } + return ptr; + } + +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxheapmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxheapmanager.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,662 @@ +/* +* Copyright (c) 2006 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: Implementation of heap manager +* +*/ + +#include +#include +#include +#include +#include +#include "mpxheapmanager.h" + +_LIT(KMPXChunkNameV2,"MPX_DATA"); +_LIT(KMPXMutexNameV2,"MPX_MUTEX"); + +const TInt KMPXBytesPerMB = 0x100000; // bytes of 1 MB, 1024*1024 +#ifdef __WINS__ +const TInt KMPXMaxHeapDefaultSize=8; // MB +#else +const TInt KMPXMaxHeapDefaultSize=15; // MB +#endif +const TInt KMPXMinHeapSize=0x10000; // 64KB +const TInt KMPXChunkAdjustSize=0x40000; // 256KB +#ifdef __ENABLE_MPX_GARBAGE_COLLECTOR +const TInt KMPXGarbageCollectorClientThreshold=1000;//GC +#endif // __ENABLE_MPX_GARBAGE_COLLECTOR + +#define MPX_NEXT_CELL(p) ((RMPXHeapCell*)(((TUint8*)p)+p->iLen)) +#define MPX_NEXT_FREE_CELL(ch,p) (p->iNextOffset?Ptr(ch, p->iNextOffset):NULL) + +// ----------------------------------------------------------------------------- +// RMPXHeapManager::TClientContext::TClientContext +// ----------------------------------------------------------------------------- +// +RMPXHeapManager::TClientContext::TClientContext() + : iTid(KNullThreadId),iCount(0),iBase(0) + { + } + +// ----------------------------------------------------------------------------- +// RMPXHeapManager::TClientContext::TClientContext +// ----------------------------------------------------------------------------- +// +RMPXHeapManager::TClientContext::TClientContext( + TUint8* aBase, + TInt aChunkHandle, + TInt aMutexHandle) : + iTid(RThread().Id()), + iCount(0), + iBase(aBase) + { + iChunk.SetHandle(aChunkHandle); + iMutex.SetHandle(aMutexHandle); + } + +// ----------------------------------------------------------------------------- +// RMPXHeapManager::RMPXHeapManager +// ----------------------------------------------------------------------------- +// +RMPXHeapManager::RMPXHeapManager(const RChunk& aChunk) + : iEndOffset(aChunk.Size()),iCounter(0) +#ifdef __ENABLE_MPX_GARBAGE_COLLECTOR + ,iDeadContextIndex(KErrNotFound) +#endif // __ENABLE_MPX_GARBAGE_COLLECTOR + { + TInt hmSize = sizeof(RMPXHeapManager); + MPX_ASSERT_WORD_ALIGNED(aChunk.Base()+hmSize); + // + // Create first free heap cell + // + RMPXHeapCell* cell=new(aChunk.Base()+hmSize)RMPXHeapCell(0,iEndOffset-hmSize); + // set up free cell list header + iFree.iNextOffset = hmSize; + iFree.iLen = 0; + iUsedMemory = hmSize; + } + +// ----------------------------------------------------------------------------- +// RMPXHeapManager::HeapMemoryInfoL +// ----------------------------------------------------------------------------- +// +void RMPXHeapManager::HeapMemoryInfoL(TInt& aTotal, TInt& aUsed) + { + TUint h = RMPXHeapManager::ClientHandle(); + if (!h) + { + User::Leave(KErrNotFound); + } + RMPXHeapManager& hm = RMPXHeapManager::HeapManager(h); + aUsed = hm.iUsedMemory; + HAL::Get(HALData::EMemoryRAMFree, aTotal); + aTotal +=aUsed; + if (aTotal > hm.iMaxMemory) + { + aTotal = hm.iMaxMemory; + } + } + +// ----------------------------------------------------------------------------- +// RMPXHeapManager::ClientHandle +// ----------------------------------------------------------------------------- +// +TUint RMPXHeapManager::ClientHandle() + { + // First, try to retrieve the handle from TLS. Although slow, this seems to be + // faster than openeing the chunk, though probably requires further testing. It + // will be in TLS if another client from this thread has previously called this + // method + // + TUint h=(TUint)Dll::Tls(); + RMPXHeapManager* m=NULL; + if (h==0) + { + // Must be first client in this thread, so try opening the chunk, but + // first, create a "critical section" on this code to protect against multiple + // threads creating the chunk/heap at the same time + // + RMutex mx; + TInt n=2; + TInt r=KErrNotFound; + while(r!=KErrNone && n--) + { + r=mx.OpenGlobal(KMPXMutexNameV2,EOwnerThread); + if (r==KErrNotFound) + { + r=mx.CreateGlobal(KMPXMutexNameV2,EOwnerThread); + } + }; + if (r==KErrNone) + { + mx.Wait(); + // + TUint8* base=NULL; + RChunk c; + r=c.OpenGlobal(KMPXChunkNameV2,EFalse,EOwnerThread); + if (r==KErrNotFound) + { + // Chunk not there, so this must be the first client in the system and so + // the chunk must be created + // + // Get maximum size of memory from CenRep key + CRepository* rep(NULL); + // Set to default size + TInt maxMemory = KMPXMaxHeapDefaultSize; + TRAP_IGNORE(rep = CRepository::NewL( KCRUidMPXSettings )); + if (rep) + { + rep->Get( KMPXMaxGlobalHeapSize, maxMemory ); + delete rep; + } + // size in bytes + maxMemory *= KMPXBytesPerMB; + r=c.CreateGlobal(KMPXChunkNameV2,0,maxMemory,EOwnerThread); + if (r==KErrNone && c.Adjust(KMPXMinHeapSize)==KErrNone) + { + base=c.Base(); + // + // Add the Heap Manager and the bottom of the chunk. Thereafter will come the + // data + // + MPX_ASSERT(sizeof(RMPXHeapManager)iMaxMemory = maxMemory; + } + } + if (r==KErrNone) + { + if (!base) + { + base=c.Base(); + } + m=reinterpret_cast(base); + TClientContext cc(base,c.Handle(),mx.Handle()); + TInt index=m->ClientIndex(cc); + h=ClientHandle(base,index); + Dll::SetTls((TAny*)h); + mx.Signal(); + } + else + { + c.Close(); + mx.Signal(); + mx.Close(); + m=NULL; + } + } + } + MPX_ASSERT(h); + return h; + } + +// ----------------------------------------------------------------------------- +// RMPXHeapManager::Find +// ----------------------------------------------------------------------------- +// +TInt RMPXHeapManager::Find(const TThreadId& aTid) + { + TInt r=KErrNotFound; + for (TInt i=0;i=0); // Run out of space (num threads > ENumClients) + iClients[i]=aContext; + } + return i; + } + +// ----------------------------------------------------------------------------- +// RMPXHeapManager::AddRef +// ----------------------------------------------------------------------------- +// +void RMPXHeapManager::AddRef(TUint aClientHandle) + { + MPX_ASSERT(aClientHandle); + TClientContext& c=iClients[ClientIndex(aClientHandle)]; + ++c.iCount; +#ifdef __ENABLE_MPX_GARBAGE_COLLECTOR + if (iCounter%KMPXGarbageCollectorClientThreshold==0 && iCounter) + {//GC + RunGc(aClientHandle); + } +#endif // __ENABLE_MPX_GARBAGE_COLLECTOR + } + +// ----------------------------------------------------------------------------- +// RMPXHeapManager::Release() +// ----------------------------------------------------------------------------- +// +void RMPXHeapManager::Release(TUint aClientHandle) + { + MPX_ASSERT(aClientHandle); + TClientContext& c=iClients[ClientIndex(aClientHandle)]; + if (--c.iCount==0) + { +#ifdef __ENABLE_MPX_GARBAGE_COLLECTOR + c.iData.Close(aClientHandle); //GC +#endif // __ENABLE_MPX_GARBAGE_COLLECTOR + c.iTid=KNullThreadId; // Mark as free + c.iMutex.Close(); + c.iChunk.Close(); + Dll::SetTls(NULL); + } + } + +// ----------------------------------------------------------------------------- +// RMPXHeapManager::HeapCell +// ----------------------------------------------------------------------------- +// +RMPXHeapCell* RMPXHeapManager::HeapCell( + TUint aClientHandle, + TInt aSize) + { + aSize = Align4(aSize + EHeapCellHeaderSize); + RMPXHeapCell* lastFree(NULL); + RMPXHeapCell* cell = DoHeapCell(aClientHandle, aSize, lastFree); + if (!cell) + { // try to grow chunk + TInt r = TryToGrowHeap(aClientHandle, aSize, lastFree); + if (KErrNone == r) + { + cell = DoHeapCell(aClientHandle, aSize, lastFree); + } + } + if (cell) + { + iUsedMemory += (cell->iLen); + } + return cell; + } + +// ----------------------------------------------------------------------------- +// RMPXHeapManager::HeapCell +// ----------------------------------------------------------------------------- +// +RMPXHeapCell* RMPXHeapManager::DoHeapCell( + TUint aClientHandle, + TInt aSize, + RMPXHeapCell*& aLastFree) + { + // + // Start with the first cell and walk the heap until a free cell is found which + // is big enough + // + RMPXHeapCell* prevCell = &iFree; + RMPXHeapCell* cell = MPX_NEXT_FREE_CELL(aClientHandle, prevCell); + TInt tempOffset(0); + for (; cell; prevCell=cell, cell=MPX_NEXT_FREE_CELL(aClientHandle, cell)) + { // scan the free list + //cell is valid and free + if (cell->iLen >= aSize) + { // size is big enough + if (cell->iLen-aSize < EMinCellSize) // leftover must larger enough to split + { // it isn't, so take it all + aSize = cell->iLen; + tempOffset = cell->iNextOffset; + MPX_ASSERT(tempOffset <= iEndOffset - EMinCellSize); + } + else + { // Take amount and create a new free cell + tempOffset = Offset(aClientHandle, cell) + aSize; + MPX_ASSERT(tempOffset <= iEndOffset - EMinCellSize); + // create a new cell + new(Ptr(aClientHandle,tempOffset)) + RMPXHeapCell(cell->iNextOffset, cell->iLen - aSize); + } + prevCell->iNextOffset = tempOffset; + cell->iLen = aSize; + return cell; + } + } + aLastFree = prevCell; + return NULL; + } + +TInt RMPXHeapManager::TryToGrowHeap( + TUint aClientHandle, + TInt aSize, + RMPXHeapCell* aLastFree) + { + TBool atEnd = IsLastCell(aClientHandle, aLastFree); + TInt grow=Max((TInt)KMPXChunkAdjustSize, aSize); + // Grow the chunk + TClientContext& cc=iClients[ClientIndex(aClientHandle)]; + TInt r(KErrNoMemory); + if (iEndOffset+grow <= iMaxMemory) + { + r=cc.iChunk.Adjust(iEndOffset+grow); + if (KErrNone == r) + { + if (atEnd) + { + aLastFree->iLen += grow; + } + else + { // create a new free cell + new (Ptr(aClientHandle, iEndOffset))RMPXHeapCell(0, grow); + aLastFree->iNextOffset = iEndOffset; + } + iEndOffset=cc.iChunk.Size(); + } + else + { + MPX_DEBUG2("RMPXHeapManager::HeapCell chunk failed to grow %d", r); + } + } + return r; + } + +// ----------------------------------------------------------------------------- +// RMPXHeapManager::ClientCount +// ----------------------------------------------------------------------------- +// +TInt RMPXHeapManager::ClientCount() const + { + TInt c=0; + for (TInt i=0;i(aClientHandle,offset); + MPX_ASSERT(ptr); + MPX_ASSERT_WORD_ALIGNED(ptr); + } + return ptr; + } + +// ----------------------------------------------------------------------------- +// Copy a buffer on the chunk +// ----------------------------------------------------------------------------- +// +TInt RMPXHeapManager::Copy(TUint aClientHandle,TAny* aSrc,TInt aSize) + { + TInt r=KErrNoMemory; + TAny* ptr=Alloc(aClientHandle,aSize); + if (ptr) + { + (void)Mem::Copy(ptr,aSrc,aSize); + r=RMPXHeapManager::Offset(aClientHandle,ptr); + } + return r; + } + +// ----------------------------------------------------------------------------- +// Frees a pointer on the chunk +// ----------------------------------------------------------------------------- +// +TInt RMPXHeapManager::Free(TUint aClientHandle,TAny* aPtr) + { + TInt cellOffset=RMPXHeapManager::Offset(aClientHandle, aPtr)-sizeof(RMPXHeapCell); + RMPXHeapCell* cell = Ptr(aClientHandle,cellOffset); + RMPXHeapCell* prevCell = &iFree; + RMPXHeapCell* tempCell = MPX_NEXT_FREE_CELL(aClientHandle, prevCell); + RMPXHeapCell* nextCell(NULL); + TInt size = cell->iLen; + // find the position in the list for the new free cell + for (; tempCell && tempCelliLen += tempCell->iLen; + cell->iNextOffset = tempCell->iNextOffset; + } + else + { + cell->iNextOffset = RMPXHeapManager::Offset(aClientHandle, tempCell); + } + } + else + { + cell->iNextOffset = 0; // No following free cell + } + + nextCell = MPX_NEXT_CELL(prevCell); + if (nextCell==cell) // Is it adjacent + { + prevCell->iLen += cell->iLen; + prevCell->iNextOffset = cell->iNextOffset; + cell = prevCell; + } + else + { + prevCell->iNextOffset = RMPXHeapManager::Offset(aClientHandle, cell); + } + + iUsedMemory -= size; + MPX_ASSERT(iUsedMemory > 0); + // Shrink chunk + // How big is the chunk now + // + // TInt gap=last->iBufOffset+last->iBufLen-iEndOffset; + //if (gap>2*KMPXChunkAdjustSize) + // { + // We assume that a spare capacity of KMPXChunkAdjustSize bytes + // is all we need, so if we have more we can shrink the chunk + // + // TClientContext& cc=iClients[ClientIndex(aClientHandle)]; + // cc.iChunk.Adjust(iEndOffset-KMPXChunkAdjustSize); + // iEndOffset=cc.iChunk.Size(); + // } + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// RMPXHeapManager::Lock +// ----------------------------------------------------------------------------- +// +void RMPXHeapManager::Lock(TUint aClientHandle) + { + MPX_ASSERT(aClientHandle); + TClientContext& cc=iClients[ClientIndex(aClientHandle)]; + cc.iMutex.Wait(); + } + +// ----------------------------------------------------------------------------- +// RMPXHeapManager::Unlock +// ----------------------------------------------------------------------------- +// +void RMPXHeapManager::Unlock(TUint aClientHandle) + { + MPX_ASSERT(aClientHandle); + TClientContext& cc=iClients[ClientIndex(aClientHandle)]; + cc.iMutex.Signal(); + } + +// ----------------------------------------------------------------------------- +// RMPXHeapManager::Counter +// ----------------------------------------------------------------------------- +// +TInt RMPXHeapManager::IncrementCounter() + { + MPX_DEBUG3("RMPXHeapManager::Counter 0x%08x, count %d", this, iCounter); + return ++iCounter; + } + +// ----------------------------------------------------------------------------- +// RMPXHeapManager::IsLastCell +// ----------------------------------------------------------------------------- +// +TBool RMPXHeapManager::IsLastCell( + TUint aClientHandle, + RMPXHeapCell* aCell) + { + return (RMPXHeapManager::Offset(aClientHandle, aCell) + aCell->iLen) == iEndOffset; + } + +#ifdef __ENABLE_MPX_GARBAGE_COLLECTOR +// ----------------------------------------------------------------------------- +// Cleans up any objects associated with threads that have died +// ----------------------------------------------------------------------------- +// +void RMPXHeapManager::RunGc(TUint aClientHandle) + {//GC + MPX_FUNC("RMPXHeapManager::RunGc"); + RThread t; + for (TInt i=0;i=0) + { + RMPXDataObject* d= + (RMPXDataObject*)c.iData.DataItem(aClientHandle,j); + TUint* dataHandle=d->Object(aClientHandle); + MMPXData* data=MMPXData::Data(aClientHandle, *dataHandle); + iDeadContextIndex=i; + data->Release(aClientHandle); + iDeadContextIndex=KErrNotFound; + j = c.iData.Count()-1; + } + + // Now remove context, now that we've cleaned up its data + // + c.iTid=KNullThreadId; // Mark as free + c.iData.Close(aClientHandle); + } + } + } + } + } + +// ----------------------------------------------------------------------------- +// RMPXHeapManager::AddData +// ----------------------------------------------------------------------------- +// +TInt RMPXHeapManager::AddData(TUint aClientHandle,TUint aDataHandle) + { //GC + TAny* ptr =Alloc(aClientHandle, sizeof(RMPXDataObject)); + TInt r(KErrNone); + if (ptr) + { + RMPXDataObject* obj=new(ptr)RMPXDataObject(); + obj->CopyObject(aClientHandle,aDataHandle); + TClientContext& c=iClients[ClientIndex(aClientHandle)]; + c.iData.Append(aClientHandle,*obj); + } + else + { + r = KErrNoMemory; + } + return r; + } + +// ----------------------------------------------------------------------------- +// RMPXHeapManager::RemoveData +// ----------------------------------------------------------------------------- +// +TInt RMPXHeapManager::RemoveData( + TUint aClientHandle, + TUint aDataHandle, + TBool aRemoveAll) + {//GC + RMPXDataObject obj; + obj.CopyObject(aClientHandle,aDataHandle); + TInt clientIndex = ClientIndex(aClientHandle); + TInt ret(KErrNotFound); + + if (aRemoveAll && iDeadContextIndex==KErrNotFound) + { // remove all and GC is not running + for (TInt i=0;i +#include +#include "mpxmedia.h" +#include "mpxmediaarray.h" +#include "mpxcollectionpath.h" + +// ----------------------------------------------------------------------------- +// CMPXMedia::NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXMedia* CMPXMedia::NewL() + { + CMPXMedia* m=new(ELeave)CMPXMedia(); + CleanupStack::PushL(m); + m->CMPXMediaBase::ConstructL(); + CleanupStack::Pop(m); + return m; + } + +// ----------------------------------------------------------------------------- +// CMPXMedia::NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXMedia* CMPXMedia::NewL(const TArray& aSupportedIds) + { + CMPXMedia* m=new(ELeave)CMPXMedia(); + CleanupStack::PushL(m); + m->ConstructL(aSupportedIds); + CleanupStack::Pop(m); + return m; + } + +// ----------------------------------------------------------------------------- +// CMPXMedia::NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXMedia* CMPXMedia::NewL(RReadStream& aStream) + { + CMPXMedia* m=new(ELeave)CMPXMedia(); + CleanupStack::PushL(m); + m->ConstructL(aStream); + CleanupStack::Pop(m); + return m; + } + +// ----------------------------------------------------------------------------- +// CMPXMedia::NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXMedia* CMPXMedia::NewL(TInt aDataHandle) + + { + CMPXMedia* m=new(ELeave)CMPXMedia(); + CleanupStack::PushL(m); + m->CMPXMediaBase::ConstructL(aDataHandle); + CleanupStack::Pop(m); + return m; + } + +// ----------------------------------------------------------------------------- +// CMPXMedia::NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXMedia* CMPXMedia::NewL(const CMPXMedia& aMedia) + { + CMPXMedia* m=new(ELeave)CMPXMedia(); + CleanupStack::PushL(m); + m->CMPXMediaBase::ConstructL(aMedia); + CleanupStack::Pop(m); + return m; + } + +// ----------------------------------------------------------------------------- +// CMPXMedia::CopyL +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXMedia* CMPXMedia::CopyL(const CMPXMedia& aMedia) + { + CMPXMedia* m=new(ELeave)CMPXMedia(); + CleanupStack::PushL(m); + m->CopyConstructL(aMedia); + CleanupStack::Pop(m); + return m; + } + +// ---------------------------------------------------------------------------- +// Overloaded assignment operator +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXMedia& CMPXMedia::operator=(const CMPXMedia& aMedia) + { +// MPX_FUNC_EX("CMPXMedia::operator=()"); + MPX_ASSERT(aMedia.iData&&aMedia.iDataHandle); + MPX_ASSERT(iClientHandle); + // + if (this!=&aMedia) + { + Clear(); + iDataHandle=aMedia.iDataHandle; + iData=aMedia.iData; + iData->AddRef(iClientHandle); + } // otherwise assign itself + return *this; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXMedia::~CMPXMedia() + { + iAttributes.Close(); + } + +// ----------------------------------------------------------------------------- +// CMPXMedia::HeapMemoryInfoL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXMedia::HeapMemoryInfoL( TInt& aTotal, TInt& aUsed ) + { + return MMPXData::HeapMemoryInfoL( aTotal, aUsed); + } + +// ----------------------------------------------------------------------------- +// Externalize +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXMedia::ExternalizeL(RWriteStream& aStream) const + { + DoExternalizeL(aStream,MMPXData::EMedia); + } + +// ----------------------------------------------------------------------------- +// Internalize +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXMedia::InternalizeL(RReadStream& aStream) + { + DoInternalizeL(aStream,MMPXData::EMedia); + } + +// ----------------------------------------------------------------------------- +// Clears data +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXMedia::Reset() + { +// MPX_FUNC_EX("CMPXMedia::Reset()"); + MPX_ASSERT(iClientHandle&&iData); + // + ResetLocal(); // Local data + iData->Reset(iClientHandle); // Clears heap data for this object + } + +// ----------------------------------------------------------------------------- +// Possible content IDs that denote the type of content the source of this +// object can supply; +// ----------------------------------------------------------------------------- +// +EXPORT_C const TArray CMPXMedia::SupportedIds() const + { + MPX_ASSERT(iClientHandle&&iData); + return iData->SupportedIds(iClientHandle); + } + +// ----------------------------------------------------------------------------- +// The attributes provided in this media object +// ----------------------------------------------------------------------------- +// +EXPORT_C const TArray CMPXMedia::Attributes() const + { + const_cast(this)->RefreshAttributes(); + return iAttributes.Array(); + } + +// ----------------------------------------------------------------------------- +// Does this object contain the value for a given attribute +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CMPXMedia::IsSupported(const TMPXAttribute& aAttribute) const + { + MPX_ASSERT(iClientHandle&&iData); + return KErrNotFound!=iData->Index(iClientHandle,aAttribute); + } + +// ----------------------------------------------------------------------------- +// The number of attribute values provided in this media object +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXMedia::Count() const + { + return CMPXMediaBase::Count(); + } + +// ----------------------------------------------------------------------------- +// The attribute for a specific index +// ----------------------------------------------------------------------------- +// +EXPORT_C const TMPXAttribute& CMPXMedia::Attribute(TInt aIndex) const + { + MPX_ASSERT(iClientHandle&&iData); + MPX_ASSERT(aIndex>=0&&aIndexAttribute(iClientHandle,aIndex); + } + +// ----------------------------------------------------------------------------- +// The attributes set for a specific content +// ----------------------------------------------------------------------------- +// +EXPORT_C TUint CMPXMedia::AttributesSet(TInt aContentId) const + { + const_cast(this)->RefreshAttributes(); + TUint attributesSet(0); + for (TInt i=iAttributes.Count();--i>=0;) + { + TMPXAttribute attr(iAttributes[i]); + if (attr.ContentId()==aContentId) + { + attributesSet|=attr.AttributeId(); + } + } + return attributesSet; + } + +// ----------------------------------------------------------------------------- +// The index of a given attribute +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXMedia::Index(const TMPXAttribute& aAttribute) const + { + MPX_ASSERT(iClientHandle&&iData); + return iData->Index(iClientHandle,aAttribute); + } + +// ----------------------------------------------------------------------------- +// The type of data stored for the attribute +// ----------------------------------------------------------------------------- +// +EXPORT_C TMPXAttributeType CMPXMedia::Type(TInt aIndex) const + { + MPX_ASSERT(iClientHandle&&iData); + MPX_ASSERT(aIndex>=0&&aIndexAttributeType(iClientHandle,aIndex); + } + +// ----------------------------------------------------------------------------- +// The type of data stored for the attribute +// ----------------------------------------------------------------------------- +// +EXPORT_C TMPXAttributeType CMPXMedia::Type(const TMPXAttribute& aAttribute) const + { + MPX_ASSERT(iClientHandle&&iData); + TMPXAttributeType type(EMPXTypeUnknown); + TInt index(Index(aAttribute)); + if (KErrNotFound!=index) + { + type = Type(index); + } + return type; + } + +// ----------------------------------------------------------------------------- +// The value for a specific attribute +// ----------------------------------------------------------------------------- +// +EXPORT_C const TDesC& CMPXMedia::ValueText(const TMPXAttribute& aAttribute) const + { + TPtrC* text=Value(aAttribute); + return text?(const TDesC&)*text:KNullDesC; + } + +// ----------------------------------------------------------------------------- +// Add a new attribute value to this object, or modifies existing +// value if already present +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXMedia::SetTextValueL( + const TMPXAttribute& aAttribute, + const TDesC& aValue) + { + TPtrC8 data((TUint8*)aValue.Ptr(),aValue.Size()); + SetValueL(aAttribute,data,EMPXTypeText); + } + +// ----------------------------------------------------------------------------- +// Merges in the attributes of the provided media +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXMedia::MergeMediaL( const CMPXMedia& aMedia ) + { + // Do not merge the same data handle + if( Data() != aMedia.Data() ) + { + for ( TInt i = 0; i < aMedia.Count(); i++ ) + { + TMPXAttributeType type( aMedia.Type( i )); + TMPXAttribute att( aMedia.Attribute( i )); + // Need to handle text differently since it's + // possible to have KNullDesC, which will result + // in an invalid TPtrC. + if ( EMPXTypeText == type ) + { + const TDesC& t( aMedia.ValueText( att )); + if ( t == KNullDesC ) + { + // Cannot use reference to KNullDesC, must + // use the literal directly. + SetTextValueL( att, KNullDesC ); + } + else + { + SetTextValueL( att, t ); + } + } + else + { + TPtrC8 ptr( aMedia.iData->Value( aMedia.iClientHandle, i )); + SetValueL( att, ptr, type ); + } + } + } + } + +// ----------------------------------------------------------------------------- +// Compares if the specified media's attribute matches this one +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool CMPXMedia::Match( + const CMPXMedia& aMedia, + const TMPXAttribute& aAtt ) + { + TBool result( EFalse ); + TInt myIndex( Index( aAtt )); + if ( KErrNotFound != myIndex ) + { + TInt index( aMedia.Index( aAtt )); + if ( KErrNotFound != index ) + { + if ( Type( myIndex ) == aMedia.Type( index )) + { + TPtrC8 myPtr( iData->Value( iClientHandle, myIndex )); + TPtrC8 ptr( aMedia.iData->Value( aMedia.iClientHandle, index )); + result = ( myPtr == ptr ); + } + } + } + return result; + } + +// ----------------------------------------------------------------------------- +// CMPXMedia::Delete +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXMedia::Delete(const TMPXAttribute& aAttribute) + { +// MPX_FUNC_EX("CMPXMedia::Delete(const TMPXAttribute& aAttribute)"); + Delete(iData->Index(iClientHandle,aAttribute)); + } + +// ----------------------------------------------------------------------------- +// CMPXMedia::Delete +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXMedia::Delete(TInt aIndex) + { +// MPX_FUNC_EX("CMPXMedia::Delete(TInt aIndex)"); + if (KErrNotFound != aIndex) + { + MPX_ASSERT(aIndex>=0&&aIndexDelete(iClientHandle,aIndex); + } // do nothing. the same behaviour as the v1 although it should panic + } + +// ----------------------------------------------------------------------------- +// CMPXMedia::ConstructL +// ----------------------------------------------------------------------------- +// +void CMPXMedia::ConstructL(const TArray& aSupportedIds) + { + CMPXMediaBase::ConstructL(); + User::LeaveIfError(iData->SetSupportedIds(iClientHandle,aSupportedIds)); + } + +// ----------------------------------------------------------------------------- +// CMPXMedia::ConstructL +// ----------------------------------------------------------------------------- +// +void CMPXMedia::ConstructL(RReadStream& aStream) + { + MPX_ASSERT(!iData&&!iDataHandle); + InternalizeL(aStream); + } + +// ----------------------------------------------------------------------------- +// CMPXMedia::SetValueL +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXMedia::SetValueL( + const TMPXAttribute& aAttribute, + const TDesC8& aValue, + TMPXAttributeType aType) + { + MPX_ASSERT(iData&&iClientHandle); + // + LockHeapLC(); + TInt i=iData->Index(iClientHandle,aAttribute); + if (i==KErrNotFound) + { + User::LeaveIfError(iData->Append(iClientHandle,aAttribute,aType,aValue)); + } + else + { + DeleteLocal(i); + iData->Set(iClientHandle,aAttribute,aType,aValue,i); + } + CleanupStack::PopAndDestroy(); //unlock heap + } + +// ----------------------------------------------------------------------------- +// CMPXMedia::ValuePtr. Returns NULL if (a) there is no such object with the +// given attribute; (b) object cannot be created (e.g. no memory); (c) it's an +// arbitrary CBase object (only CMPXMedia, CMPXMediaArray, and CMPXCollectionPath +// are supported. Otherwise, returns a pointer to the object which is also stored +// locally +// ----------------------------------------------------------------------------- +// +EXPORT_C TAny* CMPXMedia::ValuePtr(const TMPXAttribute& aAttribute) const + { + MPX_ASSERT(iData&&iClientHandle); + MMPXData::LockHeap( iClientHandle ); + TAny* obj=NULL; + TInt index=iData->Index(iClientHandle,aAttribute); + TMPXAttributeType type=EMPXTypeUnknown; + + if (index!=KErrNotFound) // Check if the value exist or not + { + type=iData->AttributeType(iClientHandle,index); + // Check local values to see if there and current + // + TInt uid=iData->Uid(iClientHandle,index); + const TValue* v=LocalValue(uid); + if (!v) + { + TPtrC8 data=iData->Value(iClientHandle,index); + TInt size=data.Size(); + const TAny* ptr=data.Ptr(); + // + switch(type) + { + case EMPXTypeText: + obj=new TPtrC((TUint16*)ptr,size/2); + break; + // + case EMPXTypeCObject: + TRAP_IGNORE(obj=ValueCObjectL(data)); + break; + // + case EMPXTypeError: // Error type is TInt, flow down + case EMPXTypeTObject: + // + // Create a decriptor pointing to the data. But the pointer + // within the descriptor must be returned by this method + // + obj=new TPtrC8((TUint8*)ptr,size); + break; + // + default: + MPX_ASSERT(0); + break; + } + if (obj) + { + CMPXMedia& theMedia=*const_cast(this); + TInt err=theMedia.SetLocal(TValue(obj,uid,type)); // Add new one + if (err!=KErrNone) + { + theMedia.DeletePtr(obj,type); + obj=NULL; + } + } + } + else + { + obj=v->iValue; + } + } + MMPXData::UnlockHeap(iClientHandle); + return (type==EMPXTypeTObject||type==EMPXTypeError)?(obj?(TAny*)static_cast(obj)->Ptr():NULL):obj; + } + +EXPORT_C TMPXAttributeType CMPXMedia::GetValue(const TMPXAttribute& aAttribute, TDes8& aValue) const + { + MPX_ASSERT(iData&&iClientHandle); + MMPXData::LockHeap( iClientHandle ); + TInt index=iData->Index(iClientHandle,aAttribute); + TMPXAttributeType type=EMPXTypeUnknown; + + if (index!=KErrNotFound) // Check if the value exist or not + { + type=iData->AttributeType(iClientHandle,index); + aValue = iData->Value(iClientHandle,index).Left(aValue.MaxLength()); + } + MMPXData::UnlockHeap(iClientHandle); + return type; + } + +// ----------------------------------------------------------------------------- +// CMPXMedia::RefreshAttributes +// ----------------------------------------------------------------------------- +// +void CMPXMedia::RefreshAttributes() + { + // Reconstructs array of attributes + // + iAttributes.Reset(); + for (TInt i=iData->Count(iClientHandle);--i>=0;) + { + (void)iAttributes.Append(iData->Attribute(iClientHandle,i)); + } + } + +// ----------------------------------------------------------------------------- +// CMPXMedia::ResetLocal +// ----------------------------------------------------------------------------- +// +void CMPXMedia::ResetLocal() + { + CMPXMediaBase::ResetLocal(); + iAttributes.Reset(); + } + +// ----------------------------------------------------------------------------- +// CMPXMedia::ValueCObjectL +// ----------------------------------------------------------------------------- +// +TAny* CMPXMedia::ValueCObjectL(const TDesC8& aData) const + { + TAny* obj=NULL; + TInt size=aData.Size(); + TUint* ptr=(TUint*)aData.Ptr(); + +#ifdef _DEBUG + const TBool ptrAddrIsOnBoundary = ((TUint)ptr & 3) == 0; + + // Only dereference 4-byte word on 4-byte word boundary + MPX_ASSERT(ptrAddrIsOnBoundary); // assert if this is not the case +#endif + + MMPXData::TMPXObjectType t=*(MMPXData::TMPXObjectType*)ptr; + switch(t) + { + case MMPXData::EMedia: + MPX_ASSERT(size==sizeof(TInt)+sizeof(TUint)); // i.e 8 bytes + obj=CMPXMedia::NewL(*++ptr); + break; + // + case MMPXData::EMediaArray: + MPX_ASSERT(size==sizeof(TInt)+sizeof(TUint)); // i.e 8 bytes + obj=ValueL(aData); + break; + // + case MMPXData::EPath: + obj=ValueL(aData); + break; + // + default: + // + // obj=NULL, i.e. arbitrary C objects + // ARE NOT SUPPORTED by this method + // + MPX_ASSERT(0); // For now, to catch clients that use this + break; + } + return obj; + } + +// ----------------------------------------------------------------------------- +// CMPXMedia::SetErrorL +// ----------------------------------------------------------------------------- +EXPORT_C void CMPXMedia::SetErrorL(const TMPXAttribute& aAttribute, TInt aError) + { + TPtrC8 value((TUint8*)&aError,sizeof(TInt)); + SetValueL(aAttribute,value,EMPXTypeError); + } + +// ----------------------------------------------------------------------------- +// CMPXMedia::Error +// ----------------------------------------------------------------------------- +EXPORT_C TInt CMPXMedia::Error(const TMPXAttribute& aAttribute) const + { + if (Type(aAttribute)==EMPXTypeError) + { + TInt* v=(TInt*)ValuePtr(aAttribute); + return v?*v:KErrNone; // return KErrNone if none exists! + } + else + return KErrNone; + } + +// END OF FILE diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxmediaarray.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxmediaarray.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,291 @@ +/* +* Copyright (c) 2006 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: Implementation of array of media objects +* +*/ + + +#include "mpxmediaarray.h" +#include "mpxmedia.h" +#include "mpxcmn.h" + +// CONSTANTS +// +// Media attribute for the media object added to array +// +const TMPXAttributeData KMPXMediaArrayItem= {0x101FFC12, 0X01}; + +// ----------------------------------------------------------------------------- +// CMPXMediaArray::NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXMediaArray* CMPXMediaArray::NewL() + { + CMPXMediaArray* a=new(ELeave)CMPXMediaArray(); + CleanupStack::PushL(a); + a->ConstructL(); + CleanupStack::Pop(a); + return a; + } + +// ----------------------------------------------------------------------------- +// CMPXMediaArray::NewL +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXMediaArray* CMPXMediaArray::NewL(const CMPXMediaArray& aArray) + { + CMPXMediaArray* a=new(ELeave)CMPXMediaArray(); + CleanupStack::PushL(a); + a->ConstructL(aArray); + CleanupStack::Pop(a); + return a; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXMediaArray::~CMPXMediaArray() + { + } + +// ----------------------------------------------------------------------------- +// Externalize +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXMediaArray::ExternalizeL(RWriteStream& aStream) const + { + DoExternalizeL(aStream,MMPXData::EMediaArray); + } + +// ----------------------------------------------------------------------------- +// Internalize. ConstructL() will have been called prior to this so there +// will definitely be a iClientHandle, iDataHandle and iData, though there may or +// may not be any data added. Either way, the data should be reset. +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXMediaArray::InternalizeL(RReadStream& aStream) + { + DoInternalizeL(aStream,MMPXData::EMediaArray); + } + +// ----------------------------------------------------------------------------- +// Total number of objects contained in array +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXMediaArray::Count() const + { + return CMPXMediaBase::Count(); + } + +// ----------------------------------------------------------------------------- +// Array assessor +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXMedia* CMPXMediaArray::operator[](TInt aIndex) const + { + return Value(aIndex); + } + +// ----------------------------------------------------------------------------- +// Get a pointer to the media object at the specified position within the array +// ----------------------------------------------------------------------------- +// +EXPORT_C CMPXMedia* CMPXMediaArray::AtL(TInt aIndex) const + { + return ValueL(aIndex); + } + +// ----------------------------------------------------------------------------- +// Appends media object to array +// Takes the ownship of aMedia +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXMediaArray::AppendL(const CMPXMedia* aMedia) + { + AppendL(*aMedia); + delete const_cast(aMedia); + } + +// ----------------------------------------------------------------------------- +// Appends media object to array +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXMediaArray::AppendL(const CMPXMedia& aMedia) + { + User::LeaveIfError(AddToArray(aMedia,CMPXMediaBase::Count())); + } + +// ----------------------------------------------------------------------------- +// Resets the media array +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXMediaArray::Reset() + { + MPX_ASSERT(iClientHandle&&iData); + // + ResetLocal(); // Local data + iData->Reset(iClientHandle); // Clears heap data for this object + } + +// ----------------------------------------------------------------------------- +// Removes the specified media from the array +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXMediaArray::Remove(TInt aIndex) + { + MPX_ASSERT(iData&&iClientHandle&&aIndex>=0&&aIndexDelete(iClientHandle,aIndex); // And data for this object + } + +// ----------------------------------------------------------------------------- +// Inserts the specified media into the array at the specified position +// Takes the ownership of aMedia +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXMediaArray::Insert(const CMPXMedia *aMedia, TInt aPos) + { + TInt r=AddToArray(*aMedia,aPos); + if (r==KErrNone) + { + delete const_cast(aMedia); + } + return r; + } + +// ----------------------------------------------------------------------------- +// Inserts the specified media into the array at the specified position +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXMediaArray::Insert(const CMPXMedia& aMedia, TInt aPos) + { + return AddToArray(aMedia,aPos); + } + +// ----------------------------------------------------------------------------- +// Sets the specified media into the array at the specified position +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXMediaArray::Set(const CMPXMedia& aMedia, TInt aPos) + { + MMPXData::LockHeap( iClientHandle ); + DeleteLocal(aPos); + (void)AddToArray(aMedia,aPos,ETrue); + MMPXData::UnlockHeap( iClientHandle ); + } + +// ----------------------------------------------------------------------------- +// Inserts the specified media into the array at the specified position and +// leave if an error is encountered +// Takes ownership of the aMedia +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXMediaArray::InsertL(const CMPXMedia *aMedia, TInt aPos) + { + User::LeaveIfError(Insert(aMedia,aPos)); + } + +// ----------------------------------------------------------------------------- +// Inserts the specified media into the array at the specified position and +// leave if an error is encountered +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMPXMediaArray::InsertL(const CMPXMedia& aMedia, TInt aPos) + { + User::LeaveIfError(AddToArray(aMedia,aPos)); + } + + +// ----------------------------------------------------------------------------- +// The value for a specific index +// ----------------------------------------------------------------------------- +// +CMPXMedia* CMPXMediaArray::Value(TInt aIndex) const + { + CMPXMedia* m=NULL; + TRAP_IGNORE(m=ValueL(aIndex)); + return m; + } + +// ----------------------------------------------------------------------------- +// The value for a specific index +// ----------------------------------------------------------------------------- +// +CMPXMedia* CMPXMediaArray::ValueL(TInt aIndex) const + { + MPX_ASSERT(iData&&iClientHandle&&aIndex>=0&&aIndexUid(iClientHandle,aIndex); + const TValue* v=LocalValue(uid); + if (!v) + { + TPtrC8 data=iData->Value(iClientHandle,aIndex); + TUint* ptr=(TUint*)data.Ptr(); + // + // Check that it's really a media object + // + MPX_ASSERT(*(MMPXData::TMPXObjectType*)ptr==MMPXData::EMedia); + MPX_ASSERT(sizeof(TUint)+sizeof(TInt)==data.Size()); + // + ++ptr; // Actual data offset + obj=CMPXMedia::NewL(*ptr); // new media object from the data + CleanupStack::PushL(obj); + CMPXMediaArray& theArray=*const_cast(this); + User::LeaveIfError(theArray.SetLocal(TValue(obj,uid,EMPXTypeCObject))); + CleanupStack::Pop(obj); + } + else + { + obj=static_cast(v->iValue); + } + CleanupStack::PopAndDestroy(); // unlock the heap + return obj; + } + +// ----------------------------------------------------------------------------- +// Inserts the specified media into the array at the specified position +// ----------------------------------------------------------------------------- +// +TInt CMPXMediaArray::AddToArray(const CMPXMedia& aMedia,TInt aPos,TBool aReplace) + { + MPX_ASSERT(iData&&iDataHandle&&iClientHandle); + const TInt KMediaStreamLen=sizeof(MMPXData::TMPXObjectType)+sizeof(TUint); + TBuf8 buf; + TUint* p=(TUint*)buf.Ptr(); + *p=MMPXData::EMedia; + *++p=aMedia.Data(); + buf.SetLength(KMediaStreamLen); + TInt r(KErrNone); + if (aReplace) + { + iData->Set(iClientHandle,KMPXMediaArrayItem,EMPXTypeCObject,buf,aPos); + } + else if (aPos==CMPXMediaBase::Count()) + { + r=iData->Append(iClientHandle,KMPXMediaArrayItem,EMPXTypeCObject,buf); + } + else + { + r=iData->Insert(iClientHandle,KMPXMediaArrayItem,EMPXTypeCObject,buf,aPos); + } + return r; + } + +// END OF FILE diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxmediabase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxmediabase.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,271 @@ +/* +* Copyright (c) 2006 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: Implementation of media base class +* +*/ + + +#include +#include +#include "mpxmediabase.h" + + +// ----------------------------------------------------------------------------- +// C++ Constructor. +// ----------------------------------------------------------------------------- +// +CMPXMediaBase::CMPXMediaBase() + { + // Open the global chunk and return the handle of the global chunk. + // If called for the first time, creates the global chunk and heap manager. + iClientHandle=MMPXData::ClientHandle(); + MMPXData::AddClientRef(iClientHandle); // Ref for this thread + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CMPXMediaBase::~CMPXMediaBase() + { + ResetLocal(); + iValues.Close(); + if (iData) + { + iData->Release(iClientHandle); + MMPXData::ReleaseClient(iClientHandle); // This thread's reference count + } + } + +// ----------------------------------------------------------------------------- +// CMPXMediaBase::ConstructL +// ----------------------------------------------------------------------------- +// +void CMPXMediaBase::ConstructL() + { + MMPXData* d=MMPXData::NewL(iClientHandle); + TInt dh=d->DataHandle(iClientHandle); + ConstructL(dh,*d); + } + +// ----------------------------------------------------------------------------- +// CMPXMediaBase::ConstructL +// ----------------------------------------------------------------------------- +// +void CMPXMediaBase::ConstructL(const CMPXMediaBase& aBase) + { + ConstructL(aBase.iDataHandle,*aBase.iData); + } + +// ----------------------------------------------------------------------------- +// CMPXMediaBase::CopyConstructL +// ----------------------------------------------------------------------------- +// +void CMPXMediaBase::CopyConstructL(const CMPXMediaBase& aBase) + { + MMPXData* d=MMPXData::NewL(iClientHandle,*aBase.iData); + TInt dh=d->DataHandle(iClientHandle); + ConstructL(dh,*d); + } + +// ----------------------------------------------------------------------------- +// CMPXMediaBase::ConstructL +// ----------------------------------------------------------------------------- +// +void CMPXMediaBase::ConstructL(TInt aDataHandle) + { + MMPXData* d=MMPXData::Data(iClientHandle,aDataHandle); + ConstructL(aDataHandle,*d); + } + +// ----------------------------------------------------------------------------- +// CMPXMediaBase::ConstructL +// ----------------------------------------------------------------------------- +// +void CMPXMediaBase::ConstructL(TInt aDataHandle,MMPXData& aData) + { + MPX_ASSERT(!iData&&!iDataHandle&&aDataHandle); + if (aDataHandle==0) + { + User::Leave(KErrArgument); + } + iDataHandle=aDataHandle; + iData=&aData; + iData->AddRef(iClientHandle); + iValues.ReserveL(Count()); + } + +// ----------------------------------------------------------------------------- +// CMPXMediaBase::Clear +// ----------------------------------------------------------------------------- +// +void CMPXMediaBase::Clear() + { + if (iData) + { + ResetLocal(); // remove local data only, keep heap data for other media objects + iData->Release(iClientHandle); // MMPXData's reference count + iData=NULL; + iDataHandle=0; + } + } + +// ----------------------------------------------------------------------------- +// CMPXMediaBase::ResetLocal +// ----------------------------------------------------------------------------- +// +void CMPXMediaBase::ResetLocal() + { + THashMapIter iter(iValues); + const TValue* v = NULL; + while ((v = iter.NextValue())!=NULL) + { + DeletePtr(v->iValue, v->iType); + iter.RemoveCurrent(); + } + iValues.Close(); + } + +TInt CMPXMediaBase::SetLocal(const TValue& aValue) + { + DeleteLocalByUid(aValue.iUid); + return iValues.Insert(aValue.iUid, aValue); + } + +// ----------------------------------------------------------------------------- +// CMPXMediaBase::LocalIndex +// ----------------------------------------------------------------------------- +// +const CMPXMediaBase::TValue* CMPXMediaBase::LocalValue(TInt aUid) const + { + return iValues.Find(aUid); + } + +// ----------------------------------------------------------------------------- +// CMPXMediaBase::DeleteLocal +// ----------------------------------------------------------------------------- +// +void CMPXMediaBase::DeleteLocalByUid(const TInt aUid) + { + TValue* val = iValues.Find(aUid); + if (val) + { + DeletePtr(val->iValue,val->iType); + iValues.Remove(aUid); + } + } + +// ----------------------------------------------------------------------------- +// CMPXMediaBase::DeleteLocal +// ----------------------------------------------------------------------------- +// +void CMPXMediaBase::DeleteLocal(TInt aIndex) + { + MPX_ASSERT(KErrNotFound != aIndex); + TInt uid = iData->Uid(iClientHandle,aIndex); + DeleteLocalByUid(uid); + } + +// ----------------------------------------------------------------------------- +// CMPXMediaBase::DeletePtr +// ----------------------------------------------------------------------------- +// +void CMPXMediaBase::DeletePtr(TAny* aValue,TMPXAttributeType aType) + { + switch(aType) + { + case EMPXTypeCObject: + delete static_cast(aValue); + break; + default: + // Both T objects and text are held in TPtrC8 which are + // allocated on the heap. + // + User::Free(aValue); + break; + } + } + +// ----------------------------------------------------------------------------- +// Externalize +// ----------------------------------------------------------------------------- +// +void CMPXMediaBase::DoExternalizeL( + RWriteStream& aStream, + MMPXData::TMPXObjectType aType) const + { + // + // NB: Client must persist the object until after it has been + // internalized, i.e. there must always be at least one object + // in existance for Internalize to work! + // + MPX_ASSERT(iDataHandle); + // + aStream.WriteInt32L(aType); + aStream.WriteUint32L(iDataHandle); + } + +// ----------------------------------------------------------------------------- +// Internalize. ConstructL() will have been called prior to this so there +// will definitely be a iClientHandle, iDataHandle and iData, though there may or +// may not be any data added. Either way, the data should be reset. +// ----------------------------------------------------------------------------- +// +void CMPXMediaBase::DoInternalizeL( + RReadStream& aStream, + MMPXData::TMPXObjectType /*aType*/) + { + MPX_ASSERT(iClientHandle); + // + Clear(); // Clear local data only from this object + TInt type( aStream.ReadInt32L() ); // object type + if ( type != MMPXData::EMedia && + type != MMPXData::EMediaArray) + { + MPX_DEBUG1("CMPXMediaBase::DoInternalizeL(): Invalid Type"); + User::Leave( KErrArgument ); + } + // + iDataHandle=aStream.ReadUint32L(); + iData=MMPXData::Data(iClientHandle,iDataHandle); + iData->AddRef(iClientHandle); + } + +// ---------------------------------------------------------------------------- +// CMPXMediaBase::LockHeapLC +// ---------------------------------------------------------------------------- +// +void CMPXMediaBase::LockHeapLC() const + { + MMPXData::LockHeap( iClientHandle ); + CleanupStack::PushL(TCleanupItem(UnlockHeap, const_cast(this))); + } + +// ---------------------------------------------------------------------------- +// CMPXMediaBase::UnlockHeap +// +// Executed when the cleanup stack item is destroyed as a result of +// CleanupStack::PopAndDestroy being called. This could either be called +// manually or as a result of a leave being generated and trapped. +// +// This is a static method. +// ---------------------------------------------------------------------------- +// +void CMPXMediaBase::UnlockHeap(TAny* aMediaBase) + { + CMPXMediaBase* base = static_cast(aMediaBase); + MMPXData::UnlockHeap(base->iClientHandle); + } + +// END OF FILE diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxmediadataarray.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxmediadataarray.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,219 @@ +/* +* Copyright (c) 2006 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: Implementation of array of variable size elements on global chunk +* +*/ + +#include "mpxmediadataarray.h" +#include "mpxheapmanager.h" +#include "mpxdata.h" + +#define ITEM(x,y) RMPXHeapManager::Ptr(x,y) + +// ----------------------------------------------------------------------------- +// RMPXMediaDataItemArray::Append +// ----------------------------------------------------------------------------- +// +TInt RMPXMediaDataItemArray::Append( + TUint aClientHandle, + const TMPXAttribute& aAttr, + TMPXAttributeType aAttrType, + const TDesC8& aData) + { + MPX_ASSERT(aClientHandle); + // + TInt r=KErrNone; + RMPXMediaDataItem* item=NewItem(aClientHandle,aAttr,aAttrType,aData); + if (item) + { + RMPXDataItemArray::Append(aClientHandle,*item); + } + else + { + r=KErrNoMemory; + } + return r; + } + + +// ----------------------------------------------------------------------------- +// RMPXMediaDataItemArray::Set +// ----------------------------------------------------------------------------- +// +TInt RMPXMediaDataItemArray::Set( + TUint aClientHandle, + const TMPXAttribute& aAttr, + TMPXAttributeType aAttrType, + const TDesC8& aData, + TInt aIndex) + { + TInt r=KErrNone; + RMPXMediaDataItem* item=NewItem(aClientHandle,aAttr,aAttrType,aData); + if (item) + { + RMPXDataItemArray::Set(aClientHandle,*item,aIndex); + } + else + { + r=KErrNoMemory; + } + return r; + } + +// ----------------------------------------------------------------------------- +// RMPXMediaDataItemArray::RMPXMediaDataItemArray +// ----------------------------------------------------------------------------- +// +TInt RMPXMediaDataItemArray::Insert( + TUint aClientHandle, + const TMPXAttribute& aAttr, + TMPXAttributeType aAttrType, + const TDesC8& aData, + TInt aIndex) + { + TInt r=KErrNone; + RMPXMediaDataItem* item=NewItem(aClientHandle,aAttr,aAttrType,aData); + if (item) + { + RMPXDataItemArray::Insert(aClientHandle,*item,aIndex); + } + else + { + r=KErrNoMemory; + } + return r; + } + +// ----------------------------------------------------------------------------- +// RMPXMediaDataItemArray::Index +// ----------------------------------------------------------------------------- +// +TInt RMPXMediaDataItemArray::Index(TUint aClientHandle,const TMPXAttribute& aAttr) + { + TInt index( KErrNotFound ); + RMPXMediaDataItem* item=NULL; + + if (iFirstItemOffset) + { + item=ITEM(aClientHandle,iFirstItemOffset); + while(item) + { + index++; + if (item->Attribute()==aAttr) + { + // + // Found it, so break outer of the loop, but first store + // the current position in case an index based query will + // follow (e,g, for data, type etc.) + // + iIndex=index; + iPos=RMPXHeapManager::Offset(aClientHandle,item); + break; + } + TInt next=item->NextOffset(); + item=next?ITEM(aClientHandle,next):NULL; + } + } + return item?index:KErrNotFound; + } + + // ----------------------------------------------------------------------------- +// RMPXMediaDataItemArray::NewItem +// ----------------------------------------------------------------------------- +// + RMPXMediaDataItem* RMPXMediaDataItemArray::NewItem( + TUint aClientHandle, + const TMPXAttribute& aAttr, + TMPXAttributeType aAttrType, + const TDesC8& aData) + { + MPX_ASSERT(aClientHandle); + // + RMPXHeapManager& m=RMPXHeapManager::HeapManager(aClientHandle); + TAny* ptr=m.Alloc(aClientHandle, sizeof(RMPXMediaDataItem) + aData.Size()); + RMPXMediaDataItem* item(NULL); + if (ptr) + { + //Alloc media data item + item = new(ptr)RMPXMediaDataItem(); + //Copy data to RMPXMediaDataItem + item->Copy(aClientHandle,aData); + item->SetAttribute(aAttr,aAttrType); + } + return item; + } + +// ----------------------------------------------------------------------------- +// RMPXDataItemArray::Copy +// ----------------------------------------------------------------------------- +// +TInt RMPXMediaDataItemArray::Copy( + TUint aClientHandle, + const RMPXMediaDataItemArray& aArray) + { + Reset(aClientHandle); // Clear existing data + TInt r=KErrNone; + TInt first=aArray.iFirstItemOffset; + if (first) + { + RMPXMediaDataItem* item=ITEM(aClientHandle,first); + while(item) + { + MMPXData* d=MMPXData::Data(aClientHandle, + item->Buf(aClientHandle), + item->Size()); + if (d) + { + // It's a global object. e.g. media or media array, so we need to copy + // that and place the handle into the buffer + // + MMPXData* newd=NULL; + TRAP(r,newd=MMPXData::NewL(aClientHandle,*d)); // will end up recursive + if (r==KErrNone) + { + // Create the data: a buffer of 8 bytes + // + const TInt KMediaStreamLen=sizeof(MMPXData::TMPXObjectType)+sizeof(TUint); + TBuf8 newbuf; + // + TUint* ptr=(TUint*)newbuf.Ptr(); // pointer to the new (empty) buffer + TUint* oldPtr=(TUint*)item->Buf(aClientHandle); // pointer to the old data + // + *ptr=*oldPtr; // the TMPXObjectType + *++ptr=newd->DataHandle(aClientHandle); // the data: handle to this new data + // + newbuf.SetLength(KMediaStreamLen); + // + r=Append(aClientHandle,item->Attribute(),item->Type(),newbuf); + // + // Don't need to call newd->Release(aClientHandle) currently, since the Append() + // would have created a ref count of 1, and the MMPXData::NewL() doesn't. + // + } + } + else + { + // Regular streamed object, so we can duplicate it by just copying the bytes + // in an Append() + // + r=Append(aClientHandle,item->Attribute(),item->Type(),item->Data(aClientHandle)); + } + item=item->NextOffset()&&r==KErrNone?ITEM(aClientHandle,item->NextOffset()):NULL; + } + } + return r; + } + +// End of file + diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxmessage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxmessage.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2006 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: implementation of message +* +*/ + +#include "mpxmessage.h" + +// ----------------------------------------------------------------------------- +// C++ constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TMPXMessage::TMPXMessage(TInt aEvent, + TInt aType /*= 0*/, + TInt aData /*= 0*/) + : iEvent(aEvent),iType(aType),iData(aData) + {} + +// ----------------------------------------------------------------------------- +// C++ constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TMPXMessage::TMPXMessage() + : iEvent(0),iType(0),iData(0) + {} + +// ----------------------------------------------------------------------------- +// Copy constructor +// ----------------------------------------------------------------------------- +// +EXPORT_C TMPXMessage::TMPXMessage(const TMPXMessage& aMsg) + : iEvent(aMsg.iEvent), iType(aMsg.iType),iData(aMsg.iData) + { + } + +// ----------------------------------------------------------------------------- +// Overloaded assignment operator +// ----------------------------------------------------------------------------- +// +EXPORT_C TMPXMessage& TMPXMessage::operator=(const TMPXMessage& aMsg) + { + if (this != &aMsg) + { + iEvent = aMsg.iEvent; + iType = aMsg.iType; + iData = aMsg.iData; + } + return *this; + } + +// ----------------------------------------------------------------------------- +// Message event +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt TMPXMessage::Event() const + { + return iEvent; + } + +// ----------------------------------------------------------------------------- +// Message type +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt TMPXMessage::Type() const + { + return iType; + } + +// ----------------------------------------------------------------------------- +// Message data +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt TMPXMessage::Data() const + { + return iData; + } + + diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxmessagemonitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxmessagemonitor.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,152 @@ +/* +* Copyright (c) 2006 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: Inline implementation of message monitor +* +*/ + +#include +#include "mpxsession.h" +#include "mpxmessagemonitor.h" + +const TInt KMPXGetNextMessage=0; +const TInt KMPXCancelGetNextMessage=1; + +// ============================== MEMBER FUNCTIONS ============================ +// ---------------------------------------------------------------------------- +// Two phases constructor +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXMessageMonitor* CMPXMessageMonitor::NewL( + const RMPXSession& aSession, + MMPXMessageObserver& aObserver) + { + CMPXMessageMonitor* self = new(ELeave)CMPXMessageMonitor(aSession, aObserver); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXMessageMonitor::~CMPXMessageMonitor() + { + MPX_FUNC_EX("CMPXMessageMonitor::~CMPXMessageMonitor"); + Cancel(); + } + +// ---------------------------------------------------------------------------- +// C++ constructor +// ---------------------------------------------------------------------------- +// +CMPXMessageMonitor::CMPXMessageMonitor( + const RMPXSession& aSession, + MMPXMessageObserver& aObserver) +: CActive(EPriorityHigh), + iSession(aSession), + iObserver(aObserver) + { + CActiveScheduler::Add(this); + } + + +// ---------------------------------------------------------------------------- +// 2nd phase construction: +// ---------------------------------------------------------------------------- +// +void CMPXMessageMonitor::ConstructL() + { + MPX_FUNC_EX("CMPXMessageMonitor::ConstructL"); + GetNextMessage(); + } + +// ---------------------------------------------------------------------------- +// Start to monitor messages +// +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXMessageMonitor::GetNextMessage() + { + MPX_FUNC_EX("CMPXMessageMonitor::GetNextMessage"); + if (!IsActive()) + { + MPX_DEBUG1("CMPXMessageMonitor::GetNextMessage send request"); + iSession.SendReceive(KMPXGetNextMessage, + TIpcArgs(&iMsgDataPkg, &iErrorPkg), + iStatus); + SetActive(); + } + } + +// ---------------------------------------------------------------------------- +// From CActive: a new message must have arrived so retrieve it and pass back +// to observer, then wait for next message +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXMessageMonitor::RunL() + { + MPX_FUNC_EX("CMPXMessageMonitor::RunL"); + + // Try again in case server is down for IAD + if (iStatus == KErrDied || iStatus == KErrServerTerminated) + { + MPX_DEBUG1("-->CMPXMessageMonitor::RunL Reconnecting session for IAD"); + + // attempt to bring the server back up + if (iSession.Reconnect() != KErrNone) + { + MPX_DEBUG1("-->CMPXMessageMonitor::RunL Reconnect Failed"); + + User::LeaveIfError(iStatus.Int()); + } + } + else + { + User::LeaveIfError(iStatus.Int()); + iObserver.MessageReceived(iMsgDataPkg(), iErrorPkg()); + } + } + +// ---------------------------------------------------------------------------- +// From CActive: no more messages are required +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXMessageMonitor::DoCancel() + { + MPX_FUNC_EX("CMPXMessageMonitor::DoCancel"); + if (IsActive()) + { + TRAP_IGNORE(iSession.SendReceiveL(KMPXCancelGetNextMessage)); + } + } + +// ---------------------------------------------------------------------------- +// Handle leave in the RunL() +// ---------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXMessageMonitor::RunError(TInt aError) + { + MPX_DEBUG3("-->CMPXMessageMonitor::RunError 0x%08x, error %d", this, aError); + if (KErrCancel!=aError && KErrServerTerminated!=aError) + { + GetNextMessage(); + } + MPX_DEBUG3("<--CMPXMessageMonitor::RunError 0x%08x, error %d", this, aError); + return KErrNone; + } + +// End of file + diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxmessagequeue.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxmessagequeue.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,305 @@ +/* +* Copyright (c) 2007 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: Queue the message +* +*/ + +#include +#ifdef _DEBUG +#include +#endif +#include "mpxmessagequeue.h" + +// ============================ PRIVATE CLASSES ============================== +NONSHARABLE_CLASS(CMPXMessageItem) : public CBase + { +public: + static CMPXMessageItem* NewL(const CMPXMessage* aMsg, TInt aError); + ~CMPXMessageItem(); + /** + * message object + * + * @return message object + */ + CMPXMessage* Message() + { + return iMsg; + } + /** + * Error code associated with the message + * + * @return the error code + */ + TInt Error() + { + return iError; + } + /** + * Offset to the task queue + * + * @return the offset + */ + static TInt Offset() + { + return _FOFF(CMPXMessageItem,iLink); + } +private: + CMPXMessageItem(TInt aError); + void ConstructL(const CMPXMessage* aMsg); +private: + TSglQueLink iLink; + CMPXMessage* iMsg; + TInt iError; + }; + +CMPXMessageItem* CMPXMessageItem::NewL(const CMPXMessage* aMsg, TInt aError) + { + CMPXMessageItem* self = new ( ELeave ) CMPXMessageItem(aError); + CleanupStack::PushL( self ); + self->ConstructL(aMsg); + CleanupStack::Pop(self); + return self; + } + +CMPXMessageItem::CMPXMessageItem(TInt aError) +: iError(aError) + { + } + +CMPXMessageItem::~CMPXMessageItem() + { + MPX_DEBUG2("-->CMPXMessageItem::~CMPXMessageItem 0x%08x", this); + if (iMsg) + { + MPX_DEBUG3("CMPXMessageItem::~CMPXMessageItem msg 0x%08x, msgHandle 0x%08x", + iMsg, iMsg->Data()); + + delete iMsg; + iMsg = NULL; + } + MPX_DEBUG2("<--CMPXMessageItem::~CMPXMessageItem 0x%08x", this); + } + +void CMPXMessageItem::ConstructL(const CMPXMessage* aMsg) + { + MPX_FUNC_EX("CMPXMessageItem::ConstructL"); + iMsg = aMsg ? CMPXMessage::NewL(*aMsg) : NULL; + } + +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXMessageQueue* CMPXMessageQueue::NewL() + { + CMPXMessageQueue* self = new ( ELeave ) CMPXMessageQueue(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------------------------- +// C++ constructor. +// ---------------------------------------------------------------------------- +// +CMPXMessageQueue::CMPXMessageQueue() +: iMsgs(CMPXMessageItem::Offset()), + iFailure(KErrNone) + { + } + +// ---------------------------------------------------------------------------- +// Second-phase constructor. +// ---------------------------------------------------------------------------- +// +void CMPXMessageQueue::ConstructL() + { + MPX_FUNC_EX("CMPXMessageQueue::ConstructL"); + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXMessageQueue::~CMPXMessageQueue() + { + MPX_FUNC_EX("CMPXMessageQueue::~CMPXMessageQueue()"); + Reset(); + } + +// ---------------------------------------------------------------------------- +// Send next message request from client +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXMessageQueue::SendNext(const RMessage2& aMsgRequest) + { + MPX_FUNC_EX("CMPXMessageQueue::SendNext()"); + MPX_ASSERT(iMsgRequest.IsNull()); + iMsgRequest = aMsgRequest; + if (!iMsgs.IsEmpty()) + { + Send(); + } + } + +// ---------------------------------------------------------------------------- +// Adds a message into the queue and sends the message if slot is available +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXMessageQueue::Add(const CMPXMessage* aMessage, TInt aError) + { + // aMessage should not be NULL and aError is KErrNone + MPX_ASSERT(aMessage || aError); + MPX_FUNC_EX("CMPXMessageQueue::Add()"); + CMPXMessageItem* item(NULL); + TRAPD(err, item = CMPXMessageItem::NewL(aMessage, aError)); + if (KErrNone==err) + { + iMsgs.AddLast(*item); +#ifdef _DEBUG + MPX_DEBUG3("CMPXMessageQueue::Add 0x%08x, items %d", this, ++iCount); +#endif + }//else failed to create message item. + else + { + MPX_DEBUG2("CMPXMessageQueue::Add Failed to create message item %d", err); + } + + if (KErrNone!=err && KErrNone==iFailure) + { // Set the failure code + iFailure = err; + } + + if (!iMsgRequest.IsNull()) + { // outstanding request + Send(); + } // else client has not finished current message yet + } + +// ---------------------------------------------------------------------------- +// Reset message queue +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXMessageQueue::Reset() + { + MPX_FUNC_EX("CMPXMessageQueue::Reset()"); + if (!iMsgRequest.IsNull()) + { + iMsgRequest.Complete(KErrCancel); + } + delete iMsgSent; + iMsgSent = NULL; + TSglQueIter iter(iMsgs); + CMPXMessageItem* msgItem=NULL; + while ((msgItem=iter++) != NULL) // Compiler on warning while(msgItem==iter++) + { + delete msgItem; + } + iMsgs.Reset(); + } + +// ---------------------------------------------------------------------------- +// Send a message +// ---------------------------------------------------------------------------- +// +void CMPXMessageQueue::Send() + { + MPX_DEBUG3("-->CMPXMessageQueue::Send() 0x%08x, iMsgSent 0x%08x", + this, iMsgSent); + delete iMsgSent; + iMsgSent = NULL; + TInt data(0); + TInt err(KErrNone); + if (iFailure) + { + err=iFailure; + iFailure = KErrNone; // Reset failure code + } + else + { + MPX_ASSERT(!iMsgs.IsEmpty()); + iMsgSent = iMsgs.First(); + iMsgs.Remove(*iMsgSent); +#ifdef _DEBUG + MPX_DEBUG4("CMPXMessageQueue::Send 0x%08x, msg 0x%08x, items %d", + this, iMsgSent->Message(), --iCount); +#endif + if (iMsgSent->Message()) + { + data = iMsgSent->Message()->Data(); + MPX_ASSERT(data>0); +#ifdef _DEBUG + CMPXMessage* msg = iMsgSent->Message(); + TMPXMessageId* pId = msg->Value(KMPXMessageGeneralId); + if (pId) + { + TInt id = static_cast(*pId); + MPX_DEBUG5("CMPXMessageQueue::Send msg item 0x%08x, msg 0x%08x, msgHandle 0x%08x, msgId 0x%08x", + iMsgSent, iMsgSent->Message(), data, id); + if (id==KMPXMessageGeneral) + { + MPX_ASSERT(msg->IsSupported(KMPXMessageGeneralEvent)); + TInt* pEvent = msg->Value(KMPXMessageGeneralEvent); + MPX_ASSERT(msg->IsSupported(KMPXMessageGeneralType)); + TInt* pType = msg->Value(KMPXMessageGeneralType); + MPX_ASSERT(msg->IsSupported(KMPXMessageGeneralData)); + TInt* pData = msg->Value(KMPXMessageGeneralData); + if (pEvent && pType && pData) + { + MPX_DEBUG5("CMPXMessageQueue::Send general msg item 0x%08x, event %d, type %d, data %d", + iMsgSent, *pEvent, *pType, *pData); + } + else + { + MPX_DEBUG1("CMPXMessageQueue::Send OOM"); + } + } + } + else + { + MPX_DEBUG1("CMPXMessageQueue::Send OOM"); + } +#endif + } // else NULL message + else // else NULL message + { + MPX_ASSERT(iMsgSent->Error()); + MPX_DEBUG3("CMPXMessageQueue::Send NULL message 0x%08x, err %d", + this, iMsgSent->Error()); + } + err = iMsgSent->Error(); + } + + TPckgC dataPkg(data); + TPckgC errPkg(err); + TInt ret = (iMsgRequest.Write(0, dataPkg)); + if (!ret) + { + ret = iMsgRequest.Write(1, errPkg); + } +#ifdef _DEBUG + if (ret) + { + MPX_DEBUG1("CMPXMessageQueue::Send Failed to write data"); + } +#endif + iMsgRequest.Complete(ret); + MPX_DEBUG5("<--CMPXMessageQueue::Send() 0x%08x, sentMsgHandle 0x%08x, sentError %d, sentRet %d", + this, data, err, ret); + } + +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxparameter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxparameter.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,193 @@ +/* +* Copyright (c) 2006 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: MPX parameter for commandline/message +* +*/ + + +// INCLUDE FILES +#include +#include + +#include "mpxparameter.h" +#include "mpxlog.h" + +// CONSTANTS + +const TInt KMPXParameterVesion = 2; + +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// C++ constructor can NOT contain any code that might leave. +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXParameter::CMPXParameter(): + iCollectionPath( NULL ), + iType( KNullUid ), + iCmdForward( EMPXCmdFwdStandAlone ) + { + } + +// Destructor +EXPORT_C CMPXParameter::~CMPXParameter() + { + delete iCollectionPath; + } + +// --------------------------------------------------------------------------- +// Externalize the object +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXParameter::ExternalizeL( RWriteStream& aStream ) const + { + MPX_FUNC( "CMPXParameter::ExternalizeL" ); + + MPX_DEBUG2( "CMPXParameter::ExternalizeL parameter version = %d", KMPXParameterVesion ); + aStream.WriteInt32L( KMPXParameterVesion ); + + MPX_DEBUG2( "CMPXParameter::ExternalizeL iCmdForward = %d", iCmdForward ); + aStream.WriteInt32L( iCmdForward ); + + // externalize playlist + if ( iCollectionPath ) + { + // collection path exist + MPX_DEBUG1( "CMPXParameter::ExternalizeL collection path exist" ); + MPX_DEBUG_PATH( *iCollectionPath ); + aStream.WriteInt32L( 1 ); + aStream << *iCollectionPath; + } + else + { + // no collection path + MPX_DEBUG1( "CMPXParameter::ExternalizeL no collection path" ); + aStream.WriteInt32L( 0 ); + } + + MPX_DEBUG2( "CMPXParameter::ExternalizeL collection path type = %d", iPathType ); + aStream.WriteInt32L( iPathType ); + + if ( iType.iUid > 0 ) + { + // view uid exist + MPX_DEBUG2( "CMPXParameter::ExternalizeL uid = 0x%x", iType.iUid ); + aStream.WriteInt32L( 1 ); + aStream.WriteInt32L( iType.iUid ); + } + else + { + // no view uid + MPX_DEBUG1( "CMPXParameter::ExternalizeL no uid" ); + aStream.WriteInt32L( 0 ); + } + } + +// --------------------------------------------------------------------------- +// Internalize the object +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXParameter::InternalizeL( RReadStream& aStream ) + { + MPX_FUNC( "CMPXParameter::InternalizeL" ); + delete iCollectionPath; + iCollectionPath = NULL; + iPathType = EMPXTypeCollectionPath; + iType = KNullUid; + + iVersion = aStream.ReadInt32L(); + MPX_DEBUG2( "CMPXParameter::InternalizeL iVersion = %d", iVersion ); + + switch ( iVersion ) + { + // this 0/1 is not the actual version number + // In the first version of parameter, + // 0 means no collection path, 1 means collection path exist + case 1: + { + // collection path exist + MPX_DEBUG1( "CMPXParameter::InternalizeL collection path" ); + iCollectionPath = CMPXCollectionPath::NewL(); + aStream >> *iCollectionPath; + MPX_DEBUG_PATH( *iCollectionPath ); + } // fall through on purpose + case 0: + { + iVersion = 1; // if it's 0, set the version to 1 + iPathType = static_cast( aStream.ReadInt32L() ); + MPX_DEBUG2( "CMPXParameter::InternalizeL iPathType = %d", iPathType ); + + TInt paramExist( aStream.ReadInt32L() ); + if ( paramExist == 1 ) + { + // view uid exist + iType.iUid = aStream.ReadInt32L(); + MPX_DEBUG2( "CMPXParameter::InternalizeL uid = 0x%x", iType.iUid ); + } +#ifdef _DEBUG + else + { + MPX_DEBUG1( "CMPXParameter::InternalizeL no uid" ); + } +#endif + break; + } + case 2: + { + iCmdForward = aStream.ReadInt32L(); + MPX_DEBUG2( "CMPXParameter::InternalizeL iCmdForward = %d", iCmdForward ); + + TInt paramExist = aStream.ReadInt32L(); + if ( paramExist == 1 ) + { + // collection path exist + iCollectionPath = CMPXCollectionPath::NewL(); + aStream >> *iCollectionPath; + MPX_DEBUG_PATH( *iCollectionPath ); + } +#ifdef _DEBUG + else + { + MPX_DEBUG1( "CMPXParameter::InternalizeL no collection path" ); + } +#endif + + iPathType = static_cast( aStream.ReadInt32L() ); + MPX_DEBUG2( "CMPXParameter::InternalizeL iPathType = %d", iPathType ); + + paramExist = aStream.ReadInt32L(); + if ( paramExist == 1 ) + { + // view uid exist + iType.iUid = aStream.ReadInt32L(); + MPX_DEBUG2( "CMPXParameter::InternalizeL uid = 0x%x", iType.iUid ); + } +#ifdef _DEBUG + else + { + MPX_DEBUG1( "CMPXParameter::InternalizeL no uid" ); + } +#endif + break; + } + default: + { + User::Leave( KErrNotSupported ); + break; + } + } + } + + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxpluginhandlerbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxpluginhandlerbase.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,1109 @@ +/* +* Copyright (c) 2006 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 plugin handler +* +* CMPXPluginHandlerBase instantiates and owns a CMPXPluginMonitor to monitor +* plugins for the designated plugin interface. When a plugin for that plugin +* interface is added/removed, PluginsChangedL is called. This base plugin +* handler provides a default implementation for PluginsChangedL which requests +* child class to perform plugin resolution. +* +* CMPXPluginHandlerBase also provides plugin selection plugin APIs. These +* methods set up the selection criteria and then request child class to +* resolve these selection criteria to a plugin via ResolvePluginL. +* +* +*/ + + + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include "mpxpluginhandlerobserver.h" +#include "mpxpluginhandlerbase.h" + +// CONSTANTS + +// ============================ LOCAL FUNCTIONS ============================== + +// --------------------------------------------------------------------------- +// Local function to cleanup an array +// --------------------------------------------------------------------------- +// +static void CleanupPluginInfoArray( + TAny* item) + { + ((RPointerArray*)item)->ResetAndDestroy(); + ((RPointerArray*)item)->Close(); + } + +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Constructor. +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXPluginHandlerBase::CMPXPluginHandlerBase( + TUid aInterfaceUid, + TPluginSelection aSelection, + TInt aSelectionType, + MMPXPluginHandlerObserver& aObserver, + CMPXPluginMonitor* aPluginMonitor/*=NULL*/) +: iObserver(aObserver), + iInterfaceUid(aInterfaceUid), + iPluginMonitor(aPluginMonitor), + iSelection(aSelection), + iSelectedType(aSelectionType) + { + iOwnedPluginMonitor = iPluginMonitor ? EFalse : ETrue; + } + +// ---------------------------------------------------------------------------- +// 2nd phase constructor. +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginHandlerBase::BaseConstructL() + { + CreatePluginListL(); + if (iOwnedPluginMonitor) + { + iPluginMonitor = CMPXPluginMonitor::NewL(iInterfaceUid); + } + iPluginMonitor->AddObserverL(*this); + } + +// ---------------------------------------------------------------------------- +// Destructor. +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXPluginHandlerBase::~CMPXPluginHandlerBase() + { + if ( iPluginMonitor ) + { + TRAP_IGNORE( iPluginMonitor->RemoveObserverL( *this ) ); + } + if (iOwnedPluginMonitor) + { + delete iPluginMonitor; + } + delete iDataType; + delete iScheme; + delete iExt; + + iPluginInfoArray.ResetAndDestroy(); + } +// ---------------------------------------------------------------------------- +// Select this specific plugin +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginHandlerBase::SelectPluginL(const TUid& aPluginUid) + { + MPX_DEBUG2("CMPXPluginHandlerBase::SelectPluginL(Uid 0x%08x)", aPluginUid.iUid); + + ClearSelectionCriteria(); + + iSelection=ESelectionUid; + iSelectedUid=aPluginUid; + + ResolvePluginL(); + MPX_DEBUG1("<--CMPXPluginHandlerBase::SelectPluginL() exits"); + } + +// ---------------------------------------------------------------------------- +// select the plugin with the specified name +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginHandlerBase::SelectPluginL(const TDesC& aPluginName) + { + MPX_DEBUG2("CMPXPluginHandlerBase::SelectPluginL(PluginName %S)", &aPluginName); + + SelectPluginL( PluginUid( aPluginName ) ); + MPX_DEBUG1("<--CMPXPluginHandlerBase::SelectPluginL() exits"); + } + +// ---------------------------------------------------------------------------- +// Set up selection criteria, e.g. data type, extension, and scheme and then +// resolve plugin +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginHandlerBase::SelectPluginL( + const TDesC& aUri, + const TDesC8& aDataType) + { + MPX_FUNC("CMPXPluginHandlerBase::PluginL"); + + delete iScheme; + iScheme=NULL; + delete iExt; + iExt=NULL; + delete iDataType; + iDataType=NULL; + + TPtrC fullpath; + TUriParser up; + TParse fp; + // + // Is it a valid URI, or even full path (e.g. c:\\data\test.mp3") + // + if (up.Parse(aUri)==KErrNone) + { + const TDesC& uriScheme=up.Extract(EUriScheme); + // + // Could be just drive letter if path + // which isn't really a scheme + // + if (uriScheme.Length()>1) + { + iScheme=MPXUser::Alloc8L(uriScheme); + } + else if (fp.Set(aUri,NULL,NULL)==KErrNone) // Must be a full path + { + fullpath.Set(fp.FullName()); + } + else + { + User::Leave(KErrArgument); + } + // + // Get the extension + // + iExt=MPXUser::Alloc8L(fp.Ext()); + } + if (aDataType.Length()) + { + iDataType=aDataType.AllocL(); + } + else if (fullpath.Length()) + { + RApaLsSession aps; + TInt error = aps.Connect(); // always fail in console test + if (KErrNone == error) + { + CleanupClosePushL(aps); + TDataType dataType; + TUid ignore; + if(aps.AppForDocument(fullpath,ignore,dataType)==KErrNone) + { + iDataType=dataType.Des8().AllocL(); + } + CleanupStack::PopAndDestroy(&aps); + } // else APPARC is not working in Console environment, + // Always find plugin by scheme & etension + } + else + { + if ( !iScheme ) // last valid case + { + User::Leave(KErrArgument); + } + } + + ResolvePluginL(); + } + +// ---------------------------------------------------------------------------- +// Select a plugin with the specific type +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginHandlerBase::SelectPluginL(TInt aPluginType) + { + MPX_DEBUG2("CMPXPluginHandlerBase::SelectPluginL(PluginType %x)", aPluginType); + + ClearSelectionCriteria(); + iSelectedType=aPluginType; + ResolvePluginL(); + MPX_DEBUG1("<--CMPXPluginHandlerBase::SelectPluginL() exits"); + } + +// ---------------------------------------------------------------------------- +// select plug-in appropriate for a file +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginHandlerBase::SelectPluginL(const RFile& aFile) + { + MPX_FUNC("CMPXPluginHandlerBase::SelectPluginL(RFile)"); + + TFileName fn; + User::LeaveIfError(aFile.FullName(fn)); + SelectPluginL(fn, KNullDesC8); + } + +// ---------------------------------------------------------------------------- +// CMPXPluginHandlerBase::UsePlugin +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginHandlerBase::UsePlugin( + const TUid& aPluginUid) + { + MPX_FUNC_EX("CMPXPluginHandlerBase::UsePlugin"); + + TInt index(IndexOf(aPluginUid)); + if (index != KErrNotFound) + { + iPluginInfoArray[index]->ReferenceCount()++; + } + } + +// ---------------------------------------------------------------------------- +// CMPXPluginHandlerBase::ReleasePlugin +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CMPXPluginHandlerBase::ReleasePlugin( + const TUid& aPluginUid) + { + MPX_FUNC_EX("CMPXPluginHandlerBase::ReleasePlugin"); + + TBool unload(EFalse); + TInt index(IndexOf(aPluginUid)); + if (index != KErrNotFound) + { + TInt& refCount = iPluginInfoArray[index]->ReferenceCount(); + refCount--; + + if (!refCount) + { + UnloadPlugin(aPluginUid); + unload = ETrue; + } + } + + return unload; + } + +// ---------------------------------------------------------------------------- +// Get current selection criteria +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginHandlerBase::GetSelectionCriteria( + TPluginSelection& aPluginSelection, + TInt& aPluginType, + TUid& aPluginUid, + TPtrC8& aDataType, + TPtrC8& aScheme, + TPtrC8& aExtension) + { + aPluginSelection=iSelection; + aPluginType=iSelectedType; + aPluginUid=iSelectedUid; + + aDataType.Set(*iDataType); + aScheme.Set(*iScheme); + aExtension.Set(*iExt); + } + +// ---------------------------------------------------------------------------- +// Clear current selection criteria +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginHandlerBase::ClearSelectionCriteria() + { + iSelection=ESelectionType; + iSelectedType=0; // unknown type. this info is unknown + iSelectedUid=KNullUid; + + delete iScheme; + iScheme=NULL; + delete iExt; + iExt=NULL; + delete iDataType; + iDataType=NULL; + } + +// ---------------------------------------------------------------------------- +// Resolve a plugin, based on properties (iDataType, iExt and iScheme) +// and selection criteria. If selection is by type, then there is always a +// plug-in resolved (if there are any of that type). +// TO-DO: Room for optimisation +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginHandlerBase::DoResolvePluginL( + TUid& aPluginUid, + TInt& aIndex, + TPtrC& aDisplayName, + TInt& aPluginType) + { + MPX_DEBUG2("===>CMPXPluginHandlerBase::DoResolvePluginL 0x%08x", this); + TInt index=KErrNotFound; + if (iSelection==ESelectionUid) + { + index=IndexOf(iSelectedUid); + } + else // if (iSelection==ESelectionType) + { + TInt score=0; + TInt maxScore=0; + + TInt count(iPluginInfoArray.Count()); + for(TInt i = 0; i < count; ++i) + { + // Must scan from beginning of plugin info array, because plugins + // sorted by priority descendingly + score=0; + + // + // First, try scheme then data type, then extension + // and total up the points + // + HBufC* hbuf = NULL; + TInt pos(0); + const CDesCArray& schemas = iPluginInfoArray[i]->SupportedSchemas(); + if (schemas.MdcaCount() && iScheme) + { + if (iScheme->Length()) + { + hbuf = MPXUser::AllocL(*iScheme); + if (!schemas.FindIsq(*hbuf, pos)) + { // schema supported by the plugin + score+=4; + } + delete hbuf; + hbuf=NULL; + } + } // else schema not supported + + if (iDataType) + { + hbuf = MPXUser::AllocL(*iDataType); + if (!iPluginInfoArray[i]->SupportedMimeTypes().FindIsq(*hbuf, pos)) + { // mime type supported by the plugin + score+=3; + } + delete hbuf; + hbuf=NULL; + } + + if (iExt) + { + hbuf = MPXUser::AllocL(*iExt); + if (!iPluginInfoArray[i]->SupportedExtensions().FindIsq(*hbuf, pos)) + { // extension supported by the plugin + score+=2; + } + delete hbuf; + hbuf=NULL; + } + + if (iSelectedType == iPluginInfoArray[i]->PluginType().iUid) + { + score+=1; // Just for being the right "type" + } + + if (score > maxScore) + { + maxScore=score; + index=i; + } + } + } + + if (index==KErrNotFound) + { + User::Leave(KErrNotSupported); + } + + // + // set return values + // + aPluginUid = iPluginInfoArray[index]->ImplementationUid(); + aIndex = index; + aDisplayName.Set(iPluginInfoArray[index]->DisplayName()); + aPluginType = iPluginInfoArray[index]->PluginType().iUid; + +#ifdef _DEBUG + PrintPluginInfo(); +#endif + + MPX_DEBUG5("<===CMPXPluginHandlerBase::DoResolvePluginL 0x%08x (aPluginUid 0x%08x, aIndex %d, aDisplayName %S)", + this, aPluginUid.iUid, aIndex, &aDisplayName); + } + +// ---------------------------------------------------------------------------- +// Handles request completion event +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginHandlerBase::PluginsChangedL() + { + MPX_DEBUG2("===> CMPXPluginHandlerBase::PluginsChangedL 0x%08x", this); + CreatePluginListL(); + ResolvePluginL(); + MPX_DEBUG2("<=== CMPXPluginHandlerBase::PluginsChangedL 0x%08x", this); + } + +// ---------------------------------------------------------------------------- +// Handles a plugin unload request +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginHandlerBase::HandlePluginUnload( + const TUid& aPluginUid) + { + UnloadPlugin(aPluginUid); + } + +// ---------------------------------------------------------------------------- +// Resolve a plugin +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginHandlerBase::ResolvePluginL() + { + // Do nothing in base class + } + +// ---------------------------------------------------------------------------- +// CMPXPluginHandlerBase::IsPluginLoaded +// This method had to be made virtual (and not pure virtual) because +// the playlist engine instantiates the base class. +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CMPXPluginHandlerBase::IsPluginLoaded( + const TUid& /* aPluginUid */) + { + return EFalse; + } + +// ---------------------------------------------------------------------------- +// CMPXPluginHandlerBase::LoadPluginL +// This method had to be made virtual (and not pure virtual) because +// the playlist engine instantiates the base class. +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginHandlerBase::LoadPluginL( + const TUid& /* aPluginUid */) + { + // do nothing + } + +// ---------------------------------------------------------------------------- +// CMPXPluginHandlerBase::UnloadPlugin +// This method had to be made virtual (and not pure virtual) because +// the playlist engine instantiates the base class. +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginHandlerBase::UnloadPlugin( + const TUid& /* aPluginUid */) + { + // do nothing + } + +// ---------------------------------------------------------------------------- +// Return a new instance of the plugin info class +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXPluginInfo* CMPXPluginHandlerBase::ConstructPluginInfoLC( + const CImplementationInformation& aData ) + { + return CMPXPluginInfo::NewLC( aData ); + } + + +// ---------------------------------------------------------------------------- +// Return plugin name which supports the specified type +// ---------------------------------------------------------------------------- +// +EXPORT_C const TDesC& CMPXPluginHandlerBase::PluginName( + TInt aPluginType) const + { + const TDesC* name=&KNullDesC; + for ( TInt i=iPluginInfoArray.Count(); --i >= 0 ; ) + { + if ( aPluginType == iPluginInfoArray[i]->PluginType().iUid ) + { + name = &(iPluginInfoArray[i]->DisplayName()); + break; + } + } + return *name; + } + +// ---------------------------------------------------------------------------- +// Return plugin name which supports the specified uid +// ---------------------------------------------------------------------------- +// +EXPORT_C const TDesC& CMPXPluginHandlerBase::PluginName(const TUid& aUid) const + { + const TDesC* name=&KNullDesC; + TInt index(IndexOf(aUid)); + MPX_ASSERT(KErrNotFound!=index && indexDisplayName(); + return *name; + } + +// ---------------------------------------------------------------------------- +// Return a list of plugin names +// ---------------------------------------------------------------------------- +// +EXPORT_C CDesCArray* CMPXPluginHandlerBase::PluginNamesL() + { + CDesCArray* desArray = new(ELeave)CDesCArrayFlat(KMPXArrayGranularity); + CleanupStack::PushL(desArray); + for(TInt i=iPluginInfoArray.Count(); --i>=0 ;) + { + HBufC* item = iPluginInfoArray[i]->DisplayName().AllocLC(); + + //ignore leave when insert the same item + TRAP_IGNORE(desArray->InsertIsqL(*item)); + CleanupStack::PopAndDestroy(item); + } + CleanupStack::Pop(desArray); + return desArray; + } + +// ---------------------------------------------------------------------------- +// returns a list of plugin types +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginHandlerBase::GetPluginTypes(RArray& aTypes) const + { + aTypes.Reset(); + TInt count(iPluginInfoArray.Count()); + for(TInt i=0; iPluginType().iUid); + } + } + +// ---------------------------------------------------------------------------- +// Return the list of UIDs of all plugins +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginHandlerBase::GetPluginUids(RArray& aUids) const + { + aUids.Reset(); + TInt count(iPluginInfoArray.Count()); + for(TInt i=0; iImplementationUid()); + } + } + +// ---------------------------------------------------------------------------- +// Get plugin list with the specific type +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginHandlerBase::GetPluginUidsL( + RArray& aPlugins, + TInt aPluginType) const + { + aPlugins.Reset(); + for(TInt i=iPluginInfoArray.Count(); --i>=0 ;) + { + if (aPluginType == iPluginInfoArray[i]->PluginType().iUid) + { + aPlugins.Append(iPluginInfoArray[i]->ImplementationUid()); + } + } + } + +// ---------------------------------------------------------------------------- +// Get plugin UID with the specified display name +// ---------------------------------------------------------------------------- +// +EXPORT_C TUid CMPXPluginHandlerBase::PluginUid(const TDesC& aPluginName) const + { + TUid uid( KNullUid ); + + for(TInt i=iPluginInfoArray.Count();--i>=0;) + { + if ( aPluginName.Compare(iPluginInfoArray[i]->DisplayName()) == 0 ) + { + uid = iPluginInfoArray[i]->ImplementationUid(); + break; + } + } + + return uid; + } + +// ---------------------------------------------------------------------------- +// returns the index of the specified plugin +// ---------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXPluginHandlerBase::IndexOf(const TUid& aPluginUid) const + { + TInt ret(KErrNotFound); + TInt count(iPluginInfoArray.Count()); + for(TInt i=0; iImplementationUid()==aPluginUid) + { + ret = i; + break; + } + } + return ret; + } + +// ---------------------------------------------------------------------------- +// Return a list of mime types supported by the plugins +// ---------------------------------------------------------------------------- +// +EXPORT_C CDesCArray* CMPXPluginHandlerBase::SupportedMimeTypesL() + { + CDesCArray* descArray = new(ELeave)CDesCArrayFlat(KMPXArrayGranularity); + for(TInt i=iPluginInfoArray.Count();--i>=0;) + { + if( iPluginInfoArray[i] ) + { + MPXUser::MergeArray(iPluginInfoArray[i]->SupportedMimeTypes(), + *descArray); + } + } + return descArray; + } + +// ---------------------------------------------------------------------------- +// Return a list of extensions supported by the plugins +// ---------------------------------------------------------------------------- +// +EXPORT_C CDesCArray* CMPXPluginHandlerBase::SupportedExtensionsL() + { + CDesCArray* descArray = new(ELeave)CDesCArrayFlat(KMPXArrayGranularity); + for(TInt i=iPluginInfoArray.Count();--i>=0;) + { + MPXUser::MergeArray(iPluginInfoArray[i]->SupportedExtensions(), + *descArray); + } + return descArray; + } + +// ---------------------------------------------------------------------------- +// Get plugin type for a given implementation UID +// ---------------------------------------------------------------------------- +// +EXPORT_C TUid CMPXPluginHandlerBase::PluginType( const TUid& aUid ) const + { + TUid ret( KNullUid ); + TInt count( iPluginInfoArray.Count() ); + for( TInt i = 0; i < count; ++i ) + { + if ( iPluginInfoArray[i]->ImplementationUid() == aUid ) + { + ret = iPluginInfoArray[i]->PluginType(); + break; + } + } + return ret; + } + +// ---------------------------------------------------------------------------- +// Get supported app uid for a given implementation UID +// ---------------------------------------------------------------------------- +// +EXPORT_C TUid CMPXPluginHandlerBase::SupportedAppUid( const TUid& aUid ) const + { + TUid ret( KNullUid ); + TInt count( iPluginInfoArray.Count() ); + for( TInt i = 0; i < count; ++i ) + { + if ( iPluginInfoArray[i]->ImplementationUid() == aUid ) + { + ret = iPluginInfoArray[i]->SupportedAppUid(); + MPX_DEBUG2("SupportedAppUid = %d", ret); + break; + } + } + return ret; + } + +// ---------------------------------------------------------------------------- +// Get plugin type for a given implementation UID +// ---------------------------------------------------------------------------- +// +EXPORT_C TUint CMPXPluginHandlerBase::PluginFlagsL( const TUid& aUid ) const + { + TUint ret( 0 ); + TInt count( iPluginInfoArray.Count() ); + TBool found( EFalse ); + for( TInt i = 0; !found && i < count; ++i ) + { + if ( iPluginInfoArray[i]->ImplementationUid() == aUid ) + { + ret = iPluginInfoArray[i]->Flags(); + found = ETrue; + } + } + if ( !found ) + { + User::Leave( KErrNotFound ); + } + return ret; + } + +// ---------------------------------------------------------------------------- +// Return a list of schemas supported by the plugins +// ---------------------------------------------------------------------------- +// +EXPORT_C CDesCArray* CMPXPluginHandlerBase::SupportedSchemasL() + { + CDesCArray* descArray = new(ELeave)CDesCArrayFlat(KMPXArrayGranularity); + for(TInt i=iPluginInfoArray.Count();--i>=0;) + { + MPXUser::MergeArray(iPluginInfoArray[i]->SupportedSchemas(), + *descArray); + } + return descArray; + } + +// ---------------------------------------------------------------------------- +// Return a list of mime types supported by the plugins +// ---------------------------------------------------------------------------- +// +EXPORT_C CDesCArray* CMPXPluginHandlerBase::SupportedMimeTypesL(const TUid& aUid) + { + CDesCArray* descArray = new(ELeave)CDesCArrayFlat(KMPXArrayGranularity); + CleanupStack::PushL(descArray); + for(TInt i=iPluginInfoArray.Count();--i>=0;) + { + if (aUid == iPluginInfoArray[i]->ImplementationUid()) + { + MPXUser::CopyArrayL(iPluginInfoArray[i]->SupportedMimeTypes(), + *descArray); + break; + } + } + CleanupStack::Pop(descArray); + return descArray; + } + +// ---------------------------------------------------------------------------- +// Return a list of extensions supported by the plugins +// ---------------------------------------------------------------------------- +// +EXPORT_C CDesCArray* CMPXPluginHandlerBase::SupportedExtensionsL(const TUid& aUid) + { + CDesCArray* descArray = new(ELeave)CDesCArrayFlat(KMPXArrayGranularity); + CleanupStack::PushL(descArray); + for(TInt i=iPluginInfoArray.Count();--i>=0;) + { + if (aUid == iPluginInfoArray[i]->ImplementationUid()) + { + MPXUser::CopyArrayL(iPluginInfoArray[i]->SupportedExtensions(), + *descArray); + break; + } + } + CleanupStack::Pop(descArray); + return descArray; + } + +// ---------------------------------------------------------------------------- +// Recreates the list of plugins. Handles the scenarios of plugin update, +// addition and removal by comparing the previous list with the current one. +// In case any change is detected to the plugin list the observer interface is +// used to notify the owner. +// +// NOTE: ECOM takes care of versioning for us. When two plugins that implement +// the same interface and have the same implementation UID are detected, it loads +// the one with the higher version. There is no way to have two implementations +// of the same interface that share the implementation UID returned by +// REComSession::ListImplementationsL. +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginHandlerBase::CreatePluginListL() + { + MPX_DEBUG_THREAD("CMPXPluginHandlerBase::CreatePluginListL"); + // Get the current list of plugins that implement the interface + // The ECOM versioning mechanism is appied here. + // Auto destroy array, no need to call ResetAndDestroy and Close + RMPXPointerArray implInfoArray; + REComSession::ListImplementationsL(iInterfaceUid, implInfoArray); + + // Temporary array to store the new plugin infos. + RPointerArray tempInfoArray; + CleanupStack::PushL(TCleanupItem(CleanupPluginInfoArray, &tempInfoArray)); + + // Reused variables + CMPXPluginInfo* prevInfo(NULL); + TBool loaded(EFalse); + + // Iterate the new plugins + // It is expected that when the loop ends the temporary array will contain + // all current plugins and iPluginInfoArray will contain the plugins that + // have been removed + TInt count(implInfoArray.Count()); + MPX_DEBUG3("CMPXPluginHandlerBase::CreatePluginListL numbers of the plugin 0x%08x %d", + this, count); + TInt index(0); + CMPXPluginInfo* info(NULL); + for (; index < count; ++index) + { + // Convert to an internal plugin info instance + info = ConstructPluginInfoLC(*implInfoArray[index]); + const TUid& uid = info->ImplementationUid(); + + // Check if the plugin existed in the previous list + TInt prevIndex = IndexOf(uid); + if (prevIndex != KErrNotFound) + { + // The plugin existed before the update + prevInfo = iPluginInfoArray[prevIndex]; + MPX_DEBUG5("Process the existing plugin 0x%08x uid 0x%08x, old version %d new version %d", + this, uid.iUid, prevInfo->Version(), info->Version()); + // Copy the reference count + info->ReferenceCount() = prevInfo->ReferenceCount(); + + // Compare the versions + if (prevInfo->Version() < info->Version()) + { + // The plugin is being upgraded + loaded = IsPluginLoaded(uid); + + // Generate an update start notification + iObserver.HandlePluginHandlerEvent( + MMPXPluginHandlerObserver::EPluginUpdateStart, uid, loaded, + info->Version()); + + // Check if this plugin was loaded. The plugin is still loaded if this is the first + // handler that got notified or it is already unloaded for any otehr handlers. + if (info->ReferenceCount()) + { + if (loaded) + { + // Unload the old plugin version + MPX_DEBUG2("CMPXPluginHandlerBase::CreatePluginListL unload old plugin 0x%08x", this); + + // The plugin is loaded - ask the monitor to tell all + // handler instances (including this one) to unload it. + // After the call below all plugin instances owned by + // all monitors are unloaded. + // + // Only make this call if the plugin is still loaded, + // i.e. from the first handler that detects the update. + iPluginMonitor->NotifyUnload(uid); + + // Necessary to ensure version upgrade of ECom plugins + // is successful. This call will unload any garbage + // plugins. + REComSession::FinalClose(); + } + + MPX_DEBUG2("CMPXPluginHandlerBase::CreatePluginListL load new plugin 0x%08x", this); + // Load the new plugin version + LoadPluginL(uid); + MPX_DEBUG2("CMPXPluginHandlerBase::CreatePluginListL load new plugin finished 0x%08x", this); + } + + // Generate an update end notification + iObserver.HandlePluginHandlerEvent( + MMPXPluginHandlerObserver::EPluginUpdateEnd, uid, loaded, + info->Version()); + } + + // Delete the entry from the info array + iPluginInfoArray.Remove(prevIndex); + delete prevInfo; + prevInfo = NULL; + } + else + { + MPX_DEBUG2("CMPXPluginHandlerBase::CreatePluginListL found new plugin 0x%08x", this); + // A new plugin is being added + iObserver.HandlePluginHandlerEvent( + MMPXPluginHandlerObserver::EPluginAdd, uid, EFalse, info->Version()); + } + + // Insert into the temporary array - order by priority, high priority first + tempInfoArray.InsertInOrderAllowRepeatsL(info, + CMPXPluginInfo::ComparePluginInfoByPriority); + + CleanupStack::Pop(info); + } + + // What is left in iPluginInfoArray are removed plugins + while (iPluginInfoArray.Count()) + { + prevInfo = iPluginInfoArray[0]; + const TUid& uid = prevInfo->ImplementationUid(); + + loaded = IsPluginLoaded(uid); + MPX_DEBUG3("CMPXPluginHandlerBase::CreatePluginListL plugin removed 0x%08x uid 0x%08x", + this, uid.iUid); + // Generate an remove notification + iObserver.HandlePluginHandlerEvent( + MMPXPluginHandlerObserver::EPluginRemove, uid, loaded, + prevInfo->Version()); + + // Check if the plugin is currently loaded + if (loaded) + { + // Unload the plugin + UnloadPlugin(uid); + } + + iPluginInfoArray.Remove(0); + delete prevInfo; + prevInfo = NULL; + } + + // iPluginInfoArray should be empty and the temp array should contain all new plugins + // Copy the pointers to iPluginInfoArray - the ownership is transferred + for (index = 0; index < count; ++index) + { + info = tempInfoArray[0]; + iPluginInfoArray.AppendL(info); + tempInfoArray.Remove(0); + // check if this plugin should be pre-loaded and not loaded yet + if (info->Flags() & EMPXPluginFlagPreLoad && info->ReferenceCount() == 0) + { + // pre-load the plugin - have to go through SelectPluginL + // to apply the reference counting consistently + TRAP_IGNORE(SelectPluginL(info->ImplementationUid())); + } + } + + // Reset the temp array - this does not delete the plugin info instances pointed to + // from the array - these were copied to iPluginInfoArray + CleanupStack::Pop(); // TCleanupItem(CleanupPluginInfoArray, &tempInfoArray) + tempInfoArray.Close(); + } + +// ---------------------------------------------------------------------------- +// CMPXPluginHandlerBase::SupportUids +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CMPXPluginHandlerBase::SupportUids( + const TUid& aPluginId, + const TArray& aUids) const + { + TInt index(IndexOf(aPluginId)); + MPX_ASSERT(index!=KErrNotFound && index < iPluginInfoArray.Count()); + return iPluginInfoArray[index]->SupportUids(aUids); + } + +// ---------------------------------------------------------------------------- +// Search a plugin by matching implementation id, supported id and plugin type +// If two plugins get the same score, high priority plugin's implementation +// uid will be returned +// ---------------------------------------------------------------------------- +// +EXPORT_C TUid CMPXPluginHandlerBase::FindPlugin(const TArray& aUids) const + { + MPX_DEBUG1("#### MPX Plugins ####"); + TInt count(iPluginInfoArray.Count()); + for (TInt index = 0; index < count; ++index) + { + CMPXPluginInfo* info = iPluginInfoArray[index]; + const TDesC& name = info->DisplayName(); + MPX_DEBUG5("%S [0x%08X] Priority: %d Ref Count: %d", &name, info->ImplementationUid(), + info->Priority(), info->ReferenceCount()); + MPX_DEBUG2("Version %d", info->Version()); + } + + TInt lastScore( 0 ); + CMPXPluginInfo* mostPossiblePluginInfo( NULL ); + TUid uid = TUid::Null(); + + // Find the most suitable plugin + for ( TInt i = iPluginInfoArray.Count(); --i >= 0; ) + { + TInt score( 0 ); + CMPXPluginInfo* info = iPluginInfoArray[i]; + const TArray supportedUids = info->SupportedUids(); + + for ( TInt j = aUids.Count(); --j >= 0; ) + { + for (TInt k=supportedUids.Count(); --k >=0;) + { + if ( aUids[j] == supportedUids[k] ) + { + // Five scores if in the supported uids list. + score += 5; + + // We now allow a UID to be repeated multiple times + // for emphasized scoring. + //break; + } + } + if (info->ImplementationUid() == aUids[j]) + { + score += 100; + } + if ( info->PluginType() == aUids[j]) + { // One more if match plugin type + score++; + } + } + + if ( score ) + { + if ( lastScore < score ) + { + lastScore = score; + mostPossiblePluginInfo = info; + } + else if ( lastScore == score ) + { + // Use priority to determine if scores are the same + // If same priorities are detected, the first found plugin + // will be used. + if (mostPossiblePluginInfo->Priority() < info->Priority()) + { + mostPossiblePluginInfo = info; + } + } // else do nothing + } + } + if (mostPossiblePluginInfo) + { + uid = mostPossiblePluginInfo->ImplementationUid(); + } + return uid; + } + +#ifdef _DEBUG + +// ---------------------------------------------------------------------------- +// CMPXPluginHandlerBase::PrintPluginInfo +// ---------------------------------------------------------------------------- +// +void CMPXPluginHandlerBase::PrintPluginInfo() + { + MPX_DEBUG1("#### MPX Plugins ####"); + + TInt count(iPluginInfoArray.Count()); + for (TInt index = 0; index < count; ++index) + { + CMPXPluginInfo* info = iPluginInfoArray[index]; + const TDesC& name = info->DisplayName(); + MPX_DEBUG5("%S [0x%08X] Priority: %d Ref Count: %d", &name, info->ImplementationUid(), + info->Priority(), info->ReferenceCount()); + MPX_DEBUG2("Version %d", info->Version()); + } + } + +#endif + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API +// ---------------------------------------------------------------------------- +// select plug-in appropriate for a file +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginHandlerBase::SelectPlugin64L(const RFile64& aFile) + { + MPX_FUNC("CMPXPluginHandlerBase::SelectPlugin64L(RFile64)"); + + TFileName fn; + User::LeaveIfError(aFile.FullName(fn)); + SelectPluginL(fn, KNullDesC8); + } +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxplugininfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxplugininfo.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,560 @@ +/* +* Copyright (c) 2006 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: Implementation of plugin info +* +*/ + + + +// INCLUDE FILES +#include +#include +#include + + +// CONSTANTS +_LIT8(KMPXTagMatch, "**"); +_LIT8(KMPXTagEnd,"*<*?>*"); + +_LIT8(KMPXSupportUidsTag, "

"); +_LIT8(KMPXPluginTypeTag, "" ); +_LIT8(KMPXPluginFlagTag, "" ); +_LIT8(KMPXPluginPriorityTag, "" ); +_LIT8(KMPXSupportSchemasTag,""); +_LIT8(KMPXSupportExtensionsTag,""); + +_LIT8(KMPXSupportAppUidTag, ""); +_LIT8(KMPX0x, "0x"); +_LIT8(KMPX0X, "0X"); +const TUint8 KMPXSemicolon = ';'; +const TInt KMPXTagLength = 3; + + +// ============================ INTERNAL CLASSES ============================== + +/** +Utility class used to parse data separated by xml-style tags. +*/ +class TaggedDataParser + { +public: + + /** + *Splits aData into xml-style tags and values, and gets aClient to process + *each tag/value pair. + */ + static void ParseTaggedDataL(const TDesC8& aData, + MTaggedDataParserClient& aClient); + + /** + * Converts a string to a Tint. The string may contain hex value or decimal value + */ + static void ConvertText8ToTIntL(const TDesC8& aData, TInt& aInt); + + /** + * Extracts elemements separated by semicolon into array descriptor + * + * @param aText original content to extract elements from + * @param aArray the array to add the extracted elements to + */ + static void ExtractIntoArrayL(const TDesC8& aText, CDesCArray*& aArray); + + /** + * Add an item into descriptor array + * + * @param aItem the item to be added to the descriptor array + * @param aArray the array to add the item to + */ + static void AddItemIntoArrayL(TPtrC8& aItem, CDesCArray*& aArray); + }; + +// ---------------------------------------------------------------------------- +// Parser xml-styled data +// ---------------------------------------------------------------------------- +// +void TaggedDataParser::ParseTaggedDataL( + const TDesC8& aData, + MTaggedDataParserClient& aClient) + { + TPtrC8 data(aData); + TInt readPosition = 0; + TBool moreData = data.Length() ? ETrue : EFalse; + while (moreData) + { + // Assumes that this segment will begin with a tag + TPtrC8 restOfData = data.Mid(readPosition); + + TInt endPos = restOfData.MatchF(KMPXTagMatch); + if (endPos == KErrNotFound) + User::Leave(KErrCorrupt); + + // extract the tag + TPtrC8 tag = restOfData.Left(KMPXTagLength); + readPosition += KMPXTagLength; + // Find the next tag + restOfData.Set(data.Mid(readPosition)); + endPos = restOfData.MatchF(KMPXTagMatch); + + TPtrC8 tagData; + if (endPos == KErrNotFound) + { // no more tag available + endPos = restOfData.MatchF(KMPXTagEnd); + if (endPos == KErrNotFound) + { // If we didn't find a tag ender, we must be at the end of + // the data + tagData.Set(restOfData); + readPosition = restOfData.Length(); + } + else + { + tagData.Set(restOfData.Left(endPos)); + } + moreData = EFalse; + } + else + { + // strip the end tag from data if found + TInt stripEndPos = restOfData.MatchF(KMPXTagEnd); + if ( stripEndPos != KErrNotFound ) + { + tagData.Set(restOfData.Left(stripEndPos)); + } + else + { + tagData.Set(restOfData.Left(endPos)); + } + readPosition += endPos; + } + aClient.ProcessTaggedDataL(tag, tagData); + } + } + +// ---------------------------------------------------------------------------- +// Convert text into a integer +// ---------------------------------------------------------------------------- +// +void TaggedDataParser::ConvertText8ToTIntL( + const TDesC8& aData, + TInt& aInt) + { + // Determine whether hex or decimal then parse as such + if (((aData.FindF(KMPX0x) == 0) || (aData.FindF(KMPX0X) == 0)) && + (aData.Length() >= KMPXTagLength)) + { + // only take the characters after "0x" + TLex8 lex(aData.Right(aData.Length()-2)); + TUint value( 0 ); + User::LeaveIfError(lex.Val(value, EHex)); + aInt = value; + } + else if (aData.Length() > 0) + { + TLex8 lex(aData); + TInt32 value(0); + User::LeaveIfError(lex.Val(value)); + aInt = value; + } + else + { + User::Leave(KErrCorrupt); + } + } + +// --------------------------------------------------------------------------- +// Extracts elemements separated by semicolon into array descriptor +// ---------------------------------------------------------------------------- +// +void TaggedDataParser::ExtractIntoArrayL( + const TDesC8& aText, + CDesCArray*& aArray) + { + const TUint8* p = aText.Ptr(); + TInt startPos(0); + TInt pos(0); + TInt len=aText.Length(); + TPtrC8 element; + + while (pos < len) + { + if (*(p+pos) == KMPXSemicolon) + { + if (pos-startPos > 0) + { + element.Set(p+startPos, pos - startPos); + AddItemIntoArrayL(element, aArray); + } + startPos = pos + 1; + } + ++pos; + } + if (startPos < len && pos - startPos > 0) + {// last item + element.Set(p+startPos, pos - startPos); + AddItemIntoArrayL(element, aArray); + } + } + +// --------------------------------------------------------------------------- +// Add an item into descriptor +// ---------------------------------------------------------------------------- +// +void TaggedDataParser::AddItemIntoArrayL(TPtrC8& aItem, CDesCArray*& aArray) + { + HBufC* item = MPXUser::AllocL(aItem); + CleanupStack::PushL(item); + //ignore leave when insert the same item + TRAP_IGNORE(aArray->InsertIsqL(*item)); + CleanupStack::PopAndDestroy(item); + } + + +// ============================ MEMBER FUNCTIONS ============================== + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXPluginInfo::CMPXPluginInfo() + { + } + +// --------------------------------------------------------------------------- +// By default Symbian 2nd phase constructor is private. +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginInfo::ConstructL( + const CImplementationInformation& aData ) + { + iPluginName = aData.DisplayName().AllocL(); + iPluginUid = aData.ImplementationUid(); + iVersion = aData.Version(); + + iSupportedSchemas = new(ELeave)CDesCArrayFlat(KMPXArrayGranularity); + iSupportedMimeTypes = new(ELeave)CDesCArrayFlat(KMPXArrayGranularity); + iSupportedExtensions = new(ELeave)CDesCArrayFlat(KMPXArrayGranularity); + + TaggedDataParser::ExtractIntoArrayL(aData.DataType(), iSupportedMimeTypes); + // Parse the opaque data... + TaggedDataParser::ParseTaggedDataL(aData.OpaqueData(), *this); + // Add plugin type into supported ids array + TInt err=iSupportedUids.InsertInOrder(iPluginTypeUid,MPXUser::CompareUids); + if (KErrNone!=err && KErrAlreadyExists!=err) + { // ignore duplicated items + User::Leave(err); + } + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CMPXPluginInfo* CMPXPluginInfo::NewL( + const CImplementationInformation& aData ) + { + CMPXPluginInfo* self = CMPXPluginInfo::NewLC( aData ); + CleanupStack::Pop( self ); + + return self; + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CMPXPluginInfo* CMPXPluginInfo::NewLC( + const CImplementationInformation& aData ) + { + CMPXPluginInfo* self = new ( ELeave ) CMPXPluginInfo(); + CleanupStack::PushL( self ); + self->ConstructL( aData ); + + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXPluginInfo::~CMPXPluginInfo() + { + delete iPluginName; + iSupportedUids.Close(); + delete iSupportedSchemas; + delete iSupportedMimeTypes; + delete iSupportedExtensions; + } + +// --------------------------------------------------------------------------- +// Process a tagged data +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginInfo::ProcessTaggedDataL(const TDesC8& aTag, const TDesC8& aData) + { + if (aTag==KMPXSupportUidsTag) + { + ExtractSupportedUidsL(aData); + } + else if (aTag==KMPXSupportAppUidTag) + { + TInt type(0); + TaggedDataParser::ConvertText8ToTIntL(aData, type); + iSupportedAppUid = TUid::Uid(type); + MPX_DEBUG2("Plugin supported App Uid = %d", iSupportedAppUid); + } + else if (aTag==KMPXPluginTypeTag) + { + TInt type(0); + TaggedDataParser::ConvertText8ToTIntL(aData, type); + iPluginTypeUid = TUid::Uid(type); + } + else if (aTag==KMPXPluginFlagTag) + { + TInt value(0); + TaggedDataParser::ConvertText8ToTIntL(aData, value); + iFlags = (TUint)value; + } + else if (aTag==KMPXPluginPriorityTag) + { + iPriority = 0; + TaggedDataParser::ConvertText8ToTIntL(aData, iPriority); + } + else if (aTag==KMPXSupportSchemasTag) + { + iSupportedSchemas->Reset(); + TaggedDataParser::ExtractIntoArrayL(aData, iSupportedSchemas); + } + else if (aTag==KMPXSupportExtensionsTag) + { + iSupportedExtensions->Reset(); + TaggedDataParser::ExtractIntoArrayL(aData, iSupportedExtensions); + } + else // let derived class to process the data + { + ProcessTaggedDataExL(aTag, aData); + } + } + +// --------------------------------------------------------------------------- +// Default implementation of a extended tagged data +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginInfo::ProcessTaggedDataExL( + const TDesC8& /*aTag*/, + const TDesC8& /*aData*/) + { + // Do nothing; derived class can add extended tags + } +// --------------------------------------------------------------------------- +// Returns plugin's display name. +// --------------------------------------------------------------------------- +// +const TDesC& CMPXPluginInfo::DisplayName() const + { + return iPluginName ? static_cast( *iPluginName ) : KNullDesC; + } + +// --------------------------------------------------------------------------- +// Returns plugin's implementation uid. +// --------------------------------------------------------------------------- +// +EXPORT_C const TUid& CMPXPluginInfo::ImplementationUid() const + { + return iPluginUid; + } + +// --------------------------------------------------------------------------- +// Returns plugin's supported uids. +// --------------------------------------------------------------------------- +// +const TArray CMPXPluginInfo::SupportedUids() const + { + return iSupportedUids.Array(); + } + +// --------------------------------------------------------------------------- +// Returns plugin's plugin type. +// --------------------------------------------------------------------------- +// +const TUid& CMPXPluginInfo::PluginType() const + { + return iPluginTypeUid; + } + +// --------------------------------------------------------------------------- +// Returns Plugin's supported App Uid. +// --------------------------------------------------------------------------- +// +const TUid& CMPXPluginInfo::SupportedAppUid() const + { + return iSupportedAppUid; + } + +// --------------------------------------------------------------------------- +// Returns plugin's view priority. +// --------------------------------------------------------------------------- +// +TInt CMPXPluginInfo::Priority() const + { + return iPriority; + } + +// --------------------------------------------------------------------------- +// Extracts plugin supported Uids from data. +// --------------------------------------------------------------------------- +// +void CMPXPluginInfo::ExtractSupportedUidsL(const TDesC8& aData) + { + iSupportedUids.Reset(); + ExtractUidsFromTextL( aData, iSupportedUids ); + } + +// --------------------------------------------------------------------------- +// Parse a text string to extract a list of UIDs +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginInfo::ExtractUidsFromTextL( const TDesC8& aData, + RArray& aArray ) + { + aArray.Reset(); + const TUint8* p = aData.Ptr(); + TInt startPos(0); + TInt pos(0); + TInt len=aData.Length(); + TPtrC8 element; + TInt err(KErrNone); + while (pos < len) + { + if (*(p+pos) == KMPXSemicolon) + { + if (pos-startPos > 0) + { + element.Set(p+startPos, pos - startPos); + TInt val(0); + TaggedDataParser::ConvertText8ToTIntL(element, val); + err = aArray.InsertInOrder(TUid::Uid(val), + MPXUser::CompareUids); + if (KErrNone!=err && KErrAlreadyExists!=err) + { // ignore duplicated items + User::Leave(err); + } + } + startPos = pos + 1; + } + ++pos; + } + if (startPos < len && pos - startPos > 0) + {// last item + element.Set(p+startPos, pos - startPos); + TInt val(0); + TaggedDataParser::ConvertText8ToTIntL(element, val); + aArray.AppendL(TUid::Uid(val)); + } + } + +// --------------------------------------------------------------------------- +// Return supported mime types +// --------------------------------------------------------------------------- +// +const CDesCArray& CMPXPluginInfo::SupportedMimeTypes() const + { + return *iSupportedMimeTypes; + } + +// --------------------------------------------------------------------------- +// Return supported extensions +// --------------------------------------------------------------------------- +// + +const CDesCArray& CMPXPluginInfo::SupportedExtensions() const + { + return *iSupportedExtensions; + } + +// --------------------------------------------------------------------------- +// Return supported schemas +// --------------------------------------------------------------------------- +// +const CDesCArray& CMPXPluginInfo::SupportedSchemas() const + { + return *iSupportedSchemas; + } + +// ---------------------------------------------------------------------------- +// CMPXPluginInfo::SupportUids +// ---------------------------------------------------------------------------- +// +TBool CMPXPluginInfo::SupportUids(const TArray& aUids) const + { + return MPXUser::CompareOrderedUidArrays(iSupportedUids.Array(), aUids)>=0; + } + +// ---------------------------------------------------------------------------- +// CMPXPluginInfo::Flags +// ---------------------------------------------------------------------------- +// +EXPORT_C TUint CMPXPluginInfo::Flags() const + { + return iFlags; + } + +// ---------------------------------------------------------------------------- +// CMPXPluginInfo::Flags +// ---------------------------------------------------------------------------- +// +TInt CMPXPluginInfo::Version() const + { + return iVersion; + } + +// ---------------------------------------------------------------------------- +// CMPXPluginInfo::ReferenceCount +// ---------------------------------------------------------------------------- +// +TInt& CMPXPluginInfo::ReferenceCount() + { + return iReferenceCount; + } + +// ---------------------------------------------------------------------------- +// CMPXPluginInfo::ComparePluginInfoByPriority +// ---------------------------------------------------------------------------- +// +TInt CMPXPluginInfo::ComparePluginInfoByPriority( + const CMPXPluginInfo& aPluginInfo1, + const CMPXPluginInfo& aPluginInfo2) + { + TInt ret(0); + if (aPluginInfo1.Priority() > aPluginInfo2.Priority()) + { + ret=-1; + } + else if (aPluginInfo1.Priority() < aPluginInfo2.Priority()) + { + ret=1; + } + return ret; + } + +// --------------------------------------------------------------------------- +// Extracts elemements separated by semicolon into array descriptor +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPluginInfo::ExtractIntoArrayL(const TDesC8& aText, + CDesCArray*& aArray) + { + TaggedDataParser::ExtractIntoArrayL(aText, aArray); + } + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxpluginmonitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxpluginmonitor.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,164 @@ +/* +* Copyright (c) 2006 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: Plugin monitor +* +* An instance of CMPXPluginMonitor monitors plugins for the designated +* plugin interface. When a plugin for that plugin interface is added or +* removed from the system, CMPXPluginMonitor is notified. CMPXPluginMonitor + notifies its client through MMPXPluginMonitorObserver if any changes of plugin. +* +* +*/ + + + +#include +#include +#include +#include + +#include +#include +#include "mpxpluginmonitor.h" + + +// ============================ MEMBER FUNCTIONS ============================== +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXPluginMonitor* CMPXPluginMonitor::NewL( + const TUid& aInterfaceUid) + { + CMPXPluginMonitor* self = new(ELeave)CMPXPluginMonitor(aInterfaceUid); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------------------------- +// Constructor. +// ---------------------------------------------------------------------------- +// +CMPXPluginMonitor::CMPXPluginMonitor( + const TUid& aInterfaceUid) +: CActive(EPriorityStandard), + iInterfaceUid(aInterfaceUid) + { + CActiveScheduler::Add(this); + } + +// ---------------------------------------------------------------------------- +// 2nd phase constructor. +// ---------------------------------------------------------------------------- +// +void CMPXPluginMonitor::ConstructL() + { + iECs = REComSession::OpenL(); + iECs.NotifyOnChange(iStatus); + SetActive(); + } + +// ---------------------------------------------------------------------------- +// Destructor. +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXPluginMonitor::~CMPXPluginMonitor() + { + Cancel(); + iObservers.Reset(); + iObservers.Close(); + iECs.Close(); + REComSession::FinalClose(); + } + +// ---------------------------------------------------------------------------- +// CMPXPluginMonitor::AddObserverL +// ---------------------------------------------------------------------------- +// +void CMPXPluginMonitor::AddObserverL(MMPXPluginMonitorObserver& aObs) + { + iObservers.AppendL(&aObs); + } + +// ---------------------------------------------------------------------------- +// CMPXPluginMonitor::RemoveObserverL +// ---------------------------------------------------------------------------- +// +void CMPXPluginMonitor::RemoveObserverL(MMPXPluginMonitorObserver& aObs) + { + TInt i=iObservers.FindL(&aObs); + iObservers.Remove(i); + } + +// ---------------------------------------------------------------------------- +// CMPXPluginMonitor::NotifyUnload +// ---------------------------------------------------------------------------- +// +void CMPXPluginMonitor::NotifyUnload( + const TUid& aPluginUid) + { + // notify client + for (TInt i = iObservers.Count(); --i >= 0;) + { + iObservers[i]->HandlePluginUnload(aPluginUid); + } + } + +// ---------------------------------------------------------------------------- +// Handles request completion event +// ---------------------------------------------------------------------------- +// +void CMPXPluginMonitor::RunL() + { + MPX_DEBUG_THREAD("CMPXPluginMonitor::RunL"); + MPX_DEBUG2("CMPXPluginMonitor::RunL interface id 0x%08x", iInterfaceUid.iUid); + iECs.NotifyOnChange(iStatus); + SetActive(); + // notify client + for (TInt i = iObservers.Count(); --i >= 0;) + { + iObservers[i]->PluginsChangedL(); + } + } + +// ---------------------------------------------------------------------------- +// Handles a leave occurring in the request completion event handler RunL() +// ---------------------------------------------------------------------------- +// +TInt CMPXPluginMonitor::RunError(TInt aError) + { + (void)aError; + MPX_DEBUG_THREAD("CMPXPluginMonitor::RunError"); + MPX_DEBUG3("CMPXPluginMonitor::RunError interface id 0x%08x, error", + iInterfaceUid.iUid, aError); + // Restart observer + iECs.NotifyOnChange(iStatus); + SetActive(); + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// Implements cancellation of an outstanding request. +// ---------------------------------------------------------------------------- +// +void CMPXPluginMonitor::DoCancel() + { + MPX_DEBUG_THREAD("CMPXPluginMonitor::DoCancel"); + MPX_DEBUG2("CMPXPluginMonitor::DoCancel interface id 0x%08x", iInterfaceUid.iUid); + iECs.CancelNotifyOnChange(iStatus); + } + +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxpskeywatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxpskeywatcher.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,158 @@ +/* +* Copyright (c) 2006 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: Publish and Subscribe key watcher +* +*/ + + +#include +#include +#include "mpxpskeywatcher.h" +#include "mpxpskeyobserver.h" + +// --------------------------------------------------------------------------- +// Default Constructor +// --------------------------------------------------------------------------- +// +CMPXPSKeyWatcher::CMPXPSKeyWatcher( TUid aUid, TInt aKey, + MMPXPSKeyObserver* aObserver ) : + CActive( EPriorityHigh ), + iObserver( aObserver ), + iUid( aUid ), + iKey( aKey ) + + { + } + + +// --------------------------------------------------------------------------- +// 2nd phased Constructor +// --------------------------------------------------------------------------- +// +void CMPXPSKeyWatcher::ConstructL() + { + CActiveScheduler::Add(this); + + iProperty.Attach( iUid, iKey ); + iProperty.Subscribe( iStatus ); + SetActive(); + } + + +// --------------------------------------------------------------------------- +// Two-Phased COnstructor +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXPSKeyWatcher* CMPXPSKeyWatcher::NewL( TUid aUid, TInt aKey, + MMPXPSKeyObserver* aObserver ) + { + CMPXPSKeyWatcher* self = new(ELeave) CMPXPSKeyWatcher( aUid, + aKey, + aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXPSKeyWatcher::~CMPXPSKeyWatcher() + { + Cancel(); // Cancels waiting request + iProperty.Close(); + } + +// --------------------------------------------------------------------------- +// CMPXPSKeyWatcher::RunL +// --------------------------------------------------------------------------- +// +void CMPXPSKeyWatcher::RunL() + { + iProperty.Subscribe( iStatus ); + SetActive(); + + // Notify Observer and start watching again + if( iObserver ) + { + iObserver->HandlePSEvent( iUid, iKey ); + } + } + +// --------------------------------------------------------------------------- +// CMPXPSKeyWatcher::DoCancel +// --------------------------------------------------------------------------- +// +void CMPXPSKeyWatcher::DoCancel() + { + iProperty.Cancel(); + } + +// --------------------------------------------------------------------------- +// CMPXPSKeyWatcher::GetValue +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXPSKeyWatcher::GetValue( TInt& aValue ) + { + return iProperty.Get( aValue ); + } + +// --------------------------------------------------------------------------- +// CMPXPSKeyWatcher::GetValue +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXPSKeyWatcher::GetValue( TDes8& aValue ) + { + return iProperty.Get( aValue ); + } + +// --------------------------------------------------------------------------- +// CMPXPSKeyWatcher::GetValue +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXPSKeyWatcher::GetValue( TDes16& aValue ) + { + return iProperty.Get( aValue ); + } + +// --------------------------------------------------------------------------- +// CMPXPSKeyWatcher::SetValue +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXPSKeyWatcher::SetValue( TInt aValue ) + { + return iProperty.Set( aValue ); + } + +// --------------------------------------------------------------------------- +// CMPXPSKeyWatcher::SetValue +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXPSKeyWatcher::SetValue( const TDesC8& aValue ) + { + return iProperty.Set( aValue ); + } + +// --------------------------------------------------------------------------- +// CMPXPSKeyWatcher::SetValue +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXPSKeyWatcher::SetValue( const TDesC16& aValue ) + { + return iProperty.Set( aValue ); + } + diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxsession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxsession.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2006 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: implementation of playback session +* +*/ + +#include +#include "mpxsessionretry.h" + + +// ============================== CONSTRUCTOR ================================= + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +EXPORT_C RMPXSession::RMPXSession() + { + iSessionRetry = new RMPXSessionRetry(); + } + +EXPORT_C RMPXSession::~RMPXSession() + { + delete iSessionRetry; + } + +// ============================== MEMBER FUNCTIONS ============================ + +// ---------------------------------------------------------------------------- +// Return the version info +// ---------------------------------------------------------------------------- +// +EXPORT_C TVersion RMPXSession::Version() const + { + return iSessionRetry->Version(); + } + +// ---------------------------------------------------------------------------- +// Connect to server +// ---------------------------------------------------------------------------- +// +EXPORT_C TInt RMPXSession::Connect(const TDesC& aServer, + const TDesC& aImage, + const TVersion& aVersion) + { + return iSessionRetry->Connect(aServer, aImage, aVersion); + } + +// ---------------------------------------------------------------------------- +// Reconnect to server +// ---------------------------------------------------------------------------- +// +EXPORT_C TInt RMPXSession::Reconnect() const + { + return iSessionRetry->Reconnect(); + } + +// ----------------------------------------------------------------------------- +// Send a message +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt RMPXSession::SendReceiveL(TInt aFunction) const + { + return iSessionRetry->SendReceiveL(aFunction); + } + +// ----------------------------------------------------------------------------- +// Send a message +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt RMPXSession::SendReceiveL(TInt aFunction, + const TIpcArgs& aArgs) const + { + return iSessionRetry->SendReceiveL(aFunction, aArgs); + } + +// ----------------------------------------------------------------------------- +// Send a message +// ----------------------------------------------------------------------------- +// +EXPORT_C void RMPXSession::SendReceive(TInt aFunction, + TRequestStatus& aStatus) const + { + iSessionRetry->SendReceive(aFunction, aStatus); + } + +// ----------------------------------------------------------------------------- +// Send a message +// ----------------------------------------------------------------------------- +// +EXPORT_C void RMPXSession::SendReceive(TInt aFunction, + const TIpcArgs& aArgs, + TRequestStatus& aStatus) const + { + iSessionRetry->SendReceive(aFunction, aArgs, aStatus); + } + +// ----------------------------------------------------------------------------- +// Close session. +// ----------------------------------------------------------------------------- +// +EXPORT_C void RMPXSession::Close() + { + iSessionRetry->Close(); + } diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxsessionretry.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxsessionretry.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,164 @@ +/* +* Copyright (c) 2007 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: Client session retry implementation +* +*/ + +#include "mpxsessionretry.h" + + +enum { EFunctionType_SendReceive1, EFunctionType_SendReceive2}; + +// ============================== LOCAL FUNCTIONS ============================= + +// ---------------------------------------------------------------------------- +// Start server process +// ---------------------------------------------------------------------------- +// +LOCAL_C TInt StartServer(const TDesC& aImage) + { + RProcess server; + + TInt r = server.Create(aImage,KNullDesC); + if (r != KErrNone) + { + return r; + } + + TRequestStatus s; + server.Rendezvous(s); + if (s != KRequestPending) + { + server.Kill(0); + } + else + { + server.Resume(); + } + + User::WaitForRequest(s); + + r = (server.ExitType()==EExitPanic) ? KErrGeneral : s.Int(); + server.Close(); + + return r; + } + +// ============================== MEMBER FUNCTIONS ============================ + +// ---------------------------------------------------------------------------- +// Return the version info +// ---------------------------------------------------------------------------- +// +TVersion RMPXSessionRetry::Version() const + { + return iVersion; + } + +// ---------------------------------------------------------------------------- +// Connect to server +// ---------------------------------------------------------------------------- +// +TInt RMPXSessionRetry::Connect(const TDesC& aServer, + const TDesC& aImage, + const TVersion& aVersion) + { + iVersion = aVersion; + iServer = aServer; + iImage = aImage; + + TInt r = RSessionBase::CreateSession(iServer, iVersion, 2); + + if (r == KErrNotFound || r == KErrServerTerminated) + { + r = Reconnect(); + } + + return r; + } + +// ---------------------------------------------------------------------------- +// Reconnect to server +// ---------------------------------------------------------------------------- +// +TInt RMPXSessionRetry::Reconnect() + { + // make sure the current session is closed; it does no harm to close + // a session that is already closed + Close(); + + TInt r = StartServer(iImage); + + if (r == KErrNone || r == KErrAlreadyExists) + { + r = RSessionBase::CreateSession(iServer, iVersion, 2); + } + + return r; + } + +// ----------------------------------------------------------------------------- +// Send a message +// ----------------------------------------------------------------------------- +// +TInt RMPXSessionRetry::SendReceiveL(TInt aFunction) + { + TInt retVal = RSessionBase::SendReceive(aFunction); + + if (KErrServerTerminated == retVal) + { + Reconnect(); // try again in case IAD took down the server to replace it + retVal = RSessionBase::SendReceive(aFunction); + } + + return User::LeaveIfError(retVal); + } + +// ----------------------------------------------------------------------------- +// Send a message +// ----------------------------------------------------------------------------- +// +TInt RMPXSessionRetry::SendReceiveL(TInt aFunction, const TIpcArgs& aArgs) + { + TInt retVal = RSessionBase::SendReceive(aFunction,aArgs); + + if (KErrServerTerminated == retVal) + { + Reconnect(); // try again in case IAD took down the server to replace it + retVal = RSessionBase::SendReceive(aFunction,aArgs); + } + + return User::LeaveIfError(retVal); + } + +// ----------------------------------------------------------------------------- +// Send a message +// ----------------------------------------------------------------------------- +// +void RMPXSessionRetry::SendReceive(TInt aFunction, + TRequestStatus& aStatus) + { + RSessionBase::SendReceive(aFunction, aStatus); + } + +// ----------------------------------------------------------------------------- +// Send a message +// ----------------------------------------------------------------------------- +// +void RMPXSessionRetry::SendReceive(TInt aFunction, + const TIpcArgs& aArgs, + TRequestStatus& aStatus) + { + RSessionBase::SendReceive(aFunction, aArgs, aStatus); + } diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxsubscription.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxsubscription.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,181 @@ +/* +* Copyright (c) 2007 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: MPX subscription class +* +*/ + + +// INCLUDES +#include +#include "mpxmediaarray.h" +#include "mpxsubscriptiondefs.h" +#include "mpxsubscription.h" + +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// CMPXSubscription::NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXSubscription* CMPXSubscription::NewL() + { + CMPXSubscription* self = static_cast(CMPXMedia::NewL()); + CleanupStack::PushL(self); + self->InitializeL(); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------------------------- +// CMPXSubscription::NewL +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXSubscription* CMPXSubscription::NewL( + CMPXMediaArray& aMediaArray) + { + CMPXSubscription* self = static_cast(CMPXMedia::NewL()); + CleanupStack::PushL(self); + self->InitializeL(aMediaArray); + CleanupStack::Pop(self); + return self; + } + +// ---------------------------------------------------------------------------- +// CMPXSubscription::AddItemL +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXSubscription::AddItemL( + const CMPXSubscriptionItem& aItem) + { + // append the subscription item to the media array + CMPXMediaArray* items = Value(KMPXSubscriptionItems); + User::LeaveIfNull(items); + items->AppendL(aItem); + } + +// ---------------------------------------------------------------------------- +// CMPXSubscription::Items +// ---------------------------------------------------------------------------- +// +EXPORT_C const CMPXMediaArray* CMPXSubscription::ItemsL() const + { + MPX_ASSERT(IsSupported(KMPXSubscriptionItems)); + CMPXMediaArray* array = Value(KMPXSubscriptionItems); + User::LeaveIfNull(array); + return array; + } + +// ---------------------------------------------------------------------------- +// CMPXSubscription::operator== +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CMPXSubscription::operator==( + const CMPXSubscription& aSubscription) const + { + TBool match(ETrue); + + const CMPXMediaArray* array1 = aSubscription.ItemsL(); + const CMPXMediaArray* array2 = ItemsL(); + + TInt count(array1->Count()); + if (count != array2->Count()) + { + match = EFalse; + } + else + { + for (TInt index = 0; (index < count) && match; ++index) + { + CMPXSubscriptionItem* subItem1( array1->AtL(index) ); + CMPXSubscriptionItem* subItem2( array2->AtL(index) ); + + TInt attrCount(subItem1->Count()); + if (attrCount != subItem2->Count()) + { + match = EFalse; + break; + } + + for (TInt attrIndex = 0; attrIndex < attrCount; ++attrIndex) + { + const TMPXAttribute& attr( subItem1->Attribute( attrIndex )); + if ( !subItem1->Match( *subItem2, attr ) ) + { + match = EFalse; + break; + } + } + } + } + + return match; + } + +// ---------------------------------------------------------------------------- +// CMPXSubscription::InitializeL +// ---------------------------------------------------------------------------- +// +void CMPXSubscription::InitializeL() + { + // create an empty subscription item array + CMPXMediaArray* dummy = CMPXMediaArray::NewL(); + CleanupStack::PushL(dummy); + SetCObjectValueL(KMPXSubscriptionItems, dummy); + CleanupStack::PopAndDestroy(dummy); + } + +// ---------------------------------------------------------------------------- +// CMPXSubscription::InitializeL +// ---------------------------------------------------------------------------- +// +void CMPXSubscription::InitializeL( + CMPXMediaArray& aMediaArray) + { + SetCObjectValueL(KMPXSubscriptionItems, &aMediaArray); + } + +// ---------------------------------------------------------------------------- +// CMPXSubscription::DebugPrint +// ---------------------------------------------------------------------------- +// +void CMPXSubscription::DebugPrint() const + { + const CMPXMediaArray* array(NULL); + TRAPD(err, array = ItemsL()); + if (KErrNone == err) + { + MPX_ASSERT(array); + TInt count(array->Count()); + for (TInt index = 0; index < count; ++index) + { + CMPXSubscriptionItem* subItem = (*array)[index]; + if (subItem) + { + TInt attrCount(subItem->Count()); + + for (TInt attrIndex = 0; attrIndex < attrCount; ++attrIndex) + { + const TMPXAttribute& attr = subItem->Attribute(attrIndex); + MPX_DEBUG3("Attr: %x, %x", attr.ContentId(), attr.AttributeId()); + } + } + else + { + break; + } + } + } + } + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxtaskqueue.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxtaskqueue.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,576 @@ +/* +* Copyright (c) 2006 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: Serializing the task +* +*/ + +#include +#include "mpxtaskqueueobserver.h" +#include "mpxtaskqueue.h" + +// ============================ PRIVATE CLASS ================================= +NONSHARABLE_CLASS(CTask) : public CBase + { +public: + /** + * C++ constructor + * + * @param aTask task id + * @param aCallback callback + * @param aHandler task handler + * @param aParamData data + * @param aBuf, extra data in buffer, ownership transferred. + * @param aPtrData, extra pointer data + * @param aAlive1, pointer to CBased object, ownership transferred + * @param aCObject2, pointer to CBased object, ownership transferred + */ + CTask(TInt aTask, + TAny* aCallback, + MMPXTaskQueueObserver* aHandler, + TInt aParamData=0, + CBufBase* aBuf=NULL, + TAny* aPtrData=NULL, + CBase* aCObject1=NULL, + CBase* aCObject2=NULL + ); + + /** + * destructor + */ + ~CTask(); + + /** + * Offset to the task queue + * + * @return the offset + */ + static TInt Offset(); + +public: + TInt iTask; + TAny* iCallback; // call back when task completed + MMPXTaskQueueObserver* iHandler; // task handler which will execute the task + TInt iParamData; // Integer data + CBufBase* iBuf; // owned. deleted when task is removed + TAny* iPtrData; // ojbect data, Not owned. + CBase* iCObject1; // owned + CBase* iCObject2; // owned + + TPtrC8 iPtr; // Descriptor to iBuf + TSglQueLink iLink; + }; + +// ---------------------------------------------------------------------------- +// Task contructor +// ---------------------------------------------------------------------------- +// +CTask::CTask( + TInt aTask, + TAny* aCallback, + MMPXTaskQueueObserver* aHandler, + TInt aParamData/*=0*/, + CBufBase* aBuf/*=NULL*/, + TAny* aPtrData/*=NULL*/, + CBase* aCObject1/*=NULL*/, + CBase* aCObject2/*=NULL*/) +: iTask(aTask), iCallback(aCallback), iHandler(aHandler), + iParamData(aParamData),iBuf(aBuf), iPtrData(aPtrData), + iCObject1(aCObject1),iCObject2(aCObject2) + { + if (iBuf) + { + iPtr.Set(iBuf->Ptr(0)); + } + else + { + iPtr.Set(KNullDesC8); + } + } + +// ---------------------------------------------------------------------------- +// Task destructor +// ---------------------------------------------------------------------------- +// +CTask::~CTask() + { + delete iBuf; + delete iCObject1; + delete iCObject2; + } + +// ---------------------------------------------------------------------------- +// Offset of the task queue +// ---------------------------------------------------------------------------- +// +TInt CTask::Offset() + { + return _FOFF(CTask,iLink); + } + +// ============================ PRIVATE CLASS ================================= +NONSHARABLE_CLASS(CMPXTaskQueueScheduler) : public CActive + { + public: + /** + * Two-phased constructor + * @param aObserver the observer + * @return object of constructed + */ + static CMPXTaskQueueScheduler* NewL(TSglQue& aTaskQueue); + + /** + * Destructor + */ + ~CMPXTaskQueueScheduler(); + + /** + * Schedule to execute next task + */ + void ScheduleNextTask(); + + /** + * Complete current task + */ + void CompleteTask(); + + public: // From base classes + + /** + * From CActive + * Handles an active object's request completion event + */ + void RunL(); + + /** + * From CActive + * Implements cancellation of an outstanding request. + */ + void DoCancel(); + + private: + /** + * C++ constructor + * + * @param aObserver observer + */ + CMPXTaskQueueScheduler(TSglQue& aTaskQueue); + + /** + * 2nd phase contructor + * + */ + void ConstructL(); + + private: + TSglQue& iTaskQueue; + TBool iTaskProcessing; + }; + +// ---------------------------------------------------------------------------- +// Two-phased constructor +// ---------------------------------------------------------------------------- +// +CMPXTaskQueueScheduler* CMPXTaskQueueScheduler::NewL(TSglQue& aTaskQueue) + { + CMPXTaskQueueScheduler* s = new(ELeave)CMPXTaskQueueScheduler(aTaskQueue); + CleanupStack::PushL(s); + s->ConstructL(); + CleanupStack::Pop(s); + return s; + } + +// ---------------------------------------------------------------------------- +// Constructor. +// ---------------------------------------------------------------------------- +// +CMPXTaskQueueScheduler::CMPXTaskQueueScheduler(TSglQue& aTaskQueue) + :CActive(EPriorityStandard), + iTaskQueue(aTaskQueue), + iTaskProcessing(EFalse) + { + CActiveScheduler::Add(this); + } + +// ---------------------------------------------------------------------------- +// Constructor. +// ---------------------------------------------------------------------------- +// +void CMPXTaskQueueScheduler::ConstructL() + { + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CMPXTaskQueueScheduler::~CMPXTaskQueueScheduler() + { + Cancel(); + } + +// ---------------------------------------------------------------------------- +// Schedule to execute next task +// ---------------------------------------------------------------------------- +// +void CMPXTaskQueueScheduler::ScheduleNextTask() + { + if (!IsActive() && !iTaskProcessing) + { + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + } + } + +// ---------------------------------------------------------------------------- +// Complete current task +// ---------------------------------------------------------------------------- +// +void CMPXTaskQueueScheduler::CompleteTask() + { + iTaskProcessing = EFalse; + } + +// ---------------------------------------------------------------------------- +// Plugin has completed the request +// ---------------------------------------------------------------------------- +// +void CMPXTaskQueueScheduler::RunL() + { + MPX_FUNC_EX("CMPXTaskQueueScheduler::RunL"); + if (!iTaskQueue.IsEmpty()) + { + CTask* task=iTaskQueue.First(); + if (task->iHandler) + { + iTaskProcessing = ETrue; + MPX_DEBUG3("CMPXTaskQueueScheduler::RunL %d cb 0x%08x", + task->iTask, task->iCallback); + task->iHandler->ExecuteTask(task->iTask, + task->iParamData, + task->iPtrData, + *(task->iBuf), + task->iCallback, + task->iCObject1, + task->iCObject2); + } + } + } + +// ---------------------------------------------------------------------------- +// Canceling has to be done by plugin +// ---------------------------------------------------------------------------- +// +void CMPXTaskQueueScheduler::DoCancel() + { + iTaskProcessing = EFalse; + } + + +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Two-phased constructor +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXTaskQueue* CMPXTaskQueue::NewL() + { + CMPXTaskQueue* s = new(ELeave)CMPXTaskQueue(); + CleanupStack::PushL(s); + s->ConstructL(); + CleanupStack::Pop(s); + return s; + } + +// ---------------------------------------------------------------------------- +// Constructor. +// ---------------------------------------------------------------------------- +// +CMPXTaskQueue::CMPXTaskQueue() + :iTaskList(CTask::Offset()) + { + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXTaskQueue::~CMPXTaskQueue() + { + Reset(); + } + +// ---------------------------------------------------------------------------- +// Constructor. +// ---------------------------------------------------------------------------- +// +void CMPXTaskQueue::ConstructL() + { + } + + +// ---------------------------------------------------------------------------- +// Add a task +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXTaskQueue::AddTaskL( + TInt aTask, + TAny* aCallback, + TInt aParamData/*=0*/, + CBufBase* aBuf/*=NULL*/, + TAny* aPtrData/*=NULL*/, + CBase* aCObject1/*=NULL*/, + CBase* aCObject2/*=NULL*/) + { + MPX_FUNC_EX("CMPXTaskQueue::AddTaskL"); + CTask* t=new(ELeave)CTask(aTask,aCallback,NULL, aParamData, + aBuf, aPtrData,aCObject1,aCObject2); + iTaskList.AddLast(*t); + } + +// ---------------------------------------------------------------------------- +// Remove a task +// ---------------------------------------------------------------------------- +// +EXPORT_C TAny* CMPXTaskQueue::RemoveTask() + { + MPX_FUNC_EX("CMPXTaskQueue::RemoveTask()"); + // Remove current task from queque + if (iTaskList.IsEmpty()) + { + return NULL; + } + CTask* task=iTaskList.First(); + TAny* cb=task->iCallback; + iTaskList.Remove(*task); + MPX_DEBUG3("CMPXTaskQueue::RemoveTask %d cb 0x%08x", task->iTask, cb); + delete task; + return cb; + } + +// ---------------------------------------------------------------------------- +// Remove task from a client +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXTaskQueue::RemoveTask(TAny* aCallback) + { + MPX_FUNC_EX("CMPXTaskQueue::RemoveTask(TAny* aCallback)"); + // Remove current task from queque + TSglQueIter iter(iTaskList); + CTask* t=NULL; + while ((t=iter++) != NULL) // Compiler warning on while (t=iter++) + { + if (t->iCallback == aCallback) + { + iTaskList.Remove(*t); + MPX_DEBUG3("CMPXTaskQueue::RemoveTask %d cb 0x%08x", + t->iTask, aCallback); + delete t; + } + } + } + +// ---------------------------------------------------------------------------- +// Reutrn if the task queue empty +// ---------------------------------------------------------------------------- +// +EXPORT_C TBool CMPXTaskQueue::IsEmpty() + { + return iTaskList.IsEmpty(); + } + +// ---------------------------------------------------------------------------- +// Reset task queue +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXTaskQueue::Reset() + { + TSglQueIter iter(iTaskList); + CTask* t=NULL; + while ((t=iter++) != NULL) // Compiler warning on while (t=iter++) + { + delete t; + } + iTaskList.Reset(); + } + +// ---------------------------------------------------------------------------- +// Return current task +// ---------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXTaskQueue::Param() + { + return iTaskList.IsEmpty() ? KErrNotFound : iTaskList.First()->iParamData; + } + +// ---------------------------------------------------------------------------- +// Return current parameter data +// ---------------------------------------------------------------------------- +// +EXPORT_C TInt CMPXTaskQueue::Task() + { + return iTaskList.IsEmpty() ? KErrNotFound : iTaskList.First()->iTask; + } + +// ---------------------------------------------------------------------------- +// Return current call back +// ---------------------------------------------------------------------------- +// +EXPORT_C TAny* CMPXTaskQueue::Callback() + { + return iTaskList.IsEmpty() ? NULL : iTaskList.First()->iCallback; + } + +// ---------------------------------------------------------------------------- +// Return pointer data +// ---------------------------------------------------------------------------- +// +EXPORT_C TAny* CMPXTaskQueue::PtrData() + { + return iTaskList.IsEmpty() ? NULL : iTaskList.First()->iPtrData; + } + +// ---------------------------------------------------------------------------- +// Return buffer data +// ---------------------------------------------------------------------------- +// +EXPORT_C const TDesC8& CMPXTaskQueue::BufData() + { + if (iTaskList.IsEmpty()) + { + return KNullDesC8; + } + else + { + return iTaskList.First()->iPtr; + } + } + +// ---------------------------------------------------------------------------- +// Two-phased constructor +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXActiveTaskQueue* CMPXActiveTaskQueue::NewL() + { + CMPXActiveTaskQueue* s = new(ELeave)CMPXActiveTaskQueue(); + CleanupStack::PushL(s); + s->ConstructL(); + CleanupStack::Pop(s); + return s; + } + +// ---------------------------------------------------------------------------- +// Constructor. +// ---------------------------------------------------------------------------- +// +CMPXActiveTaskQueue::CMPXActiveTaskQueue() + { + } + +// ---------------------------------------------------------------------------- +// Constructor. +// ---------------------------------------------------------------------------- +// +void CMPXActiveTaskQueue::ConstructL() + { + iScheduler = CMPXTaskQueueScheduler::NewL(iTaskList); + } + + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXActiveTaskQueue::~CMPXActiveTaskQueue() + { + MPX_FUNC_EX("CMPXActiveTaskQueue::~CMPXActiveTaskQueue"); + if (iScheduler) + { + delete iScheduler; + } + } + +// ---------------------------------------------------------------------------- +// Add a task +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXActiveTaskQueue::AddTaskL( + TInt aTask, + TAny* aCallback, + MMPXTaskQueueObserver* aHandler, + TInt aParamData/*=0*/, + CBufBase* aBuf/*=NULL*/, + TAny* aPtrData/*=NULL*/, + CBase* aCObject1/*=NULL*/, + CBase* aCObject2/*=NULL*/) + { + MPX_FUNC_EX("CMPXActiveTaskQueue::AddTaskL"); + CTask* t=new(ELeave)CTask(aTask,aCallback,aHandler,aParamData, + aBuf,aPtrData,aCObject1,aCObject2); + iTaskList.AddLast(*t); + ScheduleNextTask(); + } + +// ---------------------------------------------------------------------------- +// Schedule to execute next task +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXActiveTaskQueue::ScheduleNextTask() + { + iScheduler->ScheduleNextTask(); + } + +// ---------------------------------------------------------------------------- +// Complete current task +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXActiveTaskQueue::CompleteTask() + { + MPX_FUNC_EX("CMPXActiveTaskQueue::CompleteTask()"); + (void)RemoveTask(); + iScheduler->CompleteTask(); + ScheduleNextTask(); + } + +// ---------------------------------------------------------------------------- +// Cancels all outsatnding tasks +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXActiveTaskQueue::CancelRequests() + { + MPX_FUNC_EX("CMPXActiveTaskQueue::CancelRequests"); + iScheduler->Cancel(); + CMPXTaskQueue::Reset(); + } + +// ---------------------------------------------------------------------------- +// CMPXActiveTaskQueue::CompleteAllTasks +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXActiveTaskQueue::CompleteAllTasks( + TInt aError) + { + MPX_FUNC_EX("CMPXActiveTaskQueue::CompleteAllTasks"); + iScheduler->Cancel(); + + TSglQueIter iter(iTaskList); + CTask* task(NULL); + while ((task = iter++) != NULL) // Compiler warning on while (t=iter++) + { + task->iHandler->HandleTaskError(task->iTask, task->iPtrData, + task->iCallback, aError); + delete task; + } + iTaskList.Reset(); + } diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/common/src/mpxuser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/common/src/mpxuser.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,526 @@ +/* +* Copyright (c) 2006 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: mpx user helper classes +* +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "mpxuser.h" + +// ---------------------------------------------------------------------------- +// Recreate a buffer +// ---------------------------------------------------------------------------- +// +EXPORT_C void MPXUser::RecreateBufferL(TInt aSize, CBufBase*& aBuf) + { + delete aBuf; + aBuf=NULL; + CBufBase* buf=CBufFlat::NewL(aSize); + CleanupStack::PushL(buf); + buf->ResizeL(aSize); + CleanupStack::Pop(buf); + aBuf = buf; + } + + +// ---------------------------------------------------------------------------- +// Helper funciton to create descriptor array from buffer +// ---------------------------------------------------------------------------- +// +EXPORT_C void MPXUser::CreateFromBufferL( + const CBufBase &aBuf, + CDesCArray*& aArray) + { + delete aArray; + aArray = NULL; + RBufReadStream rs(aBuf); + CleanupClosePushL(rs); + InternalizeL(aArray, rs); + CleanupStack::PopAndDestroy(&rs); + } + +// ---------------------------------------------------------------------------- +// Helper funciton to create a buffer +// ---------------------------------------------------------------------------- +// +EXPORT_C CBufBase* MPXUser::CreateBufferLC(TInt aSize) + { + CBufBase* buf=CBufFlat::NewL(aSize); + CleanupStack::PushL(buf); + buf->ResizeL(aSize); + return buf; + } + +// ---------------------------------------------------------------------------- +// Create a buffer from an array +// aBuf replaced with the contents of the descriptor array and its sizes. +// The size of the buffer is the size of data in the buffer +// ---------------------------------------------------------------------------- +// +EXPORT_C void MPXUser::CreateBufferL(const MDesCArray* aArray, CBufBase*& aBuf) + { + delete aBuf; + aBuf = NULL; + + CBufBase* buffer=CreateBufferLC(KMPXBufGranularity); + RBufWriteStream ws(*buffer); + CleanupClosePushL(ws); + ExternalizeL(aArray, ws); + ws.CommitL(); + CleanupStack::PopAndDestroy(&ws); + buffer->Compress(); + CleanupStack::Pop(buffer); + aBuf = buffer; + } + +// ---------------------------------------------------------------------------- +// Create buffer from message +// ---------------------------------------------------------------------------- +// +EXPORT_C void MPXUser::CreateBufferL( + const RMessage2& aMessage, + TInt aMsgSlot, + CBufBase*& aBuffer) + { + TInt s=aMessage.GetDesLengthL(aMsgSlot); + if ( s <= 0 ) + { + User::Leave( KErrArgument ); + } + RecreateBufferL(s, aBuffer); + TPtr8 p(aBuffer->Ptr(0)); + aMessage.Read(aMsgSlot,p); + } + +// ---------------------------------------------------------------------------- +// Create buffer from a descriptor +// ---------------------------------------------------------------------------- +// +EXPORT_C void MPXUser::CreateBufferL(const TDesC& aDes, CBufBase*& aBuffer) + { + TPtrC8 ptr8 = MPXUser::Ptr(aDes); + RecreateBufferL(ptr8.Length(), aBuffer); + aBuffer->Write(0, ptr8); + aBuffer->Compress(); + } + +// ---------------------------------------------------------------------------- +// Creates a narrow heap descriptor from a unicode descriptor. +// No character conversion +// ---------------------------------------------------------------------------- +// +EXPORT_C HBufC8* MPXUser::Alloc8L(const TDesC& aDes) + { + HBufC8* des8=HBufC8::NewL(aDes.Length()); + des8->Des().Copy(aDes); + return des8; + } + +// ---------------------------------------------------------------------------- +// Creates a zero-terminated narrow heap descriptor from a unicode descriptor. +// No character conversion +// ---------------------------------------------------------------------------- +// +EXPORT_C HBufC8* MPXUser::Alloc8ZL(const TDesC& aDes) + { + HBufC8* des8=HBufC8::NewL(aDes.Length()+1); + des8->Des().Copy(aDes); + des8->Des().ZeroTerminate(); + return des8; + } + +// ---------------------------------------------------------------------------- +// Creates a heap descriptor from a narrow descriptor. +// No character conversion +// ---------------------------------------------------------------------------- +// +EXPORT_C HBufC* MPXUser::AllocL(const TDesC8& aDes) + { + HBufC* item = HBufC::NewL(aDes.Length()); + item->Des().Copy(aDes); + return item; + } + +// ---------------------------------------------------------------------------- +// Creates a narrow ptr descriptor on a unicode descriptor +// ---------------------------------------------------------------------------- +// +EXPORT_C TPtrC8 MPXUser::Ptr(const TDesC& aDes) + { +#ifdef _UNICODE + TInt len=aDes.Length()*2; // Unicode->Narrow + return TPtrC8((TUint8*)(&aDes[0]),len); +#else + return TPtrC8(aDes); +#endif + } + +// ---------------------------------------------------------------------------- +// Creates a wide ptr descriptor on a narrow descriptor +// ---------------------------------------------------------------------------- +// +EXPORT_C TPtrC MPXUser::Ptr(const TDesC8& aDes) + { +#ifdef _UNICODE + TInt len=aDes.Length()/2; // Narrrow->Unicode + return TPtrC((TUint16*)(&aDes[0]),len); +#else + return TPtrC(aDes); +#endif + } + +// ---------------------------------------------------------------------------- +// Helper internalize a descriptor array from a stream +// ---------------------------------------------------------------------------- +// +EXPORT_C void MPXUser::InternalizeL( + CDesCArray*& aArray, + RReadStream& aStream) + { + delete aArray; + aArray = NULL; + TInt n=aStream.ReadInt32L(); + if( n ) + { + CDesCArray* array=new(ELeave)CDesCArrayFlat(n); + CleanupStack::PushL(array); + TInt len; + for (TInt i=0;iDes(); + aStream.ReadL(bp,len); + array->AppendL(*item); + CleanupStack::PopAndDestroy(item); + } + CleanupStack::Pop(array); + aArray = array; + } + else + { + // Dummy + aArray = new(ELeave)CDesCArrayFlat(1); + } + } + +// ---------------------------------------------------------------------------- +// Helper externalize a descriptor array to a stream +// ---------------------------------------------------------------------------- +// +EXPORT_C void MPXUser::ExternalizeL( + const MDesCArray* aArray, + RWriteStream& aStream) + { + if (aArray) + { + TInt n = aArray->MdcaCount(); + aStream.WriteInt32L(n); + for (TInt i=0;iMdcaPoint(i); + aStream.WriteInt32L( item.Length() ); + aStream.WriteL(item, item.Length()); + } + } + else + { + // Nothing to externalize + aStream.WriteInt32L(0); + } + } + +// ---------------------------------------------------------------------------- +// Group attributes belonging to one content into an item in the array +// ---------------------------------------------------------------------------- +// +EXPORT_C void MPXUser::MergeAttributeL( + const TArray& aSrc, + RArray& aDest) + { + aDest.Reset(); + for (TInt i = 0; i < aSrc.Count(); i++) + { + const TMPXAttribute& s = aSrc[i]; + TInt index = aDest.Find(s, TMPXAttribute::MatchContentId); + if ( KErrNotFound == index ) + { + aDest.AppendL(s); + } + else + { + TMPXAttribute& d = aDest[index]; + d = TMPXAttribute(d.ContentId(), d.AttributeId() | s.AttributeId()); + } + } + } + +// ---------------------------------------------------------------------------- +// Determines the owning process id of the thread +// ---------------------------------------------------------------------------- +// +EXPORT_C TProcessId MPXUser::ProcessIdL(TThreadId aId) + { + RThread t; + User::LeaveIfError(t.Open(aId)); + CleanupClosePushL(t); + RProcess p; + User::LeaveIfError(t.Process(p)); + TProcessId pid=p.Id(); + p.Close(); + CleanupStack::PopAndDestroy(&t); + return pid; + } + +// ---------------------------------------------------------------------------- +// Add array items in aSrc into sorted array aDest if the item is not in +// the aDest yet +// ---------------------------------------------------------------------------- +// +EXPORT_C void MPXUser::MergeArray(const MDesCArray& aSrc, CDesCArray& aDest) + { + for (TInt i=aSrc.MdcaCount(); --i>=0 ;) + { + ////ignore leave when insert the same item + TRAP_IGNORE(aDest.InsertIsqL(aSrc.MdcaPoint(i))); + } + } + +// ---------------------------------------------------------------------------- +// Copies elements from one array of descriptors to another +// ---------------------------------------------------------------------------- +// +EXPORT_C void MPXUser::CopyArrayL(const MDesCArray& aSrc, CDesCArray& aDest) + { + aDest.Reset(); + for (TInt i=0; i < aSrc.MdcaCount(); ++i) + { + aDest.AppendL(aSrc.MdcaPoint(i)); + } + } + +// ---------------------------------------------------------------------------- +// Compare two uids +// ---------------------------------------------------------------------------- +// +EXPORT_C TInt MPXUser::CompareUids(const TUid& aId1, const TUid& aId2) + { + TInt ret(0); + if (aId1.iUid > aId2.iUid) + { + ret=1; + } + else if (aId1.iUid < aId2.iUid) + { + ret=-1; + } + return ret; + } + +// ---------------------------------------------------------------------------- +// Compare two sorted arrays of uids +// ---------------------------------------------------------------------------- +// +EXPORT_C TInt MPXUser::CompareOrderedUidArrays( + const TArray& aArray1, + const TArray& aArray2) + { + TInt ret(-1); + TInt count1 = aArray1.Count(); + TInt count2 = aArray2.Count(); + if (count1 >= count2) + { + TInt s1(0); // start point of array 1 + TBool found(ETrue); + for (TInt i=0; i& aArray, RReadStream& aStream) + { + TInt n=aStream.ReadInt32L(); + for (TInt i=0;i& aArray, RWriteStream& aStream) + { + TInt n=aArray.Count(); + aStream.WriteInt32L(n); + for (TInt i=0;i windowArray; + CleanupClosePushL( windowArray ); + aWsSession.WindowGroupList( &windowArray ); + TInt wgCount( windowArray.Count() ); + + for ( TInt i = 0; i < wgCount && wgId == KErrNotFound; i++ ) + { + TThreadId threadId; + User::LeaveIfError( + aWsSession.GetWindowGroupClientThreadId( + windowArray[i].iId, threadId ) ); + RThread thread; + CleanupClosePushL( thread ); + User::LeaveIfError( thread.Open( threadId )); + RProcess proc; + CleanupClosePushL( proc ); + User::LeaveIfError( thread.Process( proc )); + if ( proc.Id() == aProcId ) + { + wgId = windowArray[i].iId; + } + CleanupStack::PopAndDestroy( &proc ); + CleanupStack::PopAndDestroy( &thread ); + } + CleanupStack::PopAndDestroy( &windowArray ); + return wgId; + } + +// ----------------------------------------------------------------------------- +// Check if there is the given type call ongoing. +// ----------------------------------------------------------------------------- +// +EXPORT_C TBool MPXUser::IsCallOngoing( TInt aCallType ) + { + MPX_FUNC( "MPXUser::IsCallOngoing" ); + // In case call info not fully received (err != KErrNone), + // assume no call exists. + TBool ret( EFalse ); + + // Get call status and type. + TInt callState( EPSCTsyCallStateUninitialized ); + + TInt err( RProperty::Get( + KPSUidCtsyCallInformation, + KCTsyCallState, + callState ) ); + + MPX_DEBUG3("MPXUser::IsCallOngoing() call state: %d , error (%d)", callState, err ); + + if ( !err && + ( callState != EPSCTsyCallStateUninitialized && + callState != EPSCTsyCallStateNone ) ) + { + TInt callType( EPSCTsyCallTypeUninitialized ); + + // There is call ongoing, check it's type. + err = RProperty::Get( + KPSUidCtsyCallInformation, + KCTsyCallType, + callType ); + + MPX_DEBUG3("MPXUser::IsCallOngoing() call type: %d, error (%d)", callType, err ); + + if ( !err ) + { + if ( aCallType == KMPXCallTypeGenericVoice ) + { + // Return true for CSVoice/Video/VOIP calls + ret = ( callType == EPSCTsyCallTypeCSVoice || + callType == EPSCTsyCallTypeH324Multimedia || + callType == EPSCTsyCallTypeVoIP ); + MPX_DEBUG2("MPXUser::IsCallOngoing KMPlayerCallTypeGenericVoice return (%d) ", ret ); + } + else + { + // Check the requested type call. + ret = ( callType == aCallType ); + MPX_DEBUG2("MPXUser::IsCallOngoing return (%d) ", ret ); + } + } + } + MPX_DEBUG2("MPXUser::IsCallOngoing return (%d) ", ret ); + return ret; + } + +// ----------------------------------------------------------------------------- +// Compelete file name with file path of the dll +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt MPXUser::CompleteWithDllPath(const TDesC& aDllName, TDes& aFileName) + { + MPX_DEBUG2("==>MPXUser::CompleteWithDllPath aFileName %S", &aFileName); + TInt error(KErrNotSupported); + MPX_DEBUG2("MPX Dll file path: %S", &aDllName); + TPtrC driveAndPath = TParsePtrC(aDllName).DriveAndPath(); + TParse parse; + error = parse.Set(aFileName, &driveAndPath, NULL); + if (!error) + { + aFileName.Zero(); + aFileName.Append(parse.FullName()); + } + MPX_DEBUG2("<==MPXUser::CompleteWithDllPath aFileName %S", &aFileName); + return error; + } + +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/group/backup_registration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/group/backup_registration.xml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,5 @@ + + + + + diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2006 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 for common playframework +* +*/ + + +#include + +#include "../common/group/bld.inf" + +PRJ_EXPORTS + +// Secure backup & restore +backup_registration.xml /epoc32/release/winscw/urel/z/private/101ffc02/backup_registration.xml +backup_registration.xml /epoc32/release/winscw/udeb/z/private/101ffc02/backup_registration.xml +backup_registration.xml /epoc32/data/z/private/101ffc02/backup_registration.xml + +../rom/mpxcommonframework.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mpxcommonframework.iby) + diff -r 000000000000 -r a2952bb97e68 mpx/commonframework/rom/mpxcommonframework.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/commonframework/rom/mpxcommonframework.iby Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2006 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: Image description file for project MPX Common Framework. +* +*/ + + +#ifndef MPXCOMMONFRAMEWORK_IBY +#define MPXCOMMONFRAMEWORK_IBY + +#include + + +file=ABI_DIR\BUILD_DIR\mpxcommon.dll SHARED_LIB_DIR\mpxcommon.dll + +// Backup & restore +data=ZPRIVATE\101ffc02\backup_registration.xml private\101ffc02\backup_registration.xml + +#endif // MPXCOMMONFRAMEWORK_IBY diff -r 000000000000 -r a2952bb97e68 mpx/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2006 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 for MPX Framework. +* +*/ + + +#include + +#include "../commonframework/group/bld.inf" +#include "../playbackframework/group/bld.inf" +#include "../collectionframework/group/bld.inf" +#include "../viewframework/group/bld.inf" + +PRJ_EXPORTS +../rom/mpx.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mpx.iby) + +// Generic configuration interface for component cenrep settings +// mpx_101FFC03 implementation specifics for cenrep data +// mpx_101FFCD2 implementation specifics for cenrep data +../Conf/mpx.confml MW_LAYER_CONFML(mpx.confml) +../Conf/mpx_101FFC03.crml MW_LAYER_CRML(mpx_101FFC03.crml) +../Conf/mpx_101FFCD2.crml MW_LAYER_CRML(mpx_101FFCD2.crml) diff -r 000000000000 -r a2952bb97e68 mpx/group/mpx.SIS Binary file mpx/group/mpx.SIS has changed diff -r 000000000000 -r a2952bb97e68 mpx/inc/mpxclientlistobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/inc/mpxclientlistobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2007 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: MPX client list observer interface definition +* +*/ + + + +#ifndef MMPXCLIENTLISTOBSERVER_H +#define MMPXCLIENTLISTOBSERVER_H + + +// INCLUDES +#include + + +// FORWARD DECLARATIONS + + +// CLASS DECLARATION + +/** + * MPX client list observer. + * + * @lib mpxcommon.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( MMPXClientlistObserver ) + { +public: + enum TChangeType + { + EAdd, + ERemove + }; + /** + * Handle client change + * + * @since 3.1 + * @param aPid Process id of the client + * @param aChangeType EAdd - new client added, ERemove - a client is removed. + */ + virtual void HandleClientChange(const TProcessId& aPid, + TChangeType aChangeType) = 0; + }; + +#endif // MMPXCLIENTLISTOBSERVER_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2006 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 for project Playback Framework subsystem. +* +*/ + + +#include + +#include "../playbackutility/group/bld.inf" +#include "../playbackengine/group/bld.inf" +#include "../playbackserver/group/bld.inf" + +PRJ_EXPORTS +../rom/mpxplaybackframework.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mpxplaybackframework.iby) + diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/bwinscw/mpxplaybackengineU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/bwinscw/mpxplaybackengineU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,30 @@ +EXPORTS + ??1CMPXPlaybackEngine@@UAE@XZ @ 1 NONAME ; CMPXPlaybackEngine::~CMPXPlaybackEngine(void) + ?CancelRequests@CMPXPlaybackEngine@@QAEXXZ @ 2 NONAME ; void CMPXPlaybackEngine::CancelRequests(void) + ?ClearSelectPlayersL@CMPXPlaybackPluginHandler@@QAEXXZ @ 3 NONAME ; void CMPXPlaybackPluginHandler::ClearSelectPlayersL(void) + ?CommandL@CMPXPlaybackEngine@@QAEXAAVCMPXMedia@@ABVCMPXMessageQueue@@@Z @ 4 NONAME ; void CMPXPlaybackEngine::CommandL(class CMPXMedia &, class CMPXMessageQueue const &) + ?CommandL@CMPXPlaybackEngine@@QAEXW4TMPXPlaybackCommand@@H@Z @ 5 NONAME ; void CMPXPlaybackEngine::CommandL(enum TMPXPlaybackCommand, int) + ?GetPlayerListL@CMPXPlaybackPluginHandler@@QAEXAAV?$RArray@VTUid@@@@W4TMPXPlaybackPlayerType@@@Z @ 6 NONAME ; void CMPXPlaybackPluginHandler::GetPlayerListL(class RArray &, enum TMPXPlaybackPlayerType) + ?GetSelection@CMPXPlaybackPluginHandler@@QAEXAAW4TMPXPlaybackPlayerType@@AAVTUid@@AAHAAVTPtrC16@@@Z @ 7 NONAME ; void CMPXPlaybackPluginHandler::GetSelection(enum TMPXPlaybackPlayerType &, class TUid &, int &, class TPtrC16 &) + ?InitL@CMPXPlaybackEngine@@QAEXABVCMPXCollectionPlaylist@@H@Z @ 8 NONAME ; void CMPXPlaybackEngine::InitL(class CMPXCollectionPlaylist const &, int) + ?InitL@CMPXPlaybackEngine@@QAEXABVRFile@@@Z @ 9 NONAME ; void CMPXPlaybackEngine::InitL(class RFile const &) + ?InitL@CMPXPlaybackEngine@@QAEXABVTDesC16@@ABVTDesC8@@@Z @ 10 NONAME ; void CMPXPlaybackEngine::InitL(class TDesC16 const &, class TDesC8 const &) + ?MediaL@CMPXPlaybackEngine@@QAEXAAVMMPXPlaybackEngineObserver@@PAVCBufBase@@@Z @ 11 NONAME ; void CMPXPlaybackEngine::MediaL(class MMPXPlaybackEngineObserver &, class CBufBase *) + ?NewL@CMPXPlaybackEngine@@SAPAV1@AAVCMPXPluginMonitor@@AAVMMPXPlaybackActiveEngineObserver@@PAVMMPXClientlistObserver@@ABVTUid@@@Z @12 NONAME ; class CMPXPlaybackEngine * CMPXPlaybackEngine::NewL(CMPXPluginMonitor&, class MMPXPlaybackActiveEngineObserver &, class MMPXClientlistObserver *, class TUid const &) + ?PlayerName@CMPXPlaybackPluginHandler@@QBEABVTDesC16@@W4TMPXPlaybackPlayerType@@@Z @ 13 NONAME ; class TDesC16 const & CMPXPlaybackPluginHandler::PlayerName(enum TMPXPlaybackPlayerType) const + ?PropertyL@CMPXPlaybackEngine@@QAEXW4TMPXPlaybackProperty@@AAVMMPXPlaybackEngineObserver@@@Z @ 14 NONAME ; void CMPXPlaybackEngine::PropertyL(enum TMPXPlaybackProperty, class MMPXPlaybackEngineObserver &) + ?SelectPlayerL@CMPXPlaybackPluginHandler@@QAEXVTUid@@@Z @ 15 NONAME ; void CMPXPlaybackPluginHandler::SelectPlayerL(class TUid) + ?SelectPlayersL@CMPXPlaybackPluginHandler@@QAEXW4TMPXPlaybackPlayerType@@@Z @ 16 NONAME ; void CMPXPlaybackPluginHandler::SelectPlayersL(enum TMPXPlaybackPlayerType) + ?SelectSubPlayerL@CMPXPlaybackPluginHandler@@QAEXVTUid@@H@Z @ 17 NONAME ; void CMPXPlaybackPluginHandler::SelectSubPlayerL(class TUid, int) + ?SetL@CMPXPlaybackEngine@@QAEXW4TMPXPlaybackProperty@@H@Z @ 18 NONAME ; void CMPXPlaybackEngine::SetL(enum TMPXPlaybackProperty, int) + ?SubPlayerNamesL@CMPXPlaybackEngine@@QAEXVTUid@@AAVMMPXPlaybackEngineObserver@@@Z @ 19 NONAME ; void CMPXPlaybackEngine::SubPlayerNamesL(class TUid, class MMPXPlaybackEngineObserver &) + ?MediaL@CMPXPlaybackEngine@@QAEXAAVMMPXPlaybackEngineObserver@@ABVCMPXMedia@@@Z @ 20 NONAME ; void CMPXPlaybackEngine::MediaL(class MMPXPlaybackEngineObserver &, class CMPXMedia const &) + ?InitStreamingL@CMPXPlaybackEngine@@QAEXABVRFile@@H@Z @ 21 NONAME ; void CMPXPlaybackEngine::InitStreamingL(class RFile const &, int) + ?InitStreamingL@CMPXPlaybackEngine@@QAEXABVTDesC16@@ABVTDesC8@@H@Z @ 22 NONAME ; void CMPXPlaybackEngine::InitStreamingL(class TDesC16 const &, class TDesC8 const &, int) + ?ProcessTaggedDataExL@CMPXPlaybackPluginInfo@@MAEXABVTDesC8@@0@Z @ 23 NONAME ; void CMPXPlaybackPluginInfo::ProcessTaggedDataExL(class TDesC8 const &, class TDesC8 const &) + ?SupportedInterfacesL@CMPXPlaybackPluginHandler@@QAEPAVCDesC16Array@@ABVTUid@@@Z @ 24 NONAME ; class CDesC16Array * CMPXPlaybackPluginHandler::SupportedInterfacesL(class TUid const &) + ?SupportedInterfacesL@CMPXPlaybackPluginHandler@@QAEPAVCDesC16Array@@XZ @ 25 NONAME ; class CDesC16Array * CMPXPlaybackPluginHandler::SupportedInterfacesL(void) + ?NewL@CMPXPlaybackEngine@@SAPAV1@AAVCMPXPluginMonitor@@AAVMMPXPlaybackActiveEngineObserver@@PAVMMPXClientlistObserver@@ABVTUid@@H@Z @ 26 NONAME ; class CMPXPlaybackEngine * CMPXPlaybackEngine::NewL(class CMPXPluginMonitor &, class MMPXPlaybackActiveEngineObserver &, class MMPXClientlistObserver *, class TUid const &, int) + ?InitStreaming64L@CMPXPlaybackEngine@@QAEXABVRFile64@@H@Z @ 27 NONAME ; void CMPXPlaybackEngine::InitStreaming64L(class RFile64 const &, int) + ?Init64L@CMPXPlaybackEngine@@QAEXABVRFile64@@@Z @ 28 NONAME ; void CMPXPlaybackEngine::Init64L(class RFile64 const &) + diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/eabi/mpxplaybackengineU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/eabi/mpxplaybackengineU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,37 @@ +EXPORTS + _ZN18CMPXPlaybackEngine14CancelRequestsEv @ 1 NONAME + _ZN18CMPXPlaybackEngine15SubPlayerNamesLE4TUidR26MMPXPlaybackEngineObserver @ 2 NONAME + _ZN18CMPXPlaybackEngine4NewLER17CMPXPluginMonitorR32MMPXPlaybackActiveEngineObserverP22MMPXClientlistObserverRK4TUid @3 NONAME + _ZN18CMPXPlaybackEngine4SetLE20TMPXPlaybackPropertyi @ 4 NONAME + _ZN18CMPXPlaybackEngine5InitLERK22CMPXCollectionPlaylisti @ 5 NONAME + _ZN18CMPXPlaybackEngine5InitLERK5RFile @ 6 NONAME + _ZN18CMPXPlaybackEngine5InitLERK7TDesC16RK6TDesC8 @ 7 NONAME + _ZN18CMPXPlaybackEngine6MediaLER26MMPXPlaybackEngineObserverP8CBufBase @ 8 NONAME + _ZN18CMPXPlaybackEngine8CommandLE19TMPXPlaybackCommandi @ 9 NONAME + _ZN18CMPXPlaybackEngine8CommandLER9CMPXMediaRK16CMPXMessageQueue @ 10 NONAME + _ZN18CMPXPlaybackEngine9PropertyLE20TMPXPlaybackPropertyR26MMPXPlaybackEngineObserver @ 11 NONAME + _ZN18CMPXPlaybackEngineD0Ev @ 12 NONAME + _ZN18CMPXPlaybackEngineD1Ev @ 13 NONAME + _ZN18CMPXPlaybackEngineD2Ev @ 14 NONAME + _ZN25CMPXPlaybackPluginHandler12GetSelectionER22TMPXPlaybackPlayerTypeR4TUidRiR7TPtrC16 @ 15 NONAME + _ZN25CMPXPlaybackPluginHandler13SelectPlayerLE4TUid @ 16 NONAME + _ZN25CMPXPlaybackPluginHandler14GetPlayerListLER6RArrayI4TUidE22TMPXPlaybackPlayerType @ 17 NONAME + _ZN25CMPXPlaybackPluginHandler14SelectPlayersLE22TMPXPlaybackPlayerType @ 18 NONAME + _ZN25CMPXPlaybackPluginHandler16SelectSubPlayerLE4TUidi @ 19 NONAME + _ZN25CMPXPlaybackPluginHandler19ClearSelectPlayersLEv @ 20 NONAME + _ZNK25CMPXPlaybackPluginHandler10PlayerNameE22TMPXPlaybackPlayerType @ 21 NONAME + _ZTI18CMPXPlaybackEngine @ 22 NONAME ; ## + _ZTI23CMPXPlaybackInitializer @ 23 NONAME ; ## + _ZTI25CMPXPlaybackPluginHandler @ 24 NONAME ; ## + _ZTV18CMPXPlaybackEngine @ 25 NONAME ; ## + _ZTV23CMPXPlaybackInitializer @ 26 NONAME ; ## + _ZTV25CMPXPlaybackPluginHandler @ 27 NONAME ; ## + _ZN18CMPXPlaybackEngine6MediaLER26MMPXPlaybackEngineObserverRK9CMPXMedia @ 28 NONAME + _ZN18CMPXPlaybackEngine14InitStreamingLERK5RFilei @ 29 NONAME + _ZN18CMPXPlaybackEngine14InitStreamingLERK7TDesC16RK6TDesC8i @ 30 NONAME + _ZN25CMPXPlaybackPluginHandler20SupportedInterfacesLERK4TUid @ 31 NONAME + _ZN25CMPXPlaybackPluginHandler20SupportedInterfacesLEv @ 32 NONAME + _ZN18CMPXPlaybackEngine4NewLER17CMPXPluginMonitorR32MMPXPlaybackActiveEngineObserverP22MMPXClientlistObserverRK4TUidi @ 33 NONAME + _ZN18CMPXPlaybackEngine16InitStreaming64LERK7RFile64i @ 34 NONAME + _ZN18CMPXPlaybackEngine7Init64LERK7RFile64 @ 35 NONAME + diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2006 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 for project Player Engine. +* +*/ + + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +mpxplaybackengine.mmp + diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/group/mpxplaybackengine.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/group/mpxplaybackengine.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2006 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: player engine project specification +* +*/ + + + +#include +#include + +TARGET mpxplaybackengine.dll +CAPABILITY CAP_GENERAL_DLL +TARGETTYPE DLL +UID 0x1000008D 0x101FFC02 +VENDORID VID_DEFAULT + +USERINCLUDE ../inc + +APP_LAYER_SYSTEMINCLUDE // this has to be APP because of telephonyinternalpskeys.h +SYSTEMINCLUDE /epoc32/include/ecom + +SOURCEPATH ../src +SOURCE mpxplaybackengine.cpp +SOURCE mpxplaybackcommandbuffer.cpp +SOURCE mpxaccessoryobserver.cpp +SOURCE mpxplaybackpluginhandler.cpp +SOURCE mpxplaybacksettings.cpp +SOURCE mpxautoresumehandler.cpp +SOURCE mpxplaybackinitializer.cpp +SOURCE mpxplaybackmediahelper.cpp +SOURCE mpxplaybackdummymediaobserver.cpp +SOURCE mpxplaybackplugininfo.cpp + +LIBRARY efsrv.lib euser.lib ecom.lib bafl.lib featmgr.lib +LIBRARY inetprotutil.lib apgrfx.lib apmime.lib estor.lib +LIBRARY mpxcollectionutility.lib mpxcommon.lib +LIBRARY centralrepository.lib +#ifdef __ACCESSORY_FW +LIBRARY accClient.lib // Accessory client +LIBRARY telephonyaudiorouting.lib +#else +LIBRARY dsclient.lib // Dos services +#endif // __ACCESSORY_FW + +#if defined(ARMCC) +deffile ../eabi/ +#elif defined(WINSCW) +deffile ../bwinscw/ +#endif + +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/inc/mpxaccessoryobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/inc/mpxaccessoryobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,195 @@ +/* +* Copyright (c) 2006 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: Accessory observer +* +*/ + + +#ifndef CMPXACCESSORYOBSERVER_H +#define CMPXACCESSORYOBSERVER_H + +// INCLUDES +#ifdef __ACCESSORY_FW +#include +#include +#include +#else +#include +#include +#endif // __ACCESSORY_FW + +#include + +// FORWARD DECLARATIONS +#ifndef __ACCESSORY_FW +class RDosServer; +#endif // __ACCESSORY_FW + +/** +* Interface for handling accessory event +*/ +NONSHARABLE_CLASS(MMPXAccessoryEventObserver) + { +public: + /** + * Handle accessory event + * + * @param aMode playback accessory mode + */ + virtual void HandleAccesoryEventL(TMPXPlaybackAccessoryMode aMode)=0; + }; + + +#ifdef __ACCESSORY_FW + +NONSHARABLE_CLASS( CMPXAccessoryObserver ): public CActive + { + public: // constructor & destructor + + /** + * Two phase constructor + * @param aObs Reference to an event observer + */ + static CMPXAccessoryObserver* NewL(MMPXAccessoryEventObserver& aObs); + + /** + * Destructor. + */ + virtual ~CMPXAccessoryObserver(); + + public: + + /** + * Starts listening to Accessory events. + * @param None + * @return None + */ + void StartL(); + + /* + * Gets current accessory mode + */ + TMPXPlaybackAccessoryMode AccessoryModeL(); + + private: // New functions + + /** + * Converts from accessory mode to internal MPX mode enum + * @param aMode Accessory framework mode + * @ret MPX Accessory Mode + */ + TMPXPlaybackAccessoryMode ConvertToMpxMode( + TAccPolAccessoryMode& aMode ); + + private: // from CActive + /** @see CActive::RunL */ + void RunL(); + + /** @see CActive::DoCancel */ + void DoCancel(); + + private: // Constructor + + /** + * C++ default constructor. + * @param aObs Reference to an event observer + */ + CMPXAccessoryObserver(MMPXAccessoryEventObserver& aObs); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: + // Event observer + MMPXAccessoryEventObserver& iObs; + // Accessory Server session + RAccessoryServer iServer; + // Accessory mode + RAccessoryMode iMode; + TAccPolAccessoryMode iAccessory_mode; + + }; + +#else +/** +* Accessary event observer +*/ +NONSHARABLE_CLASS(CMPXAccessoryObserver): public CDosEventListenerBase + { +public: + + /** + * Two-phased constructor + * + * @param aObs observer + * @return object of constructed + */ + static CMPXAccessoryObserver* NewL(MMPXAccessoryEventObserver& aObs); + + /** + * Destructor. + */ + virtual ~CMPXAccessoryObserver(); + +public: // from CDosEventListenerBase + /** + * From CDosEventListenerBase + * Accessory mode changed + * + * @param aState accessory state + */ + void AccessoryModeChangedL(TDosAccessoryMode aState); + + /** + * From CDosEventListenerBase + * Start monitoring + */ + void StartL(); + + /* + * Gets current accessory mode + */ + TMPXPlaybackAccessoryMode AccessoryModeL(); + +private: // New functions + + /** + * Converts from accessory mode to internal MPX mode enum + * @param aMode Dos Accessory framework mode + * @ret MPX Accessory Mode + */ + TMPXPlaybackAccessoryMode ConvertToMpxMode( + TDosAccessoryMode& aMode ); + +private: + + /** + * C++ constructor + * + * @param aObs observer + */ + CMPXAccessoryObserver(MMPXAccessoryEventObserver& aObs); + + /** + * 2nd phase constructor + */ + void ConstructL(); +private: + MMPXAccessoryEventObserver& iObs; + }; +#endif // __ACCESSORY_FW + +#endif // CMPXACCESSORYOBSERVER_H diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/inc/mpxautoresumehandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/inc/mpxautoresumehandler.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,155 @@ +/* +* Copyright (c) 2006 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: Auto resume handler +* +*/ + + + +#ifndef CMPXAUTORESUMEHANDLER_H +#define CMPXAUTORESUMEHANDLER_H + +// INCLUDES +#include +#include +#include + +// FORWARD DECLARATIONS +class CMPXPlaybackEngine; +class CMPXPSKeyWatcher; + +/** +* CMPXAutoResumeHandler. +* Class for processing call state events. +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMPXAutoResumeHandler) : public CBase, + public MMPXPSKeyObserver + + { +public: + /** + * Creates instance of the CMPXAutoResumeHandler class. + * + * @param aEngine reference to playback engine + * @param aMixerSupport flag to support mixer + * @return Returns the instance just created. + */ + static CMPXAutoResumeHandler* NewL(CMPXPlaybackEngine& aEngine, + TBool aMixerSupport); + + /** + * Destructor. + */ + virtual ~CMPXAutoResumeHandler(); + + /** + * Handle open file complete + */ + void HandleOpenFileComplete(); + + /** + * Handle playback state change + * @param aState new state + */ + void HandlePlaybackStateChange(TMPXPlaybackState aState); + + /** + * Handle complete of playing a song + * @aError error code + */ + void HandlePlaybackComplete(TInt aError); + + /** + * Resume timer cancel. + */ + void CancelResumeTimer(); + + /** + * Set autoresume value + */ + void SetAutoResume(TBool aAutoResume); + +private: // constructors + + /** + * C++ default constructor. + * + * @param aEngine reference to playback engine + * @param aMixerSupport flag to support mixer + */ + CMPXAutoResumeHandler(CMPXPlaybackEngine& aEngine, TBool aMixerSupport); + + /** + * Symbian OS constructor. + */ + void ConstructL(); + +private: // From base classes + + /** + * From MMPXPSKeyObserver + * Handle PS event + * + * @param aUid The UID that identifies the property category + * @param aKey The property sub-key + */ + void HandlePSEvent(TUid aUid, TInt aKey); + +private: // New functions + + /** + * Handle call state or type change. + */ + void DoHandleStateChangeL(); + + /** + * Check if we should go to pause in + * given call state + */ + TBool ShouldPause(); + + /** + * Handle resume timer callback + */ + void HandleResumeTimerCallback(); + + /** + * Callback for resume timer. + */ + static TInt ResumeTimerCallback(TAny* aPtr); + + /** + * Checks if current player is remote: playback shouldn't be paused + * in that case + */ + TBool IsPlaybackRemote(); + +private: // data + CMPXPlaybackEngine& iEngine; + TBool iMixerSupport; + TBool iPausedForCall; + CMPXPSKeyWatcher* iStateObserver; // owned + CMPXPSKeyWatcher* iTypeObserver; // owned + TTime iKErrDiedTime; + TBool iAutoResume; + + // Timer for resume operation. Owned. + CPeriodic* iResumeTimer; + }; + +#endif // CMPXAUTORESUMEHANDLER_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/inc/mpxplaybackactiveengineobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/inc/mpxplaybackactiveengineobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2006 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: Active playback engine observer. +* +*/ + + + +#ifndef MMPXPLAYBACKACTIVEENGINEOBSERVER_H +#define MMPXPLAYBACKACTIVEENGINEOBSERVER_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CMPXPlaybackEngine; + +/** +* Interface for handling active engine +*/ +NONSHARABLE_CLASS(MMPXPlaybackActiveEngineObserver) + { +public: + /** + * Handle active engine + * + * @param aEngine pointer to active engine + * @param aActive ETure activated, EFalse deactivated + */ + virtual void HandleActiveEngineL(const CMPXPlaybackEngine* aEngine, + TBool aActive)=0; + }; + +#endif // MMPXPLAYBACKACTIVEENGINEOBSERVER_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/inc/mpxplaybackcommandbuffer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/inc/mpxplaybackcommandbuffer.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2006 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: Buffer commands +* +*/ + + +#ifndef CMPXPLAYBACKCMDBUFFER_H +#define CMPXPLAYBACKCMDBUFFER_H + + +#include "mpxplaybackcommandbufferobserver.h" + +/** +* Special processing for media keys, e.g. buffering a quick +* succession of keys and calling back with the net result after +* a specific period of time +*/ +NONSHARABLE_CLASS(CMPXPlaybackCmdBuffer) : public CTimer + { +public: + + /** + * Two-phased constructor + * + * @param aObserver observer of the media key + * @return object of constructed + */ + static CMPXPlaybackCmdBuffer* NewL(MMPXPlaybackCmdBufferObserver& aObserver); + +public: + /** + * Is this a command controlled by media keys + * + * @param aCmd playback command + * @return ETrue if the command is controlled by media keys + */ + TBool CommandForBuffering(TMPXPlaybackCommand aCmd) const; + + /** + * Buffer a command, along with the current state and position in the + * track + * + * @param aCmd play command + * @param aState play state + * @param aPos position + */ + void BufferCommandL(TMPXPlaybackCommand aCmd,TMPXPlaybackState aState,TInt aPos); + + /** + * Called by client when finished processing command + */ + void CompleteCommand(); + + /** + * Any command buffered + * + * @return ETrue buffered commands available + */ + TBool IsCommandBuffered() const; + + /** + * Clear all command + */ + void ClearCommands(); + +private: + /** + * From CActive + * Handles an active object's request completion event + */ + void RunL(); + + /** + * From CActive + * Handles a leave occurring in the request completion event handler RunL() + * + * @param aError error code + * @return system error code + */ + TInt RunError(TInt aError); + +private: + + /** + * C++ constructor + */ + CMPXPlaybackCmdBuffer(MMPXPlaybackCmdBufferObserver& aObserver); + +private: + MMPXPlaybackCmdBufferObserver& iObserver; + TMPXPlaybackCmdInfo iEvent; + TBool iIsCommandBuffered; + TBool iEventProcessing; + TTimeIntervalMicroSeconds32 iBufferTime; +}; + +#endif // CMPXPLAYBACKCMDBUFFER_H diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/inc/mpxplaybackcommandbufferobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/inc/mpxplaybackcommandbufferobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2006 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: Command buffer bserver +* +*/ + + +#ifndef MMPXPLAYBAKCMDBUFFEROBSERVER_H +#define MMPXPLAYBAKCMDBUFFEROBSERVER_H + +#include + + +enum TMPXPlaybackSkipEvent + { + EPbsSkipEventEnd, + EPbsSkipEventNext, + EPbsSkipEventPrevious + }; + +/** +* Media key event +*/ +NONSHARABLE_CLASS(TMPXPlaybackCmdInfo) + { +public: + TInt iTrackOffset; + TMPXPlaybackState iState; + TInt iPos; + TInt iNavKeyBuffered; + }; + + +/** +* Media key observer +*/ +NONSHARABLE_CLASS(MMPXPlaybackCmdBufferObserver) + { +public: + + /** + * Handle command from buffering + * + * @param aEvent comand info + */ + virtual void HandleCmdBufferEventL(const TMPXPlaybackCmdInfo& aEvent)=0; + + /** + * Handle command skip event from key buffering + * + * @param aSkipEvent Skip event + */ + virtual void HandleCmdBufferSkipEventL(const TMPXPlaybackSkipEvent aSkipEvent)=0; + }; + + +#endif // MMPXPLAYBAKCMDBUFFEROBSERVER_H diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/inc/mpxplaybackdummymediaobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/inc/mpxplaybackdummymediaobserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2007 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: Dummy class to get playlist objects initialized +* +*/ + + +#ifndef C_MPXDUMMYPLAYBACKOBSERVER_H +#define C_MPXDUMMYPLAYBACKOBSERVER_H + +#include + +/** + * Dummy observer to initialize the collection playlist + * + * @lib mpxplaybackengine.lib + * @since S60 3.1 + */ +NONSHARABLE_CLASS( CMPXPlaybackDummyMediaObserver ) : public CBase, + public MMPXCollectionMediaObserver + { + +public: + + /** + * Constructor + */ + CMPXPlaybackDummyMediaObserver(); + + /** + * Destructor + */ + ~CMPXPlaybackDummyMediaObserver(); + +protected: + + /** + * From MMPXCollectionMediaObserver + */ + void HandleCollectionMediaL(const CMPXMedia& aMedia, + TInt aError); + }; + +#endif // C_MPXDUMMYPLAYBACKOBSERVER_H diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/inc/mpxplaybackengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/inc/mpxplaybackengine.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,1009 @@ +/* +* Copyright (c) 2006 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: Controls playback via plug-ins +* +*/ + + + +#ifndef CMPXPLAYBACKENGINE_H +#define CMPXPLAYBACKENGINE_H + + +#include +#include +// +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mpxplaybackpluginhandler.h" +#include "mpxplaybackcommandbufferobserver.h" +#include "mpxaccessoryobserver.h" +#include "mpxplaybacksettings.h" + +class CMPXPluginMonitor; +class CMPXPlaybackPluginHandler; +class CMPXAutoResumeHandler; +class CMPXPlaybackCmdBuffer; +class CMPXCollectionPlaylist; +class MMPXPlaybackActiveEngineObserver; +class CMPXActiveTaskQueue; +class CMPXPlaybackInitializer; +class CMPXPlaybackMediaHelper; +class CMPXPlaybackDummyMediaObserver; + +// Constants +_LIT(KMPXPlaybackPluginVersion2, "MPXPlaybackPluginVersion2"); +/** +* The playback 'engine' which delegates to plug-ins (or 'players'). Unless +* stated otherwise, methods apply to currently loaded plug-in (player) and +* currently initialised song. +*/ +class CMPXPlaybackEngine : public CBase, + public MMPXPlaybackPluginObserver, + public MMPXPlaybackCmdBufferObserver, + public MBeating, + public MMPXAccessoryEventObserver, + public MMPXTaskQueueObserver, + public MMPXCollectionMediaObserver, + public MMPXCollectionPlaylistObserver, + public MMPXPluginHandlerObserver + { +public: + + /** + * Two-phased constructor. + * + * @param aPluginMonitor plugin monitor + * @param aObserver engine observer + * @param aClientListObserver client list observer + * @param aModeId denotes whether this player is designated for the + * stand-alone application + * @return Constructed object + */ + IMPORT_C static CMPXPlaybackEngine* NewL( + CMPXPluginMonitor& aPluginMonitor, + MMPXPlaybackActiveEngineObserver& aObserver, + MMPXClientlistObserver* aClientListObserver, + const TUid& aModeId); + + + /** + * Two-phased constructor. + * + * @param aPluginMonitor plugin monitor + * @param aObserver engine observer + * @param aClientListObserver client list observer + * @param aModeId denotes whether this player is designated for the + * stand-alone application + * @param aCategory category of engine (Music, Video) + * @return Constructed object + */ + IMPORT_C static CMPXPlaybackEngine* NewL( + CMPXPluginMonitor& aPluginMonitor, + MMPXPlaybackActiveEngineObserver& aObserver, + MMPXClientlistObserver* aClientListObserver, + const TUid& aModeId, + const TInt aCategory); + + + /** + * Destructor + */ + IMPORT_C ~CMPXPlaybackEngine(); + +public: + + /** + * Returns reference to client list + * + * @return client list object + */ + inline CMPXClientList* ClientList(); + + /** + * Returns object encapsulating list of clients and its management + * + * @return playback plugin handler + */ + inline CMPXPlaybackPluginHandler* PluginHandler(); + + /** + * Does this player (i.e. the currently loaded plug-in) have access to + * audio resources + * + * @return ETrue audio resource is used by the player + */ + inline TBool IsPlayerActive() const; + + /** + * Return mode id of this engine + * + * @return mode id + */ + inline const TUid& ModeId() const; + + + /** + * Return category of this engine + * + * @return category + */ + + inline const TInt Category() const; + + + /** + * Current state + * + * @return playback state + */ + inline TMPXPlaybackState State() const; + + /** + * Current collection path, or NULL if none (i.e. not from collection) + */ + inline const CMPXCollectionPlaylist* Playlist() const; + + /** + * Current song index, or KErrNotFound if none (i.e. not from collection) + */ + inline TInt SongIndex() const; + + /** + * Current uri, or KNullDesC if none (i.e. uri not supplied) + */ + inline const TDesC& Uri() const; + + /** + * Current file handle + */ + inline const RFile& File() const; + + /** + * Retursn last active process id + * + * @return process id of last active process + */ + inline TProcessId LastActiveProcessId() const; + + /** + * Retursn last inactive process id + * + * @return process id of last inactive process + */ + inline TProcessId LastInactiveProcessId() const; + + /** + * Initializes the player with a song in the collection + * + * @param aCollectionPath collection path + * @param aPlay Whether to initialize for playback, or + * else just to setup the engine first + */ + IMPORT_C void InitL( const CMPXCollectionPlaylist& aPlaylist, + TBool aPlay ); + + /** + * Initializes the player with a uri - doesn't use collection + * + * @param aUri URI of the song + * @param aType the type of song + */ + IMPORT_C void InitL(const TDesC& aUri,const TDesC8& aType); + + /** + * Initializes the player with a file - doesn't use collection + * + * @aFile file handle + */ + IMPORT_C void InitL(const RFile& aFile); + + /** + * Initializes the player with a uri and Access Point + * + * @since S60 9.2 + * @param aUri URI of the item + * @param aType the mime type of the item + * @param aAccessPoint the access point of the item + */ + IMPORT_C void InitStreamingL(const TDesC& aUri, const TDesC8& aType, const TInt aAccessPoint); + + /** + * Initializes the player with a file and access point + * + * @since S60 9.2 + * @param aFile file handle + * @param aAccessPoint the access point of the item + */ + IMPORT_C void InitStreamingL(const RFile& aFile, const TInt aAccessPoint); + + /** + * Cancel all outstanding, asynchronous requests + */ + IMPORT_C void CancelRequests(); + + /** + * Issue a playback command + * + * @param aCmd playback command + * @param aData optional data + */ + IMPORT_C void CommandL(TMPXPlaybackCommand aCmd,TInt aData=0); + + /** + * Issue a playback command + * + * @param aCmd playback command + * @param aMsgQueue Message Queue for the client + */ + IMPORT_C void CommandL(CMPXCommand& aCmd, const CMPXMessageQueue& aMsgQueue); + + /** + * Sets the property value. Value not set until a property changed event is + * returned to the client + */ + IMPORT_C void SetL(TMPXPlaybackProperty aProperty,TInt aValue); + + /** + * Asynchronously retrieves the value of a property. Result will be called + * back by using MMPXPlaybackEngineObserver + */ + IMPORT_C void PropertyL(TMPXPlaybackProperty aProperty, + MMPXPlaybackEngineObserver& aCallback); + + /** + * DEPRECATED + * + * Asynchronously return media properties + * using MMPXPlaybackEngineObserver + * + * @param aCallback playback callback + * @param aBuf parameter buffer, take over the ownership + */ + IMPORT_C void MediaL(MMPXPlaybackEngineObserver& aCallback, CBufBase* aBuf); + + /** + * Asynchronously return media properties + * using MMPXPlaybackEngineObserver + * + * @param aCallback playback callback + * @param aCmd Command object containing attribute spec and attribute array + */ + IMPORT_C void MediaL(MMPXPlaybackEngineObserver& aCallback, const CMPXCommand& aCmd); + + /** + * Asynchronously retrieves the sub player names. See MMPXPlayerManager + * + * @param aCallback playback callback + */ + IMPORT_C void SubPlayerNamesL(TUid aPlayerUid, + MMPXPlaybackEngineObserver& aCallback); + + /** + * Gets media from the plugin + * + * @param aCallback Callback method to call after retrieving media + * @param aCmd Command containing the media attributes and attribute specs. + * Ownership transfered + */ + void MediaFromPluginL( MMPXPlaybackEngineObserver* aCallback, + CMPXCommand* aCmd ); + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + /** + * Current file handle + */ + inline const RFile64& File64() const; + + /** + * Initializes the player with a file - doesn't use collection + * + * @aFile file handle + */ + IMPORT_C void Init64L(const RFile64& aFile); + + /** + * Initializes the player with a file and access point + * + * @since S60 9.2 + * @param aFile file handle + * @param aAccessPoint the access point of the item + */ + IMPORT_C void InitStreaming64L(const RFile64& aFile, const TInt aAccessPoint); +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + +public: + + /** + * Handle command + * + * @param aCmd command + */ + void HandleCommandL(TMPXPlaybackCommand aCmd, TInt aData=0); + +private: + enum TPlaySource + { + EPlayNone, + EPlayFromCollection, + EPlayFromUri, + EPlayFromFile, + EPlayFromFile64 + }; + + enum TAsyncRequest + { + EProperty, + EMedia, + ESubPlayerNames, + EHandleNext + }; + + /** + * Helper class to reflect playback call back to engine itself. + */ + class TCallbackReflector : public MMPXPlaybackEngineObserver + { + public: + + /** + * Contructor + * + * @param aEngine playback engine + */ + inline TCallbackReflector(CMPXPlaybackEngine& aEngine); + + /** + * From MMPXPlaybackEngineObserver + * Handle playback property + * + * @param aProperty the property + * @param aValue the value of the property + * @param aError error code + */ + inline void HandleProperty(TMPXPlaybackProperty aProperty, + TInt aValue, + TInt aError); + + /** + * From MMPXPlaybackEngineObserver + * Method is called continously until aComplete=ETrue, signifying that + * it is done and there will be no more callbacks + * Only new items are passed each time + * + * @param aPlayer UID of the subplayer + * @param aSubPlayers a list of sub players + * @param aComplete ETrue no more sub players. EFalse more subplayer + * expected + * @param aError error code + */ + inline void HandleSubPlayerNames(TUid aPlayer, + const MDesCArray* aSubPlayers, + TBool aComplete, + TInt aError); + + /** + * From MMPXPlaybackEngineObserver + * Handle media object + * + * @param aMedia media object + * @param aError error code + */ + inline void HandleMedia(CMPXMedia* aMedia, TInt aError); + + private: + CMPXPlaybackEngine& iEngine; + }; + +private: + + /** + * C++ constructor + * + * @param aPluginMonitor plugin monitor + * @param aObserver engine observer + * @param aModeId player engine mode + */ + CMPXPlaybackEngine(CMPXPluginMonitor& aPluginMonitor, + MMPXPlaybackActiveEngineObserver& aObserver, + const TUid& aModeId); + + + /** + * C++ constructor + * + * @param aPluginMonitor plugin monitor + * @param aObserver engine observer + * @param aModeId player engine mode + * @param aCategory player engine category + */ + + CMPXPlaybackEngine(CMPXPluginMonitor& aPluginMonitor, + MMPXPlaybackActiveEngineObserver& aObserver, + const TUid& aModeId, + const TInt aCategory); + + + /** + * 2nd phase contructor + * + * @param aClientListObserver client list observer + */ + void ConstructL(MMPXClientlistObserver* aClientListObserver); + + +private: // Functions from base class + + /** + * From MBeating + * Handles a regular heartbeat timer event + */ + void Beat(); + + /** + * From MBeating + * Synchronises the heartbeat timer with system clock + */ + void Synchronize(); + + /** + * From MMPXPlayerAccessoryEventObserver + * Handle accessory event + * + * @param aMode playback accessory mode + */ + void HandleAccesoryEventL(TMPXPlaybackAccessoryMode aMode); + + /** + * From MMPXPlaybackPluginObserver + * Handle plugin event + * + * @param aEvent the event type + * @param aData optional data + * @param aError error code of the event + */ + void HandlePluginEvent(TEvent aEvent,TInt aData,TInt aError); + + /** + * From MMPXPlaybackPluginObserver + * Handle message from plug-in + * + * @param aMsg, message from the plug-in. Ownership not transferred. + * @param aErr system error code. if aErr is not KErrNone, aMsg will not be + * used/dereferenced at playback engine. + */ + void HandlePlaybackMessage(CMPXMessage* aMsg, TInt aErr); + + /** + * From MMPXPlaybackPluginObserver + * Async response for Value request + * + * @param aProperty property key + * @param aValue property value + * @param aError error code + */ + void HandleProperty(TMPXPlaybackProperty aProperty, + TInt aValue, TInt aError); + + /** + * From MMPXPlaybackPluginObserver + * Async response for MediaL request + * + * @param aMedia media object + * @param aError error code + */ + void HandleMedia(CMPXMedia* aMedia, TInt aError); + + /** + * From MMPXPlaybackPluginObserver + * Async response for subplayer request + * + * @param aPlayer UID of the subplayer + * @param aSubPlayers array of subplayers + * @param aComplete ETrue, completed, EFalse, not completed + * @param aError error code + */ + void HandleSubPlayerNames(TUid aPlayer, const MDesCArray* aSubPlayers, + TBool aComplete, TInt aError); + + /** + * From MMPXPlaybackCmdBufferObserver + * Handle command from buffering + * + * @param aEvent comand info + */ + void HandleCmdBufferEventL(const TMPXPlaybackCmdInfo& aEvent); + + /** + * From MMPXPlaybackCmdBufferObserver + * Handle command skip event from key buffering + * + * @param aSkipEvent Skip event + */ + void HandleCmdBufferSkipEventL(const TMPXPlaybackSkipEvent aSkipEvent); + + /////////////////////////////////////////////////////////////////////////// + // From MMPXTaskQueueObserver + + /** + * Execute a task + * @param aTask task number + * @param aParamData, parameter + * @param aPtrData, any object + * @param aBuf, buffer containing externalized parameters for the task. + * @param aCallback call back function pointer + * @param aCObject1 object 1 owned by task queue + * @param aCObject2 object 2 owned by task queue + */ + void ExecuteTask(TInt aTask, + TInt aParamData, + TAny* aPtrData, + const CBufBase& aBuf, + TAny* aCallback, + CBase* aCObject1, + CBase* aCObject2); + + /** + * From MMPXCollectionMediaObserver + * Handle media properties from collection + * + * @param aMedia media + * @param aError error code + */ + void HandleCollectionMediaL(const CMPXMedia& aProperties, TInt aError); + + /** + * From MMPXCollectionPlaylistObserver + * Handle collection playlist change + * + * @param aError KErrNotFound - Playlist is updated, current item removed + * KErrNone - Playlist is updated, current item is valid + * KErrEof - Playlist is updated, current item removed and + * reached to the end of playlist + */ + void HandleCollectionPlaylistChange(TInt aError); + + /////////////////////////////////////////////////////////////////////////// + // From MMPXPluginHandlerObserver + + /* + * @see MMPXPluginHandlerObserver + */ + void HandlePluginHandlerEvent(TPluginHandlerEvents aEvent, const TUid& aPluginUid, + TBool aLoaded, TInt aData); + +private: // New functions + + + /** + * Return current plugin + * + * @return plugin object + */ + inline CMPXPlaybackPlugin* PluginL() const; + + /** + * Suspend playback + */ + void Suspend(); + + /** + * Seek timer tick + */ + void SeekTimerTick(); + + /** + * Seek timer callback + * + * @param aPtr pointer the this + */ + static TInt SeekTimerCallback(TAny* aPtr); + + /** + * Init plugin + * + * @param aSong, song path + * @param aType, song type + * @param aFile, file handle + * @param aAccessPoint aAccessPoint + */ + void InitL(const TDesC* aSong,const TDesC8* aType,RFile* aFile, + TInt aAccessPoint=0); + + /** + * Handle play command + */ + void HandlePlayL(); + + /** + * Handle play command with fade in + */ + void HandlePlayWithFadeInL(); + + /** + * Handle pause command + */ + void HandlePauseL(); + + /** + * Handle stop command + */ + void HandleStopL(); + + /** + * Stop play back + * @param aSavePlaybackInfo flag to determine if the PlaybackInfo should be saved + */ + void DoStopL(TBool aSavePlaybackInfo = ETrue); + + /** + * Handle next command + * @param aOffset offset to current index + * @param aIgnoreRepeat ETrue to ignore repeat setting + */ + void HandleNextL( TInt aOffset = 1, TBool aIgnoreRepeat=EFalse ); + + /** + * Handle previous command + * @param aOffset offset to current index + * @param aIgnoreRepeat ETrue to ignore repeat setting + */ + void HandlePreviousL(TInt aOffset = -1, TBool aIgnoreRepeat=EFalse ); + + /** + * Handle replay command + */ + void HandleReplayL(); + + /** + * Handle sart seekingcommand + */ + void HandleStartSeekL(TBool aForward); + + /** + * Handle stop seeking command + */ + void HandleStopSeekingL(); + + /** + * Handle increase volume command + */ + void HandleIncreaseVolumeL(); + + /** + * Handle decrease volume command + */ + void HandleDecreaseVolumeL(); + + /** + * Handle set volume command + */ + void HandleSetVolumeL(TInt aVolume); + + /** + * Handle mute command + */ + void HandleMuteL(TBool aMute); + + /** + * Handle close command + * @param aData data to be forwarded to the player + */ + void HandleCloseL( TInt aData = KErrNone ); + + /** + * Handle a custom command + */ + void HandleEffectL(TInt aData); + + /** + * Handle a custom command + */ + void HandleDisableEffectL(); + + /** + * Handle a request to close the file handle for an item + * @param aItemId item that is requested to be freed + */ + void HandleCloseItemL( TInt aItemId ); + + /** + * Sets the current properties for the plug-in + */ + void SetPropertiesL(); + + /** + * Stop seeking timer + */ + void EndSeek(); + + /** + * Set a playback state + * @param aState new state + */ + void SetStateL(TMPXPlaybackState aState); + + /** + * Set a playback state, takes in a TMPXPlaybackMessage with the + * state already set as the iType parameter. This Allows caller to + * set iData information as well. + * @param aMessage Message containing state information + */ + void SetStateL( TMPXPlaybackMessage& aMsg ); + + /** + * Set player activated + * @param aActive ETrue actived, EFalse inactived. + */ + void SetPlayerActivated(TBool aActive); + + /** + * Execute a task + * @param aTask task number + * @param aParamData, parameter + * @param aPtrData, any object + * @param aCallback call back function pointer + * @param aBuf buffer data + * @param aCObject1 object 1 owned by task queue + * @param aCObject2 object 2 owned by task queue + */ + void ExecuteTaskL(TInt aTask, + TInt aParamData, + TAny* aPtrData, + TAny* aCallback, + const CBufBase& aBuf, + CBase* aCObject1, + CBase* aCObject2); + + /** + * @see MMPXTaskQueueObserver + */ + void HandleTaskError(TInt aTask, + TAny* aPtrData, + TAny* aCallback, + TInt aError); + + /** + * Handle error of execution + * @param aTask task number + * @param aErr error number + * @param aParamData parameter + */ + void HandleError(TInt aTask, TInt aErr, TInt aParamData = 0); + + /** + * Get command from state + */ + TMPXPlaybackCommand CommandFromState( TMPXPlaybackState aState ); + + /** + * Cleanup when the engine closed + */ + void DoClose(); + + /** + * Media request from collection + */ + void MediaFromCollectionL(); + + /** + * Handle plugin event + * + * @param aEvent the event type + * @param aData optional data + * @param aError error code of the event + */ + void DoHandlePluginEventL(TEvent aEvent,TInt aData,TInt aError); + + /** + * Update playbackengine state machine + * Handles plugin events that could cause state change in playback-engine + * + * @param aEvent the event type + * @param aData optional data + * @param aError error code of the event + */ + void UpdateStateMachineL(TEvent aEvent,TInt aData,TInt aError); + + /* + * Handle plugin event error handling + * This is internal function called from DoHandlePluginEvent() + * @param aEvent the event type + * @param aError error code of the event + */ + void HandlePluginEventErrorHandling(TEvent aEvent, TInt aError); + + /* + * Handle Plugin Event: Initialised + * Handles the event called Initialised + * @param aState the mpx playbackstate + * @param aData data passed from playback plugin in call to HandlePluginEvent + */ + void HandlePluginEventInitialisedL(TMPXPlaybackState& aState, TInt aData); + + /** + * Save playback Information + */ + void SavePlaybackInfoL(); + + /** + * Increments play count + */ + void SavePlaybackCompleteInfoL(); + + /** + * Restore playback position and state if it was saved previously + */ + void RestorePlaybackPositionAndStateL( const CMPXMedia& aMedia ); + + /** + * Sets the volume increment depending on accessory state + */ + void SetVolumeIncrement( TMPXPlaybackAccessoryMode aMode ); + + /** + * Marks the current item as corrupted + * @param aCorrupted Flag if corrupted or not + */ + void MarkItemCorrupted( const TBool aCorrupted ); + + /** + * Marks the current item as invalid + * @param aInvalid Flag if invalid or not + */ + void MarkItemInvalid( const TBool aInvalid ); + + /** + * Marks the current item as DRM invalid (e.g. no rights) + * @param aDrmInvalid Flag if invalid or not + */ + void MarkItemDrmInvalid( const TBool aDrmInvalid ); + + /** + * Sets flag bits + * @aSet ETrue to set, EFalse to unset + * @aFlag Flag bits to set/unset + */ + void SetFlagBitsL( const TBool aSet, const TUint aFlag ); + + /** + * Creates a CMPXMedia object to be used to Set attributes + * @param aPath Collection Path + * @return CMPXMedia object + */ + CMPXMedia* CreateMediaToSetLC( const CMPXCollectionPath& aPath ); + + /** + * Sends a request to iMediaHelper to request media + */ + void RequestMediaL(); + + /** + * Sends a plugin handler message to all clients. + * @param aMessageId the value of the KMPXMessageGeneralId attribute + * @param aPluginUid plugin UID this message is for + * @param aLoaded ETrue if the plugin is loaded + * @param aVersion plugin version + */ + void SendPluginHandlerMessageL(TInt aMessageId, const TUid& aPluginUid, + TBool aLoaded, TInt aVersion = 0); + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + /** + * Init plugin + * + * @param aSong, song path + * @param aType, song type + * @param aFile, file handle + * @param aAccessPoint aAccessPoint + */ + void Init64L(RFile64* aFile, TInt aAccessPoint=0); +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + +private: + friend class TCallbackReflector; + friend class CMPXPlaybackInitializer; + + TCallbackReflector iReflector; + CMPXPluginMonitor& iPluginMonitor; + CMPXClientList* iClientList; + CMPXPlaybackInitializer* iInitializer; + CMPXPlaybackPluginHandler* iPluginHandler; + TBool iInitNext; + /** + * Utilities + */ + CHeartbeat* iProgressTimer; + CPeriodic* iSeekTimer; + CMPXAccessoryObserver* iAccessoryObs; + CMPXPlaybackCmdBuffer* iCmdBuffer; + CMPXPlaybackSettings* iPlaybackSettings; + CMPXAutoResumeHandler* iAutoResumeHandler; + + /** + * Playlist/song data + */ + CMPXCollectionPlaylist* iPlaylist; + HBufC* iUri; + TMPXItemId iItemId; + RFile iFile; + TPlaySource iPlaySource; + TUint iDbFlag; + TInt iMediaDuration; // Duration value inside CMPXMedia + + TInt iAccessPoint; + TBool iAccessPointSet; // Access Point is set + + /** + * This player data + */ + TMPXPlaybackState iState; // current state + TMPXPlaybackState iNextState; // next possible state when handling commands + TMPXPlaybackState iPluginState; // plugin state + TBool iEmbeddedMode; + TUid iModeId; + TInt iCategory; + TBool iPlayerActive; + // + TFixedArray iProperties; + TInt iSeekStep; // millisecond + TInt iMaxSeekStep; // millisecond + MMPXPlaybackActiveEngineObserver& iObserver; + CMPXActiveTaskQueue* iTaskQueue; + MMPXPlaybackEngineObserver* iCallback; // Not owned. + + TMPXPlaybackState iPreservedState; + TInt iPreservedPosition; + + TInt iVolumeIncrement; + RArray iMediaAttrs; + TBool iSkipping; + CMPXPlaybackMediaHelper* iMediaHelper; + + CMPXPlaybackDummyMediaObserver* iDummyMediaObserver; + TUid iPluginUid; // plugin uid for current item of current playlist + TProcessId iLastActiveProcess; // Last active process for this engine + TProcessId iLastInactiveProcess; // Last inactive process for this engine + TBool iInitVolume; // Initialize volume on first creation + // the index which be firstly saved when request media + TInt iFirstRequestMediaIndex; +#if defined(__HIGH_RESOLUTION_VOLUME) + // flag to indicate whether the volume setting has been rounded up last + // used to adjust volume up button setting + TBool iVolRoundedUp; +#endif + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + RFile64 iFile64; +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + }; + +#include "mpxplaybackengine.inl" + +#endif // CMPXPLAYBACKENGINE_H + diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/inc/mpxplaybackengine.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/inc/mpxplaybackengine.inl Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,239 @@ +/* +* Copyright (c) 2006 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: Inline implementation of playback engine +* +*/ + + +#include +// ============================ LOCAL FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Check if a pointer is NULL +// ---------------------------------------------------------------------------- +// +#include +#include +#include +#include + +inline void CheckPtrL(TAny* aPtr) + { + if (!aPtr) + { + User::Leave(KErrNotReady); + } + } + +// ---------------------------------------------------------------------------- +// Check if a pointer is NULL +// ---------------------------------------------------------------------------- +// +inline void CheckPtrL(const TAny* aPtr) + { + CheckPtrL(const_cast(aPtr)); + } + +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Return plugin interface +// ---------------------------------------------------------------------------- +// +inline CMPXPlaybackPlugin* CMPXPlaybackEngine::PluginL() const + { + CheckPtrL(iPluginHandler->Plugin()); + return iPluginHandler->Plugin(); + } + +// ---------------------------------------------------------------------------- +// Return the list of clients attached to this player +// ---------------------------------------------------------------------------- +// +inline CMPXClientList* CMPXPlaybackEngine::ClientList() + { + return iClientList; + } + +// ---------------------------------------------------------------------------- +// Return plugin handler +// ---------------------------------------------------------------------------- +// +inline CMPXPlaybackPluginHandler* CMPXPlaybackEngine::PluginHandler() + { + return iPluginHandler; + } + +// ---------------------------------------------------------------------------- +// Does this player have access to audio resource +// ---------------------------------------------------------------------------- +// +inline TBool CMPXPlaybackEngine::IsPlayerActive() const + { + return iPlayerActive; + } + +// ---------------------------------------------------------------------------- +// Return mode id of the player engine +// ---------------------------------------------------------------------------- +// +inline const TUid& CMPXPlaybackEngine::ModeId() const + { + return iModeId; + } + + +// ---------------------------------------------------------------------------- +// Return category of the player engine +// ---------------------------------------------------------------------------- +// +inline const TInt CMPXPlaybackEngine::Category() const + { + return iCategory; + } + +// ---------------------------------------------------------------------------- +// Current state +// ---------------------------------------------------------------------------- +// +inline TMPXPlaybackState CMPXPlaybackEngine::State() const + { + MPX_DEBUG3("CMPXPlaybackEngine::State(): this = 0x%08x, iState = %d", this, iState); + return iState; + } + +// ---------------------------------------------------------------------------- +// Current collection path, or KNullDesC if none (i.e. not from collection) +// ---------------------------------------------------------------------------- +// +inline const CMPXCollectionPlaylist* CMPXPlaybackEngine::Playlist() const + { + CMPXCollectionPlaylist* pl = NULL; + if (iPlaylist && iPlaySource==EPlayFromCollection) + { + pl = iPlaylist; + } + return pl; + } + +// ---------------------------------------------------------------------------- +// Current uri, or KNullDesC if none (i.e. uri not supplied) +// ---------------------------------------------------------------------------- +// +inline const TDesC& CMPXPlaybackEngine::Uri() const + { + return (iUri && iPlaySource == EPlayFromUri) ? + static_cast(*iUri) : KNullDesC; + } + +// ---------------------------------------------------------------------------- +// Current file handle +// ---------------------------------------------------------------------------- +// +inline const RFile& CMPXPlaybackEngine::File() const + { + return iFile; + } + +// ---------------------------------------------------------------------------- +// Return last active process id +// ---------------------------------------------------------------------------- +// +inline TProcessId CMPXPlaybackEngine::LastActiveProcessId() const + { + return iLastActiveProcess; + } + +// ---------------------------------------------------------------------------- +// Return last inactive process id +// ---------------------------------------------------------------------------- +// +inline TProcessId CMPXPlaybackEngine::LastInactiveProcessId() const + { + return iLastInactiveProcess; + } + +// ---------------------------------------------------------------------------- +// CPlaybackCallbackReflector constructor +// ---------------------------------------------------------------------------- +// +inline CMPXPlaybackEngine::TCallbackReflector::TCallbackReflector( + CMPXPlaybackEngine& aEngine) + : iEngine(aEngine) + { + } + +// ---------------------------------------------------------------------------- +// Handle playback property +// Called by CMPXPlaybackEngine::HandleProperty which is called by plugin +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::TCallbackReflector::HandleProperty( + TMPXPlaybackProperty aProperty, + TInt aValue, + TInt aError) + { + MPX_FUNC_EX("CMPXPlaybackEngine::TCallbackReflector::HandleProperty"); + MPX_DEBUG5("HandleProperty eninge 0x%08x prop %d val %d err %d", + &iEngine, aProperty, aValue, aError); + ASSERT(iEngine.iTaskQueue->Task() == EProperty); + if (KErrNone == aError) + { + iEngine.iProperties[aProperty]=aValue; + TRAP_IGNORE( + iEngine.iClientList->SendMsgL(TMPXPlaybackMessage( + TMPXPlaybackMessage::EPropertyChanged, + aProperty, aValue))); + } + // Task will be completed in the CMPXPlaybackEngine::HandleProperty + } + +// ---------------------------------------------------------------------------- +// Method is called continously until aComplete=ETrue, signifying that +// it is done and there will be no more callbacks +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::TCallbackReflector::HandleSubPlayerNames( + TUid /*aPlayer*/, + const MDesCArray* /*aSubPlayers*/, + TBool /*aComplete*/, + TInt /*aError*/) + { + MPX_FUNC_EX("CMPXPlaybackEngine::TCallbackReflector::HandleSubPlayerNames"); + } + +// ---------------------------------------------------------------------------- +// Callback of media request +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::TCallbackReflector::HandleMedia( + CMPXMedia* /*aMedia*/, + TInt /*aError*/) + { + MPX_FUNC_EX("CMPXPlaybackEngine::TCallbackReflector::HandleMedia"); + } + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API +// ---------------------------------------------------------------------------- +// Current file handle +// ---------------------------------------------------------------------------- +// +inline const RFile64& CMPXPlaybackEngine::File64() const + { + MPX_FUNC("CMPXPlaybackEngine::File64()"); + return iFile64; + } +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + +//End of file diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/inc/mpxplaybackinitializer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/inc/mpxplaybackinitializer.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,284 @@ +/* +* Copyright (c) 2006 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: Initialize a file before playback +* +*/ + + +#ifndef CMPXPLAYBACKINITIALIZER_H +#define CMPXPLAYBACKINITIALIZER_H + +#include +#include +#include +#include + +class CMPXPlaybackPluginHandler; +class CMPXCollectionPlaylist; +class CMPXPlaybackEngine; +class CMPXPlaybackPluginHandler; +class CMPXPlaybackPlugin; +class CMPXPlaybackMediaHelper; + +/** +* Initializes playlist to be played. This class is a friend +* of CMPXPlaybackEngine +* +* The use of this class is intended to be as follows by the +* playback engine: +* 1) The Engine creates initializer class and initializes it with a +* CMPXCollectionPlaylist. +* 2) This initializer will then request the media. +* 3) The Engine then calls SetActive(), which means the Engine is now +* active, so that means the resultant media request will be forwarded +* directly to the Engine. +* 4) The Engine can then call Next() anytime afterwards. This will +* make the initializer call request media on the next item in the playlist. +* 5) Once the media returns to the initializer, it will create a playback +* plugin and initialize the file +* 6) Once initialized, the plugin stays in the initialized state. If the +* Engine then calls SetActive() again, the plugin and all data will +* be swapped, and then the Engine can start playing immediately. +* +* At anytime during the process (e.g. during request media, during +* initialization, etc), the Engine can interrupt the process and call +* SetActive(), which will swap any plugins or data appropriately, depending +* on the current state. +* +*/ +class CMPXPlaybackInitializer : public CBase, + public MMPXPlaybackPluginObserver, + public MMPXPluginHandlerObserver + { +public: + /** + * Two-phased constructor. + * + * @param aEngine reference to engine + * @param aMediaHelper Media helper object + * @return Constructed object + */ + static CMPXPlaybackInitializer* NewL( + CMPXPlaybackEngine& aEngine, + CMPXPlaybackMediaHelper& aMediaHelper ); + + /** + * Destructor + */ + ~CMPXPlaybackInitializer(); + + /** + * Start intializing first media in the playlist. + * Clears any current playlist being processed + */ + void Init(CMPXCollectionPlaylist& aPlaylist); + + /** + * Initializes next track in playlist. Discards current + * track being processed + */ + TBool Next(); + + /** + * Set the playlist active in the engine. Subsequently, + * the next track or a new playlist can be initialized + */ + void SetActiveL(); + + /** + * Close the initializer + */ + void Close(); + + /** + * Return the TMPXItemId of the current file in the initializer + */ + TMPXItemId CurrentInitItemId(); + + /** + * Implementation uid of the plugin of pre-initialzer + */ + TUid PluginUid(); + +private: + /** + * C++ constructor + * + * @param aEngine reference to engine + * @param aMediaHelper Media helper object + */ + CMPXPlaybackInitializer( + CMPXPlaybackEngine& aEngine, + CMPXPlaybackMediaHelper& aMediaHelper ); + + /** + * 2nd phase contructor + */ + void ConstructL(); + + /** + * Resets such that next media can be initialised + */ + void Reset(); + + /** + * Get the Media from the collection - the callback triggers + * the initialization + */ + void RequestMediaL(); + + /** + * Updates the forwarding variable + * to send the media to the engine if a media has been requested. + */ + void UpdateMediaForwarding(); + + /** + * Swaps the plugin being handled in the initializer to the + * engine, which takes over in whatever state it currently is in. + */ + void SwapPluginL(); + + /** + * Swaps the item uri in the engine + * Only in the EPbStateInitialising and EPbStateStopped states + */ + void SwapUriL(); + + /** + * Swaps the item db flag in the engine + * Only in the EPbStateInitialising and EPbStateStopped states + */ + void SwapFlag(); + + /** + * Is this playlist the one currently being processed? + * @param aPlaylist Playlist to check if it is already initialized + */ + TBool IsInitializing(const CMPXCollectionPlaylist& aPlaylist); + + /** + * Initializes a track + * @param aMedia CMPXMedia object to initialize + * @param aError Error returned from media request + */ + void InitL(const CMPXMedia& aMedia,TInt aError); + + /** + * Cancels the pre-init timer + */ + void CancelPreInitTimer(); + + /** + * Handle pre-init timer callback + */ + void HandlePreInitTimerCallback(); + + /** + * Callback for pre-init timer. + */ + static TInt PreInitTimerCallback(TAny* aPtr); + + /** + * Initialize streaming + */ + void InitL(const TDesC& aUri, const TDesC8& aType, TInt aAccessPoint); + +private: + /** + * From MMPXPlaybackPluginObserver + * Handle plugin event + * + * @param aEvent the event type + * @param aData optional data + * @param aError error code of the event + */ + void HandlePluginEvent(TEvent aEvent,TInt aData,TInt aError); + + /** + * Leaving version of CMPXPlaybackInitializer::HandlePluginEvent + */ + void HandlePluginEventL(TEvent aEvent,TInt aData,TInt aError); + + /** + * From MMPXPlaybackPluginObserver + * Handle message from plug-in + * + * @param aMsg, message from the plug-in. Ownership not transferred. + * @param aErr system error code. if aErr is not KErrNone, aMsg will not be + * used/dereferenced at playback engine. + */ + void HandlePlaybackMessage(CMPXMessage* aMsg, TInt aErr); + + /** + * From MMPXPlaybackPluginObserver + * Async response for Value request + * + * @param aProperty property key + * @param aValue property value + * @param aError error code + */ + void HandleProperty(TMPXPlaybackProperty aProperty, + TInt aValue,TInt aError); + + /** + * From MMPXPlaybackPluginObserver + * Async response for subplayer request + * + * @param aPlayer UID of the subplayer + * @param aSubPlayers array of subplayers + * @param aComplete ETrue, completed, EFalse, not completed + * @param aError error code + */ + void HandleSubPlayerNames(TUid aPlayer,const MDesCArray* aSubPlayers, + TBool aComplete,TInt aError); + + /** + * From MMPXPlaybackPluginObserver + * Async response for ExtendedMediaProperties request + * + * @param aMedia property object + * @param aError error code + */ + void HandleMedia(const CMPXMedia& aProperties,TInt aError); + + /////////////////////////////////////////////////////////////////////////// + // From MMPXPluginHandlerObserver + + /* + * @see MMPXPluginHandlerObserver + */ + void HandlePluginHandlerEvent(TPluginHandlerEvents aEvent, + const TUid& aPluginUid, TBool aLoaded, TInt aData); + +private: + TMPXPlaybackState iState; // State of playlist + CMPXPlaybackPluginHandler* iHandler; + CMPXPlaybackEngine& iEngine; + CMPXPlaybackMediaHelper& iMediaHelper; // not owned + + TInt iPathIndex; + TInt iInitPlaylistCount; + TBool iMediaToEngine; + TBool iMediaRequested; + + TInt iDuration; + TInt iError; + CMPXMedia* iMedia; + CMPXMessage* iMediaMessage; // media update message from plugin + TInt iErrorOfMediaMessage; // error along with media update message + CPeriodic* iTimer; + }; + +#endif // CMPXPLAYBACKINITIALIZER_H diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/inc/mpxplaybackmediahelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/inc/mpxplaybackmediahelper.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,165 @@ +/* +* Copyright (c) 2006 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: Playback engine's media helper +* +*/ + + + +#ifndef CMPXPLAYBACKMEDIAHELPER_H +#define CMPXPLAYBACKMEDIAHELPER_H + +#include +#include +#include +#include + +// FORWARD DECLARATIONS +class CMPXPlaybackEngine; +class CMPXActiveTaskQueue; +class MMPXPlaybackEngineObserver; +class MMPXCollectionUtility; +class CMPXClientList; + +/** +* Helper class to retrieve media for clients +*/ +NONSHARABLE_CLASS( CMPXPlaybackMediaHelper ) : public CBase, + public MMPXTaskQueueObserver, + public MMPXCollectionObserver + { +public: + + /** + * Two-phased constructor + */ + static CMPXPlaybackMediaHelper* NewL( CMPXPlaybackEngine& aEngine ); + + /** + * Destructor. + */ + virtual ~CMPXPlaybackMediaHelper(); + +private: // constructors + + /** + * Constructor. + */ + CMPXPlaybackMediaHelper( CMPXPlaybackEngine& aEngine ); + + /** + * Symbian OS constructor. + */ + void ConstructL(); + +public: // New Methods + + /** + * Retrieves the media given the current path, and upon return, + * either calls back the observer, or broadcasts the message to + * the given client list + * + * @param aPath Collection path to retrieve media. + * @param aCmd CMPXCommand containing the attributes and attribute spec + * Ownership of aAttrs is passed to this method + * @param aObserver Callback to return media to + * @param aBroadcast Whether or not to broadcast media message + * @param aClientlist Clientlist to broadcast message to + */ + void MediaL( const CMPXCollectionPath& aPath, + CMPXCommand* aCmd, + MMPXPlaybackEngineObserver* aObserver, + TBool aBroadcast = EFalse, + CMPXClientList* aClientList = NULL ); + + /** + * Cancels all outstanding requests + */ + void CancelRequests(); + +private: // From base classes + + /** + * From MMPXTaskQueueObserver + */ + void ExecuteTask( TInt aTask, + TInt aParamData, + TAny* aPtrData, + const CBufBase& aBuf, + TAny* aCallback, + CBase* aCObject1, + CBase* aCObject2); + + /** + * @see MMPXTaskQueueObserver + */ + void HandleTaskError(TInt aTask, + TAny* aPtrData, + TAny* aCallback, + TInt aError); + + /** + * From MMPXCollectionObserver + */ + void HandleCollectionMessage(CMPXMessage* aMsg, TInt aErr); + + /** + * From MMPXCollectionObserver + */ + void HandleOpenL( const CMPXMedia& aEntries, + TInt aIndex, + TBool aComplete, + TInt aError ); + + /** + * From MMPXCollectionObserver + */ + void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, + TInt aError ); + + /** + * From MMPXCollectionObserver + */ + void HandleCommandComplete( CMPXCommand* aCommandResult, + TInt aError ); + + /** + * From MMPXCollectionMediaObserver + */ + void HandleCollectionMediaL( const CMPXMedia& aMedia, + TInt aError); + +private: // New functions + + /** + * Executes task, leaving method + */ + void DoExecuteTaskL( + TInt aTask, + TInt aParamData, + TAny* aPtrData, + const CBufBase& aBuf, + TAny* aCallback, + CBase* aCObject1, + CBase* aCObject2); + +private: // data + CMPXPlaybackEngine& iEngine; + MMPXCollectionUtility* iCollectionUtility; + CMPXActiveTaskQueue* iTaskQueue; + }; + +#endif // CMPXPLAYBACKMEDIAHELPER_H + +//End of file diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/inc/mpxplaybackpluginhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/inc/mpxplaybackpluginhandler.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,300 @@ +/* +* Copyright (c) 2006 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: Plugin handler +* +*/ + + + +#ifndef CMPXPLAYBACKPLUGINHANDLER_H +#define CMPXPLAYBACKPLUGINHANDLER_H + +#include +#include + +class CMPXPluginMonitor; +class CMPXPlaybackPlugin; +class MMPXPlaybackPluginObserver; + + +/** +* Processes plug-ins +*/ +class CMPXPlaybackPluginHandler : public CMPXPluginHandlerBase + { +public: + /** + * Two-phased constructor. + * + * @param aPluginMonitor plugin monitor + * @param aPluginObserver Observer + * @param aObserver plugin handler observer + * @return Constructed object + */ + static CMPXPlaybackPluginHandler* NewL(CMPXPluginMonitor& aPluginMonitor, + MMPXPlaybackPluginObserver& aPluginObserver, + MMPXPluginHandlerObserver& aObserver); + + /** + * Destructor + */ + ~CMPXPlaybackPluginHandler(); + +public: + /** + * Set a new observer + * + * @param aObs observer + */ + inline void SetObserver(MMPXPlaybackPluginObserver& aObs); + + /** + * Returns currently loaded plug-in, or NULL if none + * + * @return plugin object interface + */ + inline CMPXPlaybackPlugin* Plugin(); + + /** + * Returns currently loaded plug-in UID, or KNullUId if none loaded + * + * @return UID of the plugin + */ + inline TUid PluginUid() const; + + /** + * Returns currently loaded plug-in type + * + * @return plugin type + */ + inline TMPXPlaybackPlayerType PluginType() const; + + /** + * Returns display name for custom type for current plug-in; standard types + * should be recognized by client and localized - calling this method would + * then not be required. See MMPXPlayerManager + * + * @return player name + */ + inline const TDesC& PlayerName() const; + + /** + * Is a plug-in currently loaded + * + * @return ETrue if a play-in is loaded + */ + inline TBool PlayerFound() const; + + /** + * Currently selected sub player. or KErrNotFound if none + * + * @return index of subplayer + */ + inline TInt SubPlayer() const; + + /** + * Returns plug-in with UID aUid, or leaves with KErrNotFound if not there. + * Plug-in loaded until Unload called + * + * @param UID of the plugin + * @return plugin object interface + */ + CMPXPlaybackPlugin* CreatePlayerPluginL(const TUid& aUid); + + /** + * @see CMPXPluginHandlerBase + */ + TBool IsPluginLoaded(const TUid& aPluginUid); + + /** + * @see CMPXPluginHandlerBase + */ + void LoadPluginL(const TUid& aPluginUid); + + /** + * @see CMPXPluginHandlerBase + */ + void UnloadPlugin(const TUid& aPluginUid); + + /** + * Returns display name for custom types; standard types should be + * recognized by client and localized - calling this method would then not + * be required. See MMPXPlayerManager + * + * @param aType player type + * @return player name + */ + IMPORT_C const TDesC& PlayerName(TMPXPlaybackPlayerType aType) const; + + + /** + * All the UIDs of the plug-ins in the system of a specific type. + * See MMPXPlayerManager + * + * @param aPlayers array of UIDs of all players of type aType + * @param aType player type + */ + IMPORT_C void GetPlayerListL(RArray& aPlayers, + TMPXPlaybackPlayerType aType); + + /** + * Only plug-ins of a specific type will be considered for selection. + * See MMPXPlayerManager + * + * @param aType player type + */ + IMPORT_C void SelectPlayersL(TMPXPlaybackPlayerType aType); + + /** + * selects plug-in appropriate for a Uri; may already be loaded or not + * @param aUri URI of the song + * @param aDataType data type + */ + void SelectPlayerL(const TDesC& aUri,const TDesC8& aDataType); + + /** + * selects plug-in appropriate for a file; may already be loaded or not + * + * @param aFile file handle + */ + void SelectPlayerL(RFile& aFile); + + /** + * Only this plug-in will be used, if possible. See MMPXPlayerManager + * + * @param aPlayerUid UID of players + */ + IMPORT_C void SelectPlayerL(TUid aPlayerUid); + + /** + * Only this plug-in will be used, and only this sub player, if possible. + * See MMPXPlayerManager + * + * @param aPlayerUid UID of players + * @param aSubPlayerIndex index to the subplayer + */ + IMPORT_C void SelectSubPlayerL(TUid aPlayerUid,TInt aSubPlayerIndex); + + /** + * Back to default slection criteria, i.e. type=EPbLocal, no sub player + * selected + */ + IMPORT_C void ClearSelectPlayersL(); + + /** + * Retreives the current selection: KNullUid and KErrNotFound are possible + * return values for aPlayer and aSubPlayerIndex respectively if none are + * explicitly selected + * + * @param aType player type + * @param aPlayer UID + * @param aSubPlayerIndex index of sub player + * @param aSubPlayerName Friendly name of the sub player + */ + IMPORT_C void GetSelection(TMPXPlaybackPlayerType& aType, + TUid& aPlayer, + TInt& aSubPlayerIndex, + TPtrC& aSubPlayerName); + + /** + * Return a list of interfaces supported by plugins. + * + * @return an array of interfaces. Client is responsible + * for the memory management of this array and its + * items. + */ + IMPORT_C CDesCArray* SupportedInterfacesL(); + + /** + * Return a list of interfaces supported by a plugin. + * + * @param aUid plugin id + * @return an array of interfaces. Client is responsible + * for the memory management of this array and its + * items. + */ + IMPORT_C CDesCArray* SupportedInterfacesL(const TUid& aUid); + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + /** + * selects plug-in appropriate for a file; may already be loaded or not + * + * @param aFile file handle + */ + void SelectPlayer64L(RFile64& aFile); +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + +protected: + + /** + * From Base CMPXPluginHandlerBase + * Constructs the collection plugin info + */ + CMPXPluginInfo* ConstructPluginInfoLC( const CImplementationInformation& aData ); + +private: + + /** + * 2nd phase contructor + */ + void ConstructL(); + + /** + * C++ constructor + * + * @param aPluginMonitor plugin monitor + * @param aPluginObserver plugin observer + * @param aObserver handler observer + */ + CMPXPlaybackPluginHandler(CMPXPluginMonitor& aPluginMonitor, + MMPXPlaybackPluginObserver& aPluginObserver, + MMPXPluginHandlerObserver& aObserver); + +private: + + /** + * From Base CMPXPluginHandlerBase + * Resolves a plugin + */ + void ResolvePluginL(); + + /** + * Unloads the plugin at a specified index. + * @param aIndex index of the plugin in iLoadedPlugins + */ + void UnloadPlugin(TInt aIndex); + +private: + MMPXPlaybackPluginObserver* iPluginObserver; // Not owned. + // + // Loaded. The index must correspond in these arrays + // + RPointerArray iLoadedPlugins; + RArray iLoadedPluginsUids; + + // Chosen + // + CMPXPlaybackPlugin* iPlugin; + TUid iPluginUid; + TMPXPlaybackPlayerType iPluginType; + HBufC* iDisplayName; + // + // Desired + // + TInt iSelectedSubPlayerIndex; + }; + +#include "mpxplaybackpluginhandler.inl" + +#endif // CMPXPLAYBACKPLUGINHANDLER_H diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/inc/mpxplaybackpluginhandler.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/inc/mpxplaybackpluginhandler.inl Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2006 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: Inline implementation of playback plugin handler +* +*/ + + +// ---------------------------------------------------------------------------- +// Set observer +// ---------------------------------------------------------------------------- +// +inline void CMPXPlaybackPluginHandler::SetObserver( + MMPXPlaybackPluginObserver& aObs) + { + iPluginObserver = &aObs; + } + +// ---------------------------------------------------------------------------- +// Return current plugin +// ---------------------------------------------------------------------------- +// +inline CMPXPlaybackPlugin* CMPXPlaybackPluginHandler::Plugin() + { + return iPlugin; + } + +// ---------------------------------------------------------------------------- +// Return current plugin id +// ---------------------------------------------------------------------------- +// +inline TUid CMPXPlaybackPluginHandler::PluginUid() const + { + return iPluginUid; + } + +// ---------------------------------------------------------------------------- +// Return current plugin type +// ---------------------------------------------------------------------------- +// +inline TMPXPlaybackPlayerType CMPXPlaybackPluginHandler::PluginType() const + { + return iPluginType; + } + +// ---------------------------------------------------------------------------- +// Return player name +// ---------------------------------------------------------------------------- +// +inline const TDesC& CMPXPlaybackPluginHandler::PlayerName() const + { + return *iDisplayName; + } + +// ---------------------------------------------------------------------------- +// Return index of the subplayer +// ---------------------------------------------------------------------------- +// +inline TInt CMPXPlaybackPluginHandler::SubPlayer() const + { + return iPlugin->SubPlayerIndex(); + } + +// ---------------------------------------------------------------------------- +// Check if the player found or not +// ---------------------------------------------------------------------------- +// +inline TBool CMPXPlaybackPluginHandler::PlayerFound() const + { + return iPlugin!=NULL; + } diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/inc/mpxplaybackplugininfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/inc/mpxplaybackplugininfo.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2008 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: Plugin info class for Playback engine +* +*/ + + +#ifndef C_MPXPLAYBACKPLUGININFO_H +#define C_MPXPLAYBACKPLUGININFO_H + +#include +#include + +/** + * Playback derived plugin info class + * + * @lib mpxplaybackengine.dll + * @since S60 3.2 + */ +NONSHARABLE_CLASS( CMPXPlaybackPluginInfo ) : public CMPXPluginInfo + { + +public: + + /** + * Two-Phased constructor + * @param aData implementation data + * @return CMPXPlaybackPluginInfo* + */ + static CMPXPlaybackPluginInfo* NewL( const CImplementationInformation& aData ); + + /** + * Two-Phased constructor + * @param aData implementation data + * @return CMPXPlaybackPluginInfo* on cleanupstack + */ + static CMPXPlaybackPluginInfo* NewLC( const CImplementationInformation& aData ); + + + /** + * Virtual destructor + */ + virtual ~CMPXPlaybackPluginInfo(); + +protected: // From base class + + /** + * Process a extended tagged data which derived class may support. + * Default implementation in this class just ignore the data. + * + * @since S60 3.2.3 + * @param aTag xml-styled tag + * @param aData data in the xml-styled tag + */ + IMPORT_C virtual void ProcessTaggedDataExL(const TDesC8& aTag, const TDesC8& aData); + +private: + + /** + * Two-phased constructor + */ + void ConstructL( const CImplementationInformation& aData ); + + /** + * C++ Constructor + */ + CMPXPlaybackPluginInfo(); + +public: + + /** + * Extract the supported interfaces + */ + void ExtractSupportedInterfacesL( const TDesC8& aData ); + + /** + * Returns supported interfaces. + * + * @return supported interfaces + */ + const CDesCArray& SupportedInterfaces() const; + +private: // data + + CDesCArray* iSupportedInterfaces; + }; + +#endif // C_MPXPLAYBACKPLUGININFO_H diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/inc/mpxplaybacksettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/inc/mpxplaybacksettings.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2006 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: Playback settings. +* +*/ + + + +#ifndef CMPXPLAYBACKSETTINGS_H +#define CMPXPLAYBACKSETTINGS_H + +// INCLUDES +#include + +// CLASS DECLARATION + +/** +* CMPXPlaybackSettings. +* Playback settings +* +* @lib mpxplaybackengine.dll +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMPXPlaybackSettings) : public CBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CMPXPlaybackSettings* NewL(); + + /** + * Destructor. + */ + virtual ~CMPXPlaybackSettings(); + + public: // New functions + + // Central repository is used for settings + + + private: + + /** + * C++ default constructor. + */ + CMPXPlaybackSettings(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // Data + }; + +#endif // CMPXPLAYBACKSETTINGS_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/src/mpxaccessoryobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/src/mpxaccessoryobserver.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,301 @@ +/* +* Copyright (c) 2006 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: Accessory observer +* +*/ + +#include +#include "mpxaccessoryobserver.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CMPXAccessoryObserver::NewL +// Two phase constructor +// ----------------------------------------------------------------------------- +// +CMPXAccessoryObserver* CMPXAccessoryObserver::NewL( + MMPXAccessoryEventObserver& aObs) + { + CMPXAccessoryObserver* self = new ( ELeave ) CMPXAccessoryObserver(aObs); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// ----------------------------------------------------------------------------- +// CMPXAccessoryObserver::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CMPXAccessoryObserver::ConstructL() + { + MPX_DEBUG1("CMPXAccessoryObserver::ConstructL()" ); +#ifdef __ACCESSORY_FW + User::LeaveIfError(iServer.Connect()); + User::LeaveIfError(iMode.CreateSubSession(iServer)); +#endif // __ACCESSORY_FW + StartL(); + } + +// ----------------------------------------------------------------------------- +// CMPXAccessoryObserver::CMPXAccessoryObserver +// ----------------------------------------------------------------------------- +// +#ifdef __ACCESSORY_FW +CMPXAccessoryObserver::CMPXAccessoryObserver( + MMPXAccessoryEventObserver& aObs) +: CActive( CActive::EPriorityStandard ), + iObs(aObs) + { + CActiveScheduler::Add(this); + } + +#else +CMPXAccessoryObserver::CMPXAccessoryObserver( + MMPXAccessoryEventObserver& aObs) +: CDosEventListenerBase(), + iObs(aObs) + { + } +#endif // __ACCESSORY_FW + + +// ----------------------------------------------------------------------------- +// Destructor. +// ----------------------------------------------------------------------------- +// +CMPXAccessoryObserver::~CMPXAccessoryObserver() + { + MPX_DEBUG1("CMPXAccessoryObserver::~CMPXAccessoryObserver()"); +#ifdef __ACCESSORY_FW + Cancel(); + iMode.CloseSubSession(); + iServer.Disconnect(); +#endif // __ACCESSORY_FW + } + +#ifndef __ACCESSORY_FW +// ----------------------------------------------------------------------------- +// CMPXAccessoryObserver::AccessoryModeChangedL +// Receives event on accessory mode change. +// ----------------------------------------------------------------------------- +// +void CMPXAccessoryObserver::AccessoryModeChangedL( + TDosAccessoryMode aAccessoryState ) + { + MPX_FUNC("CMPXAccessoryObserver::AccessoryModeChangedL"); + + TMPXPlaybackAccessoryMode mode( ConvertToMpxMode( aAccessoryState )); + if ( EPbAccessoryModeUnknown != mode ) + { //inform parent + iObs.HandleAccesoryEventL(mode); + } + } +#endif // __ACCESSORY_FW + +// ----------------------------------------------------------------------------- +// CMPXAccessoryObserver::StartL +// ----------------------------------------------------------------------------- +// +void CMPXAccessoryObserver::StartL() + { + MPX_DEBUG1("CMPXAccessoryObserver::StartL()"); + +#ifdef __ACCESSORY_FW + if (!IsActive()) + { + iMode.NotifyAccessoryModeChanged(iStatus, iAccessory_mode); + SetActive(); + } +#else + StartListeningL(KAccessoryModeChanged, sizeof (TDosAccessoryMode), EQueue ); +#endif // __ACCESSORY_FW + + } +// ----------------------------------------------------------------------------- +// CMPXAccessoryObserver::AccessoryModeL +// Gets current accessory mode +// ----------------------------------------------------------------------------- +// +TMPXPlaybackAccessoryMode CMPXAccessoryObserver::AccessoryModeL() + { + MPX_DEBUG1("CMPXAccessoryObserver::AccessoryModeL() entering"); + +#ifdef __ACCESSORY_FW + RAccessoryServer accessoryServer; + User::LeaveIfError( accessoryServer.Connect () ); + CleanupClosePushL( accessoryServer ); + RAccessoryMode accessory; + accessory.CreateSubSession( accessoryServer ); + TAccPolAccessoryMode accMode; + TInt err = accessory.GetAccessoryMode( accMode ); + accessory.CloseSubSession(); + CleanupStack::PopAndDestroy( &accessoryServer ); +#else + RDosServer dosServer; + User::LeaveIfError( dosServer.Connect () ); + CleanupClosePushL( dosServer ); + RDosAccessory dosAccessory; + User::LeaveIfError( dosAccessory.Open( dosServer ) ); + CleanupClosePushL( dosAccessory ); + TDosAccessoryMode accMode( EDosAccNotConnected ); + TInt err = dosAccessory.GetAccessoryMode( accMode ); + CleanupStack::PopAndDestroy( 2, dosServer ); // close dosAccessory and dosServer +#endif // __ACCESSORY_FW + + MPX_DEBUG1("CMPXAccessoryObserver::AccessoryModeL() exiting"); + return ConvertToMpxMode( accMode ); + } + +// ----------------------------------------------------------------------------- +// CMPXAccessoryObserver::ConvertToMpxMode +// Converts from accessory mode to internal MPX mode enum +// ----------------------------------------------------------------------------- +// +TMPXPlaybackAccessoryMode CMPXAccessoryObserver::ConvertToMpxMode( +#ifdef __ACCESSORY_FW + TAccPolAccessoryMode& aMode ) +#else + TDosAccessoryMode& aMode ) +#endif // __ACCESORY_FW + { + MPX_DEBUG1("CMPXAccessoryObserver::ConvertToMpxMode() entering"); + + TMPXPlaybackAccessoryMode mode( EPbAccessoryModeUnknown ); + +#ifdef __ACCESSORY_FW + MPX_DEBUG2("CMPXAccessoryObserver::ConvertToMpxMode(): aMode.iAccessoryMode = %d", aMode.iAccessoryMode); + switch ( aMode.iAccessoryMode ) + { + case EAccModeHandPortable: + mode = EPbAccessoryHandPortable; + break; + case EAccModeWiredHeadset: + mode = EPbAccessoryWiredHeadset; + break; + case EAccModeWirelessHeadset: + mode = EPbAccessoryWirelessHeadset; + break; + case EAccModeWiredCarKit: + mode = EPbAccessoryWiredCarKit; + break; + case EAccModeWirelessCarKit: + mode = EPbAccessoryWirelessCarKit; + break; + case EAccModeTextDevice: + mode = EPbAccessoryTextDevice; + break; + case EAccModeLoopset: + mode = EPbAccessoryLoopset; + break; + case EAccModeMusicStand: + mode = EPbAccessoryMusicStand; + break; + case EAccModeTVOut: + mode = EPbAccessoryTVOut; + break; + case EAccModeHeadphones: + mode = EPbAccessoryHeadphones; + break; + default: + break; + } +#else + MPX_DEBUG2("CMPXAccessoryObserver::ConvertToMpxMode(): aMode = %d", aMode); + switch ( aMode ) + { + case EDosAccNotConnected: + mode = EPbAccessoryNone; + break; + case EDosAccUnsupportedConnected: + mode = EPbAccessoryUnsupported; + break; + case EDosAccModeHeadset: + mode = EPbAccessoryHeadset; + break; + case EDosAccModeLoopset: + mode = EPbAccessoryLoopset; + break; + case EDosAccModeTty: + mode = EPbAccessoryTty; + break; + case EDosAccModeCarKit: + mode = EPbAccessoryCarKit; + break; + case EDosAccModeBtHeadset: + mode = EPbAccessoryBtHeadset; + break; + case EDosAccModeBtCarKit: + mode = EPbAccessoryBtCarKit; + break; + default: + break; + } +#endif // __ACCESORY_FW + + MPX_DEBUG2("CMPXAccessoryObserver::ConvertToMpxMode() exiting: %d", mode); + return mode; + } + +#ifdef __ACCESSORY_FW +// ----------------------------------------------------------------------------- +// CMPXAccessoryObserver::RunL +// ----------------------------------------------------------------------------- +// +void CMPXAccessoryObserver::RunL() + { + MPX_DEBUG2("CMPXAccessoryObserver::RunL() status %d ",iStatus.Int() ); + + switch ( iStatus.Int() ) + { + case KErrCancel: + return; + case KErrNone: + { + TMPXPlaybackAccessoryMode mode = ConvertToMpxMode( iAccessory_mode ); + MPX_DEBUG2("CMPXAccessoryObserver::AccessoryModeChangedL() mode %d",mode ); + + //inform parent + if ( EPbAccessoryModeUnknown != mode ) + { + iObs.HandleAccesoryEventL(mode); + } + // Issue request again + StartL(); + } + break; + case KErrNotSupported: + break; + default: + StartL(); + break; + } + + } + +// ----------------------------------------------------------------------------- +// CMPXAccessoryObserver::DoCancel +// ----------------------------------------------------------------------------- +// +void CMPXAccessoryObserver::DoCancel() + { + MPX_FUNC("CMPXAccessoryObserver::DoCancel()"); + iMode.CancelNotifyAccessoryModeChanged(); + } +#endif // __ACCESSORY_FW + +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/src/mpxautoresumehandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/src/mpxautoresumehandler.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,377 @@ +/* +* Copyright (c) 2006 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: Implemention of the auto resume handler. +* +*/ + + +#include +#include +#include +#include +#include "mpxplaybackengine.h" +#include "mpxautoresumehandler.h" + +// CONSTANTS +const TInt KMPXErrDiedTimeout = 2000000; + +// Time to wait before resume after call has ended. +const TInt KMPXResumeWaitTime = 3000000; // 3.0s + + + +// ================= MEMBER FUNCTIONS ======================= + + +// ----------------------------------------------------------------------------- +// C++ constructor +// ----------------------------------------------------------------------------- +// +CMPXAutoResumeHandler::CMPXAutoResumeHandler( + CMPXPlaybackEngine& aEngine, + TBool aMixerSupport) : + iEngine(aEngine), + iMixerSupport(aMixerSupport), + iAutoResume(ETrue) + { + } + +// ----------------------------------------------------------------------------- +// Symbian OS default constructor +// ----------------------------------------------------------------------------- +// +void CMPXAutoResumeHandler::ConstructL() + { + // Listen to call state changes + iStateObserver = CMPXPSKeyWatcher::NewL(KPSUidCtsyCallInformation, + KCTsyCallState,this); + + // Listen to call type changes + iTypeObserver = CMPXPSKeyWatcher::NewL(KPSUidCtsyCallInformation, + KCTsyCallType,this); + iResumeTimer = CPeriodic::NewL(CActive::EPriorityStandard); + } + +// ----------------------------------------------------------------------------- +// Constructs a new entry with given values. +// ----------------------------------------------------------------------------- +// +CMPXAutoResumeHandler* CMPXAutoResumeHandler::NewL( + CMPXPlaybackEngine& aEngine, + TBool aMixerSupport) + { + CMPXAutoResumeHandler* self = + new (ELeave) CMPXAutoResumeHandler(aEngine, aMixerSupport); + + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// CMPXAutoResumeHandler::CMPXAutoResumeHandler() +// Destructor +// ----------------------------------------------------------------------------- +// +CMPXAutoResumeHandler::~CMPXAutoResumeHandler() + { + delete iStateObserver; + delete iTypeObserver; + if ( iResumeTimer ) + { + CancelResumeTimer(); + delete iResumeTimer; + } + } + +// ----------------------------------------------------------------------------- +// Open file completed +// ----------------------------------------------------------------------------- +// +void CMPXAutoResumeHandler::HandleOpenFileComplete() + { + MPX_FUNC("CMPXAutoResumeHandler::HandleOpenFileComplete()"); + iPausedForCall = EFalse; + } + +// ----------------------------------------------------------------------------- +// CMPXAutoResumeHandler::MPlayerStateChanged +// ----------------------------------------------------------------------------- +// +void CMPXAutoResumeHandler::HandlePlaybackStateChange(TMPXPlaybackState aState) + { + MPX_DEBUG2("CMPXAutoResumeHandler::HandlePlaybackStateChange(%d) entering", aState); + + // Any state change means that possible waiting resume is not to be done + // anymore. + CancelResumeTimer(); + + if (aState != EPbStatePaused) + { + iPausedForCall = EFalse; + } + MPX_DEBUG1("CMPXAutoResumeHandler::HandlePlaybackStateChange() exiting"); + } + +// ----------------------------------------------------------------------------- +// CMPXAutoResumeHandler::MPlayerPlayComplete +// ----------------------------------------------------------------------------- +// +void CMPXAutoResumeHandler::HandlePlaybackComplete(TInt aError) + { + MPX_DEBUG2("CMPXAutoResumeHandler::HandlePlaybackComplete(%d) entering", aError); + iPausedForCall = EFalse; + if ( KErrDied == aError || + KErrAccessDenied == aError ) + { + iKErrDiedTime.HomeTime(); + + TInt callType = EPSCTsyCallTypeNone; + TInt callState = EPSCTsyCallStateNone; + + if (!iTypeObserver->GetValue(callType) && + !iStateObserver->GetValue(callState)) + { + if ((callState == EPSCTsyCallStateRinging && iMixerSupport) || + ShouldPause()) + { + // Getting a play complete with KErrDied here + // means Audio Policy terminated our playback, + // due to phone call being connected. Enable + // autoresume. + iPausedForCall = ETrue; + } + } + } + MPX_DEBUG1("CMPXAutoResumeHandler::HandlePlaybackComplete() exiting"); + } + +// ----------------------------------------------------------------------------- +// CMPXAutoResumeHandler::CancelResumeTimer +// ----------------------------------------------------------------------------- +// +void CMPXAutoResumeHandler::CancelResumeTimer() + { + if ( iResumeTimer ) + { + iResumeTimer->Cancel(); + } + } + +// ----------------------------------------------------------------------------- +// CMPXAutoResumeHandler::HandlePSEvent +// ----------------------------------------------------------------------------- +// +void CMPXAutoResumeHandler::HandlePSEvent(TUid /*aUid*/, TInt /*aKey*/) + { + MPX_FUNC("CMPXAutoResumeHandler::HandlePSEvent()"); + TRAP_IGNORE(DoHandleStateChangeL()); + } + +// ----------------------------------------------------------------------------- +// CMPXAutoResumeHandler::DoHandleStateChangeL +// ----------------------------------------------------------------------------- +// +void CMPXAutoResumeHandler::DoHandleStateChangeL() + { + MPX_FUNC("CMPXAutoResumeHandler::DoHandleStateChangeL()"); + MPX_DEBUG2("CMPXAutoResumeHandler::DoHandleStateChangeL(): iPausedForCall = %d", iPausedForCall); + MPX_DEBUG2("CMPXAutoResumeHandler::DoHandleStateChangeL(): engineState = %d", iEngine.State()); + // if autoresume is disabled, do nothing + if ( !iAutoResume ) + { + return; + } + + TBool shouldPause = ShouldPause(); + if (shouldPause && + !iPausedForCall && + iEngine.State() == EPbStatePlaying) + { + iEngine.HandleCommandL(EPbCmdPause); + iPausedForCall = ETrue; + } + else if ( shouldPause && + !iPausedForCall && + ( iEngine.State() == EPbStateSeekingForward || + iEngine.State() == EPbStateSeekingBackward ) ) + { + iEngine.HandleCommandL( EPbCmdStopSeeking ); + if ( iEngine.State() == EPbStatePlaying ) + { + iEngine.HandleCommandL( EPbCmdPause ); + iPausedForCall = ETrue; + } + } + else if(!shouldPause && + iPausedForCall && + iEngine.State() == EPbStatePaused) + { + MPX_DEBUG1("CMPXAutoResumeHandler::DoHandleStateChangeL(): starting resume timer"); + if ( iResumeTimer->IsActive() ) + iResumeTimer->Cancel(); + iResumeTimer->Start( + KMPXResumeWaitTime, + KMPXResumeWaitTime, + TCallBack(ResumeTimerCallback, this) ); + iPausedForCall = EFalse; + } + else if ( shouldPause && + iEngine.State() == EPbStatePaused && + !iPausedForCall && + iKErrDiedTime.Int64()) + { + // Check if we recently got a playcomplete with KErrDied, + // it was most likely caused by an active call + TTime now; + now.HomeTime(); + TInt64 deltaTime = now.MicroSecondsFrom(iKErrDiedTime).Int64(); + if ( deltaTime > 0 && + deltaTime < KMPXErrDiedTimeout) + { + iResumeTimer->Cancel(); + iPausedForCall = ETrue; + } + } + MPX_DEBUG2("CMPXAutoResumeHandler::DoHandleStateChangeL(): iPausedForCall = %d", iPausedForCall); + } + +// ----------------------------------------------------------------------------- +// CMPXAutoResumeHandler::ShouldPause +// ----------------------------------------------------------------------------- +// +TBool CMPXAutoResumeHandler::ShouldPause() + { + MPX_DEBUG1("CMPXAutoResumeHandler::ShouldPause() entering"); + TBool ret = EFalse; + + if ( !IsPlaybackRemote() ) + { + TInt callType; + TInt callState; + iTypeObserver->GetValue(callType); + iStateObserver->GetValue(callState); + MPX_DEBUG3("CMPXAutoResumeHandler::ShouldPause(): type = %d, state = %d", callType, callState); + + if (callType == EPSCTsyCallTypeCSVoice || + callType == EPSCTsyCallTypeH324Multimedia || + callType == EPSCTsyCallTypeVoIP || + callType == EPSCTsyCallTypeUninitialized) + { + switch (callState) + { + case EPSCTsyCallStateAnswering: + case EPSCTsyCallStateAlerting: + case EPSCTsyCallStateConnected: + case EPSCTsyCallStateDialling: + case EPSCTsyCallStateHold: + case EPSCTsyCallStateDisconnecting: + { + ret = ETrue; + break; + } + case EPSCTsyCallStateRinging: + { + if (iPausedForCall) + { + ret = ETrue; + } + else + { + // Pause playback if we cannot mix music playback + // with ringing tone. + ret = !iMixerSupport; + } + break; + } + default: + { + // Default is no pause + break; + } + } + } + } + MPX_DEBUG2("CMPXAutoResumeHandler::ShouldPause() exiting: %d", ret); + return ret; + } + +// ----------------------------------------------------------------------------- +// CMPXAutoResumeHandler::HandleResumeTimerCallback +// ----------------------------------------------------------------------------- +// +void CMPXAutoResumeHandler::HandleResumeTimerCallback() + { + MPX_FUNC("CMPXAutoResumeHandler::HandleResumeTimerCallback() entering"); + + CancelResumeTimer(); + TRAP_IGNORE( iEngine.HandleCommandL( EPbCmdPlayWithFadeIn )); + } + +// ----------------------------------------------------------------------------- +// CMPXAutoResumeHandler::ResumeTimerCallbackL +// ----------------------------------------------------------------------------- +// +TInt CMPXAutoResumeHandler::ResumeTimerCallback(TAny* aPtr) + { + MPX_FUNC("CMPXAutoResumeHandler::ResumeTimerCallback()"); + + CMPXAutoResumeHandler* ptr = + static_cast(aPtr); + ptr->HandleResumeTimerCallback(); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMPXAutoResumeHandler::IsPlaybackRemote +// ----------------------------------------------------------------------------- +// +TBool CMPXAutoResumeHandler::IsPlaybackRemote() + { + MPX_DEBUG1("CMPXAutoResumeHandler::IsPlaybackRemote() entering"); + TBool isRemote = EFalse; + + if ( iEngine.State() == EPbStatePlaying ) + { + TMPXPlaybackPlayerType type( EPbLocal ); + TUid uid; + TInt index; + TPtrC subPlayerName( KNullDesC ); + iEngine.PluginHandler()->GetSelection( type, uid, + index, subPlayerName ); + + if ( type != EPbLocal ) + { + isRemote = ETrue; + } + } + + MPX_DEBUG2("CMPXAutoResumeHandler::IsPlaybackRemote() exiting: %d", isRemote); + return isRemote; + } + +// ----------------------------------------------------------------------------- +// Set autoresume value +// ----------------------------------------------------------------------------- +// +void CMPXAutoResumeHandler::SetAutoResume(TBool aAutoResume) + { + MPX_DEBUG2("CMPXAutoResumeHandler::SetAutoResume(): AutoResume = %d", aAutoResume); + iAutoResume = aAutoResume; + } + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/src/mpxplaybackcommandbuffer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/src/mpxplaybackcommandbuffer.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,281 @@ +/* +* Copyright (c) 2006 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: Buffer commands +* +*/ + + +#include"mpxplaybackcommandbuffer.h" +#include "mpxlog.h" + +// ============================== MEMBER FUNCTIONS ============================ + + +// ---------------------------------------------------------------------------- +// Two-phased constructor +// ---------------------------------------------------------------------------- +// +CMPXPlaybackCmdBuffer* CMPXPlaybackCmdBuffer::NewL( + MMPXPlaybackCmdBufferObserver& aObserver) + { + CMPXPlaybackCmdBuffer* h=new(ELeave)CMPXPlaybackCmdBuffer(aObserver); + CleanupStack::PushL(h); + h->ConstructL(); + CleanupStack::Pop(h); + return h; + } + +// ---------------------------------------------------------------------------- +// C++ constructor can NOT contain any code that might leave. +// ---------------------------------------------------------------------------- +// +CMPXPlaybackCmdBuffer::CMPXPlaybackCmdBuffer( + MMPXPlaybackCmdBufferObserver& aObserver) +: CTimer(EPriorityStandard), + iObserver(aObserver) + { + CActiveScheduler::Add(this); + } + + +// ---------------------------------------------------------------------------- +// Is this a command controlled by command buffer +// ---------------------------------------------------------------------------- +// +TBool CMPXPlaybackCmdBuffer::CommandForBuffering(TMPXPlaybackCommand aCmd) const + { + switch(aCmd) + { + case EPbCmdPlay: + case EPbCmdStop: + case EPbCmdPause: + case EPbCmdPlayPause: + case EPbCmdNext: + case EPbCmdPrevious: + return ETrue; + default: + return EFalse; + } + } + +// ---------------------------------------------------------------------------- +// Handle time out event +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackCmdBuffer::RunL() + { + MPX_DEBUG1("CMPXPlaybackCmdBuffer::RunL() entering"); + + if (!iEventProcessing && IsCommandBuffered()) + // + // Client is not currently processing any events, and there are new + // events to deliver + // + { + if (iEvent.iNavKeyBuffered) + { + iObserver.HandleCmdBufferSkipEventL( EPbsSkipEventEnd ); // notify end skip event + } + iIsCommandBuffered=EFalse; + iEventProcessing=ETrue; // Handled by client + iObserver.HandleCmdBufferEventL(iEvent); + } + + MPX_DEBUG1("CMPXPlaybackCmdBuffer::RunL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Handle leave in command handling +// ---------------------------------------------------------------------------- +// +TInt CMPXPlaybackCmdBuffer::RunError(TInt /*aError*/) + { + MPX_DEBUG1("==>CMPXPlaybackCmdBuffer::RunL()"); + ClearCommands(); + iEventProcessing=EFalse; + MPX_DEBUG1("<==CMPXPlaybackCmdBuffer::RunL()"); + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// Buffer a playback/skip command, along with the current state and position in +// the track. Update playback state/position internally. When time-out, restore +// state/position to playback engine. +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackCmdBuffer::BufferCommandL(TMPXPlaybackCommand aCmd, + TMPXPlaybackState aState, + TInt aPos) + { + MPX_DEBUG4("CMPXPlaybackCmdBuffer::BufferCommandL(%d, %d, %d) entering", aCmd, aState, aPos); + + if (!CommandForBuffering(aCmd) || + (aCmd==EPbCmdPlay && aState==EPbStatePlaying) || + (aCmd==EPbCmdPause && aState==EPbStatePaused)) + { + // This command does not change any state, so make sure + // to negate any previous commands + ClearCommands(); + return; + } + + TBool saveIsCmdBuffered = iIsCommandBuffered; + iBufferTime = KPbMediaKeyIntervalMicroSeconds; + const TInt KPbMediaKeyNoIntervalMicroSeconds=10; // 0.00001s + const TInt KPbMediaKeySkipIntervalMicroSeconds=200000; // 0.2s or 200ms + const TInt KPbMediaKeyPauseIntervalMicroSeconds=100000; // 0.1s or 100ms + Cancel(); // Stop timer and wait again for any other events + + if (!iIsCommandBuffered) + { + iIsCommandBuffered=ETrue; + iEvent.iTrackOffset=0; + iEvent.iState=aState; + iEvent.iNavKeyBuffered=EFalse; + } + + if (!iEvent.iNavKeyBuffered) + { + iEvent.iPos = aPos; + } + + switch(aCmd) + { + case EPbCmdNext: + { + iEvent.iTrackOffset++; + iEvent.iNavKeyBuffered++; + TBool savedStatus( iEventProcessing ); + iEventProcessing = ETrue; + iObserver.HandleCmdBufferSkipEventL( EPbsSkipEventNext ); // notify skip event + iEventProcessing = savedStatus; + if ( !saveIsCmdBuffered ) + { + iBufferTime = KPbMediaKeySkipIntervalMicroSeconds; // 0.2s or 200ms + } + break; + } + case EPbCmdPrevious: + { + if (!iEvent.iNavKeyBuffered && + (aState==EPbStatePlaying || aState==EPbStatePaused) && + iEvent.iPos > KPbReplayThresholdMiliSeconds) + { + MPX_DEBUG1("CMPXPlaybackCmdBuffer::BufferCommandL() Setting position 0"); + aPos=0; + } + else + { + TBool savedStatus( iEventProcessing ); + iEventProcessing = ETrue; + iObserver.HandleCmdBufferSkipEventL( EPbsSkipEventPrevious ); // notify skip event + iEventProcessing = savedStatus; + iEvent.iTrackOffset--; + } + iEvent.iNavKeyBuffered++; + break; + } + case EPbCmdPlay: + iEvent.iState = EPbStatePlaying; + if ( !saveIsCmdBuffered ) + { + iBufferTime = KPbMediaKeyNoIntervalMicroSeconds; + } + break; + case EPbCmdPause: // From play to pause + if (EPbStatePlaying == iEvent.iState) + { + iEvent.iState = EPbStatePaused; + if ( !saveIsCmdBuffered ) + { + iBufferTime = KPbMediaKeyPauseIntervalMicroSeconds; + } + } + break; + case EPbCmdPlayPause: + { + if ( EPbStatePlaying == iEvent.iState ) + { + iEvent.iState = EPbStatePaused; + if ( !saveIsCmdBuffered ) + { + iBufferTime = KPbMediaKeyPauseIntervalMicroSeconds; + } + break; + } + else + { + iEvent.iState = EPbStatePlaying; + if ( !saveIsCmdBuffered ) + { + iBufferTime = KPbMediaKeyNoIntervalMicroSeconds; + } + } + break; + } + case EPbCmdStop: + iEvent.iState = EPbStateStopped; + break; + default: + break; + } + // maintain pos unless track has changed + iEvent.iPos=iEvent.iTrackOffset ? 0 : aPos; + // + if (!iEventProcessing) // If client isn't processing event + { + After(iBufferTime); + } + + MPX_DEBUG1("CMPXPlaybackCmdBuffer::BufferCommandL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Called by client when finished processing commands in buffer +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackCmdBuffer::CompleteCommand() + { + MPX_DEBUG1("CMPXPlaybackCmdBuffer::CompleteCommand() entering"); + + iEventProcessing=EFalse; // Client finished processing event + if (IsCommandBuffered() && !IsActive()) + { + After(iBufferTime); + } + + MPX_DEBUG1("CMPXPlaybackCmdBuffer::CompleteCommand() exiting"); + } + +// ---------------------------------------------------------------------------- +// Check if any commands buffered +// ---------------------------------------------------------------------------- +// +TBool CMPXPlaybackCmdBuffer::IsCommandBuffered() const + { + return iIsCommandBuffered; + } + +// ---------------------------------------------------------------------------- +// Clear all commands +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackCmdBuffer::ClearCommands() + { + iIsCommandBuffered=EFalse; + Cancel(); + } + + + diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/src/mpxplaybackdummymediaobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/src/mpxplaybackdummymediaobserver.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2007 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: Dummy observer class +* +*/ + + +#include +#include "mpxplaybackdummymediaobserver.h" + + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CMPXPlaybackDummyMediaObserver::CMPXPlaybackDummyMediaObserver() + { + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CMPXPlaybackDummyMediaObserver::~CMPXPlaybackDummyMediaObserver() + { + } + +// ---------------------------------------------------------------------------- +// From MMPXCollectionMediaObserver +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackDummyMediaObserver::HandleCollectionMediaL(const CMPXMedia& /*aMedia*/, + TInt /*aError*/) + { + // DO NOTHING + } + +// END OF FILE diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/src/mpxplaybackengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/src/mpxplaybackengine.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3868 @@ +/* +* Copyright (c) 2006 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: Controls playback via plug-ins +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mpxplaybacksettings.h" +#include "mpxautoresumehandler.h" +#include "mpxplaybackcommandbuffer.h" +#include "mpxplaybackactiveengineobserver.h" +#include "mpxplaybackinitializer.h" +#include "mpxplaybackengine.h" +#include "mpxplaybackmediahelper.h" +#include "mpxplaybackdummymediaobserver.h" + +// CONSTANTS +const TInt KMPXSmallVolumeIncrement = 5; +const TInt KMPXLargeVolumeIncrement = 10; +const TInt KPercentMultiplier = 100; +_LIT(KWmaExtension, ".wma"); +_LIT(KRaExtension, ".ra"); + + +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXPlaybackEngine* CMPXPlaybackEngine::NewL( + CMPXPluginMonitor& aPluginMonitor, + MMPXPlaybackActiveEngineObserver& aObserver, + MMPXClientlistObserver* aClientListObserver, + const TUid& aModeId) + { + CMPXPlaybackEngine* p=new(ELeave)CMPXPlaybackEngine(aPluginMonitor, + aObserver, aModeId); + CleanupStack::PushL(p); + p->ConstructL(aClientListObserver); + CleanupStack::Pop(p); + return p; + } + + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXPlaybackEngine* CMPXPlaybackEngine::NewL( + CMPXPluginMonitor& aPluginMonitor, + MMPXPlaybackActiveEngineObserver& aObserver, + MMPXClientlistObserver* aClientListObserver, + const TUid& aModeId, + const TInt aCategory) + { + CMPXPlaybackEngine* p=new(ELeave)CMPXPlaybackEngine(aPluginMonitor, + aObserver, aModeId, aCategory); + CleanupStack::PushL(p); + p->ConstructL(aClientListObserver); + CleanupStack::Pop(p); + return p; + } + +// ---------------------------------------------------------------------------- +// Constructor. +// ---------------------------------------------------------------------------- +// +CMPXPlaybackEngine::CMPXPlaybackEngine( + CMPXPluginMonitor& aPluginMonitor, + MMPXPlaybackActiveEngineObserver& aObserver, + const TUid& aModeId) +: iReflector(*this), + iPluginMonitor(aPluginMonitor), + iItemId(KMPXInvalidItemId), + iPlaySource(EPlayNone), + iAccessPoint(0), + iAccessPointSet(EFalse), + iState(EPbStateNotInitialised), + iNextState(EPbStateNotInitialised), + iPluginState(EPbStateNotInitialised), + iModeId(aModeId), + iObserver(aObserver), + iPreservedState( EPbStateNotInitialised ), + iPreservedPosition( KErrNotFound ), + iSkipping(EFalse), + iPluginUid(KNullUid), + iLastActiveProcess(KNullProcessId), + iLastInactiveProcess(KNullProcessId) + { + iProperties[EPbPropertyVolumeRamp]=KPbFadeInDurationMicroSeconds; + } + +// ---------------------------------------------------------------------------- +// Constructor. +// ---------------------------------------------------------------------------- +// +CMPXPlaybackEngine::CMPXPlaybackEngine( + CMPXPluginMonitor& aPluginMonitor, + MMPXPlaybackActiveEngineObserver& aObserver, + const TUid& aModeId, + const TInt aCategory) +: iReflector(*this), + iPluginMonitor(aPluginMonitor), + iItemId(KMPXInvalidItemId), + iPlaySource(EPlayNone), + iAccessPoint(0), + iAccessPointSet(EFalse), + iState(EPbStateNotInitialised), + iNextState(EPbStateNotInitialised), + iPluginState(EPbStateNotInitialised), + iModeId(aModeId), + iObserver(aObserver), + iPreservedState( EPbStateNotInitialised ), + iPreservedPosition( KErrNotFound ), + iSkipping(EFalse), + iPluginUid(KNullUid), + iLastActiveProcess(KNullProcessId), + iLastInactiveProcess(KNullProcessId), + iCategory(aCategory) + { + iProperties[EPbPropertyVolumeRamp]=KPbFadeInDurationMicroSeconds; + } + + +// ---------------------------------------------------------------------------- +// 2nd phase constructor. +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::ConstructL(MMPXClientlistObserver* aClientListObserver) + { + MPX_FUNC_EX("CMPXPlaybackEngine::ConstructL"); + iClientList=CMPXClientList::NewL(aClientListObserver); + iPluginHandler=CMPXPlaybackPluginHandler::NewL(iPluginMonitor, *this, *this); + iCmdBuffer=CMPXPlaybackCmdBuffer::NewL(*this); + iProgressTimer=CHeartbeat::NewL(CActive::EPriorityStandard); + iSeekTimer=CPeriodic::NewL(CActive::EPriorityStandard); + iAccessoryObs=CMPXAccessoryObserver::NewL(*this); + iAutoResumeHandler = CMPXAutoResumeHandler::NewL(*this, EFalse); + iPlaybackSettings = CMPXPlaybackSettings::NewL(); + iTaskQueue = CMPXActiveTaskQueue::NewL(); + FeatureManager::InitializeLibL(); + +#if defined(__HIGH_RESOLUTION_VOLUME) + // Intialise volume level increment based on the accessory plugged in. + SetVolumeIncrement( iAccessoryObs->AccessoryModeL() ); +#else + iVolumeIncrement = KMPXLargeVolumeIncrement; +#endif + + iMediaHelper = CMPXPlaybackMediaHelper::NewL( *this ); + iDummyMediaObserver = new(ELeave) CMPXPlaybackDummyMediaObserver(); + // Select local plugin by default if none selected + iPluginHandler->SelectPlayersL( EPbLocal ); + iInitVolume = ETrue; +#if defined(__HIGH_RESOLUTION_VOLUME) + iVolRoundedUp = EFalse; +#endif + iPluginHandler->Plugin()->PropertyL( EPbPropertyVolume ); + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +EXPORT_C CMPXPlaybackEngine::~CMPXPlaybackEngine() + { + MPX_FUNC_EX("CMPXPlaybackEngine::~CMPXPlaybackEngine"); + if (iPluginHandler->Plugin()) + { + iPluginHandler->Plugin()->CancelRequest(); + } + + DoClose(); + + if (iTaskQueue) + { + delete iTaskQueue; + } + + if (iProgressTimer) + { + delete iProgressTimer; + } + + if (iSeekTimer) + { + delete iSeekTimer; + } + + FeatureManager::UnInitializeLib(); + iFile.Close(); + delete iCmdBuffer; + delete iAccessoryObs; + delete iAutoResumeHandler; + delete iPluginHandler; + delete iClientList; + delete iPlaybackSettings; + delete iInitializer; + iMediaAttrs.Close(); + delete iMediaHelper; + delete iDummyMediaObserver; +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + iFile64.Close(); +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + } + +// ---------------------------------------------------------------------------- +// Initialises from collection +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaybackEngine::InitL( + const CMPXCollectionPlaylist& aPlaylist, + TBool aPlay ) + { + MPX_FUNC_EX("CMPXPlaybackEngine::InitL"); + iPluginUid = KNullUid; // Reset plugin uid for current item + iInitNext = aPlaylist.PreInitPlugin(); + if ( iInitNext ) + { + if ( !iInitializer ) + { + iInitializer=CMPXPlaybackInitializer::NewL(*this, *iMediaHelper); + } + iInitializer->Close(); + } + + HandleCloseL(); + iPlaySource=EPlayFromCollection; + iPlaylist=CMPXCollectionPlaylist::NewL(aPlaylist, this); + CMPXCollectionPlaylist::TRepeatMode repeatmode = + static_cast( + iProperties[EPbPropertyRepeatMode]); + iPlaylist->SetRepeatMode(repeatmode); + // if current index is not 0, play the selected item, otherwise play any one + iPlaylist->SetShuffleL(iProperties[EPbPropertyRandomMode], + iPlaylist->Index()!=-1); + iSkipping = EFalse; + if ( aPlay ) + { + if ( iPlaylist->Count() > 0 ) + { + iNextState=EPbStateNotInitialised; + MediaFromCollectionL(); + } + } + else + { + if ( iPlaylist->Count() > 0 ) + { + iState = EPbStateStopped; + } + else + { + iState = EPbStateNotInitialised; + } + iAutoResumeHandler->HandlePlaybackStateChange(iState); + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EStateChanged,iState)); + iNextState = iState; + //update now playing view + iClientList->SendMsgL(TMPXPlaybackMessage( + TMPXPlaybackMessage::EPlaylistUpdated)); + iClientList->SendMsgL( + TMPXPlaybackMessage( + TMPXPlaybackMessage::EInitializeComplete, + 0, + EFalse)); + + iPluginUid = iPluginHandler->Plugin()->Uid(); + + RArray dummy; + CleanupClosePushL( dummy ); + dummy.AppendL( KMPXMediaGeneralUri ); // dummy attribute to get + iPlaylist->MediaL( dummy.Array(), *iDummyMediaObserver); + CleanupStack::PopAndDestroy( &dummy ); + } + } + +// ---------------------------------------------------------------------------- +// Initialises from URI +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaybackEngine::InitL(const TDesC& aUri,const TDesC8& aType) + { + MPX_FUNC_EX("CMPXPlaybackEngine::InitL(const TDesC& aUri,const TDesC8& aType)"); + MPX_DEBUG2("CMPXPlaybackEngine::InitL(%S)", &aUri); + iPluginUid = KNullUid; // Reset plugin uid for current item + iInitNext=EFalse; + HandleCloseL(); + iPlaySource=EPlayFromUri; + iNextState=EPbStateNotInitialised; + delete iUri; + iUri = NULL; + iUri=aUri.AllocL(); + iItemId = KMPXInvalidItemId; + TRAPD( err, InitL(&aUri,&aType,NULL) ); + if ( KErrNotFound == err || KErrPathNotFound == err ) + { + // Mark item as Invalid + MarkItemInvalid( ETrue ); + User::Leave( err ); + } + } + +// ---------------------------------------------------------------------------- +// Initialises from file. +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaybackEngine::InitL(const RFile& aFile) + { + MPX_FUNC_EX("CMPXPlaybackEngine::InitL(const RFile& aFile)"); + iPluginUid = KNullUid; // Reset plugin uid for current item + iInitNext=EFalse; + HandleCloseL(); + iPlaySource=EPlayFromFile; + iNextState=EPbStateNotInitialised; + iFile.Duplicate(aFile); + TRAPD( err, InitL(NULL,NULL,&iFile) ); + if ( KErrNotFound == err ) + { + // Mark item as Invalid + MarkItemInvalid( ETrue ); + User::Leave( err ); + } + } + +// ---------------------------------------------------------------------------- +// Initialises from URI +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaybackEngine::InitStreamingL(const TDesC& aUri, const TDesC8& aType, const TInt aAccessPoint) + { + MPX_FUNC_EX("CMPXPlaybackEngine::InitStreamingL(const TDesC& aUri, const TInt aAccessPoint)"); + MPX_DEBUG4("CMPXPlaybackEngine::InitStreamingL(%S), (%s), (%d)", &aUri, &aType, aAccessPoint); + iPluginUid = KNullUid; // Reset plugin uid for current item + iInitNext=EFalse; + HandleCloseL(); + iPlaySource=EPlayFromUri; + iNextState=EPbStateNotInitialised; + delete iUri; + iUri = NULL; + iUri=aUri.AllocL(); + iItemId = KMPXInvalidItemId; + iAccessPoint = aAccessPoint; + iAccessPointSet = ETrue; + TRAPD( err, InitL(&aUri,&aType,NULL,aAccessPoint) ); + if ( KErrNotFound == err || KErrPathNotFound == err ) + { + // Mark item as Invalid + MarkItemInvalid( ETrue ); + User::Leave( err ); + } + } + +// ---------------------------------------------------------------------------- +// Initialises from file. +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaybackEngine::InitStreamingL(const RFile& aFile, const TInt aAccessPoint) + { + MPX_FUNC_EX("CMPXPlaybackEngine::InitStreamingL(const RFile& aFile, const TInt aAccessPoint)"); + iPluginUid = KNullUid; // Reset plugin uid for current item + iInitNext=EFalse; + HandleCloseL(); + iPlaySource=EPlayFromFile; + iNextState=EPbStateNotInitialised; + iFile.Duplicate(aFile); + iAccessPoint = aAccessPoint; + iAccessPointSet = ETrue; + TRAPD( err, InitL(NULL,NULL,&iFile,aAccessPoint)); + if ( KErrNotFound == err ) + { + // Mark item as Invalid + MarkItemInvalid( ETrue ); + User::Leave( err ); + } + } + +// ---------------------------------------------------------------------------- +// Cancels all outsatnding calls (tasks): plug-in should only have one +// outstanding so that is canceled; the tasks are deleted and removed from the +// queue +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaybackEngine::CancelRequests() + { + MPX_FUNC_EX("CMPXPlaybackEngine::CancelRequests()"); + CMPXPlaybackPlugin* p(iPluginHandler->Plugin()); + if (iCallback && iTaskQueue->PtrData()) + { // there is outstanding request + p = static_cast(iTaskQueue->PtrData()); + } + if (p) + { + p->CancelRequest(); + if (iCallback) + { + iTaskQueue->CompleteTask(); + iCallback = NULL; + } + } + if (iPlaylist) + { + iPlaylist->CancelRequest(); + } + if (iInitializer) + { + iInitializer->Close(); + } + iTaskQueue->CancelRequests(); + iMediaHelper->CancelRequests(); + } + +// ---------------------------------------------------------------------------- +// Handle a command +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaybackEngine::CommandL(TMPXPlaybackCommand aCmd, + TInt aData) + { + MPX_DEBUG2("CMPXPlaybackEngine::CommandL(%d) entering", aCmd); + iClientList->SendMsgL(TMPXPlaybackMessage( + TMPXPlaybackMessage::ECommandReceived, + aCmd, + 0)); + if (iCmdBuffer->CommandForBuffering(aCmd)) + { + // Buffered commands are not valid if there are no items in playlist + TBool cmdOK( ETrue ); + if ( iPlaySource == EPlayFromCollection ) + { + if ( iPlaylist ) + { + cmdOK = ( iPlaylist->Count() > 0 ); + } + else + { + cmdOK = EFalse; + } + } + if ( cmdOK ) + { + iCmdBuffer->BufferCommandL(aCmd,iNextState, + iProperties[EPbPropertyPosition]); + } + } + else + { + HandleCommandL(aCmd,aData); + } + MPX_DEBUG1("CMPXPlaybackEngine::CommandL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Handle a command +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaybackEngine::CommandL( + CMPXCommand& aCmd, + const CMPXMessageQueue& aMsgQueue ) + { + MPX_FUNC_EX("CMPXPlaybackEngine::CommandL(CMPXCommand& aCmd)"); + ASSERT(aCmd.IsSupported(KMPXCommandGeneralId)); + TInt id = aCmd.ValueTObjectL(KMPXCommandGeneralId); + switch (id) + { + case KMPXCommandIdPlaybackGeneral: + { + ASSERT(aCmd.IsSupported(KMPXCommandPlaybackGeneralType)); + TMPXPlaybackCommand cmd = static_cast( + aCmd.ValueTObjectL(KMPXCommandPlaybackGeneralType)); + if ( EPbCmdPlay == cmd || + EPbCmdPlayPause == cmd || + EPbCmdStop == cmd) + { + ASSERT(aCmd.IsSupported(KMPXCommandPlaybackGeneralClientPid)); + iLastActiveProcess = aCmd.ValueTObjectL( + KMPXCommandPlaybackGeneralClientPid); + } + else if (EPbCmdStop == cmd) + { + ASSERT(aCmd.IsSupported(KMPXCommandPlaybackGeneralClientPid)); + iLastInactiveProcess = aCmd.ValueTObjectL( + KMPXCommandPlaybackGeneralClientPid); + } + TInt data(0); + if (aCmd.IsSupported(KMPXCommandPlaybackGeneralData)) + { + data = aCmd.ValueTObjectL(KMPXCommandPlaybackGeneralData); + } + MPX_DEBUG3("CMPXPlaybackEngine::CommandL general command (%d) data %d ", + cmd, data); + // Check if command is to be buffered, if not then handle command directly + TBool noBuffer( EFalse ); + if ( aCmd.IsSupported( KMPXCommandPlaybackGeneralNoBuffer )) + { + noBuffer = aCmd.ValueTObjectL( + KMPXCommandPlaybackGeneralNoBuffer ); + } + + if ( noBuffer ) + { + HandleCommandL( cmd, data ); + } + else + { + // Map to TMPXCommand command + CommandL(cmd, data); + } + break; + } + case KMPXCommandSubscriptionAdd: + { + TInt index( iClientList->Find( aMsgQueue )); + CMPXMediaArray* items( + aCmd.Value( KMPXCommandSubscriptionAddItems )); + User::LeaveIfNull(items); + CMPXSubscription* subscription( CMPXSubscription::NewL( *items )); + CleanupStack::PushL(subscription); + iClientList->AddSubscriptionL( index, subscription ); // ownership transferred + CleanupStack::Pop(subscription); + break; + } + case KMPXCommandSubscriptionRemove: + { + TInt index( iClientList->Find( aMsgQueue )); + CMPXMediaArray* items( + aCmd.Value( KMPXCommandSubscriptionAddItems )); + User::LeaveIfNull(items); + CMPXSubscription* subscription( CMPXSubscription::NewL( *items )); + CleanupStack::PushL(subscription); + iClientList->RemoveSubscriptionL( index, *subscription ); + CleanupStack::PopAndDestroy(subscription); + break; + } + case KMPXCommandSubscriptionRemoveAll: + { + TInt index( iClientList->Find( aMsgQueue )); + iClientList->RemoveAllSubscriptionsL( index ); + break; + } + + default: + { + // Custom command, so just send to plugin to handle + if ( iPluginHandler->Plugin() ) + { + iPluginHandler->Plugin()->CommandL( aCmd ); + } + } + } + } + +// ---------------------------------------------------------------------------- +// Set a property +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaybackEngine::SetL(TMPXPlaybackProperty aProperty, + TInt aValue) + { + MPX_DEBUG3("-->CMPXPlaybackEngine::SetL(%d, %d)", aProperty, aValue); + if ( aProperty < 0 || aProperty > EPbPropertyNum ) + { + MPX_DEBUG1("CMPXPlaybackEngine::SetL(): Invalid Argument"); + User::Leave( KErrArgument ); + } + switch(aProperty) + { + case EPbPropertyEmbeddedMode: + case EPbPropertyCrossFade: + if ( aProperty < iProperties.Count() ) + { + iProperties[aProperty]=aValue; + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EPropertyChanged, + aProperty, iProperties[aProperty])); + } + break; + case EPbPropertyVolume: + MPX_DEBUG2( "CMPXPlaybackEngine::SetL EPbPropertyVolume %d", aValue ); + if ( aValue >= KPbPlaybackVolumeLevelMin && + aValue <= KPbPlaybackVolumeLevelMax) + { + iProperties[EPbPropertyMute] = EFalse; + iProperties[aProperty] = aValue; + if ( iPluginHandler->Plugin() ) + { + PluginL()->SetL( aProperty, aValue ); + } +#if defined(__HIGH_RESOLUTION_VOLUME) + iVolRoundedUp = EFalse; +#endif + } + else + { + User::Leave(KErrArgument); + } + break; + case EPbPropertyMute: + MPX_DEBUG2( "CMPXPlaybackEngine::SetL EPbPropertyMute %d", aValue ); + if ( iPluginHandler->Plugin() ) + { + PluginL()->SetL( aProperty, aValue ); + } + break; + case EPbPropertyRandomMode: + { + MPX_DEBUG2( "CMPXPlaybackEngine::SetL EPbPropertyRandomMode %d", aValue ); + TBool randomMode = static_cast(aValue); + if( iProperties[EPbPropertyRandomMode] != randomMode ) + { + iProperties[EPbPropertyRandomMode] = randomMode; + if (iPlaySource==EPlayFromCollection && iPlaylist) + { + TRAP_IGNORE(iPlaylist->SetShuffleL(randomMode, ETrue)); + // Pre-initializer needs to re-copy the new shuffle list + // from the engine + if (iInitializer) + { + iInitializer->Close(); + } + } + TRAP_IGNORE(iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EPropertyChanged, + EPbPropertyRandomMode, + randomMode))); + } + break; + } + case EPbPropertyRepeatMode: + { + MPX_DEBUG2( "CMPXPlaybackEngine::SetL EPbPropertyRepeatMode %d", aValue ); + TMPXPlaybackRepeatMode repeat = static_cast(aValue); + if( iProperties[EPbPropertyRepeatMode] != repeat ) + { + iProperties[EPbPropertyRepeatMode] = repeat; + if (iPlaySource==EPlayFromCollection && iPlaylist) + { + CMPXCollectionPlaylist::TRepeatMode repeatmode = + static_cast( + repeat); + iPlaylist->SetRepeatMode(repeatmode); + if (iInitializer) + { + iInitializer->Close(); + } + } + TRAP_IGNORE(iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EPropertyChanged, + EPbPropertyRepeatMode, + repeat))); + } + break; + } + case EPbPropertyPosition: + { + CMPXPlaybackPlugin* pi = PluginL(); + if ( pi ) + { + MPX_DEBUG2( "CMPXPlaybackEngine::SetL setting position %d", aValue ); + iProperties[aProperty] = aValue; + pi->SetL(EPbPropertyPosition, aValue); + } + break; + } + default: + iProperties[aProperty]=aValue; + PluginL()->SetL(aProperty,aValue); + } + MPX_DEBUG3("<--CMPXPlaybackEngine::SetL(%d, %d)", aProperty, aValue); + } + +// ---------------------------------------------------------------------------- +// Property request +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaybackEngine::PropertyL(TMPXPlaybackProperty aProperty, + MMPXPlaybackEngineObserver& aCallback) + { + MPX_FUNC_EX("CMPXPlaybackEngine::PropertyL()"); + MPX_DEBUG4("CMPXPlaybackEngine::PropertyL 0x%08x cb 0x%08x, prop %d", + this, &aCallback, aProperty); + if (aProperty == EPbPropertyVolume) + { + aCallback.HandleProperty(aProperty, + iProperties[EPbPropertyVolume], + KErrNone); + } + else if (aProperty == EPbPropertyMaxVolume) + { + aCallback.HandleProperty(aProperty, + KPbPlaybackVolumeLevelMax, + KErrNone); + } + else if (aProperty == EPbPropertyRandomMode) + { + TInt random(0); + if ( iPlaylist ) + { + random = iPlaylist->Shuffle(); + } + else + { + random = iProperties[EPbPropertyRandomMode]; + } + aCallback.HandleProperty(aProperty, + random, + KErrNone); + } + else if (aProperty == EPbPropertyRepeatMode) + { + TInt repeat(0); + if ( iPlaylist ) + { + repeat = iPlaylist->RepeatMode(); + } + else + { + repeat = iProperties[EPbPropertyRepeatMode]; + } + aCallback.HandleProperty(aProperty, + repeat, + KErrNone); + } + else if (aProperty == EPbPropertyPosition && + EPbStateNotInitialised == iPluginState) + { + aCallback.HandleProperty(aProperty, + iProperties[EPbPropertyPosition], + KErrNone); + } + else + { + MPX_DEBUG1("CMPXPlaybackEngine::PropertyL add request to task queue"); + iTaskQueue->AddTaskL(EProperty, &aCallback, this, aProperty); + } + } + +// ---------------------------------------------------------------------------- +// Async call: must be added to task queue +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaybackEngine::MediaL( + MMPXPlaybackEngineObserver& aCallback, + CBufBase* /*aBuf*/) + { + MPX_DEBUG3("-->CMPXPlaybackEngine::MediaL() aBuf 0x%08x cb 0x%08x", this, &aCallback); + // DEPRECATED + MPX_ASSERT( 0 ); + MPX_DEBUG2("<--CMPXPlaybackEngine::MediaL() aBuf 0x%08x", this); + } + +// ---------------------------------------------------------------------------- +// Async call: must be added to task queue +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaybackEngine::MediaL( + MMPXPlaybackEngineObserver& aCallback, + const CMPXCommand& aCmd) + { + MPX_DEBUG3("-->CMPXPlaybackEngine::MediaL() aCmd 0x%08x cb 0x%08x", this, &aCallback); + CMPXCommand* cmd( CMPXCommand::NewL( aCmd ) ); + CleanupStack::PushL( cmd ); + TBool redirect = EFalse; + if (CMPXAttributeSpecs* specs = aCmd.Value( KMPXCommandMediaAttributeSpecs )) + { + if (specs->IsSupported(KMPXMediaGeneralExtMediaRedirect)) + { + redirect = ETrue; + MPX_DEBUG1("CMPXPlaybackEngine::MediaL - Redirect to Playback Plugin"); + } + } + + // If redirect is false, pass the cmd to mediahelper class + if ( iPlaySource == EPlayFromCollection && iPlaylist && !redirect) + { + // Onwership of cmd is passed to mediahelper class + iMediaHelper->MediaL( iPlaylist->Path(), cmd, &aCallback ); + } + else + { + // ownership of cmd is transfered + MediaFromPluginL( &aCallback, cmd ); + } + CleanupStack::Pop( cmd ); + MPX_DEBUG2("<--CMPXPlaybackEngine::MediaL() aCmd 0x%08x", this); + } + +// ---------------------------------------------------------------------------- +// Async call: must be added to task queue +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaybackEngine::SubPlayerNamesL(TUid aPlayerUid, + MMPXPlaybackEngineObserver& aCallback) + { + MPX_FUNC_EX("CMPXPlaybackEngine::SubPlayerNamesL()"); + CMPXPlaybackPlugin* p = iPluginHandler->CreatePlayerPluginL(aPlayerUid); + iTaskQueue->AddTaskL(ESubPlayerNames,&aCallback, this, aPlayerUid.iUid, NULL, p); + } + +// ---------------------------------------------------------------------------- +// Async call: must be added to task queue +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::MediaFromPluginL( + MMPXPlaybackEngineObserver* aCallback, + CMPXCommand* aCmd ) + { + MPX_FUNC_EX("CMPXPlaybackEngine::MediaFromPluginL"); + CleanupStack::PushL( aCmd ); + iTaskQueue->AddTaskL( EMedia, aCallback, this, 0, NULL, NULL, aCmd ); + CleanupStack::Pop( aCmd ); // Ownership transferred to the task queue + } + +// ---------------------------------------------------------------------------- +// Handles a regular heartbeat timer event +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::Beat() + { + + // retrieve position from plugins directly + if (iState != EPbStatePlaying) + { + iProgressTimer->Cancel(); + } + else + { + TRAP_IGNORE(iTaskQueue->AddTaskL(EProperty, &iReflector, + this, EPbPropertyPosition)); + } + + } + +// ---------------------------------------------------------------------------- +// Synchronises the heartbeat timer with system clock +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::Synchronize() + { + MPX_FUNC_EX("CMPXPlaybackEngine::Synchronize"); + MPX_DEBUG2("CMPXPlaybackEngine::Synchronize(): iState = %d", iState); + + // do the same thing as Beat + Beat(); + } + +// ---------------------------------------------------------------------------- +// Handle accessory event +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandleAccesoryEventL(TMPXPlaybackAccessoryMode aMode) + { + MPX_DEBUG2("CMPXPlaybackEngine::HandleAccesoryEventL(%d) entering", aMode); + iClientList->SendMsgL( + TMPXPlaybackMessage( TMPXPlaybackMessage::EAccessoryChanged, + aMode, + 0)); + +#if defined(__HIGH_RESOLUTION_VOLUME) + SetVolumeIncrement( aMode ); +#endif // HIGH_RESOLUTION_VOLUME + + MPX_DEBUG1("CMPXPlaybackEngine::HandleAccesoryEventL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Callback from plug-in, handle plugin event +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandlePluginEvent( + TEvent aEvent, + TInt aData, + TInt aError) + { + TRAP_IGNORE(DoHandlePluginEventL(aEvent, aData, aError)); + } + +// ---------------------------------------------------------------------------- +// Callback from plug-in, handle plugin message +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandlePlaybackMessage( + CMPXMessage* aMsg, + TInt aErr) + { + iClientList->SendMsg(aMsg, aErr); + } + +// ---------------------------------------------------------------------------- +// Handler plugin event +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::DoHandlePluginEventL( + TEvent aEvent, + TInt aData, + TInt aError) + { + MPX_DEBUG5("-->CMPXPlaybackEngine::DoHandlePluginEventL 0x%08x, event %d, data %d, error %d.", + this, aEvent, aData, aError); + + TInt disconnectionError = aError; + if ( aEvent == EPPlayerUnavailable ) + { + aError = KErrNone; + } + + if (aError!=KErrNone) + { + // If error occured during pause event, change to pause but also + // send error code to clients to handle + if ( aEvent == EPPaused ) + { + MPX_DEBUG2("CMPXPlaybackEngine::DoHandlePluginEventL(): Pause Error = %d", aError); + + if ( aError != KErrNotSupported ) + { + // If error during seeking event, keep seeking and set + // plugin state to not intialised + if ( iState == EPbStateSeekingForward || + iState == EPbStateSeekingBackward ) + { + iPluginState = EPbStateNotInitialised; + } + else + { + iState = EPbStatePaused; + iNextState = EPbStatePaused; + SetPlayerActivated(EFalse); + iClientList->SendMsgL( + TMPXPlaybackMessage( + TMPXPlaybackMessage::EStateChanged, iState, aError )); + if ( KErrDied == aError || + KErrAccessDenied == aError ) + { + iPluginState = EPbStateNotInitialised; + // fixed + iAutoResumeHandler->HandlePlaybackComplete(aError); + iAutoResumeHandler->HandlePlaybackStateChange(iState); + + } + } + } + else // Pause functionality is not supported, no change of state + // we just send the error back to Ui to let the user know + { + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EStateChanged, aEvent, aError)); + + TMPXPlaybackState s = EPbStatePlaying; + iNextState = EPbStatePlaying; + + // Set state first before activation, since activation + // will send a state changed update event as well + SetStateL(s); + } + } + else if ( aEvent != EPSetComplete ) //Not paused and not EPSetComplete + { // sometimes upnp failed to set value. + MPX_DEBUG4("CMPXPlaybackEngine::DoHandlePluginEventL error aError %d, iState %d, iNextState %d", + aError, iState, iNextState ); + SavePlaybackInfoL(); + HandlePluginEventErrorHandling(aEvent, aError); + iState = EPbStateStopped; + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EStateChanged,iState)); + if (aError) + { + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EError,aEvent,aError)); + } + } + else // SetComplete + { + if ( aError == KErrNotSupported && + aData == EPbPropertyVolume ) + { + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EPropertyChanged, + aData, aError)); + } + } + } + else // No errors + { + MPX_DEBUG4("CMPXPlaybackEngine::DoHandlePluginEventL, iState %d, iNextState %d, iSkipping %d", + iState, iNextState, iSkipping ); + + switch(aEvent) + { + case EPInitialised: + case EPClosed: + case EPPaused: + case EPPlaying: + case EPStopped: + case EPDownloadPositionChanged: + case EPDownloadStateChanged: + case EPDownloadCmdPauseDownload: + case EPDownloadCmdResumeDownload: + case EPDownloadCmdCancelDownload: + case EPDownloadStarted: + case EPDownloadingUpdated: + case EPDownloadingComplete: + case EPBufferingStarted: + case EPPlayComplete: + case EPPluginSeeking: + { + UpdateStateMachineL(aEvent, aData, aError); + break; + } + case EPActive: + { + MPX_DEBUG1("CMPXPlaybackEngine::HandlePluginEventL active message."); + SetPlayerActivated(aData); + break; + } + case EPSubPlayersChanged: + { + MPX_DEBUG1("CMPXPlaybackEngine::HandlePluginEventL subplayer changed."); + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::ESubPlayersChanged)); + break; + } + case EPSupportedFeaturesChanged: + { + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EPropertyChanged, + EPbPropertySupportedFeatures, aData)); + break; + } + case EPSetComplete: + { + if ( aData < iProperties.Count() ) + { + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EPropertyChanged, + aData, iProperties[aData])); + } + break; + } + case EPDurationChanged: + { + iProperties[EPbPropertyDuration]=aData; + SetPropertiesL(); + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EPropertyChanged, + EPbPropertyDuration, + iProperties[EPbPropertyDuration])); + break; + } + case EPPlayerUnavailable: + { + if (iInitializer) + { + iInitializer->Close(); + } + SavePlaybackInfoL(); + iPreservedState = iState; + iPreservedPosition = iProperties[EPbPropertyPosition]; + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EPlayerUnavailable, + 0, disconnectionError)); + break; + } + case EPVolumeChanged: + { + iProperties[EPbPropertyVolume] = aData; + if (iInitVolume) + { + iInitVolume = EFalse; + } + else + { + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EPropertyChanged, + EPbPropertyVolume, + iProperties[EPbPropertyVolume])); + } + break; + } + case EPMuteChanged: + { + if ( iProperties[EPbPropertyMute] != aData ) + { + iProperties[EPbPropertyMute] = aData; + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EPropertyChanged, + EPbPropertyMute, + iProperties[EPbPropertyMute])); + } + break; + } + case EPPositionChanged: + { + iProperties[EPbPropertyPosition] = aData; + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EPropertyChanged, + EPbPropertyPosition, + iProperties[EPbPropertyPosition])); + break; + } + case EPDownloadFileMoved: + { + CMPXMessage* msg = CMPXMessage::NewL(); + CleanupStack::PushL(msg); + TMPXMessageId id=static_cast(KMPXMessageGeneral); + HBufC* path = reinterpret_cast(aData); + msg->SetTObjectValueL(KMPXMessageGeneralId, id); + msg->SetTObjectValueL(KMPXMessageGeneralEvent, TMPXPlaybackMessage::EDownloadFileMoved); + msg->SetTObjectValueL(KMPXMessageGeneralType, 0); + msg->SetTObjectValueL(KMPXMessageGeneralData, 0); + msg->SetTextValueL( KMPXMediaGeneralUri, *path ); + iClientList->SendMsg(msg, KErrNone); + CleanupStack::PopAndDestroy( msg ); + break; + } + default: + ASSERT(0); + } + } + MPX_DEBUG2("<--CMPXPlaybackEngine::DoHandlePluginEventL() 0x%08x", this); + } + +// ---------------------------------------------------------------------------- +// Update State Machine +// Handle plugin events that could cause state change in playback-engine +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::UpdateStateMachineL( + TEvent aEvent, + TInt aData, + TInt aError) + { + MPX_DEBUG4("CMPXPlaybackEngine::UpdateStateMachine, iState %d, iNextState %d, iSkipping %d", + iState, iNextState, iSkipping ); + + TMPXPlaybackState s=iState; + + switch(aEvent) + { + case EPInitialised: + { + HandlePluginEventInitialisedL( s, aData ); + break; + } + case EPPlaying: + { + s = EPbStatePlaying; + iNextState = EPbStatePlaying; + MPX_DEBUG1("CMPXPlaybackEngine::HandlePluginEventL playing."); + + // Set state first before activation, since activation + // will send a state changed update event as well + SetStateL(s); + SetPlayerActivated(ETrue); + iPluginState = EPbStatePlaying; + break; + } + case EPClosed: + { + MPX_DEBUG1("CMPXPlaybackEngine::HandlePluginEventL closed."); + MPX_DEBUG2("CMPXPlaybackEngine::HandlePluginEventL: iState = %d", iState); + + iPluginState = EPbStateNotInitialised; + + // Do not set state changed event when initialising + if ( iState != EPbStateInitialising && EPbCmdClose == aData) + { + s=EPbStateNotInitialised; + + // Set state first before deactivation, since deactivation + // will send a state changed update event as well + SetStateL(s); + SetPlayerActivated(EFalse); + } // else close when stop + break; + } + case EPPaused: + { + if (iState != EPbStateSeekingForward && + iState != EPbStateSeekingBackward && + iState != EPbStatePaused && + !iSkipping) + { + s=EPbStatePaused; + + if (EPbStatePlaying == iNextState) + { // only change state from playing to pause + iNextState = EPbStatePaused; + } + + MPX_DEBUG1("CMPXPlaybackEngine::HandlePluginEventL paused."); + + // Set state first before deactivation, since deactivation + // will send a state changed update event as well + SetStateL(s); + SetPlayerActivated(EFalse); + } + + iPluginState = EPbStatePaused; + break; + } + case EPActive: + { + MPX_DEBUG1("CMPXPlaybackEngine::HandlePluginEventL active message."); + SetPlayerActivated(aData); + break; + } + case EPStopped: + { + MPX_DEBUG1("CMPXPlaybackEngine::HandlePluginEventL stopped."); + + s = EPbStateStopped; + SetStateL(s); + TBool handleStop(EFalse); + + if (iState != EPbStateSeekingForward && + iState != EPbStateSeekingBackward && + !iSkipping && + iNextState != EPbStatePlaying) + { + handleStop = ETrue; + } + else if (iProgressTimer->IsActive()) + { // stop from remote player + Suspend(); + iNextState = EPbStateStopped; + handleStop = ETrue; + } // else stop for seeking + if (handleStop) + { + SetPlayerActivated( EFalse ); + s=EPbStateStopped; + if ( iProperties[EPbPropertyPosition] != 0 ) + { + iProperties[EPbPropertyPosition]=0; + iClientList->SendMsgL( + TMPXPlaybackMessage( + TMPXPlaybackMessage::EPropertyChanged, + EPbPropertyPosition, + 0 )); + } + } + break; + } + case EPPlayComplete: + { + EndSeek(); + SavePlaybackCompleteInfoL(); + iAutoResumeHandler->HandlePlaybackComplete(aError); + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EPropertyChanged, + EPbPropertyPosition, + iProperties[EPbPropertyDuration])); + iTaskQueue->AddTaskL(EHandleNext, NULL, this, 0); + s=EPbStateStopped; //State Changed indication Stopped will be sent + break; + } + case EPDownloadPositionChanged: + { + if ( EPbStateInitialising == s ) + { + s=EPbStateBuffering; + } + iClientList->SendMsgL( + TMPXPlaybackMessage( TMPXPlaybackMessage::EDownloadPositionChanged, + 0, + aData )); + break; + } + case EPDownloadStateChanged: + { + iClientList->SendMsgL( + TMPXPlaybackMessage( TMPXPlaybackMessage::EDownloadStateChanged, + 0, + aData )); + break; + } + case EPDownloadCmdPauseDownload: + { + iClientList->SendMsgL( + TMPXPlaybackMessage( TMPXPlaybackMessage::EDownloadCmdPauseDownload, + 0, + aData )); + break; + } + case EPDownloadCmdResumeDownload: + { + iClientList->SendMsgL( + TMPXPlaybackMessage( TMPXPlaybackMessage::EDownloadCmdResumeDownload, + 0, + aData )); + break; + } + case EPDownloadCmdCancelDownload: + { + iClientList->SendMsgL( + TMPXPlaybackMessage( TMPXPlaybackMessage::EDownloadCmdCancelDownload, + 0, + aData )); + break; + } + case EPDownloadStarted: + { + iClientList->SendMsgL( + TMPXPlaybackMessage( TMPXPlaybackMessage::EDownloadStarted, + 0, + aData)); + break; + } + case EPDownloadingUpdated: + { + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EDownloadUpdated, + 0,aData)); + s=EPbStateDownloading; + break; + } + // end comment this later + case EPDownloadingComplete: + { + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EDownloadComplete, + 0,aData)); + s=EPbStateStopped; + + if ( iProperties[EPbPropertyPosition] != 0 ) + { + iProperties[EPbPropertyPosition]=0; + iClientList->SendMsgL( + TMPXPlaybackMessage( + TMPXPlaybackMessage::EPropertyChanged, + EPbPropertyPosition, + 0 )); + } + break; + } + case EPBufferingStarted: + { + s = EPbStateBuffering; + iPluginState = EPbStatePlaying; //ToDo: Do we need pluginstate?!?!? + break; + } + case EPPluginSeeking: + { + // suspend playback timer + Suspend(); + // Change to plugin seeking state + iNextState = iState; + s = EPbStatePluginSeeking; + MPX_DEBUG1("CMPXPlaybackEngine::HandlePluginEventL EPbStatePluginSeeking."); + + // Set state first before activation, since activation + // will send a state changed update event as well + SetStateL(s); + iPluginState = EPbStatePluginSeeking; + break; + } + } + SetStateL(s); //Check if state changed and notify clients. + } + +// ---------------------------------------------------------------------------- +// Handle Plugin Event : Initialised +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandlePluginEventInitialisedL(TMPXPlaybackState& s, TInt aData) + { +#if defined(__HIGH_RESOLUTION_VOLUME) +// Merlin twentysteps hack start + if ( iUri ) + { + TParsePtrC parser(*iUri); + + MPX_DEBUG2("CMPXPlaybackEngine::DoHandlePluginEventL(): iUri is %S", iUri); + if (parser.Ext().CompareF(KWmaExtension) == 0 || parser.Ext().CompareF(KRaExtension) == 0) + { + // for wma/ra file, increment is always 10 with or without headset + iVolumeIncrement = KMPXLargeVolumeIncrement; + MPX_DEBUG2("CMPXPlaybackEngine::DoHandlePluginEventL it is a wma/ra file, volumeIncrement: %d !!!!", iVolumeIncrement); + } + } +#ifdef __ACCESSORY_FW + else if (iAccessoryObs->AccessoryModeL() == EPbAccessoryWiredHeadset || iAccessoryObs->AccessoryModeL() == EPbAccessoryHeadphones) +#else + else if (iAccessoryObs->AccessoryModeL() == EPbAccessoryHeadset) +#endif // __ACCESSORY_FW + { + // for non wma files with headset, the volume increment is 5 + iVolumeIncrement = KMPXSmallVolumeIncrement; + } +#endif // HIGH_RESOLUTION_VOLUME +// twentysteps end + + iPluginState = EPbStateStopped; + // Reset corrupted and invalid flags if no error + // Only set if they were not set before, this is because + // calls to SetL() on collection are costly + MPX_DEBUG2("CMPXPlaybackEngine::DoHandlePluginEventL() iDbFlag %x", iDbFlag); + if ( iDbFlag & KMPXMediaGeneralFlagsIsCorrupted || + iDbFlag & KMPXMediaGeneralFlagsIsInvalid || + iDbFlag & KMPXMediaGeneralFlagsIsDrmLicenceInvalid ) + { + TRAP_IGNORE( + SetFlagBitsL( EFalse, + KMPXMediaGeneralFlagsIsCorrupted | + KMPXMediaGeneralFlagsIsInvalid | + KMPXMediaGeneralFlagsIsDrmLicenceInvalid )); + } + + iClientList->SendMsgL(TMPXPlaybackMessage( + TMPXPlaybackMessage::EMediaChanged)); + + iProperties[EPbPropertyDuration]=aData; //Note, radio has no duration! + SetPropertiesL(); + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EPropertyChanged, + EPbPropertyDuration, + iProperties[EPbPropertyDuration])); + + //Assumption: we take duration==0 to mean "live streaming" + // Check if position is not past the duration + if ( iProperties[EPbPropertyPosition] >= iProperties[EPbPropertyDuration] ) + { + iProperties[EPbPropertyPosition] = 0; + } + + // Set position to restore saved position. + TRAP_IGNORE( // uPnP leaves if set position in stop state + PluginL()->SetL( EPbPropertyPosition, iProperties[EPbPropertyPosition] )); + + iAutoResumeHandler->HandleOpenFileComplete(); + + // Check if playback should not be started automatically. + if ( iAccessPoint || ( iPlaylist && (!iPlaylist->AutoPlay()) ) ) + { + iNextState = EPbStateNotInitialised; + } + + TMPXPlaybackState nextState(iNextState); // save next state + switch (iNextState) //What the next state could be (command may have been sent). + { + case EPbStateNotInitialised: + { // Notify client initialized complete + MPX_DEBUG1("CMPXPlaybackEngine sends msg EInitializeComplete"); + iClientList->SendMsgL( + TMPXPlaybackMessage( + TMPXPlaybackMessage::EInitializeComplete, + 0, + ETrue)); + s = EPbStateInitialised; //This will cause a StateChanged message to be sent + break; + } + case EPbStateStopped: + { // Play to the end of playlist + PluginL()->CommandL(EPbCmdStop); + if (iInitializer) + { // close file in the initializer + iInitializer->Close(); + } + s = EPbStateStopped; + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EPropertyChanged, + EPbPropertyPosition, + iProperties[EPbPropertyPosition])); + break; + } + default: + { + iState = EPbStateStopped; + HandleCommandL(CommandFromState( iNextState )); + s = iState; // change to new state due to handle command + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EPropertyChanged, + EPbPropertyPosition, + iProperties[EPbPropertyPosition])); + break; + } + } + + if (iInitNext && EPbStateStopped != nextState) + { + // + // Try pre-initialsing the next song, just in case we get there + // + TBool more = iInitializer->Next(); + if (!more && iPlaylist->Shuffle()) + { // Reach to the end and shuffle is on, pre-initializer + // needs to re-copy the new shuffle list from engine + if (iInitializer) + { + iInitializer->Close(); + } + } + } + } + +// ---------------------------------------------------------------------------- +// Error handling for Handler plugin event +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandlePluginEventErrorHandling(TEvent aEvent, TInt aError) + { + switch (aError) + { + case KErrGeneral: + { + // Track initialization failed + if ( ( aEvent == EPInitialised ) || + ( aEvent == EPPlaying ) ) + { + aError = KErrNotSupported; + // Mark item as corrupted + + // fall through on purpose + } + else + { + break; + } + } + case KErrArgument: + case KErrNotSupported: + case KErrCorrupt: + case KErrDivideByZero: + { + // Release file handles + TRAP_IGNORE(DoStopL()); + // Mark item as corrupted + MarkItemCorrupted( ETrue ); + + // Reset DRM and invalid flags if they are set + MPX_DEBUG2("CMPXPlaybackEngine::DoHandlePluginEventL() iDbFlag %x", iDbFlag); + if ( iDbFlag & KMPXMediaGeneralFlagsIsInvalid || + iDbFlag & KMPXMediaGeneralFlagsIsDrmLicenceInvalid ) + { + TRAP_IGNORE( + SetFlagBitsL( EFalse, + KMPXMediaGeneralFlagsIsInvalid | + KMPXMediaGeneralFlagsIsDrmLicenceInvalid )); + } + + break; + } + case KErrNotFound: + { + // Mark item as invalid + MarkItemInvalid( ETrue ); + + // Reset DRM and corrupted flags if they are set + MPX_DEBUG2("CMPXPlaybackEngine::DoHandlePluginEventL() iDbFlag %x", iDbFlag); + if ( iDbFlag & KMPXMediaGeneralFlagsIsCorrupted || + iDbFlag & KMPXMediaGeneralFlagsIsDrmLicenceInvalid ) + { + TRAP_IGNORE( + SetFlagBitsL( EFalse, + KMPXMediaGeneralFlagsIsCorrupted | + KMPXMediaGeneralFlagsIsDrmLicenceInvalid )); + } + + break; + } + case KErrCANotSupported: + case KErrCANoPermission: + case KErrCANoRights: + case KErrCANoAgent: + case KErrCAOutOfRange: + case KErrCAPendingRights: + case KErrCASizeNotDetermined: + case KErrCANewFileHandleRequired: + { + // Release file handles + TRAP_IGNORE(DoStopL()); + // Mark item as DRM Invalid + MarkItemDrmInvalid( ETrue ); + + // Reset corrupted and invalid flags if they are set + MPX_DEBUG2("CMPXPlaybackEngine::DoHandlePluginEventL() iDbFlag %x", iDbFlag); + if ( iDbFlag & KMPXMediaGeneralFlagsIsCorrupted || + iDbFlag & KMPXMediaGeneralFlagsIsInvalid ) + { + TRAP_IGNORE( + SetFlagBitsL( EFalse, + KMPXMediaGeneralFlagsIsCorrupted | + KMPXMediaGeneralFlagsIsInvalid )); + } + + + break; + } + case KErrDied: + { + // Release file handles + TRAP_IGNORE(DoStopL()); + iNextState = EPbStateNotInitialised; + break; + } + default: + // otherwise send error message to clients + break; + } + } + +// ---------------------------------------------------------------------------- +// Callback from plug-in. Retrieve the task that resulted in this (which +// removes it from the queue), get the observer and call back with the results. +// Then the player is free to execute the next task, if any +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandleProperty( + TMPXPlaybackProperty aProperty, + TInt aValue, + TInt aError) + { + MPX_DEBUG5("-->CMPXPlaybackEngine::HandleProperty 0x%08x prop %d val %d err %d", + this, aProperty, aValue, aError); + if ( iInitVolume && EPbPropertyVolume == aProperty ) + { + if (KErrNone == aError) + { + iProperties[EPbPropertyVolume] = aValue; + iInitVolume = EFalse; + } + } + else + { + ASSERT(iTaskQueue->Task() == EProperty && iTaskQueue->Callback() == iCallback); + iCallback->HandleProperty(aProperty,aValue,aError); + iCallback = NULL; + iTaskQueue->CompleteTask(); + + // notify client the new position during the playback + if ((EPbPropertyPosition == aProperty) && (iProgressTimer->IsActive())) + { + TRAP_IGNORE(iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EPropertyChanged, + EPbPropertyPosition,aValue))); + } + } + MPX_DEBUG2("<--CMPXPlaybackEngine::HandleProperty 0x%08x", this); + } + +// ---------------------------------------------------------------------------- +// Callback from plug-in. Retrieve the task that resulted in this (which +// removes it from the queue), get the observer and call back with the results. +// Then the player is free to execute the next task, if any +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandleMedia( + CMPXMedia* aMedia, + TInt aError) + { + ASSERT(iTaskQueue->Task() == EMedia && iTaskQueue->Callback() == iCallback); + MPX_FUNC_EX("CMPXPlaybackEngine::HandleMedia()"); + iCallback->HandleMedia(aMedia, aError); + iCallback = NULL; + iTaskQueue->CompleteTask(); + } + +// ---------------------------------------------------------------------------- +// Callback from plug-in. Retrieve the task that resulted in this (which +// removes it from the queue), get the observer and call back with the results. +// Then the player is free to execute the next task, if any +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandleSubPlayerNames( + TUid /*aPlayer*/, + const MDesCArray* aSubPlayers, + TBool aComplete, + TInt aError) + { + ASSERT(iTaskQueue->Task() == ESubPlayerNames && + iTaskQueue->Callback() == iCallback); + MPX_DEBUG4("-->CMPXPlaybackEngine::HandleSubPlayerNames 0x%08x, complete %d, err %d", + this, aComplete, aError); + iCallback->HandleSubPlayerNames(TUid::Uid(0), aSubPlayers, + aComplete, aError); + iCallback = NULL; + iTaskQueue->CompleteTask(); + MPX_DEBUG2("<--CMPXPlaybackEngine::HandleSubPlayerNames 0x%08x", this); + } + +// ---------------------------------------------------------------------------- +// Handle media key event +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandleCmdBufferEventL(const TMPXPlaybackCmdInfo& aEvent) + { + MPX_DEBUG1("CMPXPlaybackEngine::HandleCmdBufferEventL() entering"); + + MPX_DEBUG4("CMPXPlaybackEngine::HandleCmdBufferEventL(): offset=%d, state=%d, navKeyBuffered=%d", aEvent.iTrackOffset, iNextState, aEvent.iNavKeyBuffered); + + // Fix for EJPI-7BHUGX, if the aEvent.iNavKeyBuffered == 1 and aEvent.iTrackOffset == 0 + // That means skip back key press once only, it should not request for media but set pos only + if ( aEvent.iNavKeyBuffered > 1 || aEvent.iTrackOffset != 0 ) + { + iNextState = aEvent.iState; + if ( EPlayFromCollection == iPlaySource && iPlaylist ) + { + MediaFromCollectionL(); + } + else if ( EPlayFromUri == iPlaySource ) + { + TRAP_IGNORE( InitL( iUri, &( KNullDesC8 ), NULL, iAccessPoint ) ); + } + } + else + { + // If position has changed, set the position in plugin. + // Also the current position should be after the original position + if ( Abs(aEvent.iPos - iProperties[EPbPropertyPosition]) > + KPbPositionChangeThreshold && + aEvent.iPos < iProperties[EPbPropertyPosition] ) + { + MPX_DEBUG1("CMPXPlaybackEngine::HandleCmdBufferEventL(): position changed"); + iProperties[EPbPropertyPosition]=aEvent.iPos; + if ( PluginL() ) + { + if (iState == EPbStatePlaying) + { + // Need to send pause command to plugin first so that it will + // not keep playing the rest of it's buffer + MPX_DEBUG1("CMPXPlaybackEngine::HandleCmdBufferEventL() send pause command"); + PluginL()->CommandL(EPbCmdPause); + } + PluginL()->SetL(EPbPropertyPosition, + iProperties[EPbPropertyPosition]); + } + } + + HandleCommandL(CommandFromState( aEvent.iState )); + } + iCmdBuffer->CompleteCommand(); + + MPX_DEBUG1("CMPXPlaybackEngine::HandleCmdBufferEventL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Handle command skip event from key buffering +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandleCmdBufferSkipEventL( + const TMPXPlaybackSkipEvent aSkipEvent ) + { + MPX_DEBUG2("==>CMPXPlaybackEngine::HandleCmdBufferSkipEventL(%d) entering", aSkipEvent); + + if ( EPbsSkipEventNext == aSkipEvent ) + { + iClientList->SendMsgL( + TMPXPlaybackMessage( TMPXPlaybackMessage::ESkipping, 0, 1 )); + + TBool wasSkipping( iSkipping ); + iSkipping = ETrue; + if ( !wasSkipping ) + { + if ( iState == EPbStatePlaying ) + { + Suspend(); + TRAP_IGNORE(PluginL()->CommandL(EPbCmdPause)); + TRAP_IGNORE(SavePlaybackInfoL()); + } + else if ( iState == EPbStatePaused ) + { + TRAP_IGNORE(SavePlaybackInfoL()); + } + } + if ( EPlayFromCollection == iPlaySource && iPlaylist ) + { + if ( iPlaylist->Count() > 0 ) + { + // Stop if playing or paused + if ( !iPlaylist->Next( ETrue ) ) + { + if ( EPbStatePlaying == iNextState || + EPbStatePaused == iNextState ) + { + iCmdBuffer->BufferCommandL( + EPbCmdStop, + iNextState, + iProperties[EPbPropertyPosition]); + } + + // End of playlist, send message to clients. + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage:: + EReachedEndOfPlaylist)); + } + RequestMediaL(); + } + } + } + else if ( EPbsSkipEventPrevious == aSkipEvent ) + { + TBool wasSkipping( iSkipping ); + iSkipping = ETrue; + if ( !wasSkipping && iState == EPbStatePlaying) + { + TRAP_IGNORE(DoStopL()); + PluginL()->CommandL( EPbCmdPause ); + } + + // If first track in list and repeat is off, it will replay current track, + // so do not skip + TBool sendSkip( ETrue ); + if ( iPlaylist ) + { + if ( 0 != iPlaylist->Index() || + CMPXCollectionPlaylist::ERepeatOff != iPlaylist->RepeatMode() ) + { + sendSkip = ETrue; + } + else + { + sendSkip = EFalse; + } + } + if ( sendSkip && EPlayFromCollection == iPlaySource && iPlaylist ) + { + iClientList->SendMsgL( + TMPXPlaybackMessage( TMPXPlaybackMessage::ESkipping, 0, -1 )); + + if (iPlaylist->Count()>0) + { + iPlaylist->Previous( ETrue ); + RequestMediaL(); + } + } + } + else + { + iSkipping = EFalse; + iClientList->SendMsgL( + TMPXPlaybackMessage( TMPXPlaybackMessage::ESkipEnd )); + } + + MPX_DEBUG1("<==CMPXPlaybackEngine::HandleCmdBufferSkipEventL()"); + } + + +// ---------------------------------------------------------------------------- +// Suspend playback +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::Suspend() +// +// Should stop in current position, i.e. clearing timers etc. +// + { + MPX_FUNC_EX("CMPXPlaybackEngine::Suspend()"); + iProgressTimer->Cancel(); + EndSeek(); + iAutoResumeHandler->CancelResumeTimer(); + } + +// ---------------------------------------------------------------------------- +// Seek timer callback handler +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::SeekTimerTick() + { + TInt& pos=iProperties[EPbPropertyPosition]; + pos+=iSeekStep; + if (pos>iProperties[EPbPropertyDuration]) + { + pos=iProperties[EPbPropertyDuration]; + iSeekTimer->Cancel(); + } + if (pos<0) + { + pos=0; + iSeekTimer->Cancel(); + } + + iSeekStep*=KPbSeekAccelerationFactor; + if (iSeekStep>iMaxSeekStep) + { + iSeekStep=iMaxSeekStep; + } + else if (iSeekStep<-iMaxSeekStep) + { + iSeekStep=-iMaxSeekStep; + } + TRAP_IGNORE(iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EPropertyChanged, + EPbPropertyPosition, + pos))); + } + +// ---------------------------------------------------------------------------- +// Seek timer callback +// ---------------------------------------------------------------------------- +// +TInt CMPXPlaybackEngine::SeekTimerCallback(TAny* aPtr) + { + static_cast(aPtr)->SeekTimerTick(); + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// Initialise helper method +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::InitL(const TDesC* aSong, + const TDesC8* aType, + RFile* aFile, + TInt aAccessPoint) + { + MPX_DEBUG1("==>CMPXPlaybackEngine::InitL(const TDesC* aSong, const TDesC8* aType, RFile* aFile,TInt aAccessPoint)"); + CMPXPlaybackPlugin* p( NULL ); + if ( iPluginHandler->Plugin() ) + { + TRAP_IGNORE(iPluginHandler->Plugin()->CommandL(EPbCmdClose)); + } + + if (aSong && aType) + { + MPX_DEBUG2("CMPXPlaybackEngine::InitL(%S)", aSong); + iPluginHandler->SelectPlayerL(*aSong,*aType); + } + else if (aFile) + { + iPluginHandler->SelectPlayerL(*aFile); + } + else + { // should never happen + ASSERT(0); + } + + p=iPluginHandler->Plugin(); + CheckPtrL(p); + + if (p->Uid()!=iPluginUid) + { // new plugin or new playlist + iPluginUid = p->Uid(); + iInitVolume = ETrue; + p->PropertyL( EPbPropertyVolume ); + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EPlayerChanged)); + } + // Stop and close opened file + TRAP_IGNORE(DoStopL(EFalse)); + TRAP_IGNORE(p->CommandL(EPbCmdClose)); + + // If playing from a playlist, send the index as a data + // parameter. This helps performance as the client + // doesn't need to request the index separately + TInt index( KErrNotFound ); + if ( EPlayFromCollection == iPlaySource ) + { + index = iPlaylist->Index(); + } + + TMPXPlaybackMessage msg( TMPXPlaybackMessage::EStateChanged, + EPbStateInitialising, + index ); + SetStateL( msg ); + iProperties[EPbPropertyPosition]=0; + + // make sure our interface is supported + CDesCArray* interfaces = iPluginHandler->SupportedInterfacesL( p->Uid() ); + TBool version2InterfaceSupported = EFalse; + if (interfaces->MdcaCount()) + { + TInt pos(0); + version2InterfaceSupported = !interfaces->FindIsq(KMPXPlaybackPluginVersion2, pos); + } + delete interfaces; + + // cast the plugin to use our interface + if (version2InterfaceSupported) + { + CMPXPlaybackPluginVersion2* plugin = NULL; + plugin = static_cast(p); + + // if cast was successful, then init streaming with access point + if (plugin) + { + if ( iAccessPointSet ) + { + if (aSong && aType) + { + plugin->InitStreamingL( *aSong, *aType, aAccessPoint ); + } + else if (aFile) + { + plugin->InitStreamingL( *aFile, aAccessPoint ); + } + } + else + { + if (aSong && aType) + { + plugin->InitialiseL( *aSong ); + } + else if (aFile) + { + plugin->InitialiseL( *aFile ); + } + } + } + else // if (plugin) + { + MPX_DEBUG1("CMPXPlaybackEngine::InitL(): *** Init Streaming failed -- failure to convert to expected interface"); + } + } + else // if (version2InterfaceSupported) + { + if (aSong && aType) + { + p->InitialiseL( *aSong ); + } + else if (aFile) + { + p->InitialiseL( *aFile ); + } + } + + MPX_DEBUG1("<==CMPXPlaybackEngine::InitL(const TDesC* aSong, const TDesC8* aType, RFile* aFile, TInt aAccessPoint)"); + } + +// ---------------------------------------------------------------------------- +// Command handler +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandleCommandL(TMPXPlaybackCommand aCmd, TInt aData ) + { + MPX_DEBUG2("CMPXPlaybackEngine::HandleCommandL(%d) entering", aCmd); + switch(aCmd) + { + case EPbCmdPlay: + HandlePlayL(); + break; + case EPbCmdStop: + HandleStopL(); + break; + case EPbCmdPause: + HandlePauseL(); + break; + case EPbCmdNext: + HandleNextL(); + break; + case EPbCmdPrevious: + HandlePreviousL(); + break; + case EPbCmdPlayWithFadeIn: + HandlePlayWithFadeInL(); + break; + case EPbCmdStartSeekForward: + HandleStartSeekL(ETrue); + break; + case EPbCmdStartSeekBackward: + HandleStartSeekL(EFalse); + break; + case EPbCmdStopSeeking: + HandleStopSeekingL(); + break; + case EPbCmdIncreaseVolume: + HandleIncreaseVolumeL(); + break; + case EPbCmdDecreaseVolume: + HandleDecreaseVolumeL(); + break; + case EPbCmdSetVolume: + HandleSetVolumeL( aData ); + break; + case EPbCmdMuteVolume: + HandleMuteL(ETrue); + break; + case EPbCmdUnMuteVolume: + HandleMuteL(EFalse); + break; + case EPbCmdClose: + HandleCloseL( aData ); + break; + case EPbCmdReplay: + HandleReplayL(); + break; + case EPbApplyEffect: + HandleEffectL(aData); + break; + case EPbCmdDisableEffect: + HandleDisableEffectL(); + break; + case EPbCmdPreservePosition: + iPreservedPosition = iProperties[EPbPropertyPosition]; + break; + case EPbCmdPreserveState: + iPreservedState = iState; + break; + case EPbCmdCloseItem: + HandleCloseItemL( aData ); + break; + case EPbCmdCancelInit: + { + if (EPbStateInitialising==iState) + { + PluginL()->CancelRequest(); + iNextState = EPbStateStopped; + + if (iPluginHandler->Plugin()) + { + TRAP_IGNORE(iPluginHandler->Plugin()->CommandL(EPbCmdClose, aData)); + } + if (iInitializer) + { + iInitializer->Close(); + } + //Needs to update iState and report the change to Ui + SetStateL(EPbStateStopped); + } + break; + } + case EPbCmdResetPreserveState: + { + iPreservedState = EPbStateNotInitialised; + break; + } + case EPbCmdUnloadNonActivePlugin: + { + TUid uid = TUid::Uid(aData); + if (iPluginHandler->Plugin()) + { + if (iPluginHandler->Plugin()->Uid() != uid) + { //not current active plugin + iPluginHandler->UnloadPlugin(uid); + } + } + if (iInitializer) + { + if (iInitializer->PluginUid() == uid) + { //Plugin loaded in pre-initializer, not active one. + iInitializer->Close(); + } + } + break; + } + case EPbCmdClearKeyBuffer: + { + MPX_DEBUG1("CMPXPlaybackEngine::HandleCommandL - EPbCmdClearKeyBuffer"); + iCmdBuffer->ClearCommands(); + break; + } + case EPbCmdSetAutoResume: + { + iAutoResumeHandler->SetAutoResume( aData ); + break; + } + default: + ASSERT(0); + } + MPX_DEBUG1("CMPXPlaybackEngine::HandleCommandL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Handle media properties from collection +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandleCollectionMediaL( + const CMPXMedia& aMedia, + TInt aError) + { + MPX_DEBUG3("-->CMPXPlaybackEngine::HandleCollectionMediaL 0x%08x err(%d)", + this, aError); + + if (KErrNone == aError) + { + HBufC8* mimeType = + MPXUser::Alloc8L(aMedia.ValueText(KMPXMediaGeneralMimeType)); + CleanupStack::PushL(mimeType); + + if(iUri) + { + delete iUri; + iUri = NULL; + } + + iUri = aMedia.ValueText(KMPXMediaGeneralUri).AllocL(); + MPX_DEBUG2("CMPXPlaybackEngine::HandleCollectionMediaL uri %S", iUri); + + iItemId = KMPXInvalidItemId; + if (aMedia.IsSupported(KMPXMediaGeneralId)) + { + iItemId = aMedia.ValueTObjectL( KMPXMediaGeneralId ); + MPX_DEBUG3("CMPXPlaybackEngine::HandleCollectionMediaL iItemId %d %d", iItemId.iId1, iItemId.iId2); + } + + iDbFlag = 0; + if ( aMedia.IsSupported( KMPXMediaGeneralFlags )) + { + iDbFlag = aMedia.ValueTObjectL( KMPXMediaGeneralFlags ); + MPX_DEBUG2("CMPXPlaybackEngine::HandleCollectionMediaL iDbFlag %x", iDbFlag); + } + + iMediaDuration = 0; + if ( aMedia.IsSupported( KMPXMediaGeneralDuration )) + { + iMediaDuration = aMedia.ValueTObjectL( KMPXMediaGeneralDuration ); + MPX_DEBUG2("CMPXPlaybackEngine::HandleCollectionMediaL iMediaDuration %d", iMediaDuration); + } + + iAccessPoint = 0; + iAccessPointSet = EFalse; + if ( aMedia.IsSupported(KMPXMediaGeneralExtAccessPoint) ) + { + iAccessPoint = aMedia.ValueTObjectL( KMPXMediaGeneralExtAccessPoint ); + MPX_DEBUG2("CMPXPlaybackEngine::HandleCollectionMediaL iAccessPoint %d", iAccessPoint ); + iAccessPointSet = ETrue; + } + if (*iUri == KNullDesC) + { + aError = KErrNotFound; + } + else + { + TRAP( aError, InitL( iUri, mimeType, NULL, iAccessPoint) ); + /* + // 20 steps fix + // check whether we are playing WMA files, if so + // the increment has to be KMPXLargeVolumeIncrement + TParsePtrC parser(*iUri); + + MPX_DEBUG2("CMPXPlaybackEngine::HandleCollectionMediaL(): iUri is %S", iUri); + if (parser.Ext().CompareF(KWmaExtension) == 0 || parser.Ext().CompareF(KRaExtension) == 0) + { + // for wma file, the increment is always 10 with or without headset + iVolumeIncrement = KMPXLargeVolumeIncrement; + MPX_DEBUG2("CMPXPlaybackEngine::HandleCollectionMediaL it is a wma/ra file, volumeIncrement: %d !!!!", iVolumeIncrement); + } +#if defined(__HIGH_RESOLUTION_VOLUME) +#ifdef __ACCESSORY_FW + else if (iAccessoryObs->AccessoryModeL() == EPbAccessoryWiredHeadset || iAccessoryObs->AccessoryModeL() == EPbAccessoryHeadphones) +#else + else if (iAccessoryObs->AccessoryModeL() == EPbAccessoryHeadset) +#endif // __ACCESSORY_FW + { + // for non wma files with headset, the volume increment is 5 + iVolumeIncrement = KMPXSmallVolumeIncrement; + } +#endif // HIGH_RESOLUTION_VOLUME + */ + if ( KErrNone == aError ) + { + RestorePlaybackPositionAndStateL( aMedia ); + } + else + { + iClientList->SendMsgL(TMPXPlaybackMessage( + TMPXPlaybackMessage::EMediaChanged)); + iState = EPbStateStopped; + } + } + CleanupStack::PopAndDestroy(mimeType); + } + else + { + // it'll be incorrect to leave iItemId unchanged, also KMPXInvalidItemId has special handling in + // CreateMediaToSetLC so we'd rather set Id to some actual value even if it had some 'issues' + iItemId = iPlaylist->Path().Id(); + } + + // Check for error again, just in case above code had any errors + if ( KErrNone != aError ) + { + if ( KErrNotFound == aError || + KErrPathNotFound == aError || + KErrPermissionDenied == aError ) + { + // Mark item as Invalid + MarkItemInvalid( ETrue ); + iClientList->SendMsgL( + TMPXPlaybackMessage( TMPXPlaybackMessage::EError, + EPInitialised, + aError )); + } + else + { // other system error + HandleStopL(); + } + } + MPX_DEBUG1("<--CMPXPlaybackEngine::HandleCollectionMediaL()"); + } + +// ---------------------------------------------------------------------------- +// Handle playlist change event +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandleCollectionPlaylistChange(TInt aError) + { + MPX_FUNC_EX("CMPXPlaybackEngine::HandleCollectionPlaylistChange"); + MPX_DEBUG2("CMPXPlaybackEngine::HandleCollectionPlaylistChange(%d)", aError); + + if (KErrNotFound == aError) + { + if ( iPlaylist ) + { + TRAP_IGNORE(HandleStopL()); + + // If playlist is empty now, update state + if ( iPlaylist->Count() == 0 ) + { + iNextState = EPbStateNotInitialised; + iState = EPbStateNotInitialised; + } + } + } + else if(KErrEof == aError) + { // current item removed at the end + TRAP_IGNORE(HandleStopL()); + + // If playlist is empty now, update state + if ( iPlaylist->Count() == 0 ) + { + iNextState = EPbStateNotInitialised; + iState = EPbStateNotInitialised; + } + else + { + TRAP_IGNORE(HandleNextL(1, ETrue)); + } + } + else if (iInitializer) + { // Reset initializer anyway. Make sure it is synced + //iInitializer->Close(); //correct auto playlist crash + } + //update now playing view + TRAP_IGNORE(iClientList->SendMsgL(TMPXPlaybackMessage( + TMPXPlaybackMessage::EPlaylistUpdated))); + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackEngine::HandlePluginHandlerEvent +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandlePluginHandlerEvent( + TPluginHandlerEvents aEvent, + const TUid& aPluginUid, + TBool aLoaded, + TInt aData) + { + MPX_FUNC_EX("CMPXPlaybackEngine::HandlePluginHandlerEvent"); + + switch (aEvent) + { + case MMPXPluginHandlerObserver::EPluginAdd: + { + TRAP_IGNORE(SendPluginHandlerMessageL(KMPXMessagePluginAdd, aPluginUid, + EFalse, aData)); + break; + } + case MMPXPluginHandlerObserver::EPluginUpdateStart: + { + // Handling the unloading of the previous plugin version and the loading + // of the new plugin version is synchronous and therefore new requests + // will not be processed by the server/engine in between EPluginUpdateStart + // and EPluginUpdateEnd. + // + // If the plugin handler would unload/load plugins asynchronously then a + // mechanism must be created where new requests are not accepted for + // the plugin that is being updated for the duration of the update. + + TRAP_IGNORE(SendPluginHandlerMessageL(KMPXMessagePluginUpdateStart, + aPluginUid, aLoaded, aData)); + + // If the current loaded plugin is being updated + if (iPluginHandler->Plugin() && + (iPluginHandler->Plugin()->Uid() == aPluginUid)) + { + // Complete all outstanding requests + iTaskQueue->CompleteAllTasks(KErrNotReady); + } + break; + } + case MMPXPluginHandlerObserver::EPluginUpdateEnd: + { + TRAP_IGNORE(SendPluginHandlerMessageL(KMPXMessagePluginUpdateEnd, + aPluginUid, aLoaded, aData)); + break; + } + case MMPXPluginHandlerObserver::EPluginRemove: + { + // If the current loaded plugin is being removed + if (iPluginHandler->Plugin() && + (iPluginHandler->Plugin()->Uid() == aPluginUid)) + { + // Complete all outstanding requests + iTaskQueue->CompleteAllTasks(KErrNotReady); + } + + TRAP_IGNORE(SendPluginHandlerMessageL(KMPXMessagePluginRemove, + aPluginUid, aLoaded)); + break; + } + + default: + { + // ignore the event + break; + } + } + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackEngine::SendPluginHandlerMessageL +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::SendPluginHandlerMessageL( + TInt aMessageId, + const TUid& aPluginUid, + TBool aLoaded, + TInt aVersion /* = 0 */) + { + CMPXMessage* msg = CMPXMedia::NewL(); + CleanupStack::PushL(msg); + + msg->SetTObjectValueL(KMPXMessageGeneralId, aMessageId); + msg->SetTObjectValueL(KMPXAttrPluginId, aPluginUid); + msg->SetTObjectValueL(KMPXAttrPluginLoaded, aLoaded); + if (aVersion > 0) + { + msg->SetTObjectValueL(KMPXAttrPluginVersion, aVersion); + } + + iClientList->SendMsg(msg, KErrNone); + + CleanupStack::PopAndDestroy(msg); + } + +// ---------------------------------------------------------------------------- +// Handle play command +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandlePlayL() + { + MPX_DEBUG1("CMPXPlaybackEngine::HandlePlayL(): entering"); + CMPXPlaybackPlugin* p(NULL); + TMPXPlaybackState oldNextState( iNextState ); + iNextState = EPbStatePlaying; + if (EPbStateNotInitialised == iPluginState && + EPlayFromCollection == iPlaySource && + EPbStatePaused != iState) + { + MediaFromCollectionL(); + } + else + { + switch (iState) + { + case EPbStatePlaying: //already playing, send message to update clients + if (EPbStatePaused == iPluginState) + { // paused due to skipping + PluginL()->CommandL(EPbCmdPlay); + } + iClientList->SendMsgL( + TMPXPlaybackMessage( + TMPXPlaybackMessage::EStateChanged, iState)); + break; + case EPbStateNotInitialised: // No song initialised in engine + iNextState = EPbStateNotInitialised; + break; + case EPbStateSeekingForward: + case EPbStateSeekingBackward: + EndSeek(); + p = PluginL(); + p->CommandL(EPbCmdPlay); + break; + case EPbStatePaused: + case EPbStateStopped: + { + // If playing from collection playlist and currently in + // stopped state, then re-get media attributes + if ( EPlayFromCollection == iPlaySource && + EPbStateStopped == oldNextState ) + { + MediaFromCollectionL(); + break; + } + else if ( EPlayFromUri == iPlaySource && + EPbStateStopped == oldNextState ) + { + TRAP_IGNORE( InitL( iUri, &( KNullDesC8 ), NULL, iAccessPoint ) ); + break; + } + else + { + // fall through on purpose + } + } + default: + { + p= PluginL(); + p->CommandL(EPbCmdPlay); + break; + } + } + } + MPX_DEBUG1("CMPXPlaybackEngine::HandlePlayL(): exiting"); + } + +// ---------------------------------------------------------------------------- +// Handle play command with fade in +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandlePlayWithFadeInL() + { + MPX_DEBUG1("CMPXPlaybackEngine::HandlePlayWithFadeInL(): entering"); + MPX_DEBUG2("CMPXPlaybackEngine::HandlePlayWithFadeInL(): Ramp = %d", iProperties[EPbPropertyVolumeRamp]); + MPX_DEBUG2("CMPXPlaybackEngine::HandlePlayWithFadeInL(): Position = %d", iProperties[EPbPropertyPosition]); + + CMPXPlaybackPlugin* p( PluginL() ); + TRAP_IGNORE( // uPnP leaves if set in stop state + p->SetL( EPbPropertyVolumeRamp, + iProperties[EPbPropertyVolumeRamp] )); + p->CommandL(EPbCmdPlay); + iNextState = EPbStatePlaying; + MPX_DEBUG1("CMPXPlaybackEngine::HandlePlayWithFadeInL(): exiting"); + } + +// ---------------------------------------------------------------------------- +// Handle pause command +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandlePauseL() + { + MPX_DEBUG1("CMPXPlaybackEngine::HandlePauseL(): entering"); + Suspend(); + if ( EPbStatePaused == iState ) + { + //already paused, send message to update clients + iClientList->SendMsgL( + TMPXPlaybackMessage( + TMPXPlaybackMessage::EStateChanged, iState)); + } + else + { + if (EPbStatePlaying == iNextState) + { // only change state from playing to pause + iNextState = EPbStatePaused; + } + PluginL()->CommandL(EPbCmdPause); + } + MPX_DEBUG1("CMPXPlaybackEngine::HandlePauseL(): exiting"); + } + +// ---------------------------------------------------------------------------- +// Handle stop command +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandleStopL() + { + MPX_DEBUG1("CMPXPlaybackEngine::HandleStopL(): entering"); + iNextState = EPbStateStopped; + TRAP_IGNORE(DoStopL()); + if (iInitializer) + { + iInitializer->Close(); + } + MPX_DEBUG1("CMPXPlaybackEngine::HandleStopL(): exiting"); + } + +// ---------------------------------------------------------------------------- +// Stop playback +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::DoStopL(TBool aSavePlaybackInfo) + { + MPX_DEBUG1("==>CMPXPlaybackEngine::DoStopL()"); + Suspend(); + if (iState == EPbStatePaused || iState == EPbStatePlaying || + iState == EPbStateInitialising) + { + if (aSavePlaybackInfo && (iState == EPbStatePaused || iState == EPbStatePlaying )) + { + TRAP_IGNORE(SavePlaybackInfoL()); // Leave when MMC eject and database already closed. + } + PluginL()->CommandL(EPbCmdStop); // Leave if router power down + } + MPX_DEBUG1("<==CMPXPlaybackEngine::DoStopL()"); + } + +// ---------------------------------------------------------------------------- +// Handle next track command +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandleNextL( + TInt aOffset /*= 1*/, + TBool aIgnoreRepeat /*=EFalse*/ ) + { + MPX_ASSERT(aOffset>0); + MPX_DEBUG2("CMPXPlaybackEngine::HandleNextL(%d) entering", aOffset); + EndSeek(); + TBool next = ETrue; + TBool notify( ETrue ); + if (EPlayFromCollection == iPlaySource && iPlaylist) + { + // Ignore command if playlist empty + if ( iPlaylist->Count() <= 0 ) + { + next = EFalse; + notify = EFalse; + } + else + { + while (aOffset-->0) + { + if (!iPlaylist->Next( aIgnoreRepeat )) + { + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage:: + EReachedEndOfPlaylist)); + iNextState = EPbStateStopped; + if (iPlaylist->IsSingleItemPlaylist()) + { + next = EFalse; + } + break; + } + } + } + } + + // Check if repeat mode is on and playing from a file or URI + else if ( iProperties[EPbPropertyRepeatMode] != EPbRepeatOff ) + { + if ( EPlayFromFile == iPlaySource ) + { + TRAP_IGNORE( InitL( NULL, NULL, &iFile, iAccessPoint )); + } +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + else if ( EPlayFromFile64 == iPlaySource ) + { + TRAP_IGNORE( Init64L( &iFile64, iAccessPoint )); + } +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + else if ( EPlayFromUri == iPlaySource ) + { + TRAP_IGNORE( InitL( iUri, &( KNullDesC8 ), NULL, iAccessPoint )); + } + else + { + HandleStopL(); + } + next = EFalse; + } + else + { + HandleStopL(); + next = EFalse; + } + + if (next) + { + // query collection for next song + MediaFromCollectionL(); + } + else if ( notify ) + { // trigger UI to update duration + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EStateChanged,iState)); + } + MPX_DEBUG1("CMPXPlaybackEngine::HandleNextL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Handle previous command +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandlePreviousL( + TInt aOffset /*= -1*/, + TBool aIgnoreRepeat /*=EFalse*/ ) + { + MPX_ASSERT(aOffset<0); + MPX_DEBUG2("CMPXPlaybackEngine::HandlePreviousL(%d) entering", aOffset); + EndSeek(); + if (EPlayFromCollection == iPlaySource && iPlaylist) + { + // Ignore command if playlist empty + if ( iPlaylist->Count() > 0 ) + { + // If first item in list and repeat is off, then replay the song + if ( 0 == iPlaylist->Index() && + CMPXCollectionPlaylist::ERepeatOff == iPlaylist->RepeatMode() ) + { + if ( EPbStatePlaying == iState || + EPbStatePaused == iState ) + { + HandleReplayL(); + } + } + else + { + aOffset = -aOffset; + while (aOffset-->0) + { + if (!iPlaylist->Previous( aIgnoreRepeat )) + { + HandleStopL(); + break; + } + } + MediaFromCollectionL(); + } + } + } + else + { + HandleStopL(); + } + MPX_DEBUG1("CMPXPlaybackEngine::HandlePreviousL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Handle replay command +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandleReplayL() + { + MPX_DEBUG1("CMPXPlaybackEngine::HandleReplayL(): entering"); + EndSeek(); + iProperties[EPbPropertyPosition] = 0; + if ( PluginL() ) + { + TMPXPlaybackState prevState( iState ); + if ( iState == EPbStatePlaying ) + { + // Need to send pause command to plugin first so that it will + // not keep playing the rest of it's buffer + MPX_DEBUG1("CMPXPlaybackEngine::HandleReplayL() send pause command"); + iState = EPbStatePaused; + PluginL()->CommandL(EPbCmdPause); + } + PluginL()->SetL(EPbPropertyPosition, + iProperties[EPbPropertyPosition]); + if ( prevState == EPbStatePlaying ) + { + PluginL()->CommandL(EPbCmdPlay); + } + } + MPX_DEBUG1("CMPXPlaybackEngine::HandleReplayL(): exiting"); + } + +// ---------------------------------------------------------------------------- +// Handle start seeking command +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandleStartSeekL(TBool aForward) + { + MPX_DEBUG1("CMPXPlaybackEngine::HandleStartSeekL(): entering"); + if (iState==EPbStatePlaying || + iState==EPbStatePaused || + iState==EPbStateSeekingForward || + iState==EPbStateSeekingBackward) + { + Suspend(); + if (iState != EPbStateSeekingForward && + iState != EPbStateSeekingBackward) + { + iNextState = iState; + } + + SetStateL(aForward?EPbStateSeekingForward:EPbStateSeekingBackward); + + PluginL()->CommandL(EPbCmdPause); + + TCallBack cb(SeekTimerCallback,this); + iSeekStep = aForward ? KPbInitialSeekStepMilliSeconds : + -KPbInitialSeekStepMilliSeconds; + if ( iSeekTimer->IsActive() ) + iSeekTimer->Cancel(); + iSeekTimer->Start(KPbSeekIntervalMicroSeconds, + KPbSeekIntervalMicroSeconds, cb); + MPX_DEBUG2("CMPXPlaybackEngine sends msg EStateChanged to %d", iState); + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EStateChanged,iState)); + } + MPX_DEBUG1("CMPXPlaybackEngine::HandleStartSeekL(): exiting"); + } + +// ---------------------------------------------------------------------------- +// Handle stop seeking command +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandleStopSeekingL() + { + MPX_DEBUG1("CMPXPlaybackEngine::HandleStopSeekingL(): entering"); + + // Only perform actions if we are currently in seeking state + if (iState == EPbStateSeekingForward || + iState == EPbStateSeekingBackward) + { + EndSeek(); + if (EPbStateNotInitialised == iPluginState && + EPlayFromCollection == iPlaySource ) + { + iPreservedPosition = iProperties[EPbPropertyPosition]; + MediaFromCollectionL(); + } + else + { + PluginL()->SetL(EPbPropertyPosition,iProperties[EPbPropertyPosition]); + iState = iNextState; + switch ( iState ) + { + case EPbStatePlaying: + { + iClientList->SendMsgL( // update UI icons + TMPXPlaybackMessage(TMPXPlaybackMessage::EStateChanged,iState)); + PluginL()->CommandL( EPbCmdPlay ); + break; + } + case EPbStatePaused: + { + iClientList->SendMsgL( // update UI icons + TMPXPlaybackMessage(TMPXPlaybackMessage::EStateChanged,iState)); + break; + } + default: + break; + } + } + } + MPX_DEBUG1("CMPXPlaybackEngine::HandleStopSeekingL(): exiting"); + } + +// ---------------------------------------------------------------------------- +// Handle increase volume command +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandleIncreaseVolumeL() + { + TInt level( iProperties[EPbPropertyVolume] ); +#if defined(__HIGH_RESOLUTION_VOLUME) + // if we already rounded up last time, don't have to increase, + // reset flag + if (!iVolRoundedUp) + { + level += iVolumeIncrement; + } +#else + level += iVolumeIncrement; +#endif + // Ensure that level is within min and max values + if (level > KPbPlaybackVolumeLevelMax) + { + level = KPbPlaybackVolumeLevelMax; + } + if (level < KPbPlaybackVolumeLevelMin) + { + level = KPbPlaybackVolumeLevelMin; + } + + SetL(EPbPropertyVolume, level); + } + +// ---------------------------------------------------------------------------- +// Handle decrease volume command +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandleDecreaseVolumeL() + { + TInt level( iProperties[EPbPropertyVolume] - iVolumeIncrement ); + + // Ensure that level is within min and max values + if (level > KPbPlaybackVolumeLevelMax) + { + level = KPbPlaybackVolumeLevelMax; + } + if (level < KPbPlaybackVolumeLevelMin) + { + level = KPbPlaybackVolumeLevelMin; + } + + SetL(EPbPropertyVolume, level); + } + +// ---------------------------------------------------------------------------- +// Handle set volume command +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandleSetVolumeL(TInt aVolume) + { + TInt level = aVolume; + + // Ensure that level is within min and max values + if (level > KPbPlaybackVolumeLevelMax) + { + level = KPbPlaybackVolumeLevelMax; + } + if (level < KPbPlaybackVolumeLevelMin) + { + level = KPbPlaybackVolumeLevelMin; + } + + SetL(EPbPropertyVolume, level); + } + +// ---------------------------------------------------------------------------- +// Handle mute command +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandleMuteL(TBool aMute) + { + SetL(EPbPropertyMute, aMute); + } + +// ---------------------------------------------------------------------------- +// Handle close command +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandleCloseL( TInt aData ) + { + MPX_DEBUG1("CMPXPlaybackEngine::HandleCloseL(): entering"); + if (iPluginHandler->Plugin()) + { + TRAP_IGNORE(DoStopL()); + iNextState = EPbStateNotInitialised; + TRAP_IGNORE(iPluginHandler->Plugin()->CommandL(EPbCmdClose, aData)); + DoClose(); + } + if (iInitializer) + { + iInitializer->Close(); + } + MPX_DEBUG1("CMPXPlaybackEngine::HandleCloseL(): exiting"); + } + +// ---------------------------------------------------------------------------- +// Handle a custom command +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandleEffectL(TInt aData) + { + MPX_FUNC_EX("CMPXPlaybackEngine::HandleEffectL()"); + if(iPluginHandler->Plugin()) + { + iPluginHandler->Plugin()->CommandL(EPbApplyEffect, aData); + } + } + +// ---------------------------------------------------------------------------- +// Handle a custom command +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandleDisableEffectL() + { + MPX_FUNC_EX("CMPXPlaybackEngine::HandleDisableEffectL()"); + if(iPluginHandler->Plugin()) + { + iPluginHandler->Plugin()->CommandL(EPbCmdDisableEffect); + } + } + +// ---------------------------------------------------------------------------- +// Handle request to close a specific item +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandleCloseItemL( TInt aItemId ) + { + MPX_FUNC_EX("CMPXPlaybackEngine::HandleCloseItemL()"); + + if( iPlaylist ) + { + // If the item is currently in play, close playback or + // if item is currently in the initializer + if( iPlaylist->Path().Id().ApproxEqual( aItemId ) ) + { + HandleStopL(); + } + else if(iInitializer) + { + TInt nextIndex; + TBool repeatMode; + repeatMode = iPlaylist->RepeatMode(); + TBool nextFound = iPlaylist->NextIndex( repeatMode, nextIndex ); + TMPXItemId nextItemId = iPlaylist->Path().IdOfIndex( nextIndex ); + + if((iInitializer->CurrentInitItemId().iId2 == aItemId) || + ( iInitNext && nextFound && nextItemId.ApproxEqual( aItemId ))) + { + iInitializer->Close(); + } + } + } + } + +// ---------------------------------------------------------------------------- +// Sets the plug-in properties +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::SetPropertiesL() + { + MPX_FUNC_EX("CMPXPlaybackEngine::SetPropertiesL()"); + iMaxSeekStep = iProperties[EPbPropertyDuration]/KPercentMultiplier*KPbMaxSeekStepPercent; + MPX_DEBUG2("CMPXPlaybackEngine::SetPropertiesL(): iMediaDuration = %d", iMediaDuration); + MPX_DEBUG2("CMPXPlaybackEngine::SetPropertiesL(): iProperties[EPbPropertyDuration] = %d", iProperties[EPbPropertyDuration]); + if ( Abs(iMediaDuration - iProperties[EPbPropertyDuration]) > + KPbDurationChangeThreshold ) + { + MPX_DEBUG1("CMPXPlaybackEngine::SetPropertiesL(): Duration not equal"); + // Set duration if it's different than what collection has + if ( iPlaylist) + { + if ( iPlaylist->Count() && !iPlaylist->EmbeddedPlaylist() ) + { + MPX_DEBUG1("CMPXPlaybackEngine::SetPropertiesL(): Setting duration"); + CMPXMedia* media( CreateMediaToSetLC( iPlaylist->Path() )); + + iMediaDuration = iProperties[EPbPropertyDuration]; + media->SetTObjectValueL( KMPXMediaGeneralDuration, + iProperties[EPbPropertyDuration] ); + iPlaylist->SetL( *media ); + CleanupStack::PopAndDestroy( media ); + } + } + } + } + +// ---------------------------------------------------------------------------- +// Stop seeking timer +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::EndSeek() + { + if (iSeekTimer) + { + iSeekTimer->Cancel(); + } + } + +// ---------------------------------------------------------------------------- +// Set playback state +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::SetStateL(TMPXPlaybackState aState) + { + MPX_DEBUG2("CMPXPlaybackEngine::SetStateL(%d): entering", aState); + + TMPXPlaybackMessage msg( TMPXPlaybackMessage::EStateChanged, + aState ); + SetStateL( msg ); + MPX_DEBUG1("CMPXPlaybackEngine::SetStateL(): exiting"); + } + +// ---------------------------------------------------------------------------- +// Set playback state +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::SetStateL( TMPXPlaybackMessage& aMsg ) + { + MPX_DEBUG1("CMPXPlaybackEngine::SetStateL(aMsg): entering"); + + TMPXPlaybackState state( static_cast( aMsg.Type() )); + MPX_DEBUG2("CMPXPlaybackEngine::SetStateL(): state = %d", state); + + if ( state!=iState ) + { + iState = state; + iAutoResumeHandler->HandlePlaybackStateChange( iState ); + MPX_DEBUG2("CMPXPlaybackEngine sends msg EStateChanged to %d", iState); + iClientList->SendMsgL( aMsg ); + } + // Restart progress timer + if (EPbStatePlaying == iState && !iProgressTimer->IsActive()) + { + iProgressTimer->Start(ETwelveOClock,this); + } + MPX_DEBUG1("CMPXPlaybackEngine::SetStateL(aMsg): exiting"); + } + +// ---------------------------------------------------------------------------- +// Set player activated +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::SetPlayerActivated(TBool aActive) + { + MPX_DEBUG3("CMPXPlaybackEngine::SetPlayerActivated old = %d, new = %d", + iPlayerActive, aActive); + if (iPlayerActive != aActive) + { + iPlayerActive = aActive; + // triggle clients to update playback state + TRAP_IGNORE(iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EStateChanged, iState))); + MPX_DEBUG1("Playback Engine notify server active player chnaged."); + TRAP_IGNORE(iObserver.HandleActiveEngineL(this, iPlayerActive)); + } + MPX_DEBUG1("CMPXPlaybackEngine::SetPlayerActivated(): exiting"); + } + +// ---------------------------------------------------------------------------- +// Execute a async task +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::ExecuteTask( + TInt aTask, + TInt aParamData, + TAny* aPtrData, + const CBufBase& aBuf, + TAny* aCallback, + CBase* aCObject1, + CBase* aCObject2) + { + TRAPD(err, ExecuteTaskL(aTask, aParamData, aPtrData, + aCallback, aBuf, aCObject1, aCObject2)); + if (KErrNone != err) + { + HandleError(aTask, err, aParamData); + } + } + +// ---------------------------------------------------------------------------- +// Indicates that a task was terminated with an error. +// This will be called in case of a plugin update/removal. +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandleTaskError( + TInt aTask, + TAny* /*aPtrData*/, + TAny* /*aCallback*/, + TInt aError) + { + MPX_FUNC("CMPXCollectionClientContext::HandleTaskError"); + HandleError(aTask, aError); + } + +// ---------------------------------------------------------------------------- +// Execute a async task +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::ExecuteTaskL( + TInt aTask, + TInt aParamData, + TAny* aPtrData, + TAny* aCallback, + const CBufBase& /*aBuf*/, + CBase* aCObject1, + CBase* /*aCObject2*/) + { + MPX_DEBUG5("-->CMPXPlaybackEngine::ExecuteTaskL 0x%08x cb 0x%08x (%d, %d)", + this, aCallback, aTask, aParamData); + if ( aTask != EHandleNext ) + { + ASSERT(aCallback); + iCallback = static_cast(aCallback); + } + CMPXPlaybackPlugin* p = aPtrData ? + static_cast(aPtrData) : + iPluginHandler->Plugin(); + switch(aTask) + { + case EProperty: + { + CheckPtrL(p); + p->PropertyL(static_cast(aParamData)); + break; + } + case EMedia: + { + iMediaAttrs.Reset(); + CMPXCommand* cmd( static_cast(aCObject1)); + const TDesC& attr = cmd->ValueText( KMPXCommandMediaAttribute ); + TPtrC8 ptr = MPXUser::Ptr( attr ); + RDesReadStream readStream( ptr ); + CleanupClosePushL( readStream ); + // Internalize attributes + ::InternalizeL( iMediaAttrs, readStream ); + CleanupStack::PopAndDestroy( &readStream ); + CheckPtrL( p ); + TMPXPlaybackState state(State()); + if (( EPbStateInitialising == state || + EPbStatePlaying == state || + EPbStatePaused == state || + EPbStateStopped == state || + EPbStateBuffering == state || + EPbStateDownloading == state || + EPbStateInitialised == state )) + { + CMPXAttributeSpecs* specs( NULL ); + if ( cmd->IsSupported( KMPXCommandMediaAttributeSpecs ) ) + { + specs = cmd->Value( KMPXCommandMediaAttributeSpecs ); + User::LeaveIfNull(specs); + } + p->MediaL( iMediaAttrs.Array(), specs ); + } + else + { + CMPXMedia *media = CMPXMedia::NewL(); + CleanupStack::PushL(media); + media->SetTObjectValueL(KMPXMediaColDetailMediaNotAvailable, + ETrue); + HandleMedia(media, KErrNone); + CleanupStack::PopAndDestroy(media); + } + } + break; + case ESubPlayerNames: + { + CheckPtrL(p); + p->SubPlayerNamesL(); + break; + } + case EHandleNext: + { + HandleNextL(); + if( iPlaylist ) + { + iClientList->SendMsgL(TMPXPlaybackMessage( + TMPXPlaybackMessage::EMediaChanged)); + } + SetStateL( iState ); + iTaskQueue->CompleteTask(); + break; + } + default: + ASSERT(0); + } + MPX_DEBUG4("<--CMPXPlaybackEngine::ExecuteTaskL 0x%08x (%d, %d): Exiting", + this, aTask, aParamData); + } + +// ---------------------------------------------------------------------------- +// Error happens upon request +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::HandleError( + TInt aTask, + TInt aError, + TInt aParamData /* = 0 */) + { + MPX_DEBUG3("-->CMPXPlaybackEngine::HandleError() 0x%08x: aError %d", this, aError); + switch (aTask) + { + case EProperty: + iCallback->HandleProperty( + static_cast(aParamData), + 0,aError); + iCallback = NULL; + break; + case EMedia: + { + iCallback->HandleMedia(NULL, aError); + iCallback = NULL; + } + break; + case ESubPlayerNames: + { + TUid piid=TUid::Uid(aParamData); + iCallback->HandleSubPlayerNames(piid, NULL, ETrue, aError); + iCallback = NULL; + } + break; + default: + ASSERT(0); + break; + } + iTaskQueue->CompleteTask(); + MPX_DEBUG3("<--CMPXPlaybackEngine::HandleError() 0x%08x: aError %d", this, aError); + } + +// ---------------------------------------------------------------------------- +// Get command from state +// ---------------------------------------------------------------------------- +// +TMPXPlaybackCommand CMPXPlaybackEngine::CommandFromState( + TMPXPlaybackState aState ) + { + MPX_DEBUG2("CMPXPlaybackEngine::CommandFromState(): aState %d", aState); + TMPXPlaybackCommand cmd(EPbCmdStop); + switch ( aState ) + { + case EPbStatePlaying: + cmd = EPbCmdPlay; + break; + case EPbStatePaused: + cmd = EPbCmdPause; + break; + case EPbStateStopped: + cmd = EPbCmdStop; + break; + default: + break; + } + return cmd; + } + +// ---------------------------------------------------------------------------- +// Do close +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::DoClose() + { + MPX_FUNC_EX("CMPXPlaybackEngine::DoClose()"); + if (iTaskQueue) + { + iTaskQueue->CancelRequests(); + } + + iAutoResumeHandler->CancelResumeTimer(); + + if (iProgressTimer) + { + iProgressTimer->Cancel(); + } + + if (iSeekTimer) + { + iSeekTimer->Cancel(); + } + + iCmdBuffer->ClearCommands(); + + iFile.Close(); +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + iFile64.Close(); +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + delete iPlaylist; + iPlaylist = NULL; + delete iUri; + iUri = NULL; + iItemId = KMPXInvalidItemId; + iPlaySource = EPlayNone; + iState = EPbStateNotInitialised; + iNextState = EPbStateNotInitialised; + } + +// ---------------------------------------------------------------------------- +// URI from collection +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::MediaFromCollectionL() + { + MPX_FUNC_EX("CMPXPlaybackEngine::MediaFromCollectionL"); + if (iInitNext) + { + iInitializer->Init(*iPlaylist); + iInitializer->SetActiveL(); + } + else + { + RArray attrs; + CleanupClosePushL(attrs); + attrs.AppendL(KMPXMediaGeneralId); + attrs.AppendL(KMPXMediaGeneralUri); + attrs.AppendL(KMPXMediaGeneralMimeType); + attrs.AppendL(KMPXMediaGeneralLastPlaybackPosition); + attrs.AppendL(KMPXMediaGeneralFlags); + + if (iPlaylist) ///in some cases this could be empty + { + iPlaylist->MediaL(attrs.Array(),*this); + } + + CleanupStack::PopAndDestroy(&attrs); + } + } + +// ---------------------------------------------------------------------------- +// Save playback position +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::SavePlaybackInfoL() + { + MPX_DEBUG1("CMPXPlaybackEngine::SavePlaybackInfoL() entering"); + + if ( iPlaylist) + { + if (iPlaylist->Count() && !iPlaylist->EmbeddedPlaylist()) + { + CMPXMedia* media( CreateMediaToSetLC( iPlaylist->Path() )); + + // Save position, if at the end, then save position is 0 + // Due to timer callbacks, the current position may not be exactly + // at the same value as the duration, thus must give it a + // threshold to be within. + TInt savePosition( iProperties[EPbPropertyPosition] ); + if ( Abs( iProperties[EPbPropertyDuration] - savePosition ) < + KPbPositionChangeThreshold ) + { + savePosition = 0; + } + media->SetTObjectValueL( KMPXMediaGeneralLastPlaybackPosition, + savePosition ); + iPlaylist->SetL( *media ); + CleanupStack::PopAndDestroy(media); + } + } + + MPX_DEBUG1("CMPXPlaybackEngine::SavePlaybackInfoL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Increments play count +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::SavePlaybackCompleteInfoL() + { + MPX_DEBUG1("CMPXPlaybackEngine::SavePlaybackCompleteInfoL() entering"); + + if ( iPlaylist ) + { + if ( iPlaylist->Count() && !iPlaylist->EmbeddedPlaylist() ) + { + CMPXMedia* media( CreateMediaToSetLC( iPlaylist->Path() )); + + // Increment play count + // Collection implementation will increment count by the + // value provided + media->SetTObjectValueL( KMPXMediaGeneralPlayCount, + 1 ); + + // reset the last playback position to 0 + media->SetTObjectValueL( KMPXMediaGeneralLastPlaybackPosition, + 0 ); + + // Set last play time + TTime now; + now.UniversalTime(); + media->SetTObjectValueL(KMPXMediaGeneralLastPlaybackTime, + now.Int64() ); + + iPlaylist->SetL( *media ); + CleanupStack::PopAndDestroy( media ); + } + } + + MPX_DEBUG1("CMPXPlaybackEngine::SavePlaybackCompleteInfoL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Restore playback position if it was saved previously +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::RestorePlaybackPositionAndStateL( + const CMPXMedia& aMedia ) + { + MPX_DEBUG1("CMPXPlaybackEngine::RestorePlaybackPositionAndStateL() entering"); + + // Restore Position + iProperties[EPbPropertyPosition] = 0; + if ( KErrNotFound != iPreservedPosition ) + { + iProperties[EPbPropertyPosition] = iPreservedPosition; + iPreservedPosition = KErrNotFound; + } + else + { + // Check media + if (aMedia.IsSupported(KMPXMediaGeneralLastPlaybackPosition)) + { + iProperties[EPbPropertyPosition] = + aMedia.ValueTObjectL( KMPXMediaGeneralLastPlaybackPosition ); + } + } + + // Restore State + if ( EPbStateNotInitialised != iPreservedState ) + { + iNextState = iPreservedState; + iPreservedState = EPbStateNotInitialised; + } + + MPX_DEBUG1("CMPXPlaybackEngine::RestorePlaybackPositionAndStateL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Sets the volume increment depending on accessory state +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::SetVolumeIncrement( TMPXPlaybackAccessoryMode aMode ) + { + MPX_DEBUG2("CMPXPlaybackEngine::SetVolumeIncrement(%d) entering", aMode); + + switch ( aMode ) + { +#ifdef __ACCESSORY_FW + case EPbAccessoryWiredHeadset: + case EPbAccessoryHeadphones: +#else + case EPbAccessoryHeadset: +#endif // __ACCESSORY_FW + { +// twentysteps start + + // check whether we are playing WMA files, if so the increment has to be KMPXLargeVolumeIncrement + if(iUri) + { + //MPX_DEBUG1("still alive one !!!!"); + TParsePtrC parser(*iUri); + + MPX_DEBUG2("CMPXPlaybackEngine::SetVolumeIncrement(): iUri is %S", iUri); + + if (parser.Ext().CompareF(KWmaExtension) == 0 || parser.Ext().CompareF(KRaExtension) == 0 ) + { + iVolumeIncrement = KMPXLargeVolumeIncrement; + } + else + { + iVolumeIncrement = KMPXSmallVolumeIncrement; + } + } + else + { + MPX_DEBUG1("CMPXPlaybackEngine::SetVolumeIncrement iUri is NULL"); + iVolumeIncrement = KMPXSmallVolumeIncrement; + } + + MPX_DEBUG2("CMPXPlaybackEngine::SetVolumeIncrement(): Headset is inserted, increment is %d", iVolumeIncrement); +// twentysteps end +// uncomment this when twentysteps is removed iVolumeIncrement = KMPXSmallVolumeIncrement; + break; + } + default: + { + // for everything else check what is the current volume value + // and if an not an interval of KMPXLargeVolumeIncrement, + // which could be the case if the last + // time user listened to music and wired headset was plugged in, + // then convert the value used to an increment of KMPXLargeVolumeIncrement. + MPX_DEBUG2("CMPXPlaybackEngine::SetVolumeIncrement(): NOT a headset, increment is %d", KMPXLargeVolumeIncrement); + iVolumeIncrement = KMPXLargeVolumeIncrement; + if ( iProperties[EPbPropertyVolume] > KPbPlaybackVolumeLevelMin && + iProperties[EPbPropertyVolume] < KPbPlaybackVolumeLevelMax) + { +#if defined(__HIGH_RESOLUTION_VOLUME) + // if we will round up the volume to next increment of 10, set the flag + // so when the headset is unplugged, we just increment it again. + if (iProperties[EPbPropertyVolume] % KMPXLargeVolumeIncrement) + { + iVolRoundedUp = ETrue; + } +#endif + while ( iProperties[EPbPropertyVolume] % KMPXLargeVolumeIncrement && + iProperties[EPbPropertyVolume] <= KPbPlaybackVolumeLevelMax ) + { + // increase volume until it's a valid increment of KMPXLargeVolumeIncrement + iProperties[EPbPropertyVolume]++; + } + } + break; + } + } + + MPX_DEBUG1("CMPXPlaybackEngine::SetVolumeIncrement() exiting"); + } + +// ---------------------------------------------------------------------------- +// Marks the current item as corrupted +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::MarkItemCorrupted( const TBool aCorrupted ) + { + MPX_DEBUG2("CMPXPlaybackEngine::MarkItemCorrupted(%d) entering", aCorrupted); + + TRAP_IGNORE( SetFlagBitsL( aCorrupted, KMPXMediaGeneralFlagsIsCorrupted )); + + MPX_DEBUG1("CMPXPlaybackEngine::MarkItemCorrupted() exiting"); + } + +// ---------------------------------------------------------------------------- +// Marks the current item as invalid +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::MarkItemInvalid( const TBool aInvalid ) + { + MPX_DEBUG2("CMPXPlaybackEngine::MarkItemInvalid(%d) entering", aInvalid); + + TRAP_IGNORE( SetFlagBitsL( aInvalid, KMPXMediaGeneralFlagsIsInvalid )); + + MPX_DEBUG1("CMPXPlaybackEngine::MarkItemInvalid() exiting"); + } + +// ---------------------------------------------------------------------------- +// Marks the current item as DRM invalid +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::MarkItemDrmInvalid( const TBool aDrmInvalid ) + { + MPX_DEBUG2("CMPXPlaybackEngine::MarkItemDrmInvalid(%d) entering", aDrmInvalid); + + TRAP_IGNORE( SetFlagBitsL( aDrmInvalid, KMPXMediaGeneralFlagsIsDrmLicenceInvalid )); + + MPX_DEBUG1("CMPXPlaybackEngine::MarkItemDrmInvalid() exiting"); + } + +// ---------------------------------------------------------------------------- +// Sets flag bits +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::SetFlagBitsL( + const TBool aSet, + const TUint aFlag ) + { + MPX_DEBUG3("CMPXPlaybackEngine::SetFlagBitsL(%d, %d) entering", aSet, aFlag); + + if ( iPlaylist) + { + if (iPlaylist->Count() && !iPlaylist->EmbeddedPlaylist()) + { + CMPXMedia* media( CreateMediaToSetLC( iPlaylist->Path() )); + + // Set flag + TUint flag( 0 ); + if ( aSet ) + { + flag = KMPXMediaGeneralFlagsSetOrUnsetBit; + } + flag |= aFlag; + media->SetTObjectValueL( KMPXMediaGeneralFlags, + flag ); + iPlaylist->SetL( *media ); + CleanupStack::PopAndDestroy( media ); + } + } + + MPX_DEBUG1("CMPXPlaybackEngine::SetFlagBitsL() exiting"); + } + +// ---------------------------------------------------------------------------- +// Creates a CMPXMedia object to be used to Set attributes +// ---------------------------------------------------------------------------- +// +CMPXMedia* CMPXPlaybackEngine::CreateMediaToSetLC( const CMPXCollectionPath& aPath ) + { + MPX_DEBUG1("-->CMPXPlaybackEngine::CreateMediaToSetLC()"); + + // Create new Media object to set + CMPXMedia* media = CMPXMedia::NewL(); + CleanupStack::PushL(media); + media->SetTObjectValueL( KMPXMediaGeneralType, + EMPXItem ); + media->SetTObjectValueL( KMPXMediaGeneralCategory, + EMPXSong ); + media->SetTObjectValueL( KMPXMediaGeneralCollectionId, + aPath.Id( CMPXCollectionPath::ECollectionUid )); + + if (iItemId != KMPXInvalidItemId) + { + media->SetTObjectValueL(KMPXMediaGeneralId, iItemId); + } + else if (iUri) + { + media->SetTextValueL( KMPXMediaGeneralUri, *iUri); + } + else + { + media->SetTObjectValueL( KMPXMediaGeneralId , aPath.Id() ); + } + MPX_DEBUG1("<--CMPXPlaybackEngine::CreateMediaToSetLC()"); + return media; + } + +// ---------------------------------------------------------------------------- +// Sends a request to iMediaHelper to request media +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::RequestMediaL() + { + MPX_FUNC( "CMPXPlaybackEngine::RequestMediaL" ); + CMPXCommand* cmd = CMPXCommand::NewL(); + CleanupStack::PushL( cmd ); + cmd->SetTObjectValueL(KMPXCommandGeneralId, KMPXCommandContentIdMedia); + CBufBase* buf = CBufFlat::NewL( KMPXBufGranularity ); + CleanupStack::PushL( buf ); + + // Setup array buffer + RArray attrs; + CleanupClosePushL( attrs ); + attrs.AppendL( KMPXMediaGeneralBasic ); + attrs.AppendL( KMPXMediaGeneralUri ); + attrs.AppendL( KMPXMediaMusicAlbumArtFileName ); + attrs.AppendL( KMPXMediaMusicArtist ); + attrs.AppendL( KMPXMediaMusicAlbum ); + + RBufWriteStream writeStream( *buf ); + CleanupClosePushL( writeStream ); + // externalize attributes array + ::ExternalizeL(attrs.Array(), writeStream); + // Close and compress buffer + writeStream.CommitL(); + buf->Compress(); + CleanupStack::PopAndDestroy( &writeStream ); + CleanupStack::PopAndDestroy( &attrs ); + TPtrC ptr = MPXUser::Ptr( buf->Ptr( 0 ) ); + cmd->SetTextValueL( KMPXCommandMediaAttribute, ptr ); + + CMPXAttributeSpecs* attrSpecs = CMPXAttributeSpecs::NewL(); + CleanupStack::PushL(attrSpecs); + cmd->SetCObjectValueL( + KMPXCommandMediaAttributeSpecs, attrSpecs ); + CleanupStack::PopAndDestroy(attrSpecs); + + iMediaHelper->MediaL( iPlaylist->Path(), cmd, NULL, ETrue, iClientList ); + CleanupStack::PopAndDestroy( buf ); + // Onwership of media is passed to mediahelper class + CleanupStack::Pop( cmd ); + } + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API +// ---------------------------------------------------------------------------- +// Initialises from file. +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaybackEngine::Init64L(const RFile64& aFile) + { + MPX_FUNC_EX("CMPXPlaybackEngine::Init64L(const RFile64& aFile)"); + iPluginUid = KNullUid; // Reset plugin uid for current item + iInitNext=EFalse; + HandleCloseL(); + iPlaySource=EPlayFromFile64; + iNextState=EPbStateNotInitialised; + iFile64.Duplicate(aFile); + TRAPD( err, Init64L(&iFile64) ); + if ( KErrNotFound == err ) + { + // Mark item as Invalid + MarkItemInvalid( ETrue ); + User::Leave( err ); + } + } + +// ---------------------------------------------------------------------------- +// Initialises from file. +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaybackEngine::InitStreaming64L(const RFile64& aFile, const TInt aAccessPoint) + { + MPX_FUNC_EX("CMPXPlaybackEngine::InitStreaming64L(const RFile64& aFile, const TInt aAccessPoint)"); + iPluginUid = KNullUid; // Reset plugin uid for current item + iInitNext=EFalse; + HandleCloseL(); + iPlaySource=EPlayFromFile64; + iNextState=EPbStateNotInitialised; + iFile64.Duplicate(aFile); + iAccessPoint = aAccessPoint; + iAccessPointSet = ETrue; + TRAPD( err, Init64L(&iFile64,aAccessPoint)); + if ( KErrNotFound == err ) + { + // Mark item as Invalid + MarkItemInvalid( ETrue ); + User::Leave( err ); + } + } + +// ---------------------------------------------------------------------------- +// Initialise helper method +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackEngine::Init64L(RFile64* aFile, TInt aAccessPoint) + { + MPX_FUNC_EX("CMPXPlaybackEngine::Init64L(RFile64* aFile,TInt aAccessPoint)"); + CMPXPlaybackPlugin* p( NULL ); + if ( iPluginHandler->Plugin() ) + { + TRAP_IGNORE(iPluginHandler->Plugin()->CommandL(EPbCmdClose)); + } + + if (aFile) + { + iPluginHandler->SelectPlayer64L(*aFile); + } + else + { // should never happen + ASSERT(0); + } + + p=iPluginHandler->Plugin(); + CheckPtrL(p); + + if (p->Uid()!=iPluginUid) + { // new plugin or new playlist + iPluginUid = p->Uid(); + iInitVolume = ETrue; + p->PropertyL( EPbPropertyVolume ); + iClientList->SendMsgL( + TMPXPlaybackMessage(TMPXPlaybackMessage::EPlayerChanged)); + } + // Stop and close opened file + TRAP_IGNORE(DoStopL(EFalse)); + TRAP_IGNORE(p->CommandL(EPbCmdClose)); + + // If playing from a playlist, send the index as a data + // parameter. This helps performance as the client + // doesn't need to request the index separately + TInt index( KErrNotFound ); + if ( EPlayFromCollection == iPlaySource ) + { + index = iPlaylist->Index(); + } + + TMPXPlaybackMessage msg( TMPXPlaybackMessage::EStateChanged, + EPbStateInitialising, + index ); + SetStateL( msg ); + iProperties[EPbPropertyPosition]=0; + + // Check if version2 interface is supported. + CDesCArray* interfaces = iPluginHandler->SupportedInterfacesL( p->Uid() ); + TBool version2InterfaceSupported = EFalse; + if (interfaces->MdcaCount()) + { + TInt pos(0); + version2InterfaceSupported = !interfaces->FindIsq(KMPXPlaybackPluginVersion2, pos); + } + delete interfaces; + + // cast the plugin to use our interface + if (version2InterfaceSupported) + { + CMPXPlaybackPluginVersion2* plugin = NULL; + plugin = static_cast(p); + + // if cast was successful, then init streaming with access point + if (plugin) + { + if ( iAccessPointSet ) + { + plugin->InitStreaming64L( *aFile, aAccessPoint ); + } + else + { + plugin->Initialise64L( *aFile ); + } + } + else + { + MPX_DEBUG1("CMPXPlaybackEngine::Init64L(): -- failure to convert to expected interface"); + } + } + else + { + MPX_DEBUG1("CMPXPlaybackEngine::Init64L(): expected interface not supported"); + User::Leave( KErrNotFound ); + } + } +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/src/mpxplaybackinitializer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/src/mpxplaybackinitializer.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,892 @@ +/* +* Copyright (c) 2006 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: Initialize a file before playback +* +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mpxplaybackinitializer.h" +#include "mpxplaybackpluginhandler.h" +#include "mpxplaybackengine.h" +#include "mpxplaybackmediahelper.h" + +const TInt KMPXInitTimer = 3000000; // 3 seconds + +// ---------------------------------------------------------------------------- +// CMPXPlaybackInitializer* NewL +// ---------------------------------------------------------------------------- +// +CMPXPlaybackInitializer* CMPXPlaybackInitializer::NewL( + CMPXPlaybackEngine& aEngine, + CMPXPlaybackMediaHelper& aMediaHelper ) + { + CMPXPlaybackInitializer* self = new (ELeave) + CMPXPlaybackInitializer( aEngine, aMediaHelper ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ---------------------------------------------------------------------------- +// Constructor +// ---------------------------------------------------------------------------- +// +CMPXPlaybackInitializer::CMPXPlaybackInitializer( + CMPXPlaybackEngine& aEngine, + CMPXPlaybackMediaHelper& aMediaHelper ) + : iState( EPbStateNotInitialised ), + iEngine( aEngine ), + iMediaHelper( aMediaHelper ) + { + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackInitializer::ConstructL +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackInitializer::ConstructL() + { + iMedia = CMPXMedia::NewL(); + iTimer = CPeriodic::NewL( CActive::EPriorityIdle ); + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CMPXPlaybackInitializer::~CMPXPlaybackInitializer() + { + delete iMedia; + delete iMediaMessage; + Close(); + CancelPreInitTimer(); + delete iTimer; + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackInitializer::Init +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackInitializer::Init( CMPXCollectionPlaylist& aPlaylist ) + { + MPX_FUNC_EX("CMPXPlaybackInitializer::Init aPlaylist"); + + // Check if we already initialized the song in this playlist, + // if so then do nothing + if ( !IsInitializing( aPlaylist )) + { + Reset(); // clean up all resources (start again) + delete iHandler; + iHandler = NULL; + + // Save the path index and count. This is just in case the + // engine calls InitL() again before we make a call to + // Request media, because these are used to check if we're + // initializing the same song in the IsInitializing() method. + iPathIndex = aPlaylist.Path().Index(); + iInitPlaylistCount = iEngine.iPlaylist->Count(); + } + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackInitializer::Next +// Advance the playlist and start initializing (return ETrue) or if there's +// no next song, does nothing (return EFalse) +// ---------------------------------------------------------------------------- +// +TBool CMPXPlaybackInitializer::Next() + { + MPX_FUNC("CMPXPlaybackInitializer::Next"); + + ASSERT( iEngine.iPlaylist ); + + TInt nextPlIndex( KErrNotFound ); + TBool playNext( iEngine.iPlaylist->NextIndex( EFalse, nextPlIndex )); + Reset(); // Reset state + + // Only pre-init if there is a next song + if ( playNext ) + { + MPX_DEBUG1("CMPXPlaybackInitializer::Next(): Starting timer"); + iPathIndex = iEngine.iPlaylist->PathIndex( nextPlIndex ); + iInitPlaylistCount = iEngine.iPlaylist->Count(); + CancelPreInitTimer(); + // Start timer + iTimer->Start( + KMPXInitTimer, + KMPXInitTimer, + TCallBack(PreInitTimerCallback, this )); + } + return playNext; + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackInitializer::SetActiveL. Swaps the item being handled in the +// initializer to the engine, which takes over in whatever state it currently +// is in +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackInitializer::SetActiveL() + { + ASSERT(iEngine.iPlaylist); + MPX_DEBUG3("-->CMPXPlaybackInitializer::SetActiveL state %d, error %d", + iState, iError); + CancelPreInitTimer(); + switch(iState) + { + case EPbStateNotInitialised: + // + // From NewL()/InitL()/NextL()/PreviousL() + // up until the requested media URI is returned. + // Need to swap the playlist only (no plugin has + // yet been resolved + // + { + if (iEngine.iPlaylist) + { + // + // Get the URI from the collection - the callback triggers + // the initialization + // + RequestMediaL(); + UpdateMediaForwarding(); + } + break; + } + + case EPbStateInitialising: + // + // From NewL()/InitL()/NextL()/PreviousL() up + // until the URI has been returned, plug-in is + // being intialized OR an error has been returned + // from playlist + // + { + UpdateMediaForwarding(); + SwapUriL(); + SwapFlag(); + if (iError==KErrNone) + // + // Plug-in must be initialising + // + { + SwapPluginL(); + } + else + { + // + // Hasn't got as far as initialising a plug-in + // + iEngine.HandleCollectionMediaL(*iMedia,iError); + } + break; + } + + case EPbStateStopped: + // + // From NewL()/InitL()/NextL()/PreviousL() up + // until the plug-in has been initialised, either + // successfully or with an error + // + { + UpdateMediaForwarding(); + SwapPluginL(); + SwapUriL(); + SwapFlag(); + if (iError==KErrNone) + { + iEngine.HandlePluginEvent(EPInitialised,iDuration,KErrNone); + } + else + { + iEngine.HandlePluginEvent(EPInitialised,0,iError); + } + break; + } + default: + ASSERT(0) ; + } + MPX_DEBUG1("<--CMPXPlaybackInitializer::SetActiveL"); + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackInitializer::Close. Resets and destroys all resources owned by +// initializer +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackInitializer::Close() + { + MPX_FUNC("CMPXPlaybackInitializer::Close"); + CancelPreInitTimer(); + Reset(); // must come after handler deletion + delete iHandler; + iHandler=NULL; + } + +// ---------------------------------------------------------------------------- +// Gets the current item id in use by the initializer +// ---------------------------------------------------------------------------- +// +TMPXItemId CMPXPlaybackInitializer::CurrentInitItemId() + { + TMPXItemId id( KMPXInvalidItemId ); + if( iState != EPbStateNotInitialised && iEngine.iPlaylist ) + { + id = iEngine.iPlaylist->Path().Id(); + } + return id; + } + +// ---------------------------------------------------------------------------- +// Implementation uid of the plugin for pre-initialzer +// ---------------------------------------------------------------------------- +// +TUid CMPXPlaybackInitializer::PluginUid() + { + TUid uid(KNullUid); + if (iHandler) + { + if (iHandler->Plugin()) + { + uid = iHandler->Plugin()->Uid(); + } + } + return uid; + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackInitializer::Reset. Resets such that next media can be initialised +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackInitializer::Reset() + { + MPX_FUNC("CMPXPlaybackInitializer::Reset"); + // + // Cancel any activity with current plug-in + // + if (iHandler) + { + if (iHandler->Plugin()) + { + TRAP_IGNORE(iHandler->Plugin()->CommandL(EPbCmdStop)); + TRAP_IGNORE(iHandler->Plugin()->CommandL(EPbCmdClose)); + } + } + // + // Reset data associated with previous initialization + // + iState = EPbStateNotInitialised; + iError = KErrNone; + iDuration = 0; + iPathIndex = KErrNotFound; + iInitPlaylistCount = 0; + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackInitializer::RequestMediaL +// Get the Media from the collection - the callback triggers +// the initialization +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackInitializer::RequestMediaL( ) + { + ASSERT(iEngine.iPlaylist); + + MPX_DEBUG3("-->CMPXPlaybackInitializer::RequestMediaL 0x%08x item index %d", + this, iEngine.iPlaylist->Index()); + // Reset media message + delete iMediaMessage; + iMediaMessage = NULL; + iErrorOfMediaMessage = KErrNone; + + // Setup attribute array + RArray attrs; + CleanupClosePushL(attrs); + attrs.Append(KMPXMediaGeneralId); + attrs.Append(KMPXMediaGeneralUri); + attrs.Append(KMPXMediaGeneralMimeType); + attrs.Append(KMPXMediaGeneralLastPlaybackPosition); + attrs.Append(KMPXMediaGeneralFlags); + attrs.Append(KMPXMediaGeneralDuration); + attrs.Append(KMPXMediaGeneralTitle); + attrs.Append( KMPXMediaMusicArtist ); + + // Create object to hold attributes and specs + CMPXCommand* cmd = CMPXCommand::NewL(); + CleanupStack::PushL( cmd ); + cmd->SetTObjectValueL(KMPXCommandGeneralId, KMPXCommandContentIdMedia); + CBufBase* buf = CBufFlat::NewL( KMPXBufGranularity ); + CleanupStack::PushL( buf ); + + RBufWriteStream writeStream( *buf ); + CleanupClosePushL( writeStream ); + // externalize attributes array + ::ExternalizeL(attrs.Array(), writeStream); + // Close and compress buffer + writeStream.CommitL(); + buf->Compress(); + CleanupStack::PopAndDestroy( &writeStream ); + TPtrC ptr( MPXUser::Ptr( buf->Ptr( 0 ))); + cmd->SetTextValueL( KMPXCommandMediaAttribute, ptr ); + + CMPXAttributeSpecs* attrSpecs( CMPXAttributeSpecs::NewL() ); + CleanupStack::PushL( attrSpecs ); + cmd->SetCObjectValueL( + KMPXCommandMediaAttributeSpecs, attrSpecs ); + CleanupStack::PopAndDestroy( attrSpecs ); + + // Instead of copying the whole path object, which may be large due + // to number of songs in the list, just get the container path and + // append the item ID to that. This saves memory and time. + const CMPXCollectionPath& path( iEngine.iPlaylist->Path() ); + CMPXCollectionPath* initPath( path.ContainerPathL() ); + CleanupStack::PushL( initPath ); + initPath->AppendL( path.IdOfIndex( iPathIndex ) ); + + iMediaHelper.MediaL( *initPath, + cmd, // ownership passed + this ); + CleanupStack::PopAndDestroy( initPath ); + CleanupStack::PopAndDestroy( buf ); + CleanupStack::Pop( cmd ); + CleanupStack::PopAndDestroy( &attrs ); + iMediaRequested = ETrue; + MPX_DEBUG2("<--CMPXPlaybackInitializer::RequestMediaL 0x%08x", this); + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackInitializer::UpdateMediaForwarding. Updates the forwarding variable +// to send the media to the engine if a media has been requested. +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackInitializer::UpdateMediaForwarding() + { + MPX_FUNC("CMPXPlaybackInitializer::UpdateMediaForwarding"); + + // Forward the media to the engine if it has been requested. + + // The difference between the iMediaToEngine and iMediaRequested flags, + // is that if the engine calls this method first (through SetActive()), + // but the media has not been requested yet, then we want to make sure + // in that case to not forward the subsequent media requests + iMediaToEngine = iMediaRequested ? ETrue : EFalse; + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackInitializer::SwapPluginL. Swaps the plugin being handled in the +// initializer to the engine, which takes over in whatever state it currently +// is in +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackInitializer::SwapPluginL() + { + MPX_DEBUG1("==>CMPXPlaybackInitializer::SwapPluginL"); + // unfinished business with old playback plug-in + if (iEngine.iPluginHandler->Plugin()) + { + iEngine.iPluginHandler->Plugin()->CancelRequest(); + } + TInt index( iEngine.iPlaylist->Index() ); + TMPXPlaybackMessage msg( TMPXPlaybackMessage::EStateChanged, + EPbStateInitialising, + index ); + iEngine.SetStateL( msg ); + TRAPD(err, iEngine.DoStopL()); + if (err) + { // play is not available. e.g. power off + MPX_DEBUG2("CMPXPlaybackInitializer::SwapPluginL stop leave %d", err); + iError = err; // save error + } + else + { + if ( iMedia ) + { + iEngine.RestorePlaybackPositionAndStateL( *iMedia ); + } + // + // Set plug-in handler + // + if ( iHandler ) + { + CMPXPlaybackPluginHandler*& h=iEngine.iPluginHandler; + delete h; // delete engine's handler + + // plug-in handler now reports to engine + iHandler->SetObserver(iEngine); + + if (iHandler->Plugin()) + { + iHandler->Plugin()->SetObserver(iEngine); + } + + h=iHandler; // replace engine's handler + iHandler=NULL; // reset handler in initializer + } + + if (iMediaMessage) + { + iEngine.HandlePlaybackMessage(iMediaMessage, iErrorOfMediaMessage); + } + } + MPX_DEBUG1("<==CMPXPlaybackInitializer::SwapPluginL"); + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackInitializer::SwapUriL. Swaps the item uri in the engine +// Only in the EPbStateInitialising and EPbStateStopped states +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackInitializer::SwapUriL() + { + // Update the engine's uri to the item that was in the initializer + // + delete iEngine.iUri ; + iEngine.iUri = NULL; + if ( iMedia->IsSupported( KMPXMediaGeneralUri )) + { + iEngine.iUri = iMedia->ValueText(KMPXMediaGeneralUri).AllocL(); + } + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackInitializer::SwapFlag. Swaps the item db flag in the engine +// Only in the EPbStateInitialising and EPbStateStopped states +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackInitializer::SwapFlag() + { + // Update the engine's flag to the item that was in the initializer + // + if ( iMedia->IsSupported( KMPXMediaGeneralFlags ) ) + { + iEngine.iDbFlag = iMedia->ValueTObjectL( KMPXMediaGeneralFlags ); + } + else // not supported, reset to 0 + { + iEngine.iDbFlag = 0; + } + + // Also swap item id + if ( iMedia->IsSupported( KMPXMediaGeneralId )) + { + iEngine.iItemId = iMedia->ValueTObjectL( KMPXMediaGeneralId ); + } + else + { + iEngine.iItemId = KMPXInvalidItemId; + } + + // Also swap duration value + if ( iMedia->IsSupported( KMPXMediaGeneralDuration )) + { + iEngine.iMediaDuration = iMedia->ValueTObjectL( KMPXMediaGeneralDuration ); + } + else + { + iEngine.iMediaDuration = 0; + } + iEngine.iAccessPointSet = EFalse; + if ( iMedia->IsSupported(KMPXMediaGeneralExtAccessPoint) ) + { + TInt accessPoint = iMedia->ValueTObjectL( KMPXMediaGeneralExtAccessPoint ); + iEngine.iAccessPoint = accessPoint; + if ( accessPoint ) + { + iEngine.iAccessPointSet = ETrue; + } + } + else + { + iEngine.iAccessPoint = 0; + } + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackInitializer::IsInitializing +// ---------------------------------------------------------------------------- +// +TBool CMPXPlaybackInitializer::IsInitializing( + const CMPXCollectionPlaylist& aPlaylist) + { + MPX_FUNC("CMPXPlaybackInitializer::IsInitializing aPlaylist"); + TBool ret=ETrue; + + if ( !iEngine.iPlaylist ) + { + ret=EFalse; + } + else if ( iPathIndex != aPlaylist.Path().Index() || + iInitPlaylistCount != aPlaylist.Count() || + aPlaylist.Levels() == 0 ) + { + ret=EFalse; + } + else if ( iHandler ) + // + // Check that PI obeys the same selection criteria as that of the + // engine, else we may have the wrong plug-in + // + { + if (iHandler->Plugin()) + { + TMPXPlaybackPlayerType t1; + TUid u1; + TInt i1; + TPtrC n1; + iHandler->GetSelection(t1,u1,i1,n1); + + TMPXPlaybackPlayerType t2; + TUid u2; + TInt i2; + TPtrC n2; + iEngine.iPluginHandler->GetSelection(t2,u2,i2,n2); + + ret=(t1==t2 && u1==u2 && i1==i2); + } + } + + MPX_DEBUG3("CMPXPlaybackInitializer::IsInitializing plugin=%08x, ret=%d", + iHandler ? iHandler->Plugin() : NULL, ret); + return ret; + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackInitializer::InitL +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackInitializer::InitL(const CMPXMedia& aMedia,TInt aError) + { + MPX_FUNC("CMPXPlaybackInitializer::InitL(const CMPXMedia& aMedia,TInt aError)"); + iState=EPbStateInitialising; + if (aError==KErrNone) + { + *iMedia = aMedia; // Copy and save media(Uri) from collection + + // + // No error, get the URI + // + const TDesC& uri=aMedia.ValueText(KMPXMediaGeneralUri); + if (uri.Length()) + { + // + // Got the URI, so get a plug-in and go + // + if (!iHandler) + { + iHandler=CMPXPlaybackPluginHandler::NewL(iEngine.iPluginMonitor, + *this, *this); + // arg=plug-in observer + // + // Copy selection criteria + // + TMPXPlaybackPlayerType t; + TUid u; + TInt i; + TPtrC n; + iEngine.iPluginHandler->GetSelection(t,u,i,n); + + if (i!=KErrNotFound) + { + iHandler->SelectSubPlayerL(u,i); + } + else if (u!=KNullUid) + { + iHandler->SelectPlayerL(u); + } + else + { + iHandler->SelectPlayersL(t); + } + } + TInt accessPoint = 0; + if ( aMedia.IsSupported(KMPXMediaGeneralExtAccessPoint) ) + { + accessPoint = aMedia.ValueTObjectL( KMPXMediaGeneralExtAccessPoint ); + MPX_DEBUG2("CMPXPlaybackInitializer::InitL accessPoint %d", accessPoint ); + } + HBufC8* mimeType = + MPXUser::Alloc8L(aMedia.ValueText(KMPXMediaGeneralMimeType)); + CleanupStack::PushL(mimeType); + iHandler->SelectPlayerL(uri,*mimeType); + MPX_DEBUG2("CMPXPlaybackInitializer::InitL plugin=%08x",iHandler->Plugin()); + // Plugin handler guarantee to choose a plugin + // In case there is file open in the audio controller + iHandler->Plugin()->CommandL(EPbCmdClose); + InitL(uri, *mimeType, accessPoint); + CleanupStack::PopAndDestroy(mimeType); + } + else // No URI + { + iError=KErrNotFound; + } + } + else // aError not equal to KErrNone + { + iError=aError; + + // Reset media since if there's an error, the media + // object passed in is unreliable + delete iMedia; + iMedia = NULL; + iMedia = CMPXMedia::NewL(); + } + } + +// ---------------------------------------------------------------------------- +// Cancels the pre-init timer +// ---------------------------------------------------------------------------- +void CMPXPlaybackInitializer::CancelPreInitTimer() + { + MPX_FUNC("CMPXPlaybackInitializer::CancelPreInitTimer()"); + if ( iTimer && iTimer->IsActive() ) + { + MPX_DEBUG1("CMPXPlaybackInitializer::CancelPreInitTimer(): Timer active, cancelling"); + iTimer->Cancel(); + } + } + +// ---------------------------------------------------------------------------- +// Handle pre-init timer callback +// ---------------------------------------------------------------------------- +void CMPXPlaybackInitializer::HandlePreInitTimerCallback() + { + MPX_FUNC("CMPXPlaybackInitializer::HandlePreInitTimerCallback()"); + + CancelPreInitTimer(); + + TRAP_IGNORE(RequestMediaL()); + } + +// ---------------------------------------------------------------------------- +// Callback for pre-init timer. +// ---------------------------------------------------------------------------- +TInt CMPXPlaybackInitializer::PreInitTimerCallback(TAny* aPtr) + { + MPX_FUNC("CMPXPlaybackInitializer::PreInitTimerCallback()"); + + CMPXPlaybackInitializer* ptr = + static_cast(aPtr); + ptr->HandlePreInitTimerCallback(); + + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackInitializer::HandlePluginEventL. Must be non leaving since client has +// no context as this is a callback +// ---------------------------------------------------------------------------- + +void CMPXPlaybackInitializer::HandlePluginEvent( + TEvent aEvent,TInt aData,TInt aError) + { + TRAP_IGNORE( HandlePluginEventL( aEvent, aData, aError ) ); + } + +// ---------------------------------------------------------------------------- +// Leaving version of CMPXPlaybackInitializer::HandlePluginEvent +// ---------------------------------------------------------------------------- +void CMPXPlaybackInitializer::HandlePluginEventL( + TEvent aEvent,TInt aData,TInt aError) + { + MPX_DEBUG3("CMPXPlaybackInitializer::HandlePluginEventL %d, error %d", + aEvent, aError); + if (aEvent==EPInitialised) + { + if (aError!=KErrNone) + { + iError=aError; + } + else + { + iDuration=aData; + if ( iMedia->IsSupported( KMPXMediaGeneralDuration )) + { + TInt dur( iMedia->ValueTObjectL( KMPXMediaGeneralDuration )); + if ( dur != iDuration ) + { + // Set duration if it's different than what collection has + if ( iEngine.iPlaylist ) + { + if ( iEngine.iPlaylist->Count() && !iEngine.iPlaylist->EmbeddedPlaylist() ) + { + const CMPXCollectionPath& path( iEngine.iPlaylist->Path() ); + CMPXMedia* media = CMPXMedia::NewL(); + CleanupStack::PushL(media); + media->SetTObjectValueL( KMPXMediaGeneralType, + EMPXItem ); + media->SetTObjectValueL( KMPXMediaGeneralCategory, + EMPXSong ); + media->SetTObjectValueL( KMPXMediaGeneralCollectionId, + path.Id( + CMPXCollectionPath::ECollectionUid )); + media->SetTObjectValueL( + KMPXMediaGeneralId, + iMedia->ValueTObjectL( KMPXMediaGeneralId ) ); + media->SetTObjectValueL( KMPXMediaGeneralDuration, + iDuration ); + iEngine.iPlaylist->SetL( *media ); + CleanupStack::PopAndDestroy( media ); + } + } + } + } + } + iState=EPbStateStopped; + } + } + +// ---------------------------------------------------------------------------- +// Callback from plug-in, handle plugin message +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackInitializer::HandlePlaybackMessage( + CMPXMessage* aMsg, + TInt aErr) + { + // Save the media update message + TRAP_IGNORE(iMediaMessage = CMPXMessage::NewL(*aMsg)); + iErrorOfMediaMessage = aErr; + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackInitializer::HandleProperty +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackInitializer::HandleProperty( + TMPXPlaybackProperty /*aProperty*/, + TInt /*aValue*/, + TInt /*aError*/) + { + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackInitializer::HandleSubPlayerNames +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackInitializer::HandleSubPlayerNames( + TUid /*aPlayer*/, + const MDesCArray* /*aSubPlayers*/, + TBool /*aComplete*/, + TInt /*aError*/) + { + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackInitializer::HandleMedia +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackInitializer::HandleMedia( + const CMPXMedia& aMedia, + TInt aError) + { + MPX_FUNC("CMPXPlaybackInitializer::HandleMedia()"); + + iMediaRequested = EFalse; + if ( iMediaToEngine ) + { + TRAP_IGNORE( iEngine.HandleCollectionMediaL( aMedia,iError) ); + iMediaToEngine = EFalse; + } + else + { + TRAPD( err, InitL( aMedia,aError )); + if ( err ) + { // Set the error so that not switch to un-initialized plugin + MPX_DEBUG2("CMPXPlaybackInitializer::HandleMedia TRAP InitL %d", + err); + iError = err; // reset error code to new error + } + } + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackInitializer::HandlePluginHandlerEvent +// Rely on the playback engine to handle the plugin handler events. +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackInitializer::HandlePluginHandlerEvent( + TPluginHandlerEvents /* aEvent */, + const TUid& /* aPluginUid */, + TBool /* aLoaded */, + TInt /* aData */) + { + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackInitializer::InitL +// Initialize. +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackInitializer::InitL(const TDesC& aUri, const TDesC8& aType, TInt aAccessPoint) + { + MPX_FUNC("CMPXPlaybackInitializer::InitL"); + CMPXPlaybackPlugin* p = iHandler->Plugin(); + if ( !p ) + { + MPX_DEBUG1("CMPXPlaybackInitializer::InitL(): *** Init failed -- No plugin selected"); + return; + } + + // Check if version2 interface is supported + CDesCArray* interfaces = iHandler->SupportedInterfacesL( p->Uid() ); + TBool version2InterfaceSupported = EFalse; + if (interfaces->MdcaCount()) + { + TInt pos(0); + version2InterfaceSupported = !interfaces->FindIsq(KMPXPlaybackPluginVersion2, pos); + } + delete interfaces; + + if (version2InterfaceSupported) + { + // cast the plugin to use our interface + CMPXPlaybackPluginVersion2* plugin = NULL; + plugin = static_cast(p); + + // if cast was successful, then init streaming with access point + if (plugin) + { + if ( aAccessPoint ) + { + plugin->InitStreamingL( aUri, aType, aAccessPoint ); + } + else + { + plugin->InitialiseL(aUri); + } + } + else + { + MPX_DEBUG1("CMPXPlaybackInitializer::InitL(): *** Init failed -- failure to convert to expected interface"); + } + } + else + { + p->InitialiseL(aUri); + } + } + +// end of file diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/src/mpxplaybackmediahelper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/src/mpxplaybackmediahelper.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,363 @@ +/* +* Copyright (c) 2006 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: Implementation of playback engine media helper +* +*/ + + +#include +#include +#include +#include +#include "mpxplaybackengine.h" +#include "mpxplaybackmediahelper.h" + +// CONSTANTS +const TInt KTaskMediaWithAttributeSpec = 0; + +// ---------------------------------------------------------------------------- +// Two-phased constructor +// ---------------------------------------------------------------------------- +// +CMPXPlaybackMediaHelper* CMPXPlaybackMediaHelper::NewL( + CMPXPlaybackEngine& aEngine ) + { + CMPXPlaybackMediaHelper* p= new (ELeave) CMPXPlaybackMediaHelper( aEngine ); + CleanupStack::PushL(p); + p->ConstructL(); + CleanupStack::Pop(p); + return p; + } + +// ---------------------------------------------------------------------------- +// Constructor. +// ---------------------------------------------------------------------------- +// +CMPXPlaybackMediaHelper::CMPXPlaybackMediaHelper( + CMPXPlaybackEngine& aEngine ) + : iEngine( aEngine ) + { + } + +// ---------------------------------------------------------------------------- +// 2nd phase constructor. +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackMediaHelper::ConstructL() + { + iCollectionUtility = MMPXCollectionUtility::NewL( this ); + +#ifdef __USE_MESSAGE_SUBSCRIPTION + // This class does not care about collection messages + iCollectionUtility->Collection().ClearSubscriptionsL(); +#endif + iTaskQueue = CMPXActiveTaskQueue::NewL(); + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CMPXPlaybackMediaHelper::~CMPXPlaybackMediaHelper() + { + if ( iCollectionUtility ) + { + iCollectionUtility->Close(); + } + if ( iTaskQueue ) + { + iTaskQueue->CancelRequests(); + delete iTaskQueue; + } + } + +// ---------------------------------------------------------------------------- +// Retrieves the media given the current path, and upon return, +// either calls back the observer, or broadcasts the message to +// the given client list +// ---------------------------------------------------------------------------- +void CMPXPlaybackMediaHelper::MediaL( + const CMPXCollectionPath& aPath, + CMPXCommand* aCmd, + MMPXPlaybackEngineObserver* aObserver, + TBool aBroadcast /*= EFalse */, + CMPXClientList* aClientList /*= NULL */ ) + { + MPX_DEBUG1("CMPXPlaybackMediaHelper::MediaL(): Entering"); + + CMPXCollectionPath* path( CMPXCollectionPath::NewL( aPath ) ); + CleanupStack::PushL( path ); + CleanupStack::PushL( aCmd ); + + if ( aBroadcast ) + { + iTaskQueue->AddTaskL( KTaskMediaWithAttributeSpec, + aClientList, + this, + ETrue, + NULL, + NULL, + path, + aCmd ); + } + else + { + iTaskQueue->AddTaskL( KTaskMediaWithAttributeSpec, + aObserver, + this, + EFalse, + NULL, + NULL, + path, + aCmd ); + } + // Ownership of aAttrs and path passed to the task queue + CleanupStack::Pop( aCmd ); + CleanupStack::Pop( path ); + + MPX_DEBUG1("CMPXPlaybackMediaHelper::MediaL(): Exiting"); + } + +// ---------------------------------------------------------------------------- +// Cancels all outstanding requests +// ---------------------------------------------------------------------------- +void CMPXPlaybackMediaHelper::CancelRequests() + { + MPX_FUNC_EX("CMPXPlaybackMediaHelper::CancelRequests()"); + if ( iCollectionUtility ) + { + iCollectionUtility->Collection().CancelRequest(); + } + if ( iTaskQueue ) + { + iTaskQueue->CancelRequests(); + } + } + +// ---------------------------------------------------------------------------- +// From MMPXTaskQueueObserver +// Executes task +// ---------------------------------------------------------------------------- +void CMPXPlaybackMediaHelper::ExecuteTask( + TInt aTask, + TInt aParamData, + TAny* aPtrData, + const CBufBase& aBuf, + TAny* aCallback, + CBase* aCObject1, + CBase* aCObject2) + { + MPX_DEBUG1("CMPXPlaybackMediaHelper::ExecuteTask(): Entering"); + + TRAPD( err, DoExecuteTaskL( aTask, aParamData, aPtrData, + aBuf, aCallback, aCObject1, aCObject2 )); + if ( KErrNone != err ) + { + TRAP_IGNORE( + CMPXMedia* dummy( CMPXMedia::NewL() ); + CleanupStack::PushL( dummy ); + HandleCollectionMediaL( *dummy, err ); + CleanupStack::PopAndDestroy( dummy ); + ) + } + + MPX_DEBUG1("CMPXPlaybackMediaHelper::ExecuteTask(): Exiting"); + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackMediaHelper::HandleTaskError +// ---------------------------------------------------------------------------- +void CMPXPlaybackMediaHelper::HandleTaskError( + TInt /* aTask */, + TAny* /*aPtrData*/, + TAny* /*aCallback*/, + TInt /* aError */) + { + // do nothing, queued tasks are not canceled + } + +// ---------------------------------------------------------------------------- +// From MMPXCollectionObserver +// ---------------------------------------------------------------------------- +void CMPXPlaybackMediaHelper::HandleCollectionMessage( + CMPXMessage* /*aMsg*/, + TInt /*aErr*/) + { + MPX_DEBUG1("CMPXPlaybackMediaHelper::HandleCollectionMessageL(CMPXMessage): Entering"); + MPX_DEBUG1("CMPXPlaybackMediaHelper::HandleCollectionMessageL(CMPXMessage): Exiting"); + } + +// ---------------------------------------------------------------------------- +// From MMPXCollectionObserver +// ---------------------------------------------------------------------------- +void CMPXPlaybackMediaHelper::HandleOpenL( + const CMPXMedia& /*aEntries*/, + TInt /*aIndex*/, + TBool /*aComplete*/, + TInt /*aError*/ ) + { + MPX_DEBUG1("CMPXPlaybackMediaHelper::HandleOpenL(): Entering"); + MPX_DEBUG1("CMPXPlaybackMediaHelper::HandleOpenL(): Exiting"); + } + +// ---------------------------------------------------------------------------- +// From MMPXCollectionObserver +// ---------------------------------------------------------------------------- +void CMPXPlaybackMediaHelper::HandleOpenL( + const CMPXCollectionPlaylist& /*aPlaylist*/, + TInt /*aError*/ ) + { + MPX_DEBUG1("CMPXPlaybackMediaHelper::HandleOpenL(): Entering"); + MPX_DEBUG1("CMPXPlaybackMediaHelper::HandleOpenL(): Exiting"); + } + +// ---------------------------------------------------------------------------- +// From MMPXCollectionObserver +// ---------------------------------------------------------------------------- +void CMPXPlaybackMediaHelper::HandleCommandComplete( + CMPXCommand* /*aCommandResult*/, + TInt /*aError*/ ) + { + MPX_DEBUG1("CMPXPlaybackMediaHelper::HandleCommandComplete(): Entering"); + MPX_DEBUG1("CMPXPlaybackMediaHelper::HandleCommandComplete(): Exiting"); + } + +// ---------------------------------------------------------------------------- +// From MMPXCollectionmediaObserver +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackMediaHelper::HandleCollectionMediaL( + const CMPXMedia& aMedia, + TInt aError ) + { + MPX_FUNC_EX("CMPXPlaybackMediaHelper::HandleCollectionMediaL"); + MPX_DEBUG2("CMPXPlaybackMediaHelper::HandleCollectionMediaL(): error %d", aError); + + // First check if media attributes supported, if not, need to retrieve + // from playback plugin + TBool mediaOk( ETrue ); + // Note: The following block is for uPnP remote playlist which does not contain + // metadata in the remote playlist. However, uPnP update to gurantee that titles + // are available in the collection plugin. If KMPXMediaColDetailMediaNotAvailable + // returned, UI can at least update title anyway anyway. + // + // We could not call MediaFromPluginL before the plugin initiliazed. uPnP made + // changes so that it will call back media after the new track is initialized. + // So we don't need call plugin API MediaL. + /*if ( KErrNone == aError ) + { // media object is ok + if ( aMedia.IsSupported( KMPXMediaColDetailMediaNotAvailable )) + { + TBool mediaNotSupported( + aMedia.ValueTObjectL( KMPXMediaColDetailMediaNotAvailable )); + MPX_DEBUG2("HandleCollectionMediaL media not inCollection %d", + mediaNotSupported); + if ( mediaNotSupported) + { // It must be uPnP remote playlist, media request can only be + // sent to plugin at initialising, playing & pause state + mediaOk = EFalse; + // need to create a copy of buf since that will be delete when + // this task is completed + const TDesC8& data( iTaskQueue->BufData() ); + CBufBase* buf( MPXUser::CreateBufferLC( data.Size() )); + buf->Write( 0, data ); + iEngine.MediaFromPluginL( + static_cast( + iTaskQueue->Callback() ), + buf ); + CleanupStack::Pop( buf ); + } //otherwise, just send uri to clients. + } + }*/ + + if ( mediaOk || aError ) + { + MPX_DEBUG2("CMPXPlaybackMediaHelper::HandleCollectionMediaL task %d", + iTaskQueue->Task()); + + if ( iTaskQueue->Param() ) + { + // Broadcast + CMPXMessage* msg( CMPXMessage::NewL() ); + CleanupStack::PushL( msg ); + msg->SetTObjectValueL( KMPXMessageGeneralId, + KMPXMessagePbMediaChanged ); + msg->SetCObjectValueL( KMPXMessagePbMedia, + const_cast( &aMedia )); + CMPXClientList* clientList( + static_cast( iTaskQueue->Callback() )); + clientList->SendMsg(msg, KErrNone); + CleanupStack::PopAndDestroy( msg ); + } + else + { + // Callback + MPX_DEBUG2("CMPXPlaybackMediaHelper::HandleCollectionMediaL task cb 0x%08x", + iTaskQueue->Callback()); + MMPXPlaybackEngineObserver* callback( + static_cast( iTaskQueue->Callback() )); + callback->HandleMedia( aMedia, aError ); + } + } + MPX_DEBUG1("CMPXPlaybackMediaHelper::HandleCollectionMediaL complete task"); + iTaskQueue->CompleteTask(); + } + +// ---------------------------------------------------------------------------- +// Executes task, leaving method +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackMediaHelper::DoExecuteTaskL( + TInt aTask, + TInt /*aParamData*/, + TAny* /*aPtrData*/, + const CBufBase& /*aBuf*/, + TAny* /*aCallback*/, + CBase* aCObject1, + CBase* aCObject2) + { + MPX_DEBUG1("CMPXPlaybackMediaHelper::DoExcuteTaskL(): Entering"); + + if ( KTaskMediaWithAttributeSpec == aTask ) + { + CMPXCollectionPath* path( static_cast(aCObject1)); + CMPXMedia* media( static_cast(aCObject2)); + + CMPXAttributeSpecs* specs = + media->Value( KMPXCommandMediaAttributeSpecs ); + + const TDesC& attr = media->ValueText( KMPXCommandMediaAttribute ); + TPtrC8 ptr = MPXUser::Ptr( attr ); + RDesReadStream readStream( ptr ); + CleanupClosePushL( readStream ); + // Internalize attributes + RArray attrs; + CleanupClosePushL( attrs ); + ::InternalizeL( attrs, readStream ); + iCollectionUtility->Collection().MediaL(*path, + attrs.Array(), + specs ); + + CleanupStack::PopAndDestroy( &attrs ); + CleanupStack::PopAndDestroy( &readStream ); + } + else + { + iTaskQueue->CompleteTask(); + } + + MPX_DEBUG1("CMPXPlaybackMediaHelper::DoExcuteTaskL(): Exiting"); + } + +//End of file diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/src/mpxplaybackpluginhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/src/mpxplaybackpluginhandler.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,429 @@ +/* +* Copyright (c) 2006 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: Implements the playback plugin handler. +* +* There is just one plaback plugin loaded for each plugin handler / engine and +* whenever a new plugin is selected for the engine the old one is automatically +* unloaded. Different engines can load multiple instances of the same playback +* plugin, however there is no connection between these instances as they +* are tied to different songs. +* +* There is no point in applying the reference counting mechanism for playback. +* +* +*/ + + +#include +#include +#include +#include +#include "mpxplaybackplugininfo.h" +#include "mpxplaybackpluginhandler.h" + +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CMPXPlaybackPluginHandler* CMPXPlaybackPluginHandler::NewL( + CMPXPluginMonitor& aPluginMonitor, + MMPXPlaybackPluginObserver& aPluginObserver, + MMPXPluginHandlerObserver& aObserver) + { + CMPXPlaybackPluginHandler* p=new(ELeave)CMPXPlaybackPluginHandler( + aPluginMonitor, + aPluginObserver, + aObserver); + CleanupStack::PushL(p); + p->ConstructL(); + CleanupStack::Pop(p); + return p; + } + +// ---------------------------------------------------------------------------- +// Constructor. +// ---------------------------------------------------------------------------- +// +CMPXPlaybackPluginHandler::CMPXPlaybackPluginHandler( + CMPXPluginMonitor& aPluginMonitor, + MMPXPlaybackPluginObserver& aPluginObserver, + MMPXPluginHandlerObserver& aObserver) +: CMPXPluginHandlerBase(KMPXPlaybackInterfaceUid, + ESelectionType, + EPbLocal, + aObserver, + &aPluginMonitor), + iPluginObserver(&aPluginObserver), + iSelectedSubPlayerIndex(KErrNotFound) + { + } + +// ---------------------------------------------------------------------------- +// 2nd phase constructor. +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackPluginHandler::ConstructL() + { + BaseConstructL(); + } + +// ---------------------------------------------------------------------------- +// Destructor. +// ---------------------------------------------------------------------------- +// +CMPXPlaybackPluginHandler::~CMPXPlaybackPluginHandler() + { + MPX_FUNC_EX("CMPXPlaybackPluginHandler::Destructor"); + //close plugins + for (TInt i = iLoadedPlugins.Count(); --i >= 0;) + { + CMPXPlaybackPlugin* p=iLoadedPlugins[i]; + TRAP_IGNORE(p->CommandL(EPbCmdClose)); + } + iLoadedPlugins.ResetAndDestroy(); + iLoadedPluginsUids.Close(); + delete iDisplayName; + } + +// ---------------------------------------------------------------------------- +// Resolve a plugin to iPlugin, based on properties (iDataType, iExt and iScheme) +// and selection criteria. If selection is by type, then there is always a +// plug-in resolved (if there are any of that type). Room for optimisation. +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackPluginHandler::ResolvePluginL() + { + MPX_FUNC_EX("CMPXPlaybackPluginHandler::ResolvePluginL()"); + // + // Resolve plugin + // + TUid pluginUid( KNullUid ); + TInt index( KErrNotFound ); + TPtrC displayName; + TInt pluginType( EPbUnknown ); + + DoResolvePluginL(pluginUid, index, displayName, pluginType ); + + // + // Load resolved plug-in + // + CMPXPlaybackPlugin* p=CreatePlayerPluginL(pluginUid); + UsePlugin(pluginUid); + + MPX_DEBUG5("CMPXPlaybackPluginHandler::ResolvePluginL() p(%08x), iPlugin(%08x), pluginUid 0x%08x %S", + p, iPlugin, pluginUid.iUid, &displayName); + if (p!=iPlugin) + { + if (iPlugin) + { + UnloadPlugin(iPluginUid); + } + iPlugin=p; + iPluginUid=pluginUid; + + delete iDisplayName; + iDisplayName=NULL; + iDisplayName=displayName.AllocL(); + iPluginType=static_cast(pluginType); + } + + if (iSelectedSubPlayerIndex!=KErrNotFound) + { + iPlugin->SelectSubPlayerL(iSelectedSubPlayerIndex); + } + } + +// ---------------------------------------------------------------------------- +// Return a plugin with the specific id +// ---------------------------------------------------------------------------- +// +CMPXPlaybackPlugin* CMPXPlaybackPluginHandler::CreatePlayerPluginL( + const TUid& aUid) + { + MPX_DEBUG3("==>CMPXPlaybackPluginHandler::CreatePlayerPluginL 0x%08x (aUid 0x%08x)", + this, aUid.iUid); + CMPXPlaybackPlugin* p=NULL; + TInt i=iLoadedPluginsUids.Find(aUid); + if (i==KErrNotFound) + { + p=CMPXPlaybackPlugin::NewL(aUid,*iPluginObserver); + CleanupStack::PushL(p); + iLoadedPlugins.AppendL(p); + TInt err = iLoadedPluginsUids.Append(aUid); + if (err != KErrNone) // if the second append failed, it should revert the first append + { + iLoadedPlugins.Remove(iLoadedPlugins.Count()-1); + User::Leave(err); + } + CleanupStack::Pop(p); + } + else + { + p=iLoadedPlugins[i]; + } + MPX_DEBUG3("<==CMPXPlaybackPluginHandler::CreatePlayerPluginL 0x%08x (aUid 0x%08x)", + this, aUid.iUid); + return p; + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackPluginHandler::IsPluginLoaded +// ---------------------------------------------------------------------------- +// +TBool CMPXPlaybackPluginHandler::IsPluginLoaded( + const TUid& aPluginUid) + { + MPX_FUNC_EX("CMPXPlaybackPluginHandler::IsPluginLoaded"); + return (iLoadedPluginsUids.Find(aPluginUid) != KErrNotFound); + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackPluginHandler::LoadPluginL +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackPluginHandler::LoadPluginL( + const TUid& aPluginUid) + { + MPX_DEBUG2("===>CMPXPlaybackPluginHandler::LoadPluginL 0x%08x", this); + + if (iPlugin) + { + UnloadPlugin(iPluginUid); + } + + iPlugin = CreatePlayerPluginL(aPluginUid); + iPluginUid = aPluginUid; + + delete iDisplayName; + iDisplayName = NULL; + iDisplayName = PluginName(aPluginUid).AllocL(); + MPX_DEBUG3("<===CMPXPlaybackPluginHandler::LoadPluginL 0x%08x plugin name %S", + this, iDisplayName); + } + +// ---------------------------------------------------------------------------- +// Constructs the collection plugin info class +// ---------------------------------------------------------------------------- +// +CMPXPluginInfo* +CMPXPlaybackPluginHandler::ConstructPluginInfoLC( + const CImplementationInformation& aData ) + { + return CMPXPlaybackPluginInfo::NewLC( aData ); + } + +// ---------------------------------------------------------------------------- +// Unload the plugin +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackPluginHandler::UnloadPlugin( + const TUid& aUid) + { + MPX_FUNC_EX("CMPXPlaybackPluginHandler::UnloadPlugin"); + + TInt index(iLoadedPluginsUids.Find(aUid)); + if (index != KErrNotFound) + { + UnloadPlugin(index); + } + } + +// ---------------------------------------------------------------------------- +// Return player name +// ---------------------------------------------------------------------------- +// +EXPORT_C const TDesC& CMPXPlaybackPluginHandler::PlayerName( + TMPXPlaybackPlayerType aType) const + { + MPX_FUNC("CMPXPlaybackPluginHandler::PlayerName()"); + return PluginName(aType); + } + +// ---------------------------------------------------------------------------- +// Get player list with the specific type +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaybackPluginHandler::GetPlayerListL( + RArray& aPlayers, + TMPXPlaybackPlayerType aType) + { + MPX_FUNC("CMPXPlaybackPluginHandler::GetPlayerListL()"); + GetPluginUidsL(aPlayers, aType); + } + +// ---------------------------------------------------------------------------- +// Select players with the specific type +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaybackPluginHandler::SelectPlayersL( + TMPXPlaybackPlayerType aType) + { + MPX_FUNC("CMPXPlaybackPluginHandler::SelectPlayersL(TMPXPlaybackPlayerType aType)"); + iSelectedSubPlayerIndex=KErrNotFound; + SelectPluginL(aType); + } + +// ---------------------------------------------------------------------------- +// Returns plug-in appropriate for a Uri and data type +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackPluginHandler::SelectPlayerL( + const TDesC& aUri, + const TDesC8& aDataType) + { + MPX_FUNC("CMPXPlaybackPluginHandler::SelectPlayerL(const TDesC& aUri)"); + MPX_DEBUG2("CMPXPlaybackPluginHandler::SelectPlayerL(aUri %S)", &aUri); + SelectPluginL( aUri, aDataType ); + } + +// ---------------------------------------------------------------------------- +// Returns plug-in appropriate for a file; may already be loaded or not +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackPluginHandler::SelectPlayerL(RFile& aFile) + { + MPX_FUNC("CMPXPlaybackPluginHandler::SelectPlayerL(RFile& aFile)"); + SelectPluginL( aFile ); + } + +// ---------------------------------------------------------------------------- +// Select players with the specific UID +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaybackPluginHandler::SelectPlayerL(TUid aPlayerUid) + { + MPX_FUNC("CMPXPlaybackPluginHandler::SelectPlayerL(TUid aPlayerUid)"); + SelectSubPlayerL(aPlayerUid,KErrNotFound); + iSelectedType = iPluginType; + } + +// ---------------------------------------------------------------------------- +// Select subplayer +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaybackPluginHandler::SelectSubPlayerL( + TUid aPlayerUid, + TInt aSubPlayerIndex) + { + MPX_FUNC("CMPXPlaybackPluginHandler::SelectPlayerL(TUid aPlayerUid, TInt aSubPlayerIndex)"); + MPX_DEBUG3("CMPXPlaybackPluginHandler::SelectPlayerL(0x%08x, %d)", aPlayerUid.iUid, aSubPlayerIndex); + iSelectedSubPlayerIndex=aSubPlayerIndex; + SelectPluginL(aPlayerUid); + } + +// ---------------------------------------------------------------------------- +// Clear selection +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaybackPluginHandler::ClearSelectPlayersL() + { + MPX_FUNC("CMPXPlaybackPluginHandler::ClearSelectPlayersL()"); + SelectPlayersL(EPbLocal); + } + +// ---------------------------------------------------------------------------- +// Get current selection +// ---------------------------------------------------------------------------- +// +EXPORT_C void CMPXPlaybackPluginHandler::GetSelection( + TMPXPlaybackPlayerType& aType, + TUid& aPlayer, + TInt& aSubPlayerIndex, + TPtrC& aSubPlayerName) + { + MPX_FUNC("CMPXPlaybackPluginHandler::GetSelectionL()"); + aType=iPluginType; + aPlayer=iSelectedUid; + aSubPlayerIndex=iSelectedSubPlayerIndex; + if ( iPlugin ) + { + aSubPlayerName.Set(iPlugin->SubPlayerName()); + } + else + { + aSubPlayerName.Set(KNullDesC); + } + } + +// ---------------------------------------------------------------------------- +// Return a list of interfaces supported by the plugins +// ---------------------------------------------------------------------------- +// +EXPORT_C CDesCArray* CMPXPlaybackPluginHandler::SupportedInterfacesL() + { + CDesCArray* descArray = new(ELeave)CDesCArrayFlat(KMPXArrayGranularity); + for(TInt i=iPluginInfoArray.Count();--i>=0;) + { + CMPXPlaybackPluginInfo* pi = + static_cast(iPluginInfoArray[i]); + MPXUser::MergeArray(pi->SupportedInterfaces(), *descArray); + } + return descArray; + } + +// ---------------------------------------------------------------------------- +// Return a list of interfaces supported by the plugins +// ---------------------------------------------------------------------------- +// +EXPORT_C CDesCArray* CMPXPlaybackPluginHandler::SupportedInterfacesL(const TUid& aUid) + { + CDesCArray* descArray = new(ELeave)CDesCArrayFlat(KMPXArrayGranularity); + CleanupStack::PushL(descArray); + for(TInt i=iPluginInfoArray.Count();--i>=0;) + { + if (aUid == iPluginInfoArray[i]->ImplementationUid()) + { + CMPXPlaybackPluginInfo* pi = + static_cast(iPluginInfoArray[i]); + MPXUser::CopyArrayL(pi->SupportedInterfaces(), *descArray); + break; + } + } + CleanupStack::Pop(descArray); + return descArray; + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackPluginHandler::UnloadPlugin +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackPluginHandler::UnloadPlugin( + TInt aIndex) + { + CMPXPlaybackPlugin* p = iLoadedPlugins[aIndex]; + TRAP_IGNORE(p->CommandL(EPbCmdClose)); + iLoadedPlugins.Remove(aIndex); + iLoadedPluginsUids.Remove(aIndex); + if (p == iPlugin) + { + iPlugin = NULL; + } + delete p; + } + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API +// ---------------------------------------------------------------------------- +// Returns plug-in appropriate for a file; may already be loaded or not +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackPluginHandler::SelectPlayer64L(RFile64& aFile) + { + MPX_FUNC("CMPXPlaybackPluginHandler::SelectPlayer64L(RFile64& aFile)"); + SelectPlugin64L( aFile ); + } +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + +// end of file diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/src/mpxplaybackplugininfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/src/mpxplaybackplugininfo.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,118 @@ +/* +* Copyright (c) 2008 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: Derived plugin info class for playback tags +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include "mpxplaybackplugininfo.h" + +_LIT8(KMPXPluginSupportedInterfacesTag, "" ); + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CMPXPlaybackPluginInfo::CMPXPlaybackPluginInfo() + { + + } + + +// --------------------------------------------------------------------------- +// 2nd phase constructor +// --------------------------------------------------------------------------- +// +void CMPXPlaybackPluginInfo::ConstructL( const CImplementationInformation& aData ) + { + iSupportedInterfaces = new(ELeave)CDesCArrayFlat(KMPXArrayGranularity); + + // Base constructor + CMPXPluginInfo::ConstructL( aData ); + } + +// --------------------------------------------------------------------------- +// Two-Phased constructor +// --------------------------------------------------------------------------- +// +CMPXPlaybackPluginInfo* CMPXPlaybackPluginInfo::NewL( + const CImplementationInformation& aData ) + { + CMPXPlaybackPluginInfo* self = new( ELeave ) CMPXPlaybackPluginInfo; + CleanupStack::PushL( self ); + self->ConstructL( aData ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Two-phased constructor +// --------------------------------------------------------------------------- +// +CMPXPlaybackPluginInfo* CMPXPlaybackPluginInfo::NewLC( + const CImplementationInformation& aData ) + { + CMPXPlaybackPluginInfo* self = new( ELeave ) CMPXPlaybackPluginInfo; + CleanupStack::PushL( self ); + self->ConstructL( aData ); + return self; + } + +// --------------------------------------------------------------------------- +// Virtual destructor +// --------------------------------------------------------------------------- +// +CMPXPlaybackPluginInfo::~CMPXPlaybackPluginInfo() + { + delete iSupportedInterfaces; + } + +// --------------------------------------------------------------------------- +// Extended tag parsing functionality +// --------------------------------------------------------------------------- +// +void CMPXPlaybackPluginInfo::ProcessTaggedDataExL( const TDesC8& aTag, + const TDesC8& aData) + { + if( aTag == KMPXPluginSupportedInterfacesTag ) + { + ExtractSupportedInterfacesL( aData ); + } + } + +// --------------------------------------------------------------------------- +// Get the list of supported interfaces +// --------------------------------------------------------------------------- +// +const CDesCArray& CMPXPlaybackPluginInfo::SupportedInterfaces() const + { + return *iSupportedInterfaces; + } + +// --------------------------------------------------------------------------- +// Process the non-cacheable attributes +// --------------------------------------------------------------------------- +// +void CMPXPlaybackPluginInfo::ExtractSupportedInterfacesL( const TDesC8& aData ) + { + iSupportedInterfaces->Reset(); + ExtractIntoArrayL(aData, iSupportedInterfaces); + } + +// END OF FILE diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackengine/src/mpxplaybacksettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackengine/src/mpxplaybacksettings.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2006 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: Playback settings +* +*/ + + + +// INCLUDE FILES +#include +#include + +#include "mpxplaybacksettings.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CMPXPlaybackSettings::CMPXPlaybackSettings() + { + // Do nothing + } + +// ----------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CMPXPlaybackSettings::ConstructL() + { + // Get Pre-Init setting + } + +// ----------------------------------------------------------------------------- +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CMPXPlaybackSettings* CMPXPlaybackSettings::NewL() + { + CMPXPlaybackSettings* self = new(ELeave) CMPXPlaybackSettings; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CMPXPlaybackSettings::~CMPXPlaybackSettings() + { + } + +// ----------------------------------------------------------------------------- +// Returns PreInit enabled +// ----------------------------------------------------------------------------- +// + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackserver/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackserver/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2006 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 for MPX Playback Server. +* +*/ + + + +PRJ_EXPORTS + +PRJ_MMPFILES +mpxplaybackserver.mmp + diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackserver/group/mpxplaybackserver.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackserver/group/mpxplaybackserver.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2006 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: Playback server project specification +* +*/ + + +#include +#include + +TARGET mpxplaybackserver.exe +TARGETTYPE exe +UID 0 0x101FFC00 +VENDORID VID_DEFAULT +CAPABILITY ALL -TCB +EPOCHEAPSIZE 0x1000 0x1000000 + +USERINCLUDE ../inc +USERINCLUDE ../../../inc +USERINCLUDE ../../playbackengine/inc + +MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/kernel +SYSTEMINCLUDE /epoc32/include/mmf/common + +SOURCEPATH ../src +SOURCE mpxplaybackserver.cpp +SOURCE mpxplaybackserversession.cpp + +LIBRARY euser.lib +LIBRARY estor.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY mpxplaybackengine.lib +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib + +#ifdef RD_TSP_CLIENT_MAPPER +LIBRARY tspclientmapper.lib +#endif +// End of file + diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackserver/inc/mpxplaybackserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackserver/inc/mpxplaybackserver.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,193 @@ +/* +* Copyright (c) 2004 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: Playback server +* +*/ + + +#ifndef CMPXPLAYBACKSERVER_H +#define CMPXPLAYBACKSERVER_H + +#include +#include "mpxclientlistobserver.h" +#include "mpxplaybackserverdefs.h" +#include "mpxplaybackactiveengineobserver.h" + +class CMPXPlaybackEngine; +class CMPXMessageQueue; +class CTspClientMapper; +class CMPXPluginMonitor; + +/** +* Music playback server +*/ +NONSHARABLE_CLASS(CMPXPlaybackServer) : public CPolicyServer, + public MMPXPlaybackActiveEngineObserver, + public MMPXClientlistObserver + { +public: + + /** + * Two-phased constructor. Leaves on failure. + * + * @return The constructed object + */ + static CMPXPlaybackServer* NewL(); + + /** + * Destructor + */ + ~CMPXPlaybackServer(); + + /** + * Create a player for a specific client, or returns an existing player + * depending on the mode and whether it already exists. + * + * @param aModeId playback mode id + * @param aClientId thread id of the client + * @aMsgQueue message queue for the client + * @leave The function leaves with one of the system wide error codes, + * if the operation fails. + */ + CMPXPlaybackEngine* CreatePlayerL(const TUid& aModeId, + const TInt aCategory, + TThreadId aClientId, + CMPXMessageQueue* aMsgQueue); + + /** + * Increments number of sessions this server holds + */ + void AddClient(); + + /** + * Decrements number of sessions this server holds, and if now zero, shuts + * down server. ALSO removes client from player, and if the player has no + * more clients, it gets deleted. + * + * @param aMsgQueue message queue for the client + */ + void RemoveClient(const CMPXMessageQueue& aMsgQueue); + + /** + * Retursn last active process id + * + * @return process id of last active process + */ + TProcessId LastActiveProcessId(); + +private: + + /** + * Add a new player + * + * @param aClientId thread id of the client + * @param aModeId playback mode id + * @aMsgQueue message queue for the client + * @param aCategory category of engine + * @leave The function leaves with one of the system wide error codes, + * if the operation fails. + * @return pointer to engine + */ + CMPXPlaybackEngine* AddNewPlayerL(TThreadId aClientId, + const TUid& aModeId, + CMPXMessageQueue* aMsgQueue, + const TInt aCategory); + + /** + * Attach to a default player within the same thread + * + * @param aClientId thread id of the client which attachs to existing player + * @aMsgQueue message queue for the client + * @param aCategory category of engine + * @leave The function leaves with one of the system wide error codes, + * if the operation fails. + * @return pointer to engine or NULL if not found + */ + CMPXPlaybackEngine* AddToDefaultPlayerL(TThreadId aClientId, + CMPXMessageQueue* aMsgQueue, + const TInt aCategory); + + /** + * Returns index of recent active player + * + * @leave The function leaves with one of the system wide error codes, + * if the operation fails. + * @return index to recent active player, KErrNotFound if not found + */ + TInt IndexOfRecentActivePlayer(); + + /** + * Returns index of recent active player + * @param aCategory category of engine + * @leave The function leaves with one of the system wide error codes, + * if the operation fails. + * @return index to recent active player, KErrNotFound if not found + */ + TInt IndexOfRecentActivePlayer(TInt aCategory); + +private: + + /** + * C++ constructor + * + * @param aPriority priority of server + * @param aPolicy security policy + */ + CMPXPlaybackServer(TInt aPriority, const TPolicy &aPolicy); + + /** + * 2nd phase constructor + */ + void ConstructL(); + +private: // from base class + /** + * From MMPXPlaybackActiveEngineObserver + * Handle active engine + * + * @param aEngine pointer to active engine + * @param aActive ETrue activated, EFalse deactivated + */ + void HandleActiveEngineL(const CMPXPlaybackEngine* aEngine, TBool aActive); + + /** + * From CPolicyServer/CServer2 + * Create a new session + * + * @param aVersion version of the server + * @param aMessage message object + */ + CSession2* NewSessionL(const TVersion& aVersion, + const RMessage2& aMessage) const; + + /** + * From MMPXClientlistObserver + * Observer client change + */ + void HandleClientChange(const TProcessId& aPid, + MMPXClientlistObserver::TChangeType aChangeType); + +private: + // The players are sorted by the time activated. In other word, the last + // active player is always the first item. + RPointerArray iPlayers; + TInt iClients; + CMPXPluginMonitor* iPluginMonitor; +#ifdef RD_TSP_CLIENT_MAPPER + CTspClientMapper* iClientMapper; +#endif + }; + +#endif // CMPXPLAYBACKSERVER_H + diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackserver/inc/mpxplaybackserverdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackserver/inc/mpxplaybackserverdefs.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2006 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: Playback Server common definitions +* +*/ + + +#ifndef MPXPLAYBACKSERVERDEFS_H +#define MPXPLAYBACKSERVERDEFS_H + + +#include +#include +#include + +// Server name +_LIT(KMPXPlaybackServerName,"MPXPlaybackServer"); +_LIT(KMPXPlaybackServerImg,"mpxplaybackserver"); // DLL/EXE name +// UID +const TUid KMPXPlaybackServerUid3={0x1020381D}; +// Serverversion number +const TUint KMPXPlaybackServerMajorVersionNumber=0; +const TUint KMPXPlaybackServerMinorVersionNumber=1; +const TUint KMPXPlaybackServerBuildVersionNumber=1; + +#endif // MPXPLAYBACKSERVERDEFS_H + diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackserver/inc/mpxplaybackserversession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackserver/inc/mpxplaybackserversession.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,232 @@ +/* +* Copyright (c) 2006 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: Playback server session +* +*/ + + +#ifndef CMPXPLAYBACKSESSION_H +#define CMPXPLAYBACKSESSION_H + + +#include +#include +#include +#include +#include "mpxplaybackserverdefs.h" + +class CMPXPlaybackEngine; +class CMPXMessageQueue; + +/** +* Music playback server session +*/ +class CMPXPlaybackSession : public CSession2, + public MMPXPlaybackEngineObserver + { +public: + + /** + * Two-phased constructor. Leaves on failure. + * + * @return The constructed object + */ + static CMPXPlaybackSession* NewL(); + + /** + * C++ constructor + * + */ + CMPXPlaybackSession(); + + /** + * Destructor + */ + ~CMPXPlaybackSession(); + +private: + + /** + * From CSession2 + * Service request + * @param aMessage message object + */ + void ServiceL(const RMessage2& aMessage); + + /** + * Dispatch message + * + * @param aMessage message object + * @return message completion code + */ + void DispatchMessageL( const RMessage2& aMessage, TInt& aMsgHandleResult ); + + /** + * Set playback mode + * + * @param aMessage message object + */ + void SetModeL(const RMessage2& aMessage); + + /** + * Get client id from message + * + * @param aMessage message object + * @reutrn client thread id + */ + TThreadId ClientIdL(const RMessage2& aMessage); + + /** + * Init player from file + * + * @param aMessage message object + */ + void InitFromFileL(const RMessage2& aMessage); + + /** + * Cancel outstanding requests + */ + void CancelRequests(); + + /** + * Set request as async + * + * @param aMessage message object + */ + void SetAsync(const RMessage2& aMessage); + + /** + * Complete async request + * + * @param aErr error code + * @param aSlot1 message slot 1 + * @param aVal1 value in the slot 1 + * @param aSlot2 message slot 2 + * @param aVal2 value in the slot 2 + */ + void CompleteAsync(TInt aErr, + TInt aSlot1 = 0, const TDesC8* aVal1 = NULL, + TInt aSlot2 = 0,const TDesC8* aVal2 = NULL); + + + /** + * Writes data from the specified source descriptor to the specified + * message slot + * + * @param aErr error code + * @param aSlot1 message slot 1 + * @param aVal1 value in the slot 1 + * @param aSlot2 message slot 2 + * @param aVal2 value in the slot 2 + * @return KErrNone, if successful, otherwise system error code + */ + TInt DoWriteData(TInt aSlot1 = 0, const TDesC8* aVal1 = NULL, + TInt aSlot2 = 0, const TDesC8* aVal2 = NULL); + + /** + * Get current selection + * + * @param aMessage message object + */ + void GetSelectionL(const RMessage2& aMessage); + + /** + * Helper methods for transferring variable sized arrays and objects + */ + + /** + * Create the buffer filled with player UIDs + * + * @param aMessage message object + * @return the size of buffer + */ + TInt CreatePlayerUidsBufferL(const RMessage2& aMessage); + + /** + * Check if player is valid + */ + void CheckPlayerL(); + +private: + + /** + * From MMPXPlaybackEngineObserver + * Handle playback property + * + * @param aProperty the property + * @param aValue the value of the property + * @param aError error code + */ + void HandleProperty(TMPXPlaybackProperty aProperty, + TInt aValue, + TInt aError); + + /** + * From MMPXPlaybackEngineObserver + * Method is called continously until aComplete=ETrue, signifying that + * it is done and there will be no more callbacks + * Only new items are passed each time + * + * @param aPlayer UID of the subplayer + * @param aSubPlayers a list of sub players + * @param aComplete ETrue no more sub players. EFalse more subplayer + * expected + * @param aError error code + */ + void HandleSubPlayerNames(TUid aPlayer, + const MDesCArray* aSubPlayers, + TBool aComplete, + TInt aError); + + /** + * From MMPXPlaybackEngineObserver + * Handle media properties + * + * @param aMedia media object + * @param aError error code + */ + void HandleMedia(CMPXMedia* aMedia, TInt aError); + + /** + * From MMPXPlaybackEngineObserver + * Handle completion of a asynchronous command + * + * @param aCommandResult result of the command, NULL if error + * @param aError error code + */ + void HandlePlaybackCommandComplete(CMPXCommand* aCommandResult, + TInt aError); + +private: + + /** + * 2nd phase constructor + */ + void ConstructL(); + +private: + CMPXPlaybackEngine* iPlayer; + RMessage2 iMessage; + TBool iCompleteRequest; + // + // Data for client, for current request + // + CBufBase* iSyncBuffer; + CBufBase* iAsyncBuffer; + CMPXMedia* iMedia; + CMPXMessageQueue* iMessageQueue; // Message queue + }; + +#endif // CMPXPLAYBACKSESSION_H + diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackserver/src/mpxplaybackserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackserver/src/mpxplaybackserver.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,525 @@ +/* +* Copyright (c) 2004 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: Playback server +* +*/ + + +#include +#include +#ifdef RD_TSP_CLIENT_MAPPER +#include +#endif +#include +#include +#include +#include "mpxplaybackserverdefs.h" +#include "mpxplaybackengine.h" +#include "mpxplaybackserversession.h" +#include "mpxplaybackserver.h" + +// CONSTANTS + +// Server Security Policy +const TUint KMPXPlaybackServerRangeCount = 2; +const TInt KMPXPlaybackServerRanges[KMPXPlaybackServerRangeCount] = + { + 0, //range is [0-EPbsServerOpEnd) + EPbsServerOpEnd, //range is [EPbsServerOpEnd-KMaxTInt] + }; +const TUint8 KMPXPlaybackSeverElementsIndex[KMPXPlaybackServerRangeCount] = + { + 0, //applies to range [0-EPbsServerOpEnd) + CPolicyServer::ENotSupported, //applies to range [EPbsServerOpEnd-KMaxTInt] + }; + +const CPolicyServer::TPolicyElement KMPXPlaybackServerPolicyElements[] = + { + {_INIT_SECURITY_POLICY_C1(ECapability_None), + CPolicyServer::EFailClient}, + }; + +const CPolicyServer::TPolicy KMPXPlaybackServerPolicy = + { + CPolicyServer::EAlwaysPass, //specifies all connect attempts should pass + KMPXPlaybackServerRangeCount, + KMPXPlaybackServerRanges, + KMPXPlaybackSeverElementsIndex, + KMPXPlaybackServerPolicyElements, + }; + +// ---------------------------------------------------------------------------- +// Start playback server +// +LOCAL_C void StartServerL() + { + User::LeaveIfError(User::RenameThread(KMPXPlaybackServerName)); + CActiveScheduler* scheduler = new(ELeave)CActiveScheduler; + CleanupStack::PushL(scheduler); + CActiveScheduler::Install(scheduler); + CMPXPlaybackServer* server = CMPXPlaybackServer::NewL(); + CleanupStack::PushL(server); + RProcess::Rendezvous(KErrNone); + CActiveScheduler::Start(); + CActiveScheduler::Install(NULL); + CleanupStack::PopAndDestroy(server); + CleanupStack::PopAndDestroy(scheduler); + } + +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CMPXPlaybackServer* CMPXPlaybackServer::NewL() + { + CMPXPlaybackServer *pS = new(ELeave) CMPXPlaybackServer( + CActive::EPriorityStandard, + KMPXPlaybackServerPolicy); + CleanupStack::PushL(pS); + pS->ConstructL(); + CleanupStack::Pop(pS); + return pS; + } + +// ---------------------------------------------------------------------------- +// C++ constructor can NOT contain any code that might leave. +// ---------------------------------------------------------------------------- +// +CMPXPlaybackServer::CMPXPlaybackServer(TInt aPriority, const TPolicy &aPolicy) + : CPolicyServer(aPriority, aPolicy) + {} + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CMPXPlaybackServer::~CMPXPlaybackServer() + { + iPlayers.ResetAndDestroy(); + delete iPluginMonitor; +#ifdef RD_TSP_CLIENT_MAPPER + delete iClientMapper; +#endif + } + +// ---------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackServer::ConstructL() + { + StartL(KMPXPlaybackServerName); + iPluginMonitor = CMPXPluginMonitor::NewL(KMPXPlaybackInterfaceUid); +#ifdef RD_TSP_CLIENT_MAPPER + iClientMapper = CTspClientMapper::NewL(); +#endif + } + +// ---------------------------------------------------------------------------- +// Increments number of sessions this server holds +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackServer::AddClient() + { + iClients++; + } + + +// ---------------------------------------------------------------------------- +// Find the player that has client aName, and remove it from that player; if +// that player has no clients, then delete that player. If the server has no +// more client sessions, then stop the server. +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackServer::RemoveClient(const CMPXMessageQueue& aMsgQueue) + { + MPX_DEBUG2("CMPXPlaybackServer::RemoveClient from %d", + iPlayers.Count()); + for (TInt i=iPlayers.Count();--i>=0;) + { + CMPXPlaybackEngine* p=iPlayers[i]; + CMPXClientList* cl=p->ClientList(); + TInt index(cl->Find(aMsgQueue)); + if (KErrNotFound != index) + { + MPX_DEBUG1("CMPXPlaybackServer::RemoveClient found client"); + cl->RemoveClient(index); + if (cl->ClientCount()==0) + { + MPX_DEBUG1("CMPXPlaybackServer::RemoveClient delete a player"); + delete p; + iPlayers.Remove(i); + } + break; + } + } + iClients--; + ASSERT(iClients>=0); + if (iClients==0) + { + CActiveScheduler::Stop(); + } + } + +// ---------------------------------------------------------------------------- +// Return last active process id +// ---------------------------------------------------------------------------- +// +TProcessId CMPXPlaybackServer::LastActiveProcessId() + { + TProcessId id(KNullProcessId); + if (iPlayers.Count()) + { + id = iPlayers[0]->LastActiveProcessId(); + } + return id; + } + +// ---------------------------------------------------------------------------- +// Creates a brand new player to the player list with this client name and TID, +// and whether it's the music player. +// ---------------------------------------------------------------------------- +// +CMPXPlaybackEngine* CMPXPlaybackServer::AddNewPlayerL( + TThreadId aClientId, + const TUid& aModeId, + CMPXMessageQueue* aMsgQueue, + const TInt aCategory) + { + CMPXPlaybackEngine* p = + CMPXPlaybackEngine::NewL(*iPluginMonitor,*this,this,aModeId, aCategory); + MPX_DEBUG2("CMPXPlaybackServer::AddNewPlayerL 0x%08x", p); + CleanupStack::PushL(p); + p->ClientList()->AddClientL(aClientId, aModeId.iUid, aMsgQueue, aCategory); + iPlayers.AppendL(p); + CleanupStack::Pop(p); + return p; + } + +// ---------------------------------------------------------------------------- +// Create player according to the mode: +// ---------------------------------------------------------------------------- +// +CMPXPlaybackEngine* CMPXPlaybackServer::CreatePlayerL( + const TUid& aModeId, + const TInt aCategory, + TThreadId aClientId, + CMPXMessageQueue* aMsgQueue) + { + CMPXPlaybackEngine* p=NULL; + if (aModeId == KPbModeDefault) + { + // Add the new client to the player created by another client running + // in the same thread. If there isn't one, then create the first player + // for this thread + // + p=AddToDefaultPlayerL(aClientId,aMsgQueue,aCategory); + if(!p) + { + + p=AddNewPlayerL(aClientId, aModeId, aMsgQueue, aCategory); + } + } + // + else if (aModeId == KPbModeNewPlayer) + { + // + // Create a brand new player for this client + // + p=AddNewPlayerL(aClientId, aModeId, aMsgQueue, aCategory); + } + else if (aModeId == KPbModeActivePlayer) + { + TInt index = IndexOfRecentActivePlayer(aCategory); + if (KErrNotFound != index) + { + p = iPlayers[index]; // active & matching category + } + if (!p && iPlayers.Count()>0) + { //no recent activeplayer, attach to the first player with matching category + TInt count = iPlayers.Count(); + for(TInt i = 0; i < count; i++) + { + if(iPlayers[i]->Category() == aCategory) + { + p = iPlayers[i]; // not active, first matching category + break; + } + } + } + if (p) + { + p->ClientList()->AddClientL(aClientId,aModeId.iUid,aMsgQueue, aCategory); + } + else + { // no player available (no active player with matching category) + MPX_DEBUG1("CMPXPlaybackServer::CreatePlayerL create a new player"); + p=AddNewPlayerL(aClientId, aModeId, aMsgQueue, aCategory); + } + } + else + { + // + // Add the new client to the player created by one application. If + // there isn't one, then create the first player for the application + // + for (TInt i=iPlayers.Count();--i>=0;) + { + if (iPlayers[i]->ModeId() == aModeId) + { + p = iPlayers[i]; + p->ClientList()->AddClientL(aClientId, + aModeId.iUid, aMsgQueue, aCategory); + break; + } + } + + if (!p) + { + p=AddNewPlayerL(aClientId, aModeId, aMsgQueue, aCategory); + } + } + return p; + } + +// ---------------------------------------------------------------------------- +// Add the new client (defined by it's TID) to the player +// associated with the Tid aExistingClientId +// ---------------------------------------------------------------------------- +// +CMPXPlaybackEngine* CMPXPlaybackServer::AddToDefaultPlayerL( + TThreadId aClientId, + CMPXMessageQueue* aMsgQueue, + const TInt aCategory) + { + CMPXPlaybackEngine* p=NULL; + for (TInt i=0; i < iPlayers.Count(); ++i) + { + p=iPlayers[i]; + CMPXClientList* cl=p->ClientList(); + TInt index = cl->Find(aClientId); + if (KErrNotFound != index) + { + // if the player is an active player, change mode from default + // to activeplayer. Default mode always uses the mode of first client + TInt mode = (cl->ClientMode(index) == KPbModeActivePlayer.iUid) ? + KPbModeActivePlayer.iUid : KPbModeDefault.iUid; + MPX_DEBUG3("CMPXPlaybackServer::AddToDefaultPlayerL mode 0x%08x, engine 0x%08x", + mode, p); + cl->AddClientL(aClientId,mode,aMsgQueue, aCategory); + break; + } + } + return p; + } + +// ---------------------------------------------------------------------------- +// Return the index of an active player. If there is no active player, return +// the index to the player in paused state which may be interrupted. +// ---------------------------------------------------------------------------- +// +TInt CMPXPlaybackServer::IndexOfRecentActivePlayer(TInt aCategory) + { + TInt ret(KErrNotFound); + for (TInt i=0; iIsPlayerActive() && aCategory == p->Category()) + { // Found active player + ret = i; + break; + } + else if (EPbStatePaused == p->State() && KErrNotFound == ret && aCategory == p->Category()) + { // first paused player + ret = i; + } + } + return ret; + } + +TInt CMPXPlaybackServer::IndexOfRecentActivePlayer() + { + TInt ret(KErrNotFound); + for (TInt i=0; iIsPlayerActive()) + { // Found active player + ret = i; + break; + } + else if (EPbStatePaused == p->State() && KErrNotFound == ret) + { // first paused player + ret = i; + } + } + return ret; + } + +// ---------------------------------------------------------------------------- +// Handle active player changed evnet. +// Notify all clients of EPbModeActivePlayer mode in inactive engines +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackServer::HandleActiveEngineL( + const CMPXPlaybackEngine* aEngine, + TBool aActive) + { + MPX_DEBUG3("CMPXPlaybackServer::HandleActiveEngineL Engine: 0x%08x, Active %d", + aEngine, aActive); + TInt i(0); + TInt indexOfActive = iPlayers.Find(aEngine); + ASSERT(KErrNotFound!=indexOfActive); + if (!aActive) + { +#ifdef RD_TSP_CLIENT_MAPPER + iClientMapper->SetTspTargetClientToOtherType( + CTspClientMapper::EStoppedClients, + aEngine->LastActiveProcessId()); + MPX_DEBUG2("CMPXPlaybackServer::HandleActiveEngineL(): Adding to stopped client %d", + TUint( aEngine->LastActiveProcessId())); + +#endif + if (EPbStatePaused != aEngine->State()) + { + indexOfActive = IndexOfRecentActivePlayer(); + } + else + { // else no need to rebind. if the player is interruptted by other player + // there must be another HandleActiveEngineL callback with aActive = ETrue + indexOfActive = KErrNotFound; + } + } + else + {// else aEngine is active player +#ifdef RD_TSP_CLIENT_MAPPER + iClientMapper->SetTspTargetClientToOtherType( + CTspClientMapper::EPlayingClients, + aEngine->LastActiveProcessId()); + MPX_DEBUG2("CMPXPlaybackServer::HandleActiveEngineL(): Adding to playing client %d", + TUint( aEngine->LastActiveProcessId())); +#endif + } + + if (KErrNotFound != indexOfActive) + { + // Move the active player engine to the top of player list + CMPXPlaybackEngine* player(NULL); + if (indexOfActive) + { // not 0 + player = iPlayers[indexOfActive]; + iPlayers.Remove(indexOfActive); + iPlayers.Insert(player, 0); + } + + // Active engine changed, notify all clients who are instrested. + // e.g. KPbModeActivePlayer + for (i=1; i < iPlayers.Count(); ++i) + { + player = iPlayers[i]; + if (player == aEngine && aActive) + { + continue; + } + MPX_DEBUG2("CMPXPlaybackServer::HandleActiveEngineL Player: 0x%08x", player); + CMPXClientList* cl = player->ClientList(); + for (TInt j = cl->ClientCount(); --j>=0;) + { + if ((KPbModeActivePlayer.iUid == cl->ClientMode(j)) && + (aEngine->Category() == cl->ClientCategory(j))) + { + MPX_DEBUG2( + "CMPXPlaybackServer notify %d client player changed", j); + player->ClientList()->SendMsgL( + j, + TMPXPlaybackMessage( + TMPXPlaybackMessage::EActivePlayerChanged, + 1, aActive)); + } + } + } + } + } + +// ---------------------------------------------------------------------------- +// Observe client change event +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackServer::HandleClientChange( + const TProcessId& aPid, + MMPXClientlistObserver::TChangeType aChangeType) + { +#ifdef RD_TSP_CLIENT_MAPPER + if (MMPXClientlistObserver::EAdd == aChangeType) + { + iClientMapper->SetTspTargetClient( + CTspClientMapper::EPlayingClients, + aPid); + MPX_DEBUG2("CMPXPlaybackServer::HandleClientChange(): Adding to registered client %d", + TUint( aPid )); + } + else + { + iClientMapper->RemoveTspTargetClient( + CTspClientMapper::EPlayingClients, + aPid); + MPX_DEBUG2("CMPXPlaybackServer::HandleClientChange(): Adding to EPlayingClients client %d", + TUint( aPid )); + } +#else + (void)aPid; + (void)aChangeType; +#endif + } + +// ---------------------------------------------------------------------------- +// Create a new session +// ---------------------------------------------------------------------------- +// +CSession2* CMPXPlaybackServer::NewSessionL(const TVersion& aVersion, + const RMessage2& /*aMessage*/) const + { + TVersion v(KMPXPlaybackServerMajorVersionNumber, + KMPXPlaybackServerMinorVersionNumber, + KMPXPlaybackServerBuildVersionNumber); + if (!User::QueryVersionSupported(v,aVersion)) + User::Leave(KErrNotSupported); + CMPXPlaybackSession* session = CMPXPlaybackSession::NewL(); + const_cast(this)->AddClient(); + return session; + } + +// ---------------------------------------------------------------------------- +// Server exe entry +// ---------------------------------------------------------------------------- +// +TInt E32Main() + { + __UHEAP_MARK; + // + CTrapCleanup* cleanup=CTrapCleanup::New(); + TInt r=KErrNoMemory; + if (cleanup) + { + TRAP(r,StartServerL()); + } + + delete cleanup; + __UHEAP_MARKEND; + return r; + } + +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackserver/src/mpxplaybackserversession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackserver/src/mpxplaybackserversession.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,813 @@ +/* +* Copyright (c) 2006 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: Playback server session +* +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mpxplaybackserver.h" +#include "mpxplaybackengine.h" +#include "mpxplaybackserversession.h" + +// ============================ LOCAL FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// Panic client +// ---------------------------------------------------------------------------- +// +LOCAL_C void PanicClient(const RMessage2 &aMessage,TInt aPanic) + { + _LIT(KTxtServer,"Playback server Session"); + aMessage.Panic(KTxtServer,aPanic); + } + + +// ============================ MEMBER FUNCTIONS ============================== +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CMPXPlaybackSession* CMPXPlaybackSession::NewL() + { + CMPXPlaybackSession* s = new(ELeave)CMPXPlaybackSession(); + CleanupStack::PushL(s); + s->ConstructL(); + CleanupStack::Pop(s); + return s; + } + +// ---------------------------------------------------------------------------- +// C++ constructor can NOT contain any code that might leave. +// ---------------------------------------------------------------------------- +// +CMPXPlaybackSession::CMPXPlaybackSession() + { + } + +// ---------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackSession::ConstructL() + { + MPX_DEBUG2("CMPXPlaybackSession::ConstructL(), this 0x%08x", this); + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CMPXPlaybackSession::~CMPXPlaybackSession() + { + CancelRequests(); + CMPXPlaybackServer* server = static_cast( + const_cast(Server())); + if ( iMessageQueue ) + { + server->RemoveClient( *iMessageQueue ); + } + delete iSyncBuffer; + delete iAsyncBuffer; + delete iMedia; + delete iMessageQueue; + } + +// ---------------------------------------------------------------------------- +// Service request +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackSession::ServiceL(const RMessage2& aMessage) + { + // by default - change for async in helper methods if required + iCompleteRequest=ETrue; + TInt r=KErrNone; + TRAPD( err, DispatchMessageL( aMessage, r ) ); + TBool isErr=(err!=KErrNone); + // If it's not async, complete now (or an async helper method leaves) + if(iCompleteRequest) + { + if (!aMessage.IsNull()) + { + aMessage.Complete(isErr ? err : r); + } // otherwise message already completed DispatchMessageL + } + else if (isErr) // Async and error, remove message from message queue + { + CompleteAsync(err); + } + } + +// ---------------------------------------------------------------------------- +// Message dispatcher +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackSession::DispatchMessageL( const RMessage2& aMessage, TInt& aMsgHandleResult ) + { + aMsgHandleResult = KErrNone; + // + // All methods apart from the player creation methods, require a player + // + TInt op=aMessage.Function(); + if (op != EPbsSetMode) + { + CheckPlayerL(); + } + MPX_DEBUG3("-->CMPXPlaybackSession::DispatchMessageL %d, this 0x%08x", + op, this); + switch(op) + { + case EPbsSetMode: + { + SetModeL(aMessage); + break; + } + case EPbsGetClients: + { + RArray procArray; + ::CopyArrayL( + iPlayer->ClientList()->ClientProcessList(), + procArray ); + TProcessId lastPid = static_cast( + const_cast(Server()))->LastActiveProcessId(); + + TInt index( procArray.Find( lastPid )); + if ( KErrNotFound != index && index ) + { + procArray.Remove( index ); + procArray.Insert( lastPid, 0 ); + } + ::CreateBufferL( + procArray.Array(), + iSyncBuffer); + aMsgHandleResult = iSyncBuffer->Size(); + procArray.Close(); + break; + } + case EPbsGetSyncBuffer: + { + aMessage.WriteL(0,iSyncBuffer->Ptr(0)); + delete iSyncBuffer; + iSyncBuffer = NULL; + break; + } + case EPbsGetAsyncBuffer: + { + aMessage.WriteL(0,iAsyncBuffer->Ptr(0)); + delete iAsyncBuffer; + iAsyncBuffer = NULL; + break; + } + case EPbsInitFromCollection: + { + MPXUser::CreateBufferL(aMessage, 0, iSyncBuffer); + CMPXCollectionPlaylist* p = NULL; + ::NewFromBufferL(*iSyncBuffer, p); + delete iSyncBuffer; + iSyncBuffer = NULL; + CleanupStack::PushL(p); + iPlayer->InitL(*p,aMessage.Int1()); + CleanupStack::PopAndDestroy(p); + } + break; + case EPbsInitFromUri: + { + CBufBase* buf0(NULL); + MPXUser::CreateBufferL(aMessage,0,buf0); + CleanupStack::PushL(buf0); + + // Type parameter is optional + if ( aMessage.GetDesLength( 1 ) > 0 ) + { + CBufBase* buf1(NULL); + MPXUser::CreateBufferL(aMessage,1,buf1); + CleanupStack::PushL(buf1); + iPlayer->InitL(MPXUser::Ptr(buf0->Ptr(0)), buf1->Ptr(0)); + CleanupStack::PopAndDestroy(buf1); + } + else + { + MPX_DEBUG2("CMPXPlaybackSession::DispatchMessageL %d: Type is empty", op); + iPlayer->InitL( MPXUser::Ptr( buf0->Ptr(0) ), KNullDesC8 ); + } + CleanupStack::PopAndDestroy(buf0); + } + break; + case EPbsInitFromFile: + { + InitFromFileL(aMessage); + break; + } + case EPbsInitStreamingFromUri: + { + CBufBase* buf0(NULL); + MPXUser::CreateBufferL(aMessage,0,buf0); + CleanupStack::PushL(buf0); + + // Type parameter is optional + if ( aMessage.GetDesLength( 1 ) > 0 ) + { + CBufBase* buf1(NULL); + MPXUser::CreateBufferL(aMessage,1,buf1); + CleanupStack::PushL(buf1); + iPlayer->InitStreamingL(MPXUser::Ptr(buf0->Ptr(0)), buf1->Ptr(0), aMessage.Int2()); + CleanupStack::PopAndDestroy(buf1); + } + else + { + MPX_DEBUG2("CMPXPlaybackSession::DispatchMessageL %d: Type is empty", op); + iPlayer->InitStreamingL( MPXUser::Ptr( buf0->Ptr(0) ), KNullDesC8, aMessage.Int2() ); + } + CleanupStack::PopAndDestroy(buf0); + break; + } + case EPbsInitStreamingFromFile: + { + RFile file; + User::LeaveIfError(file.AdoptFromClient(aMessage,0,1)); + iPlayer->InitStreamingL(file, aMessage.Int2()); + file.Close(); + break; + } + case EPbsCancelRequest: + { + CancelRequests(); + break; + } + case EPbsGetState: + { + aMsgHandleResult = iPlayer->State(); + break; + } + case EPbsSetProperty: + { + iPlayer->SetL(static_cast(aMessage.Int0()), + aMessage.Int1()); + break; + } + case EPbsGetProperty: + { + SetAsync(aMessage); + iPlayer->PropertyL( + static_cast(aMessage.Int0()),*this); + break; + } + case EPbsGetPlayerTypes: + { + RArray pluginTypes; + CleanupClosePushL(pluginTypes); + RArray types; + CleanupClosePushL(types); + iPlayer->PluginHandler()->GetPluginTypes(types); + for (TInt i=0; i< types.Count(); ++i) + { + pluginTypes.AppendL( + static_cast(types[i])); + } + CleanupStack::PopAndDestroy(&types); + ::CreateBufferL( + pluginTypes.Array(), + iSyncBuffer); + aMsgHandleResult = iSyncBuffer->Size(); + CleanupStack::PopAndDestroy(&pluginTypes); + break; + } + case EPbsGetPlayerTypeDisplayName: + { + const TDesC& playerName = iPlayer->PluginHandler()->PlayerName( + static_cast(aMessage.Int0())); + aMsgHandleResult = 0; + if (playerName.Length()>0) + { + MPXUser::CreateBufferL(playerName, iSyncBuffer); + aMsgHandleResult = iSyncBuffer->Size(); + } + break; + } + case EPbsGetAllPlayersUids: + { + RArray uids; + CleanupClosePushL(uids); + iPlayer->PluginHandler()->GetPluginUids(uids); + + ::CreateBufferL( + uids.Array(), + iSyncBuffer); + aMsgHandleResult = iSyncBuffer->Size(); + CleanupStack::PopAndDestroy(&uids); + break; + } + case EPbsGetPlayersUidsForType: + { + aMsgHandleResult = CreatePlayerUidsBufferL(aMessage); + break; + } + case EPbsGetSubPlayerNamesByUid: + { + SetAsync(aMessage); + iPlayer->SubPlayerNamesL(TUid::Uid(aMessage.Int0()),*this); + break; + } + case EPbsSelectPlayerByType: + { + iPlayer->PluginHandler()->SelectPlayersL( + static_cast(aMessage.Int0())); + break; + } + case EPbsSelectPlayerByUid: + { + iPlayer->PluginHandler()->SelectPlayerL(TUid::Uid(aMessage.Int0())); + break; + } + case EPbsSelectSubPlayer: + { + iPlayer->PluginHandler()->SelectSubPlayerL( + TUid::Uid(aMessage.Int0()),aMessage.Int1()); + break; + } + case EPbsClearPlayerSelection: + { + iPlayer->PluginHandler()->ClearSelectPlayersL(); + break; + } + case EPbsGetSelection: + { + GetSelectionL(aMessage); + break; + } + case EPbsPlayerFound: + { + aMsgHandleResult = iPlayer->PluginHandler()->PlayerFound(); + break; + } + case EPbsGetPlayerType: + { + aMsgHandleResult = iPlayer->PluginHandler()->PluginType(); + break; + } + case EPbsGetTypeName: + { + MPXUser::CreateBufferL(iPlayer->PluginHandler()->PlayerName(), + iSyncBuffer); + aMsgHandleResult = iSyncBuffer->Size(); + break; + } + case EPbsGetSubPlayerIndex: + { + aMsgHandleResult = iPlayer->PluginHandler()->SubPlayer(); + break; + } + case EPbsGetPlayerUid: + { + TPckgC uidPkg((iPlayer->PluginHandler()->PluginUid()).iUid); + aMessage.Write(0,uidPkg); + break; + } + case EPbsGetCollectionPlaylist: + { + aMsgHandleResult = 0; + if (iPlayer->Playlist()) + { + ::CreateBufferL(*(iPlayer->Playlist()), + iSyncBuffer); + aMsgHandleResult = iSyncBuffer->Size(); + } + break; + } + case EPbsGetFile: + { + const RFile& file = iPlayer->File(); + if (file.SubSessionHandle()) + { + aMsgHandleResult = file.TransferToClient(aMessage,0); //message completed + } + else + { + TPckgC handle(KErrNotFound); + aMessage.Write(0, handle); + } + break; + } + case EPbsGetUri: + { + aMsgHandleResult=0; + if (iPlayer->Uri().Length()>0) + { + MPXUser::CreateBufferL(iPlayer->Uri(),iSyncBuffer); + aMsgHandleResult = iSyncBuffer->Size(); + } + break; + } + case EPbsGetMedia: + { + SetAsync( aMessage ); + CMPXCommand* cmd( CMPXCommand::NewL( aMessage.Int1() ) ); + CleanupStack::PushL( cmd ); + iPlayer->MediaL( *this, *cmd ); + CleanupStack::PopAndDestroy( cmd ); + break; + } + case EPbsGetSupportedMimeTypes: + { + CDesCArray* mimeTypes = + iPlayer->PluginHandler()->SupportedMimeTypesL(); + CleanupStack::PushL(mimeTypes); + MPXUser::CreateBufferL((const MDesCArray*)mimeTypes, iSyncBuffer); + aMsgHandleResult = iSyncBuffer->Size(); + CleanupStack::PopAndDestroy(mimeTypes); + } + break; + case EPbsGetSupportedExtensions: + { + CDesCArray* exts = + iPlayer->PluginHandler()->SupportedExtensionsL(); + CleanupStack::PushL(exts); + MPXUser::CreateBufferL((const MDesCArray*)exts, iSyncBuffer); + aMsgHandleResult = iSyncBuffer->Size(); + CleanupStack::PopAndDestroy(exts); + } + break; + case EPbsGetSupportedSchemas: + { + CDesCArray* schemas = + iPlayer->PluginHandler()->SupportedSchemasL(); + CleanupStack::PushL(schemas); + MPXUser::CreateBufferL((const MDesCArray*)schemas, iSyncBuffer); + aMsgHandleResult = iSyncBuffer->Size(); + CleanupStack::PopAndDestroy(schemas); + } + break; + case EPbsGetNextMessage: + { + ASSERT(iMessageQueue); + iMessageQueue->SendNext(aMessage); + iCompleteRequest=EFalse; + break; + } + case EPbsCancelGetMessage: + { + ASSERT(iMessageQueue); + iMessageQueue->Reset(); + break; + } + case EPbsCommand: + { + CMPXCommand* cmd( NULL ); + ::NewFromMessageL(aMessage, 1, cmd); + CleanupStack::PushL(cmd); + if (aMessage.Int0()) + { // aSync command + SetAsync(aMessage); + } // else sync command + iPlayer->CommandL(*cmd, *iMessageQueue); + CleanupStack::PopAndDestroy(cmd); + break; + } +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + case EPbsInitFromFile64: + { + RFile64 file; + User::LeaveIfError(file.AdoptFromClient(aMessage,0,1)); + iPlayer->Init64L(file); + file.Close(); + break; + } + case EPbsInitStreamingFromFile64: + { + RFile64 file; + User::LeaveIfError(file.AdoptFromClient(aMessage,0,1)); + iPlayer->InitStreaming64L(file, aMessage.Int2()); + file.Close(); + break; + } + case EPbsGetFile64: + { + const RFile64& file = iPlayer->File64(); + if (file.SubSessionHandle()) + { + aMsgHandleResult = file.TransferToClient(aMessage,0); //message completed + } + else + { + TPckgC handle(KErrNotFound); + aMessage.Write(0, handle); + } + break; + } +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + default: + { + PanicClient(aMessage,KErrNotSupported); + break; + } + } + MPX_DEBUG1("<---CMPXPlaybackSession::DispatchMessageL"); + } + +// ---------------------------------------------------------------------------- +// Get current selection +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackSession::GetSelectionL(const RMessage2& aMessage) + { + TMPXPlaybackPlayerType type; + TUid uid; + TInt index; + const TInt KMsgSlotZero = 0; + const TInt KMsgSlotOne = 1; + const TInt KMsgSlotTwo = 2; + const TInt KMsgSlotThree = 3; + TPtrC subPlayerName(KNullDesC); + iPlayer->PluginHandler()->GetSelection(type,uid,index, subPlayerName); + TInt size(0); + if (subPlayerName != KNullDesC) + { + MPXUser::CreateBufferL(subPlayerName, iSyncBuffer); + size = iSyncBuffer->Size(); + } + ::WriteL( aMessage, KMsgSlotZero, type ); + ::WriteL( aMessage, KMsgSlotOne, uid ); + ::WriteL( aMessage, KMsgSlotTwo, index ); + ::WriteL( aMessage, KMsgSlotThree, size ); + } + +// ---------------------------------------------------------------------------- +// Queue the message and complete async +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackSession::SetAsync(const RMessage2& aMessage) + { + MPX_FUNC_EX("CMPXPlaybackSession::SetAsync"); + MPX_ASSERT(iMessage.IsNull() && !aMessage.IsNull()); + iMessage = aMessage; + iCompleteRequest=EFalse; + } + +// ---------------------------------------------------------------------------- +// Complete queued message +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackSession::CompleteAsync( + TInt aErr, + TInt aSlot1, const TDesC8* aVal1, + TInt aSlot2, const TDesC8* aVal2) + { + MPX_ASSERT(!iMessage.IsNull()); + TInt err(KErrNone); + if (KErrNone==aErr) + { + err = DoWriteData(aSlot1, aVal1, aSlot2, aVal2); + if (err) + { // Set to new error + aErr = err; + } + } + MPX_DEBUG4("CMPXPlaybackSession::CompleteAsync 0x%08x task %d err %d", + this, iMessage.Function(), aErr); + iMessage.Complete(aErr); + } + +// ---------------------------------------------------------------------------- +// Write data back to client +// ---------------------------------------------------------------------------- +// +TInt CMPXPlaybackSession::DoWriteData( + TInt aSlot1, const TDesC8* aVal1, + TInt aSlot2, const TDesC8* aVal2) + { + TInt ret(KErrNone); + if (aVal1) + { + ret = iMessage.Write(aSlot1,*aVal1); + } + + if (aVal2 && KErrNone==ret) + { + ret = iMessage.Write(aSlot2,*aVal2); + } + return ret; + } + +// ---------------------------------------------------------------------------- +// Init player from file +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackSession::InitFromFileL(const RMessage2& aMessage) + { + RFile file; + User::LeaveIfError(file.AdoptFromClient(aMessage,0,1)); + iPlayer->InitL(file); + file.Close(); + } + +// ---------------------------------------------------------------------------- +// Cancel all outstanding requests on this session +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackSession::CancelRequests() + { + MPX_FUNC_EX("CMPXPlaybackSession::CancelRequests"); + if (!iMessage.IsNull()) + { + iMessage.Complete(KErrCancel); + iPlayer->CancelRequests(); + } + } + +// ---------------------------------------------------------------------------- +// The thread ID of the client thread +// ---------------------------------------------------------------------------- +// +TThreadId CMPXPlaybackSession::ClientIdL(const RMessage2& aMessage) + { + RThread t; + aMessage.ClientL(t); + TThreadId tid=t.Id(); + t.Close(); + return tid; + } + +// ---------------------------------------------------------------------------- +// Set playback mode +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackSession::SetModeL(const RMessage2& aMessage) + { + MPX_DEBUG3("-->CMPXPlaybackSession::SetModeL 0x%08x, mode 0x%08x", this, aMessage.Int0()); + if (iPlayer) + { + MPX_DEBUG1("CMPXPlaybackSession::SetModeL detach from old player"); + // swap engine + static_cast( + const_cast(Server()))->AddClient(); + static_cast( + const_cast(Server()))->RemoveClient(*iMessageQueue); + iPlayer = NULL; + ASSERT(iMessageQueue); + iMessageQueue->Reset(); + } + if (!iMessageQueue) + { + iMessageQueue = CMPXMessageQueue::NewL(); + } + iPlayer=static_cast( + const_cast(Server()))->CreatePlayerL( + TUid::Uid(aMessage.Int0()), + aMessage.Int1(), + ClientIdL(aMessage), + iMessageQueue); + MPX_DEBUG3("<--CMPXPlaybackSession::SetModeL 0x%08x, engine 0x%08x", this, iPlayer); + } + +// ---------------------------------------------------------------------------- +// An array must be supplied to receive UIDs, so a temporary one is created +// here before being copied into the buffer +// ---------------------------------------------------------------------------- +// +TInt CMPXPlaybackSession::CreatePlayerUidsBufferL(const RMessage2& aMessage) + { + RArray players; + CleanupClosePushL(players); + iPlayer->PluginHandler()->GetPlayerListL(players, + static_cast(aMessage.Int0())); + ::CreateBufferL(players.Array(), iSyncBuffer); + TInt r = iSyncBuffer->Size(); + CleanupStack::PopAndDestroy(&players); + return r; + } + +// ---------------------------------------------------------------------------- +// Handle playback property +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackSession::HandleProperty( + TMPXPlaybackProperty /*aProperty*/, + TInt aValue, + TInt aError) + { + MPX_FUNC_EX("CMPXPlaybackSession::HandleProperty"); + MPX_DEBUG3("CMPXPlaybackSession::HandleProperty(): aValue = %d, aError = %d", aValue, aError); + MPX_ASSERT(!iMessage.IsNull() && iMessage.Function() == EPbsGetProperty); + TPckgC val(aValue); + CompleteAsync(aError,1,&val); + } + +// ---------------------------------------------------------------------------- +// Method is called continously until aComplete=ETrue, signifying that it is +// done and there will be no more callbacks.Only new items are passed each time +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackSession::HandleSubPlayerNames( + TUid /*aPlayer*/, + const MDesCArray* aSubPlayers, + TBool aComplete, + TInt aError) + { + MPX_FUNC_EX("CMPXPlaybackSession::HandleSubPlayerNames"); + MPX_ASSERT(!iMessage.IsNull() && iMessage.Function() == EPbsGetSubPlayerNamesByUid); + TRAPD(err,MPXUser::CreateBufferL(aSubPlayers, iAsyncBuffer)); + TInt size(0); + if(aSubPlayers && !err) + { + size = iAsyncBuffer->Size(); + } + else if (err) + { // err to create buffer + aError = err; + } + else + { // aSubPlayers is NULL + aError = KErrNotFound; + } + TPckgC complete(aComplete); + TPckgC sizePkg(size); + CompleteAsync(aError,1,&sizePkg,2,&complete); + } + +// ---------------------------------------------------------------------------- +// Handle media properties +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackSession::HandleMedia(CMPXMedia* aMedia, TInt aError) + { + MPX_FUNC_EX("CMPXPlaybackSession::HandleMedia"); + MPX_ASSERT(!iMessage.IsNull() && iMessage.Function() == EPbsGetMedia); + TInt size(0); + if (KErrNone == aError && aMedia) + { + delete iMedia; + iMedia=NULL; + TInt err(KErrNone); + TRAP(err, iMedia=CMPXMedia::NewL(*aMedia)); + if (!err) + { + TRAP(err, ::CreateBufferL(*iMedia,iAsyncBuffer)); + } + if (!err) + { + size = iAsyncBuffer->Size(); + } + } // else complete with error + TPckgC sizePkg(size); + CompleteAsync(aError,0,&sizePkg); + } + +// ---------------------------------------------------------------------------- +// Callback of async CommandL +// ---------------------------------------------------------------------------- +// + void CMPXPlaybackSession::HandlePlaybackCommandComplete( + CMPXCommand* aCommandResult, + TInt aError) + { + MPX_ASSERT(!iMessage.IsNull() && iMessage.Function() == EPbsCommandExt); + TInt size(0); + if( aError == KErrNone && aCommandResult) + { + delete iMedia; + iMedia=NULL; + TRAP( aError, iMedia = CMPXMedia::NewL( *aCommandResult ) ); + if ( KErrNone == aError ) + TRAP( aError, ::CreateBufferL( *iMedia, iAsyncBuffer ) ); + if ( KErrNone == aError ) + { + size = iAsyncBuffer->Size(); + } + } + TPckgC sizePkg(size); + CompleteAsync(aError, 2, &sizePkg); + } + +// ---------------------------------------------------------------------------- +// Check if player is valid +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackSession::CheckPlayerL() + { + if (!iPlayer) + { + User::Leave(KErrNotReady); + } + } + +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackutility/bwinscw/mpxplaybackutilityU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackutility/bwinscw/mpxplaybackutilityU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,6 @@ +EXPORTS + ?NewL@MMPXPlaybackUtility@@SAPAV1@ABVTUid@@PAVMMPXPlaybackObserver@@@Z @ 1 NONAME ; class MMPXPlaybackUtility * MMPXPlaybackUtility::NewL(class TUid const &, class MMPXPlaybackObserver *) + ?UtilityL@MMPXPlaybackUtility@@SAPAV1@ABVTUid@@@Z @ 2 NONAME ; class MMPXPlaybackUtility * MMPXPlaybackUtility::UtilityL(class TUid const &) + ?NewL@MMPXPlaybackUtility@@SAPAV1@W4TMPXCategory@@ABVTUid@@PAVMMPXPlaybackObserver@@@Z @ 3 NONAME ; class MMPXPlaybackUtility * MMPXPlaybackUtility::NewL(enum TMPXCategory, class TUid const &, class MMPXPlaybackObserver *) + ?UtilityL@MMPXPlaybackUtility@@SAPAV1@W4TMPXCategory@@ABVTUid@@@Z @ 4 NONAME ; class MMPXPlaybackUtility * MMPXPlaybackUtility::UtilityL(enum TMPXCategory, class TUid const &) + diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackutility/eabi/mpxplaybackutilityU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackutility/eabi/mpxplaybackutilityU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,6 @@ +EXPORTS + _ZN19MMPXPlaybackUtility4NewLERK4TUidP20MMPXPlaybackObserver @ 1 NONAME + _ZN19MMPXPlaybackUtility8UtilityLERK4TUid @ 2 NONAME + _ZN19MMPXPlaybackUtility4NewLE12TMPXCategoryRK4TUidP20MMPXPlaybackObserver @ 3 NONAME + _ZN19MMPXPlaybackUtility8UtilityLE12TMPXCategoryRK4TUid @ 4 NONAME + diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackutility/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackutility/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2006 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 for project Playback utility. +* +*/ + + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +mpxplaybackutility.mmp + diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackutility/group/mpxplaybackutility.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackutility/group/mpxplaybackutility.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2006 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: playback utility project specification +* +*/ + + + +#include +#include + +TARGET mpxplaybackutility.dll +CAPABILITY CAP_GENERAL_DLL +TARGETTYPE DLL +UID 0x1000008D 0x101FFC01 +VENDORID VID_DEFAULT + +USERINCLUDE ../inc +USERINCLUDE ../../playbackserver/inc + +MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/mmf/common + +SOURCEPATH ../src +SOURCE mpxplaybackutility.cpp +SOURCE mpxplaybackutilityimpl.cpp + +LIBRARY efsrv.lib +LIBRARY euser.lib +LIBRARY bafl.lib +LIBRARY estor.lib +LIBRARY mpxcollectionutility.lib +LIBRARY mpxcommon.lib + +#if defined(ARMCC) +deffile ../eabi/ +#elif defined(WINSCW) +deffile ../bwinscw/ +#endif + diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackutility/inc/mpxplaybackutilityimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackutility/inc/mpxplaybackutilityimpl.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,664 @@ +/* +* Copyright (c) 2006 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: Implementation of interface for playbackutility +* +*/ + + + +#ifndef CMPXPLAYBACKUTILITY_H +#define CMPXPLAYBACKUTILITY_H + +#include +#include +#include +#include +#include +#include +#include "mpxplaybackutility.h" + +class CMPXMessageMonitor; +class CMPXTaskQueue; + +NONSHARABLE_STRUCT( TMPXPlaybackUtilityStruct ) + { + // Default mode playback utility + MMPXPlaybackUtility* iDefaultPlaybackUtility; + }; + +/** +* Implementation of playback utility interface +* this interface: +*/ +NONSHARABLE_CLASS(CMPXPlaybackUtility) : public CActive, + public MMPXPlaybackUtility, + public MMPXMessageObserver, + public MMPXPlayer, + public MMPXSource, + public MMPXPlayerManager + { +public: + /** + * Two-phased constructor + * + * @param aModeId playback mode id + * @param aObs observer + * @param aCategory category of client / engine + * @return object of constructed + */ + static CMPXPlaybackUtility* NewL(const TUid& aModeId, + MMPXPlaybackObserver* aObs, + const TMPXCategory aCategory); + + /** + * Gets the interface for the client, or creates a new one. + * This interface could be a singleton + */ + static MMPXPlaybackUtility* UtilityL( const TUid& aModeId, + const TMPXCategory aCategory); + +private: + /** + * Destructor + */ + ~CMPXPlaybackUtility(); + + /** + * C++ constructor + */ + CMPXPlaybackUtility(); + + /** + * Second phase constructor + * + * @param aModeId playback mode id + * @param aObs observer + * @param aCategory category of client / engine + */ + void ConstructL(const TUid& aModeId, MMPXPlaybackObserver* aObs, const TMPXCategory aCategory); + /** + * Second phase constructor + * + * @param aObs observer + */ + void ConstructL(MMPXPlaybackObserver* aObs); + + /** + * From MMPXPlaybackUtility + * Add a Observer. Clients only receive events from the engine corresponding + * to the specific mode the interface was created in + * + * @param aObs, observer to be added + */ + void AddObserverL(MMPXPlaybackObserver& aObs); + + /** + * From MMPXPlaybackUtility + * Remove a observer. + * + * @param aObs, observer to be removed + */ + void RemoveObserverL(MMPXPlaybackObserver& aObs); + + /** + * From MMPXPlaybackUtility + * Returns PIds of clients that are using the engine in the mode this + * interface was created in. For example, if a client was interested in all + * the clients' pids with an active engine, they would: + * + * MMPXPlaybackUtility* m=MMPXPlaybackUtility::NewL(EActivePlayer); + * RArray pids; + * m->GetClients(pids); + * ......... + * pids->Close(); + * m->Close(); + * + * @param aClients Array of Pids returned. + */ + void GetClientsL(RArray& aClients); + + /** + * From MMPXPlaybackUtility + * Initializes a track given by aCollectionPath + * + * @param aCollectionPath collection path + * @param aPlay Whether to initialize for playback, or + * else just to setup the engine first + */ + virtual void InitL(const CMPXCollectionPlaylist& aPlaylist, + TBool aPlay=ETrue); + + /** + * From MMPXPlaybackUtility + * Inititialises with a single item, may not be part of any collection + * + * @param aUri URI of the item + * @param aType the mime type of the item + */ + void InitL(const TDesC& aUri,const TDesC8* aType=NULL); + + /** + * From MMPXPlaybackUtility + * Inititialises with a single item, may not be part of any collection + * Before this function can be called, the file server session which owns + * this file handle must first be marked as shareable by calling + * RFs::ShareProtected(). + * + * @param aFile file handle + */ + void InitL(RFile& aShareableFile); + + /** + * From MMPXPlaybackUtility + * Frees up client side resources only; a player is freed when there are no + * clients using it, and all resources are freed when the last client closed + */ + void Close(); + + /** + * From MMPXPlaybackUtility + * Stops any async operations that are currently under way + */ + void CancelRequest(); + + /** + * From MMPXPlaybackUtility + * Issue player commands, with optional data. ECommandReceived and + * ECommandComplete events should follow + * + * @param aCmd the command + * @param aData optional data + */ + void CommandL(TMPXPlaybackCommand aCmd,TInt aData=0); + + /** + * From MMPXPlaybackUtility + * Send a command to the playback server + * + * @param aCmd, reference to command object + * @param aCallback, call back when command exection completed. + * Asynchronously command only + */ + void CommandL(CMPXCommand& aCmd, MMPXPlaybackCallback* aCallback=NULL); + + /** + * From MMPXPlaybackUtility + * Current state of player + * @return current state + */ + TMPXPlaybackState StateL() const; + + /** + * From MMPXPlaybackUtility + * Current source being played, NULL if none was supplied + * + * @return source object + */ + MMPXSource* Source(); + + /** + * From MMPXPlaybackUtility + * Player manager + * + * @return reference to player manager + */ + MMPXPlayerManager& PlayerManager(); + + /** + * From MMPXPlaybackUtility + * Set playback property, EPropertyChanged event when complete + * + * @param aProperty the property to be set + * @param aValue the the value of the property + */ + void SetL(TMPXPlaybackProperty aProperty,TInt aValue); + + /** + * From MMPXPlaybackUtility + * Get value of a playback property, Asyc + * + * @param aCallback playback callback + * @param aProperty the property + */ + void ValueL(MMPXPlaybackCallback& aCallback,TMPXPlaybackProperty aProperty); + + /** + * Get value of a playback property, Asyc + * Result will be called back in HandleProperty + * + * @param aCallback playback callback + * @param aProperty the property + */ + void PropertyL(MMPXPlaybackCallback& aCallback, + TMPXPlaybackProperty aProperty); + + /** + * From MMPXPlaybackUtility + * Return a list of mime types supported by playback framework + * + * @return an array of mime types + */ + virtual CDesCArray* SupportedMimeTypes(); + + /** + * From MMPXPlaybackUtility + * Return a list of file extensions supported by playback framework + * + * @return an array of extensions + */ + virtual CDesCArray* SupportedExtensions(); + + /** + * From MMPXPlaybackUtility + * Return a list of schemas supported by playback framework + * + * @return an array of schemas + */ + virtual CDesCArray* SupportedSchemas(); + + /** + * Sets the priority of the playback utility + * + * @param aPriority Priority to set + */ + virtual void SetPriority( TInt aPriority ); + + /** + * Adds a message subscription for this client. + * @param aSubscription subscription to be added + */ + void AddSubscriptionL(const CMPXSubscription& aSubscription); + + /** + * Removes a message subscription for this client. + * @param aSubscription subscription to be removed. + */ + void RemoveSubscriptionL(const CMPXSubscription& aSubscription); + + /** + * Removes all message subscriptions for this client. + */ + void ClearSubscriptionsL(); + + /** + * From MMPXPlayerManager + * Typically, a client will obtain the list of all the (non-duplicated) + * player 'types' in the system from GetPlayerTypesL and present localized + * type names (e.g. "Local","Home network", if possible, else if + * non-standard type,should use PlayerTypeDisplayNameL to get text from + * player). + * + * User should be given opportunity to choose IF there is more than one + * type available, or if there is one type but more than one sub players, + * the user could be presented with the sub player list. + * + * @param aTypes the list of player types + */ + void GetPlayerTypesL(RArray& aTypes); + + /** + * From MMPXPlayerManager + * Returns display name for custom types; standard types should be + * recognized by client and localized - calling this method would then not + * be required + * + * @param aType playback type + */ + HBufC* PlayerTypeDisplayNameL(TMPXPlaybackPlayerType aType); + + /** + * From MMPXPlayerManager + * Get the list of UIDs of all players + * + * @param aPlayers All the players' uids in the system + */ + void GetPlayerListL(RArray& aPlayers); + + /** + * From MMPXPlayerManager + * Get the list of UIDs of players with the specific type + * + * @param aPlayers All the players' uids with the same type + * @param aType the type of players + */ + void GetPlayerListL(RArray& aPlayers,TMPXPlaybackPlayerType aType); + + /** + * From MMPXPlayerManager + * Get the list of sub player names, Async + * + * @param aCallback sub players returned in call back interface + * @param aPlayer UID of the player + */ + void SubPlayerNamesL(MMPXPlaybackCallback& aCallback,TUid aPlayer); + + /** + * From MMPXPlayerManager + * Client selects all players with the type aType, the specific player used + * then being resolved on the basis of the content. + * + * @param aType the type of player + */ + void SelectPlayersL(TMPXPlaybackPlayerType aType); + + /** + * From MMPXPlayerManager + * Client selects specific player aPlayer and sub player aSubPlayerIndex + * from array returned by SubPlayerNamesL + * + * @param aPlayer the UID of player + * @param aSubPlayerIndex the index of the sub player + */ + void SelectSubPlayerL(TUid aPlayer,TInt aSubPlayerIndex); + + /** + * From MMPXPlayerManager + * Client selects a specific player + * + * @param aPlayer the UID of the player + */ + void SelectPlayerL(TUid aPlayer); + + /** + * From MMPXPlayerManager + * Clears all selection criteria. Essentially the same as + * SelectPlayersL(EPbLocal). + */ + void ClearSelectPlayersL(); + + /** + * From MMPXPlayerManager + * Retreives the current selection: KNullUid and KErrNotFound are possible + * return values for aPlayer and aSubPlayerIndex respectively if none are + * explicitly selected + * + * @param aType player type + * @param aPlayer the UID of player + * @param aSubPlayerIndex index of the subplayer + * @param aSubPlayerName friendly name of the subplayer + * Notes: Client owns the returned aSubPlayerName object. + */ + void GetSelectionL(TMPXPlaybackPlayerType& aType, + TUid& aPlayer, + TInt& aSubPlayerIndex, + HBufC*& aSubPlayerName); + + /** + * From MMPXPlayerManager + * The current player, may change with each item, NULL if none found + * + * @return object of current player + */ + MMPXPlayer* CurrentPlayer(); + + /** + * From MMPXPlayer + * The 'type' of the player. Built-in types are EPbLocal and EPbRemote, but + * the plug-ins could extend this if they desire to be a different type + * which can be selected by the user + * + * @return player type + */ + TMPXPlaybackPlayerType TypeL(); + + /** + * From MMPXPlayer + * If TypeL returns a value that is not known to the UI (and therefore + * can't localize it),then TypeNameL can be used for unlocalized display + * purposes. + * + * @return player name. + */ + HBufC* TypeNameL(); + + /** + * From MMPXPlayer + * If the player supports other 'players', else array count == 0. + * + * @param aCallback sub players returned in the callback + */ + void SubPlayerNamesL(MMPXPlaybackCallback& aCallback); + + /** + * From MMPXPlayer + * Selected sub player index, corresponding to sub player names array. + * + * @return sub player index. KErrNotFound if none + */ + TInt SubPlayerL() const; + + /** + * From MMPXPlayer + * The UID identifying this player + * + * @return UID of the player + */ + TUid UidL() const; + + /** + * From MMPXSource + * Path to the collection, or NULL if not in any collection + * Ownership transferred + * + * @return collection path + */ + CMPXCollectionPlaylist* PlaylistL(); + + /** + * From MMPXSource + * File passed in, or NULL if none passed in + * + * @return pointer to file handle + */ + RFile* FileL(); + + /** + * From MMPXSource + * URI of current item + * + * @return URI of the item + */ + HBufC* UriL(); + + /** + * From MMPXSource + * + * DEPRECATED + * + * Media request + * HandleMediaL of the callback + * + * @param aAttrs attributes requested + * @param aCallback playback callback + */ + void MediaL(const TArray& aAttrs, + MMPXPlaybackCallback& aCallback); + + /** + * From MMPXSource + * Media request + * HandleMediaL of the callback + * + * @param aAttrs attributes requested + * @param aCallback playback callback + * @param aSpecs, specifications for attributes + */ + void MediaL(const TArray& aAttrs, + MMPXPlaybackCallback& aCallback, + CMPXAttributeSpecs* aSpecs); + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + /** + * From MMPXSource + * File passed in, or NULL if none passed in + * + * @return pointer to file handle + */ + RFile64* File64L(); +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + + /** + * From CActive + * Handles an active object's request completion event + */ + void RunL(); + + /** + * From CActive + * Implements cancellation of an outstanding request. + */ + void DoCancel(); + + /** + * From CActive + * Handles a leave occurring in the request completion event handler RunL() + * + * @param aError error code + */ + TInt RunError(TInt aError); + + /** + * From MMPXMessageObserver + * Message received + * @param aMsgData message data + * @param aError error code + */ + void MessageReceived(TInt aMsgData, TInt aError); + + /** + * Inititialises for streaming with URI and Access Point + * + * @since S60 9.2 + * @param aUri URI of the item + * @param aType the mime type of the item + * @param aAccessPoint the access point of the item + */ + virtual void InitStreamingL(const TDesC& aUri, const TDesC8* aType, const TInt aAccessPoint); + + /** + * Inititialises for streaming with URI and Access Point, the file may not be part of any collection + * Before this function can be called, the file server session which owns + * this file handle must first be marked as shareable by calling + * RFs::ShareProtected(). + * + * @since S60 9.2 + * @param aShareableFile shareable file handle + * @param aAccessPoint the access point of the item + */ + virtual void InitStreamingL(RFile& aShareableFile, const TInt aAccessPoint); + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + /** + * Inititialises with a single item, may not be part of any collection + * Before this function can be called, the file server session which owns + * this file handle must first be marked as shareable by calling + * RFs::ShareProtected(). + * + * @since S60 9.2 + * @param aShareableFile shareable RFile64 file handle + */ + virtual void Init64L(RFile64& aShareableFile); + + /** + * Inititialises for streaming with URI and Access Point, the file may not be part of any collection + * Before this function can be called, the file server session which owns + * this file handle must first be marked as shareable by calling + * RFs::ShareProtected(). + * + * @since S60 9.2 + * @param aShareableFile shareable RFile64 file handle + * @param aAccessPoint the access point of the item + */ + virtual void InitStreaming64L(RFile64& aShareableFile, const TInt aAccessPoint); +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + +private: + + + /** + * Helper to return a descriptor buffer + * + * @param aSize size of the buffer + */ + HBufC* DesL(TInt aSize); + + /** + * Add a request + * + * @param aFunction function code + * @param aCallback callback + * @param aParamData data + * @param aBuf buffer data, ownership transferred + * @param aPtr, pointer to a object + * @param aAlivePtr1, object to keep alive for a task + * ownership transferred + * @leave leave with system error code when failed + */ + void AddRequestL(TMPXPlaybackServerOp aFunction, + MMPXPlaybackCallback* aCallback=NULL, + TInt aParamData=0, + CBufBase* aBuf=NULL, + TAny* aPtr=NULL, + CBase* aAlivePtr=NULL); + + /** + * Send next request to server + */ + void ExecuteNextRequest(); + + /** + * Handle message from message queue + * @param aMsgData message data + * @param aError error code + */ + void HandleMessageL(TInt aMsgData, TInt aError); + + /** + * Handles error in RunL + * + * @param aError error code + */ + void HandleRunErrorL(TInt aError); + +#ifdef _ENABLE_GUARD_TIMER + /** + * Gaurd timer callback + * + * @param aPtr pointer the this + */ + static TInt GuardTimerCallback(TAny* aPtr); +#endif + +private: + RArray iObservers; + CMPXMessageMonitor* iMsgMonitor; + CMPXTaskQueue* iTaskQueue; + RMPXSession iPbs; + CBufBase* iBuffer; + TPckgBuf iPropertyValuePckg; + TPckgBuf iCompletePckg; + TPckgBuf iResultSizePckg; + RFile iFile; + TBool iCallbackOngoing; // whether client is processing callback or not +#ifdef _ENABLE_GUARD_TIMER + CPeriodic* iGuardTimer; // guard timer for async request +#endif + CMPXMedia* iMediaOnError; // media object while handling error + TInt iRefCount; +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + RFile64 iFile64; +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + }; + +#endif // CMPXPLAYBACKUTILITY_H diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackutility/src/mpxplaybackutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackutility/src/mpxplaybackutility.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,64 @@ +/* +* 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: Factory method to create playback utility object +* +*/ + + +#include"mpxplaybackutilityimpl.h" + + +// ============================== MEMBER FUNCTIONS ============================ + +// ---------------------------------------------------------------------------- +// Create the playback utility object +// ---------------------------------------------------------------------------- +// +EXPORT_C MMPXPlaybackUtility* MMPXPlaybackUtility::NewL(const TUid& aModeId, + MMPXPlaybackObserver* aObs) + { + return CMPXPlaybackUtility::NewL(aModeId,aObs, EMPXCategoryMusic); + } + +// ---------------------------------------------------------------------------- +// Create the playback utility object +// ---------------------------------------------------------------------------- +// + +EXPORT_C MMPXPlaybackUtility* MMPXPlaybackUtility::NewL(const TMPXCategory aCategory, + const TUid& aModeId, + MMPXPlaybackObserver* aObs) + { + return CMPXPlaybackUtility::NewL(aModeId,aObs,aCategory); + } + +// ---------------------------------------------------------------------------- +// Creates the playback utility object if not already created +// ---------------------------------------------------------------------------- +// +EXPORT_C MMPXPlaybackUtility* MMPXPlaybackUtility::UtilityL( const TUid& aModeId ) + { + return CMPXPlaybackUtility::UtilityL( aModeId, EMPXCategoryMusic ); + } + +// ---------------------------------------------------------------------------- +// Creates the playback utility object if not already created +// ---------------------------------------------------------------------------- +// + +EXPORT_C MMPXPlaybackUtility* MMPXPlaybackUtility::UtilityL(const TMPXCategory aCategory, + const TUid& aModeId ) + { + return CMPXPlaybackUtility::UtilityL( aModeId, aCategory ); + } diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/playbackutility/src/mpxplaybackutilityimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/playbackutility/src/mpxplaybackutilityimpl.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,1337 @@ +/* +* Copyright (c) 2006 - 2007 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: Playback Utility implementation +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mpxplaybackserverdefs.h" +#include "mpxplaybackutilityimpl.h" + +// ============================== MEMBER FUNCTIONS ============================ + +// --------------------------------------------------------------------------- +// Retrieves playback utility from TLS. Creates if it's not there. +// --------------------------------------------------------------------------- +// +MMPXPlaybackUtility* CMPXPlaybackUtility::UtilityL( + const TUid& aModeId, + const TMPXCategory aCategory) + { + MPX_FUNC("CMPXPlaybackUtility::UtilityL"); + MMPXPlaybackUtility* utility( NULL ); + // Currently only make the default mode a singleton since it's used the most + // If needed we could make other modes a singleton as well. This is why + // a struct was used to store in the TLS so that more utilities can be + // added easily. + if ( KPbModeDefault == aModeId ) + { + TMPXPlaybackUtilityStruct* s( reinterpret_cast( Dll::Tls() )); + if ( !s ) + { + MPX_DEBUG1("CMPXPlaybackUtility::UtilityL(): Creating default mode"); + utility = CMPXPlaybackUtility::NewL( aModeId, NULL, aCategory ); + CleanupClosePushL( *utility ); + MPX_DEBUG2("CMPXPlaybackUtility::UtilityL(): utility = 0x%08x", utility); + s = new (ELeave) TMPXPlaybackUtilityStruct; + s->iDefaultPlaybackUtility = utility; + Dll::SetTls( s ); + CleanupStack::Pop( utility ); + } + else + { + utility = s->iDefaultPlaybackUtility; + MPX_DEBUG2("CMPXPlaybackUtility::UtilityL(): Retrieving default mode 0x%08x", utility); + static_cast( utility )->iRefCount++; + } + } + else + { + MPX_DEBUG1("CMPXPlaybackUtility::UtilityL(): Not default mode"); + utility = CMPXPlaybackUtility::NewL( aModeId, NULL, aCategory ); + } + return utility; + } + +// ---------------------------------------------------------------------------- +// Two phases constructor +// ---------------------------------------------------------------------------- +// +CMPXPlaybackUtility* CMPXPlaybackUtility::NewL(const TUid& aModeId, + MMPXPlaybackObserver* aObs, + const TMPXCategory aCategory) + { + CMPXPlaybackUtility* p=new(ELeave)CMPXPlaybackUtility(); + CleanupStack::PushL(p); + p->ConstructL(aModeId,aObs,aCategory); + CleanupStack::Pop(p); + return p; + } + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CMPXPlaybackUtility::~CMPXPlaybackUtility() + { + MPX_FUNC_EX("CMPXPlaybackUtility::~CMPXPlaybackUtility"); + Cancel(); +#ifdef _ENABLE_GUARD_TIMER + delete iGuardTimer; +#endif + if (iTaskQueue) + { + delete iTaskQueue; + } + if (iMsgMonitor) + { + delete iMsgMonitor; + } + iObservers.Close(); + iPbs.Close(); + iFile.Close(); + if (iBuffer) + { + delete iBuffer; + } + delete iMediaOnError; +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + iFile64.Close(); +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + } + +// ---------------------------------------------------------------------------- +// C++ constructor +// Create a unique name out of thread ID and this pointer: no other instance of +// this object will have the same name; used to identify this object for +// recieving messages +// ---------------------------------------------------------------------------- +// +CMPXPlaybackUtility::CMPXPlaybackUtility() + : CActive(EPriorityStandard), + iCallbackOngoing(EFalse) + { + CActiveScheduler::Add(this); + } + +// ---------------------------------------------------------------------------- +// 2nd construtor +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::ConstructL(const TUid& aModeId, + MMPXPlaybackObserver* aObs, + const TMPXCategory aCategory) + { + MPX_FUNC_EX("CMPXPlaybackUtility::ConstructL()"); + MPX_DEBUG4("CMPXPlaybackUtility::ConstructL this 0x%08x mode 0x%08x observer 0x%08x", + this, aModeId.iUid, aObs); + if (aObs) + { + AddObserverL(*aObs); + } + iTaskQueue = CMPXTaskQueue::NewL(); + User::LeaveIfError(iPbs.Connect(KMPXPlaybackServerName, + KMPXPlaybackServerImg, + TVersion(KMPXPlaybackServerMajorVersionNumber, + KMPXPlaybackServerMinorVersionNumber, + KMPXPlaybackServerBuildVersionNumber))); + iPbs.SendReceiveL(EPbsSetMode,TIpcArgs(aModeId.iUid, aCategory)); + iMsgMonitor = CMPXMessageMonitor::NewL(iPbs, *this); +#ifdef _ENABLE_GUARD_TIMER + iGuardTimer=CPeriodic::NewL(CActive::EPriorityStandard); +#endif + iMediaOnError = CMPXMedia::NewL(); + iRefCount++; + } + +// ---------------------------------------------------------------------------- +// Add a observer +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::AddObserverL(MMPXPlaybackObserver& aObs) + { + MPX_FUNC_EX("CMPXPlaybackUtility::AddObserverL()"); + iObservers.AppendL(&aObs); + } + +// ---------------------------------------------------------------------------- +// Remove a observer +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::RemoveObserverL(MMPXPlaybackObserver& aObs) + { + MPX_FUNC_EX("CMPXPlaybackUtility::RemoveObserverL()"); + TInt i=iObservers.FindL(&aObs); + iObservers.Remove(i); + } + +// ---------------------------------------------------------------------------- +// Returns PIds of clients that are using the engine in the mode +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::GetClientsL(RArray& aClients) + { + MPX_FUNC_EX("CMPXPlaybackUtility::GetClientsL()"); + TInt size = iPbs.SendReceiveL(EPbsGetClients); + ::ArrayFromServerL(iPbs, EPbsGetSyncBuffer,size,aClients); + } + +// ---------------------------------------------------------------------------- +// Initializes a track given by aIndex in path aCollectionPath +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::InitL( + const CMPXCollectionPlaylist& aPlaylist, + TBool aPlay /*=ETrue*/ ) + { + MPX_FUNC("CMPXPlaybackUtility::InitL()"); + MPX_DEBUG_THREAD("CMPXPlaybackUtility::InitL()"); + CBufBase* buffer(NULL); + ::CreateBufferL(aPlaylist, buffer); + CleanupStack::PushL( buffer ); + TPtr8 p=buffer->Ptr(0); + iPbs.SendReceiveL(EPbsInitFromCollection,TIpcArgs(&p,aPlay)); + CleanupStack::PopAndDestroy( buffer ); + } + +// ---------------------------------------------------------------------------- +// Inititialises with a single song, may not be part of any collection +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::InitL(const TDesC& aUri,const TDesC8* aType) + { + MPX_FUNC("CMPXPlaybackUtility::InitL(const TDesC& aUri,const TDesC8* aType)"); + MPX_DEBUG_THREAD("CMPXPlaybackUtility::InitL()"); + const TDesC8& type=aType?*aType:KNullDesC8; + TPtrC8 uri = MPXUser::Ptr(aUri); + iPbs.SendReceiveL(EPbsInitFromUri,TIpcArgs(&uri,&type)); + } + +// ---------------------------------------------------------------------------- +// Inititialises with a single song, may not be part of any collection +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::InitL(RFile& aShareableFile) + { + MPX_FUNC("CMPXPlaybackUtility::InitL(RFile& aShareableFile)"); + MPX_DEBUG_THREAD("CMPXPlaybackUtility::InitL()"); + if (!aShareableFile.SubSessionHandle()) + { + User::Leave(KErrArgument); + } + TIpcArgs args; + aShareableFile.TransferToServer(args,0,1); + iPbs.SendReceiveL(EPbsInitFromFile,args); + } + +// ---------------------------------------------------------------------------- +// Inititialises with a URI +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::InitStreamingL(const TDesC& aUri, const TDesC8* aType, const TInt aAccessPoint) +{ + MPX_FUNC("CMPXPlaybackUtility::InitStreamingL(const TDesC& aUri, const TInt aAccessPoint)"); + MPX_DEBUG_THREAD("CMPXPlaybackUtility::InitStreamingL()"); + + const TDesC8& type=aType?*aType:KNullDesC8; + TPtrC8 uri = MPXUser::Ptr(aUri); + iPbs.SendReceiveL(EPbsInitStreamingFromUri,TIpcArgs(&uri, &type, aAccessPoint)); + +} + + +// ---------------------------------------------------------------------------- +// Inititialises with a file, may not be part of any collection +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::InitStreamingL(RFile& aShareableFile, const TInt aAccessPoint) +{ + MPX_FUNC("CMPXPlaybackUtility::InitStreamingL(RFile& aShareableFile, const TInt aAccessPoint)"); + MPX_DEBUG_THREAD("CMPXPlaybackUtility::InitStreamingL()"); + if (!aShareableFile.SubSessionHandle()) + { + User::Leave(KErrArgument); + } + TIpcArgs args; + aShareableFile.TransferToServer(args,0,1); + args.Set(2, aAccessPoint); //use index "2" for setting the AccessPoint + + iPbs.SendReceiveL(EPbsInitStreamingFromFile, args); +} + +// ---------------------------------------------------------------------------- +// Frees up client side resources only; a player is freed when there are no +// clients using it, and all resources are freed when the last client closed +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::Close() + { + MPX_DEBUG2("CMPXPlaybackUtility::Close 0x%08x", this); + ASSERT( iRefCount > 0 ); + if ( --iRefCount == 0 ) + { + // last client released + iMsgMonitor->Cancel(); + TMPXPlaybackUtilityStruct* s( reinterpret_cast( Dll::Tls() )); + if ( s ) + { + if ( s->iDefaultPlaybackUtility == this ) + { + delete s; + Dll::SetTls( NULL ); + } + } + delete this; + } + } + +// ---------------------------------------------------------------------------- +// Stops any async operations that are currently under way +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::CancelRequest() + { + MPX_FUNC_EX("CMPXPlaybackUtility::CancelRequest()"); + Cancel(); + iTaskQueue->Reset(); + } + +// ---------------------------------------------------------------------------- +// Issue player commands, with optional data. +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::CommandL(TMPXPlaybackCommand aCmd,TInt aData) + { + MPX_DEBUG2("-->CMPXPlaybackUtility::CommandL(%d)", aCmd); + MPX_DEBUG_THREAD("CMPXPlaybackUtility::CommandL()"); + CMPXCommand* cmd = CMPXCommand::NewL(); + CleanupStack::PushL(cmd); + cmd->SetTObjectValueL(KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral); + // All of current commands are sync + cmd->SetTObjectValueL(KMPXCommandGeneralDoSync, ETrue); + cmd->SetTObjectValueL(KMPXCommandPlaybackGeneralType, aCmd); + cmd->SetTObjectValueL(KMPXCommandPlaybackGeneralData, aData); + CommandL(*cmd, NULL); + CleanupStack::PopAndDestroy(cmd); + MPX_DEBUG2("<--CMPXPlaybackUtility::CommandL(%d)", aCmd); + } + +// ---------------------------------------------------------------------------- +// Issue player commands +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::CommandL( + CMPXCommand& aCmd, + MMPXPlaybackCallback* aCallback/*=NULL*/) + { + MPX_FUNC_EX("CMPXPlaybackUtility::CommandL(CMPXCommand& aCmd)"); + MPX_DEBUG_THREAD("CMPXPlaybackUtility::CommandL(CMPXCommand& aCmd)"); + ASSERT(aCmd.IsSupported(KMPXCommandGeneralId)); + TInt id = aCmd.ValueTObjectL(KMPXCommandGeneralId); + MPX_DEBUG2("CMPXPlaybackUtility::CommandL(): id = 0x%08x", id); + if (KMPXCommandIdPlaybackGeneral==id) + { + ASSERT(aCmd.IsSupported(KMPXCommandPlaybackGeneralType)); + TMPXPlaybackCommand cmdType = static_cast( + aCmd.ValueTObjectL(KMPXCommandPlaybackGeneralType)); + MPX_DEBUG2("CMPXPlaybackUtility::CommandL(): cmdType = %d", cmdType); + if ( EPbCmdPlay == cmdType || + EPbCmdPlayPause == cmdType || + EPbCmdStop == cmdType) + { + aCmd.SetTObjectValueL(KMPXCommandPlaybackGeneralClientPid, + RProcess().Id()); // current process id + } + } + + TBool asyncVar(ETrue); // by default command is asynchronous + if (aCmd.IsSupported(KMPXCommandGeneralDoSync)) + { // check if command is sync + asyncVar=!(aCmd.ValueTObjectL(KMPXCommandGeneralDoSync)); + } + CBufBase* buf(NULL); + ::CreateBufferL( aCmd, buf ); + CleanupStack::PushL( buf ); + TPtr8 ptr = buf->Ptr(0); + if (asyncVar) + { // async request + ASSERT(aCallback); // callback must be provided for asynchronous command + // Increase reference count on command ownership transferred + CMPXCommand* ref = CMPXCommand::NewL(aCmd); + // Async version, Add request to the task queue + CleanupStack::PushL(ref); + AddRequestL(EPbsCommand, aCallback, asyncVar, buf, NULL, ref ); + CleanupStack::Pop(ref); + CleanupStack::Pop( buf ); // ownership transferred to the queue + } + else + { // send request if sync + iPbs.SendReceiveL(EPbsCommand, TIpcArgs(asyncVar, &ptr)); + CleanupStack::PopAndDestroy( buf ); + } + } + +// ---------------------------------------------------------------------------- +// Current state of player +// ---------------------------------------------------------------------------- +// +TMPXPlaybackState CMPXPlaybackUtility::StateL() const + { + MPX_DEBUG2("CMPXPlaybackUtility::StateL 0x%08x", this); + return static_cast(iPbs.SendReceiveL(EPbsGetState)); + } + +// ---------------------------------------------------------------------------- +// Determine whether there is a song by the state of the engine: if there is, +// its OK to return MMPXMedia, else NULL is returned +// ---------------------------------------------------------------------------- +// +MMPXSource* CMPXPlaybackUtility::Source() + { + MPX_FUNC_EX("CMPXPlaybackUtility::Source()"); + TMPXPlaybackState s=EPbStateNotInitialised; + TRAP_IGNORE(s=StateL()); + return (s==EPbStateNotInitialised || + s==EPbStateShuttingDown) ? NULL:this; + } + +// ---------------------------------------------------------------------------- +// Get player manager +// ---------------------------------------------------------------------------- +// +MMPXPlayerManager& CMPXPlaybackUtility::PlayerManager() + { + return *this; + } + +// ---------------------------------------------------------------------------- +// Set playback property, EPropertyChanged event when complete +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::SetL(TMPXPlaybackProperty aProperty,TInt aValue) + { + MPX_FUNC_EX("CMPXPlaybackUtility::SetL()"); + iPbs.SendReceiveL(EPbsSetProperty,TIpcArgs(aProperty,aValue)); + } + +// ---------------------------------------------------------------------------- +// Send property request +// Result will be called back in HandleProperty +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::ValueL(MMPXPlaybackCallback& aCallback, + TMPXPlaybackProperty aProperty) + { + MPX_FUNC_EX("CMPXPlaybackUtility::ValueL()"); + PropertyL(aCallback, aProperty); + } + +// ---------------------------------------------------------------------------- +// Send property request +// Result will be called back in HandleProperty +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::PropertyL( + MMPXPlaybackCallback& aCallback, + TMPXPlaybackProperty aProperty) + { + MPX_DEBUG2("-->CMPXPlaybackUtility::PropertyL(%d)", aProperty); + MPX_DEBUG_THREAD("CMPXPlaybackUtility::PropertyL()"); + AddRequestL(EPbsGetProperty, &aCallback, aProperty); + MPX_DEBUG2("<--CMPXPlaybackUtility::PropertyL(%d)", aProperty); + } + +// ---------------------------------------------------------------------------- +// Return a list of mime types supported by playback framework +// ---------------------------------------------------------------------------- +// +CDesCArray* CMPXPlaybackUtility::SupportedMimeTypes() + { + MPX_FUNC_EX("CMPXPlaybackUtility::SupportedMimeTypes()"); + TInt size = 0; + TRAPD( err, size = iPbs.SendReceiveL( EPbsGetSupportedMimeTypes ) ); + CDesCArray* desArray = NULL; + if ( size && ( err == KErrNone ) ) + { + TRAP_IGNORE( + ::TransferBufferFromServerL(iPbs, EPbsGetSyncBuffer, size, iBuffer); + MPXUser::CreateFromBufferL(*iBuffer, desArray)); + } + return desArray; + } + +// ---------------------------------------------------------------------------- +// Return a list of mime types supported by playback framework +// ---------------------------------------------------------------------------- +// +CDesCArray* CMPXPlaybackUtility::SupportedExtensions() + { + MPX_FUNC_EX("CMPXPlaybackUtility::SupportedExtensions()"); + TInt size = 0; + TRAPD( err, size = iPbs.SendReceiveL( EPbsGetSupportedExtensions ) ); + CDesCArray* desArray = NULL; + if ( size && ( err == KErrNone ) ) + { + TRAP_IGNORE( + ::TransferBufferFromServerL(iPbs, EPbsGetSyncBuffer, size, iBuffer); + MPXUser::CreateFromBufferL(*iBuffer, desArray)); + } + return desArray; + } + +// ---------------------------------------------------------------------------- +// Return a list of mime types supported by playback framework +// ---------------------------------------------------------------------------- +// +CDesCArray* CMPXPlaybackUtility::SupportedSchemas() + { + MPX_FUNC_EX("CMPXPlaybackUtility::SupportedSchemas()"); + TInt size = 0; + TRAPD( err, size = iPbs.SendReceiveL( EPbsGetSupportedSchemas ) ); + CDesCArray* desArray = NULL; + if ( size && ( err == KErrNone ) ) + { + TRAP_IGNORE( + ::TransferBufferFromServerL(iPbs, EPbsGetSyncBuffer, size, iBuffer); + MPXUser::CreateFromBufferL(*iBuffer, desArray)); + } + return desArray; + } + +// ---------------------------------------------------------------------------- +// Sets the priority of the playback utility +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::SetPriority( TInt aPriority ) + { + MPX_DEBUG2("-->CMPXPlaybackUtility::SetPriority(%d)", aPriority); + MPX_DEBUG_THREAD("CMPXPlaybackUtility::SetPriority()"); + CActive::SetPriority( aPriority ); + MPX_DEBUG2("-->CMPXPlaybackUtility::SetPriority(%d)", aPriority); + } + + +// ---------------------------------------------------------------------------- +// CMPXPlaybackUtility::AddSubscriptionL +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::AddSubscriptionL( + const CMPXSubscription& aSubscription) + { + const CMPXMediaArray* items = aSubscription.ItemsL(); + User::LeaveIfNull(const_cast(items)); + CMPXCommand* cmd = CMPXCommand::NewL(); + CleanupStack::PushL(cmd); + cmd->SetTObjectValueL(KMPXCommandGeneralId, KMPXCommandSubscriptionAdd); + cmd->SetCObjectValueL(KMPXCommandSubscriptionAddItems, items); + cmd->SetTObjectValueL(KMPXCommandGeneralDoSync, ETrue); + CommandL(*cmd); + CleanupStack::PopAndDestroy(cmd); + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackUtility::RemoveSubscriptionL +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::RemoveSubscriptionL( + const CMPXSubscription& aSubscription) + { + const CMPXMediaArray* items = aSubscription.ItemsL(); + User::LeaveIfNull(const_cast(items)); + CMPXCommand* cmd = CMPXCommand::NewL(); + CleanupStack::PushL(cmd); + cmd->SetTObjectValueL(KMPXCommandGeneralId, KMPXCommandSubscriptionRemove); + cmd->SetCObjectValueL(KMPXCommandSubscriptionAddItems, items); + cmd->SetTObjectValueL(KMPXCommandGeneralDoSync, ETrue); + CommandL(*cmd); + CleanupStack::PopAndDestroy(cmd); + } + +// ---------------------------------------------------------------------------- +// CMPXPlaybackUtility::ClearSubscriptionsL +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::ClearSubscriptionsL() + { + CMPXCommand* cmd = CMPXCommand::NewL(); + CleanupStack::PushL(cmd); + cmd->SetTObjectValueL(KMPXCommandGeneralId, KMPXCommandSubscriptionRemoveAll); + cmd->SetTObjectValueL(KMPXCommandGeneralDoSync, ETrue); + CommandL(*cmd); + CleanupStack::PopAndDestroy(cmd); + } +// ---------------------------------------------------------------------------- +// Get a list of player types +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::GetPlayerTypesL( + RArray& aTypes) + { + MPX_FUNC_EX("CMPXPlaybackUtility::GetPlayerTypesL()"); + TInt size = iPbs.SendReceiveL(EPbsGetPlayerTypes); + ::ArrayFromServerL(iPbs, EPbsGetSyncBuffer,size,aTypes); + } + +// ---------------------------------------------------------------------------- +// Returns display name for custom types +// ---------------------------------------------------------------------------- +// +HBufC* CMPXPlaybackUtility::PlayerTypeDisplayNameL(TMPXPlaybackPlayerType aType) + { + MPX_FUNC_EX("CMPXPlaybackUtility::PlayerTypeDisplayNameL()"); + return DesL(iPbs.SendReceiveL(EPbsGetPlayerTypeDisplayName,TIpcArgs(aType))); + } + +// ---------------------------------------------------------------------------- +// Get the list of UIDs of all players +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::GetPlayerListL(RArray& aPlayers) + { + MPX_FUNC_EX("CMPXPlaybackUtility::GetPlayerListL(Rarray)"); + TInt size = iPbs.SendReceiveL(EPbsGetAllPlayersUids); + ::ArrayFromServerL(iPbs, EPbsGetSyncBuffer,size,aPlayers); + } + +// ---------------------------------------------------------------------------- +// Get the list of UIDs of players with the specific type +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::GetPlayerListL(RArray& aPlayers, + TMPXPlaybackPlayerType aType) + { + MPX_FUNC_EX("CMPXPlaybackUtility::GetPlayerListL(TMPXPlaybackPlayerType)"); + TInt size = iPbs.SendReceiveL(EPbsGetPlayersUidsForType, TIpcArgs(aType)); + ::ArrayFromServerL(iPbs, EPbsGetSyncBuffer,size,aPlayers); + } + +// ---------------------------------------------------------------------------- +// Asynchronous method: when server completes message, RunL() will be called +// and then the observer is notified of the results. Data required for the +// results that is not supplied by the server is stored; data supplied by the +// server is written back into packaged descriptors in this address space +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::SubPlayerNamesL(MMPXPlaybackCallback& aCallback, + TUid aPlayer) + { + MPX_FUNC_EX("CMPXPlaybackUtility::SubPlayerNamesL()"); + AddRequestL(EPbsGetSubPlayerNamesByUid, &aCallback, aPlayer.iUid); + } + +// ---------------------------------------------------------------------------- +// Selects all players with the type +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::SelectPlayersL(TMPXPlaybackPlayerType aType) + { + MPX_FUNC_EX("CMPXPlaybackUtility::SelectPlayersL(TMPXPlaybackPlayerType)"); + iPbs.SendReceiveL(EPbsSelectPlayerByType,TIpcArgs(aType)); + } + +// ---------------------------------------------------------------------------- +// Selects a specific player +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::SelectPlayerL(TUid aPlayer) + { + MPX_FUNC_EX("CMPXPlaybackUtility::SelectPlayersL(TUid)"); + iPbs.SendReceiveL(EPbsSelectPlayerByUid,TIpcArgs(aPlayer.iUid)); + } + +// ---------------------------------------------------------------------------- +// Selects a specific player and sub player +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::SelectSubPlayerL(TUid aPlayer,TInt aSubPlayerIndex) + { + MPX_FUNC_EX("CMPXPlaybackUtility::SelectSubPlayerL()"); + iPbs.SendReceiveL(EPbsSelectSubPlayer, + TIpcArgs(aPlayer.iUid,aSubPlayerIndex)); + } + +// ---------------------------------------------------------------------------- +// Clears all selection criteria. +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::ClearSelectPlayersL() + { + MPX_FUNC_EX("CMPXPlaybackUtility::ClearSelectPlayersL()"); + iPbs.SendReceiveL(EPbsClearPlayerSelection); + } + +// ---------------------------------------------------------------------------- +// Retreives the current selection +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::GetSelectionL(TMPXPlaybackPlayerType& aType, + TUid& aPlayer, + TInt& aSubPlayerIndex, + HBufC*& aSubPlayerName) + { + MPX_FUNC_EX("CMPXPlaybackUtility::GetSelectionL()"); + if (aSubPlayerName) + { + delete aSubPlayerName; + aSubPlayerName = NULL; + } + TPckg type(aType); + TPckg uid(aPlayer); + TPckg index(aSubPlayerIndex); + TPckgBuf size; + iPbs.SendReceiveL(EPbsGetSelection,TIpcArgs(&type,&uid,&index, &size)); + if (size()) + { + ::TransferBufferFromServerL(iPbs, EPbsGetSyncBuffer, size(), iBuffer); + aSubPlayerName = MPXUser::Ptr(iBuffer->Ptr(0)).AllocL(); + } // else aSubPlayer return NULL; + } + +// ---------------------------------------------------------------------------- +// The current player +// ---------------------------------------------------------------------------- +// +MMPXPlayer* CMPXPlaybackUtility::CurrentPlayer() + { + MPX_FUNC_EX("CMPXPlaybackUtility::CurrentPlayer()"); + TInt r=0; + TRAP_IGNORE(r=iPbs.SendReceiveL(EPbsPlayerFound)); + return r ? this : NULL; + } + +// ---------------------------------------------------------------------------- +// The 'type' of the player +// ---------------------------------------------------------------------------- +// +TMPXPlaybackPlayerType CMPXPlaybackUtility::TypeL() + { + MPX_FUNC_EX("CMPXPlaybackUtility::TypeL()"); + return static_cast( + iPbs.SendReceiveL(EPbsGetPlayerType)); + } + +// ---------------------------------------------------------------------------- +// The name of player type +// ---------------------------------------------------------------------------- +// +HBufC* CMPXPlaybackUtility::TypeNameL() + { + MPX_FUNC_EX("CMPXPlaybackUtility::TypeNameL()"); + return DesL(iPbs.SendReceiveL(EPbsGetTypeName)); + } + +// ---------------------------------------------------------------------------- +// Get sub players +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::SubPlayerNamesL(MMPXPlaybackCallback& aCallback) + { + MPX_FUNC_EX("CMPXPlaybackUtility::SubPlayerNamesL()"); + SubPlayerNamesL(aCallback,UidL()); + } + +// ---------------------------------------------------------------------------- +// Selected sub player index +// ---------------------------------------------------------------------------- +// +TInt CMPXPlaybackUtility::SubPlayerL() const + { + MPX_DEBUG2("CMPXPlaybackUtility::SubPlayerL 0x%08x", this); + return iPbs.SendReceiveL(EPbsGetSubPlayerIndex); + } + +// ---------------------------------------------------------------------------- +// The UID identifying this player +// ---------------------------------------------------------------------------- +// +TUid CMPXPlaybackUtility::UidL() const + { + MPX_DEBUG2("-->CMPXPlaybackUtility::UidL 0x%08x", this); + TPckgBuf uidPkg; + iPbs.SendReceiveL(EPbsGetPlayerUid, TIpcArgs(&uidPkg)); + MPX_DEBUG2("<--CMPXPlaybackUtility::UidL 0x%08x", this); + return TUid::Uid(uidPkg()); + } + +// ---------------------------------------------------------------------------- +// Path to the collection +// ---------------------------------------------------------------------------- +// +CMPXCollectionPlaylist* CMPXPlaybackUtility::PlaylistL() + { + MPX_FUNC_EX("CMPXPlaybackUtility::PlaylistL()"); + CMPXCollectionPlaylist *p = NULL; + TInt size = iPbs.SendReceiveL(EPbsGetCollectionPlaylist); + if (size > 0) + { + ::TransferBufferFromServerL(iPbs, EPbsGetSyncBuffer, size, iBuffer); + ::NewFromBufferL(*iBuffer, p); + } + return p; + } + +// ---------------------------------------------------------------------------- +// Return file handle +// ---------------------------------------------------------------------------- +// +RFile* CMPXPlaybackUtility::FileL() + { + MPX_FUNC_EX("CMPXPlaybackUtility::FileL()"); + TPckgBuf fileHandle; + TInt fsHandle = iPbs.SendReceiveL(EPbsGetFile,TIpcArgs(&fileHandle)); + RFile* file(NULL); + if (KErrNotFound != fileHandle()) + { + iFile.Close(); + User::LeaveIfError(iFile.AdoptFromServer(fsHandle,fileHandle())); + file = &iFile; + } // else return NULL + return file; + } + +// ---------------------------------------------------------------------------- +// URI of current song +// ---------------------------------------------------------------------------- +// +HBufC* CMPXPlaybackUtility::UriL() + { + MPX_FUNC_EX("CMPXPlaybackUtility::UriL()"); + return DesL(iPbs.SendReceiveL(EPbsGetUri)); + } + +// ---------------------------------------------------------------------------- +// Request for media properties. +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::MediaL( + const TArray& aAttrs, + MMPXPlaybackCallback& aCallback) + { + MPX_FUNC_EX( "-->CMPXPlaybackUtility::MediaL 2 parameters" ); + MediaL( aAttrs, aCallback, NULL ); + } + +// ---------------------------------------------------------------------------- +// Request for media properties. +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::MediaL( + const TArray& aAttrs, + MMPXPlaybackCallback& aCallback, + CMPXAttributeSpecs* aSpecs) + { + MPX_FUNC_EX( "-->CMPXPlaybackUtility::MediaL 3 parameters" ); + MPX_DEBUG_THREAD("CMPXPlaybackUtility::MediaL()"); + + CMPXCommand* cmd = CMPXCommand::NewL(); + CleanupStack::PushL( cmd ); + cmd->SetTObjectValueL(KMPXCommandGeneralId, KMPXCommandContentIdMedia); + + CBufBase* buf = CBufFlat::NewL( KMPXBufGranularity ); + CleanupStack::PushL( buf ); + RBufWriteStream writeStream( *buf ); + CleanupClosePushL( writeStream ); + // externalize attributes array + ::ExternalizeL(aAttrs, writeStream); + // Close and compress buffer + writeStream.CommitL(); + buf->Compress(); + CleanupStack::PopAndDestroy( &writeStream ); + TPtrC ptr = MPXUser::Ptr( buf->Ptr( 0 ) ); + cmd->SetTextValueL( KMPXCommandMediaAttribute, ptr ); + CleanupStack::PopAndDestroy( buf ); + + CMPXAttributeSpecs* attrSpecs = aSpecs ? + CMPXAttributeSpecs::NewL(*aSpecs) : CMPXAttributeSpecs::NewL(); + CleanupStack::PushL(attrSpecs); + cmd->SetCObjectValueL( + KMPXCommandMediaAttributeSpecs, attrSpecs ); + CleanupStack::PopAndDestroy(attrSpecs); + + AddRequestL(EPbsGetMedia, &aCallback, 0, NULL, (TAny*)cmd, cmd ); + CleanupStack::Pop( cmd ); // Ownership transferred to the task queue + } + +// ---------------------------------------------------------------------------- +// Server has completed the message, and if there's no error, the results are +// available. The server completes with the function id (or error) so the correct +// callback is made +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::RunL() + { +#ifdef _ENABLE_GUARD_TIMER + iGuardTimer->Cancel(); +#endif + TInt err=iStatus.Int(); + TInt task = iTaskQueue->Task(); + MPX_DEBUG4("CMPXPlaybackUtility::RunL 0x%08x task %d err%d", + this, task, err); + if (KErrNotFound == task) + { + return; + } + + // Try again in case server is down for IAD + if (err == KErrDied || err == KErrServerTerminated) + { + MPX_DEBUG3("-->CMPXPlaybackUtility::RunL Reconnecting session for IAD 0x%08x task %d", + this, task); + + // attempt to bring the server back up + err = iPbs.Reconnect(); + + if (err != KErrNone) + { + MPX_DEBUG1("-->CMPXPlaybackUtility::RunL Reconnect Failed"); + } + } + + User::LeaveIfError(err); + MMPXPlaybackCallback* cb = + static_cast(iTaskQueue->Callback()); + switch(task) + { + case EPbsGetProperty: + { + iCallbackOngoing = ETrue; + cb->HandlePropertyL( + static_cast(iTaskQueue->Param()), + iPropertyValuePckg(), err); + iCallbackOngoing = EFalse; + break; + } + case EPbsGetSubPlayerNamesByUid: + { + if (KErrNone == err) + { + CDesCArray* desArray = NULL; + if (iResultSizePckg()) + { + ::TransferBufferFromServerL(iPbs, EPbsGetAsyncBuffer, + iResultSizePckg(), iBuffer); + MPXUser::CreateFromBufferL(*iBuffer, desArray); + CleanupStack::PushL(desArray); + } + iCallbackOngoing = ETrue; + cb->HandleSubPlayerNamesL(TUid::Uid(iTaskQueue->Param()), + desArray, iCompletePckg(),err); + if (!iCompletePckg()) + { // Add next request in the task queue, but not mess up runerror + TRAPD(err, SubPlayerNamesL(*cb,TUid::Uid(iTaskQueue->Param()))); + if (KErrNone!=err) + { // complete searching sub players when error on request + cb->HandleSubPlayerNamesL(TUid::Uid(iTaskQueue->Param()), + desArray, ETrue, err); + } + } + iCallbackOngoing = EFalse; + if (desArray) + { + CleanupStack::PopAndDestroy(desArray); + } + } + else + { + iCallbackOngoing = ETrue; + cb->HandleSubPlayerNamesL(TUid::Uid(iTaskQueue->Param()), + NULL, ETrue, err); + iCallbackOngoing = EFalse; + } + break; + } + case EPbsGetMedia: + { + if (iResultSizePckg() && KErrNone == err) + { + CMPXMedia* media(NULL); + ::TransferBufferFromServerL(iPbs, EPbsGetAsyncBuffer, + iResultSizePckg(), iBuffer); + ::NewFromBufferL(*iBuffer, media); + CleanupStack::PushL(media); + iCallbackOngoing = ETrue; + cb->HandleMediaL(*media, err); + iCallbackOngoing = EFalse; + CleanupStack::PopAndDestroy(media); + } + else + { + iCallbackOngoing = ETrue; + cb->HandleMediaL(*iMediaOnError, err); // return dummy media + iCallbackOngoing = EFalse; + } + break; + } + case EPbsCommand: + { + CMPXCommand* result = NULL; + if (KErrNone == err) + { + if(iResultSizePckg()) + { + ::TransferBufferFromServerL(iPbs,EPbsGetAsyncBuffer, + iResultSizePckg(), iBuffer); + ::NewFromBufferL(*iBuffer, result); + } + CleanupStack::PushL(result); + iCallbackOngoing = ETrue; + cb->HandlePlaybackCommandComplete(result, KErrNone); + iCallbackOngoing = EFalse; + CleanupStack::PopAndDestroy(result); + } + else + { + iCallbackOngoing = ETrue; + cb->HandlePlaybackCommandComplete(NULL, err); + iCallbackOngoing = EFalse; + } + break; + } + default: + ASSERT(0); + } + MPX_DEBUG2("CMPXPlaybackUtility::RunL remove a task from queue 0x%08x", + iTaskQueue); + iTaskQueue->RemoveTask(); + ExecuteNextRequest(); + } + +// ---------------------------------------------------------------------------- +// Canceling by the server +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::DoCancel() + { + MPX_FUNC_EX("CMPXPlaybackUtility::DoCancel()"); +#ifdef _ENABLE_GUARD_TIMER + iGuardTimer->Cancel(); +#endif + TRAP_IGNORE(iPbs.SendReceiveL(EPbsCancelRequest)); + } + +// ---------------------------------------------------------------------------- +// Sends error message to all observers - maybe it should only be to the +// client that calls the async method +// ---------------------------------------------------------------------------- +// +TInt CMPXPlaybackUtility::RunError(TInt aError) + { + MPX_FUNC_EX("CMPXPlaybackUtility::RunError"); + TRAP_IGNORE(HandleRunErrorL(aError)); + iCallbackOngoing = EFalse; + MPX_DEBUG2("CMPXPlaybackUtility::RunError remove a task from queue 0x%08x", + iTaskQueue); + iTaskQueue->RemoveTask(); + ExecuteNextRequest(); + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// Distributes messages to all observers +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::MessageReceived(TInt aMsgData, TInt aError) + { + MPX_FUNC_EX("CMPXPlaybackUtility::MessageReceived()"); + TRAP_IGNORE(HandleMessageL(aMsgData,aError)); + } + +// ---------------------------------------------------------------------------- +// Distributes messages to all observers +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::HandleMessageL(TInt aMsgData, TInt aError) + { + ASSERT(aMsgData>0 || aError); // aMessage should not be NULL and aError is KErrNone + MPX_DEBUG4("CMPXPlaybackUtility::HandleMessageL 0x%08x, MsgHandle 0x%08x, Err %d", + this, aMsgData, aError); + if (aMsgData > 0) + { + CMPXMessage* msg = CMPXMessage::NewL(aMsgData); + CleanupStack::PushL(msg); + ASSERT(msg->IsSupported(KMPXMessageGeneralId)); + TInt id = static_cast( + msg->ValueTObjectL(KMPXMessageGeneralId)); + if (id==KMPXMessageGeneral) + { // DEPRECATED, covert the general message into TMPXMessage + ASSERT(msg->IsSupported(KMPXMessageGeneralEvent)); + TMPXPlaybackMessage::TEvent event = + static_cast( + msg->ValueTObjectL(KMPXMessageGeneralEvent)); + if (event == TMPXPlaybackMessage::EActivePlayerChanged) + { + ASSERT(msg->IsSupported(KMPXMessageGeneralType)); + TInt type(msg->ValueTObjectL(KMPXMessageGeneralType)); + ASSERT(msg->IsSupported(KMPXMessageGeneralData)); + TInt data(msg->ValueTObjectL(KMPXMessageGeneralData)); + if ( type) + { // receive this message because this client attached to + // ActivePlayer + MPX_DEBUG2("CMPXPlaybackUtility::MessageReceived 0x%08x, rebinds to active player", + this); + // Cancel request to old player + CancelRequest(); + TRAP_IGNORE(iPbs.SendReceiveL(EPbsSetMode, + TIpcArgs(KPbModeActivePlayer.iUid, EMPXCategoryMusic))); + } + } + } + for (TInt i = iObservers.Count(); --i >= 0;) + { + iObservers[i]->HandlePlaybackMessage(msg, aError); + } + CleanupStack::PopAndDestroy(msg); + } + else + { + for (TInt i = iObservers.Count(); --i >= 0;) + { + iObservers[i]->HandlePlaybackMessage(NULL, aError); + } + } + iMsgMonitor->GetNextMessage(); + } + +// ---------------------------------------------------------------------------- +// Handle error in RunL +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::HandleRunErrorL(TInt aError) + { + MPX_FUNC_EX("CMPXPlaybackUtility::HandleRunErrorL()"); + TInt task = iTaskQueue->Task(); + MMPXPlaybackCallback* cb = + static_cast(iTaskQueue->Callback()); + if (!iCallbackOngoing) + { // Error happens during preparing callback + iCallbackOngoing = ETrue; // will be reset to EFalse in the RunError + switch(task) + { + case EPbsGetProperty: + { + cb->HandlePropertyL( + static_cast(iTaskQueue->Param()), + 0, // dummy value on error + aError); + break; + } + case EPbsGetSubPlayerNamesByUid: + { + cb->HandleSubPlayerNamesL(TUid::Uid(iTaskQueue->Param()), + NULL, ETrue, aError); + break; + } + case EPbsGetMedia: + { + cb->HandleMediaL(*iMediaOnError, aError); + break; + } + case EPbsCommand: + { + cb->HandlePlaybackCommandComplete(iMediaOnError, aError); + break; + } + default: + { + ASSERT(0); + break; + } + } + } // do nothing if error happens during client processing callback. + // all callback should be changed into non-leave so that this will + // be never happen. + } + + +// ---------------------------------------------------------------------------- +// Read a buffer from server +// ---------------------------------------------------------------------------- +// +HBufC* CMPXPlaybackUtility::DesL(TInt aSize) + { + HBufC* des=NULL; + if (aSize) + { + ::TransferBufferFromServerL(iPbs, EPbsGetSyncBuffer, aSize, iBuffer); + TPtrC ptr = MPXUser::Ptr(iBuffer->Ptr(0)); + des = ptr.AllocL(); + } + return des; + } + +// ---------------------------------------------------------------------------- +// Adds a sync request to the queue: if there is no outstanding request, +// it will be executed immediately +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::AddRequestL(TMPXPlaybackServerOp aFunction, + MMPXPlaybackCallback* aCallback/*=NULL*/, + TInt aParamData/*=0*/, + CBufBase* aBuf/*=NULL*/, + TAny* aPtr, + CBase* aAlivePtr/*=NULL*/) + { + iTaskQueue->AddTaskL(aFunction, aCallback, aParamData, aBuf, aPtr, aAlivePtr, NULL); + MPX_DEBUG3("CMPXPlaybackUtility::AddRequestL this 0x%08x task=%d", + this, aFunction); + if (!IsActive() && !iCallbackOngoing) + { + ExecuteNextRequest(); + } + } + +// ---------------------------------------------------------------------------- +// Executes the next request in the queue. +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::ExecuteNextRequest() + { + MPX_FUNC_EX("CMPXPlaybackUtility::ExecuteNextRequest()"); + TInt task = iTaskQueue->Task(); + if (KErrNotFound != task && !IsActive()) + { + switch(task) + { + case EPbsGetProperty: + iPbs.SendReceive(EPbsGetProperty, + TIpcArgs(iTaskQueue->Param(), &iPropertyValuePckg), + iStatus); + break; + case EPbsGetSubPlayerNamesByUid: + iPbs.SendReceive(EPbsGetSubPlayerNamesByUid, + TIpcArgs(iTaskQueue->Param(), + &iResultSizePckg,&iCompletePckg), + iStatus); + break; + case EPbsGetMedia: + iPbs.SendReceive(task, + TIpcArgs(&iResultSizePckg, + ((CMPXCommand*)(iTaskQueue->PtrData()))->Data()), + iStatus); + break; + case EPbsCommand: + { + iPbs.SendReceive(EPbsCommand, + TIpcArgs(iTaskQueue->Param(), //[in] Async flag + &iTaskQueue->BufData(),//[in] command + &iResultSizePckg), //[out] size of buffer + iStatus); + break; + } + default: + ASSERT(0); + } + #ifdef _ENABLE_GUARD_TIMER + if ( iGuardTimer->IsActive() ); + iGuardTimer->Cancel(); + iGuardTimer->Start(KMPXGuardTimer,KMPXGuardTimer, + TCallBack(GuardTimerCallback,this)); + #endif + SetActive(); + MPX_DEBUG3("CMPXPlaybackUtility::ExecuteNextRequest 0x%08x task %d ", + this, task); + } + } +#ifdef _ENABLE_GUARD_TIMER +// ---------------------------------------------------------------------------- +// Guard timer time out +// ---------------------------------------------------------------------------- +// +TInt CMPXPlaybackUtility::GuardTimerCallback(TAny* aPtr) + { + CMPXPlaybackUtility* pb = static_cast(aPtr); + MPX_DEBUG3("CMPXPlaybackUtility::GaurdTimerCallback this 0x%08x task=%d", + pb, pb->iTaskQueue->Task()); + pb->iGuardTimer->Cancel(); + ASSERT(0); // the function should never be called + return KErrNone; + } +#endif + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API +// ---------------------------------------------------------------------------- +// Inititialises with a single song, may not be part of any collection +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::Init64L(RFile64& aShareableFile) + { + MPX_FUNC("CMPXPlaybackUtility::Init64L(RFile64& aShareableFile)"); + MPX_DEBUG_THREAD("CMPXPlaybackUtility::Init64L()"); + if (!aShareableFile.SubSessionHandle()) + { + User::Leave(KErrArgument); + } + TIpcArgs args; + aShareableFile.TransferToServer(args,0,1); + iPbs.SendReceiveL(EPbsInitFromFile64,args); + } + +// ---------------------------------------------------------------------------- +// Inititialises with a file, may not be part of any collection +// ---------------------------------------------------------------------------- +// +void CMPXPlaybackUtility::InitStreaming64L(RFile64& aShareableFile, const TInt aAccessPoint) + { + MPX_FUNC("CMPXPlaybackUtility::InitStreaming64L(RFile64& aShareableFile, const TInt aAccessPoint)"); + MPX_DEBUG_THREAD("CMPXPlaybackUtility::InitStreaming64L()"); + if (!aShareableFile.SubSessionHandle()) + { + User::Leave(KErrArgument); + } + TIpcArgs args; + aShareableFile.TransferToServer(args,0,1); + args.Set(2, aAccessPoint); //use index "2" for setting the AccessPoint + + iPbs.SendReceiveL(EPbsInitStreamingFromFile64, args); + } + +// ---------------------------------------------------------------------------- +// Return file handle +// ---------------------------------------------------------------------------- +// +RFile64* CMPXPlaybackUtility::File64L() + { + MPX_FUNC_EX("CMPXPlaybackUtility::File64L()"); + TPckgBuf fileHandle; + TInt fsHandle = iPbs.SendReceiveL(EPbsGetFile64,TIpcArgs(&fileHandle)); + RFile64* file(NULL); + if (KErrNotFound != fileHandle()) + { + iFile64.Close(); + User::LeaveIfError(iFile64.AdoptFromServer(fsHandle,fileHandle())); + file = &iFile64; + } // else return NULL + return file; + } + +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + +// End of file diff -r 000000000000 -r a2952bb97e68 mpx/playbackframework/rom/mpxplaybackframework.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/playbackframework/rom/mpxplaybackframework.iby Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2006 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: Image description file for project MPX Playback Framework. +* +*/ + + +#ifndef MPXPLAYBACKFRAMEWORK_IBY +#define MPXPLAYBACKFRAMEWORK_IBY + +#include + + +file=ABI_DIR\BUILD_DIR\mpxplaybackengine.dll SHARED_LIB_DIR\mpxplaybackengine.dll +file=ABI_DIR\BUILD_DIR\mpxplaybackserver.exe PROGRAMS_DIR\mpxplaybackserver.exe +file=ABI_DIR\BUILD_DIR\mpxplaybackutility.dll SHARED_LIB_DIR\mpxplaybackutility.dll + +#endif // MPXPLAYBACKFRAMEWORK_IBY diff -r 000000000000 -r a2952bb97e68 mpx/rom/mpx.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/rom/mpx.iby Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2006 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: Image description file for project MPX. +* +*/ + + +#ifndef MPX_IBY +#define MPX_IBY + +// Include stub sis file in ROM +data=\epoc32\data\z\system\install\mpxstub.sis system\install\mpxstub.sis + +#endif // MPX_IBY diff -r 000000000000 -r a2952bb97e68 mpx/sis/101FFC03.cre Binary file mpx/sis/101FFC03.cre has changed diff -r 000000000000 -r a2952bb97e68 mpx/sis/101FFCd2.cre Binary file mpx/sis/101FFCd2.cre has changed diff -r 000000000000 -r a2952bb97e68 mpx/sis/ErrRd.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/sis/ErrRd.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -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: Package file for project ErrRd. +; +; +; Installation file for ErrRd +; +&EN +; +; Package header +; +#{"ErrRd"},(0x0F0000EB),0,0,0 +; +; Supports Series 60 v3.x +; This line indicates that this installation is for the Series 60 platform v3.x +; This line must appear _exactly_ as shown below in the sis file +; If this line is missing or incorrect, the sis file will not be able +; to be installed on Series 60 v3.x platforms +; +(0x101f7961), 0, 0, 0, {"Series60v3.0"} +; +; Non-localised vendor name +; +:"Nokia Corporation" +; +; Localised vendor name +; +%{"Vendor-EN"} +; +; Files to install +; +"ErrRd.pkg" - "C:\resource\ErrRd" +; +; End of file +; +;*"mykey.key","mycert.cer" diff -r 000000000000 -r a2952bb97e68 mpx/sis/build-sisx.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/sis/build-sisx.bat Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,20 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Bat file for making mpx.sisx. +rem + +Echo please copy key files to ROOT before build sis file +del mpx.sis mpx.sisx +makesis -v mpx.pkg +signsis mpx.sis mpx.sisx ../internal/sis_keys/Nokia_RnDCert_02.der ../internal/sis_keys/Nokia_RnDCert_02.key diff -r 000000000000 -r a2952bb97e68 mpx/sis/buildcenrepsisx.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/sis/buildcenrepsisx.bat Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,20 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Bat file for making mpxcenrep.sisx. +rem + +Echo please copy key files to ROOT before build sis file +del mpxcenrep.sis mpxcenrep.sisx +makesis -v mpxcenrep.pkg +signsis mpxcenrep.sis mpxcenrep.sisx ../internal/sis_keys/Nokia_RnDCert_02.der ../internal/sis_keys/Nokia_RnDCert_02.key \ No newline at end of file diff -r 000000000000 -r a2952bb97e68 mpx/sis/depends.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/sis/depends.xml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,68 @@ + + + + + + + 1 + + S60 MPX Framework with TNM Integration + + MPX with TNM support + + + + + + S60 + + + 5 + 0 + + + 2008 + 46 + + + + + 5 + 0 + + 2010 + 1 + + + + + + + 0x102830AB + + 2 + 0 + 0 + + + 3 + 0 + 0 + + + + diff -r 000000000000 -r a2952bb97e68 mpx/sis/mpx.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/sis/mpx.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -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: Package file for project MPX. +; + +;Languages +&EN, FR, GE, SP, IT, SW, DA, NO, FI, AM, PO, TU, IC, RU, HU, DU, CS, SK, PL, SL, TC, HK, ZH, JA, TH, AR, TL, BG, CA, +HR, ET, FA, CF, EL, HE, IN, LV, LT, MS, BP, RO, SR, LS, UK, UR, VI, BA, GL, 129, 157, 158, 159, 160, 161, 326, 327 + + +;Header +#{"MPX", "MPX", "MPX", "MPX", + "MPX", "MPX", "MPX", "MPX", + "MPX", "MPX", "MPX", "MPX", + "MPX", "MPX", "MPX", "MPX", + "MPX", "MPX", "MPX", "MPX", + "MPX", "MPX", "MPX", "MPX", + "MPX", "MPX", "MPX", "MPX", + "MPX", "MPX", "MPX", "MPX", + "MPX", "MPX", "MPX", "MPX", + "MPX", "MPX", "MPX", "MPX", + "MPX", "MPX", "MPX", "MPX", + "MPX", "MPX", "MPX", "MPX", + "MPX", "MPX", "MPX", "MPX", + "MPX", "MPX", "MPX", "MPX" + },(0x101FFC63),11,0,1,TYPE=SA, RU + +; Localised vendor names +%{"Nokia", "Nokia", "Nokia", "Nokia", + "Nokia", "Nokia", "Nokia", "Nokia", + "Nokia", "Nokia", "Nokia", "Nokia", + "Nokia", "Nokia", "Nokia", "Nokia", + "Nokia", "Nokia", "Nokia", "Nokia", + "Nokia", "Nokia", "Nokia", "Nokia", + "Nokia", "Nokia", "Nokia", "Nokia", + "Nokia", "Nokia", "Nokia", "Nokia", + "Nokia", "Nokia", "Nokia", "Nokia", + "Nokia", "Nokia", "Nokia", "Nokia", + "Nokia", "Nokia", "Nokia", "Nokia", + "Nokia", "Nokia", "Nokia", "Nokia", + "Nokia", "Nokia", "Nokia", "Nokia", + "Nokia", "Nokia", "Nokia", "Nokia" + } + +; Unique, global vendor name +:"Nokia" + + +;Files to install + +; +; Display restart message +; +"restart.txt" - "", FILETEXT, TEXTEXIT + +; From Common Framework +"\epoc32\release\armv5\urel\mpxcommon.dll" -"!:\sys\bin\mpxcommon.dll" + +; From Collection Framework +"\epoc32\release\armv5\urel\mpxcollectionutility.dll" -"!:\sys\bin\mpxcollectionutility.dll" +"\epoc32\release\armv5\urel\mpxcollectionserver.exe" -"!:\sys\bin\mpxcollectionserver.exe" +"\epoc32\release\armv5\urel\mpxcollectionengine.dll" -"!:\sys\bin\mpxcollectionengine.dll" + +; From Playback Framework +"\epoc32\release\armv5\urel\mpxplaybackengine.dll" -"!:\sys\bin\mpxplaybackengine.dll" +"\epoc32\release\armv5\urel\mpxplaybackserver.exe" -"!:\sys\bin\mpxplaybackserver.exe" +"\epoc32\release\armv5\urel\mpxplaybackutility.dll" -"!:\sys\bin\mpxplaybackutility.dll" + +; From Harvester +"\epoc32\release\armv5\urel\mpxharvesterserver.exe" -"!:\sys\bin\mpxharvesterserver.exe" +"\epoc32\release\armv5\urel\mpxfilehandler.dll" -"!:\sys\bin\mpxfilehandler.dll" +"\epoc32\release\armv5\urel\mpxharvesterutility.dll" -"!:\sys\bin\mpxharvesterutility.dll" +"\epoc32\release\armv5\urel\mpxcollectionmediator.dll" -"!:\sys\bin\mpxcollectionmediator.dll" +"\epoc32\release\armv5\urel\mpxmetadataextractor.dll" -"!:\sys\bin\mpxmetadataextractor.dll" + +; From Playlist Engine +"\epoc32\release\armv5\urel\mpxplaylistengine.dll" -"!:\sys\bin\mpxplaylistengine.dll" +"\epoc32\release\armv5\urel\mpxplaylistrecognizer.dll" -"!:\sys\bin\mpxplaylistrecognizer.dll" + +; From View Framework +"\epoc32\release\armv5\urel\mpxviewutility.dll" -"!:\sys\bin\mpxviewutility.dll" +"\epoc32\release\armv5\urel\mpxviewplugin.dll" -"!:\sys\bin\mpxviewplugin.dll" + +; From AlbumArt Utility +"\epoc32\release\armv5\urel\mpxalbumartutility.dll" -"!:\sys\bin\mpxalbumartutility.dll" +"\epoc32\release\armv5\urel\mpxcollectionhelper.dll" -"!:\sys\bin\mpxcollectionhelper.dll" + +; From BackStepping +"\epoc32\release\armv5\urel\mpxbacksteppingutility.dll" -"!:\sys\bin\mpxbacksteppingutility.dll" + +; Central Repositary Files +"101FFC03.cre" -"!:\private\10202BE9\101FFC03.cre" +"101FFCD2.cre" -"!:\private\10202BE9\101FFCD2.cre" + + +; Interface Resources +"\epoc32\data\Z\resource\plugins\mpxplaylistrecognizer.rsc" -"!:\resource\plugins\mpxplaylistrecognizer.rsc" +"\epoc32\data\Z\resource\mpxplaylisttopcharacterset.rsc" -"!:\resource\mpxplaylisttopcharacterset.rsc" + + +; Localised String Resources +{ +"\epoc32\data\Z\resource\apps\mpxmediator.r01" +"\epoc32\data\Z\resource\apps\mpxmediator.r02" +"\epoc32\data\Z\resource\apps\mpxmediator.r03" +"\epoc32\data\Z\resource\apps\mpxmediator.r04" +"\epoc32\data\Z\resource\apps\mpxmediator.r05" +"\epoc32\data\Z\resource\apps\mpxmediator.r06" +"\epoc32\data\Z\resource\apps\mpxmediator.r07" +"\epoc32\data\Z\resource\apps\mpxmediator.r08" +"\epoc32\data\Z\resource\apps\mpxmediator.r09" +"\epoc32\data\Z\resource\apps\mpxmediator.r10" +"\epoc32\data\Z\resource\apps\mpxmediator.r13" +"\epoc32\data\Z\resource\apps\mpxmediator.r14" +"\epoc32\data\Z\resource\apps\mpxmediator.r15" +"\epoc32\data\Z\resource\apps\mpxmediator.r16" +"\epoc32\data\Z\resource\apps\mpxmediator.r17" +"\epoc32\data\Z\resource\apps\mpxmediator.r18" +"\epoc32\data\Z\resource\apps\mpxmediator.r25" +"\epoc32\data\Z\resource\apps\mpxmediator.r26" +"\epoc32\data\Z\resource\apps\mpxmediator.r27" +"\epoc32\data\Z\resource\apps\mpxmediator.r28" +"\epoc32\data\Z\resource\apps\mpxmediator.r29" +"\epoc32\data\Z\resource\apps\mpxmediator.r30" +"\epoc32\data\Z\resource\apps\mpxmediator.r31" +"\epoc32\data\Z\resource\apps\mpxmediator.r32" +"\epoc32\data\Z\resource\apps\mpxmediator.r33" +"\epoc32\data\Z\resource\apps\mpxmediator.r37" +"\epoc32\data\Z\resource\apps\mpxmediator.r39" +"\epoc32\data\Z\resource\apps\mpxmediator.r42" +"\epoc32\data\Z\resource\apps\mpxmediator.r44" +"\epoc32\data\Z\resource\apps\mpxmediator.r45" +"\epoc32\data\Z\resource\apps\mpxmediator.r49" +"\epoc32\data\Z\resource\apps\mpxmediator.r50" +"\epoc32\data\Z\resource\apps\mpxmediator.r51" +"\epoc32\data\Z\resource\apps\mpxmediator.r54" +"\epoc32\data\Z\resource\apps\mpxmediator.r57" +"\epoc32\data\Z\resource\apps\mpxmediator.r59" +"\epoc32\data\Z\resource\apps\mpxmediator.r67" +"\epoc32\data\Z\resource\apps\mpxmediator.r68" +"\epoc32\data\Z\resource\apps\mpxmediator.r70" +"\epoc32\data\Z\resource\apps\mpxmediator.r76" +"\epoc32\data\Z\resource\apps\mpxmediator.r78" +"\epoc32\data\Z\resource\apps\mpxmediator.r79" +"\epoc32\data\Z\resource\apps\mpxmediator.r83" +"\epoc32\data\Z\resource\apps\mpxmediator.r93" +"\epoc32\data\Z\resource\apps\mpxmediator.r94" +"\epoc32\data\Z\resource\apps\mpxmediator.r96" +"\epoc32\data\Z\resource\apps\mpxmediator.r102" +"\epoc32\data\Z\resource\apps\mpxmediator.r103" +"\epoc32\data\Z\resource\apps\mpxmediator.r129" +"\epoc32\data\Z\resource\apps\mpxmediator.r157" +"\epoc32\data\Z\resource\apps\mpxmediator.r158" +"\epoc32\data\Z\resource\apps\mpxmediator.r159" +"\epoc32\data\Z\resource\apps\mpxmediator.r160" +"\epoc32\data\Z\resource\apps\mpxmediator.r161" +"\epoc32\data\Z\resource\apps\mpxmediator.r326" +"\epoc32\data\Z\resource\apps\mpxmediator.r327" +} - "!:\resource\apps\mpxmediator.rsc" + diff -r 000000000000 -r a2952bb97e68 mpx/sis/mpxcenrep.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/sis/mpxcenrep.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,32 @@ +; +; 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: Package file for MPX CenRep files. +; +;Languages +&EN + +; Header +#{ "MPX CenRep files"}, (0x10202BE9), 1, 0, 1, TYPE=SP + +; Supports Series 60 v3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +;Localised Vendor Name +%{"Nokia"} + +;Unique Vendor Name +:"Nokia" + +"101FFC03.cre" -"c:\private\10202BE9\101FFC03.cre" +"101FFCD2.cre" -"c:\private\10202BE9\101FFCD2.cre" diff -r 000000000000 -r a2952bb97e68 mpx/sis/mpxdebug.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/sis/mpxdebug.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,74 @@ +; +; 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: Package file for MPX debug. +; +;Languages +&EN + +;packet-header (name, uid, major, minor, build, type) +#{"MPX"},(0x101FFC63),0,0,0,TYPE=PU + +; Supports Series 60 v3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +;Localised Vendor Name +%{"Nokia"} + +;Unique Vendor Name +:"Nokia" + +; From Common Framework +"\epoc32\release\armv5\UDEB\mpxcommon.dll" -"!:\sys\bin\mpxcommon.dll" + +; From Collection Framework +"\epoc32\release\armv5\UDEB\mpxcollectionutility.dll" -"!:\sys\bin\mpxcollectionutility.dll" +"\epoc32\release\armv5\UDEB\mpxcollectionserver.exe" -"!:\sys\bin\mpxcollectionserver.exe" +"\epoc32\release\armv5\UDEB\mpxcollectionengine.dll" -"!:\sys\bin\mpxcollectionengine.dll" + +; From Playback Framework +"\epoc32\release\armv5\UDEB\mpxplaybackengine.dll" -"!:\sys\bin\mpxplaybackengine.dll" +"\epoc32\release\armv5\UDEB\mpxplaybackserver.exe" -"!:\sys\bin\mpxplaybackserver.exe" +"\epoc32\release\armv5\UDEB\mpxplaybackutility.dll" -"!:\sys\bin\mpxplaybackutility.dll" + +; From Harvester +"\epoc32\release\armv5\UDEB\mpxharvesterserver.exe" -"!:\sys\bin\mpxharvesterserver.exe" +"\epoc32\release\armv5\UDEB\mpxfilehandler.dll" -"!:\sys\bin\mpxfilehandler.dll" +"\epoc32\release\armv5\UDEB\mpxharvesterutility.dll" -"!:\sys\bin\mpxharvesterutility.dll" +"\epoc32\release\armv5\UDEB\mpxcollectionmediator.dll" -"!:\sys\bin\mpxcollectionmediator.dll" +"\epoc32\release\armv5\UDEB\mpxmetadataextractor.dll" -"!:\sys\bin\mpxmetadataextractor.dll" +"\epoc32\data\Z\resource\apps\mpxmediator.rsc" -"!:\resource\apps\mpxmediator.rsc" + +; From Playlist Engine +"\epoc32\release\armv5\UDEB\mpxplaylistengine.dll" -"!:\sys\bin\mpxplaylistengine.dll" +"\epoc32\release\armv5\UDEB\mpxplaylistrecognizer.dll" -"!:\sys\bin\mpxplaylistrecognizer.dll" +"\epoc32\data\Z\resource\plugins\mpxplaylistrecognizer.rsc" -"!:\resource\plugins\mpxplaylistrecognizer.rsc" + +; From View Framework +"\epoc32\release\armv5\UDEB\mpxviewutility.dll" -"!:\sys\bin\mpxviewutility.dll" +"\epoc32\release\armv5\UDEB\mpxviewplugin.dll" -"!:\sys\bin\mpxviewplugin.dll" + +; Other pieces +"\epoc32\release\armv5\UDEB\mpxalbumartutility.dll" -"!:\sys\bin\mpxalbumartutility.dll" +"\epoc32\release\armv5\UDEB\mpxcollectionhelper.dll" -"!:\sys\bin\mpxcollectionhelper.dll" + +; Add missing dll files +"\epoc32\release\armv5\UDEB\MPSettEngine.dll" -"!:\sys\bin\MPSettEngine.dll" +"\epoc32\release\armv5\UDEB\audiofetcher.dll" -"!:\sys\bin\audiofetcher.dll" + +;add missing resource files +"\epoc32\data\Z\resource\apps\audiofetcher.mif" -"!:\resource\apps\audiofetcher.mif" +"\epoc32\data\Z\resource\plugins\audiofetcher.rsc" -"!:\resource\plugins\audiofetcher.rsc" +"\epoc32\data\Z\resource\apps\audiofetcherdialog.rsc" -"!:\resource\apps\audiofetcherdialog.rsc" + +@"mpxcenrep.sisx",(0x10202BE9) diff -r 000000000000 -r a2952bb97e68 mpx/sis/mpxstub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/sis/mpxstub.pkg Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,26 @@ +; +; 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: Package file for MPX stub file. +; +;Language +&EN + +;Header +#{"MPX"}, (0x101ffc63), 1, 0, 0, TYPE=SA + +;Localised Vendor Name +%{"Nokia"} + +;Unique Vendor Name +:"Nokia" diff -r 000000000000 -r a2952bb97e68 mpx/sis/mpxstub.sis Binary file mpx/sis/mpxstub.sis has changed diff -r 000000000000 -r a2952bb97e68 mpx/sis/restart.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/sis/restart.txt Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,2 @@ +To complete the installation process, the phone must be restarted. +Until then, some applications may not function properly. diff -r 000000000000 -r a2952bb97e68 mpx/viewframework/baseviewplugins/bwinscw/mpxviewpluginU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/viewframework/baseviewplugins/bwinscw/mpxviewpluginU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,17 @@ +EXPORTS + ??1CMPXAknDialogPlugin@@UAE@XZ @ 1 NONAME ; CMPXAknDialogPlugin::~CMPXAknDialogPlugin(void) + ??1CMPXAknViewPlugin@@UAE@XZ @ 2 NONAME ; CMPXAknViewPlugin::~CMPXAknViewPlugin(void) + ??1CMPXViewPlugin@@UAE@XZ @ 3 NONAME ; CMPXViewPlugin::~CMPXViewPlugin(void) + ?ActivateViewL@CMPXAknDialogPlugin@@MAEXPBVTDesC16@@@Z @ 4 NONAME ; void CMPXAknDialogPlugin::ActivateViewL(class TDesC16 const *) + ?ActivateViewL@CMPXAknViewPlugin@@MAEXPBVTDesC16@@@Z @ 5 NONAME ; void CMPXAknViewPlugin::ActivateViewL(class TDesC16 const *) + ?CreateViewL@CMPXAknDialogPlugin@@MAEXXZ @ 6 NONAME ; void CMPXAknDialogPlugin::CreateViewL(void) + ?CreateViewL@CMPXAknViewPlugin@@MAEXXZ @ 7 NONAME ; void CMPXAknViewPlugin::CreateViewL(void) + ?DeactivateView@CMPXAknDialogPlugin@@MAEXXZ @ 8 NONAME ; void CMPXAknDialogPlugin::DeactivateView(void) + ?DeactivateView@CMPXAknViewPlugin@@MAEXXZ @ 9 NONAME ; void CMPXAknViewPlugin::DeactivateView(void) + ?DestroyView@CMPXAknDialogPlugin@@MAEXXZ @ 10 NONAME ; void CMPXAknDialogPlugin::DestroyView(void) + ?DestroyView@CMPXAknViewPlugin@@MAEXXZ @ 11 NONAME ; void CMPXAknViewPlugin::DestroyView(void) + ?NewL@CMPXViewPlugin@@SAPAV1@ABVTUid@@PAVMMPXCustomCommandObserver@@@Z @ 12 NONAME ; class CMPXViewPlugin * CMPXViewPlugin::NewL(class TUid const &, class MMPXCustomCommandObserver *) + ?SetAsDefaultViewL@CMPXAknDialogPlugin@@MAEXXZ @ 13 NONAME ; void CMPXAknDialogPlugin::SetAsDefaultViewL(void) + ?SetAsDefaultViewL@CMPXAknViewPlugin@@MAEXXZ @ 14 NONAME ; void CMPXAknViewPlugin::SetAsDefaultViewL(void) + ?SetObserver@CMPXViewPlugin@@MAEXPAVMMPXCustomCommandObserver@@@Z @ 15 NONAME ; void CMPXViewPlugin::SetObserver(class MMPXCustomCommandObserver *) + diff -r 000000000000 -r a2952bb97e68 mpx/viewframework/baseviewplugins/eabi/mpxviewpluginU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/viewframework/baseviewplugins/eabi/mpxviewpluginU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,29 @@ +EXPORTS + _ZN14CMPXViewPlugin11SetObserverEP25MMPXCustomCommandObserver @ 1 NONAME + _ZN14CMPXViewPlugin4NewLERK4TUidP25MMPXCustomCommandObserver @ 2 NONAME + _ZN14CMPXViewPluginD0Ev @ 3 NONAME + _ZN14CMPXViewPluginD1Ev @ 4 NONAME + _ZN14CMPXViewPluginD2Ev @ 5 NONAME + _ZN17CMPXAknViewPlugin11CreateViewLEv @ 6 NONAME + _ZN17CMPXAknViewPlugin11DestroyViewEv @ 7 NONAME + _ZN17CMPXAknViewPlugin13ActivateViewLEPK7TDesC16 @ 8 NONAME + _ZN17CMPXAknViewPlugin14DeactivateViewEv @ 9 NONAME + _ZN17CMPXAknViewPlugin17SetAsDefaultViewLEv @ 10 NONAME + _ZN17CMPXAknViewPluginD0Ev @ 11 NONAME + _ZN17CMPXAknViewPluginD1Ev @ 12 NONAME + _ZN17CMPXAknViewPluginD2Ev @ 13 NONAME + _ZN19CMPXAknDialogPlugin11CreateViewLEv @ 14 NONAME + _ZN19CMPXAknDialogPlugin11DestroyViewEv @ 15 NONAME + _ZN19CMPXAknDialogPlugin13ActivateViewLEPK7TDesC16 @ 16 NONAME + _ZN19CMPXAknDialogPlugin14DeactivateViewEv @ 17 NONAME + _ZN19CMPXAknDialogPlugin17SetAsDefaultViewLEv @ 18 NONAME + _ZN19CMPXAknDialogPluginD0Ev @ 19 NONAME + _ZN19CMPXAknDialogPluginD1Ev @ 20 NONAME + _ZN19CMPXAknDialogPluginD2Ev @ 21 NONAME + _ZTI14CMPXViewPlugin @ 22 NONAME ; ## + _ZTI17CMPXAknViewPlugin @ 23 NONAME ; ## + _ZTI19CMPXAknDialogPlugin @ 24 NONAME ; ## + _ZTV14CMPXViewPlugin @ 25 NONAME ; ## + _ZTV17CMPXAknViewPlugin @ 26 NONAME ; ## + _ZTV19CMPXAknDialogPlugin @ 27 NONAME ; ## + diff -r 000000000000 -r a2952bb97e68 mpx/viewframework/baseviewplugins/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/viewframework/baseviewplugins/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2006 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 for project mpxviewplugin. +* +*/ + + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +mpxviewplugin.mmp + +PRJ_TESTMMPFILES diff -r 000000000000 -r a2952bb97e68 mpx/viewframework/baseviewplugins/group/mpxviewplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/viewframework/baseviewplugins/group/mpxviewplugin.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2006 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 for project mpxviewplugin. +* +*/ + + + +#include +#include + +TARGET mpxviewplugin.dll +TARGETTYPE dll +UID 0x1000006C 0x101FFC67 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE mpxviewplugin.cpp +SOURCE mpxaknviewplugin.cpp +SOURCE mpxakndialogplugin.cpp + +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY apparc.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY avkon.lib +LIBRARY ecom.lib + + +#if defined(ARMCC) +deffile ../eabi/ +#elif defined(WINSCW) +deffile ../bwinscw/ +#endif + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/viewframework/baseviewplugins/src/mpxakndialogplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/viewframework/baseviewplugins/src/mpxakndialogplugin.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2006 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: MPX Avkon dialog plugin definition. +* +*/ + + + +// INCLUDE FILES +#include +#include +#include + +#include "mpxakndialogplugin.h" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXAknDialogPlugin::~CMPXAknDialogPlugin() + { + delete iDialog; + } + +// --------------------------------------------------------------------------- +// From CMPXViewPlugin +// Interface method to create view. +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXAknDialogPlugin::CreateViewL() + { + // no need to create again if view already exist + if ( !iDialog ) + { + iDialog = ConstructDialogL(); + } + } + +// --------------------------------------------------------------------------- +// From CMPXViewPlugin +// Interface method to destroy view. +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXAknDialogPlugin::DestroyView() + { + delete iDialog; + iDialog = NULL; + } + +// --------------------------------------------------------------------------- +// From CMPXViewPlugin +// Interface method to activate view. +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXAknDialogPlugin::ActivateViewL( + const TDesC* /* aParam */ ) + { + if ( !iDialog ) + { + CreateViewL(); + } + iDialog->ExecuteLD( ResourceId() ); + if ( iCommandObserver ) + { + TPckgC selfPtr( reinterpret_cast( this ) ); + iCommandObserver->HandleCustomCommand( + TUid::Uid( KMPXViewUtilityCustomCommand ), + EMPXViewUtilCmdViewDeActivated, + selfPtr ); + } + iDialog = NULL; + } + +// --------------------------------------------------------------------------- +// From CMPXViewPlugin +// Interface method to activate as default view, will not bring to foreground +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXAknDialogPlugin::SetAsDefaultViewL() + { + User::Leave( KErrNotSupported ); + } + +// --------------------------------------------------------------------------- +// From CMPXViewPlugin +// Interface method to deactivate view. +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXAknDialogPlugin::DeactivateView() + { + if ( iCommandObserver ) + { + TPckgC selfPtr( reinterpret_cast( this ) ); + iCommandObserver->HandleCustomCommand( + TUid::Uid( KMPXViewUtilityCustomCommand ), + EMPXViewUtilCmdViewDeActivated, + selfPtr ); + } + } + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/viewframework/baseviewplugins/src/mpxaknviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/viewframework/baseviewplugins/src/mpxaknviewplugin.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2006 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: MPX Avkon view plugin definition. +* +*/ + + + +// INCLUDE FILES +#include +#include +#include +#include + +#include "mpxaknviewplugin.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXAknViewPlugin::~CMPXAknViewPlugin() + { + // do nothing + } + +// --------------------------------------------------------------------------- +// From CMPXViewPlugin +// Interface method to create view. +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXAknViewPlugin::CreateViewL() + { + // no need to create again if view already exist + if ( !iView ) + { + CAknView* view = ConstructViewLC(); + iAvkonViewAppUi->AddViewL( view ); + CleanupStack::Pop( view ); // ownership transferred + iView = view; + } + } + +// --------------------------------------------------------------------------- +// From CMPXViewPlugin +// Interface method to destroy view. +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXAknViewPlugin::DestroyView() + { + ASSERT( iView ); + } + +// --------------------------------------------------------------------------- +// From CMPXViewPlugin +// Interface method to activate view. +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXAknViewPlugin::ActivateViewL( + const TDesC* aParam ) + { + if ( !iView ) + { + CreateViewL(); + } + + if ( !aParam ) + { + iAvkonViewAppUi->ActivateLocalViewL( iView->Id() ); + } + else + { + // Create a narrow heap descriptor from a unicode descriptor + HBufC8* des8 = HBufC8::NewLC( aParam->Length() ); + des8->Des().Copy( *aParam ); + + iAvkonViewAppUi->ActivateLocalViewL( iView->Id(), KNullUid, *des8 ); + + CleanupStack::PopAndDestroy( des8 ); + } + } + +// --------------------------------------------------------------------------- +// From CMPXViewPlugin +// Interface method to activate as default view, will not bring to foreground +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXAknViewPlugin::SetAsDefaultViewL() + { + if ( !iView ) + { + CreateViewL(); + } + iAvkonViewAppUi->SetDefaultViewL( *iView ); + } + +// --------------------------------------------------------------------------- +// From CMPXViewPlugin +// Interface method to deactivate view. +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXAknViewPlugin::DeactivateView() + { + if ( iCommandObserver ) + { + TPckgC selfPtr( reinterpret_cast( this ) ); + iCommandObserver->HandleCustomCommand( + TUid::Uid( KMPXViewUtilityCustomCommand ), + EMPXViewUtilCmdViewDeActivated, + selfPtr ); + } + } + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/viewframework/baseviewplugins/src/mpxviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/viewframework/baseviewplugins/src/mpxviewplugin.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2006 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: MPX view plugin definition. +* +*/ + + + +// INCLUDE FILES +#include +#include "mpxviewplugin.h" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXViewPlugin* CMPXViewPlugin::NewL( + const TUid& aUid, + MMPXCustomCommandObserver* aCommandObserver ) + { + TAny* plugin = REComSession::CreateImplementationL( + aUid, + _FOFF( CMPXViewPlugin, iDtorKey ) ); + CMPXViewPlugin* self = reinterpret_cast( plugin ); + self->SetObserver( aCommandObserver ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CMPXViewPlugin::~CMPXViewPlugin() + { + REComSession::DestroyedImplementation( iDtorKey ); + } + +// --------------------------------------------------------------------------- +// Set command observer +// --------------------------------------------------------------------------- +// +EXPORT_C void CMPXViewPlugin::SetObserver( + MMPXCustomCommandObserver* aCommandObserver ) + { + iCommandObserver = aCommandObserver; + } + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/viewframework/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/viewframework/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2006 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 for View Framework. +* +*/ + + +#include + +#include "../baseviewplugins/group/bld.inf" +#include "../viewutility/group/bld.inf" + +PRJ_EXPORTS +../rom/mpxviewframework.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mpxviewframework.iby) + + diff -r 000000000000 -r a2952bb97e68 mpx/viewframework/rom/mpxviewframework.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/viewframework/rom/mpxviewframework.iby Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2006 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: Image description file for project MPX View Framework. +* +*/ + + +#ifndef MPXVIEWFRAMEWORK_IBY +#define MPXVIEWFRAMEWORK_IBY + +#include + + +file=ABI_DIR\BUILD_DIR\mpxviewutility.dll SHARED_LIB_DIR\mpxviewutility.dll +file=ABI_DIR\BUILD_DIR\mpxviewplugin.dll SHARED_LIB_DIR\mpxviewplugin.dll + +#endif // MPXVIEWFRAMEWORK_IBY diff -r 000000000000 -r a2952bb97e68 mpx/viewframework/viewutility/bwinscw/mpxviewutilityU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/viewframework/viewutility/bwinscw/mpxviewutilityU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?UtilityL@MMPXViewUtility@@SAPAV1@XZ @ 1 NONAME ; class MMPXViewUtility * MMPXViewUtility::UtilityL(void) + diff -r 000000000000 -r a2952bb97e68 mpx/viewframework/viewutility/eabi/mpxviewutilityU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/viewframework/viewutility/eabi/mpxviewutilityU.DEF Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,3 @@ +EXPORTS + _ZN15MMPXViewUtility8UtilityLEv @ 1 NONAME + diff -r 000000000000 -r a2952bb97e68 mpx/viewframework/viewutility/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/viewframework/viewutility/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2006 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 for project mpxviewutility. +* +*/ + + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +mpxviewutility.mmp + +PRJ_TESTMMPFILES diff -r 000000000000 -r a2952bb97e68 mpx/viewframework/viewutility/group/mpxviewutility.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/viewframework/viewutility/group/mpxviewutility.mmp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2006 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 for project mpxviewutility. +* +*/ + + + +#include +#include +#include + +TARGET mpxviewutility.dll +TARGETTYPE dll +UID 0x1000006C 0x101FFC68 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE mpxviewutility.cpp +SOURCE mpxviewutilityimp.cpp +SOURCE mpxviewpluginhandler.cpp +SOURCE mpxviewutilityhelper.cpp +SOURCE mpxviewhistory.cpp + +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY apparc.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY centralrepository.lib +LIBRARY mpxviewplugin.lib +LIBRARY mpxcommon.lib + +#if defined(ARMCC) +deffile ../eabi/ +#elif defined(WINSCW) +deffile ../bwinscw/ +#endif + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/viewframework/viewutility/inc/mpxviewhistory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/viewframework/viewutility/inc/mpxviewhistory.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2006 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: MPX view history +* +*/ + + + +#ifndef MPXVIEWHISTORY_H +#define MPXVIEWHISTORY_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CMPXViewPlugin; + +// CLASS DECLARATION + +/** + * MPX view history. + * + * @lib mpxviewutility.lib + * @since S60 v3.1 + */ + +NONSHARABLE_CLASS( CMPXViewHistory ) : public CBase + { +public: + /** + * Two-phase constructor + * + * @return object created + */ + static CMPXViewHistory* NewL(); + + /** + * Two-phase constructor + * + * @param aHistory pointer to an existing view history + * @return object created + */ + static CMPXViewHistory* NewL( CMPXViewHistory* aHistory ); + + /** + * Two-phase constructor + * + * @param aUids Uid used to resolve the plugins + * @param aPluginType type of the plugin resolved + * @param aPluginImplementationUid Implementation Uid + * @param aPlugin Pointer to the plugin + * @return object created + */ + static CMPXViewHistory* NewL( + const RArray& aUids, + const TUid aPluginType, + const TUid aPluginImplementationUid, + CMPXViewPlugin* aPlugin ); + + /** + * Destructor. + */ + ~CMPXViewHistory(); + +private: + + /** + * default constructor + */ + CMPXViewHistory(); + + /** + * Second phase constructor + * + * @param aUids Uid used to resolve the plugins + * @param aPluginType type of the plugin resolved + * @param aPluginImpUid Implementation Uid + * @param aPlugin Pointer to the plugin + */ + void ConstructL( + const RArray& aUids, + const TUid aPluginType, + const TUid aPluginImpUid, + CMPXViewPlugin* aPlugin ); + +public: + RArray iUids; + TUid iPluginType; + TUid iPluginImplementationUid; + CMPXViewPlugin* iPlugin; // not owned + }; + +#endif // MPXVIEWHISTORY_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/viewframework/viewutility/inc/mpxviewpluginhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/viewframework/viewutility/inc/mpxviewpluginhandler.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,202 @@ +/* +* Copyright (c) 2006 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: MPX view plugin handler implementation +* +*/ + + + +#ifndef CMPXVIEWPLUGINHANDLER_H +#define CMPXVIEWPLUGINHANDLER_H + + +// INCLUDES +#include +#include +#include +#include +#include "mpxviewpluginmanager.h" + + +// FORWARD DECLARATIONS +class MMPXCustomCommandObserver; + + +// CLASS DECLARATION + +/** + * MPX view plugin handler. + * + * @lib mpxviewutility.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( CMPXViewPluginHandler ) : public CMPXPluginHandlerBase, + public MMPXViewPluginManager + { +public: + + /** + * Two-phased constructor. + * + * @since 3.1 + * + * @param aCommandObserver Observer to handle commands from the plugins + * @return Pointer to newly created object. + */ + static CMPXViewPluginHandler* NewL( + MMPXCustomCommandObserver* aCommandObserver, + MMPXPluginHandlerObserver& aObserver ); + + /** + * Destructor. + */ + virtual ~CMPXViewPluginHandler(); + + /** + * Wraper function to resolve view plugin + * Resolve view plugin based on the criteria passed in parameter. + * + * @since 3.0 + * @param aUid Specific view plugin uid or plugin type uid. + * @param aResolvedPluginType On return, stores the plugin type of + * the returned pointer + * @param aResolvedPluginImplementationUid On return, stores the implementation + * Uid of the resolved plugin + * @return Pointer to a view plugin object. Leave if not found. + */ + CMPXViewPlugin* ResolvePluginL( + const TUid& aUid, TUid& aResolvedPluginType, + TUid& aResolvedPluginImplementationUid ); + + /** + * Wraper function to resolve view plugin + * Resolve view plugin based on the criteria passed in parameter. + * + * @since 3.0 + * @param aUids List of Uids, including specific view plugin uid and/or + * plugin type uid. + * @param aResolvedPluginType On return, stores the plugin type of + * the returned pointer + * @param aResolvedPluginImplementationUid On return, stores the implementation + * Uid of the resolved plugin + * @return Pointer to a view plugin object. Leave if not found. + */ + CMPXViewPlugin* ResolvePluginL( + const RArray& aUids, TUid& aResolvedPluginType, + TUid& aResolvedPluginImplementationUid ); + + /** + * Wraper function to get a list of plugins that need to be pre-loaded. + * + * @since 3.0 + * @param aUids On return, a list of plugins' uids that match the criteria. + * @param aUid of specific application + */ + void GetPreLoadPluginsL( + RArray& aUids, const TUid& aUid ); + +// from base class MMPXViewPluginManager + + /** + * From MMPXViewPluginManager + * Return view plugin with specific view plugin uid. + * + * @since 3.0 + * @param aUid Specific view plugin uid. + * @return Pointer to a view plugin object. Leave if not found. + */ + CMPXViewPlugin* PluginL( + const TUid& aUid ); + + /** + * From MMPXViewPluginManager + * Wraper function to resolve view plugin + * Resolve view plugin based on the criteria passed in parameter. + * + * @since 3.0 + * @param aUid Specific view plugin uid or plugin type uid. + * @param aResolvedPluginType On return, stores the plugin type of + * the returned pointer + * @return Pointer to a view plugin object. Leave if not found. + */ + CMPXViewPlugin* ResolvePluginL( + const TUid& aUid, TUid& aResolvedPluginType ); + + /** + * From MMPXViewPluginManager + * Wraper function to resolve view plugin + * Resolve view plugin based on the criteria passed in parameter. + * + * @since 3.0 + * @param aUids List of Uids, including specific view plugin uid and/or + * plugin type uid. + * @param aResolvedPluginType On return, stores the plugin type of + * the returned pointer + * @return Pointer to a view plugin object. Leave if not found. + */ + CMPXViewPlugin* ResolvePluginL( + const RArray& aUids, TUid& aResolvedPluginType ); + +private: + + /** + * C++ default constructor. + * + * @param aCommandObserver Observer to handle commands from the plugins + * @param aObserver handler observer + */ + CMPXViewPluginHandler( MMPXCustomCommandObserver* aCommandObserver, + MMPXPluginHandlerObserver& aObserver ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * From Base CMPXPluginHandlerBase + * + * Not used, use ResolvePluginL( const RArray/Uid, TUid ) instead + */ + void ResolvePluginL(); + + /** + * @see CMPXPluginHandlerBase + */ + TBool IsPluginLoaded(const TUid& aPluginUid); + + /** + * @see CMPXPluginHandlerBase + */ + void LoadPluginL(const TUid& aPluginUid); + + /** + * @see CMPXPluginHandlerBase + */ + void UnloadPlugin(const TUid& aPluginUid); + +private: // data + + /** + * Loaded plugins. The index must correspond in these arrays. + */ + RPointerArray iLoadedPlugins; + RArray iLoadPluginUids; + + MMPXCustomCommandObserver* iCommandObserver; // not owned + }; + +#endif // CMPXVIEWPLUGINHANDLER_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/viewframework/viewutility/inc/mpxviewplugininfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/viewframework/viewutility/inc/mpxviewplugininfo.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,213 @@ +/* +* Copyright (c) 2006 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: MPX view plugin info definition +* +*/ + + + +#ifndef CMPXVIEWPLUGININFO_H +#define CMPXVIEWPLUGININFO_H + + +// INCLUDES +#include +#include + + +// FORWARD DECLARATIONS + + +// CLASS DECLARATION + +/** + * MPX view plugin info. + * + * @lib mpxviewutility.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( CMPXViewPluginInfo ) : public CBase + { +public: + + /** + * Two-phased constructor. + * + * @since 3.0 + * @param aData Plugin's implementation information. + * @return Pointer to newly created object. + */ + static CMPXViewPluginInfo* NewL( + const CImplementationInformation& aData ); + + /** + * Two-phased constructor. + * + * @since 3.0 + * @param aData Plugin's implementation information. + * @return Pointer to newly created object. + */ + static CMPXViewPluginInfo* NewLC( + const CImplementationInformation& aData ); + + /** + * Destructor. + */ + virtual ~CMPXViewPluginInfo(); + + /** + * Returns plugin's display name. + * + * @since 3.0 + * @return Plugin's display name. + */ + const TDesC& DisplayName() const; + + /** + * Returns plugin's implementation uid. + * + * @since 3.0 + * @return Plugin's implementation uid. + */ + const TUid& ImplementationUid() const; + + /** + * Returns plugin's supported uids. + * + * @since 3.0 + * @return Plugin's supported uids. + */ + const RArray SupportedUids() const; + + /** + * Returns plugin's plugin type. + * + * @since 3.0 + * @return Plugin's plugin type. + */ + const TUid& PluginType() const; + + /** + * Returns plugin's view priority. + * + * @since 3.0 + * @return Plugin's view priority. + */ + TInt Priority() const; + + /** + * Test whether the plugin is user selectable. + * + * @since 3.0 + * @return ETrue if plugin is user selectable, EFalse otherwise. + */ + TBool IsUserSelectable() const; + + /** + * Test whether the plugin should be preloaded. + * + * @since 3.0 + * @return ETrue if plugin needs preloaded, EFalse otherwise. + */ + TBool IsPreLoad() const; + +private: + + /** + * C++ default constructor. + */ + CMPXViewPluginInfo(); + + /** + * By default Symbian 2nd phase constructor is private. + * + * @param aData Plugin's implementation information. + */ + void ConstructL( + const CImplementationInformation& aData ); + + /** + * Extracts plugin priority from data. + * + * @param aData Plugin's opaque data. + * @return Plugin priority. + */ + TInt ExtractPluginPriority( + const TDesC8& aData ); + + /** + * Extracts plugin supported Uids from data. + * + * @param aData Plugin's opaque data. + * @param aArray On return, contains list of plugin uids. + */ + void ExtractPluginUidsL( + const TDesC8& aData, + RArray& aArray ); + + /** + * Extracts plugin type from data. + * + * @param aData Plugin's opaque data. + * @return Plugin type. + */ + TUid ExtractPluginType( + const TDesC8& aData ); + + /** + * Extracts plugin flags from data. + * + * @param aData Plugin's opaque data. + * @return Plugin feature flags. + */ + TInt ExtractPluginFlags( + const TDesC8& aData ); + +private: // data + + /** + * List of supported Uids. + */ + RArray iSupportedUids; + + /** + * Plugin's display name. + * Own. + */ + HBufC* iPluginName; + + /** + * Plugin's implementation Uid. + */ + TUid iPluginUid; + + /** + * Plugin's plugin type Uid. + */ + TUid iPluginTypeUid; + + /** + * Plugin feature flags. + */ + TInt iFlags; + + /** + * Plugin priority, TMPXViewPluginPriorities defined in mpxviewplugin.hrh. + */ + TInt iPriority; + }; + +#endif // CMPXVIEWPLUGININFO_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/viewframework/viewutility/inc/mpxviewutilityhelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/viewframework/viewutility/inc/mpxviewutilityhelper.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2006 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: MPX view utility helper +* +*/ + + + +#ifndef CMPXVIEWUTILITYHELPER_H +#define CMPXVIEWUTILITYHELPER_H + + +// INCLUDES +#include + +// CLASS DECLARATION + +/** + * MPX view utility helper. + * + * @lib mpxviewutility.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( CMPXViewUtilityHelper ) + { +public: + + /** + * Extracts number from data. + * + * @param aData Plugin's opaque data. + * @param aNextPos Next position to be searched from. On return, this value + * will be updated to next position. KErrNotFound if + * the end of data is reached. + * @param aResult Signed integer if found. + * @return KErrNone if found. KErrNotFound if not found. + * KErrGeneral if aNextPos is negative or aNextPos is greater than + * the length of aData. + */ + static TInt ExtractNum( + const TDesC8& aData, + TInt& aNextPos, + TInt& aResult ); + + /** + * Extracts number from data. + * + * @param aData Plugin's opaque data. + * @param aNextPos Next position to be searched from. On return, this value + * will be updated to next position. KErrNotFound if + * the end of data is reached. + * @param aResult Signed integer if found. + * @return KErrNone if found. KErrNotFound if not found. + * KErrGeneral if aNextPos is negative or aNextPos is greater than + * the length of aData. + */ + static TInt ExtractNum( + const TDesC& aData, + TInt& aNextPos, + TInt& aResult ); + }; + +#endif // CMPXVIEWUTILITYHELPER_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/viewframework/viewutility/inc/mpxviewutilityimp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/viewframework/viewutility/inc/mpxviewutilityimp.h Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,431 @@ +/* +* Copyright (c) 2006 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: MPX view utility implementation +* +*/ + + + +#ifndef CMPXVIEWUTILITYIMP_H +#define CMPXVIEWUTILITYIMP_H + + +// INCLUDES +#include +#include +#include "mpxviewutility.h" + +// FORWARD DECLARATIONS +class CMPXViewPluginHandler; +class CRepository; +class CMPXViewPlugin; +class CMPXViewHistory; + +// CLASS DECLARATION + +/** + * MPX view utility implementation. + * + * @lib mpxviewutility.lib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( CMPXViewUtilityImp ) : public CBase, + public MMPXViewUtility, + public MMPXCustomCommandObserver, + public MMPXPluginHandlerObserver + { +public: + + /** + * Retrieves view utility from TLS. Creates if it's not there. + * + * @since 3.1 + * @return Pointer to a view utility object. + */ + static MMPXViewUtility* UtilityL(); + +private: + + /** + * C++ default constructor. + */ + CMPXViewUtilityImp(); + + /** + * Destructor. + */ + virtual ~CMPXViewUtilityImp(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Two-phased constructor. + * Intentionally make this API private as this class is a singleton. + * To get a view utility instance, UtilityL() should be called. + * + * @return Pointer to newly created object. + */ + static CMPXViewUtilityImp* NewL(); + + /** + * Store view utility to TLS. + * + * @param aUtility View utility object. Ownership not transferred. + */ + static void StoreViewUtility( MMPXViewUtility* aUtility ); + +// from base class MMPXViewUtility + + /** + * From MMPXViewUtility + * This method must be called when the client no longer needs the utility + * instance. This object will be destroyed when no one is using it. + * + * @since 3.1 + */ + void Close(); + + /** + * From MMPXViewUtility + * Activate view by resolving passed uid. + * + * @since 3.1 + * @param aUid Uid to be resolved. This uid can be plugin implementation + * uid, plugin type uid or specific view plugin uid. + * @param aParam Parameter passed to the view on activation + * @leave KErrNotFound if a matching plugin cannot be found + */ + void ActivateViewL( + const TUid& aUid, + const TDesC* aParam = NULL ); + + /** + * From MMPXViewUtility + * Activate view by resolving passed uids. + * + * @since 3.1 + * @param aUids List of Uids to be resolved, this uid can be plugin uid, + * plugin type uid or specific view plugin uid. + * @param aParam Parameter passed to the view on activation + * @leave KErrNotFound if a matching plugin cannot be found + */ + void ActivateViewL( + const RArray& aUids, + const TDesC* aParam = NULL ); + + /** + * From MMPXViewUtility + * Set view as default view, not bring to foreground. This is only valid + * if there are no views previously activated + * + * @since 3.1 + * @param aUid Uid of item to be activated. This uid can be plugin implementation + * uid, plugin type uid or specific view plugin uid. + * @leave Error code KErrAlreadyExist when there are views already + * activated + * @leave Error code KErrNotSupported for views that doesn't support + * default view (such as dialogs) + */ + void SetAsDefaultViewL( const TUid& aUid ); + + /** + * From MMPXViewUtility + * Set view as default view, not bring to foreground. This is only valid + * if there are no views previously activated + * + * @since 3.1 + * @param aUid Uids of item to be activated. This uid can be plugin implementation + * uid, plugin type uid or specific view plugin uid. + * @leave Error code KErrAlreadyExist when there are views already + * activated + * @leave Error code KErrNotSupported for views that doesn't support + * default view (such as dialogs) + */ + void SetAsDefaultViewL( const RArray& aUids ); + + /** + * From MMPXViewUtility + * Activate previous view. + * + * @since 3.1 + * + * @leave Error code KErrNotFound if there's no history. + */ + void ActivatePreviousViewL(); + + /** + * From MMPXViewUtility + * Pre-load view plug-ins that have KMPXVpFeaturePreLoaded flag set. + * + * @since 3.1 + */ + void PreLoadViewsL(); + + /** + * From MMPXViewUtility + * Pre-load view plug-ins that have KMPXVpFeaturePreLoaded flag set and also by resolving aUid. + * + * @param aUid Uid of specific applicaiton to be resolved + */ + void PreLoadViewsL(const TUid& aUid); + + /** + * From MMPXViewUtility + * Pre-load view plug-in by resolving passed uid. + * + * @since 3.1 + * @param aUid Uid to be resolved. This uid can be plugin uid, plugin type + * uid or specific view plugin uid. + * @leave if no match is found. + */ + void PreLoadViewL( const TUid& aUid ); + + /** + * From MMPXViewUtility + * Get a reference to view plugin manager. + * + * @since 3.1 + * @return Reference to view plugin manager. + */ + MMPXViewPluginManager& ViewPluginManager(); + + /** + * From MMPXViewUtility + * Constructs default view history + * + * @since 3.1 + * @return if defined, the default view UID. KNullUid if not defined + */ + TUid ConstructDefaultViewHistoryL(); + + /** + * From MMPXViewUtility + * + * Push default history to view history. The current browse history + * is erased and the default browsing path is loaded as the current history + * + * @since 3.1 + */ + void PushDefaultHistoryL(); + + /** + * From MMPXViewUtility + * Gets default view's UID + * + * @return if defined, the default view UID. KNullUid if not defined + * + * @since 3.1 + */ + TUid DefaultViewUid(); + + /** + * From MMPXViewUtility + * Returns the current history depth + * if depth is greater than 1, the client should call ActivatePreviousViewL + * on a back command + * + * if depth is 1, the client should exit the app on a back command instead + * of calling ActivatePreviousViewL + * + * @since 3.1 + * + * @return The current browsing history depth. + */ + TInt ViewHistoryDepth(); + + /** + * From MMPXViewUtility + * Returns the last activated view type + * + * @return previous view type if defined. KNullUid if not. + * + * @since 3.1 + */ + TUid PreviousViewType(); + + /** + * From MMPXViewUtility + * Returns the view type of the active view. + * + * @return current view type if defined. KNullUid if not. + * + * @since 3.1 + */ + TUid ActiveViewType(); + + /** + * From MMPXViewUtility + * Returns the implementation uid of the active view. + * + * @return current view implementation id if defined. KNullUid if not. + * + * @since 3.1 + */ + TUid ActiveViewImplementationUid(); + + /** + * From MMPXViewUtility + * Add view activation observer. + * + * @since 3.1 + * @param aObserver Pointer to an observer object + */ + void AddObserverL( + MMPXViewActivationObserver* aObserver ); + + /** + * From MMPXViewUtility + * Remove view activation observer. + * + * @since 3.1 + * @param aObserver Pointer to an observer object + */ + void RemoveObserver( + MMPXViewActivationObserver* aObserver ); + + /** + * From MMPXCustomCommandObserver + * Handle custom commands. + * + * @since 3.1 + * @param aUid Command category Uid. Different command set will have + * different Uid to avoid clash. + * @param aCommand Command to be handled. + * @param aData data for the specific command + */ + void HandleCustomCommand( + const TUid& aUid, + const TInt aCommand, + const TDesC8& aData = KNullDesC8 ); + + /* + * From MMPXPluginHandlerObserver + * @see MMPXPluginHandlerObserver + */ + void HandlePluginHandlerEvent(TPluginHandlerEvents aEvent, const TUid& aPluginUid, + TInt aLoaded, TInt aData); + +private: + + /** + * Activate view by resolving passed uids. + * + * @since 3.1 + * @param aUids List of Uids to be resolved, this uid can be plugin uid, + * plugin type uid or specific view plugin uid. + * @param aIsActivatingPreviousView ETrue if activating previous view + * @param aUpdatedPreviousView ETrue iPreviousView has been updated or no need + * EFalse will update iPreviousView + * @param aParam Parameter passed to the view on activation + */ + void ActivateViewL( + const RArray& aUids, + TBool aIsActivatingPreviousView, + TBool aUpdatedPreviousView, + const TDesC* aParam = NULL ); + + /** + * Marks the view closed. This does not actually close the view. + * When a dialog is closed, it should call this method to indicate it has been closed. + * + * @since 3.1 + * @param aPlugin a pointer to the current dialog + */ + void MarkViewAsClosedL( CMPXViewPlugin* aPlugin ); + + /** + * Notify observers on view activation. + * + * @param aCurrentViewType Current view type Uid + * @param aPreviousViewType Previous view type Uid + */ + void NotifyObservers( + const TUid& aCurrentViewType, + const TUid& aPreviousViewType ); + + /** + * Notify observers on view update events (addition/update/removal). + * + * @param aViewUid Identifies the view. + * @param aUpdateEvent Identifies the event (addition/update/removal). + * @param aLoaded ETrue if the view is currently loaded + * @param aVersion View version (new for addition and update and old for removal) + */ + void NotifyViewUpdate( + const TUid& aViewUid, + MMPXViewActivationObserver::TViewUpdateEvent aUpdateEvent, + TBool aLoaded, + TInt aVersion = 0); + + /** + * Insert/Append to default view history array + * + * @param aData data to append/insert + * @param aLoc location to insert (default append) + * + * @return if successful, returns the plulgin type uid + */ + TInt AddToDefaultViewHistoryL( const TDesC& aData, TInt aLoc = -1 ); + + /** + * Updates previous view info + * + * @param aIndex index in current view history to store + */ + void UpdatePreviousViewInfoL( TInt aIndex ); + + /** + * Find if the view exist in current history + * + * @param aType type to search for + * @return index of the plugin in history if found, KErrNotFound otherwise + */ + TInt FindCurrentHistoryEntryByTypeL( const TUid aType ); + +private: // data + + /** + * View plugin handler. + * Own. + */ + CMPXViewPluginHandler* iPluginManager; + + /** + * Reference count. + */ + TInt iRefCount; + + /** + * History paths + */ + RPointerArray iDefaultHistoryPath; + RPointerArray iCurrentHistoryPath; + + /** + * List of observers + * Owned. + */ + RPointerArray iObservers; + + CMPXViewHistory* iPreviousView; + CMPXViewHistory* iCurrentView; + CMPXViewHistory* iDefaultView; + }; + +#endif // CMPXVIEWUTILITYIMP_H + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/viewframework/viewutility/src/mpxviewhistory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/viewframework/viewutility/src/mpxviewhistory.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2006 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: Implementation of view history +* +*/ + + + +// INCLUDE FILES +#include + +#include "mpxviewhistory.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CMPXViewHistory* CMPXViewHistory::NewL() + { + CMPXViewHistory* self = new ( ELeave ) CMPXViewHistory(); + // empty history, construction not needed + return self; + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CMPXViewHistory* CMPXViewHistory::NewL( CMPXViewHistory* aHistory ) + { + CMPXViewHistory* self = new ( ELeave ) CMPXViewHistory(); + CleanupStack::PushL( self ); + if ( aHistory ) + { + self->ConstructL( + aHistory->iUids, aHistory->iPluginType, + aHistory->iPluginImplementationUid, aHistory->iPlugin ); + } + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CMPXViewHistory* CMPXViewHistory::NewL( + const RArray& aUids, + const TUid aPluginType, + const TUid aPluginImplementationUid, + CMPXViewPlugin* aPlugin ) + { + CMPXViewHistory* self = new ( ELeave ) CMPXViewHistory(); + CleanupStack::PushL( self ); + self->ConstructL( aUids, aPluginType, aPluginImplementationUid, aPlugin ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// default constructor +// --------------------------------------------------------------------------- +// +CMPXViewHistory::CMPXViewHistory() + { + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CMPXViewHistory::~CMPXViewHistory() + { + iUids.Reset(); + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CMPXViewHistory::ConstructL( + const RArray& aUids, + const TUid aPluginType, + const TUid aPluginImpUid, + CMPXViewPlugin* aPlugin ) + { + iPluginType = aPluginType; + iPluginImplementationUid = aPluginImpUid; + iPlugin = aPlugin; + + for ( TInt i = 0; i < aUids.Count(); i++ ) + { + iUids.Append( aUids[ i ] ); + } + } + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/viewframework/viewutility/src/mpxviewpluginhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/viewframework/viewutility/src/mpxviewpluginhandler.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,286 @@ +/* +* Copyright (c) 2006 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: Implementation of view plugin handler +* +*/ + + + +// INCLUDE FILES +#include +#include +#include "mpxpluginhandlerobserver.h" +#include "mpxviewpluginhandler.h" +#include "mpxlog.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CMPXViewPluginHandler::CMPXViewPluginHandler( + MMPXCustomCommandObserver* aCommandObserver, + MMPXPluginHandlerObserver& aObserver ) : + CMPXPluginHandlerBase( + TUid::Uid( KMPXViewPluginInterfaceUid ), ESelectionType, 0, aObserver ), + iCommandObserver( aCommandObserver ) + { + } + +// --------------------------------------------------------------------------- +// By default Symbian 2nd phase constructor is private. +// --------------------------------------------------------------------------- +// +void CMPXViewPluginHandler::ConstructL() + { + MPX_FUNC( "CMPXViewPluginHandler::ConstructL" ); + BaseConstructL(); + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CMPXViewPluginHandler* CMPXViewPluginHandler::NewL( + MMPXCustomCommandObserver* aCommandObserver, + MMPXPluginHandlerObserver& aObserver ) + { + CMPXViewPluginHandler* self = + new ( ELeave ) CMPXViewPluginHandler( aCommandObserver, aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CMPXViewPluginHandler::~CMPXViewPluginHandler() + { + for ( TInt i = iLoadedPlugins.Count(); --i >= 0; ) + { + iLoadedPlugins[i]->DestroyView(); + } + iLoadedPlugins.ResetAndDestroy(); + iLoadPluginUids.Close(); + + iCommandObserver = NULL; + } + +// --------------------------------------------------------------------------- +// Resolve view plugin based on the criteria passed in parameter. +// --------------------------------------------------------------------------- +// +CMPXViewPlugin* CMPXViewPluginHandler::ResolvePluginL( + const TUid& aUid, TUid& aResolvedPluginType, + TUid& aResolvedPluginImplementationUid ) + { + MPX_FUNC( "CMPXViewPluginHandler::ResolvePluginL single uid" ); + RArray array; + CleanupClosePushL( array ); + array.AppendL( aUid ); + CMPXViewPlugin* plugin( NULL ); + plugin = ResolvePluginL( + array, aResolvedPluginType, aResolvedPluginImplementationUid ); + CleanupStack::PopAndDestroy( &array ); + + return plugin; + } + +// --------------------------------------------------------------------------- +// Resolve view plugin based on the criteria passed in parameter. +// --------------------------------------------------------------------------- +// +CMPXViewPlugin* CMPXViewPluginHandler::ResolvePluginL( + const RArray& aUids, TUid& aResolvedPluginType, + TUid& aResolvedPluginImplementationUid ) + { + MPX_FUNC( "CMPXViewPluginHandler::ResolvePluginL uid array" ); +#ifdef _DEBUG + for ( TInt i = 0; i < aUids.Count(); i++ ) + { + MPX_DEBUG2( "CMPXViewPluginHandler::ResolvePluginL input Uid = 0x%x", aUids[i].iUid ); + } +#endif // _DEBUG + TUid impUid( FindPlugin( aUids.Array() ) ); + MPX_DEBUG2( "CMPXViewPluginHandler::ResolvePluginL resolved implementation Uid = 0x%x", impUid.iUid ); + if ( impUid == KNullUid ) + { + User::Leave( KErrNotFound ); + } + else + { + aResolvedPluginImplementationUid = impUid; + aResolvedPluginType = PluginType( impUid ); + } + return PluginL( impUid ); + } + +// --------------------------------------------------------------------------- +// Get a list of plugins that need to be pre-loaded. +// --------------------------------------------------------------------------- +// +void CMPXViewPluginHandler::GetPreLoadPluginsL( RArray& aUids, const TUid& aUid ) + { + MPX_DEBUG2( "CMPXViewPluginHandler::GetPreLoadPluginsL aUID: 0x%x", aUid ); + RArray array; + CleanupClosePushL( array ); + GetPluginUids( array ); + + for ( TInt i = array.Count(); --i >= 0; ) + { + if ( PluginFlagsL( array[ i ] ) & EMPXPluginFlagPreLoad ) + { + if ( aUid == KNullUid ) + { + MPX_DEBUG2( "CMPXViewPluginHandler::GetPreLoadPluginsL adding UID: 0x%x", array[i] ); + aUids.Append( array[ i ] ); + } + else + { + TUid impUid = SupportedAppUid( array[ i ] ); + MPX_DEBUG2( "APP UID: 0x%x", impUid ); + if ( aUid == impUid ) + { + MPX_DEBUG2( "CMPXViewPluginHandler::GetPreLoadPluginsL adding UID: 0x%x", array[i] ); + aUids.Append( array[ i ] ); + } + } + } + } + CleanupStack::PopAndDestroy( &array ); + } + +// --------------------------------------------------------------------------- +// From MMPXViewPluginManager +// Return view plugin with specific view plugin uid. +// --------------------------------------------------------------------------- +// +CMPXViewPlugin* CMPXViewPluginHandler::PluginL( + const TUid& aUid ) + { + MPX_FUNC( "CMPXViewPluginHandler::PluginL" ); + CMPXViewPlugin* plugin( NULL ); + TInt index = iLoadPluginUids.Find( aUid ); + + if ( KErrNotFound == index ) + { + // Check if uid is a valid view plugin uid. + if ( IndexOf( aUid ) != KErrNotFound ) + { + plugin = CMPXViewPlugin::NewL( aUid, iCommandObserver ); + CleanupStack::PushL( plugin ); + iLoadPluginUids.AppendL( aUid ); + iLoadedPlugins.AppendL( plugin ); + CleanupStack::Pop( plugin ); + } + else + { + // Leave if not found + User::Leave( KErrNotFound ); + } + } + else + { + plugin = iLoadedPlugins[index]; + } + return plugin; + } + +// --------------------------------------------------------------------------- +// From MMPXViewPluginManager +// Resolve view plugin based on the criteria passed in parameter. +// --------------------------------------------------------------------------- +// +CMPXViewPlugin* CMPXViewPluginHandler::ResolvePluginL( + const TUid& aUid, TUid& aResolvedPluginType ) + { + MPX_FUNC( "CMPXViewPluginHandler::ResolvePluginL single uid wrapper" ); + TUid impUid( KNullUid ); + return ResolvePluginL( aUid, aResolvedPluginType, impUid ); + } + +// --------------------------------------------------------------------------- +// From MMPXViewPluginManager +// Resolve view plugin based on the criteria passed in parameter. +// --------------------------------------------------------------------------- +// +CMPXViewPlugin* CMPXViewPluginHandler::ResolvePluginL( + const RArray& aUids, TUid& aResolvedPluginType ) + { + MPX_FUNC( "CMPXViewPluginHandler::ResolvePluginL uid array wrapper" ); + TUid impUid( KNullUid ); + return ResolvePluginL( aUids, aResolvedPluginType, impUid ); + } + +// --------------------------------------------------------------------------- +// From CMPXPluginHandlerBase +// Resolve view plugin based on the criteria passed in parameter. +// --------------------------------------------------------------------------- +// +void CMPXViewPluginHandler::ResolvePluginL() + { + MPX_FUNC( "CMPXViewPluginHandler::ResolvePluginL" ); + // not used + } + +// ---------------------------------------------------------------------------- +// CMPXViewPluginHandler::IsPluginLoaded +// ---------------------------------------------------------------------------- +// +TBool CMPXViewPluginHandler::IsPluginLoaded( + const TUid& aPluginUid) + { + MPX_FUNC("CMPXViewPluginHandler::IsPluginLoaded"); + return (iLoadPluginUids.Find(aPluginUid) != KErrNotFound); + } + +// ---------------------------------------------------------------------------- +// CMPXViewPluginHandler::LoadPluginL +// ---------------------------------------------------------------------------- +// +void CMPXViewPluginHandler::LoadPluginL( + const TUid& aPluginUid) + { + MPX_FUNC("CMPXViewPluginHandler::LoadPluginL"); + (void)PluginL(aPluginUid); + } + +// ---------------------------------------------------------------------------- +// Unload the plugin +// ---------------------------------------------------------------------------- +// +void CMPXViewPluginHandler::UnloadPlugin( + const TUid& aUid) + { + MPX_FUNC("CMPXViewPluginHandler::UnloadPlugin"); + + TInt index = iLoadPluginUids.Find(aUid); + if (index != KErrNotFound) + { + CMPXViewPlugin* plugin = iLoadedPlugins[index]; + plugin->DestroyView(); + iLoadedPlugins.Remove(index); + iLoadPluginUids.Remove(index); + delete plugin; + } + } + + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/viewframework/viewutility/src/mpxviewplugininfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/viewframework/viewutility/src/mpxviewplugininfo.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,246 @@ +/* +* Copyright (c) 2006 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: Implementation of view plugin info +* +*/ + + + +// INCLUDE FILES +#include + +#include "mpxviewutilityhelper.h" +#include "mpxviewplugininfo.h" +#include "mpxlog.h" + + +// CONSTANTS +_LIT8( KMPXPluginUidMarkerStart, "

" ); +_LIT8( KMPXPluginUidMarkerEnd, "

" ); +_LIT8( KMPXPluginTypeMarkerStart, "" ); +_LIT8( KMPXPluginTypeMarkerEnd, "" ); +_LIT8( KMPXPluginFlagMarkerStart, "" ); +_LIT8( KMPXPluginFlagMarkerEnd, "" ); +_LIT8( KMPXPluginPriorityMarkerStart, "" ); +_LIT8( KMPXPluginPriorityMarkerEnd, "" ); + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CMPXViewPluginInfo::CMPXViewPluginInfo() + { + } + +// --------------------------------------------------------------------------- +// By default Symbian 2nd phase constructor is private. +// --------------------------------------------------------------------------- +// +void CMPXViewPluginInfo::ConstructL( + const CImplementationInformation& aData ) + { + iPluginName = aData.DisplayName().AllocL(); + iPluginUid = aData.ImplementationUid(); + iPluginTypeUid = ExtractPluginType( aData.OpaqueData() ); + iFlags = ExtractPluginFlags( aData.OpaqueData() ); + iPriority = ExtractPluginPriority( aData.OpaqueData() ); + ExtractPluginUidsL( aData.OpaqueData(), iSupportedUids ); + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CMPXViewPluginInfo* CMPXViewPluginInfo::NewL( + const CImplementationInformation& aData ) + { + CMPXViewPluginInfo* self = CMPXViewPluginInfo::NewLC( aData ); + CleanupStack::Pop( self ); + + return self; + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CMPXViewPluginInfo* CMPXViewPluginInfo::NewLC( + const CImplementationInformation& aData ) + { + CMPXViewPluginInfo* self = new ( ELeave ) CMPXViewPluginInfo(); + CleanupStack::PushL( self ); + self->ConstructL( aData ); + + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CMPXViewPluginInfo::~CMPXViewPluginInfo() + { + delete iPluginName; + iSupportedUids.Close(); + } + +// --------------------------------------------------------------------------- +// Returns plugin's display name. +// --------------------------------------------------------------------------- +// +const TDesC& CMPXViewPluginInfo::DisplayName() const + { + return iPluginName ? static_cast( *iPluginName ) : KNullDesC; + } + +// --------------------------------------------------------------------------- +// Returns plugin's implementation uid. +// --------------------------------------------------------------------------- +// +const TUid& CMPXViewPluginInfo::ImplementationUid() const + { + return iPluginUid; + } + +// --------------------------------------------------------------------------- +// Returns plugin's supported uids. +// --------------------------------------------------------------------------- +// +const RArray CMPXViewPluginInfo::SupportedUids() const + { + return iSupportedUids; + } + +// --------------------------------------------------------------------------- +// Returns plugin's plugin type. +// --------------------------------------------------------------------------- +// +const TUid& CMPXViewPluginInfo::PluginType() const + { + return iPluginTypeUid; + } + +// --------------------------------------------------------------------------- +// Returns plugin's view priority. +// --------------------------------------------------------------------------- +// +TInt CMPXViewPluginInfo::Priority() const + { + return iPriority; + } + +// --------------------------------------------------------------------------- +// Test whether the plugin is user selectable. +// --------------------------------------------------------------------------- +// +TBool CMPXViewPluginInfo::IsUserSelectable() const + { + return iFlags & KMPXVpFeatureUserSelectable; + } + +// --------------------------------------------------------------------------- +// Test whether the plugin needs to be preloaded. +// --------------------------------------------------------------------------- +// +TBool CMPXViewPluginInfo::IsPreLoad() const + { + return iFlags & KMPXVpFeaturePreLoaded; + } + +// --------------------------------------------------------------------------- +// Extracts plugin priority from data. +// --------------------------------------------------------------------------- +// +TInt CMPXViewPluginInfo::ExtractPluginPriority( + const TDesC8& aData ) + { + TInt ignore( 0 ); + TInt priority( 0 ); + TPtrC8 string = + CMPXViewUtilityHelper::Extract( + aData, + KMPXPluginPriorityMarkerStart, + KMPXPluginPriorityMarkerEnd ); + + CMPXViewUtilityHelper::ExtractNum( string, ignore, priority ); + + return priority; + } + +// --------------------------------------------------------------------------- +// Extracts plugin supported Uids from data. +// --------------------------------------------------------------------------- +// +void CMPXViewPluginInfo::ExtractPluginUidsL( + const TDesC8& aData, + RArray& aArray ) + { + aArray.Reset(); + + TInt nextPos( 0 ); + TInt pluginUid( 0 ); + TPtrC8 string = + CMPXViewUtilityHelper::Extract( + aData, KMPXPluginUidMarkerStart, KMPXPluginUidMarkerEnd ); + + do + { + if ( KErrNone == + CMPXViewUtilityHelper::ExtractNum( string, nextPos, pluginUid ) ) + { + aArray.AppendL( TUid::Uid( pluginUid ) ); + } + } while ( KErrNotFound != nextPos ); + } + +// --------------------------------------------------------------------------- +// Extracts plugin type from data. +// --------------------------------------------------------------------------- +// +TUid CMPXViewPluginInfo::ExtractPluginType( + const TDesC8& aData ) + { + TInt ignore( 0 ); + TInt type( 0 ); + TPtrC8 string = + CMPXViewUtilityHelper::Extract( + aData, KMPXPluginTypeMarkerStart, KMPXPluginTypeMarkerEnd ); + + CMPXViewUtilityHelper::ExtractNum( string, ignore, type ); + + return TUid::Uid( type ); + } + +// --------------------------------------------------------------------------- +// Extracts plugin feature flags from data. +// --------------------------------------------------------------------------- +// +TInt CMPXViewPluginInfo::ExtractPluginFlags( + const TDesC8& aData ) + { + TInt ignore( 0 ); + TInt flags( 0 ); + TPtrC8 string = + CMPXViewUtilityHelper::Extract( + aData, KMPXPluginFlagMarkerStart, KMPXPluginFlagMarkerEnd ); + + CMPXViewUtilityHelper::ExtractNum( string, ignore, flags ); + + return flags; + } + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/viewframework/viewutility/src/mpxviewutility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/viewframework/viewutility/src/mpxviewutility.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2006 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: Implementation of view utility +* +*/ + + + +// INCLUDE FILES +#include "mpxviewutilityimp.h" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Retrieve a view utility of this thread. +// --------------------------------------------------------------------------- +// +EXPORT_C MMPXViewUtility* MMPXViewUtility::UtilityL() + { + return CMPXViewUtilityImp::UtilityL(); + } + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/viewframework/viewutility/src/mpxviewutilityhelper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/viewframework/viewutility/src/mpxviewutilityhelper.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,154 @@ +/* +* Copyright (c) 2006 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: Implementation of view utility helper +* +*/ + + + +// INCLUDE FILES +#include "mpxviewutilityhelper.h" + +// CONSTANTS +_LIT8( KMPXDelimiter8, ";" ); +_LIT8( KMPXHexMarker8, "0x" ); + +_LIT( KMPXDelimiter, ";" ); +_LIT( KMPXHexMarker, "0x" ); + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Extracts number from data. ( 8 bit ) +// --------------------------------------------------------------------------- +// +TInt CMPXViewUtilityHelper::ExtractNum( + const TDesC8& aData, + TInt& aNextPos, + TInt& aResult ) + { + if ( aNextPos < 0 || aNextPos > aData.Length() ) + { + aNextPos = KErrNotFound; + return KErrArgument; + } + + TInt err( KErrNone ); + TPtrC8 string( aData.Mid( aNextPos ) ); + + if ( string.Length() ) + { + TInt delimiterPos = string.Find( KMPXDelimiter8 ); + if ( KErrNotFound != delimiterPos ) + { + string.Set( aData.Mid( aNextPos, delimiterPos ) ); + aNextPos += delimiterPos + KMPXDelimiter8().Length(); + if ( aNextPos >= aData.Length() ) + { + // Reach the end of string + aNextPos = KErrNotFound; + } + } + else + { + // Reach the end of string + aNextPos = KErrNotFound; + } + + // Convert string to integer + TInt hexMarkerPos = string.Find( KMPXHexMarker8 ); + if ( KErrNotFound != hexMarkerPos ) + { + TUint numHex( 0 ); + TLex8 lexHex( string.Mid( KMPXHexMarker8().Length() ) ); + err = lexHex.Val( numHex, EHex ); + aResult = numHex; + } + else + { + TLex8 lexDec( string ); + err = lexDec.Val( aResult ); + } + } + else + { + aNextPos = KErrNotFound; + err = KErrNotFound; + } + + return err; + } + +// --------------------------------------------------------------------------- +// Extracts number from data. ( generic ) +// --------------------------------------------------------------------------- +// +TInt CMPXViewUtilityHelper::ExtractNum( + const TDesC& aData, + TInt& aNextPos, + TInt& aResult ) + { + if ( aNextPos < 0 || aNextPos > aData.Length() ) + { + aNextPos = KErrNotFound; + return KErrGeneral; + } + + TInt err( KErrNone ); + TPtrC string( aData.Mid( aNextPos ) ); + + if ( string.Length() ) + { + TInt delimiterPos = string.Find( KMPXDelimiter ); + if ( KErrNotFound != delimiterPos ) + { + string.Set( aData.Mid( aNextPos, delimiterPos ) ); + aNextPos += delimiterPos + KMPXDelimiter().Length(); + if ( aNextPos >= aData.Length() ) + { + // Reach the end of string + aNextPos = KErrNotFound; + } + } + else + { + // Reach the end of string + aNextPos = KErrNotFound; + } + + // Convert string to integer + TInt hexMarkerPos = string.Find( KMPXHexMarker ); + if ( KErrNotFound != hexMarkerPos ) + { + TUint numHex( 0 ); + TLex lexHex( string.Mid( KMPXHexMarker().Length() ) ); + err = lexHex.Val( numHex, EHex ); + aResult = numHex; + } + else + { + TLex lexDec( string ); + err = lexDec.Val( aResult ); + } + } + else + { + aNextPos = KErrNotFound; + err = KErrNotFound; + } + + return err; + } + +// End of File diff -r 000000000000 -r a2952bb97e68 mpx/viewframework/viewutility/src/mpxviewutilityimp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/viewframework/viewutility/src/mpxviewutilityimp.cpp Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,1012 @@ +/* +* Copyright (c) 2006 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: Implementation of view utility +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include + +#include "mpxviewutilitycommanddef.h" +#include "mpxviewhistory.h" +#include "mpxviewutilityhelper.h" +#include "mpxviewutilityimp.h" +#include "mpxviewpluginhandler.h" +#include "mpxlog.h" + +// CONSTANTS +_LIT( KMPXDelimiter, ";" ); +const TInt KMPXMaxHistoryLength( 255 ); + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CMPXViewUtilityImp::CMPXViewUtilityImp() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// By default Symbian 2nd phase constructor is private. +// --------------------------------------------------------------------------- +// +void CMPXViewUtilityImp::ConstructL() + { + iPluginManager = CMPXViewPluginHandler::NewL( this, *this ); + iCurrentView = CMPXViewHistory::NewL(); + ConstructDefaultViewHistoryL(); + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CMPXViewUtilityImp* CMPXViewUtilityImp::NewL() + { + CMPXViewUtilityImp* self = new ( ELeave ) CMPXViewUtilityImp(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CMPXViewUtilityImp::~CMPXViewUtilityImp() + { + delete iPreviousView; + delete iCurrentView; + delete iDefaultView; + delete iPluginManager; + iDefaultHistoryPath.ResetAndDestroy(); + iCurrentHistoryPath.ResetAndDestroy(); + + iObservers.Reset(); + } + +// --------------------------------------------------------------------------- +// Retrieves view utility from TLS. Creates if it's not there. +// --------------------------------------------------------------------------- +// +MMPXViewUtility* CMPXViewUtilityImp::UtilityL() + { + MPX_FUNC( "CMPXViewUtilityImp::UtilityL" ); + MMPXViewUtility* utility = reinterpret_cast( Dll::Tls() ); + if ( !utility ) + { + utility = CMPXViewUtilityImp::NewL(); + StoreViewUtility( utility ); + } + + static_cast( utility )->iRefCount++; + return utility; + } + +// --------------------------------------------------------------------------- +// Store view utility to TLS. +// --------------------------------------------------------------------------- +// +void CMPXViewUtilityImp::StoreViewUtility( MMPXViewUtility* aUtility ) + { + Dll::SetTls( aUtility ); + } + +// --------------------------------------------------------------------------- +// From MMPXViewUtility +// This method must be called when the client no longer needs this instance. +// This object will be destroyed when no one is using it. +// --------------------------------------------------------------------------- +// +void CMPXViewUtilityImp::Close() + { + ASSERT( iRefCount > 0 ); + MPX_FUNC_EX( "CMPXViewUtilityImp::Close" ); + MPX_DEBUG2( "CMPXViewUtilityImp::Close ref count = %d", iRefCount ); + if ( --iRefCount == 0 ) + { + MPX_DEBUG1( "CMPXViewUtilityImp::Close deleting this" ); + // last client released + StoreViewUtility( NULL ); + delete this; + } + } + +// --------------------------------------------------------------------------- +// From MMPXViewUtility +// Activate view by resolving passed uid. +// --------------------------------------------------------------------------- +// +void CMPXViewUtilityImp::ActivateViewL( + const TUid& aUid, + const TDesC* aParam ) + { + RArray array; + CleanupClosePushL( array ); + array.AppendL( aUid ); + ActivateViewL( array, EFalse, EFalse, aParam ); + CleanupStack::PopAndDestroy( &array ); + } + +// --------------------------------------------------------------------------- +// From MMPXViewUtility +// Activate view by resolving passed uids. +// --------------------------------------------------------------------------- +// +void CMPXViewUtilityImp::ActivateViewL( + const RArray& aUids, + const TDesC* aParam ) + { + ActivateViewL( aUids, EFalse, EFalse, aParam ); + } + +// --------------------------------------------------------------------------- +// From MMPXViewUtility +// Activate view as default view, does not bring to foreground. +// --------------------------------------------------------------------------- +// +void CMPXViewUtilityImp::SetAsDefaultViewL( const TUid& aUid ) + { + RArray array; + CleanupClosePushL( array ); + array.AppendL( aUid ); + SetAsDefaultViewL( array ); + CleanupStack::PopAndDestroy( &array ); + } + +// --------------------------------------------------------------------------- +// From MMPXViewUtility +// Activate view by resolving passed uids. +// --------------------------------------------------------------------------- +// +void CMPXViewUtilityImp::SetAsDefaultViewL( const RArray& aUids ) + { + TInt count = iCurrentHistoryPath.Count(); + if ( count > 0 ) + { + User::Leave( KErrAlreadyExists ); + } + else + { + TUid pluginType( KNullUid ); + TUid pluginImpUid( KNullUid ); + CMPXViewPlugin* plugin( + iPluginManager->ResolvePluginL( aUids, pluginType, pluginImpUid ) ); + + MPX_DEBUG4( "CMPXViewUtilityImp::SetAsDefaultViewL adding type: 0x%x, impUid: 0x%x, address: 0x%x to current view history", + pluginType.iUid, pluginImpUid.iUid, plugin ); + CMPXViewHistory* viewHistory = CMPXViewHistory::NewL( aUids, pluginType, pluginImpUid, plugin ); + iCurrentHistoryPath.Append( viewHistory ); // iCurrentHistoryPath takes ownership + delete iCurrentView; + iCurrentView = NULL; + iCurrentView = CMPXViewHistory::NewL( viewHistory ); + delete iDefaultView; + iDefaultView = NULL; + iDefaultView = CMPXViewHistory::NewL( viewHistory ); + + NotifyObservers( ActiveViewType(), PreviousViewType() ); + + MPX_DEBUG2( "CMPXViewUtilityImp::SetAsDefaultViewL activating 0x%x as default view", pluginType.iUid ); + TRAPD( err, plugin->SetAsDefaultViewL() ); + if ( err != KErrNone ) + { + MPX_DEBUG2( "CMPXViewUtilityImp::SetAsDefaultViewL error duing SetAsDefaultViewL, leaving with code %d", err ); + // error during activation, clean up view history + MarkViewAsClosedL( plugin ); + User::Leave( err ); + } + else if ( ActiveViewType() != pluginType ) + { + // notify observers again if the view type has changed + // possibily because ActivateViewL of the plugin is sync + // and the plugin exited already + MPX_DEBUG1( "CMPXViewUtilityImp::SetAsDefaultViewL notifying observers again" ); + NotifyObservers( ActiveViewType(), PreviousViewType() ); + } + else + { + // nothing to do + } + } + } + +// --------------------------------------------------------------------------- +// From MMPXViewUtility +// Activate previous view. +// --------------------------------------------------------------------------- +// +void CMPXViewUtilityImp::ActivatePreviousViewL() + { + // if can't find default history in cenrep, don't use default history + if ( iCurrentHistoryPath.Count() > 1 ) + { + TBool jump( EFalse ); + // previousViewType contains a list of view types that needs to be checked + TUid previousViewType = KNullUid; + if ( iDefaultHistoryPath.Count() > 0 ) + { + // default path exist, check that + TUid currentViewType( + iCurrentHistoryPath[ iCurrentHistoryPath.Count() - 1 ]->iPluginType ); + TInt count( iDefaultHistoryPath.Count() ); + + // loop starts at one, since there's no previous view in index 0 + for ( TInt i = 1; i < count && previousViewType == KNullUid; i++ ) + { + if ( iDefaultHistoryPath[ i ]->iPluginType == currentViewType ) + { + previousViewType = iDefaultHistoryPath[ i - 1 ]->iPluginType; + } + } + + if ( previousViewType != KNullUid ) + { + jump = ETrue; + // if previousViewType exist in iCurrentHistoryPath, it's not a jump + count = iCurrentHistoryPath.Count(); + for ( TInt i = 0; ( ( i < count ) && ( jump ) ); i++ ) + { + if ( iCurrentHistoryPath[ i ]->iPluginType == previousViewType ) + { + jump = EFalse; + } + } + MPX_DEBUG2( "CMPXViewUtilityImp::ActivatePreviousViewL activating jump = %d", jump ); + } +#ifdef _DEBUG + else + { + // current UID doesn't exist in default path, just follow the current path + MPX_DEBUG1( "CMPXViewUtilityImp::ActivatePreviousViewL activating current UID doesn't exist in default path" ); + } +#endif // _DEBUG + } +#ifdef _DEBUG + else + { + // default path doesn't exist, just use current history path + MPX_DEBUG1( "CMPXViewUtilityImp::ActivatePreviousViewL activating without default history" ); + } +#endif // _DEBUG + RArray array; + CleanupClosePushL( array ); + TInt lastIndex( iCurrentHistoryPath.Count() - 1 ); + TBool updatePreviousView( EFalse ); + TBool activatingPreviousView( EFalse ); + UpdatePreviousViewInfoL( lastIndex ); + if ( jump ) + { + if ( previousViewType != KNullUid ) + { + MPX_DEBUG2( "CMPXViewUtilityImp::ActivatePreviousViewL activating 0x%x jumped", previousViewType.iUid ); + updatePreviousView = ETrue; + array.AppendL( previousViewType ); + } + } + else + { + TInt count = iCurrentHistoryPath[ lastIndex - 1 ]->iUids.Count(); + MPX_DEBUG2( "CMPXViewUtilityImp::ActivatePreviousViewL activating not jumped iUid.Count %d", count ); + for ( TInt i = 0; i < count; i++ ) + { + TUid u = iCurrentHistoryPath[ lastIndex - 1 ]->iUids[ i ]; + MPX_DEBUG2( "CMPXViewUtilityImp::ActivatePreviousViewL activating not jumped, appending 0x%x", u.iUid ); + array.AppendL( u ); + } + activatingPreviousView = ETrue; + } + // last index is current view, previous view is at last index - 1 + delete iCurrentHistoryPath[ lastIndex ]; + iCurrentHistoryPath.Remove( lastIndex ); + iCurrentHistoryPath.Compress(); + ActivateViewL( array, activatingPreviousView, updatePreviousView ); + CleanupStack::PopAndDestroy( &array ); + } + else + { + // no history + User::Leave( KErrNotFound ); + } + } + +// --------------------------------------------------------------------------- +// From MMPXViewUtility +// Pre-load view plug-ins that have KMPXVpFeaturePreLoaded flag set. +// --------------------------------------------------------------------------- +// +void CMPXViewUtilityImp::PreLoadViewsL() + { + MPX_FUNC( "CMPXViewUtilityImp::PreLoadViewsL" ); + PreLoadViewsL( KNullUid ); + } + +// --------------------------------------------------------------------------- +// From MMPXViewUtility +// Pre-load view plug-ins that have KMPXVpFeaturePreLoaded flag set and also by resolving UID +// --------------------------------------------------------------------------- +// +void CMPXViewUtilityImp::PreLoadViewsL( const TUid& aUid ) + { + MPX_DEBUG2( "CMPXViewUtilityImp::PreLoadViewsL aUid: 0x%x", aUid ); + RArray array; + CleanupClosePushL( array ); + + // Get list of plug-ins that need to be pre-loaded + iPluginManager->GetPreLoadPluginsL( array, aUid ); + + for ( TInt i = array.Count(); --i >= 0; ) + { + MPX_DEBUG2( "CMPXViewUtilityImp::PreLoadViewsL loading UID: 0x%x", array[i] ); + CMPXViewPlugin* plugin = iPluginManager->PluginL( array[i] ); + plugin->CreateViewL(); + } + + CleanupStack::PopAndDestroy( &array ); + } + +// --------------------------------------------------------------------------- +// From MMPXViewUtility +// Pre-load view plug-in by resolving passed uid. +// --------------------------------------------------------------------------- +// +void CMPXViewUtilityImp::PreLoadViewL( const TUid& aUid ) + { + TUid pluginType( KNullUid ); + TUid pluginImpUid( KNullUid ); + CMPXViewPlugin* plugin( + iPluginManager->ResolvePluginL( aUid, pluginType, pluginImpUid ) ); + plugin->CreateViewL(); + } + +// --------------------------------------------------------------------------- +// From MMPXViewUtility +// Get a reference to view plugin manager. +// --------------------------------------------------------------------------- +// +MMPXViewPluginManager& CMPXViewUtilityImp::ViewPluginManager() + { + return *iPluginManager; + } + +// --------------------------------------------------------------------------- +// From MMPXViewUtility +// Constructs default view history +// --------------------------------------------------------------------------- +// +TUid CMPXViewUtilityImp::ConstructDefaultViewHistoryL() + { + iDefaultHistoryPath.ResetAndDestroy(); + delete iDefaultView; + iDefaultView = NULL; + + CRepository* cenRepository = CRepository::NewLC( KCRUidMPXSettings ); + TBool isEmbedded = CEikonEnv::Static()->StartedAsServerApp(); + MPX_DEBUG2( "CMPXViewUtilityImp::ConstructDefaultViewHistoryL isEmbedded: %d", isEmbedded ); + + // check if embeded mode, if embeded mode use host application uid + // CAiwGenericParamList + // if not embeded mode, use app uid + + // get default paths + TUid settingsUid( KNullUid ); + if ( isEmbedded ) + { + // TO-DO: get host UID + } + else + { + CEikAppUi* appUi = CEikonEnv::Static()->EikAppUi(); + if ( appUi ) + { + CEikApplication* app = appUi->Application(); + if ( app ) + { + settingsUid = app->AppDllUid(); + } + } + } + TInt ret ( KErrGeneral ); + HBufC* defaultPath = HBufC::NewLC( KMPXMaxHistoryLength ); + MPX_DEBUG2( "CMPXViewUtilityImp::ConstructDefaultViewHistoryL trying to read default history from uid 0x%x", settingsUid.iUid ); + TPtr dPathPtr = defaultPath->Des(); + ret = cenRepository->Get( settingsUid.iUid, dPathPtr ); + if ( ret == KErrNone ) + { + TPtrC defaultPathPtr( *defaultPath ); + TInt nextLoc = defaultPathPtr.Find( KMPXDelimiter ); + TBool defaultSet( EFalse ); + while ( nextLoc != KErrNotFound ) + { + TPtrC currentPath = defaultPathPtr.Left( nextLoc ); + AddToDefaultViewHistoryL( currentPath ); + if ( !defaultSet && iDefaultHistoryPath.Count() == 1 ) + { + // first entry is the default view + iDefaultView = CMPXViewHistory::NewL( iDefaultHistoryPath[0] ); + defaultSet = ETrue; + } + defaultPathPtr.Set( defaultPathPtr.Mid( nextLoc + 1 ) ); + nextLoc = defaultPathPtr.Find( KMPXDelimiter ); + } + if ( defaultPathPtr.Length() > 0 ) + { + AddToDefaultViewHistoryL( defaultPathPtr ); + } + } + else + { + // get default view + HBufC* defaultView = HBufC::NewLC( KMPXMaxHistoryLength ); + TPtr dViewPtr = defaultView->Des(); + ret = cenRepository->Get( KMPXVUCurrentDefaultView, dViewPtr ); + if ( ret == KErrNone ) + { + TPtrC defaultViewPtr( *defaultView ); + if ( defaultViewPtr.Length() > 0 ) + { + TInt nextPos( 0 ); + TInt err( + CMPXViewUtilityHelper::ExtractNum( defaultViewPtr, nextPos, ret ) ); + if ( err == KErrNone ) + { + iDefaultView = CMPXViewHistory::NewL(); + iDefaultView->iPluginType = TUid::Uid( ret ); + if ( iDefaultHistoryPath.Count() > 0 ) + { + TRAP( ret, AddToDefaultViewHistoryL( defaultViewPtr, 0 ) ); + } + } + + if ( iDefaultHistoryPath.Count() == 0 && err != KErrNone ) + { + ret = err; + } + } + } + CleanupStack::PopAndDestroy( defaultView ); + } + CleanupStack::PopAndDestroy( defaultPath ); + + // clean up duplicate entries + TInt count( iDefaultHistoryPath.Count() ); + TUid previousUid( KNullUid ); + for ( TInt i = count - 1; i >= 0; i-- ) + { + if ( iDefaultHistoryPath[ i ]->iPluginType == previousUid ) + { + MPX_DEBUG3( "CMPXViewUtilityImp::ConstructDefaultViewHistoryL removing duplicate entry 0x%x at %d", iDefaultHistoryPath[ i ]->iPluginType.iUid, i ); + // duplicate entry, remove + delete iDefaultHistoryPath[ i ]; + iDefaultHistoryPath.Remove( i ); + } + else + { + previousUid = iDefaultHistoryPath[ i ]->iPluginType; + } + } + iDefaultHistoryPath.Compress(); + MPX_DEBUG2( "CMPXViewUtilityImp::ConstructDefaultViewHistoryL after clean up, default path contains %d elements", iDefaultHistoryPath.Count() ); + + CleanupStack::PopAndDestroy( cenRepository ); + return DefaultViewUid(); + } + +// --------------------------------------------------------------------------- +// Push default history to view history +// --------------------------------------------------------------------------- +// +void CMPXViewUtilityImp::PushDefaultHistoryL() + { + MPX_FUNC( "CMPXViewUtilityImp::PushDefaultHistoryL" ); + TInt count( iDefaultHistoryPath.Count() ); + iCurrentHistoryPath.ResetAndDestroy(); + delete iPreviousView; + iPreviousView = NULL; + if ( count > 0 ) + { + for ( TInt i = 0; i < count; i++ ) + { + CMPXViewHistory* viewHistory = CMPXViewHistory::NewL(); + CleanupStack::PushL( viewHistory ); + TUid pluginType( iDefaultHistoryPath[ i ]->iPluginType ); + viewHistory->iPluginType = pluginType; + viewHistory->iUids.Append( pluginType ); + viewHistory->iPlugin = NULL; + iCurrentHistoryPath.Append( viewHistory ); + CleanupStack::Pop( viewHistory ); + } + } +#ifdef _DEBUG + else + { + MPX_DEBUG1( "CMPXViewUtilityImp::PushDefaultHistoryL default history is not defined, FAILED" ); + } +#endif + } + +// --------------------------------------------------------------------------- +// Gets default view's UID +// --------------------------------------------------------------------------- +// +TUid CMPXViewUtilityImp::DefaultViewUid() + { +#ifdef _DEBUG + if ( iDefaultView ) + { + MPX_DEBUG2( "CMPXViewUtilityImp::DefaultViewUid = 0x%x", iDefaultView->iPluginType.iUid ); + } +#endif // _DEBUG + return iDefaultView ? iDefaultView->iPluginType : KNullUid; + } + +// --------------------------------------------------------------------------- +// Returns the current history depth +// --------------------------------------------------------------------------- +// +TInt CMPXViewUtilityImp::ViewHistoryDepth() + { +#ifdef _DEBUG + TInt count( iCurrentHistoryPath.Count() ); + for ( TInt i = 0; i < count; i++ ) + { + TUid currentPluginType = iCurrentHistoryPath[ i ]->iPluginType; + CMPXViewPlugin* plugin = iCurrentHistoryPath[ i ]->iPlugin; + MPX_DEBUG4( "CMPXViewUtilityImp::ViewHistoryDepth (%d) type = 0x%x, address = 0x%x", i, currentPluginType.iUid, plugin ); + } +#endif + return iCurrentHistoryPath.Count(); + } + +// --------------------------------------------------------------------------- +// Returns the last activated view type +// --------------------------------------------------------------------------- +// +TUid CMPXViewUtilityImp::PreviousViewType() + { +#ifdef _DEBUG + if ( iPreviousView ) + { + MPX_DEBUG2( "CMPXViewUtilityImp::PreviousViewType = 0x%x", iPreviousView->iPluginType.iUid ); + } +#endif // _DEBUG + return iPreviousView ? iPreviousView->iPluginType : KNullUid; + } + +// --------------------------------------------------------------------------- +// Returns the current activated view type +// --------------------------------------------------------------------------- +// +TUid CMPXViewUtilityImp::ActiveViewType() + { +#ifdef _DEBUG + if ( iCurrentView ) + { + MPX_DEBUG2( "CMPXViewUtilityImp::ActiveViewType = 0x%x", iCurrentView->iPluginType.iUid ); + } +#endif // _DEBUG + return iCurrentView ? iCurrentView->iPluginType : KNullUid; + } + +// --------------------------------------------------------------------------- +// Returns the current activated view type +// --------------------------------------------------------------------------- +// +TUid CMPXViewUtilityImp::ActiveViewImplementationUid() + { +#ifdef _DEBUG + MPX_DEBUG1( "-->CMPXViewUtilityImp::ActiveViewImplementationUid" ); + if( iCurrentView && + ( iCurrentView->iPluginImplementationUid != KNullUid ) ) + { + MPX_DEBUG2( "CMPXViewUtilityImp::ActiveViewImplementationUid = 0x%x", + iCurrentView->iPluginImplementationUid.iUid ); + } + else + { + MPX_DEBUG1( "CMPXViewUtilityImp::ActiveViewImplementationUid - active view implementation uid not resolved yet" ); + } + MPX_DEBUG1( "<--CMPXViewUtilityImp::ActiveViewImplementationUid" ); +#endif // _DEBUG + return iCurrentView ? iCurrentView->iPluginImplementationUid : KNullUid; + } + +// --------------------------------------------------------------------------- +// Add observer. +// --------------------------------------------------------------------------- +// +void CMPXViewUtilityImp::AddObserverL( + MMPXViewActivationObserver* aObserver ) + { + if ( aObserver ) + { + iObservers.AppendL( aObserver ); + } + } + +// --------------------------------------------------------------------------- +// Remove observer. +// --------------------------------------------------------------------------- +// +void CMPXViewUtilityImp::RemoveObserver( + MMPXViewActivationObserver* aObserver ) + { + TInt index = iObservers.Find( aObserver ); + ASSERT( index >= 0 ); + if ( index >= 0 ) + { + iObservers.Remove( index ); + } + } + +// --------------------------------------------------------------------------- +// Handle custom commands. +// --------------------------------------------------------------------------- +// +void CMPXViewUtilityImp::HandleCustomCommand( + const TUid& aUid, + const TInt aCommand, + const TDesC8& aData ) + { + MPX_FUNC( "CMPXViewUtilityImp::HandleCustomCommand" ); + if ( aUid.iUid == KMPXViewUtilityCustomCommand ) + { + switch ( aCommand ) + { + case EMPXViewUtilCmdViewActivated: + { + // TO-DO + break; + } + case EMPXViewUtilCmdViewDeActivated: + { + MPX_DEBUG1( "CMPXViewUtilityImp::HandleCustomCommand EMPXViewUtilCmdViewDeActivated" ); + // aData contains the pointer to the view + if ( aData.Length() > 0 ) + { + TPckgBuf buf( KErrNotFound ); + buf.Copy( aData ); + TInt viewPtr = buf(); + MPX_DEBUG2( "CMPXViewUtilityImp::HandleCustomCommand EMPXViewUtilCmdViewDeActivated address = 0x%x", viewPtr ); + CMPXViewPlugin* piPtr = reinterpret_cast( viewPtr ); + TRAP_IGNORE( MarkViewAsClosedL( piPtr ) ); + } + break; + } + default: + { + break; + } + } + } + } + +// --------------------------------------------------------------------------- +// CMPXViewUtilityImp::HandlePluginHandlerEvent +// --------------------------------------------------------------------------- +// +void CMPXViewUtilityImp::HandlePluginHandlerEvent( + TPluginHandlerEvents aEvent, + const TUid& aPluginUid, + TInt aLoaded, + TInt aData) + { + MPX_FUNC("CMPXViewUtilityImp::HandlePluginHandlerEvent"); + + switch (aEvent) + { + case EPluginAdd: + { + NotifyViewUpdate(aPluginUid, MMPXViewActivationObserver::EViewPluginAdd, + aLoaded, aData); + break; + } + case EPluginUpdateStart: + { + NotifyViewUpdate(aPluginUid, MMPXViewActivationObserver::EViewPluginUpdate, + aLoaded, aData); + break; + } + case EPluginRemove: + { + NotifyViewUpdate(aPluginUid, MMPXViewActivationObserver::EViewPluginRemove, + aLoaded, aData); + break; + } + case EPluginUpdateEnd: + { + // do nothing + break; + } + } + } + +// --------------------------------------------------------------------------- +// Activate view by resolving passed uids. +// --------------------------------------------------------------------------- +// +void CMPXViewUtilityImp::ActivateViewL( + const RArray& aUids, + TBool aIsActivatingPreviousView, + TBool aUpdatedPreviousView, + const TDesC* aParam ) + { + TUid pluginType( KNullUid ); + TUid pluginImpUid( KNullUid ); + CMPXViewPlugin* plugin( + iPluginManager->ResolvePluginL( aUids, pluginType, pluginImpUid ) ); + CMPXViewPlugin* currentPlugin( NULL ); + + // if the resolved view is already activated + TInt count = iCurrentHistoryPath.Count(); + TUid currentPluginType( KNullUid ); + if ( count > 0 ) + { + currentPluginType = iCurrentHistoryPath[ count - 1 ]->iPluginType; + currentPlugin = iCurrentHistoryPath[ count - 1 ]->iPlugin; + } + + if ( ( currentPluginType != pluginType ) || ( currentPlugin != plugin ) || + ( aIsActivatingPreviousView ) ) + { + if ( ( pluginType != KNullUid ) && ( !aIsActivatingPreviousView ) ) + { + if ( !aUpdatedPreviousView ) + { + if ( count > 0 ) + { + UpdatePreviousViewInfoL( KErrNotFound ); + } + } + + // check if the view has been activated before + TInt index( FindCurrentHistoryEntryByTypeL( pluginType ) ); + if ( index != KErrNotFound ) + { + // cleanup, count down + for ( TInt i = count - 1; i > index; i-- ) + { + MPX_DEBUG2( "CMPXViewUtilityImp::ActivateViewL removing entry %d", i ); + delete iCurrentHistoryPath[ i ]; + iCurrentHistoryPath.Remove( i ); + } + iCurrentHistoryPath.Compress(); + + // update the uids used to activate this view + CMPXViewHistory* vh( iCurrentHistoryPath[ index ] ); + vh->iPlugin = plugin; + vh->iUids.Reset(); + TInt uidCount( aUids.Count() ); + for ( TInt i = 0; i < uidCount; i++ ) + { + TUid u = aUids[ i ]; + vh->iUids.Append( u ); + } + } + else + { + MPX_DEBUG3( "CMPXViewUtilityImp::ActivateViewL adding type: 0x%x, address: 0x%x to current view history", pluginType.iUid, plugin ); + CMPXViewHistory* viewHistory = CMPXViewHistory::NewL(); + CleanupStack::PushL( viewHistory ); + TInt uidCount( aUids.Count() ); + for ( TInt i = 0; i < uidCount; i++ ) + { + TUid u = aUids[ i ]; + viewHistory->iUids.Append( u ); + } + viewHistory->iPlugin = plugin; + viewHistory->iPluginType = pluginType; + viewHistory->iPluginImplementationUid = pluginImpUid; + iCurrentHistoryPath.Append( viewHistory ); + CleanupStack::Pop( viewHistory ); + } + } + MPX_DEBUG2( "CMPXViewUtilityImp::ActivateViewL activating 0x%x", pluginType.iUid ); + + if ( plugin != iCurrentView->iPlugin ) + { + delete iCurrentView; + iCurrentView = NULL; + iCurrentView = CMPXViewHistory::NewL( aUids, pluginType, pluginImpUid, plugin ); + // Notify observers for view activation, ActivateViewL maybe sync + // and won't return until the view is closed + NotifyObservers( ActiveViewType(), PreviousViewType() ); + TRAPD( err, plugin->ActivateViewL( aParam ) ); + if ( err != KErrNone ) + { + MPX_DEBUG2( "CMPXViewUtilityImp::ActivateViewL error duing ActivateViewL, leaving with code %d", err ); + // error during view activation, clean up view history + MarkViewAsClosedL( plugin ); + User::Leave( err ); + } + } + else + { + MPX_DEBUG2( "CMPXViewUtilityImp::ActivateViewL view 0x%x already activated, ignoring", pluginType.iUid ); + } + } + else + { + MPX_DEBUG2( "CMPXViewUtilityImp::ActivateViewL view 0x%x already activated, ignoring", pluginType.iUid ); + } + } + +// --------------------------------------------------------------------------- +// Marks the view closed. This does not actually close the view. +// --------------------------------------------------------------------------- +// +void CMPXViewUtilityImp::MarkViewAsClosedL( CMPXViewPlugin* aPlugin ) + { + MPX_DEBUG2( "CMPXViewUtilityImp::MarkViewAsClosedL called 0x%x", aPlugin ); + TInt count = iCurrentHistoryPath.Count(); + TBool removed( EFalse ); + // Count down, counting up and removing items is bad + for ( TInt i = count - 1; i >= 0 && !removed ; i-- ) + { + if ( iCurrentHistoryPath[ i ]->iPlugin == aPlugin ) + { + MPX_DEBUG2( "CMPXViewUtilityImp::MarkViewAsClosedL removing location %d", i ); + UpdatePreviousViewInfoL( i ); + + delete iCurrentView; + iCurrentView = NULL; + if ( i > 0 ) + { + iCurrentView = CMPXViewHistory::NewL( + iCurrentHistoryPath[ ( i != count - 1 ) ? count - 1 : i - 1 ] ); + } + + // match found, remove it from history + delete iCurrentHistoryPath[ i ]; + iCurrentHistoryPath.Remove( i ); + removed = ETrue; + + // Notify observers for view activation, ActivateViewL maybe sync + // and won't return until the view is closed + NotifyObservers( ActiveViewType(), PreviousViewType() ); + } + } + if ( removed ) + { + iCurrentHistoryPath.Compress(); + } +#ifdef _DEBUG + else + { + MPX_DEBUG1( "CMPXViewUtilityImp::MarkViewAsClosedL Nothing removed" ); + } +#endif + } + +// ----------------------------------------------------------------------------- +// Notify observers for view activation +// ----------------------------------------------------------------------------- +// +void CMPXViewUtilityImp::NotifyObservers( + const TUid& aCurrentViewType, + const TUid& aPreviousViewType ) + { + MPX_FUNC( "CMPXViewUtilityImp::NotifyObservers" ); + MPX_DEBUG3( "CMPXViewUtilityImp::NotifyObservers current: 0x%x, previous: 0x%x", aCurrentViewType.iUid, aPreviousViewType.iUid ); + TInt count( iObservers.Count() ); + for ( TInt i = 0; i < count; i++ ) + { + iObservers[i]->HandleViewActivation( + aCurrentViewType, + aPreviousViewType ); + } + } + +// ----------------------------------------------------------------------------- +// Notify observers of a view update event +// ----------------------------------------------------------------------------- +// +void CMPXViewUtilityImp::NotifyViewUpdate( + const TUid& aViewUid, + MMPXViewActivationObserver::TViewUpdateEvent aUpdateEvent, + TBool aLoaded, + TInt aVersion /* = 0 */) + { + MPX_FUNC( "CMPXViewUtilityImp::NotifyViewUpdate" ); + + TInt count(iObservers.Count()); + for (TInt i = 0; i < count; ++i) + { + iObservers[i]->HandleViewUpdate(aViewUid, aUpdateEvent, aLoaded, aVersion); + } + } + +// --------------------------------------------------------------------------- +// Insert/Append to default view history array +// --------------------------------------------------------------------------- +// +TInt CMPXViewUtilityImp::AddToDefaultViewHistoryL( + const TDesC& aData, TInt aLoc ) + { + TInt result( KErrGeneral ); + TInt nextPos( 0 ); + User::LeaveIfError( CMPXViewUtilityHelper::ExtractNum( aData, nextPos, result ) ); + CMPXViewHistory* viewHistory = CMPXViewHistory::NewL(); + CleanupStack::PushL( viewHistory ); + viewHistory->iPluginType.iUid = result; + if ( aLoc == -1 ) + { + MPX_DEBUG2( "CMPXViewUtilityImp::AddToDefaultViewHistoryL Appending 0x%x to default view history", result ); + User::LeaveIfError( iDefaultHistoryPath.Append( viewHistory ) ); + } + else + { + MPX_DEBUG3( "CMPXViewUtilityImp::AddToDefaultViewHistoryL Inserting 0x%x to default view history at %d", result, aLoc ); + User::LeaveIfError( iDefaultHistoryPath.Insert( viewHistory, aLoc ) ); + } + CleanupStack::Pop( viewHistory ); + return result; + } + +// --------------------------------------------------------------------------- +// Updates previous view info +// --------------------------------------------------------------------------- +// +void CMPXViewUtilityImp::UpdatePreviousViewInfoL( TInt aIndex ) + { + MPX_FUNC( "CMPXViewUtilityImp::UpdatePreviousViewInfoL" ); + delete iPreviousView; + iPreviousView = NULL; + if ( aIndex != KErrNotFound ) + { + TInt currentHistoryCount = iCurrentHistoryPath.Count(); + if ( ( currentHistoryCount > aIndex ) && ( aIndex >= 0 ) ) + { + iPreviousView = CMPXViewHistory::NewL( iCurrentHistoryPath[ aIndex ] ); + iPreviousView->iPlugin = NULL; + MPX_DEBUG2( "CMPXViewUtilityImp::UpdatePreviousViewInfoL previous view type 0x%x", iPreviousView->iPluginType.iUid ); + } + } + else + { + delete iPreviousView; + iPreviousView = NULL; + iPreviousView = CMPXViewHistory::NewL( iCurrentView ); + } + } + +// --------------------------------------------------------------------------- +// Find if the view exist in current history +// --------------------------------------------------------------------------- +// +TInt CMPXViewUtilityImp::FindCurrentHistoryEntryByTypeL( const TUid aType ) + { + TInt count = iCurrentHistoryPath.Count(); + TInt index = KErrNotFound; + for ( TInt i = 0; i < count && index == KErrNotFound; i++ ) + { + if ( iCurrentHistoryPath[ i ]->iPluginType == aType ) + { + index = i; + } + } + return index; + } + +// End of File diff -r 000000000000 -r a2952bb97e68 package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_definition.xml Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r a2952bb97e68 sysdef_1_4_0.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sysdef_1_4_0.dtd Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r a2952bb97e68 tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tsrc/group/bld.inf Thu Dec 17 08:55:47 2009 +0200 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2006 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 specification for mmappfw projects. +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTEXPORTS + +PRJ_EXPORTS + +PRJ_TESTMMPFILES +#include "../../mmappfw_plat/asx_parser_api/tsrc/group/bld.inf" +#include "../../mmappfw_plat/collection_helper_api/tsrc/group/bld.inf" +#include "../../mmappfw_plat/harvester_utility_api/tsrc/group/bld.inf" +#include "../../mmappfw_plat/media_player_settings_engine_api/tsrc/group/bld.inf" +#include "../../mmappfw_plat/mpx_base_view_plugins_api/tsrc/group/bld.inf" +#include "../../mmappfw_plat/mpx_collection_utility_api/tsrc/group/bld.inf" +#include "../../mmappfw_plat/mpx_common_api/tsrc/group/bld.inf" +#include "../../mmappfw_plat/mpx_playback_utility_api/tsrc/group/bld.inf" +#include "../../mmappfw_plat/mpx_view_utility_api/tsrc/group/bld.inf" +#include "../../mmappfw_plat/playlist_engine_api/tsrc/group/bld.inf" +#include "../../mmappfw_plat/harvester_metadata_extractor_api/tsrc/group/bld.inf" +#include "../../mmappfw_plat/harvester_collection_mediator_api/tsrc/group/bld.inf" +#include "../../mmappfw_plat/mpx_albumart_utility_api/tsrc/group/bld.inf" +#include "../../mmappfw_plat/playback_helper_api/tsrc/group/bld.inf" +#include "../../mmappfw_plat/videoplaylist_utility_api/tsrc/group/bld.inf" + +PRJ_MMPFILES + +// End of File