|
1 /* |
|
2 * Copyright (c) 2009 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 */ |
|
17 |
|
18 |
|
19 #ifndef OBSERVER_H |
|
20 #define OBSERVER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <aicontentobserver.h> |
|
24 #include <hscontentpublisher.h> |
|
25 |
|
26 //class CAiPluginTesterView; |
|
27 class RFile; |
|
28 |
|
29 /** |
|
30 * |
|
31 */ |
|
32 class Observer : public CBase, public MAiContentObserver |
|
33 { |
|
34 |
|
35 public: |
|
36 |
|
37 static Observer* NewL(); |
|
38 |
|
39 virtual ~Observer(); |
|
40 |
|
41 /** |
|
42 * Invoked by the plug-in to inform that it initiates content publishing |
|
43 * transaction. |
|
44 * |
|
45 * @param aTxId - transaction Id |
|
46 * @return KErrNone - transaction is started. |
|
47 * KErrNotSupported - UI Controller does not support transactions, |
|
48 * meaning that content will be rendered every time when Publish |
|
49 * is called. |
|
50 * @since S60 v3.2 |
|
51 */ |
|
52 TInt StartTransaction(TInt aTxId); |
|
53 |
|
54 inline TInt CancelTransaction(TInt /*aTxId*/) |
|
55 { |
|
56 return 10000000000; |
|
57 }; |
|
58 |
|
59 /** |
|
60 * Invoked by the plug-in to request framework that content publishing |
|
61 * transaction must be finalized and content should be rendered to the |
|
62 * screen. |
|
63 * |
|
64 * @param aTxId - transaction Id |
|
65 * @return KErrNone - transaction is over. |
|
66 * KErrNotSupported - UI Controller does not support transactions, |
|
67 * meaning that content will be rendered every time when Publish |
|
68 * is called. |
|
69 * KErrNotFound - transaction with matching id has not been |
|
70 * started. |
|
71 * @since S60 v3.2 |
|
72 */ |
|
73 TInt Commit(TInt aTxId); |
|
74 |
|
75 /** |
|
76 * Invoked by plug-in to indicate that content publishing transaction |
|
77 * must be cancelled. |
|
78 * |
|
79 * @param aTxId - transaction Id |
|
80 * @return KErrNone - transaction is cancelled. |
|
81 * KErrNotSupported - UI Controller does not support transactions, |
|
82 * meaning that content will be rendered every time when Publish |
|
83 * is called. |
|
84 * KErrNotFound - transaction with matching id has not been |
|
85 * started. |
|
86 * @since S60 v3.2 |
|
87 */ |
|
88 TInt Rollback(TInt aTxId); |
|
89 |
|
90 /** |
|
91 * Invoked by plug-in to test if content can be published. |
|
92 * |
|
93 * @param aPlugin - Plug-in property extension interface implementation. |
|
94 * @param aContent - identification of content selector, MUST correspond |
|
95 * single content selector supported by plug-in. The framework |
|
96 * utilizes the selector id to match for cid and MIME type. |
|
97 * @param aIndex - index of the content item. |
|
98 * @return ETrue - if content could be published. |
|
99 * @since S60 3.2 |
|
100 */ |
|
101 TBool CanPublish(CHsContentPublisher& aPlugin, TInt aContent, TInt aIndex); |
|
102 |
|
103 /** |
|
104 * Invoked by the plug-in to inform that content identified by reference |
|
105 * aResource must be published to UI control\element identified by selector |
|
106 * aContent. |
|
107 * |
|
108 * @param aPlugin - Plug-in property extension interface implementation. |
|
109 * @param aContent - identification of content selector, MUST correspond |
|
110 * single content selector supported by plug-in. The framework |
|
111 * utilizes the selector id to match for cid and MIME type. |
|
112 * @param aResource - identification of content reference, MUST correspond |
|
113 * single content reference supported by plug-in. The framework |
|
114 * utilizes the reference if to match for cid and MIME type of the |
|
115 * content supplied with in UI definition. |
|
116 * @param aIndex - index of the content item. |
|
117 * @return KErrNone - if content is published. |
|
118 * KErrNotSupported - if content selector is not supported by |
|
119 * current UI definition. |
|
120 * KErrNotFound - if content reference is not found in current |
|
121 * UI definition. |
|
122 * @since S60 v3.2 |
|
123 */ |
|
124 TInt Publish(CHsContentPublisher& aPlugin, TInt aContent, TInt aResource, TInt aIndex); |
|
125 |
|
126 /** |
|
127 * Invoked by the plug-in to inform that textual content provided within |
|
128 * parameter aText must be published to UI control\element identified by |
|
129 * selector aContent. |
|
130 * |
|
131 * @param aPlugin - Plug-in property extension interface implementation. |
|
132 * @param aContent - identification of content selector, MUST correspond |
|
133 * single content selector supported by plug-in. The framework |
|
134 * utilizes the selector id to match for cid and MIME type. |
|
135 * @param aText - Textual content in UNICODE. |
|
136 * @param aIndex - index of the content item. |
|
137 * @return KErrNone - if content is published. |
|
138 * KErrNotSupported - if content selector is not supported by |
|
139 * current UI definition. |
|
140 * KErrNotFound - if content reference is not found in current |
|
141 * UI definition. |
|
142 * KErrArgument - if content cannot be published to UI element, |
|
143 * e.g. MIME type mismatch. |
|
144 * @since S60 v3.2 |
|
145 */ |
|
146 TInt Publish(CHsContentPublisher& aPlugin, TInt aContent, const TDesC16& aText, TInt aIndex); |
|
147 |
|
148 /** |
|
149 * Invoked by the plug-in to inform that content provided within buffer |
|
150 * aBuf must be published to UI control\element identified by selector |
|
151 * aContent. |
|
152 * |
|
153 * @param aPlugin - Plug-in property extension interface implementation. |
|
154 * @param aContent - identification of content selector, MUST correspond |
|
155 * single content selector supported by plug-in. The framework |
|
156 * utilizes the selector id to match for cid and MIME type. |
|
157 * @param aBuf - instance of content. |
|
158 * @param aIndex - index of the content item. |
|
159 * @return KErrNone - if content is published. |
|
160 * KErrNotSupported - if content selector is not supported by |
|
161 * current UI definition. |
|
162 * KErrNotFound - if content reference is not found in current |
|
163 * UI definition. |
|
164 * KErrArgument - if content cannot be published to UI element, |
|
165 * e.g. MIME type mismatch. |
|
166 * @since S60 v3.2 |
|
167 */ |
|
168 TInt Publish(CHsContentPublisher& aPlugin, TInt aContent, const TDesC8& aBuf, TInt aIndex); |
|
169 |
|
170 /** |
|
171 * Invoked by the plug-in to inform that content from file handle aFile |
|
172 * must be published to UI control\element identified by selector aContent. |
|
173 * |
|
174 * @param aPlugin - Plug-in property extension interface implementation. |
|
175 * @param aContent - identification of content selector, MUST correspond |
|
176 * single content selector supported by plug-in. The framework |
|
177 * utilizes the selector id to match for cid and MIME type. |
|
178 * @param aFile - file handle from where content can be obtained by UI |
|
179 * framework. |
|
180 * @param aIndex - index of the content item. |
|
181 * @return KErrNone - if content is published. |
|
182 * KErrNotSupported - if content selector is not supported by |
|
183 * current UI definition. |
|
184 * KErrNotFound - if content reference is not found in current |
|
185 * UI definition. |
|
186 * KErrArgument - if content cannot be published to UI element, |
|
187 * e.g. MIME type mismatch. |
|
188 * @since S60 v3.2 |
|
189 */ |
|
190 TInt Publish(CHsContentPublisher& aPlugin, TInt aContent, RFile& aFile, TInt aIndex); |
|
191 |
|
192 /** |
|
193 * Invoked by the plug-in to inform that content must be cleaned in UI |
|
194 * control\element identified by selector aContent. |
|
195 * |
|
196 * @param aPlugin - Plug-in property extension interface implementation. |
|
197 * @param aContent - identification of content selector, MUST correspond |
|
198 * single content selector supported by plug-in. The framework |
|
199 * utilizes the selector id to match for cid and MIME type. |
|
200 * @param aIndex - index of the content item. |
|
201 * @return KErrNone - if content is published. |
|
202 * KErrNotSupported - if content selector is not supported by |
|
203 * current UI definition. |
|
204 * KErrNotFound - if content reference is not found in current |
|
205 * UI definition. |
|
206 * @since S60 v3.2 |
|
207 */ |
|
208 TInt Clean(CHsContentPublisher& aPlugin, TInt aContent, TInt aIndex); |
|
209 |
|
210 /** |
|
211 * Returns interface extension. Not used in Series 60 3.1 release. |
|
212 * |
|
213 * @param aUid - UID of the extension interface to access. |
|
214 * @return the extension interface. Actual type depends on the passed aUid |
|
215 * argument. |
|
216 * @since S60 v3.2 |
|
217 */ |
|
218 TAny* Extension(TUid aUid) ; |
|
219 |
|
220 /** |
|
221 * |
|
222 */ |
|
223 TBool RequiresSubscription( const THsPublisherInfo& aPublisherInfo ) const; |
|
224 |
|
225 /** |
|
226 * |
|
227 */ |
|
228 TInt SetProperty( CHsContentPublisher& aPlugin, |
|
229 const TDesC8& aElementId, |
|
230 const TDesC8& aPropertyName, |
|
231 const TDesC8& aPropertyValue ); |
|
232 |
|
233 /** |
|
234 * |
|
235 */ |
|
236 TInt SetProperty( CHsContentPublisher& aPlugin, |
|
237 const TDesC8& aElementId, |
|
238 const TDesC8& aPropertyName, |
|
239 const TDesC8& aPropertyValue, |
|
240 MAiContentObserver::TValueType aValueType); |
|
241 |
|
242 protected: |
|
243 |
|
244 private: |
|
245 |
|
246 Observer(); |
|
247 |
|
248 void ConstructL(); |
|
249 |
|
250 /** |
|
251 * Leaving version of the commit operation |
|
252 * |
|
253 * @since S60 3.1 |
|
254 */ |
|
255 void DoCommitL(TInt aTxId); |
|
256 |
|
257 private: // Data |
|
258 |
|
259 /** |
|
260 * Transaction id |
|
261 */ |
|
262 TInt iTransactionId; |
|
263 |
|
264 /** |
|
265 * Flag indicating if transaction is ongoing |
|
266 */ |
|
267 TBool iTransactionOngoing; |
|
268 |
|
269 /** |
|
270 * Pointer to tester application view |
|
271 * Not own. |
|
272 */ |
|
273 // CAiPluginTesterView* iView; |
|
274 |
|
275 }; |
|
276 |
|
277 #endif // OBSERVER_H |
|
278 |
|
279 // End of File. |