sl@0: /* sl@0: * Copyright (c) 2007-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: sl@0: sl@0: #ifndef FEATUREINFOPLUGIN_H sl@0: #define FEATUREINFOPLUGIN_H sl@0: sl@0: /** sl@0: @file sl@0: @publishedPartner sl@0: @released sl@0: sl@0: This header file holds the definitions for the Feature Manager adaptation sl@0: interface - Feature Info Plug-in API. sl@0: It holds interface and command definitions and the related command and response sl@0: types and structures used over this interface. sl@0: */ sl@0: sl@0: sl@0: // INCLUDES sl@0: sl@0: #include sl@0: #include sl@0: sl@0: sl@0: // CONSTANTS sl@0: sl@0: /** sl@0: This constant holds the ECOM Instantiation Interface UID. This interface UID sl@0: identifies plug-in implementations that derive from CFeatureInfoPlugin. sl@0: This interface is used by the Feature Manager server when it is started up. sl@0: @see CFeatureInfoPlugin sl@0: */ sl@0: const TUid KFeatureInfoPluginInterfaceUid = { 0x10205057 }; sl@0: sl@0: sl@0: // TYPES & STRUCTURES sl@0: sl@0: /** sl@0: FeatureInfoCommand namespace groups the command ID enumerations, structures sl@0: and types used over the CFeatureInfoPlugin interface. sl@0: */ sl@0: namespace FeatureInfoCommand sl@0: { sl@0: sl@0: /** sl@0: Command definitions sl@0: All commands contain a command Id and a set of parameters. The command sl@0: Ids are defined first then the parameters for each command. sl@0: sl@0: The CFeatureInfoPlug ininterface is asynchronous. A command Id is sent to sl@0: the plugin through CFeatureInfoPlugin::ProcessCommandL(). If the command is sl@0: supported by the plug-in it schedules an active object to do the work and sl@0: call MFeatureInfoPluginCallback::ProcessResponseL() to complete the command. sl@0: If the command is not supported, the plug-in should leave with sl@0: KErrNotSupported. sl@0: sl@0: The field Input means the parameter for the command. sl@0: The field Output means the parameter for the response. sl@0: @see CFeatureInfoPlugin sl@0: @see MFeatureInfoPluginCallback sl@0: */ sl@0: enum TFeatureInfoCmd sl@0: { sl@0: /** sl@0: No command. May be used for sanity checks, but sl@0: never as an actual command ID. sl@0: Input None sl@0: Output None sl@0: */ sl@0: ENoCommandId = 1000, sl@0: sl@0: /** sl@0: FM uses this command to request feature information of read-only sl@0: features, aka simple features, known to the plug-in. Implementations sl@0: should used this command to return such features, if any are known. sl@0: If no such features are known to the plug-in it should leave with sl@0: KErrNotSupported, hence this command is optional. sl@0: Features contained in a response to this command should not appear sl@0: in ELoadEnhancedFeatureInfoCmdId responses, for efficiency. sl@0: Input None sl@0: Output TFeatureInfoRespPckg sl@0: */ sl@0: ELoadFeatureInfoCmdId, sl@0: sl@0: /** sl@0: FM uses this command to request feature information of sl@0: features that have custom flags and user-data, that are known to the sl@0: plug-in. Implementations should use this command to return such sl@0: features, if any are known. If no such features are known to the sl@0: plug-in it should leave with KErrNotSupported, hence this command is sl@0: optional. sl@0: Features contained in a response to this command should not appear sl@0: in ELoadFeatureInfoCmdId responses, for efficiency. sl@0: Input None sl@0: Output TEnhancedFeatureInfoRespPckg sl@0: */ sl@0: ELoadEnhancedFeatureInfoCmdId sl@0: }; sl@0: sl@0: /** sl@0: Data structure used to list the features in data structure TFeatureInfo. sl@0: Used in ELoadFeatureInfoCmdId commands. sl@0: */ sl@0: struct TFeature sl@0: { sl@0: // UID of the feature, as found in a system header file. sl@0: TUint32 iFeatureID; sl@0: sl@0: // Value of the 'Supported?' feature flag. sl@0: // If feature has been turned OFF from a product the value is set to sl@0: // EFalse and if it has been turned ON the value is set to ETrue. sl@0: TBool iValue; sl@0: }; sl@0: sl@0: /** sl@0: Data structure used to pass data with ELoadFeatureInfoCmdId response. sl@0: Used in ELoadFeatureInfoCmdId commands. It contains the return code for sl@0: the command iErrorCode and is typically: sl@0: No leave, just returns - iList contains feature entries. sl@0: KErrNotSuppoted - no features to report for this command. sl@0: ... - other system wide error. sl@0: */ sl@0: struct TFeatureInfo sl@0: { sl@0: // System wide error code. sl@0: TInt iErrorCode; sl@0: sl@0: // List of read-only feature entries. sl@0: RArray iList; sl@0: }; sl@0: sl@0: /** Data package for ELoadFeatureInfoCmdId response structure */ sl@0: typedef TPckgBuf TFeatureInfoRespPckg; sl@0: sl@0: /** sl@0: Data structure used to pass data with ELoadEnhancedFeatureInfoCmdId sl@0: response. Used in ELoadEnhancedFeatureInfoCmdId commands. It contains the sl@0: return code for the command iErrorCode and is typically: sl@0: No leave, just returns - iList contains feature entries. sl@0: KErrNotSuppoted - no features to report for this command. sl@0: ... - other system wide error. sl@0: @see RFeatureArray sl@0: */ sl@0: struct TEnhancedFeatureInfo sl@0: { sl@0: // System wide error code. sl@0: TInt iErrorCode; sl@0: sl@0: // List of enhanced feature records. sl@0: // List consists of TFeatureEntry entries. Plugin should initialize sl@0: // feature ID and feature support status flag and optionally any other sl@0: // feature flags as specified in TFeatureFlags. If feature has sl@0: // associated user-data, it should be initialized for response as well. sl@0: // If there is no user-data value this must be set to 0. sl@0: // For type definitions see featurecmn.h sl@0: RFeatureArray iList; sl@0: }; sl@0: sl@0: /** Data package for ELoadEnhancedFeatureInfoCmdId response structure */ sl@0: typedef TPckgBuf TEnhancedFeatureInfoRespPckg; sl@0: sl@0: } // end namespace sl@0: sl@0: sl@0: // CLASS DECLARATION sl@0: sl@0: /** sl@0: This M-class is an interface class implemented by FM server to receive sl@0: feature information responses from adaptation plug-ins i.e. they call the sl@0: server back with the data. Reference supplied to the plugin implementation sl@0: at construction and available in iResponseCallback. sl@0: sl@0: @see CFeatureInfoPlugin sl@0: */ sl@0: class MFeatureInfoPluginCallback sl@0: { sl@0: public: sl@0: /** sl@0: Method to return data in response to a message from sl@0: a Feature Info plugin. The related ProcessCommandL call sl@0: must return before this method can be called. sl@0: sl@0: @param aCommandId Command ID for which the response comes sl@0: @param aTransId Transcation identifier of sl@0: the original command sl@0: @param aData Data returned from call. sl@0: Data package contents are defined by command. sl@0: Can be deleted right after sl@0: ProcessResponseL has returned. sl@0: */ sl@0: virtual void ProcessResponseL( sl@0: const FeatureInfoCommand::TFeatureInfoCmd aCommandId, sl@0: const TUint8 aTransId, sl@0: TDesC8& aData ) = 0; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Feature Manager ECOM Plugin interface class to be implemented by adaptation. sl@0: As it is an adaptation interface implementations are only loaded from ROM. sl@0: sl@0: Implementations of this interface are created by the Feature Manager server sl@0: during start up in it's main thread where an Active Scheduler is installed. sl@0: Implementations must perform minmial work in ProcessCommandL() and return. sl@0: Plugin work and calls to ProcessResponseL() must be performed asynchronsly in sl@0: an active object callback running in the server's main thread. sl@0: sl@0: For the command Ids and types used with this interface see definitions in the sl@0: FeatureInfoCommand namespace. sl@0: sl@0: @see MFeatureInfoPluginCallback sl@0: @see KFeatureInfoPluginInterfaceUid sl@0: */ sl@0: class CFeatureInfoPlugin : public CBase sl@0: { sl@0: public: // construction and destruction sl@0: sl@0: /** sl@0: Constructor method for instance. sl@0: Uses ECom to find correct instance. sl@0: sl@0: @param aImplementationUid UID of the interface sl@0: implementation to instantiate. sl@0: @param aResponseCallback Reference to plugin callback handler. sl@0: */ sl@0: inline static CFeatureInfoPlugin* NewL(TUid aImplementationUid, sl@0: MFeatureInfoPluginCallback& aResponseCallback); sl@0: sl@0: /** sl@0: Destructor sl@0: */ sl@0: inline virtual ~CFeatureInfoPlugin(); sl@0: sl@0: public: sl@0: /** sl@0: Method to invoke a particular command in the plugin. sl@0: Response to method is returned via separate ProcessResponseL sl@0: call. Call to ProcessResponseL is done after the call to sl@0: ProcessCommandL returns. sl@0: Leaves with error code KErrNotSupported if command ID is not sl@0: supported by the plug-in. If ProcessCommandL leaves, no corresponding sl@0: ProcessResponseL is expected. sl@0: sl@0: @param aCommandId Command ID sl@0: @param aTransId Transaction ID sl@0: @param aData Data associated with command. sl@0: Data package contents are defined by command. sl@0: Some commands require no data and pass sl@0: empty buffer as aData. sl@0: @leave KErrNotSupported aCommandId not supported by plug-in. sl@0: */ sl@0: virtual void ProcessCommandL( sl@0: const FeatureInfoCommand::TFeatureInfoCmd aCommandId, sl@0: const TUint8 aTransId, sl@0: TDesC8& aData ) = 0; sl@0: sl@0: sl@0: protected: sl@0: /** sl@0: Callback pointer to be used with responses to commands. sl@0: This pointer is not owned by this class. sl@0: */ sl@0: MFeatureInfoPluginCallback* iResponseCallback; // not owned sl@0: sl@0: private: sl@0: /** Destructor identifier to be used with ECom framework. */ sl@0: TUid iDestructorIDKey; sl@0: }; sl@0: sl@0: #include sl@0: sl@0: #endif // FEATUREINFOPLUGIN_H sl@0: sl@0: // End of File