|
1 /* |
|
2 * Copyright (c) 2002 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: Presence Server class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __CPENGSERVER_H__ |
|
20 #define __CPENGSERVER_H__ |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32def.h> |
|
24 #include <s32std.h> |
|
25 #include <e32svr.h> |
|
26 #include <s32file.h> // file server |
|
27 |
|
28 #include "MPEngServer.h" |
|
29 #include "RPEngStorageAdminClient.h" |
|
30 |
|
31 // FORWARD DECLARATION |
|
32 class TPEngServerParams; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 /** |
|
36 * Presence Server server class |
|
37 * |
|
38 * @lib PEngServer2 |
|
39 * @since 3.0 |
|
40 */ |
|
41 NONSHARABLE_CLASS( CPEngServer ): |
|
42 public CPolicyServer, |
|
43 public MPEngServer |
|
44 { |
|
45 public: // Constructors and destructors |
|
46 |
|
47 /** |
|
48 * Two-phased constructor. |
|
49 * @since 3.0 |
|
50 * @param aPriority priority of the server |
|
51 */ |
|
52 static CPEngServer* NewL( TInt aPriority ); |
|
53 |
|
54 static CPEngServer* NewLC( TInt aPriority ); |
|
55 |
|
56 /** |
|
57 * Destructor. |
|
58 */ |
|
59 virtual ~CPEngServer(); |
|
60 |
|
61 public: // new functions from MPEngServer |
|
62 |
|
63 /** |
|
64 * Inform server about created session, |
|
65 * @see <MPEngServer.h> |
|
66 */ |
|
67 void SessionCreated(); |
|
68 |
|
69 /** |
|
70 * Inform server about closing of the session |
|
71 * @see <MPEngServer.h> |
|
72 */ |
|
73 void SessionDied(); |
|
74 |
|
75 /** |
|
76 * Add subsession to the container |
|
77 * @see <MPEngServer.h> |
|
78 */ |
|
79 void AddSubSessionL( CPEngSubSession& aSubSession ); |
|
80 |
|
81 /** |
|
82 * Remove subsession from the container |
|
83 * @see <MPEngServer.h> |
|
84 */ |
|
85 void RemoveSubSessionL( CPEngSubSession& aSubSession ); |
|
86 |
|
87 /** |
|
88 * Session Manager |
|
89 * @see <MPEngServer.h> |
|
90 */ |
|
91 CPEngCSPSessManager* CSPSessionManagerLC( |
|
92 CPEngSessionSlotId& aSessionId ); |
|
93 |
|
94 /** |
|
95 * Remove Session Manager from the server |
|
96 * @see <MPEngServer.h> |
|
97 */ |
|
98 void RemoveCSPSessManager( CPEngCSPSessManager* aManager ); |
|
99 |
|
100 /** |
|
101 * Session is opened |
|
102 * @see <MPEngServer.h> |
|
103 */ |
|
104 void SessionOpened(); |
|
105 |
|
106 /** |
|
107 * Session is closed |
|
108 * @see <MPEngServer.h> |
|
109 */ |
|
110 void SessionClosed(); |
|
111 |
|
112 public: // New methods |
|
113 |
|
114 /* |
|
115 * Starts the server |
|
116 * @since 3.0 |
|
117 * @param aParams parameters for server start up |
|
118 */ |
|
119 static TInt ExecuteServerL( TPEngServerParams& aParams ); |
|
120 |
|
121 /* |
|
122 * Stops the server, |
|
123 * actually just calls CActiveScheduler::Stop(); |
|
124 * @since 3.0 |
|
125 */ |
|
126 void StopServer(); |
|
127 |
|
128 /* |
|
129 * Run server |
|
130 * @since 3.0 |
|
131 * @param aParams parameters to run server with |
|
132 */ |
|
133 static void RunServerL( TPEngServerParams& aParams ); |
|
134 |
|
135 public: // Methods derived from CServer2 |
|
136 |
|
137 /* |
|
138 * Create new session handler |
|
139 * @see <CServer2.h> |
|
140 */ |
|
141 CSession2* NewSessionL( const TVersion& aVersion, |
|
142 const RMessage2& aMessage ) const; |
|
143 |
|
144 private: // New methods |
|
145 |
|
146 /* |
|
147 * Start server listening |
|
148 * Calls CActiveScheduler::Start() |
|
149 * @since 3.0 |
|
150 */ |
|
151 void StartServer(); |
|
152 |
|
153 /* |
|
154 * Check server access count |
|
155 * @since 3.0 |
|
156 */ |
|
157 void CheckServerAccess(); |
|
158 |
|
159 protected: // Constructors and destructors |
|
160 |
|
161 /** |
|
162 * C++ default constructor. |
|
163 */ |
|
164 CPEngServer( TInt aPriority ); |
|
165 |
|
166 /** |
|
167 * Symbian 2nd phase constructor |
|
168 */ |
|
169 void ConstructL(); // Second phase construct |
|
170 |
|
171 private: // Data |
|
172 |
|
173 /// OWN: Object Container of Sub-Sessions, owned over iContainerIx |
|
174 CObjectCon* iContainer; |
|
175 |
|
176 /// OWN: Flag if server is running |
|
177 TBool iRunning; |
|
178 |
|
179 /// OWN: Session count |
|
180 TInt iSessCount; |
|
181 |
|
182 /// OWN: Opened sessions count |
|
183 TInt iOpenedSessions; |
|
184 |
|
185 /// OWN: Container of the CSP Managers |
|
186 /// Elements OWNed |
|
187 RPointerArray<CPEngCSPSessManager> iSessionsManagers; |
|
188 |
|
189 /// OWN: Storage Admin main client |
|
190 RPEngStorageAdminClient iStoreAdmin; |
|
191 }; |
|
192 |
|
193 #endif // __CPENGSERVER_H__ |
|
194 |