|
1 /* |
|
2 * Copyright (c) 2002-2004 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: |
|
15 * |
|
16 * ChspsRequestClient is a client-side implementation of MhspsClientRequestService API-definition |
|
17 * of Homescreen Plugin Configuration Management Services. |
|
18 * ChspsRequestClient is intended to serve Rendering Engines with Application configuartion and plugin configurations |
|
19 * and their associated resources. ChspsRequestClient will provide access to Homescreen Plugin configuration |
|
20 * database maintained by hspsThemeServer. |
|
21 * Typical use-case in using ChspsRequestClient is that there is HSPS SAPI user with a instance of |
|
22 * CHspsConfigurationService. When Homescreen application is starting up, the provider of teh HSPS Sapi is created |
|
23 * with instance of ChspsConfigurationService. ChspsConfigurationService calls hspsGetODT() and retrieves application |
|
24 * configuartion. When request exists on server-side, the right one application configuration is delivered to client process. |
|
25 * Theme may include resources. Resourses are listed on Resource List which is delivered too by |
|
26 * the same request. hspsThemeServer uses Symbian Central Repository to get match theme on the |
|
27 * request. ChspsRequestClient serves also resource accesses. In using file handle passing introduced |
|
28 * by Symbian Platform Security, it deliver a resource access to the client process. |
|
29 * |
|
30 * ChspsRequestClient includes asynchronous service for subscribing the changes of current theme. |
|
31 * These changes could be for e.g. theme status change (another theme is activated for the |
|
32 * application) or a theme update. Change-events must be subsribed by calling hspsGetODTUpdate(). |
|
33 * CHspsConfigurationService who was initiated ChspsRequestClient, must listen to |
|
34 * the hspsThemeServer call-back events. Call-back events are delivered through |
|
35 * MhspsClientRequestServiceObserver::HandlehspsRequestClientMessage() function. |
|
36 * Subscribtion can be canceled by hspsCancelGetODTUpdate() at any time. ChspsRequestClient cancels |
|
37 * subscription automaticly on some cases, for instance, on theme status change; there is no reason |
|
38 * to continue subscription of changes of the theme which is not active any more - host application |
|
39 * must reload the theme and then initiate the subscription again. |
|
40 * |
|
41 * For more information, see HSPS Theme Management Service APIs documentation |
|
42 * and hspsThemeManagement.h, where MhspsClientRequestService API implemented by this class are defined. |
|
43 * |
|
44 * Version : %version: 1 % |
|
45 * |
|
46 */ |
|
47 |
|
48 |
|
49 #ifndef __ChspsREQUESTCLIENT_H__ |
|
50 #define __ChspsREQUESTCLIENT_H__ |
|
51 |
|
52 #include <e32base.h> |
|
53 |
|
54 #include "hspsthememanagement.h" |
|
55 #include "hspsclientsession.h" |
|
56 #include "hspsresult.h" |
|
57 #include "hspsreqnotifparam.h" |
|
58 |
|
59 #ifdef HSPS_LOG_ACTIVE |
|
60 class ChspsLogBus; |
|
61 #endif |
|
62 |
|
63 /** hspsRequestClient Panic Category. */ |
|
64 _LIT( KhspsRequestClient, "hspsRequestClient" ); |
|
65 |
|
66 /** hspsRequestClient panic codes: */ |
|
67 enum ThspsRequestClientPanics |
|
68 { |
|
69 EhspsRequestClientBadState |
|
70 }; |
|
71 |
|
72 class ChspsODT; |
|
73 class ChspsResource; |
|
74 class RhspsClientSession; |
|
75 class MhspsClientRequestService; |
|
76 class MhspsClientRequestServiceObserver; |
|
77 class ChspsResult; |
|
78 class ChspaRequestNotificationParams; |
|
79 |
|
80 /** |
|
81 * Request client |
|
82 * |
|
83 * @lib hspsrequestclient.lib |
|
84 * @since S60 5.0 |
|
85 * @ingroup group_hspsclients |
|
86 */ |
|
87 class ChspsRequestClient : public CActive, public MhspsClientRequestService |
|
88 { |
|
89 |
|
90 public: // Constructors and destructors |
|
91 /** |
|
92 * NewL. |
|
93 * Two-phased constructor. |
|
94 * Creates a ChspsClient object using two phase construction, |
|
95 * and return a pointer to the created object. |
|
96 * |
|
97 * @since S60 5.0 |
|
98 * @param aObserver The object to be used to |
|
99 * handle updates from the server. |
|
100 */ |
|
101 IMPORT_C static ChspsRequestClient* NewL(MhspsClientRequestServiceObserver& aObserver ); |
|
102 |
|
103 /** |
|
104 * NewLC. |
|
105 * Two-phased constructor. |
|
106 * Creates a ChspsRequestClient object using two phase construction, |
|
107 * and return a pointer to the created object. |
|
108 * |
|
109 * @since S60 5.0 |
|
110 * @param aObserver The object to be used to |
|
111 * handle updates from the server. |
|
112 */ |
|
113 IMPORT_C static ChspsRequestClient* NewLC( MhspsClientRequestServiceObserver& aObserver ); |
|
114 |
|
115 /** |
|
116 * ~ChspsRequestClient. |
|
117 * |
|
118 * Destructor. |
|
119 * Destroys the object and release all memory objects. |
|
120 */ |
|
121 virtual ~ChspsRequestClient(); |
|
122 |
|
123 public: // New functions |
|
124 |
|
125 /** |
|
126 * From MhspsClientRequestService. |
|
127 */ |
|
128 IMPORT_C ThspsServiceCompletedMessage hspsGetODT(TInt aAppUid, ChspsODT& aODT); |
|
129 |
|
130 /** |
|
131 * From MhspsClientRequestService. |
|
132 */ |
|
133 IMPORT_C ThspsServiceCompletedMessage hspsGetODTUpdate(); |
|
134 |
|
135 /** |
|
136 * From MhspsClientRequestService. |
|
137 */ |
|
138 IMPORT_C ThspsServiceCompletedMessage hspsCancelGetODTUpdate(); |
|
139 |
|
140 /** |
|
141 * From MhspsClientRequestService. |
|
142 */ |
|
143 IMPORT_C ThspsServiceCompletedMessage hspsAccessResourceFile( |
|
144 const TDesC& aResourceFileName, |
|
145 const ThspsConfiguration& aConfiguration, |
|
146 RFile& aFile); |
|
147 |
|
148 /** |
|
149 * GethspsResult. |
|
150 * |
|
151 * @since S60 5.0 |
|
152 * @param aResult is a ChspsResult object containing additional information of query result. |
|
153 */ |
|
154 IMPORT_C void GethspsResult(ChspsResult& aResult); |
|
155 |
|
156 /** |
|
157 * Sets a log bus when debugging has been enabled. |
|
158 * Empty implementation if non HSPS_LOG_ACTIVE build. |
|
159 * |
|
160 * @since S60 5.0 |
|
161 * @param aLogBus Log bus to be set. |
|
162 */ |
|
163 IMPORT_C void SetLogBus( void* aLogBus ); |
|
164 |
|
165 protected: // Functions from base classes |
|
166 |
|
167 /** |
|
168 * From CActive, RunL. |
|
169 * Callback function. |
|
170 * Invoked to handle responses from the server. |
|
171 */ |
|
172 void RunL(); |
|
173 |
|
174 /** |
|
175 * From CActive, DoCancel. |
|
176 * Cancels any outstanding operation. |
|
177 */ |
|
178 void DoCancel(); |
|
179 |
|
180 /** |
|
181 * From CActive Called when asynchronous request has failed |
|
182 * @since S60 3.1 |
|
183 */ |
|
184 TInt RunError( TInt aError ); |
|
185 |
|
186 protected: |
|
187 /** |
|
188 * Sends a request to the server, retrieves a file path, internalizes the file |
|
189 * and copies resources from the server to client's private folder |
|
190 * @since S60 5.0 |
|
191 */ |
|
192 void CallGetOdtInFileL( |
|
193 const ThspsConfiguration& aConfiguration, |
|
194 ChspsODT& aODT ); |
|
195 |
|
196 /** |
|
197 * UpdatehspsResult. Updates iResult with latest result data coming on client request return. |
|
198 */ |
|
199 void UpdatehspsResult(); |
|
200 |
|
201 /** |
|
202 * UpdatehspsReqNotifParams. Updates iReqNotifParams with latest notification data coming on client request return. |
|
203 */ |
|
204 void UpdatehspsReqNotifParams(); |
|
205 |
|
206 private: // Constructors and destructors |
|
207 |
|
208 /** |
|
209 * ChspsRequestClient. |
|
210 * Performs the first phase of two phase construction. |
|
211 * @param aObserver The object to be used to |
|
212 * handle updates from the server. |
|
213 */ |
|
214 ChspsRequestClient( MhspsClientRequestServiceObserver& aObserver); |
|
215 |
|
216 /** |
|
217 * ConstructL. |
|
218 * Performs the second phase construction |
|
219 * ChspsRequestClient object. |
|
220 */ |
|
221 void ConstructL(); |
|
222 |
|
223 private: // Members |
|
224 |
|
225 /** |
|
226 * iSession, the time server session. |
|
227 */ |
|
228 RhspsClientSession iSession; |
|
229 |
|
230 /** |
|
231 * iObserver, observer which handles updates from the server. |
|
232 */ |
|
233 MhspsClientRequestServiceObserver& iObserver; |
|
234 |
|
235 private: // Data |
|
236 TBuf8<KMaxHeaderDataLength8> iHeaderData; |
|
237 HBufC8* iElement; |
|
238 TBuf8<KMaxResultDataLength8> iResultData; |
|
239 ChspsResult* iResult; |
|
240 ChspsRequestNotificationParams* iReqNotifParams; |
|
241 TBuf8<KMaxReqNotifDataLength8> iReqNotifData; |
|
242 ChspsODT* iODT; |
|
243 TBool iODTValid; |
|
244 CArrayPtrSeg<ChspsResource>* iResourceList; |
|
245 |
|
246 #ifdef HSPS_LOG_ACTIVE |
|
247 // Log bus. Not owned. |
|
248 ChspsLogBus* iLogBus; |
|
249 #endif |
|
250 }; |
|
251 |
|
252 |
|
253 #endif //__ChspsCLIENT_H__ |
|
254 |
|
255 // End of File |