locationsystemui/locationsysui/privacyverifiernotifierui/locprivacyserver/src/locprivacyserver.cpp
changeset 32 b12ea03c50a3
child 37 e175e2ba2fb0
equal deleted inserted replaced
25:73f6c2762ffe 32:b12ea03c50a3
       
     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:  server class implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 
       
    20 #include "locprivacyserver.h"
       
    21 #include "locprivacycommon.h"
       
    22 #include "locprivacyserversession.h"
       
    23 #include "locprivacyserverdebugpanic.h"
       
    24 
       
    25 
       
    26 // CONSTANTS
       
    27 
       
    28 // ================= MEMBER FUNCTIONS =======================
       
    29 
       
    30 // C++ default constructor can NOT contain any code, that
       
    31 // might leave.
       
    32 //
       
    33 CLocPrivacyServer::CLocPrivacyServer(TInt aPriority)
       
    34     : CServer2(aPriority),
       
    35     iNumSessions(0)
       
    36     {
       
    37     // This does not do anything.
       
    38     __DECLARE_NAME(_S("CLocPrivacyServer"));
       
    39     }
       
    40 
       
    41 // EPOC default constructor can leave.
       
    42 void CLocPrivacyServer::ConstructL()
       
    43     {
       
    44     User::LeaveIfError(Start(KLocPrivacyServerName));
       
    45     }
       
    46 
       
    47 // Two-phased constructor
       
    48 CLocPrivacyServer* CLocPrivacyServer::NewL()
       
    49     {
       
    50     CLocPrivacyServer* self = new (ELeave) CLocPrivacyServer(EPriority);
       
    51     CleanupStack::PushL(self);
       
    52     self->ConstructL();
       
    53     CleanupStack::Pop(self);
       
    54     return self;
       
    55     }
       
    56 
       
    57 // Destructor
       
    58 CLocPrivacyServer::~CLocPrivacyServer()
       
    59     {
       
    60     }
       
    61 
       
    62 // ---------------------------------------------------------
       
    63 // CLocPrivacyServer::IncrementSessions
       
    64 //
       
    65 // (other items were commented in a header).
       
    66 // ---------------------------------------------------------
       
    67 //
       
    68 void CLocPrivacyServer::IncrementSessions()
       
    69     {
       
    70     iNumSessions++;
       
    71     }
       
    72 
       
    73 // ---------------------------------------------------------
       
    74 // CLocPrivacyServer::DecrementSessions
       
    75 //
       
    76 // (other items were commented in a header).
       
    77 // ---------------------------------------------------------
       
    78 //
       
    79 void CLocPrivacyServer::DecrementSessions(
       
    80     CLocPrivacyServerSession* /*aSession*/)
       
    81     {
       
    82     iNumSessions--;
       
    83     if (iNumSessions == 0)
       
    84         {
       
    85          // Shutdown the server by shutting down the active scheduler.
       
    86         CActiveScheduler::Stop();
       
    87         }
       
    88     }
       
    89 
       
    90 // ---------------------------------------------------------
       
    91 // CLocPrivacyServer::NewSessionL
       
    92 //
       
    93 // (other items were commented in a header).
       
    94 // ---------------------------------------------------------
       
    95 //
       
    96 CSession2* CLocPrivacyServer::NewSessionL(
       
    97     const TVersion& /*aVersion*/,
       
    98     const RMessage2& /*aMessage*/) const
       
    99     {
       
   100     
       
   101     // Make new session
       
   102     CLocPrivacyServerSession* newSession = CLocPrivacyServerSession::NewL(
       
   103             const_cast<CLocPrivacyServer&>(*this));
       
   104 
       
   105     return newSession;
       
   106     }
       
   107 
       
   108 // ---------------------------------------------------------
       
   109 // CLocPrivacyServer::RunError
       
   110 // This method is called by the active scheduler whenever an
       
   111 // untrapped leave occurs in the server active object.
       
   112 // (other items were commented in a header).
       
   113 // ---------------------------------------------------------
       
   114 //
       
   115 TInt CLocPrivacyServer::RunError(TInt aError)
       
   116     {
       
   117     Message().Complete(aError);
       
   118     ReStart();
       
   119     return KErrNone;
       
   120     }
       
   121 
       
   122 
       
   123 //  End of File