114
|
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: BS Server - implemenration of CServer2
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef C_CBSSERVER_H
|
|
20 |
#define C_CBSSERVER_H
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <eikenv.h>
|
|
24 |
#include <eikappui.h>
|
|
25 |
|
|
26 |
#include "bspanic.h"
|
|
27 |
|
|
28 |
class CBSEngine;
|
|
29 |
|
|
30 |
/**
|
|
31 |
* Back Stepping server implementation
|
|
32 |
*
|
|
33 |
* @since Series 60 3.2
|
|
34 |
*/
|
|
35 |
|
|
36 |
class CBSServer : public CServer2
|
|
37 |
{
|
|
38 |
/**
|
|
39 |
* EIkonEnv for the server process.
|
|
40 |
*
|
|
41 |
* @since Series 60 3.2
|
|
42 |
*/
|
|
43 |
class CBSEikonEnv : public CEikonEnv
|
|
44 |
{
|
|
45 |
public:
|
|
46 |
void DestroyEnvironment();
|
|
47 |
void ConstructL();
|
|
48 |
};
|
|
49 |
|
|
50 |
/**
|
|
51 |
* EikAppUi for the server process.
|
|
52 |
* Inform engine if focused application was changed
|
|
53 |
*
|
|
54 |
* @since Series 60 3.2
|
|
55 |
*/
|
|
56 |
class CBSAppUi : public CEikAppUi
|
|
57 |
{
|
|
58 |
public:
|
|
59 |
~CBSAppUi();
|
|
60 |
void ConstructL();
|
|
61 |
void HandleWsEventL( const TWsEvent& aEvent,
|
|
62 |
CCoeControl* aDestination );
|
|
63 |
CBSEngine* iEngine;
|
|
64 |
};
|
|
65 |
|
|
66 |
public:
|
|
67 |
|
|
68 |
static CBSServer* NewLC();
|
|
69 |
|
|
70 |
/**
|
|
71 |
* Destructor.
|
|
72 |
*/
|
|
73 |
virtual ~CBSServer();
|
|
74 |
|
|
75 |
/**
|
|
76 |
* Return the reference to the engine.
|
|
77 |
*
|
|
78 |
* @since Series 60 3.2
|
|
79 |
* @return engine reference
|
|
80 |
*/
|
|
81 |
CBSEngine& Engine();
|
|
82 |
|
|
83 |
/**
|
|
84 |
* Increment session count
|
|
85 |
*
|
|
86 |
* @since Series 60 3.2
|
|
87 |
*/
|
|
88 |
void IncrementSessions();
|
|
89 |
|
|
90 |
/**
|
|
91 |
* Decrement session count
|
|
92 |
* Stops server if last session was closed
|
|
93 |
* @since Series 60 3.2
|
|
94 |
*/
|
|
95 |
void DecrementSessions();
|
|
96 |
|
|
97 |
/**
|
|
98 |
* First stage startup for the server thread.
|
|
99 |
*
|
|
100 |
* @since Series 60 3.2
|
|
101 |
* @return return KErrNone or panics thread
|
|
102 |
*/
|
|
103 |
static TInt ThreadFunction();
|
|
104 |
|
|
105 |
/**
|
|
106 |
* Panic client.
|
|
107 |
*
|
|
108 |
* @since Series 60 3.2
|
|
109 |
* @param aMessage RMessage2
|
|
110 |
* @param aPanic panic code
|
|
111 |
*/
|
|
112 |
static void PanicClient( const RMessage2& aMessage,
|
|
113 |
TBSEnginePanic aPanic );
|
|
114 |
|
|
115 |
protected:
|
|
116 |
|
|
117 |
// from base class CActive
|
|
118 |
/**
|
|
119 |
* From CActive.
|
|
120 |
* Process any errors.
|
|
121 |
*
|
|
122 |
* @since Series 60 3.2
|
|
123 |
* @param aError the leave code reported
|
|
124 |
* @return return KErrNone if leave is handled
|
|
125 |
*/
|
|
126 |
TInt RunError( TInt aError );
|
|
127 |
|
|
128 |
private:
|
|
129 |
|
|
130 |
/**
|
|
131 |
* Constructs the server.
|
|
132 |
*
|
|
133 |
* @since Series 60 3.2
|
|
134 |
* @param aPriority CServer2 input parameter
|
|
135 |
*/
|
|
136 |
CBSServer( TInt aPriority );
|
|
137 |
|
|
138 |
void ConstructL();
|
|
139 |
|
|
140 |
/**
|
|
141 |
* Panic the server.
|
|
142 |
*
|
|
143 |
* @since Series 60 3.2
|
|
144 |
* @param aPanic the panic code
|
|
145 |
*/
|
|
146 |
static void PanicServer( TBSEnginePanic aPanic );
|
|
147 |
|
|
148 |
/**
|
|
149 |
* Second stage startup for the server thread.
|
|
150 |
*
|
|
151 |
* @since Series 60 3.2
|
|
152 |
*/
|
|
153 |
static void ThreadFunctionL();
|
|
154 |
|
|
155 |
/**
|
|
156 |
* Create a server session, and return a pointer to the created object.
|
|
157 |
* @param aVersion the client version
|
|
158 |
* @param aMessage RMessage2
|
|
159 |
* @return pointer to new session
|
|
160 |
*/
|
|
161 |
CSession2* NewSessionL( const TVersion& aVersion,
|
|
162 |
const RMessage2& aMessage ) const;
|
|
163 |
|
|
164 |
private:
|
|
165 |
// data
|
|
166 |
/**
|
|
167 |
* Instance of engine
|
|
168 |
* Own.
|
|
169 |
*/
|
|
170 |
CBSEngine* iEngine;
|
|
171 |
|
|
172 |
/*
|
|
173 |
* Session count
|
|
174 |
*/
|
|
175 |
TInt iSessionCount;
|
|
176 |
};
|
|
177 |
|
|
178 |
#endif // C_CBSSERVER_H
|