|
1 /* |
|
2 * Copyright (c) 2005-2007 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: SAPI data plug-in main class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef SAPIDATAPLUGIN_H |
|
20 #define SAPIDATAPLUGIN_H |
|
21 |
|
22 // System includes |
|
23 |
|
24 // User includes |
|
25 #include <hscontentpublisher.h> |
|
26 #include <aicontentmodel.h> |
|
27 |
|
28 // Forward declarations |
|
29 class MAiContentObserver; |
|
30 class MAiContentItemIterator; |
|
31 class CSapiData; |
|
32 class CGulIcon; |
|
33 class CLiwDefaultMap; |
|
34 |
|
35 /** |
|
36 * @ingroup group_sapidataplugin |
|
37 * |
|
38 * Plug-in main class |
|
39 * |
|
40 * @since S60 v3.2 |
|
41 */ |
|
42 NONSHARABLE_CLASS( CSapiDataPlugin ) : public CHsContentPublisher |
|
43 { |
|
44 public: |
|
45 // data types |
|
46 |
|
47 /** |
|
48 * Plugin's network state. |
|
49 */ |
|
50 enum TPluginNetworkStatus |
|
51 { |
|
52 EUnknown, |
|
53 EOffline, |
|
54 EOnline |
|
55 }; |
|
56 |
|
57 /** |
|
58 * Plugin's state. |
|
59 */ |
|
60 enum TPluginStates |
|
61 { |
|
62 EStopped, |
|
63 EStarted, |
|
64 EResume, |
|
65 ESuspend |
|
66 }; |
|
67 |
|
68 public: |
|
69 // constructor and destructor |
|
70 |
|
71 /** |
|
72 * Part of the two phased constuction |
|
73 * |
|
74 * @param none |
|
75 * @return none |
|
76 */ |
|
77 static CSapiDataPlugin* NewL(); |
|
78 |
|
79 /** |
|
80 * Destructor |
|
81 * |
|
82 * @param none |
|
83 * @return none |
|
84 */ |
|
85 ~CSapiDataPlugin(); |
|
86 |
|
87 private: |
|
88 // constructors |
|
89 |
|
90 /** |
|
91 * Constructor |
|
92 * |
|
93 * @param none |
|
94 * @return none |
|
95 */ |
|
96 CSapiDataPlugin(); |
|
97 |
|
98 /** |
|
99 * Part of the two phased construction |
|
100 * |
|
101 * @param void |
|
102 * @return void |
|
103 */ |
|
104 void ConstructL(); |
|
105 |
|
106 public: |
|
107 // from CHsContentPublisher |
|
108 |
|
109 /** |
|
110 * @see CHsContentPublisher |
|
111 */ |
|
112 void Start( TStartReason aReason ); |
|
113 |
|
114 /** |
|
115 * @see CHsContentPublisher |
|
116 */ |
|
117 void Stop( TStopReason aReason ); |
|
118 |
|
119 /** |
|
120 * @see CHsContentPublisher |
|
121 */ |
|
122 void Resume( TResumeReason aReason ); |
|
123 |
|
124 /** |
|
125 * @see CHsContentPublisher |
|
126 */ |
|
127 void Suspend( TSuspendReason aReason ); |
|
128 |
|
129 /** |
|
130 * @see CHsContentPublisher |
|
131 */ |
|
132 void SetOnline(); |
|
133 |
|
134 /** |
|
135 * @see CHsContentPublisher |
|
136 */ |
|
137 void SetOffline(); |
|
138 |
|
139 /** |
|
140 * @see CHsContentPublisher |
|
141 */ |
|
142 void SubscribeL( MAiContentObserver& aObserver ); |
|
143 |
|
144 /** |
|
145 * @see CHsContentPublisher |
|
146 */ |
|
147 void ConfigureL( RAiSettingsItemArray& aSettings ); |
|
148 |
|
149 /** |
|
150 * @see CHsContentPublisher |
|
151 */ |
|
152 void SetProperty( TProperty aProperty, TAny* aAny ); |
|
153 |
|
154 /** |
|
155 * @see CHsContentPublisher |
|
156 */ |
|
157 TAny* GetProperty( TProperty aProperty ); |
|
158 |
|
159 /** |
|
160 * @see CHsContentPublisher |
|
161 */ |
|
162 void HandleEvent( const TDesC& aEventName, const TDesC& aParam ); |
|
163 |
|
164 /** |
|
165 * @see CHsContentPublisher |
|
166 */ |
|
167 TBool HasMenuItem( const TDesC16& aMenuItem ); |
|
168 |
|
169 private: |
|
170 // new functions |
|
171 |
|
172 void StartL( TStartReason aReason ); |
|
173 void StopL( TStopReason aReason ); |
|
174 |
|
175 public: |
|
176 // new functions |
|
177 |
|
178 /** |
|
179 * Publishes widget's texts and images |
|
180 * |
|
181 * @param void |
|
182 * @return void |
|
183 */ |
|
184 void PublishL(); |
|
185 |
|
186 /** |
|
187 * Gets the id of a content |
|
188 * |
|
189 * @param aObjectId image or text id |
|
190 * @return id of the content |
|
191 */ |
|
192 TInt GetIdL(TDesC& aObjectId); |
|
193 |
|
194 /** |
|
195 * Gets the type of a specific content |
|
196 * |
|
197 * @param aObjectId image or text id |
|
198 * @return void |
|
199 */ |
|
200 const TDesC& GetTypeL( TDesC& aObjectId ); |
|
201 |
|
202 /** |
|
203 * RefereshL a specific image of text in the widget |
|
204 * |
|
205 * @param aContentType content type |
|
206 * @param aOperation operation performed |
|
207 * @param aDataMap data map if available. Can be NULL. |
|
208 * Ownership NOT transferred. |
|
209 * @return void |
|
210 */ |
|
211 void RefreshL( TDesC& aContentType, |
|
212 TDesC& aOperation, |
|
213 CLiwDefaultMap* aDataMap ); |
|
214 |
|
215 /** |
|
216 * Is plugin active to publish the data |
|
217 * |
|
218 * @param void |
|
219 * @return boolean (ETrue/EFalse) |
|
220 */ |
|
221 TBool IsActive() const; |
|
222 |
|
223 /** |
|
224 * Is plugin stopped |
|
225 * |
|
226 * @param void |
|
227 * @return boolean (ETrue/EFalse) |
|
228 */ |
|
229 TBool IsStopped() const; |
|
230 |
|
231 /** |
|
232 * Publish a specific text of the widget |
|
233 * |
|
234 * @param aObserver observer |
|
235 * @param aContentId content model id |
|
236 * @param aContentValue content value |
|
237 * @return void |
|
238 */ |
|
239 void PublishTextL(MAiContentObserver* aObserver, |
|
240 TInt& aContentId, TDesC& aContentValue); |
|
241 |
|
242 /** |
|
243 * Publish a specific image of the widget |
|
244 * |
|
245 * @param aObserver observer |
|
246 * @param aContentId content model id |
|
247 * @param aHandle image handle |
|
248 * @param aMaskHandle handle of the mask image |
|
249 * @return void |
|
250 */ |
|
251 void PublishImageL(MAiContentObserver* aObserver, |
|
252 TInt& aContentId, TInt aHandle, TInt aMaskHandle); |
|
253 |
|
254 /** |
|
255 * Publish a specific image of the widget |
|
256 * |
|
257 * @param aObserver observer |
|
258 * @param aContentId content model id |
|
259 * @param aPath image path / skin id pattern / mif id Pattern |
|
260 * @return void |
|
261 */ |
|
262 void PublishImageL(MAiContentObserver* aObserver, |
|
263 TInt aContentId, TDesC& aPath ); |
|
264 |
|
265 /** |
|
266 * Publish a data stream to the widget |
|
267 * |
|
268 * @param aObserver observer |
|
269 * @param aContentId content model id |
|
270 * @param aData data stream |
|
271 * @return void |
|
272 */ |
|
273 void PublishData( MAiContentObserver* aObserver, |
|
274 TInt& aContentId, const TDesC8& aData ); |
|
275 |
|
276 /** |
|
277 * Cleans a data from the widget |
|
278 * |
|
279 * @param aObserver observer |
|
280 * @param aContentId content model id |
|
281 * @return void |
|
282 */ |
|
283 void Clean(MAiContentObserver* aObserver, |
|
284 TInt& aContentId ); |
|
285 |
|
286 /** |
|
287 * CSapiData getter |
|
288 * @return Pointer to CSapiData |
|
289 */ |
|
290 CSapiData* Data() const; |
|
291 |
|
292 /* |
|
293 * Plugin's network status getter |
|
294 */ |
|
295 TPluginNetworkStatus NetworkStatus() const; |
|
296 |
|
297 private: |
|
298 // data |
|
299 /** Iterator for plugin content, owned */ |
|
300 MAiContentItemIterator* iContent; |
|
301 /** Array of content observers, owned */ |
|
302 RPointerArray<MAiContentObserver> iObservers; |
|
303 /** Number of data in the content model */ |
|
304 TInt iDataCount; |
|
305 /** Dynamic content model, owned */ |
|
306 TAiContentItem* iContentModel; |
|
307 /** Reference array for Published text, owned */ |
|
308 RPointerArray< HBufC > iDataArray; |
|
309 /** Service API Data Subscriber, owned */ |
|
310 CSapiData* iData; |
|
311 /** References array for published images, owned */ |
|
312 RArray< CGulIcon* > iIconArray; |
|
313 /** Handle to file server session, owned */ |
|
314 RFs iRfs; |
|
315 /** Plugin's network status */ |
|
316 TPluginNetworkStatus iNetworkStatus; |
|
317 /** Plugin state */ |
|
318 TPluginStates iPluginState; |
|
319 /** Flag to indicate whether observer is registered */ |
|
320 TBool iPubObsRegistered; |
|
321 |
|
322 private: |
|
323 // friend classes |
|
324 |
|
325 #ifdef _SAPIDATAPLUGIN_TEST |
|
326 friend class MT_SapiDataPlugin; |
|
327 #endif |
|
328 }; |
|
329 |
|
330 #endif // SAPIDATAPLUGIN_H |
|
331 |
|
332 // End of file |
|
333 |