33
|
1 |
/*
|
|
2 |
* Copyright (c) 2003 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: This file contains the header file of the CCbsServer class
|
|
15 |
*
|
|
16 |
* Represents CBS Server. Derives from EPOC client-server framework base
|
|
17 |
* class CServer.
|
|
18 |
*
|
|
19 |
*/
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
#ifndef CCBSSERVER_H
|
|
25 |
#define CCBSSERVER_H
|
|
26 |
|
|
27 |
// INCLUDES
|
|
28 |
#include <e32base.h>
|
|
29 |
#include "CbsCommon.h"
|
|
30 |
#include "MCbsDbTopicListObserver.H"
|
|
31 |
|
|
32 |
// CONSTANTS
|
|
33 |
// This is the priority of the server active object.
|
|
34 |
const TInt KCbsServerPriority = CActive::EPriorityStandard;
|
|
35 |
|
|
36 |
// FORWARD DECLARATIONS
|
|
37 |
#ifdef __WINS__
|
|
38 |
// Required to satify EPOCEXE target type build criteria
|
|
39 |
IMPORT_C TInt WinsMain( TAny * );
|
|
40 |
#endif
|
|
41 |
|
|
42 |
class CObjectConIx;
|
|
43 |
class CCbsDbImp;
|
|
44 |
class CCbsRecEtel;
|
|
45 |
class CCbsReceiverHelper;
|
|
46 |
class CCbsObject;
|
|
47 |
class CCbsSatRefresh;
|
|
48 |
class CCbsShutdownMonitor;
|
|
49 |
|
|
50 |
// CLASS DECLARATION
|
|
51 |
|
|
52 |
/**
|
|
53 |
* CCbsServer is the core part of CBS Server.
|
|
54 |
*
|
|
55 |
* CCbsServer allocates all server-side resources on startup and
|
|
56 |
* creates CCbsSession objects in response to client requests.
|
|
57 |
*/
|
|
58 |
class CCbsServer : public CServer2
|
|
59 |
{
|
|
60 |
public: // New functions
|
|
61 |
/**
|
|
62 |
* Creates an instance of the class.
|
|
63 |
*
|
|
64 |
* The name of the server will be KCbsServerName as specified
|
|
65 |
* in CbsServerConstants.h.
|
|
66 |
*
|
|
67 |
* After the call is made, the server is responsible of releasing
|
|
68 |
* both database and receiver during destruction.
|
|
69 |
*
|
|
70 |
* @return The method returns a pointer to the
|
|
71 |
* new CCbsServer object.
|
|
72 |
*/
|
|
73 |
static CCbsServer* NewL();
|
|
74 |
|
|
75 |
/**
|
|
76 |
* Destructor.
|
|
77 |
*/
|
|
78 |
~CCbsServer();
|
|
79 |
|
|
80 |
/**
|
|
81 |
* Creates a new session object container.
|
|
82 |
*
|
|
83 |
* It is the responsibility of the caller to delete the object
|
|
84 |
* container, when it is no longer used.
|
|
85 |
*
|
|
86 |
* @return A pointer to the new object container.
|
|
87 |
*/
|
|
88 |
CObjectCon* NewContainerL();
|
|
89 |
|
|
90 |
/**
|
|
91 |
* Returns a reference to the database.
|
|
92 |
*
|
|
93 |
* @return Database object
|
|
94 |
*/
|
|
95 |
CCbsDbImp& Database();
|
|
96 |
|
|
97 |
/**
|
|
98 |
* Returns a reference to the receiver.
|
|
99 |
*
|
|
100 |
* @return Receiver object
|
|
101 |
*/
|
|
102 |
CCbsRecEtel& Receiver();
|
|
103 |
|
|
104 |
/**
|
|
105 |
* Returns the total number of detected (via topic detection feature)
|
|
106 |
* topics and then clears the counter.
|
|
107 |
*
|
|
108 |
* @return Number of detected topics.
|
|
109 |
*/
|
|
110 |
TInt TotalTopicsDetected();
|
|
111 |
|
|
112 |
/**
|
|
113 |
* Panics the client.
|
|
114 |
*
|
|
115 |
* @param Reason of panic
|
|
116 |
*/
|
|
117 |
void PanicClient( TInt aPanic ) const;
|
|
118 |
|
|
119 |
/**
|
|
120 |
* Shuts the server down.
|
|
121 |
*/
|
|
122 |
void Shutdown();
|
|
123 |
|
|
124 |
/**
|
|
125 |
* Returns the object container index reference
|
|
126 |
*
|
|
127 |
* @return Container index reference
|
|
128 |
*/
|
|
129 |
CObjectConIx& ContainerIndex();
|
|
130 |
|
|
131 |
/**
|
|
132 |
* Returns the current message
|
|
133 |
*
|
|
134 |
* @return Current IPC message
|
|
135 |
*/
|
|
136 |
const RMessage2 ServerMessage() const;
|
|
137 |
|
|
138 |
/**
|
|
139 |
* Returns an object by handle.
|
|
140 |
*
|
|
141 |
* @param aHandle Handle to the object.
|
|
142 |
* @return Pointer to the object or, if there is no
|
|
143 |
* such object, NULL.
|
|
144 |
*/
|
|
145 |
CCbsObject* ReturnObjectByHandle( TUint aHandle );
|
|
146 |
|
|
147 |
/**
|
|
148 |
* Deletes a subsession
|
|
149 |
*
|
|
150 |
* @param aHandle Handle to the object.
|
|
151 |
*/
|
|
152 |
void DeleteObjectByHandle( TUint aHandle );
|
|
153 |
|
|
154 |
/**
|
|
155 |
* Returns the object container
|
|
156 |
*
|
|
157 |
* @@return The object container
|
|
158 |
*/
|
|
159 |
CObjectCon& Container();
|
|
160 |
|
|
161 |
/**
|
|
162 |
* Returns the object index
|
|
163 |
*
|
|
164 |
* @@return The object index
|
|
165 |
*/
|
|
166 |
CObjectIx& ObjectIx();
|
|
167 |
|
|
168 |
/**
|
|
169 |
* Reloads the SIM topics in case of SAT/SIM refresh
|
|
170 |
*
|
|
171 |
*/
|
|
172 |
void ReLoadSimTopicsL();
|
|
173 |
|
|
174 |
public: // From CServer2
|
|
175 |
|
|
176 |
/**
|
|
177 |
* Creates a new session (an instance of CCbsSession).
|
|
178 |
*
|
|
179 |
* The method is meant to be called by the Symbian OS server framework and
|
|
180 |
* so it should not be used in any other case.
|
|
181 |
*
|
|
182 |
* The method leaves if the version given as parameter and the server
|
|
183 |
* version differ.
|
|
184 |
*
|
|
185 |
* @param aVersion Expected version of CBS Server.
|
|
186 |
* @return New session object.
|
|
187 |
*/
|
|
188 |
CSession2* NewSessionL( const TVersion& aVersion, const RMessage2& aMessage ) const;
|
|
189 |
|
|
190 |
private:
|
|
191 |
|
|
192 |
/**
|
|
193 |
* Constructor.
|
|
194 |
*
|
|
195 |
* @param aPriority Priority of the server.
|
|
196 |
*/
|
|
197 |
CCbsServer( TInt aPriority );
|
|
198 |
|
|
199 |
/**
|
|
200 |
* Finalizes the construction by creating subcomponents
|
|
201 |
* and synchronizing DB and receiver states.
|
|
202 |
*/
|
|
203 |
void ConstructL();
|
|
204 |
|
|
205 |
/**
|
|
206 |
* Initializes the receiver
|
|
207 |
*/
|
|
208 |
void InitReceiverL();
|
|
209 |
|
|
210 |
/**
|
|
211 |
* Initializes topic detection status.
|
|
212 |
*/
|
|
213 |
void InitTopicDetectionStatusL();
|
|
214 |
|
|
215 |
private: // Prohibited operators and functions
|
|
216 |
|
|
217 |
// Copy constructor
|
|
218 |
CCbsServer( const CCbsServer& );
|
|
219 |
|
|
220 |
// Assignment operator
|
|
221 |
CCbsServer& operator=( const CCbsServer& );
|
|
222 |
|
|
223 |
private: // Data
|
|
224 |
|
|
225 |
// Own: The container index, that is required to create
|
|
226 |
// object containers.
|
|
227 |
CObjectConIx* iContainerIx;
|
|
228 |
|
|
229 |
// Own: database object.
|
|
230 |
CCbsDbImp* iDatabase;
|
|
231 |
|
|
232 |
// Own: receiver object.
|
|
233 |
CCbsRecEtel* iReceiver;
|
|
234 |
|
|
235 |
// Own: gateway to the receiver.
|
|
236 |
CCbsReceiverHelper* iHelper;
|
|
237 |
|
|
238 |
// Own: PubSub shutdown monitor
|
|
239 |
CCbsShutdownMonitor* iShutdownMonitor;
|
|
240 |
|
|
241 |
// Own: the object container that contains the subsessions.
|
|
242 |
CObjectCon* iContainer;
|
|
243 |
|
|
244 |
// Own: object index that is used to find a subsession object
|
|
245 |
// by it's handle.
|
|
246 |
CObjectIx* iIndex;
|
|
247 |
|
|
248 |
// Sat refresh listener
|
|
249 |
CCbsSatRefresh* iSatRefresh;
|
|
250 |
};
|
|
251 |
|
|
252 |
#endif // CCBSSERVER_H
|
|
253 |
|
|
254 |
// End of File
|
|
255 |
|
|
256 |
|