devsound/a3fcharacterisationtest/src/char_a3f_devsound_toneclient.h
changeset 24 2672ba96448e
equal deleted inserted replaced
21:1c0a769d0cc5 24:2672ba96448e
       
     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 #ifndef CHAR_A3F_DEVSOUND_TONECLIENT_H
       
    17 #define CHAR_A3F_DEVSOUND_TONECLIENT_H
       
    18 
       
    19 #include <mmf/server/sounddevice.h>
       
    20 #include "char_a3f_devsound_compliancesuiteconstants.h"
       
    21 #include <testframework.h>
       
    22 /*
       
    23 An interface to a set of DevSound callback functions.
       
    24 */
       
    25 class MA3FDevsoundToneClientObserver
       
    26 	{
       
    27 public:
       
    28 	virtual void ClientInitializeCompleteCallback(TInt aError) = 0;
       
    29 	virtual void ClientToneFinishedCallback(TInt aError) = 0;
       
    30 	};
       
    31 
       
    32 class CA3FDevSoundToneClient : public CBase, public MDevSoundObserver
       
    33 	{
       
    34 public:
       
    35 	static CA3FDevSoundToneClient* NewL(MA3FDevsoundToneClientObserver &aObserver);
       
    36 	~CA3FDevSoundToneClient();
       
    37 
       
    38 	void SetPriority(TInt priority);
       
    39 	TInt InitTonePlay(TInt aFrequency,TInt aDuration);
       
    40 	TInt InitDualTonePlay(TInt aFrequency, TInt aFrequencyTwo, TInt aDuration);
       
    41 	TInt InitDTMFStringPlay(const TDesC &aDTMFString);
       
    42 	TInt InitToneSequencePlay();
       
    43 	TInt PlayTone();
       
    44 	TInt PlayDualTone();
       
    45 	TInt PlayDTMFString();
       
    46 	TInt PlayToneSequence();
       
    47 	
       
    48 private:
       
    49 	CA3FDevSoundToneClient(MA3FDevsoundToneClientObserver &aObserver);
       
    50 	void ConstructL();
       
    51 	// from MDevSoundObserver
       
    52 	void BufferToBeFilled(CMMFBuffer *aBuffer);
       
    53 	void BufferToBeEmptied(CMMFBuffer *aBuffer);
       
    54 	void DeviceMessage(TUid aMessageType, const TDesC8& aMsg);
       
    55 	void ConvertError(TInt aError);
       
    56 	void PlayError(TInt aError);
       
    57 	void RecordError(TInt aError);
       
    58 
       
    59 	void InitializeComplete(TInt aError);
       
    60 	void ToneFinished(TInt aError);
       
    61 private:
       
    62 	CMMFDevSound* iDevSound;
       
    63 	MA3FDevsoundToneClientObserver& iObserver;
       
    64 	TInt iDuration;
       
    65 	TInt iFrequency;
       
    66 	TInt iFrequencyTwo;
       
    67 	TBuf16<KMaxStringLength> iDTMFString;
       
    68 	};
       
    69 
       
    70 #endif //CHAR_A3F_DEVSOUND_TONECLIENT_H
       
    71 	
       
    72