bearermanagement/mpm/src/mpmofflinequerytimer.cpp
branchRCL_3
changeset 69 cf1b3ddbe9a1
parent 65 14754bf06654
child 75 dd7f31e692c1
equal deleted inserted replaced
65:14754bf06654 69:cf1b3ddbe9a1
     1 /*
       
     2  * Copyright (c) 2010 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: Implementation of class CMPMOfflineQueryTimer.
       
    15  * This timer is used for preventing offline query when the user
       
    16  * has cancelled the previous offline query.
       
    17  *
       
    18  */
       
    19 
       
    20 #include "mpmlogger.h"
       
    21 #include "mpmserver.h"
       
    22 #include "mpmexpirytimer.h"
       
    23 #include "mpmofflinequerytimer.h"
       
    24 
       
    25 // ---------------------------------------------------------------------------
       
    26 // Creates a new object by calling the two-phased constructor.
       
    27 // ---------------------------------------------------------------------------
       
    28 //
       
    29 CMPMOfflineQueryTimer* CMPMOfflineQueryTimer::NewL( CMPMServer* aServer )
       
    30     {
       
    31     MPMLOGSTRING( "CMPMOfflineQueryTimer::NewL" )
       
    32             
       
    33     CMPMOfflineQueryTimer* self = new( ELeave ) CMPMOfflineQueryTimer( aServer );
       
    34     CleanupStack::PushL( self );
       
    35     self->ConstructL();
       
    36     CleanupStack::Pop( self );
       
    37     return self;
       
    38     }
       
    39 
       
    40 // ---------------------------------------------------------------------------
       
    41 // Default C++ constructor.
       
    42 // ---------------------------------------------------------------------------
       
    43 //
       
    44 CMPMOfflineQueryTimer::CMPMOfflineQueryTimer( CMPMServer* aServer ) :
       
    45     iServer( aServer )
       
    46     {
       
    47     MPMLOGSTRING( "CMPMOfflineQueryTimer::CMPMOfflineQueryTimer" )
       
    48     }
       
    49 
       
    50 // ---------------------------------------------------------------------------
       
    51 // Symbian 2nd phase constructor.
       
    52 // ---------------------------------------------------------------------------
       
    53 //
       
    54 void CMPMOfflineQueryTimer::ConstructL()
       
    55     {
       
    56     MPMLOGSTRING( "CMPMOfflineQueryTimer::ConstructL" )
       
    57     iExpiryTimer = CMPMExpiryTimer::NewL( *this, KTimeout );
       
    58     }
       
    59 
       
    60 // ---------------------------------------------------------------------------
       
    61 // Destructor.
       
    62 // ---------------------------------------------------------------------------
       
    63 //
       
    64 CMPMOfflineQueryTimer::~CMPMOfflineQueryTimer()
       
    65     {
       
    66     MPMLOGSTRING( "CMPMOfflineQueryTimer::~CMPMOfflineQueryTimer" )
       
    67     if ( iExpiryTimer )
       
    68         {
       
    69         iExpiryTimer->Cancel();
       
    70         delete iExpiryTimer;
       
    71         }
       
    72     }
       
    73 
       
    74 // ---------------------------------------------------------------------------
       
    75 // Start the timer.
       
    76 // ---------------------------------------------------------------------------
       
    77 //
       
    78 void CMPMOfflineQueryTimer::StartTimer()
       
    79     {
       
    80     MPMLOGSTRING( "CMPMOfflineQueryTimer::StartTimer" )
       
    81     if ( iExpiryTimer )
       
    82         {
       
    83         iExpiryTimer->Cancel();
       
    84         iExpiryTimer->Start();    
       
    85         }
       
    86     }
       
    87 
       
    88 // ---------------------------------------------------------------------------
       
    89 // Handles the timeout.
       
    90 // ---------------------------------------------------------------------------
       
    91 //
       
    92 void CMPMOfflineQueryTimer::HandleTimedOut()
       
    93     {
       
    94     MPMLOGSTRING( "CMPMOfflineQueryTimer::HandleTimedOut" )
       
    95     iServer->ResetOfflineQueryTimer();
       
    96     }