os/boardsupport/haitest/bspsvs/suite/bsp/sound/inc/t_mdadevsounddata.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 /*
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:
    15 *
    16 */
    17 
    18 /**
    19 @test
    20 @internalComponent
    21 
    22 This contains CT_MdaDevSoundData
    23 */
    24 
    25 #if (!defined __T_MDADEVSOUND_DATA_H__)
    26 #define __T_MDADEVSOUND_DATA_H__
    27 
    28 //	User Includes
    29 #include "DataWrapperBase.h"
    30 #include "sound_util.h"
    31 #include "t_soundactivecallback.h"
    32 
    33 //	EPOC includes
    34 #include <mdasound.h>
    35 #include <e32twin.h>
    36 
    37 /**
    38  * Class to wrap RMdaDevSound APIs.
    39  *
    40  */
    41 class CT_MdaDevSoundData: public CDataWrapperBase
    42 	{
    43 public:
    44 	/**
    45 	* Two phase constructor
    46 	*
    47 	* @leave	system wide error
    48 	*/
    49 	static CT_MdaDevSoundData*	NewL(RMdaDevSound* aServerStore);
    50 	/**
    51 	* Public destructor
    52 	*/
    53 	~CT_MdaDevSoundData();
    54 
    55 	/**
    56 	* Process a command read from the ini file
    57 	*
    58 	* @param	aCommand requiring command to be processed
    59 	* @param	aSection the section in the ini file requiring the command to be processed
    60 	* @param	aAsyncErrorIndex the index of asynchronous command error code belongs to.
    61 	* 
    62 	* @leave	system wide error
    63 	*
    64 	* @return	ETrue if the command is processed
    65 	*/
    66 	virtual TBool	DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
    67 
    68 	/**
    69 	* Return a pointer to the object that the data wraps
    70 	*
    71 	* @return	pointer to the object that the data wraps
    72 	*/
    73 	virtual TAny*	GetObject();
    74 	virtual void	SetObjectL(TAny* aAny);
    75 	virtual void	DisownObjectL();
    76 
    77 	inline virtual 	TCleanupOperation CleanupOperation();
    78 
    79 	/**
    80 	* Query to see if there are any outstanding requests
    81 	*
    82 	* @return ETrue if there are any outstanding requests
    83 	*/
    84 	
    85 	void RunL(CActive* aActive, TInt aIndex);
    86 	void DoCancel(CActive* aActive, TInt aIndex);
    87 
    88 protected:
    89 	/**
    90 	* Protected constructor. First phase construction
    91 	*/
    92 	CT_MdaDevSoundData(RMdaDevSound* aServerStore);
    93 	/**
    94 	* Second phase construction
    95 	*/
    96 	void ConstructL();
    97 
    98 private:
    99 	static void CleanupOperation( TAny* aAny );
   100 
   101 	/**
   102 	* General commands
   103 	*/
   104 	void	DoCmdNewL();
   105 	void	DoCmdOpen(const TDesC& aSection);
   106 	void	DoCmdClose();
   107 	void	DoCmdDestructor();
   108 	void	DoCmdIsMdaSound();
   109 	void	DoCmdVersionRequired(const TDesC& aSection);
   110 
   111 	/**
   112 	* Playback commands
   113 	*/
   114 	void	DoCmdPlayVolume(const TDesC& aSection);
   115 	void	DoCmdSetPlayVolume(const TDesC& aSection);
   116 	void	DoCmdPlayDataL(const TDesC& aSection, const TInt aAsyncErrorIndex);
   117 	void	DoCmdCancelPlayData();
   118 	void	DoCmdFlushPlayBuffer();
   119 	void	DoCmdNotifyPlayErrorL(const TInt aAsyncErrorIndex);
   120 	void	DoCmdCancelNotifyPlayError();
   121 	void	DoCmdBytesPlayed(const TDesC& aSection);
   122 	void	DoCmdResetBytesPlayed();
   123 	void	DoCmdPausePlayBuffer();
   124 	void	DoCmdResumePlaying();
   125 
   126 	/**
   127 	* Recording commands
   128 	*/
   129 	void	DoCmdRecordDataL(const TDesC& aSection, const TInt aAsyncErrorIndex);
   130 	void	DoCmdCancelRecordData();
   131 	void	DoCmdFlushRecordBuffer();
   132 	void	DoCmdRecordLevel(const TDesC& aSection);	
   133 	void	DoCmdSetRecordLevel(const TDesC& aSection);
   134 	void	DoCmdNotifyRecordErrorL(const TInt aAsyncErrorIndex);
   135 	void	DoCmdCancelNotifyRecordError();
   136 	
   137 	/**
   138 	* Format commands
   139 	*/
   140 	void	DoCmdPlayFormatsSupportedL(const TDesC& aSection);
   141 	void	DoCmdGetPlayFormatL(const TDesC& aSection);
   142 	void	DoCmdSetPlayFormatL(const TDesC& aSection);
   143 	void	DoCmdRecordFormatsSupportedL(const TDesC& aSection);
   144 	void	DoCmdGetRecordFormatL(const TDesC& aSection);
   145 	void	DoCmdSetRecordFormatL(const TDesC& aSection);
   146 	
   147 	/**
   148 	* Utility commands
   149 	*/
   150 	void DoCmdUtilityLoadDrivers(const TDesC& aSection);
   151 	void DoCmdUtilityFreeDrivers(const TDesC& aSection);
   152 	void DoCmdUtilityDeleteFileL(const TDesC& aSection);
   153 
   154 	/**
   155 	* Helper commands
   156 	*/
   157 	void	DoCleanup();
   158 	
   159 
   160 private:
   161 	/** RMdaDevSound class instance that is tested */
   162 	RMdaDevSound*										iMdaDevSound;
   163 	
   164 	/** Reference to RMdaDevSound object stored on server side */
   165 	RMdaDevSound* 										iServerStore;
   166 
   167 	/** The request status for playback errors */
   168 	RPointerArray<CActiveCallback>						iNotifyPlayError;
   169 
   170 	/** The request status for recording errors */
   171 	RPointerArray<CActiveCallback>						iNotifyRecordError;
   172 
   173 	/** The request status for sound playback */
   174 	RPointerArray<CT_SoundActiveCallback>				iPlay;
   175 
   176 	/** The request status for sound recording */
   177 	RPointerArray<CT_SoundActiveCallback>				iRecord;
   178 	};
   179 
   180 #define GET_MANDATORY_STRING_PARAMETER(aParamName, aSection, aResult)		GetCommandStringParameter(aParamName, aSection, aResult, (TText8*)__FILE__, __LINE__, ETrue)
   181 #define GET_MANDATORY_INT_PARAMETER(aParamName, aSection, aResult)		GetCommandIntParameter(aParamName, aSection, aResult,(TText8*) __FILE__, __LINE__, ETrue)
   182 #define GET_MANDATORY_INT64_PARAMETER(aParamName, aSection, aResult)		GetCommandInt64Parameter(aParamName, aSection, aResult,(TText8*) __FILE__, __LINE__, ETrue)
   183 #define GET_MANDATORY_BOOL_PARAMETER(aParamName, aSection, aResult)		GetCommandBoolParameter(aParamName, aSection, aResult, (TText8*)__FILE__, __LINE__, ETrue)
   184 
   185 #define GET_OPTIONAL_STRING_PARAMETER(aParamName, aSection, aResult)		GetCommandStringParameter(aParamName, aSection, aResult, (TText8*) __FILE__, __LINE__, EFalse)
   186 #define GET_OPTIONAL_INT_PARAMETER(aParamName, aSection, aResult)		GetCommandIntParameter(aParamName, aSection, aResult,(TText8*) __FILE__, __LINE__, EFalse)
   187 #define GET_OPTIONAL_INT64_PARAMETER(aParamName, aSection, aResult)		GetCommandInt64Parameter(aParamName, aSection, aResult,(TText8*) __FILE__, __LINE__, EFalse)
   188 #define GET_OPTIONAL_BOOL_PARAMETER(aParamName, aSection, aResult)		GetCommandBoolParameter(aParamName, aSection, aResult,(TText8*) __FILE__, __LINE__, EFalse)
   189 
   190 #endif /* __T_MDADEVSOUND_DATA_H__ */