mmserv/tms/tmsserver/src/tmstareventhandler.cpp
changeset 12 5a06f39ad45b
child 33 5e8b14bae8c3
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 "tmstareventhandler.h"
       
    20 #include "tmsclientserver.h"
       
    21 #include "tmsutility.h"
       
    22 
       
    23 using namespace TMS;
       
    24 
       
    25 // -----------------------------------------------------------------------------
       
    26 // TMSTarEventHandler::TMSTarEventHandler
       
    27 // C++ default constructor can NOT contain any code, that
       
    28 // might leave.
       
    29 // -----------------------------------------------------------------------------
       
    30 //
       
    31 TMSTarEventHandler::TMSTarEventHandler(TMSServer* aServer) :
       
    32     CActive(EPriorityStandard),
       
    33     iTMSSer(aServer)
       
    34     {
       
    35     }
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // TMSTarEventHandler::ConstructL
       
    39 // Symbian 2nd phase constructor can leave.
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 void TMSTarEventHandler::ConstructL()
       
    43     {
       
    44     TRACE_PRN_FN_ENT;
       
    45     CActiveScheduler::Add(this);
       
    46     User::LeaveIfError(iProperty.Attach(KTMSPropertyCategory, ERoutingPs));
       
    47     iStatus = KRequestPending;
       
    48     iProperty.Subscribe(iStatus);
       
    49     SetActive();
       
    50     TRACE_PRN_FN_EXT;
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // TMSTarEventHandler::NewL
       
    55 // Two-phased constructor.
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 TMSTarEventHandler* TMSTarEventHandler::NewL(TMSServer* aServer)
       
    59     {
       
    60     TMSTarEventHandler* self = new (ELeave) TMSTarEventHandler(aServer);
       
    61     CleanupStack::PushL(self);
       
    62     self->ConstructL();
       
    63     CleanupStack::Pop(self);
       
    64     return self;
       
    65     }
       
    66 
       
    67 // Destructor
       
    68 TMSTarEventHandler::~TMSTarEventHandler()
       
    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 // TMSTarEventHandler::DoCancel
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 void TMSTarEventHandler::DoCancel()
       
    84     {
       
    85     TRACE_PRN_FN_ENT;
       
    86     iProperty.Cancel();
       
    87     TRACE_PRN_FN_EXT;
       
    88     }
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // TMSTarEventHandler::RunL
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 void TMSTarEventHandler::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() == TMS_RESULT_SUCCESS)
       
   100         {
       
   101         iStatus = KRequestPending;
       
   102         iProperty.Subscribe(iStatus);
       
   103         SetActive();
       
   104         TRoutingMsgBufPckg routingpckg;
       
   105         iProperty.Get(routingpckg);
       
   106         iTMSSer->NotifyTarClients(routingpckg);
       
   107         }
       
   108     TRACE_PRN_FN_EXT;
       
   109     }
       
   110 
       
   111 //  End of File
       
   112