satengine/SatServer/Commands/SendDtmfCmd/src/csatdtmfsender.cpp
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2007-2008 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:  Handles SendDTMF command
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include    "csatdtmfsender.h"
       
    20 #include    "CSendDtmfHandler.h"
       
    21 #include    "msatmultimodeapi.h"
       
    22 #include    "SatLog.h"
       
    23 
       
    24 // ============================ MEMBER FUNCTIONS ===============================
       
    25 
       
    26 // -----------------------------------------------------------------------------
       
    27 // CSatDtmfSender::CSatDtmfSender
       
    28 // C++ default constructor can NOT contain any code, that
       
    29 // might leave.
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 CSatDtmfSender::CSatDtmfSender( 
       
    33     CSendDtmfHandler& aDtmfHandler, MSatMultiModeApi& aPhone ) : 
       
    34     CActive( EPriorityStandard ),
       
    35     iDtmfHandler( aDtmfHandler ),
       
    36     iPhone( aPhone )
       
    37     {
       
    38     LOG( SIMPLE,
       
    39         "SENDDTMF: CSatDtmfSender::CSatDtmfSender calling - exiting" )
       
    40     CActiveScheduler::Add( this );
       
    41     }
       
    42 
       
    43 // Destructor
       
    44 CSatDtmfSender::~CSatDtmfSender()
       
    45     {
       
    46     LOG( SIMPLE, "SENDDTMF: CSatDtmfSender::~CSatDtmfSender calling" )
       
    47 
       
    48     Cancel();
       
    49 
       
    50     LOG( SIMPLE, "SENDDTMF: CSatDtmfSender::~CSatDtmfSender exiting" )
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // CSatDtmfSender::SendToneString
       
    55 // Sends DTMF tones during active, connected voice calls.
       
    56 // (other items were commented in a header).
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 void CSatDtmfSender::SendToneString( const TDesC& aTones )
       
    60     {
       
    61     LOG( SIMPLE, "SENDDTMF: CSatDtmfSender::SendToneString calling" )
       
    62 
       
    63     if ( !IsActive() )
       
    64         {
       
    65         LOG( SIMPLE, "SENDDTMF: CSatDtmfSender::SendToneString set active" )
       
    66         iPhone.SendDTMFTones( iStatus, aTones );
       
    67         SetActive();
       
    68         }
       
    69 
       
    70     LOG( SIMPLE, "SENDDTMF: CSatDtmfSender::SendToneString exiting" )
       
    71     }
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // CSatDtmfSender::DoCancel
       
    75 // Cancels the DTMF sending request.
       
    76 // (other items were commented in a header).
       
    77 // -----------------------------------------------------------------------------
       
    78 //
       
    79 void CSatDtmfSender::DoCancel()
       
    80     {
       
    81     LOG( SIMPLE, "SENDDTMF: CSatDtmfSender::DoCancel calling" )
       
    82 
       
    83     iPhone.CancelAsyncRequest( EMobilePhoneSendDTMFTones );
       
    84 
       
    85     LOG( SIMPLE, "SENDDTMF: CSatDtmfSender::DoCancel exiting" )
       
    86     }
       
    87 
       
    88 // -----------------------------------------------------------------------------
       
    89 // CSatDtmfSender::RunL
       
    90 // Informs observer about result of DTMF sending.
       
    91 // (other items were commented in a header).
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 void CSatDtmfSender::RunL()
       
    95     {
       
    96     LOG( SIMPLE, "SENDDTMF: CSatDtmfSender::RunL calling" )
       
    97 
       
    98     iDtmfHandler.SendDtmfComplete( iStatus.Int() );
       
    99 
       
   100     LOG( SIMPLE, "SENDDTMF: CSatDtmfSender::RunL exiting" )
       
   101     }
       
   102