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: Plays remote images on a renderer |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CUPNPIMAGEPLAYER_H |
|
20 #define C_CUPNPIMAGEPLAYER_H |
|
21 |
|
22 |
|
23 #include <e32base.h> |
|
24 |
|
25 #include <s32mem.h> |
|
26 #include "upnpavrenderingsessionobserver.h" |
|
27 #include "upnpcommonui.h" |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class MUPnPAVController; |
|
31 class MUPnPAVRenderingSession; |
|
32 class CUpnpAVDevice; |
|
33 class CUpnpObject; |
|
34 class MUPnPDeviceObserver; |
|
35 class CUPnPCommonUI; |
|
36 |
|
37 |
|
38 // CLASS DECLARATION |
|
39 |
|
40 /** |
|
41 * UPnP AV Controller callback dispatcher |
|
42 * |
|
43 * |
|
44 * @lib - |
|
45 * @since Series 60 3.1 |
|
46 */ |
|
47 |
|
48 NONSHARABLE_CLASS( CUpnpImagePlayer ) : public CBase, |
|
49 public MUPnPAVRenderingSessionObserver |
|
50 { |
|
51 |
|
52 private: |
|
53 /** |
|
54 * Defines the image playing state |
|
55 */ |
|
56 enum TPendingOperation |
|
57 { |
|
58 EImageIdle = 0, //when no action on image has been set |
|
59 EImageInitialising, //image uri has been set, callback not called |
|
60 EImageShowing, //image play has been set, callback not called |
|
61 EImageNext //another image is acting when the previous |
|
62 //one's action has not been completed |
|
63 }; |
|
64 |
|
65 public: // Constructors and destructor |
|
66 |
|
67 static CUpnpImagePlayer* NewL( MUPnPAVController& aAVControl, |
|
68 MUPnPDeviceObserver& aDialog, |
|
69 CUPnPCommonUI& aCommonUI ); |
|
70 |
|
71 /** |
|
72 * Destructor. |
|
73 */ |
|
74 virtual ~CUpnpImagePlayer(); |
|
75 |
|
76 public: |
|
77 |
|
78 /** |
|
79 * Set the renderer to show the image |
|
80 * @since Series 60 3.1 |
|
81 * @param aTargetDevice the selected renderer to show the image |
|
82 * @return none |
|
83 */ |
|
84 void SetTargetDeviceL(const CUpnpAVDevice& aTargetDevice); |
|
85 |
|
86 /** |
|
87 * Show the image |
|
88 * @since Series 60 3.1 |
|
89 * @param the image to be shown |
|
90 * @return none |
|
91 */ |
|
92 void PlayL(const CUpnpObject& aItem); |
|
93 |
|
94 /** |
|
95 * Stop showing the image |
|
96 * @since Series 60 3.1 |
|
97 * @param none; |
|
98 * @return none |
|
99 */ |
|
100 void Stop(); |
|
101 |
|
102 |
|
103 protected: //Functions from MUPnPAVRenderingSessionObserver |
|
104 |
|
105 /** |
|
106 * UPnP AV Controller calls this method to return the result for the |
|
107 * 'get volume' request. Parameter contains the volume level of the |
|
108 * media renderer device to which the 'get volume' request was sent. |
|
109 * |
|
110 * @since Series 60 3.1 |
|
111 * @param aError error code |
|
112 * @param aVolumeLevel TInt volume level (between 0 - 100) |
|
113 * @param aActionResponse EFalse if caused by pressing hardware key |
|
114 * ETrue if caused by rendering session |
|
115 * @return None |
|
116 */ |
|
117 void VolumeResult( TInt /*aError*/, TInt /*aVolumeLevel*/, |
|
118 TBool /*aActionResponse*/ ){}; |
|
119 |
|
120 /** |
|
121 * UPnP AV Controller calls this method to return the result for the |
|
122 * 'get mute' request. Parameter contains the state of the mute of the |
|
123 * media renderer device to which the 'get mute' request was sent. |
|
124 * |
|
125 * @since Series 60 3.1 |
|
126 * @param aError error code |
|
127 * @param aMute TBool the state of the mute (ETrue or EFalse) |
|
128 * @param aActionResponse EFalse if caused by pressing hardware key |
|
129 * ETrue if caused by rendering session |
|
130 * @return None |
|
131 */ |
|
132 void MuteResult( TInt /*aError*/, TBool /*aMute*/, |
|
133 TBool /*aActionResponse*/ ){}; |
|
134 |
|
135 /** |
|
136 * UPnP AV Controller calls this method to indicate that the |
|
137 * requested interaction operation (play, stop, etc.) is complete. |
|
138 * In other words, the target rendering device has changed it's |
|
139 * state accordingly. |
|
140 * |
|
141 * @since Series 60 3.1 |
|
142 * @param aErrorCode TInt error code |
|
143 * @param aOperation TInt operation (TAVInteractOperation) |
|
144 * @return None |
|
145 */ |
|
146 void InteractOperationComplete( |
|
147 TInt aError, |
|
148 TUPnPAVInteractOperation aOperation |
|
149 ); |
|
150 |
|
151 /** |
|
152 * UPnP AV Controller calls this method as a response to Position |
|
153 * Info action. The current position and the total length of the |
|
154 * track that is currently playing is returned. The results are in |
|
155 * (hh:mm:ss) format. |
|
156 * |
|
157 * UPnPAVController releases the memory allocated for aTrackPosition |
|
158 * and aTrackLength. |
|
159 * |
|
160 * @since Series 60 3.0 |
|
161 * @param aStatus TInt error code |
|
162 * @param aTrackPosition TDesC8& track position |
|
163 * @param aTrackLength TDesC8& track length |
|
164 * @return None |
|
165 */ |
|
166 void PositionInfoResult( |
|
167 TInt /*aError*/, |
|
168 const TDesC8& /*aTrackPosition*/, |
|
169 const TDesC8& /*aTrackLength*/ |
|
170 ){}; |
|
171 |
|
172 /** |
|
173 * UPnP AV Controller calls this method to return the result for the |
|
174 * 'set uri' request. |
|
175 * |
|
176 * @since Series 60 3.1 |
|
177 * @param aError error code |
|
178 * @return None |
|
179 */ |
|
180 void SetURIResult( TInt aError ); |
|
181 |
|
182 /** |
|
183 * UPnP AV Controller calls this method to return the result for the |
|
184 * 'set next uri' request. |
|
185 * |
|
186 * @since Series 60 3.1 |
|
187 * @param aError error code |
|
188 * @return None |
|
189 */ |
|
190 void SetNextURIResult( TInt /*aError*/){}; |
|
191 |
|
192 /** |
|
193 * Notifies that the Media Renderer we have a session with has |
|
194 * disappeared. Session is now unusable and must be closed. |
|
195 * |
|
196 * @since Series 60 3.1 |
|
197 * @return None |
|
198 */ |
|
199 void MediaRendererDisappeared( |
|
200 TUPnPDeviceDisconnectedReason aReason ); |
|
201 |
|
202 /** |
|
203 * Notifies that the Local Media Server has been put on sharing state |
|
204 * |
|
205 * @since Series 60 3.1 |
|
206 * @param aReason reason code |
|
207 * @return None |
|
208 */ |
|
209 void ReserveLocalMSServicesCompleted( TInt /*aError*/ ){}; |
|
210 |
|
211 private: |
|
212 |
|
213 /** |
|
214 * C++ default constructor. |
|
215 */ |
|
216 CUpnpImagePlayer( MUPnPAVController& aAVControl, |
|
217 MUPnPDeviceObserver& aDialog, |
|
218 CUPnPCommonUI& aCommonUI ); |
|
219 /** |
|
220 * By default Symbian 2nd phase constructor is private. |
|
221 */ |
|
222 void ConstructL(); |
|
223 |
|
224 private: |
|
225 |
|
226 /** |
|
227 * UPnP AV Controller calls this method to indicate that the |
|
228 * requested interaction operation (play, stop, etc.) is complete. |
|
229 * In other words, the target rendering device has changed it's |
|
230 * state accordingly. |
|
231 * |
|
232 * @since Series 60 3.1 |
|
233 * @param aErrorCode TInt error code |
|
234 * @param aOperation TInt operation (TAVInteractOperation) |
|
235 * @return None |
|
236 */ |
|
237 void InteractOperationCompleteL( |
|
238 TInt aError, |
|
239 TUPnPAVInteractOperation aOperation |
|
240 ); |
|
241 |
|
242 /** |
|
243 * UPnP AV Controller calls this method to return the result for the |
|
244 * 'set uri' request. |
|
245 * |
|
246 * @since Series 60 3.1 |
|
247 * @param aError error code |
|
248 * @return None |
|
249 */ |
|
250 void SetURIResultL( TInt aError ); |
|
251 |
|
252 private: |
|
253 |
|
254 MUPnPAVRenderingSession* iRendSession; //owned |
|
255 MUPnPAVController& iAVControl; //not owned |
|
256 const CUpnpAVDevice* iTargetDevice; //not owned |
|
257 |
|
258 TPendingOperation iImageState; |
|
259 |
|
260 HBufC8* iUri; //OWNED |
|
261 |
|
262 const CUpnpItem* iItem; //not owned |
|
263 |
|
264 MUPnPDeviceObserver& iDialog; //not owned |
|
265 |
|
266 CUPnPCommonUI& iCommonUI; //Not owned |
|
267 |
|
268 TBool iFirstStart; |
|
269 |
|
270 CUPnPCommonUI::TUPnPAction iAction; |
|
271 }; |
|
272 |
|
273 |
|
274 #endif // C_CUPNPIMAGEPLAYER_H |
|