|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: File tranfer session |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 #ifndef C_UPNPFILEUPLOADSESSIONIMPL_H |
|
24 #define C_UPNPFILEUPLOADSESSIONIMPL_H |
|
25 |
|
26 // INCLUDES |
|
27 #include <e32base.h> |
|
28 #include "upnpfileuploadsession.h" |
|
29 #include "upnpavdeviceobserver.h" |
|
30 |
|
31 #include "tupnpfiletransferevent.h" |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class RUPnPAVControllerClient; |
|
35 class CUpnpAVDevice; |
|
36 class MUPnPFileTransferSessionObserver; |
|
37 |
|
38 // CLASS DECLARATION |
|
39 /** |
|
40 * AV Controller file upload session client-side implementation. |
|
41 * |
|
42 * |
|
43 * @lib upnpavcontrollerclient.lib |
|
44 * @since S60 v3.2 |
|
45 */ |
|
46 NONSHARABLE_CLASS( CUPnPFileUploadSessionImpl ) : |
|
47 public CActive, |
|
48 public MUPnPFileUploadSession, |
|
49 public MUPnPAVDeviceObserver |
|
50 { |
|
51 public: |
|
52 |
|
53 /** |
|
54 * 1st phase construct |
|
55 * |
|
56 * @param aServer a handle to AV Controller server |
|
57 * @param aDevice target device |
|
58 * @return new instance |
|
59 */ |
|
60 static CUPnPFileUploadSessionImpl* NewL( |
|
61 RUPnPAVControllerClient& aServer, const CUpnpAVDevice& aDevice ); |
|
62 |
|
63 /** |
|
64 * Destructor |
|
65 */ |
|
66 ~CUPnPFileUploadSessionImpl(); |
|
67 |
|
68 private: |
|
69 |
|
70 /** |
|
71 * Private constructor |
|
72 * |
|
73 * @param aServer a handle to AV Controller server |
|
74 */ |
|
75 CUPnPFileUploadSessionImpl( RUPnPAVControllerClient& aServer ); |
|
76 |
|
77 /** |
|
78 * 2nd phase constructor |
|
79 */ |
|
80 void ConstructL(); |
|
81 |
|
82 private: // From CActive |
|
83 |
|
84 /** |
|
85 * See e32base.h |
|
86 */ |
|
87 void RunL(); |
|
88 /** |
|
89 * See e32base.h |
|
90 */ |
|
91 |
|
92 void DoCancel(); |
|
93 |
|
94 /** |
|
95 * See e32base.h |
|
96 */ |
|
97 TInt RunError( TInt aError ); |
|
98 |
|
99 public: // From MUPnPFileUploadSession |
|
100 |
|
101 /** |
|
102 * See upnpfileuploadsession.h |
|
103 */ |
|
104 void StartUploadL( const TDesC& aFilePath, TInt aKey ); |
|
105 |
|
106 public: // From MUPnPFileTransferSession |
|
107 |
|
108 /** |
|
109 * See upnpfiletransfersession.h |
|
110 */ |
|
111 void SetObserver( MUPnPFileTransferSessionObserver& aObserver ); |
|
112 |
|
113 /** |
|
114 * See upnpfiletransfersession.h |
|
115 */ |
|
116 void RemoveObserver(); |
|
117 |
|
118 /** |
|
119 * See upnpfiletransfersession.h |
|
120 */ |
|
121 MUPnPFileTransferSessionObserver* Observer() const; |
|
122 |
|
123 /** |
|
124 * See upnpfiletransfersession.h |
|
125 */ |
|
126 void StartTrackingProgressL( TInt aKey ); |
|
127 |
|
128 /** |
|
129 * See upnpfiletransfersession.h |
|
130 */ |
|
131 void CancelTransfer( TInt aKey ); |
|
132 |
|
133 /** |
|
134 * See upnpfiletransfersession.h |
|
135 */ |
|
136 void CancelAllTransfers(); |
|
137 |
|
138 public: // From MUPnPAVDeviceObserver |
|
139 |
|
140 /** |
|
141 * See upnpavdeviceobserver.h |
|
142 */ |
|
143 void UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice ); |
|
144 |
|
145 /** |
|
146 * See upnpavdeviceobserver.h |
|
147 */ |
|
148 void UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice ); |
|
149 |
|
150 /** |
|
151 * See upnpavdeviceobserver.h |
|
152 */ |
|
153 void WLANConnectionLost(); |
|
154 |
|
155 public: // New methods |
|
156 |
|
157 /** |
|
158 * Returns device |
|
159 * |
|
160 * @return device |
|
161 */ |
|
162 const CUpnpAVDevice& Device() const; |
|
163 |
|
164 private: |
|
165 |
|
166 /** |
|
167 * Reset |
|
168 */ |
|
169 void ResetL(); |
|
170 |
|
171 private: |
|
172 |
|
173 /** |
|
174 * Filetransfer observer |
|
175 * |
|
176 * Not owned |
|
177 */ |
|
178 MUPnPFileTransferSessionObserver* iObserver; |
|
179 |
|
180 /** |
|
181 * AV Controller server client handle |
|
182 * |
|
183 * Not owned |
|
184 */ |
|
185 RUPnPAVControllerClient& iServer; |
|
186 |
|
187 /** |
|
188 * Source device |
|
189 * |
|
190 * Owned |
|
191 */ |
|
192 CUpnpAVDevice* iDevice; |
|
193 |
|
194 /** |
|
195 * Buffer to pass data to the server process |
|
196 * |
|
197 * Owned |
|
198 */ |
|
199 HBufC8* iBuffer; |
|
200 |
|
201 /** |
|
202 * Modifiable pointer to data the buffer |
|
203 */ |
|
204 TPtr8 iBufferPtr; |
|
205 |
|
206 /** |
|
207 * Flag to store the state of WLAN |
|
208 */ |
|
209 TBool iAlive; |
|
210 |
|
211 /** |
|
212 * Filetransfer event. Used to receive events from the server process |
|
213 */ |
|
214 TUpnpFileTransferEvent iEvent; |
|
215 |
|
216 /** |
|
217 * Package buffer used in client-server comms |
|
218 */ |
|
219 TPckg<TUpnpFileTransferEvent> iEventPkg; |
|
220 }; |
|
221 |
|
222 #endif // C_UPNPFILEUPLOADSESSIONIMPL_H |
|
223 |
|
224 // End of file |