|
1 /* |
|
2 * Copyright (c) 2005 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: Subsession for image handler. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CPHSRVSUBSESSIONIMAGEHANDLER_H |
|
19 #define CPHSRVSUBSESSIONIMAGEHANDLER_H |
|
20 |
|
21 // INCLUDES |
|
22 #include "CPhSrvSubSessionBase.h" |
|
23 #include "cphsrvimagesaver.h" |
|
24 #include "mphsrvimagesaverobserver.h" |
|
25 #include <CPhCltBaseImageParams.h> |
|
26 #include <bautils.h> |
|
27 #include <fbs.h> |
|
28 #include <PhoneClientServerDomainPStypes.h> |
|
29 #include <PhoneClientServerDomainPSkeys.h> |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * Image handler Subsession. |
|
35 * |
|
36 * @since Series60 3.0 |
|
37 */ |
|
38 class CPhSrvSubSessionImageHandler |
|
39 : public CPhSrvSubSessionBase, public MPhSrvImageSaverObserver |
|
40 { |
|
41 NONSHARABLE_CLASS( CPhSrvOperatorLogoContainer ) : public CBase |
|
42 { |
|
43 public: // Constructors and destructor |
|
44 |
|
45 /** |
|
46 * Destructor. |
|
47 */ |
|
48 ~CPhSrvOperatorLogoContainer(); |
|
49 |
|
50 /** |
|
51 * Constructor. |
|
52 * @param aCountryCode country code for operator logo |
|
53 * @param aNetworkCode network code for operator logo |
|
54 * @param aBitmap bitmap to store. |
|
55 */ |
|
56 CPhSrvOperatorLogoContainer( |
|
57 const TPhCltCountryCode aCountryCode, |
|
58 const TPhCltNetworkCode aNetworkCode, |
|
59 const TPhCltExtOperatorLogoType aLogoType, |
|
60 CFbsBitmap* aBitmap ); |
|
61 |
|
62 // Stored image. |
|
63 CFbsBitmap* iBitmap; |
|
64 |
|
65 // Operator logo country code. |
|
66 TPhCltCountryCode iCountryCode; |
|
67 |
|
68 // Operator logo network code. |
|
69 TPhCltNetworkCode iNetworkCode; |
|
70 |
|
71 // Operator logo type. |
|
72 TPhCltExtOperatorLogoType iLogoType; |
|
73 }; |
|
74 |
|
75 public: // Constructors and destructor |
|
76 |
|
77 /** |
|
78 * Two-phased constructor. |
|
79 * |
|
80 * @param aSession The pre-opened Phone Server session. |
|
81 * @return CPhSrvSubSessionImageHandler subsession. |
|
82 */ |
|
83 static CPhSrvSubSessionBase* NewL(CPhSrvSession& aSession ); |
|
84 |
|
85 /** |
|
86 * Destructor. |
|
87 * |
|
88 */ |
|
89 ~CPhSrvSubSessionImageHandler(); |
|
90 |
|
91 public: // from MPhSrvImageSaverObserver |
|
92 /** |
|
93 * @see MPhSrvImageSaverObserver::ImageSaved |
|
94 */ |
|
95 virtual void ImageSaved( TInt aResult ); |
|
96 |
|
97 private: // Functions from base classes. |
|
98 |
|
99 /** |
|
100 * @see MPhSrvMessageDecoder |
|
101 */ |
|
102 TBool PhSrvMessageDecoderCanProcessMessage( TInt aFunction ); |
|
103 |
|
104 /** |
|
105 * @see MPhSrvMessageProcessor |
|
106 */ |
|
107 void PhSrvMessageProcessorHandleMessageL( const RMessage2& aMessage ); |
|
108 |
|
109 private: // SubSession function handlers. |
|
110 |
|
111 /** |
|
112 * Handle the close command. |
|
113 * |
|
114 * @param aMessage The received message. |
|
115 */ |
|
116 void CmdSubSessionClose( const RMessage2& aMessage ); |
|
117 |
|
118 /** |
|
119 * Handle the save command. |
|
120 * |
|
121 * @param aMessage The received message. |
|
122 */ |
|
123 void CmdSubSessionSaveImagesL( const RMessage2& aMessage ); |
|
124 |
|
125 /** |
|
126 * Handle the load command. |
|
127 * |
|
128 * @param aMessage The received message. |
|
129 */ |
|
130 void CmdSubSessionLoadImagesL( const RMessage2& aMessage ); |
|
131 |
|
132 /** |
|
133 * Open default VT image file and transfer handle to client. |
|
134 */ |
|
135 void CmdSubSessionOpenDefaultVtImageL( const RMessage2& aMessage ); |
|
136 |
|
137 /** |
|
138 * Resolve default VT image file name. |
|
139 */ |
|
140 TInt ResolveDefaultVtImageFileName( TDes& aFileName ); |
|
141 |
|
142 /** |
|
143 * Saves user defined VT image |
|
144 */ |
|
145 void CmdSubSessionSaveVtImageL( const RMessage2& aMessage ); |
|
146 |
|
147 /** |
|
148 * Complete the load command. |
|
149 * |
|
150 * @param aMessage The received message. |
|
151 */ |
|
152 void CmdSubSessionCommitLoadL( const RMessage2& aMessage ); |
|
153 |
|
154 private: // New functions. |
|
155 |
|
156 /** |
|
157 * Updates Publish & Subscribe information with an event |
|
158 * happened to a operator logo. |
|
159 * @param aCountryCode country code for a logo |
|
160 * @param aNetworkCode network code for a logo |
|
161 * @param aEvent event that occurred |
|
162 * @return Symbian error code. |
|
163 */ |
|
164 TInt NotifyListeners( |
|
165 const TPhCltCountryCode aCountryCode, |
|
166 const TPhCltNetworkCode aNetworkCode, |
|
167 const |
|
168 TTelephonyOTALogoUpdate::TPSOperatorLogoUpdateEvent aEvent ); |
|
169 |
|
170 /** |
|
171 * Updates Publish & Subscribe information with an event |
|
172 * happened to a operator logo. |
|
173 * @param aCountryCode country code for a logo |
|
174 * @param aNetworkCode network code for a logo |
|
175 * @param aEvent event that occurred |
|
176 * @return Symbian error code. |
|
177 */ |
|
178 TInt NotifyListeners( |
|
179 const TPhCltCountryCode aCountryCode, |
|
180 const TPhCltNetworkCode aNetworkCode, |
|
181 const |
|
182 TTelOTALogoUpdate::TPSOperatorLogoUpdateEvent aEvent ); |
|
183 |
|
184 /** |
|
185 * Parses operator logo file name and path. |
|
186 * @param aCountryCode country code to use in deletion |
|
187 * @param aNetworkCode network code to use in deletion |
|
188 * @param aLogoType type of logo to delete |
|
189 * @param aFileName file name in return |
|
190 */ |
|
191 void ConstructLogoFileNameL( |
|
192 const TPhCltCountryCode aCountryCode, |
|
193 const TPhCltNetworkCode aNetworkCode, |
|
194 const TPhCltExtOperatorLogoType aLogoType, |
|
195 TDes& aFileName ); |
|
196 |
|
197 /** |
|
198 * Converts given logo type to file name id. |
|
199 * @param aLogoType logo type to convert' |
|
200 * @param aType type in return |
|
201 */ |
|
202 void AppendLogoTypeAsTextL( |
|
203 const TPhCltExtOperatorLogoType aLogoType, TDes& aType ); |
|
204 |
|
205 /** |
|
206 * Checks logo deletion and deletes if needed. |
|
207 * @param aCountryCode country code to use in deletion |
|
208 * @param aNetworkCode network code to use in deletion |
|
209 * @param aLogoType type of logo to delete |
|
210 * @param aFileHandle file handle to be checked |
|
211 * @return ETrue if deleted |
|
212 */ |
|
213 TBool DeleteLogoL( |
|
214 const TPhCltCountryCode aCountryCode, |
|
215 const TPhCltNetworkCode aNetworkCode, |
|
216 const TPhCltExtOperatorLogoType aLogoType, |
|
217 const TInt aFileHandle ); |
|
218 |
|
219 |
|
220 /** |
|
221 * Does saving of video telephony images. |
|
222 * |
|
223 * @param aImages Image handle array. |
|
224 */ |
|
225 void DoSaveVTImageL( TPhCltImageArray& aImages ); |
|
226 |
|
227 /** |
|
228 * Loads a video telephony image from file. |
|
229 * @param aImages image handle array to return. |
|
230 */ |
|
231 void DoLoadVTImagesL( TPhCltImageArray& aImages ); |
|
232 |
|
233 /** |
|
234 * Reads video telephony images from private path. |
|
235 * @param aDefaultImage ETrue reads default image |
|
236 * EFalse reads user defined image |
|
237 */ |
|
238 void DoReadVTImagesL( const TBool aDefaultImage ); |
|
239 |
|
240 /** |
|
241 * Constructs search path for VT still/default image. |
|
242 * It contains image name with wild card. |
|
243 * @param aDefaultImage ETrue path for default image |
|
244 * EFalse path for still image |
|
245 * @param aPath returns plain drive+path w/o wild cards |
|
246 * @return search path |
|
247 */ |
|
248 HBufC* ConstructVTImageSearchPathLC( |
|
249 const TBool aDefaultImage, |
|
250 TPtrC& aPath ) const; |
|
251 |
|
252 /** |
|
253 * Does saving of operator logos. |
|
254 * |
|
255 * @param aImages Image handle array. |
|
256 */ |
|
257 void DoSaveOperatorLogoL( TPhCltImageArray& aImages ); |
|
258 |
|
259 /** |
|
260 * Loads operator logo image from file. |
|
261 * @param aImages image handle array to return. |
|
262 */ |
|
263 void DoLoadOperatorLogoL( TPhCltImageArray& aImages ); |
|
264 |
|
265 /** |
|
266 * Completes operator logo loading, and releases resources. |
|
267 * @param aImages image handle array. |
|
268 */ |
|
269 void DoCommitLoadLogo( TPhCltImageArray& aImages ); |
|
270 |
|
271 /** |
|
272 * Completes vt image loading, and releases resources. |
|
273 */ |
|
274 void DoCommitLoadVTL(); |
|
275 |
|
276 /** |
|
277 * Creates image storage directory. |
|
278 */ |
|
279 void MakeImageDirL(); |
|
280 |
|
281 private: |
|
282 |
|
283 /** |
|
284 * Constructor. |
|
285 * |
|
286 * @param aSession The session where this subsession belongs. |
|
287 */ |
|
288 CPhSrvSubSessionImageHandler( CPhSrvSession& aSession ); |
|
289 |
|
290 /** |
|
291 * Symbian constructor that may leave. |
|
292 */ |
|
293 void ConstructL(); |
|
294 |
|
295 private: // Data. |
|
296 |
|
297 // Stored VT bitmaps |
|
298 RPointerArray<CFbsBitmap> iVTBitMaps; |
|
299 |
|
300 // Stored operator logos. |
|
301 RPointerArray<CPhSrvOperatorLogoContainer> iOperatorLogos; |
|
302 |
|
303 // File server handle. |
|
304 RFs iFs; |
|
305 |
|
306 // Path to privates. |
|
307 TFileName iFilePath; |
|
308 |
|
309 // Used for defining pubsub key. |
|
310 TBool iPropertyDefined; |
|
311 |
|
312 //System drive name |
|
313 TFileName iDriveName; |
|
314 |
|
315 // Pointer to object performing image saving. Not owned. |
|
316 CPhSrvImageSaver* iImageSaver; |
|
317 |
|
318 // message entry for VT image saving |
|
319 RMessage2 iSaveVtImageMessage; |
|
320 }; |
|
321 |
|
322 #endif // CPHSRVSUBSESSIONIMAGEHANDLER_H |
|
323 |
|
324 |
|
325 // End of File |