×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    19

    Download Manager's file handle

    Hi!

    How can I get the file which is downloaded by download manager?
    Can I use the file for reading during the download?

    I followed the example described in http://wiki.forum.nokia.com/index.ph...ogrammatically
    and I get an event EHttpDlCompleted, but when I try to get the file handle:
    Code:
    void CTMDownloader::HandleDMgrEventL(RHttpDownload &aDownload,
            THttpDownloadEvent aEvent )
    {
    ...
        switch ( aEvent.iDownloadState )
            {
    ...
            case EHttpDlCompleted:
                {
                RFile file;
                aDownload.GetFileHandleAttribute( file );
                }
    }
    The download manager crashes. If I try to set in the begining the file handle it also crashes the DMgr server.
    Code:
            RFs fs; 
            fs.Connect();
            RFile file;
            if(file.Open( fs, _L("C:\\Data\\Videos\\hvf.mp4"), EFileWrite) != KErrNone)
                {file.Create( fs, _L("C:\\Data\\Videos\\hvf.mp4"), EFileWrite);}
            TInt error = iDownload->SetFileHandleAttribute( file );
    error is -15 : server terminated.
    What can be the problem?

    Thanks for your help!
    pka

  2. #2
    Registered User
    Join Date
    Dec 2007
    Posts
    19

    Re: Download Manager's file handle

    Just to share our experinces:
    - DMgr opens the file exclusively so it can not be opened by other application even when progressive download is set.

    - We also tried to get the chunk but it also crashed.

    Our sollution:
    - We implemeted simmiliar thing with RHttpSession it just works.

  3. #3
    Registered User
    Join Date
    Nov 2003
    Posts
    30

    Re: Download Manager's file handle

    In my case I'm handling the RFile myself, by setting the file in the
    RHttpDownload::SetFileHandleAttribute just after the download has been created (CreateDownloadL) and before Start'ing it.

    You should have to make handling of the file (open and close) by yourself.

    /J

  4. #4
    Registered User
    Join Date
    Sep 2008
    Posts
    11

    Re: Download Manager's file handle

    Hi there, i am using the following code to download a file and store it over the mobile
    I am redownloading the same file after a time interval by calling the same code.. can anyone tell me wats wrong in this code. the file which store in the mobile with a name f1 gets deleted after this code runs the 2nd time.


    void CDownloadXML::ConstructL()
    {


    iDMgr.ConnectL( KMyApplnUid, *this, ETrue );

    iUiReg = CDownloadMgrUiLibRegistry::NewL( iDMgr );

    idMgrUserInteractions = &iUiReg->RegisterUserInteractionsL();

    iMgrDownloadsList = &iUiReg->RegisterDownloadsListL();

    iDMgr.DeleteAll();
    }

    void CDownloadXML:: DownloadXMLDoc(TDesC& aFileName, TPtrC8 aCodUrl)

    {
    TUint32 iapId(0);
    CCommsDatabase* cdb = CCommsDatabase::NewL(EDatabaseTypeIAP);
    CleanupStack::PushL(cdb);

    CCommsDbConnectionPrefTableView* commDBView = cdb->OpenConnectionPrefTableInRankOrderLC(ECommDbConnectionDirectionOutgoing);
    if(commDBView->GotoFirstRecord() == KErrNone)
    {
    CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref;
    commDBView->ReadConnectionPreferenceL(pref);
    iapId = pref.iBearer.iIapId;
    }

    CleanupStack::PopAndDestroy(commDBView);
    CleanupStack::PopAndDestroy(cdb);

    User::LeaveIfError( iDMgr.SetIntAttribute( EDlMgrIap, (TInt32)iapId ) );


    RHttpDownload& download = iDMgr.CreateDownloadL(URL,retVal);

    download.SetStringAttribute( EDlAttrDestFilename, filename ); //silent save prob till now...

    TBool silattr(ETrue);

    download.SetBoolAttribute(EDlAttrSilent,silattr);
    download.Start();

    }

    void CDownloadXML::HandleDMgrEventL (RHttpDownload &aDownload, THttpDownloadEvent aEvent)
    {
    switch ( aEvent.iDownloadState )
    {
    case EHttpDlCompleted:
    {
    iDMgr.DeleteAll();
    break;
    }
    }
    }

  5. #5
    Regular Contributor
    Join Date
    Feb 2008
    Location
    Pune, India
    Posts
    340

    Re: Download Manager's file handle

    Forget about what is wrong in the code. Your problem can be solved if you copy the file before it is being deleted.

    You can do it in the "Download Complete" case of the download events.
    Regards,
    Sainagakishore Srikantham (Kishore)

    Don't Hope, KNOW!!! ---------- Visit me at http://ssnkishore.blogspot.com ----------

Similar Threads

  1. Replies: 7
    Last Post: 2007-10-02, 14:59
  2. .3gp file download problem
    By anoopd in forum Symbian Media (Closed)
    Replies: 0
    Last Post: 2005-02-25, 05:53
  3. File too large to download using WAP
    By nlecomte in forum Symbian
    Replies: 0
    Last Post: 2003-04-29, 07:33
  4. nokia 7210 modem via IR doesn't work !
    By oussamaaiadi in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2003-03-06, 10:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×