|
1 /* |
|
2 * Copyright (c) 2008 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "atextsrvcommon.h" |
|
20 #include "atextclientsrvcommon.h" |
|
21 #include "atextsecpolicy.h" |
|
22 #include "atextcommonsession.h" |
|
23 #include "debug.h" |
|
24 |
|
25 // --------------------------------------------------------------------------- |
|
26 // Constructor |
|
27 // --------------------------------------------------------------------------- |
|
28 // |
|
29 CATExtSrvCommon::CATExtSrvCommon( TInt aPriority ) : |
|
30 CPolicyServer( aPriority, KSrvPolicy ) |
|
31 { |
|
32 } |
|
33 |
|
34 // --------------------------------------------------------------------------- |
|
35 // Destructor. |
|
36 // --------------------------------------------------------------------------- |
|
37 // |
|
38 CATExtSrvCommon::~CATExtSrvCommon() |
|
39 { |
|
40 iSessions.Close(); |
|
41 TRACE_FUNC |
|
42 } |
|
43 |
|
44 // --------------------------------------------------------------------------- |
|
45 // Two-phased constructor. |
|
46 // --------------------------------------------------------------------------- |
|
47 // |
|
48 CATExtSrvCommon* CATExtSrvCommon::NewLC() |
|
49 { |
|
50 CATExtSrvCommon* self = new (ELeave) CATExtSrvCommon( EPriorityNormal ); |
|
51 CleanupStack::PushL( self ); |
|
52 self->ConstructL(); |
|
53 self->StartL( KATExtSrvName ); |
|
54 RThread().SetPriority( EPriorityNormal ); |
|
55 return self; |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // Removes session from array of instantiated sessions |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 void CATExtSrvCommon::ClientClosed( CATExtCommonSession& aSession ) |
|
63 { |
|
64 TRACE_FUNC_ENTRY |
|
65 TInt index = iSessions.Find( &aSession ); |
|
66 if ( index >= 0 ) |
|
67 { |
|
68 iSessions.Remove( index ); |
|
69 } |
|
70 TRACE_FUNC_EXIT |
|
71 } |
|
72 |
|
73 // --------------------------------------------------------------------------- |
|
74 // Creates a new session to client |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 CSession2* CATExtSrvCommon::NewSessionL( const TVersion& aVersion, |
|
78 const RMessage2& /*aMessage*/ ) const |
|
79 { |
|
80 TRACE_FUNC_ENTRY |
|
81 CATExtSrvCommon& thisServer = const_cast<CATExtSrvCommon&>( *this ); |
|
82 CATExtCommonSession* session = CATExtCommonSession::NewL( thisServer, |
|
83 aVersion ); |
|
84 CleanupStack::PushL( session ); |
|
85 thisServer.iSessions.AppendL( session ); |
|
86 CleanupStack::Pop( session ); |
|
87 TRACE_FUNC_EXIT |
|
88 return session; |
|
89 } |
|
90 |
|
91 // --------------------------------------------------------------------------- |
|
92 // CATExtSrvCommon::ConstructL |
|
93 // --------------------------------------------------------------------------- |
|
94 // |
|
95 void CATExtSrvCommon::ConstructL() |
|
96 { |
|
97 TRACE_FUNC_ENTRY |
|
98 TRACE_FUNC_EXIT |
|
99 } |