os/mm/devsound/a3fdevsound/src/mmfdevsoundproxy/mmfdevsoundproxy.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/devsound/a3fdevsound/src/mmfdevsoundproxy/mmfdevsoundproxy.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,852 @@
     1.4 +/*
     1.5 +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +
    1.23 +#ifndef RMMFDEVSOUNDPROXY_H
    1.24 +#define RMMFDEVSOUNDPROXY_H
    1.25 +
    1.26 +//  INCLUDES
    1.27 +#include <mmf/common/mmfipc.h>
    1.28 +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    1.29 +#include <mmf/common/mmfipcserver.h>
    1.30 +#endif
    1.31 +#include <mmf/common/mcustomcommand.h>
    1.32 +#include "mmfdevsoundcallbackhandler.h"
    1.33 +#include "mmfaudioserverproxy.h"
    1.34 +
    1.35 +_LIT(KMMFDevSoundProxyPanicCategory, "MmfDevSoundProxy");
    1.36 +
    1.37 +enum TMMFDevSoundProxyPanicCodes
    1.38 +	{
    1.39 +	EMMFDevSoundProxyPlayDataWithoutInitialize,
    1.40 +	EMMFDevSoundProxyRecordDataWithoutInitialize,
    1.41 +	EMMFDevSoundProxyInitCompleteInWrongState,
    1.42 +	EMMFDevSoundProxyToneFinishedInWrongState,
    1.43 +	EMMFDevSoundProxyPlayErrorInWrongState,
    1.44 +	EMMFDevSoundProxyRecordErrorInWrongState,
    1.45 +	EMMFDevSoundProxyUnexpectedConvError,
    1.46 +	EMMFDevSoundProxyCapabilitiesInWrongState,
    1.47 +	EMMFDevSoundProxyConfigInWrongState,
    1.48 +	EMMFDevSoundProxyBTBFInWrongState,
    1.49 +	EMMFDevSoundProxyBTBEInWrongState,
    1.50 +	EMMFDevSoundProxyPlayDataInWrongState,
    1.51 +	EMMFDevSoundProxyRecordDataInWrongState,
    1.52 +	EMMFDevSoundProxyNonEmptyLastBuffer,
    1.53 +	};
    1.54 +
    1.55 +
    1.56 +// FORWARD DECLARATIONS
    1.57 +class RMMFDevSoundProxy; // declared here.
    1.58 +
    1.59 +// CLASS DECLARATION
    1.60 +
    1.61 +/**
    1.62 +*  Main interface to DevSound server.
    1.63 +*
    1.64 +*  @lib MmfDevSoundProxy.lib
    1.65 +*  @since 
    1.66 +*/
    1.67 +NONSHARABLE_CLASS( RMMFDevSoundProxy ) : public RMmfSessionBase, 
    1.68 +										 public MCustomCommand,
    1.69 +										 public MDevSoundObserver,
    1.70 +										 public MMMFDevSoundCancelInitialize
    1.71 +	{
    1.72 +public:  // Constructors and destructor
    1.73 +	/**
    1.74 +	* Constructor.
    1.75 +	* @since 
    1.76 +	*/
    1.77 +	IMPORT_C RMMFDevSoundProxy();
    1.78 +
    1.79 +public: // New functions
    1.80 +
    1.81 +	/**
    1.82 +	* Open a DevSound server session
    1.83 +	* @since 
    1.84 +	* @return KErrNone if successfull, else corresponding error code
    1.85 +	*/
    1.86 +	IMPORT_C TInt Open();
    1.87 +	
    1.88 +	/**
    1.89 +	* Post open - called following successful open to complete open process.
    1.90 +	* Allows async opening
    1.91 +	* @return KErrNone successful, otherwise one of the standard system errors
    1.92 +	*/
    1.93 +	IMPORT_C TInt PostOpen(); 
    1.94 +
    1.95 +	/**
    1.96 +	* Launch DevSound instances that might have been waiting for audio
    1.97 +	* policy.
    1.98 +	* @since 
    1.99 +	* @return KErrNone if successfull, else corresponding error code
   1.100 +	*/
   1.101 +	IMPORT_C TInt SetDevSoundInfo();
   1.102 +
   1.103 +	/**
   1.104 +	* Initialize DevSound for the mode aMode.
   1.105 +	* Leaves on failure.
   1.106 +	* @since 
   1.107 +	* @param TMMFState aMode The mode for which this object will be used
   1.108 +	* @param aDevSoundCIObserver Observer which will receive Custom Interface events
   1.109 +	* 
   1.110 +	*/
   1.111 +	IMPORT_C void InitializeL(MDevSoundObserver& aDevSoundObserver,
   1.112 +	                          TMMFState aMode,
   1.113 +	                          MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver);
   1.114 +
   1.115 +	/**
   1.116 +	* Initializes DevSound object for the mode aMode for processing audio
   1.117 +	* data with hardware device aHWDev.
   1.118 +	* Leaves on failure.
   1.119 +	* @since 
   1.120 +	* @param TUid aHWDev The CMMFHwDevice implementation identifier.
   1.121 +	* @param TMMFState aMode The mode for which this object will be used
   1.122 +	* @param aDevSoundCIObserver Observer which will receive Custom Interface events
   1.123 +	* 
   1.124 +	*/
   1.125 +	IMPORT_C void InitializeL(MDevSoundObserver& aDevSoundObserver,
   1.126 +	                          TUid aHWDev,
   1.127 +	                          TMMFState aMode,
   1.128 +	                          MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver);
   1.129 +
   1.130 +	/**
   1.131 +	* Initializes DevSound object for the mode aMode for processing audio
   1.132 +	* data with hardware device supporting FourCC aDesiredFourCC.
   1.133 +	* Leaves on failure.
   1.134 +	* @since 
   1.135 +	* @param TFourCC aDesiredFourCC The CMMFHwDevice implementation FourCC
   1.136 +	*        code.
   1.137 +	* @param TMMFState aMode The mode for which this object will be used
   1.138 +	* @param aDevSoundCIObserver Observer which will receive Custom Interface events
   1.139 +	* 
   1.140 +	*/
   1.141 +	IMPORT_C void InitializeL(MDevSoundObserver& aDevSoundObserver,
   1.142 +	                          TFourCC aDesiredFourCC,
   1.143 +	                          TMMFState aMode,
   1.144 +	                          MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver);
   1.145 +
   1.146 +	/**
   1.147 +	* Returns the supported Audio settings ie. encoding, sample rates,
   1.148 +	* mono/stereo operation, buffer size etc..
   1.149 +	* @since 
   1.150 +	* @return TMMFCapabilities The device settings.
   1.151 +	*/
   1.152 +	IMPORT_C TMMFCapabilities Capabilities();
   1.153 +
   1.154 +	/**
   1.155 +	* Returns the current device configuration.
   1.156 +	* @since 
   1.157 +	* @return TMMFCapabilities The device settings.
   1.158 +	*/
   1.159 +	IMPORT_C TMMFCapabilities Config();
   1.160 +
   1.161 +	/**
   1.162 +	* Configure CMMFDevSound object with the settings in aConfig. Use this
   1.163 +	* to set sampling rate, encoding and mono/stereo.
   1.164 +	* Leaves on failure.
   1.165 +	* @since 
   1.166 +	* @param const TMMFCapabilities& aConfig The attribute values to which
   1.167 +	*        CMMFDevSound object will be configured to.
   1.168 +	* @return KErrNone if successfull, else corresponding error code
   1.169 +	*/
   1.170 +	IMPORT_C void SetConfigL(const TMMFCapabilities& aConfig);
   1.171 +
   1.172 +	/**
   1.173 +	* Returns an integer representing the maximum volume device supports.
   1.174 +	* This is the maximum value which can be passed to
   1.175 +	* CMMFDevSound::SetVolume.
   1.176 +	* @since 
   1.177 +	* @return TInt The maximum volume. This value is platform dependent but
   1.178 +	*        is always greater than or equal to one.
   1.179 +	*/
   1.180 +	IMPORT_C TInt MaxVolume();
   1.181 +
   1.182 +	/**
   1.183 +	* Returns an integer representing the current volume.
   1.184 +	* @since 
   1.185 +	* @return TInt The current volume level.
   1.186 +	*/
   1.187 +	IMPORT_C TInt Volume();
   1.188 +
   1.189 +	/**
   1.190 +	* Changes the current playback volume to a specified value. The volume
   1.191 +	* can be changed before or during playback and is effective immediately
   1.192 +	* @since 
   1.193 +	* @param TInt aVolume The volume setting. This can be any value from 0
   1.194 +	*        to the value returned by a call to
   1.195 +	*        CMMFDevSound::MaxVolume(). If the volume is not
   1.196 +	*        within this range, the volume is automatically set
   1.197 +	*        to minimum or maximum value based on the value
   1.198 +	*        that is being passed. Setting a zero value mutes
   1.199 +	*        the sound. Setting the maximum value results in
   1.200 +	*        the loudest possible sound.
   1.201 +	* @return KErrNone if successfull, else corresponding error code
   1.202 +	*/
   1.203 +	IMPORT_C TInt SetVolume(TInt aVolume);
   1.204 +
   1.205 +	/**
   1.206 +	* Returns an integer representing the maximum gain the device supports.
   1.207 +	* This is the maximum value which can be passed to CMMFDevSound::SetGain
   1.208 +	* @since 
   1.209 +	* @return TInt The maximum gain. This value is platform dependent but is
   1.210 +	*        always greater than or equal to one.
   1.211 +	*/
   1.212 +	IMPORT_C TInt MaxGain();
   1.213 +
   1.214 +	/**
   1.215 +	* Returns an integer representing the current gain.
   1.216 +	* @since 
   1.217 +	* @return TInt The current gain level.
   1.218 +	*/
   1.219 +	IMPORT_C TInt Gain();
   1.220 +
   1.221 +	/**
   1.222 +	* Changes the current recording gain to a specified value. The gain can
   1.223 +	* be changed before or during recording and is effective immediately.
   1.224 +	* @since 
   1.225 +	* @param TInt aGain The gain setting. This can be any value from zero to
   1.226 +	*        the value returned by a call to
   1.227 +	*        CMMFDevSound::MaxGain(). If the volume
   1.228 +	*        is not within this range, the gain is automatically
   1.229 +	*        set to minimum or maximum value based on the value
   1.230 +	*        that is being passed. Setting a zero value mutes the
   1.231 +	*        sound. Setting the maximum value results in the
   1.232 +	*        loudest possible sound.
   1.233 +	* @return KErrNone if successfull, else corresponding error code
   1.234 +	*/
   1.235 +	IMPORT_C TInt SetGain(TInt aGain);
   1.236 +
   1.237 +	/**
   1.238 +	* Returns the speaker balance set for playing.
   1.239 +	* Leaves on failure.
   1.240 +	* @since 
   1.241 +	* @param TInt &aLeftPercentage On return contains the left speaker
   1.242 +	*        volume percentage.
   1.243 +	* @param TInt &aRightPercentage On return contains the right speaker
   1.244 +	*        volume percentage.
   1.245 +	*/
   1.246 +	IMPORT_C void GetPlayBalanceL(TInt& aLeftPercentage,
   1.247 +	                              TInt& aRightPercentage);
   1.248 +
   1.249 +	/**
   1.250 +	* Sets the speaker balance for playing. The speaker balance can be
   1.251 +	* changed before or during playback and is effective immediately.
   1.252 +	* Leaves on failure.
   1.253 +	* @since 
   1.254 +	* @param TInt aLeftPercentage The left speaker volume percentage. This
   1.255 +	*        can be any value from zero to 100. Setting
   1.256 +	*        a zero value mutes the sound on left
   1.257 +	*        speaker.
   1.258 +	* @param TInt aRightPercentage The right speaker volume percentage.
   1.259 +	*        This can be any value from zero to 100.
   1.260 +	*        Setting a zero value mutes the sound on
   1.261 +	*        right speaker.
   1.262 +	*/
   1.263 +	IMPORT_C void SetPlayBalanceL(TInt aLeftPercentage,
   1.264 +	                              TInt aRightPercentage);
   1.265 +
   1.266 +	/**
   1.267 +	* Returns the microphone gain balance set for recording.
   1.268 +	* Leaves on failure.
   1.269 +	* @since 
   1.270 +	* @param TInt &aLeftPercentage On return contains the left microphone
   1.271 +	*        gain percentage.
   1.272 +	* @param TInt &aRightPercentage On return contains the right microphone
   1.273 +	*        gain percentage.
   1.274 +	* @return void
   1.275 +	*/
   1.276 +	IMPORT_C void GetRecordBalanceL(TInt& aLeftPercentage,
   1.277 +	                                TInt& aRightPercentage);
   1.278 +
   1.279 +	/**
   1.280 +	* Sets the microphone balance for recording. The microphone balance can
   1.281 +	* be changed before or during recording and is effective immediately.
   1.282 +	* Leaves on failure.
   1.283 +	* @since 
   1.284 +	* @param TInt aLeftPercentage The left microphone gain percentage. This
   1.285 +	*        can be any value from zero to 100. Setting
   1.286 +	*        a zero value mutes the sound from left
   1.287 +	*        microphone.
   1.288 +	* @param TInt aRightPercentage The right microphone gain percentage.
   1.289 +	*        This can be any value from zero to 100.
   1.290 +	*        Setting a zero value mutes the sound from
   1.291 +	*        right microphone.
   1.292 +	* @return void
   1.293 +	*/
   1.294 +	IMPORT_C void SetRecordBalanceL(TInt aLeftPercentage,
   1.295 +	                                TInt aRightPercentage);
   1.296 +
   1.297 +	/**
   1.298 +	* Close the server session
   1.299 +	* @since 
   1.300 +	* @return void
   1.301 +	*/
   1.302 +	IMPORT_C void Close();
   1.303 +
   1.304 +	/**
   1.305 +	* Initializes the audio device and starts the play process. This
   1.306 +	* function queries and acquires the audio policy before initializing
   1.307 +	* audio device. If there was an error during policy initialization,
   1.308 +	* PlayError() function will be called on the observer with error code
   1.309 +	* KErrAccessDenied, otherwise BufferToBeFilled() function will be called
   1.310 +	* with a buffer reference. After reading data into the buffer reference
   1.311 +	* passed, the client should call PlayData() to play data.
   1.312 +	* The amount of data that can be played is specified in
   1.313 +	* CMMFBuffer::RequestSize(). Any data that is read into buffer beyond
   1.314 +	* this size will be ignored.
   1.315 +	* Leaves on failure.
   1.316 +	* @since 
   1.317 +	* @return void
   1.318 +	*/
   1.319 +	IMPORT_C void PlayInitL();
   1.320 +
   1.321 +	/**
   1.322 +	* Initializes the audio device and starts the record process. This
   1.323 +	* function queries and acquires the audio policy before initializing
   1.324 +	* audio device. If there was an error during policy initialization,
   1.325 +	* RecordError() function will be called on the observer with error code
   1.326 +	* KErrAccessDenied, otherwise BufferToBeEmptied() function will be called
   1.327 +	* with a buffer reference. This buffer contains recorded or encoded
   1.328 +	* data. After processing data in the buffer reference passed, the client
   1.329 +	* should call RecordData() to continue recording process.
   1.330 +	* The amount of data that is available is specified in
   1.331 +	* CMMFBuffer::RequestSize().
   1.332 +	* Leaves on failure.
   1.333 +	* @since 
   1.334 +	* @return void
   1.335 +	*/
   1.336 +	IMPORT_C void RecordInitL();
   1.337 +
   1.338 +	/**
   1.339 +	* Plays data in the buffer at the current volume.
   1.340 +	* The client should fill the buffer with audio data before calling this
   1.341 +	* function. The observer gets a reference to the buffer along with the
   1.342 +	* callback function BufferToBeFilled(). When playing of the audio sample
   1.343 +	* is complete, successfully or otherwise, the function PlayError() on
   1.344 +	* the observer is called.
   1.345 +	* The last buffer of the audio stream being played should have the last
   1.346 +	* buffer flag set using CMMFBuffer::SetLastBuffer(TBool). If a
   1.347 +	* subsequent attempt to play the clip is made, this flag will need
   1.348 +	* resetting by the client.
   1.349 +	* @return void
   1.350 +	*/
   1.351 +	IMPORT_C void PlayData();
   1.352 +
   1.353 +	/**
   1.354 +	* Contine the process of recording.
   1.355 +	* Once the buffer is filled with recorded data, the Observer gets a
   1.356 +	* reference to the buffer along with the callback function
   1.357 +	* BufferToBeEmptied(). After processing the buffer (copying over to a
   1.358 +	* different buffer or writing to file) the client should call this
   1.359 +	* function to continue the recording process.
   1.360 +	* @return void
   1.361 +	*/
   1.362 +	IMPORT_C void RecordData();
   1.363 +
   1.364 +	/**
   1.365 +	* Stops the ongoing operation (Play, Record, TonePlay).
   1.366 +	* @since 
   1.367 +	* @return void
   1.368 +	*/
   1.369 +	IMPORT_C void Stop();
   1.370 +
   1.371 +	/**
   1.372 +	* Temporarily Stops the ongoing operation (Play, Record, TonePlay).
   1.373 +	* @since 
   1.374 +	* @return void
   1.375 +	*/
   1.376 +	IMPORT_C void Pause();
   1.377 +
   1.378 +	/**
   1.379 +	* Initializes the audio device and starts playing a tone. The tone is
   1.380 +	* played with the frequency and duration specified.
   1.381 +	* Leaves on failure.
   1.382 +	* @since 
   1.383 +	* @param TInt aFrequency The frequency at which the tone will be played.
   1.384 +	* @param const TTimeIntervalMicroSeconds &aDuration The period over
   1.385 +	*        which the tone will be played. A zero value causes the no tone
   1.386 +	*        to be played.
   1.387 +	* @return void
   1.388 +	*/
   1.389 +	IMPORT_C void PlayToneL(TInt aFrequency,
   1.390 +	                        const TTimeIntervalMicroSeconds& aDuration);
   1.391 +
   1.392 +	/**
   1.393 +	* Initializes audio device and starts playing a dual tone. Dual Tone is
   1.394 +	* played with the specified frequencies and for the specified duration.
   1.395 +	* Leaves on failure.
   1.396 +	* @since 
   1.397 +	* @param TInt aFrequencyOne The first frequency of dual tone.
   1.398 +	* @param TInt aFrequencyTwo The second frequency of dual tone.
   1.399 +	* @param const TTimeIntervalMicroSeconds &aDuration The period over
   1.400 +	*        which the tone will be played. A zero value causes the no tone
   1.401 +	*        to be played.
   1.402 +	* @return void
   1.403 +	*/
   1.404 +	IMPORT_C void PlayDualToneL(
   1.405 +	              TInt aFrequencyOne,
   1.406 +	              TInt aFrequencyTwo,
   1.407 +	              const TTimeIntervalMicroSeconds& aDuration);
   1.408 +
   1.409 +	/**
   1.410 +	* Initializes the audio device and starts playing the DTMF string
   1.411 +	* aDTMFString.
   1.412 +	* Leaves on failure.
   1.413 +	* @since 
   1.414 +	* @param const TDesC &aDTMFString The DTMF sequence in a descriptor.
   1.415 +	* @return void
   1.416 +	*/
   1.417 +	IMPORT_C void PlayDTMFStringL(const TDesC& aDTMFString);
   1.418 +
   1.419 +	/**
   1.420 +	* Initializes the audio device and starts playing a tone sequence.
   1.421 +	* Leaves on failure.
   1.422 +	* @since 
   1.423 +	* @param const TDesC8 &aData The tone sequence in a descriptor.
   1.424 +	* @return void
   1.425 +	*/
   1.426 +	IMPORT_C void PlayToneSequenceL(const TDesC8& aData);
   1.427 +
   1.428 +	/**
   1.429 +	* Initializes the audio device and starts playing the specified
   1.430 +	* pre-defined tone sequence.
   1.431 +	* Leaves on failure.
   1.432 +	* @since 
   1.433 +	* @param TInt aSequenceNumber The index identifying the specific
   1.434 +	*        pre-defined tone sequence. Index values are relative to zero.
   1.435 +	*        This can be any value from zero to the value returned by a call
   1.436 +	*        to FixedSequenceCount() - 1. The function raises a panic if the
   1.437 +	*        sequence number is not within this range.
   1.438 +	* @return void
   1.439 +	*/
   1.440 +	IMPORT_C void PlayFixedSequenceL(TInt aSequenceNumber);
   1.441 +
   1.442 +	/**
   1.443 +	* Defines the duration of tone on, tone off and tone pause to be used
   1.444 +	* during the DTMF tone playback operation.
   1.445 +	* Supported only during tone playing.
   1.446 +	* @since 
   1.447 +	* @param TTimeIntervalMicroSeconds32 &aToneOnLength The period over
   1.448 +	*        which the tone will be played. If this is set to zero, then the
   1.449 +	*        tone is not played.
   1.450 +	* @param TTimeIntervalMicroSeconds32 &aToneOffLength The period over
   1.451 +	*        which the no tone will be played.
   1.452 +	* @param TTimeIntervalMicroSeconds32 &aPauseLength The period over which
   1.453 +	*        the tone playing will be paused.
   1.454 +	* @return void
   1.455 +	*/
   1.456 +	IMPORT_C void SetDTMFLengths(
   1.457 +	              TTimeIntervalMicroSeconds32& aToneOnLength,
   1.458 +	              TTimeIntervalMicroSeconds32& aToneOffLength,
   1.459 +	              TTimeIntervalMicroSeconds32& aPauseLength);
   1.460 +
   1.461 +	/**
   1.462 +	* Defines the period over which the volume level is to rise smoothly
   1.463 +	* from nothing to the normal volume level.
   1.464 +	* The function is only available before playing.
   1.465 +	* @since 
   1.466 +	* @param const TTimeIntervalMicroSeconds &aRampDuration The period over
   1.467 +	*        which the volume is to rise. A zero value causes the tone
   1.468 +	*        sample to be played at the normal level for the full duration
   1.469 +	*        of the playback. A value, which is longer than the duration of
   1.470 +	*        the tone sample means that the sample never reaches its normal
   1.471 +	*        volume level.
   1.472 +	* @return void
   1.473 +	*/
   1.474 +	IMPORT_C void SetVolumeRamp(
   1.475 +	              const TTimeIntervalMicroSeconds& aRampDuration);
   1.476 +
   1.477 +	/**
   1.478 +	* Returns a list of the supported input datatypes that can be sent to
   1.479 +	* DevSound for playing audio. The datatypes returned are those that the
   1.480 +	* DevSound supports given the priority settings passed in
   1.481 +	* aPrioritySettings. Note that if no supported data types are found this
   1.482 +	* does not constitute failure, the function will return normally with no
   1.483 +	* entries in aSupportedDataTypes.
   1.484 +	* @since 
   1.485 +	* @param RArray< TFourCC > &aSupportedDataTypes The array of supported
   1.486 +	*        data types that will be filled in by this function. The
   1.487 +	*        supported data types of the DevSound are in the form of an
   1.488 +	*        array of TFourCC codes. Any existing entries in the array will
   1.489 +	*        be overwritten on calling this function. If no supported data
   1.490 +	*        types are found given the priority settings, then the
   1.491 +	*        aSupportedDatatypes array will have zero entries.
   1.492 +	* @param const TMMFPrioritySettings &aPrioritySettings The priority
   1.493 +	*        settings used to determine the supported datatypes. Note this
   1.494 +	*        does not set the priority settings. For input datatypes the
   1.495 +	*        iState member of the priority settings would be expected to be
   1.496 +	*        either EMMFStatePlaying or EMMFStatePlayingRecording. The
   1.497 +	*        priority settings may effect the supported datatypes depending
   1.498 +	*        on the audio routing.
   1.499 +	* @return void
   1.500 +	*/
   1.501 +	IMPORT_C void GetSupportedInputDataTypesL(
   1.502 +	              RArray<TFourCC>& aSupportedDataTypes,
   1.503 +	              const TMMFPrioritySettings& aPrioritySettings);
   1.504 +
   1.505 +	/**
   1.506 +	* Returns a list of the supported output dataypes that can be received
   1.507 +	* from DevSound for recording audio. The datatypes returned are those
   1.508 +	* that the DevSound supports given the priority settings passed in
   1.509 +	* aPrioritySettings. Note that if no supported data types are found this
   1.510 +	* does not constitute failure, the function will return normally with no
   1.511 +	* entries in aSupportedDataTypes.
   1.512 +	* @since 
   1.513 +	* @param RArray< TFourCC > &aSupportedDataTypes The array of supported
   1.514 +	*        data types that will be filled in by this function. The
   1.515 +	*        supported datatypes of the DevSound are in the form of an array
   1.516 +	*        of TFourCC codes. Any existing entries in the array will be
   1.517 +	*        overwritten on calling this function. If no supported datatypes
   1.518 +	*        are found given the priority settings, then the
   1.519 +	*        aSupportedDatatypes array will have zero entries.
   1.520 +	* @param const TMMFPrioritySettings &aPrioritySettings The priority
   1.521 +	*        settings used to determine the supported data types. Note this
   1.522 +	*        does not set the priority settings. For output data types the
   1.523 +	*        iState member of the priority settings would expected to be
   1.524 +	*        either EMMFStateRecording or EMMFStatePlayingRecording. The
   1.525 +	*        priority settings may effect the supported datatypes depending
   1.526 +	*        on the audio routing.
   1.527 +	* @return void
   1.528 +	*/
   1.529 +	IMPORT_C void GetSupportedOutputDataTypesL(
   1.530 +	              RArray<TFourCC>& aSupportedDataTypes,
   1.531 +	              const TMMFPrioritySettings& aPrioritySettings);
   1.532 +
   1.533 +	/**
   1.534 +	* Returns the number samples recorded so far.
   1.535 +	* @since 
   1.536 +	* @return TInt The samples recorded.
   1.537 +	*/
   1.538 +	IMPORT_C TInt SamplesRecorded();
   1.539 +
   1.540 +	/**
   1.541 +	* Returns the number samples played so far.
   1.542 +	* @since 
   1.543 +	* @return TInt The samples played.
   1.544 +	*/
   1.545 +	IMPORT_C TInt SamplesPlayed();
   1.546 +
   1.547 +	/**
   1.548 +	* Defines the number of times the audio is to be repeated during the
   1.549 +	* tone playback operation. A period of silence can follow each playing
   1.550 +	* of a tone. The tone playing can be repeated indefinitely
   1.551 +	* @since 
   1.552 +	* @param TInt aRepeatCount The number of times the tone, together with
   1.553 +	*        the trailing silence, is to be repeated. If this is set to
   1.554 +	*        KMdaRepeatForever, then the tone, together with the trailing
   1.555 +	*        silence, is repeated indefinitely or until Stop() is called.
   1.556 +	*        If this is set to zero, then the tone is not repeated.
   1.557 +	* @param const TTimeIntervalMicroSeconds &aRepeatTrailingSilence An
   1.558 +	*        interval of silence which will be played after each tone.
   1.559 +	*        Supported only during tone playing.
   1.560 +	* @return void
   1.561 +	*/
   1.562 +	IMPORT_C void SetToneRepeats(
   1.563 +	              TInt aRepeatCount,
   1.564 +	              const TTimeIntervalMicroSeconds& aRepeatTrailingSilence);
   1.565 +
   1.566 +	/**
   1.567 +	* Defines the priority settings that should be used for this instance.
   1.568 +	* @since 
   1.569 +	* @param const TMMFPrioritySettings &aPrioritySettings A class type
   1.570 +	*        representing the client's priority, priority preference and
   1.571 +	*        state
   1.572 +	* @return void
   1.573 +	*/
   1.574 +	IMPORT_C void SetPrioritySettings(
   1.575 +	              const TMMFPrioritySettings& aPrioritySettings);
   1.576 +
   1.577 +	/**
   1.578 +	* Returns the name assigned to a specific pre-defined tone sequence.
   1.579 +	* This is the number of the fixed sequence supported by DevSound by
   1.580 +	* default.
   1.581 +	* The function raises a panic if sequence number specified is invalid.
   1.582 +	* @since 
   1.583 +	* @param TInt aSequenceNumber The index identifying the specific
   1.584 +	*        pre-defined tone sequence. Index values are relative to zero.
   1.585 +	*        This can be any value from zero to the value returned by a call
   1.586 +	*        to CMdaAudioPlayerUtility::FixedSequenceCount() - 1. The
   1.587 +	*        function raises a panic if sequence number is not within this
   1.588 +	*        range.
   1.589 +	* @return const TDesC & A reference to a Descriptor containing the fixed
   1.590 +	*        sequence name indexed by aSequenceNumber.
   1.591 +	*/
   1.592 +	IMPORT_C const TDesC& FixedSequenceName(TInt aSequenceNumber);
   1.593 +
   1.594 +	/**
   1.595 +	* Retrieves a custom interface to the device.
   1.596 +	* @since 
   1.597 +	* @param TUid aInterfaceId The interface UID, defined with the custom
   1.598 +	*        interface.
   1.599 +	* @return TAny* A pointer to the interface implementation, or NULL if
   1.600 +	*        the device does not implement the interface requested. The
   1.601 +	*        return value must be cast to the correct type by the user.
   1.602 +	*/
   1.603 +	IMPORT_C TAny* CustomInterface(TUid aInterfaceId);
   1.604 +
   1.605 +	/**
   1.606 +	* Returns the number of available pre-defined tone sequences.
   1.607 +	* This is the number of fixed sequence supported by DevSound by default.
   1.608 +	* @since 
   1.609 +	* @return TInt  The fixed sequence count. This value is implementation
   1.610 +	*        dependent.
   1.611 +	*/
   1.612 +	IMPORT_C TInt FixedSequenceCount();
   1.613 +
   1.614 +	/**
   1.615 +	* Returns data buffer from the DevSound server for playback.
   1.616 +	* @since 
   1.617 +	* @param TMMFDevSoundProxyHwBufPckg& aSetPckg A reference to pckg to
   1.618 +	*        receive buffer information.
   1.619 +	* @return KErrNone if successfull, otherwise a corresponding error code
   1.620 +	*/
   1.621 +
   1.622 +	IMPORT_C TInt BufferToBeFilledData(
   1.623 +			TBool aRequestChunk, TMMFDevSoundProxyHwBufPckg& aSetPckg);
   1.624 +
   1.625 +	/**
   1.626 +	* Returns data buffer from the DevSound server for recording.
   1.627 +	* @since 
   1.628 +	* @param TMMFDevSoundProxyHwBufPckg& aSetPckg A reference to pckg to
   1.629 +	*        receive buffer information.
   1.630 +	* @return KErrNone if successfull, otherwise a corresponding error code
   1.631 +	*/
   1.632 +	IMPORT_C TInt BufferToBeEmptiedData(TMMFDevSoundProxyHwBufPckg& aSetPckg);
   1.633 +	IMPORT_C TInt RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData = KNullDesC8);
   1.634 +	IMPORT_C TInt CancelRegisterAsClient(TUid aEventType);
   1.635 +	IMPORT_C TInt GetResourceNotificationData(TUid aEventType,TDes8& aNotificationData);
   1.636 +	IMPORT_C TInt WillResumePlay();
   1.637 +	IMPORT_C TInt EmptyBuffers();
   1.638 +	IMPORT_C TInt CancelInitialize();
   1.639 +	IMPORT_C TInt SetClientThreadInfo(TThreadId& aTid);
   1.640 +
   1.641 +	/**
   1.642 +	* Sends a custom command synchronously to the DevSound server. This
   1.643 +	* method will not return until the server has serviced the command.
   1.644 +	* @since 
   1.645 +	* @param   "const TMMFMessageDestinationPckg& aDestination"
   1.646 +	*          The destination of the custom command. This consists of the
   1.647 +	*          unique ID of the interface of command handler.
   1.648 +	* @param   "TInt aFunction"
   1.649 +	*          The number of the function to be called on the command
   1.650 +	*          handler.
   1.651 +	* @param   "const TDesC8& aDataTo1"
   1.652 +	*          A reference to data to be copied to the command handler.
   1.653 +	*          The exact contents of the data are dependent on the command
   1.654 +	*          hanlder on the DevSound server. Can be NULL.
   1.655 +	* @param   "const TDesC8& aDataTo2"
   1.656 +	*          A reference to data to be copied to the command handler.
   1.657 +	*          The exact contents of the data are dependent on the command
   1.658 +	*          hanlder on the DevSound server. Can be NULL.
   1.659 +	* @param   "TDes8& aDataFrom"
   1.660 +	*          A reference to an area of memory to which the command handler
   1.661 +	*          will write any data to be passed back to the client. Cannot
   1.662 +	*          be NULL.
   1.663 +	* @return   "TInt"
   1.664 +	*          The result of the custom command. The exact range of values
   1.665 +	*          is dependent on the command handler interface.
   1.666 +	*/
   1.667 +	IMPORT_C TInt CustomCommandSync(
   1.668 +	              const TMMFMessageDestinationPckg&  aDestination,
   1.669 +	              TInt aFunction,
   1.670 +	              const TDesC8& aDataTo1,
   1.671 +	              const TDesC8& aDataTo2,
   1.672 +	              TDes8& aDataFrom);
   1.673 +
   1.674 +	/**
   1.675 +	* Sends a custom command synchronously to the DevSound server. This
   1.676 +	* method will not return until the server has serviced the command.
   1.677 +	* @since 
   1.678 +	* @param   "const TMMFMessageDestinationPckg& aDestination"
   1.679 +	*          The destination of the custom command. This consists of the
   1.680 +	*          unique ID of the interface of command handler.
   1.681 +	* @param   "TInt aFunction"
   1.682 +	*          The number of the function to be called on the command
   1.683 +	*          handler.
   1.684 +	* @param   "const TDesC8& aDataTo1"
   1.685 +	*          A reference to data to be copied to the command handler.
   1.686 +	*          The exact contents of the data are dependent on the command
   1.687 +	*          hanlder on the DevSound server. Can be NULL.
   1.688 +	* @param   "const TDesC8& aDataTo2"
   1.689 +	*          A reference to data to be copied to the command handler.
   1.690 +	*          The exact contents of the data are dependent on the command
   1.691 +	*          hanlder on the DevSound server. Can be NULL.
   1.692 +	* @return   "TInt"
   1.693 +	*          The result of the custom command. The exact range of values
   1.694 +	*          is dependent on the command handler interface.
   1.695 +	*/
   1.696 +	IMPORT_C TInt CustomCommandSync(
   1.697 +	              const TMMFMessageDestinationPckg&  aDestination,
   1.698 +	              TInt aFunction,
   1.699 +	              const TDesC8& aDataTo1,
   1.700 +	              const TDesC8& aDataTo2);
   1.701 +
   1.702 +	/**
   1.703 +	* Sends a custom command asynchronously to the DevSound server.
   1.704 +	* Note: This method will return immediately. The ::RunL() of the active
   1.705 +	* object owning the aStatus parameter will be called when the command
   1.706 +	* is completed by the command handler.
   1.707 +	* @since 
   1.708 +	* @param   "const TMMFMessageDestinationPckg& aDestination"
   1.709 +	*          The destination of the custom command. This consists of the
   1.710 +	*          unique ID of the interface of command handler.
   1.711 +	* @param   "TInt aFunction"
   1.712 +	*          The number of the function to be called on the command
   1.713 +	*          handler.
   1.714 +	* @param   "const TDesC8& aDataTo1"
   1.715 +	*          A reference to data to be copied to the command handler.
   1.716 +	*          The exact contents of the data are dependent on the command
   1.717 +	*          hanlder on the DevSound server. Can be NULL.
   1.718 +	* @param   "const TDesC8& aDataTo2"
   1.719 +	*          A reference to data to be copied to the command handler.
   1.720 +	*          The exact contents of the data are dependent on the command
   1.721 +	*          hanlder on the DevSound server. Can be NULL.
   1.722 +	* @param   "TDes8& aDataFrom"
   1.723 +	*          A reference to an area of memory to which the command handler
   1.724 +	*          will write any data to be passed back to the client. Cannot
   1.725 +	*          be NULL.
   1.726 +	* @param   "TRequestStatus& aStatus"
   1.727 +	*          The TRequestStatus of an active object. This will contain the
   1.728 +	*          result of the custom command on completion. The exact range
   1.729 +	*          of result values is dependent on the custom command
   1.730 +	*          interface.
   1.731 +	*/
   1.732 +	IMPORT_C void CustomCommandAsync(
   1.733 +	              const TMMFMessageDestinationPckg& aDestination,
   1.734 +	              TInt aFunction,
   1.735 +	              const TDesC8& aDataTo1,
   1.736 +	              const TDesC8& aDataTo2,
   1.737 +	              TDes8& aDataFrom,
   1.738 +	              TRequestStatus& aStatus);
   1.739 +
   1.740 +	/**
   1.741 +	* Sends a custom command asynchronously to the DevSound server.
   1.742 +	* Note: This method will return immediately. The ::RunL() of the active
   1.743 +	* object owning the aStatus parameter will be called when the command
   1.744 +	* is completed by the command handler.
   1.745 +	* @since 
   1.746 +	* @param   "const TMMFMessageDestinationPckg& aDestination"
   1.747 +	*          The destination of the custom command. This consists of the
   1.748 +	*          unique ID of the interface of command handler.
   1.749 +	* @param   "TInt aFunction"
   1.750 +	*          The number of the function to be called on the command
   1.751 +	*          handler.
   1.752 +	* @param   "const TDesC8& aDataTo1"
   1.753 +	*          A reference to data to be copied to the command handler. The
   1.754 +	*          exact contents of the data are dependent on the command
   1.755 +	*          hanlder on the DevSound server. Can be NULL.
   1.756 +	* @param   "const TDesC8& aDataTo2"
   1.757 +	*          A reference to data to be copied to the command handler. The
   1.758 +	*          exact contents of the data are dependent on the command
   1.759 +	*          hanlder on the DevSound server. Can be NULL.
   1.760 +	* @param   "TRequestStatus& aStatus"
   1.761 +	*          The TRequestStatus of an active object. This will contain the
   1.762 +	*          result of the custom command on completion. The exact range
   1.763 +	*          of result values is dependent on the custom command
   1.764 +	*          interface.
   1.765 +	*/
   1.766 +	IMPORT_C void CustomCommandAsync(
   1.767 +	              const TMMFMessageDestinationPckg& aDestination,
   1.768 +	              TInt aFunction,
   1.769 +	              const TDesC8& aDataTo1,
   1.770 +	              const TDesC8& aDataTo2,
   1.771 +	              TRequestStatus& aStatus);
   1.772 +
   1.773 +	IMPORT_C TInt SyncCustomCommand(TUid aUid, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam);
   1.774 +	IMPORT_C void AsyncCustomCommand(TUid aUid, TRequestStatus& aStatus, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam);
   1.775 +	IMPORT_C TInt GetTimePlayed(TTimeIntervalMicroSeconds& aTime);
   1.776 +
   1.777 +	/**
   1.778 +	* Queries if the low layers does support resume operation.
   1.779 +	* @since
   1.780 +	* @return TBool ETrue if Resume is supported
   1.781 +	*               EFalse otherwise
   1.782 +	*/	
   1.783 +	IMPORT_C TBool IsResumeSupported();
   1.784 +
   1.785 +	/**
   1.786 +	* Resume the operation (Play, Record, TonePlay) temporarily paused .
   1.787 +	* @since
   1.788 +	* @return TInt KErrNone if succesful
   1.789 +	*              KErrNotSupported if the operation is not supported by this implementation
   1.790 +	*/
   1.791 +	IMPORT_C TInt Resume();
   1.792 +
   1.793 +	// from MDevSoundObserver
   1.794 +	void InitializeComplete(TInt aError);
   1.795 +	void ToneFinished(TInt aError);
   1.796 +	void BufferToBeFilled(CMMFBuffer* aBuffer);
   1.797 +	void PlayError(TInt aError);
   1.798 +	void BufferToBeEmptied(CMMFBuffer* aBuffer);
   1.799 +	void RecordError(TInt aError);
   1.800 +	void ConvertError(TInt aError);
   1.801 +	void DeviceMessage(TUid aMessageType, const TDesC8& aMsg);
   1.802 +	void SendEventToClient(const TMMFEvent& aEvent);
   1.803 +
   1.804 +private:
   1.805 +	void StartReceivingMsgQueueHandlerEventsL(MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver);
   1.806 +
   1.807 +private:    // Data
   1.808 +
   1.809 +	TMMFDevSoundProxySettingsPckg iDspsPckg;
   1.810 +	CMMFDataBuffer* iBuffer; //Not Owned
   1.811 +	HBufC* iSeqName;
   1.812 +
   1.813 +	TMMFMessageDestinationPckg iDestinationPckg;
   1.814 +
   1.815 +	enum TState
   1.816 +		{
   1.817 +		EIdle = 0,
   1.818 +		EInitializing,
   1.819 +		EInitialized,
   1.820 +		EPlaying,
   1.821 +		EPlayingBufferWait,
   1.822 +		ETonePlaying, 
   1.823 +		ERecording,
   1.824 +		ERecordingBufferWait,
   1.825 +		ERecordingInLastBufferCycle,
   1.826 +		ERecordingResumingInLastBufferCycle,
   1.827 +		};
   1.828 +
   1.829 +	enum TTonePlayingMode
   1.830 +		{
   1.831 +		ESimple = 0,
   1.832 +		EDual,
   1.833 +		EDTMFString,
   1.834 +		ESequence,
   1.835 +		EFixedSequence 
   1.836 +		};
   1.837 +
   1.838 +	// Allows distinguish for operations supported for some tones
   1.839 +	TTonePlayingMode iToneMode;
   1.840 +	// Contains state information of this DLL instance. Allows client-size state checking.
   1.841 +	TState iState;
   1.842 +	// Reference to the devsound proxy object
   1.843 +	RMMFAudioServerProxy* iAudioServerProxy;
   1.844 +	// Reference to observer where the events need to be forwarded to.
   1.845 +	MDevSoundObserver* iDevSoundObserver;
   1.846 +	// Message queue
   1.847 +	RMsgQueue<TMMFDevSoundQueueItem> iMsgQueue;
   1.848 +	// Reference to the message queue handler
   1.849 +	CMsgQueueHandler* iMsgQueueHandler;
   1.850 +	TMMFMessageDestinationPckg iCustIntPckg;
   1.851 +	};
   1.852 +
   1.853 +#endif // RMMFDEVSOUNDPROXY_H
   1.854 +
   1.855 +// End of File