locationsystemui/locationsysui/locsettingsuiservice/locsettingsuiserver/src/locsettingsuisrvshutdowntimer.cpp
branchRCL_3
changeset 44 2b4ea9893b66
parent 42 02ba3f1733c6
child 45 6b6920c56e2f
equal deleted inserted replaced
42:02ba3f1733c6 44:2b4ea9893b66
     1 /*
       
     2 * Copyright (c) 2005 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:  The implementation of Shutdown Timer class of Location 
       
    15 *                Settings UI Server
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include <eikenv.h>
       
    21 
       
    22 #include "locsettingsuisrvshutdowntimer.h"
       
    23 
       
    24 //Local constants
       
    25 // Shutdown Time 10 seconds expressed in micro seconds
       
    26 const TInt KShutdownTime = 10000000;
       
    27 
       
    28 // ======== MEMBER FUNCTIONS ========
       
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 // CLocSettingsUISrvShutdown::NewL()
       
    32 // ---------------------------------------------------------------------------
       
    33 //
       
    34 CLocSettingsUISrvShutdown* CLocSettingsUISrvShutdown::NewL()
       
    35     {
       
    36     CLocSettingsUISrvShutdown* self = 
       
    37             new(ELeave) CLocSettingsUISrvShutdown();
       
    38     CleanupStack::PushL(self);
       
    39     self->ConstructL();
       
    40     CleanupStack::Pop(self);
       
    41     return self;
       
    42     }
       
    43 
       
    44    
       
    45 // ---------------------------------------------------------------------------
       
    46 // CLocSettingsUISrvShutdown::~CLocSettingsUISrvShutdown()
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 CLocSettingsUISrvShutdown::~CLocSettingsUISrvShutdown()
       
    50     {
       
    51     iTimer.Cancel();
       
    52     iTimer.Close();
       
    53     }
       
    54 
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // CLocSettingsUISrvShutdown::Start()
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 void CLocSettingsUISrvShutdown::Start()
       
    61     {
       
    62     // Just to be safe, Cancel the Timer if it is running currently.
       
    63     iTimer.Cancel();
       
    64     iStatus = KRequestPending;
       
    65     iTimer.After(iStatus, KShutdownTime);
       
    66     SetActive();
       
    67     }
       
    68 
       
    69 
       
    70 // ---------------------------------------------------------------------------
       
    71 // CLocSettingsUISrvShutdown::RunL()
       
    72 // ---------------------------------------------------------------------------
       
    73 //
       
    74 void CLocSettingsUISrvShutdown::RunL()
       
    75     {
       
    76     // The server object will be deleted by the Application class which 
       
    77     // creates and owns the object
       
    78     // Shutting down the server by stopping the Active Scheduler loop.
       
    79     // Since currently there are no sessions, we don't need to explicitly
       
    80     // close sesisons.
       
    81     // Also since no requests are currently being executed, we don't need to
       
    82     // worry about another Active Scheduler loop running.
       
    83     CActiveScheduler::Stop();
       
    84     }
       
    85 
       
    86 
       
    87 // ---------------------------------------------------------------------------
       
    88 // CLocSettingsUISrvShutdown::DoCancel()
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 void CLocSettingsUISrvShutdown::DoCancel()
       
    92     {
       
    93     iTimer.Cancel();
       
    94     }
       
    95 
       
    96 
       
    97 // ---------------------------------------------------------------------------
       
    98 // CLocSettingsUISrvShutdown::RunError(TInt aError)
       
    99 // ---------------------------------------------------------------------------
       
   100 //
       
   101 TInt CLocSettingsUISrvShutdown::RunError(TInt /*aError*/)
       
   102     {
       
   103     // See if any error handling needed here.
       
   104     return KErrNone;
       
   105     }
       
   106 
       
   107 
       
   108 // ---------------------------------------------------------------------------
       
   109 // CLocSettingsUISrvShutdown::CLocSettingsUISrvShutdown()
       
   110 // ---------------------------------------------------------------------------
       
   111 //
       
   112 CLocSettingsUISrvShutdown::CLocSettingsUISrvShutdown()
       
   113     :CActive(EPriorityStandard)
       
   114     {
       
   115     }
       
   116 
       
   117 
       
   118 // ---------------------------------------------------------------------------
       
   119 // CLocSettingsUISrvShutdown::ConstructL()
       
   120 // ---------------------------------------------------------------------------
       
   121 //
       
   122 void CLocSettingsUISrvShutdown::ConstructL()
       
   123     {
       
   124     CActiveScheduler::Add(this);
       
   125     TInt errorCode = iTimer.CreateLocal();
       
   126     User::LeaveIfError(errorCode);
       
   127     }
       
   128 
       
   129 
       
   130 // End of file