I'm building a simple incremental unzipper class.
It unzips the file in chunks and takes short pauses in between them, using the timer example found in http://wiki.forum.nokia.com/index.ph...implementation.
The pause is held because the zip file to be extracted is pretty huge and I don't want to choke the phone entirely.
For some odd reason when testing this on device the RunL() method is never called after calling the RTimer.After() method. I've implemented similar proggressbar & timer system for a simple audioplayer class I modified from wiki example, which is basically very same as this one. I just can't see why this wouldn't work also.
In emulator everything works fine, the timer calls the IncrementUnzip() and the zip file gets unzipped, and proggressbar updates.
But in device the RunL() isn't called even for the first time after UnzipL() has called the RTimer.After().
Any ideas why this would not work in the device?
Or am I already way off on doing this, and should I just implement CZipExtrator as ActiveObject and not use the RTimer at all?
For clarity I've only included the parts that are went through before the error occurs.
Code:CZipExtractor* CZipExtractor::NewL() { CZipExtractor* self = CZipExtractor::NewLC(); CleanupStack::Pop(self); return self; } CZipExtractor* CZipExtractor::NewLC() { CZipExtractor* self = new (ELeave) CZipExtractor(); CleanupStack::PushL(self); self->ConstructL(); return self; } void CZipExtractor::ConstructL() { iTimer = CIntervalTimer::NewL(CActive::EPriorityStandard,*this); } TInt CZipExtractor::UnzipL(const TDesC& aFileName, const TFileName& aOutputFolder, MZipExtractorCallback* aLogger) { shouldStop = EFalse; iCallBack = aLogger; User::LeaveIfError(iFsSession.Connect()); //iFsSession.ShareProtected(); iZipFile = CZipFile::NewL(iFsSession, aFileName); iMembers = iZipFile->GetMembersL(); iOutputFolder.Copy(aOutputFolder); //Dialog iProgressDialog = new ( ELeave ) CAknProgressDialog( reinterpret_cast <CEikDialog**> ( &iProgressDialog ), ETrue ); iProgressDialog->SetCallback(this); iProgressDialog->PrepareLC( R_PLAYBACK_DIALOG ); iProgressDialog->SetTextL(KDialogPleaseWait); iProgressInfo = iProgressDialog->GetProgressInfoL(); TInt size; iZipFile->Size(size); iProgressInfo->SetFinalValue(size); iProgressDialog->RunLD(); iCallBack->Log(_L("Setting timer")); //This is reached in device & emulator iTimer->After(KUnzipFreshTimeOut); } void CZipExtractor::DialogDismissedL( TInt aButtonId ) { shouldStop = ETrue; } void CZipExtractor::TimerExpired(TAny* /*aTimer*/,TInt aError) { iCallBack->Log(_L("TimerExpired")); //This is never reached in device? if(IncrementUnzip()) //More to unzip { iTimer->After(KUnzipFreshTimeOut); } //Something else }Code:class MZipExtractorCallback { public: virtual void Log(const TDesC& aTxt) = 0; virtual void ZipExtractedCallback(TInt aError) = 0; }; class CZipExtractor : public CBase, public MProgressDialogCallback, MTimerNotify { public: static CZipExtractor* NewL(); static CZipExtractor* NewLC(); ~CZipExtractor(); public: // public functions TInt UnzipL(const TDesC& aFileName, const TFileName& aOutputFolder, MZipExtractorCallback* aLogger); public: // implements MTimerNotify void TimerExpired(TAny* aTimer,TInt aError); private: // internal functions void ConstructL(); CZipExtractor(); TBool IncrementUnzip(); private: //private variabled CIntervalTimer* iTimer; CAknProgressDialog* iProgressDialog; CEikProgressInfo* iProgressInfo; CZipFileMemberIterator* iMembers; CZipFile* iZipFile; RFs iFsSession; TFileName iOutputFolder; MZipExtractorCallback* iCallBack; };

Reply With Quote

