|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @publishedPartner |
|
19 @released |
|
20 */ |
|
21 |
|
22 #ifndef MDFPROCESSINGUNIT_H |
|
23 #define MDFPROCESSINGUNIT_H |
|
24 |
|
25 #include <e32base.h> |
|
26 #include <ecom/implementationinformation.h> |
|
27 #include <mdf/mdfinputport.h> |
|
28 #include <mdf/mdfoutputport.h> |
|
29 |
|
30 class MMdfInputPort; |
|
31 class MMdfOutputPort; |
|
32 class CMdfProcessingUnit; |
|
33 class MMdfInputPortObserver; |
|
34 class MMdfOutputPortObserver; |
|
35 class TPuConfig; |
|
36 |
|
37 /** |
|
38 Processing Unit internal state. |
|
39 */ |
|
40 enum TProcessingUnitState |
|
41 { |
|
42 /** |
|
43 Processing Unit invalid state |
|
44 */ |
|
45 EProcessingUnitInvalid = 0, |
|
46 /** |
|
47 Processing Unit loaded state |
|
48 */ |
|
49 EProcessingUnitLoaded, |
|
50 /** |
|
51 Processing Unit idle state |
|
52 */ |
|
53 EProcessingUnitIdle, |
|
54 /** |
|
55 Processing Unit executing state |
|
56 */ |
|
57 EProcessingUnitExecuting, |
|
58 /** |
|
59 Processing Unit paused state |
|
60 */ |
|
61 EProcessingUnitPaused, |
|
62 /** |
|
63 Processing Unit waiting for resources state |
|
64 */ |
|
65 EProcessingUnitWaitingForResources, |
|
66 /** |
|
67 Processing Unit loading state |
|
68 */ |
|
69 EProcessingUnitLoading, |
|
70 /** |
|
71 Processing Unit initializing state |
|
72 */ |
|
73 EProcessingUnitInitializing |
|
74 }; |
|
75 |
|
76 /** |
|
77 Processing Unit observer class |
|
78 */ |
|
79 class MMdfProcessingUnitObserver |
|
80 { |
|
81 public: |
|
82 /** |
|
83 Called by a Processing Unit when Initialize() has completed. |
|
84 @param aPu |
|
85 The Processing Unit which sent the callback. |
|
86 @param aErrorCode |
|
87 An error code indicating if the function call was successful. KErrNone on success, otherwise |
|
88 another of the system-wide error codes. |
|
89 */ |
|
90 virtual void InitializeComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode) = 0; |
|
91 |
|
92 /** |
|
93 Called by a Processing Unit when Execute() has completed. |
|
94 @param aPu |
|
95 The Processing Unit which sent the callback. |
|
96 @param aErrorCode |
|
97 An error code indicating if the function call was successful. KErrNone on success, otherwise |
|
98 another of the system-wide error codes. |
|
99 */ |
|
100 virtual void ExecuteComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode) = 0; |
|
101 }; |
|
102 |
|
103 /** |
|
104 Processing Unit interface |
|
105 */ |
|
106 class CMdfProcessingUnit : public CBase |
|
107 { |
|
108 public: |
|
109 /** |
|
110 Standard safe constructor that leaves nothing on the cleanup stack |
|
111 @param aImplementationUid |
|
112 The uid of the new created processing unit. |
|
113 @return A pointer to the newly constructed object. |
|
114 */ |
|
115 inline static CMdfProcessingUnit* NewL(TUid aImplementationUid); |
|
116 |
|
117 /** |
|
118 Synchronous method which creates the Processing Unit. |
|
119 @param aProcessingUnitObserver |
|
120 The class to receive asynchronous Processing Unit events. |
|
121 @return An error code indicating if the function call was successful. KErrNone on success, otherwise |
|
122 another of the system-wide error codes. |
|
123 */ |
|
124 virtual TInt Create(const MMdfProcessingUnitObserver& aProcessingUnitObserver) = 0; |
|
125 |
|
126 /** |
|
127 Synchronous method which returns the Input Ports that a Processing Unit holds. |
|
128 @param aComponentInputPorts |
|
129 The array to which the Input Ports will be appended. |
|
130 @return An error code indicating if the function call was successful. KErrNone on success, otherwise |
|
131 another of the system-wide error codes. |
|
132 */ |
|
133 virtual TInt GetInputPorts(RPointerArray<MMdfInputPort>& aComponentInputPorts) = 0; |
|
134 |
|
135 /** |
|
136 Synchronous method which returns the Output Ports that a Processing Unit holds. |
|
137 @param aComponentOutputPorts |
|
138 The array to which the Output Ports will be appended. |
|
139 @return An error code indicating if the function call was successful. KErrNone on success, otherwise |
|
140 another of the system-wide error codes. |
|
141 */ |
|
142 virtual TInt GetOutputPorts(RPointerArray<MMdfOutputPort>& aComponentOutputPorts) = 0; |
|
143 |
|
144 /** |
|
145 Synchronous method which sets the configuration for a Processing Unit. |
|
146 @param aConfigurationSetup |
|
147 The reference to the structure that contains the configuration data. |
|
148 @return An error code indicating if the function call was successful. KErrNone on success, otherwise |
|
149 another of the system-wide error codes. |
|
150 */ |
|
151 virtual TInt Configure(const TPuConfig& aConfigurationSetup) = 0; |
|
152 |
|
153 /** |
|
154 Synchronous method which gets a configuration structure. |
|
155 @param aConfigurationSetup |
|
156 The reference to the structure that is to contain the configuration information. |
|
157 @return An error code indicating if the function call was successful. KErrNone on success, otherwise |
|
158 another of the system-wide error codes. |
|
159 */ |
|
160 virtual TInt GetConfig(TPuConfig& aConfigurationSetup) = 0; |
|
161 |
|
162 |
|
163 /** |
|
164 Asynchronous method which instructs the Processing Unit to start the initialization. |
|
165 @see MMdfProcessingUnitObserver::InitializeComplete() |
|
166 */ |
|
167 virtual void Initialize() = 0; |
|
168 |
|
169 /** |
|
170 Asynchronous method which starts the execution for a Processing Unit. |
|
171 @see MMdfProcessingUnitObserver::ExecuteComplete() |
|
172 */ |
|
173 virtual void Execute () = 0; |
|
174 |
|
175 /** |
|
176 Synchronous method which pauses the current on-going task. |
|
177 @return An error code indicating if the function call was successful. KErrNone on success, otherwise |
|
178 another of the system-wide error codes. |
|
179 */ |
|
180 virtual TInt Pause () = 0; |
|
181 |
|
182 /** |
|
183 Synchronous method which stops the current on-going task. |
|
184 */ |
|
185 virtual void Stop () = 0; |
|
186 |
|
187 /** |
|
188 Synchronous method which returns the current state of the Processing Unit. |
|
189 @return The current state of the Processing Unit. |
|
190 */ |
|
191 virtual TProcessingUnitState State() = 0; |
|
192 |
|
193 /** |
|
194 Synchronous method which requests an extension feature. |
|
195 This is intended to provide additional features. |
|
196 @param aUid |
|
197 Used to indicate which interface is required. |
|
198 @return Standard error code. KErrNotSupported is used to indicate that the particular |
|
199 plugin is used. |
|
200 */ |
|
201 virtual TInt CreateCustomInterface(TUid aUid) = 0; |
|
202 |
|
203 /** |
|
204 Synchronous method which returns a previously created extension. |
|
205 This returns a custom interface. This should only be used if CreateCustomInterface() has already |
|
206 been called for the same UID value. This means that any construction for that interface |
|
207 has already been called, and thus this call cannot fail. |
|
208 @param aUid |
|
209 Used to indicate which interface is required. |
|
210 @return The requested interface, or NULL if not known. |
|
211 @see CMdfProcessingUnit::CreateCustomInterface() |
|
212 */ |
|
213 virtual TAny* CustomInterface(TUid aUid) = 0; |
|
214 |
|
215 /** |
|
216 Destructor. |
|
217 |
|
218 The destructor is called by ECom framework allowing derived classes |
|
219 to clean up the implementation specific resources. |
|
220 */ |
|
221 inline virtual ~CMdfProcessingUnit(); |
|
222 |
|
223 private: |
|
224 TUid iDtor_ID_Key; |
|
225 }; |
|
226 |
|
227 #include <mdf/mdfprocessingunit.inl> |
|
228 |
|
229 #endif // MDFPROCESSINGUNIT_H |