33
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2009 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: The Sat Server session manages a connection to a client and
|
|
15 |
* handles client requests.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
#ifndef CSATSSESSION_H
|
|
20 |
#define CSATSSESSION_H
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <e32svr.h>
|
|
24 |
|
|
25 |
// FORWARD DECLARATIONS
|
|
26 |
class TSatEventMediator;
|
|
27 |
class CSatSServer;
|
|
28 |
class CSatSSubSession;
|
|
29 |
class MSatUiSession;
|
|
30 |
class CSatSServer;
|
|
31 |
class MSatApi;
|
|
32 |
class MThreadDeathNotifier;
|
|
33 |
class CSatIconHandler;
|
|
34 |
class MSatSIconAPI;
|
|
35 |
// CLASS DECLARATION
|
|
36 |
|
|
37 |
/**
|
|
38 |
* CSatSSession represents the server-side session object.
|
|
39 |
*
|
|
40 |
* @lib SatEngine.lib
|
|
41 |
* @since Series 60 3.0
|
|
42 |
*/
|
|
43 |
class CSatSSession : public CSession2
|
|
44 |
{
|
|
45 |
public: // Constructors and destructor
|
|
46 |
|
|
47 |
/**
|
|
48 |
* Two-phased constructor.
|
|
49 |
* @param aServer SatServer class
|
|
50 |
* @param aEventMediator Event mediator class
|
|
51 |
* @param aUsatApi An USat API interface
|
|
52 |
* @param aThreadDeathNotifier ThreadDeath notifier interface
|
|
53 |
*/
|
|
54 |
static CSatSSession* NewL( CSatSServer* aServer,
|
|
55 |
TSatEventMediator& aEventMediator,
|
|
56 |
MSatApi& aUsatApi,
|
|
57 |
MThreadDeathNotifier& aThreadDeathNotifier );
|
|
58 |
|
|
59 |
/**
|
|
60 |
* Destructor.
|
|
61 |
*/
|
|
62 |
virtual ~CSatSSession();
|
|
63 |
|
|
64 |
public: // Functions from base classes
|
|
65 |
|
|
66 |
/**
|
|
67 |
* From CSession2 Handles an incoming message.
|
|
68 |
* @param aMessage Handle to the client message.
|
|
69 |
*/
|
|
70 |
void ServiceL( const RMessage2 &aMessage );
|
|
71 |
|
|
72 |
public: // New functions
|
|
73 |
|
|
74 |
/**
|
|
75 |
* Gives pointer of ui sub session interface. May be null.
|
|
76 |
* @return Pointer of ui subsession interface.
|
|
77 |
*/
|
|
78 |
MSatUiSession* UiSubSession();
|
|
79 |
|
|
80 |
/**
|
|
81 |
* Closes icon sub-session.
|
|
82 |
* @param aMessage Handle to the client message.
|
|
83 |
* @return TRUE if subsession exists. Otherwise return FALSE.
|
|
84 |
*/
|
|
85 |
TBool CloseSubSession( const RMessage2& aMessage );
|
|
86 |
|
|
87 |
/**
|
|
88 |
* Gets the sub-session using handle.
|
|
89 |
* @param aHandle Sub-session handle.
|
|
90 |
* @return Sub-session. NULL if not found.
|
|
91 |
*/
|
|
92 |
CSatSSubSession* GetSubSessionFromHandle( TInt aHandle ) const;
|
|
93 |
|
|
94 |
/**
|
|
95 |
* Panic the client.
|
|
96 |
* @param aMessage The panic message
|
|
97 |
* @param aPanic The panic code.
|
|
98 |
*/
|
|
99 |
void PanicClient( const RMessage2& aMessage, TInt aPanic ) const;
|
|
100 |
|
|
101 |
/**
|
|
102 |
* Notifies Thread death monitor for thread is dying
|
|
103 |
*/
|
|
104 |
void NotifyThreadDeathMonitor();
|
|
105 |
|
|
106 |
/**
|
|
107 |
* Gets pointer to SatServer
|
|
108 |
* @param Pointer to SatServer
|
|
109 |
*/
|
|
110 |
CSatSServer* SatServer();
|
|
111 |
|
|
112 |
/**
|
|
113 |
* Tells that UI Sub session is closed.
|
|
114 |
*/
|
|
115 |
void UiSessionClosed();
|
|
116 |
|
|
117 |
/**
|
|
118 |
* Creates icon handler and returns it to icon sub session
|
|
119 |
* return Pointer to created icon handler
|
|
120 |
*/
|
|
121 |
MSatSIconAPI* CreateIconHandlerL();
|
|
122 |
|
|
123 |
private: // New functions
|
|
124 |
|
|
125 |
/**
|
|
126 |
* Adds sub session to container. Sub session is deleted
|
|
127 |
* if leave occurs.
|
|
128 |
* @param aSubSession A Session that is needed to be added
|
|
129 |
* @param aMessage An instance of RMessage2
|
|
130 |
*/
|
|
131 |
void AddSubSessionL( CSatSSubSession* aSubSession,
|
|
132 |
const RMessage2& aMessage );
|
|
133 |
|
|
134 |
private: // Constructors
|
|
135 |
|
|
136 |
/**
|
|
137 |
* ConstrucL
|
|
138 |
*/
|
|
139 |
void ConstructL();
|
|
140 |
|
|
141 |
/**
|
|
142 |
* C++ default constructor.
|
|
143 |
* @param aServer SatServer class
|
|
144 |
* @param aEventMediator Event mediator class
|
|
145 |
* @param aUsatApi An USat API interface
|
|
146 |
* @param aThreadDeathNotifier ThreadDeath notifier interface
|
|
147 |
*/
|
|
148 |
CSatSSession( CSatSServer* aServer,
|
|
149 |
TSatEventMediator& aEventMediator,
|
|
150 |
MSatApi& aSatApi,
|
|
151 |
MThreadDeathNotifier& aThreadDeathNotifier );
|
|
152 |
|
|
153 |
private: // Data
|
|
154 |
|
|
155 |
// A reference to the server.
|
|
156 |
CSatSServer* iSatServer;
|
|
157 |
|
|
158 |
// Event mediator reference
|
|
159 |
TSatEventMediator& iEventMediator;
|
|
160 |
|
|
161 |
// Sat api
|
|
162 |
MSatApi& iSatApi;
|
|
163 |
|
|
164 |
// Generates a unique handle for subsession.
|
|
165 |
CObjectIx* iSubSessionIx;
|
|
166 |
|
|
167 |
// Container for sub-sessions.
|
|
168 |
CObjectCon* iSubSessionCon;
|
|
169 |
|
|
170 |
// Interface for ui sub session
|
|
171 |
MSatUiSession* iUiSubSession;
|
|
172 |
|
|
173 |
// Thread death monitor notifier
|
|
174 |
MThreadDeathNotifier& iThreadDeathNotifier;
|
|
175 |
|
|
176 |
// Indicates is SatUiSubSession closed
|
|
177 |
TBool iSatUiSubSessionClosed;
|
|
178 |
|
|
179 |
};
|
|
180 |
|
|
181 |
#endif // CSATSSESSION_H
|
|
182 |
|
|
183 |
// End of File
|