author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 20:54:53 +0300 | |
branch | RCL_3 |
changeset 21 | 9da50d567e3c |
parent 20 | f4a778e096c2 |
permissions | -rw-r--r-- |
20 | 1 |
/* |
2 |
* Copyright (c) 2007 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: PCS Server main class. Co-ordinates server startup, |
|
15 |
* shutdown and receives client requests. |
|
16 |
* |
|
17 |
*/ |
|
18 |
||
19 |
// INCLUDE FILES |
|
20 |
#include <e32base.h> |
|
21 |
#include <featmgr.h> |
|
22 |
||
23 |
#include "CPcsDebug.h" |
|
24 |
#include "CPcsDefs.h" |
|
25 |
#include "CPcsServer.h" |
|
26 |
#include "CPcsSession.h" |
|
27 |
#include "CPcsPluginInterface.h" |
|
28 |
||
29 |
//Costant Declaration |
|
30 |
const TInt KAlgorithmNameMaxLen = 50; |
|
31 |
// ============================== MEMBER FUNCTIONS ============================ |
|
32 |
||
33 |
// ---------------------------------------------------------------------------- |
|
34 |
// CPcsServer::NewL |
|
35 |
// Two Phase Construction |
|
36 |
// ---------------------------------------------------------------------------- |
|
37 |
CPcsServer* CPcsServer::NewL() |
|
38 |
{ |
|
39 |
PRINT ( _L("Enter CPcsServer::NewL") ); |
|
40 |
||
41 |
CPcsServer* self = new (ELeave) CPcsServer; |
|
42 |
CleanupStack::PushL(self); |
|
43 |
self->ConstructL(); |
|
44 |
self->StartL(KPcsServerName); |
|
45 |
CleanupStack::Pop(); |
|
46 |
||
47 |
PRINT ( _L("End CPcsServer::NewL") ); |
|
48 |
||
49 |
return self; |
|
50 |
} |
|
51 |
||
52 |
// ---------------------------------------------------------------------------- |
|
53 |
// CPcsServer::CPcsServer |
|
54 |
// Constructor |
|
55 |
// ---------------------------------------------------------------------------- |
|
56 |
CPcsServer::CPcsServer() : CServer2(EPriorityStandard) |
|
57 |
{ |
|
58 |
PRINT ( _L("Enter CPcsServer::CPcsServer") ); |
|
59 |
PRINT ( _L("End CPcsServer::CPcsServer") ); |
|
60 |
} |
|
61 |
||
62 |
// ---------------------------------------------------------------------------- |
|
63 |
// CPcsServer::ConstructL |
|
64 |
// Second phase constructor |
|
65 |
// ---------------------------------------------------------------------------- |
|
66 |
void CPcsServer::ConstructL() |
|
67 |
{ |
|
68 |
PRINT ( _L("Enter CPcsServer::ConstructL") ); |
|
69 |
||
70 |
iPcs = CPcsPluginInterface::NewL(); |
|
71 |
||
72 |
// Check if the phone is chinese feature id installed |
|
73 |
TBool isChineseVariant = IsChineseFeatureInitilizedL(); |
|
74 |
// Create the plugin for the required algorithm |
|
75 |
// Matches the ECOM Plugin's display name definition in rss file |
|
76 |
// Check for the chinese feature id flag. |
|
77 |
if(isChineseVariant) |
|
78 |
{ |
|
79 |
// Chinese variant phones. Use Algorithm 2 |
|
80 |
PRINT ( _L("Enter CPcsServer::ConstructL() - Chinese Variant Phone Algorithm Instantiated") ); |
|
81 |
TBuf<KAlgorithmNameMaxLen> algorithmName(KPcsAlgorithm_Chinese); |
|
82 |
iPcs->InstantiateAlgorithmL(algorithmName); |
|
83 |
||
84 |
} |
|
85 |
else |
|
86 |
{ |
|
87 |
// NON-Chinese variant phones. Use Algorithm 1 |
|
88 |
PRINT ( _L("Enter CPcsServer::ConstructL() - NON-Chinese Variant Phone Algorithm Instantiated") ); |
|
89 |
TBuf<KAlgorithmNameMaxLen> algorithmName(KPcsAlgorithm_NonChinese); |
|
90 |
// TBuf<KAlgorithmNameMaxLen> algorithmName(KPcsAlgorithm_Chinese); |
|
91 |
iPcs->InstantiateAlgorithmL(algorithmName); |
|
92 |
||
93 |
} |
|
94 |
||
95 |
PRINT ( _L("End CPcsServer::ConstructL") ); |
|
96 |
} |
|
97 |
||
98 |
// ---------------------------------------------------------------------------- |
|
99 |
// CPcsServer::~CPcsServer |
|
100 |
// Destructor |
|
101 |
// ---------------------------------------------------------------------------- |
|
102 |
CPcsServer::~CPcsServer() |
|
103 |
{ |
|
104 |
PRINT ( _L("Enter CPcsServer::~CPcsServer") ); |
|
105 |
delete iPcs; |
|
106 |
PRINT ( _L("End CPcsServer::~CPcsServer") ); |
|
107 |
} |
|
108 |
||
109 |
// ---------------------------------------------------------------------------- |
|
110 |
// CPcsServer::NewSessionL |
|
111 |
// Constructor |
|
112 |
// ---------------------------------------------------------------------------- |
|
113 |
CSession2* CPcsServer::NewSessionL(const TVersion& aVersion, |
|
114 |
const RMessage2& /*aMessage*/ ) const |
|
115 |
{ |
|
116 |
PRINT ( _L("Enter CPcsServer::NewSessionL") ); |
|
117 |
||
118 |
TVersion serverVersion( 1, 0, 0); |
|
119 |
if ( !User::QueryVersionSupported(serverVersion,aVersion) ) |
|
120 |
User::Leave(KErrNotSupported); |
|
121 |
||
122 |
CPcsSession* session = CPcsSession::NewL(const_cast<CPcsServer*> (this)); |
|
123 |
||
124 |
PRINT ( _L("End CPcsServer::NewSessionL") ); |
|
125 |
||
126 |
return session; |
|
127 |
} |
|
128 |
||
129 |
// ---------------------------------------------------------------------------- |
|
130 |
// CPcsServer::PluginInterface |
|
131 |
// Get the plugin interface |
|
132 |
// ---------------------------------------------------------------------------- |
|
133 |
CPcsPluginInterface* CPcsServer::PluginInterface() |
|
134 |
{ |
|
135 |
return iPcs; |
|
21
9da50d567e3c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
20
diff
changeset
|
136 |
} |
20 | 137 |
|
138 |
// ---------------------------------------------------------------------------- |
|
139 |
// CPcsServer::IsChineseFeatureInitilizedL() |
|
140 |
// Returns ETrue if Chinese variant feature is initilized |
|
141 |
// ---------------------------------------------------------------------------- |
|
142 |
TBool CPcsServer::IsChineseFeatureInitilizedL() |
|
143 |
{ |
|
144 |
FeatureManager::InitializeLibL(); |
|
145 |
||
146 |
TBool chineseFeatureInitialized = FeatureManager::FeatureSupported(KFeatureIdChinese) && |
|
147 |
( FeatureManager::FeatureSupported(KFeatureIdChinesePrcFonts) || FeatureManager::FeatureSupported(KFeatureIdChineseTaiwanHkFonts) ); |
|
148 |
||
149 |
FeatureManager::UnInitializeLib(); |
|
150 |
||
151 |
return chineseFeatureInitialized; |
|
152 |
} |