sl@0
|
1 |
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#ifndef MMRCSERVERSESSION_H__
|
sl@0
|
17 |
#define MMRCSERVERSESSION_H__
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <e32std.h>
|
sl@0
|
20 |
#include <e32base.h>
|
sl@0
|
21 |
#include <a3f/a3fbase.h>
|
sl@0
|
22 |
#include <e32msgqueue.h>
|
sl@0
|
23 |
#include "mmrcclientserver.h"
|
sl@0
|
24 |
|
sl@0
|
25 |
/**
|
sl@0
|
26 |
* @file
|
sl@0
|
27 |
* @internalTechnology
|
sl@0
|
28 |
*/
|
sl@0
|
29 |
|
sl@0
|
30 |
class MMultimediaResourceControlObserver;
|
sl@0
|
31 |
class MLogicalChain;
|
sl@0
|
32 |
class CFourCCConvertor;
|
sl@0
|
33 |
class MAudioContext;
|
sl@0
|
34 |
class CMMRCServerController;
|
sl@0
|
35 |
class CMMRCServerSession;
|
sl@0
|
36 |
class CMMRCClientSideServerRequestToAdaptationAO;
|
sl@0
|
37 |
class CMMRCServerSideAdaptationResponseAO;
|
sl@0
|
38 |
class CAudioContext;
|
sl@0
|
39 |
|
sl@0
|
40 |
enum TMMRCServerSessionRequestType
|
sl@0
|
41 |
{
|
sl@0
|
42 |
ENormalRequest,
|
sl@0
|
43 |
EPreemptionRequest,
|
sl@0
|
44 |
};
|
sl@0
|
45 |
|
sl@0
|
46 |
/**
|
sl@0
|
47 |
Panic category and codes that MMRCServerSession raises on the client
|
sl@0
|
48 |
*/
|
sl@0
|
49 |
_LIT(KMMRCServerSessionPanicCategory, "MMRCServerSession");
|
sl@0
|
50 |
|
sl@0
|
51 |
enum TMMRCServerSessionPanicCodes
|
sl@0
|
52 |
{
|
sl@0
|
53 |
ECloneLeftWhenSendingResponseToClient =1,
|
sl@0
|
54 |
EMsgQueueFailedToSendMsg
|
sl@0
|
55 |
};
|
sl@0
|
56 |
|
sl@0
|
57 |
/**
|
sl@0
|
58 |
@internalComponent
|
sl@0
|
59 |
This class implements the MMRC Server Session.
|
sl@0
|
60 |
*/
|
sl@0
|
61 |
NONSHARABLE_CLASS(CMMRCServerSession) : public CSession2
|
sl@0
|
62 |
{
|
sl@0
|
63 |
//friend class CTimeoutClientAcknowledment;
|
sl@0
|
64 |
public:
|
sl@0
|
65 |
/**
|
sl@0
|
66 |
* Constructs, and returns a pointer to, a new CMMRCServerSession object.
|
sl@0
|
67 |
* Leaves on failure.
|
sl@0
|
68 |
* @param CMMRCServerController& A reference on the MMRC Server controller
|
sl@0
|
69 |
* @param CFourCCConvertor& A reference to the Fourcc to format converter
|
sl@0
|
70 |
* @return CMMRCServerSession* A pointer to newly created utlitly object.
|
sl@0
|
71 |
*/
|
sl@0
|
72 |
static CMMRCServerSession* NewL(CMMRCServerController& aMMRCServerController,
|
sl@0
|
73 |
const CFourCCConvertor& aFourCCConvertor);
|
sl@0
|
74 |
|
sl@0
|
75 |
/**
|
sl@0
|
76 |
* Constructs, leaves object on the cleanup stack, and returns a pointer
|
sl@0
|
77 |
* to, a new CMMRCServerSession object.
|
sl@0
|
78 |
* Leaves on failure.
|
sl@0
|
79 |
* @param CMMRCServerController& A reference on the MMRC Server controller
|
sl@0
|
80 |
* @param CFourCCConvertor& A reference to the Fourcc to format converter
|
sl@0
|
81 |
* @return CMMRCServerSession* A pointer to newly created utlitly object.
|
sl@0
|
82 |
*/
|
sl@0
|
83 |
static CMMRCServerSession* NewLC(CMMRCServerController& aMMRCServerController,
|
sl@0
|
84 |
const CFourCCConvertor& aFourCCConvertor);
|
sl@0
|
85 |
|
sl@0
|
86 |
/**
|
sl@0
|
87 |
* Destructor.
|
sl@0
|
88 |
*/
|
sl@0
|
89 |
~CMMRCServerSession();
|
sl@0
|
90 |
|
sl@0
|
91 |
|
sl@0
|
92 |
/**
|
sl@0
|
93 |
* from CSession2
|
sl@0
|
94 |
* @param aMessage - Function and data for the session
|
sl@0
|
95 |
*/
|
sl@0
|
96 |
void ServiceL(const RMessage2& aMessage);
|
sl@0
|
97 |
|
sl@0
|
98 |
/*
|
sl@0
|
99 |
*
|
sl@0
|
100 |
*/
|
sl@0
|
101 |
void StartProcessL();
|
sl@0
|
102 |
|
sl@0
|
103 |
/*
|
sl@0
|
104 |
*
|
sl@0
|
105 |
*/
|
sl@0
|
106 |
void StartPreemptionL();
|
sl@0
|
107 |
|
sl@0
|
108 |
/**
|
sl@0
|
109 |
* Callback on a resource request
|
sl@0
|
110 |
* @param TMMRCServerToClientMessageResults aResult the result on the request
|
sl@0
|
111 |
* @leave
|
sl@0
|
112 |
*/
|
sl@0
|
113 |
void AdaptationRequestAcknowledgment(TMMRCAdaptationToServerRequestResults aResult, TInt aError);
|
sl@0
|
114 |
|
sl@0
|
115 |
/**
|
sl@0
|
116 |
* Notify all the paused client that a resource has been unallocated
|
sl@0
|
117 |
*/
|
sl@0
|
118 |
void NotifyClientResourceUnallocated();
|
sl@0
|
119 |
|
sl@0
|
120 |
/**
|
sl@0
|
121 |
* return the current committed chain (const)
|
sl@0
|
122 |
* @return the current committed chain
|
sl@0
|
123 |
*/
|
sl@0
|
124 |
const MLogicalChain* LogicalChainRequested() const;
|
sl@0
|
125 |
|
sl@0
|
126 |
/**
|
sl@0
|
127 |
* return the current committed chain (const)
|
sl@0
|
128 |
* @return the current committed chain
|
sl@0
|
129 |
*/
|
sl@0
|
130 |
const MLogicalChain* LogicalChainRequestedStack() const;
|
sl@0
|
131 |
|
sl@0
|
132 |
/**
|
sl@0
|
133 |
* return the last committed chain (const)
|
sl@0
|
134 |
* @return the last committed chain
|
sl@0
|
135 |
*/
|
sl@0
|
136 |
const MLogicalChain* LogicalChainLastCommited() const;
|
sl@0
|
137 |
|
sl@0
|
138 |
/*
|
sl@0
|
139 |
*
|
sl@0
|
140 |
*/
|
sl@0
|
141 |
const MAudioContext* AudioContext() const;
|
sl@0
|
142 |
|
sl@0
|
143 |
/**
|
sl@0
|
144 |
* return the current committed chain
|
sl@0
|
145 |
* @return the current committed chain
|
sl@0
|
146 |
*/
|
sl@0
|
147 |
MLogicalChain* LogicalChainRequested();
|
sl@0
|
148 |
|
sl@0
|
149 |
/**
|
sl@0
|
150 |
* return the current committed chain
|
sl@0
|
151 |
* @return the current committed chain
|
sl@0
|
152 |
*/
|
sl@0
|
153 |
MLogicalChain* LogicalChainRequestedStack();
|
sl@0
|
154 |
|
sl@0
|
155 |
/**
|
sl@0
|
156 |
* return the last committed chain
|
sl@0
|
157 |
* @return the last committed chain
|
sl@0
|
158 |
*/
|
sl@0
|
159 |
MLogicalChain* LogicalChainLastCommited();
|
sl@0
|
160 |
|
sl@0
|
161 |
/**
|
sl@0
|
162 |
*
|
sl@0
|
163 |
*/
|
sl@0
|
164 |
CMMRCClientSideServerRequestToAdaptationAO* AdaptationProxy();
|
sl@0
|
165 |
|
sl@0
|
166 |
|
sl@0
|
167 |
CMMRCServerSideAdaptationResponseAO* ServerProxy();
|
sl@0
|
168 |
/**
|
sl@0
|
169 |
*
|
sl@0
|
170 |
*/
|
sl@0
|
171 |
TUint64 ContextId();
|
sl@0
|
172 |
|
sl@0
|
173 |
/**
|
sl@0
|
174 |
*
|
sl@0
|
175 |
*/
|
sl@0
|
176 |
TBool HasMultimediaCapability() const;
|
sl@0
|
177 |
|
sl@0
|
178 |
/**
|
sl@0
|
179 |
*
|
sl@0
|
180 |
*/
|
sl@0
|
181 |
void Clean();
|
sl@0
|
182 |
|
sl@0
|
183 |
/**
|
sl@0
|
184 |
*
|
sl@0
|
185 |
*/
|
sl@0
|
186 |
TBool IsServerShuttingDown();
|
sl@0
|
187 |
|
sl@0
|
188 |
TInt RequestsSent();
|
sl@0
|
189 |
|
sl@0
|
190 |
TInt SendRequestToAdaptation(TMMRCServerSessionRequestType aRequestType);
|
sl@0
|
191 |
|
sl@0
|
192 |
TInt GetPriority() const;
|
sl@0
|
193 |
|
sl@0
|
194 |
/**
|
sl@0
|
195 |
*
|
sl@0
|
196 |
*/
|
sl@0
|
197 |
TBool HasUserEnvironmentCapability();
|
sl@0
|
198 |
|
sl@0
|
199 |
/*
|
sl@0
|
200 |
*
|
sl@0
|
201 |
*/
|
sl@0
|
202 |
TInt NotifyClientOfError(TInt aError);
|
sl@0
|
203 |
|
sl@0
|
204 |
protected:
|
sl@0
|
205 |
|
sl@0
|
206 |
void IncrementRequestsSent();
|
sl@0
|
207 |
|
sl@0
|
208 |
/*
|
sl@0
|
209 |
*
|
sl@0
|
210 |
*/
|
sl@0
|
211 |
void Disconnect(const RMessage2& aMessage);
|
sl@0
|
212 |
|
sl@0
|
213 |
private:
|
sl@0
|
214 |
|
sl@0
|
215 |
//Constructor
|
sl@0
|
216 |
/**
|
sl@0
|
217 |
* By default Symbian 2nd phase constructor is private.
|
sl@0
|
218 |
* @param CMMRCServerController& A reference on the MMRC Server controller
|
sl@0
|
219 |
* @param CFourCCConvertor& A reference to the Fourcc to format converter
|
sl@0
|
220 |
*/
|
sl@0
|
221 |
CMMRCServerSession(CMMRCServerController& aMMRCServerController,
|
sl@0
|
222 |
const CFourCCConvertor& aFourCCConvertor);
|
sl@0
|
223 |
|
sl@0
|
224 |
/**
|
sl@0
|
225 |
* By default Symbian 2nd phase constructor is private.
|
sl@0
|
226 |
*/
|
sl@0
|
227 |
void ConstructL();
|
sl@0
|
228 |
|
sl@0
|
229 |
/**
|
sl@0
|
230 |
* Dispatch the message received from ServeL
|
sl@0
|
231 |
* EMMRCClientToServerSetMsgQueueHandle - Initialise the queue handler
|
sl@0
|
232 |
* EMMRCClientToServerMessage - Process a message from the client
|
sl@0
|
233 |
* EMMRCClientToServerMessageUpdate - Process a message update from the client
|
sl@0
|
234 |
* EMMRCClientToServerMessageAcknowledgement - Process the acknowldgement from the client
|
sl@0
|
235 |
* @param aMessage - Function and data for the session
|
sl@0
|
236 |
* @return error code
|
sl@0
|
237 |
* @leave in case of writeL leave or request leave
|
sl@0
|
238 |
*/
|
sl@0
|
239 |
TInt DispatchMessageL(const RMessage2& aMessage);
|
sl@0
|
240 |
|
sl@0
|
241 |
/*
|
sl@0
|
242 |
*
|
sl@0
|
243 |
*/
|
sl@0
|
244 |
TInt EnqueueRequestL(const RMessage2& aMessage);
|
sl@0
|
245 |
|
sl@0
|
246 |
/*
|
sl@0
|
247 |
*
|
sl@0
|
248 |
*/
|
sl@0
|
249 |
void PreProcessRequestL(const RMessage2& aMessage);
|
sl@0
|
250 |
|
sl@0
|
251 |
|
sl@0
|
252 |
/*
|
sl@0
|
253 |
*
|
sl@0
|
254 |
*/
|
sl@0
|
255 |
void ProcessResourceDataRequestL(const RMessage2& aMessage);
|
sl@0
|
256 |
|
sl@0
|
257 |
/*
|
sl@0
|
258 |
*
|
sl@0
|
259 |
*/
|
sl@0
|
260 |
void SendRequestResponseToClient(TMMRCQueueItem& messageItem);
|
sl@0
|
261 |
|
sl@0
|
262 |
/*
|
sl@0
|
263 |
*
|
sl@0
|
264 |
*/
|
sl@0
|
265 |
void SendPreemptionNotificationToClient(TMMRCQueueItem& messageItem);
|
sl@0
|
266 |
|
sl@0
|
267 |
|
sl@0
|
268 |
/*
|
sl@0
|
269 |
*
|
sl@0
|
270 |
*/
|
sl@0
|
271 |
void Panic(TMMRCServerSessionPanicCodes aCode);
|
sl@0
|
272 |
|
sl@0
|
273 |
private:
|
sl@0
|
274 |
RMsgQueue<TMMRCQueueItem> iMsgQueue; //
|
sl@0
|
275 |
CMMRCServerController& iMMRCServerController; // a reference on the MMRC Server controller
|
sl@0
|
276 |
//RThread iClientThread;
|
sl@0
|
277 |
RThread iServerThread;
|
sl@0
|
278 |
RThread iClientThread;
|
sl@0
|
279 |
TBool iShutdown;
|
sl@0
|
280 |
//owned
|
sl@0
|
281 |
CMMRCServerSideAdaptationResponseAO* iMMRCServerSideAdaptationResponseAO;
|
sl@0
|
282 |
MLogicalChain* iLogicalChainRequestedStack; // the new committed chain
|
sl@0
|
283 |
MLogicalChain* iLogicalChainLastCommitedStack; // the last committed
|
sl@0
|
284 |
MLogicalChain* iLogicalChainRequested; // the new committed chain
|
sl@0
|
285 |
MLogicalChain* iLogicalChainLastCommited; // the last committed
|
sl@0
|
286 |
MLogicalChain* iLogicalChainRequestResponse; // A copy of the chain for client response
|
sl@0
|
287 |
MLogicalChain* iLogicalChainPreemptionNotification; // A copy of the chain for preemption notification to the client
|
sl@0
|
288 |
|
sl@0
|
289 |
//not owned (can be null pointers)
|
sl@0
|
290 |
CAudioContext* iAudioContext;
|
sl@0
|
291 |
const CFourCCConvertor* iFourCCConvertor;
|
sl@0
|
292 |
CMMRCClientSideServerRequestToAdaptationAO* iMMRCClientSideServerRequestToAdaptationAO;
|
sl@0
|
293 |
|
sl@0
|
294 |
//not own
|
sl@0
|
295 |
TInt32 iContextId;
|
sl@0
|
296 |
TInt32 iRequestsSent;
|
sl@0
|
297 |
TBool iClientHasMMCapability;
|
sl@0
|
298 |
TBool iClientHasUECapability;
|
sl@0
|
299 |
};
|
sl@0
|
300 |
|
sl@0
|
301 |
#endif //__MMRCSERVERSESSION_H__
|