|
1 /* |
|
2 * Copyright (c) 2006-2008 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: Plug-in main class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CAISATPLUGIN_H |
|
20 #define CAISATPLUGIN_H |
|
21 |
|
22 #include <aicontentpublisher.h> |
|
23 #include <aipropertyextension.h> |
|
24 #include <aicontentmodel.h> |
|
25 |
|
26 #include "mpluginapi.h" |
|
27 #include "caisatengine.h" |
|
28 |
|
29 class MAiContentObserver; |
|
30 class MAiContentItemIterator; |
|
31 |
|
32 /** |
|
33 * Plug-in main class |
|
34 * |
|
35 * @since S60 v3.2 |
|
36 */ |
|
37 class CAiSatPlugin : public CAiContentPublisher, |
|
38 public MAiPropertyExtension, |
|
39 public MPluginAPI |
|
40 { |
|
41 |
|
42 public: |
|
43 |
|
44 /** |
|
45 * Part of the two phased constuction |
|
46 */ |
|
47 static CAiSatPlugin* NewL(); |
|
48 |
|
49 /** |
|
50 * Destructor |
|
51 */ |
|
52 ~CAiSatPlugin(); |
|
53 |
|
54 /** |
|
55 * Publishes SAT Set Up Idle Mode Text |
|
56 */ |
|
57 void PublishSatL(); |
|
58 |
|
59 // from base class CAiContentPublisher |
|
60 |
|
61 /** |
|
62 * From CAiContentPublisher |
|
63 * The method is called by the framework to request the plug-in free all |
|
64 * memory and CPU resources and close all its open files, e.g. the plug-in |
|
65 * should unload its engines due backup operation. The method transits the |
|
66 * plug-in to "Idle" state. |
|
67 * |
|
68 * @param aReason Reason for state change, see TAiTransitionChange. |
|
69 */ |
|
70 void Stop( TAiTransitionReason aReason ); |
|
71 |
|
72 /** |
|
73 * From CAiContentPublisher |
|
74 * The method is called by the framework to instruct plug-in that it is |
|
75 * allowed to consume CPU resources, e.g plug-in is able to run timers, |
|
76 * perform asynchronous operations, etc. The method transits the plug-in |
|
77 * to "Alive" state. |
|
78 * |
|
79 * @param aReason Reason for state change, see TAiTransitionChange. |
|
80 */ |
|
81 void Resume( TAiTransitionReason aReason ); |
|
82 |
|
83 /** |
|
84 * From CAiContentPublisher |
|
85 * The method is called by the framework to instruct plug-in that it is |
|
86 * not allowed to consume CPU resources, e.g plug-in MUST stop each |
|
87 * timers, cancel outstanding asynchronous operations, etc. The method |
|
88 * transits the plug-in to "Suspendend" state. |
|
89 * |
|
90 * @param aReason Reason for state change, see TAiTransitionChange. |
|
91 */ |
|
92 void Suspend( TAiTransitionReason aReason ); |
|
93 |
|
94 /** |
|
95 * From CAiContentPublisher |
|
96 * Adds the content observer / subscriber to plug-in. The plug-in MUST |
|
97 * maintain a registry of subscribers and send notification to all them |
|
98 * whenever the plug-in changes state or new content available. |
|
99 * |
|
100 * @param aObserver Content observer to register. |
|
101 */ |
|
102 void SubscribeL( MAiContentObserver& aObserver ); |
|
103 |
|
104 /** |
|
105 * From CAiContentPublisher |
|
106 * Configures the plug-in. |
|
107 * Plug-ins take ownership of the settings array, so it must either |
|
108 * store it in a member or free it. Framework has put the array in cleanup |
|
109 * stack so the plugin shouldn't do that. |
|
110 * If this leaves, the plug-in will be destroyed by AI FW. |
|
111 * Plug-in must support LaunchByValue-event even if normal shortcuts don't |
|
112 * work. The only allowed serious enough leave is KErrNotFound from CenRep. |
|
113 * |
|
114 * @param aSettings Setting items defined in the UI definition. |
|
115 */ |
|
116 void ConfigureL( RAiSettingsItemArray& aSettings ); |
|
117 |
|
118 /** |
|
119 * From CAiContentPublisher |
|
120 * Returns interface extension. In Series 60 3.1 only event & property |
|
121 * extensions are supported. See MAiEventExtension & MAiPropertyExtension |
|
122 * interfaces. |
|
123 * |
|
124 * @param aUid UID of the extension interface to access. |
|
125 * @return The extension interface. Actual type depends on the passed aUid |
|
126 * argument. |
|
127 */ |
|
128 TAny* Extension( TUid aUid ); |
|
129 |
|
130 // from base class MAiPropertyExtension |
|
131 |
|
132 /** |
|
133 * From MAiPropertyExtension. |
|
134 * Read property of publisher plug-in. |
|
135 * |
|
136 * @param aProperty Identification of property. |
|
137 * @return Pointer to property value. |
|
138 */ |
|
139 TAny* GetPropertyL( TInt aProperty ); |
|
140 |
|
141 /** |
|
142 * From MAiPropertyExtension. |
|
143 * Write property value. |
|
144 * |
|
145 * @param aProperty Identification of property. |
|
146 * @param aValue Contains pointer to property value. |
|
147 */ |
|
148 void SetPropertyL( TInt aProperty, TAny* aValue ); |
|
149 |
|
150 /** |
|
151 * Receives a notification of the content update event |
|
152 */ |
|
153 void NotifyContentUpdate(); |
|
154 |
|
155 private: |
|
156 |
|
157 /** |
|
158 * Constructor to use in the object creation. |
|
159 * Initializes the necessary data. |
|
160 */ |
|
161 CAiSatPlugin(); |
|
162 |
|
163 /** |
|
164 * Part of the two phased construction |
|
165 */ |
|
166 void ConstructL(); |
|
167 |
|
168 /** |
|
169 * Update idle area when plug in reload. |
|
170 */ |
|
171 void UpdateSatL(); |
|
172 |
|
173 /** |
|
174 * Publish a icon to the idle area. |
|
175 * |
|
176 * @param aObserver The Active Idle content observer. |
|
177 * @param aIcon The icon to be published. |
|
178 * @return The error code. |
|
179 */ |
|
180 TInt PublishIcon( MAiContentObserver& aObserver, CGulIcon* aIcon ); |
|
181 |
|
182 /** |
|
183 * Clean setup idle mode icon. |
|
184 * |
|
185 * @param aObserver The Active Idle content observer. |
|
186 * @return The error code. |
|
187 */ |
|
188 TInt CleanIcon( MAiContentObserver& aObserver ); |
|
189 |
|
190 /** |
|
191 * Publish a SetUpIdleModeText string. |
|
192 * |
|
193 * @param aObserver The Active Idle content observer. |
|
194 * @param aContent The SetUpIdleModeText string would be published. |
|
195 * @return The error code. |
|
196 */ |
|
197 TInt PublishText( MAiContentObserver& aObserver, |
|
198 const TDesC& aText ); |
|
199 |
|
200 /** |
|
201 * Clean setup idle mode text. |
|
202 * |
|
203 * @param aObserver The Active Idle content observer. |
|
204 * @return The error code. |
|
205 */ |
|
206 TInt CleanText( MAiContentObserver& aObserver ); |
|
207 |
|
208 private: // data |
|
209 |
|
210 /** |
|
211 * Iterator for plugin content |
|
212 * Own |
|
213 */ |
|
214 MAiContentItemIterator* iContent; |
|
215 |
|
216 /** |
|
217 * Iterator for plugin resources |
|
218 * Own |
|
219 */ |
|
220 MAiContentItemIterator* iResources; |
|
221 |
|
222 /** |
|
223 * Iterator for plugin events |
|
224 * Own |
|
225 */ |
|
226 MAiContentItemIterator* iEvents; |
|
227 |
|
228 /** |
|
229 * Plugin engine |
|
230 * Own |
|
231 */ |
|
232 CAiSatEngine* iEngine; |
|
233 |
|
234 /** |
|
235 * Array of content observers |
|
236 */ |
|
237 RPointerArray<MAiContentObserver> iObservers; |
|
238 |
|
239 /** |
|
240 * Information about the content publisher (this plug-in) |
|
241 */ |
|
242 TAiPublisherInfo iInfo; |
|
243 |
|
244 /** |
|
245 * Whether the icon is the same with previous one. |
|
246 */ |
|
247 TBool iDupIcon; |
|
248 |
|
249 /** |
|
250 * Whether the text is the same with previous one. |
|
251 */ |
|
252 TBool iDupText; |
|
253 }; |
|
254 |
|
255 #endif // CAISATPLUGIN_H |
|
256 |
|
257 |