|
1 /* |
|
2 * Copyright (c) 2005 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MUSHENGMCESESSION_H |
|
20 #define MUSHENGMCESESSION_H |
|
21 |
|
22 // USER |
|
23 #include "musengsession.h" |
|
24 #include "musengsessiondurationtimerobserver.h" |
|
25 |
|
26 // SYSTEM |
|
27 /* |
|
28 #include <mcesessionobserver.h> |
|
29 #include <mcestreamobserver.h> |
|
30 #include <mcertpobserver.h> |
|
31 #include <mcetransactiondatacontainer.h> |
|
32 */ |
|
33 |
|
34 /* |
|
35 class CMceManager; |
|
36 class CMceSession; |
|
37 */ |
|
38 class CMusEngSessionDurationTimer; |
|
39 |
|
40 |
|
41 // CONSTANTS |
|
42 |
|
43 _LIT8( KMusEngAcceptContactHeader, |
|
44 "Accept-Contact: *;+g.3gpp.cs-voice; explicit" ); |
|
45 _LIT8( KMusEngSessionSdpLineXApplication, "a=X-application:com.nokia.rtvs" ); |
|
46 |
|
47 // CLASS DECLARATION |
|
48 |
|
49 /** |
|
50 * Base class for Multimedia Sharing Engine MCE sessions, inherited by |
|
51 * CMusEngLiveSession CMusEngClipSession and CMusEngReceiveSession. |
|
52 * |
|
53 * CMusEngMceSession encapsulates CMCESession and simplifies use of |
|
54 * MCE Sessions to user interface. Also splits observers messy events |
|
55 * simplified commands like a SessionDisconnected. |
|
56 * |
|
57 * @lib musengine.lib |
|
58 * @since S60 v3.2 |
|
59 */ |
|
60 class CMusEngMceSession : public CMusEngSession, |
|
61 public MMusEngSessionDurationTimerObserver |
|
62 { |
|
63 |
|
64 public: |
|
65 |
|
66 /** |
|
67 * Destructor |
|
68 * |
|
69 * @since S60 v3.2 |
|
70 */ |
|
71 ~CMusEngMceSession(); |
|
72 |
|
73 |
|
74 public: // API FUNCTIONS |
|
75 |
|
76 /** |
|
77 * Terminates session. |
|
78 * @pre Session is established |
|
79 * @post Session is ready to be deleted |
|
80 * @leave KErrNotReady if precondition is not fullfilled |
|
81 * @since S60 v3.2 |
|
82 */ |
|
83 IMPORT_C void TerminateL(); |
|
84 |
|
85 /** |
|
86 * Releases all this session internal observers. This function is needed |
|
87 * before we could get session store out of this session. |
|
88 * TODO: Is this function really needed? At least at the moment it is |
|
89 * not called from UI. -HR 21.8. |
|
90 * |
|
91 * @since S60 v3.2 |
|
92 */ |
|
93 IMPORT_C void ReleaseInternalObservers(); |
|
94 |
|
95 /** |
|
96 * Get session time return estabilished session time |
|
97 * |
|
98 * @since S60 v3.2 |
|
99 * @return TTime returns time if connection established else < 0 |
|
100 */ |
|
101 IMPORT_C TTimeIntervalSeconds GetSessionTime() const; |
|
102 |
|
103 /** |
|
104 * Returns current connection state |
|
105 * |
|
106 * @since S60 v3.2 |
|
107 * @return TBool returns current connection state |
|
108 */ |
|
109 IMPORT_C TBool ConnectionActive() const; |
|
110 |
|
111 |
|
112 public: // VIRTUAL API |
|
113 |
|
114 // No virtual api |
|
115 |
|
116 |
|
117 public: // from CMusEngSession |
|
118 |
|
119 /** |
|
120 * Increases volume level by one |
|
121 * |
|
122 * @pre Session is ongoing |
|
123 * @since S60 v3.2 |
|
124 */ |
|
125 IMPORT_C void VolumeUpL(); |
|
126 |
|
127 /** |
|
128 * Decreases volume level by one |
|
129 * |
|
130 * @pre Session is ongoing |
|
131 * @since S60 v3.2 |
|
132 */ |
|
133 IMPORT_C void VolumeDownL(); |
|
134 |
|
135 /** |
|
136 * Permission to draw on screen device. |
|
137 * |
|
138 * @pre Session is ongoing |
|
139 * @since S60 v3.2 |
|
140 */ |
|
141 IMPORT_C void EnableDisplayL( TBool aEnable ); |
|
142 |
|
143 /** |
|
144 * Implements virtual from CMusEngSession |
|
145 * |
|
146 * @pre Session is ongoing |
|
147 * @since S60 v3.2 |
|
148 */ |
|
149 IMPORT_C void MuteL(); |
|
150 |
|
151 /** |
|
152 * Implements virtual from CMusEngSession |
|
153 * |
|
154 * @pre Session is ongoing |
|
155 * @since S60 v3.2 |
|
156 */ |
|
157 IMPORT_C void UnmuteL(); |
|
158 |
|
159 |
|
160 protected: // CONSTRUCTORS |
|
161 |
|
162 /** |
|
163 * Constructor |
|
164 * |
|
165 * @since S60 v3.2 |
|
166 */ |
|
167 CMusEngMceSession( const TRect& aRect ); |
|
168 |
|
169 /** |
|
170 * Second-phase constructor |
|
171 * |
|
172 * @since S60 v3.2 |
|
173 */ |
|
174 void ConstructL(); |
|
175 |
|
176 |
|
177 protected: // HELPER FUNCTIONS |
|
178 |
|
179 /** |
|
180 * |
|
181 * @since S60 v3.2 |
|
182 */ |
|
183 void RectChangedL(); |
|
184 |
|
185 /** |
|
186 * Sets session specific SDP line to a session |
|
187 * |
|
188 * @since S60 v3.2 |
|
189 */ |
|
190 //void SetSessionSdpLinesL( CMceSession& aSession ); |
|
191 |
|
192 |
|
193 protected: // internal API |
|
194 |
|
195 /** |
|
196 * |
|
197 * @since S60 v3.2 |
|
198 */ |
|
199 virtual TBool IsRtpcInactivityTimoutSupported(); |
|
200 |
|
201 |
|
202 private: // HELPER FUNCTIONS |
|
203 |
|
204 /** |
|
205 * Start counting session time |
|
206 * |
|
207 * @since S60 v3.2 |
|
208 */ |
|
209 void InitializeSessionTimer(); |
|
210 |
|
211 /** |
|
212 * Callback |
|
213 * |
|
214 * @since S60 v3.2 |
|
215 */ |
|
216 void UpdateTimerEvent(); |
|
217 |
|
218 /** |
|
219 * |
|
220 * |
|
221 * @since S60 v3.2 |
|
222 */ |
|
223 void DoMuteL( TBool aMute ); |
|
224 |
|
225 /** |
|
226 * Increases or decreases current volume of all speakers in session |
|
227 * structure by one. |
|
228 * @pre Current volume of all the speakers is less than MaxVolumeL() |
|
229 * and at least 1. |
|
230 */ |
|
231 void ChangeVolumeByOneL( TBool aIncreaseVolume ); |
|
232 |
|
233 |
|
234 private: // Helpers |
|
235 |
|
236 /** |
|
237 * Helper function to avoid three different traps. |
|
238 * Should be replaced when MCE supports different kind of method |
|
239 * detecting end of clip. |
|
240 * |
|
241 * @since S60 v3.2 |
|
242 */ |
|
243 void CheckClipEndL(); |
|
244 |
|
245 |
|
246 public: // MEMBERS |
|
247 |
|
248 /** |
|
249 * Class for connecting to MCE server. |
|
250 * This class provides the connection to the MCE server and |
|
251 * provides functions |
|
252 * for setting observers for asynchronous events. |
|
253 * The user should create only one instance of this class. |
|
254 * |
|
255 * @since S60 v3.2 |
|
256 */ |
|
257 //CMceManager* iManager; |
|
258 |
|
259 /** |
|
260 * Base class for MCE sessions, inherited by both CMCEInSession and |
|
261 * CMCEOutSession. * CMCESession represents peer-to-peer connection |
|
262 * made with remote terminal. This connection is also known as dialog |
|
263 * and it is set up using SIP INVITE method. The characteristics of the |
|
264 * session are defined by user of this class by attaching media streams |
|
265 * into the session. After the session has been succesfully established, |
|
266 * it can be later updated and must be finally terminated. If for any |
|
267 * reason instance of this class is deleted while in established state, |
|
268 * session is automatically terminated by MCE server. |
|
269 * |
|
270 * @since S60 v3.2 |
|
271 */ |
|
272 //CMceSession* iSession; |
|
273 |
|
274 |
|
275 public: |
|
276 |
|
277 /** |
|
278 * It is assumed, that user has only one instance of this class. |
|
279 * The same instance is passed between MCE and user, but the data |
|
280 * inside of this container is just updated for each event. |
|
281 * |
|
282 * @since S60 v3.2 |
|
283 */ |
|
284 //TMceTransactionDataContainer iTransactionDataContainer; |
|
285 |
|
286 /** |
|
287 * Session time. Acts simultaneously as RTCP inactivity timer. |
|
288 * |
|
289 * @since S60 v3.2 |
|
290 */ |
|
291 TTime iStartTime; |
|
292 |
|
293 CMusEngSessionDurationTimer* iUpdateTimer; |
|
294 |
|
295 /** |
|
296 * Value indicating seconds gone since last received RTCP sender or |
|
297 * receiver report. Value 20 indicates RTCP inactivity timeout. |
|
298 */ |
|
299 TInt iSecondsFromLastRtcpReport; |
|
300 TInt iDisplayEnabled; |
|
301 |
|
302 }; |
|
303 #endif //MUSHENGMCESESSION_H |