First public contribution.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
22 #ifndef MDFPROCESSINGUNIT_H
23 #define MDFPROCESSINGUNIT_H
26 #include <ecom/implementationinformation.h>
27 #include <mdf/mdfinputport.h>
28 #include <mdf/mdfoutputport.h>
32 class CMdfProcessingUnit;
33 class MMdfInputPortObserver;
34 class MMdfOutputPortObserver;
38 Processing Unit internal state.
40 enum TProcessingUnitState
43 Processing Unit invalid state
45 EProcessingUnitInvalid = 0,
47 Processing Unit loaded state
49 EProcessingUnitLoaded,
51 Processing Unit idle state
55 Processing Unit executing state
57 EProcessingUnitExecuting,
59 Processing Unit paused state
61 EProcessingUnitPaused,
63 Processing Unit waiting for resources state
65 EProcessingUnitWaitingForResources,
67 Processing Unit loading state
69 EProcessingUnitLoading,
71 Processing Unit initializing state
73 EProcessingUnitInitializing
77 Processing Unit observer class
79 class MMdfProcessingUnitObserver
83 Called by a Processing Unit when Initialize() has completed.
85 The Processing Unit which sent the callback.
87 An error code indicating if the function call was successful. KErrNone on success, otherwise
88 another of the system-wide error codes.
90 virtual void InitializeComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode) = 0;
93 Called by a Processing Unit when Execute() has completed.
95 The Processing Unit which sent the callback.
97 An error code indicating if the function call was successful. KErrNone on success, otherwise
98 another of the system-wide error codes.
100 virtual void ExecuteComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode) = 0;
104 Processing Unit interface
106 class CMdfProcessingUnit : public CBase
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.
115 inline static CMdfProcessingUnit* NewL(TUid aImplementationUid);
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.
124 virtual TInt Create(const MMdfProcessingUnitObserver& aProcessingUnitObserver) = 0;
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.
133 virtual TInt GetInputPorts(RPointerArray<MMdfInputPort>& aComponentInputPorts) = 0;
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.
142 virtual TInt GetOutputPorts(RPointerArray<MMdfOutputPort>& aComponentOutputPorts) = 0;
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.
151 virtual TInt Configure(const TPuConfig& aConfigurationSetup) = 0;
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.
160 virtual TInt GetConfig(TPuConfig& aConfigurationSetup) = 0;
164 Asynchronous method which instructs the Processing Unit to start the initialization.
165 @see MMdfProcessingUnitObserver::InitializeComplete()
167 virtual void Initialize() = 0;
170 Asynchronous method which starts the execution for a Processing Unit.
171 @see MMdfProcessingUnitObserver::ExecuteComplete()
173 virtual void Execute () = 0;
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.
180 virtual TInt Pause () = 0;
183 Synchronous method which stops the current on-going task.
185 virtual void Stop () = 0;
188 Synchronous method which returns the current state of the Processing Unit.
189 @return The current state of the Processing Unit.
191 virtual TProcessingUnitState State() = 0;
194 Synchronous method which requests an extension feature.
195 This is intended to provide additional features.
197 Used to indicate which interface is required.
198 @return Standard error code. KErrNotSupported is used to indicate that the particular
201 virtual TInt CreateCustomInterface(TUid aUid) = 0;
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.
209 Used to indicate which interface is required.
210 @return The requested interface, or NULL if not known.
211 @see CMdfProcessingUnit::CreateCustomInterface()
213 virtual TAny* CustomInterface(TUid aUid) = 0;
218 The destructor is called by ECom framework allowing derived classes
219 to clean up the implementation specific resources.
221 inline virtual ~CMdfProcessingUnit();
227 #include <mdf/mdfprocessingunit.inl>
229 #endif // MDFPROCESSINGUNIT_H