mmserv/voipaudioservices/VoIPServer/src/VoIPECallEventHandler.cpp
changeset 0 71ca22bcf22a
child 3 4f62049db6ac
child 12 5a06f39ad45b
equal deleted inserted replaced
-1:000000000000 0:71ca22bcf22a
       
     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: VoIP Audio Services
       
    15  *
       
    16  */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include <ctsydomainpskeys.h>
       
    20 #include "debugtracemacros.h"
       
    21 #include "voipecalleventhandler.h"
       
    22 
       
    23 // -----------------------------------------------------------------------------
       
    24 // CVoIPECallEventHandler::CVoIPECallEventHandler
       
    25 // C++ default constructor can NOT contain any code, that
       
    26 // might leave.
       
    27 // -----------------------------------------------------------------------------
       
    28 //
       
    29 CVoIPECallEventHandler::CVoIPECallEventHandler(CVoIPAudioServer* aServer) :
       
    30     CActive(EPriorityStandard),
       
    31     iVasServer(aServer)
       
    32     {
       
    33     }
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // CVoIPECallEventHandler::ConstructL
       
    37 // Symbian 2nd phase constructor can leave.
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 void CVoIPECallEventHandler::ConstructL()
       
    41     {
       
    42     TRACE_PRN_FN_ENT;
       
    43     CActiveScheduler::Add(this);
       
    44     User::LeaveIfError(iProperty.Attach(KPSUidCtsyEmergencyCallInfo,
       
    45             KCTSYEmergencyCallInfo));
       
    46     iProperty.Subscribe(iStatus);
       
    47     SetActive();
       
    48     TRACE_PRN_FN_EXT;
       
    49     }
       
    50 
       
    51 // -----------------------------------------------------------------------------
       
    52 // CVoIPECallEventHandler::NewL
       
    53 // Two-phased constructor.
       
    54 // -----------------------------------------------------------------------------
       
    55 //
       
    56 CVoIPECallEventHandler* CVoIPECallEventHandler::NewL(
       
    57         CVoIPAudioServer* aServer)
       
    58     {
       
    59     CVoIPECallEventHandler* self = new (ELeave) CVoIPECallEventHandler(
       
    60             aServer);
       
    61     CleanupStack::PushL(self);
       
    62     self->ConstructL();
       
    63     CleanupStack::Pop(self);
       
    64     return self;
       
    65     }
       
    66 
       
    67 // Destructor
       
    68 CVoIPECallEventHandler::~CVoIPECallEventHandler()
       
    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 // CVoIPECallEventHandler::DoCancel
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 void CVoIPECallEventHandler::DoCancel()
       
    84     {
       
    85     TRACE_PRN_FN_ENT;
       
    86     iProperty.Cancel();
       
    87     TRACE_PRN_FN_EXT;
       
    88     }
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // CVoIPECallEventHandler::RunL
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 void CVoIPECallEventHandler::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         iProperty.Subscribe(iStatus);
       
   102         SetActive();
       
   103 
       
   104         TInt eCall = 0;
       
   105         iProperty.Get(eCall);
       
   106         if (iVasServer)
       
   107             {
       
   108             iVasServer->NotifyECallEvent(eCall);
       
   109             }
       
   110         }
       
   111     TRACE_PRN_FN_EXT;
       
   112     }
       
   113 
       
   114 //  End of File
       
   115