sl@0: // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: sl@0: #ifndef MDFPROCESSINGUNIT_H sl@0: #define MDFPROCESSINGUNIT_H sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: class MMdfInputPort; sl@0: class MMdfOutputPort; sl@0: class CMdfProcessingUnit; sl@0: class MMdfInputPortObserver; sl@0: class MMdfOutputPortObserver; sl@0: class TPuConfig; sl@0: sl@0: /** sl@0: Processing Unit internal state. sl@0: */ sl@0: enum TProcessingUnitState sl@0: { sl@0: /** sl@0: Processing Unit invalid state sl@0: */ sl@0: EProcessingUnitInvalid = 0, sl@0: /** sl@0: Processing Unit loaded state sl@0: */ sl@0: EProcessingUnitLoaded, sl@0: /** sl@0: Processing Unit idle state sl@0: */ sl@0: EProcessingUnitIdle, sl@0: /** sl@0: Processing Unit executing state sl@0: */ sl@0: EProcessingUnitExecuting, sl@0: /** sl@0: Processing Unit paused state sl@0: */ sl@0: EProcessingUnitPaused, sl@0: /** sl@0: Processing Unit waiting for resources state sl@0: */ sl@0: EProcessingUnitWaitingForResources, sl@0: /** sl@0: Processing Unit loading state sl@0: */ sl@0: EProcessingUnitLoading, sl@0: /** sl@0: Processing Unit initializing state sl@0: */ sl@0: EProcessingUnitInitializing sl@0: }; sl@0: sl@0: /** sl@0: Processing Unit observer class sl@0: */ sl@0: class MMdfProcessingUnitObserver sl@0: { sl@0: public: sl@0: /** sl@0: Called by a Processing Unit when Initialize() has completed. sl@0: @param aPu sl@0: The Processing Unit which sent the callback. sl@0: @param aErrorCode sl@0: An error code indicating if the function call was successful. KErrNone on success, otherwise sl@0: another of the system-wide error codes. sl@0: */ sl@0: virtual void InitializeComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode) = 0; sl@0: sl@0: /** sl@0: Called by a Processing Unit when Execute() has completed. sl@0: @param aPu sl@0: The Processing Unit which sent the callback. sl@0: @param aErrorCode sl@0: An error code indicating if the function call was successful. KErrNone on success, otherwise sl@0: another of the system-wide error codes. sl@0: */ sl@0: virtual void ExecuteComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode) = 0; sl@0: }; sl@0: sl@0: /** sl@0: Processing Unit interface sl@0: */ sl@0: class CMdfProcessingUnit : public CBase sl@0: { sl@0: public: sl@0: /** sl@0: Standard safe constructor that leaves nothing on the cleanup stack sl@0: @param aImplementationUid sl@0: The uid of the new created processing unit. sl@0: @return A pointer to the newly constructed object. sl@0: */ sl@0: inline static CMdfProcessingUnit* NewL(TUid aImplementationUid); sl@0: sl@0: /** sl@0: Synchronous method which creates the Processing Unit. sl@0: @param aProcessingUnitObserver sl@0: The class to receive asynchronous Processing Unit events. sl@0: @return An error code indicating if the function call was successful. KErrNone on success, otherwise sl@0: another of the system-wide error codes. sl@0: */ sl@0: virtual TInt Create(const MMdfProcessingUnitObserver& aProcessingUnitObserver) = 0; sl@0: sl@0: /** sl@0: Synchronous method which returns the Input Ports that a Processing Unit holds. sl@0: @param aComponentInputPorts sl@0: The array to which the Input Ports will be appended. sl@0: @return An error code indicating if the function call was successful. KErrNone on success, otherwise sl@0: another of the system-wide error codes. sl@0: */ sl@0: virtual TInt GetInputPorts(RPointerArray& aComponentInputPorts) = 0; sl@0: sl@0: /** sl@0: Synchronous method which returns the Output Ports that a Processing Unit holds. sl@0: @param aComponentOutputPorts sl@0: The array to which the Output Ports will be appended. sl@0: @return An error code indicating if the function call was successful. KErrNone on success, otherwise sl@0: another of the system-wide error codes. sl@0: */ sl@0: virtual TInt GetOutputPorts(RPointerArray& aComponentOutputPorts) = 0; sl@0: sl@0: /** sl@0: Synchronous method which sets the configuration for a Processing Unit. sl@0: @param aConfigurationSetup sl@0: The reference to the structure that contains the configuration data. sl@0: @return An error code indicating if the function call was successful. KErrNone on success, otherwise sl@0: another of the system-wide error codes. sl@0: */ sl@0: virtual TInt Configure(const TPuConfig& aConfigurationSetup) = 0; sl@0: sl@0: /** sl@0: Synchronous method which gets a configuration structure. sl@0: @param aConfigurationSetup sl@0: The reference to the structure that is to contain the configuration information. sl@0: @return An error code indicating if the function call was successful. KErrNone on success, otherwise sl@0: another of the system-wide error codes. sl@0: */ sl@0: virtual TInt GetConfig(TPuConfig& aConfigurationSetup) = 0; sl@0: sl@0: sl@0: /** sl@0: Asynchronous method which instructs the Processing Unit to start the initialization. sl@0: @see MMdfProcessingUnitObserver::InitializeComplete() sl@0: */ sl@0: virtual void Initialize() = 0; sl@0: sl@0: /** sl@0: Asynchronous method which starts the execution for a Processing Unit. sl@0: @see MMdfProcessingUnitObserver::ExecuteComplete() sl@0: */ sl@0: virtual void Execute () = 0; sl@0: sl@0: /** sl@0: Synchronous method which pauses the current on-going task. sl@0: @return An error code indicating if the function call was successful. KErrNone on success, otherwise sl@0: another of the system-wide error codes. sl@0: */ sl@0: virtual TInt Pause () = 0; sl@0: sl@0: /** sl@0: Synchronous method which stops the current on-going task. sl@0: */ sl@0: virtual void Stop () = 0; sl@0: sl@0: /** sl@0: Synchronous method which returns the current state of the Processing Unit. sl@0: @return The current state of the Processing Unit. sl@0: */ sl@0: virtual TProcessingUnitState State() = 0; sl@0: sl@0: /** sl@0: Synchronous method which requests an extension feature. sl@0: This is intended to provide additional features. sl@0: @param aUid sl@0: Used to indicate which interface is required. sl@0: @return Standard error code. KErrNotSupported is used to indicate that the particular sl@0: plugin is used. sl@0: */ sl@0: virtual TInt CreateCustomInterface(TUid aUid) = 0; sl@0: sl@0: /** sl@0: Synchronous method which returns a previously created extension. sl@0: This returns a custom interface. This should only be used if CreateCustomInterface() has already sl@0: been called for the same UID value. This means that any construction for that interface sl@0: has already been called, and thus this call cannot fail. sl@0: @param aUid sl@0: Used to indicate which interface is required. sl@0: @return The requested interface, or NULL if not known. sl@0: @see CMdfProcessingUnit::CreateCustomInterface() sl@0: */ sl@0: virtual TAny* CustomInterface(TUid aUid) = 0; sl@0: sl@0: /** sl@0: Destructor. sl@0: sl@0: The destructor is called by ECom framework allowing derived classes sl@0: to clean up the implementation specific resources. sl@0: */ sl@0: inline virtual ~CMdfProcessingUnit(); sl@0: sl@0: private: sl@0: TUid iDtor_ID_Key; sl@0: }; sl@0: sl@0: #include sl@0: sl@0: #endif // MDFPROCESSINGUNIT_H