convergedcallengine/csplugin/inc/cspdtmfprovider.h
branchRCL_3
changeset 20 987c9837762f
parent 0 ff3b6d0fd310
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Header of CSPDTMFProvider which provides DTMF functionality.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CSPDTMFPROVIDER_H
       
    20 #define CSPDTMFPROVIDER_H
       
    21 
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <mccpdtmfprovider.h>
       
    25 #include <mccpdtmfobserver.h>
       
    26 
       
    27 
       
    28 class RMobilePhone;
       
    29 class CSPEtelDtmfMonitor;
       
    30 class CSPEtelDtmfStopMonitor;
       
    31 class RMmCustomAPI;
       
    32 
       
    33 /**
       
    34 * Makes asynchronic request to ETel interface according to given request type.
       
    35 * Provides canceling via CActive::Cancel().
       
    36 * 
       
    37 */
       
    38 class CSPDTMFProvider: public CActive,
       
    39                        public MCCPDTMFProvider        
       
    40     {
       
    41         
       
    42     public:
       
    43     
       
    44         /**
       
    45         * Two phased constructing of the DTMF provider instance.
       
    46         * @param aPhone mobile phone handle
       
    47         * @param aMmCustom custom API handle for special DTMF event 
       
    48         *        monitoring.
       
    49         * @return the DTMF provider instance
       
    50         */
       
    51         static CSPDTMFProvider* NewL( RMobilePhone& aPhone, 
       
    52                                       RMmCustomAPI& aMmCustom );
       
    53         
       
    54         
       
    55         /**
       
    56         * C++ default destructor
       
    57         */
       
    58         virtual ~CSPDTMFProvider( );
       
    59         
       
    60         /**
       
    61         * HandleDTMFEvents.
       
    62         * @since S60 3.2
       
    63         * @param aEvent Event type
       
    64         * @param aError Error code
       
    65         * @param aTone Character
       
    66         */
       
    67         void NotifyDTMFEvent( const MCCPDTMFObserver::TCCPDtmfEvent aEvent,
       
    68                               const TInt aError,
       
    69                               const TChar aTone );
       
    70 
       
    71         
       
    72 // from base class MCCPDTMFProvider
       
    73         /**
       
    74         * Cancels asynchronous DTMF string sending.
       
    75         * @return KErrNone if succesfull, otherwise another system wide error code
       
    76         */
       
    77         TInt CancelDtmfStringSending();
       
    78 
       
    79         /**
       
    80         * Starts the transmission of a single DTMF tone across a
       
    81         * connected and active call.
       
    82         * @param aTone Tone to be played.
       
    83         * @return KErrNone if succesfull, otherwise another system wide error code
       
    84         */
       
    85         TInt StartDtmfTone( const TChar aTone );
       
    86 
       
    87         /**
       
    88         * Stops playing current DTMF tone.
       
    89         * @return KErrNone if succesfull, otherwise another system wide error code
       
    90         */
       
    91         TInt StopDtmfTone();
       
    92 
       
    93         /**
       
    94         * Plays DTMF string.
       
    95         * @param aString String to be played.
       
    96         * @return KErrNone if succesfull, otherwise another system wide error code
       
    97         * KErrArgument if the specified string contains illegal DTMF characters
       
    98         */
       
    99         TInt SendDtmfToneString( const TDesC& aString );
       
   100 
       
   101         /**
       
   102         * Continue or cancel sending DTMF string which was stopped with 'w'-character
       
   103         * in string.
       
   104         * @param aContinue ETrue if sending of the DTMF string should continue,
       
   105         * EFalse if the rest of the DTMF string is to be discarded.
       
   106         * @return KErrNone if succesfull, otherwise another system wide error code
       
   107         */
       
   108         TInt ContinueDtmfStringSending( const TBool aContinue );
       
   109 
       
   110         /**
       
   111         * Add an observer for DTMF related events.
       
   112         * Plug-in dependent feature if duplicates or more than one observers 
       
   113         * are allowed or not. Currently CCE will set only one observer.
       
   114         * @since S60 v3.2
       
   115         * @param aObserver Observer
       
   116         * @leave system error if observer adding fails
       
   117         */
       
   118         void AddObserverL( const MCCPDTMFObserver& aObserver );
       
   119 
       
   120         /**
       
   121         * Remove an observer.
       
   122         * @since S60 v3.2
       
   123         * @param aObserver Observer
       
   124         * @return KErrNone if removed succesfully. KErrNotFound if observer was not found.
       
   125         * Any other system error depending on the error.
       
   126         */
       
   127         TInt RemoveObserver( const MCCPDTMFObserver& aObserver );
       
   128             
       
   129 // from base class CActive
       
   130     protected:
       
   131         /**
       
   132         * From CActive
       
   133         * RunL
       
   134         * @since S60 3.2
       
   135         */
       
   136         void RunL();
       
   137         
       
   138         /**
       
   139         * From CActive
       
   140         * Cancels the monitor
       
   141         * @since S60 3.2
       
   142         */
       
   143         void DoCancel();  
       
   144 
       
   145         
       
   146     private:
       
   147         /**
       
   148         * Constructs the requester.
       
   149         *
       
   150         * @param aPhone handle to ETel phone
       
   151         * @param aMmCustom custom API handle
       
   152         */
       
   153         CSPDTMFProvider( RMobilePhone& aPhone, RMmCustomAPI& aMmCustom );
       
   154         
       
   155         /**
       
   156         * Constructing the provider in the second phase.
       
   157         */
       
   158         void ConstructL();
       
   159     
       
   160     private: // data
       
   161     
       
   162         /**
       
   163         * DTMF event observer.
       
   164         */
       
   165         RPointerArray<MCCPDTMFObserver> iObservers;
       
   166         
       
   167         /**
       
   168         * ETel phone handle for DTMF functionality.
       
   169         */
       
   170         RMobilePhone& iPhone;
       
   171         
       
   172         /**
       
   173         * Monitor for DTMF events and changes.
       
   174         * Own.
       
   175         */
       
   176         CSPEtelDtmfMonitor* iMonitor;
       
   177 
       
   178         /**
       
   179         * Monitor for DTMF stopping.
       
   180         * Own.
       
   181         */
       
   182         CSPEtelDtmfStopMonitor* iStopMonitor;
       
   183         
       
   184         /**
       
   185         * Custom API reference.
       
   186         */
       
   187         RMmCustomAPI& iMmCustom;
       
   188         
       
   189     };
       
   190     
       
   191 #endif // CSPDTMFPROVIDER