diff -r 5a06f39ad45b -r 80975da52420 mmserv/tms/tmscallserver/inc/tmsdtmfprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmserv/tms/tmscallserver/inc/tmsdtmfprovider.h Mon May 03 12:59:52 2010 +0300 @@ -0,0 +1,181 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Telephony Multimedia Service + * + */ + +#ifndef TMSDTMFPROVIDER_H +#define TMSDTMFPROVIDER_H + +#include +#include +#include +#include "tmsdtmfobserver.h" + +namespace TMS { + +// FORWARD DECLARATIONS +class TMSEtelDtmfMonitor; +class TMSEtelDtmfStopMonitor; + +/** + * TMSDTMFProvider class + * Makes asynchronic request to ETel interface according to given request type. + * Provides canceling via CActive::Cancel(). + */ +class TMSDTMFProvider : public CActive + { +public: + + /** + * Two phased constructing of the DTMF provider instance. + * @param aPhone mobile phone handle + * @param aMmCustom custom API handle for special DTMF event + * monitoring. + * @return the DTMF provider instance + */ + static TMSDTMFProvider* NewL(); + + /** + * C++ default destructor + */ + virtual ~TMSDTMFProvider(); + + /** + * HandleDTMFEvents. + * @param aEvent Event type + * @param aError Error code + * @param aTone Character + */ + void NotifyDTMFEvent(const TMSDTMFObserver::TCCPDtmfEvent aEvent, + const TInt aError, const TChar aTone); + + // from base class MCCPDTMFProvider + /** + * Cancels asynchronous DTMF string sending. + * @return KErrNone if succesfull, otherwise another system wide error code + */ + TInt CancelDtmfStringSending(); + + /** + * Starts the transmission of a single DTMF tone across a + * connected and active call. + * @param aTone Tone to be played. + * @return KErrNone if succesfull, otherwise another system wide error code + */ + TInt StartDtmfTone(const TChar aTone); + + /** + * Stops playing current DTMF tone. + * @return KErrNone if succesfull, otherwise another system wide error code + */ + TInt StopDtmfTone(); + + /** + * Plays DTMF string. + * @param aString String to be played. + * @return KErrNone if succesfull, otherwise another system wide error code + * KErrArgument if the specified string contains illegal DTMF characters + */ + TInt SendDtmfToneString(const TDesC& aString); + + /** + * Continue or cancel sending DTMF string which was stopped with 'w' + * character in string. + * @param aContinue ETrue if sending of the DTMF string should continue, + * EFalse if the rest of the DTMF string is to be discarded. + * @return KErrNone if succesfull, otherwise another system wide error code + */ + TInt ContinueDtmfStringSending(const TBool aContinue); + + /** + * Add an observer for DTMF related events. + * Plug-in dependent feature if duplicates or more than one observers + * are allowed or not. Currently CCE will set only one observer. + * @param aObserver Observer + * @leave system error if observer adding fails + */ + void AddObserverL(const TMSDTMFObserver& aObserver); + + /** + * Remove an observer. + * @param aObserver Observer + * @return KErrNone if removed succesfully. KErrNotFound if observer was + * not found. Any other system error depending on the error. + */ + TInt RemoveObserver(const TMSDTMFObserver& aObserver); + + // from base class CActive +protected: + /** + * From CActive + * RunL + */ + void RunL(); + + /** + * From CActive + * Cancels the monitor + */ + void DoCancel(); + +private: + /** + * Constructs the requester. + * + * @param aPhone handle to ETel phone + * @param aMmCustom custom API handle + */ + TMSDTMFProvider(); + + /** + * Constructing the provider in the second phase. + */ + void ConstructL(); + +private: + /** + * DTMF event observer. + */ + RPointerArray iObservers; + + /** + * ETel phone handle for DTMF functionality. + */ + RMobilePhone iPhone; + + /** + * Monitor for DTMF events and changes. + * Own. + */ + TMSEtelDtmfMonitor* iMonitor; + + /** + * Monitor for DTMF stopping. + * Own. + */ + TMSEtelDtmfStopMonitor* iStopMonitor; + + /** + * Custom API reference. + */ + RMmCustomAPI iMmCustom; + + RTelServer iServer; + TBuf<25> iTsyname; + }; + +} //namespace TMS + +#endif //TMSDTMFPROVIDER_H