os/mm/devsound/a3fdevsound/src/mmfdevsoundproxy/mmfdevsoundproxy.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2006-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 
    20 #ifndef RMMFDEVSOUNDPROXY_H
    21 #define RMMFDEVSOUNDPROXY_H
    22 
    23 //  INCLUDES
    24 #include <mmf/common/mmfipc.h>
    25 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    26 #include <mmf/common/mmfipcserver.h>
    27 #endif
    28 #include <mmf/common/mcustomcommand.h>
    29 #include "mmfdevsoundcallbackhandler.h"
    30 #include "mmfaudioserverproxy.h"
    31 
    32 _LIT(KMMFDevSoundProxyPanicCategory, "MmfDevSoundProxy");
    33 
    34 enum TMMFDevSoundProxyPanicCodes
    35 	{
    36 	EMMFDevSoundProxyPlayDataWithoutInitialize,
    37 	EMMFDevSoundProxyRecordDataWithoutInitialize,
    38 	EMMFDevSoundProxyInitCompleteInWrongState,
    39 	EMMFDevSoundProxyToneFinishedInWrongState,
    40 	EMMFDevSoundProxyPlayErrorInWrongState,
    41 	EMMFDevSoundProxyRecordErrorInWrongState,
    42 	EMMFDevSoundProxyUnexpectedConvError,
    43 	EMMFDevSoundProxyCapabilitiesInWrongState,
    44 	EMMFDevSoundProxyConfigInWrongState,
    45 	EMMFDevSoundProxyBTBFInWrongState,
    46 	EMMFDevSoundProxyBTBEInWrongState,
    47 	EMMFDevSoundProxyPlayDataInWrongState,
    48 	EMMFDevSoundProxyRecordDataInWrongState,
    49 	EMMFDevSoundProxyNonEmptyLastBuffer,
    50 	};
    51 
    52 
    53 // FORWARD DECLARATIONS
    54 class RMMFDevSoundProxy; // declared here.
    55 
    56 // CLASS DECLARATION
    57 
    58 /**
    59 *  Main interface to DevSound server.
    60 *
    61 *  @lib MmfDevSoundProxy.lib
    62 *  @since 
    63 */
    64 NONSHARABLE_CLASS( RMMFDevSoundProxy ) : public RMmfSessionBase, 
    65 										 public MCustomCommand,
    66 										 public MDevSoundObserver,
    67 										 public MMMFDevSoundCancelInitialize
    68 	{
    69 public:  // Constructors and destructor
    70 	/**
    71 	* Constructor.
    72 	* @since 
    73 	*/
    74 	IMPORT_C RMMFDevSoundProxy();
    75 
    76 public: // New functions
    77 
    78 	/**
    79 	* Open a DevSound server session
    80 	* @since 
    81 	* @return KErrNone if successfull, else corresponding error code
    82 	*/
    83 	IMPORT_C TInt Open();
    84 	
    85 	/**
    86 	* Post open - called following successful open to complete open process.
    87 	* Allows async opening
    88 	* @return KErrNone successful, otherwise one of the standard system errors
    89 	*/
    90 	IMPORT_C TInt PostOpen(); 
    91 
    92 	/**
    93 	* Launch DevSound instances that might have been waiting for audio
    94 	* policy.
    95 	* @since 
    96 	* @return KErrNone if successfull, else corresponding error code
    97 	*/
    98 	IMPORT_C TInt SetDevSoundInfo();
    99 
   100 	/**
   101 	* Initialize DevSound for the mode aMode.
   102 	* Leaves on failure.
   103 	* @since 
   104 	* @param TMMFState aMode The mode for which this object will be used
   105 	* @param aDevSoundCIObserver Observer which will receive Custom Interface events
   106 	* 
   107 	*/
   108 	IMPORT_C void InitializeL(MDevSoundObserver& aDevSoundObserver,
   109 	                          TMMFState aMode,
   110 	                          MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver);
   111 
   112 	/**
   113 	* Initializes DevSound object for the mode aMode for processing audio
   114 	* data with hardware device aHWDev.
   115 	* Leaves on failure.
   116 	* @since 
   117 	* @param TUid aHWDev The CMMFHwDevice implementation identifier.
   118 	* @param TMMFState aMode The mode for which this object will be used
   119 	* @param aDevSoundCIObserver Observer which will receive Custom Interface events
   120 	* 
   121 	*/
   122 	IMPORT_C void InitializeL(MDevSoundObserver& aDevSoundObserver,
   123 	                          TUid aHWDev,
   124 	                          TMMFState aMode,
   125 	                          MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver);
   126 
   127 	/**
   128 	* Initializes DevSound object for the mode aMode for processing audio
   129 	* data with hardware device supporting FourCC aDesiredFourCC.
   130 	* Leaves on failure.
   131 	* @since 
   132 	* @param TFourCC aDesiredFourCC The CMMFHwDevice implementation FourCC
   133 	*        code.
   134 	* @param TMMFState aMode The mode for which this object will be used
   135 	* @param aDevSoundCIObserver Observer which will receive Custom Interface events
   136 	* 
   137 	*/
   138 	IMPORT_C void InitializeL(MDevSoundObserver& aDevSoundObserver,
   139 	                          TFourCC aDesiredFourCC,
   140 	                          TMMFState aMode,
   141 	                          MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver);
   142 
   143 	/**
   144 	* Returns the supported Audio settings ie. encoding, sample rates,
   145 	* mono/stereo operation, buffer size etc..
   146 	* @since 
   147 	* @return TMMFCapabilities The device settings.
   148 	*/
   149 	IMPORT_C TMMFCapabilities Capabilities();
   150 
   151 	/**
   152 	* Returns the current device configuration.
   153 	* @since 
   154 	* @return TMMFCapabilities The device settings.
   155 	*/
   156 	IMPORT_C TMMFCapabilities Config();
   157 
   158 	/**
   159 	* Configure CMMFDevSound object with the settings in aConfig. Use this
   160 	* to set sampling rate, encoding and mono/stereo.
   161 	* Leaves on failure.
   162 	* @since 
   163 	* @param const TMMFCapabilities& aConfig The attribute values to which
   164 	*        CMMFDevSound object will be configured to.
   165 	* @return KErrNone if successfull, else corresponding error code
   166 	*/
   167 	IMPORT_C void SetConfigL(const TMMFCapabilities& aConfig);
   168 
   169 	/**
   170 	* Returns an integer representing the maximum volume device supports.
   171 	* This is the maximum value which can be passed to
   172 	* CMMFDevSound::SetVolume.
   173 	* @since 
   174 	* @return TInt The maximum volume. This value is platform dependent but
   175 	*        is always greater than or equal to one.
   176 	*/
   177 	IMPORT_C TInt MaxVolume();
   178 
   179 	/**
   180 	* Returns an integer representing the current volume.
   181 	* @since 
   182 	* @return TInt The current volume level.
   183 	*/
   184 	IMPORT_C TInt Volume();
   185 
   186 	/**
   187 	* Changes the current playback volume to a specified value. The volume
   188 	* can be changed before or during playback and is effective immediately
   189 	* @since 
   190 	* @param TInt aVolume The volume setting. This can be any value from 0
   191 	*        to the value returned by a call to
   192 	*        CMMFDevSound::MaxVolume(). If the volume is not
   193 	*        within this range, the volume is automatically set
   194 	*        to minimum or maximum value based on the value
   195 	*        that is being passed. Setting a zero value mutes
   196 	*        the sound. Setting the maximum value results in
   197 	*        the loudest possible sound.
   198 	* @return KErrNone if successfull, else corresponding error code
   199 	*/
   200 	IMPORT_C TInt SetVolume(TInt aVolume);
   201 
   202 	/**
   203 	* Returns an integer representing the maximum gain the device supports.
   204 	* This is the maximum value which can be passed to CMMFDevSound::SetGain
   205 	* @since 
   206 	* @return TInt The maximum gain. This value is platform dependent but is
   207 	*        always greater than or equal to one.
   208 	*/
   209 	IMPORT_C TInt MaxGain();
   210 
   211 	/**
   212 	* Returns an integer representing the current gain.
   213 	* @since 
   214 	* @return TInt The current gain level.
   215 	*/
   216 	IMPORT_C TInt Gain();
   217 
   218 	/**
   219 	* Changes the current recording gain to a specified value. The gain can
   220 	* be changed before or during recording and is effective immediately.
   221 	* @since 
   222 	* @param TInt aGain The gain setting. This can be any value from zero to
   223 	*        the value returned by a call to
   224 	*        CMMFDevSound::MaxGain(). If the volume
   225 	*        is not within this range, the gain is automatically
   226 	*        set to minimum or maximum value based on the value
   227 	*        that is being passed. Setting a zero value mutes the
   228 	*        sound. Setting the maximum value results in the
   229 	*        loudest possible sound.
   230 	* @return KErrNone if successfull, else corresponding error code
   231 	*/
   232 	IMPORT_C TInt SetGain(TInt aGain);
   233 
   234 	/**
   235 	* Returns the speaker balance set for playing.
   236 	* Leaves on failure.
   237 	* @since 
   238 	* @param TInt &aLeftPercentage On return contains the left speaker
   239 	*        volume percentage.
   240 	* @param TInt &aRightPercentage On return contains the right speaker
   241 	*        volume percentage.
   242 	*/
   243 	IMPORT_C void GetPlayBalanceL(TInt& aLeftPercentage,
   244 	                              TInt& aRightPercentage);
   245 
   246 	/**
   247 	* Sets the speaker balance for playing. The speaker balance can be
   248 	* changed before or during playback and is effective immediately.
   249 	* Leaves on failure.
   250 	* @since 
   251 	* @param TInt aLeftPercentage The left speaker volume percentage. This
   252 	*        can be any value from zero to 100. Setting
   253 	*        a zero value mutes the sound on left
   254 	*        speaker.
   255 	* @param TInt aRightPercentage The right speaker volume percentage.
   256 	*        This can be any value from zero to 100.
   257 	*        Setting a zero value mutes the sound on
   258 	*        right speaker.
   259 	*/
   260 	IMPORT_C void SetPlayBalanceL(TInt aLeftPercentage,
   261 	                              TInt aRightPercentage);
   262 
   263 	/**
   264 	* Returns the microphone gain balance set for recording.
   265 	* Leaves on failure.
   266 	* @since 
   267 	* @param TInt &aLeftPercentage On return contains the left microphone
   268 	*        gain percentage.
   269 	* @param TInt &aRightPercentage On return contains the right microphone
   270 	*        gain percentage.
   271 	* @return void
   272 	*/
   273 	IMPORT_C void GetRecordBalanceL(TInt& aLeftPercentage,
   274 	                                TInt& aRightPercentage);
   275 
   276 	/**
   277 	* Sets the microphone balance for recording. The microphone balance can
   278 	* be changed before or during recording and is effective immediately.
   279 	* Leaves on failure.
   280 	* @since 
   281 	* @param TInt aLeftPercentage The left microphone gain percentage. This
   282 	*        can be any value from zero to 100. Setting
   283 	*        a zero value mutes the sound from left
   284 	*        microphone.
   285 	* @param TInt aRightPercentage The right microphone gain percentage.
   286 	*        This can be any value from zero to 100.
   287 	*        Setting a zero value mutes the sound from
   288 	*        right microphone.
   289 	* @return void
   290 	*/
   291 	IMPORT_C void SetRecordBalanceL(TInt aLeftPercentage,
   292 	                                TInt aRightPercentage);
   293 
   294 	/**
   295 	* Close the server session
   296 	* @since 
   297 	* @return void
   298 	*/
   299 	IMPORT_C void Close();
   300 
   301 	/**
   302 	* Initializes the audio device and starts the play process. This
   303 	* function queries and acquires the audio policy before initializing
   304 	* audio device. If there was an error during policy initialization,
   305 	* PlayError() function will be called on the observer with error code
   306 	* KErrAccessDenied, otherwise BufferToBeFilled() function will be called
   307 	* with a buffer reference. After reading data into the buffer reference
   308 	* passed, the client should call PlayData() to play data.
   309 	* The amount of data that can be played is specified in
   310 	* CMMFBuffer::RequestSize(). Any data that is read into buffer beyond
   311 	* this size will be ignored.
   312 	* Leaves on failure.
   313 	* @since 
   314 	* @return void
   315 	*/
   316 	IMPORT_C void PlayInitL();
   317 
   318 	/**
   319 	* Initializes the audio device and starts the record process. This
   320 	* function queries and acquires the audio policy before initializing
   321 	* audio device. If there was an error during policy initialization,
   322 	* RecordError() function will be called on the observer with error code
   323 	* KErrAccessDenied, otherwise BufferToBeEmptied() function will be called
   324 	* with a buffer reference. This buffer contains recorded or encoded
   325 	* data. After processing data in the buffer reference passed, the client
   326 	* should call RecordData() to continue recording process.
   327 	* The amount of data that is available is specified in
   328 	* CMMFBuffer::RequestSize().
   329 	* Leaves on failure.
   330 	* @since 
   331 	* @return void
   332 	*/
   333 	IMPORT_C void RecordInitL();
   334 
   335 	/**
   336 	* Plays data in the buffer at the current volume.
   337 	* The client should fill the buffer with audio data before calling this
   338 	* function. The observer gets a reference to the buffer along with the
   339 	* callback function BufferToBeFilled(). When playing of the audio sample
   340 	* is complete, successfully or otherwise, the function PlayError() on
   341 	* the observer is called.
   342 	* The last buffer of the audio stream being played should have the last
   343 	* buffer flag set using CMMFBuffer::SetLastBuffer(TBool). If a
   344 	* subsequent attempt to play the clip is made, this flag will need
   345 	* resetting by the client.
   346 	* @return void
   347 	*/
   348 	IMPORT_C void PlayData();
   349 
   350 	/**
   351 	* Contine the process of recording.
   352 	* Once the buffer is filled with recorded data, the Observer gets a
   353 	* reference to the buffer along with the callback function
   354 	* BufferToBeEmptied(). After processing the buffer (copying over to a
   355 	* different buffer or writing to file) the client should call this
   356 	* function to continue the recording process.
   357 	* @return void
   358 	*/
   359 	IMPORT_C void RecordData();
   360 
   361 	/**
   362 	* Stops the ongoing operation (Play, Record, TonePlay).
   363 	* @since 
   364 	* @return void
   365 	*/
   366 	IMPORT_C void Stop();
   367 
   368 	/**
   369 	* Temporarily Stops the ongoing operation (Play, Record, TonePlay).
   370 	* @since 
   371 	* @return void
   372 	*/
   373 	IMPORT_C void Pause();
   374 
   375 	/**
   376 	* Initializes the audio device and starts playing a tone. The tone is
   377 	* played with the frequency and duration specified.
   378 	* Leaves on failure.
   379 	* @since 
   380 	* @param TInt aFrequency The frequency at which the tone will be played.
   381 	* @param const TTimeIntervalMicroSeconds &aDuration The period over
   382 	*        which the tone will be played. A zero value causes the no tone
   383 	*        to be played.
   384 	* @return void
   385 	*/
   386 	IMPORT_C void PlayToneL(TInt aFrequency,
   387 	                        const TTimeIntervalMicroSeconds& aDuration);
   388 
   389 	/**
   390 	* Initializes audio device and starts playing a dual tone. Dual Tone is
   391 	* played with the specified frequencies and for the specified duration.
   392 	* Leaves on failure.
   393 	* @since 
   394 	* @param TInt aFrequencyOne The first frequency of dual tone.
   395 	* @param TInt aFrequencyTwo The second frequency of dual tone.
   396 	* @param const TTimeIntervalMicroSeconds &aDuration The period over
   397 	*        which the tone will be played. A zero value causes the no tone
   398 	*        to be played.
   399 	* @return void
   400 	*/
   401 	IMPORT_C void PlayDualToneL(
   402 	              TInt aFrequencyOne,
   403 	              TInt aFrequencyTwo,
   404 	              const TTimeIntervalMicroSeconds& aDuration);
   405 
   406 	/**
   407 	* Initializes the audio device and starts playing the DTMF string
   408 	* aDTMFString.
   409 	* Leaves on failure.
   410 	* @since 
   411 	* @param const TDesC &aDTMFString The DTMF sequence in a descriptor.
   412 	* @return void
   413 	*/
   414 	IMPORT_C void PlayDTMFStringL(const TDesC& aDTMFString);
   415 
   416 	/**
   417 	* Initializes the audio device and starts playing a tone sequence.
   418 	* Leaves on failure.
   419 	* @since 
   420 	* @param const TDesC8 &aData The tone sequence in a descriptor.
   421 	* @return void
   422 	*/
   423 	IMPORT_C void PlayToneSequenceL(const TDesC8& aData);
   424 
   425 	/**
   426 	* Initializes the audio device and starts playing the specified
   427 	* pre-defined tone sequence.
   428 	* Leaves on failure.
   429 	* @since 
   430 	* @param TInt aSequenceNumber The index identifying the specific
   431 	*        pre-defined tone sequence. Index values are relative to zero.
   432 	*        This can be any value from zero to the value returned by a call
   433 	*        to FixedSequenceCount() - 1. The function raises a panic if the
   434 	*        sequence number is not within this range.
   435 	* @return void
   436 	*/
   437 	IMPORT_C void PlayFixedSequenceL(TInt aSequenceNumber);
   438 
   439 	/**
   440 	* Defines the duration of tone on, tone off and tone pause to be used
   441 	* during the DTMF tone playback operation.
   442 	* Supported only during tone playing.
   443 	* @since 
   444 	* @param TTimeIntervalMicroSeconds32 &aToneOnLength The period over
   445 	*        which the tone will be played. If this is set to zero, then the
   446 	*        tone is not played.
   447 	* @param TTimeIntervalMicroSeconds32 &aToneOffLength The period over
   448 	*        which the no tone will be played.
   449 	* @param TTimeIntervalMicroSeconds32 &aPauseLength The period over which
   450 	*        the tone playing will be paused.
   451 	* @return void
   452 	*/
   453 	IMPORT_C void SetDTMFLengths(
   454 	              TTimeIntervalMicroSeconds32& aToneOnLength,
   455 	              TTimeIntervalMicroSeconds32& aToneOffLength,
   456 	              TTimeIntervalMicroSeconds32& aPauseLength);
   457 
   458 	/**
   459 	* Defines the period over which the volume level is to rise smoothly
   460 	* from nothing to the normal volume level.
   461 	* The function is only available before playing.
   462 	* @since 
   463 	* @param const TTimeIntervalMicroSeconds &aRampDuration The period over
   464 	*        which the volume is to rise. A zero value causes the tone
   465 	*        sample to be played at the normal level for the full duration
   466 	*        of the playback. A value, which is longer than the duration of
   467 	*        the tone sample means that the sample never reaches its normal
   468 	*        volume level.
   469 	* @return void
   470 	*/
   471 	IMPORT_C void SetVolumeRamp(
   472 	              const TTimeIntervalMicroSeconds& aRampDuration);
   473 
   474 	/**
   475 	* Returns a list of the supported input datatypes that can be sent to
   476 	* DevSound for playing audio. The datatypes returned are those that the
   477 	* DevSound supports given the priority settings passed in
   478 	* aPrioritySettings. Note that if no supported data types are found this
   479 	* does not constitute failure, the function will return normally with no
   480 	* entries in aSupportedDataTypes.
   481 	* @since 
   482 	* @param RArray< TFourCC > &aSupportedDataTypes The array of supported
   483 	*        data types that will be filled in by this function. The
   484 	*        supported data types of the DevSound are in the form of an
   485 	*        array of TFourCC codes. Any existing entries in the array will
   486 	*        be overwritten on calling this function. If no supported data
   487 	*        types are found given the priority settings, then the
   488 	*        aSupportedDatatypes array will have zero entries.
   489 	* @param const TMMFPrioritySettings &aPrioritySettings The priority
   490 	*        settings used to determine the supported datatypes. Note this
   491 	*        does not set the priority settings. For input datatypes the
   492 	*        iState member of the priority settings would be expected to be
   493 	*        either EMMFStatePlaying or EMMFStatePlayingRecording. The
   494 	*        priority settings may effect the supported datatypes depending
   495 	*        on the audio routing.
   496 	* @return void
   497 	*/
   498 	IMPORT_C void GetSupportedInputDataTypesL(
   499 	              RArray<TFourCC>& aSupportedDataTypes,
   500 	              const TMMFPrioritySettings& aPrioritySettings);
   501 
   502 	/**
   503 	* Returns a list of the supported output dataypes that can be received
   504 	* from DevSound for recording audio. The datatypes returned are those
   505 	* that the DevSound supports given the priority settings passed in
   506 	* aPrioritySettings. Note that if no supported data types are found this
   507 	* does not constitute failure, the function will return normally with no
   508 	* entries in aSupportedDataTypes.
   509 	* @since 
   510 	* @param RArray< TFourCC > &aSupportedDataTypes The array of supported
   511 	*        data types that will be filled in by this function. The
   512 	*        supported datatypes of the DevSound are in the form of an array
   513 	*        of TFourCC codes. Any existing entries in the array will be
   514 	*        overwritten on calling this function. If no supported datatypes
   515 	*        are found given the priority settings, then the
   516 	*        aSupportedDatatypes array will have zero entries.
   517 	* @param const TMMFPrioritySettings &aPrioritySettings The priority
   518 	*        settings used to determine the supported data types. Note this
   519 	*        does not set the priority settings. For output data types the
   520 	*        iState member of the priority settings would expected to be
   521 	*        either EMMFStateRecording or EMMFStatePlayingRecording. The
   522 	*        priority settings may effect the supported datatypes depending
   523 	*        on the audio routing.
   524 	* @return void
   525 	*/
   526 	IMPORT_C void GetSupportedOutputDataTypesL(
   527 	              RArray<TFourCC>& aSupportedDataTypes,
   528 	              const TMMFPrioritySettings& aPrioritySettings);
   529 
   530 	/**
   531 	* Returns the number samples recorded so far.
   532 	* @since 
   533 	* @return TInt The samples recorded.
   534 	*/
   535 	IMPORT_C TInt SamplesRecorded();
   536 
   537 	/**
   538 	* Returns the number samples played so far.
   539 	* @since 
   540 	* @return TInt The samples played.
   541 	*/
   542 	IMPORT_C TInt SamplesPlayed();
   543 
   544 	/**
   545 	* Defines the number of times the audio is to be repeated during the
   546 	* tone playback operation. A period of silence can follow each playing
   547 	* of a tone. The tone playing can be repeated indefinitely
   548 	* @since 
   549 	* @param TInt aRepeatCount The number of times the tone, together with
   550 	*        the trailing silence, is to be repeated. If this is set to
   551 	*        KMdaRepeatForever, then the tone, together with the trailing
   552 	*        silence, is repeated indefinitely or until Stop() is called.
   553 	*        If this is set to zero, then the tone is not repeated.
   554 	* @param const TTimeIntervalMicroSeconds &aRepeatTrailingSilence An
   555 	*        interval of silence which will be played after each tone.
   556 	*        Supported only during tone playing.
   557 	* @return void
   558 	*/
   559 	IMPORT_C void SetToneRepeats(
   560 	              TInt aRepeatCount,
   561 	              const TTimeIntervalMicroSeconds& aRepeatTrailingSilence);
   562 
   563 	/**
   564 	* Defines the priority settings that should be used for this instance.
   565 	* @since 
   566 	* @param const TMMFPrioritySettings &aPrioritySettings A class type
   567 	*        representing the client's priority, priority preference and
   568 	*        state
   569 	* @return void
   570 	*/
   571 	IMPORT_C void SetPrioritySettings(
   572 	              const TMMFPrioritySettings& aPrioritySettings);
   573 
   574 	/**
   575 	* Returns the name assigned to a specific pre-defined tone sequence.
   576 	* This is the number of the fixed sequence supported by DevSound by
   577 	* default.
   578 	* The function raises a panic if sequence number specified is invalid.
   579 	* @since 
   580 	* @param TInt aSequenceNumber The index identifying the specific
   581 	*        pre-defined tone sequence. Index values are relative to zero.
   582 	*        This can be any value from zero to the value returned by a call
   583 	*        to CMdaAudioPlayerUtility::FixedSequenceCount() - 1. The
   584 	*        function raises a panic if sequence number is not within this
   585 	*        range.
   586 	* @return const TDesC & A reference to a Descriptor containing the fixed
   587 	*        sequence name indexed by aSequenceNumber.
   588 	*/
   589 	IMPORT_C const TDesC& FixedSequenceName(TInt aSequenceNumber);
   590 
   591 	/**
   592 	* Retrieves a custom interface to the device.
   593 	* @since 
   594 	* @param TUid aInterfaceId The interface UID, defined with the custom
   595 	*        interface.
   596 	* @return TAny* A pointer to the interface implementation, or NULL if
   597 	*        the device does not implement the interface requested. The
   598 	*        return value must be cast to the correct type by the user.
   599 	*/
   600 	IMPORT_C TAny* CustomInterface(TUid aInterfaceId);
   601 
   602 	/**
   603 	* Returns the number of available pre-defined tone sequences.
   604 	* This is the number of fixed sequence supported by DevSound by default.
   605 	* @since 
   606 	* @return TInt  The fixed sequence count. This value is implementation
   607 	*        dependent.
   608 	*/
   609 	IMPORT_C TInt FixedSequenceCount();
   610 
   611 	/**
   612 	* Returns data buffer from the DevSound server for playback.
   613 	* @since 
   614 	* @param TMMFDevSoundProxyHwBufPckg& aSetPckg A reference to pckg to
   615 	*        receive buffer information.
   616 	* @return KErrNone if successfull, otherwise a corresponding error code
   617 	*/
   618 
   619 	IMPORT_C TInt BufferToBeFilledData(
   620 			TBool aRequestChunk, TMMFDevSoundProxyHwBufPckg& aSetPckg);
   621 
   622 	/**
   623 	* Returns data buffer from the DevSound server for recording.
   624 	* @since 
   625 	* @param TMMFDevSoundProxyHwBufPckg& aSetPckg A reference to pckg to
   626 	*        receive buffer information.
   627 	* @return KErrNone if successfull, otherwise a corresponding error code
   628 	*/
   629 	IMPORT_C TInt BufferToBeEmptiedData(TMMFDevSoundProxyHwBufPckg& aSetPckg);
   630 	IMPORT_C TInt RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData = KNullDesC8);
   631 	IMPORT_C TInt CancelRegisterAsClient(TUid aEventType);
   632 	IMPORT_C TInt GetResourceNotificationData(TUid aEventType,TDes8& aNotificationData);
   633 	IMPORT_C TInt WillResumePlay();
   634 	IMPORT_C TInt EmptyBuffers();
   635 	IMPORT_C TInt CancelInitialize();
   636 	IMPORT_C TInt SetClientThreadInfo(TThreadId& aTid);
   637 
   638 	/**
   639 	* Sends a custom command synchronously to the DevSound server. This
   640 	* method will not return until the server has serviced the command.
   641 	* @since 
   642 	* @param   "const TMMFMessageDestinationPckg& aDestination"
   643 	*          The destination of the custom command. This consists of the
   644 	*          unique ID of the interface of command handler.
   645 	* @param   "TInt aFunction"
   646 	*          The number of the function to be called on the command
   647 	*          handler.
   648 	* @param   "const TDesC8& aDataTo1"
   649 	*          A reference to data to be copied to the command handler.
   650 	*          The exact contents of the data are dependent on the command
   651 	*          hanlder on the DevSound server. Can be NULL.
   652 	* @param   "const TDesC8& aDataTo2"
   653 	*          A reference to data to be copied to the command handler.
   654 	*          The exact contents of the data are dependent on the command
   655 	*          hanlder on the DevSound server. Can be NULL.
   656 	* @param   "TDes8& aDataFrom"
   657 	*          A reference to an area of memory to which the command handler
   658 	*          will write any data to be passed back to the client. Cannot
   659 	*          be NULL.
   660 	* @return   "TInt"
   661 	*          The result of the custom command. The exact range of values
   662 	*          is dependent on the command handler interface.
   663 	*/
   664 	IMPORT_C TInt CustomCommandSync(
   665 	              const TMMFMessageDestinationPckg&  aDestination,
   666 	              TInt aFunction,
   667 	              const TDesC8& aDataTo1,
   668 	              const TDesC8& aDataTo2,
   669 	              TDes8& aDataFrom);
   670 
   671 	/**
   672 	* Sends a custom command synchronously to the DevSound server. This
   673 	* method will not return until the server has serviced the command.
   674 	* @since 
   675 	* @param   "const TMMFMessageDestinationPckg& aDestination"
   676 	*          The destination of the custom command. This consists of the
   677 	*          unique ID of the interface of command handler.
   678 	* @param   "TInt aFunction"
   679 	*          The number of the function to be called on the command
   680 	*          handler.
   681 	* @param   "const TDesC8& aDataTo1"
   682 	*          A reference to data to be copied to the command handler.
   683 	*          The exact contents of the data are dependent on the command
   684 	*          hanlder on the DevSound server. Can be NULL.
   685 	* @param   "const TDesC8& aDataTo2"
   686 	*          A reference to data to be copied to the command handler.
   687 	*          The exact contents of the data are dependent on the command
   688 	*          hanlder on the DevSound server. Can be NULL.
   689 	* @return   "TInt"
   690 	*          The result of the custom command. The exact range of values
   691 	*          is dependent on the command handler interface.
   692 	*/
   693 	IMPORT_C TInt CustomCommandSync(
   694 	              const TMMFMessageDestinationPckg&  aDestination,
   695 	              TInt aFunction,
   696 	              const TDesC8& aDataTo1,
   697 	              const TDesC8& aDataTo2);
   698 
   699 	/**
   700 	* Sends a custom command asynchronously to the DevSound server.
   701 	* Note: This method will return immediately. The ::RunL() of the active
   702 	* object owning the aStatus parameter will be called when the command
   703 	* is completed by the command handler.
   704 	* @since 
   705 	* @param   "const TMMFMessageDestinationPckg& aDestination"
   706 	*          The destination of the custom command. This consists of the
   707 	*          unique ID of the interface of command handler.
   708 	* @param   "TInt aFunction"
   709 	*          The number of the function to be called on the command
   710 	*          handler.
   711 	* @param   "const TDesC8& aDataTo1"
   712 	*          A reference to data to be copied to the command handler.
   713 	*          The exact contents of the data are dependent on the command
   714 	*          hanlder on the DevSound server. Can be NULL.
   715 	* @param   "const TDesC8& aDataTo2"
   716 	*          A reference to data to be copied to the command handler.
   717 	*          The exact contents of the data are dependent on the command
   718 	*          hanlder on the DevSound server. Can be NULL.
   719 	* @param   "TDes8& aDataFrom"
   720 	*          A reference to an area of memory to which the command handler
   721 	*          will write any data to be passed back to the client. Cannot
   722 	*          be NULL.
   723 	* @param   "TRequestStatus& aStatus"
   724 	*          The TRequestStatus of an active object. This will contain the
   725 	*          result of the custom command on completion. The exact range
   726 	*          of result values is dependent on the custom command
   727 	*          interface.
   728 	*/
   729 	IMPORT_C void CustomCommandAsync(
   730 	              const TMMFMessageDestinationPckg& aDestination,
   731 	              TInt aFunction,
   732 	              const TDesC8& aDataTo1,
   733 	              const TDesC8& aDataTo2,
   734 	              TDes8& aDataFrom,
   735 	              TRequestStatus& aStatus);
   736 
   737 	/**
   738 	* Sends a custom command asynchronously to the DevSound server.
   739 	* Note: This method will return immediately. The ::RunL() of the active
   740 	* object owning the aStatus parameter will be called when the command
   741 	* is completed by the command handler.
   742 	* @since 
   743 	* @param   "const TMMFMessageDestinationPckg& aDestination"
   744 	*          The destination of the custom command. This consists of the
   745 	*          unique ID of the interface of command handler.
   746 	* @param   "TInt aFunction"
   747 	*          The number of the function to be called on the command
   748 	*          handler.
   749 	* @param   "const TDesC8& aDataTo1"
   750 	*          A reference to data to be copied to the command handler. The
   751 	*          exact contents of the data are dependent on the command
   752 	*          hanlder on the DevSound server. Can be NULL.
   753 	* @param   "const TDesC8& aDataTo2"
   754 	*          A reference to data to be copied to the command handler. The
   755 	*          exact contents of the data are dependent on the command
   756 	*          hanlder on the DevSound server. Can be NULL.
   757 	* @param   "TRequestStatus& aStatus"
   758 	*          The TRequestStatus of an active object. This will contain the
   759 	*          result of the custom command on completion. The exact range
   760 	*          of result values is dependent on the custom command
   761 	*          interface.
   762 	*/
   763 	IMPORT_C void CustomCommandAsync(
   764 	              const TMMFMessageDestinationPckg& aDestination,
   765 	              TInt aFunction,
   766 	              const TDesC8& aDataTo1,
   767 	              const TDesC8& aDataTo2,
   768 	              TRequestStatus& aStatus);
   769 
   770 	IMPORT_C TInt SyncCustomCommand(TUid aUid, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam);
   771 	IMPORT_C void AsyncCustomCommand(TUid aUid, TRequestStatus& aStatus, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam);
   772 	IMPORT_C TInt GetTimePlayed(TTimeIntervalMicroSeconds& aTime);
   773 
   774 	/**
   775 	* Queries if the low layers does support resume operation.
   776 	* @since
   777 	* @return TBool ETrue if Resume is supported
   778 	*               EFalse otherwise
   779 	*/	
   780 	IMPORT_C TBool IsResumeSupported();
   781 
   782 	/**
   783 	* Resume the operation (Play, Record, TonePlay) temporarily paused .
   784 	* @since
   785 	* @return TInt KErrNone if succesful
   786 	*              KErrNotSupported if the operation is not supported by this implementation
   787 	*/
   788 	IMPORT_C TInt Resume();
   789 
   790 	// from MDevSoundObserver
   791 	void InitializeComplete(TInt aError);
   792 	void ToneFinished(TInt aError);
   793 	void BufferToBeFilled(CMMFBuffer* aBuffer);
   794 	void PlayError(TInt aError);
   795 	void BufferToBeEmptied(CMMFBuffer* aBuffer);
   796 	void RecordError(TInt aError);
   797 	void ConvertError(TInt aError);
   798 	void DeviceMessage(TUid aMessageType, const TDesC8& aMsg);
   799 	void SendEventToClient(const TMMFEvent& aEvent);
   800 
   801 private:
   802 	void StartReceivingMsgQueueHandlerEventsL(MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver);
   803 
   804 private:    // Data
   805 
   806 	TMMFDevSoundProxySettingsPckg iDspsPckg;
   807 	CMMFDataBuffer* iBuffer; //Not Owned
   808 	HBufC* iSeqName;
   809 
   810 	TMMFMessageDestinationPckg iDestinationPckg;
   811 
   812 	enum TState
   813 		{
   814 		EIdle = 0,
   815 		EInitializing,
   816 		EInitialized,
   817 		EPlaying,
   818 		EPlayingBufferWait,
   819 		ETonePlaying, 
   820 		ERecording,
   821 		ERecordingBufferWait,
   822 		ERecordingInLastBufferCycle,
   823 		ERecordingResumingInLastBufferCycle,
   824 		};
   825 
   826 	enum TTonePlayingMode
   827 		{
   828 		ESimple = 0,
   829 		EDual,
   830 		EDTMFString,
   831 		ESequence,
   832 		EFixedSequence 
   833 		};
   834 
   835 	// Allows distinguish for operations supported for some tones
   836 	TTonePlayingMode iToneMode;
   837 	// Contains state information of this DLL instance. Allows client-size state checking.
   838 	TState iState;
   839 	// Reference to the devsound proxy object
   840 	RMMFAudioServerProxy* iAudioServerProxy;
   841 	// Reference to observer where the events need to be forwarded to.
   842 	MDevSoundObserver* iDevSoundObserver;
   843 	// Message queue
   844 	RMsgQueue<TMMFDevSoundQueueItem> iMsgQueue;
   845 	// Reference to the message queue handler
   846 	CMsgQueueHandler* iMsgQueueHandler;
   847 	TMMFMessageDestinationPckg iCustIntPckg;
   848 	};
   849 
   850 #endif // RMMFDEVSOUNDPROXY_H
   851 
   852 // End of File