|
1 /* |
|
2 * Copyright (c) 2007-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: action presentation model |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef HNACTIONMODEL_H_ |
|
20 #define HNACTIONMODEL_H_ |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <e32hashtab.h> |
|
24 #include <liwservicehandler.h> |
|
25 #include "hnglobals.h" |
|
26 |
|
27 |
|
28 class MLiwNotifyCallback; |
|
29 class CLiwGenericParamList; |
|
30 class CHnMdServiceCommand; |
|
31 class CHnEventHandler; |
|
32 class CHnMdBaseKey; |
|
33 struct THnMdCommonPointers; |
|
34 |
|
35 /** |
|
36 * Action model class. |
|
37 * |
|
38 * The class represents an evaluated action, with concrete values. |
|
39 * It is constructed from the data contained in the CHnMdAction, |
|
40 * during evaluation. The afore mentioned process, replaces any |
|
41 * configurable data with specific information fetched form services |
|
42 * or other sources. Such setup action, may be executed by means |
|
43 * of its methods. However, a reference to an instance of CHnEventHandler |
|
44 * has to be provided. |
|
45 * |
|
46 * @lib hnpresentationmodel |
|
47 * @since S60 5.0 |
|
48 * @see CHnMdAction |
|
49 * @see CHnEventHandler |
|
50 * @ingroup group_hnpresentationmodel |
|
51 */ |
|
52 NONSHARABLE_CLASS( CHnActionModel ) : public CBase |
|
53 { |
|
54 |
|
55 public: |
|
56 |
|
57 /** |
|
58 * Two-phased constructor. |
|
59 * |
|
60 * @since S60 5.0 |
|
61 */ |
|
62 IMPORT_C static CHnActionModel* NewL(); |
|
63 |
|
64 /** |
|
65 * Virtual Destructor. |
|
66 * |
|
67 * @since S60 5.0 |
|
68 */ |
|
69 ~CHnActionModel(); |
|
70 |
|
71 /** |
|
72 * Concretizes the key values. |
|
73 * |
|
74 * @since S60 5.0 |
|
75 * @param aActionModel The action model to be concretized. |
|
76 * @param aGenericParamList The list of parameters. |
|
77 * @return Concretized instance of action model. |
|
78 * |
|
79 */ |
|
80 CHnActionModel* ConcretizeL( const CHnActionModel & aActionModel, |
|
81 CLiwGenericParamList* aGenericParamList ); |
|
82 |
|
83 /** |
|
84 * Returns service constructor parameters |
|
85 * as a CLiwGenericParamList. The list contains |
|
86 * keys evaluated from the XML configuration. |
|
87 * |
|
88 * @since S60 5.0 |
|
89 * @return Constructor parameters. |
|
90 * |
|
91 */ |
|
92 IMPORT_C CLiwGenericParamList* ConstructorLC(); |
|
93 |
|
94 /** |
|
95 * Returns the service name. |
|
96 * |
|
97 * @since S60 5.0 |
|
98 * @return Service name. |
|
99 */ |
|
100 IMPORT_C const TDesC8& Service() const; |
|
101 |
|
102 /** |
|
103 * Returns service command content as |
|
104 * a CLiwGenericParamList. The list contains |
|
105 * keys evaluated from the XML configuration. |
|
106 * |
|
107 * @since S60 5.0 |
|
108 * @return Command element. |
|
109 */ |
|
110 IMPORT_C CLiwGenericParamList* CommandLC() const; |
|
111 |
|
112 /** |
|
113 * Returns interface name. |
|
114 * |
|
115 * @since S60 5.0 |
|
116 * @return Interface name. |
|
117 */ |
|
118 IMPORT_C const TDesC8& Interface() const; |
|
119 |
|
120 /** |
|
121 * Sets constructor parameters. |
|
122 * Method takes copy of items from the array. |
|
123 * |
|
124 * @since S60 5.0 |
|
125 * @param aData Constructor parameters. |
|
126 */ |
|
127 IMPORT_C void SetConstructorL( CHnMdBaseKey* aData ); |
|
128 |
|
129 /** |
|
130 * Sets the service name. |
|
131 * |
|
132 * @since S60 5.0 |
|
133 * @param aService Service name. |
|
134 */ |
|
135 IMPORT_C void SetServiceL( const TDesC8& aService ); |
|
136 |
|
137 /** |
|
138 * Sets the service command parameters. |
|
139 * |
|
140 * @since S60 5.0 |
|
141 * @param aCommand Command parameters. |
|
142 */ |
|
143 IMPORT_C void SetCommand( CHnMdBaseKey* aCommand ); |
|
144 |
|
145 /** |
|
146 * Sets interface name. |
|
147 * |
|
148 * @since S60 5.0 |
|
149 * @param aInterface Interface name. |
|
150 */ |
|
151 IMPORT_C void SetInterfaceL( const TDesC8& aInterface ); |
|
152 |
|
153 /** |
|
154 * Sets service command name. |
|
155 * |
|
156 * @since S60 5.0 |
|
157 * @param aCommandName Name of the service command. |
|
158 */ |
|
159 IMPORT_C void SetCommandNameL( const TDesC8& aCommandName ); |
|
160 |
|
161 |
|
162 /** |
|
163 * Sets the mode in which the service command |
|
164 * should operate. |
|
165 * |
|
166 * @since S60 5.0 |
|
167 * @param aMode Mode in which command operates. |
|
168 */ |
|
169 IMPORT_C void SetServiceModeL( TServiceMode aMode ); |
|
170 |
|
171 /** |
|
172 * Returns command name. |
|
173 * |
|
174 * @since S60 5.0 |
|
175 * @return Command name. |
|
176 */ |
|
177 IMPORT_C const TDesC8& CommandName() const; |
|
178 |
|
179 |
|
180 /** |
|
181 * Returns service mode in which the action operates. |
|
182 * |
|
183 * @since S60 5.0 |
|
184 * @return Service mode. |
|
185 */ |
|
186 IMPORT_C TServiceMode ServiceMode() const; |
|
187 |
|
188 /** |
|
189 * Executes the action. |
|
190 * |
|
191 * @since S60 5.0 |
|
192 * @param aEventHandler A reference to an instance of event handler |
|
193 * @param aExecutionParams A pointer to the parameters to the event. |
|
194 * @return Error code of the event execution. |
|
195 */ |
|
196 TInt ExecuteL( CHnEventHandler & aEventHandler, |
|
197 CLiwGenericParamList *aExecutionParams ); |
|
198 |
|
199 private: |
|
200 |
|
201 /** |
|
202 * Second phase constructor. |
|
203 * |
|
204 * @since S60 5.0 |
|
205 */ |
|
206 void ConstructL(); |
|
207 |
|
208 /** |
|
209 * Default constructor. |
|
210 * |
|
211 * @since S60 5.0 |
|
212 */ |
|
213 CHnActionModel(); |
|
214 |
|
215 private: // data |
|
216 |
|
217 /** |
|
218 * Service name. |
|
219 */ |
|
220 RBuf8 iService; |
|
221 |
|
222 /** |
|
223 * Interface name. |
|
224 */ |
|
225 RBuf8 iInterface; |
|
226 |
|
227 /** |
|
228 * Command name. |
|
229 */ |
|
230 RBuf8 iCommandName; |
|
231 |
|
232 /** |
|
233 * Service mode. |
|
234 */ |
|
235 TServiceMode iMode; |
|
236 |
|
237 /** |
|
238 * Command parameters. |
|
239 * Own. |
|
240 */ |
|
241 CHnMdBaseKey* iCommand; |
|
242 |
|
243 /** |
|
244 * Constructor parameters. |
|
245 * Own. |
|
246 */ |
|
247 CHnMdBaseKey* iConstructor; |
|
248 |
|
249 }; |
|
250 |
|
251 #endif /*HNACTIONMODEL_H_*/ |