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