author | samhuttu |
Mon, 01 Nov 2010 12:37:49 +0200 | |
branch | new development branch with rendering state machine and other goodies |
changeset 38 | 5360b7ddc251 |
parent 0 | 7f85d04be362 |
permissions | -rw-r--r-- |
38
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
1 |
/* |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
2 |
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
3 |
* All rights reserved. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
8 |
* |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
9 |
* Initial Contributors: |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
11 |
* |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
12 |
* Contributors: |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
13 |
* |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
14 |
* Description: Resolver for downloading remote items |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
15 |
* |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
16 |
*/ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
17 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
18 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
19 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
20 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
21 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
22 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
23 |
// INCLUDE FILES |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
24 |
// System |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
25 |
#include <pathinfo.h> |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
26 |
#include <bautils.h> |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
27 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
28 |
// dlnasrv / mediaserver api |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
29 |
#include <upnpobject.h> |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
30 |
#include <upnpitem.h> |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
31 |
#include <upnpelement.h> |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
32 |
#include <upnpattribute.h> // for getting resource protocol info |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
33 |
#include <upnpdlnaprotocolinfo.h> // for resolving object mimetype |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
34 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
35 |
// dlnasrv / avcontroller api |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
36 |
#include "upnpavcontroller.h" // avcontrol services |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
37 |
#include "upnpavdevice.h" // avcontroller device class |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
38 |
#include "upnpavbrowsingsession.h" // avcontrol browsing session |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
39 |
#include "upnpfiledownloadsession.h" // avcontrol download session |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
40 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
41 |
// dlnasrv / avcontroller helper api |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
42 |
#include "upnpconstantdefs.h" // for element names |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
43 |
#include "upnpitemutility.h" // for FindAttributeByName |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
44 |
#include "upnpresourceselector.h" // MUPnPResourceSelector |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
45 |
#include "upnpitemresolverobserver.h" // observer for this class |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
46 |
#include "upnpdlnautility.h" // IsSupportedDlnaProfile |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
47 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
48 |
// dlnasrv / internal api's |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
49 |
#include "upnpcommonutils.h" // for FileExtensionByMimeTypeL |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
50 |
#include "upnpsettingsengine.h" // get selected download location |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
51 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
52 |
// dlnasrv / avcontroller helper internal |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
53 |
#include "upnpremoteitemresolver.h" // remote item resolver impl. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
54 |
#include "upnpdownloaditemresolver.h" // download item resolver impl. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
55 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
56 |
_LIT( KComponentLogfile, "upnpavcontrollerhelper.txt"); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
57 |
#include "upnplog.h" |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
58 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
59 |
// CONSTANTS |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
60 |
_LIT( KTempPrefix, "upnpfwtemp"); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
61 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
62 |
// METHODS |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
63 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
64 |
// -------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
65 |
// CUPnPDownloadItemResolver::NewL |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
66 |
//--------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
67 |
CUPnPDownloadItemResolver* CUPnPDownloadItemResolver::NewL( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
68 |
const TDesC8& aItemId, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
69 |
MUPnPAVController& aAvController, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
70 |
MUPnPAVBrowsingSession& aHostSession, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
71 |
MUPnPResourceSelector& aSelector, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
72 |
const TDesC8& aBrowseFilter ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
73 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
74 |
CUPnPDownloadItemResolver* self = new (ELeave) CUPnPDownloadItemResolver( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
75 |
aItemId, aAvController, aHostSession, aSelector, aBrowseFilter ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
76 |
CleanupStack::PushL( self ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
77 |
self->ConstructL( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
78 |
aItemId, aAvController, aHostSession, aSelector, aBrowseFilter ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
79 |
CleanupStack::Pop( self ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
80 |
return self; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
81 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
82 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
83 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
84 |
// -------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
85 |
// CUPnPDownloadItemResolver::CUPnPDownloadItemResolver |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
86 |
//--------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
87 |
CUPnPDownloadItemResolver::CUPnPDownloadItemResolver( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
88 |
const TDesC8& /*aItemId*/, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
89 |
MUPnPAVController& aAvController, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
90 |
MUPnPAVBrowsingSession& /*aHostSession*/, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
91 |
MUPnPResourceSelector& aSelector, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
92 |
const TDesC8& /*aBrowseFilter*/ ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
93 |
: iAvController( aAvController ), |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
94 |
iState( EStateIdle ),iSelector(aSelector) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
95 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
96 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
97 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
98 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
99 |
// -------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
100 |
// CUPnPDownloadItemResolver::ConstructL |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
101 |
//--------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
102 |
void CUPnPDownloadItemResolver::ConstructL( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
103 |
const TDesC8& aItemId, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
104 |
MUPnPAVController& /*aAvController*/, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
105 |
MUPnPAVBrowsingSession& aHostSession, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
106 |
MUPnPResourceSelector& aSelector, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
107 |
const TDesC8& aBrowseFilter ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
108 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
109 |
iRemoteResolver = CUPnPRemoteItemResolver::NewL( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
110 |
aItemId, aHostSession, aSelector, aBrowseFilter ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
111 |
iRemoteDevice = CUpnpAVDevice::NewL( aHostSession.Device() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
112 |
iSettingsEngine = CUPnPSettingsEngine::NewL(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
113 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
114 |
// Open File Server session |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
115 |
User::LeaveIfError( iFsSession.Connect() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
116 |
User::LeaveIfError( iFsSession.ShareProtected() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
117 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
118 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
119 |
// -------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
120 |
// CUPnPDownloadItemResolver::~CUPnPDownloadItemResolver |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
121 |
//--------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
122 |
CUPnPDownloadItemResolver::~CUPnPDownloadItemResolver() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
123 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
124 |
Cleanup(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
125 |
delete iRemoteResolver; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
126 |
iRemoteResolver = 0; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
127 |
delete iRemoteDevice; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
128 |
iRemoteDevice= 0; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
129 |
delete iSettingsEngine; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
130 |
iSettingsEngine = 0; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
131 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
132 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
133 |
// -------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
134 |
// CUPnPDownloadItemResolver::ResolveL |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
135 |
//--------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
136 |
void CUPnPDownloadItemResolver::ResolveL( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
137 |
MUPnPItemResolverObserver& aObserver, CUpnpAVDevice* /*aDevice*/ ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
138 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
139 |
__LOG( "DownloadItemResolver:Resolve()" ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
140 |
__ASSERTD( iState == EStateIdle, __FILE__, __LINE__ ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
141 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
142 |
// change state |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
143 |
iObserver = &aObserver; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
144 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
145 |
// first resolve the item |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
146 |
iRemoteResolver->ResolveL( *this ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
147 |
iState = EStateResolving; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
148 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
149 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
150 |
// -------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
151 |
// CUPnPDownloadItemResolver::ResolveComplete |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
152 |
//--------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
153 |
void CUPnPDownloadItemResolver::ResolveComplete( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
154 |
const MUPnPItemResolver& /*aResolver*/, TInt aError ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
155 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
156 |
__LOG1( "DownloadItemResolver:ResolveComplete(%d)", aError ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
157 |
__ASSERTD( iState == EStateResolving, __FILE__, __LINE__ ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
158 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
159 |
if ( aError == KErrNone ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
160 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
161 |
TRAP( aError, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
162 |
const CUpnpElement& res = |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
163 |
iSelector.SelectResourceL( iRemoteResolver->Item() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
164 |
IsLocallySupportedL( res ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
165 |
); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
166 |
if( aError ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
167 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
168 |
Complete( aError ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
169 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
170 |
else |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
171 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
172 |
TRAPD( err, InitiateDownloadL() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
173 |
if ( err != KErrNone ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
174 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
175 |
Complete( err ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
176 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
177 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
178 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
179 |
else |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
180 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
181 |
Complete( aError ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
182 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
183 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
184 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
185 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
186 |
// -------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
187 |
// CUPnPDownloadItemResolver::InitiateDownloadL |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
188 |
//--------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
189 |
void CUPnPDownloadItemResolver::InitiateDownloadL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
190 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
191 |
__LOG( "CUPnPDownloadItemResolver::InitiateDownloadL"); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
192 |
// start a download session if not already started |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
193 |
if( !iDownloadSession ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
194 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
195 |
iDownloadSession = |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
196 |
&iAvController.StartDownloadSessionL( *iRemoteDevice ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
197 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
198 |
iDownloadSession->SetObserver( *this ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
199 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
200 |
// Get selected download location. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
201 |
HBufC* copyLocation = GetSelectedDownloadLocationL(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
202 |
CleanupStack::PushL( copyLocation ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
203 |
_LIT(KTempFolder, "temp\\"); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
204 |
// Create temp file name |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
205 |
HBufC* tempFileName = CreateTmpFileNameL(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
206 |
CleanupStack::PushL( tempFileName ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
207 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
208 |
// Create and save full file path. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
209 |
if( iLocalFile ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
210 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
211 |
// delete if already allocated. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
212 |
delete iLocalFile; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
213 |
iLocalFile = 0; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
214 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
215 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
216 |
iLocalFile = HBufC::NewL( copyLocation->Length() + |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
217 |
KTempFolder().Length() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
218 |
iLocalFile->Des().Append( *copyLocation ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
219 |
iLocalFile->Des().Append( KTempFolder ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
220 |
//check the existence of the target folder |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
221 |
if( !BaflUtils::FolderExists( iFsSession, *iLocalFile ) ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
222 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
223 |
User::LeaveIfError( iFsSession.MkDirAll( *iLocalFile ) ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
224 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
225 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
226 |
User::LeaveIfError( iFsSession.SetAtt( *iLocalFile, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
227 |
KEntryAttHidden, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
228 |
KEntryAttNormal ) ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
229 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
230 |
iLocalFile = iLocalFile->ReAllocL( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
231 |
iLocalFile->Length() + tempFileName->Length() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
232 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
233 |
iLocalFile->Des().Append( *tempFileName ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
234 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
235 |
// write the file path into the item |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
236 |
CUpnpElement& writableRes = |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
237 |
const_cast<CUpnpElement&>( iRemoteResolver->Resource() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
238 |
writableRes.SetFilePathL( *iLocalFile ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
239 |
CleanupStack::PopAndDestroy( tempFileName ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
240 |
CleanupStack::PopAndDestroy( copyLocation ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
241 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
242 |
// Create local target file for dowload item |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
243 |
TInt err = CreateRFile( *iLocalFile ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
244 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
245 |
if( err == KErrNone ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
246 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
247 |
__LOG( "StartDownloading..."); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
248 |
// initiate download |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
249 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
250 |
iDownloadSession->StartDownloadL( writableRes, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
251 |
iRemoteResolver->Item(), |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
252 |
iFile, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
253 |
(TInt)this ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
254 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
255 |
iState = EStateDownloading; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
256 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
257 |
else // Create download target failed! |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
258 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
259 |
__LOG( "Create download target failed!"); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
260 |
User::Leave( err ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
261 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
262 |
__LOG( "CUPnPDownloadItemResolver::InitiateDownloadL -End"); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
263 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
264 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
265 |
// -------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
266 |
// CUPnPDownloadItemResolver::TransferStarted |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
267 |
//--------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
268 |
void CUPnPDownloadItemResolver::TransferStarted( TInt /*aKey*/, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
269 |
TInt /*aStatus*/ ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
270 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
271 |
__LOG( "DownloadItemResolver:TransferStarted"); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
272 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
273 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
274 |
// -------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
275 |
// CUPnPDownloadItemResolver::TransferCompleted |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
276 |
//--------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
277 |
void CUPnPDownloadItemResolver::TransferCompleted( TInt /*aKey*/, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
278 |
TInt aStatus, const TDesC& /*aFilePath*/ ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
279 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
280 |
__LOG1( "DownloadItemResolver:TransferCompleted(%d)", aStatus ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
281 |
iFile.Close(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
282 |
Complete( aStatus ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
283 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
284 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
285 |
// -------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
286 |
// CUPnPDownloadItemResolver::TransferProgress |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
287 |
//--------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
288 |
void CUPnPDownloadItemResolver::TransferProgress( TInt /*aKey*/, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
289 |
TInt /*aBytes*/, TInt /*aTotalBytes*/ ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
290 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
291 |
__LOG( "DownloadItemResolver:TransferProgress"); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
292 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
293 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
294 |
// -------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
295 |
// CUPnPDownloadItemResolver::MediaServerDisappeared |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
296 |
//--------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
297 |
void CUPnPDownloadItemResolver::MediaServerDisappeared( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
298 |
TUPnPDeviceDisconnectedReason /*aReason*/ ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
299 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
300 |
__LOG( "DownloadItemResolver:MediaServerDisappeared" ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
301 |
Complete( KErrDisconnected ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
302 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
303 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
304 |
// -------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
305 |
// CUPnPDownloadItemResolver::Item |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
306 |
//--------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
307 |
const CUpnpItem& CUPnPDownloadItemResolver::Item() const |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
308 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
309 |
__ASSERTD( iState == EStateReady, __FILE__, __LINE__ ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
310 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
311 |
return iRemoteResolver->Item(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
312 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
313 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
314 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
315 |
// -------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
316 |
// CUPnPDownloadItemResolver::Resource |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
317 |
//--------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
318 |
const CUpnpElement& CUPnPDownloadItemResolver::Resource() const |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
319 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
320 |
__ASSERTD( iState == EStateReady, __FILE__, __LINE__ ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
321 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
322 |
return iRemoteResolver->Resource(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
323 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
324 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
325 |
// -------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
326 |
// CUPnPDownloadItemResolver::DeleteTempFilesL |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
327 |
// -------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
328 |
EXPORT_C void CUPnPDownloadItemResolver::DeleteTempDownloadFilesL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
329 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
330 |
__LOG("CUPnPDownloadItemResolver::DeleteTempDownloadFilesL begin"); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
331 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
332 |
RFs fs; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
333 |
User::LeaveIfError( fs.Connect() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
334 |
CleanupClosePushL( fs ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
335 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
336 |
CFileMan* fileMan = CFileMan::NewL( fs ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
337 |
CleanupStack::PushL( fileMan ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
338 |
_LIT( KAnyChar, "*"); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
339 |
_LIT( KAnyExtension, "*.*"); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
340 |
_LIT( KUpnpUploadTempDirectory, "temp\\" ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
341 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
342 |
// clean selected download directory |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
343 |
HBufC* path = HBufC::NewLC( KMaxFileName ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
344 |
CUPnPSettingsEngine* settingsEngine = CUPnPSettingsEngine::NewL(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
345 |
CleanupStack::PushL( settingsEngine ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
346 |
HBufC* copyLocation = HBufC::NewL( KMaxFileName ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
347 |
CleanupStack::PushL( copyLocation ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
348 |
TBool copyLocationIsPhoneMemory = 0; // not used in this case |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
349 |
TPtr copyLocationPtr( copyLocation->Des() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
350 |
settingsEngine->GetCopyLocationL( copyLocationPtr, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
351 |
copyLocationIsPhoneMemory ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
352 |
path->Des().Append( *copyLocation ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
353 |
path->Des().Append( KAnyChar ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
354 |
path->Des().Append( KTempPrefix ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
355 |
path->Des().Append( KAnyExtension ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
356 |
fileMan->Delete( *path ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
357 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
358 |
path->Des().Zero(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
359 |
path->Des().Append( *copyLocation ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
360 |
path->Des().Append( KUpnpUploadTempDirectory ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
361 |
path->Des().Append( KAnyExtension ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
362 |
fileMan->Delete( *path ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
363 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
364 |
CleanupStack::PopAndDestroy( copyLocation ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
365 |
CleanupStack::PopAndDestroy( settingsEngine ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
366 |
CleanupStack::PopAndDestroy( path ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
367 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
368 |
CleanupStack::PopAndDestroy( fileMan ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
369 |
CleanupStack::PopAndDestroy( &fs ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
370 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
371 |
__LOG("CUPnPDownloadItemResolver::DeleteTempDownloadFilesL End"); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
372 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
373 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
374 |
// -------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
375 |
// CUPnPDownloadItemResolver::Complete |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
376 |
//--------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
377 |
void CUPnPDownloadItemResolver::Complete( TInt aError ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
378 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
379 |
__ASSERTD( iState == EStateResolving || iState == EStateDownloading, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
380 |
__FILE__, __LINE__ ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
381 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
382 |
if ( iDownloadSession != 0 ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
383 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
384 |
iAvController.StopDownloadSession( *iDownloadSession ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
385 |
iDownloadSession = 0; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
386 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
387 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
388 |
MUPnPItemResolverObserver& observer = *iObserver; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
389 |
iObserver = 0; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
390 |
if ( aError == KErrNone ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
391 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
392 |
iState = EStateReady; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
393 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
394 |
else |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
395 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
396 |
iState = EStateIdle; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
397 |
Cleanup(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
398 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
399 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
400 |
observer.ResolveComplete( *this, aError ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
401 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
402 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
403 |
// -------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
404 |
// CUPnPDownloadItemResolver::Cleanup |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
405 |
//--------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
406 |
void CUPnPDownloadItemResolver::Cleanup() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
407 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
408 |
iObserver = 0; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
409 |
iFile.Close(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
410 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
411 |
if ( iDownloadSession != 0 ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
412 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
413 |
iAvController.StopDownloadSession( *iDownloadSession ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
414 |
iDownloadSession = 0; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
415 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
416 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
417 |
if ( iLocalFile ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
418 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
419 |
// delete the local file |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
420 |
iFsSession.Delete( iLocalFile->Des() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
421 |
__LOG1( "DownloadItemResolver: deleted local file(%d)", iLocalFile ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
422 |
delete iLocalFile; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
423 |
iLocalFile = 0; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
424 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
425 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
426 |
iFsSession.Close(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
427 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
428 |
iState = EStateIdle; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
429 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
430 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
431 |
// -------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
432 |
// CUPnPDownloadItemResolver::CreateTmpFileNameL |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
433 |
//--------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
434 |
HBufC* CUPnPDownloadItemResolver::CreateTmpFileNameL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
435 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
436 |
__LOG( "DownloadItemResolver::CreateTmpFileName" ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
437 |
__ASSERTD( iState == EStateResolving, __FILE__, __LINE__ ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
438 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
439 |
HBufC* tempfilename = NULL; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
440 |
HBufC* fileExt = NULL; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
441 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
442 |
// Get file extension |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
443 |
const CUpnpAttribute* attr = UPnPItemUtility |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
444 |
::FindAttributeByName( iRemoteResolver->Resource(), |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
445 |
KAttributeProtocolInfo ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
446 |
if ( attr != 0 ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
447 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
448 |
CUpnpDlnaProtocolInfo* pInfo = |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
449 |
CUpnpDlnaProtocolInfo::NewL( attr->Value() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
450 |
CleanupStack::PushL( pInfo ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
451 |
fileExt = UPnPCommonUtils::FileExtensionByMimeTypeL( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
452 |
pInfo->ThirdField() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
453 |
CleanupStack::PopAndDestroy( pInfo ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
454 |
pInfo = NULL; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
455 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
456 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
457 |
// If file extension exist create whole file name. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
458 |
if( fileExt ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
459 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
460 |
CleanupStack::PushL( fileExt ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
461 |
tempfilename = HBufC::NewL( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
462 |
KTempPrefix().Length() + |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
463 |
iRemoteResolver->Item().Id().Length() + |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
464 |
fileExt->Length() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
465 |
CleanupStack::PushL( tempfilename ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
466 |
// Add prefix |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
467 |
tempfilename->Des().Append( KTempPrefix ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
468 |
// Add item name. Convert 8 to 16 and replace illeagal characters. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
469 |
HBufC8* tmpItemName8 = |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
470 |
UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
471 |
iRemoteResolver->Item().Id() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
472 |
CleanupStack::PushL( tmpItemName8 ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
473 |
HBufC* itemname = HBufC::NewL( tmpItemName8->Length() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
474 |
CleanupStack::PushL( itemname ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
475 |
itemname->Des().Copy( *tmpItemName8 ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
476 |
tempfilename->Des().Append( *itemname ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
477 |
CleanupStack::PopAndDestroy( itemname ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
478 |
CleanupStack::PopAndDestroy( tmpItemName8 ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
479 |
// Add file extension |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
480 |
tempfilename->Des().Append( *fileExt ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
481 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
482 |
CleanupStack::Pop( tempfilename ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
483 |
CleanupStack::PopAndDestroy( fileExt ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
484 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
485 |
else // Create without file extension |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
486 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
487 |
tempfilename = HBufC::NewL( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
488 |
KTempPrefix().Length() + iRemoteResolver->Item().Id().Length() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
489 |
CleanupStack::PushL( tempfilename ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
490 |
// Add prefix |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
491 |
tempfilename->Des().Append( KTempPrefix ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
492 |
// Add item name. Convert 8 to 16 and replace illeagal characters. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
493 |
HBufC8* tmpItemName8 = |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
494 |
UPnPCommonUtils::ReplaceIllegalFilenameCharactersL( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
495 |
iRemoteResolver->Item().Id() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
496 |
CleanupStack::PushL( tmpItemName8 ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
497 |
HBufC* itemname = HBufC::NewL( tmpItemName8->Length() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
498 |
CleanupStack::PushL( itemname ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
499 |
itemname->Des().Copy( *tmpItemName8 ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
500 |
tempfilename->Des().Append( *itemname ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
501 |
CleanupStack::PopAndDestroy( itemname ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
502 |
CleanupStack::PopAndDestroy( tmpItemName8 ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
503 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
504 |
CleanupStack::Pop( tempfilename ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
505 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
506 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
507 |
return tempfilename; //transfer ownership |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
508 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
509 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
510 |
// -------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
511 |
// CUPnPDownloadItemResolver::GetSelectedDownloadLocationL |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
512 |
//--------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
513 |
HBufC* CUPnPDownloadItemResolver::GetSelectedDownloadLocationL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
514 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
515 |
__LOG( "DownloadItemResolver::GetSelectedDownloadLocationL" ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
516 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
517 |
HBufC* copyLocation = HBufC::NewL( KMaxFileName ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
518 |
CleanupStack::PushL( copyLocation ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
519 |
TBool copyLocationIsPhoneMemory = 0; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
520 |
TPtr copyLocationPtr( copyLocation->Des() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
521 |
TRAPD( error, iSettingsEngine->GetCopyLocationL( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
522 |
copyLocationPtr, copyLocationIsPhoneMemory ) ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
523 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
524 |
// Something wrong in getting copy location. Default to |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
525 |
// phone memory. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
526 |
if( error != KErrNone ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
527 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
528 |
TPtrC phoneDrive( PathInfo::PhoneMemoryRootPath() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
529 |
copyLocation->Des().Append( phoneDrive ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
530 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
531 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
532 |
CleanupStack::Pop( copyLocation ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
533 |
return copyLocation; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
534 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
535 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
536 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
537 |
// CUPnPDownloadItemResolver::CreateRFile |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
538 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
539 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
540 |
TInt CUPnPDownloadItemResolver::CreateRFile( const TDesC& aFilePath ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
541 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
542 |
__LOG( "DownloadItemResolver::CreateRFile" ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
543 |
iFile.Close(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
544 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
545 |
// In some special case, the function Replace() will fail |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
546 |
// with error -14(KErrInUse) by using 'EFileWrite' mode. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
547 |
// Maybe some other handler does not close the file. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
548 |
TInt err = iFile.Replace( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
549 |
iFsSession, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
550 |
aFilePath, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
551 |
EFileShareReadersOrWriters ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
552 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
553 |
if( KErrPathNotFound == err ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
554 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
555 |
__LOG( "Directory not available -> create new" ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
556 |
iFsSession.MkDirAll( aFilePath ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
557 |
err = iFile.Create( iFsSession, aFilePath, EFileWrite ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
558 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
559 |
return err; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
560 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
561 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
562 |
// -------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
563 |
// CUPnPDownloadItemResolver::IsLocallySupportedL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
564 |
// Check if the audio is DLNA supported in remote to local playback |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
565 |
// -------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
566 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
567 |
void CUPnPDownloadItemResolver::IsLocallySupportedL( const CUpnpElement& aRes ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
568 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
569 |
const CUpnpAttribute* attr = |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
570 |
&UPnPItemUtility::FindAttributeByNameL( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
571 |
aRes, KAttributeProtocolInfo ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
572 |
// parse protocol info |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
573 |
CUpnpDlnaProtocolInfo* pInfo = NULL; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
574 |
pInfo = CUpnpDlnaProtocolInfo::NewL( attr->Value() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
575 |
CleanupStack::PushL(pInfo); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
576 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
577 |
//if DLNA compliant item |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
578 |
if ( pInfo->PnParameter() != KNullDesC8() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
579 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
580 |
if( !UPnPDlnaUtility::IsSupportedDlnaProfile( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
581 |
pInfo->PnParameter() ) ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
582 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
583 |
User::Leave(KErrNotSupported); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
584 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
585 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
586 |
else //if not, check MIME type |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
587 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
588 |
if( !UPnPDlnaUtility::IsSupportedMimeType( pInfo->ThirdField() ) ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
589 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
590 |
User::Leave(KErrNotSupported); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
591 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
592 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
593 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
594 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
595 |
CleanupStack::PopAndDestroy(pInfo); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
596 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
597 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
598 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
0
diff
changeset
|
599 |