securitydialogs/secuidialognotifiersrv/src/secuidialognotifierserver.cpp
changeset 59 881d92421467
child 63 989397f9511c
equal deleted inserted replaced
53:25dd1e8b2663 59:881d92421467
       
     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:  Secui dialog notifier server
       
    15 *
       
    16 */
       
    17 
       
    18 #include "secuidialognotifierserver.h"   // CSecuiDialogNotifierServer
       
    19 #include "secuidialognotifiersession.h"  // CSecuiDialogNotifierSession
       
    20 #include "secuidialognotifierservername.h" // KSecuiDialogNotifierServerName
       
    21 #include "secuidialogstrace.h"           // TRACE macro
       
    22 
       
    23 
       
    24 const TUint KRangeCount = 1;
       
    25 
       
    26 const TInt KRanges[ KRangeCount ] =
       
    27     {
       
    28     0
       
    29     };
       
    30 
       
    31 const TUint8 KElementsIndex[ KRangeCount ] =
       
    32     {
       
    33     0
       
    34     };
       
    35 
       
    36 const TInt KUikonServerId = 0x10003a4a;
       
    37 const CPolicyServer::TPolicyElement KPolicyElements[] =
       
    38     {
       
    39     { _INIT_SECURITY_POLICY_S0( KUikonServerId ), CPolicyServer::EFailClient }
       
    40     };
       
    41 
       
    42 const CPolicyServer::TPolicy KSecuiDialogNotifierServerPolicy =
       
    43     {
       
    44     CPolicyServer::EAlwaysPass,
       
    45     KRangeCount,
       
    46     KRanges,
       
    47     KElementsIndex,
       
    48     KPolicyElements
       
    49     };
       
    50 
       
    51 
       
    52 // ======== MEMBER FUNCTIONS ========
       
    53 
       
    54 // ---------------------------------------------------------------------------
       
    55 // CSecuiDialogNotifierServer::NewLC()
       
    56 // ---------------------------------------------------------------------------
       
    57 //
       
    58 CSecuiDialogNotifierServer* CSecuiDialogNotifierServer::NewLC()
       
    59     {
       
    60     CSecuiDialogNotifierServer* self = new( ELeave ) CSecuiDialogNotifierServer;
       
    61     CleanupStack::PushL( self );
       
    62     self->ConstructL();
       
    63     return self;
       
    64     }
       
    65 
       
    66 // ---------------------------------------------------------------------------
       
    67 // CSecuiDialogNotifierServer::~CSecuiDialogNotifierServer()
       
    68 // ---------------------------------------------------------------------------
       
    69 //
       
    70 CSecuiDialogNotifierServer::~CSecuiDialogNotifierServer()
       
    71     {
       
    72     TRACE( "CSecuiDialogNotifierServer::~CSecuiDialogNotifierServer" );
       
    73     }
       
    74 
       
    75 // ---------------------------------------------------------------------------
       
    76 // CSecuiDialogNotifierServer::AddSession()
       
    77 // ---------------------------------------------------------------------------
       
    78 //
       
    79 void CSecuiDialogNotifierServer::AddSession()
       
    80     {
       
    81     TRACE( "CSecuiDialogNotifierServer::AddSession" );
       
    82     ++iSessionCount;
       
    83     }
       
    84 
       
    85 // ---------------------------------------------------------------------------
       
    86 // CSecuiDialogNotifierServer::RemoveSession()
       
    87 // ---------------------------------------------------------------------------
       
    88 //
       
    89 void CSecuiDialogNotifierServer::RemoveSession()
       
    90     {
       
    91     TRACE( "CSecuiDialogNotifierServer::RemoveSession" );
       
    92     --iSessionCount;
       
    93     if( iSessionCount == 0 )
       
    94         {
       
    95         TRACE( "CSecuiDialogNotifierServer::RemoveSession, shutting down" );
       
    96         CActiveScheduler::Stop();
       
    97         }
       
    98     }
       
    99 
       
   100 // ---------------------------------------------------------------------------
       
   101 // CSecuiDialogNotifierServer::NewSessionL()
       
   102 // ---------------------------------------------------------------------------
       
   103 //
       
   104 CSession2* CSecuiDialogNotifierServer::NewSessionL( const TVersion &aVersion,
       
   105         const RMessage2& /*aMessage*/ ) const
       
   106     {
       
   107     TRACE( "CSecuiDialogNotifierServer::NewSessionL" );
       
   108     TVersion version( KSecuiDialogNotifierServerMajorVersionNumber,
       
   109             KSecuiDialogNotifierServerMinorVersionNumber,
       
   110             KSecuiDialogNotifierServerBuildVersionNumber );
       
   111     if( !User::QueryVersionSupported( version, aVersion ) )
       
   112         {
       
   113         TRACE( "CSecuiDialogNotifierServer::NewSessionL, version not supported" );
       
   114         User::Leave( KErrNotSupported );
       
   115         }
       
   116 
       
   117     return CSecuiDialogNotifierSession::NewL();
       
   118     }
       
   119 
       
   120 // ---------------------------------------------------------------------------
       
   121 // CSecuiDialogNotifierServer::CSecuiDialogNotifierServer()
       
   122 // ---------------------------------------------------------------------------
       
   123 //
       
   124 CSecuiDialogNotifierServer::CSecuiDialogNotifierServer() :
       
   125         CPolicyServer( CActive::EPriorityStandard, KSecuiDialogNotifierServerPolicy )
       
   126     {
       
   127     TRACE( "CSecuiDialogNotifierServer::CSecuiDialogNotifierServer" );
       
   128     }
       
   129 
       
   130 // ---------------------------------------------------------------------------
       
   131 // CSecuiDialogNotifierServer::ConstructL()
       
   132 // ---------------------------------------------------------------------------
       
   133 //
       
   134 void CSecuiDialogNotifierServer::ConstructL()
       
   135     {
       
   136     StartL( KSecuiDialogNotifierServerName );
       
   137     }
       
   138