mmserv/tms/tmsserver/src/tmsdtmfeventhandler.cpp
changeset 12 5a06f39ad45b
child 28 ebf79c79991a
equal deleted inserted replaced
0:71ca22bcf22a 12:5a06f39ad45b
       
     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 // INCLUDE FILES
       
    19 #include "tmsdtmfeventhandler.h"
       
    20 #include "tmsclientserver.h"
       
    21 #include "tmsutility.h"
       
    22 
       
    23 using namespace TMS;
       
    24 
       
    25 // -----------------------------------------------------------------------------
       
    26 // TMSDtmfEventHandler::TMSDtmfEventHandler
       
    27 // C++ default constructor can NOT contain any code, that
       
    28 // might leave.
       
    29 // -----------------------------------------------------------------------------
       
    30 //
       
    31 TMSDtmfEventHandler::TMSDtmfEventHandler(TMSServer* aServer) :
       
    32     CActive(EPriorityStandard),
       
    33     iTMSSer(aServer)
       
    34     {
       
    35     }
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // TMSDtmfEventHandler::ConstructL
       
    39 // Symbian 2nd phase constructor can leave.
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 void TMSDtmfEventHandler::ConstructL()
       
    43     {
       
    44     TRACE_PRN_FN_ENT;
       
    45     CActiveScheduler::Add(this);
       
    46     User::LeaveIfError(iProperty.Attach(KTMSPropertyCategory, EDtmfPs));
       
    47     iStatus = KRequestPending;
       
    48     iProperty.Subscribe(iStatus);
       
    49     SetActive();
       
    50     TRACE_PRN_FN_EXT;
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // TMSDtmfEventHandler::NewL
       
    55 // Two-phased constructor.
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 TMSDtmfEventHandler* TMSDtmfEventHandler::NewL(TMSServer* aServer)
       
    59     {
       
    60     TMSDtmfEventHandler* self = new (ELeave) TMSDtmfEventHandler(aServer);
       
    61     CleanupStack::PushL(self);
       
    62     self->ConstructL();
       
    63     CleanupStack::Pop(self);
       
    64     return self;
       
    65     }
       
    66 
       
    67 // Destructor
       
    68 TMSDtmfEventHandler::~TMSDtmfEventHandler()
       
    69     {
       
    70     TRACE_PRN_FN_ENT;
       
    71     if (IsActive())
       
    72         {
       
    73         Cancel();
       
    74         }
       
    75     iProperty.Close();
       
    76     TRACE_PRN_FN_EXT;
       
    77     }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // TMSDtmfEventHandler::DoCancel
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 void TMSDtmfEventHandler::DoCancel()
       
    84     {
       
    85     TRACE_PRN_FN_ENT;
       
    86     iProperty.Cancel();
       
    87     TRACE_PRN_FN_EXT;
       
    88     }
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // TMSDtmfEventHandler::RunL
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 void TMSDtmfEventHandler::RunL()
       
    95     {
       
    96     TRACE_PRN_FN_ENT;
       
    97 // Subscribe immediately before analyzing the notification to ensure that we
       
    98 // don't miss further updates.
       
    99 //if (iStatus.Int() == KErrNone)
       
   100 //    {
       
   101     iStatus = KRequestPending;
       
   102     iProperty.Subscribe(iStatus);
       
   103     SetActive();
       
   104     TmsMsgBufPckg dtmfpckg;
       
   105     iProperty.Get(dtmfpckg);
       
   106     iTMSSer->NotifyDtmfClients(dtmfpckg);
       
   107 //    }
       
   108     TRACE_PRN_FN_EXT;
       
   109     }
       
   110 
       
   111 //  End of File
       
   112