omxil/mmilapi/ilif/inc/milcomponentif.h
changeset 56 b6488ac24ddc
parent 47 481b3bce574a
child 57 1cbb0d5bf7f2
equal deleted inserted replaced
47:481b3bce574a 56:b6488ac24ddc
     1 // Copyright (c) 2008-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  @internalTechnology
       
    19  @prototype
       
    20 */
       
    21 
       
    22 #ifndef MILCOMPONENTIF_H
       
    23 #define MILCOMPONENTIF_H
       
    24 
       
    25 #include <e32base.h>
       
    26 #include "ilifbase.h"
       
    27 #include "tilstruct.h"
       
    28 
       
    29 class MILIfObserver;
       
    30 class MILComponentPortIf;
       
    31 
       
    32 /**
       
    33 IL Component interface class
       
    34 */
       
    35 class MILComponentIf
       
    36 	{
       
    37 public:
       
    38 
       
    39 	/**
       
    40 	Synchronous method which creates the physical IL Component.
       
    41 	
       
    42 	@param  aComponentName
       
    43 			The string identifying the name of the component.
       
    44 	@param  aComponentObserver
       
    45 			The class to receive asynchronous component events.
       
    46 	@leave 	System wide error.
       
    47 	*/
       
    48 	virtual void CreateComponentL(const TDesC8& aComponentName, MILIfObserver& aComponentObserver) = 0;
       
    49 
       
    50 	/**
       
    51 	Synchronous method which creates the physical IL Component.
       
    52 	
       
    53 	@param  aComponentUID
       
    54 			The UIF identifying a particular component implementation.
       
    55 	@param  aComponentObserver
       
    56 			The class to receive asynchronous component events.
       
    57 	@leave 	System wide error.
       
    58 	*/
       
    59 	virtual void CreateComponentL(const TUid& aComponentUID, MILIfObserver& aComponentObserver) = 0;
       
    60 
       
    61 	/**
       
    62 	Called by the IL client to release the component associated to this interface
       
    63 	*/
       
    64 	virtual void ReleaseComponent() = 0;
       
    65 	
       
    66 	/**
       
    67 	Synchronous method which returns the input ports a component holds. 
       
    68 	The array is cleared before appending ports.
       
    69 	
       
    70 	@param  aComponentPorts
       
    71 			The array to which the input ports will be appended.
       
    72 	@return An error code indicating if the function call was successful. KErrNone on success, otherwise
       
    73 	        another of the system-wide error codes.
       
    74 	*/
       
    75 	virtual TInt GetComponentInputPorts(RPointerArray<MILComponentPortIf>& aComponentPorts) const = 0;
       
    76 
       
    77 	/**
       
    78 	Synchronous method which returns the output ports a component holds.
       
    79 	The array is cleared before appending ports.
       
    80 	
       
    81 	@param  aComponentPorts
       
    82 			The array to which the output ports will be appended.
       
    83 	@return An error code indicating if the function call was successful. KErrNone on success, otherwise
       
    84 	        another of the system-wide error codes.
       
    85 	*/
       
    86 	virtual TInt GetComponentOutputPorts(RPointerArray<MILComponentPortIf>& aComponentPorts) const = 0;
       
    87 
       
    88 	/**
       
    89 	Synchronous method which sets the configuration for a Component.
       
    90 	Note that in the omx implementation of this interface this function will be used for both SetParameter()
       
    91 	and SetConfig()
       
    92 
       
    93 	@param  aConfig
       
    94 			The reference to the structure that contains the configuration data.
       
    95 	@param  aComponentPort
       
    96 			The component's port to be configured when needed, otherwise NULL.
       
    97 	@return An error code indicating if the function call was successful. KErrNone on success, otherwise
       
    98 	        another of the system-wide error codes.	
       
    99 	@see TILStruct
       
   100 	*/
       
   101 	virtual TInt SetConfig(const TILStruct& aConfig, const MILComponentPortIf* aComponentPort = NULL) = 0;
       
   102 	
       
   103 	/**
       
   104 	Synchronous method which gets a configuration structure from a component.
       
   105 	Note that in the omx implementation of this interface this function will be used for both GetParameter()
       
   106 	and GetConfig()
       
   107 	
       
   108 	@param  aConfig
       
   109 			The reference to the structure that is to contain the configuration information.
       
   110 	@param  aComponentPort
       
   111 			The component's port to be queried when needed, otherwise NULL.
       
   112 	@return An error code indicating if the function call was successful. KErrNone on success, otherwise
       
   113 	        another of the system-wide error codes.	
       
   114 	@see TILStruct
       
   115 	*/
       
   116 	virtual TInt GetConfig(TILStruct& aConfig, const MILComponentPortIf* aComponentPort = NULL) const = 0;	
       
   117 	
       
   118 	/**
       
   119 	Asynchronous method which instructs the Component to start the initialization. 
       
   120 	An event is sent to the component's observer on completion.
       
   121 	
       
   122 	@return An error code indicating if the function call was successful. KErrNone on success, otherwise
       
   123 	        another of the system-wide error codes.
       
   124 	@see MILIfObserver::MsgFromILComponent()
       
   125 	*/
       
   126 	virtual TInt Initialize() = 0;
       
   127 
       
   128 	/**
       
   129 	Asynchronous method which instructs the Component to start the execution. 
       
   130 	An event is sent to the component's observer on completion.
       
   131 	
       
   132 	@return An error code indicating if the function call was successful. KErrNone on success, otherwise
       
   133 	        another of the system-wide error codes.
       
   134 	@see MILIfObserver::MsgFromILComponent()
       
   135 	*/
       
   136 	virtual TInt Execute() = 0; 
       
   137 
       
   138 	/**
       
   139 	Asynchronous method which pauses the current on-going task.
       
   140 	An event is sent to the component's observer on completion.
       
   141 	
       
   142 	@return An error code indicating if the function call was successful. KErrNone on success, otherwise
       
   143 	        another of the system-wide error codes.
       
   144 	@see MILIfObserver::MsgFromILComponent()
       
   145 	*/
       
   146 	virtual TInt Pause() = 0;
       
   147 
       
   148 	/**
       
   149 	Asynchronous method which stops the current on-going task. 
       
   150 	An event is sent to the component's observer on completion.
       
   151 
       
   152 	@return An error code indicating if the function call was successful. KErrNone on success, otherwise
       
   153 	        another of the system-wide error codes.
       
   154 	@see MILIfObserver::MsgFromILComponent()
       
   155 	*/
       
   156 	virtual TInt Stop() = 0;
       
   157 
       
   158 	/**
       
   159 	Asynchronous method which moves the component back to its uninitialized state. 
       
   160 	An event is sent to the component's observer on completion.
       
   161 
       
   162 	@return An error code indicating if the function call was successful. KErrNone on success, otherwise
       
   163 	        another of the system-wide error codes.
       
   164 	@see MILIfObserver::MsgFromILComponent()
       
   165 	*/
       
   166 	virtual TInt UnInitialize() = 0;
       
   167 
       
   168 	/**
       
   169 	Synchronous method which returns the current state of the Component.
       
   170 	
       
   171 	@param  aState
       
   172  			The current state of the Component.
       
   173 	@return An error code indicating if the function call was successful. KErrNone on success, otherwise
       
   174 	        another of the system-wide error codes.
       
   175 	*/
       
   176 	virtual TInt GetState(TILComponentState& aState) const = 0;
       
   177 
       
   178 	/**
       
   179 	Synchronous method which sends a command to the component.
       
   180 	
       
   181 	@param  aCommand
       
   182 			The reference to the structure that is to contain the command to be executed by the component.
       
   183 	@return An error code indicating if the function call was successful. KErrNone on success, otherwise
       
   184 	        another of the system-wide error codes.
       
   185 	@see TILCommand
       
   186 	*/
       
   187 	virtual TInt SendCommand(const TILCommand& aCommand) = 0;
       
   188 
       
   189 	/**	
       
   190 	Asynchronous function used to flush all component ports. 
       
   191 	An event is sent to the component's observer on completion.
       
   192 	
       
   193 	@return An error code indicating if the function call was successful. KErrNone on success, otherwise
       
   194 	        another of the system-wide error codes.
       
   195 	*/
       
   196 	virtual TInt FlushAllPorts() = 0;
       
   197 
       
   198 	/**	
       
   199 	Called by the IL client to query the component about the roles it supports. 
       
   200 	A component role  is a string identifying the behaviour of the component.
       
   201 	
       
   202 	@param  aComponentRole
       
   203 			The pointer to the string returned identifying the role of the component.
       
   204 	@param  aIndex
       
   205 			The index of the component's role being queried.
       
   206 	@return An error code indicating if the function call was successful. KErrNone on success, otherwise
       
   207 	        another of the system-wide error codes.
       
   208 	*/
       
   209 	virtual TInt ComponentRoleEnum(TPtr8& aComponentRole, TUint32 aIndex) const = 0;
       
   210  
       
   211 
       
   212 	/**	
       
   213 	Called by the IL client to query the component's version.
       
   214 	
       
   215 	@param  aVersion
       
   216 			The reference to the structure that is to contain the version of the component
       
   217 	@return An error code indicating if the function call was successful. KErrNone on success, otherwise
       
   218 	        another of the system-wide error codes.
       
   219 	@see TILComponentVersion
       
   220 	*/
       
   221 	virtual TInt GetComponentVersion(TILComponentVersion& aVersion) const = 0;
       
   222 
       
   223 	/**
       
   224 	Synchronous method which uses a standardized OpenMAX or vendor-specific extension string 
       
   225 	to set a particular component configuration.
       
   226 	Note that in the OMX implementation of this interface this function will be used for both 
       
   227 	SetParameter() and SetConfig().
       
   228 	
       
   229 	@param  aParameterName
       
   230 			The string that identifies the data container.
       
   231 	@param  aConfig
       
   232 			The reference to the structure that allows access to the data container used for this 
       
   233 			particular component configuration
       
   234 	@param  aComponentPort
       
   235 			The component's port to which the config command is targeted to.
       
   236 	@return An error code indicating if the function call was successful. KErrNone on success, otherwise
       
   237 	        another of the system-wide error codes.	
       
   238 	@see TILStruct
       
   239 	*/
       
   240 	virtual TInt SetExtConfig(const TDesC8& aParameterName, const TILStruct& aConfig, const MILComponentPortIf* aComponentPort = NULL) = 0;
       
   241 	
       
   242 	/**
       
   243 	Synchronous method which uses a standardized OpenMAX or vendor-specific extension string 
       
   244 	to get a particular component configuration.
       
   245 	
       
   246 	@param  aParameterName
       
   247 			The string that identifies the data container.
       
   248 	@param  aConfig
       
   249 			The reference to the structure to access the component's configuration data.
       
   250 	@param  aComponentPort
       
   251 			The component's port to which the config command is targeted to.
       
   252 	@return An error code indicating if the function call was successful. KErrNone on success, otherwise
       
   253 	        another of the system-wide error codes.	
       
   254 	@see TILStruct
       
   255 	*/
       
   256 	virtual TInt GetExtConfig(const TDesC8& aParameterName, TILStruct& aConfig, const MILComponentPortIf* aComponentPort = NULL) const = 0;
       
   257 	
       
   258 	
       
   259 	/**
       
   260 	Synchronous method to set a particular instance of this interface to the specific role passed as a parameter. 
       
   261 	A single implementation of this API may support various component roles. It is necessary for the 
       
   262 	implementation to know what type of component is configuring so that the appropriate translation of 
       
   263 	configuration parameters can be chosen.
       
   264 	The role UIDs may be defined by the client application and can be mapped be the implementation of this API
       
   265 	to roles the components under this layer understand.
       
   266 
       
   267 	@param  aFormat
       
   268 			The UID identifying the role to be played by the implementation of this API.
       
   269 	@return An error code indicating if the function call was successful. KErrNone on success, otherwise
       
   270 	        another of the system-wide error codes.	
       
   271 	*/
       
   272 	virtual TInt SetComponentIfRole(const TUid& aComponentRole) = 0;
       
   273 
       
   274 	/**
       
   275 	Synchronous method to set a particular instance of this interface to the specific role passed as a parameter. 
       
   276 	A single implementation of this API may support various component roles. It is necessary for the 
       
   277 	implementation to know what type of component is configuring so that the appropriate translation of 
       
   278 	configuration parameters can be chosen.
       
   279 	Usually the component role names are defined by a known standard body. For instance role names are defined
       
   280 	for OpenMAX IL Standard Components by Khronos Group.
       
   281 	
       
   282 	@param  aComponentRole
       
   283 			The string identifying the role to be played by the implementation of this API.
       
   284 	@return An error code indicating if the function call was successful. KErrNone on success, otherwise
       
   285 	        another of the system-wide error codes.	
       
   286 	*/
       
   287 	virtual TInt SetComponentIfRole(const TDesC8& aComponentRole) = 0;
       
   288 
       
   289 	/**
       
   290 	Synchronous method to query about the particular role the interface is set to.
       
   291 	A single implementation of this API can support various roles, however the role of the interface
       
   292 	is that of the physical component instantiated under this interface.
       
   293 	The role of the interface is set by the client after the component creation by calling SetComponentIfRole.
       
   294 	The role UIDs may be defined by the client application and can be mapped be the implementation of this API
       
   295 	to roles the components under this layer understand.
       
   296 	
       
   297 	@param  aComponentRole
       
   298 			The UID identifying this interface's role which is to be passed back to the caller.
       
   299 	@return An error code indicating if the function call was successful. KErrNone on success, otherwise
       
   300 	        another of the system-wide error codes.	
       
   301 	*/
       
   302 	virtual TInt GetComponentIfRole(TUid& aComponentRole) const = 0;
       
   303 
       
   304 	/**
       
   305 	Synchronous method to query about the particular role the interface is set to.
       
   306 	A single implementation of this API can support various roles, however the role of the interface
       
   307 	is that of the [hysical component instantiated under this interface.
       
   308 	The role of the interface is set by the client after the component creation by calling SetComponentIfRole.
       
   309 	Usually the component role names are defined by a known standard body. For instance role names are defined
       
   310 	for OpenMAX IL Standard Components by Khronos Group.
       
   311 
       
   312 	@param  aComponentRole
       
   313 			The string identifying this interface's role which is to be passed back to the caller.
       
   314 	@return An error code indicating if the function call was successful. KErrNone on success, otherwise
       
   315 	        another of the system-wide error codes.	
       
   316 	*/
       
   317 	virtual TInt GetComponentIfRole(TDes8& aComponentRole) const = 0;
       
   318 
       
   319 	/**
       
   320 	Synchronous method used to identify a particular interface implementation. 
       
   321 	It takes as a parameter the UID identifying the type of the interface requested and 
       
   322 	it returns a pointer to the specified interface or NULL if it does not exist. 
       
   323 	Must be cast to correct type by the user
       
   324 
       
   325 	@param  aInterfaceId
       
   326 			The UID associated with the interface requested.
       
   327 	@return A pointer to the specified interface or NULL if it has not be implemented.	
       
   328 	*/
       
   329 	virtual TAny* CustomInterface(TUid aInterfaceId) = 0;
       
   330 
       
   331 	};
       
   332 
       
   333 	
       
   334 #endif // MILCOMPONENTIF_H