17 |
17 |
18 |
18 |
19 #ifndef CMCSPLUGIN_H |
19 #ifndef CMCSPLUGIN_H |
20 #define CMCSPLUGIN_H |
20 #define CMCSPLUGIN_H |
21 |
21 |
22 #include <aicontentpublisher.h> |
22 // System includes |
23 #include <aipropertyextension.h> |
23 |
|
24 // User includes |
|
25 #include <hscontentpublisher.h> |
24 #include <aicontentmodel.h> |
26 #include <aicontentmodel.h> |
25 #include <aieventhandlerextension.h> |
|
26 #include <centralrepository.h> |
|
27 #include "mcspluginwatcher.h" |
|
28 |
27 |
|
28 // Forward declarations |
29 class MAiContentObserver; |
29 class MAiContentObserver; |
30 class MAiContentItemIterator; |
30 class MAiContentItemIterator; |
31 class CMCSPluginEngine; |
31 class CMCSPluginEngine; |
32 class TMCSData; |
32 class TMCSData; |
33 //class CMCSPluginData; |
|
34 |
|
35 //class RAiSettingsItemArray; |
|
36 |
33 |
37 /** |
34 /** |
38 * @ingroup group_mcsplugin |
35 * @ingroup group_mcsplugin |
39 * |
36 * |
40 * Plug-in main class |
37 * MCS Plug-in main class |
41 * |
38 * |
42 * @since S60 v3.2 |
39 * @since S60 5.2 |
43 */ |
40 */ |
44 class CMCSPlugin : public CAiContentPublisher, |
41 NONSHARABLE_CLASS( CMCSPlugin ) : public CHsContentPublisher |
45 public MAiPropertyExtension, |
42 { |
46 public MAiEventHandlerExtension, |
43 public: |
47 public MMCSPluginWatcherObserver |
44 // constructor and destructor |
48 |
45 |
|
46 static CMCSPlugin* NewL(); |
49 |
47 |
50 { |
48 ~CMCSPlugin(); |
51 |
49 |
52 public: |
50 private: |
|
51 // constructors |
|
52 |
|
53 /** |
|
54 * C++ default constructor |
|
55 */ |
|
56 CMCSPlugin(); |
53 |
57 |
54 /** |
58 /** |
55 * Part of the two phased constuction |
59 * 2nd phase constructor |
56 * |
|
57 * @param none |
|
58 * @return none |
|
59 */ |
60 */ |
60 static CMCSPlugin* NewL(); |
61 void ConstructL(); |
|
62 |
|
63 public: |
|
64 // from CHsContentPublisher |
|
65 |
|
66 /** |
|
67 * @see CHsContentPublisher |
|
68 */ |
|
69 void Start( TStartReason aReason ); |
61 |
70 |
62 /** |
71 /** |
63 * CompareItems |
72 * @see CHsContentPublisher |
64 * |
|
65 * @param aFirst |
|
66 * @param aSecond |
|
67 */ |
73 */ |
68 static TInt CompareItems(const MAiPluginSettings& aFirst, |
74 void Stop( TStopReason aReason ); |
69 const MAiPluginSettings& aSecond ); |
|
70 /** |
|
71 * Constructor |
|
72 * |
|
73 * @param none |
|
74 * @return none |
|
75 */ |
|
76 CMCSPlugin(); |
|
77 |
|
78 /** |
|
79 * Destructor |
|
80 * |
|
81 * @param none |
|
82 * @return none |
|
83 */ |
|
84 ~CMCSPlugin(); |
|
85 |
|
86 /** |
|
87 * Publishes profile names |
|
88 * |
|
89 * @param void |
|
90 * @return void |
|
91 */ |
|
92 void PublishL(); |
|
93 |
75 |
94 /** |
76 /** |
95 * From base class MMCSPluginWatcherObserver |
77 * @see CHsContentPublisher |
96 * .a method for Skin UID cenrep key change handeling |
78 */ |
97 */ |
79 void Resume( TResumeReason aReason ); |
98 void HandleNotifyL(); |
|
99 |
|
100 // from base class CAiContentPublisher |
|
101 |
|
102 /** |
|
103 * From CAiContentPublisher |
|
104 * The method is called by the framework to request the plug-in free all |
|
105 * memory and CPU resources and close all its open files, e.g. the plug-in |
|
106 * should unload its engines due backup operation. The method transits the |
|
107 * plug-in to "Idle" state. |
|
108 * |
|
109 * @param aReason reason for state change, see TAiTransitionChange. |
|
110 * @return void |
|
111 */ |
|
112 void Stop( TAiTransitionReason aReason ); |
|
113 |
80 |
114 /** |
81 /** |
115 * From CAiContentPublisher |
82 * @see CHsContentPublisher |
116 * The method is called by the framework to instruct plug-in that it is |
83 */ |
117 * allowed to consume CPU resources, e.g plug-in is able to run timers, |
84 void Suspend( TSuspendReason aReason ); |
118 * perform asynchronous operations, etc. The method transits the plug-in |
|
119 * to "Alive" state. |
|
120 * |
|
121 * @param aReason reason for state change, see TAiTransitionChange. |
|
122 * @return void |
|
123 */ |
|
124 void Resume( TAiTransitionReason aReason ); |
|
125 |
85 |
126 /** |
86 /** |
127 * From CAiContentPublisher |
87 * @see CHsContentPublisher |
128 * The method is called by the framework to instruct plug-in that it is |
88 */ |
129 * not allowed to consume CPU resources, e.g plug-in MUST stop each |
89 void SubscribeL( MAiContentObserver& aObserver ); |
130 * timers, cancel outstanding asynchronous operations, etc. The method |
|
131 * transits the plug-in to "Suspendend" state. |
|
132 * |
|
133 * @param aReason reason for state change, see TAiTransitionChange. |
|
134 * @return void |
|
135 */ |
|
136 void Suspend( TAiTransitionReason aReason ); |
|
137 |
90 |
138 /** |
91 /** |
139 * From CAiContentPublisher |
92 * @see CHsContentPublisher |
140 * Adds the content observer / subscriber to plug-in. The plug-in MUST |
93 */ |
141 * maintain a registry of subscribers and send notification to all them |
|
142 * whenever the plug-in changes state or new content available. |
|
143 * |
|
144 * @param aObserver content observer to register. |
|
145 * @return void |
|
146 */ |
|
147 void SubscribeL( MAiContentObserver& aObserver ); |
|
148 |
|
149 /** |
|
150 * From CAiContentPublisher |
|
151 * Configures the plug-in. |
|
152 * Plug-ins take ownership of the settings array, so it must either |
|
153 * store it in a member or free it. Framework has put the array in cleanup |
|
154 * stack so the plugin shouldn't do that. |
|
155 * If this leaves, the plug-in will be destroyed by AI FW. |
|
156 * Plug-in must support LaunchByValue-event even if normal shortcuts don't |
|
157 * work. The only allowed serious enough leave is KErrNotFound from CenRep. |
|
158 * |
|
159 * @param aSettings setting items defined in the UI definition. |
|
160 * @return void |
|
161 */ |
|
162 void ConfigureL( RAiSettingsItemArray& aSettings ); |
94 void ConfigureL( RAiSettingsItemArray& aSettings ); |
163 |
95 |
164 /** |
96 /** |
165 * From CAiContentPublisher |
97 * @see CHsContentPublisher |
166 * Returns interface extension. In Series 60 3.1 only event & property |
98 */ |
167 * extensions are supported. See MAiEventExtension & MAiPropertyExtension |
99 TAny* GetProperty( TProperty aProperty ); |
168 * interfaces. |
|
169 * |
|
170 * @param aUid - UID of the extension interface to access. |
|
171 * @return the extension interface. Actual type depends on the passed aUid |
|
172 * argument. |
|
173 */ |
|
174 TAny* Extension( TUid aUid ); |
|
175 |
|
176 // from base class MAiPropertyExtension |
|
177 |
100 |
178 /** |
101 /** |
179 * From MAiPropertyExtension. |
102 * @see CHsContentPublisher |
180 * Read property of publisher plug-in. |
103 */ |
181 * |
104 void HandleEvent( const TDesC& aEventName, const TDesC& aParam ); |
182 * @param aProperty - identification of property. |
105 |
183 * @return pointer to property value. |
106 public: |
184 */ |
107 // new functions |
185 TAny* GetPropertyL( TInt aProperty ); |
|
186 |
108 |
187 /** |
109 /** |
188 * From MAiPropertyExtension. |
110 * Publishes data |
189 * Write property value. |
|
190 * |
|
191 * @param aProperty - identification of property. |
|
192 * @param aValue - contains pointer to property value. |
|
193 */ |
111 */ |
194 void SetPropertyL( TInt aProperty, TAny* aValue ); |
112 void PublishL(); |
195 |
113 |
196 // from base class MAiEventHandlerExtension |
114 private: |
197 |
115 // new functions |
198 /** |
|
199 * From MAiEventHandlerExtension |
|
200 * Invoked by the framework when plug-in must handle an event. |
|
201 * |
|
202 * @param aEvent - unique identifier of event from plug-in content model. |
|
203 * @param aParam - parameters associated with event. Each UI Definition |
|
204 * declares events in the format: <event name>(<event params>), |
|
205 * where <event name> is mapped by the framework to unique |
|
206 * identifier supplied in aEvent, <event params> are provided to |
|
207 * plug-in as-is in the descriptor. |
|
208 * @since S60 3.2 |
|
209 */ |
|
210 void HandleEvent(TInt aEvent, const TDesC& aParam); |
|
211 |
116 |
212 /** |
117 /** |
213 * From MAiEventHandlerExtension |
118 * CompareItems |
214 * Invoked by the framework when plug-in must handle an event. |
|
215 * |
|
216 * @param aEventName - name of the event from plug-in content model. |
|
217 * @param aParam - parameters associated with event. Each UI Definition |
|
218 * declares events in the format: <event name>(<event params>), |
|
219 * where <event name> mapping to unique identifier supplied by event |
|
220 * is failed by the frame work then the <event name> and |
|
221 * <event params> are provided to plug-in as-is in the descriptor. |
|
222 */ |
119 */ |
223 void HandleEvent(const TDesC& aEventName, const TDesC& aParam); |
120 static TInt CompareItems( const MAiPluginSettings& aFirst, |
224 |
121 const MAiPluginSettings& aSecond ); |
225 protected: |
122 |
226 |
|
227 private: |
|
228 |
|
229 /** |
|
230 * Part of the two phased construction |
|
231 * |
|
232 * @param void |
|
233 * @return void |
|
234 */ |
|
235 void ConstructL(); |
|
236 |
|
237 /** |
|
238 * Resume the plug-in. |
|
239 * |
|
240 * @param aReason reason for state change, see TAiTransitionChange. |
|
241 * @return void |
|
242 */ |
|
243 void DoResumeL(TAiTransitionReason aReason); |
|
244 |
|
245 /** |
123 /** |
246 * Publishes content for one menu item |
124 * Publishes content for one menu item |
247 */ |
125 */ |
248 void PublishLItemL( MAiContentObserver& aObserver, TMCSData& aDataItem, TInt aIndex ); |
126 void PublishLItemL( MAiContentObserver& aObserver, TMCSData& aDataItem, TInt aIndex ); |
249 |
127 |
250 /** |
128 /** |
251 * Free the engine |
|
252 * |
|
253 * @param void |
|
254 * @return void |
|
255 */ |
|
256 void FreeEngine(); |
|
257 |
|
258 /** |
|
259 * Delete content model |
129 * Delete content model |
260 */ |
130 */ |
261 void DeleteContentModel(); |
131 void DeleteContentModel(); |
262 |
132 |
263 private: // data |
133 /** |
|
134 * Determines if dirty items exists |
|
135 */ |
|
136 TBool PublishRequired() const; |
|
137 |
|
138 private: |
|
139 // data |
264 |
140 |
265 // Iterator for plugin content |
141 /** Iterator for plugin content, owned */ |
266 // Own |
|
267 MAiContentItemIterator* iContent; |
142 MAiContentItemIterator* iContent; |
268 |
143 /** Number of data in the content model */ |
269 // Number of data in the content model. |
|
270 TInt iDataCount; |
144 TInt iDataCount; |
271 |
145 /** Dynamic content model, owned */ |
272 // Dynamic content model |
|
273 // Own. |
|
274 TAiContentItem* iContentModel; |
146 TAiContentItem* iContentModel; |
275 |
147 /** Plugin engine, owned */ |
276 // Plugin engine |
|
277 // Own |
|
278 CMCSPluginEngine* iEngine; |
148 CMCSPluginEngine* iEngine; |
279 |
149 /** Array of content observers, not owned */ |
280 // Array of content observers |
|
281 // not own |
|
282 RPointerArray<MAiContentObserver> iObservers; |
150 RPointerArray<MAiContentObserver> iObservers; |
283 |
|
284 // Information about the content publisher (this plug-in) |
|
285 TAiPublisherInfo iInfo; |
|
286 |
|
287 // For accessing central repository keys |
|
288 CRepository* iRepository; |
|
289 |
|
290 // For observing central repository Skin UID key change |
|
291 CMCSPluginWatcher* iRepositoryWatcher; |
|
292 |
|
293 }; |
151 }; |
294 |
152 |
295 #endif // CMCSPLUGIN_H |
153 #endif // CMCSPLUGIN_H |
|
154 |
|
155 // End of file |