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