--- a/backupandrestore/backupengine/group/sbeclient.mmp Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backupengine/group/sbeclient.mmp Tue Jul 06 15:13:34 2010 +0300
@@ -25,9 +25,7 @@
MW_LAYER_SYSTEMINCLUDE_SYMBIAN
-USERINCLUDE ../../../../../os/ossrv/genericservices/activebackupclient/inc
-SOURCEPATH ../../../../../os/ossrv/genericservices/activebackupclient/src
-SOURCE panic.cpp
+
USERINCLUDE . ../inc
@@ -35,7 +33,8 @@
SOURCE sbheapwrapper.cpp
SOURCE sbeclient.cpp
SOURCE sbeclientsession.cpp
-SOURCE sbtypes.cpp
+SOURCE sbtypes.cpp
+SOURCE sbepanic.cpp
LIBRARY euser.lib estor.lib apgrfx.lib apmime.lib
--- a/backupandrestore/backupengine/group/sbencrypt.mmp Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backupengine/group/sbencrypt.mmp Tue Jul 06 15:13:34 2010 +0300
@@ -25,15 +25,14 @@
USERINCLUDE .
MW_LAYER_SYSTEMINCLUDE_SYMBIAN
-USERINCLUDE ../../../../../os/ossrv/genericservices/activebackupclient/inc
-SOURCEPATH ../../../../../os/ossrv/genericservices/activebackupclient/src
-SOURCE panic.cpp
+
USERINCLUDE . ../inc
SOURCEPATH ../src
SOURCE sbencrypt.cpp
-SOURCE sbencryptimpl.cpp
+SOURCE sbencryptimpl.cpp
+SOURCE sbepanic.cpp
LIBRARY euser.lib
--- a/backupandrestore/backupengine/group/sbengine.mmp Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backupengine/group/sbengine.mmp Tue Jul 06 15:13:34 2010 +0300
@@ -29,9 +29,8 @@
UID 0 0x10202D56 // Assigned UID
VENDORID 0x70000001
-USERINCLUDE ../../../../../os/ossrv/genericservices/activebackupclient/inc
-SOURCEPATH ../../../../../os/ossrv/genericservices/activebackupclient/src
-SOURCE panic.cpp
+
+
SOURCEPATH ../src
SOURCE sbtypes.cpp
@@ -51,6 +50,7 @@
SOURCE sbecompressionandencryption.cpp
SOURCE sbeconfig.cpp
SOURCE sbeparserproxy.cpp
+SOURCE sbepanic.cpp
USERINCLUDE . ../inc
@@ -66,12 +66,12 @@
#ifdef __SBE_DISABLE_RELEASE_LOGGING
// Flogger will not be linked do this binary in UREL builds
- DEBUGLIBRARY flogger.lib
+DEBUGLIBRARY flogger.lib
#else
// Flogger always statically linked to this binary.
- LIBRARY flogger.lib
+LIBRARY flogger.lib
#endif
--- a/backupandrestore/backupengine/group/sbenginenojava.mmp Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backupengine/group/sbenginenojava.mmp Tue Jul 06 15:13:34 2010 +0300
@@ -30,9 +30,8 @@
MACRO SBENGINE_EXCLUDE_JAVA
-USERINCLUDE ../../../../../os/ossrv/genericservices/activebackupclient/inc
-SOURCEPATH ../../../../../os/ossrv/genericservices/activebackupclient/src
-SOURCE panic.cpp
+
+
SOURCEPATH ../src
SOURCE sbtypes.cpp
@@ -52,6 +51,7 @@
SOURCE sbecompressionandencryption.cpp
SOURCE sbeconfig.cpp
SOURCE sbeparserproxy.cpp
+SOURCE sbepanic.cpp
USERINCLUDE . ../inc
--- a/backupandrestore/backupengine/inc/sbedataowner.h Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backupengine/inc/sbedataowner.h Tue Jul 06 15:13:34 2010 +0300
@@ -50,6 +50,8 @@
_LIT(KCentRepProcessName, "centralrepositorysrv.exe");
_LIT8(KYes, "yes");
+ const TTimeIntervalMicroSeconds32 KABCallbackDefaultTimeout(200000000);
+
// Forwards
class CABServer;
class CDataOwnerManager;
@@ -196,7 +198,7 @@
*/
TActiveInformation() :
iSupported(EFalse), iRequiresDelayToPrepareData(EFalse),
- iSupportsSelective(EFalse), iSupportsIncremental(ETrue), iActiveDataOwner(EFalse), iActiveType(EActiveOnly)
+ iSupportsSelective(EFalse), iSupportsIncremental(ETrue), iActiveDataOwner(EFalse), iActiveType(EActiveOnly), iCallbackDelayTime(KABCallbackDefaultTimeout)
{
}
public:
@@ -207,6 +209,7 @@
TUint8 iSupportsIncremental; /*<! Supports Incremental */
TUint8 iActiveDataOwner; /*<! Although we say we're active, we're not really */
TActiveType iActiveType; /*<! Type of the Active DO */
+ TTimeIntervalMicroSeconds32 iCallbackDelayTime; /*<! Callback Delay Time */
};
/** Data Owner support classes and enums */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backupengine/inc/sbepanic.h Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,39 @@
+/**
+* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* Declaration of Panic(). Customises a panic raised in SBE
+*
+*
+*/
+
+
+
+/**
+ @file
+*/
+
+#ifndef __SBPANIC_H__
+#define __SBPANIC_H__
+
+namespace conn
+ {
+
+ /** @{ */
+
+ void Panic(TInt aPanicCode);
+
+ /** @} */
+ }
+
+#endif //__SBPANIC_H__
--- a/backupandrestore/backupengine/inc/sbeparserdefs.h Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backupengine/inc/sbeparserdefs.h Tue Jul 06 15:13:34 2010 +0300
@@ -67,6 +67,8 @@
_LIT8(KRequiresReboot, "requires_reboot");
_LIT8(KDeleteBeforeRestore, "delete_before_restore");
_LIT8(KBaseBackupOnly, "base_backup_only");
+
+ _LIT8(KCallbackDelayTime, "callback_delay_time");
}
#endif // __SBEPARSERDEFS_H__
--- a/backupandrestore/backupengine/src/abserver.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backupengine/src/abserver.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -26,7 +26,7 @@
#include "absession.h"
#include "absessionmap.h"
#include "sbedataownermanager.h"
-#include <connect/panic.h>
+#include "sbepanic.h"
#include "sblog.h"
namespace conn
--- a/backupandrestore/backupengine/src/absession.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backupengine/src/absession.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -26,7 +26,7 @@
#include "sbedataownermanager.h"
#include "sbedataowner.h"
#include <connect/sbtypes.h>
-#include <connect/panic.h>
+#include "sbepanic.h"
#include "sblog.h"
namespace conn
@@ -425,9 +425,10 @@
iCallbackWatchdog = NULL;
iCallbackWatchdog = CPeriodic::NewL(EPriorityHigh);
TTimeIntervalMicroSeconds32 KWatchdogIntervalNone = 0;
- iCallbackWatchdog->Start(KABCallbackWatchdogTimeout, KWatchdogIntervalNone, iWatchdogHandler);
+ iCallbackWatchdog->Start(DataOwnerL().ActiveInformation().iCallbackDelayTime, KWatchdogIntervalNone, iWatchdogHandler);
#endif
-
+
+
// Send the message back to the callback handler
iMessage.Complete(KErrNone);
--- a/backupandrestore/backupengine/src/absessionmap.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backupengine/src/absessionmap.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -22,7 +22,7 @@
#include "absession.h"
#include "absessionmap.h"
#include "sbedataowner.h"
-#include <connect/panic.h>
+#include "sbepanic.h"
namespace conn
{
--- a/backupandrestore/backupengine/src/sbebufferhandler.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backupengine/src/sbebufferhandler.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -22,7 +22,7 @@
#include "sbebufferhandler.h"
#include "sblog.h"
-#include <connect/panic.h>
+#include "sbepanic.h"
namespace conn
{
@@ -508,11 +508,29 @@
__LOG1("CBufferFileReader::WriteToFile() - making directory resulted in fatal error: %d", err);
User::Leave(err);
} // if
-
-
+
+ TEntry entry;
+ TBool isReadOnly = EFalse;
+ err = iFs.Entry(iFileName, entry);
+ if(KErrNone == err)
+ {
+ if(entry.iAtt & KEntryAttReadOnly)
+ {
+ isReadOnly = ETrue;
+ entry.iAtt &= ~KEntryAttReadOnly;
+ iFs.SetAtt(iFileName, entry.iAtt, ~entry.iAtt);
+ }
+ }
+
err = iFileHandle.Replace(iFs, iFileName, EFileWrite);
__LOG1("CBufferFileReader::WriteToFile() - replacing file returned err: %d", err);
User::LeaveIfError( err );
+
+ if(isReadOnly)
+ {
+ entry.iAtt |= KEntryAttReadOnly;
+ iFs.SetAtt(iFileName, entry.iAtt, ~entry.iAtt);
+ }
iFileOpen = ETrue;
__LOG("CBufferFileReader::RecreateFileL() - END");
--- a/backupandrestore/backupengine/src/sbeclient.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backupengine/src/sbeclient.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -22,7 +22,7 @@
#include "sbeclient.h"
#include "sbeclientsession.h"
-#include <connect/panic.h>
+#include "sbepanic.h"
namespace conn
{
--- a/backupandrestore/backupengine/src/sbeclientsession.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backupengine/src/sbeclientsession.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -22,7 +22,7 @@
#include "sbeclientsession.h"
#include "sbeclientserver.h"
#include <connect/sbtypes.h>
-#include <connect/panic.h>
+#include "sbepanic.h"
namespace conn
{
--- a/backupandrestore/backupengine/src/sbeconfig.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backupengine/src/sbeconfig.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -19,7 +19,7 @@
@file
*/
#include <e32std.h>
-#include <connect/panic.h>
+#include "sbepanic.h"
#include "sbeconfig.h"
#include "sblog.h"
#include <xml/parser.h>
--- a/backupandrestore/backupengine/src/sbedataowner.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backupengine/src/sbedataowner.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -25,7 +25,7 @@
#include "sbtypes.h"
#include "sblog.h"
#include "sbeparserdefs.h"
-#include <connect/panic.h>
+#include "sbepanic.h"
namespace conn
{
@@ -3553,6 +3553,17 @@
iActiveInformation.iActiveType = EProxyImpOnly;
}
}
+ else if(!localName.CompareF(KCallbackDelayTime))
+ {
+ const TDesC8& value = aAttributes[x].Value().DesC();
+ TInt timeValue = 0;
+ TLex8 lex(value);
+ TInt err = lex.Val(timeValue);
+ if( err == KErrNone && timeValue > 0)
+ iActiveInformation.iCallbackDelayTime = TTimeIntervalMicroSeconds32(timeValue);
+ else
+ iActiveInformation.iCallbackDelayTime = KABCallbackDefaultTimeout;
+ }
} // for x
return KErrNone;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backupengine/src/sbepanic.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,40 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Server Panic methods
+//
+//
+
+/**
+ @file
+*/
+
+#include <e32std.h>
+#include "sbepanic.h"
+
+namespace conn
+ {
+ void Panic(TInt aPanicCode)
+ /**
+ @internalComponent
+
+ Calls User::Panic with reason "SB: <panic code>"
+
+ @param aPanicCode The panic code as defined in panic.h
+ @panic aPanicCode The panic code passed in
+ */
+ {
+ _LIT(KPanicString,"SBE:");
+ User::Panic(KPanicString,aPanicCode);
+ }
+ }
--- a/backupandrestore/backupengine/src/sbeserver.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backupengine/src/sbeserver.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -24,7 +24,7 @@
#include "sbeclientserver.h"
#include "sbeserver.h"
#include "sbesession.h"
-#include <connect/panic.h>
+#include "sbepanic.h"
#include "sbedataownermanager.h"
#include "sblog.h"
//#include <stdlib.h>
--- a/backupandrestore/backupengine/src/sbesession.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backupengine/src/sbesession.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -24,7 +24,7 @@
#include "sbeserver.h"
#include "sbesession.h"
#include "sbeclientserver.h"
-#include <connect/panic.h>
+#include "sbepanic.h"
#include "sbedataownermanager.h"
#include <connect/sbtypes.h>
#include "sblog.h"
--- a/backupandrestore/backupengine/src/sbheapwrapper.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backupengine/src/sbheapwrapper.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -21,7 +21,7 @@
*/
#include "sbheapwrapper.h"
-#include <connect/panic.h>
+#include "sbepanic.h"
namespace conn
{
--- a/backupandrestore/backupengine/src/sbtypes.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backupengine/src/sbtypes.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -19,7 +19,7 @@
@file
*/
#include <e32std.h>
-#include <connect/panic.h>
+#include "sbepanic.h"
#include "sbtypes.h"
#include <s32mem.h>
#include <apgcli.h>
--- a/backupandrestore/backuptest/burtestserver/Group/bld.inf Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backuptest/burtestserver/Group/bld.inf Tue Jul 06 15:13:34 2010 +0300
@@ -40,6 +40,8 @@
../testscripts/test_restorepackage.script z:/testdata/scripts/sbetestdata/test_restorepackage.script
../testscripts/test_increament.script z:/testdata/scripts/sbetestdata/test_increament.script
+../../testdata/armv5/bigexeforbackup.sis /epoc32/data/z/testdata/scripts/sbetestdata/bigexeforbackup.sis
+../../testdata/armv5/test_dll_nopublic.sis /epoc32/data/z/testdata/scripts/sbetestdata/test_dll_nopublic.sis
PRJ_TESTMMPFILES
burtestserver.mmp
--- a/backupandrestore/backuptest/burtestserver/Group/burtestserver.iby Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backuptest/burtestserver/Group/burtestserver.iby Tue Jul 06 15:13:34 2010 +0300
@@ -35,6 +35,10 @@
data=EPOCROOT##Epoc32\data\z\testdata\scripts\sbetestdata\test_activebackuprestore.script testdata\scripts\sbetestdata\test_activebackuprestore.script
data=EPOCROOT##Epoc32\data\z\testdata\scripts\sbetestdata\test_increament.script testdata\scripts\sbetestdata\test_increament.script
+data=EPOCROOT##Epoc32\data\z\testdata\scripts\sbetestdata\bigexeforbackup.sis testdata\scripts\sbetestdata\bigexeforbackup.sis
+data=EPOCROOT##Epoc32\data\z\testdata\scripts\sbetestdata\test_dll_nopublic.sis testdata\scripts\sbetestdata\test_dll_nopublic.sis
+
+
#ifndef __SERIES60_
data=EPOCROOT##Epoc32\data\z\testdata\scripts\sbetestdata\sbeconfig.xml private\10202d56\sbeconfig.xml
#endif
--- a/backupandrestore/backuptest/burtestserver/TestSteps/inc/t_burteststepbase.h Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backuptest/burtestserver/TestSteps/inc/t_burteststepbase.h Tue Jul 06 15:13:34 2010 +0300
@@ -90,6 +90,9 @@
public:
RSIDArray iSidArray;
+ // add support for exclude sid list
+ RSIDArray iExcludeSidArray;
+
private:
HBufC* GetIndentation(TInt aLevel);
--- a/backupandrestore/backuptest/burtestserver/TestSteps/src/t_burteststepbase.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backuptest/burtestserver/TestSteps/src/t_burteststepbase.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -63,6 +63,9 @@
iDataOwners.Close();
iSidArray.Close();
+
+ iExcludeSidArray.Close();
+
iJidArray.Close();
iPublicFileNames.Close();
iPrivateFileNames.Close();
@@ -387,6 +390,48 @@
/** Read private file sizes into array */
_LIT(KExpectPrivateFileSizes, "ExpectPrivateFileSizes");
ReadListIntoIntArray(KExpectPrivateFileSizes, delimiter, iPrivateFileSizes);
+
+ // Read Exclude IDs LIST //
+ TSecureId sid;
+ TChar ch;
+ TPtrC list;
+
+ // clear the array
+ iExcludeSidArray.Reset();
+ // read the string
+ _LIT(KExcludeSIDList, "ExcludeIDs");
+ GetStringFromConfig(ConfigSection(), KExcludeSIDList, list);
+ TLex sidLex(list);
+ // parse the string
+ while (!sidLex.Eos())
+ {
+ sidLex.Mark();
+ ch=sidLex.Peek();
+
+ while(!sidLex.Eos() && ( ch=sidLex.Peek() ) != TChar(','))
+ sidLex.Inc();
+
+ if(!sidLex.TokenLength())
+ continue;
+
+ TPtrC pToken = sidLex.MarkedToken();
+ TLex token(pToken);
+
+ if (pToken.Length() <= KMaxHexLength && token.Val(sid.iId, EHex) == KErrNone)
+ {
+ iExcludeSidArray.Append(sid);
+ _LIT(KFound, "Exclude ID Found in ini file: ");
+ LogWithSID(LOG_LEVEL4, KFound, sid);
+ } //if
+
+ if(ch==TChar(','))
+ sidLex.Inc();
+
+ sidLex.SkipSpace();
+
+ } //while
+
+
}
void CBURTestStepBase::ReadListIntoStringArray(const TDesC& aSectionName, const TChar& aDelimiter, RArray<TPtrC>& aResultList)
@@ -458,7 +503,6 @@
LogWithNum(LOG_LEVEL2,KTempText1, err);
iFailures++;
}
-
// Log
if (iDataOwners.Count() == 0)
{
@@ -470,6 +514,30 @@
_LIT(KTempText4, "Number of data owners found on device: ");
LogWithNum(LOG_LEVEL3, KTempText4, iDataOwners.Count());
}
+
+ //filter the dataowners per the exclude SID list
+ for (TInt index = 0; index < iDataOwners.Count(); index++)
+ {
+ TSecureId sid = NULL;
+ sid = ExtractIDL(*iDataOwners[index]);
+
+ if (sid != NULL)
+ {
+ TInt position = iExcludeSidArray.Find(sid);
+ if (position != KErrNotFound)
+ {
+ _LIT(KTempText2, "ExcludeID found in list of data owners: ");
+ LogWithSID(LOG_LEVEL3, KTempText2, sid);
+
+ delete iDataOwners[index];
+ iDataOwners[index] = NULL;
+ iDataOwners.Remove(index);
+ index--;
+ }
+ }
+ }
+
+
}
void CBURTestStepBase::PopulateListOfDataOwnersAsyncL()
@@ -510,6 +578,28 @@
_LIT(KTempText4, "Number of data owners found on device: ");
LogWithNum(LOG_LEVEL3, KTempText4, iDataOwners.Count());
}
+
+ //filter the dataowners per the exclude SID list
+ for (TInt index = 0; index < iDataOwners.Count(); index++)
+ {
+ TSecureId sid = NULL;
+ sid = ExtractIDL(*iDataOwners[index]);
+
+ if (sid != NULL)
+ {
+ TInt position = iExcludeSidArray.Find(sid);
+ if (position != KErrNotFound)
+ {
+ _LIT(KTempText2, "ExcludeID found in list of data owners: ");
+ LogWithSID(LOG_LEVEL3, KTempText2, sid);
+
+ delete iDataOwners[index];
+ iDataOwners[index] = NULL;
+ iDataOwners.Remove(index);
+ index--;
+ }
+ }
+ }
}
void CBURTestStepBase::SetBURModeL(TBURPartType aBURPartType, TBackupIncType aBackupIncType)
@@ -557,8 +647,8 @@
for (TInt index = 0; index < iDataOwners.Count(); index++)
{
TBool notFound = ETrue;
- sid = ExtractIDL(*iDataOwners[index]);
-
+ sid = ExtractIDL(*iDataOwners[index]);
+
if (sid != NULL)
{
TInt position = iSidArray.Find(sid);
@@ -576,19 +666,22 @@
else // possibly jid
{
HBufC* pSuiteHash = ExtractJavaIDL(*iDataOwners[index]);
- TPtrC suiteHash = pSuiteHash->Des();
- if (iJidArray.Find(suiteHash) != KErrNotFound)
- {
- _LIT(KTempText3, "Java ID found in list of data owners: ");
- LogWithText(LOG_LEVEL3, KTempText3, suiteHash);
- notFound = EFalse;
- }
- else // not found
- {
- notFound = ETrue;
- }
- delete pSuiteHash;
- pSuiteHash = NULL;
+ if (pSuiteHash != NULL)
+ {
+ TPtrC suiteHash = pSuiteHash->Des();
+ if (iJidArray.Find(suiteHash) != KErrNotFound)
+ {
+ _LIT(KTempText3, "Java ID found in list of data owners: ");
+ LogWithText(LOG_LEVEL3, KTempText3, suiteHash);
+ notFound = EFalse;
+ }
+ else // not found
+ {
+ notFound = ETrue;
+ }
+ delete pSuiteHash;
+ pSuiteHash = NULL;
+ }
}
if (notFound)
{
@@ -1223,6 +1316,12 @@
j--;
total--;
}
+ else
+ {
+ // print the status
+ LogWithSID(LOG_LEVEL3, _L("---The unexpected dataowner status-SID: "),statusArray[j].iSID.iId);
+ LogWithNum(LOG_LEVEL3,_L("---The unexpected dataowner status-status: "),statusArray[j].iStatus) ;
+ }
} //for
statusArray.Reset();
CleanupStack::PopAndDestroy(&statusArray);
@@ -1367,8 +1466,25 @@
for (TInt i=0; i < KRetries;)
{
+
+
+ LogWithNum(LOG_LEVEL3,_L("retryies :"), i);
+
CheckSIDStatusL(iTransferTypes, readyArray);
-
+
+
+ LogWithNum(LOG_LEVEL3,_L("readyArray count :"), readyArray.Count());
+
+ // print all the ready array
+ for(TInt jj = 0 ; jj < readyArray.Count(); jj++)
+ {
+ CSBSIDTransferType* type = CSBSIDTransferType::NewL(readyArray[jj]);
+ CleanupStack::PushL(type);
+
+ LogWithSID(LOG_LEVEL3, _L("readyArray SIDs : ") , type->SecureIdL());
+ CleanupStack::PopAndDestroy(type);
+ }
+
if (readyArray.Count()) // dataowners ready
{
// ========= Supply Data ================
@@ -1389,6 +1505,19 @@
iFailures++;
_LIT(KLogNoTrans, "***Error: Some Data Owners were Not Ready or Failed to Connect");
Log(LOG_LEVEL3, KLogNoTrans);
+
+ // print the remenan sids
+ for( TInt kk = 0 ; kk <iTransferTypes.Count() ; kk++)
+ {
+
+ CSBSIDTransferType* sidType = CSBSIDTransferType::NewL(iTransferTypes[kk]);
+ CleanupStack::PushL(sidType);
+ TSecureId id = NULL;
+ id = sidType->SecureIdL();
+ CleanupStack::PopAndDestroy(sidType);
+ LogWithSID(LOG_LEVEL3, _L("--iTransferTypes, remanent SIDs : "),id.iId);
+ }
+ //
}
readyArray.ResetAndDestroy();
CleanupStack::PopAndDestroy(&readyArray);
@@ -1482,7 +1611,6 @@
{
User::Leave(KErrInUse);
}
- iStatus = KRequestPending;
SetActive();
iActiveScheduler->Start();
}
--- a/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststepbackup.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststepbackup.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -17,7 +17,7 @@
@file
@released
*/
-
+#include "W32STD.H"
#include "t_teststepbackup.h"
namespace bur_ts
@@ -145,6 +145,8 @@
Log(LOG_LEVEL2, KLog3);
}
+ _LIT(KLog31, "Checking valid registration...");
+ Log(LOG_LEVEL2, KLog31);
CheckValidRegistrationL();
_LIT(KLog4, "Saving Data Owners...");
@@ -201,9 +203,13 @@
BackupSystemBaseDataL();
BackupSystemSnapshotDataL();
- //active
- BackupActiveBaseDataL();
- BackupActiveSnapshotDataL();
+ // do active backup when in partial backup mode
+ if (iIsPartial)
+ {
+ //active
+ BackupActiveBaseDataL();
+ BackupActiveSnapshotDataL();
+ }
//passive
BackupPassiveBaseDataL();
@@ -238,9 +244,13 @@
BackupSystemBaseDataL();
BackupSystemSnapshotDataL();
- // active
- BackupActiveIncDataL();
- BackupActiveSnapshotDataL();
+ // do active backup when in partial backup mode
+ if (iIsPartial)
+ {
+ //active
+ BackupActiveIncDataL();
+ BackupActiveSnapshotDataL();
+ }
//passive
BackupPassiveIncDataL();
@@ -530,6 +540,10 @@
TRAPD(error,
for (TInt i=0; i < KRetries;)
{
+ //
+ LogWithNum(LOG_LEVEL3,_L("doActiveBackup-retryies :"), i);
+
+
CheckSIDStatusL(transferTypes, iTransferTypes);
if (iTransferTypes.Count()) // dataowners ready
{
@@ -551,7 +565,20 @@
iFailures++;
_LIT(KLogNoTrans, "***Error: Some Data Owners were Not Ready or Failed to Connect");
Log(LOG_LEVEL3, KLogNoTrans);
- } //if
+
+
+ //print the remenant sids
+ for( TInt kk = 0 ; kk <transferTypes.Count() ; kk++)
+ {
+
+ CSBSIDTransferType* sidType = CSBSIDTransferType::NewL(transferTypes[kk]);
+ CleanupStack::PushL(sidType);
+ TSecureId id = NULL;
+ id = sidType->SecureIdL();
+ CleanupStack::PopAndDestroy(sidType);
+ LogWithSID(LOG_LEVEL3, _L("doActiveBackup-transferTypes, remanent SIDs : "),id.iId);
+ }
+ } //if
transferTypes.ResetAndDestroy();
User::LeaveIfError(error);
--- a/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststepbackup2.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststepbackup2.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -204,9 +204,13 @@
BackupSystemBaseDataL();
BackupSystemSnapshotDataL();
- //active
- BackupActiveBaseDataL();
- BackupActiveSnapshotDataL();
+ // do active backup when in partial backup mode
+ if (iIsPartial)
+ {
+ //active
+ BackupActiveBaseDataL();
+ BackupActiveSnapshotDataL();
+ }
//passive
BackupPassiveBaseDataL();
@@ -241,9 +245,13 @@
BackupSystemBaseDataL();
BackupSystemSnapshotDataL();
- // active
- BackupActiveIncDataL();
- BackupActiveSnapshotDataL();
+ // do active backup when in partial backup mode
+ if (iIsPartial)
+ {
+ //active
+ BackupActiveIncDataL();
+ BackupActiveSnapshotDataL();
+ }
//passive
BackupPassiveIncDataL();
--- a/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststepbackupasync.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststepbackupasync.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -148,6 +148,8 @@
Log(LOG_LEVEL2, KLog3);
}
+ _LIT(KLog31, "Checking valid registration...");
+ Log(LOG_LEVEL2, KLog31);
CheckValidRegistrationL();
_LIT(KLog4, "Saving Data Owners...");
@@ -204,9 +206,12 @@
BackupSystemBaseDataL();
BackupSystemSnapshotDataL();
- //active
- BackupActiveBaseDataL();
- BackupActiveSnapshotDataL();
+ if (iIsPartial)
+ {
+ //active
+ BackupActiveBaseDataL();
+ BackupActiveSnapshotDataL();
+ }
//passive
BackupPassiveBaseDataL();
@@ -251,9 +256,12 @@
BackupSystemBaseDataL();
BackupSystemSnapshotDataL();
- // active
- BackupActiveIncDataL();
- BackupActiveSnapshotDataL();
+ if (iIsPartial)
+ {
+ // active
+ BackupActiveIncDataL();
+ BackupActiveSnapshotDataL();
+ }
//passive
BackupPassiveIncDataL();
--- a/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststeprestore.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststeprestore.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -241,9 +241,13 @@
SupplyPassiveSnapshotDataL();
RestorePassiveBaseDataL();
- //active
- SupplyActiveSnapshotDataL();
- RestoreActiveBaseDataL();
+ // do active restore when in partial restore mode
+ if (iIsPartial)
+ {
+ //active
+ SupplyActiveSnapshotDataL();
+ RestoreActiveBaseDataL();
+ }
}
void CBURTestStepRestore::IncrementalRestoreL()
@@ -259,11 +263,14 @@
RestorePassiveBaseDataL();
RestorePassiveIncDataL();
-
- //active
- SupplyActiveSnapshotDataL();
- RestoreActiveBaseDataL();
- RestoreActiveIncDataL();
+ // do active restore when in partial restore mode
+ if (iIsPartial)
+ {
+ //active
+ SupplyActiveSnapshotDataL();
+ RestoreActiveBaseDataL();
+ RestoreActiveIncDataL();
+ }
}
--- a/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststeprestoreasync.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststeprestoreasync.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -200,9 +200,12 @@
{
RestoreJavaMidletDataL();
- // passive
- SupplyPassiveSnapshotDataL();
- RestorePassiveBaseDataL();
+ if (iIsPartial)
+ {
+ // passive
+ SupplyPassiveSnapshotDataL();
+ RestorePassiveBaseDataL();
+ }
//active
SupplyActiveSnapshotDataL();
@@ -216,17 +219,19 @@
*/
{
RestoreJavaMidletDataL();
-
- // passive
- SupplyPassiveSnapshotDataL();
- RestorePassiveBaseDataL();
- RestorePassiveIncDataL();
-
-
- //active
- SupplyActiveSnapshotDataL();
- RestoreActiveBaseDataL();
- RestoreActiveIncDataL();
+
+ // passive
+ SupplyPassiveSnapshotDataL();
+ RestorePassiveBaseDataL();
+ RestorePassiveIncDataL();
+
+ if (iIsPartial)
+ {
+ //active
+ SupplyActiveSnapshotDataL();
+ RestoreActiveBaseDataL();
+ RestoreActiveIncDataL();
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/backup_registration.xml Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,8 @@
+<?xml version="1.0" standalone="yes"?>
+
+<backup_registration>
+ <passive_backup base_backup_only="yes">
+ <include_directory name = "preserve"/>
+ </passive_backup>
+</backup_registration>
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/import_backup_registration.xml Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,18 @@
+<?xml version="1.0" standalone="yes"?>
+
+<backup_registration>
+ <public_backup>
+ <include_directory name = "C:\public\81113002\"/>
+ <include_directory name = "!:\public\test\"/>
+ <exclude name = "c:\nkern.txt"/>
+ </public_backup>
+
+ <!-- Increase condition coverage -->
+ <exclude name = "c:\resource\81113002\nkern.txt"/>
+
+ <!--test proxy parse function. -->
+ <proxy_data_manager sid= "0x10202BE9" />
+
+ <system_backup/>
+ <restore requires_reboot = "no"/>
+</backup_registration>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/increamenttest.xml Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,11 @@
+<?xml version="1.0" standalone="yes"?>
+
+<backup_registration>
+ <passive_backup base_backup_only="no">
+ <include_file name="needbackup.xml"/>
+ </passive_backup>
+ <public_backup>
+ <include_file name="c:\publicbackup.xml"/>
+ </public_backup>
+</backup_registration>
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/invalidproxymgr.xml Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,5 @@
+<?xml version="1.0" standalone="yes"?>
+<backup_registration>
+ <proxy_data_manager SID="0x00000000" />
+ <dbms_backup policy="AABBCCDD" />
+</backup_registration>
Binary file backupandrestore/backuptest/burtestserver/testscripts/private_file1.dat has changed
Binary file backupandrestore/backuptest/burtestserver/testscripts/public_file1.dat has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/public_file2.dat Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,1 @@
+test data
\ No newline at end of file
Binary file backupandrestore/backuptest/burtestserver/testscripts/sbeconfig.xml has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/test.ini Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,225 @@
+[BACKUP_RESTORE_0010]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=1
+DriveList=c
+IDs=10005399
+
+[BACKUP_RESTORE_0020]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=0
+DriveList=c
+IDs=10005399
+
+[BACKUP_RESTORE_0030]
+BackupDir=c:\BackupArchive\
+IsPartial=0
+BaseOnly=1
+DriveList=c
+ExcludeIDs=10281d18,101fdf81,2000b4d8,1028246f,1028312B,200286d2,101F51F2,10202BE9,101F99FB,100069CC,20021367,10003A73,101F401D,2002BCC0,1020383E
+
+[BACKUP_RESTORE_0040]
+BackupDir=c:\BackupArchive\
+IsPartial=0
+BaseOnly=0
+DriveList=c
+ExcludeIDs=10281d18,101fdf81,2000b4d8,1028246f,1028312B,200286d2,101F51F2,10202BE9,101F99FB,100069CC,20021367,10003A73,101F401D,2002BCC0,1020383E
+
+[BACKUP_RESTORE_0050]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=1
+DriveList=c
+IDs=00000000
+
+[BACKUP_RESTORE_0060]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=1
+DriveList=o
+IDs=0AB7E57C
+ExpectStatus=-1
+
+[BACKUP_RESTORE_0070]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=1
+DriveList=c
+IDs=12345678
+
+[BACKUP_RESTORE_0075]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=1
+DriveList=c
+IDs=0AB7E58F
+
+[BACKUP_RESTORE_0077]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=1
+DriveList=c
+IDs=0AB7E58F
+ExpectStatus=-21
+
+[BACKUP_RESTORE_0080]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=0
+DriveList=c
+IDs=0AB7E58F
+
+[BACKUP_RESTORE_0090]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=0
+DriveList=c
+IDs=0AB7E58F
+
+[BACKUP_RESTORE_0100]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=0
+DriveList=c
+IDs=0AB7E58C
+
+[BACKUP_RESTORE_0110]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=0
+DriveList=A,c,$,#,@,!,1,^,&,*
+IDs=0AB7E58C
+ExpectStatus=-1
+
+[BACKUP_RESTORE_0120]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=0
+DriveList=c
+IDs=0AB7E58C
+ExpectStatus=-21
+
+[INC_BACKUP_RESTORE_0010]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+IDs=0AB7E57C,0AB7E57E,0AB7E58A
+BaseOnly=1
+DriveList=c
+
+[INC_BACKUP_RESTORE_0020]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+IDs=0AB7E57C,0AB7E57E,0AB7E58A
+BaseOnly=0
+DriveList=c
+
+[PACKAGE_0010]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=1
+DriveList=c
+IDs=8111300b
+
+[PACKAGE_0020]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=1
+DriveList=c
+IDs=8111300b
+ExpectStatus=-11
+ExpectStatus2=-12
+
+[PACKAGE_0030]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=1
+DriveList=c
+IDs=81113002
+
+[PACKAGE_0040]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=1
+DriveList=c
+IDs=81113002
+ExpectStatus=-11
+ExpectStatus2=-12
+
+[PUBLIC_FILE_0010]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=1
+DriveList=c
+IDs=0FA00001
+ExpectPublicFiles=c:\public\0FA00001\public_file1.dat,c:\public\0FA00001\public_file2.dat
+
+[PUBLIC_FILE_0020]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=1
+DriveList=c
+IDs=0FA00001
+ExpectPrivateFiles=C:\private\0FA00001\private_file1.dat
+ExpectPrivateFileSizes=68841
+
+[ACTIVE_BACKUP_0010]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+IDs=0AB7E57C,0AB7E57E,0AB7E58A
+BaseOnly=1
+DriveList=c
+
+[ACTIVE_BACKUP_0020]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+IDs=0AB7E57D
+BaseOnly=1
+DriveList=c
+ExpectStatus=-1
+
+[ACTIVE_BACKUP_0030]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+IDs=0AB7E57C
+BaseOnly=0
+DriveList=c
+
+[ACTIVE_BACKUP_0040]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+IDs=0AB7E58B
+BaseOnly=0
+DriveList=c
+ExpectStatus=5
+
+[ACTIVE_RESTORE_0010]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+IDs=0AB7E57C,0AB7E57E,0AB7E58A
+BaseOnly=1
+DriveList=c
+
+[ACTIVE_RESTORE_0020]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+IDs=0AB7E57D
+BaseOnly=1
+DriveList=c
+ExpectStatus=-1
+ExpectStatus2=-18
+
+[ACTIVE_RESTORE_0030]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+IDs=0AB7E57C
+BaseOnly=0
+DriveList=c
+
+[ACTIVE_RESTORE_0040]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+IDs=0AB7E58B
+BaseOnly=0
+DriveList=c
+ExpectStatus=5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/test_activebackuprestore.script Tue Jul 06 15:13:34 2010 +0300
@@ -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:
+//
+
+
+//////////////////////////////////////////////////////////////////////////////////////
+//
+// test_activebackup.script
+//
+////////////////////////////////////////////////////////////////////////////////////
+LOAD_SUITE BURTestServer
+
+PRINT ----------------------------------------------
+PRINT Test Active Backup
+PRINT ----------------------------------------------
+RUN_UTILS DeleteDirectory C:\BackupArchive\
+START_TESTCASE MTP-SBE-ACTIVEBACKUP-0010
+//! @SYMTestCaseID MTP-SBE-ACTIVEBACKUP-0010
+//! @SYMTestCaseDesc Do BaseOnly active-backup for three data owners
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do BaseOnly active-backup for three data owners
+//! @SYMTestExpectedResults Backup succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini ACTIVE_BACKUP_0010
+END_TESTCASE MTP-SBE-ACTIVEBACKUP-0010
+
+START_TESTCASE MTP-SBE-ACTIVEBACKUP-0020
+//! @SYMTestCaseID MTP-SBE-ACTIVEBACKUP-0020
+//! @SYMTestCaseDesc Do Proxy active-backup for specified data owner
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do Proxy active-backup for specified data owner
+//! @SYMTestExpectedResults Backup succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini ACTIVE_BACKUP_0020
+END_TESTCASE MTP-SBE-ACTIVEBACKUP-0020
+
+START_TESTCASE MTP-SBE-ACTIVEBACKUP-0030
+//! @SYMTestCaseID MTP-SBE-ACTIVEBACKUP-0030
+//! @SYMTestCaseDesc Do Incremental active-backup for specified data owner
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do Incremental active-backup for specified data owner
+//! @SYMTestExpectedResults Backup succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini ACTIVE_BACKUP_0030
+END_TESTCASE MTP-SBE-ACTIVEBACKUP-0030
+
+START_TESTCASE MTP-SBE-ACTIVEBACKUP-0040
+//! @SYMTestCaseID MTP-SBE-ACTIVEBACKUP-0040
+//! @SYMTestCaseDesc Do active-backup for a data owner whose executable file is missing
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do active-backup for a data owner whose executable file is missing
+//! @SYMTestExpectedResults Backup fails with error code 5
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini ACTIVE_BACKUP_0040
+END_TESTCASE MTP-SBE-ACTIVEBACKUP-0040
+
+PRINT ----------------------------------------------
+PRINT Test Active Restore
+PRINT ----------------------------------------------
+
+START_TESTCASE MTP-SBE-ACTIVERESTORE-0010
+//! @SYMTestCaseID MTP-SBE-ACTIVERESTORE-0010
+//! @SYMTestCaseDesc Do BaseOnly active-restore for three data owners
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do BaseOnly active-restore for three data owners
+//! @SYMTestExpectedResults Restore succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini ACTIVE_RESTORE_0010
+END_TESTCASE MTP-SBE-ACTIVERESTORE-0010
+
+START_TESTCASE MTP-SBE-ACTIVERESTORE-0020
+//! @SYMTestCaseID MTP-SBE-ACTIVERESTORE-0020
+//! @SYMTestCaseDesc Do Proxy active-restore for specified data owner
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do Proxy active-restore for specified data owner
+//! @SYMTestExpectedResults Restore succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini ACTIVE_RESTORE_0020
+END_TESTCASE MTP-SBE-ACTIVERESTORE-0020
+
+START_TESTCASE MTP-SBE-ACTIVERESTORE-0030
+//! @SYMTestCaseID MTP-SBE-ACTIVERESTORE-0030
+//! @SYMTestCaseDesc Do Incremental active-restore for specified data owner
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do Incremental active-restore for specified data owner
+//! @SYMTestExpectedResults Restore succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini ACTIVE_RESTORE_0030
+END_TESTCASE MTP-SBE-ACTIVERESTORE-0030
+
+START_TESTCASE MTP-SBE-ACTIVERESTORE-0040
+//! @SYMTestCaseID MTP-SBE-ACTIVERESTORE-0040
+//! @SYMTestCaseDesc Do active-restore for a data owner whose executable file is missing
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do active-restore for a data owner whose executable file is missing
+//! @SYMTestExpectedResults Restore fails with error code 5
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini ACTIVE_RESTORE_0040
+END_TESTCASE MTP-SBE-ACTIVERESTORE-0040
+
+PRINT ----------------------------------------------
+PRINT Test Active Backup Async
+PRINT ----------------------------------------------
+RUN_UTILS DeleteDirectory C:\BackupArchive\
+START_TESTCASE MTP-SBE-ACTIVEBACKUP-ASYNC-0010
+//! @SYMTestCaseID MTP-SBE-ACTIVEBACKUP-ASYNC-0010
+//! @SYMTestCaseDesc Do BaseOnly active-backup for three data owners asynchronously
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do BaseOnly active-backup for three data owners asynchronously
+//! @SYMTestExpectedResults Backup succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackupAsync z:\testdata\scripts\sbetestdata\test.ini ACTIVE_BACKUP_0010
+END_TESTCASE MTP-SBE-ACTIVEBACKUP-ASYNC-0010
+
+START_TESTCASE MTP-SBE-ACTIVEBACKUP-ASYNC-0020
+//! @SYMTestCaseID MTP-SBE-ACTIVEBACKUP-ASYNC-0020
+//! @SYMTestCaseDesc Do Proxy active-backup for specified data owner asynchronously
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do Proxy active-backup for specified data owner asynchronously
+//! @SYMTestExpectedResults Backup succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackupAsync z:\testdata\scripts\sbetestdata\test.ini ACTIVE_BACKUP_0020
+END_TESTCASE MTP-SBE-ACTIVEBACKUP-ASYNC-0020
+
+START_TESTCASE MTP-SBE-ACTIVEBACKUP-ASYNC-0030
+//! @SYMTestCaseID MTP-SBE-ACTIVEBACKUP-ASYNC-0030
+//! @SYMTestCaseDesc Do Incremental active-backup for specified data owner asynchronously
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do Incremental active-backup for specified data owner asynchronously
+//! @SYMTestExpectedResults Backup succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackupAsync z:\testdata\scripts\sbetestdata\test.ini ACTIVE_BACKUP_0030
+END_TESTCASE MTP-SBE-ACTIVEBACKUP-ASYNC-0030
+
+START_TESTCASE MTP-SBE-ACTIVEBACKUP-ASYNC-0040
+//! @SYMTestCaseID MTP-SBE-ACTIVEBACKUP-ASYNC-0040
+//! @SYMTestCaseDesc Do active-backup asynchronously for a data owner whose executable file is missing
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do active-backup asynchronously for a data owner whose executable file is missing
+//! @SYMTestExpectedResults Backup fails with error code 5
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackupAsync z:\testdata\scripts\sbetestdata\test.ini ACTIVE_BACKUP_0040
+END_TESTCASE MTP-SBE-ACTIVEBACKUP-ASYNC-0040
+
+PRINT ----------------------------------------------
+PRINT Test Active Restore Async
+PRINT ----------------------------------------------
+
+START_TESTCASE MTP-SBE-ACTIVERESTORE-ASYNC-0010
+//! @SYMTestCaseID MTP-SBE-ACTIVERESTORE-ASYNC-0010
+//! @SYMTestCaseDesc Do BaseOnly active-restore for three data owners asynchronously
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do BaseOnly active-restore for three data owners asynchronously
+//! @SYMTestExpectedResults Restore succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestoreAsync z:\testdata\scripts\sbetestdata\test.ini ACTIVE_RESTORE_0010
+END_TESTCASE MTP-SBE-ACTIVERESTORE-ASYNC-0010
+
+START_TESTCASE MTP-SBE-ACTIVERESTORE-ASYNC-0020
+//! @SYMTestCaseID MTP-SBE-ACTIVERESTORE-ASYNC-0020
+//! @SYMTestCaseDesc Do Proxy active-restore for specified data owner asynchronously
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do Proxy active-restore for specified data owner asynchronously
+//! @SYMTestExpectedResults Restore succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestoreAsync z:\testdata\scripts\sbetestdata\test.ini ACTIVE_RESTORE_0020
+END_TESTCASE MTP-SBE-ACTIVERESTORE-ASYNC-0020
+
+START_TESTCASE MTP-SBE-ACTIVERESTORE-ASYNC-0030
+//! @SYMTestCaseID MTP-SBE-ACTIVERESTORE-ASYNC-0030
+//! @SYMTestCaseDesc Do Incremental active-restore for specified data owner asynchronously
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do Incremental active-restore for specified data owner asynchronously
+//! @SYMTestExpectedResults Restore succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestoreAsync z:\testdata\scripts\sbetestdata\test.ini ACTIVE_RESTORE_0030
+END_TESTCASE MTP-SBE-ACTIVERESTORE-ASYNC-0030
+
+START_TESTCASE MTP-SBE-ACTIVERESTORE-ASYNC-0040
+//! @SYMTestCaseID MTP-SBE-ACTIVERESTORE-ASYNC-0040
+//! @SYMTestCaseDesc Do active-restore asynchronously for a data owner whose executable file is missing
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do active-restore asynchronously for a data owner whose executable file is missing
+//! @SYMTestExpectedResults Restore fails with error code 5
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestoreAsync z:\testdata\scripts\sbetestdata\test.ini ACTIVE_RESTORE_0040
+END_TESTCASE MTP-SBE-ACTIVERESTORE-ASYNC-0040
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/test_backupinvalid.script Tue Jul 06 15:13:34 2010 +0300
@@ -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:
+//
+
+//////////////////////////////////////////////////////////////////////////////////////
+//
+// test.script
+//
+////////////////////////////////////////////////////////////////////////////////////
+LOAD_SUITE BURTestServer
+
+PRINT ----------------------------------------------
+PRINT Test Backup Invalid
+PRINT ----------------------------------------------
+RUN_UTILS DeleteDirectory C:\BackupArchive\
+START_TESTCASE MTP-SBE-BACKUPINVALIDIDS-0000
+//! @SYMTestCaseID MTP-SBE-BACKUPINVALIDIDS-0000
+//! @SYMTestCaseDesc Invalid data owner ID test
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify an invlid id and try backup it.
+//! @SYMTestExpectedResults SBE can't found and do nothing
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0050
+END_TESTCASE MTP-SBE-BACKUPINVALIDIDS-0000
+
+START_TESTCASE MTP-SBE-BACKUPINVALIDDRIVE-0001
+//! @SYMTestCaseID MTP-SBE-BACKUPINVALIDDRIVE-0001
+//! @SYMTestCaseDesc Invalid drive test
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify an invalid drive for a data owner to backup
+//! @SYMTestExpectedResults SBE backup operation return -1
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0060
+END_TESTCASE MTP-SBE-BACKUPINVALIDDRIVE-0001
+
+RUN_UTILS MkDir c:\private\12345678\
+RUN_UTILS CopyFile z:\testdata\scripts\sbetestdata\backup_registration.xml c:\private\12345678\backup_registration.xml
+START_TESTCASE MTP-SBE-BACKUPINVALIDDIR-0002
+//! @SYMTestCaseID MTP-SBE-BACKUPINVALIDDIR-0002
+//! @SYMTestCaseDesc Invalid directory test
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify an invalid directory for a data owner to backup
+//! @SYMTestExpectedResults SBE can't found and do nothing
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0070
+END_TESTCASE MTP-SBE-BACKUPINVALIDDIR-0002
+
+RUN_UTILS DeleteDirectory c:\private\12345678\
+RUN_UTILS DeleteDirectory c:\BackupArchive\
+RUN_UTILS DeleteDirectory c:\private\0AB7E58F\
+RUN_UTILS MkDir c:\private\0AB7E58F\
+RUN_UTILS CopyFile z:\testdata\scripts\sbetestdata\invalidproxymgr.xml c:\private\0AB7E58F\backup_registration.xml
+RUN_UTILS MakeReadWrite c:\private\0AB7E58F\backup_registration.xml
+START_TESTCASE MTP-SBE-BACKUPINVALIDPROXY-0003
+//! @SYMTestCaseID MTP-SBE-BACKUPINVALIDPROXY-0003
+//! @SYMTestCaseDesc Invalid proxy manager test
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify an invalid proxy manager in register file for a data owner to backup
+//! @SYMTestExpectedResults SBE can't found and do nothing
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0075
+END_TESTCASE MTP-SBE-BACKUPINVALIDPROXY-0003
+
+RUN_UTILS DeleteDirectory c:\private\0AB7E58F\
+RUN_UTILS DeleteDirectory c:\BackupArchive\
+RUN_UTILS MkDir c:\private\0AB7E58F\
+RUN_UTILS CopyFile z:\testdata\scripts\sbetestdata\increamenttest.xml c:\private\0AB7E58F\backup_registration.xml
+RUN_UTILS CopyFile z:\sys\bin\esock.dll c:\private\0AB7E58F\needbackup.xml
+START_TESTCASE MTP-SBE-BACKUPREADONLY-0004
+//! @SYMTestCaseID MTP-SBE-BACKUPREADONLY-0004
+//! @SYMTestCaseDesc Test readonly file backup. This case only valid on hardware, on winscw, all file is readable.
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Backup a read only file
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0075
+END_TESTCASE MTP-SBE-BACKUPREADONLY-0004
+
+START_TESTCASE MTP-SBE-RESTOREREADONLY-0005
+//! @SYMTestCaseID MTP-SBE-RESTOREREADONLY-0005
+//! @SYMTestCaseDesc Test readonly file restore
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Restore a readonly file, but the origin file exist
+//! @SYMTestExpectedResults -21
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0077
+END_TESTCASE MTP-SBE-RESTOREREADONLY-0005
+RUN_UTILS DeleteDirectory c:\private\0AB7E58F\
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/test_backuppackage.script Tue Jul 06 15:13:34 2010 +0300
@@ -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:
+//
+
+
+//////////////////////////////////////////////////////////////////////////////////////
+//
+// test_backuppackage.script
+// for testing backup datas of installed applications
+//
+////////////////////////////////////////////////////////////////////////////////////
+LOAD_SUITE BURTestServer
+
+PRINT ----------------------------------------------
+PRINT Test Backup and Restore package applications
+PRINT ----------------------------------------------
+RUN_PROGRAM 1000 swiconsole /i Z:\testdata\scripts\sbetestdata\bigexeforbackup.sis /optimal
+RUN_PROGRAM 1000 swiconsole /i Z:\testdata\scripts\sbetestdata\test_dll_nopublic.SIS /optimal
+RUN_UTILS DeleteDirectory C:\BackupArchive\
+RUN_UTILS DeleteDirectory C:\system\temp\
+RUN_UTILS CopyFile Z:\testdata\scripts\sbetestdata\private_file1.dat C:\private\81000014\private_file1.dat
+RUN_UTILS MakeReadWrite C:\private\81000014\private_file1.dat
+
+RUN_UTILS DeleteDirectory C:\public\
+RUN_UTILS MkDir C:\public\
+RUN_UTILS MkDir C:\public\81113002\
+RUN_UTILS MkDir C:\public\test\
+RUN_UTILS CopyFile Z:\testdata\scripts\sbetestdata\public_file1.dat C:\public\81113002\public_file1.dat
+RUN_UTILS CopyFile Z:\testdata\scripts\sbetestdata\public_file2.dat C:\public\81113002\public_file2.dat
+RUN_UTILS CopyFile Z:\testdata\scripts\sbetestdata\private_file1.dat C:\public\test\private_file1.dat
+RUN_UTILS MakeReadWrite C:\public\81113002\public_file1.dat
+RUN_UTILS MakeReadWrite C:\public\81113002\public_file2.dat
+RUN_UTILS MakeReadWrite C:\public\test\private_file1.dat
+
+START_TESTCASE MTP-SBE-BACKUPPACKAGE-0000
+//! @SYMTestCaseID MTP-SBE-BACKUPPACKAGE-0000
+//! @SYMTestCaseDesc Backup big data which owner is install application
+//! @SYMPREQ PREQ2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Backup executable files and private data of install application
+//! @SYMTestExpectedResults 1. The success message displayed in the console.
+//! 2. No any error or warning message displayed in the console.
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini PACKAGE_0010
+END_TESTCASE MTP-SBE-BACKUPPACKAGE-0000
+RUN_UTILS DeleteFile C:\private\81000014\private_file1.dat
+
+START_TESTCASE MTP-SBE-RESTOREBACKUPPACKAGE-0001
+//! @SYMTestCaseID MTP-SBE-RESTOREBACKUPPACKAGE-0001
+//! @SYMTestCaseDesc Restore big data which owner is install application
+//! @SYMPREQ PREQ2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Restore executable files and private datas of install application from bakcup file.
+//! @SYMTestExpectedResults 1. The failure message of restore displayed in the console
+//! 2. The executable files are not be restored.
+//! 3. The private files are not be restored.
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini PACKAGE_0020
+END_TESTCASE MTP-SBE-RESTOREBACKUPPACKAGE-0001
+RUN_UTILS DeleteFile C:\private\81000014\private_file1.dat
+
+START_TESTCASE MTP-SBE-BACKUPPACKAGE-0002
+//! @SYMTestCaseID MTP-SBE-BACKUPPACKAGE-0002
+//! @SYMTestCaseDesc Backup DLLs data which are installed as part of package
+//! @SYMPREQ PREQ2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Backup executable files and private data of install DLL
+//! @SYMTestExpectedResults 1. The success message displayed in the console.
+//! 2. No any error or warning message displayed in the console.
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini PACKAGE_0030
+END_TESTCASE MTP-SBE-BACKUPPACKAGE-0002
+
+START_TESTCASE MTP-SBE-RESTOREBACKUPPACKAGE-0003
+//! @SYMTestCaseID MTP-SBE-RESTOREBACKUPPACKAGE-0003
+//! @SYMTestCaseDesc Backup DLLs data which are installed as part of package
+//! @SYMPREQ PREQ2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Restore executable files and private datas of install DLL from bakcup file.
+//! @SYMTestExpectedResults 1. The failure message of restore displayed in the console
+//! 2. The executable files are not be restored.
+//! 3. The private files are not be restored.
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini PACKAGE_0040
+END_TESTCASE MTP-SBE-RESTOREBACKUPPACKAGE-0003
+
+RUN_UTILS DeleteFile C:\public\81113002\public_file1.dat
+RUN_UTILS DeleteFile C:\public\81113002\public_file2.dat
+RUN_UTILS DeleteFile C:\public\test\private_file1.dat
+RUN_UTILS DeleteDirectory C:\public\81113002\
+RUN_UTILS DeleteDirectory C:\public\test\
+RUN_UTILS DeleteDirectory C:\public\
+RUN_PROGRAM 900 swiconsole /u /uid 0x8111300b /pkg "big exe for backup" /vendor "Unique Vendor Name" /optimal
+RUN_PROGRAM 1000 swiconsole /u /uid 0x81113002 /pkg "tswinocapability" /vendor "Symbian" /optimal
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/test_backuprestore.script Tue Jul 06 15:13:34 2010 +0300
@@ -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:
+//
+
+//////////////////////////////////////////////////////////////////////////////////////
+//
+// test.script
+//
+////////////////////////////////////////////////////////////////////////////////////
+LOAD_SUITE BURTestServer
+
+PRINT ----------------------------------------------
+PRINT Test Backup Restore
+PRINT ----------------------------------------------
+RUN_UTILS DeleteDirectory C:\BackupArchive\
+START_TESTCASE MTP-SBE-BACKUPPARTIALBASE-0000
+//! @SYMTestCaseID MTP-SBE-BACKUPPARTIALBASE-0000
+//! @SYMTestCaseDesc Backup with partial and base
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for base and partial backup
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0010
+END_TESTCASE MTP-SBE-BACKUPPARTIALBASE-0000
+
+START_TESTCASE MTP-SBE-RESTOREPARTIALBASE-0001
+//! @SYMTestCaseID MTP-SBE-RESTOREPARTIALBASE-0001
+//! @SYMTestCaseDesc restore with partial and base
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for base and partial restore
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0010
+END_TESTCASE MTP-SBE-RESTOREPARTIALBASE-0001
+
+START_TESTCASE MTP-SBE-BACKUPPARTIAL-0002
+//! @SYMTestCaseID MTP-SBE-BACKUPPARTIAL-0002
+//! @SYMTestCaseDesc Backup with partial and increament
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for increament and partial backup
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0020
+END_TESTCASE MTP-SBE-BACKUPPARTIAL-0002
+
+START_TESTCASE MTP-SBE-RESTOREPARTIAL-0003
+//! @SYMTestCaseID MTP-SBE-RESTOREPARTIAL-0003
+//! @SYMTestCaseDesc Restore with partial and increament
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for increament and partial restore
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0020
+END_TESTCASE MTP-SBE-RESTOREPARTIAL-0003
+
+START_TESTCASE MTP-SBE-BACKUPFULLBASE-0004
+//! @SYMTestCaseID MTP-SBE-BACKUPFULLBASE-0004
+//! @SYMTestCaseDesc Backup with full and base
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for full and base backup
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0030
+END_TESTCASE MTP-SBE-BACKUPFULLBASE-0004
+
+START_TESTCASE MTP-SBE-RESTOREFULLBASE-0005
+//! @SYMTestCaseID MTP-SBE-RESTOREFULLBASE-0005
+//! @SYMTestCaseDesc Restore with full and base
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for full and base restore
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0030
+END_TESTCASE MTP-SBE-RESTOREFULLBASE-0005
+
+START_TESTCASE MTP-SBE-BACKUPFULL-0006
+//! @SYMTestCaseID MTP-SBE-BACKUPFULL-0006
+//! @SYMTestCaseDesc Backup with full and increament
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for full and increament backup
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0040
+END_TESTCASE MTP-SBE-BACKUPFULL-0006
+
+START_TESTCASE MTP-SBE-RESTOREFULL-0007
+//! @SYMTestCaseID MTP-SBE-RESTOREFULL-0007
+//! @SYMTestCaseDesc Restore with full and increament
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for full and increament restore
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0040
+END_TESTCASE MTP-SBE-RESTOREFULL-0007
+
+RUN_UTILS DeleteFile c:\sbetest1.txt
+RUN_UTILS DeleteFile c:\sbetest2.txt
+RUN_UTILS CopyFile z:\testdata\scripts\sbetestdata\increamenttest.xml c:\sbetest1.txt
+RUN_UTILS CopyFile z:\testdata\scripts\sbetestdata\increamenttest.xml c:\sbetest2.txt
+RUN_UTILS MakeReadWrite c:\sbetest1.txt
+RUN_UTILS MakeReadWrite c:\sbetest2.txt
+START_TESTCASE MTP-SBE-BACKUPPARTIALBASE-0008
+//! @SYMTestCaseID MTP-SBE-BACKUPPARTIALBASE-0008
+//! @SYMTestCaseDesc Do passive backup for a data owner which has a very complex backup registration file
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority high
+//! @SYMTestActions Do passive backup for a data owner which has a very complex backup registration file
+//! @SYMTestExpectedResults Backup succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0100
+END_TESTCASE MTP-SBE-BACKUPPARTIALBASE-0008
+
+START_TESTCASE MTP-SBE-BACKUPPARTIALBASE-0010
+//! @SYMTestCaseID MTP-SBE-BACKUPPARTIALBASE-0010
+//! @SYMTestCaseDesc Do passive backup for a data owner with a invalid drive list
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority high
+//! @SYMTestActions Do passive backup for a data owner with a invalid drive list
+//! @SYMTestExpectedResults Backup fails with error code -1
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0110
+END_TESTCASE MTP-SBE-BACKUPPARTIALBASE-0010
+
+START_TESTCASE MTP-SBE-BACKUPPARTIALBASE-0012
+//! @SYMTestCaseID MTP-SBE-BACKUPPARTIALBASE-0012
+//! @SYMTestCaseDesc Do passive backup with abnormal operation sequence
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority high
+//! @SYMTestActions Do passive backup with abnormal operation sequence
+//! @SYMTestExpectedResults Backup fails with error code -21
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestBackup2 z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0120
+END_TESTCASE MTP-SBE-BACKUPPARTIALBASE-0012
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/test_backuprestoreasync.script Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,122 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies 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.script
+//
+////////////////////////////////////////////////////////////////////////////////////
+LOAD_SUITE BURTestServer
+
+PRINT ----------------------------------------------
+PRINT Test Backup Restore Async
+PRINT ----------------------------------------------
+RUN_UTILS DeleteDirectory C:\BackupArchive\
+START_TESTCASE MTP-SBE-BACKUPPARTIALBASEASYNC-0000
+//! @SYMTestCaseID MTP-SBE-BACKUPPARTIALBASEASYNC-0000
+//! @SYMTestCaseDesc Backup with partial and base
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for base and partial backup
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackupAsync z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0010
+END_TESTCASE MTP-SBE-BACKUPPARTIALBASEASYNC-0000
+
+START_TESTCASE MTP-SBE-RESTOREPARTIALBASEASYNC-0001
+//! @SYMTestCaseID MTP-SBE-RESTOREPARTIALBASEASYNC-0001
+//! @SYMTestCaseDesc restore with partial and base
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for base and partial restore
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestoreAsync z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0010
+END_TESTCASE MTP-SBE-RESTOREPARTIALBASEASYNC-0001
+
+START_TESTCASE MTP-SBE-BACKUPPARTIALASYNC-0002
+//! @SYMTestCaseID MTP-SBE-BACKUPPARTIALASYNC-0002
+//! @SYMTestCaseDesc Backup with partial and increament
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for increament and partial backup
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackupAsync z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0020
+END_TESTCASE MTP-SBE-BACKUPPARTIALASYNC-0002
+
+START_TESTCASE MTP-SBE-RESTOREPARTIALASYNC-0003
+//! @SYMTestCaseID MTP-SBE-RESTOREPARTIALASYNC-0003
+//! @SYMTestCaseDesc Restore with partial and increament
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for increament and partial restore
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestoreAsync z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0020
+END_TESTCASE MTP-SBE-RESTOREPARTIALASYNC-0003
+
+START_TESTCASE MTP-SBE-BACKUPFULLBASEASYNC-0004
+//! @SYMTestCaseID MTP-SBE-BACKUPFULLBASEASYNC-0004
+//! @SYMTestCaseDesc Backup with full and base
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for full and base backup
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestBackupAsync z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0030
+END_TESTCASE MTP-SBE-BACKUPFULLBASEASYNC-0004
+
+START_TESTCASE MTP-SBE-RESTOREFULLBASEASYNC-0005
+//! @SYMTestCaseID MTP-SBE-RESTOREFULLBASEASYNC-0005
+//! @SYMTestCaseDesc Restore with full and base
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for full and base restore
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestRestoreAsync z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0030
+END_TESTCASE MTP-SBE-RESTOREFULLBASEASYNC-0005
+
+START_TESTCASE MTP-SBE-BACKUPFULLASYNC-0006
+//! @SYMTestCaseID MTP-SBE-BACKUPFULLASYNC-0006
+//! @SYMTestCaseDesc Backup with full and increament
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for full and increament backup
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestBackupAsync z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0040
+END_TESTCASE MTP-SBE-BACKUPFULLASYNC-0006
+
+START_TESTCASE MTP-SBE-RESTOREFULLASYNC-0007
+//! @SYMTestCaseID MTP-SBE-RESTOREFULLASYNC-0007
+//! @SYMTestCaseDesc Restore with full and increament
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for full and increament restore
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestRestoreAsync z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0040
+END_TESTCASE MTP-SBE-RESTOREFULLASYNC-0007
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/test_increament.script Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,135 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+//////////////////////////////////////////////////////////////////////////////////////
+//
+// test.script
+//
+////////////////////////////////////////////////////////////////////////////////////
+LOAD_SUITE BURTestServer
+
+PRINT ----------------------------------------------
+PRINT Test Increament
+PRINT ----------------------------------------------
+RUN_UTILS DeleteDirectory c:\BackupArchive\
+RUN_UTILS DeleteDirectory c:\private\0AB7E58F\
+RUN_UTILS DeleteFile c:\publicbackup.xml
+RUN_UTILS MkDir c:\private\0AB7E58F\
+RUN_UTILS CopyFile z:\testdata\scripts\sbetestdata\increamenttest.xml c:\private\0AB7E58F\backup_registration.xml
+RUN_UTILS MakeReadWrite c:\private\0AB7E58F\backup_registration.xml
+RUN_UTILS CopyFile c:\private\0AB7E58F\backup_registration.xml c:\private\0AB7E58F\needbackup.xml
+START_TESTCASE MTP-SBE-BACKUPBASE-0000
+//! @SYMTestCaseID MTP-SBE-BACKUPBASE-0000
+//! @SYMTestCaseDesc Backup 0AB7E58F
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify 0AB7E58F need be backup
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0080
+END_TESTCASE MTP-SBE-BACKUPBASE-0000
+
+RUN_UTILS DeleteFile c:\private\0AB7E58F\needbackup.xml
+RUN_UTILS CopyFile z:\testdata\scripts\sbetestdata\testbigfile.dat c:\private\0AB7E58F\needbackup.xml
+RUN_UTILS MakeReadWrite c:\private\0AB7E58F\needbackup.xml
+RUN_UTILS CopyFile c:\private\0AB7E58F\backup_registration.xml c:\publicbackup.xml
+START_TESTCASE MTP-SBE-BACKUPINCREAMENT-0010
+//! @SYMTestCaseID MTP-SBE-BACKUPINCREAMENT-0010
+//! @SYMTestCaseDesc Increament backup 0AB7E58F after some files changed
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify 0AB7E58F need be backup
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0090
+END_TESTCASE MTP-SBE-BACKUPINCREAMENT-0010
+
+RUN_UTILS DeleteFile c:\publicbackup.xml
+RUN_UTILS DeleteFile c:\private\0AB7E58F\needbackup.xml
+START_TESTCASE MTP-SBE-RESTOREINCREAMENT-0020
+//! @SYMTestCaseID MTP-SBE-RESTOREINCREAMENT-0020
+//! @SYMTestCaseDesc Increament restore
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify 0AB7E58F need be increament restore
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0090
+END_TESTCASE MTP-SBE-RESTOREINCREAMENT-0020
+
+RUN_UTILS DeleteFile c:\private\0AB7E58F\needbackup.xml
+RUN_UTILS DeleteFile c:\BackupArchive\AB7E58F\C\Passive\Base\data.bkp
+START_TESTCASE MTP-SBE-INVALIDDATARESTORE-0030
+//! @SYMTestCaseID MTP-SBE-INVALIDDATARESTORE-0030
+//! @SYMTestCaseDesc Increament restore with invalid data store
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Delete some data store data and try restore
+//! @SYMTestExpectedResults no error and SBE do nothing
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0090
+END_TESTCASE MTP-SBE-INVALIDDATARESTORE-0030
+
+RUN_UTILS DeleteDirectory c:\private\0AB7E58F\
+START_TESTCASE MTP-SBE-ACTIVEBASEBACKUP-0040
+//! @SYMTestCaseID MTP-SBE-ACTIVEBASEBACKUP-0040
+//! @SYMTestCaseDesc Backup an active data owner
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify active data owner need be backup
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini INC_BACKUP_RESTORE_0010
+END_TESTCASE MTP-SBE-ACTIVEBASEBACKUP-0040
+
+START_TESTCASE MTP-SBE-ACTIVEINCBACKUP-0050
+//! @SYMTestCaseID MTP-SBE-ACTIVEINCBACKUP-0050
+//! @SYMTestCaseDesc Increament backup an active data owner
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify active data owner need be backup
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini INC_BACKUP_RESTORE_0020
+END_TESTCASE MTP-SBE-ACTIVEINCBACKUP-0050
+
+START_TESTCASE MTP-SBE-ACTIVEBASERESTORE-0060
+//! @SYMTestCaseID MTP-SBE-ACTIVEBASERESTORE-0060
+//! @SYMTestCaseDesc Base restore
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify the active data owner need be base restore
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini INC_BACKUP_RESTORE_0010
+END_TESTCASE MTP-SBE-ACTIVEBASERESTORE-0060
+
+START_TESTCASE MTP-SBE-ACTIVEINCRESTORE-0070
+//! @SYMTestCaseID MTP-SBE-ACTIVEINCRESTORE-0070
+//! @SYMTestCaseDesc Increament restore
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify the active data owner need be increament restore
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini INC_BACKUP_RESTORE_0020
+END_TESTCASE MTP-SBE-ACTIVEINCRESTORE-0070
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/test_registration.xml Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,15 @@
+<?xml version="1.0" standalone="yes"?>
+
+<backup_registration>
+ <public_backup>
+ <include_directory name = "\logs"/>
+ <include_directory name = "C:\public\81113002\"/>
+ <include_file name = "C:\public\81113002\public_file1.dat"/>
+ <include_directory name = "I:\"/>
+ <exclude name = "c:\nkern.txt"/>
+ <exclude name = "C:\public\81113002\public_file1.dat"/>
+ </public_backup>
+
+ <system_backup/>
+ <restore requires_reboot = "no"/>
+</backup_registration>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/test_restorepackage.script Tue Jul 06 15:13:34 2010 +0300
@@ -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:
+//
+
+//////////////////////////////////////////////////////////////////////////////////////
+//
+// test_backuppackage.script
+// for testing backup datas of installed applications
+//
+////////////////////////////////////////////////////////////////////////////////////
+LOAD_SUITE BURTestServer
+
+PRINT ----------------------------------------------
+PRINT Test Restore
+PRINT ----------------------------------------------
+RUN_UTILS DeleteDirectory C:\system\temp\
+
+START_TESTCASE MTP-SBE-RESTOREBACKUPPACKAGE-0000
+//! @SYMTestCaseID MTP-SBE-RESTOREBACKUPPACKAGE-0000
+//! @SYMTestCaseDesc Restore big data which owner is install application
+//! @SYMPREQ PREQ2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Restore executable files and private datas of install application from bakcup file.
+//! @SYMTestExpectedResults 1. The executable files are same like after installing application
+//! 2. The name and size of private files are same like after installing application.
+//! 3. The public files don't be restored.
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini PACKAGE_0020
+END_TESTCASE MTP-SBE-RESTOREBACKUPPACKAGE-0000
+
+START_TESTCASE MTP-SBE-RESTOREBACKUPPACKAGE-0001
+//! @SYMTestCaseID MTP-SBE-RESTOREBACKUPPACKAGE-0001
+//! @SYMTestCaseDesc Backup DLLs data which are installed as part of package
+//! @SYMPREQ PREQ2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Restore executable files and private datas of install DLL from bakcup file.
+//! @SYMTestExpectedResults 1. The dll files are same like after installing application
+//! 2. The name and size of DLLs are same like after installing application.
+//! 3. The public files don't be restored.
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini PACKAGE_0040
+END_TESTCASE MTP-SBE-RESTOREBACKUPPACKAGE-0001
+
+RUN_PROGRAM 900 swiconsole /u /uid 0x8111300b /pkg "big exe for backup" /vendor "Unique Vendor Name" /optimal
+RUN_PROGRAM 1000 swiconsole /u /uid 0x81113002 /pkg "tswinocapability" /vendor "Symbian" /optimal
Binary file backupandrestore/backuptest/burtestserver/testscripts/testbigfile.dat has changed
Binary file backupandrestore/backuptest/testdata/armv5/bigexeforbackup.sis has changed
Binary file backupandrestore/backuptest/testdata/armv5/test_dll_nopublic.sis has changed
Binary file backupandrestore/backuptest/testdata/winscw/bigexeforbackup.sis has changed
Binary file backupandrestore/backuptest/testdata/winscw/test_dll_nopublic.SIS has changed
--- a/group/bld.inf Fri Jun 11 14:27:06 2010 +0300
+++ b/group/bld.inf Tue Jul 06 15:13:34 2010 +0300
@@ -26,7 +26,7 @@
#include "../mtpdataproviders/mtpfileandfolderdp/group/bld.inf"
#include "../mtpdataproviders/mtpwmpextndp/group/bld.inf"
#include "../mtptransports/mtpusbtransport/group/bld.inf"
-#include "../mtpfws/mtpfw/dataproviders/devdp/devdpextn/group/bld.inf"
+//#include "../mtpfws/mtpfw/dataproviders/devdp/devdpextn/group/bld.inf"
#include "../mtptransports/mtpptpiptransport/group/bld.inf"
#include "../mtptransports/mtpbttransport/group/bld.inf"
#include "../mtpdataproviders/mtpmetadatadp/group/bld.inf"
@@ -34,6 +34,8 @@
#include "../mtpdataproviders/mtppictbridgedp/group/bld.inf"
#include "../mtpdataproviders/mtpimagedp/group/bld.inf"
+#include "../mtpdataproviders/mtpplaybackcontroldp/group/bld.inf"
+
#ifdef FF_MTP_CONTROLLER
#include "../mtptransports/mtpcontroller/group/bld.inf"
#endif//FF_MTP_CONTROLLER
--- a/layers.sysdef.xml Fri Jun 11 14:27:06 2010 +0300
+++ b/layers.sysdef.xml Tue Jul 06 15:13:34 2010 +0300
@@ -67,6 +67,10 @@
<module name="MTP PictBridge Data Provider">
<unit name="MTP_Pic_Bri" unitID="smw.mtpdps.mtppicbri" bldFile="sf\mw\remoteconn\mtpdataproviders\mtppictbridgedp\group" mrp="sf\mw\remoteconn\mtpdataproviders\mtppictbridgedp\group\mtp_pictbridgedp.mrp"/>
</module>
+
+ <module name="MTP Playback Control Data Provider">
+ <unit name="MTP_PbcDP" unitID="smw.mtpdps.mtpplaybackcontrol" bldFile="sf\mw\remoteconn\mtpdataproviders\mtpplaybackcontroldp\group" mrp="sf\mw\remoteconn\mtpdataproviders\mtpplaybackcontroldp\group\mtp_playbackcontroldp.mrp"/>
+ </module>
<module name="MTP Image Data Provider">
<unit name="MTP_ImageDP" unitID="smw.mtptsp.mtpimagedp" bldFile="sf\mw\remoteconn\mtpdataproviders\mtpimagedp\group" mrp="sf\mw\remoteconn\mtpdataproviders\mtpimagedp\group\mtp_imagedp.mrp"/>
--- a/localconnectivityservice/dun/atext/bwins/dunatextu.def Fri Jun 11 14:27:06 2010 +0300
+++ b/localconnectivityservice/dun/atext/bwins/dunatextu.def Tue Jul 06 15:13:34 2010 +0300
@@ -1,12 +1,11 @@
EXPORTS
- ?StopUrc@CDunAtCmdHandler@@QAEHXZ @ 1 NONAME ; int CDunAtCmdHandler::StopUrc(void)
- ?Stop@CDunAtCmdHandler@@QAEHXZ @ 2 NONAME ; int CDunAtCmdHandler::Stop(void)
- ?SetEndOfCmdLine@CDunAtCmdHandler@@QAEXH@Z @ 3 NONAME ; void CDunAtCmdHandler::SetEndOfCmdLine(int)
- ?ResetData@CDunAtCmdHandler@@QAEXXZ @ 4 NONAME ; void CDunAtCmdHandler::ResetData(void)
- ?AddCmdModeCallback@CDunAtCmdHandler@@QAEHPAVMDunCmdModeMonitor@@@Z @ 5 NONAME ; int CDunAtCmdHandler::AddCmdModeCallback(class MDunCmdModeMonitor *)
- ?NewL@CDunAtCmdHandler@@SAPAV1@PAVMDunAtCmdStatusReporter@@PAVMDunStreamManipulator@@PBVTDesC8@@@Z @ 6 NONAME ; class CDunAtCmdHandler * CDunAtCmdHandler::NewL(class MDunAtCmdStatusReporter *, class MDunStreamManipulator *, class TDesC8 const *)
- ?ParseCommand@CDunAtCmdHandler@@QAEHAAVTDesC8@@AAH@Z @ 7 NONAME ; int CDunAtCmdHandler::ParseCommand(class TDesC8 &, int &)
- ?StartUrc@CDunAtCmdHandler@@QAEHXZ @ 8 NONAME ; int CDunAtCmdHandler::StartUrc(void)
- ?ManageAbortRequest@CDunAtCmdHandler@@QAEHXZ @ 9 NONAME ; int CDunAtCmdHandler::ManageAbortRequest(void)
- ?SendEchoCharacter@CDunAtCmdHandler@@QAEHPBVTDesC8@@PAVMDunAtCmdEchoer@@@Z @ 10 NONAME ; int CDunAtCmdHandler::SendEchoCharacter(class TDesC8 const *, class MDunAtCmdEchoer *)
+ ?AddCmdModeCallback@CDunAtCmdHandler@@QAEHPAVMDunCmdModeMonitor@@@Z @ 1 NONAME ; int CDunAtCmdHandler::AddCmdModeCallback(class MDunCmdModeMonitor *)
+ ?AddDataForParsing@CDunAtCmdHandler@@QAEHAAVTDesC8@@AAH@Z @ 2 NONAME ; int CDunAtCmdHandler::AddDataForParsing(class TDesC8 &, int &)
+ ?ManageAbortRequest@CDunAtCmdHandler@@QAEHXZ @ 3 NONAME ; int CDunAtCmdHandler::ManageAbortRequest(void)
+ ?NewL@CDunAtCmdHandler@@SAPAV1@PAVMDunAtCmdStatusReporter@@PAVMDunStreamManipulator@@PBVTDesC8@@@Z @ 4 NONAME ; class CDunAtCmdHandler * CDunAtCmdHandler::NewL(class MDunAtCmdStatusReporter *, class MDunStreamManipulator *, class TDesC8 const *)
+ ?ResetData@CDunAtCmdHandler@@QAEXXZ @ 5 NONAME ; void CDunAtCmdHandler::ResetData(void)
+ ?SendEchoCharacter@CDunAtCmdHandler@@QAEHPBVTDesC8@@PAVMDunAtCmdEchoer@@@Z @ 6 NONAME ; int CDunAtCmdHandler::SendEchoCharacter(class TDesC8 const *, class MDunAtCmdEchoer *)
+ ?StartUrc@CDunAtCmdHandler@@QAEHXZ @ 7 NONAME ; int CDunAtCmdHandler::StartUrc(void)
+ ?Stop@CDunAtCmdHandler@@QAEHXZ @ 8 NONAME ; int CDunAtCmdHandler::Stop(void)
+ ?StopUrc@CDunAtCmdHandler@@QAEHXZ @ 9 NONAME ; int CDunAtCmdHandler::StopUrc(void)
--- a/localconnectivityservice/dun/atext/eabi/dunatextu.def Fri Jun 11 14:27:06 2010 +0300
+++ b/localconnectivityservice/dun/atext/eabi/dunatextu.def Tue Jul 06 15:13:34 2010 +0300
@@ -1,12 +1,11 @@
EXPORTS
- _ZN16CDunAtCmdHandler12ParseCommandER6TDesC8Ri @ 1 NONAME
- _ZN16CDunAtCmdHandler15SetEndOfCmdLineEi @ 2 NONAME
+ _ZN16CDunAtCmdHandler17AddDataForParsingER6TDesC8Ri @ 1 NONAME
+ _ZN16CDunAtCmdHandler17SendEchoCharacterEPK6TDesC8P15MDunAtCmdEchoer @ 2 NONAME
_ZN16CDunAtCmdHandler18AddCmdModeCallbackEP18MDunCmdModeMonitor @ 3 NONAME
- _ZN16CDunAtCmdHandler4NewLEP23MDunAtCmdStatusReporterP21MDunStreamManipulatorPK6TDesC8 @ 4 NONAME
- _ZN16CDunAtCmdHandler4StopEv @ 5 NONAME
- _ZN16CDunAtCmdHandler7StopUrcEv @ 6 NONAME
- _ZN16CDunAtCmdHandler8StartUrcEv @ 7 NONAME
- _ZN16CDunAtCmdHandler9ResetDataEv @ 8 NONAME
- _ZN16CDunAtCmdHandler18ManageAbortRequestEv @ 9 NONAME
- _ZN16CDunAtCmdHandler17SendEchoCharacterEPK6TDesC8P15MDunAtCmdEchoer @ 10 NONAME
+ _ZN16CDunAtCmdHandler18ManageAbortRequestEv @ 4 NONAME
+ _ZN16CDunAtCmdHandler4NewLEP23MDunAtCmdStatusReporterP21MDunStreamManipulatorPK6TDesC8 @ 5 NONAME
+ _ZN16CDunAtCmdHandler4StopEv @ 6 NONAME
+ _ZN16CDunAtCmdHandler7StopUrcEv @ 7 NONAME
+ _ZN16CDunAtCmdHandler8StartUrcEv @ 8 NONAME
+ _ZN16CDunAtCmdHandler9ResetDataEv @ 9 NONAME
--- a/localconnectivityservice/dun/atext/inc/DunAtCmdEchoer.h Fri Jun 11 14:27:06 2010 +0300
+++ b/localconnectivityservice/dun/atext/inc/DunAtCmdEchoer.h Tue Jul 06 15:13:34 2010 +0300
@@ -105,7 +105,7 @@
* From MDunCompletionReporter.
* Gets called when data push is complete
*
- * @since S60 5.0
+ * @since TB9.2
* @param aAllPushed ETrue if all in the queue were pushed, EFalse otherwise
* @return None
*/
--- a/localconnectivityservice/dun/atext/inc/DunAtCmdHandler.h Fri Jun 11 14:27:06 2010 +0300
+++ b/localconnectivityservice/dun/atext/inc/DunAtCmdHandler.h Tue Jul 06 15:13:34 2010 +0300
@@ -32,7 +32,7 @@
const TInt KDunChSetMaxCharLen = 1; // Only ASCII supported for now
const TInt KDunOkBufLength = 1+1+2+1+1; // <CR>+<LF>+"OK"+<CR>+<LF>
const TInt KDunErrorBufLength = 1+1+5+1+1; // <CR>+<LF>+"ERROR"+<CR>+<LF>
-const TInt KDunInputBufLength = (512 + 1); // 512 chars for command + <CR>
+const TInt KDunLineBufLength = (512 + 1); // 512 chars for command + <CR>
const TInt KDunEscBufLength = 1; // Escape (0x1B) character
class CDunAtUrcHandler;
@@ -43,7 +43,7 @@
* Class used for storing information related to string conversion and parsing
*
* @lib dunatext.lib
- * @since S60 v3.2
+ * @since TB9.2
*/
NONSHARABLE_CLASS( TDunParseInfo )
{
@@ -51,9 +51,10 @@
public:
/**
- * Buffer for sending
+ * Buffer for sending to ATEXT (one command)
+ * (length is part of KDunLineBufLength)
*/
- TBuf8<KDunInputBufLength> iSendBuffer;
+ TBuf8<KDunLineBufLength> iSendBuffer;
/**
* Conversion limit for upper case conversion.
@@ -68,7 +69,7 @@
* Class used for AT command decoding related functionality
*
* @lib dunatext.lib
- * @since S60 v5.0
+ * @since TB9.2
*/
NONSHARABLE_CLASS( TDunDecodeInfo )
{
@@ -81,12 +82,12 @@
TBool iFirstDecode;
/**
- * Index in iInputBuffer for decoding to iDecodeBuffer
+ * Index in iLineBuffer for decoding to iSendBuffer
*/
TInt iDecodeIndex;
/**
- * Index in iInputBuffer for extended character position
+ * Index in iLineBuffer for extended character position
*/
TInt iExtendedIndex;
@@ -106,7 +107,7 @@
TBool iAssignFound;
/**
- * Flag to indicate if processing inside quotes
+ * Flag to indicate if processing inside quotes
*/
TBool iInQuotes;
@@ -114,11 +115,11 @@
* Flag to indicate if special subcommand found
*/
TBool iSpecialFound;
-
+
/**
- * Buffer for parsing
+ * Number of commands handled (for debugging purposes)
*/
- TBuf8<KDunInputBufLength> iDecodeBuffer;
+ TBool iCmdsHandled;
};
@@ -140,7 +141,7 @@
/**
* AT command decoding related information for peeked data
- * (not to be used if HandleNextDecodedCommand() returns EFalse)
+ * (not to be used if HandleNextSubCommand() returns EFalse)
*/
TDunDecodeInfo iPeekInfo;
@@ -150,7 +151,7 @@
* Notification interface class for command mode start/end
*
* @lib dunutils.lib
- * @since S60 v5.0
+ * @since TB9.2
*/
NONSHARABLE_CLASS( MDunCmdModeMonitor )
{
@@ -160,7 +161,7 @@
/**
* Notifies about command mode start
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
virtual void NotifyCommandModeStart() = 0;
@@ -168,7 +169,7 @@
/**
* Notifies about command mode end
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
virtual void NotifyCommandModeEnd() = 0;
@@ -179,7 +180,7 @@
* Notification interface class for status changes in AT command handling
*
* @lib dunatext.lib
- * @since S60 v5.0
+ * @since TB9.2
*/
NONSHARABLE_CLASS( MDunAtCmdStatusReporter )
{
@@ -187,21 +188,12 @@
public:
/**
- * Notifies about AT command handling start
+ * Notifies about parser's need to get more data
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
- virtual void NotifyAtCmdHandlingStart() = 0;
-
- /**
- * Notifies about AT command handling end
- *
- * @since S60 5.0
- * @param aEndIndex Index to the start of next command
- * @return None
- */
- virtual void NotifyAtCmdHandlingEnd( TInt aStartIndex ) = 0;
+ virtual void NotifyParserNeedsMoreData() = 0;
/**
* Notifies about editor mode reply
@@ -218,7 +210,7 @@
* Class for AT command handler and notifier
*
* @lib dunatext.lib
- * @since S60 v5.0
+ * @since TB9.2
*/
NONSHARABLE_CLASS( CDunAtCmdHandler ) : public CBase,
public MDunAtCmdPusher,
@@ -248,7 +240,7 @@
/**
* Resets data to initial values
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
IMPORT_C void ResetData();
@@ -257,41 +249,31 @@
* Adds callback for command mode notification
* The callback will be called when command mode starts or ends
*
- * @since S60 5.0
+ * @since TB9.2
* @param aCallback Callback to call when command mode starts or ends
* @return Symbian error code on error, KErrNone otherwise
*/
IMPORT_C TInt AddCmdModeCallback( MDunCmdModeMonitor* aCallback );
/**
- * Parses an AT command
+ * Adds data for parsing and parses if necessary
*
- * @since S60 5.0
- * @param aCommand Command to parse
- * @param aPartialInput ETrue if partial input, EFalse otherwise
+ * @since TB9.2
+ * @param aInput Data to add for parsing
+ * @param aMoreNeeded ETrue if more data needed, EFalse otherwise
* @return Symbian error code on error, KErrNone otherwise
*/
- IMPORT_C TInt ParseCommand( TDesC8& aCommand, TBool& aPartialInput );
+ IMPORT_C TInt AddDataForParsing( TDesC8& aInput, TBool& aMoreNeeded );
/**
* Manages request to abort command handling
*
- * @since S60 5.0
+ * @since TB9.2
* @return Symbian error code on error, KErrNone otherwise
*/
IMPORT_C TInt ManageAbortRequest();
/**
- * Sets end of command line marker on for the possible series of AT
- * commands.
- *
- * @since S60 5.0
- * @param aClearInput ETrue to clear input buffer, EFalse otherwise
- * @return None
- */
- IMPORT_C void SetEndOfCmdLine( TBool aClearInput );
-
- /**
* Sends a character to be echoed
*
* @since TB9.2
@@ -305,7 +287,7 @@
/**
* Stops sending of AT command from decode buffer
*
- * @since S60 3.2
+ * @since TB9.2
* @return Symbian error code on error, KErrNone otherwise
*/
IMPORT_C TInt Stop();
@@ -313,7 +295,7 @@
/**
* Starts URC message handling
*
- * @since S60 5.0
+ * @since TB9.2
* @return Symbian error code on error, KErrNone otherwise
*/
IMPORT_C TInt StartUrc();
@@ -321,7 +303,7 @@
/**
* Stops URC message handling
*
- * @since S60 3.2
+ * @since TB9.2
* @return Symbian error code on error, KErrNone otherwise
*/
IMPORT_C TInt StopUrc();
@@ -337,7 +319,7 @@
/**
* Initializes this class
*
- * @since S60 3.2
+ * @since TB9.2
* @return None
*/
void Initialize();
@@ -345,7 +327,7 @@
/**
* Creates plugin handlers for this class
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
void CreatePluginHandlersL();
@@ -353,7 +335,7 @@
/**
* Creates the array of special commands
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
void CreateSpecialCommandsL();
@@ -362,7 +344,7 @@
* Recreates special command data.
* This is done when a plugin is installed or uninstalled.
*
- * @since S60 5.0
+ * @since TB9.2
* @return Symbian error code on error, KErrNone otherwise
*/
TInt RecreateSpecialCommands();
@@ -370,7 +352,7 @@
/**
* Gets default settings from RATExtCommon and sets them to RATExt
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
void GetAndSetDefaultSettingsL();
@@ -378,7 +360,7 @@
/**
* Regenerates the reply strings based on settings
*
- * @since S60 5.0
+ * @since TB9.2
* @return ETrue if quiet mode, EFalse otherwise
*/
TBool RegenerateReplyStrings();
@@ -386,7 +368,7 @@
/**
* Regenerates the ok reply based on settings
*
- * @since S60 5.0
+ * @since TB9.2
* @return ETrue if quiet mode, EFalse otherwise
*/
TBool RegenerateOkReply();
@@ -394,7 +376,7 @@
/**
* Regenerates the error reply based on settings
*
- * @since S60 5.0
+ * @since TB9.2
* @return ETrue if quiet mode, EFalse otherwise
*/
TBool RegenerateErrorReply();
@@ -402,7 +384,7 @@
/**
* Gets current mode
*
- * @since S60 5.0
+ * @since TB9.2
* @param aMask Mask for current mode (only one supported)
* @return New current mode
*/
@@ -412,7 +394,7 @@
* Instantiates one URC message handling class instance and adds it to
* the URC message handler array
*
- * @since S60 3.2
+ * @since TB9.2
* @return None
*/
CDunAtUrcHandler* AddOneUrcHandlerL();
@@ -420,7 +402,7 @@
/**
* Deletes all instantiated URC message handlers
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
void DeletePluginHandlers();
@@ -428,86 +410,131 @@
/**
* Manages partial AT command
*
- * @since S60 5.0
- * @param aCommand Command to process
- * @param aNeedsCarriage ETrue if full and non-consumed AT command needs
- * carriage return (AT command "A/")
- * @return ETrue if no other processing needed, EFalse otherwise
+ * @since TB9.2
+ * @return ETrue if more data needed, EFalse otherwise
*/
- TBool ManagePartialCommand( TDesC8& aCommand,
- TBool& aNeedsCarriage );
+ TBool ManagePartialCommand();
/**
* Echoes a command if echo is on
*
- * @since S60 5.0
- * @param aDes String descriptor
+ * @since TB9.2
* @return ETrue if echo push started, EFalse otherwise
*/
- TBool EchoCommand( TDesC8& aDes );
+ TBool EchoCommand();
/**
* Handles backspace and cancel characters
*
- * @since S60 5.0
- * @param aCommand Command to process
+ * @since TB9.2
* @return ETrue if special character found, EFalse otherwise
*/
- TBool HandleSpecialCharacters( TDesC8& aCommand );
+ TBool HandleSpecialCharacters();
+
+ /**
+ * Extracts line from input buffer to line buffer
+ *
+ * @since TB9.2
+ * @return ETrue if more data needed, EFalse otherwise
+ */
+ TBool ExtractLineFromInputBuffer();
+
+ /**
+ * Handles generic buffer management
+ * (explanation in ExtractLineFromInputBuffer())
+ *
+ * @since TB9.2
+ * @param aStartIndex Start index for buffer to be copied
+ * @param aCopyLength Length for data needed to be copied
+ * @param aCopyNeeded ETrue if buffer copy needed
+ * @return ETrue if more data needed, EFalse otherwise
+ */
+ TBool HandleGenericBufferManagement( TInt& aStartIndex,
+ TInt& aCopyLength,
+ TBool& aCopyNeeded );
+
+ /**
+ * Handles special buffer management
+ * (explanation in ExtractLineFromInputBuffer())
+ *
+ * @since TB9.2
+ * @param aStartIndex Start index for buffer to be copied
+ * @param aCopyLength Length for data needed to be copied
+ * @param aCopyNeeded ETrue if buffer copy needed
+ * @return ETrue if more data needed, EFalse otherwise
+ */
+ TBool HandleSpecialBufferManagement( TInt aStartIndex,
+ TInt& aCopyLength,
+ TBool& aCopyNeeded );
/**
- * Appends command to input buffer
+ * Skips end-of-line characters
+ *
+ * @since TB9.2
+ * @param aStartIndex Start index
+ * @return Index to end of non-end-of-line or Symbian error code on error
+ */
+ TInt SkipEndOfLineCharacters( TInt aStartIndex );
+
+ /**
+ * Skips subcommand delimiter characters
*
- * @since S60 5.0
- * @param aCommand Command to append to input buffer
- * @param aEndFound ETrue if end (carriage return) was found
- * @return ETrue if overflow was found, EFalse otherwise
+ * @since TB9.2
+ * @param aStartIndex Start index
+ * @return Index to end of delimiter or Symbian error code on error
*/
- TBool AppendCommandToInputBuffer( TDesC8& aCommand, TBool& aEndFound );
+ TInt SkipSubCommandDelimiterCharacters( TInt aStartIndex );
+
+ /**
+ * Finds the end of the line
+ *
+ * @since TB9.2
+ * @param aStartIndex Start index
+ * @return Index to end of line or Symbian error code on error
+ */
+ TInt FindEndOfLine( TInt aStartIndex );
/**
- * Handles next decoded command from input buffer
+ * Handles next subcommand from line buffer
*
- * @since S60 5.0
+ * @since TB9.2
* @return ETrue if last command decoded, EFalse otherwise
*/
- TBool HandleNextDecodedCommand();
+ TBool HandleNextSubCommand();
/**
- * Finds the start of the next command
+ * Manages end of AT command handling
+ *
+ * @since TB9.2
+ * @param aNotifyLocal Notify local parties
+ * @param aNotifyExternal Notify external parties
+ * @return None
+ */
+ void ManageEndOfCmdHandling( TBool aNotifyLocal,
+ TBool aNotifyExternal );
+
+ /**
+ * Extracts next subcommand from line buffer to send buffer
+ *
+ * @since TB9.2
+ * @param aPeek Peek for the next command if ETrue, EFalse otherwise
+ * @return ETrue if command extracted, EFalse otherwise
+ */
+ TBool ExtractNextSubCommand( TBool aPeek=EFalse );
+
+ /**
+ * Finds the start of subcommand from line buffer
*
* @since TB9.2
* @return Index to the next command or Symbian error code on error
*/
- TInt FindStartOfNextCommand();
+ TInt FindStartOfSubCommand();
/**
- * Manages end of AT command handling
- *
- * @since S60 5.0
- * @param aNotifyExternal Notify external parties
- * @param aNotifyLocal Notify local parties
- * @param aClearInput ETrue to clear input buffer, EFalse otherwise
- * @return None
- */
- void ManageEndOfCmdHandling( TBool aNotifyExternal,
- TBool aNotifyLocal,
- TBool aClearInput );
-
- /**
- * Extracts next decoded command from input buffer to decode buffer
- *
- * @since S60 5.0
- * @param aPeek Peek for the next command if ETrue, EFalse otherwise
- * @return ETrue if command extracted, EFalse otherwise
- */
- TBool ExtractNextDecodedCommand( TBool aPeek=EFalse );
-
- /**
- * Restores old decode info. For ExtractNextDecodedCommand() when aPeeks is
+ * Restores old decode info. For ExtractNextSubCommand() when aPeeks is
* ETrue.
*
- * @since S60 5.0
+ * @since TB9.2
* @param aPeek Peek for the next command if ETrue, EFalse otherwise
* @param aOldInfo Old information to restore when aPeek is ETrue
* @return None
@@ -515,39 +542,18 @@
void RestoreOldDecodeInfo( TBool aPeek, TDunDecodeInfo& aOldInfo );
/**
- * Finds end of an AT command
+ * Tests for end of AT command line
*
- * @since S60 5.0
- * @param aDes String descriptor
- * @param aStartIndex Start index for search
- * @return Index if found, KErrNotFound otherwise
- */
- TInt FindEndOfCommand( TDesC8& aDes, TInt aStartIndex=0 );
-
- /**
- * Tests for end of AT command character
- *
- * @since S60 5.0
+ * @since TB9.2
* @param aCharacter Character to test
* @return ETrue if end of command, EFalse otherwise
*/
- TBool IsEndOfCommand( TChar& aCharacter );
-
- /**
- * Finds start of a decoded AT command
- *
- * @since S60 5.0
- * @param aDes String descriptor
- * @param aStartIndex Start index for search
- * @return Index if found, KErrNotFound otherwise
- */
- TInt FindStartOfDecodedCommand( TDesC8& aDes,
- TInt aStartIndex );
+ TBool IsEndOfLine( TChar& aCharacter );
/**
* Checks if character is delimiter character
*
- * @since S60 5.0
+ * @since TB9.2
* @param aCharacter Character to test
* @return ETrue if delimiter character, EFalse otherwise
*/
@@ -556,7 +562,7 @@
/**
* Checks if character is of extended group
*
- * @since S60 5.0
+ * @since TB9.2
* @param aCharacter Character to test
* @return ETrue if extended character, EFalse otherwise
*/
@@ -565,13 +571,11 @@
/**
* Checks special command
*
- * @since S60 5.0
- * @param aStartIndex Start index (doesn't change)
+ * @since TB9.2
* @param aEndIndex End index (changes)
* @return Symbian error code on error, KErrNone otherwise
*/
- TBool CheckSpecialCommand( TInt aStartIndex,
- TInt& aEndIndex );
+ TBool CheckSpecialCommand( TInt& aEndIndex );
/**
* Saves character decode state for a found character
@@ -584,7 +588,7 @@
*/
void SaveFoundCharDecodeState( TChar aCharacter,
TBool aAddSpecial=ETrue );
-
+
/**
* Saves character decode state for a not found character
*
@@ -616,7 +620,7 @@
* @return ETrue if in next command's extended border, EFalse otherwise
*/
TBool IsExtendedBorder( TChar aCharacter, TInt aStartIndex, TInt& aEndIndex );
-
+
/**
* Finds subcommand with alphanumeric borders
*
@@ -631,16 +635,15 @@
* Finds subcommand
*
* @since TB9.2
- * @param aStartIndex Start index (doesn't change)
* @param aEndIndex End index (changes)
* @return Symbian error code on error, KErrNone otherwise
*/
- TInt FindSubCommand( TInt aStartIndex, TInt& aEndIndex );
+ TInt FindSubCommand( TInt& aEndIndex );
/**
* Check if "A/" command
*
- * @since S60 5.0
+ * @since TB9.2
* @return ETrue if "A/" command, EFalse otherwise
*/
TBool IsASlashCommand();
@@ -648,24 +651,15 @@
/**
* Handles "A/" command
*
- * @since S60 5.0
+ * @since TB9.2
* @return ETrue if error reply push started, EFalse otherwise
*/
TBool HandleASlashCommand();
/**
- * Resets parse buffers
- *
- * @since S60 5.0
- * @param aClearInput ETrue to clear input buffer, EFalse otherwise
- * @return None
- */
- void ResetParseBuffers( TBool aClearInput=ETrue );
-
- /**
* Manages command mode change
*
- * @since S60 5.0
+ * @since TB9.2
* @param aMode Mode to manage
* @return ETrue if command mode change detected, EFalse otherwise
*/
@@ -674,7 +668,7 @@
/**
* Reports command mode start/end change
*
- * @since S60 3.2
+ * @since TB9.2
* @param aStart Command mode start if ETrue, end otherwise
* @return None
*/
@@ -683,7 +677,7 @@
/**
* Manages echo mode change
*
- * @since S60 5.0
+ * @since TB9.2
* @param aMode Mode to manage
* @return ETrue if echo mode change detected, EFalse otherwise
*/
@@ -692,7 +686,7 @@
/**
* Manages quiet mode change
*
- * @since S60 5.0
+ * @since TB9.2
* @param aMode Mode to manage
* @return ETrue if quiet mode change detected, EFalse otherwise
*/
@@ -701,7 +695,7 @@
/**
* Manages verbose mode change
*
- * @since S60 5.0
+ * @since TB9.2
* @param aMode Mode to manage
* @return ETrue if verbose mode change detected, EFalse otherwise
*/
@@ -710,7 +704,7 @@
/**
* Manages character change
*
- * @since S60 5.0
+ * @since TB9.2
* @param aMode Mode to manage
* @return None
*/
@@ -742,7 +736,7 @@
* This is after all reply data for an AT command is multiplexed to the
* downstream.
*
- * @since S60 5.0
+ * @since TB9.2
* @param aError Error code of command processing completion
* @return None
*/
@@ -752,15 +746,15 @@
* Notifies about request to stop AT command handling for the rest of the
* command line data
*
- * @since S60 5.0
- * @return Symbian error code on error, KErrNone otherwise
+ * @since TB9.2
+ * @return None
*/
- TInt NotifyEndOfCmdLineProcessing();
+ void NotifyEndOfCmdLineProcessing();
/**
* Notifies about request to peek for the next command
*
- * @since S60 5.0
+ * @since TB9.2
* @return ETrue if next command exists, EFalse otherwise
*/
TBool NotifyNextCommandPeekRequest();
@@ -789,7 +783,7 @@
* From MDunAtEcomListen.
* Notifies about new plugin installation
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
TInt NotifyPluginInstallation( TUid& aPluginUid );
@@ -798,7 +792,7 @@
* From MDunAtEcomListen.
* Notifies about existing plugin uninstallation
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
TInt NotifyPluginUninstallation( TUid& aPluginUid );
@@ -809,7 +803,7 @@
* From MDunAtModeListen.
* Gets called on mode status change
*
- * @since S60 5.0
+ * @since TB9.2
* @param aMode Mode to manage
* @return Symbian error code on error, KErrNone otherwise
*/
@@ -861,10 +855,10 @@
TInt8 iBackspace;
/**
- * Current command to ParseCommand()
+ * Current input to AddDataForParsing()
* Not own.
*/
- TDesC8* iCommand;
+ TDesC8* iInput;
/**
* Special commands for parsing
@@ -887,14 +881,14 @@
TBuf8<KDunErrorBufLength> iErrorBuffer;
/**
- * Buffer for AT command input
+ * Buffer for AT command (one line)
*/
- TBuf8<KDunInputBufLength> iInputBuffer;
+ TBuf8<KDunLineBufLength> iLineBuffer;
/**
* Buffer for last AT command input (for "A/")
*/
- TBuf8<KDunInputBufLength> iLastBuffer;
+ TBuf8<KDunLineBufLength> iLastBuffer;
/**
* Buffer for <ESC> command
@@ -973,7 +967,7 @@
TBool iVerboseOn;
/**
- * End index for command delimiter
+ * End index for not added data in iCommand
*/
TInt iEndIndex;
--- a/localconnectivityservice/dun/atext/inc/DunAtCmdPusher.h Fri Jun 11 14:27:06 2010 +0300
+++ b/localconnectivityservice/dun/atext/inc/DunAtCmdPusher.h Tue Jul 06 15:13:34 2010 +0300
@@ -28,7 +28,7 @@
* Notification interface class for data pushing status changes
*
* @lib dunatext.lib
- * @since S60 v5.0
+ * @since TB9.2
*/
NONSHARABLE_CLASS( MDunAtCmdPusher )
{
@@ -40,7 +40,7 @@
* This is after all reply data for an AT command is multiplexed to the
* downstream.
*
- * @since S60 5.0
+ * @since TB9.2
* @param aError Error code of command processing completion
* @return Symbian error code on error, KErrNone otherwise
*/
@@ -50,15 +50,15 @@
* Notifies about request to stop AT command handling for the rest of the
* command line data
*
- * @since S60 5.0
+ * @since TB9.2
* @return Symbian error code on error, KErrNone otherwise
*/
- virtual TInt NotifyEndOfCmdLineProcessing() = 0;
+ virtual void NotifyEndOfCmdLineProcessing() = 0;
/**
* Notifies about request to peek for the next command
*
- * @since S60 5.0
+ * @since TB9.2
* @return ETrue if next command exists, EFalse otherwise
*/
virtual TBool NotifyNextCommandPeekRequest() = 0;
@@ -77,7 +77,7 @@
* Class for AT command URC handler
*
* @lib dunatext.lib
- * @since S60 v5.0
+ * @since TB9.2
*/
NONSHARABLE_CLASS( CDunAtCmdPusher ) : public CActive,
public MDunCompletionReporter
@@ -119,7 +119,7 @@
/**
* Resets data to initial values
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
void ResetData();
@@ -127,17 +127,17 @@
/**
* Starts AT command handling
*
- * @since S60 5.0
- * @param aCommand AT command or editor mode input to handle
+ * @since TB9.2
+ * @param aInput AT command or editor mode input to handle
* @param aNormalMode ETrue if request issue for normal mode
* @return Symbian error code on error, KErrNone otherwise
*/
- TInt IssueRequest( TDesC8& aCommand, TBool aNormalMode=ETrue );
+ TInt IssueRequest( TDesC8& aInput, TBool aNormalMode=ETrue );
/**
* Stops AT command handling
*
- * @since S60 5.0
+ * @since TB9.2
* @return Symbian error code on error, KErrNone otherwise
*/
TInt Stop();
@@ -145,7 +145,7 @@
/**
* Manages request to abort command handling
*
- * @since S60 5.0
+ * @since TB9.2
* @return Symbian error code on error, KErrNone otherwise
*/
TInt ManageAbortRequest();
@@ -154,7 +154,7 @@
* Sets end of command line marker on for the possible series of AT
* commands.
*
- * @since S60 5.0
+ * @since TB9.2
* @param aPushLast ETrue to push last reply, EFalse otherwise
* @return None
*/
@@ -180,7 +180,7 @@
/**
* Initializes this class
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
void Initialize();
@@ -188,7 +188,7 @@
/**
* Sets state to idle and notifies about subcommand handling completion
*
- * @since S60 5.0
+ * @since TB9.2
* @param aError Error code for completion
* @return None
*/
@@ -198,7 +198,7 @@
* Checks if "OK" (verbose) or "0" (numeric) string or exists at the end of
* buffer and removes it
*
- * @since S60 5.0
+ * @since TB9.2
* @return Symbian error code on error, KErrNone otherwise
*/
TInt CheckAndRemoveOkString();
@@ -206,7 +206,7 @@
/**
* Sends reply data to downstream
*
- * @since S60 5.0
+ * @since TB9.2
* @param aRecvBuffer ETrue if using receive buffer
* EFalse if using "OK" buffer
* @return None
@@ -248,7 +248,7 @@
/**
* Manages change in reply type
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
void ManageReplyTypeChange();
@@ -259,7 +259,7 @@
* From CActive.
* Gets called when AT command handled
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
void RunL();
@@ -268,7 +268,7 @@
* From CActive.
* Gets called on cancel
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
void DoCancel();
@@ -279,7 +279,7 @@
* From MDunCompletionReporter.
* Gets called when data push is complete
*
- * @since S60 5.0
+ * @since TB9.2
* @param aAllPushed ETrue if all in the queue were pushed, EFalse otherwise
* @return None
*/
--- a/localconnectivityservice/dun/atext/inc/DunAtEcomListen.h Fri Jun 11 14:27:06 2010 +0300
+++ b/localconnectivityservice/dun/atext/inc/DunAtEcomListen.h Tue Jul 06 15:13:34 2010 +0300
@@ -26,7 +26,7 @@
* Notification interface class for ECOM plugin interface status changes
*
* @lib dunatext.lib
- * @since S60 v5.0
+ * @since TB9.2
*/
NONSHARABLE_CLASS( MDunAtEcomListen )
{
@@ -36,7 +36,7 @@
/**
* Notifies about new plugin installation
*
- * @since S60 5.0
+ * @since TB9.2
* @param aPluginUid UID of installed plugin
* @return Symbian error code on error, KErrNone otherwise
*/
@@ -45,7 +45,7 @@
/**
* Notifies about existing plugin uninstallation
*
- * @since S60 5.0
+ * @since TB9.2
* @param aPluginUid UID of uninstalled plugin
* @return Symbian error code on error, KErrNone otherwise
*/
@@ -57,7 +57,7 @@
* Class for ECom plugin install/uninstall/version listener
*
* @lib dunatext.lib
- * @since S60 v5.0
+ * @since TB9.2
*/
NONSHARABLE_CLASS( CDunAtEcomListen ) : public CActive
{
@@ -81,7 +81,7 @@
*/
static CDunAtEcomListen* NewLC( RATExt* aAtCmdExt,
MDunAtEcomListen* aCallback );
-
+
/**
* Destructor.
*/
@@ -90,7 +90,7 @@
/**
* Resets data to initial values
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
void ResetData();
@@ -98,7 +98,7 @@
/**
* Starts waiting for ECom plugin install/uninstall/version status changes
*
- * @since S60 5.0
+ * @since TB9.2
* @return Symbian error code on error, KErrNone otherwise
*/
TInt IssueRequest();
@@ -106,7 +106,7 @@
/**
* Stops waiting for Ecom plugin install/uninstall/version status changes
*
- * @since S60 5.0
+ * @since TB9.2
* @return Symbian error code on error, KErrNone otherwise
*/
TInt Stop();
@@ -121,7 +121,7 @@
/**
* Initializes this class
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
void Initialize();
@@ -132,7 +132,7 @@
* From CActive.
* Gets called when plugin installed, uninstalled or changed
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
void RunL();
@@ -141,7 +141,7 @@
* From CActive.
* Gets called on cancel
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
void DoCancel();
--- a/localconnectivityservice/dun/atext/inc/DunAtModeListen.h Fri Jun 11 14:27:06 2010 +0300
+++ b/localconnectivityservice/dun/atext/inc/DunAtModeListen.h Tue Jul 06 15:13:34 2010 +0300
@@ -27,7 +27,7 @@
* Notification interface class for modem's mode listener
*
* @lib dunatext.lib
- * @since S60 v5.0
+ * @since TB9.2
*/
NONSHARABLE_CLASS( MDunAtModeListen )
{
@@ -37,7 +37,7 @@
/**
* Notifies about mode status change
*
- * @since S60 5.0
+ * @since TB9.2
* @param aMode Current modem modes
* @return Symbian error code on error, KErrNone otherwise
*/
@@ -49,7 +49,7 @@
* Class for modem's mode listener and notifier
*
* @lib dunatext.lib
- * @since S60 v5.0
+ * @since TB9.2
*/
NONSHARABLE_CLASS( CDunAtModeListen ) : public CActive
{
@@ -82,7 +82,7 @@
/**
* Resets data to initial values
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
void ResetData();
@@ -90,7 +90,7 @@
/**
* Issues request to start monitoring for mode status changes
*
- * @since S60 5.0
+ * @since TB9.2
* @return Symbian error code on error, KErrNone otherwise
*/
TInt IssueRequest();
@@ -98,7 +98,7 @@
/**
* Stops monitoring for mode status changes
*
- * @since S60 5.0
+ * @since TB9.2
* @return Symbian error code on error, KErrNone otherwise
*/
TInt Stop();
@@ -113,7 +113,7 @@
/**
* Initializes this class
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
void Initialize();
@@ -124,7 +124,7 @@
* From CActive.
* Gets called when mode changes
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
void RunL();
@@ -133,7 +133,7 @@
* From CActive.
* Gets called on cancel
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
void DoCancel();
--- a/localconnectivityservice/dun/atext/inc/DunAtNvramListen.h Fri Jun 11 14:27:06 2010 +0300
+++ b/localconnectivityservice/dun/atext/inc/DunAtNvramListen.h Tue Jul 06 15:13:34 2010 +0300
@@ -26,7 +26,7 @@
* Class for AT NVRAM status change listener
*
* @lib dunatext.lib
- * @since S60 v5.0
+ * @since TB9.2
*/
NONSHARABLE_CLASS( CDunAtNvramListen ) : public CActive
{
@@ -61,7 +61,7 @@
/**
* Resets data to initial values
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
void ResetData();
@@ -69,7 +69,7 @@
/**
* Starts waiting for NVRAM status changes
*
- * @since S60 5.0
+ * @since TB9.2
* @return Symbian error code on error, KErrNone otherwise
*/
TInt IssueRequest();
@@ -77,7 +77,7 @@
/**
* Stops waiting for NVRAM status changes
*
- * @since S60 5.0
+ * @since TB9.2
* @return Symbian error code on error, KErrNone otherwise
*/
TInt Stop();
@@ -92,7 +92,7 @@
/**
* Initializes this class
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
void Initialize();
@@ -103,7 +103,7 @@
* From CActive.
* Gets called when NVRAM has changed
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
void RunL();
@@ -112,7 +112,7 @@
* From CActive.
* Gets called on cancel
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
void DoCancel();
--- a/localconnectivityservice/dun/atext/inc/DunAtSpecialCmdHandler.h Fri Jun 11 14:27:06 2010 +0300
+++ b/localconnectivityservice/dun/atext/inc/DunAtSpecialCmdHandler.h Tue Jul 06 15:13:34 2010 +0300
@@ -21,7 +21,7 @@
#include <e32base.h>
#include <badesca.h>
-const TInt KInputBufLength = (512 + 1); // Set this the same as in KDunInputBufLength
+const TInt KLineBufLength = (512 + 1); // Set this the same as in KDunLineBufLength
/**
* Class for special AT command handler
@@ -98,7 +98,7 @@
/**
* Buffer for temporary AT command input
*/
- TBuf8<KInputBufLength> iBuffer;
+ TBuf8<KLineBufLength> iBuffer;
/**
* Special commands for parsing
--- a/localconnectivityservice/dun/atext/inc/DunAtUrcHandler.h Fri Jun 11 14:27:06 2010 +0300
+++ b/localconnectivityservice/dun/atext/inc/DunAtUrcHandler.h Tue Jul 06 15:13:34 2010 +0300
@@ -28,7 +28,7 @@
* Class for AT command URC handler
*
* @lib dunatext.lib
- * @since S60 v5.0
+ * @since TB9.2
*/
NONSHARABLE_CLASS( CDunAtUrcHandler ) : public CActive,
public MDunCompletionReporter
@@ -62,7 +62,7 @@
/**
* Resets data to initial values
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
void ResetData();
@@ -70,7 +70,7 @@
/**
* Starts waiting for an incoming URC message
*
- * @since S60 5.0
+ * @since TB9.2
* @return Symbian error code on error, KErrNone otherwise
*/
TInt IssueRequest();
@@ -78,7 +78,7 @@
/**
* Stops waiting for an incoming URC message
*
- * @since S60 5.0
+ * @since TB9.2
* @return Symbian error code on error, KErrNone otherwise
*/
TInt Stop();
@@ -86,7 +86,7 @@
/**
* UID of the owning plugin
*
- * @since S60 5.0
+ * @since TB9.2
* @return UID of the owning plugin
*/
TUid OwnerUid();
@@ -101,7 +101,7 @@
/**
* Initializes this class
*
- * @since S60 3.2
+ * @since TB9.2
* @return None
*/
void Initialize();
@@ -112,7 +112,7 @@
* From CActive.
* Gets called when URC command received
*
- * @since S60 3.2
+ * @since TB9.2
* @return None
*/
void RunL();
@@ -121,7 +121,7 @@
* From CActive.
* Gets called on cancel
*
- * @since S60 3.2
+ * @since TB9.2
* @return None
*/
void DoCancel();
@@ -132,7 +132,7 @@
* From MDunCompletionReporter.
* Gets called when data push is complete
*
- * @since S60 5.0
+ * @since TB9.2
* @param aAllPushed ETrue if all in the queue were pushed, EFalse otherwise
* @return None
*/
--- a/localconnectivityservice/dun/atext/src/DunAtCmdHandler.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/localconnectivityservice/dun/atext/src/DunAtCmdHandler.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -23,6 +23,24 @@
*/
/*
+ * This file has the following functionality:
+ * 1) Line buffer filler:
+ * AddDataForParsing(), ManagePartialCommand(), ExtractLineFromInputBuffer(),
+ * etc. This buffer is used for parsing. These functions are used for
+ * splitter-combiner logic described below. CDunAtCmdPusher is used
+ * separately for each element in the line buffer.
+ * 2) Parser and splitter-combiner to handle the separater elements (subcommands)
+ * in the line buffer. When end of line is detected, iEndIndex is used to
+ * extract the next line in iInput to the line buffer (ManageEndOfCmdHandling()
+ * and ExtractLineFromInputBuffer()).
+ * 3) When end of iEndIndex is found (ExtractLineFromInputBuffer()), more data
+ * is asked from CDunUpstream.
+ * Note: There is separate handling for "one character input data" and "A/"
+ * command handling which should be supported only for one line based data
+ * (ManagePartialCommand()).
+ */
+
+/*
* The AT command handling is splitted to two parts on high level:
* 1) Splitter: splitting the sub-commands in a command line to multiple ones
* for ATEXT to process.
@@ -30,6 +48,13 @@
* (the filter categories are explained in DunAtCmdPusher.cpp)
*/
+/*
+ * Note1: This file uses AT command parsing based on heuristics.
+ * Refer to test specification if planning to change the heuristic.
+ * Note2: Input buffer management (ExtractLineFromInputBuffer()) can be tested
+ * with non-line based terminals such as HyperTerminal or Realterm.
+ */
+
#include "DunAtCmdHandler.h"
#include "DunAtUrcHandler.h"
#include "DunDownstream.h"
@@ -139,39 +164,38 @@
}
// ---------------------------------------------------------------------------
-// Parses an AT command
+// Adds data for parsing and parses if necessary
// ---------------------------------------------------------------------------
//
-EXPORT_C TInt CDunAtCmdHandler::ParseCommand( TDesC8& aCommand,
- TBool& aPartialInput )
+EXPORT_C TInt CDunAtCmdHandler::AddDataForParsing( TDesC8& aInput,
+ TBool& aMoreNeeded )
{
- FTRACE(FPrint( _L("CDunAtCmdHandler::ParseCommand()") ));
- FTRACE(FPrint( _L("CDunAtCmdHandler::ParseCommand() received:") ));
- FTRACE(FPrintRaw(aCommand) );
+ FTRACE(FPrint( _L("CDunAtCmdHandler::AddDataForParsing()") ));
+ FTRACE(FPrint( _L("CDunAtCmdHandler::AddDataForParsing() received (%d bytes):"), aInput.Length() ));
+ FTRACE(FPrintRaw(aInput) );
TBool editorMode = iCmdPusher->EditorMode();
if ( editorMode )
{
- // Note: return here with "no partial input" and some error to fool
+ // Note: return here with "no more data needed" and some error to fool
// CDunUpstream into not reissuing the read request.
- iCmdPusher->IssueRequest( aCommand, EFalse );
- aPartialInput = EFalse;
+ iCmdPusher->IssueRequest( aInput, EFalse );
+ aMoreNeeded = EFalse;
return KErrGeneral;
}
- iCommand = &aCommand; // iCommand only for normal mode
+ iInput = &aInput; // iInput only for normal mode
// Manage partial AT command
- TBool needsCarriage = ETrue;
- TBool okToExit = ManagePartialCommand( aCommand, needsCarriage );
- if ( okToExit )
+ TBool moreNeeded = ManagePartialCommand();
+ if ( moreNeeded )
{
- FTRACE(FPrint( _L("CDunAtCmdHandler::ParseCommand() (ok to exit) complete") ));
- aPartialInput = ETrue;
+ aMoreNeeded = ETrue;
+ FTRACE(FPrint( _L("CDunAtCmdHandler::AddDataForParsing() (more partial) complete") ));
return KErrNone;
}
if ( iHandleState != EDunStateIdle )
{
- aPartialInput = EFalse;
- ResetParseBuffers();
- FTRACE(FPrint( _L("CDunAtCmdHandler::ParseCommand() (not ready) complete") ));
+ aMoreNeeded = EFalse;
+ ManageEndOfCmdHandling( EFalse, EFalse );
+ FTRACE(FPrint( _L("CDunAtCmdHandler::AddDataForParsing() (not ready) complete") ));
return KErrNotReady;
}
TBool pushStarted = HandleASlashCommand();
@@ -180,20 +204,21 @@
// Note: return here with "partial input" status to fool CDunUpstream
// into reissuing the read request. The AT command has not really
// started yet so this is necessary.
- aPartialInput = ETrue;
- ResetParseBuffers();
- FTRACE(FPrint( _L("CDunAtCmdHandler::ParseCommand() (A/) complete") ));
+ aMoreNeeded = ETrue;
+ ManageEndOfCmdHandling( EFalse, EFalse );
+ FTRACE(FPrint( _L("CDunAtCmdHandler::AddDataForParsing() (A/) complete") ));
return KErrNone;
}
- FTRACE(FPrint( _L("CDunAtCmdHandler::ParseCommand() received total:") ));
- FTRACE(FPrintRaw(iInputBuffer) );
iHandleState = EDunStateAtCmdHandling;
- iUpstream->NotifyAtCmdHandlingStart();
iDecodeInfo.iFirstDecode = ETrue;
iDecodeInfo.iDecodeIndex = 0;
- HandleNextDecodedCommand();
- FTRACE(FPrint( _L("CDunAtCmdHandler::ParseCommand() complete") ));
- aPartialInput = EFalse;
+ iDecodeInfo.iPrevExists = EFalse;
+ iParseInfo.iLimit = KErrNotFound;
+ iParseInfo.iSendBuffer.Zero();
+ iEditorModeInfo.iContentFound = EFalse;
+ HandleNextSubCommand();
+ FTRACE(FPrint( _L("CDunAtCmdHandler::AddDataForParsing() complete") ));
+ aMoreNeeded = EFalse;
return KErrNone;
}
@@ -211,17 +236,6 @@
}
// ---------------------------------------------------------------------------
-// Sets end of command line marker on for the possible series of AT commands.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CDunAtCmdHandler::SetEndOfCmdLine( TBool aClearInput )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::SetEndOfCmdLine()") ));
- ManageEndOfCmdHandling( EFalse, ETrue, aClearInput );
- FTRACE(FPrint( _L("CDunAtCmdHandler::SetEndOfCmdLine() complete") ));
- }
-
-// ---------------------------------------------------------------------------
// Sends a character to be echoed
// ---------------------------------------------------------------------------
//
@@ -250,10 +264,10 @@
iCmdPusher->Stop();
// The line below is used in the case when this function is called by
// CDunUpstream as a result of "data mode ON" change notification.
- // In this case it is possible that HandleNextDecodedCommand() returns
- // without resetting the iInputBuffer because of the way it checks the
+ // In this case it is possible that HandleNextSubCommand() returns
+ // without resetting the iSendBuffer because of the way it checks the
// iHandleState.
- ManageEndOfCmdHandling( EFalse, ETrue, ETrue );
+ ManageEndOfCmdHandling( ETrue, EFalse );
FTRACE(FPrint( _L("CDunAtCmdHandler::Stop() complete") ));
return KErrNone;
}
@@ -374,7 +388,7 @@
iCarriageReturn = 0;
iLineFeed = 0;
iBackspace = 0;
- iCommand = NULL;
+ iInput = NULL;
iDecodeInfo.iFirstDecode = ETrue;
iDecodeInfo.iDecodeIndex = KErrNotFound;
iDecodeInfo.iExtendedIndex = KErrNotFound;
@@ -383,6 +397,7 @@
iDecodeInfo.iAssignFound = EFalse;
iDecodeInfo.iInQuotes = EFalse;
iDecodeInfo.iSpecialFound = EFalse;
+ iDecodeInfo.iCmdsHandled = 0;
iEditorModeInfo.iContentFound = EFalse;
iCmdPusher = NULL;
iEcomListen = NULL;
@@ -435,19 +450,19 @@
TBool firstSearch = ETrue;
for ( ;; )
{
- retTemp = iAtCmdExt.GetNextSpecialCommand( iInputBuffer, firstSearch );
+ // Let's borrow iLineBuffer for this purpose
+ retTemp = iAtCmdExt.GetNextSpecialCommand( iLineBuffer, firstSearch );
if ( retTemp != KErrNone )
{
break;
}
- HBufC8* specialCmd = HBufC8::NewMaxLC( iInputBuffer.Length() );
- TPtr8 specialCmdPtr = specialCmd->Des();
- specialCmdPtr.Copy( iInputBuffer );
- specialCmdPtr.UpperCase();
+ TInt lineLength = iLineBuffer.Length();
+ HBufC8* specialCmd = HBufC8::NewMaxLC( lineLength );
+ *specialCmd = iLineBuffer;
iSpecials.AppendL( specialCmd );
CleanupStack::Pop( specialCmd );
}
- iInputBuffer.Zero();
+ iLineBuffer.Zero();
FTRACE(FPrint( _L("CDunAtCmdHandler::CreateSpecialCommandsL() complete") ));
}
@@ -512,6 +527,11 @@
TBool CDunAtCmdHandler::RegenerateOkReply()
{
FTRACE(FPrint( _L("CDunAtCmdHandler::RegenerateOkReply()") ));
+ if ( iDownstream->IsDataInQueue(&iOkBuffer) )
+ {
+ FTRACE(FPrint( _L("CDunAtCmdHandler::RegenerateOkReply() (in queue!) complete") ));
+ return iQuietOn;
+ }
iOkBuffer.Zero();
if ( iQuietOn )
{
@@ -544,6 +564,11 @@
TBool CDunAtCmdHandler::RegenerateErrorReply()
{
FTRACE(FPrint( _L("CDunAtCmdHandler::RegenerateErrorReply()") ));
+ if ( iDownstream->IsDataInQueue(&iErrorBuffer) )
+ {
+ FTRACE(FPrint( _L("CDunAtCmdHandler::RegenerateErrorReply() (in queue!) complete") ));
+ return iQuietOn;
+ }
iErrorBuffer.Zero();
if ( iQuietOn )
{
@@ -634,57 +659,39 @@
// Manages partial AT command
// ---------------------------------------------------------------------------
//
-TBool CDunAtCmdHandler::ManagePartialCommand( TDesC8& aCommand,
- TBool& aNeedsCarriage )
+TBool CDunAtCmdHandler::ManagePartialCommand()
{
FTRACE(FPrint( _L("CDunAtCmdHandler::ManagePartialCommand()") ));
- aNeedsCarriage = ETrue;
- // Check length of command
- if ( aCommand.Length() == 0 )
+ // Check one character (or unit) based input data
+ if ( iInput->Length() == KDunChSetMaxCharLen )
{
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManagePartialCommand() (length zero) complete") ));
- return ETrue;
- }
- // Check one character (or unit) based input data
- if ( aCommand.Length() == KDunChSetMaxCharLen )
- {
- EchoCommand( aCommand );
+ EchoCommand();
// Handle backspace and cancel characters
- TBool found = HandleSpecialCharacters( aCommand );
+ TBool found = HandleSpecialCharacters();
if ( found )
{
FTRACE(FPrint( _L("CDunAtCmdHandler::ManagePartialCommand() (special) complete") ));
return ETrue;
}
}
- TBool endFound = EFalse;
- TBool overflow = AppendCommandToInputBuffer( aCommand, endFound );
- if ( overflow )
+ TBool moreNeeded = ExtractLineFromInputBuffer();
+ if ( moreNeeded )
{
- // Overflow occurred so return ETrue (consumed) to skip all the rest
- // characters until carriage return is found
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManagePartialCommand() (overflow) complete") ));
- return ETrue;
+ // More data is not needed with "A/" (no carriage return), check that
+ // special case here, otherwise continue processing
+ if ( !IsASlashCommand() )
+ {
+ FTRACE(FPrint( _L("CDunAtCmdHandler::ManagePartialCommand() (more) complete") ));
+ return ETrue;
+ }
}
// If something went wrong, do nothing (return consumed)
- if ( iInputBuffer.Length() <= 0 )
+ if ( iLineBuffer.Length() <= 0 )
{
FTRACE(FPrint( _L("CDunAtCmdHandler::ManagePartialCommand() (length) complete") ));
return ETrue;
}
- // If "A/", no carriage return is needed, check that now
- if ( IsASlashCommand() )
- {
- aNeedsCarriage = EFalse;
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManagePartialCommand() (A/) complete") ));
- return EFalse;
- }
- // For other commands and if no end, just return with consumed
- if ( !endFound )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManagePartialCommand() (void) complete") ));
- return ETrue;
- }
+ // For other commands, just return with consumed
FTRACE(FPrint( _L("CDunAtCmdHandler::ManagePartialCommand() complete") ));
return EFalse;
}
@@ -693,17 +700,22 @@
// Echoes a command if echo is on
// ---------------------------------------------------------------------------
//
-TBool CDunAtCmdHandler::EchoCommand( TDesC8& aDes )
+TBool CDunAtCmdHandler::EchoCommand()
{
FTRACE(FPrint( _L("CDunAtCmdHandler::EchoCommand()") ));
- if ( aDes.Length() > KDunChSetMaxCharLen )
+ if ( iInput->Length() > KDunChSetMaxCharLen )
{
FTRACE(FPrint( _L("CDunAtCmdHandler::EchoCommand() (wrong length) complete") ));
return EFalse;
}
if ( iEchoOn )
{
- iEchoBuffer.Copy( aDes );
+ if ( iDownstream->IsDataInQueue(&iEchoBuffer) )
+ {
+ FTRACE(FPrint( _L("CDunAtCmdHandler::EchoCommand() (in queue!) complete") ));
+ return EFalse;
+ }
+ iEchoBuffer.Copy( *iInput );
iDownstream->NotifyDataPushRequest( &iEchoBuffer, NULL );
FTRACE(FPrint( _L("CDunAtCmdHandler::EchoCommand() complete") ));
return ETrue;
@@ -716,27 +728,27 @@
// Handles backspace and cancel characters
// ---------------------------------------------------------------------------
//
-TBool CDunAtCmdHandler::HandleSpecialCharacters( TDesC8& aCommand )
+TBool CDunAtCmdHandler::HandleSpecialCharacters()
{
FTRACE(FPrint( _L("CDunAtCmdHandler::HandleSpecialCharacters()") ));
- if ( aCommand.Length() != KDunChSetMaxCharLen )
+ if ( iInput->Length() != KDunChSetMaxCharLen )
{
FTRACE(FPrint( _L("CDunAtCmdHandler::HandleSpecialCharacters() (wrong length) complete") ));
return EFalse;
}
- if ( aCommand[0] == iBackspace )
+ if ( (*iInput)[0] == iBackspace )
{
- TInt bufferLength = iInputBuffer.Length();
- if ( bufferLength > 0 )
+ TInt lineLength = iLineBuffer.Length();
+ if ( lineLength > 0 )
{
- iInputBuffer.SetLength( bufferLength-1 );
+ iLineBuffer.SetLength( lineLength-1 );
}
FTRACE(FPrint( _L("CDunAtCmdHandler::HandleSpecialCharacters() (backspace) complete") ));
return ETrue;
}
- if ( aCommand[0] == KDunCancel )
+ if ( (*iInput)[0] == KDunCancel )
{
- ResetParseBuffers(); // More processing here?
+ ManageEndOfCmdHandling( EFalse, EFalse );
FTRACE(FPrint( _L("CDunAtCmdHandler::HandleSpecialCharacters() (cancel) complete") ));
return ETrue;
}
@@ -745,167 +757,395 @@
}
// ---------------------------------------------------------------------------
-// Appends command to parse buffer
+// Extracts line from input buffer to line buffer
// ---------------------------------------------------------------------------
//
-TBool CDunAtCmdHandler::AppendCommandToInputBuffer( TDesC8& aCommand,
- TBool& aEndFound )
+TBool CDunAtCmdHandler::ExtractLineFromInputBuffer()
{
- FTRACE(FPrint( _L("CDunAtCmdHandler::AppendCommandToInputBuffer()") ));
- aEndFound = EFalse;
- TInt cmdBufIndex = 0;
- TInt cmdBufLim = aCommand.Length();
- while ( cmdBufIndex < cmdBufLim )
+ FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractLineFromInputBuffer()") ));
+ FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractLineFromInputBuffer() before (%d bytes):"), iLineBuffer.Length() ));
+ FTRACE(FPrintRaw(iLineBuffer) );
+ // Case1: If no data in iLineBuffer and end-of-line character in iInputBuffer[start]:
+ // - Skip end-of-line characters, find start-of-line condition, find end-of-line character
+ // - If partial line found (start-of-line condition and no end-of-line character):
+ // - Save partial line to iLineBuffer
+ // - Set iEndIndex to end of iInputBuffer
+ // - If full line found (start-of-line condition and end-of-line character):
+ // - Save full line to iLineBuffer
+ // - Skip multiple end-of-line characters until next start-of-line
+ // condition or end of iInputBuffer -> save this position to iEndIndex
+ // Case2: If no data in iLineBuffer and non-end-of-line character in iInputBuffer[start]:
+ // - Find end-of-line character
+ // - If partial line found (no end-of-line character):
+ // - Save partial line to iLineBuffer
+ // - Set iEndIndex to end of iLineBuffer
+ // - If full line found (end-of-line character):
+ // - Save full line to iLineBuffer
+ // - Skip multiple end-of-line characters until next start-of-line
+ // condition or end of iInputBuffer -> save this position to iEndIndex
+ // Case3: If data in iLineBuffer and end-of-line character in iInputBuffer[start]:
+ // - Skip end-of-line characters
+ // - Keep string currently in iLineBuffer
+ // - Skip end-of-line characters until non-end-of-line or end of
+ // iInputBuffer -> save this position to iEndIndex
+ // Case4: If data in iLineBuffer and non-end-of-line character in iInputBuffer[start]:
+ // - Processed the same way as Case1, however "Skip end-of-line characters" does
+ // not have any effect
+ if ( iInput->Length() <= 0 )
{
- if ( iInputBuffer.Length() == iInputBuffer.MaxLength() )
+ FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractLineFromInputBuffer() (wrong length) complete") ));
+ return ETrue;
+ }
+ TBool moreNeeded = ETrue;
+ TBool copyNeeded = EFalse;
+ TInt copyLength = KErrNotFound;
+ TInt lineLength = iLineBuffer.Length();
+ TInt lineMaxLength = iLineBuffer.MaxLength();
+ TInt freeLineSpace = lineMaxLength - lineLength;
+ TInt inputLength = iInput->Length();
+ TInt startIndex = ( iEndIndex>=0 ) ? iEndIndex : 0;
+ if ( startIndex >= inputLength )
+ {
+ iEndIndex = KErrNotFound;
+ FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractLineFromInputBuffer() (input end) complete") ));
+ return ETrue;
+ }
+ // Cases here:
+ // Case1: If no data in iLineBuffer and end-of-line character in iInputBuffer[start]
+ // Case2: If no data in iLineBuffer and non-end-of-line character in iInputBuffer[start]
+ // Case3: If data in iLineBuffer and end-of-line character in iInputBuffer[start]
+ // Case4: If data in iLineBuffer and non-end-of-line character in iInputBuffer[start]
+ // Summary: Cases 1, 2 and 4 can be combined. Case 3 needs a separate check.
+ TChar character = (*iInput)[startIndex];
+ TBool endOfLine = IsEndOfLine(character);
+ if ( lineLength>0 && endOfLine )
+ {
+ moreNeeded = HandleSpecialBufferManagement( startIndex,
+ copyLength,
+ copyNeeded );
+ }
+ else
+ {
+ moreNeeded = HandleGenericBufferManagement( startIndex,
+ copyLength,
+ copyNeeded );
+ }
+ if ( copyNeeded && copyLength>0 )
+ {
+ // Check the case copyLength does not fit to iLineBuffer
+ // This case should be handled by returning "more data needed"
+ // Also reset the iLineBuffer to ensure the handling doesn't stuck
+ // for rest of the commands (usability case)
+ if ( copyLength > freeLineSpace )
{
- // 1) If output is full and end found from input
- // -> reset buffers and overflow found
- // 2) If output is full and end not found from input
- // -> don't reset buffers and overflow found
- TInt foundIndex = FindEndOfCommand( aCommand );
- if ( foundIndex >= 0 )
- {
- aEndFound = ETrue;
- ResetParseBuffers();
- FTRACE(FPrint( _L("CDunAtCmdHandler::AppendCommandToInputBuffer() (reset) complete") ));
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::AppendCommandToInputBuffer() (overflow) complete") ));
+ iLineBuffer.Zero();
+ iEndIndex = KErrNotFound;
+ FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractLineFromInputBuffer() after (%d bytes):"), iLineBuffer.Length() ));
+ FTRACE(FPrintRaw(iLineBuffer) );
+ FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractLineFromInputBuffer() (overflow) complete") ));
return ETrue;
}
- TChar character = aCommand[cmdBufIndex];
- if ( IsEndOfCommand(character) )
+ iLineBuffer.Append( &(*iInput)[startIndex], copyLength );
+ FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractLineFromInputBuffer() after (%d bytes):"), iLineBuffer.Length() ));
+ FTRACE(FPrintRaw(iLineBuffer) );
+ }
+ if ( moreNeeded )
+ {
+ iEndIndex = KErrNotFound;
+ FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractLineFromInputBuffer() (more needed) complete") ));
+ return ETrue;
+ }
+ // As a last step adjust the possible multiple IsDelimiterCharacter()
+ // characters and set length of iLineBuffer. Leave iEndIndex untouched.
+ lineLength = iLineBuffer.Length();
+ for ( TInt i=lineLength-1; i>=0; i-- )
+ {
+ TChar character = iLineBuffer[i];
+ if ( !IsDelimiterCharacter(character) )
{
- aEndFound = ETrue;
- iEndIndex = cmdBufIndex;
+ iLineBuffer.SetLength( i + 1 );
+ FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractLineFromInputBuffer() after (%d bytes):"), iLineBuffer.Length() ));
+ FTRACE(FPrintRaw(iLineBuffer) );
break;
}
- iInputBuffer.Append( aCommand[cmdBufIndex] );
- cmdBufIndex++;
}
- FTRACE(FPrint( _L("CDunAtCmdHandler::AppendCommandToInputBuffer() complete") ));
+ FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractLineFromInputBuffer() (line found) complete") ));
return EFalse;
}
// ---------------------------------------------------------------------------
-// Handles next decoded command from input buffer
+// Handles generic buffer management
+// (explanation in ExtractLineFromInputBuffer())
// ---------------------------------------------------------------------------
//
-TBool CDunAtCmdHandler::HandleNextDecodedCommand()
+TBool CDunAtCmdHandler::HandleGenericBufferManagement( TInt& aStartIndex,
+ TInt& aCopyLength,
+ TBool& aCopyNeeded )
{
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleNextDecodedCommand()") ));
- if ( iHandleState != EDunStateAtCmdHandling )
+ FTRACE(FPrint( _L("CDunAtCmdHandler::HandleGenericBufferManagement()") ));
+ TInt inputLength = iInput->Length();
+ TInt currentIndex = SkipEndOfLineCharacters( aStartIndex );
+ if ( currentIndex >= inputLength )
{
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleNextDecodedCommand() (not ready) complete") ));
+ // No data in iLineBuffer and only end-of-lines in new buffer
+ // return with "need more data"
+ iEndIndex = inputLength;
+ aCopyLength = 0;
+ aCopyNeeded = EFalse;
+ FTRACE(FPrint( _L("CDunAtCmdHandler::HandleGenericBufferManagement() (new end for old no data) complete") ));
return ETrue;
}
- TBool extracted = ExtractNextDecodedCommand();
- if ( !extracted )
+ // No data in iLineBuffer and non-end-of-line character found
+ // Try to find the first start-of-line condition
+ TInt lineLength = iLineBuffer.Length();
+ if ( lineLength == 0 )
{
- ManageEndOfCmdHandling( ETrue, ETrue, ETrue );
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleNextDecodedCommand() (last) complete") ));
+ currentIndex = SkipSubCommandDelimiterCharacters( aStartIndex );
+ if ( currentIndex >= inputLength )
+ {
+ // No data in iLineBuffer and only end-of-lines+delimiter in new buffer
+ // return with "need more data"
+ iEndIndex = inputLength;
+ aCopyLength = 0;
+ aCopyNeeded = EFalse;
+ FTRACE(FPrint( _L("CDunAtCmdHandler::HandleGenericBufferManagement() (new end+delim for old no data) complete") ));
+ return ETrue;
+ }
+ }
+ aStartIndex = currentIndex;
+ // No data in iLineBuffer and other than end-of-line or delimiter character found
+ // Variable currentIndex is now the start of new command
+ // Next try to find the end of the command
+ TInt endIndex = FindEndOfLine( aStartIndex );
+ if ( endIndex >= inputLength )
+ {
+ // No data in iLineBuffer and start of command found without end
+ // return with "need more data"
+ iEndIndex = inputLength;
+ aCopyLength = inputLength - aStartIndex;
+ aCopyNeeded = ETrue;
+ FTRACE(FPrint( _L("CDunAtCmdHandler::HandleGenericBufferManagement() (start but no end for old no data) complete") ));
return ETrue;
}
- // Next convert the decoded AT command to uppercase
- // Don't check for case status -> let mixed cases pass
- iParseInfo.iSendBuffer.Copy( iDecodeInfo.iDecodeBuffer );
- TInt maxLength = iParseInfo.iSendBuffer.MaxLength();
- TPtr8 upperDes( &iParseInfo.iSendBuffer[0], iParseInfo.iLimit, maxLength );
- upperDes.UpperCase();
- // Next always send the command to ATEXT
- iCmdPusher->IssueRequest( iParseInfo.iSendBuffer );
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleNextDecodedCommand() complete") ));
+ // No data in iLineBuffer and end-of-line character found
+ // Try to skip possible multiple end-of-line characters
+ currentIndex = SkipEndOfLineCharacters( endIndex );
+ // Variable currentIndex is now either start of next command or end of iInput
+ // Note that this requires that Case 2 must skip the possible IsDelimiterCharacter()s
+ iEndIndex = currentIndex;
+ aCopyLength = endIndex - aStartIndex;
+ aCopyNeeded = ETrue;
+ FTRACE(FPrint( _L("CDunAtCmdHandler::HandleGenericBufferManagement() (line found) complete") ));
return EFalse;
}
// ---------------------------------------------------------------------------
-// Finds the start of the next command
+// Handles special buffer management
+// (explanation in ExtractLineFromInputBuffer())
// ---------------------------------------------------------------------------
//
-TInt CDunAtCmdHandler::FindStartOfNextCommand()
+TBool CDunAtCmdHandler::HandleSpecialBufferManagement( TInt aStartIndex,
+ TInt& aCopyLength,
+ TBool& aCopyNeeded )
{
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindStartOfNextCommand()") ));
- // Note: here we need to avoid internal recursion when parsing the
- // multiple IsEndOfCommand() and IsDelimiterCharacter() markers inside the
- // same upstream block.
- // Skip all the extra markers except the one we already know to exist.
- TInt i;
- TInt startVal = iEndIndex + 1;
- TInt foundIndex = KErrNotFound;
- TInt count = iCommand->Length();
- for ( i=startVal; i<count; i++ )
+ FTRACE(FPrint( _L("CDunAtCmdHandler::HandleSpecialBufferManagement()") ));
+ TInt currentIndex = SkipEndOfLineCharacters( aStartIndex );
+ // Variable currentIndex is now either start of next command or end of iInput
+ iEndIndex = currentIndex;
+ aCopyLength = 0;
+ aCopyNeeded = EFalse;
+ FTRACE(FPrint( _L("CDunAtCmdHandler::HandleSpecialBufferManagement() complete") ));
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+// Skips end-of-line characters
+// ---------------------------------------------------------------------------
+//
+TInt CDunAtCmdHandler::SkipEndOfLineCharacters( TInt aStartIndex )
+ {
+ FTRACE(FPrint( _L("CDunAtCmdHandler::SkipEndOfLineCharacters()") ));
+ TInt foundIndex = iInput->Length();
+ TInt inputLength = foundIndex;
+ for ( TInt i=aStartIndex; i<inputLength; i++ )
{
- TChar character = (*iCommand)[i];
- if ( !(IsEndOfCommand(character)||IsDelimiterCharacter(character)) )
+ TChar character = (*iInput)[i];
+ if ( !IsEndOfLine(character) )
{
foundIndex = i;
break;
}
}
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindStartOfNextCommand() complete") ));
+ FTRACE(FPrint( _L("CDunAtCmdHandler::SkipEndOfLineCharacters() complete") ));
+ return foundIndex;
+ }
+
+// ---------------------------------------------------------------------------
+// Skips subcommand delimiter characters
+// ---------------------------------------------------------------------------
+//
+TInt CDunAtCmdHandler::SkipSubCommandDelimiterCharacters( TInt aStartIndex )
+ {
+ FTRACE(FPrint( _L("CDunAtCmdHandler::SkipSubCommandDelimiterCharacters()") ));
+ TInt inputLength = iInput->Length();
+ TInt foundIndex = inputLength;
+ for ( TInt i=aStartIndex; i<inputLength; i++ )
+ {
+ TChar character = (*iInput)[i];
+ if ( !IsDelimiterCharacter(character) )
+ {
+ foundIndex = i;
+ break;
+ }
+ }
+ FTRACE(FPrint( _L("CDunAtCmdHandler::SkipSubCommandDelimiterCharacters() complete") ));
return foundIndex;
}
// ---------------------------------------------------------------------------
+// Finds the end of the line
+// ---------------------------------------------------------------------------
+//
+TInt CDunAtCmdHandler::FindEndOfLine( TInt aStartIndex )
+ {
+ FTRACE(FPrint( _L("CDunAtCmdHandler::FindEndOfLine()") ));
+ TInt inputLength = iInput->Length();
+ TInt foundIndex = inputLength;
+ for ( TInt i=aStartIndex; i<inputLength; i++ )
+ {
+ TChar character = (*iInput)[i];
+ // Checking for IsDelimiterCharacter() here needs more logic (a parser).
+ // Just check with "IsEndOfLine()"
+ if ( IsEndOfLine(character) )
+ {
+ foundIndex = i;
+ break;
+ }
+ }
+ FTRACE(FPrint( _L("CDunAtCmdHandler::FindEndOfLine() complete") ));
+ return foundIndex;
+ }
+
+// ---------------------------------------------------------------------------
+// Handles next subcommand from line buffer
+// ---------------------------------------------------------------------------
+//
+TBool CDunAtCmdHandler::HandleNextSubCommand()
+ {
+ FTRACE(FPrint( _L("CDunAtCmdHandler::HandleNextSubCommand()") ));
+ if ( iHandleState != EDunStateAtCmdHandling )
+ {
+ FTRACE(FPrint( _L("CDunAtCmdHandler::HandleNextSubCommand() (not ready) complete") ));
+ return EFalse;
+ }
+ TBool extracted = ExtractNextSubCommand();
+ if ( !extracted )
+ {
+ ManageEndOfCmdHandling( ETrue, ETrue );
+ FTRACE(FPrint( _L("CDunAtCmdHandler::HandleNextSubCommand() (last) complete") ));
+ return EFalse;
+ }
+ // Next convert the decoded AT command to uppercase
+ // Don't check for case status -> let mixed cases pass
+ TInt oldLength = iParseInfo.iSendBuffer.Length();
+ iParseInfo.iSendBuffer.SetLength( iParseInfo.iLimit );
+ iParseInfo.iSendBuffer.UpperCase();
+ iParseInfo.iSendBuffer.SetLength( oldLength );
+ // Next always send the command to ATEXT
+ iCmdPusher->IssueRequest( iParseInfo.iSendBuffer );
+ FTRACE(FPrint( _L("CDunAtCmdHandler::HandleNextSubCommand() complete") ));
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
// Manages end of AT command handling
// ---------------------------------------------------------------------------
//
-void CDunAtCmdHandler::ManageEndOfCmdHandling( TBool aNotifyExternal,
- TBool aNotifyLocal,
- TBool aClearInput )
+void CDunAtCmdHandler::ManageEndOfCmdHandling( TBool aNotifyLocal,
+ TBool aNotifyExternal )
{
FTRACE(FPrint( _L("CDunAtCmdHandler::ManageEndOfCmdHandling()") ));
- if ( iInputBuffer.Length() > 0 )
+ FTRACE(FPrint( _L("CDunAtCmdHandler::ManageEndOfCmdHandling() (loc=%d, ext=%d)"), aNotifyLocal, aNotifyExternal ));
+ // If iEndIndex is (>=0 && <iInput.Length()) it means more data waits in
+ // iInput that didn't fit in iInputBuffer.
+ TInt cmdLength = iInput->Length();
+ TBool subBlock = ( iEndIndex>=0&&iEndIndex<cmdLength ) ? ETrue : EFalse;
+ if ( iLineBuffer.Length()>0 && !subBlock )
{
- iLastBuffer.Copy( iInputBuffer );
+ // Line buffer set and no partial subblock, copy to lastbuffer
+ iLastBuffer.Copy( iLineBuffer );
}
- ResetParseBuffers( aClearInput );
+ iLineBuffer.Zero();
+ iDecodeInfo.iFirstDecode = ETrue;
+ iDecodeInfo.iDecodeIndex = 0;
+ iDecodeInfo.iPrevExists = EFalse;
+ iParseInfo.iLimit = KErrNotFound;
+ iParseInfo.iSendBuffer.Zero();
+ iEditorModeInfo.iContentFound = EFalse;
iHandleState = EDunStateIdle;
if ( aNotifyLocal )
{
iCmdPusher->SetEndOfCmdLine();
}
- if ( !aNotifyExternal )
+ // iEndIndex must not be reset to KErrNotFound only when
+ // ExtractLineFromInputBuffer() found the next line
+ // (when moreNeeded is EFalse)
+ TBool resetIndex = ETrue;
+ if ( aNotifyExternal )
{
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageEndOfCmdHandling() (no external) complete") ));
- return;
+ TBool moreNeeded = ExtractLineFromInputBuffer();
+ if ( moreNeeded )
+ {
+ iUpstream->NotifyParserNeedsMoreData();
+ }
+ else
+ {
+ // AppendBlockToInputBuffer() was able to fill with known end, handle next
+ iHandleState = EDunStateAtCmdHandling;
+ HandleNextSubCommand();
+ resetIndex = EFalse;
+ }
}
- TInt foundIndex = FindStartOfNextCommand();
- iUpstream->NotifyAtCmdHandlingEnd( foundIndex );
+ if ( resetIndex )
+ {
+ iEndIndex = KErrNotFound;
+ }
FTRACE(FPrint( _L("CDunAtCmdHandler::ManageEndOfCmdHandling() complete") ));
}
// ---------------------------------------------------------------------------
-// Extracts next decoded command from input buffer to decode buffer
+// Extracts next subcommand from line buffer to send buffer
// ---------------------------------------------------------------------------
//
-TBool CDunAtCmdHandler::ExtractNextDecodedCommand( TBool aPeek )
+TBool CDunAtCmdHandler::ExtractNextSubCommand( TBool aPeek )
{
- FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractNextDecodedCommand()") ));
- iParseInfo.iLimit = KErrNotFound;
+ FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractNextSubCommand()") ));
TDunDecodeInfo oldInfo = iDecodeInfo;
- iDecodeInfo.iDecodeBuffer.Zero();
- // Find start of decode command from input buffer
- TInt startIndex = iDecodeInfo.iDecodeIndex;
- startIndex = FindStartOfDecodedCommand( iInputBuffer, startIndex );
+ iParseInfo.iLimit = KErrNotFound;
+ iParseInfo.iSendBuffer.Zero();
+ // Find start of subcommand from line buffer
+ TInt startIndex = FindStartOfSubCommand();
if ( startIndex < 0 )
{
RestoreOldDecodeInfo( aPeek, oldInfo );
FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractNextDecodedCommand() (no start) complete") ));
return EFalse;
}
- // Find end of decode command from input buffer
+ iDecodeInfo.iDecodeIndex = startIndex;
TBool specialCmd = EFalse;
TInt endIndex = KErrNotFound;
- specialCmd = CheckSpecialCommand( startIndex, endIndex );
+ specialCmd = CheckSpecialCommand( endIndex );
if ( !specialCmd )
{
- FindSubCommand( startIndex, endIndex );
+ FindSubCommand( endIndex );
}
- if ( endIndex < startIndex )
+ TInt lineLength = iLineBuffer.Length();
+ TBool inStartLimits = ( startIndex >= 0 && startIndex < lineLength ) ? ETrue : EFalse;
+ TBool inEndLimits = ( endIndex >= 0 && endIndex < lineLength ) ? ETrue : EFalse;
+ if ( !inStartLimits || !inEndLimits )
{
RestoreOldDecodeInfo( aPeek, oldInfo );
- FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractNextDecodedCommand() (no end) complete") ));
+ FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractNextSubCommand() (no end) complete") ));
return EFalse;
}
TInt cmdLength = endIndex - startIndex + 1;
@@ -915,25 +1155,55 @@
iParseInfo.iLimit = cmdLength;
}
// Next create a new command
- if ( !iDecodeInfo.iFirstDecode && !specialCmd )
+ if ( !iDecodeInfo.iFirstDecode )
{
- _LIT( KAtMsg, "AT" );
- iDecodeInfo.iDecodeBuffer.Append( KAtMsg );
- iParseInfo.iLimit += 2; // Length of "AT"
+ _LIT( KAtPrefix, "AT" );
+ iParseInfo.iSendBuffer.Append( KAtPrefix );
+ if ( !specialCmd ) // Already added with CheckSpecialCommand()
+ {
+ iParseInfo.iLimit += 2; // Length of "AT"
+ }
// Note: The length of iDecodeBuffer is not exceeded here because "AT"
// is added only for the second commands after that.
}
- TPtrC8 decodedCmd = iInputBuffer.Mid( startIndex, cmdLength );
- iDecodeInfo.iDecodeBuffer.Append( decodedCmd );
- // Set index for next round
+ iParseInfo.iSendBuffer.Append( &iLineBuffer[startIndex], cmdLength );
+ // Change settings for the next decode round
iDecodeInfo.iFirstDecode = EFalse;
iDecodeInfo.iDecodeIndex = endIndex + 1;
RestoreOldDecodeInfo( aPeek, oldInfo );
- FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractNextDecodedCommand() complete") ));
+ if ( !aPeek )
+ {
+ iDecodeInfo.iCmdsHandled++;
+ FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractNextSubCommand() (handled=%d)"), iDecodeInfo.iCmdsHandled ));
+ }
+ FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractNextSubCommand() complete") ));
return ETrue;
}
// ---------------------------------------------------------------------------
+// Finds the start of subcommand from line buffer
+// ---------------------------------------------------------------------------
+//
+TBool CDunAtCmdHandler::FindStartOfSubCommand()
+ {
+ FTRACE(FPrint( _L("CDunAtCmdHandler::FindStartOfSubCommand()") ));
+ TInt i;
+ TInt foundIndex = KErrNotFound;
+ TInt lineLength = iLineBuffer.Length();
+ for ( i=iDecodeInfo.iDecodeIndex; i<lineLength; i++ )
+ {
+ TChar character = iLineBuffer[i];
+ if ( !IsDelimiterCharacter(character) )
+ {
+ foundIndex = i;
+ break;
+ }
+ }
+ FTRACE(FPrint( _L("CDunAtCmdHandler::FindStartOfSubCommand() complete") ));
+ return foundIndex;
+ }
+
+// ---------------------------------------------------------------------------
// Restores old decode info. For ExtractNextDecodedCommand() when aPeeks is
// ETrue.
// ---------------------------------------------------------------------------
@@ -951,32 +1221,10 @@
}
// ---------------------------------------------------------------------------
-// Finds end of an AT command
+// Tests for end of AT command line
// ---------------------------------------------------------------------------
//
-TInt CDunAtCmdHandler::FindEndOfCommand( TDesC8& aDes, TInt aStartIndex )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindEndOfCommand()") ));
- TInt i;
- TInt length = aDes.Length();
- for ( i=aStartIndex; i<length; i++ )
- {
- TChar character = aDes[i];
- if ( IsEndOfCommand(character) )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindEndOfCommand() complete (%d)"), i ));
- return i;
- }
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindEndOfCommand() (not found) complete") ));
- return KErrNotFound;
- }
-
-// ---------------------------------------------------------------------------
-// Tests for end of AT command character
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::IsEndOfCommand( TChar& aCharacter )
+TBool CDunAtCmdHandler::IsEndOfLine( TChar& aCharacter )
{
FTRACE(FPrint( _L("CDunAtCmdHandler::IsEndOfCommand()") ));
if ( aCharacter==iCarriageReturn || aCharacter==iLineFeed )
@@ -989,29 +1237,6 @@
}
// ---------------------------------------------------------------------------
-// Finds start of a decoded AT command
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtCmdHandler::FindStartOfDecodedCommand( TDesC8& aDes,
- TInt aStartIndex )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindStartOfDecodedCommand()") ));
- TInt i;
- TInt count = aDes.Length();
- for ( i=aStartIndex; i<count; i++ )
- {
- TChar character = aDes[i];
- if ( !IsDelimiterCharacter(character) )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindStartOfDecodedCommand() complete (%d)"), i ));
- return i;
- }
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindStartOfDecodedCommand() (not found) complete") ));
- return KErrNotFound;
- }
-
-// ---------------------------------------------------------------------------
// Checks if character is delimiter character
// ---------------------------------------------------------------------------
//
@@ -1049,13 +1274,22 @@
// Checks special command
// ---------------------------------------------------------------------------
//
-TBool CDunAtCmdHandler::CheckSpecialCommand( TInt aStartIndex,
- TInt& aEndIndex )
+TBool CDunAtCmdHandler::CheckSpecialCommand( TInt& aEndIndex )
{
FTRACE(FPrint( _L("CDunAtCmdHandler::CheckSpecialCommand()") ));
- TBuf8<KDunInputBufLength> upperBuf;
- TInt newLength = iInputBuffer.Length() - aStartIndex;
- upperBuf.Copy( &iInputBuffer[aStartIndex], newLength );
+ TInt atPrefixLen = 0;
+ TInt startIndex = iDecodeInfo.iDecodeIndex;
+ TInt newLength = iLineBuffer.Length() - startIndex;
+ TBuf8<KDunLineBufLength> upperBuf;
+ if ( !iDecodeInfo.iFirstDecode )
+ {
+ // For cases such as "ATM1L3DT*99#" "DT" must have "AT"
+ _LIT8( KAtPrefix, "AT" );
+ upperBuf.Copy( KAtPrefix );
+ atPrefixLen = 2; // "AT"
+ newLength += atPrefixLen;
+ }
+ upperBuf.Append( &iLineBuffer[startIndex], newLength );
upperBuf.UpperCase();
TInt i;
TInt count = iSpecials.Count();
@@ -1077,7 +1311,7 @@
if ( cmpResult == 0 )
{
iParseInfo.iLimit = specialLength;
- aEndIndex = (origLength-1) + aStartIndex;
+ aEndIndex = (origLength-1) + startIndex - atPrefixLen;
FTRACE(FPrint( _L("CDunAtCmdHandler::CheckSpecialCommand() complete") ));
return ETrue;
}
@@ -1255,21 +1489,22 @@
// Finds subcommand
// ---------------------------------------------------------------------------
//
-TInt CDunAtCmdHandler::FindSubCommand( TInt aStartIndex, TInt& aEndIndex )
+TInt CDunAtCmdHandler::FindSubCommand( TInt& aEndIndex )
{
FTRACE(FPrint( _L("CDunAtCmdHandler::FindSubCommand()") ));
- aEndIndex = aStartIndex;
+ TInt startIndex = iDecodeInfo.iDecodeIndex;
+ aEndIndex = startIndex;
TBool found = EFalse;
- TInt length = iInputBuffer.Length();
+ TInt lineLength = iLineBuffer.Length();
iDecodeInfo.iAssignFound = EFalse;
iDecodeInfo.iInQuotes = EFalse;
iDecodeInfo.iExtendedIndex = KErrNotFound;
SaveNotFoundCharDecodeState();
iAtSpecialCmdHandler->ResetComparisonBuffer(); // just to be sure
- for ( ; aEndIndex<length; aEndIndex++ )
+ for ( ; aEndIndex<lineLength; aEndIndex++ )
{
- TChar character = iInputBuffer[aEndIndex];
- found = FindSubCommandQuotes( character, aStartIndex, aEndIndex );
+ TChar character = iLineBuffer[aEndIndex];
+ found = FindSubCommandQuotes( character, startIndex, aEndIndex );
if ( found )
{
continue;
@@ -1292,7 +1527,7 @@
// AT+CMD+CMD [second + as delimiter]
if ( IsExtendedCharacter(character) )
{
- found = IsExtendedBorder( character, aStartIndex, aEndIndex );
+ found = IsExtendedBorder( character, startIndex, aEndIndex );
if ( !found )
{
continue;
@@ -1320,10 +1555,10 @@
TBool CDunAtCmdHandler::IsASlashCommand()
{
FTRACE(FPrint( _L("CDunAtCmdHandler::IsASlashCommand()") ));
- if ( iInputBuffer.Length() == 2 )
+ if ( iLineBuffer.Length() == 2 )
{
- if ( iInputBuffer[1] == '/' &&
- (iInputBuffer[0] == 'A' || iInputBuffer[0] == 'a') )
+ if ( iLineBuffer[1] == '/' &&
+ (iLineBuffer[0] == 'A' || iLineBuffer[0] == 'a') )
{
FTRACE(FPrint( _L("CDunAtCmdHandler::IsASlashCommand() (found) complete") ));
return ETrue;
@@ -1346,43 +1581,21 @@
FTRACE(FPrint( _L("CDunAtCmdHandler::HandleASlashCommand() (no push) complete") ));
return EFalse;
}
+ iEndIndex = iInput->Length(); // Causes skipping of last '/' in ManageEndOfCmdHandling()
// If "A/" command and last buffer exist, set the last buffer as the current buffer
if ( iLastBuffer.Length() > 0 )
{
- iInputBuffer.Copy( iLastBuffer );
+ iLineBuffer.Copy( iLastBuffer );
FTRACE(FPrint( _L("CDunAtCmdHandler::HandleASlashCommand() (copy) complete") ));
return EFalse;
}
- // Last buffer not set so return "ERROR" if quiet mode not on
- if ( iQuietOn )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleASlashCommand() (quiet) complete") ));
- return EFalse;
- }
+ // Last buffer not set so return "ERROR"
iDownstream->NotifyDataPushRequest( &iErrorBuffer, NULL );
FTRACE(FPrint( _L("CDunAtCmdHandler::HandleASlashCommand() complete") ));
return ETrue;
}
// ---------------------------------------------------------------------------
-// Resets parse buffers
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdHandler::ResetParseBuffers( TBool aClearInput )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ResetParseBuffers()") ));
- if ( aClearInput )
- {
- iInputBuffer.Zero();
- }
- iDecodeInfo.iFirstDecode = ETrue;
- iDecodeInfo.iDecodeIndex = 0;
- iDecodeInfo.iPrevExists = EFalse;
- iDecodeInfo.iDecodeBuffer.Zero();
- FTRACE(FPrint( _L("CDunAtCmdHandler::ResetParseBuffers() complete") ));
- }
-
-// ---------------------------------------------------------------------------
// Manages command mode change
// ---------------------------------------------------------------------------
//
@@ -1573,7 +1786,7 @@
if ( !nextContentFound )
{
iUpstream->NotifyEditorModeReply( aStart );
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyEditorModeReply() complete") ));
+ FTRACE(FPrint( _L("CDunAtCmdHandler::ManageEditorModeReply() complete") ));
return KErrNone;
}
// In block mode end the block mode by sending <ESC> and hope it works.
@@ -1596,22 +1809,23 @@
FTRACE(FPrint( _L("CDunAtCmdHandler::FindNextContent() (skip) complete" ) ));
return iEditorModeInfo.iContentFound;
}
- iEditorModeInfo.iContentFound = EFalse;
- TInt foundCmdIndex = KErrNotFound;
- TBool nextContentFound = ExtractNextDecodedCommand( ETrue ); // peek
- if ( !nextContentFound )
+ // If iEndIndex is (>=0 && <iInput.Length()) it means more data waits in
+ // iInput that didn't fit in iInputBuffer. Only check FindStartOfCommand()
+ // if iEndIndex < 0, meaning more data is needed from CDunUpstream.
+ TBool contentFound = EFalse;
+ TInt cmdLength = iInput->Length();
+ TBool subBlock = ( iEndIndex>=0&&iEndIndex<cmdLength ) ? ETrue : EFalse;
+ if ( subBlock )
{
- // Check the next subblock
- foundCmdIndex = FindStartOfNextCommand();
+ contentFound = ETrue;
}
- if ( !nextContentFound && foundCmdIndex<0 )
+ if ( !contentFound )
{
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindNextContent() (not found) complete") ));
- return EFalse;
+ contentFound = ExtractNextSubCommand( ETrue ); // peek
}
- iEditorModeInfo.iContentFound = ETrue;
+ iEditorModeInfo.iContentFound = contentFound;
FTRACE(FPrint( _L("CDunAtCmdHandler::FindNextContent() complete" ) ));
- return ETrue;
+ return contentFound;
}
// ---------------------------------------------------------------------------
@@ -1630,7 +1844,7 @@
FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyEndOfProcessing() (editor) complete" ) ));
return KErrNone;
}
- HandleNextDecodedCommand();
+ HandleNextSubCommand();
FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyEndOfProcessing() complete" ) ));
return KErrNone;
}
@@ -1641,13 +1855,11 @@
// command line data
// ---------------------------------------------------------------------------
//
-TInt CDunAtCmdHandler::NotifyEndOfCmdLineProcessing()
+void CDunAtCmdHandler::NotifyEndOfCmdLineProcessing()
{
FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyEndOfCmdLineProcessing()" ) ));
- TInt retVal = Stop();
- ManageEndOfCmdHandling( ETrue, EFalse, ETrue );
+ ManageEndOfCmdHandling( ETrue, ETrue );
FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyEndOfCmdLineProcessing() complete" ) ));
- return retVal;
}
// ---------------------------------------------------------------------------
@@ -1658,7 +1870,7 @@
TBool CDunAtCmdHandler::NotifyNextCommandPeekRequest()
{
FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyNextCommandPeekRequest()") ));
- TBool extracted = ExtractNextDecodedCommand( ETrue );
+ TBool extracted = ExtractNextSubCommand( ETrue );
FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyNextCommandPeekRequest() complete") ));
return extracted;
}
--- a/localconnectivityservice/dun/atext/src/DunAtCmdPusher.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/localconnectivityservice/dun/atext/src/DunAtCmdPusher.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -103,19 +103,24 @@
// Starts AT command handling
// ---------------------------------------------------------------------------
//
-TInt CDunAtCmdPusher::IssueRequest( TDesC8& aCommand, TBool aNormalMode )
+TInt CDunAtCmdPusher::IssueRequest( TDesC8& aInput, TBool aNormalMode )
{
FTRACE(FPrint( _L("CDunAtCmdPusher::IssueRequest()") ));
FTRACE(FPrint( _L("CDunAtCmdPusher::IssueRequest() send ATEXT:") ));
- FTRACE(FPrintRaw(aCommand) );
+ FTRACE(FPrintRaw(aInput) );
if ( iAtPushState!=EDunStateIdle && aNormalMode )
{
FTRACE(FPrint( _L("CDunAtCmdPusher::IssueRequest() (not ready) complete") ));
return KErrNotReady;
}
+ if ( iDownstream->IsDataInQueue(&iRecvBuffer) )
+ {
+ FTRACE(FPrint( _L("CDunAtCmdPusher::IssueRequest() (in queue!) complete") ));
+ return KErrGeneral;
+ }
iStatus = KRequestPending;
iAtCmdExt->HandleCommand( iStatus,
- aCommand,
+ aInput,
iRecvBuffer,
iReplyLeftPckg,
iReplyTypePckg );
@@ -132,6 +137,7 @@
TInt CDunAtCmdPusher::Stop()
{
FTRACE(FPrint( _L("CDunAtCmdPusher::Stop()") ));
+ SetEndOfCmdLine();
if ( iAtPushState != EDunStateAtCmdPushing )
{
FTRACE(FPrint( _L("CDunAtCmdHandler::Stop() (not ready) complete" )));
@@ -142,7 +148,6 @@
// idle eventually), cancel the actual operation in DoCancel()
Cancel();
iAtPushState = EDunStateIdle;
- SetEndOfCmdLine();
FTRACE(FPrint( _L("CDunAtCmdPusher::Stop() complete") ));
return KErrNone;
}
@@ -480,8 +485,9 @@
// First check if error or stop condition detected
if ( iReplyType==EReplyTypeError || iStop )
{
+ SetEndOfCmdLine();
+ iAtPushState = EDunStateIdle;
iCallback->NotifyEndOfCmdLineProcessing();
- iAtPushState = EDunStateIdle;
FTRACE(FPrint( _L("CDunAtCmdPusher::NotifyDataPushComplete() (error reply) complete") ));
return;
}
--- a/localconnectivityservice/dun/plugins/src/bt/DunBtListen.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/localconnectivityservice/dun/plugins/src/bt/DunBtListen.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -343,11 +343,11 @@
return KErrInUse;
}
aChannelNum = aListenSocket.LocalPort();
-
+
// We try to set the Telephony and Networking bits in our service class. If this fails we
// ignore it, as it's better to carry on without it than to fail to start listening.
- (void)aListenSocket.SetOpt(KBTRegisterCodService, KSolBtRFCOMM, KCoDDunServiceClass);
-
+ aListenSocket.SetOpt(KBTRegisterCodService, KSolBtRFCOMM, KCoDDunServiceClass);
+
retTemp = aListenSocket.Listen( KListenQueSize );
if ( retTemp != KErrNone )
{
--- a/localconnectivityservice/dun/rom/dunresources.iby Fri Jun 11 14:27:06 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
-* 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: Image description file for project DUN utilities
-*
-*/
-
-
-#ifndef __DUNRESOURCES_IBY__
-#define __DUNRESOURCES_IBY__
-
-#ifdef __DIALUP_NETWORKING
-data=DATAZ_\RESOURCE_FILES_DIR\dunutils.rsc RESOURCE_FILES_DIR\dunutils.rsc
-#endif
-
-#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/tsrc/bwins/dunutilstestu.def Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/tsrc/conf/dunutilstest.cfg Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+[Test]
+title Launch the dialog
+create dunutilstest Dun_Handler_Tester
+Dun_Handler_Tester LaunchDialog
+delete Dun_Handler_Tester
+[Endtest]
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/tsrc/eabi/dunutilstestu.def Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ _Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/tsrc/group/bld.inf Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+dunutilstest.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/tsrc/group/dunutilstest.mmp Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+TARGET dunutilstest.dll
+TARGETTYPE dll
+UID 0x1000008d 0xE9AF118D
+
+CAPABILITY ALL -TCB
+
+//TARGETPATH ?target_path
+DEFFILE dunutilstest.def
+
+USERINCLUDE ../inc ../../utils/inc
+
+SYSTEMINCLUDE /epoc32/include/mw/hb/hbwidgets
+
+#if defined(__S60_)
+ // OSEXT_LAYER_SYSTEMINCLUDE
+ MW_LAYER_SYSTEMINCLUDE
+#else
+ //SYSTEMINCLUDE /epoc32/include
+ //SYSTEMINCLUDE /epoc32/include/internal
+#endif
+
+SOURCEPATH ../src
+
+SOURCE dunutilstest.cpp
+
+SOURCEPATH ../../utils/src
+
+SOURCE DunNoteHandler.cpp
+
+
+LIBRARY euser.lib
+LIBRARY stiftestinterface.lib
+LIBRARY sysutil.lib
+LIBRARY HbWidgets.lib
+
+LANG SC
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/tsrc/inc/dunutilstest.h Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// This file defines the API for dunutilstest.dll
+
+#ifndef DUNUTILSTEST_H
+#define DUNUTILSTEST_H
+
+// Include Files
+
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+
+#include "DunNoteHandler.h"
+
+// Constants
+
+// Class Definitions
+
+
+NONSHARABLE_CLASS(Cdunutilstest) : public CScriptBase
+ {
+public:
+ // new functions
+
+ static Cdunutilstest* NewL(CTestModuleIf& aTestModuleIf);
+
+ virtual ~Cdunutilstest();
+
+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:
+ // new functions
+ Cdunutilstest(CTestModuleIf& aTestModuleIf);
+ void ConstructL();
+
+ virtual TInt LaunchDialogL( CStifItemParser& aItem );
+
+private:
+ // data
+ CDunNoteHandler* mDunandler;
+ };
+
+#endif // DUNUTILSTEST_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/tsrc/init/dunutilstest.ini Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,233 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+#
+
+#
+# This is 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= e:\testing\logs\
+TestReportFileName= obexServApiTest_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:\testing\conf\dunutilstest.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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/tsrc/src/dunutilstest.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "dunutilstest.h" // Cdunutilstest
+
+// Member Functions
+
+
+Cdunutilstest* Cdunutilstest::NewL(CTestModuleIf& aTestModuleIf)
+ {
+ Cdunutilstest* self = new (ELeave) Cdunutilstest( aTestModuleIf );
+
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+
+ }
+
+Cdunutilstest::Cdunutilstest(CTestModuleIf& aTestModuleIf ):
+ CScriptBase( aTestModuleIf )
+ {
+ }
+
+void Cdunutilstest::ConstructL()
+ {
+ // second phase constructor, anything that may leave must be constructed here
+ mDunandler = CDunNoteHandler::NewL();
+
+ }
+
+Cdunutilstest::~Cdunutilstest()
+ {
+ delete mDunandler;
+ }
+
+TInt Cdunutilstest::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( "LaunchDialog", Cdunutilstest::LaunchDialogL )
+ };
+
+ const TInt count = sizeof( KFunctions ) /
+ sizeof( TStifFunctionInfo );
+
+ return RunInternalL( KFunctions, count, aItem );
+
+ }
+
+TInt Cdunutilstest::LaunchDialogL( CStifItemParser& /*aItem*/ )
+ {
+
+ TTimeIntervalMicroSeconds32 time(7000000); //7 Seconds
+
+ mDunandler->IssueRequest();
+ User::After(time);
+ return KErrNone;
+ }
+
+// ========================== 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* ) Cdunutilstest::NewL( aTestModuleIf );
+
+ }
+
+
--- a/localconnectivityservice/dun/utils/data/dunutils.rss Fri Jun 11 14:27:06 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
-* 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 definitions for project DUN
-*
-*/
-
-
-NAME DUNX
-
-#include <eikon.rh>
-#include <dunutils.loc>
-
-RESOURCE RSS_SIGNATURE { }
-RESOURCE TBUF r_dun_maximum_dialups { buf=qtn_dun_max_number; }
--- a/localconnectivityservice/dun/utils/group/bld.inf Fri Jun 11 14:27:06 2010 +0300
+++ b/localconnectivityservice/dun/utils/group/bld.inf Tue Jul 06 15:13:34 2010 +0300
@@ -23,8 +23,7 @@
PRJ_EXPORTS
../../rom/dunutils.iby CORE_MW_LAYER_IBY_EXPORT_PATH(dunutils.iby)
-../../rom/dunresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(dunresources.iby)
-../loc/dunutils.loc MW_LAYER_LOC_EXPORT_PATH(dunutils.loc)
+
PRJ_MMPFILES
dunutils.mmp
--- a/localconnectivityservice/dun/utils/group/dunutils.mmp Fri Jun 11 14:27:06 2010 +0300
+++ b/localconnectivityservice/dun/utils/group/dunutils.mmp Tue Jul 06 15:13:34 2010 +0300
@@ -54,12 +54,6 @@
SOURCE DunNoteHandler.cpp
SOURCE DunUtils.cpp
-START RESOURCE ../data/dunutils.rss
-TARGETPATH RESOURCE_FILES_DIR
-HEADER
-LANGUAGE_IDS
-END // RESOURCE
-
USERINCLUDE ../inc ../../atext/inc
MW_LAYER_SYSTEMINCLUDE
@@ -70,8 +64,8 @@
// added into the include statements (like #include <phonebook/header.h>)
//SYSTEMINCLUDE /epoc32/include/ecom
SYSTEMINCLUDE ../../../inc
+SYSTEMINCLUDE /epoc32/include/mw/hb/hbwidgets
-LIBRARY aknnotify.lib
LIBRARY bafl.lib
#ifdef PRJ_USE_NETWORK_STUBS
LIBRARY c32comm_stub.lib
@@ -85,4 +79,6 @@
LIBRARY dunatext.lib
LIBRARY efsrv.lib
LIBRARY euser.lib
+LIBRARY HbWidgets.lib
+
DEBUGLIBRARY flogger.lib
--- a/localconnectivityservice/dun/utils/inc/DunDataPusher.h Fri Jun 11 14:27:06 2010 +0300
+++ b/localconnectivityservice/dun/utils/inc/DunDataPusher.h Tue Jul 06 15:13:34 2010 +0300
@@ -38,7 +38,7 @@
/**
* Data to push to the stream (not copied)
*/
- const TDesC8 *iPushedData;
+ const TDesC8* iDataToPush;
/**
* Callback to call when data is processed by the stream
@@ -127,30 +127,30 @@
* Adds event notification to queue
*
* @since S60 3.2
- * @param aPushedData Data to push to the stream (not copied)
+ * @param aDataToPush Data to push to the stream (not copied)
* @param aCallback Callback to call when data is processed by the stream
* @return Symbian error code on error, KErrNone otherwise
*/
- TInt AddToEventQueue( const TDesC8 *aPushedData,
+ TInt AddToEventQueue( const TDesC8* aDataToPush,
MDunCompletionReporter* aCallback );
/**
* Finds an event from queue
*
* @since S60 5.0
- * @param aPushedData Data to push to the stream (not copied)
+ * @param aDataToPush Data to push to the stream (not copied)
* @return Index of found event, Symbian error code otherwise
*/
- TInt FindEventFromQueue( const TDesC8 *aPushedData );
+ TInt FindEventFromQueue( const TDesC8* aDataToPush );
/**
* Stops one event in the event queue
*
* @since S60 5.0
- * @param aPushedData Data to push to the stream (not copied)
+ * @param aDataToPush Data to push to the stream (not copied)
* @return Symbian error code on error, KErrNone otherwise
*/
- TInt StopOneEvent( const TDesC8 *aPushedData );
+ TInt StopOneEvent( const TDesC8* aDataToPush );
/**
* Sends queued data in round robin
--- a/localconnectivityservice/dun/utils/inc/DunDownstream.h Fri Jun 11 14:27:06 2010 +0300
+++ b/localconnectivityservice/dun/utils/inc/DunDownstream.h Tue Jul 06 15:13:34 2010 +0300
@@ -73,14 +73,23 @@
* Gets called when outside party wants to push data to the existing stream
*
* @since S60 5.0
- * @param aPushedData Data to push to the stream (not copied)
+ * @param aDataToPush Data to push to the stream (not copied)
* @param aCallback Callback to call when data is processed by the stream
* @return Symbian error code on error, KErrNone otherwise
*/
virtual TInt NotifyDataPushRequest(
- const TDesC8 *aPushedData,
+ const TDesC8* aDataToPush,
MDunCompletionReporter* aCallback ) = 0;
+ /**
+ * Checks if data is in queue
+ *
+ * @since TB9.2
+ * @param aDataToPush Data to check
+ * @return ETrue if data is in queue, EFalse otherwise
+ */
+ virtual TBool IsDataInQueue( const TDesC8 *aDataToPush ) = 0;
+
};
/**
@@ -146,14 +155,23 @@
TInt InitializeForDataPushing( MDunAtCmdHandler* aAtCmdHandler );
/**
+ * Checks if data is in queue
+ *
+ * @since TB9.2
+ * @param aDataToPush Data to check
+ * @return ETrue if data is in queue, EFalse otherwise
+ */
+ TBool IsDataInQueue( const TDesC8* aDataToPush );
+
+ /**
* Adds data to event queue and starts sending if needed
*
* @since S60 5.0
- * @param aPushedData Data to push to the stream (not copied)
+ * @param aDataToPush Data to push to the stream (not copied)
* @param aCallback Callback to call when data is processed by the stream
* @return Symbian error code on error, KErrNone otherwise
*/
- TInt AddToQueueAndSend( const TDesC8 *aPushedData,
+ TInt AddToQueueAndSend( const TDesC8* aDataToPush,
MDunCompletionReporter* aCallback );
private:
@@ -204,11 +222,11 @@
* Gets called when outside party wants to push data to the existing stream
*
* @since S60 3.2
- * @param aPushedData Data to push to the stream (not copied)
+ * @param aDataToPush Data to push to the stream (not copied)
* @param aCallback Callback to call when data is processed by the stream
* @return Symbian error code on error, KErrNone otherwise
*/
- TInt NotifyDataPushRequest( const TDesC8 *aPushedData,
+ TInt NotifyDataPushRequest( const TDesC8* aDataToPush,
MDunCompletionReporter* aCallback );
// from base class MDunCompletionReporter
--- a/localconnectivityservice/dun/utils/inc/DunNoteHandler.h Fri Jun 11 14:27:06 2010 +0300
+++ b/localconnectivityservice/dun/utils/inc/DunNoteHandler.h Tue Jul 06 15:13:34 2010 +0300
@@ -20,9 +20,7 @@
#define C_CDUNNOTEHANDLER_H
#include <e32base.h>
-#include <dunutils.rsg>
-#include <AknGlobalConfirmationQuery.h>
-#include <data_caging_path_literals.hrh>
+#include <hbdevicemessageboxsymbian.h>
#include "DunTransporter.h"
/**
@@ -31,7 +29,8 @@
* @lib dunutils.lib
* @since S60 v3.2
*/
-NONSHARABLE_CLASS( CDunNoteHandler ) : public CActive
+NONSHARABLE_CLASS( CDunNoteHandler ) : public CBase,
+ public MHbDeviceMessageBoxObserver
{
public:
@@ -93,42 +92,18 @@
*/
void DoIssueRequestL();
- /**
- * Reads resource text
- *
- * @since S60 3.2
- * @param aResourceId Resource ID to read
- * @param aUnicode Buffer containing the note string to show
- * @return None
- */
- void ReadResourceTextL( TInt aResourceId, HBufC16*& aUnicode );
-
-// from base class CActive
+// from base class MHbDeviceMessageBoxObserver
- /*
- * From CActive.
- * Gets called when UI note dismissed
- *
- * @since S60 3.2
- * @return None
- */
- void RunL();
-
- /**
- * From CActive.
- * Gets called on cancel
- *
- * @since S60 3.2
- * @return None
- */
- void DoCancel();
+ // TODO: ADD DESCRIPTION HERE!
+ void MessageBoxClosed( const CHbDeviceMessageBoxSymbian* aMessageBox,
+ CHbDeviceMessageBoxSymbian::TButtonId aButton );
private: // data
/**
* Note to show
*/
- CAknGlobalConfirmationQuery* iNote;
+ CHbDeviceMessageBoxSymbian* iNote;
/**
* Current state of note showing: active or inactive
--- a/localconnectivityservice/dun/utils/inc/DunUpstream.h Fri Jun 11 14:27:06 2010 +0300
+++ b/localconnectivityservice/dun/utils/inc/DunUpstream.h Tue Jul 06 15:13:34 2010 +0300
@@ -77,17 +77,7 @@
TBool iDataMode;
/**
- * Flag to indicate whether AT parsing is needed or not
- */
- TBool iParseNeeded;
-
- /**
- * Flag to be set when AT command handling starts
- */
- TBool iHandling;
-
- /**
- * AT Command handler. Used if iAtParseNeeded is ETrue
+ * AT Command handler.
*/
CDunAtCmdHandler* iAtCmdHandler;
@@ -270,21 +260,12 @@
// from base class MDunAtCmdStatusReporter
/**
- * Notifies about AT command handling start
+ * Notifies about parser's need to get more data
*
- * @since S60 5.0
+ * @since TB9.2
* @return None
*/
- void NotifyAtCmdHandlingStart();
-
- /**
- * Notifies about AT command handling end
- *
- * @since S60 5.0
- * @param aEndIndex Index to the start of next command
- * @return None
- */
- void NotifyAtCmdHandlingEnd( TInt aStartIndex );
+ void NotifyParserNeedsMoreData();
/**
* Notifies about editor mode reply
--- a/localconnectivityservice/dun/utils/loc/dunutils.loc Fri Jun 11 14:27:06 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
-* 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: Localization strings for project DUN
-*
-*/
-
-
-// d: When a maximum number of dial-up connections with any bearer are already established
-// d: and the user tries to set up another one, a global query with this text is shown.
-// d: Query has only left softkey OK $text.softkey.ok$. This softkey confirms that user
-// d: see the note. User has to press softkey or Selection key and after that the note
-// d: disappears.
-// l: popup_note_window
-// w:
-// r: 5.0
-#define qtn_dun_max_number "Maximum number of dialup-connections. Dial-up failed."
--- a/localconnectivityservice/dun/utils/src/DunDataPusher.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/localconnectivityservice/dun/utils/src/DunDataPusher.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -99,17 +99,17 @@
// Adds event notification to queue
// ---------------------------------------------------------------------------
//
-TInt CDunDataPusher::AddToEventQueue( const TDesC8 *aPushedData,
+TInt CDunDataPusher::AddToEventQueue( const TDesC8* aDataToPush,
MDunCompletionReporter* aCallback )
{
FTRACE(FPrint( _L("CDunDataPusher::AddToQueue()" )));
- if ( !aPushedData || aPushedData->Length()<0 )
+ if ( !aDataToPush || aDataToPush->Length()<0 )
{
FTRACE(FPrint( _L("CDunDataPusher::AddToQueue() (unknown data) complete" )));
return KErrGeneral;
}
// Check if identical pointer to data already exists
- TInt foundIndex = FindEventFromQueue( aPushedData );
+ TInt foundIndex = FindEventFromQueue( aDataToPush );
if ( foundIndex >= 0 )
{
FTRACE(FPrint( _L("CDunDataPusher::AddToQueue() (already exists) complete" )));
@@ -117,7 +117,7 @@
}
// Unique pointer -> add to event queue
TDunDataPush dataPush;
- dataPush.iPushedData = aPushedData;
+ dataPush.iDataToPush = aDataToPush;
dataPush.iCallback = aCallback;
TInt retTemp = iEventQueue.Append( dataPush );
if ( retTemp != KErrNone )
@@ -125,7 +125,7 @@
FTRACE(FPrint( _L("CDunDataPusher::AddToQueue() (append failed!) complete" )));
return retTemp;
}
- FTRACE(FPrint( _L("CDunDataPusher::AddToQueue() complete (%d)" ), iEventQueue.Count() ));
+ FTRACE(FPrint( _L("CDunDataPusher::AddToQueue() complete (count=%d)" ), iEventQueue.Count() ));
return KErrNone;
}
@@ -133,14 +133,14 @@
// Finds an event from queue
// ---------------------------------------------------------------------------
//
-TInt CDunDataPusher::FindEventFromQueue( const TDesC8 *aPushedData )
+TInt CDunDataPusher::FindEventFromQueue( const TDesC8* aDataToPush )
{
FTRACE(FPrint( _L("CDunDataPusher::FindEventFromQueue()" )));
TInt i;
TInt count = iEventQueue.Count();
for ( i=0; i<count; i++ )
{
- if ( iEventQueue[i].iPushedData == aPushedData )
+ if ( iEventQueue[i].iDataToPush == aDataToPush )
{
FTRACE(FPrint( _L("CDunDataPusher::FindEventFromQueue() complete" )));
return i;
@@ -154,15 +154,15 @@
// Stops one event in the event queue
// ---------------------------------------------------------------------------
//
-TInt CDunDataPusher::StopOneEvent( const TDesC8 *aPushedData )
+TInt CDunDataPusher::StopOneEvent( const TDesC8* aDataToPush )
{
FTRACE(FPrint( _L("CDunDataPusher::StopOneEvent()" )));
- if ( !aPushedData )
+ if ( !aDataToPush )
{
FTRACE(FPrint( _L("CDunDataPusher::StopOneEvent() (unknown data) complete" )));
return KErrGeneral;
}
- TInt foundIndex = FindEventFromQueue( aPushedData );
+ TInt foundIndex = FindEventFromQueue( aDataToPush );
if ( foundIndex >= 0 )
{
if ( iEventIndex == foundIndex )
@@ -334,17 +334,18 @@
FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() (buffer mismatch) complete" )));
return KErrGeneral;
}
- iStatus = KRequestPending;
- const TDesC8 *pushedData = iEventQueue[iEventIndex].iPushedData;
+ const TDesC8* dataToPush = iEventQueue[iEventIndex].iDataToPush;
if ( iComm )
{
- iComm->Write( iStatus, *pushedData );
- FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() RComm Write() requested" ) ));
+ iStatus = KRequestPending;
+ iComm->Write( iStatus, *dataToPush );
+ FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() RComm Write() requested (buffer=0x%08X)" ), dataToPush ));
}
else if ( iSocket )
{
- iSocket->Send( *pushedData, 0, iStatus );
- FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() RSocket Send() requested" ) ));
+ iStatus = KRequestPending;
+ iSocket->Send( *dataToPush, 0, iStatus );
+ FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() RSocket Send() requested (buffer=0x%08X)" ), dataToPush ));
}
else
{
@@ -385,7 +386,7 @@
//
void CDunDataPusher::RunL()
{
- FTRACE(FPrint( _L("CDunDataPusher::RunL()" )));
+ FTRACE(FPrint( _L("CDunDataPusher::RunL() (buffer=0x%08X)" ), iEventQueue[iEventIndex].iDataToPush ));
TBool isError;
TInt retTemp = iStatus.Int();
--- a/localconnectivityservice/dun/utils/src/DunDownstream.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/localconnectivityservice/dun/utils/src/DunDownstream.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -116,10 +116,27 @@
}
// ---------------------------------------------------------------------------
+// Checks if data is in queue
+// ---------------------------------------------------------------------------
+//
+TBool CDunDownstream::IsDataInQueue( const TDesC8* aDataToPush )
+ {
+ FTRACE(FPrint( _L("CDunDownstream::IsDataInQueue()" ) ));
+ if ( !iPushData.iDataPusher )
+ {
+ FTRACE(FPrint( _L("CDunDownstream::IsDataInQueue() (iPushData.iDataPusher not initialized!) complete" )));
+ return EFalse;
+ }
+ TInt foundIndex = iPushData.iDataPusher->FindEventFromQueue( aDataToPush );
+ FTRACE(FPrint( _L("CDunDownstream::IsDataInQueue() complete" ) ));
+ return ( foundIndex >= 0 ) ? ETrue : EFalse;
+ }
+
+// ---------------------------------------------------------------------------
// Adds data to event queue and starts sending if needed
// ---------------------------------------------------------------------------
//
-TInt CDunDownstream::AddToQueueAndSend( const TDesC8 *aPushedData,
+TInt CDunDownstream::AddToQueueAndSend( const TDesC8* aDataToPush,
MDunCompletionReporter* aCallback )
{
FTRACE(FPrint( _L("CDunDownstream::AddToQueueAndSend()" ) ));
@@ -129,7 +146,7 @@
return KErrGeneral;
}
// Add to event queue. If something went wrong, just return
- TInt retTemp = iPushData.iDataPusher->AddToEventQueue( aPushedData, aCallback );
+ TInt retTemp = iPushData.iDataPusher->AddToEventQueue( aDataToPush, aCallback );
if ( retTemp != KErrNone )
{
FTRACE(FPrint( _L("CDunDownstream::AddToQueueAndSend() (ERROR) complete" )));
@@ -149,6 +166,7 @@
TInt CDunDownstream::StartStream()
{
FTRACE(FPrint( _L("CDunDownstream::StartStream()" ) ));
+ FTRACE(FPrint( _L("CDunDownstream::StartStream() (buffer=0x%08X)" ), iBufferPtr ));
// Note: only start URC here.
// The downstream read request is started when command mode ends.
// This is done to make the data arrive in the correct order (reply vs.
@@ -363,13 +381,13 @@
// Gets called when outside party wants to push data to the existing stream
// ---------------------------------------------------------------------------
//
-TInt CDunDownstream::NotifyDataPushRequest( const TDesC8 *aPushedData,
+TInt CDunDownstream::NotifyDataPushRequest( const TDesC8* aDataToPush,
MDunCompletionReporter* aCallback )
{
FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushRequest()" )));
// If in data mode push the reply anyway as "CONNECT" or "NO CARRIER"
// reply could arrive before/after the command mode information itself.
- TInt retVal = AddToQueueAndSend( aPushedData, aCallback );
+ TInt retVal = AddToQueueAndSend( aDataToPush, aCallback );
FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushRequest() complete" )));
return retVal;
}
--- a/localconnectivityservice/dun/utils/src/DunNoteHandler.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/localconnectivityservice/dun/utils/src/DunNoteHandler.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -16,20 +16,9 @@
*/
-#include <bautils.h>
-#include <featmgr.h>
-#include <aknSDData.h>
-#include <secondarydisplay/dunsecondarydisplayapi.h>
#include "DunNoteHandler.h"
#include "DunDebug.h"
-_LIT( KDunUtilsDriveSpec, "z:" );
-_LIT( KDunUtilsResourceFileName, "dunutils.rsc" );
-
-const TInt KDunCoverEnumStart = (ECmdNone + 1); // start after ECmdNone
-const TInt KDunPtr8toPtr16Divider = 2; // Divider for converting
-const TInt KDunThreeItemsToPop = 3;
-
// ======== MEMBER FUNCTIONS ========
// ---------------------------------------------------------------------------
@@ -91,7 +80,6 @@
FTRACE(FPrint( _L("CDunNoteHandler::IssueRequest() (trapped!) complete (%d)"), retTrap));
return retTrap;
}
- SetActive();
iNoteState = EDunStateUiNoting;
FTRACE(FPrint( _L("CDunNoteHandler::IssueRequest() complete") ));
return KErrNone;
@@ -114,8 +102,7 @@
FTRACE(FPrint( _L("CDunNoteHandler::Stop() (iNote not initialized!) complete") ));
return KErrGeneral;
}
- iNote->CancelConfirmationQuery();
- Cancel();
+ iNote->Close();
iNoteState = EDunStateIdle;
FTRACE(FPrint( _L("CDunNoteHandler::Stop() complete") ));
return KErrNone;
@@ -125,8 +112,7 @@
// CDunNoteHandler::CDunNoteHandler
// ---------------------------------------------------------------------------
//
-CDunNoteHandler::CDunNoteHandler() :
- CActive( EPriorityStandard )
+CDunNoteHandler::CDunNoteHandler()
{
Initialize();
}
@@ -138,7 +124,6 @@
void CDunNoteHandler::ConstructL()
{
FTRACE(FPrint( _L("CDunNoteHandler::ConstructL()") ));
- CActiveScheduler::Add( this );
FTRACE(FPrint( _L("CDunNoteHandler::ConstructL() complete") ));
}
@@ -166,83 +151,34 @@
FTRACE(FPrint( _L("CDunNoteHandler::DoIssueRequestL() (ERROR) complete") ));
User::Leave( KErrGeneral );
}
- HBufC16* unicodeString = NULL;
- ReadResourceTextL( R_DUN_MAXIMUM_DIALUPS, unicodeString );
- CAknGlobalConfirmationQuery* note = CAknGlobalConfirmationQuery::NewLC();
- // Publish cover UI note data
- CAknSDData* sdData = CAknSDData::NewL( KDunNoteCategory,
- ECmdMaxNumber - KDunCoverEnumStart,
- KNullDesC8 );
- note->SetSecondaryDisplayData( sdData ); // ownership transferred
- // Start to show note
- iStatus = KRequestPending;
- note->ShowConfirmationQueryL( iStatus,
- *unicodeString,
- R_AVKON_SOFTKEYS_OK_EMPTY,
- R_QGN_NOTE_ERROR_ANIM,
- KNullDesC,
- 0,
- 0,
- CAknQueryDialog::EErrorTone );
- CleanupStack::Pop( note );
- delete unicodeString;
- iNote = note;
+
+ CHbDeviceMessageBoxSymbian* messageBox =
+ CHbDeviceMessageBoxSymbian::NewL(
+ CHbDeviceMessageBoxSymbian::EWarning);
+ CleanupStack::PushL(messageBox);
+ //ToDo: Need to use localised strings.
+ _LIT(KText, "Maximum number of dialup-connections. Dial-up failed.");
+ messageBox->SetTextL(KText);
+ messageBox->SetObserver(this);
+ messageBox->SetTimeout(0);
+ messageBox->ShowL();
+ CleanupStack::Pop(messageBox);
+ iNote = messageBox;
FTRACE(FPrint( _L("CDunNoteHandler::DoIssueRequestL() complete") ));
}
// ---------------------------------------------------------------------------
-// Reads resource string
+// From class MHbDeviceMessageBoxObserver.
+// Gets called on dialog close.
// ---------------------------------------------------------------------------
//
-void CDunNoteHandler::ReadResourceTextL( TInt aResourceId, HBufC16*& aUnicode )
+void CDunNoteHandler::MessageBoxClosed(
+ const CHbDeviceMessageBoxSymbian* /*aMessageBox*/,
+ CHbDeviceMessageBoxSymbian::TButtonId /*aButton*/ )
{
- FTRACE(FPrint( _L("CDunNoteHandler::ReadNoteResourceL()") ));
- // Connect to file server (for resource file reading)
- RFs fileSession;
- CleanupClosePushL<RFs>( fileSession );
- User::LeaveIfError( fileSession.Connect() );
- // Create dunutils.rsc path and file name
- TFileName fileName;
- fileName = KDunUtilsDriveSpec;
- fileName += KDC_RESOURCE_FILES_DIR;
- fileName += KDunUtilsResourceFileName;
- // Find nearest language file for resource
- BaflUtils::NearestLanguageFile( fileSession, fileName );
- // Read note resource
- RResourceFile resourceFile;
- CleanupClosePushL<RResourceFile>( resourceFile );
- resourceFile.OpenL( fileSession, fileName );
- resourceFile.ConfirmSignatureL();
- HBufC8* readBuffer = resourceFile.AllocReadLC( aResourceId );
- // Convert read HBufC8 to HBufC16
- const TPtrC16 ptr16(reinterpret_cast<const TUint16*>
- (readBuffer->Ptr()),
- (readBuffer->Size() / KDunPtr8toPtr16Divider) );
- aUnicode = HBufC16::NewL( ptr16.Length() );
- *aUnicode = ptr16;
- CleanupStack::PopAndDestroy( KDunThreeItemsToPop ); // readBuffer, resourceFile, fileSession
- FTRACE(FPrint( _L("CDunNoteHandler::ReadNoteResourceL() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called when UI note dismissed
-// ---------------------------------------------------------------------------
-//
-void CDunNoteHandler::RunL()
- {
- FTRACE(FPrint( _L("CDunNoteHandler::RunL()" ) ));
+ FTRACE(FPrint( _L("CDunNoteHandler::MessageBoxClosed()" ) ));
iNoteState = EDunStateIdle;
delete iNote;
iNote = NULL;
- FTRACE(FPrint( _L("CDunNoteHandler::RunL() complete" ) ));
+ FTRACE(FPrint( _L("CDunNoteHandler::MessageBoxClosed() complete" ) ));
}
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called on cancel
-// ---------------------------------------------------------------------------
-//
-void CDunNoteHandler::DoCancel()
- {
- }
--- a/localconnectivityservice/dun/utils/src/DunUpstream.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/localconnectivityservice/dun/utils/src/DunUpstream.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -124,8 +124,6 @@
atCmdHandler->AddCmdModeCallback( aCallbackUp );
atCmdHandler->AddCmdModeCallback( aCallbackDown );
iParseData.iDataMode = EFalse;
- iParseData.iParseNeeded = ETrue;
- iParseData.iHandling = EFalse;
iParseData.iAtCmdHandler = atCmdHandler;
FTRACE(FPrint( _L("CDunUpstream::InitializeForAtParsing() complete" ) ));
return KErrNone;
@@ -245,8 +243,6 @@
iActivityData.iDataRead = EFalse;
iActivityData.iNotified = EFalse;
iParseData.iDataMode = EFalse;
- iParseData.iParseNeeded = EFalse;
- iParseData.iHandling = EFalse;
iParseData.iAtCmdHandler = NULL;
}
@@ -323,7 +319,7 @@
{
FTRACE(FPrint( _L("CDunUpstream::ProcessReadData()" )));
// The following will be transferred to Dataport
- if ( iParseData.iDataMode || !iParseData.iParseNeeded )
+ if ( iParseData.iDataMode )
{
iOperationType = EDunOperationTypeWrite;
FTRACE(FPrint( _L("CDunUpstream::ProcessReadData() (next write) complete" )));
@@ -336,14 +332,16 @@
}
// The following will be transferred to parser
TInt retTemp = KErrNone;
- TBool partialInput = EFalse;
- retTemp = iParseData.iAtCmdHandler->ParseCommand( *iBufferPtr,
- partialInput );
- if ( retTemp!=KErrNone || !partialInput )
+ TBool moreNeeded = EFalse;
+ retTemp = iParseData.iAtCmdHandler->AddDataForParsing( *iBufferPtr,
+ moreNeeded );
+ if ( retTemp!=KErrNone || !moreNeeded )
{
+ // If error or no error but no more data needed, don't reissue
FTRACE(FPrint( _L("CDunUpstream::ProcessReadData() (no reissue) complete" )));
return EFalse;
}
+ // If no error and more data needed, reissue
FTRACE(FPrint( _L("CDunUpstream::ProcessReadData() (reissue) complete" )));
return ETrue;
}
@@ -446,56 +444,14 @@
// ---------------------------------------------------------------------------
// From class MDunAtCmdStatusReporter
-// Notifies about AT command handling start
-// ---------------------------------------------------------------------------
-//
-void CDunUpstream::NotifyAtCmdHandlingStart()
- {
- FTRACE(FPrint( _L("CDunUpstream::NotifyAtCmdHandlingStart()" )));
- if ( iParseData.iHandling )
- {
- FTRACE(FPrint( _L("CDunUpstream::NotifyAtCmdHandlingStart() (already set!)" )));
- }
- iParseData.iHandling = ETrue;
- FTRACE(FPrint( _L("CDunUpstream::NotifyAtCmdHandlingStart() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunAtCmdStatusReporter
-// Notifies about AT command handling end
+// Notifies about parser's need to get more data
// ---------------------------------------------------------------------------
//
-void CDunUpstream::NotifyAtCmdHandlingEnd( TInt aStartIndex )
+void CDunUpstream::NotifyParserNeedsMoreData()
{
- FTRACE(FPrint( _L("CDunUpstream::NotifyAtCmdHandlingEnd()" )));
- if ( !iParseData.iHandling )
- {
- FTRACE(FPrint( _L("CDunUpstream::NotifyAtCmdHandlingEnd() (already set!)" )));
- }
- iParseData.iHandling = EFalse;
- // Next check the offset to the next command inside this block
- TInt length = iBufferPtr->Length();
- if ( aStartIndex < 0 )
- {
- // Start of the next command not found so here we need to just reissue
- // the read request and not clear the input buffer.
- iParseData.iAtCmdHandler->SetEndOfCmdLine( EFalse );
- IssueRequest(); // iOperationType must be read here (don't set)
- FTRACE(FPrint( _L("CDunUpstream::NotifyAtCmdHandlingEnd() (not found) complete" )));
- return;
- }
- // Here the start of next command was found so try to directly handle that
- // command using ProcessReadData() for the next subblock.
- iParseData.iAtCmdHandler->SetEndOfCmdLine( ETrue );
- TInt maxLength = iBufferPtr->MaxLength();
- iBufferPtr->Set( &(*iBufferPtr)[aStartIndex], length-aStartIndex, maxLength );
- TBool reIssue = ProcessReadData();
- if ( reIssue )
- {
- // Note: should come here only if something went wrong
- IssueRequest();
- }
- FTRACE(FPrint( _L("CDunUpstream::NotifyAtCmdHandlingEnd() complete" )));
+ FTRACE(FPrint( _L("CDunUpstream::NotifyParserNeedsMoreData()" )));
+ IssueRequest(); // iOperationType must be read here (don't set)
+ FTRACE(FPrint( _L("CDunUpstream::NotifyParserNeedsMoreData() complete" )));
}
// ---------------------------------------------------------------------------
--- a/mtpdataproviders/mtpimagedp/inc/cmtpimagedpobjectpropertymgr.h Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/inc/cmtpimagedpobjectpropertymgr.h Tue Jul 06 15:13:34 2010 +0300
@@ -25,6 +25,7 @@
#include <e32base.h>
#include <f32file.h>
#include <e32std.h>
+#include <e32hashtab.h>
#include <mdesession.h>
#include <mtp/mtpprotocolconstants.h>
@@ -74,7 +75,8 @@
void GetPropertyL(TMTPObjectPropertyCode aProperty, CMTPTypeArray& aValue, TBool alwaysCreate = ETrue);
//clear the cache
- void ClearCacheL();
+ void ClearAllCache();
+ void ClearCache(TUint aHandle);
void ConvertMTPTimeStr2TTimeL(const TDesC& aTimeString, TTime& aModifiedTime) const;
void StoreThunmnail(TUint aHandle, HBufC8* aData);
@@ -108,6 +110,9 @@
void OpenMdeObjectL();
void ClearThumnailCache();
+ TBool FindPropertiesCache(TUint aObjectHandle);
+ void DestroyPropertiesCahce(TUint aObjectHandle);
+
private:
//define property cache object
@@ -123,7 +128,6 @@
EImagePixHeight = 1,
EImageBitDepth = 2,
EDateCreated = 3,
-
/**
The number of elements.
*/
@@ -138,11 +142,9 @@
const TDesC& DesC(TUint aId) const;
TUint Uint(TUint aId) const;
- TUint ObjectHandle() const;
void SetDesCL(TUint aId, const TDesC& aValue);
- void SetUint(TUint aId, TUint aValue);
- void SetObjectHandle(TUint aObjectHandle);
+ void SetUint(TUint aId, TUint aValue);
private:
@@ -178,11 +180,6 @@
*/
RArray<TUint> iElementsUint;
- /**
- The object handle of owner
- */
- TUint iObjectHandle;
-
static const TElementMetaData KElements[];
};
@@ -211,7 +208,6 @@
MMTPObjectMgr& iObjectMgr;
CMTPObjectMetaData* iObjectInfo; //not owned
TBool iCacheHit;//flag to indicate cache is available
- TBool iNeedParse;//flag to indicate whether we need to parse image file by our self
/*
* Cache thumbnail, thumbnail size is inconsistent in winlogo test
@@ -222,7 +218,8 @@
* Cache the latest image properties which PC send to device,
* it can optimize synce/reverse-sync performance due to reduction of object properties generation
*/
- CMTPImagePropertiesCache* iPropertiesCache;
+ CMTPImagePropertiesCache* iCurrentPropertiesCache;
+ RHashMap<TUint, CMTPImagePropertiesCache*> iPropretiesCacheMap;
};
#endif // CMTPIMAGEDPOBJECTPROPERTYMGR_H
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -586,7 +586,7 @@
/**
* We clear property manager cache when receiving session close notification from framework every times
*/
- iPropertyMgr->ClearCacheL();
+ iPropertyMgr->ClearAllCache();
__FLOG(_L8("<< SessionClosedL"));
}
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpcopyobject.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpcopyobject.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -45,7 +45,7 @@
const TMTPRequestElementInfo KMTPCopyObjectPolicy[] =
{
{TMTPTypeRequest::ERequestParameter2, EMTPElementTypeStorageId, EMTPElementAttrWrite, 0, 0, 0},
- {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir | EMTPElementAttrWrite, 1, 0, 0}
+ {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir, 1, 0, 0}
};
/**
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectinfo.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectinfo.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -141,7 +141,7 @@
TUint16 thumbFormat;
iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeRepresentativeSampleFormat, thumbFormat);
iObjectInfoToBuild->SetUint16L(CMTPTypeObjectInfo::EThumbFormat, thumbFormat);
- TUint32 value;
+ TUint32 value(0);
iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeRepresentativeSampleSize, value);
iObjectInfoToBuild->SetUint32L(CMTPTypeObjectInfo::EThumbCompressedSize, value);
iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeRepresentativeSampleWidth, value);
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectproplist.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectproplist.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -363,7 +363,7 @@
case EMTPObjectPropCodeRepresentativeSampleHeight:
case EMTPObjectPropCodeRepresentativeSampleWidth:
{
- TUint32 value;
+ TUint32 value(0);
iPropertyMgr.GetPropertyL(TMTPObjectPropertyCode(aPropCode), value, EFalse);
CMTPTypeObjectPropListElement& propElem = iPropertyList->ReservePropElemL(aHandle, propCode);
propElem.SetUint32L(CMTPTypeObjectPropListElement::EValue, value);
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectpropvalue.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectpropvalue.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -314,7 +314,7 @@
void CMTPImageDpGetObjectPropValue::ServiceRepresentativeSampleSizeL()
{
- TUint32 representativeSampleSize;
+ TUint32 representativeSampleSize(0);
iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeRepresentativeSampleSize, representativeSampleSize, EFalse);
iMTPTypeUint32.Set(representativeSampleSize);
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpmoveobject.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpmoveobject.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -45,7 +45,7 @@
const TMTPRequestElementInfo KMTPMoveObjectPolicy[] =
{
{TMTPTypeRequest::ERequestParameter2, EMTPElementTypeStorageId, EMTPElementAttrWrite, 0, 0, 0},
- {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir | EMTPElementAttrWrite, 1, 0, 0}
+ {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir, 1, 0, 0}
};
/**
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpobjectpropertymgr.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpobjectpropertymgr.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -51,6 +51,9 @@
// Class constants.
__FLOG_STMT(_LIT8(KComponent,"MTPImageDpPropertyMgr");)
+// Indicate how many cache can be stored
+const TUint KCacheThreshold = 16;
+
/**
The properties cache table content.
*/
@@ -112,13 +115,10 @@
break;
}
}
-
- iObjectHandle = KMTPHandleNone;
}
void CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::ResetL()
{
- iObjectHandle = KMTPHandleNone;
SetUint(EImagePixWidth, 0);
SetUint(EImagePixHeight, 0);
SetUint(EImageBitDepth, 0);
@@ -137,11 +137,6 @@
return iElementsUint[iElements[aId].iOffset];
}
-TUint CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::ObjectHandle() const
- {
- return iObjectHandle;
- }
-
void CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::SetDesCL(TUint aId, const TDesC& aValue)
{
const TElementMetaData& KElement(iElements[aId]);
@@ -157,11 +152,6 @@
iElementsUint[iElements[aId].iOffset] = aValue;
}
-void CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::SetObjectHandle(TUint aObjectHandle)
- {
- iObjectHandle = aObjectHandle;
- }
-
CMTPImageDpObjectPropertyMgr* CMTPImageDpObjectPropertyMgr::NewL(MMTPDataProviderFramework& aFramework, CMTPImageDataProvider& aDataProvider)
{
CMTPImageDpObjectPropertyMgr* self = new (ELeave) CMTPImageDpObjectPropertyMgr(aFramework, aDataProvider);
@@ -175,7 +165,7 @@
iFramework(aFramework),
iDataProvider(aDataProvider),
iFs(aFramework.Fs()),
- iObjectMgr(aFramework.ObjectMgr())
+ iObjectMgr(aFramework.ObjectMgr())
{
__FLOG_OPEN(KMTPSubsystem, KComponent);
}
@@ -183,7 +173,6 @@
void CMTPImageDpObjectPropertyMgr::ConstructL(MMTPDataProviderFramework& /*aFramework*/)
{
__FLOG(_L8("CMTPImageDpObjectPropertyMgr::ConstructL - Entry"));
- iPropertiesCache = CMTPImagePropertiesCache::NewL();
iMetaDataSession = CMdESession::NewL(*this);
__FLOG(_L8("CMTPImageDpObjectPropertyMgr::ConstructL - Exit"));
}
@@ -191,10 +180,13 @@
CMTPImageDpObjectPropertyMgr::~CMTPImageDpObjectPropertyMgr()
{
__FLOG(_L8("CMTPImageDpObjectPropertyMgr::~CMTPImageDpObjectPropertyMgr - Entry"));
- delete iPropertiesCache;
delete iObject;
delete iMetaDataSession;
delete iThumbnailCache.iThumbnailData;
+
+ //Clear propreties cache map
+ ClearAllCache();
+ iPropretiesCacheMap.Close();
__FLOG(_L8("CMTPImageDpObjectPropertyMgr::~CMTPImageDpObjectPropertyMgr - Exit"));
__FLOG_CLOSE;
}
@@ -212,26 +204,12 @@
/**
* determine whether the cache hit is occured
*/
- if (iPropertiesCache->ObjectHandle() == iObjectInfo->Uint(CMTPObjectMetaData::EHandle))
+ iCacheHit = FindPropertiesCache(iObjectInfo->Uint(CMTPObjectMetaData::EHandle));
+ if (!iCacheHit)
{
- iCacheHit = ETrue;
- }
- else
- {
- iCacheHit = EFalse;
-
- /**
- * if cache miss, we should clear the cache content
- */
- ClearCacheL();
-
- //need parse image file by our self if fail to get properties from MdS
- iNeedParse = ETrue;
-
- //clear previous Mde object
delete iObject;
- iObject = NULL;
- }
+ iObject = NULL;
+ }
}
else
{
@@ -241,13 +219,27 @@
* other operations will not use cache, such as setobjectvalue/setobjectproplist
*/
if (aSaveToCache)
- {
+ {
TUint objectHandle = iObjectInfo->Uint(CMTPObjectMetaData::EHandle);
- if (iPropertiesCache->ObjectHandle() != objectHandle)
+ if (FindPropertiesCache(objectHandle))
+ {
+ __FLOG_VA((_L16("SetCurrentObjectL - find object in cache:%u"), objectHandle));
+ iCurrentPropertiesCache->ResetL();
+ }
+ else
{
- iPropertiesCache->ResetL();
+ if (iPropretiesCacheMap.Count() > KCacheThreshold)
+ {
+ // Find the first object handle from cache map and then destory it
+ RHashMap<TUint, CMTPImagePropertiesCache*>::TIter iter(iPropretiesCacheMap);
+ DestroyPropertiesCahce(*iter.NextKey());
+ __FLOG_VA((_L16("SetCurrentObjectL - destory object:%u"), objectHandle));
+ }
+
+ iCurrentPropertiesCache = CMTPImagePropertiesCache::NewL();
+ iPropretiesCacheMap.Insert(objectHandle, iCurrentPropertiesCache);
+ __FLOG_VA((_L16("SetCurrentObjectL - create new object:%u"), objectHandle));
}
- iPropertiesCache->SetObjectHandle(objectHandle);
}
}
@@ -304,13 +296,22 @@
iObjectInfo->SetUint(CMTPObjectMetaData::EParentHandle, aValue);
break;
case EMTPObjectPropCodeWidth:
- iPropertiesCache->SetUint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImagePixWidth, aValue);
+ if (iCurrentPropertiesCache != NULL)
+ {
+ iCurrentPropertiesCache->SetUint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImagePixWidth, aValue);
+ }
break;
case EMTPObjectPropCodeHeight:
- iPropertiesCache->SetUint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImagePixHeight, aValue);
+ if (iCurrentPropertiesCache != NULL)
+ {
+ iCurrentPropertiesCache->SetUint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImagePixHeight, aValue);
+ }
break;
case EMTPObjectPropCodeImageBitDepth:
- iPropertiesCache->SetUint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImageBitDepth, aValue);
+ if (iCurrentPropertiesCache != NULL)
+ {
+ iCurrentPropertiesCache->SetUint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImageBitDepth, aValue);
+ }
break;
default:
//nothing to do
@@ -363,7 +364,10 @@
break;
case EMTPObjectPropCodeDateCreated://MdS property
- iPropertiesCache->SetDesCL(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EDateCreated, aValue);
+ if (iCurrentPropertiesCache != NULL)
+ {
+ iCurrentPropertiesCache->SetDesCL(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EDateCreated, aValue);
+ }
break;
default:
@@ -640,19 +644,19 @@
switch (aProperty)
{
case EMTPObjectPropCodeDateCreated:
- (*(static_cast<CMTPTypeString*>(aValue))).SetL(iPropertiesCache->DesC(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EDateCreated));
+ (*(static_cast<CMTPTypeString*>(aValue))).SetL(iCurrentPropertiesCache->DesC(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EDateCreated));
break;
case EMTPObjectPropCodeWidth:
- *static_cast<TUint32*>(aValue) = iPropertiesCache->Uint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImagePixWidth);
+ *static_cast<TUint32*>(aValue) = iCurrentPropertiesCache->Uint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImagePixWidth);
break;
case EMTPObjectPropCodeHeight:
- *static_cast<TUint32*>(aValue) = iPropertiesCache->Uint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImagePixHeight);
+ *static_cast<TUint32*>(aValue) = iCurrentPropertiesCache->Uint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImagePixHeight);
break;
case EMTPObjectPropCodeImageBitDepth:
- *static_cast<TUint32*>(aValue) = iPropertiesCache->Uint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImageBitDepth);
+ *static_cast<TUint32*>(aValue) = iCurrentPropertiesCache->Uint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImageBitDepth);
break;
default:
@@ -958,9 +962,18 @@
iMdeSessionError = aError;
}
-void CMTPImageDpObjectPropertyMgr::ClearCacheL()
+void CMTPImageDpObjectPropertyMgr::ClearAllCache()
{
- iPropertiesCache->ResetL();
+ while (iPropretiesCacheMap.Count())
+ {
+ RHashMap<TUint, CMTPImagePropertiesCache*>::TIter iter(iPropretiesCacheMap);
+ DestroyPropertiesCahce(*iter.NextKey());
+ };
+ }
+
+void CMTPImageDpObjectPropertyMgr::ClearCache(TUint aHandle)
+ {
+ DestroyPropertiesCahce(aHandle);
}
void CMTPImageDpObjectPropertyMgr::OpenMdeObjectL()
@@ -986,3 +999,32 @@
iThumbnailCache.iObjectHandle = KMTPHandleNone;
}
+
+TBool CMTPImageDpObjectPropertyMgr::FindPropertiesCache(TUint aObjectHandle)
+ {
+ TBool ret = EFalse;
+ CMTPImagePropertiesCache** ppCache = iPropretiesCacheMap.Find(aObjectHandle);
+ if (ppCache)
+ {
+ iCurrentPropertiesCache = *ppCache;
+ ret = (iCurrentPropertiesCache != NULL) ? ETrue : EFalse;
+ }
+ else
+ {
+ iCurrentPropertiesCache = NULL;
+ ret = EFalse;
+ }
+
+ return ret;
+ }
+
+void CMTPImageDpObjectPropertyMgr::DestroyPropertiesCahce(TUint aObjectHandle)
+ {
+ CMTPImagePropertiesCache** ppCache = iPropretiesCacheMap.Find(aObjectHandle);
+ if (ppCache)
+ {
+ CMTPImagePropertiesCache* pCache = *ppCache;
+ delete pCache;
+ iPropretiesCacheMap.Remove(aObjectHandle);
+ }
+ }
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpsendobjectinfo.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpsendobjectinfo.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -879,7 +879,7 @@
*/
TRAP_IGNORE(
iFramework.ObjectMgr().RemoveObjectL(iReceivedObject->Uint(CMTPObjectMetaData::EHandle));
- iObjectPropertyMgr.ClearCacheL();
+ iObjectPropertyMgr.ClearCache(iReceivedObject->Uint(CMTPObjectMetaData::EHandle));
);
}
--- a/mtpdataproviders/mtppictbridgedp/inc/s60dependency.h Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpdataproviders/mtppictbridgedp/inc/s60dependency.h Tue Jul 06 15:13:34 2010 +0300
@@ -24,7 +24,7 @@
#include <e32base.h>
-#include <platform/mw/usbwatcherinternalpskeys.h>
+#include <platform/mw/UsbWatcherInternalPSKeys.h>
#include <platform/mw/usbpersonalityids.h>
#include <pathinfo.h>
#include <featmgr/featmgr.h>
--- a/mtpdataproviders/mtppictbridgedp/src/cmtppictbridgedpsendobjectinfo.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpdataproviders/mtppictbridgedp/src/cmtppictbridgedpsendobjectinfo.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -42,7 +42,7 @@
const TMTPRequestElementInfo KMTPSendObjectInfoPolicy[] =
{
{TMTPTypeRequest::ERequestParameter1, EMTPElementTypeStorageId, EMTPElementAttrWrite, 1, 0, 0},
- {TMTPTypeRequest::ERequestParameter2, EMTPElementTypeObjectHandle, EMTPElementAttrWrite, 2, KMTPHandleAll, KMTPHandleNone}
+ {TMTPTypeRequest::ERequestParameter2, EMTPElementTypeObjectHandle, EMTPElementAttrDir, 2, KMTPHandleAll, KMTPHandleNone}
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/group/bld.inf Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,28 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+mtp_playbackcontroldp.iby /epoc32/rom/include/mtp_playbackcontroldp.iby
+
+PRJ_MMPFILES
+mtpplaybackcontroldp.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/group/mtp_playbackcontroldp.iby Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,38 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef MTP_PLAYBACKCONTROL_IBY
+#define MTP_PLAYBACKCONTROL_IBY
+
+#if !defined(SYMBIAN_EXCLUDE_MTP)
+
+#ifdef FF_AUTOMOTIVESTACK
+// MTP Playback Control Data Provider
+ECOM_PLUGIN(mtpplaybackcontroldp.dll, mtpplaybackcontroldp.rsc)
+
+// MTP plugin registration resource file
+data=EPOCROOT##epoc32\data\Z\resource\mtp\2002EA99.rsc resource\mtp\2002EA99.rsc
+#endif
+
+
+
+#endif //SYMBIAN_EXCLUDE_MTP
+
+#endif //MTP_PLAYBACKCONTROL_IBY
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/group/mtp_playbackcontroldp.mrp Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,29 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+component mtp_playbackdp
+source \sf\mw\remoteconn\mtpdataproviders\mtpplaybackcontroldp
+
+binary \sf\mw\remoteconn\mtpdataproviders\mtpplaybackcontroldp\group all
+exports \sf\mw\remoteconn\mtpdataproviders\mtpplaybackcontroldp\group
+
+notes_source \component_defs\release.src
+
+ipr E
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/group/mtpplaybackcontroldp.mmp Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,93 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <comms-infras/commsdebugutility.mmh>
+
+TARGET mtpplaybackcontroldp.dll
+TARGETTYPE PLUGIN
+UID 0x10009D8D 0x2002EA98
+VENDORID 0x70000001
+
+CAPABILITY CommDD PowerMgmt ReadDeviceData WriteDeviceData TrustedUI ProtServ NetworkControl NetworkServices LocalServices ReadUserData WriteUserData
+
+MW_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+USERINCLUDE ../inc
+USERINCLUDE ../../../mtpfws/mtpfw/dataproviders/dputility/inc
+USERINCLUDE ../../../mtpfws/mtpfw/common/inc
+USERINCLUDE ../../../mtpfws/mtpfw/inc
+
+USERINCLUDE ../mtpplaybackinterface/inc
+USERINCLUDE ../mtpplaybackmpximplementation/inc
+
+SOURCEPATH ../src
+SOURCE cmtppbcgetdevicepropdesc.cpp
+SOURCE cmtppbcgetdevicepropvalue.cpp
+SOURCE cmtppbcsetdevicepropvalue.cpp
+SOURCE cmtppbcresetdevicepropvalue.cpp
+SOURCE cmtpplaybackcontroldp.cpp
+SOURCE mtpplaybackcontroldpimplproxy.cpp
+SOURCE mtpplaybackcontroldpprocessor.cpp
+SOURCE cmtpplaybackmap.cpp
+SOURCE cmtpplaybackproperty.cpp
+SOURCE cmtppbcskip.cpp
+
+SOURCEPATH ../mtpplaybackinterface/src
+SOURCE mmtpplaybackinterface.cpp
+SOURCE cmtpplaybackcommand.cpp
+SOURCE cmtpplaybackevent.cpp
+SOURCE cmtpplaybackparam.cpp
+
+SOURCEPATH ../mtpplaybackmpximplementation/src
+SOURCE cmtpplaybackcontrolimpl.cpp
+SOURCE cmtpplaybackplaylisthelper.cpp
+SOURCE cmtpplaybackresumehelper.cpp
+SOURCE cmtpplaybackcommandchecker.cpp
+
+SOURCEPATH ../src
+START RESOURCE mtpplaybackcontroldp.rss
+TARGET mtpplaybackcontroldp.rsc
+END
+
+// Data provider configuration resource file.
+// The target filename corresponds to the implementation UID.
+START RESOURCE mtpplaybackcontroldp_config.rss
+TARGETPATH /resource/mtp
+TARGET 2002EA99.rsc
+END
+
+
+
+
+LIBRARY euser.lib
+LIBRARY efsrv.lib
+LIBRARY ecom.lib
+
+LIBRARY mtpdatatypes.lib
+LIBRARY mtpdataproviderapi.lib
+LIBRARY mtpdataproviderutility.lib
+LIBRARY mtpframework.lib
+
+LIBRARY mpxplaybackutility.lib
+LIBRARY mpxcommon.lib
+LIBRARY mpxcollectionhelper.lib
+LIBRARY mpxcollectionutility.lib
+LIBRARY platformenv.lib
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/inc/cmtppbcgetdevicepropdesc.h Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,70 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+ */
+
+#ifndef CMTPPBCGETPBDEVICEPROPDESC_H
+#define CMTPPBCGETPBDEVICEPROPDESC_H
+
+#include "cmtprequestprocessor.h"
+#include "mtpdebug.h"
+#include "cmtpplaybackmap.h"
+
+class CMTPTypeDevicePropDesc;
+class CMTPPlaybackControlDataProvider;
+
+/**
+Implements the device data provider GetDevicePropDesc request processor.
+@internalComponent
+*/
+class CMTPPbcGetDevicePropDesc : public CMTPRequestProcessor, public MMTPPlaybackCallback
+ {
+
+public:
+
+ static MMTPRequestProcessor* NewL(MMTPDataProviderFramework& aFramework,
+ MMTPConnection& aConnection,
+ CMTPPlaybackControlDataProvider& aDataProvider);
+ ~CMTPPbcGetDevicePropDesc();
+
+protected:
+ // From CMTPRequestProcessor
+ virtual TMTPResponseCode CheckRequestL();
+
+private: // From CMTPRequestProcessor
+ void ServiceL();
+
+private: //From MMTPPlaybackCallback
+ void HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr);
+
+private:
+ CMTPPbcGetDevicePropDesc(MMTPDataProviderFramework& aFramework,
+ MMTPConnection& aConnection,
+ CMTPPlaybackControlDataProvider& aDataProvider);
+
+private: // Owned.
+
+ __FLOG_DECLARATION_MEMBER_MUTABLE;
+ CMTPPlaybackControlDataProvider& iPlaybackControlDp;
+
+ CMTPTypeDevicePropDesc* iPropDesc;
+ CMTPPlaybackCommand* iPbCmd;
+ };
+
+#endif //CMTPPBCGETPBDEVICEPROPDESC_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/inc/cmtppbcgetdevicepropvalue.h Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,64 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef CMTPPBCGETPBDEVICEPROPVALUE_H
+#define CMTPPBCGETPBDEVICEPROPVALUE_H
+
+#include "cmtprequestprocessor.h"
+#include "cmtpplaybackmap.h"
+
+class CMTPPlaybackControlDataProvider;
+
+/**
+Implements the device data provider GetDevicePropValue request processor.
+@internalComponent
+*/
+class CMTPPbcGetDevicePropValue : public CMTPRequestProcessor, public MMTPPlaybackCallback
+ {
+
+public:
+
+ static MMTPRequestProcessor* NewL(MMTPDataProviderFramework& aFramework,
+ MMTPConnection& aConnection,
+ CMTPPlaybackControlDataProvider& aDataProvider);
+ ~CMTPPbcGetDevicePropValue();
+
+private: // From CMTPRequestProcessor
+ TMTPResponseCode CheckRequestL();
+ void ServiceL();
+
+private: //From MMTPPlaybackCallback
+ void HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr);
+
+private:
+ CMTPPbcGetDevicePropValue(MMTPDataProviderFramework& aFramework,
+ MMTPConnection& aConnection,
+ CMTPPlaybackControlDataProvider& aDataProvider);
+
+private: // Owned
+ __FLOG_DECLARATION_MEMBER_MUTABLE;
+ CMTPPlaybackControlDataProvider& iPlaybackControlDp;
+ CMTPPlaybackCommand* iPbCmd;
+ TMTPTypeInt32 iInt32;
+ TMTPTypeUint32 iUint32;
+ };
+
+#endif // CMTPPBCGETPBDEVICEPROPVALUE_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/inc/cmtppbcresetdevicepropvalue.h Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,73 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef CMTPPCBRESETPBDEVICEPROPVALUE_H
+#define CMTPPCBRESETPBDEVICEPROPVALUE_H
+
+#include "cmtppbcgetdevicepropdesc.h"
+#include "mtpdebug.h"
+#include "cmtpplaybackmap.h"
+
+class CMTPTypeString;
+/**
+Implements the device data provider ResetDevicePropValue request processor.
+@internalComponent
+*/
+class CMTPPbcResetDevicePropValue : public CMTPRequestProcessor, public MMTPPlaybackCallback
+ {
+
+public:
+
+ static MMTPRequestProcessor* NewL(MMTPDataProviderFramework& aFramework,
+ MMTPConnection& aConnection,
+ CMTPPlaybackControlDataProvider& aDataProvider);
+ ~CMTPPbcResetDevicePropValue();
+
+private: //From MMTPPlaybackCallback
+ void HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr);
+
+private:
+
+ CMTPPbcResetDevicePropValue(MMTPDataProviderFramework& aFramework,
+ MMTPConnection& aConnection,
+ CMTPPlaybackControlDataProvider& aDataProvider);
+
+private: // From CMTPRequestProcessor
+
+ TMTPResponseCode CheckRequestL();
+ void ServiceL();
+
+private:
+ TMTPTypeGuid* GetGUIDL( const TUint aKey);
+ void SaveGUID( const TUint aKey, TMTPTypeGuid& aValue );
+
+private: // Owned
+
+ /**
+ FLOGGER debug trace member variable.
+ */
+ __FLOG_DECLARATION_MEMBER_MUTABLE;
+ CMTPPlaybackControlDataProvider& iPlaybackControlDp;
+ TMTPPbCtrlData iData;
+ CMTPPlaybackCommand* iPbCmd;
+ };
+
+#endif // CMTPPCBRESETPBDEVICEPROPVALUE_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/inc/cmtppbcsetdevicepropvalue.h Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,71 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef CMTPPBCSETPBDEVICEPROPVALUE_H
+#define CMTPPBCSETPBDEVICEPROPVALUE_H
+
+#include "cmtprequestprocessor.h"
+#include "cmtpplaybackmap.h"
+
+class CMTPTypeString;
+class CMTPPlaybackControlDataProvider;
+
+/**
+Implements the device data provider SetDevicePropValue request processor.
+@internalComponent
+*/
+class CMTPPlaybackCommand;
+
+class CMTPPbcSetDevicePropValue : public CMTPRequestProcessor, public MMTPPlaybackCallback
+ {
+
+public:
+
+ static MMTPRequestProcessor* NewL(MMTPDataProviderFramework& aFramework,
+ MMTPConnection& aConnection,
+ CMTPPlaybackControlDataProvider& aDataProvider);
+ ~CMTPPbcSetDevicePropValue();
+
+private: // From CMTPRequestProcessor
+ TMTPResponseCode CheckRequestL();
+ void ServiceL();
+ TBool DoHandleResponsePhaseL();
+
+private: //From MMTPPlaybackCallback
+ void HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr);
+
+private:
+ CMTPPbcSetDevicePropValue(MMTPDataProviderFramework& aFramework,
+ MMTPConnection& aConnection,
+ CMTPPlaybackControlDataProvider& aDataProvider);
+
+private: // Owned
+
+ /**
+ FLOGGER debug trace member variable.
+ */
+ __FLOG_DECLARATION_MEMBER_MUTABLE;
+ CMTPPlaybackControlDataProvider& iPlaybackControlDp;
+ TMTPPbCtrlData iData;
+ CMTPPlaybackCommand* iPbCmd;
+ };
+
+#endif // CMTPPBCSETPBDEVICEPROPVALUE_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/inc/cmtppbcskip.h Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,63 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef CMTPPBCSKIP_H
+#define CMTPPBCSKIP_H
+
+#include "cmtprequestprocessor.h"
+#include "mmtpplaybackinterface.h"
+
+class CMTPPlaybackCommand;
+class CMTPPlaybackControlDataProvider;
+
+/**
+Implements the device data provider GetDevicePropValue request processor.
+@internalComponent
+*/
+class CMTPPbcSkip : public CMTPRequestProcessor, public MMTPPlaybackCallback
+ {
+
+public:
+
+ static MMTPRequestProcessor* NewL(MMTPDataProviderFramework& aFramework,
+ MMTPConnection& aConnection,
+ CMTPPlaybackControlDataProvider& aDataProvider);
+ ~CMTPPbcSkip();
+
+private: //From MMTPPlaybackCallback
+ void HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr);
+
+private: // From CMTPRequestProcessor
+ TMTPResponseCode CheckRequestL();
+ void ServiceL();
+
+private:
+ CMTPPbcSkip(MMTPDataProviderFramework& aFramework,
+ MMTPConnection& aConnection,
+ CMTPPlaybackControlDataProvider& aDataProvider);
+
+private: // Owned
+ __FLOG_DECLARATION_MEMBER_MUTABLE;
+ CMTPPlaybackControlDataProvider& iPlaybackControlDp;
+ CMTPPlaybackCommand* iPbCmd;
+ };
+
+#endif // CMTPPBCSKIP_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/inc/cmtpplaybackcontroldp.h Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,116 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef CMTPPLAYBACKCONTROLDP_H
+#define CMTPPLAYBACKCONTROLDP_H
+
+#include <mtp/cmtpdataproviderplugin.h>
+#include <mtp/tmtptypeevent.h>
+
+#include "mtpplaybackcontroldpconst.h"
+#include "mtpdebug.h"
+#include "mmtpplaybackinterface.h"
+
+class MMTPRequestProcessor;
+class CMTPPlaybackMap;
+class MMTPPlaybackControl;
+class CMTPPlaybackProperty;
+class CMTPPlaybackEvent;
+
+/**
+Implements the MTP playback control data provider plug-in.
+@internalComponent
+*/
+class CMTPPlaybackControlDataProvider : public CMTPDataProviderPlugin, public MMTPPlaybackObserver
+ {
+public:
+
+ static TAny* NewL(TAny* aParams);
+ ~CMTPPlaybackControlDataProvider();
+
+ CMTPPlaybackMap& GetPlaybackMap() const;
+ CMTPPlaybackProperty& GetPlaybackProperty() const;
+ MMTPPlaybackControl& GetPlaybackControlL();
+ void RequestToResetPbCtrl();
+
+private: // From CMTPDataProviderPlugin
+
+ void Cancel();
+ void ProcessEventL(const TMTPTypeEvent& aEvent, MMTPConnection& aConnection);
+ void ProcessNotificationL(TMTPNotification aNotification, const TAny* aParams);
+ void ProcessRequestPhaseL(TMTPTransactionPhase aPhase, const TMTPTypeRequest& aRequest, MMTPConnection& aConnection);
+ void StartObjectEnumerationL(TUint32 aStorageId, TBool aPersistentFullEnumeration);
+ void StartStorageEnumerationL();
+ void Supported(TMTPSupportCategory aCategory, RArray<TUint>& aArray) const;
+
+private: //From MMTPPlaybackObserver
+
+ void HandlePlaybackEventL(CMTPPlaybackEvent* aEvent, TInt aErr);
+
+private:
+
+ CMTPPlaybackControlDataProvider(TAny* aParams);
+ void ConstructL();
+
+ TInt LocateRequestProcessorL(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection);
+ void SessionClosedL(const TMTPNotificationParamsSessionChange& aSession);
+ void SessionOpenedL(const TMTPNotificationParamsSessionChange& aSession);
+ void SendEventL(TMTPDevicePropertyCode aPropCode);
+
+private: // Owned
+
+ /**
+ FLOGGER debug trace member variable.
+ */
+ __FLOG_DECLARATION_MEMBER_MUTABLE;
+
+ /**
+ The event dataset.
+ */
+ TMTPTypeEvent iEvent;
+
+ /**
+ The active request processors table. Multiple request processors may be
+ active in a multi-session MTP environment.
+ */
+ RPointerArray<MMTPRequestProcessor> iActiveProcessors;
+ TInt iActiveProcessor;
+ TBool iActiveProcessorRemoved;
+
+ /**
+ The iPlaybackMap map the device property or operation to valid playback command
+ */
+ CMTPPlaybackMap* iPlaybackMap;
+
+ /**
+ The iPlaybackProperty is a container for playback properties.
+ */
+ CMTPPlaybackProperty* iPlaybackProperty;
+
+ /**
+ The checker map the device property or operation to valid playback command
+ */
+ MMTPPlaybackControl* iPlaybackControl;
+
+ TBool iRequestToResetPbCtrl;
+ };
+
+#endif // CMTPPLAYBACKCONTROLDP_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/inc/cmtpplaybackmap.h Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,98 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef CMTPPLAYBACKMAP_H
+#define CMTPPLAYBACKMAP_H
+
+#include <mtp/tmtptypeint32.h>
+#include <mtp/tmtptypeuint32.h>
+#include "mtpplaybackcontroldpconst.h"
+#include "mmtpplaybackinterface.h"
+#include "mtpdebug.h"
+
+class CMTPPlaybackCommand;
+class CMTPPlaybackProperty;
+class MMTPDataProviderFramework;
+
+class TMTPPbCtrlData
+ {
+public:
+ TMTPOperationCode iOptCode;
+ TMTPDevicePropertyCode iDevPropCode;
+ TMTPTypeUint32 iPropValUint32;
+ TMTPTypeInt32 iPropValInt32;
+ };
+
+
+/**
+Implements CMTPPlaybackMap.
+@internalComponent
+*/
+class CMTPPlaybackMap : public CBase
+ {
+
+public:
+
+ static CMTPPlaybackMap* NewL(MMTPDataProviderFramework& aFramework, CMTPPlaybackProperty& aProperty);
+ ~CMTPPlaybackMap();
+
+ /**
+ Factory meothod, map the MTP playback control data to playback control command,
+ @param aData TMTPPbCtrlData,
+ @param aCmd output the valid playback command if the return value if KErrNone
+ @return KErrNone if request is valid, else an error code.
+ */
+ TInt GetPlaybackControlCommand(const TMTPPbCtrlData& aData, CMTPPlaybackCommand** aCmd);
+
+ /**
+ Map the playback state to MTP playback rate,
+ @param aState TMTPPlaybackState
+ @return the playback rate.
+ */
+ TInt32 PlaybackRateL(TMTPPlaybackState aState);
+
+ /**
+ Map the playback state to MTP playback rate,
+ @param aSuid SUID
+ @return the playback object handle.
+ */
+ TUint32 ObjectHandleL(const TDesC& aSuid);
+
+private:
+ CMTPPlaybackMap(MMTPDataProviderFramework& aFramework, CMTPPlaybackProperty& aProperty);
+ void ConstructL();
+
+ TInt HandleSetDevicePropValue(const TMTPPbCtrlData& aData, CMTPPlaybackCommand** aCmd);
+ void HandleSetDevicePropValueL(const TMTPPbCtrlData& aData, CMTPPlaybackCommand** aCmd);
+ TInt HandleGetDevicePropValue(const TMTPPbCtrlData& aData, CMTPPlaybackCommand** aCmd);
+ void HandleGetDevicePropValueL(const TMTPPbCtrlData& aData, CMTPPlaybackCommand** aCmd);
+ TInt HandleSkip(const TMTPPbCtrlData& aData, CMTPPlaybackCommand** aCmd);
+ void HandleSkipL(const TMTPPbCtrlData& aData, CMTPPlaybackCommand** aCmd);
+ void GetObjecInfoFromHandleL(TUint32 aHandle, TDes& aSuid, TUint& aFormat) const;
+
+private: // Owned.
+
+ __FLOG_DECLARATION_MEMBER_MUTABLE;
+ MMTPDataProviderFramework& iFramework;
+ CMTPPlaybackProperty& iProperty;
+ };
+
+#endif //CMTPPLAYBACKMAP_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/inc/cmtpplaybackproperty.h Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,93 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef CMTPPLAYBACKPROPERTY_H
+#define CMTPPLAYBACKPROPERTY_H
+
+#include "mtpplaybackcontroldpconst.h"
+#include "mtpdebug.h"
+#include "cmtpplaybackcommand.h"
+
+class CMTPPlaybackControlDataProvider;
+class TMTPPbCtrlData;
+
+/**
+Implements the CMTPPlaybackProperty.
+@internalComponent
+*/
+class CMTPPlaybackProperty : public CBase
+ {
+
+public:
+
+ static CMTPPlaybackProperty* NewL();
+ ~CMTPPlaybackProperty();
+
+ /**
+ Get the devide property value by property code,
+ @param aProp, DevicePropertyCode,
+ @param aValue, Return value of the property,
+ */
+ void GetDefaultPropertyValueL(TMTPDevicePropertyCode aProp, TInt32& aValue);
+
+ /**
+ Get the devide property value by property code,
+ @param aProp, DevicePropertyCode,
+ @param aValue, Return value of the property,
+ */
+ void GetDefaultPropertyValueL(TMTPDevicePropertyCode aProp, TUint32& aValue);
+
+ /**
+ Get the default devide property value,
+ @param aValue, Value of the property,
+ */
+ void GetDefaultPropertyValueL(TMTPPbCtrlData& aValue);
+
+ /**
+ Get the default volume data set,
+ @param aValue, Value of the property,
+ */
+ void GetDefaultVolSet(TMTPPbDataVolume& aValue);
+
+ /**
+ Set the default volume data set,
+ @param aValue, Value of the property,
+ */
+ void SetDefaultVolSetL(const TMTPPbDataVolume& aValue);
+
+ /**
+ Check if the input is equalt to the default devide property value,
+ @param aValue, Value of the property,
+ @return ETrue if equal.
+ */
+ TBool IsDefaultPropertyValueL(const TMTPPbCtrlData& aValue) const;
+
+private:
+ CMTPPlaybackProperty();
+ void ConstructL();
+
+private: // Owned.
+
+ __FLOG_DECLARATION_MEMBER_MUTABLE;
+ TMTPPbDataVolume* iPlaybackVolumeData;
+ };
+
+#endif //CMTPPLAYBACKPROPERTY_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/inc/mtpplaybackcontroldpconst.h Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,56 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef MTPPLAYBACKCONTROLDPCONST_H
+#define MTPPLAYBACKCONTROLDPCONST_H
+
+#include <mtp/mtpprotocolconstants.h>
+
+/**
+define all the operations that are supported by the device data provider
+*/
+static const TUint16 KMTPPlaybackControlDpSupportedOperations[] =
+ {
+ EMTPOpCodeGetDevicePropDesc,
+ EMTPOpCodeGetDevicePropValue,
+ EMTPOpCodeSetDevicePropValue,
+ EMTPOpCodeResetDevicePropValue,
+ EMTPOpCodeSkip
+ };
+
+/**
+define all the device properties supported by the device data provider
+*/
+static const TUint16 KMTPPlaybackControlDpSupportedProperties[] =
+ {
+ EMTPDevicePropCodeVolume,
+ EMTPDevicePropCodePlaybackRate,
+ EMTPDevicePropCodePlaybackObject,
+ EMTPDevicePropCodePlaybackContainerIndex,
+ EMTPDevicePropCodePlaybackPosition
+ };
+
+static const TUint16 KMTPPlaybackControlDpSupportedEvents[] =
+ {
+ EMTPEventCodeDevicePropChanged
+ };
+
+#endif // MTPPLAYBACKCONTROLDPCONST_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/inc/mtpplaybackcontroldpprocessor.h Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,47 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef MTPPLAYBACKCONTROLDPPROCESSOR_H
+#define MTPPLAYBACKCONTROLDPPROCESSOR_H
+
+//forward declaration
+class MMTPConnection;
+class TMTPTypeRequest;
+class CMTPDataProviderPlugin;
+class MMTPDataProviderFramework;
+class MMTPRequestProcessor;
+class CMTPPlaybackControlDataProvider;
+/**
+Defines device data provider request processor
+
+@internalTechnology
+*/
+class MTPPlaybackControlDpProcessor
+ {
+public:
+ static MMTPRequestProcessor* CreateL(
+ MMTPDataProviderFramework& aFramework,
+ const TMTPTypeRequest& aRequest,
+ MMTPConnection& aConnection,
+ CMTPPlaybackControlDataProvider& aDataProvider);
+ };
+
+#endif //MTPPLAYBACKCONTROLDPPROCESSOR_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/inc/mtpplaybackcontrolpanic.h Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,42 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef MTPPLAYBACKCONTROLPANIC_H
+#define MTPPLAYBACKCONTROLPANIC_H
+
+#include <e32std.h>
+
+enum TMTPPlaybackControlPanic
+ {
+ EMTPPBReserved = 0,
+ EMTPPBCollectionErrMsg = 1,
+ EMTPPBCallbackInvalid = 2,
+ EMTPPBCollectionErrCall = 3,
+ EMTPPBDataTypeErr = 4,
+ EMTPPBArgumentErr = 5,
+ EMTPPBDataNullErr = 6,
+ };
+
+inline void Panic( TMTPPlaybackControlPanic aCode )
+ {
+ User::Panic( _L("MTPPlaybackControl"), aCode );
+ };
+
+#endif //MTPPLAYBACKCONTROLPANIC_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/inc/cmtpplaybackcommand.h Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,114 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef CMTPPLAYBACKCOMMAND_H
+#define CMTPPLAYBACKCOMMAND_H
+
+#include "mtpdebug.h"
+#include "mmtpplaybackinterface.h"
+#include "cmtpplaybackparam.h"
+
+class TMTPPbDataVolume
+ {
+public:
+ TMTPPbDataVolume(TUint32 aMax, TUint32 aMin, TUint32 aDefault, TUint32 aCurrent, TUint32 aStep);
+ TMTPPbDataVolume(const TMTPPbDataVolume& aVol);
+
+ void SetVolume(TUint32 aMax, TUint32 aMin, TUint32 aDefault, TUint32 aCurrent, TUint32 aStep);
+ void operator =(const TMTPPbDataVolume& aVol);
+ TUint32 MaxVolume() const;
+ TUint32 MinVolume() const;
+ TUint32 DefaultVolume() const;
+ TUint32 CurrentVolume() const;
+ TUint32 Step() const;
+
+private:
+ TUint32 iMaxVolume;
+ TUint32 iMinVolume;
+ TUint32 iDefaultVolume;
+ TUint32 iCurrentVolume;
+ TUint32 iStep;
+ };
+
+/**
+* Encapsulates parameter for command EPlaybackCmdInitObject
+*/
+class CMTPPbCmdParam : public CMTPPbParamBase
+ {
+public:
+ static CMTPPbCmdParam* NewL(TMTPPbCategory aCategory, const TDesC& aSuid);
+ static CMTPPbCmdParam* NewL(TInt32 aValue);
+ static CMTPPbCmdParam* NewL(TUint32 aValue);
+ static CMTPPbCmdParam* NewL(const CMTPPbCmdParam& aParam);
+ static CMTPPbCmdParam* NewL(const TMTPPbDataVolume& aVolume);
+ ~CMTPPbCmdParam();
+
+public:
+ const TMTPPbDataVolume& VolumeSetL() const;
+
+private:
+ /**
+ * The constuctor.
+ * @param aCategory, category of object for initialization,
+ */
+ CMTPPbCmdParam();
+ CMTPPbCmdParam(TMTPPbCategory aCategory, const TDesC& aSuid);
+ CMTPPbCmdParam(TInt32 aValue);
+ CMTPPbCmdParam(TUint32 aValue);
+ CMTPPbCmdParam(const TMTPPbDataVolume& aVolume);
+
+ void ConstructL(TMTPPbCategory aCategory, const TDesC& aSuid);
+ void ConstructL(TInt32 aValue);
+ void ConstructL(TUint32 aValue);
+ void ConstructL(const TMTPPbDataVolume& aVolume);
+ void ConstructL(const CMTPPbCmdParam& aParam);
+ };
+
+
+/**
+Implements the CMTPPlaybackCommand.
+@internalComponent
+*/
+class CMTPPlaybackCommand : public CBase
+ {
+public:
+ static CMTPPlaybackCommand* NewL(TMTPPlaybackCommand aCmd, CMTPPbCmdParam* aParam);
+ static CMTPPlaybackCommand* NewL(const CMTPPlaybackCommand& aCmd);
+
+ void SetParam(CMTPPbCmdParam* aParam);
+ const CMTPPbCmdParam& ParamL() const;
+ TMTPPlaybackCommand PlaybackCommand() const;
+ TBool HasParam() const;
+
+ ~CMTPPlaybackCommand();
+
+private:
+ CMTPPlaybackCommand(TMTPPlaybackCommand aCmd, CMTPPbCmdParam* aParam);
+ void ConstructL(const CMTPPlaybackCommand& aParam);
+ void ConstructL();
+
+private: // Owned.
+ __FLOG_DECLARATION_MEMBER;
+ const TMTPPlaybackCommand iPbCmd;
+ CMTPPbCmdParam* iParam;
+ };
+
+#endif //CMTPPLAYBACKCOMMAND_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/inc/cmtpplaybackevent.h Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,77 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef CMTPPLAYBACKEVENT_H
+#define CMTPPLAYBACKEVENT_H
+
+#include "mtpdebug.h"
+#include "mmtpplaybackinterface.h"
+#include "cmtpplaybackparam.h"
+
+/**
+* Encapsulates parameter for command EPlaybackCmdInitObject
+*/
+class CMTPPbEventParam : public CMTPPbParamBase
+ {
+public:
+ static CMTPPbEventParam* NewL(TMTPPbCategory aCategory, const TDesC& aSuid);
+ static CMTPPbEventParam* NewL(TInt32 aValue);
+ static CMTPPbEventParam* NewL(TUint32 aValue);
+ ~CMTPPbEventParam();
+
+private:
+ /**
+ * The constuctor.
+ * @param aCategory, category of object for initialization,
+ */
+ CMTPPbEventParam(TMTPPbCategory aCategory, const TDesC& aSuid);
+ CMTPPbEventParam(TInt32 aValue);
+ CMTPPbEventParam(TUint32 aValue);
+ };
+
+
+/**
+Implements the CMTPPlaybackCommand.
+@internalComponent
+*/
+class CMTPPlaybackEvent : public CBase
+ {
+public:
+
+ static CMTPPlaybackEvent* NewL(TMTPPlaybackEvent aCmd, CMTPPbEventParam* aParam);
+
+ void SetParam(CMTPPbEventParam* aParam);
+ const CMTPPbEventParam& ParamL();
+ TMTPPlaybackEvent PlaybackEvent();
+
+ ~CMTPPlaybackEvent();
+
+private:
+ CMTPPlaybackEvent(TMTPPlaybackEvent aCmd, CMTPPbEventParam* aParam);
+ void ConstructL();
+
+private: // Owned.
+ __FLOG_DECLARATION_MEMBER;
+ const TMTPPlaybackEvent iPbEvent;
+ CMTPPbEventParam* iParam;
+ };
+
+#endif //CMTPPLAYBACKEVENT_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/inc/cmtpplaybackparam.h Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,104 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef CMTPPLAYBACKPARAM_H
+#define CMTPPLAYBACKPARAM_H
+
+#include "mtpdebug.h"
+
+/**
+ Category identifier
+*/
+enum TMTPPbCategory
+ {
+ /** Init value **/
+ EMTPPbCatNone=0,
+ /** SingleMusic **/
+ EMTPPbCatMusic=1,
+ /** PlayList**/
+ EMTPPbCatPlayList = 2,
+ /** Ablum **/
+ EMTPPbCatAlbum = 3
+ };
+
+enum TMTPPbDataType
+ {
+ EMTPPbTypeNone,
+ EMTPPbInt32,
+ EMTPPbUint32,
+ EMTPPbSuidSet,
+ EMTPPbVolumeSet,
+ EMTPPbTypeEnd
+ };
+
+class TMTPPbDataSuid
+ {
+public:
+ TMTPPbDataSuid(TMTPPbCategory aCategory, const TDesC& aSuid);
+
+ TMTPPbCategory Category() const;
+ const TDesC& Suid() const;
+
+private:
+ //The category
+ TMTPPbCategory iPlayCategory;
+ //The suid of object for initialization
+ TFileName iSuid;
+ };
+
+/**
+* Encapsulates parameter for playback commands and events.
+*/
+class CMTPPbParamBase : public CBase
+ {
+public:
+ virtual const TMTPPbDataSuid& SuidSetL() const;
+ virtual TInt32 Int32L() const;
+ virtual TUint32 Uint32L() const;
+ virtual ~CMTPPbParamBase();
+ TMTPPbDataType Type() const;
+
+protected:
+ /**
+ * The constuctor.
+ * @param aCategory, category of object for initialization,
+ */
+ CMTPPbParamBase();
+ CMTPPbParamBase(TInt32 aValue);
+ CMTPPbParamBase(TUint32 aValue);
+ CMTPPbParamBase(TMTPPbCategory aCategory, const TDesC& aSuid);
+
+ void ConstructL(TMTPPbCategory aCategory, const TDesC& aSuid);
+ void ConstructL(TInt32 aValue);
+ void ConstructL(TUint32 aValue);
+ void ConstructL(const CMTPPbParamBase& aParam);
+ void SetType(TMTPPbDataType);
+ TAny* GetData() const;
+ void SetData(TAny* aData);
+
+private:
+ __FLOG_DECLARATION_MEMBER;
+
+ TMTPPbDataType iParamType;
+ TAny* iData;
+ };
+
+#endif //CMTPPLAYBACKPARAM_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/inc/mmtpplaybackinterface.h Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,133 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef MMTPPLAYBACKINTERFACE_H
+#define MMTPPLAYBACKINTERFACE_H
+
+const TInt KPlaybackErrNone = 0;
+const TInt KPlaybackErrDeviceBusy = (-8000);
+const TInt KPlaybackErrDeviceUnavailable = (-8001);
+const TInt KPlaybackErrParamInvalid = (-8002);
+const TInt KPlaybackErrContextInvalid = (-8003);
+
+/** Playback status */
+enum TMTPPlaybackState
+ {
+ /** Playing */
+ EPlayStatePlaying,
+ /** Pause */
+ EPlayStatePaused,
+ /** Forward seeking */
+ EPlayStateForwardSeeking,
+ /** Backward seeking */
+ EPlayStateBackwardSeeking,
+ /** error state */
+ EPlayStateError
+ };
+
+/** Playback events */
+enum TMTPPlaybackEvent
+ {
+ EPlaybackEventNone,
+ /** playback volume update */
+ EPlaybackEventVolumeUpdate,
+ /** playback object update */
+ EPlaybackEventObjectUpdate,
+ /** playback object index update */
+ EPlaybackEventObjectIndexUpdate,
+ /** player state update */
+ EPlaybackEventStateUpdate,
+ /** Last Event */
+ EPlaybackEventEnd
+ };
+
+/** Playback command */
+enum TMTPPlaybackCommand
+ {
+ EPlaybackCmdNone,
+ EPlaybackCmdInitObject,
+ EPlaybackCmdInitIndex,
+ EPlaybackCmdPlay,
+ EPlaybackCmdPause,
+ EPlaybackCmdStop,
+ EPlaybackCmdSkip,
+ EPlaybackCmdSeekForward,
+ EPlaybackCmdSeekBackward,
+ EPlaybackCmdGetVolume,
+ EPlaybackCmdGetVolumeSet,
+ EPlaybackCmdSetVolume,
+ EPlaybackCmdGetPosition,
+ EPlaybackCmdSetPosition,
+ EPlaybackCmdGetDuration,
+ EPlaybackCmdGetState,
+ EPlaybackCmdGetObject,
+ EPlaybackCmdGetIndex,
+ EPlaybackCmdEnd
+ };
+
+class CMTPPlaybackCommand;
+class CMTPPlaybackEvent;
+
+class MMTPPlaybackObserver
+ {
+public:
+ /**
+ * Called when playback object is updated or
+ * playback object's position is updated
+ * in the active player instance.
+ */
+ virtual void HandlePlaybackEventL(CMTPPlaybackEvent* aEvent, TInt aErr = KPlaybackErrNone) = 0;
+ };
+
+class MMTPPlaybackCallback
+ {
+public:
+ /**
+ * Called when playback command is completed
+ *
+ * @param aErr Complete error
+ * @param aCmd Complete command
+ */
+ virtual void HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr = KPlaybackErrNone) = 0;
+ };
+
+class MMTPPlaybackControl
+ {
+public:
+ /**
+ * Create an Instance of MMTPPlaybackControl's implementation.
+ */
+ static MMTPPlaybackControl* NewL(MMTPPlaybackObserver& aObserver);
+
+ /**
+ * Frees resource, and destroy the object itself.
+ */
+ virtual void Close()=0;
+
+ /**
+ * Issue player commands, with optional data.
+ * @param aCmd the command
+ * @param aCallback Call back function
+ */
+ virtual void CommandL(CMTPPlaybackCommand& aCmd, MMTPPlaybackCallback* aCallback = NULL) = 0;
+ };
+
+#endif // MMTPPLAYBACKINTERFACE_H
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/src/cmtpplaybackcommand.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,319 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include "cmtpplaybackcommand.h"
+#include "mtpplaybackcontrolpanic.h"
+
+// Class constants.
+__FLOG_STMT(_LIT8(KComponent,"CMtpPbCmd");)
+
+/*********************************************
+ class TMTPPbDataVolume
+**********************************************/
+TMTPPbDataVolume::TMTPPbDataVolume(TUint32 aMax, TUint32 aMin, TUint32 aDefault, TUint32 aCurrent, TUint32 aStep):
+ iMaxVolume(aMax),iMinVolume(aMin), iDefaultVolume(aDefault), iCurrentVolume(aCurrent), iStep(aStep)
+ {
+ __ASSERT_DEBUG((aMin < aMax), Panic(EMTPPBArgumentErr));
+ __ASSERT_DEBUG((aMin <= aDefault && aDefault <= aMax), Panic(EMTPPBArgumentErr));
+ __ASSERT_DEBUG((aMin <= aCurrent && aCurrent <= aMax), Panic(EMTPPBArgumentErr));
+ __ASSERT_DEBUG((aStep <= (aMax-aMin)), Panic(EMTPPBArgumentErr));
+ __ASSERT_DEBUG((aStep != 0), Panic(EMTPPBArgumentErr));
+ }
+
+TMTPPbDataVolume::TMTPPbDataVolume(const TMTPPbDataVolume& aVol):
+ iMaxVolume(aVol.MaxVolume()),
+ iMinVolume(aVol.MinVolume()),
+ iDefaultVolume(aVol.DefaultVolume()),
+ iCurrentVolume(aVol.CurrentVolume()),
+ iStep(aVol.Step())
+ {
+
+ }
+
+void TMTPPbDataVolume::SetVolume(TUint32 aMax, TUint32 aMin, TUint32 aDefault, TUint32 aCurrent, TUint32 aStep)
+ {
+ __ASSERT_DEBUG((aMin < aMax), Panic(EMTPPBArgumentErr));
+ __ASSERT_DEBUG((aMin <= aDefault && aDefault <= aMax), Panic(EMTPPBArgumentErr));
+ __ASSERT_DEBUG((aMin <= aCurrent && aCurrent <= aMax), Panic(EMTPPBArgumentErr));
+ __ASSERT_DEBUG((aStep <= (aMax-aMin)), Panic(EMTPPBArgumentErr));
+ __ASSERT_DEBUG((aStep != 0), Panic(EMTPPBArgumentErr));
+ iMaxVolume = aMax;
+ iMinVolume = aMin;
+ iDefaultVolume = aDefault;
+ iCurrentVolume = aCurrent,
+ iStep = aStep;
+ }
+
+void TMTPPbDataVolume::operator =(const TMTPPbDataVolume& aVol)
+ {
+ iMaxVolume = aVol.MaxVolume();
+ iMinVolume = aVol.MinVolume();
+ iDefaultVolume = aVol.DefaultVolume();
+ iCurrentVolume = aVol.CurrentVolume();
+ iStep = aVol.Step();
+ }
+
+TUint32 TMTPPbDataVolume::MaxVolume() const
+ {
+ return iMaxVolume;
+ }
+
+TUint32 TMTPPbDataVolume::MinVolume() const
+ {
+ return iMinVolume;
+ }
+
+TUint32 TMTPPbDataVolume::DefaultVolume() const
+ {
+ return iDefaultVolume;
+ }
+
+TUint32 TMTPPbDataVolume::CurrentVolume() const
+ {
+ return iCurrentVolume;
+ }
+
+TUint32 TMTPPbDataVolume::Step() const
+ {
+ return iStep;
+ }
+
+/*********************************************
+ class CMTPPbCmdParam
+**********************************************/
+
+CMTPPbCmdParam* CMTPPbCmdParam::NewL(TMTPPbCategory aCategory, const TDesC& aSuid)
+ {
+ CMTPPbCmdParam* self = new (ELeave) CMTPPbCmdParam(aCategory, aSuid);
+ CleanupStack::PushL(self);
+ self->ConstructL(aCategory, aSuid);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+CMTPPbCmdParam* CMTPPbCmdParam::NewL(TInt32 aValue)
+ {
+ CMTPPbCmdParam* self = new (ELeave) CMTPPbCmdParam(aValue);
+ CleanupStack::PushL(self);
+ self->ConstructL(aValue);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+CMTPPbCmdParam* CMTPPbCmdParam::NewL(TUint32 aValue)
+ {
+ CMTPPbCmdParam* self = new (ELeave) CMTPPbCmdParam(aValue);
+ CleanupStack::PushL(self);
+ self->ConstructL(aValue);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+CMTPPbCmdParam* CMTPPbCmdParam::NewL(const TMTPPbDataVolume& aVolume)
+ {
+ CMTPPbCmdParam* self = new (ELeave) CMTPPbCmdParam(aVolume);
+ CleanupStack::PushL(self);
+ self->ConstructL(aVolume);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+CMTPPbCmdParam* CMTPPbCmdParam::NewL(const CMTPPbCmdParam& aParam)
+ {
+ CMTPPbCmdParam* self = new (ELeave) CMTPPbCmdParam();
+ CleanupStack::PushL(self);
+ self->ConstructL(aParam);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+CMTPPbCmdParam::~CMTPPbCmdParam()
+ {
+
+ }
+
+CMTPPbCmdParam::CMTPPbCmdParam():
+ CMTPPbParamBase()
+ {
+
+ }
+
+CMTPPbCmdParam::CMTPPbCmdParam(TMTPPbCategory aCategory, const TDesC& aSuid):
+ CMTPPbParamBase(aCategory, aSuid)
+ {
+
+ }
+
+CMTPPbCmdParam::CMTPPbCmdParam(TInt32 aValue):
+ CMTPPbParamBase(aValue)
+ {
+
+ }
+
+CMTPPbCmdParam::CMTPPbCmdParam(TUint32 aValue):
+ CMTPPbParamBase(aValue)
+ {
+
+ }
+
+CMTPPbCmdParam::CMTPPbCmdParam(const TMTPPbDataVolume& /*aVolume*/):
+ CMTPPbParamBase()
+ {
+ CMTPPbParamBase::SetType(EMTPPbVolumeSet);
+ }
+
+void CMTPPbCmdParam::ConstructL(TMTPPbCategory aCategory, const TDesC& aSuid)
+ {
+ CMTPPbParamBase::ConstructL(aCategory, aSuid);
+ }
+
+void CMTPPbCmdParam::ConstructL(TInt32 aValue)
+ {
+ CMTPPbParamBase::ConstructL(aValue);
+ }
+
+void CMTPPbCmdParam::ConstructL(TUint32 aValue)
+ {
+ CMTPPbParamBase::ConstructL(aValue);
+ }
+
+void CMTPPbCmdParam::ConstructL(const TMTPPbDataVolume& aVolume)
+ {
+ TMTPPbDataVolume* val = new (ELeave) TMTPPbDataVolume(aVolume);
+ CMTPPbParamBase::SetData(static_cast<TAny*>(val));
+ }
+
+void CMTPPbCmdParam::ConstructL(const CMTPPbCmdParam& aParam)
+ {
+ TMTPPbDataType type(aParam.Type());
+
+ __ASSERT_DEBUG((type > EMTPPbTypeNone && type < EMTPPbTypeEnd), Panic(EMTPPBArgumentErr));
+ __ASSERT_ALWAYS((type > EMTPPbTypeNone && type < EMTPPbTypeEnd), User::Leave(KErrArgument));
+
+ if(type == EMTPPbVolumeSet)
+ {
+ TMTPPbDataVolume* val = new (ELeave) TMTPPbDataVolume(aParam.VolumeSetL());
+ CMTPPbParamBase::SetData(static_cast<TAny*>(val));
+ CMTPPbParamBase::SetType(type);
+ }
+ else
+ {
+ CMTPPbParamBase::ConstructL(aParam);
+ }
+ }
+
+const TMTPPbDataVolume& CMTPPbCmdParam::VolumeSetL() const
+ {
+ __ASSERT_DEBUG((CMTPPbParamBase::Type() == EMTPPbVolumeSet), Panic(EMTPPBDataTypeErr));
+ __ASSERT_ALWAYS((CMTPPbParamBase::Type() == EMTPPbVolumeSet), User::Leave(KErrArgument));
+ return *static_cast<TMTPPbDataVolume*>(CMTPPbParamBase::GetData());
+ }
+
+/*********************************************
+ class CMTPPlaybackCommand
+**********************************************/
+CMTPPlaybackCommand* CMTPPlaybackCommand::NewL(TMTPPlaybackCommand aCmd, CMTPPbCmdParam* aParam)
+ {
+ __ASSERT_DEBUG((aCmd > EPlaybackCmdNone && aCmd < EPlaybackCmdEnd), Panic(EMTPPBArgumentErr));
+ __ASSERT_ALWAYS((aCmd > EPlaybackCmdNone && aCmd < EPlaybackCmdEnd), User::Leave(KErrArgument));
+
+ CMTPPlaybackCommand* self = new (ELeave) CMTPPlaybackCommand(aCmd, aParam);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+CMTPPlaybackCommand* CMTPPlaybackCommand::NewL(const CMTPPlaybackCommand& aCmd)
+ {
+ CMTPPlaybackCommand* self = new (ELeave) CMTPPlaybackCommand(aCmd.PlaybackCommand(), NULL);
+ CleanupStack::PushL(self);
+ self->ConstructL(aCmd);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+/**
+Destructor.
+*/
+CMTPPlaybackCommand::~CMTPPlaybackCommand()
+ {
+ __FLOG(_L8("~CMTPPlaybackCommand - Entry"));
+ delete iParam;
+ __FLOG(_L8("~CMTPPlaybackCommand - Exit"));
+ __FLOG_CLOSE;
+ }
+
+/**
+Constructor.
+*/
+CMTPPlaybackCommand::CMTPPlaybackCommand(TMTPPlaybackCommand aCmd,
+ CMTPPbCmdParam* aParam):
+ iPbCmd(aCmd),iParam(aParam)
+ {
+ }
+
+/**
+Second-phase constructor.
+*/
+void CMTPPlaybackCommand::ConstructL()
+ {
+ __FLOG_OPEN(KMTPSubsystem, KComponent);
+ __FLOG(_L8("CMTPPlaybackCommand: ConstructL - Entry"));
+ __FLOG(_L8("CMTPPlaybackCommand: ConstructL - Exit"));
+ }
+
+/**
+Second-phase constructor.
+*/
+void CMTPPlaybackCommand::ConstructL(const CMTPPlaybackCommand& aCmd)
+ {
+ __FLOG(_L8("CMTPPlaybackCommand: ConstructL - Entry"));
+ if(aCmd.HasParam())
+ {
+ iParam = CMTPPbCmdParam::NewL(aCmd.ParamL());
+ }
+ __FLOG(_L8("CMTPPlaybackCommand: ConstructL - Exit"));
+ }
+
+TMTPPlaybackCommand CMTPPlaybackCommand::PlaybackCommand() const
+ {
+ __ASSERT_DEBUG((iPbCmd > EPlaybackCmdNone && iPbCmd < EPlaybackCmdEnd), Panic(EMTPPBArgumentErr));
+ return iPbCmd;
+ }
+
+TBool CMTPPlaybackCommand::HasParam() const
+ {
+ TBool result(iParam != NULL);
+ return result;
+ }
+
+const CMTPPbCmdParam& CMTPPlaybackCommand::ParamL() const
+ {
+ __ASSERT_DEBUG((iParam != NULL), Panic(EMTPPBDataNullErr));
+ __ASSERT_ALWAYS((iParam != NULL), User::Leave(KErrArgument));
+ return *iParam;
+ }
+
+void CMTPPlaybackCommand::SetParam(CMTPPbCmdParam* aParam)
+ {
+ delete iParam;
+ iParam = aParam;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/src/cmtpplaybackevent.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,140 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include "cmtpplaybackevent.h"
+#include "mtpplaybackcontrolpanic.h"
+
+// Class constants.
+__FLOG_STMT(_LIT8(KComponent,"CMtpPbEvent");)
+
+CMTPPbEventParam* CMTPPbEventParam::NewL(TMTPPbCategory aCategory, const TDesC& aSuid)
+ {
+ CMTPPbEventParam* self = new (ELeave) CMTPPbEventParam(aCategory, aSuid);
+ CleanupStack::PushL(self);
+ self->ConstructL(aCategory, aSuid);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+CMTPPbEventParam* CMTPPbEventParam::NewL(TInt32 aValue)
+ {
+ CMTPPbEventParam* self = new (ELeave) CMTPPbEventParam(aValue);
+ CleanupStack::PushL(self);
+ self->ConstructL(aValue);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+CMTPPbEventParam* CMTPPbEventParam::NewL(TUint32 aValue)
+ {
+ CMTPPbEventParam* self = new (ELeave) CMTPPbEventParam(aValue);
+ CleanupStack::PushL(self);
+ self->ConstructL(aValue);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+CMTPPbEventParam::~CMTPPbEventParam()
+ {
+
+ }
+
+CMTPPbEventParam::CMTPPbEventParam(TMTPPbCategory aCategory, const TDesC& aSuid):
+ CMTPPbParamBase(aCategory, aSuid)
+ {
+
+ }
+
+CMTPPbEventParam::CMTPPbEventParam(TInt32 aValue):
+ CMTPPbParamBase(aValue)
+ {
+
+ }
+
+CMTPPbEventParam::CMTPPbEventParam(TUint32 aValue):
+ CMTPPbParamBase(aValue)
+ {
+
+ }
+
+/**
+Two-phase constructor.
+*/
+CMTPPlaybackEvent* CMTPPlaybackEvent::NewL(TMTPPlaybackEvent aEvent, CMTPPbEventParam* aParam)
+ {
+ __ASSERT_DEBUG((aEvent > EPlaybackEventNone && aEvent < EPlaybackEventEnd), Panic(EMTPPBArgumentErr));
+ __ASSERT_ALWAYS((aEvent > EPlaybackEventNone && aEvent < EPlaybackEventEnd), User::Leave(KErrArgument));
+
+ CMTPPlaybackEvent* self = new (ELeave) CMTPPlaybackEvent(aEvent, aParam);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+/**
+Destructor.
+*/
+CMTPPlaybackEvent::~CMTPPlaybackEvent()
+ {
+ __FLOG(_L8("~CMTPPlaybackEvent - Entry"));
+ delete iParam;
+ __FLOG(_L8("~CMTPPlaybackEvent - Exit"));
+ __FLOG_CLOSE;
+ }
+
+/**
+Constructor.
+*/
+CMTPPlaybackEvent::CMTPPlaybackEvent(TMTPPlaybackEvent aEvent,
+ CMTPPbEventParam* aParam):
+ iPbEvent(aEvent),iParam(aParam)
+ {
+ }
+
+/**
+Second-phase constructor.
+*/
+void CMTPPlaybackEvent::ConstructL()
+ {
+ __FLOG_OPEN(KMTPSubsystem, KComponent);
+ __FLOG(_L8("CMTPPlaybackEvent: ConstructL - Entry"));
+ __FLOG(_L8("CMTPPlaybackEvent: ConstructL - Exit"));
+ }
+
+void CMTPPlaybackEvent::SetParam(CMTPPbEventParam* aParam)
+ {
+ delete iParam;
+ iParam = aParam;
+ }
+
+TMTPPlaybackEvent CMTPPlaybackEvent::PlaybackEvent()
+ {
+ __ASSERT_DEBUG((iPbEvent > EPlaybackEventNone && iPbEvent < EPlaybackEventEnd), Panic(EMTPPBArgumentErr));
+ return iPbEvent;
+ }
+
+const CMTPPbEventParam& CMTPPlaybackEvent::ParamL()
+ {
+ __ASSERT_DEBUG((iParam != NULL), Panic(EMTPPBDataNullErr));
+ __ASSERT_ALWAYS((iParam != NULL), User::Leave(KErrArgument));
+
+ return *iParam;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/src/cmtpplaybackparam.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,177 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include "cmtpplaybackparam.h"
+#include "mtpplaybackcontrolpanic.h"
+
+
+/*********************************************
+ class TMTPPbDataSuid
+**********************************************/
+TMTPPbCategory TMTPPbDataSuid::Category() const
+ {
+ return iPlayCategory;
+ }
+
+const TDesC& TMTPPbDataSuid::Suid() const
+ {
+ return iSuid;
+ }
+
+TMTPPbDataSuid::TMTPPbDataSuid(TMTPPbCategory aCategory, const TDesC& aSuid):
+ iPlayCategory(aCategory),
+ iSuid(aSuid)
+ {
+
+ }
+
+/*********************************************
+ class CMTPPbParamBase
+**********************************************/
+
+CMTPPbParamBase::~CMTPPbParamBase()
+ {
+ delete iData;
+ }
+
+CMTPPbParamBase::CMTPPbParamBase():
+ iParamType(EMTPPbTypeNone)
+ {
+
+ }
+
+CMTPPbParamBase::CMTPPbParamBase(TMTPPbCategory /*aCategory*/, const TDesC& /*aSuid*/):
+ iParamType(EMTPPbSuidSet)
+ {
+
+ }
+
+CMTPPbParamBase::CMTPPbParamBase(TInt32 /*aValue*/):
+ iParamType(EMTPPbInt32)
+ {
+
+ }
+
+CMTPPbParamBase::CMTPPbParamBase(TUint32 /*aValue*/):
+ iParamType(EMTPPbUint32)
+ {
+
+ }
+
+void CMTPPbParamBase::ConstructL(TMTPPbCategory aCategory, const TDesC& aSuid)
+ {
+ TMTPPbDataSuid* val = new (ELeave) TMTPPbDataSuid(aCategory, aSuid);
+ iData = static_cast<TAny*>(val);
+ }
+
+void CMTPPbParamBase::ConstructL(TInt32 aValue)
+ {
+ TInt32* val = new (ELeave) TInt32();
+ *val = aValue;
+ iData = static_cast<TAny*>(val);
+ }
+
+void CMTPPbParamBase::ConstructL(TUint32 aValue)
+ {
+ TUint32* val = new (ELeave) TUint32();
+ *val = aValue;
+ iData = static_cast<TAny*>(val);
+ }
+
+void CMTPPbParamBase::ConstructL(const CMTPPbParamBase& aParam)
+ {
+ TMTPPbDataType type(aParam.Type());
+ __ASSERT_DEBUG((type > EMTPPbTypeNone && type < EMTPPbTypeEnd), Panic(EMTPPBArgumentErr));
+ __ASSERT_ALWAYS((type > EMTPPbTypeNone && type < EMTPPbTypeEnd), User::Leave(KErrArgument));
+
+ switch(type)
+ {
+ case EMTPPbSuidSet:
+ {
+ ConstructL(aParam.SuidSetL().Category(), aParam.SuidSetL().Suid());
+ }
+ break;
+ case EMTPPbInt32:
+ {
+ ConstructL(aParam.Int32L());
+ }
+ break;
+ case EMTPPbUint32:
+ {
+ ConstructL(aParam.Uint32L());
+ }
+ break;
+ default:
+ User::Leave(KErrArgument);
+ break;
+ }
+
+ iParamType = type;
+ }
+
+TMTPPbDataType CMTPPbParamBase::Type() const
+ {
+ __ASSERT_DEBUG((iParamType > EMTPPbTypeNone && iParamType < EMTPPbTypeEnd),
+ Panic(EMTPPBDataTypeErr));
+ return iParamType;
+ }
+
+void CMTPPbParamBase::SetType(TMTPPbDataType aType)
+ {
+ __ASSERT_DEBUG((iParamType == EMTPPbTypeNone), Panic(EMTPPBDataTypeErr));
+ __ASSERT_DEBUG((aType > EMTPPbTypeNone && aType < EMTPPbTypeEnd), Panic(EMTPPBDataTypeErr));
+ iParamType = aType;
+ }
+
+TAny* CMTPPbParamBase::GetData() const
+ {
+ __ASSERT_DEBUG((iData != NULL), Panic(EMTPPBDataNullErr));
+ return iData;
+ }
+
+void CMTPPbParamBase::SetData(TAny* aData)
+ {
+ __ASSERT_DEBUG((aData != NULL), Panic(EMTPPBDataNullErr));
+ iData = aData;
+ }
+
+const TMTPPbDataSuid& CMTPPbParamBase::SuidSetL() const
+ {
+ __ASSERT_DEBUG((iParamType == EMTPPbSuidSet), Panic(EMTPPBDataTypeErr));
+ __ASSERT_ALWAYS((iParamType == EMTPPbSuidSet), User::Leave(KErrArgument));
+
+ return *static_cast<TMTPPbDataSuid*>(iData);
+ }
+
+TInt32 CMTPPbParamBase::Int32L() const
+ {
+ __ASSERT_DEBUG((iParamType == EMTPPbInt32), Panic(EMTPPBDataTypeErr));
+ __ASSERT_ALWAYS((iParamType == EMTPPbInt32), User::Leave(KErrArgument));
+
+ return *static_cast<TInt32*>(iData);
+ }
+
+TUint32 CMTPPbParamBase::Uint32L() const
+ {
+ __ASSERT_DEBUG((iParamType == EMTPPbUint32), Panic(EMTPPBDataTypeErr));
+ __ASSERT_ALWAYS((iParamType == EMTPPbUint32), User::Leave(KErrArgument));
+
+ return *static_cast<TUint32*>(iData);
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/src/mmtpplaybackinterface.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,30 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include"cmtpplaybackcontrolimpl.h"
+
+// ---------------------------------------------------------------------------
+// Create the playback control object
+// ---------------------------------------------------------------------------
+
+MMTPPlaybackControl* MMTPPlaybackControl::NewL( MMTPPlaybackObserver& aObserver )
+ {
+ return CMTPPlaybackControlImpl::NewL( aObserver );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/inc/cmtpplaybackcommandchecker.h Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,81 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef CMTPPLAYBACKCOMMANDCHECKER_H_
+#define CMTPPLAYBACKCOMMANDCHECKER_H_
+
+#include "cmtpplaybackcommand.h"
+#include "mtpdebug.h"
+
+class CMTPPlaybackControlImpl;
+
+NONSHARABLE_CLASS( CMTPPlaybackCommandChecker ) : public CBase
+ {
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CMTPPlaybackCommandChecker* NewL( CMTPPlaybackControlImpl& aControlImpl );
+ /**
+ * Destructor.
+ */
+ virtual ~CMTPPlaybackCommandChecker();
+
+public:
+
+ /**
+ * Check playback command context
+ */
+ void CheckPlaybackCommandContextL( TMTPPlaybackCommand aMTPPBCommand );
+
+ /**
+ *Check and update playback param
+ */
+ void CheckAndUpdatePlaybackParamL( CMTPPlaybackCommand& aMTPPPBSourceCmd, CMTPPbCmdParam** aMTPPPBTargetParam );
+
+private:
+
+ /**
+ * C++ default constructor.
+ */
+ CMTPPlaybackCommandChecker( CMTPPlaybackControlImpl& aControlImpl );
+
+private:
+
+ /**
+ * Return instance of CMTPPlaybackControlImpl.
+ */
+ CMTPPlaybackControlImpl& MTPPlaybackControlImpl();
+
+private:
+
+ /**
+ The handle of the owner
+ */
+ CMTPPlaybackControlImpl& iMTPPlaybackControl;
+
+ /**
+ FLOGGER debug trace member variable.
+ */
+ __FLOG_DECLARATION_MEMBER;
+ };
+
+#endif /* CMTPPLAYBACKCOMMANDCHECKER_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/inc/cmtpplaybackcontrolimpl.h Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,315 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef CMTPPLAYBACKCONTROLIMPL_H
+#define CMTPPLAYBACKCONTROLIMPL_H
+
+#include <mpxplaybackobserver.h>
+
+#include "mmtpplaybackinterface.h"
+#include "mtpplaybackcontrolconst.h"
+#include "mtpdebug.h"
+
+class MMPXPlaybackUtility;
+class CMPXCollectionPath;
+class CMPXCollectionPlaylist;
+
+class CMTPPlaybackCommandChecker;
+class CMTPPlaybackPlaylistHelper;
+class CMTPPlaybackResumeHelper;
+class CMTPPlaybackCommand;
+class CMTPPbCmdParam;
+
+
+NONSHARABLE_CLASS( CMTPPlaybackControlImpl ) : public CActive,
+ public MMPXPlaybackObserver,
+ public MMPXPlaybackCallback,
+ public MMTPPlaybackControl
+ {
+private:
+
+ friend class CMTPPlaybackCommandChecker;
+ friend class CMTPPlaybackPlaylistHelper;
+ friend class CMTPPlaybackResumeHelper;
+
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CMTPPlaybackControlImpl* NewL( MMTPPlaybackObserver& aObserver );
+ /**
+ * Frees resource, and destroy the object itself.
+ */
+ void Close();
+ /**
+ * Destructor.
+ */
+ virtual ~CMTPPlaybackControlImpl();
+
+public:
+ /**
+ * From MMTPPlaybackControl
+ * @param aCmd, refer to CMTPPlaybackCommand
+ * @param aCallback, refer to MMTPPlaybackCallback
+ */
+ void CommandL( CMTPPlaybackCommand& aCmd,
+ MMTPPlaybackCallback* aCallback = NULL);
+
+private:
+
+ /**
+ * From MMPXPlaybackObserver
+ * See mpxplaybackobserver.h for detailed description.
+ */
+ void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
+
+ /**
+ * From MMPXPlaybackCallback
+ * See mpxplaybackobserver.h for detailed description.
+ */
+ void HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError );
+
+ /**
+ * From MMPXPlaybackCallback
+ * See mpxplaybackobserver.h for detailed description.
+ */
+ void HandleSubPlayerNamesL( TUid aPlayer, const MDesCArray* aSubPlayers, TBool aComplete, TInt aError );
+
+ /**
+ * From MMPXPlaybackCallback
+ * See mpxplaybackobserver.h for detailed description.
+ */
+ void HandleMediaL( const CMPXMedia& aMedia, TInt aError );
+
+private:// From CActive
+
+ /**
+ * DoCancel.
+ */
+ void DoCancel();
+
+ /**
+ * RunL.
+ */
+ void RunL();
+
+private:
+
+ /**
+ * C++ default constructor.
+ */
+ CMTPPlaybackControlImpl( MMTPPlaybackObserver& aObserver );
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+private:
+
+ /**
+ * Get Playlist from collection complete..
+ */
+ void GetPlaylistFromCollectionCompleteL( const CMPXCollectionPlaylist& aPlaylist );
+
+ /**
+ * Deactive other player so that we can play
+ */
+ void DeActiveOtherPlayerL();
+
+ /**
+ * Check playback command and cache
+ */
+ void CheckPlaybackCmdAndCacheL( CMTPPlaybackCommand& aCmd );
+
+ /**
+ * UpdateCommandArrary
+ */
+ void UpdateCommandArray();
+
+ /**
+ * Require current media
+ */
+ void RequestMediaL();
+
+ /**
+ * Handle commandL
+ */
+ void DoCommandL();
+
+ /**
+ * Handle playback message
+ *
+ * @param aMessage playback message
+ */
+ void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
+
+ /**
+ * Handle playback property
+ *
+ * @param aProperty the property
+ * @param aValue the value of the property
+ */
+ void DoHandlePropertyL( TInt aProperty, TInt aValue );
+
+ /**
+ * Handle playback state changed.
+ *
+ * @param aState New Playback state
+ */
+ void DoHandleStateChangedL( TMPXPlaybackState aState );
+
+ /**
+ * Handle request media.
+ */
+ void DoHandleMediaL( const CMPXMedia& aMedia );
+
+ /**
+ * Handle Media changed.
+ *
+ */
+ void DoHandleMediaChangedL();
+
+ /**
+ * Handle Initialize Complete.
+ *
+ */
+ void DoHandleInitializeCompleteL();
+
+ /**
+ * Handle error.
+ *
+ */
+ void DoHandleError( TInt aErr );
+
+ /**
+ * Compare two path
+ * @param aPathBase the base path
+ * @param aPathNew the new path
+ * @param aLevel compare level
+ */
+ TBool IfEqual( const CMPXCollectionPath& aPathBase, const CMPXCollectionPath& aPathNew, TUint aLevel );
+
+ /**
+ * Map states from TMPXPlaybackState to TMPlayerState
+ *
+ * @param aState State in TMPXPlaybackState format
+ * @return State in TMPlayerState format
+ */
+ TMTPPlaybackState MapState( TMPXPlaybackState aState );
+
+ /**
+ * Map error from TInt to the error defined in interface
+ */
+ TInt MapError( TInt error );
+
+ /**
+ *Complete a sync request
+ */
+ void CompleteSelf( TInt aCompletionCode );
+
+ /*
+ * Initiate MPX Playback Command
+ */
+ void InitiateMPXPlaybackCommandL( TMPXPlaybackCommand aCommand, TBool aIsMTPPlaybackUtility );
+
+ /*
+ * SendMPXPlaybackCommandL
+ */
+ void SendMPXPlaybackCommandL( TMPXPlaybackCommand aCommand, TBool aIsMTPPlaybackUtility );
+
+
+ /*
+ * SendPlaybackCommandCompleteL
+ */
+ void SendPlaybackCommandCompleteL();
+
+ /*
+ * SendPlaybackEventL
+ */
+ void SendPlaybackEventL( TMTPPlaybackEvent aEvt );
+
+ /**
+ * Reset playback command
+ */
+ void ResetPlaybackCommand();
+
+private:
+
+ /**
+ * return current state.
+ */
+ TMPXPlaybackState CurrentState() const;
+
+ /**
+ * return previous state.
+ */
+ TMPXPlaybackState PreviousState() const;
+
+ /**
+ * return song count.
+ */
+ TInt32 SongCount() const;
+
+ /**
+ * return song index.
+ */
+ TInt32 SongIndex() const;
+
+ /**
+ * Cache mtp playback command.
+ */
+ void SetMTPPBCmd( TMTPPlaybackCommand aMTPPBCmd );
+
+ /**
+ * return mtp playback command.
+ */
+ TMTPPlaybackCommand MTPPBCmdHandling() const;
+
+private:
+
+ MMTPPlaybackObserver* iObserver;// Not owned
+ MMTPPlaybackCallback* iCallback;// Not owned
+
+ MMPXPlaybackUtility* iPlaybackUtility;// Owned
+ MMPXPlaybackUtility* iNowActivePlaybackUtility;// Owned
+
+ CMTPPlaybackCommandChecker* iPlaybackCommandChecker;//Owned
+ CMTPPlaybackPlaylistHelper* iPlaybackPlaylistHelper;//Owned
+ CMTPPlaybackResumeHelper* iPlaybackResumeHelper;
+
+ CMPXCollectionPlaylist* iPlayList; //Owned
+ RResumeCmdArray iPrepareCmdArray;//Owned
+ RResumeCmdArray iResumeCmdArray;//Owned
+ CMTPPbCmdParam* iCmdParam;
+
+ TMTPPlaybackCommand iMTPPBCmd;
+ TMPXPlaybackState iPreState;
+ TMPXPlaybackState iState;
+
+ /**
+ FLOGGER debug trace member variable.
+ */
+ __FLOG_DECLARATION_MEMBER;
+ };
+
+#endif // CMTPPLAYBACKCONTROLIMPL_H
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/inc/cmtpplaybackplaylisthelper.h Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,228 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef CMTPPLAYBACKPLAYLISTHELPER_H_
+#define CMTPPLAYBACKPLAYLISTHELPER_H_
+
+#include <mpxcollectionobserver.h>
+#include <mpxcollectionuihelperobserver.h>
+
+#include "mtpdebug.h"
+#include "cmtpplaybackparam.h"
+
+class MMPXCollectionUiHelper;
+class MMPXCollectionHelper;
+class MMPXCollectionUtility;
+
+class TMTPPbDataSuid;
+class CMTPPlaybackControlImpl;
+
+NONSHARABLE_CLASS( CMTPPlaybackPlaylistHelper ) : public CBase,
+ public MMPXCollectionObserver
+ {
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CMTPPlaybackPlaylistHelper* NewL( CMTPPlaybackControlImpl& aControlImpl );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CMTPPlaybackPlaylistHelper();
+
+public:
+
+ /**
+ * Get playlist from collection server
+ * @param aPlayObject, refer to TMTPPbDataSuid
+ */
+ void GetPlayListFromCollectionL( const TMTPPbDataSuid& aPlayObject );
+
+ /**
+ * Get playlist from collection server
+ * @param aIndex, song index
+ */
+ void GetPlayListFromCollectionL( TInt aIndex );
+
+ /**
+ * Get suid from collection server
+ * @param aPlaylist, current collection playlist
+ */
+ TMTPPbDataSuid GetMTPPBSuidFromCollectionL(
+ const CMPXCollectionPlaylist& aPlaylist );
+
+ /**
+ * Get category
+ */
+ TMTPPbCategory MTPPbCategory() const;
+
+ /**
+ * Get suid
+ */
+ TFileName MTPPbSuid() const;
+
+private:
+
+ //from base class MMPXCollectionObserver
+ /**
+ * Handle collection message
+ *
+ * @param aMsg 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.
+ */
+ void HandleCollectionMessage( CMPXMessage* aMsg, TInt aErr );
+
+ /**
+ * 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 );
+
+ /**
+ * 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 MMPXCollectionMediaObserver
+ * It handles MediaL event.
+ *
+ * @param aMedia object containing collection's informations
+ * @param aError error code
+ */
+ void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError );
+
+private:
+
+ /**
+ * C++ default constructor.
+ */
+ CMTPPlaybackPlaylistHelper( CMTPPlaybackControlImpl& aControlImpl );
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+private:
+
+ /**
+ * Handle collection message
+ */
+ void DoHandleCollectionMessageL( const CMPXMessage& aMsg );
+
+ /**
+ * Handle OpenL
+ */
+ void DoHandleOpenL( const CMPXMedia& aEntries );
+
+ /**
+ * Open the root path of playlist
+ */
+ void OpenMusicPlayListPathL();
+
+ /**
+ * Open the root path of album
+ */
+ void OpenMusicAblumPathL();
+
+ /**
+ * Reset play source
+ */
+ void ResetPlaySource();
+
+ /**
+ *Update path index according to iPlayObject
+ */
+ void UpdatePlaylistPathIndexL( const CMPXMedia& aEntries );
+
+ /**
+ *Got the collectionHelperL
+ */
+ MMPXCollectionHelper* CollectionHelperL();
+
+ /**
+ * Map uri to ItemId
+ */
+ const TMPXItemId UriToItemIdL();
+
+ /**
+ * Map uri to ItemId
+ */
+ const TFileName ItemIdToUriL( const TMPXItemId& aId );
+
+ /**
+ * Find Album Songs
+ */
+ CMPXMedia* FindAlbumSongsL( const TMPXItemId& aAlbumId );
+
+ /*
+ * UpdatePathAndOpenL
+ */
+ void UpdateAlbumPathAndOpenL();
+
+ /*
+ * UpdatePathAndOpenL
+ */
+ void UpdatePathAndOpenL();
+
+ /**
+ * Return instance of CMTPPlaybackControlImpl.
+ *
+ */
+ CMTPPlaybackControlImpl& MTPPlaybackControlImpl();
+
+private:
+
+ MMPXCollectionUiHelper* iCollectionUiHelper;//Owned
+ MMPXCollectionHelper* iCollectionHelper;//Owned
+ MMPXCollectionUtility* iCollectionUtil;//Owned
+ HBufC* iPlayObject; //Owned
+
+ CMTPPlaybackControlImpl& iMTPPlaybackControl;// Not owned
+
+ TMTPPbCategory iPlayCategory;
+ TInt iSongIndex;
+ TInt iPathIndex;
+
+ /**
+ FLOGGER debug trace member variable.
+ */
+ __FLOG_DECLARATION_MEMBER;
+ };
+
+#endif /* CMTPPLAYBACKPLAYLISTHELPER_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/inc/cmtpplaybackresumehelper.h Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,125 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef CMTPPLAYBACKRESUMEHELPER_H_
+#define CMTPPLAYBACKRESUMEHELPER_H_
+
+#include "mtpplaybackcontrolconst.h"
+#include "mmtpplaybackinterface.h"
+#include "mtpdebug.h"
+
+class CMTPPlaybackControlImpl;
+
+NONSHARABLE_CLASS( CMTPPlaybackResumeHelper ) : public CBase
+ {
+public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CMTPPlaybackResumeHelper* NewL( CMTPPlaybackControlImpl& aControlImpl );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CMTPPlaybackResumeHelper();
+
+public:
+
+ /**
+ Map the CMTPPlaybackCommand to MPXCommand,
+ */
+ void UpdatePrepareCmdArray( TMTPPlaybackCommand aMTPPPBCmd, RResumeCmdArray& aMTPPBMPXCmd );
+
+ /**
+ Map the CMTPPlaybackCommand to MPXCommand,
+ */
+ void UpdateResumeCmdArray( TMTPPlaybackCommand aMTPPPBCmd, RResumeCmdArray& aMTPPBMPXCmd );
+
+private:
+
+ /**
+ * C++ default constructor.
+ */
+ CMTPPlaybackResumeHelper( CMTPPlaybackControlImpl& aControlImpl );
+
+private:
+
+ /**
+ * Map PlaybackCmd to PlaybackMPXCmd.
+ */
+ void HandlePlaybackCmdInitObject( RResumeCmdArray& aMTPPBMPXCmdArray );
+
+ /**
+ * Map PlaybackCmd to PlaybackMPXCmd.
+ */
+ void HandlePlaybackCmdInitIndex( RResumeCmdArray& aMTPPBMPXCmdArray );
+
+ /**
+ * Map PlaybackCmd to PlaybackMPXCmd.
+ */
+ void HandlePlaybackCmdPlay( RResumeCmdArray& aMTPPBMPXCmdArray );
+
+ /**
+ * Map PlaybackCmd to PlaybackMPXCmd.
+ */
+ void HandlePlaybackCmdPause( RResumeCmdArray& aMTPPBMPXCmdArray );
+
+ /**
+ * Map PlaybackCmd to PlaybackMPXCmd.
+ */
+ void HandlePlaybackCmdSeekForward( RResumeCmdArray& aMTPPBMPXCmd );
+
+ /**
+ * Map PlaybackCmd to PlaybackMPXCmd.
+ */
+ void HandlePlaybackCmdSeekBackward( RResumeCmdArray& aMTPPBMPXCmd );
+
+ /**
+ * Map PlaybackCmd to PlaybackMPXCmd.
+ */
+ void HandlePlaybackCmdSkip( RResumeCmdArray& aMTPPBMPXCmd );
+
+ /**
+ * Map PlaybackCmd to PlaybackMPXCmd.
+ */
+ void HandlePlaybackCmdSetPosition( RResumeCmdArray& aMTPPBMPXCmd );
+
+ /**
+ * Return instance of CMTPPlaybackControlImpl.
+ */
+ CMTPPlaybackControlImpl& MTPPlaybackControlImpl();
+
+private:
+
+ /**
+ The handle of the owner
+ */
+ CMTPPlaybackControlImpl& iMTPPlaybackControl;
+
+ TBool iIfParepareArray;
+
+ /**
+ FLOGGER debug trace member variable.
+ */
+ __FLOG_DECLARATION_MEMBER;
+ };
+
+#endif /* CMTPPLAYBACKRESUMEHELPER_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/inc/mtpplaybackcontrolconst.h Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,65 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef MTPPLAYBACKCONTROLCONST_H_
+#define MTPPLAYBACKCONTROLCONST_H_
+
+#include <mpxplaybackutility.h>
+
+/**
+Used by test db existed
+*/
+const TInt KMTPPlaybackInvalidSongID = 0x1FFFFFFF;
+const TInt KStorageRootMaxLength = 10;
+
+/**
+The volume step of mtp playback
+*/
+const TUint32 KMTPPlaybackVolumeStep = 1;
+
+/**
+The playlist or album level of collection path
+*/
+const TInt KMTPPlaybackPlaylistAblumLevel = 2;
+
+/**
+The album id of collection path
+*/
+const TInt KMPXCollectionArtistAlbum = 3;
+
+/**
+iMPXCommand is the mpx command
+iMPXExpectState is the expected state
+*/
+struct TMPXComandElement
+ {
+ TMPXPlaybackCommand iMPXCommand;
+ TMPXPlaybackState iMPXExpectState;
+ };
+
+typedef RArray<TMPXComandElement> RResumeCmdArray;
+
+/**
+The uid of playback control dp
+*/
+const TUid KMTPPlaybackControlDpUid = { 0x2002EA9A };
+
+#endif /* MTPPLAYBACKCONTROLCONST_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/src/cmtpplaybackcommandchecker.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,209 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include "cmtpplaybackcommandchecker.h"
+#include "cmtpplaybackcontrolimpl.h"
+
+// Constants
+__FLOG_STMT(_LIT8(KComponent,"PlaybackCommandChecker");)
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackCommandChecker::NewL
+// ---------------------------------------------------------------------------
+//
+CMTPPlaybackCommandChecker* CMTPPlaybackCommandChecker::NewL(
+ CMTPPlaybackControlImpl& aControlImpl )
+ {
+ CMTPPlaybackCommandChecker* self = new ( ELeave )
+ CMTPPlaybackCommandChecker( aControlImpl );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackCommandChecker::~CMTPPlaybackCommandChecker
+// ---------------------------------------------------------------------------
+//
+CMTPPlaybackCommandChecker::~CMTPPlaybackCommandChecker()
+ {
+ __FLOG(_L8("+CMTPPlaybackCommandChecker::~CMTPPlaybackCommandChecker"));
+ __FLOG(_L8("-CMTPPlaybackCommandChecker::~CMTPPlaybackCommandChecker"));
+ __FLOG_CLOSE;
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackCommandChecker::CheckPlaybackCommandContextL
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackCommandChecker::CheckPlaybackCommandContextL( TMTPPlaybackCommand aMTPPBCommand )
+ {
+ __FLOG(_L8("+CMTPPlaybackCommandChecker::CheckPlaybackCommandContextL"));
+
+ MTPPlaybackControlImpl().SetMTPPBCmd( aMTPPBCommand );
+
+ switch ( aMTPPBCommand )
+ {
+ case EPlaybackCmdInitObject:
+ case EPlaybackCmdGetVolumeSet:
+ case EPlaybackCmdGetVolume:
+ case EPlaybackCmdGetState:
+ case EPlaybackCmdSetVolume:
+ {
+ __FLOG(_L8("no context check for init object command"));
+ }
+ break;
+ case EPlaybackCmdInitIndex:
+ case EPlaybackCmdSkip:
+ case EPlaybackCmdGetIndex:
+ {
+ if ( MTPPlaybackControlImpl().SongCount() < 0 )
+ {
+ User::Leave( KPlaybackErrContextInvalid );
+ }
+ }
+ break;
+ case EPlaybackCmdPlay:
+ case EPlaybackCmdPause:
+ case EPlaybackCmdStop:
+ case EPlaybackCmdSeekForward:
+ case EPlaybackCmdSeekBackward:
+ case EPlaybackCmdGetObject:
+ case EPlaybackCmdSetPosition:
+ case EPlaybackCmdGetPosition:
+ {
+ switch ( MTPPlaybackControlImpl().CurrentState())
+ {
+ case EPbStateNotInitialised:
+ {
+ User::Leave( KPlaybackErrContextInvalid );
+ }
+ default:
+ break;
+ }
+ }
+ break;
+ default:
+ {
+ __FLOG(_L8("Not support command!"));
+ User::Leave( KPlaybackErrParamInvalid );
+ }
+ break;
+ }
+
+ __FLOG(_L8("-CMTPPlaybackCommandChecker::CheckPlaybackCommandContextL"));
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackCommandChecker::CheckAndUpdatePlaybackParamL
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackCommandChecker::CheckAndUpdatePlaybackParamL( CMTPPlaybackCommand& aMTPPPBSourceCmd,
+ CMTPPbCmdParam** aMTPPPBTargetParam )
+ {
+ __FLOG(_L8("+CMTPPlaybackCommandChecker::CheckAndUpdatePlaybackParamL"));
+
+ delete *aMTPPPBTargetParam;
+ *aMTPPPBTargetParam = NULL;
+
+ switch ( aMTPPPBSourceCmd.PlaybackCommand())
+ {
+ case EPlaybackCmdInitObject:
+ {
+ const TMTPPbCategory category = aMTPPPBSourceCmd.ParamL().SuidSetL().Category();
+ TFileName suid = aMTPPPBSourceCmd.ParamL().SuidSetL().Suid();
+ *aMTPPPBTargetParam = CMTPPbCmdParam::NewL( category, suid );
+ }
+ break;
+ case EPlaybackCmdInitIndex:
+ {
+ TUint32 songIndex = aMTPPPBSourceCmd.ParamL().Uint32L();
+ if ( songIndex > ( MTPPlaybackControlImpl().SongCount()-1 ))
+ {
+ User::Leave( KPlaybackErrParamInvalid );
+ }
+ *aMTPPPBTargetParam = CMTPPbCmdParam::NewL( songIndex );
+ }
+ break;
+ case EPlaybackCmdSkip:
+ {
+ TInt32 songIndex = MTPPlaybackControlImpl().SongIndex() + aMTPPPBSourceCmd.ParamL().Int32L();
+ TUint32 songCount = MTPPlaybackControlImpl().SongCount();
+
+ if ( songIndex < 0 )
+ {
+ songIndex = ( - songIndex ) % songCount;
+ songIndex = ( songCount - songIndex ) % songCount;
+ }
+ else
+ {
+ songIndex = songIndex % songCount;
+ }
+
+ *aMTPPPBTargetParam = CMTPPbCmdParam::NewL( songIndex);
+ }
+ break;
+ case EPlaybackCmdSetVolume:
+ {
+ TUint32 volume = aMTPPPBSourceCmd.ParamL().Uint32L();
+ if( volume > KPbPlaybackVolumeLevelMax )
+ {
+ User::Leave( KPlaybackErrParamInvalid );
+ }
+ *aMTPPPBTargetParam = CMTPPbCmdParam::NewL( volume );
+ }
+ break;
+ case EPlaybackCmdSetPosition:
+ {
+ TUint32 position= aMTPPPBSourceCmd.ParamL().Uint32L();
+ *aMTPPPBTargetParam = CMTPPbCmdParam::NewL( position );
+ }
+ break;
+ default:
+ {
+ __FLOG(_L8("No param, just cache command"));
+ }
+ break;
+ }
+
+ __FLOG(_L8("-CMTPPlaybackCommandChecker::CheckAndUpdatePlaybackParamL"));
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackCommandChecker::CMTPPlaybackCommandChecker
+// ---------------------------------------------------------------------------
+//
+CMTPPlaybackCommandChecker::CMTPPlaybackCommandChecker(
+ CMTPPlaybackControlImpl& aControlImpl )
+ : iMTPPlaybackControl( aControlImpl )
+ {
+ __FLOG_OPEN(KMTPSubsystem, KComponent);
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackCommandChecker::MTPPlaybackControlImpl
+// ---------------------------------------------------------------------------
+//
+CMTPPlaybackControlImpl& CMTPPlaybackCommandChecker::MTPPlaybackControlImpl()
+ {
+ return iMTPPlaybackControl;
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/src/cmtpplaybackcontrolimpl.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,1097 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <mpxmessagegeneraldefs.h>
+#include <mpxplaybackutility.h>
+#include <mpxplaybackmessage.h>
+#include <mpxplaybackmessagedefs.h>
+#include <mpxcommandgeneraldefs.h>
+
+#include <mpxcollectionplaylist.h>
+#include <mpxcollectionpath.h>
+
+#include "cmtpplaybackcontrolimpl.h"
+#include "cmtpplaybackplaylisthelper.h"
+#include "cmtpplaybackcommandchecker.h"
+#include "cmtpplaybackresumehelper.h"
+#include "mtpplaybackcontrolpanic.h"
+#include "cmtpplaybackcommand.h"
+#include "cmtpplaybackevent.h"
+
+// Constants
+__FLOG_STMT(_LIT8(KComponent,"PlaybackControlImpl");)
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackControlImpl::NewL
+// ---------------------------------------------------------------------------
+//
+CMTPPlaybackControlImpl* CMTPPlaybackControlImpl::NewL(
+ MMTPPlaybackObserver& aObserver )
+ {
+ CMTPPlaybackControlImpl* self = new ( ELeave )
+ CMTPPlaybackControlImpl( aObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackControlImpl::Close()
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackControlImpl::Close()
+ {
+ delete this;
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackControlImpl::~CMTPPlaybackControlImpl
+// ---------------------------------------------------------------------------
+//
+CMTPPlaybackControlImpl::~CMTPPlaybackControlImpl()
+ {
+ __FLOG(_L8("+CMTPPlaybackControlImpl::~CMTPPlaybackControlImpl"));
+
+ if ( iPlaybackUtility )
+ {
+ TRAP_IGNORE( SendMPXPlaybackCommandL( EPbCmdClose, ETrue ) );
+ TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) );
+ iPlaybackUtility->Close();
+ }
+
+ if ( iNowActivePlaybackUtility )
+ {
+ TRAP_IGNORE( SendMPXPlaybackCommandL( EPbCmdClose, EFalse ) );
+ iNowActivePlaybackUtility->Close();
+ }
+
+ delete iPlaybackCommandChecker;
+ delete iPlaybackPlaylistHelper;
+ delete iPlaybackResumeHelper;
+ delete iPlayList;
+ iPrepareCmdArray.Reset();
+ iPrepareCmdArray.Close();
+ iResumeCmdArray.Reset();
+ iResumeCmdArray.Close();
+ delete iCmdParam;
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::~CMTPPlaybackControlImpl"));
+ __FLOG_CLOSE;
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackControlImpl::CommandL
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackControlImpl::CommandL( CMTPPlaybackCommand& aCmd, MMTPPlaybackCallback* aCallback )
+ {
+ __FLOG(_L8("+CMTPPlaybackControlImpl::CommandL"));
+ __FLOG_1(_L8("The command code is 0x%X"), aCmd.PlaybackCommand() );
+
+ iCallback = aCallback;
+
+ TRAPD( err, CheckPlaybackCmdAndCacheL( aCmd ));
+
+ if ( KErrNone == err )
+ {
+ UpdateCommandArray();
+ DoCommandL();
+ }
+ else
+ {
+ CompleteSelf( err );
+ }
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::CommandL"));
+ }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackObserver
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackControlImpl::HandlePlaybackMessage( CMPXMessage* aMessage,
+ TInt aError )
+ {
+ __FLOG_1(_L8("+CMTPPlaybackControlImpl::HandlePlaybackMessage( %d ) "), aError );
+
+ if (( KErrNone == aError ) && aMessage )
+ {
+ TRAP( aError, DoHandlePlaybackMessageL( *aMessage ) );
+ }
+
+ if ( KErrNone != aError )
+ {
+ DoHandleError( MapError( aError ));
+ }
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::HandlePlaybackMessage"));
+ }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackControlImpl::HandlePropertyL( TMPXPlaybackProperty aProperty,
+ TInt aValue, TInt aError )
+ {
+ __FLOG_VA((_L8("+CMTPPlaybackControlImpl::HandlePropertyL( aProperty = 0x%X, aValue = 0x%X, aError = %d ) "), aProperty, aValue, aError ));
+
+ if ( KErrNone == aError )
+ {
+ TRAP( aError, DoHandlePropertyL( aProperty, aValue ));
+ }
+
+ if ( KErrNone != aError )
+ {
+ DoHandleError( MapError( aError ) );
+ }
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::HandlePropertyL"));
+ }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// 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 CMTPPlaybackControlImpl::HandleSubPlayerNamesL(
+ TUid /* aPlayer */,
+ const MDesCArray* /* aSubPlayers */,
+ TBool /* aComplete */,
+ TInt /* aError */ )
+ {
+ __FLOG(_L8("+CMTPPlaybackControlImpl::HandleSubPlayerNamesL"));
+ __FLOG(_L8("-CMTPPlaybackControlImpl::HandleSubPlayerNamesL"));
+ }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle media
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackControlImpl::HandleMediaL( const CMPXMedia& aMedia,
+ TInt aError )
+ {
+ __FLOG(_L8("+CMTPPlaybackControlImpl::HandleMediaL"));
+
+ if (( KErrNone == aError ) && ( aMedia.IsSupported( KMPXMediaGeneralUri )))
+ {
+ TRAP( aError, DoHandleMediaL( aMedia ));
+ }
+
+ if ( KErrNone != aError )
+ {
+ DoHandleError( MapError( aError ));
+ }
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::HandleMediaL"));
+ }
+
+// ---------------------------------------------------------------------------
+// From CActive
+// CMTPPlaybackControlImpl::DoCancel()
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackControlImpl::DoCancel()
+ {
+ __FLOG(_L8("+CMTPPlaybackControlImpl::DoCancel"));
+ __FLOG(_L8("-CMTPPlaybackControlImpl::DoCancel"));
+ }
+
+// ---------------------------------------------------------------------------
+// From CActive
+// CMTPPlaybackControlImpl::RunL()
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackControlImpl::RunL()
+ {
+ __FLOG(_L8("+CMTPBTConnection::RunL"));
+
+ if ( KPlaybackErrNone == iStatus.Int() )
+ {
+ TRAPD( error, SendPlaybackCommandCompleteL());
+ if ( error != KErrNone )
+ {
+ DoHandleError( MapError( error ) );
+ }
+ }
+ else
+ {
+ DoHandleError( iStatus.Int());
+ }
+
+ __FLOG(_L8("-CMTPBTConnection::RunL"));
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackControlImpl::CMTPPlaybackControlImpl
+// ---------------------------------------------------------------------------
+//
+CMTPPlaybackControlImpl::CMTPPlaybackControlImpl(
+ MMTPPlaybackObserver& aObserver )
+ : CActive( EPriorityStandard ),
+ iObserver( &aObserver )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackControlImpl::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackControlImpl::ConstructL()
+ {
+ __FLOG_OPEN(KMTPSubsystem, KComponent);
+ __FLOG(_L8("+CMTPPlaybackControlImpl::ConstructL"));
+
+ iPlaybackUtility = MMPXPlaybackUtility::NewL( KMTPPlaybackControlDpUid, this );
+ iNowActivePlaybackUtility = MMPXPlaybackUtility::NewL( KPbModeActivePlayer );
+
+ iPlaybackCommandChecker = CMTPPlaybackCommandChecker::NewL( *this );
+ iPlaybackPlaylistHelper = CMTPPlaybackPlaylistHelper::NewL( *this );
+ iPlaybackResumeHelper = CMTPPlaybackResumeHelper::NewL( *this );
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::ConstructL"));
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackControlImpl::GetPlaylistFromCollectionCompleteL
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackControlImpl::GetPlaylistFromCollectionCompleteL( const CMPXCollectionPlaylist& aPlaylist )
+ {
+ __FLOG(_L8("+CMTPPlaybackControlImpl::GetPlaylistFromCollectionCompleteL "));
+
+ CMPXCollectionPlaylist* tmp =
+ CMPXCollectionPlaylist::NewL( aPlaylist );
+ CleanupStack::PushL( tmp );
+ tmp->SetEmbeddedPlaylist( ETrue );
+ tmp->SetRepeatEnabled( EFalse );
+ tmp->SetShuffleEnabledL( EFalse );
+ iPlaybackUtility->InitL( *tmp, ETrue );
+ CleanupStack::PopAndDestroy( tmp );
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::HandlePlaybackGetPlaylistCompleteL"));
+ }
+
+// ----------------------------------------------------
+// CMTPPlaybackControlImpl::DeActiveOtherPlayerL
+// ----------------------------------------------------
+//
+void CMTPPlaybackControlImpl::DeActiveOtherPlayerL()
+ {
+ __FLOG(_L8("+CMTPPlaybackControlImpl::DeActiveOtherPlayerL()"));
+
+ if ( iNowActivePlaybackUtility->StateL() != iPlaybackUtility->StateL())
+ {
+ SendMPXPlaybackCommandL( EPbCmdPause, EFalse );
+ }
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::DeActiveOtherPlayerL()"));
+ }
+
+// ----------------------------------------------------
+// CMTPPlaybackControlImpl::CheckPlaybackCmdAndCacheL
+// ----------------------------------------------------
+//
+void CMTPPlaybackControlImpl::CheckPlaybackCmdAndCacheL( CMTPPlaybackCommand& aCmd )
+ {
+ __FLOG(_L8("+CMTPPlaybackControlImpl::CheckPlaybackCmdAndCacheL"));
+
+ iPlaybackCommandChecker->CheckPlaybackCommandContextL( aCmd.PlaybackCommand());
+ iPlaybackCommandChecker->CheckAndUpdatePlaybackParamL( aCmd, &iCmdParam );
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::CheckPlaybackCmdAndCacheL"));
+ }
+
+// ----------------------------------------------------
+// CMTPPlaybackControlImpl::UpdateCommandArrayL
+// ----------------------------------------------------
+//
+void CMTPPlaybackControlImpl::UpdateCommandArray()
+ {
+ __FLOG(_L8("+CMTPPlaybackControlImpl::UpdateCommandArrayL"));
+
+ iPlaybackResumeHelper->UpdatePrepareCmdArray( iMTPPBCmd, iPrepareCmdArray );
+ iPlaybackResumeHelper->UpdateResumeCmdArray( iMTPPBCmd, iResumeCmdArray );
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::UpdateCommandArrayL"));
+ }
+
+// ----------------------------------------------------
+// CMTPPlaybackControlImpl::RequestMediaL
+// ----------------------------------------------------
+//
+void CMTPPlaybackControlImpl::RequestMediaL()
+ {
+ __FLOG(_L8("+CMTPPlaybackControlImpl::RequestMediaL"));
+
+ if ( iPlayList )
+ {
+ delete iCmdParam;
+ iCmdParam = NULL;
+ iCmdParam = CMTPPbCmdParam::NewL( iPlaybackPlaylistHelper->MTPPbCategory(),
+ iPlaybackPlaylistHelper->MTPPbSuid());
+ CompleteSelf( KPlaybackErrNone );
+ }
+ else if ( iPlaybackUtility->Source() )
+ {
+ //Album or Playlist
+ iPlayList = iPlaybackUtility->Source()->PlaylistL();
+
+ if ( iPlayList )
+ {
+ TMTPPbDataSuid suid( EMTPPbCatNone, KNullDesC );
+ suid = iPlaybackPlaylistHelper->GetMTPPBSuidFromCollectionL( *iPlayList );
+ delete iCmdParam;
+ iCmdParam = NULL;
+ iCmdParam = CMTPPbCmdParam::NewL( suid.Category(), suid.Suid());
+ CompleteSelf( KPlaybackErrNone );
+ }
+ else
+ {
+ //Single Song
+ RArray<TMPXAttribute> attrs;
+ CleanupClosePushL(attrs);
+ attrs.Append( KMPXMediaGeneralUri );
+ iPlaybackUtility->Source()->MediaL( attrs.Array(), *this );
+ CleanupStack::PopAndDestroy( &attrs );
+ }
+ }
+ else
+ {
+ //Not initialized
+ CompleteSelf( KPlaybackErrContextInvalid );
+ }
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::RequestMediaL"));
+ }
+
+// ----------------------------------------------------
+// CMTPPlaybackControlImpl::DoCommandL
+// ----------------------------------------------------
+//
+void CMTPPlaybackControlImpl::DoCommandL()
+ {
+ __FLOG(_L8("+CMTPPlaybackControlImpl::DoCommandL"));
+
+ if ( iPrepareCmdArray.Count() != 0 )
+ {
+ InitiateMPXPlaybackCommandL( iPrepareCmdArray[0].iMPXCommand, ETrue );
+ return;
+ }
+
+ switch ( iMTPPBCmd )
+ {
+ case EPlaybackCmdInitObject:
+ {
+ const TMTPPbCategory category = iCmdParam->SuidSetL().Category();
+ if ( EMTPPbCatMusic == category )
+ {
+ iPlaybackUtility->InitL( iCmdParam->SuidSetL().Suid() );
+ }
+ else
+ {
+ iPlaybackPlaylistHelper->GetPlayListFromCollectionL( iCmdParam->SuidSetL() );
+ }
+ }
+ break;
+ case EPlaybackCmdInitIndex:
+ {
+ iPlaybackPlaylistHelper->GetPlayListFromCollectionL( iCmdParam->Uint32L() );
+ }
+ break;
+ case EPlaybackCmdStop:
+ {
+ delete iPlayList;
+ iPlayList = NULL;
+ SendMPXPlaybackCommandL( EPbCmdClose, ETrue );
+ CompleteSelf( KPlaybackErrNone );
+ }
+ break;
+ case EPlaybackCmdSkip:
+ {
+ iPlaybackPlaylistHelper->GetPlayListFromCollectionL( iCmdParam->Int32L() );
+ }
+ break;
+ case EPlaybackCmdSetVolume:
+ {
+ iPlaybackUtility->SetL( EPbPropertyVolume, iCmdParam->Uint32L() );
+ }
+ break;
+ case EPlaybackCmdSetPosition:
+ {
+ iPlaybackUtility->PropertyL(*this, EPbPropertyDuration);
+ }
+ break;
+ case EPlaybackCmdGetPosition:
+ {
+ iPlaybackUtility->PropertyL(*this, EPbPropertyPosition);
+ }
+ break;
+ case EPlaybackCmdGetVolumeSet:
+ case EPlaybackCmdGetVolume:
+ {
+ iPlaybackUtility->PropertyL(*this, EPbPropertyVolume);
+ }
+ break;
+ case EPlaybackCmdGetState:
+ {
+ delete iCmdParam;
+ iCmdParam = NULL;
+ TMTPPlaybackState state = MapState( CurrentState());
+ iCmdParam = CMTPPbCmdParam::NewL( static_cast<TUint32>( state ));
+ CompleteSelf( KPlaybackErrNone );
+ }
+ break;
+ case EPlaybackCmdGetObject:
+ {
+ RequestMediaL();
+ }
+ break;
+ case EPlaybackCmdGetIndex:
+ {
+ delete iCmdParam;
+ iCmdParam = NULL;
+ iCmdParam = CMTPPbCmdParam::NewL( static_cast<TUint32>( SongIndex()));
+ CompleteSelf( KPlaybackErrNone );
+ }
+ break;
+ default:
+ {
+ if ( iResumeCmdArray.Count() != 0 )
+ {
+ InitiateMPXPlaybackCommandL( iResumeCmdArray[0].iMPXCommand, ETrue );
+ }
+ else
+ {
+ CompleteSelf( KPlaybackErrNone );
+ }
+ }
+ break;
+ }
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::DoCommandL"));
+ }
+
+// ----------------------------------------------------
+// CMTPPlaybackControlImpl::DoHandlePlaybackMessageL
+// ----------------------------------------------------
+//
+void CMTPPlaybackControlImpl::DoHandlePlaybackMessageL( const CMPXMessage& aMessage )
+ {
+ __FLOG(_L8("+CMTPPlaybackControlImpl::DoHandlePlaybackMessageL"));
+
+ TMPXMessageId id(
+ aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+
+ if ( KMPXMessageGeneral == id )
+ {
+ TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
+
+ switch ( event )
+ {
+ case TMPXPlaybackMessage::EPropertyChanged:
+ {
+ DoHandlePropertyL(
+ aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ),
+ aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ));
+ }
+ break;
+ case TMPXPlaybackMessage::EStateChanged:
+ {
+ TMPXPlaybackState state(
+ aMessage.ValueTObjectL<TMPXPlaybackState>(
+ KMPXMessageGeneralType ));
+ DoHandleStateChangedL( state );
+ }
+ break;
+ case TMPXPlaybackMessage::EInitializeComplete:
+ {
+ DoHandleInitializeCompleteL();
+ }
+ break;
+ case TMPXPlaybackMessage::EMediaChanged:
+ {
+ DoHandleMediaChangedL();
+ }
+ break;
+ default:
+ __FLOG_VA((_L8("DoHandlePlaybackMessageL( TMPXPlaybackMessage event = 0x%X ) "), event ));
+ break;
+ }
+ }
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::DoHandlePlaybackMessageL"));
+ }
+
+
+// ---------------------------------------------------------------------------
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackControlImpl::DoHandlePropertyL( TInt aProperty, TInt aValue )
+ {
+ __FLOG_VA((_L8("+CMTPPlaybackControlImpl::DoHandlePropertyL( aProperty = 0x%X, aValue = 0x%X ) "), aProperty, aValue ));
+
+ switch ( aProperty )
+ {
+ case EPbPropertyPosition:
+ {
+ if ( EPlaybackCmdGetPosition == MTPPBCmdHandling())
+ {
+ delete iCmdParam;
+ iCmdParam = NULL;
+ iCmdParam = CMTPPbCmdParam::NewL(static_cast<TUint32>(aValue));
+ SendPlaybackCommandCompleteL();
+ }
+ else if ( EPlaybackCmdSetPosition == MTPPBCmdHandling() )
+ {
+ if ( aValue == iCmdParam->Uint32L() )
+ {
+ SendPlaybackCommandCompleteL();
+ }
+ }
+ }
+ break;
+ case EPbPropertyMute:
+ {
+ SendPlaybackEventL( EPlaybackEventVolumeUpdate );
+ }
+ break;
+ case EPbPropertyVolume:
+ {
+ switch ( MTPPBCmdHandling() )
+ {
+ case EPlaybackCmdSetVolume:
+ {
+ SendPlaybackCommandCompleteL();
+ }
+ break;
+ case EPlaybackCmdGetVolumeSet:
+ {
+ delete iCmdParam;
+ iCmdParam = NULL;
+ TMTPPbDataVolume volumeSet( KPbPlaybackVolumeLevelMax,
+ KPbPlaybackVolumeLevelMin,
+ KMPXPlaybackDefaultVolume,
+ aValue,
+ KMTPPlaybackVolumeStep );
+ iCmdParam = CMTPPbCmdParam::NewL( volumeSet );
+ SendPlaybackCommandCompleteL();
+ }
+ break;
+ case EPlaybackCmdGetVolume:
+ {
+ delete iCmdParam;
+ iCmdParam = NULL;
+ iCmdParam = CMTPPbCmdParam::NewL(static_cast<TUint32>( aValue ));
+ SendPlaybackCommandCompleteL();
+ }
+ break;
+ default:
+ {
+ SendPlaybackEventL( EPlaybackEventVolumeUpdate );
+ }
+ break;
+ }
+ }
+ break;
+ case EPbPropertyDuration:
+ {
+ if ( EPlaybackCmdSetPosition == MTPPBCmdHandling())
+ {
+ if ( iCmdParam->Uint32L() < aValue )
+ {
+ iPlaybackUtility->SetL( EPbPropertyPosition, iCmdParam->Uint32L() );
+ }
+ else
+ {
+ DoHandleError( KPlaybackErrParamInvalid );
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::DoHandlePropertyL"));
+ }
+
+// ---------------------------------------------------------------------------
+// Handle playback state changed.
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackControlImpl::DoHandleStateChangedL( TMPXPlaybackState aState )
+ {
+ __FLOG_VA((_L8("+CMTPPlaybackControlImpl::DoHandleStateChangedL( aState = 0x%X ) "), aState ));
+
+ if (( iPrepareCmdArray.Count() != 0 ) && ( iPrepareCmdArray[0].iMPXExpectState == aState ))
+ {
+ iPrepareCmdArray.Remove( 0 );
+ DoCommandL();
+ }
+ else if (( iResumeCmdArray.Count() != 0 ) && ( iResumeCmdArray[0].iMPXExpectState == aState ))
+ {
+ iResumeCmdArray.Remove( 0 );
+ SendPlaybackCommandCompleteL();
+ }
+ else if (( iState != aState ) && ( MapState( aState )!= MapState( iState ) ))
+ {
+ SendPlaybackEventL( EPlaybackEventStateUpdate );
+ }
+
+ if ( iState != aState )
+ {
+ iPreState = iState;
+ iState = aState;
+ }
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::DoHandleStateChangedL"));
+ }
+
+// ---------------------------------------------------------------------------
+// DoHandleMediaL.
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackControlImpl::DoHandleMediaL( const CMPXMedia& aMedia )
+ {
+ __FLOG(_L8("+CMTPPlaybackControlImpl::DoHandleMediaL"));
+
+ TFileName filePath(aMedia.ValueText(KMPXMediaGeneralUri) );
+ delete iCmdParam;
+ iCmdParam = NULL;
+ iCmdParam = CMTPPbCmdParam::NewL( EMTPPbCatMusic, filePath );
+ SendPlaybackCommandCompleteL();
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::DoHandleMediaL"));
+ }
+
+// ---------------------------------------------------------------------------
+// Handle media changed.
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackControlImpl::DoHandleMediaChangedL()
+ {
+ __FLOG(_L8("+CMTPPlaybackControlImpl::DoHandleMediaChangedL"));
+
+ if (( EPbStateNotInitialised == iState ) || ( EPbStateInitialising == iState ))
+ {
+ if (( MTPPBCmdHandling() != EPlaybackCmdInitObject )
+ && ( MTPPBCmdHandling() != EPlaybackCmdInitIndex )
+ && ( MTPPBCmdHandling() != EPlaybackCmdSkip ))
+ {
+ //should send an event
+ MMPXSource* source = iPlaybackUtility->Source();
+ CMPXCollectionPlaylist* playlist = source->PlaylistL();
+ if (( playlist != NULL ) && ( iPlayList != NULL ))
+ {
+ CleanupStack::PushL( playlist );
+ //New media is a playlist or album
+ TInt level = playlist->Path().Levels();
+ if ( IfEqual(iPlayList->Path(), playlist->Path(), level-1 ) && !IfEqual(iPlayList->Path(), playlist->Path(), level ))
+ {
+ SendPlaybackEventL( EPlaybackEventObjectIndexUpdate );
+
+ CleanupStack::Pop( playlist );
+ delete iPlayList;
+ iPlayList = playlist;
+ }
+ else
+ {
+ SendPlaybackEventL( EPlaybackEventObjectUpdate );
+ SendPlaybackEventL( EPlaybackEventObjectIndexUpdate );
+
+ CleanupStack::PopAndDestroy( playlist );
+ delete iPlayList;
+ iPlayList = NULL;
+ }
+ }
+ else
+ {
+ //New media is a single song
+ SendPlaybackEventL( EPlaybackEventObjectUpdate );
+
+ delete iPlayList;
+ iPlayList = NULL;
+ }
+ }
+ }
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::DoHandleMediaChangedL"));
+ }
+
+// ---------------------------------------------------------------------------
+// Handle Initialize complete.
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackControlImpl::DoHandleInitializeCompleteL()
+ {
+ __FLOG(_L8("+CMTPPlaybackControlImpl::DoHandleInitializeCompleteL"));
+
+ if ( EPlaybackCmdInitObject == MTPPBCmdHandling()
+ || EPlaybackCmdInitIndex == MTPPBCmdHandling()
+ || EPlaybackCmdSkip == MTPPBCmdHandling())
+ {
+ delete iPlayList;
+ iPlayList = NULL;
+
+ MMPXSource* source = iPlaybackUtility->Source();
+ if ( source )
+ {
+ iPlayList = source->PlaylistL();
+ SendPlaybackCommandCompleteL();
+ }
+ }
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::DoHandleInitializeCompleteL"));
+ }
+
+// ---------------------------------------------------------------------------
+// Handle error.
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackControlImpl::DoHandleError( TInt aErr )
+ {
+ if ( aErr != KPlaybackErrNone )
+ {
+ if ( iCallback )
+ {
+ TRAP_IGNORE( iCallback->HandlePlaybackCommandCompleteL( NULL, aErr ));
+ ResetPlaybackCommand();
+ }
+ else
+ {
+ TRAP_IGNORE( iObserver->HandlePlaybackEventL( NULL, aErr ));
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Compare two path according to level.
+// ---------------------------------------------------------------------------
+//
+TBool CMTPPlaybackControlImpl::IfEqual( const CMPXCollectionPath& aPathBase, const CMPXCollectionPath& aPathNew, TUint aLevel )
+ {
+ __FLOG(_L8("+CMTPPlaybackControlImpl::IfEqual"));
+
+ if (( aPathBase.Levels() < aLevel ) || ( aPathNew.Levels() < aLevel ))
+ {
+ return EFalse;
+ }
+ for ( TInt i = 0; i < aLevel; i++ )
+ {
+ if ( aPathBase.Index( i ) != aPathNew.Index( i ) )
+ {
+ return EFalse;
+ }
+ }
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::IfEqual"));
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+// Map states from TMPXPlaybackState to TMTPPlaybackState
+// ---------------------------------------------------------------------------
+//
+TMTPPlaybackState CMTPPlaybackControlImpl::MapState( TMPXPlaybackState aState )
+ {
+ __FLOG_VA((_L8("+CMTPPlaybackControlImpl::MapState( aState = 0x%X ) "), aState ));
+
+ TMTPPlaybackState state = EPlayStateError;
+
+ switch ( aState )
+ {
+ case EPbStatePlaying:
+ {
+ state = EPlayStatePlaying;
+ }
+ break;
+ case EPbStatePaused:
+ case EPbStateInitialising:
+ case EPbStateInitialised:
+ case EPbStateNotInitialised:
+ case EPbStateStopped:
+ {
+ state = EPlayStatePaused;
+ }
+ break;
+ case EPbStateSeekingForward:
+ {
+ state = EPlayStateForwardSeeking;
+ }
+ break;
+ case EPbStateSeekingBackward:
+ {
+ state = EPlayStateBackwardSeeking;
+ }
+ break;
+ default:
+ break;
+ }
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::MapState"));
+ return state;
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackControlImpl::MapError.
+// ---------------------------------------------------------------------------
+//
+TInt CMTPPlaybackControlImpl::MapError( TInt aError )
+ {
+ TInt err( KPlaybackErrNone );
+
+ if ( KErrHardwareNotAvailable == aError )
+ {
+ err = KPlaybackErrDeviceUnavailable;
+ }
+ else if ( KErrArgument == aError )
+ {
+ err = KPlaybackErrParamInvalid;
+ }
+ else
+ {
+ err = KPlaybackErrDeviceBusy;
+ }
+ return err;
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackControlImpl::CompleteSelf.
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackControlImpl::CompleteSelf( TInt aCompletionCode )
+ {
+ __FLOG_1(_L8("+CMTPPlaybackControlImpl::CompleteSelf( %d )"), aCompletionCode );
+
+ SetActive();
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, aCompletionCode );
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::CompleteSelf"));
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackControlImpl::InitiateMPXPlaybackCommandL.
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackControlImpl::InitiateMPXPlaybackCommandL( TMPXPlaybackCommand aCommand, TBool aIsMTPPlaybackUtility )
+ {
+ __FLOG(_L8("+CMTPPlaybackControlImpl::InitiateMPXPlaybackCommandL"));
+
+ switch ( aCommand )
+ {
+ case EPbCmdPlay:
+ {
+ DeActiveOtherPlayerL();
+ SendMPXPlaybackCommandL( EPbCmdPlay, aIsMTPPlaybackUtility );
+ }
+ break;
+ case EPbCmdPlayPause:
+ {
+ DeActiveOtherPlayerL();
+ SendMPXPlaybackCommandL( EPbCmdPlayPause, aIsMTPPlaybackUtility );
+ }
+ break;
+ default:
+ {
+ SendMPXPlaybackCommandL( aCommand, aIsMTPPlaybackUtility );
+ }
+ break;
+ }
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::InitiateMPXPlaybackCommandL"));
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackControlImpl::SendMPXPlaybackCommandL.
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackControlImpl::SendMPXPlaybackCommandL( TMPXPlaybackCommand aCommand, TBool aIsMTPPlaybackUtility )
+ {
+ __FLOG(_L8("+CMTPPlaybackControlImpl::SendPlaybackCommandL"));
+
+ CMPXCommand* cmd( CMPXCommand::NewL() );
+ CleanupStack::PushL( cmd );
+ cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral );
+ cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+ cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, aCommand );
+ cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralData, 0 );
+
+ if ( aIsMTPPlaybackUtility )
+ {
+ iPlaybackUtility->CommandL( *cmd, this );
+ }
+ else
+ {
+ iNowActivePlaybackUtility->CommandL( *cmd );
+ }
+
+ CleanupStack::PopAndDestroy( cmd );
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::SendPlaybackCommandL"));
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackControlImpl::SendPlaybackCommandCompleteL.
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackControlImpl::SendPlaybackCommandCompleteL()
+ {
+ __FLOG(_L8("+CMTPPlaybackControlImpl::SendPlaybackCommandCompleteL"));
+
+ __ASSERT_DEBUG( iCallback, Panic( EMTPPBCallbackInvalid ));
+ __ASSERT_DEBUG(( iMTPPBCmd > EPlaybackCmdNone ) && ( iMTPPBCmd < EPlaybackCmdEnd ), Panic( EMTPPBCallbackInvalid ));
+
+ if ( iResumeCmdArray.Count() != 0 )
+ {
+ InitiateMPXPlaybackCommandL( iResumeCmdArray[0].iMPXCommand, ETrue );
+ }
+ else
+ {
+ CMTPPlaybackCommand* cmd = CMTPPlaybackCommand::NewL( iMTPPBCmd, iCmdParam );
+ iCmdParam = NULL;//Ownership is handled to CMTPPlaybackCommand
+ CleanupStack::PushL(cmd);
+ iCallback->HandlePlaybackCommandCompleteL( cmd );
+ CleanupStack::PopAndDestroy(cmd);
+
+ ResetPlaybackCommand();
+ }
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::SendPlaybackCommandCompleteL"));
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackControlImpl::SendPlaybackEventL.
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackControlImpl::SendPlaybackEventL( TMTPPlaybackEvent aEvt )
+ {
+ __FLOG(_L8("+CMTPPlaybackControlImpl::SendPlaybackEventL"));
+
+ CMTPPlaybackEvent* event = CMTPPlaybackEvent::NewL( aEvt, NULL );
+ CleanupStack::PushL(event);
+ iObserver->HandlePlaybackEventL( event );
+ CleanupStack::PopAndDestroy(event);
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::SendPlaybackEventL"));
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackControlImpl::ResetPlaybackCommand.
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackControlImpl::ResetPlaybackCommand()
+ {
+ __FLOG(_L8("+CMTPPlaybackControlImpl::ResetPlaybackCommand"));
+
+ iCallback = NULL;
+ iMTPPBCmd = EPlaybackCmdNone;
+ iPrepareCmdArray.Reset();
+ iResumeCmdArray.Reset();
+ delete iCmdParam;
+ iCmdParam = NULL;
+
+ __FLOG(_L8("-CMTPPlaybackControlImpl::ResetPlaybackCommand"));
+ }
+
+// ---------------------------------------------------------------------------
+// Return current state
+// ---------------------------------------------------------------------------
+//
+TMPXPlaybackState CMTPPlaybackControlImpl::CurrentState() const
+ {
+ return iState;
+ }
+
+// ---------------------------------------------------------------------------
+// Return previous state
+// ---------------------------------------------------------------------------
+//
+TMPXPlaybackState CMTPPlaybackControlImpl::PreviousState() const
+ {
+ return iPreState;
+ }
+
+// ---------------------------------------------------------------------------
+// Return song count
+// ---------------------------------------------------------------------------
+//
+TInt32 CMTPPlaybackControlImpl::SongCount() const
+ {
+ TInt32 songCount = -1;
+ if ( iPlayList )
+ {
+ songCount = iPlayList->Count();
+ }
+ return songCount;
+ }
+
+// ---------------------------------------------------------------------------
+// Return song index
+// ---------------------------------------------------------------------------
+//
+TInt32 CMTPPlaybackControlImpl::SongIndex() const
+ {
+ TInt32 songIndex = -1;
+ if ( iPlayList )
+ {
+ TInt level = iPlayList->Path().Levels();
+ songIndex = iPlayList->Path().Index( level-1 );
+ }
+ return songIndex;
+ }
+
+// ---------------------------------------------------------------------------
+// Set mtp playback command
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackControlImpl::SetMTPPBCmd( TMTPPlaybackCommand aMTPPBCmd )
+ {
+ iMTPPBCmd = aMTPPBCmd;
+ }
+
+// ---------------------------------------------------------------------------
+// Return mtp playback command which is handling
+// ---------------------------------------------------------------------------
+//
+TMTPPlaybackCommand CMTPPlaybackControlImpl::MTPPBCmdHandling() const
+ {
+ if ( iPrepareCmdArray.Count() == 0 )
+ {
+ return iMTPPBCmd;
+ }
+ else
+ {
+ return EPlaybackCmdNone;
+ }
+
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/src/cmtpplaybackplaylisthelper.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,756 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <mpxmediamusicdefs.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmessagegeneraldefs.h>
+#include <pathinfo.h>
+
+#include <mpxcollectionhelper.h>
+#include <mpxcollectionhelperfactory.h>
+#include <mpxcollectionuihelper.h>
+#include <mpxcollectionhelperfactory.h>
+
+#include <mpxcollectionutility.h>
+#include <mpxcollectionplaylist.h>
+#include <mpxcollectionmessage.h>
+#include <mpxcollectionpath.h>
+
+#include "cmtpplaybackcontrolimpl.h"
+#include "cmtpplaybackplaylisthelper.h"
+#include "mtpplaybackcontrolpanic.h"
+
+// Constants
+__FLOG_STMT(_LIT8(KComponent,"PlaybackPlaylistHelper");)
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackPlaylistHelper::NewL
+// ---------------------------------------------------------------------------
+//
+CMTPPlaybackPlaylistHelper* CMTPPlaybackPlaylistHelper::NewL( CMTPPlaybackControlImpl& aControlImpl )
+ {
+ CMTPPlaybackPlaylistHelper* self = new ( ELeave )
+ CMTPPlaybackPlaylistHelper( aControlImpl );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackPlaylistHelper::~CMTPPlaybackPlaylistHelper
+// ---------------------------------------------------------------------------
+//
+CMTPPlaybackPlaylistHelper::~CMTPPlaybackPlaylistHelper()
+ {
+ __FLOG(_L8("+CMTPPlaybackPlaylistHelper::~CMTPPlaybackPlaylistHelper"));
+
+ if( iCollectionUiHelper )
+ {
+ iCollectionUiHelper->Close();
+ }
+
+ if ( iCollectionHelper )
+ {
+ iCollectionHelper->Close();
+ }
+
+ if( iCollectionUtil )
+ {
+ iCollectionUtil->Close();
+ }
+
+ delete iPlayObject;
+
+ __FLOG(_L8("-CMTPPlaybackPlaylistHelper::~CMTPPlaybackPlaylistHelper"));
+ __FLOG_CLOSE;
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackPlaylistHelper::GetPlayListFromCollectionL
+//// Get Playlist via aMedia
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackPlaylistHelper::GetPlayListFromCollectionL( const TMTPPbDataSuid& aPlayObject )
+ {
+ __FLOG(_L8("+CMTPPlaybackPlaylistHelper::GetPlayListFromCollectionL"));
+
+ //Reset
+ ResetPlaySource();
+
+ iPlayCategory = aPlayObject.Category();
+ iPlayObject = aPlayObject.Suid().AllocL();
+
+ switch ( iPlayCategory )
+ {
+ case EMTPPbCatPlayList:
+ {
+ OpenMusicPlayListPathL();
+ }
+ break;
+ case EMTPPbCatAlbum:
+ {
+ OpenMusicAblumPathL();
+ }
+ break;
+ default:
+ {
+ Panic( EMTPPBCollectionErrCall );
+ }
+ break;
+ }
+
+ __FLOG(_L8("-CMTPPlaybackPlaylistHelper::GetPlayListFromCollectionL"));
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackPlaylistHelper::GetPlayListFromCollectionL
+// Get Playlist via index
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackPlaylistHelper::GetPlayListFromCollectionL( TInt aIndex )
+ {
+ __FLOG(_L8("+CMTPPlaybackPlaylistHelper::GetPlayListFromCollectionL"));
+
+ iSongIndex = aIndex;
+
+ UpdatePathAndOpenL();
+
+ __FLOG(_L8("-CMTPPlaybackPlaylistHelper::GetPlayListFromCollectionL"));
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackPlaylistHelper::GetMTPPBSuidFromCollectionL
+// ---------------------------------------------------------------------------
+//
+TMTPPbDataSuid CMTPPlaybackPlaylistHelper::GetMTPPBSuidFromCollectionL(
+ const CMPXCollectionPlaylist& aPlaylist )
+ {
+ __FLOG(_L8("+CMTPPlaybackPlaylistHelper::GetPlayListFromCollectionL"));
+
+ CMPXCollectionPath* path = iCollectionUiHelper->MusicPlaylistPathL();
+ if ( path->Id() == aPlaylist.Path().Id( KMTPPlaybackPlaylistAblumLevel -1 ))
+ {
+ iPlayCategory = EMTPPbCatPlayList;
+ }
+ else
+ {
+ iPlayCategory = EMTPPbCatAlbum;
+ }
+ TFileName uri = ItemIdToUriL( aPlaylist.Path().Id( KMTPPlaybackPlaylistAblumLevel ));
+ TMTPPbDataSuid dataSuid( iPlayCategory, uri );
+
+ __FLOG(_L8("-CMTPPlaybackPlaylistHelper::GetPlayListFromCollectionL"));
+ return dataSuid;
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackPlaylistHelper::MTPPbCategory
+// ---------------------------------------------------------------------------
+//
+TMTPPbCategory CMTPPlaybackPlaylistHelper::MTPPbCategory() const
+ {
+ return iPlayCategory;
+ }
+// ---------------------------------------------------------------------------
+// CMTPPlaybackPlaylistHelper::MTPPbSuid
+// ---------------------------------------------------------------------------
+//
+TFileName CMTPPlaybackPlaylistHelper::MTPPbSuid() const
+ {
+ return TFileName( *iPlayObject );
+ }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handle completion of a asynchronous command
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackPlaylistHelper::HandleCollectionMessage( CMPXMessage* aMsg, TInt aErr )
+ {
+ __FLOG_1(_L8("+CMTPPlaybackPlaylistHelper::HandleCollectionMessage( %d ) "), aErr );
+
+ if (( KErrNone == aErr ) && aMsg )
+ {
+ TRAP( aErr, DoHandleCollectionMessageL( *aMsg ));
+ }
+
+ if ( KErrNone != aErr )
+ {
+ TInt error = MTPPlaybackControlImpl().MapError( aErr );
+ MTPPlaybackControlImpl().DoHandleError( error );
+ }
+
+ __FLOG(_L8("-CMTPPlaybackPlaylistHelper::HandleCollectionMessage"));
+ }
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackPlaylistHelper::HandleOpenL( const CMPXMedia& aEntries,
+ TInt /*aIndex*/, TBool /*aComplete*/, TInt aError )
+ {
+ __FLOG_1(_L8("+CMTPPlaybackPlaylistHelper::HandleOpenL( %d )"), aError );
+
+ if ( KErrNone == aError )
+ {
+ TRAP( aError, DoHandleOpenL( aEntries ));
+ }
+
+ if ( KErrNone != aError )
+ {
+ TInt error = MTPPlaybackControlImpl().MapError( aError );
+ MTPPlaybackControlImpl().DoHandleError( error );
+ }
+
+ __FLOG(_L8("-CMTPPlaybackPlaylistHelper::HandleOpenL"));
+ }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackPlaylistHelper::HandleOpenL( const CMPXCollectionPlaylist& aPlaylist,
+ TInt aError )
+ {
+ __FLOG_1(_L8("+CMTPPlaybackPlaylistHelper::HandleOpenL( aPlaylist, aError = %d )"), aError );
+
+ if ( KErrNone == aError )
+ {
+ TRAP( aError, MTPPlaybackControlImpl().GetPlaylistFromCollectionCompleteL( aPlaylist ));
+ }
+
+ if ( KErrNone != aError )
+ {
+ TInt error = MTPPlaybackControlImpl().MapError( aError );
+ MTPPlaybackControlImpl().DoHandleError( error );
+ }
+
+ __FLOG(_L8("-CMTPPlaybackPlaylistHelper::HandleOpenL( aPlaylist, aError )"));
+ }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionMediaObserver
+// ---------------------------------------------------------------------------
+void CMTPPlaybackPlaylistHelper::HandleCollectionMediaL( const CMPXMedia& /*aMedia*/, TInt /*aError*/ )
+ {
+ __FLOG(_L8("+CMTPPlaybackPlaylistHelper::HandleCollectionMediaL"));
+ __FLOG(_L8("-CMTPPlaybackPlaylistHelper::HandleCollectionMediaL"));
+ }
+
+//
+// CMTPPlaybackPlaylistHelper::CMTPPlaybackPlaylistHelper
+// ---------------------------------------------------------------------------
+//
+CMTPPlaybackPlaylistHelper::CMTPPlaybackPlaylistHelper( CMTPPlaybackControlImpl& aControlImpl )
+ : iCollectionUiHelper( NULL ),
+ iCollectionHelper( NULL ),
+ iCollectionUtil( NULL ),
+ iPlayObject( NULL ),
+ iMTPPlaybackControl( aControlImpl )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackPlaylistHelper::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackPlaylistHelper::ConstructL()
+ {
+ __FLOG_OPEN(KMTPSubsystem, KComponent);
+ __FLOG(_L8("+CMTPPlaybackPlaylistHelper::ConstructL"));
+
+ iCollectionUiHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL();
+ iCollectionUtil = MMPXCollectionUtility::NewL( this, KMcModeDefault );
+
+ __FLOG(_L8("-CMTPPlaybackPlaylistHelper::ConstructL"));
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackPlaylistHelper::DoHandleCollectionMessage
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackPlaylistHelper::DoHandleCollectionMessageL( const CMPXMessage& aMsg )
+ {
+ __FLOG(_L8("+CMTPPlaybackPlaylistHelper::DoHandleCollectionMessage"));
+
+ TMPXMessageId id( aMsg.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+
+ if ( KMPXMessageGeneral == id )
+ {
+ TInt event( aMsg.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
+ TInt type( aMsg.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+ TInt data( aMsg.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+
+ __FLOG_VA((_L8("Event code is 0x%X, type code is 0x%X"), event, type ));
+ __FLOG_1(_L8("Data code is 0x%X"), data );
+
+ if ( event == TMPXCollectionMessage::EPathChanged &&
+ type == EMcPathChangedByOpen &&
+ data == EMcContainerOpened )
+ {
+ iCollectionUtil->Collection().OpenL();
+ }
+ else if ( event == TMPXCollectionMessage::EPathChanged &&
+ type == EMcPathChangedByOpen &&
+ data == EMcItemOpened )
+ {
+ iCollectionUtil->Collection().OpenL();
+ }
+ else if ( event == TMPXCollectionMessage::ECollectionChanged )
+ {
+ __FLOG(_L8("Ignore this event"));
+ }
+ }
+
+ __FLOG(_L8("-CMTPPlaybackPlaylistHelper::DoHandleCollectionMessage"));
+ }
+
+// ----------------------------------------------------
+// CMTPPlaybackPlaylistHelper::DoHandleOpenL
+// ----------------------------------------------------
+//
+void CMTPPlaybackPlaylistHelper::DoHandleOpenL( const CMPXMedia& aEntries )
+ {
+ __FLOG(_L8("+CMTPPlaybackPlaylistHelper::DoHandleOpenL( const CMPXMedia )"));
+
+ if ( EMTPPbCatAlbum == iPlayCategory )
+ {
+ UpdateAlbumPathAndOpenL();
+ }
+ else
+ {
+ //playlist
+ if ( -1 == iPathIndex )
+ {
+ //first, the top path
+ UpdatePlaylistPathIndexL( aEntries );
+
+ if ( -1 == iPathIndex )
+ {
+ MTPPlaybackControlImpl().DoHandleError( KPlaybackErrParamInvalid );
+ }
+ else
+ {
+ iCollectionUtil->Collection().OpenL( iPathIndex );
+ }
+ }
+ else
+ {
+ //open the first song when initObject
+ iCollectionUtil->Collection().OpenL( iSongIndex );
+ }
+ }
+
+ __FLOG(_L8("-CMTPPlaybackPlaylistHelper::DoHandleOpenL( const CMPXMedia )"));
+ }
+
+// ----------------------------------------------------
+// CMTPPlaybackPlaylistHelper::OpenMusicPlayListPathL
+// ----------------------------------------------------
+//
+void CMTPPlaybackPlaylistHelper::OpenMusicPlayListPathL()
+ {
+ __FLOG(_L8("+CMTPPlaybackPlaylistHelper::OpenMusicPlayListPathL"));
+
+ CMPXCollectionPath* path = iCollectionUiHelper->MusicPlaylistPathL();
+ CleanupStack::PushL( path );
+ iCollectionUtil->Collection().OpenL( *path );
+ CleanupStack::PopAndDestroy( path );
+
+ __FLOG(_L8("-CMTPPlaybackPlaylistHelper::OpenMusicPlayListPathL"));
+ }
+
+// ----------------------------------------------------
+// CMTPPlaybackPlaylistHelper::OpenMusicAblumPathL
+// ----------------------------------------------------
+//
+void CMTPPlaybackPlaylistHelper::OpenMusicAblumPathL()
+ {
+ __FLOG(_L8("+CMTPPlaybackPlaylistHelper::OpenMusicAblumPathL"));
+
+ CMPXCollectionPath* path = iCollectionUiHelper->MusicMenuPathL();
+ CleanupStack::PushL( path );
+ path->AppendL(KMPXCollectionArtistAlbum);
+ iCollectionUtil->Collection().OpenL( *path );
+ CleanupStack::PopAndDestroy( path );
+
+ __FLOG(_L8("-CMTPPlaybackPlaylistHelper::OpenMusicAblumPathL"));
+ }
+
+// ----------------------------------------------------
+// CMTPPlaybackPlaylistHelper::ResetPlaySource
+// ----------------------------------------------------
+//
+void CMTPPlaybackPlaylistHelper::ResetPlaySource()
+ {
+ __FLOG(_L8("+CMTPPlaybackPlaylistHelper::ResetPlaySourceL"));
+
+ iPathIndex = -1;
+ iSongIndex = 0;
+ delete iPlayObject;
+ iPlayObject = NULL;
+
+ __FLOG(_L8("-CMTPPlaybackPlaylistHelper::ResetPlaySourceL"));
+ }
+
+// ----------------------------------------------------
+// CMTPPlaybackPlaylistHelper::UpdatePlaylistPathIndexL
+// ----------------------------------------------------
+//
+void CMTPPlaybackPlaylistHelper::UpdatePlaylistPathIndexL( const CMPXMedia& aEntries )
+ {
+ __FLOG(_L8("+CMTPPlaybackPlaylistHelper::UpdatePlaylistPathIndexL"));
+ __ASSERT_DEBUG( iPlayCategory == EMTPPbCatPlayList, Panic( EMTPPBCollectionErrCall ));
+
+ const CMPXMediaArray* refArray = aEntries.Value<CMPXMediaArray> ( KMPXMediaArrayContents );
+ TInt count = refArray->Count();
+ const TMPXItemId playlistId = UriToItemIdL();
+
+ for ( TInt i=0; i<count; ++i )
+ {
+ CMPXMedia* container = refArray->AtL(i);
+ /**
+ * Try to find out the next path according to the
+ * playlist's ItemId
+ */
+ if ( container->IsSupported( KMPXMediaGeneralId ))
+ {
+ const TMPXItemId tempId = container->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+ if ( tempId == playlistId )
+ {
+ iPathIndex = i;
+ break;
+ }
+ }
+ }
+
+ __FLOG(_L8("-CMTPPlaybackPlaylistHelper::UpdatePlaylistPathIndexL"));
+ }
+
+// ---------------------------------------------------------------------------
+// return instance of CollectionHelper.
+// ---------------------------------------------------------------------------
+//
+MMPXCollectionHelper* CMTPPlaybackPlaylistHelper::CollectionHelperL()
+ {
+ __FLOG(_L8("+CMTPPlaybackPlaylistHelper::CollectionHelperL"));
+
+ if ( iCollectionHelper == NULL )
+ {
+ iCollectionHelper = CMPXCollectionHelperFactory::NewCollectionCachedHelperL();
+
+ // Do a search for a song ID that does not exist
+ RArray<TInt> 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<TMPXItemId>( KMPXMediaGeneralId,
+ KMTPPlaybackInvalidSongID );
+
+ /*
+ * store root
+ */
+ TChar driveChar = 'c';
+ TInt driveNumber;
+ User::LeaveIfError( RFs::CharToDrive( driveChar, driveNumber ) );
+
+ // get root path
+ TBuf<KStorageRootMaxLength> storeRoot;
+ User::LeaveIfError( PathInfo::GetRootPath( storeRoot, driveNumber ) );
+
+ searchMedia->SetTextValueL( KMPXMediaGeneralDrive, storeRoot );
+
+ RArray<TMPXAttribute> songAttributes;
+ CleanupClosePushL( songAttributes ); // + songAttributes
+ songAttributes.AppendL( KMPXMediaGeneralId );
+
+ CMPXMedia* foundMedia = NULL;
+ TRAPD( err, foundMedia = iCollectionHelper->FindAllL(
+ *searchMedia,
+ songAttributes.Array() ) );
+
+ CleanupStack::PopAndDestroy( &songAttributes ); // - songAttributes
+ CleanupStack::PopAndDestroy( searchMedia ); // - searchMedia
+
+ CleanupStack::PushL( foundMedia ); // + foundMedia
+
+ if ( err != KErrNone )
+ {
+ iCollectionHelper->Close();
+ iCollectionHelper = NULL;
+ User::Leave( KErrGeneral );
+ }
+ CleanupStack::PopAndDestroy( foundMedia ); // - foundMedia
+ }
+
+ __FLOG(_L8("-CMTPPlaybackPlaylistHelper::CollectionHelperL"));
+ return iCollectionHelper;
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackPlaylistHelper::UriToItemIdL
+// ---------------------------------------------------------------------------
+//
+const TMPXItemId CMTPPlaybackPlaylistHelper::UriToItemIdL()
+ {
+ __FLOG(_L8("+CMTPPlaybackPlaylistHelper::UriToItemIdL"));
+
+
+ TMPXItemId itemId( KMPXInvalidItemId );
+ TInt error = KErrNone;
+ CMPXMedia* result = NULL;
+
+ RArray<TMPXAttribute> atts;
+ CleanupClosePushL( atts );
+ atts.AppendL( KMPXMediaGeneralId );
+
+ if ( EMTPPbCatPlayList == iPlayCategory )
+ {
+ TRAP( error, result = CollectionHelperL()->GetL( *iPlayObject, atts.Array(), EMPXPlaylist ));
+ }
+ else
+ {
+ TRAP( error, result = CollectionHelperL()->GetL( *iPlayObject, atts.Array(), EMPXAbstractAlbum ));
+ }
+
+ if ( error != KErrNone )
+ {
+ CleanupStack::PopAndDestroy( &atts );
+ }
+ else
+ {
+ CleanupStack::PushL( result );
+ itemId = result->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+ CleanupStack::PopAndDestroy( result );
+ CleanupStack::PopAndDestroy( &atts );
+ }
+
+ __FLOG(_L8("-CMTPPlaybackPlaylistHelper::UriToItemIdL"));
+ return itemId;
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackPlaylistHelper::ItemIdToUriL.
+// ---------------------------------------------------------------------------
+//
+const TFileName CMTPPlaybackPlaylistHelper::ItemIdToUriL( const TMPXItemId& aId )
+ {
+ __FLOG(_L8("+CMTPPlaybackPlaylistHelper::ItemIdToUriL"));
+
+ TFileName itemUri( KNullDesC );
+
+ RArray<TInt> 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 );
+ if ( iPlayCategory == EMTPPbCatPlayList )
+ {
+ searchMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXPlaylist );
+ }
+ else
+ {
+ searchMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXAbstractAlbum );
+ }
+ searchMedia->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, aId );
+
+ RArray<TMPXAttribute> resultAttributes;
+ CleanupClosePushL( resultAttributes ); // + resultAttributes
+ resultAttributes.AppendL( KMPXMediaGeneralUri );
+
+ CMPXMedia* foundMedia = CollectionHelperL()->FindAllL(
+ *searchMedia,
+ resultAttributes.Array() );
+
+ CleanupStack::PopAndDestroy( &resultAttributes ); // - resultAttributes
+ CleanupStack::PopAndDestroy( searchMedia ); // - searchMedia
+
+ CleanupStack::PushL( foundMedia ); // + foundMedia
+ if ( !foundMedia->IsSupported( KMPXMediaArrayCount ))
+ {
+ User::Leave( KErrNotSupported );
+ }
+ else if ( *foundMedia->Value<TInt>( KMPXMediaArrayCount ) != 1 )
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+ const CMPXMediaArray* tracksArray = foundMedia->Value<CMPXMediaArray> ( KMPXMediaArrayContents );
+ CMPXMedia* item = tracksArray->AtL(0);
+
+ if ( item->IsSupported( KMPXMediaGeneralUri ))
+ {
+ itemUri = item->ValueText(KMPXMediaGeneralUri);
+ }
+
+ CleanupStack::PopAndDestroy( foundMedia ); // - foundMedia
+
+ __FLOG(_L8("-CMTPPlaybackPlaylistHelper::ItemIdToUriL"));
+ return itemUri;
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackPlaylistHelper::FindAlbumSongsL
+// ---------------------------------------------------------------------------
+//
+CMPXMedia* CMTPPlaybackPlaylistHelper::FindAlbumSongsL( const TMPXItemId& aAlbumId )
+ {
+ __FLOG(_L8("+CMTPPlaybackPlaylistHelper::FindAlbumSongsL"));
+
+ // Fetch the songs for the selected album
+ CMPXMedia* findCriteria = CMPXMedia::NewL();
+ CleanupStack::PushL( findCriteria );
+ findCriteria->SetTObjectValueL<TMPXGeneralType>( KMPXMediaGeneralType, EMPXGroup );
+ findCriteria->SetTObjectValueL<TMPXGeneralCategory>( KMPXMediaGeneralCategory, EMPXSong );
+ findCriteria->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, aAlbumId );
+ RArray<TMPXAttribute> attrs;
+ CleanupClosePushL( attrs );
+ attrs.Append( TMPXAttribute( KMPXMediaIdGeneral,
+ EMPXMediaGeneralTitle |
+ EMPXMediaGeneralId ) );
+ attrs.Append( KMPXMediaMusicAlbumTrack );
+
+ CMPXMedia* foundMedia = CollectionHelperL()->FindAllL( *findCriteria,
+ attrs.Array() );
+ CleanupStack::PopAndDestroy( &attrs );
+ CleanupStack::PopAndDestroy( findCriteria );
+
+ if ( !foundMedia->IsSupported( KMPXMediaArrayCount ) )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ TInt foundItemCount = *foundMedia->Value<TInt>( KMPXMediaArrayCount );
+ if ( foundItemCount == 0 )
+ {
+ User::Leave( KErrNotFound );
+ }
+ if ( !foundMedia->IsSupported( KMPXMediaArrayContents ) )
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+ __FLOG(_L8("-CMTPPlaybackPlaylistHelper::FindAlbumSongsL"));
+ return foundMedia;
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackPlaylistHelper::UpdatePathAndOpenL.
+// aParam: const CMPXMedia& aAlbums
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackPlaylistHelper::UpdateAlbumPathAndOpenL()
+ {
+ __FLOG(_L8("+CMTPPlaybackPlaylistHelper::UpdateAlbumPathAndOpenL"));
+
+ RArray<TMPXItemId> ids;
+ CleanupClosePushL(ids);
+
+ CMPXCollectionPath* cpath = iCollectionUtil->Collection().PathL();
+ CleanupStack::PushL( cpath );
+
+ if (cpath->Levels() == 3)
+ {
+ // go back one level before amending path with new levels
+ cpath->Back();
+ }
+
+ const TMPXItemId id = UriToItemIdL();
+ if ( KMPXInvalidItemId == id )
+ {
+ MTPPlaybackControlImpl().DoHandleError( KPlaybackErrParamInvalid );
+ CleanupStack::PopAndDestroy( cpath );
+ CleanupStack::PopAndDestroy(&ids);
+ return;
+ }
+
+ ids.AppendL(id);
+ cpath->AppendL( ids.Array() ); // top level items
+ cpath->Set( 0 );
+ ids.Reset();
+
+ CMPXMedia* songs = FindAlbumSongsL( id );
+ CleanupStack::PushL( songs );
+ const CMPXMediaArray* tracksArray = songs->Value<CMPXMediaArray> ( KMPXMediaArrayContents );
+ User::LeaveIfNull(const_cast<CMPXMediaArray*>(tracksArray));
+ TUint count = tracksArray->Count();
+ for (TInt i=0; i<count; ++i)
+ {
+ CMPXMedia* song = tracksArray->AtL(i);
+ const TMPXItemId id = song->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+ ids.AppendL(id);
+ }
+
+ cpath->AppendL(ids.Array()); // top level items
+ cpath->Set( iSongIndex );
+
+ iCollectionUtil->Collection().OpenL(*cpath);
+ CleanupStack::PopAndDestroy( songs );
+ CleanupStack::PopAndDestroy( cpath );
+ CleanupStack::PopAndDestroy(&ids);
+
+ __FLOG(_L8("-CMTPPlaybackPlaylistHelper::UpdateAlbumPathAndOpenL"));
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackPlaylistHelper::UpdatePathAndOpenL.
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackPlaylistHelper::UpdatePathAndOpenL()
+ {
+ __FLOG(_L8("+CMTPPlaybackPlaylistHelper::UpdatePathAndOpenL()"));
+
+ RArray<TMPXItemId> ids;
+ CleanupClosePushL(ids);
+
+ CMPXCollectionPath* cpath = iCollectionUtil->Collection().PathL();
+ CleanupStack::PushL( cpath );
+
+ cpath->Set( iSongIndex );
+
+ iCollectionUtil->Collection().OpenL(*cpath);
+ CleanupStack::PopAndDestroy( cpath );
+ CleanupStack::PopAndDestroy(&ids);
+
+ __FLOG(_L8("-CMTPPlaybackPlaylistHelper::UpdatePathAndOpenL( aSong Index )"));
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackPlaylistHelper::MTPPlaybackControlImpl.
+// ---------------------------------------------------------------------------
+//
+CMTPPlaybackControlImpl& CMTPPlaybackPlaylistHelper::MTPPlaybackControlImpl()
+ {
+ return iMTPPlaybackControl;
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/src/cmtpplaybackresumehelper.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,402 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include "cmtpplaybackresumehelper.h"
+#include "cmtpplaybackcommand.h"
+#include "cmtpplaybackcontrolimpl.h"
+
+// Constants
+__FLOG_STMT(_LIT8(KComponent,"PlaybackResumeHelper");)
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackResumeHelper::NewL
+// ---------------------------------------------------------------------------
+//
+CMTPPlaybackResumeHelper* CMTPPlaybackResumeHelper::NewL(
+ CMTPPlaybackControlImpl& aControlImpl )
+ {
+ CMTPPlaybackResumeHelper* self = new ( ELeave )
+ CMTPPlaybackResumeHelper( aControlImpl );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackResumeHelper::~CMTPPlaybackResumeHelper
+// ---------------------------------------------------------------------------
+//
+CMTPPlaybackResumeHelper::~CMTPPlaybackResumeHelper()
+ {
+ __FLOG(_L8("+CMTPPlaybackResumeHelper::~CMTPPlaybackResumeHelper"));
+ __FLOG(_L8("-CMTPPlaybackResumeHelper::~CMTPPlaybackResumeHelper"));
+ __FLOG_CLOSE;
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackResumeHelper::UpdatePrepareCmdArrayL
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackResumeHelper::UpdatePrepareCmdArray( TMTPPlaybackCommand aMTPPPBCmd,
+ RResumeCmdArray& aMTPPBMPXCmd )
+ {
+ __FLOG(_L8("+CMTPPlaybackResumeHelper::UpdatePrepareCmdArrayL"));
+
+ aMTPPBMPXCmd.Reset();
+ iIfParepareArray = ETrue;
+
+ switch ( aMTPPPBCmd )
+ {
+ case EPlaybackCmdSetPosition:
+ {
+ HandlePlaybackCmdSetPosition( aMTPPBMPXCmd );
+ }
+ break;
+ default:
+ break;
+ }
+
+ __FLOG(_L8("-CMTPPlaybackResumeHelper::UpdatePrepareCmdArrayL"));
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackResumeHelper::UpdateResumeCmdArrayL
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackResumeHelper::UpdateResumeCmdArray( TMTPPlaybackCommand aMTPPPBCmd,
+ RResumeCmdArray& aMTPPBMPXCmd)
+ {
+ __FLOG(_L8("+CMTPPlaybackResumeHelper::MapMTPPBCommandToMPXCommandL"));
+
+ aMTPPBMPXCmd.Reset();
+ iIfParepareArray = EFalse;
+
+ switch ( aMTPPPBCmd )
+ {
+ case EPlaybackCmdInitObject:
+ {
+ HandlePlaybackCmdInitObject( aMTPPBMPXCmd );
+ }
+ break;
+ case EPlaybackCmdInitIndex:
+ {
+ HandlePlaybackCmdInitIndex( aMTPPBMPXCmd );
+ }
+ break;
+ case EPlaybackCmdPlay:
+ {
+ HandlePlaybackCmdPlay( aMTPPBMPXCmd );
+ }
+ break;
+ case EPlaybackCmdPause:
+ {
+ HandlePlaybackCmdPause( aMTPPBMPXCmd );
+ }
+ break;
+ case EPlaybackCmdSkip:
+ {
+ HandlePlaybackCmdSkip( aMTPPBMPXCmd );
+ }
+ break;
+ case EPlaybackCmdSeekForward:
+ {
+ HandlePlaybackCmdSeekForward( aMTPPBMPXCmd );
+ }
+ break;
+ case EPlaybackCmdSeekBackward:
+ {
+ HandlePlaybackCmdSeekBackward( aMTPPBMPXCmd );
+ }
+ break;
+ case EPlaybackCmdSetPosition:
+ {
+ HandlePlaybackCmdSetPosition( aMTPPBMPXCmd );
+ }
+ break;
+ default:
+ break;
+ }
+
+ __FLOG(_L8("-CMTPPlaybackResumeHelper::MapPlaybackControlCommandL"));
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackResumeHelper::CMTPPlaybackResumeHelper
+// ---------------------------------------------------------------------------
+//
+CMTPPlaybackResumeHelper::CMTPPlaybackResumeHelper(
+ CMTPPlaybackControlImpl& aControlImpl )
+ : iMTPPlaybackControl( aControlImpl )
+ {
+ __FLOG_OPEN(KMTPSubsystem, KComponent);
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackResumeHelper::HandlePlaybackCmdInitObjectL
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackResumeHelper::HandlePlaybackCmdInitObject( RResumeCmdArray& aMTPPBMPXCmdArray )
+ {
+ switch ( MTPPlaybackControlImpl().CurrentState() )
+ {
+ case EPbStatePlaying:
+ {
+ TMPXComandElement command = { EPbCmdPlay, EPbStatePlaying };
+ aMTPPBMPXCmdArray.Append( command );
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackResumeHelper::HandlePlaybackCmdInitObjectL
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackResumeHelper::HandlePlaybackCmdInitIndex( RResumeCmdArray& aMTPPBMPXCmdArray )
+ {
+ switch ( MTPPlaybackControlImpl().CurrentState() )
+ {
+ case EPbStatePlaying:
+ {
+ TMPXComandElement command = { EPbCmdPlay, EPbStatePlaying };
+ aMTPPBMPXCmdArray.Append( command );
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackResumeHelper::HandlePlaybackCmdPlayL
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackResumeHelper::HandlePlaybackCmdPlay(RResumeCmdArray& aMTPPBMPXCmdArray )
+ {
+ switch ( MTPPlaybackControlImpl().CurrentState() )
+ {
+ case EPbStatePaused:
+ case EPbStateStopped:
+ case EPbStateInitialised:
+ {
+ TMPXComandElement command = { EPbCmdPlay, EPbStatePlaying };
+ aMTPPBMPXCmdArray.Append( command );
+ }
+ break;
+ case EPbStateSeekingBackward:
+ case EPbStateSeekingForward:
+ {
+ if ( MTPPlaybackControlImpl().PreviousState() == EPbStatePlaying )
+ {
+ TMPXComandElement tmp = { EPbCmdStopSeeking, EPbStatePlaying };
+ aMTPPBMPXCmdArray.Append( tmp );
+ }
+ else if ( MTPPlaybackControlImpl().PreviousState() == EPbStatePaused )
+ {
+ TMPXComandElement command = { EPbCmdStopSeeking, EPbStatePaused };
+ aMTPPBMPXCmdArray.Append( command );
+ TMPXComandElement command1 = { EPbCmdPlay, EPbStatePlaying };
+ aMTPPBMPXCmdArray.Append( command1 );
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackResumeHelper::HandlePlaybackCmdPauseL
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackResumeHelper::HandlePlaybackCmdPause( RResumeCmdArray& aMTPPBMPXCmdArray )
+ {
+ switch ( MTPPlaybackControlImpl().CurrentState() )
+ {
+ case EPbStatePlaying:
+ {
+ TMPXComandElement command = { EPbCmdPlayPause, EPbStatePaused };
+ aMTPPBMPXCmdArray.Append( command );
+ }
+ break;
+ case EPbStateSeekingBackward:
+ case EPbStateSeekingForward:
+ {
+ if ( MTPPlaybackControlImpl().PreviousState() == EPbStatePaused )
+ {
+ TMPXComandElement command = { EPbCmdStopSeeking, EPbStatePaused };
+ aMTPPBMPXCmdArray.Append( command );
+ }
+ else if ( MTPPlaybackControlImpl().PreviousState() == EPbStatePlaying )
+ {
+ TMPXComandElement command = { EPbCmdStopSeeking, EPbStatePlaying };
+ aMTPPBMPXCmdArray.Append( command );
+ TMPXComandElement command1 = { EPbCmdPlayPause, EPbStatePaused };
+ aMTPPBMPXCmdArray.Append( command1 );
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackResumeHelper::HandlePlaybackCmdSeekForwardL
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackResumeHelper::HandlePlaybackCmdSeekForward( RResumeCmdArray& aMTPPBMPXCmd )
+ {
+ switch ( MTPPlaybackControlImpl().CurrentState() )
+ {
+ case EPbStatePlaying:
+ case EPbStatePaused:
+ {
+ TMPXComandElement command = { EPbCmdStartSeekForward, EPbStateSeekingForward };
+ aMTPPBMPXCmd.Append( command );
+ }
+ break;
+ case EPbStateInitialised:
+ {
+ TMPXComandElement command = { EPbCmdPlay, EPbStatePlaying };
+ aMTPPBMPXCmd.Append( command );
+ TMPXComandElement command1 = { EPbCmdStartSeekForward, EPbStateSeekingForward };
+ aMTPPBMPXCmd.Append( command1 );
+ }
+ break;
+ case EPbStateSeekingBackward:
+ {
+ if ( MTPPlaybackControlImpl().PreviousState() == EPbStatePaused )
+ {
+ TMPXComandElement command = { EPbCmdStopSeeking, EPbStatePaused };
+ aMTPPBMPXCmd.Append( command );
+ TMPXComandElement command1 = { EPbCmdStartSeekForward, EPbStateSeekingForward };
+ aMTPPBMPXCmd.Append( command1 );
+ }
+ else if ( MTPPlaybackControlImpl().PreviousState() == EPbStatePlaying )
+ {
+ TMPXComandElement command = { EPbCmdStopSeeking, EPbStatePlaying };
+ aMTPPBMPXCmd.Append( command );
+ TMPXComandElement command1 = { EPbCmdStartSeekForward, EPbStateSeekingForward };
+ aMTPPBMPXCmd.Append( command1 );
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackResumeHelper::HandlePlaybackCmdSeekBackwardL
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackResumeHelper::HandlePlaybackCmdSeekBackward( RResumeCmdArray& aMTPPBMPXCmd )
+ {
+ switch ( MTPPlaybackControlImpl().CurrentState() )
+ {
+ case EPbStatePlaying:
+ case EPbStatePaused:
+ {
+ TMPXComandElement command = { EPbCmdStartSeekBackward, EPbStateSeekingBackward };
+ aMTPPBMPXCmd.Append( command );
+ }
+ break;
+ case EPbStateSeekingForward:
+ {
+ if ( MTPPlaybackControlImpl().PreviousState() == EPbStatePaused )
+ {
+ TMPXComandElement command = { EPbCmdStopSeeking, EPbStatePaused };
+ aMTPPBMPXCmd.Append( command );
+ TMPXComandElement command1 = { EPbCmdStartSeekBackward, EPbStateSeekingBackward };
+ aMTPPBMPXCmd.Append( command1 );
+ }
+ else if ( MTPPlaybackControlImpl().PreviousState() == EPbStatePlaying )
+ {
+ TMPXComandElement command = { EPbCmdStopSeeking, EPbStatePlaying };
+ aMTPPBMPXCmd.Append( command );
+ TMPXComandElement command1 = { EPbCmdStartSeekBackward, EPbStateSeekingBackward };
+ aMTPPBMPXCmd.Append( command1 );
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackResumeHelper::HandlePlaybackCmdSkipL
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackResumeHelper::HandlePlaybackCmdSkip( RResumeCmdArray& aMTPPBMPXCmd )
+ {
+ switch ( MTPPlaybackControlImpl().CurrentState() )
+ {
+ case EPbStatePlaying:
+ {
+ TMPXComandElement command = { EPbCmdPlay, EPbStatePlaying };
+ aMTPPBMPXCmd.Append( command );
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackResumeHelper::HandlePlaybackCmdSetPositionL
+// ---------------------------------------------------------------------------
+//
+void CMTPPlaybackResumeHelper::HandlePlaybackCmdSetPosition( RResumeCmdArray& aMTPPBMPXCmd )
+ {
+ switch ( MTPPlaybackControlImpl().CurrentState() )
+ {
+ case EPbStatePlaying:
+ {
+ if ( iIfParepareArray )
+ {
+ TMPXComandElement command = { EPbCmdPause, EPbStatePaused };
+ aMTPPBMPXCmd.Append( command );
+ }
+ else
+ {
+ TMPXComandElement command = { EPbCmdPlay, EPbStatePlaying };
+ aMTPPBMPXCmd.Append( command );
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CMTPPlaybackResumeHelper::CMTPPlaybackControlImpl
+// ---------------------------------------------------------------------------
+//
+CMTPPlaybackControlImpl& CMTPPlaybackResumeHelper::MTPPlaybackControlImpl()
+ {
+ return iMTPPlaybackControl;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/src/cmtppbcgetdevicepropdesc.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,312 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <mtp/cmtptypedevicepropdesc.h>
+
+#include "cmtppbcgetdevicepropdesc.h"
+#include "mtpplaybackcontroldpconst.h"
+#include "cmtpplaybackcontroldp.h"
+#include "cmtpplaybackproperty.h"
+#include "cmtpplaybackmap.h"
+#include "cmtpplaybackcommand.h"
+#include "mtpplaybackcontrolpanic.h"
+
+// Class constants.
+__FLOG_STMT(_LIT8(KComponent,"GetPlaybackDevicePropDesc");)
+
+/**
+Two-phase constructor.
+@param aPlugin The data provider plugin
+@param aFramework The data provider framework
+@param aConnection The connection from which the request comes
+@return a pointer to the created request processor object
+*/
+MMTPRequestProcessor* CMTPPbcGetDevicePropDesc::NewL(MMTPDataProviderFramework& aFramework,
+ MMTPConnection& aConnection,
+ CMTPPlaybackControlDataProvider& aDataProvider)
+ {
+ CMTPPbcGetDevicePropDesc* self = new (ELeave) CMTPPbcGetDevicePropDesc(aFramework, aConnection, aDataProvider);
+ return self;
+ }
+
+/**
+Destructor.
+*/
+CMTPPbcGetDevicePropDesc::~CMTPPbcGetDevicePropDesc()
+ {
+ __FLOG(_L8("~CMTPPbcGetDevicePropDesc - Entry"));
+ delete iPropDesc;
+ delete iPbCmd;
+ __FLOG(_L8("~CMTPPbcGetDevicePropDesc - Exit"));
+ __FLOG_CLOSE;
+ }
+
+/**
+Constructor.
+*/
+CMTPPbcGetDevicePropDesc::CMTPPbcGetDevicePropDesc(MMTPDataProviderFramework& aFramework,
+ MMTPConnection& aConnection,
+ CMTPPlaybackControlDataProvider& aDataProvider) :
+ CMTPRequestProcessor(aFramework, aConnection, 0, NULL),
+ iPlaybackControlDp(aDataProvider)
+ {
+ //Open the log system
+ __FLOG_OPEN(KMTPSubsystem, KComponent);
+ }
+
+/**
+GetDevicePropDesc request validator.
+@return EMTPRespCodeOK if request is verified, otherwise one of the error response codes
+*/
+TMTPResponseCode CMTPPbcGetDevicePropDesc::CheckRequestL()
+ {
+ __FLOG(_L8("CheckRequestL - Entry"));
+ TMTPResponseCode respCode = CMTPRequestProcessor::CheckRequestL();
+ if(respCode == EMTPRespCodeOK)
+ {
+ respCode = EMTPRespCodeDevicePropNotSupported;
+ TUint32 propCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
+ const TInt count = sizeof(KMTPPlaybackControlDpSupportedProperties) / sizeof(KMTPPlaybackControlDpSupportedProperties[0]);
+ for (TUint i(0); (i < count); i++)
+ {
+ if (propCode == KMTPPlaybackControlDpSupportedProperties[i])
+ {
+ respCode = EMTPRespCodeOK;
+ break;
+ }
+ }
+ }
+
+ __FLOG(_L8("CheckRequestL - Exit"));
+ return respCode;
+ }
+
+/**
+GetDevicePropDesc request handler.
+*/
+void CMTPPbcGetDevicePropDesc::ServiceL()
+ {
+ __FLOG(_L8("ServiceL - Entry"));
+ //Destroy the previous playback command.
+ delete iPbCmd;
+ iPbCmd = NULL;
+
+ //Get the device property code
+ TMTPDevicePropertyCode propCode(static_cast<TMTPDevicePropertyCode>(Request().
+ Uint32(TMTPTypeRequest::ERequestParameter1)));
+
+ TMTPPbCtrlData data;
+ data.iOptCode = EMTPOpCodeGetDevicePropDesc;
+ data.iDevPropCode = propCode;
+
+ //Get a new playback command.
+ CMTPPlaybackMap& map(iPlaybackControlDp.GetPlaybackMap());
+ TInt result = map.GetPlaybackControlCommand(data, &iPbCmd);
+
+ if(KErrNone == result)
+ {
+ MMTPPlaybackControl& control(iPlaybackControlDp.GetPlaybackControlL());
+ TRAPD(err, control.CommandL(*iPbCmd, this));
+ __ASSERT_ALWAYS((err == KErrNone), SendResponseL(EMTPRespCodeParameterNotSupported));
+ }
+ else if(KErrNotSupported == result)
+ {
+ SendResponseL(EMTPRespCodeDevicePropNotSupported);
+ }
+ else
+ {
+ SendResponseL(EMTPRespCodeParameterNotSupported);
+ }
+
+ __FLOG(_L8("ServiceL - Exit"));
+ }
+
+void CMTPPbcGetDevicePropDesc::HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr)
+ {
+ __FLOG(_L8("HandlePlaybackCommandCompleteL - Entry"));
+ __FLOG_1(_L8("aErr %d"), aErr);
+
+ TBool useDefault = EFalse;
+ switch(aErr)
+ {
+ case KPlaybackErrNone:
+ {
+ __ASSERT_DEBUG((aCmd != NULL), Panic(EMTPPBDataNullErr));
+ __ASSERT_DEBUG((aCmd->PlaybackCommand() == iPbCmd->PlaybackCommand()), Panic(EMTPPBArgumentErr));
+ __ASSERT_ALWAYS((aCmd != NULL), User::Leave(KErrArgument));
+ __ASSERT_ALWAYS((aCmd->PlaybackCommand() == iPbCmd->PlaybackCommand()), User::Leave(KErrArgument));
+ __FLOG_1(_L8("aCmd %d"), aCmd->PlaybackCommand());
+ }
+ break;
+ case KPlaybackErrContextInvalid:
+ {
+ useDefault = ETrue;
+ }
+ break;
+ case KPlaybackErrDeviceUnavailable:
+ {
+ iPlaybackControlDp.RequestToResetPbCtrl();
+ SendResponseL(EMTPRespCodeDeviceBusy);
+ }
+ return;
+
+ default:
+ {
+ SendResponseL(EMTPRespCodeDeviceBusy);
+ }
+ return;
+ }
+
+ delete iPropDesc;
+ iPropDesc = NULL;
+
+ CMTPPlaybackProperty& property(iPlaybackControlDp.GetPlaybackProperty());
+ TMTPDevicePropertyCode propCode = static_cast<TMTPDevicePropertyCode>
+ (Request().Uint32(TMTPTypeRequest::ERequestParameter1));
+
+ switch (propCode)
+ {
+ case EMTPDevicePropCodeVolume:
+ {
+ TMTPPbDataVolume volSet(1,0,1,1,1);
+ if(useDefault)
+ {
+ property.GetDefaultVolSet(volSet);
+ }
+ else
+ {
+ volSet = aCmd->ParamL().VolumeSetL();
+ property.SetDefaultVolSetL(volSet);
+ }
+
+ CMTPTypeDevicePropDescRangeForm* form = CMTPTypeDevicePropDescRangeForm::NewLC(EMTPTypeUINT32);
+ form->SetUint32L(CMTPTypeDevicePropDescRangeForm::EMaximumValue, volSet.MaxVolume());
+ form->SetUint32L(CMTPTypeDevicePropDescRangeForm::EMinimumValue, volSet.MinVolume());
+ form->SetUint32L(CMTPTypeDevicePropDescRangeForm::EStepSize, volSet.Step());
+ iPropDesc = CMTPTypeDevicePropDesc::NewL(propCode,
+ CMTPTypeDevicePropDesc::EReadWrite,
+ CMTPTypeDevicePropDesc::ERangeForm,
+ form);
+
+ iPropDesc->SetUint32L(CMTPTypeDevicePropDesc::EFactoryDefaultValue, volSet.DefaultVolume());
+ iPropDesc->SetUint32L(CMTPTypeDevicePropDesc::ECurrentValue, volSet.CurrentVolume());
+ CleanupStack::PopAndDestroy(form);
+ SendDataL(*iPropDesc);
+ }
+ break;
+
+ case EMTPDevicePropCodePlaybackRate:
+ {
+ CMTPTypeDevicePropDescEnumerationForm* form = CMTPTypeDevicePropDescEnumerationForm::
+ NewLC(EMTPTypeINT32);
+ CMTPPlaybackMap& map(iPlaybackControlDp.GetPlaybackMap());
+
+ TInt32 val = map.PlaybackRateL(EPlayStateBackwardSeeking);
+ TMTPTypeInt32 value(val);
+ form->AppendSupportedValueL(value);
+
+ val = map.PlaybackRateL(EPlayStatePaused);
+ value.Set(val);
+ form->AppendSupportedValueL(value);
+
+ val = map.PlaybackRateL(EPlayStatePlaying);
+ value.Set(val);
+ form->AppendSupportedValueL(value);
+
+ val = map.PlaybackRateL(EPlayStateForwardSeeking);
+ value.Set(val);
+ form->AppendSupportedValueL(value);
+
+ iPropDesc = CMTPTypeDevicePropDesc::NewL(propCode,
+ CMTPTypeDevicePropDesc::EReadWrite,
+ CMTPTypeDevicePropDesc::EEnumerationForm,
+ form);
+
+ property.GetDefaultPropertyValueL(propCode, val);
+ iPropDesc->SetInt32L(CMTPTypeDevicePropDesc::EFactoryDefaultValue, val);
+
+ if(!useDefault)
+ {
+ TMTPPlaybackState state = static_cast<TMTPPlaybackState>(aCmd->ParamL().Uint32L());
+ val = map.PlaybackRateL(state);
+ }
+ iPropDesc->SetInt32L(CMTPTypeDevicePropDesc::ECurrentValue, val);
+ CleanupStack::PopAndDestroy(form);
+
+ SendDataL(*iPropDesc);
+ }
+ break;
+
+ case EMTPDevicePropCodePlaybackObject:
+ {
+ iPropDesc = CMTPTypeDevicePropDesc::NewL(propCode);
+ TUint32 val = 0;
+ property.GetDefaultPropertyValueL(propCode, val);
+ iPropDesc->SetUint32L(CMTPTypeDevicePropDesc::EFactoryDefaultValue, val);
+ CMTPPlaybackMap& map(iPlaybackControlDp.GetPlaybackMap());
+ if(!useDefault)
+ {
+ val = map.ObjectHandleL(aCmd->ParamL().SuidSetL().Suid());
+ }
+ iPropDesc->SetUint32L(CMTPTypeDevicePropDesc::ECurrentValue, val);
+ SendDataL(*iPropDesc);
+ }
+ break;
+
+ case EMTPDevicePropCodePlaybackContainerIndex:
+ {
+ iPropDesc = CMTPTypeDevicePropDesc::NewL(propCode);
+ TUint32 val = 0;
+ property.GetDefaultPropertyValueL(propCode, val);
+ iPropDesc->SetUint32L(CMTPTypeDevicePropDesc::EFactoryDefaultValue, val);
+ if(!useDefault)
+ {
+ val = aCmd->ParamL().Uint32L();
+ }
+ iPropDesc->SetUint32L(CMTPTypeDevicePropDesc::ECurrentValue, val);
+ SendDataL(*iPropDesc);
+ }
+ break;
+
+ case EMTPDevicePropCodePlaybackPosition:
+ {
+ iPropDesc = CMTPTypeDevicePropDesc::NewL(propCode);
+ TUint32 val = 0;
+ CMTPPlaybackProperty& property(iPlaybackControlDp.GetPlaybackProperty());
+ property.GetDefaultPropertyValueL(propCode, val);
+ iPropDesc->SetUint32L(CMTPTypeDevicePropDesc::EFactoryDefaultValue, val);
+ if(!useDefault)
+ {
+ val = aCmd->ParamL().Uint32L();
+ }
+ iPropDesc->SetUint32L(CMTPTypeDevicePropDesc::ECurrentValue, val);
+ SendDataL(*iPropDesc);
+ }
+ break;
+
+ default:
+ {
+ User::Leave(KErrArgument);
+ }
+ break;
+ }
+
+ __FLOG(_L8("HandlePlaybackCommandCompleteL - Exit"));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/src/cmtppbcgetdevicepropvalue.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,242 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <mtp/mmtpdataproviderframework.h>
+#include <mtp/mtpprotocolconstants.h>
+#include <mtp/tmtptyperequest.h>
+
+#include "cmtppbcgetdevicepropvalue.h"
+#include "mtpplaybackcontroldpconst.h"
+#include "cmtpplaybackcontroldp.h"
+#include "cmtpplaybackproperty.h"
+#include "cmtpplaybackcommand.h"
+#include "mtpplaybackcontrolpanic.h"
+
+
+// Class constants.
+__FLOG_STMT(_LIT8(KComponent,"GetPlaybackDevicePropValue");)
+
+/**
+Two-phase constructor.
+@param aPlugin The data provider plugin
+@param aFramework The data provider framework
+@param aConnection The connection from which the request comes
+@return a pointer to the created request processor object.
+*/
+MMTPRequestProcessor* CMTPPbcGetDevicePropValue::NewL(MMTPDataProviderFramework& aFramework,
+ MMTPConnection& aConnection,
+ CMTPPlaybackControlDataProvider& aDataProvider)
+ {
+ CMTPPbcGetDevicePropValue* self = new (ELeave) CMTPPbcGetDevicePropValue(aFramework, aConnection, aDataProvider);
+ return self;
+ }
+
+/**
+Destructor.
+*/
+CMTPPbcGetDevicePropValue::~CMTPPbcGetDevicePropValue()
+ {
+ __FLOG(_L8("~CMTPPbcGetDevicePropValue - Entry"));
+ delete iPbCmd;
+ __FLOG(_L8("~CMTPPbcGetDevicePropValue - Exit"));
+ __FLOG_CLOSE;
+ }
+
+/**
+Constructor.
+*/
+CMTPPbcGetDevicePropValue::CMTPPbcGetDevicePropValue(MMTPDataProviderFramework& aFramework,
+ MMTPConnection& aConnection,
+ CMTPPlaybackControlDataProvider& aDataProvider):
+ CMTPRequestProcessor(aFramework, aConnection, 0, NULL),
+ iPlaybackControlDp(aDataProvider)
+ {
+ //Open the log system
+ __FLOG_OPEN(KMTPSubsystem, KComponent);
+ }
+
+/**
+CMTPPbcGetDevicePropValue request validator.
+@return EMTPRespCodeOK if request is verified, otherwise one of the error response codes
+*/
+TMTPResponseCode CMTPPbcGetDevicePropValue::CheckRequestL()
+ {
+ __FLOG(_L8("CheckRequestL - Entry"));
+ TMTPResponseCode respCode = CMTPRequestProcessor::CheckRequestL();
+ if(respCode == EMTPRespCodeOK)
+ {
+ respCode = EMTPRespCodeDevicePropNotSupported;
+ TUint32 propCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
+ const TInt count = sizeof(KMTPPlaybackControlDpSupportedProperties) /
+ sizeof(KMTPPlaybackControlDpSupportedProperties[0]);
+ for (TUint i(0); (i < count); i++)
+ {
+ if (propCode == KMTPPlaybackControlDpSupportedProperties[i])
+ {
+ respCode = EMTPRespCodeOK;
+ break;
+ }
+ }
+ }
+ __FLOG(_L8("CheckRequestL - Exit"));
+ return respCode;
+ }
+
+/**
+CMTPPbcGetDevicePropValue request handler.
+*/
+void CMTPPbcGetDevicePropValue::ServiceL()
+ {
+ __FLOG(_L8("ServiceL - Entry"));
+ //Destroy the previous playback command.
+ delete iPbCmd;
+ iPbCmd = NULL;
+
+ //Get the device property code
+ TMTPDevicePropertyCode propCode(static_cast<TMTPDevicePropertyCode>(Request().
+ Uint32(TMTPTypeRequest::ERequestParameter1)));
+
+ TMTPPbCtrlData data;
+ data.iOptCode = EMTPOpCodeGetDevicePropValue;
+ data.iDevPropCode = propCode;
+
+ //Get a new playback command.
+ CMTPPlaybackMap& map(iPlaybackControlDp.GetPlaybackMap());
+ TInt result = map.GetPlaybackControlCommand(data, &iPbCmd);
+
+ if(KErrNone == result)
+ {
+ MMTPPlaybackControl& control(iPlaybackControlDp.GetPlaybackControlL());
+ TRAPD(err, control.CommandL(*iPbCmd, this));
+ __ASSERT_ALWAYS((err == KErrNone), SendResponseL(EMTPRespCodeParameterNotSupported));
+ }
+ else if(KErrNotSupported == result)
+ {
+ SendResponseL(EMTPRespCodeDevicePropNotSupported);
+ }
+ else
+ {
+ SendResponseL(EMTPRespCodeParameterNotSupported);
+ }
+ __FLOG(_L8("ServiceL - Exit"));
+ }
+
+void CMTPPbcGetDevicePropValue::HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr)
+ {
+ __FLOG(_L8("HandlePlaybackCommandCompleteL - Entry"));
+ __FLOG_1(_L8("aErr %d"), aErr);
+
+ //Handle the error
+ TBool useDefault = EFalse;
+ switch(aErr)
+ {
+ case KPlaybackErrNone:
+ {
+ __ASSERT_DEBUG((aCmd != NULL), Panic(EMTPPBDataNullErr));
+ __ASSERT_DEBUG((aCmd->PlaybackCommand() == iPbCmd->PlaybackCommand()), Panic(EMTPPBArgumentErr));
+ __ASSERT_ALWAYS((aCmd != NULL), User::Leave(KErrArgument));
+ __ASSERT_ALWAYS((aCmd->PlaybackCommand() == iPbCmd->PlaybackCommand()), User::Leave(KErrArgument));
+ __FLOG_1(_L8("aCmd %d"), aCmd->PlaybackCommand());
+ }
+ break;
+ case KPlaybackErrContextInvalid:
+ {
+ useDefault = ETrue;
+ }
+ break;
+ case KPlaybackErrDeviceUnavailable:
+ {
+ iPlaybackControlDp.RequestToResetPbCtrl();
+ SendResponseL(EMTPRespCodeDeviceBusy);
+ }
+ return;
+ default:
+ {
+ SendResponseL(EMTPRespCodeDeviceBusy);
+ }
+ return;
+ }
+
+ CMTPPlaybackProperty& property(iPlaybackControlDp.GetPlaybackProperty());
+ TMTPDevicePropertyCode propCode(static_cast<TMTPDevicePropertyCode>
+ (Request().Uint32(TMTPTypeRequest::ERequestParameter1)));
+
+ switch(propCode)
+ {
+ case EMTPDevicePropCodePlaybackRate:
+ {
+ CMTPPlaybackMap& map(iPlaybackControlDp.GetPlaybackMap());
+ TInt32 val;
+ if(useDefault)
+ {
+ property.GetDefaultPropertyValueL(propCode, val);
+ }
+ else
+ {
+ TMTPPlaybackState state = static_cast<TMTPPlaybackState>(aCmd->ParamL().Uint32L());
+ val = map.PlaybackRateL(state);
+ }
+ iInt32.Set(val);
+ SendDataL(iInt32);
+ }
+ break;
+
+ case EMTPDevicePropCodePlaybackObject:
+ {
+ CMTPPlaybackMap& map(iPlaybackControlDp.GetPlaybackMap());
+ TUint32 val;
+ if(useDefault)
+ {
+ property.GetDefaultPropertyValueL(propCode, val);
+ }
+ else
+ {
+ val = map.ObjectHandleL(aCmd->ParamL().SuidSetL().Suid());
+ }
+ iUint32.Set(val);
+ SendDataL(iUint32);
+ }
+ break;
+
+ case EMTPDevicePropCodeVolume:
+ case EMTPDevicePropCodePlaybackContainerIndex:
+ case EMTPDevicePropCodePlaybackPosition:
+ {
+ TUint32 val;
+ if(useDefault)
+ {
+ property.GetDefaultPropertyValueL(propCode, val);
+ }
+ else
+ {
+ val = aCmd->ParamL().Uint32L();
+ }
+ iUint32.Set(val);
+ SendDataL(iUint32);
+ }
+ break;
+
+ default:
+ SendResponseL(EMTPRespCodeDevicePropNotSupported);
+ break;
+ }
+ __FLOG(_L8("HandlePlaybackCommandCompleteL - Exit"));
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/src/cmtppbcresetdevicepropvalue.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,177 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include "cmtppbcresetdevicepropvalue.h"
+#include "mtpplaybackcontroldpconst.h"
+#include "cmtpplaybackcontroldp.h"
+#include "cmtpplaybackproperty.h"
+#include "cmtpplaybackcommand.h"
+#include "mtpplaybackcontrolpanic.h"
+
+// Class constants.
+__FLOG_STMT(_LIT8(KComponent,"ResetPlaybackDevicePropValue");)
+
+/**
+Two-phase constructor.
+@param aPlugin The data provider plugin
+@param aFramework The data provider framework
+@param aConnection The connection from which the request comes
+@return a pointer to the created request processor object.
+*/
+MMTPRequestProcessor* CMTPPbcResetDevicePropValue::NewL(MMTPDataProviderFramework& aFramework,
+ MMTPConnection& aConnection,
+ CMTPPlaybackControlDataProvider& aDataProvider)
+ {
+ CMTPPbcResetDevicePropValue* self = new (ELeave) CMTPPbcResetDevicePropValue(aFramework, aConnection, aDataProvider);
+ return self;
+ }
+
+/**
+Destructor
+*/
+CMTPPbcResetDevicePropValue::~CMTPPbcResetDevicePropValue()
+ {
+ __FLOG(_L8("~CMTPPbcResetDevicePropValue - Entry"));
+ delete iPbCmd;
+ __FLOG(_L8("~CMTPPbcResetDevicePropValue - Exit"));
+ __FLOG_CLOSE;
+ }
+
+/**
+Standard c++ constructor
+*/
+CMTPPbcResetDevicePropValue::CMTPPbcResetDevicePropValue(MMTPDataProviderFramework& aFramework,
+ MMTPConnection& aConnection,
+ CMTPPlaybackControlDataProvider& aDataProvider):
+ CMTPRequestProcessor(aFramework, aConnection, 0, NULL),
+ iPlaybackControlDp(aDataProvider)
+ {
+ //Open the log system
+ __FLOG_OPEN(KMTPSubsystem, KComponent);
+ }
+
+/**
+SetDevicePropValue request validator.
+@return EMTPRespCodeOK if request is verified, otherwise one of the error response codes
+*/
+TMTPResponseCode CMTPPbcResetDevicePropValue::CheckRequestL()
+ {
+ __FLOG(_L8("CheckRequestL - Entry"));
+ TMTPResponseCode respCode = CMTPRequestProcessor::CheckRequestL();
+ if(respCode == EMTPRespCodeOK)
+ {
+ respCode = EMTPRespCodeDevicePropNotSupported;
+ TUint32 propCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
+ const TInt count = sizeof(KMTPPlaybackControlDpSupportedProperties) / sizeof(KMTPPlaybackControlDpSupportedProperties[0]);
+ for (TUint i(0); (i < count); i++)
+ {
+ if (propCode == KMTPPlaybackControlDpSupportedProperties[i])
+ {
+ respCode = EMTPRespCodeOK;
+ break;
+ }
+ }
+ }
+
+ __FLOG(_L8("CheckRequestL - Exit"));
+ return respCode;
+ }
+/**
+ResetDevicePropValue request handler.
+*/
+void CMTPPbcResetDevicePropValue::ServiceL()
+ {
+ __FLOG(_L8("ServiceL - Entry"));
+
+ CMTPPlaybackMap& map(iPlaybackControlDp.GetPlaybackMap());
+ //Destroy the previous playback command.
+ delete iPbCmd;
+ iPbCmd = NULL;
+
+ //Get a new playback command.
+ iData.iOptCode = EMTPOpCodeResetDevicePropValue;
+ TMTPDevicePropertyCode propCode(static_cast<TMTPDevicePropertyCode>(Request().
+ Uint32(TMTPTypeRequest::ERequestParameter1)));
+ iData.iDevPropCode = propCode;
+ CMTPPlaybackProperty& property(iPlaybackControlDp.GetPlaybackProperty());
+ property.GetDefaultPropertyValueL(iData);
+
+ TInt result = map.GetPlaybackControlCommand(iData, &iPbCmd);
+
+ if(KErrNone == result)
+ {
+ MMTPPlaybackControl& control(iPlaybackControlDp.GetPlaybackControlL());
+ TRAPD(err, control.CommandL(*iPbCmd, this));
+ __ASSERT_ALWAYS((err == KErrNone), SendResponseL(EMTPRespCodeParameterNotSupported));
+ }
+ else if(KErrNotSupported == result)
+ {
+ SendResponseL(EMTPRespCodeDevicePropNotSupported);
+ }
+ else
+ {
+ SendResponseL(EMTPRespCodeParameterNotSupported);
+ }
+
+ __FLOG(_L8("ServiceL - Exit"));
+ }
+
+void CMTPPbcResetDevicePropValue::HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr)
+ {
+ __FLOG(_L8("HandlePlaybackCommandCompleteL - Entry"));
+ __FLOG_1(_L8("aErr %d"), aErr);
+
+ //Handle error response.
+ TMTPResponseCode response;
+ switch(aErr)
+ {
+ case KPlaybackErrNone:
+ {
+ response = EMTPRespCodeOK;
+ }
+ break;
+ case KPlaybackErrDeviceUnavailable:
+ {
+ response = EMTPRespCodeDeviceBusy;
+ iPlaybackControlDp.RequestToResetPbCtrl();
+ }
+ break;
+ case KPlaybackErrContextInvalid:
+ {
+ response = EMTPRespCodeAccessDenied;
+ }
+ break;
+ default:
+ {
+ response = EMTPRespCodeDeviceBusy;
+ }
+ break;
+ }
+
+ SendResponseL(response);
+
+ if(aCmd != NULL)
+ {
+ __ASSERT_DEBUG((aCmd->PlaybackCommand() == iPbCmd->PlaybackCommand()), Panic(EMTPPBArgumentErr));
+ __FLOG_1(_L8("aCmd %d"), aCmd->PlaybackCommand());
+ }
+
+ __FLOG(_L8("HandlePlaybackCommandCompleteL - Exit"));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/src/cmtppbcsetdevicepropvalue.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,220 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <mtp/mmtpdataproviderframework.h>
+#include <mtp/mtpprotocolconstants.h>
+
+#include "cmtppbcsetdevicepropvalue.h"
+#include "mtpplaybackcontroldpconst.h"
+#include "cmtpplaybackcontroldp.h"
+#include "cmtpplaybackproperty.h"
+#include "cmtpplaybackcommand.h"
+#include "mtpplaybackcontrolpanic.h"
+
+// Class constants.
+__FLOG_STMT(_LIT8(KComponent,"SetPlaybackDevicePropValue");)
+
+/**
+Two-phase constructor.
+@param aPlugin The data provider plugin
+@param aFramework The data provider framework
+@param aConnection The connection from which the request comes
+@return a pointer to the created request processor object.
+*/
+MMTPRequestProcessor* CMTPPbcSetDevicePropValue::NewL(MMTPDataProviderFramework& aFramework,
+ MMTPConnection& aConnection,
+ CMTPPlaybackControlDataProvider& aDataProvider)
+ {
+ CMTPPbcSetDevicePropValue* self = new (ELeave) CMTPPbcSetDevicePropValue(aFramework, aConnection, aDataProvider);
+ return self;
+ }
+
+/**
+Destructor
+*/
+CMTPPbcSetDevicePropValue::~CMTPPbcSetDevicePropValue()
+ {
+ __FLOG(_L8("~CMTPPbcSetDevicePropValue - Entry"));
+ delete iPbCmd;
+ __FLOG(_L8("~CMTPPbcSetDevicePropValue - Exit"));
+ __FLOG_CLOSE;
+ }
+
+/**
+Standard c++ constructor
+*/
+CMTPPbcSetDevicePropValue::CMTPPbcSetDevicePropValue(MMTPDataProviderFramework& aFramework,
+ MMTPConnection& aConnection,
+ CMTPPlaybackControlDataProvider& aDataProvider):
+ CMTPRequestProcessor(aFramework, aConnection, 0, NULL),
+ iPlaybackControlDp(aDataProvider)
+ {
+ //Open the log system
+ __FLOG_OPEN(KMTPSubsystem, KComponent);
+ }
+
+/**
+CMTPPbcSetDevicePropValue request validator.
+@return EMTPRespCodeOK if request is verified, otherwise one of the error response codes
+*/
+TMTPResponseCode CMTPPbcSetDevicePropValue::CheckRequestL()
+ {
+ __FLOG(_L8("CheckRequestL - Entry"));
+ TMTPResponseCode respCode = CMTPRequestProcessor::CheckRequestL();
+ if(respCode == EMTPRespCodeOK)
+ {
+ respCode = EMTPRespCodeDevicePropNotSupported;
+ TUint32 propCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
+ const TInt count = sizeof(KMTPPlaybackControlDpSupportedProperties) / sizeof(KMTPPlaybackControlDpSupportedProperties[0]);
+ for (TUint i(0); (i < count); i++)
+ {
+ if (propCode == KMTPPlaybackControlDpSupportedProperties[i])
+ {
+ respCode = EMTPRespCodeOK;
+ break;
+ }
+ }
+ }
+
+ __FLOG(_L8("CheckRequestL - Exit"));
+ return respCode;
+ }
+
+/**
+Process the transaction response phase.
+*/
+TBool CMTPPbcSetDevicePropValue::DoHandleResponsePhaseL()
+ {
+ __FLOG(_L8("DoHandleResponsePhaseL - Entry"));
+
+ CMTPPlaybackMap& map(iPlaybackControlDp.GetPlaybackMap());
+ //Destroy the previous playback command.
+ delete iPbCmd;
+ iPbCmd = NULL;
+
+ //Get a new playback command.
+ TInt result = map.GetPlaybackControlCommand(iData, &iPbCmd);
+
+ if(KErrNone == result)
+ {
+ MMTPPlaybackControl& control(iPlaybackControlDp.GetPlaybackControlL());
+ TRAPD(err, control.CommandL(*iPbCmd, this));
+ __ASSERT_ALWAYS((err == KErrNone), SendResponseL(EMTPRespCodeInvalidDevicePropValue));
+ }
+ else if(KErrNotSupported == result)
+ {
+ SendResponseL(EMTPRespCodeDevicePropNotSupported);
+ }
+ else
+ {
+ SendResponseL(EMTPRespCodeInvalidDevicePropValue);
+ }
+
+ __FLOG(_L8("DoHandleResponsePhaseL - Exit"));
+ return EFalse;
+ }
+
+void CMTPPbcSetDevicePropValue::ServiceL()
+ {
+ __FLOG(_L8("ServiceL - Entry"));
+ TMTPDevicePropertyCode propCode(static_cast<TMTPDevicePropertyCode>(Request().
+ Uint32(TMTPTypeRequest::ERequestParameter1)));
+ iData.iOptCode = EMTPOpCodeSetDevicePropValue;
+ iData.iDevPropCode = propCode;
+ switch(propCode)
+ {
+ case EMTPDevicePropCodePlaybackRate:
+ {
+ ReceiveDataL(iData.iPropValInt32);
+ }
+ break;
+ case EMTPDevicePropCodeVolume:
+ case EMTPDevicePropCodePlaybackObject:
+ case EMTPDevicePropCodePlaybackContainerIndex:
+ case EMTPDevicePropCodePlaybackPosition:
+ {
+ ReceiveDataL(iData.iPropValUint32);
+ }
+ break;
+
+ default:
+ {
+ SendResponseL(EMTPRespCodeDevicePropNotSupported);
+ }
+ break;
+ }
+ __FLOG(_L8("ServiceL - Exit"));
+ }
+
+void CMTPPbcSetDevicePropValue::HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr)
+ {
+ __FLOG(_L8("HandlePlaybackCommandCompleteL - Entry"));
+ __FLOG_1(_L8("aErr %d"), aErr);
+
+ //Handle error response.
+ TMTPResponseCode response;
+ switch(aErr)
+ {
+ case KPlaybackErrNone:
+ {
+ response = EMTPRespCodeOK;
+ }
+ break;
+ case KPlaybackErrDeviceUnavailable:
+ {
+ response = EMTPRespCodeDeviceBusy;
+ iPlaybackControlDp.RequestToResetPbCtrl();
+ }
+ break;
+ case KPlaybackErrContextInvalid:
+ {
+ CMTPPlaybackProperty& prop(iPlaybackControlDp.GetPlaybackProperty());
+ if(prop.IsDefaultPropertyValueL(iData))
+ {
+ response = EMTPRespCodeOK;
+ }
+ else
+ {
+ response = EMTPRespCodeAccessDenied;
+ }
+ }
+ break;
+ case KPlaybackErrParamInvalid:
+ {
+ response = EMTPRespCodeInvalidDevicePropValue;
+ }
+ break;
+ default:
+ {
+ response = EMTPRespCodeDeviceBusy;
+ }
+ break;
+ }
+
+ SendResponseL(response);
+
+ if(aCmd != NULL)
+ {
+ __ASSERT_DEBUG((aCmd->PlaybackCommand() == iPbCmd->PlaybackCommand()), Panic(EMTPPBArgumentErr));
+ __FLOG_1(_L8("aCmd %d"), aCmd->PlaybackCommand());
+ }
+
+ __FLOG(_L8("HandlePlaybackCommandCompleteL - Exit"));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/src/cmtppbcskip.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,164 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <mtp/mmtpdataproviderframework.h>
+#include <mtp/mtpprotocolconstants.h>
+#include <mtp/tmtptyperequest.h>
+
+#include "cmtppbcskip.h"
+#include "mtpplaybackcontroldpconst.h"
+#include "cmtpplaybackmap.h"
+#include "cmtpplaybackcontroldp.h"
+#include "cmtpplaybackproperty.h"
+#include "cmtpplaybackcommand.h"
+#include "mtpplaybackcontrolpanic.h"
+
+
+// Class constants.
+__FLOG_STMT(_LIT8(KComponent,"Skip");)
+
+/**
+Two-phase constructor.
+@param aPlugin The data provider plugin
+@param aFramework The data provider framework
+@param aConnection The connection from which the request comes
+@return a pointer to the created request processor object.
+*/
+MMTPRequestProcessor* CMTPPbcSkip::NewL(MMTPDataProviderFramework& aFramework,
+ MMTPConnection& aConnection,
+ CMTPPlaybackControlDataProvider& aDataProvider)
+ {
+ CMTPPbcSkip* self = new (ELeave) CMTPPbcSkip(aFramework, aConnection, aDataProvider);
+ return self;
+ }
+
+/**
+Destructor.
+*/
+CMTPPbcSkip::~CMTPPbcSkip()
+ {
+ __FLOG(_L8("CMTPPbcSkip - Entry"));
+ delete iPbCmd;
+ __FLOG(_L8("CMTPPbcSkip - Exit"));
+ __FLOG_CLOSE;
+ }
+
+/**
+Constructor.
+*/
+CMTPPbcSkip::CMTPPbcSkip(MMTPDataProviderFramework& aFramework,
+ MMTPConnection& aConnection,
+ CMTPPlaybackControlDataProvider& aDataProvider):
+ CMTPRequestProcessor(aFramework, aConnection, 0, NULL),
+ iPlaybackControlDp(aDataProvider)
+ {
+ //Open the log system
+ __FLOG_OPEN(KMTPSubsystem, KComponent);
+ }
+
+/**
+CheckRequestL
+*/
+TMTPResponseCode CMTPPbcSkip::CheckRequestL()
+ {
+ __FLOG(_L8("CheckRequestL - Entry"));
+ TMTPResponseCode respCode = CMTPRequestProcessor::CheckRequestL();
+ if(respCode == EMTPRespCodeOK)
+ {
+ respCode = EMTPRespCodeInvalidParameter;
+ TUint32 step = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
+ if(step != 0)
+ {
+ respCode = EMTPRespCodeOK;
+ }
+ }
+ __FLOG(_L8("CheckRequestL - Exit"));
+ return respCode;
+ }
+
+/**
+CMTPPbcSkip request handler.
+*/
+void CMTPPbcSkip::ServiceL()
+ {
+ __FLOG(_L8("ServiceL - Entry"));
+ CMTPPlaybackMap& map(iPlaybackControlDp.GetPlaybackMap());
+ MMTPPlaybackControl& control(iPlaybackControlDp.GetPlaybackControlL());
+
+ TMTPPbCtrlData data;
+ data.iOptCode = EMTPOpCodeSkip;
+ data.iPropValInt32 = static_cast<TInt32>(Request().Uint32(TMTPTypeRequest::ERequestParameter1));
+
+ TInt result = map.GetPlaybackControlCommand(data, &iPbCmd);
+
+ if(KErrNone == result)
+ {
+ TRAPD(err, control.CommandL(*iPbCmd, this));
+ __ASSERT_ALWAYS((err == KErrNone), SendResponseL(EMTPRespCodeInvalidParameter));
+ }
+ else
+ {
+ SendResponseL(EMTPRespCodeInvalidParameter);
+ }
+ __FLOG(_L8("ServiceL - Exit"));
+ }
+
+void CMTPPbcSkip::HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr)
+ {
+ __FLOG(_L8("HandlePlaybackCommandCompleteL - Entry"));
+ __FLOG_1(_L8("aErr %d"), aErr);
+
+ //Handle error response.
+ TMTPResponseCode response;
+ switch(aErr)
+ {
+ case KPlaybackErrNone:
+ {
+ response = EMTPRespCodeOK;
+ }
+ break;
+ case KPlaybackErrDeviceBusy:
+ {
+ response = EMTPRespCodeDeviceBusy;
+ }
+ break;
+ case KPlaybackErrDeviceUnavailable:
+ {
+ response = EMTPRespCodeDeviceBusy;
+ iPlaybackControlDp.RequestToResetPbCtrl();
+ }
+ break;
+ default:
+ {
+ response = EMTPRespCodeInvalidParameter;
+ }
+ break;
+ }
+
+ SendResponseL(response);
+
+ if(aCmd != NULL)
+ {
+ __ASSERT_DEBUG((aCmd->PlaybackCommand() == iPbCmd->PlaybackCommand()), Panic(EMTPPBArgumentErr));
+ __FLOG_1(_L8("aCmd %d"), aCmd->PlaybackCommand());
+ }
+
+ __FLOG(_L8("HandlePlaybackCommandCompleteL - Exit"));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/src/cmtpplaybackcontroldp.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,392 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <mtp/mmtpconnection.h>
+#include <mtp/mmtpdataproviderframework.h>
+#include <mtp/mtpdataproviderapitypes.h>
+
+#include "cmtpplaybackcontroldp.h"
+#include "cmtprequestprocessor.h"
+#include "mtpplaybackcontroldpprocessor.h"
+#include "cmtpplaybackmap.h"
+#include "cmtpplaybackproperty.h"
+#include "mmtpplaybackinterface.h"
+#include "cmtpplaybackevent.h"
+#include "mtpplaybackcontrolpanic.h"
+
+
+// Class constants.
+__FLOG_STMT(_LIT8(KComponent,"PlaybackControlDataProvider");)
+static const TInt KMTPPlaybackControlDpSessionGranularity(3);
+
+/**
+MTP playback control data provider plug-in factory method.
+@return A pointer to an MTP playback control data provider plug-in. Ownership IS
+transfered.
+@leave One of the system wide error codes, if a processing failure occurs.
+*/
+TAny* CMTPPlaybackControlDataProvider::NewL(TAny* aParams)
+ {
+ CMTPPlaybackControlDataProvider* self = new (ELeave) CMTPPlaybackControlDataProvider(aParams);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+/**
+Destructor
+*/
+CMTPPlaybackControlDataProvider::~CMTPPlaybackControlDataProvider()
+ {
+ __FLOG(_L8("~CMTPPlaybackControlDataProvider - Entry"));
+ TInt count = iActiveProcessors.Count();
+ while(count--)
+ {
+ iActiveProcessors[count]->Release();
+ }
+ iActiveProcessors.Close();
+ delete iPlaybackMap;
+ delete iPlaybackProperty;
+ if(iPlaybackControl)
+ {
+ iPlaybackControl->Close();
+ }
+ __FLOG(_L8("~CMTPPlaybackControlDataProvider - Exit"));
+ __FLOG_CLOSE;
+ }
+
+void CMTPPlaybackControlDataProvider::Cancel()
+ {
+
+ }
+
+void CMTPPlaybackControlDataProvider::ProcessEventL(const TMTPTypeEvent& /*aEvent*/, MMTPConnection& /*aConnection*/)
+ {
+ __FLOG(_L8("ProcessEventL - Entry"));
+ __FLOG(_L8("ProcessEventL - Exit"));
+ }
+
+void CMTPPlaybackControlDataProvider::ProcessNotificationL(TMTPNotification aNotification, const TAny* aParams)
+ {
+ __FLOG(_L8("ProcessNotificationL - Entry"));
+ switch (aNotification)
+ {
+ case EMTPSessionClosed:
+ SessionClosedL(*reinterpret_cast<const TMTPNotificationParamsSessionChange*>(aParams));
+ break;
+
+ case EMTPSessionOpened:
+ SessionOpenedL(*reinterpret_cast<const TMTPNotificationParamsSessionChange*>(aParams));
+ break;
+ default:
+ // Ignore all other notifications.
+ break;
+ }
+ __FLOG(_L8("ProcessNotificationL - Exit"));
+ }
+
+void CMTPPlaybackControlDataProvider::ProcessRequestPhaseL(TMTPTransactionPhase aPhase, const TMTPTypeRequest& aRequest, MMTPConnection& aConnection)
+ {
+ __FLOG(_L8("ProcessRequestPhaseL - Entry"));
+ TInt index = LocateRequestProcessorL(aRequest, aConnection);
+ __ASSERT_DEBUG(index != KErrNotFound, Panic(EMTPPBArgumentErr));
+ MMTPRequestProcessor* processor = iActiveProcessors[index];
+ iActiveProcessor = index;
+ iActiveProcessorRemoved = EFalse;
+ TBool result = processor->HandleRequestL(aRequest, aPhase);
+ if (iActiveProcessorRemoved)
+ {
+ processor->Release(); // destroy the processor
+ }
+ else if (result)
+ {
+ processor->Release();
+ iActiveProcessors.Remove(index);
+ }
+ iActiveProcessor = -1;
+ __FLOG(_L8("ProcessRequestPhaseL - Exit"));
+ }
+
+void CMTPPlaybackControlDataProvider::Supported(TMTPSupportCategory aCategory, RArray<TUint>& aArray) const
+ {
+ __FLOG(_L8("Supported - Entry"));
+
+ switch (aCategory)
+ {
+ case EDeviceProperties:
+ {
+ TInt count = sizeof(KMTPPlaybackControlDpSupportedProperties) / sizeof(KMTPPlaybackControlDpSupportedProperties[0]);
+ for(TInt i = 0; i < count; i++)
+ {
+ aArray.Append(KMTPPlaybackControlDpSupportedProperties[i]);
+ }
+ }
+ break;
+
+ case EOperations:
+ {
+ TInt count = sizeof(KMTPPlaybackControlDpSupportedOperations) / sizeof(KMTPPlaybackControlDpSupportedOperations[0]);
+ for(TInt i = 0; i < count; i++)
+ {
+ aArray.Append(KMTPPlaybackControlDpSupportedOperations[i]);
+ }
+ }
+ break;
+
+ case EEvents:
+ {
+ TInt count = sizeof(KMTPPlaybackControlDpSupportedEvents) / sizeof(KMTPPlaybackControlDpSupportedEvents[0]);
+ for(TInt i = 0; i < count; i++)
+ {
+ aArray.Append(KMTPPlaybackControlDpSupportedEvents[i]);
+ }
+ }
+ break;
+
+ default:
+ // Unrecognised category, leave aArray unmodified.
+ break;
+ }
+ __FLOG(_L8("Supported - Exit"));
+ }
+
+/**
+Constructor.
+*/
+CMTPPlaybackControlDataProvider::CMTPPlaybackControlDataProvider(TAny* aParams) :
+ CMTPDataProviderPlugin(aParams),
+ iActiveProcessors(KMTPPlaybackControlDpSessionGranularity),
+ iActiveProcessor(-1),
+ iRequestToResetPbCtrl(EFalse)
+ {
+
+ }
+
+/**
+Second phase constructor.
+*/
+void CMTPPlaybackControlDataProvider::ConstructL()
+ {
+ __FLOG_OPEN(KMTPSubsystem, KComponent);
+ __FLOG(_L8("ConstructL - Entry"));
+ iPlaybackProperty = CMTPPlaybackProperty::NewL();
+ iPlaybackMap = CMTPPlaybackMap::NewL(Framework(),*iPlaybackProperty);
+ __FLOG(_L8("ConstructL - Exit"));
+ }
+
+void CMTPPlaybackControlDataProvider::SendEventL(TMTPDevicePropertyCode aPropCode)
+ {
+ __FLOG(_L8("SendEventL - Entry"));
+ iEvent.Reset();
+ iEvent.SetUint16(TMTPTypeEvent::EEventCode, EMTPEventCodeDevicePropChanged );
+ iEvent.SetUint32(TMTPTypeEvent::EEventSessionID, KMTPSessionAll);
+ iEvent.SetUint32(TMTPTypeEvent::EEventTransactionID, KMTPTransactionIdNone);
+ iEvent.SetUint32(TMTPTypeEvent::EEventParameter1, aPropCode);
+ Framework().SendEventL(iEvent);
+ __FLOG(_L8("SendEventL - Exit"));
+ }
+
+/**
+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 CMTPPlaybackControlDataProvider::LocateRequestProcessorL(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection)
+ {
+ __FLOG(_L8("LocateRequestProcessorL - Entry"));
+ 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)
+ {
+ MMTPRequestProcessor* processor = MTPPlaybackControlDpProcessor::CreateL(Framework(), aRequest, aConnection, *this);
+ __ASSERT_DEBUG(processor, Panic(EMTPPBArgumentErr));
+ CleanupReleasePushL(*processor);
+ iActiveProcessors.AppendL(processor);
+ CleanupStack::Pop();
+ index = count;
+ }
+
+ __FLOG(_L8("LocateRequestProcessorL - Exit"));
+ return index;
+ }
+
+/**
+Cleans up outstanding request processors when a session is closed.
+@param aSession notification parameter block
+*/
+void CMTPPlaybackControlDataProvider::SessionClosedL(const TMTPNotificationParamsSessionChange& aSession)
+ {
+ __FLOG(_L8("SessionClosedL - Entry"));
+ TInt count = iActiveProcessors.Count();
+ while (count--)
+ {
+ MMTPRequestProcessor* processor = iActiveProcessors[count];
+ TUint32 sessionId(processor->SessionId());
+ if ((sessionId == aSession.iMTPId) && (processor->Connection().ConnectionId() == aSession.iConnection.ConnectionId()))
+ {
+ iActiveProcessors.Remove(count);
+ if (count == iActiveProcessor)
+ {
+ iActiveProcessorRemoved = ETrue;
+ }
+ else
+ {
+ processor->Release();
+ }
+ }
+ }
+
+ if(iPlaybackControl)
+ {
+ iPlaybackControl->Close();
+ iPlaybackControl = NULL;
+ }
+
+ __FLOG(_L8("SessionClosedL - Exit"));
+ }
+
+/**
+Prepares for a newly-opened session.
+@param aSession notification parameter block
+*/
+#ifdef __FLOG_ACTIVE
+void CMTPPlaybackControlDataProvider::SessionOpenedL(const TMTPNotificationParamsSessionChange& aSession)
+#else
+void CMTPPlaybackControlDataProvider::SessionOpenedL(const TMTPNotificationParamsSessionChange& /*aSession*/)
+#endif
+ {
+ __FLOG(_L8("SessionOpenedL - Entry"));
+ __FLOG_VA((_L8("SessionID = %d"), aSession.iMTPId));
+ __FLOG(_L8("SessionOpenedL - Exit"));
+ }
+
+void CMTPPlaybackControlDataProvider::StartObjectEnumerationL(TUint32 aStorageId, TBool /*aPersistentFullEnumeration*/)
+ {
+ __FLOG(_L8("StartObjectEnumerationL - Entry"));
+ //This DP doesn't manage data.
+ Framework().ObjectEnumerationCompleteL(aStorageId);
+ __FLOG(_L8("StartObjectEnumerationL - Exit"));
+ }
+
+void CMTPPlaybackControlDataProvider::StartStorageEnumerationL()
+ {
+ __FLOG(_L8("StartStorageEnumerationL - Entry"));
+ //This DP doesn't manage data.
+ Framework().StorageEnumerationCompleteL();
+ __FLOG(_L8("StartStorageEnumerationL - Exit"));
+ }
+
+void CMTPPlaybackControlDataProvider::HandlePlaybackEventL(CMTPPlaybackEvent* aEvent, TInt aErr)
+ {
+ __FLOG(_L8("HandlePlaybackEventL - Entry"));
+
+ if(aErr != KPlaybackErrNone)
+ {
+ if(aErr == KPlaybackErrDeviceUnavailable )
+ {
+ iRequestToResetPbCtrl = ETrue;
+ //Report error to initiator, .
+ SendEventL(EMTPDevicePropCodePlaybackObject);
+ SendEventL(EMTPDevicePropCodePlaybackRate);
+ SendEventL(EMTPDevicePropCodePlaybackContainerIndex);
+ SendEventL(EMTPDevicePropCodePlaybackPosition);
+ }
+ return;
+ }
+
+ __ASSERT_DEBUG((aEvent != NULL), Panic(EMTPPBDataNullErr));
+ __ASSERT_ALWAYS((aEvent != NULL), User::Leave(KErrArgument));
+ __FLOG_1(_L8("aEvent %d"), aEvent->PlaybackEvent());
+
+ switch(aEvent->PlaybackEvent())
+ {
+ case EPlaybackEventVolumeUpdate:
+ {
+ SendEventL(EMTPDevicePropCodeVolume);
+ }
+ break;
+ case EPlaybackEventStateUpdate:
+ {
+ SendEventL(EMTPDevicePropCodePlaybackRate);
+ }
+ break;
+ case EPlaybackEventObjectUpdate:
+ {
+ SendEventL(EMTPDevicePropCodePlaybackObject);
+ }
+ break;
+ case EPlaybackEventObjectIndexUpdate:
+ {
+ SendEventL(EMTPDevicePropCodePlaybackContainerIndex);
+ }
+ break;
+
+ default:
+ User::Leave(KErrArgument);
+ break;
+ }
+
+ __FLOG(_L8("HandlePlaybackEventL - Exit"));
+ }
+
+CMTPPlaybackMap& CMTPPlaybackControlDataProvider::GetPlaybackMap() const
+ {
+ __ASSERT_DEBUG((iPlaybackMap != NULL), Panic(EMTPPBDataNullErr));
+ return *iPlaybackMap;
+ }
+
+CMTPPlaybackProperty& CMTPPlaybackControlDataProvider::GetPlaybackProperty() const
+ {
+ __ASSERT_DEBUG((iPlaybackProperty != NULL), Panic(EMTPPBDataNullErr));
+ return *iPlaybackProperty;
+ }
+
+MMTPPlaybackControl& CMTPPlaybackControlDataProvider::GetPlaybackControlL()
+ {
+ __FLOG(_L8("GetPlaybackControlL - Entry"));
+ if(iPlaybackControl == NULL)
+ {
+ iPlaybackControl = MMTPPlaybackControl::NewL(*this);
+ }
+ else if(iRequestToResetPbCtrl)
+ {
+ iRequestToResetPbCtrl = EFalse;
+ iPlaybackControl->Close();
+ iPlaybackControl = NULL;
+ iPlaybackControl = MMTPPlaybackControl::NewL(*this);
+ }
+ __FLOG(_L8("GetPlaybackControlL - Exit"));
+ return *iPlaybackControl;
+ }
+
+void CMTPPlaybackControlDataProvider::RequestToResetPbCtrl()
+ {
+ iRequestToResetPbCtrl = ETrue;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/src/cmtpplaybackmap.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,378 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <mtp/cmtpobjectmetadata.h>
+#include <mtp/mmtpdataproviderframework.h>
+#include <mtp/mmtpobjectmgr.h>
+
+#include "cmtpplaybackmap.h"
+#include "cmtpplaybackcommand.h"
+#include "cmtpplaybackcontroldp.h"
+#include "mtpplaybackcontrolpanic.h"
+
+
+// Class constants.
+__FLOG_STMT(_LIT8(KComponent,"MTPPlaybackMap");)
+
+const TInt KPlaybackRatePlay = 1000;
+const TInt KPlaybackRatePause = 0;
+const TInt KPlaybackRateFF = 2000;
+const TInt KPlaybackRateREW = -2000;
+/**
+Two-phase constructor.
+@param aPlugin The data provider plugin
+@return a pointer to the created playback checker object
+*/
+CMTPPlaybackMap* CMTPPlaybackMap::NewL(MMTPDataProviderFramework& aFramework,
+ CMTPPlaybackProperty& aProperty)
+ {
+ CMTPPlaybackMap* self = new (ELeave) CMTPPlaybackMap(aFramework, aProperty);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+/**
+Destructor.
+*/
+CMTPPlaybackMap::~CMTPPlaybackMap()
+ {
+ __FLOG(_L8("~CMTPPlaybackMap - Entry"));
+ __FLOG(_L8("~CMTPPlaybackMap - Exit"));
+ __FLOG_CLOSE;
+ }
+
+/**
+Constructor.
+*/
+CMTPPlaybackMap::CMTPPlaybackMap(MMTPDataProviderFramework& aFramework,
+ CMTPPlaybackProperty& aProperty):
+ iFramework(aFramework),iProperty(aProperty)
+ {
+ }
+
+/**
+Second-phase constructor.
+*/
+void CMTPPlaybackMap::ConstructL()
+ {
+ __FLOG_OPEN(KMTPSubsystem, KComponent);
+ __FLOG(_L8("CMTPPlaybackMap: ConstructL - Entry"));
+ __FLOG(_L8("CMTPPlaybackMap: ConstructL - Exit"));
+ }
+
+TInt CMTPPlaybackMap::GetPlaybackControlCommand(const TMTPPbCtrlData& aData,
+ CMTPPlaybackCommand** aCmd)
+ {
+ __FLOG(_L8("GetPlaybackControlCommand - Entry"));
+ TInt result = KErrNotSupported;
+ switch(aData.iOptCode)
+ {
+ case EMTPOpCodeSetDevicePropValue:
+ case EMTPOpCodeResetDevicePropValue:
+ {
+ result = HandleSetDevicePropValue(aData, aCmd);
+ }
+ break;
+ case EMTPOpCodeGetDevicePropValue:
+ case EMTPOpCodeGetDevicePropDesc:
+ {
+ result = HandleGetDevicePropValue(aData, aCmd);
+ }
+ break;
+ case EMTPOpCodeSkip:
+ {
+ result = HandleSkip(aData, aCmd);
+ }
+ break;
+ default:
+ break;
+ }
+ __FLOG(_L8("GetPlaybackControlCommand - Exit"));
+ return result;
+ }
+
+TInt CMTPPlaybackMap::HandleSetDevicePropValue(const TMTPPbCtrlData& aData,
+ CMTPPlaybackCommand** aCmd)
+ {
+ TRAPD(err, HandleSetDevicePropValueL(aData, aCmd));
+ return err;
+ }
+
+void CMTPPlaybackMap::HandleSetDevicePropValueL(const TMTPPbCtrlData& aData,
+ CMTPPlaybackCommand** aCmd)
+ {
+ __FLOG(_L8("HandleSetDevicePropValueL - Entry"));
+ __ASSERT_DEBUG((aData.iOptCode == EMTPOpCodeSetDevicePropValue) ||
+ (aData.iOptCode == EMTPOpCodeResetDevicePropValue),
+ Panic(EMTPPBArgumentErr));
+
+ switch(aData.iDevPropCode)
+ {
+ case EMTPDevicePropCodeVolume:
+ {
+ TUint32 val = aData.iPropValUint32.Value();
+ CMTPPbCmdParam* param = CMTPPbCmdParam::NewL(val);
+ CleanupStack::PushL(param);
+ *aCmd = CMTPPlaybackCommand::NewL(EPlaybackCmdSetVolume, param);
+ CleanupStack::Pop(param);
+ }
+ break;
+
+ case EMTPDevicePropCodePlaybackRate:
+ {
+ TInt32 val = aData.iPropValInt32.Value();
+ TMTPPlaybackCommand cmd = EPlaybackCmdNone;
+ switch(val)
+ {
+ case KPlaybackRateFF:
+ cmd = EPlaybackCmdSeekForward;
+ break;
+ case KPlaybackRatePlay:
+ cmd = EPlaybackCmdPlay;
+ break;
+ case KPlaybackRatePause:
+ cmd = EPlaybackCmdPause;
+ break;
+ case KPlaybackRateREW:
+ cmd = EPlaybackCmdSeekBackward;
+ break;
+ default:
+ User::Leave(KErrArgument);
+ break;
+ }
+ if(cmd != EPlaybackCmdNone)
+ {
+ *aCmd = CMTPPlaybackCommand::NewL(cmd, NULL);
+ }
+ else
+ {
+ *aCmd = NULL;
+ }
+ }
+ break;
+
+ case EMTPDevicePropCodePlaybackObject:
+ {
+ TUint32 handle = aData.iPropValUint32.Value();
+ if(handle == 0)
+ {
+ *aCmd = CMTPPlaybackCommand::NewL(EPlaybackCmdStop, NULL);
+ }
+ else
+ {
+ TFileName suid;
+ TUint format;
+ GetObjecInfoFromHandleL(handle, suid, format);
+ TMTPPbCategory cat = EMTPPbCatNone;
+ switch(format)
+ {
+ case 0xBA05://Abstract Audio & Video Playlist
+ case 0xBA11://M3U Playlist
+ cat = EMTPPbCatPlayList;
+ break;
+ case 0xBA03://Abstract Audio Album
+ cat = EMTPPbCatAlbum;
+ break;
+ case 0x3009://MP3
+ case 0xB903://AAC (Advance Audio Coding)
+ case 0xB901://WMA (Windows Media Audio)
+ case 0x3008://WAV (Waveform audio format)
+ cat = EMTPPbCatMusic;
+ break;
+ default:
+ User::Leave(KErrArgument);
+ break;
+ }
+ if(cat != EMTPPbCatNone)
+ {
+ CMTPPbCmdParam* param = CMTPPbCmdParam::NewL(cat, suid);
+ CleanupStack::PushL(param);
+ *aCmd = CMTPPlaybackCommand::NewL(EPlaybackCmdInitObject, param);
+ CleanupStack::Pop(param);
+ }
+ else
+ {
+ *aCmd = NULL;
+ }
+ }
+ }
+ break;
+
+ case EMTPDevicePropCodePlaybackContainerIndex:
+ {
+ TUint32 index = aData.iPropValUint32.Value();
+ CMTPPbCmdParam* param = CMTPPbCmdParam::NewL(index);
+ CleanupStack::PushL(param);
+ *aCmd = CMTPPlaybackCommand::NewL(EPlaybackCmdInitIndex, param);
+ CleanupStack::Pop(param);
+ }
+ break;
+
+ case EMTPDevicePropCodePlaybackPosition:
+ {
+ TUint32 position = aData.iPropValUint32.Value();
+ CMTPPbCmdParam* param = CMTPPbCmdParam::NewL(position);
+ CleanupStack::PushL(param);
+ *aCmd = CMTPPlaybackCommand::NewL(EPlaybackCmdSetPosition, param);
+ CleanupStack::Pop(param);
+ }
+ break;
+
+ default:
+ User::Leave(KErrArgument);
+ break;
+ }
+ __FLOG(_L8("HandleSetDevicePropValueL - Exit"));
+ }
+
+TInt CMTPPlaybackMap::HandleGetDevicePropValue(const TMTPPbCtrlData& aData,
+ CMTPPlaybackCommand** aCmd)
+ {
+ TRAPD(err, HandleGetDevicePropValueL(aData, aCmd));
+ return err;
+ }
+void CMTPPlaybackMap::HandleGetDevicePropValueL(const TMTPPbCtrlData& aData,
+ CMTPPlaybackCommand** aCmd)
+ {
+ __FLOG(_L8("HandleGetDevicePropValueL - Entry"));
+ __ASSERT_DEBUG((aData.iOptCode == EMTPOpCodeGetDevicePropValue) ||
+ (aData.iOptCode == EMTPOpCodeGetDevicePropDesc),
+ Panic(EMTPPBArgumentErr));
+
+ switch(aData.iDevPropCode)
+ {
+ case EMTPDevicePropCodeVolume:
+ {
+ TMTPPlaybackCommand cmd = EPlaybackCmdGetVolumeSet;
+ if(aData.iOptCode == EMTPOpCodeGetDevicePropValue)
+ {
+ cmd = EPlaybackCmdGetVolume;
+ }
+ *aCmd = CMTPPlaybackCommand::NewL(cmd, NULL);
+ }
+ break;
+
+ case EMTPDevicePropCodePlaybackRate:
+ {
+ *aCmd = CMTPPlaybackCommand::NewL(EPlaybackCmdGetState, NULL);
+ }
+ break;
+
+ case EMTPDevicePropCodePlaybackObject:
+ {
+ *aCmd = CMTPPlaybackCommand::NewL(EPlaybackCmdGetObject, NULL);
+ }
+ break;
+
+ case EMTPDevicePropCodePlaybackContainerIndex:
+ {
+ *aCmd = CMTPPlaybackCommand::NewL(EPlaybackCmdGetIndex, NULL);
+ }
+ break;
+
+ case EMTPDevicePropCodePlaybackPosition:
+ {
+ *aCmd = CMTPPlaybackCommand::NewL(EPlaybackCmdGetPosition, NULL);
+ }
+ break;
+
+ default:
+ User::Leave(KErrArgument);
+ break;
+ }
+ __FLOG(_L8("HandleGetDevicePropValueL - Exit"));
+ }
+
+TInt CMTPPlaybackMap::HandleSkip(const TMTPPbCtrlData& aData,
+ CMTPPlaybackCommand** aCmd)
+ {
+ TRAPD(err, HandleSkipL(aData, aCmd));
+ return err;
+ }
+
+void CMTPPlaybackMap::HandleSkipL(const TMTPPbCtrlData& aData,
+ CMTPPlaybackCommand** aCmd)
+ {
+ __FLOG(_L8("HandleSkipL - Entry"));
+ TInt32 step = aData.iPropValInt32.Value();
+ CMTPPbCmdParam* param = CMTPPbCmdParam::NewL(step);
+ CleanupStack::PushL(param);
+ *aCmd = CMTPPlaybackCommand::NewL(EPlaybackCmdSkip, param);
+ CleanupStack::Pop(param);
+ __FLOG(_L8("HandleSkipL - Exit"));
+ }
+
+TInt32 CMTPPlaybackMap::PlaybackRateL(TMTPPlaybackState aState)
+ {
+ __FLOG(_L8("PlaybackRate - Entry"));
+ TInt32 rate = KPlaybackRatePause;
+ switch(aState)
+ {
+ case EPlayStateForwardSeeking:
+ rate = KPlaybackRateFF;
+ break;
+
+ case EPlayStatePlaying:
+ rate = KPlaybackRatePlay;
+ break;
+
+ case EPlayStatePaused:
+ rate = KPlaybackRatePause;
+ break;
+
+ case EPlayStateBackwardSeeking:
+ rate = KPlaybackRateREW;
+ break;
+
+ default:
+ User::Leave(KErrArgument);
+ break;
+ }
+ __FLOG(_L8("PlaybackRate - Exit"));
+ return rate;
+ }
+
+TUint32 CMTPPlaybackMap::ObjectHandleL(const TDesC& aSuid)
+ {
+ __FLOG(_L8("ObjectHandleL - Entry"));
+ CMTPObjectMetaData* meta(CMTPObjectMetaData::NewLC());
+ TBool result = iFramework.ObjectMgr().ObjectL(aSuid, *meta);
+ __ASSERT_ALWAYS(result, User::Leave(KErrBadHandle));
+ __ASSERT_DEBUG(meta, Panic(EMTPPBDataNullErr));
+ TUint32 handle = meta->Uint(CMTPObjectMetaData::EHandle);
+ CleanupStack::PopAndDestroy(meta);
+ __FLOG(_L8("ObjectHandleL - Exit"));
+ return handle;
+ }
+
+void CMTPPlaybackMap::GetObjecInfoFromHandleL(TUint32 aHandle, TDes& aSuid, TUint& aFormat) const
+ {
+ __FLOG(_L8("GetObjecInfoFromHandleL - Entry"));
+ CMTPObjectMetaData* meta(CMTPObjectMetaData::NewLC());
+ TBool result = iFramework.ObjectMgr().ObjectL(aHandle, *meta);
+ __ASSERT_ALWAYS(result, User::Leave(KErrBadHandle));
+ __ASSERT_DEBUG(meta, Panic(EMTPPBDataNullErr));
+ aSuid = meta->DesC(CMTPObjectMetaData::ESuid);
+ aFormat = meta->Uint(CMTPObjectMetaData::EFormatCode);
+ CleanupStack::PopAndDestroy(meta);
+ __FLOG(_L8("GetObjecInfoFromHandleL - Exit"));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/src/cmtpplaybackproperty.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,265 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include "cmtpplaybackmap.h"
+#include "cmtpplaybackproperty.h"
+#include "mtpplaybackcontrolpanic.h"
+
+// Class constants.
+__FLOG_STMT(_LIT8(KComponent,"MTPPlaybackProperty");)
+
+const TInt32 KMTPDefaultPlaybackRate = 0;
+
+const TUint32 KMTPMaxPlaybackVolume = 100;
+const TUint32 KMTPMinPlaybackVolume = 0;
+const TUint32 KMTPDefaultPlaybackVolume = 40;
+const TUint32 KMTPCurrentPlaybackVolume = 40;
+const TUint32 KMTPVolumeStep = 1;
+
+const TUint32 KMTPDefaultPlaybackObject = 0;
+const TUint32 KMTPDefaultPlaybackIndex = 0;
+const TUint32 KMTPDefaultPlaybackPosition = 0;
+
+/**
+Two-phase constructor.
+@param aPlugin The data provider plugin
+@return a pointer to the created playback checker object
+*/
+CMTPPlaybackProperty* CMTPPlaybackProperty::NewL()
+ {
+ CMTPPlaybackProperty* self = new (ELeave) CMTPPlaybackProperty();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+/**
+Destructor.
+*/
+CMTPPlaybackProperty::~CMTPPlaybackProperty()
+ {
+ __FLOG(_L8("~CMTPPlaybackProperty - Entry"));
+ delete iPlaybackVolumeData;
+ __FLOG(_L8("~CMTPPlaybackProperty - Exit"));
+ __FLOG_CLOSE;
+ }
+
+/**
+Constructor.
+*/
+CMTPPlaybackProperty::CMTPPlaybackProperty()
+ {
+ }
+
+/**
+Second-phase constructor.
+*/
+void CMTPPlaybackProperty::ConstructL()
+ {
+ __FLOG_OPEN(KMTPSubsystem, KComponent);
+ __FLOG(_L8("ConstructL - Entry"));
+ __FLOG(_L8("ConstructL - Exit"));
+ }
+
+void CMTPPlaybackProperty::GetDefaultPropertyValueL(TMTPDevicePropertyCode aProp, TInt32& aValue)
+ {
+ __FLOG(_L8("GetDefaultPropertyValueL - Entry"));
+
+ __ASSERT_ALWAYS((aProp == EMTPDevicePropCodePlaybackRate), User::Leave(KErrArgument));
+ aValue = KMTPDefaultPlaybackRate;
+
+ __FLOG(_L8("GetDefaultPropertyValueL - Exit"));
+ }
+
+void CMTPPlaybackProperty::GetDefaultPropertyValueL(TMTPDevicePropertyCode aProp, TUint32& aValue)
+ {
+ __FLOG(_L8("GetDefaultPropertyValueL - Entry"));
+ switch(aProp)
+ {
+ case EMTPDevicePropCodeVolume:
+ {
+ if(iPlaybackVolumeData != NULL)
+ {
+ aValue = iPlaybackVolumeData->DefaultVolume();
+ }
+ else
+ {
+ aValue = KMTPDefaultPlaybackVolume;
+ }
+ }
+ break;
+
+ case EMTPDevicePropCodePlaybackObject:
+ {
+ aValue = KMTPDefaultPlaybackObject;
+ }
+ break;
+
+ case EMTPDevicePropCodePlaybackContainerIndex:
+ {
+ aValue = KMTPDefaultPlaybackIndex;
+ }
+ break;
+
+ case EMTPDevicePropCodePlaybackPosition:
+ {
+ aValue = KMTPDefaultPlaybackPosition;
+ }
+ break;
+
+ default:
+ User::Leave(KErrArgument);
+ }
+ __FLOG(_L8("GetDefaultPropertyValueL - Exit"));
+ }
+
+void CMTPPlaybackProperty::GetDefaultVolSet(TMTPPbDataVolume& aValue)
+ {
+ if(iPlaybackVolumeData == NULL)
+ {
+ aValue.SetVolume(KMTPMaxPlaybackVolume,
+ KMTPMinPlaybackVolume,
+ KMTPDefaultPlaybackVolume,
+ KMTPCurrentPlaybackVolume,
+ KMTPVolumeStep);
+ }
+ else
+ {
+ aValue = (*iPlaybackVolumeData);
+ }
+ }
+
+void CMTPPlaybackProperty::SetDefaultVolSetL(const TMTPPbDataVolume& aValue)
+ {
+ if(iPlaybackVolumeData == NULL)
+ {
+ iPlaybackVolumeData = new (ELeave) TMTPPbDataVolume(aValue);
+ }
+ else
+ {
+ (*iPlaybackVolumeData) = aValue;
+ }
+ }
+
+void CMTPPlaybackProperty::GetDefaultPropertyValueL(TMTPPbCtrlData& aValue)
+ {
+ __FLOG(_L8("GetDefaultPropertyValueL - Entry"));
+ __ASSERT_DEBUG((aValue.iOptCode == EMTPOpCodeResetDevicePropValue), Panic(EMTPPBArgumentErr));
+
+ switch(aValue.iDevPropCode)
+ {
+ case EMTPDevicePropCodePlaybackRate:
+ {
+ TInt32 val;
+ GetDefaultPropertyValueL(aValue.iDevPropCode, val);
+ aValue.iPropValInt32.Set(val);
+ }
+ break;
+
+ case EMTPDevicePropCodeVolume:
+ case EMTPDevicePropCodePlaybackObject:
+ case EMTPDevicePropCodePlaybackContainerIndex:
+ case EMTPDevicePropCodePlaybackPosition:
+ {
+ TUint32 val;
+ GetDefaultPropertyValueL(aValue.iDevPropCode, val);
+ aValue.iPropValUint32.Set(val);
+ }
+ break;
+
+ default:
+ User::Leave(KErrArgument);
+ }
+ __FLOG(_L8("GetDefaultPropertyValueL - Exit"));
+ }
+
+TBool CMTPPlaybackProperty::IsDefaultPropertyValueL(const TMTPPbCtrlData& aValue) const
+ {
+ __FLOG(_L8("EqualToDefaultPropertyValueL - Entry"));
+
+ TInt result(EFalse);
+
+ switch(aValue.iDevPropCode)
+ {
+ case EMTPDevicePropCodePlaybackRate:
+ {
+ if(aValue.iPropValInt32.Value() == KMTPDefaultPlaybackRate)
+ {
+ result = ETrue;
+ }
+ }
+ break;
+
+ case EMTPDevicePropCodeVolume:
+ {
+ if(iPlaybackVolumeData == NULL)
+ {
+ if(aValue.iPropValUint32.Value() == KMTPDefaultPlaybackVolume)
+ {
+ result = ETrue;
+ }
+ }
+ else
+ {
+ if(aValue.iPropValUint32.Value() == iPlaybackVolumeData->DefaultVolume())
+ {
+ result = ETrue;
+ }
+ }
+ }
+ break;
+
+ case EMTPDevicePropCodePlaybackObject:
+ {
+ if(aValue.iPropValUint32.Value() == KMTPDefaultPlaybackObject)
+ {
+ result = ETrue;
+ }
+ }
+ break;
+
+ case EMTPDevicePropCodePlaybackContainerIndex:
+ {
+ if(aValue.iPropValUint32.Value() == KMTPDefaultPlaybackIndex)
+ {
+ result = ETrue;
+ }
+ }
+ break;
+
+ case EMTPDevicePropCodePlaybackPosition:
+ {
+ if(aValue.iPropValUint32.Value() == KMTPDefaultPlaybackPosition)
+ {
+ result = ETrue;
+ }
+ }
+ break;
+
+ default:
+ User::Leave(KErrArgument);
+ }
+
+ __FLOG(_L8("EqualToDefaultPropertyValueL - Exit"));
+
+ return result;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/src/mtpplaybackcontroldp.rss Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,45 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <ecom/registryinfo.rh>
+
+RESOURCE REGISTRY_INFO theInfo
+ {
+ dll_uid = 0x2002EA98;
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ interface_uid = 0x102827AD;
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x2002EA99;
+ version_no = 1;
+ display_name = "MTP Playback Control Data Provider plug-in.";
+ default_data = "";
+ opaque_data = "";
+ }
+ };
+ }
+ };
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/src/mtpplaybackcontroldp_config.rss Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,33 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <mtp/mtpdataproviderconfig.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 = 0;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/src/mtpplaybackcontroldpimplproxy.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,40 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include "cmtpplaybackcontroldp.h"
+#include <ecom/implementationproxy.h>
+
+// Define the interface UIDs
+static const TImplementationProxy ImplementationTable[] =
+ {
+ {
+ {0x2002EA99}, (TProxyNewLPtr)(CMTPPlaybackControlDataProvider::NewL)
+ }
+ };
+
+/**
+ECOM plugin entry point
+*/
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+ {
+ aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+ return ImplementationTable;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/src/mtpplaybackcontroldpprocessor.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -0,0 +1,95 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include "mtpplaybackcontroldpprocessor.h"
+#include "cmtprequestprocessor.h"
+#include "cmtppbcgetdevicepropdesc.h"
+#include "cmtppbcgetdevicepropvalue.h"
+#include "cmtppbcsetdevicepropvalue.h"
+#include "cmtppbcresetdevicepropvalue.h"
+#include "cmtppbcskip.h"
+#include "cmtprequestunknown.h"
+
+typedef MMTPRequestProcessor*(*TMTPPlaybackRequestProcessorCreateFunc)(
+ MMTPDataProviderFramework& aFramework,
+ MMTPConnection& aConnection,
+ CMTPPlaybackControlDataProvider& aDataProvider);
+
+/**
+Defines an entry which maps from operation code to the request processor
+
+@internalComponent
+*/
+typedef struct
+ {
+ TUint16 iOperationCode;
+ TMTPPlaybackRequestProcessorCreateFunc iCreateFunc;
+ } TMTPPlaybackRequestProcessorEntry;
+
+/**
+Playback control data provider mapping table from request ID to factory method of the request processor
+*/
+static const TMTPPlaybackRequestProcessorEntry KMTPRequestProcessorTable[] =
+ {
+ {EMTPOpCodeGetDevicePropDesc, CMTPPbcGetDevicePropDesc::NewL},
+ {EMTPOpCodeGetDevicePropValue, CMTPPbcGetDevicePropValue::NewL},
+ {EMTPOpCodeSetDevicePropValue, CMTPPbcSetDevicePropValue::NewL},
+ {EMTPOpCodeResetDevicePropValue, CMTPPbcResetDevicePropValue::NewL},
+ {EMTPOpCodeSkip, CMTPPbcSkip::NewL},
+ };
+
+/**
+Create a request processor that matches the request
+@param aPlugin The reference to the data provider plugin
+@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
+@return a pointer to the request processor
+*/
+MMTPRequestProcessor* MTPPlaybackControlDpProcessor::CreateL(
+ MMTPDataProviderFramework& aFramework,
+ const TMTPTypeRequest& aRequest,
+ MMTPConnection& aConnection,
+ CMTPPlaybackControlDataProvider& aDataProvider)
+ {
+ TMTPPlaybackRequestProcessorCreateFunc createFunc = NULL;
+ TUint16 operationCode = aRequest.Uint16(TMTPTypeRequest::ERequestOperationCode);
+ TInt count = sizeof(KMTPRequestProcessorTable) / sizeof(TMTPRequestProcessorEntry);
+ for(TInt i = 0; i < count; i++)
+ {
+ if(KMTPRequestProcessorTable[i].iOperationCode == operationCode)
+ {
+ createFunc = KMTPRequestProcessorTable[i].iCreateFunc;
+ break;
+ }
+ }
+
+ if(!createFunc)
+ {
+ return CMTPRequestUnknown::NewL(aFramework, aConnection);
+ }
+ else
+ {
+ return (*createFunc)(aFramework, aConnection, aDataProvider);
+ }
+ }
+
+
+
Binary file mtpfws/mtpfw/conf/mtpframework.confml has changed
--- a/mtpfws/mtpfw/daemon/server/src/cmtpserver.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpfws/mtpfw/daemon/server/src/cmtpserver.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -73,6 +73,7 @@
{
__FLOG(_L8("~CMTPServer - Entry"));
delete iShutdown;
+ iShutdown = NULL;
iFrameworkSingletons.ConnectionMgr().StopTransports();
iFrameworkSingletons.DpController().UnloadDataProviders();
iFrameworkSingletons.Close();
@@ -139,12 +140,6 @@
if (--iSessionCount==0 && iFrameworkSingletons.ConnectionMgr().TransportCount() == 0)
{
// No active MTP client API sessions remain, start the shutdown timer.
- if (!iShutdown)
- {
- TRAPD(error, iShutdown = CMTPShutdown::NewL());
- __FLOG(_L8("CMTPShutdown Loaded- Entry"));
- UNUSED_VAR(error);
- }
if (iShutdown)
{
__FLOG(_L8("Shutdown Started - Entry"));
@@ -193,6 +188,12 @@
__FLOG(_L8("ConstructL - Entry"));
StartL(KMTPServerName);
iFrameworkSingletons.OpenL();
+ if (!iShutdown)
+ {
+ TRAPD(error, iShutdown = CMTPShutdown::NewL());
+ __FLOG(_L8("CMTPShutdown Loaded- Entry"));
+ UNUSED_VAR(error);
+ }
__FLOG(_L8("ConstructL - Exit"));
}
--- a/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpgetdeviceinfo.h Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpgetdeviceinfo.h Tue Jul 06 15:13:34 2010 +0300
@@ -57,7 +57,7 @@
void SetSupportedOperationsL(CMTPDataProviderController& aDpController);
void SetSupportedEventsL(CMTPDataProviderController& aDpController);
- void SetSupportedDevicePropertiesL();
+ void SetSupportedDevicePropertiesL(CMTPDataProviderController& aDpController);
void SetSupportedCaptureFormatsL(CMTPDataProviderController& aDpController);
void SetSupportedPlaybackFormatsL(CMTPDataProviderController& aDpController);
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedatastore.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedatastore.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -509,7 +509,7 @@
1. Device friendly name.
*/
iDeviceFriendlyNameDefault = iSingletons.FrameworkConfig().ValueL(CMTPFrameworkConfig::EDeviceFriendlyName);
- iDeviceFriendlyName = CMTPTypeString::NewL(*iDeviceFriendlyNameDefault);
+ iDeviceFriendlyName = CMTPTypeString::NewL();
// 2. Synchronization partner name.
iSyncPartnerNameDefault = iSingletons.FrameworkConfig().ValueL(CMTPFrameworkConfig::ESynchronizationPartnerName);
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdeviceinfo.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdeviceinfo.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -165,7 +165,7 @@
CMTPDataProviderController& dps(iSingletons.DpController());
SetSupportedOperationsL(dps);
SetSupportedEventsL(dps);
- SetSupportedDevicePropertiesL();
+ SetSupportedDevicePropertiesL(dps);
SetSupportedCaptureFormatsL(dps);
SetSupportedPlaybackFormatsL(dps);
@@ -243,11 +243,42 @@
/**
Populates the supported device properties field in the device info data set
*/
-void CMTPGetDeviceInfo::SetSupportedDevicePropertiesL()
+void CMTPGetDeviceInfo::SetSupportedDevicePropertiesL(CMTPDataProviderController& aDpController)
{
- __FLOG(_L8("SetSupportedDevicePropertiesL - Entry"));
- iDeviceInfo->SetL(CMTPTypeDeviceInfo::EDevicePropertiesSupported,
- iDpSingletons.DeviceDataStore().GetSupportedDeviceProperties());
+ __FLOG(_L8("SetSupportedDevicePropertiesL - Entry"));
+ TInt count = aDpController.Count();
+ RArray<TUint> supportedOperations(KMTPArrayGranularity);
+ CleanupClosePushL(supportedOperations);
+ const TInt32 KMTPImplementationUidDeviceDp(0x102827AF);
+ const TInt32 KMTPImplementationUidFileDp(0x102827B0);
+ const TInt32 KMTPImplementationUidProxyDp(0x102827B1);
+ const TInt32 KMTPFrameworkDpCount(3);
+ TBool bOnlyInternalDpLoad = count > KMTPFrameworkDpCount ? EFalse : ETrue;
+ while(count--)
+ {
+ TInt32 uid = aDpController.DataProviderByIndexL(count).ImplementationUid().iUid;
+ // The filter is added for licencee's request which will filtrate the symbian's internal
+ // dp's supported enhance mode operations to make licencee's dp work.
+ // Every new internal dp need add it's implementation id here to filtrate and increase
+ // the KMTPFrameworkDpCount number.
+ if ((uid == KMTPImplementationUidDeviceDp ||
+ uid == KMTPImplementationUidFileDp ||
+ uid == KMTPImplementationUidProxyDp) && !bOnlyInternalDpLoad)
+ {
+ AddToArrayWithFilterL(supportedOperations, aDpController.DataProviderByIndexL(count).SupportedCodes(EDeviceProperties));
+ }
+ else
+ {
+ AddToArrayL(supportedOperations, aDpController.DataProviderByIndexL(count).SupportedCodes(EDeviceProperties));
+ }
+ }
+
+ CMTPTypeArray* mtpOperationsArray = CMTPTypeArray::NewL(EMTPTypeAUINT16, supportedOperations);
+ CleanupStack::PopAndDestroy(&supportedOperations);
+ CleanupStack::PushL(mtpOperationsArray); //unnecessary if Set operation below does not leave,
+ iDeviceInfo->SetL(CMTPTypeDeviceInfo::EDevicePropertiesSupported, *mtpOperationsArray);
+ CleanupStack::PopAndDestroy(mtpOperationsArray);
+
__FLOG(_L8("SetSupportedDevicePropertiesL - Exit"));
}
@@ -385,6 +416,13 @@
TInt count(aSrcArray.Count());
for (TInt i(0); (i < count); i++)
{
+ // Apply filter
+ if(aSrcArray[i] == EMTPOpCodeResetDevicePropValue)
+ {
+ __FLOG_VA((_L8("Filter ignored operation: %d"), aSrcArray[i]));
+ continue;
+ }
+
TInt err(aDestArray.InsertInOrder(aSrcArray[i]));
if ((err != KErrNone) && (err != KErrAlreadyExists))
{
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdevicepropdesc.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdevicepropdesc.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -35,6 +35,8 @@
// Class constants.
__FLOG_STMT(_LIT8(KComponent,"GetDevicePropDesc");)
+_LIT(KSpace, " ");
+
/**
Two-phase constructor.
@param aPlugin The data provider plugin
@@ -273,7 +275,32 @@
CMTPDeviceDataStore& device(iDpSingletons.DeviceDataStore());
iPropDesc->SetStringL(CMTPTypeDevicePropDesc::EFactoryDefaultValue, device.DeviceFriendlyNameDefault());
- iPropDesc->SetStringL(CMTPTypeDevicePropDesc::ECurrentValue, device.DeviceFriendlyName());
+
+ //if device friendly name is blank, which means it is the first time the device get connected,
+ //, so will use "manufacture + model id" firstly; if neither manufacture nor model
+ //id not able to be fetched by API, then use the default device friendly name
+ if ( device.DeviceFriendlyName().Length()<=0 )
+ {
+ if ( device.Manufacturer().Compare(KMTPDefaultManufacturer) && device.Model().Compare(KMTPDefaultModel) )
+ {
+ HBufC* friendlyName = HBufC::NewLC(device.Manufacturer().Length()+1+ device.Model().Length());
+ TPtr ptrName = friendlyName->Des();
+ ptrName.Copy(device.Manufacturer());
+ ptrName.Append(KSpace);
+ ptrName.Append(device.Model());
+ device.SetDeviceFriendlyNameL(ptrName);
+ iPropDesc->SetStringL(CMTPTypeDevicePropDesc::ECurrentValue, ptrName);
+ CleanupStack::PopAndDestroy(friendlyName);
+ }
+ else
+ {
+ iPropDesc->SetStringL(CMTPTypeDevicePropDesc::ECurrentValue, device.DeviceFriendlyNameDefault());
+ }
+ }
+ else
+ {
+ iPropDesc->SetStringL(CMTPTypeDevicePropDesc::ECurrentValue, device.DeviceFriendlyName());
+ }
SendDataL(*iPropDesc);
__FLOG(_L8("ServiceDeviceFriendlyNameL - Exit"));
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdevicepropvalue.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdevicepropvalue.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -27,6 +27,8 @@
// Class constants.
__FLOG_STMT(_LIT8(KComponent,"GetDevicePropValue");)
+_LIT(KSpace, " ");
+
/**
Two-phase constructor.
@param aPlugin The data provider plugin
@@ -96,7 +98,33 @@
void CMTPGetDevicePropValue::ServiceDeviceFriendlyNameL()
{
__FLOG(_L8("ServiceDeviceFriendlyNameL - Entry"));
- iString->SetL(iDpSingletons.DeviceDataStore().DeviceFriendlyName());
+ //if device friendly name is blank, which means it is the first time the device get connected,
+ //, so will use "manufacture + model id" firstly; if neither manufacture nor model
+ //id not able to be fetched by API, then use the default device friendly name if ( iDpSingletons.DeviceDataStore().DeviceFriendlyName().Length()<=0 )
+ if ( iDpSingletons.DeviceDataStore().DeviceFriendlyName().Length()<=0 )
+ {
+ if ( iDpSingletons.DeviceDataStore().Manufacturer().Compare(KMTPDefaultManufacturer) &&
+ iDpSingletons.DeviceDataStore().Model().Compare(KMTPDefaultModel) )
+ {
+ HBufC* friendlyName = HBufC::NewLC( iDpSingletons.DeviceDataStore().Manufacturer().Length()+1+ iDpSingletons.DeviceDataStore().Model().Length());
+ TPtr ptrName = friendlyName->Des();
+ ptrName.Copy( iDpSingletons.DeviceDataStore().Manufacturer());
+ ptrName.Append(KSpace);
+ ptrName.Append( iDpSingletons.DeviceDataStore().Model());
+ iDpSingletons.DeviceDataStore().SetDeviceFriendlyNameL(ptrName);
+ iString->SetL(ptrName);
+ CleanupStack::PopAndDestroy(friendlyName);
+ }
+ else
+ {
+ iString->SetL(iDpSingletons.DeviceDataStore().DeviceFriendlyNameDefault());
+ }
+ }
+ else
+ {
+ iString->SetL(iDpSingletons.DeviceDataStore().DeviceFriendlyName());
+ }
+
SendDataL(*iString);
__FLOG(_L8("ServiceDeviceFriendlyNameL - Exit"));
}
--- a/mtpfws/mtpfw/dataproviders/devdp/src/mtpdevicedpprocessor.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/mtpdevicedpprocessor.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -52,6 +52,8 @@
#include "cmtpgetserviceinfo.h"
#include "cmtpgetformatcapabilities.h"
#include "cmtpsetobjectprotection.h"
+#include "cmtpcommonrequestprocessor.h"
+
/**
device data provider mapping table from request ID to factory method of the request processor
*/
@@ -89,7 +91,9 @@
{EMTPOpCodeGetServiceIDs, CMTPGetServiceIds::NewL},
{EMTPOpCodeGetServiceInfo, CMTPGetServiceInfo::NewL},
{EMTPOpCodeGetFormatCapabilities,CMTPGetFormatCapabilities::NewL},
- {EMTPOpCodeSetObjectProtection, CMTPSetObjectProtection::NewL}
+ {EMTPOpCodeSetObjectProtection, CMTPSetObjectProtection::NewL},
+ {EMTPOpCodeSetServicePropList,CMTPCommonRequestProcessor::NewL<EMTPRespCodeInvalidServiceID, ETrue>},
+ {EMTPOpCodeDeleteServicePropList,CMTPCommonRequestProcessor::NewL<EMTPRespCodeInvalidServiceID, ETrue>}
};
/**
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpcopyobject.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpcopyobject.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -37,7 +37,7 @@
{
{TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, EMTPElementAttrFileOrDir, 0, 0, 0},
{TMTPTypeRequest::ERequestParameter2, EMTPElementTypeStorageId, EMTPElementAttrWrite, 0, 0, 0},
- {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir | EMTPElementAttrWrite, 1, 0, 0}
+ {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir, 1, 0, 0}
};
/**
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpmoveobject.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpmoveobject.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -38,7 +38,7 @@
{
{TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, EMTPElementAttrFileOrDir | EMTPElementAttrWrite, 0, 0, 0},
{TMTPTypeRequest::ERequestParameter2, EMTPElementTypeStorageId, EMTPElementAttrWrite, 0, 0, 0},
- {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir | EMTPElementAttrWrite, 1, 0, 0}
+ {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir, 1, 0, 0}
};
/**
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsetobjectprotection.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsetobjectprotection.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -35,6 +35,7 @@
*/
const TMTPRequestElementInfo KMTPSetObjectProtectionPolicy[] =
{
+ //This policy does not taks effect, see CheckRequestL
{TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, EMTPElementAttrWrite, 0, 0, 0},
};
--- a/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpcopyobject.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpcopyobject.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -33,7 +33,7 @@
{
{TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, EMTPElementAttrFileOrDir, 0, 0, 0},
{TMTPTypeRequest::ERequestParameter2, EMTPElementTypeStorageId, EMTPElementAttrWrite, 0, 0, 0},
- {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir | EMTPElementAttrWrite, 1, 0, 0}
+ {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir, 1, 0, 0}
};
--- a/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpmoveobject.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpmoveobject.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -36,7 +36,7 @@
{
{TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, EMTPElementAttrFileOrDir | EMTPElementAttrWrite, 0, 0, 0},
{TMTPTypeRequest::ERequestParameter2, EMTPElementTypeStorageId, EMTPElementAttrWrite, 0, 0, 0},
- {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir | EMTPElementAttrWrite, 1, 0, 0}
+ {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir, 1, 0, 0}
};
/**
--- a/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpsendobjectinfo.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpsendobjectinfo.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -35,7 +35,7 @@
const TMTPRequestElementInfo KMTPSendObjectInfoPolicy[] =
{
{TMTPTypeRequest::ERequestParameter1, EMTPElementTypeStorageId, EMTPElementAttrWrite, 1, 0, 0},
- {TMTPTypeRequest::ERequestParameter2, EMTPElementTypeObjectHandle, EMTPElementAttrDir | EMTPElementAttrWrite, 2, KMTPHandleAll, KMTPHandleNone}
+ {TMTPTypeRequest::ERequestParameter2, EMTPElementTypeObjectHandle, EMTPElementAttrDir, 2, KMTPHandleAll, KMTPHandleNone}
};
/**
--- a/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpsendobjectproplist.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpsendobjectproplist.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -32,7 +32,7 @@
const TMTPRequestElementInfo KMTPSendObjectPropListPolicy[] =
{
{TMTPTypeRequest::ERequestParameter1, EMTPElementTypeStorageId, EMTPElementAttrWrite, 1, 0, 0},
- {TMTPTypeRequest::ERequestParameter2, EMTPElementTypeObjectHandle, (EMTPElementAttrDir | EMTPElementAttrWrite), 2, KMTPHandleAll, KMTPHandleNone}
+ {TMTPTypeRequest::ERequestParameter2, EMTPElementTypeObjectHandle, EMTPElementAttrDir, 2, KMTPHandleAll, KMTPHandleNone}
};
/**
--- a/mtpfws/mtpfw/datatypes/interface/cmtptypefile.h Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpfws/mtpfw/datatypes/interface/cmtptypefile.h Tue Jul 06 15:13:34 2010 +0300
@@ -25,7 +25,7 @@
#include <e32base.h>
#include <f32file.h>
#include <mtp/mmtptype.h>
-
+
/**
Defines the MTP file object data type.
@publishedPartner
@@ -100,7 +100,8 @@
void ConstructL(const TDesC& aName, TFileMode aMode);
void ConstructL(const TDesC& aName, TFileMode aMode, TInt64 aRequiredSize, TInt64 aOffSet);
void ToggleRdWrBuffer();
-
+ void CreateDoubleBufferL(TInt64 aFileSize);
+
protected: // From CActive
void DoCancel();
@@ -110,8 +111,7 @@
void RunL();
private:
-
-
+
/**
The read and write data stream states.
*/
--- a/mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -234,16 +234,8 @@
iRemainingDataSize = (TInt64)aSize;//Current implemenation does not support file size with 2 x64
- if(iRemainingDataSize> KMTPFileChunkSizeForLargeFile) //512K
- {
- iBuffer1.CreateMaxL(KMTPFileChunkSizeForLargeFile);
- iBuffer2.CreateMaxL(KMTPFileChunkSizeForLargeFile);
- }
- else
- {
- iBuffer1.CreateMaxL(KMTPFileChunkSizeForSmallFile);
- iBuffer2.CreateMaxL(KMTPFileChunkSizeForSmallFile);
- }
+ CreateDoubleBufferL(iRemainingDataSize);
+
if(iRemainingDataSize> KMTPFileSetSizeChunk)
{
//split the setSize to multiple calling of 512M
@@ -599,16 +591,7 @@
iRemainingDataSize = size;
//For File reading, NO "SetSizeL()" will be called, therefore, create the buffer here.
- if (iRemainingDataSize > KMTPFileChunkSizeForLargeFile) //512K
- {
- iBuffer1.CreateMaxL(KMTPFileChunkSizeForLargeFile);
- iBuffer2.CreateMaxL(KMTPFileChunkSizeForLargeFile);
- }
- else
- {
- iBuffer1.CreateMaxL(KMTPFileChunkSizeForSmallFile);
- iBuffer2.CreateMaxL(KMTPFileChunkSizeForSmallFile);
- }
+ CreateDoubleBufferL(iRemainingDataSize);
}
}
@@ -647,16 +630,7 @@
iRemainingDataSize = iTargetFileSize;
//For File reading, NO "SetSizeL()" will be called, therefore, create the buffer here.
- if (iRemainingDataSize > KMTPFileChunkSizeForLargeFile) //512K
- {
- iBuffer1.CreateMaxL(KMTPFileChunkSizeForLargeFile);
- iBuffer2.CreateMaxL(KMTPFileChunkSizeForLargeFile);
- }
- else
- {
- iBuffer1.CreateMaxL(KMTPFileChunkSizeForSmallFile);
- iBuffer2.CreateMaxL(KMTPFileChunkSizeForSmallFile);
- }
+ CreateDoubleBufferL(iRemainingDataSize);
}
}
@@ -743,3 +717,46 @@
iBuffer1AvailForWrite = !iBuffer1AvailForWrite;//toggle the flag.
}
+
+/**
+ * Allocate double buffers to write to/read from file
+ * @param aFileSize: the size of the file to be written to or read from
+ * @return void
+ * leave code: KErrNoMemory if there is insufficient memory
+ */
+void CMTPTypeFile::CreateDoubleBufferL(TInt64 aFileSize)
+ {
+ if(aFileSize > KMTPFileChunkSizeForLargeFile) //512KB
+ {
+ TInt err = iBuffer1.CreateMax(KMTPFileChunkSizeForLargeFile);
+ TInt err2 = iBuffer2.CreateMax(KMTPFileChunkSizeForLargeFile);
+ TInt bufferSize = KMTPFileChunkSizeForLargeFile;
+
+ //if one of buffer allocation fails, decrease the buffer size by
+ //a half of it until :
+ //we finally succeed in the allocation Or
+ //the smallest acceptable buffer size KMTPFileChunkSizeForSmallFile(64KB) reaches.
+ while ((err != KErrNone || err2 != KErrNone) && bufferSize != KMTPFileChunkSizeForSmallFile)
+ {
+ iBuffer1.Close();
+ iBuffer2.Close();
+
+ bufferSize /= 2;
+ err = iBuffer1.CreateMax(bufferSize);
+ err2 = iBuffer2.CreateMax(bufferSize);
+ }
+
+ if ( err != KErrNone || err2 != KErrNone)
+ {
+ //We still can not allocate 2*64KB buffer, just leave under this case
+ iBuffer1.Close();
+ iBuffer2.Close();
+ User::Leave(KErrNoMemory);
+ }
+ }
+ else
+ {
+ iBuffer1.CreateMaxL(KMTPFileChunkSizeForSmallFile);
+ iBuffer2.CreateMaxL(KMTPFileChunkSizeForSmallFile);
+ }
+ }
--- a/mtpfws/mtpfw/datatypes/src/cmtptypeobjectproplist.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpfws/mtpfw/datatypes/src/cmtptypeobjectproplist.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -609,9 +609,27 @@
{
User::Leave(KErrArgument);
}
- TUint16 retValue;
- GetValueL(&retValue, sizeof(TUint16));
- return retValue;
+
+ //Workaround for partial deletion issue observed on Windows XP/Windows7.
+ //When send an object from PC to device through Windows explorer, it will
+ //include the 'ProtectionStatus' property in the dataset of 'SendObjectPropList'
+ //command. While syncing through Ovi player or Windows Media Player, this property
+ //will not be included.
+ //When we delete a folder which contains read-only objects,we returns partial
+ //deletion code, because read-only object should not be deleted according to MTP spec.
+ //On receiving this,Windows popup a dialog saying 'device stops response', this really
+ //give user bad experience, to prevent this, we make this workaround here: when dataprovider
+ //query value of 'ProtectionStatus' property,always return EMTPProtectionNoProtection(0x0000).
+ if (EMTPObjectPropCodeProtectionStatus == iPropertyCode)
+ {
+ return EMTPProtectionNoProtection;
+ }
+ else
+ {
+ TUint16 retValue;
+ GetValueL(&retValue, sizeof(TUint16));
+ return retValue;
+ }
default:
User::Leave(KErrArgument);
}
Binary file mtpfws/mtpfw/group/10282FCC_ARMV5.cre has changed
Binary file mtpfws/mtpfw/group/10282FCC_ARMV5.txt has changed
Binary file mtpfws/mtpfw/group/10282FCC_WINSCW.cre has changed
Binary file mtpfws/mtpfw/group/10282FCC_WINSCW.txt has changed
--- a/mtpfws/mtpfw/src/cmtpdataprovidercontroller.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpfws/mtpfw/src/cmtpdataprovidercontroller.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -849,29 +849,36 @@
__FLOG(_L8("EnumerateDataProviderObjectsL - Entry"));
CMTPDataProvider& dp(DataProviderL(aId));
- if (IsObjectsEnumerationNeededL(dp))
- {
- TBool abnormaldown = ETrue;
- iSingletons.FrameworkConfig().GetValueL(CMTPFrameworkConfig::EAbnormalDown , abnormaldown);
- if ( (!abnormaldown) && (dp.DataProviderConfig().BoolValue(MMTPDataProviderConfig::EObjectEnumerationPersistent)))
- {
- // Initialize persistent objects store.
+ if (IsObjectsEnumerationNeededL(dp))
+ {
+ TBool abnormaldown = ETrue;
+ iSingletons.FrameworkConfig().GetValueL(CMTPFrameworkConfig::EAbnormalDown , abnormaldown);
+ if ( (!abnormaldown) && (dp.DataProviderConfig().BoolValue(MMTPDataProviderConfig::EObjectEnumerationPersistent)))
+ {
+ // Initialize persistent objects store.
iSingletons.ObjectMgr().RestorePersistentObjectsL(aId);
- }
+ }
else
- {
- // Mark all non-persistent objects.
- iSingletons.ObjectMgr().MarkNonPersistentObjectsL(aId,iEnumeratingStorages[0]);
- }
-
- // Initiate the data provider enumeration sequence.
- dp.EnumerateObjectsL(iEnumeratingStorages[0]);
- }
- else
- {
- //The DP does not need enumeration this time, so just change the state to go on.
- EnumerationStateChangedL(dp);
- }
+ {
+ // Mark all non-persistent objects.
+ iSingletons.ObjectMgr().MarkNonPersistentObjectsL(aId,iEnumeratingStorages[0]);
+ }
+ if ((KMTPStorageAll == iEnumeratingStorages[0]) || (iSingletons.StorageMgr().ValidStorageId(iEnumeratingStorages[0])))
+ {
+ //Only initiate the data provider enumeration sequence for valid storage or all storage
+ dp.EnumerateObjectsL(iEnumeratingStorages[0]);
+ }
+ else
+ {
+ EnumerationStateChangedL(dp);
+ }
+
+ }
+ else
+ {
+ //The DP does not need enumeration this time, so just change the state to go on.
+ EnumerationStateChangedL(dp);
+ }
__FLOG(_L8("EnumerateDataProviderObjectsL - Exit"));
}
--- a/mtpfws/mtpfw/src/cmtpframeworkconfig.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtpfws/mtpfw/src/cmtpframeworkconfig.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -180,7 +180,7 @@
}
//Save the AbnormalDown state to ETrue
- User::LeaveIfError(iRepository->Set(EAbnormalDown, KStartupInitValue ));
-
+ //if connect the phone to PC while backup, this will leave.
+ TRAP_IGNORE(iRepository->Set(EAbnormalDown, KStartupInitValue ));
}
--- a/mtptransports/mtpusbtransport/usbsic_imp/inc/cmtpusbepbase.h Fri Jun 11 14:27:06 2010 +0300
+++ b/mtptransports/mtpusbtransport/usbsic_imp/inc/cmtpusbepbase.h Tue Jul 06 15:13:34 2010 +0300
@@ -54,6 +54,7 @@
void CancelSendL(TInt aReason);
void FlushRxDataL();
+ void FlushBufferedRxDataL();
protected:
--- a/mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbconnection.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbconnection.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -508,7 +508,7 @@
__FLOG(_L8("cancel event received at completing phase, flush rx data"));
//flush rx data.
- static_cast<CMTPUsbEpBulkOut*>(iEndpoints[EMTPUsbEpBulkOut])->FlushRxDataL();
+ iEndpoints[EMTPUsbEpBulkOut]->FlushRxDataL();
}
else
{
@@ -518,7 +518,7 @@
DataEndpointsStop();
//flush rx data.
- static_cast<CMTPUsbEpBulkOut*>(iEndpoints[EMTPUsbEpBulkOut])->FlushRxDataL();
+ iEndpoints[EMTPUsbEpBulkOut]->FlushRxDataL();
// initiate bulk request sequence.
InitiateBulkRequestSequenceL();
@@ -1669,7 +1669,6 @@
SetBulkTransactionState(EUndefined);
SetConnectionState(EIdle);
SetSuspendState(ENotSuspended);
- SetDeviceStatus(EMTPUsbDeviceStatusBusy);
}
__FLOG(_L8("StopConnection - Exit"));
@@ -1688,6 +1687,9 @@
{
// Stop all data transfer activity.
DataEndpointsStop();
+
+ //flush buffered rx data.
+ iEndpoints[EMTPUsbEpBulkOut]->FlushBufferedRxDataL();
}
ControlEndpointStop();
@@ -1846,12 +1848,24 @@
ifc().iClass.iProtocolNum = KMTPUsbInterfaceProtocolSIC;
ifc().iTotalEndpointsUsed = KMTPUsbRequiredNumEndpoints;
- // Allocate 512KB buffer for OUT EndPoint, and 64KB for IN EndPoint
+ // Allocate 512KB*2 buffer for OUT EndPoint, and 64KB for IN EndPoint
TUint32 bandwidthPriority = EUsbcBandwidthINPlus2 | EUsbcBandwidthOUTMaximum;
// Write the active interface descriptor.
- User::LeaveIfError(iLdd.SetInterface(KMTPUsbAlternateInterface, ifc, bandwidthPriority));
-
+ TInt err = iLdd.SetInterface(KMTPUsbAlternateInterface, ifc, bandwidthPriority);
+
+ if (err == KErrNoMemory)
+ {
+ __FLOG(_L8("NoMem when setinterface, try with lower priority"));
+ // Allocate 64KB*2 buffer for OUT EndPoint, and 64KB for IN EndPoint
+ bandwidthPriority = EUsbcBandwidthINPlus2 | EUsbcBandwidthOUTPlus2;
+ err = iLdd.SetInterface(KMTPUsbAlternateInterface, ifc, bandwidthPriority);
+ __FLOG_1(_L8("setinterface return for lower priority:%d"),err);
+ }
+
+ __FLOG_1(_L8("setinterface error code:%d"),err);
+ User::LeaveIfError(err);
+
__FLOG(_L8("SetInterfaceDescriptorL - Exit"));
}
--- a/mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbepbase.cpp Fri Jun 11 14:27:06 2010 +0300
+++ b/mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbepbase.cpp Tue Jul 06 15:13:34 2010 +0300
@@ -1085,3 +1085,28 @@
readBuf.Close();
__FLOG(_L8("FlushRxDataL - Exit"));
}
+
+/*
+ * The difference with FlushRxDataL() is FlushBufferedRxDataL only flush current buffered trash data
+ * if currently no data is buffered in usb driver, just return rather than wait some time like what
+ * FlushRxDataL() does
+ */
+void CMTPUsbEpBase::FlushBufferedRxDataL()
+ {
+ //flush buffered rx data
+ TInt nbytes = 0;
+ TInt err = Connection().Ldd().QueryReceiveBuffer(EndpointNumber(), nbytes);
+
+ // has data, read it
+ if( (err == KErrNone) && (nbytes > 0) )
+ {
+ // create the read buff
+ RBuf8 readBuf;
+ readBuf.CreateL(nbytes);
+ // synchronously read the data
+ TRequestStatus status;
+ Connection().Ldd().ReadOneOrMore(status, EndpointNumber(), readBuf);
+ User::WaitForRequest(status);
+ readBuf.Close();
+ }
+ }