|
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 |
|
20 |
|
21 #ifndef CMCECSESSIONIMPLEMENTATION_H |
|
22 #define CMCECSESSIONIMPLEMENTATION_H |
|
23 |
|
24 #include <badesca.h> |
|
25 |
|
26 #include "mcesrv.h" |
|
27 #include "mceclientserver.h" |
|
28 #include "mcecomaudiocodec.h" |
|
29 #include "mcecomvideocodec.h" |
|
30 |
|
31 // FORWARD DECLARATION |
|
32 class CMceCsSession; |
|
33 class CMceSipManager; |
|
34 class TMceIds; |
|
35 class CMceCsSubSession; |
|
36 class CMceSipDefaults; |
|
37 class TMceFileInfo; |
|
38 class TMceMccComEvent; |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 |
|
43 /** |
|
44 * MCE CS session implementation |
|
45 * |
|
46 * @lib |
|
47 * @since |
|
48 */ |
|
49 class CMceCsSessionImplementation : public CBase |
|
50 { |
|
51 public: // Constructors and destructor |
|
52 |
|
53 /** |
|
54 * Two-phased constructor. |
|
55 * @param aManager SIP manager |
|
56 * @param aITCProvider provides ITC functionality. Ownership is NOT transferred |
|
57 * @return CS session implementation |
|
58 */ |
|
59 static CMceCsSessionImplementation* NewL( CMceSipManager& aManager, |
|
60 CMceCsSession* aITCProvider ); |
|
61 |
|
62 /** |
|
63 * Two-phased constructor. |
|
64 * @param aManager SIP manager |
|
65 * @param aITCProvider provides ITC functionality. Ownership is NOT transferred |
|
66 * @return CS session implementation |
|
67 */ |
|
68 static CMceCsSessionImplementation* NewLC( CMceSipManager& aManager, |
|
69 CMceCsSession* aITCProvider ); |
|
70 |
|
71 /** |
|
72 * Destructor. |
|
73 */ |
|
74 ~CMceCsSessionImplementation(); |
|
75 |
|
76 |
|
77 public: // New |
|
78 |
|
79 |
|
80 /** |
|
81 * Creates sub session |
|
82 * @param aIds set of ids defining ITC call context |
|
83 * @param aParams parameters for creation |
|
84 */ |
|
85 void CreateSubSessionL( TMceIds& aIds, |
|
86 CDesC8Array& aParams); |
|
87 |
|
88 /** |
|
89 * Removes sub session |
|
90 * @param aSessionId aSessionID |
|
91 */ |
|
92 void RemoveSubSessionL( TUint32 aSessionId ); |
|
93 |
|
94 /** |
|
95 * Gets all sub sessions |
|
96 * @return all sub sessions |
|
97 */ |
|
98 RPointerArray<CMceCsSubSession>& SubSessions(); |
|
99 |
|
100 /** |
|
101 * Finds sub session based on session id |
|
102 * @param aSessionId session id |
|
103 * @return sub session |
|
104 */ |
|
105 CMceCsSubSession* SubSessionL( TUint32 aSessionId ); |
|
106 |
|
107 /** |
|
108 * Finds sub session based on dialog id |
|
109 * @param aDialogId dialog id |
|
110 * @return sub session |
|
111 */ |
|
112 const CMceCsSubSession* FindSubSession( TUint32 aDialogId ); |
|
113 |
|
114 /** |
|
115 * Returns supported audio codecs |
|
116 * @return supported audio codecs as encoded string |
|
117 */ |
|
118 HBufC8* SupportedAudioCodecsL(); |
|
119 |
|
120 /** |
|
121 * Returns supported video codecs |
|
122 * @return supported video codecs as encoded string |
|
123 */ |
|
124 HBufC8* SupportedVideoCodecsL(); |
|
125 |
|
126 /** |
|
127 * Stores default headers for given methods. |
|
128 * @param aMethod the methods |
|
129 * @param aHeaders the default headers |
|
130 */ |
|
131 void StoreDefaultHeadersL( CDesC8Array& aMethods, CDesC8Array* aHeaders ); |
|
132 |
|
133 /** |
|
134 * Returns the default headers for the given method |
|
135 * @param aMethodInd the method index in SIP Strings |
|
136 * @return default headers |
|
137 */ |
|
138 CDesC8Array& DefaultHeaders( TInt aMethodInd ); |
|
139 |
|
140 /** |
|
141 * Returns the encoded default headers for the given method |
|
142 * @param aMethod the method |
|
143 * @return encoded default headers |
|
144 */ |
|
145 HBufC8* DefaultHeadersL( TDesC8& aMethod ); |
|
146 |
|
147 void DoServiceL( TMceIds& aIds, TInt aFunction, TPtr8& aInfo ); |
|
148 |
|
149 void DoServiceL( TMceIds& aIds, TInt aFunction, const TDesC8& aInfo ); |
|
150 |
|
151 HBufC8* DoServiceL( TMceIds& aIds, TInt aFunction ); |
|
152 |
|
153 void DoServiceL( TMceIds& aIds, TInt aFunction, CMceMsgBase& aMessage ); |
|
154 |
|
155 void StoreClientContent( HBufC8* aClientContent ); |
|
156 |
|
157 /** |
|
158 * Callback function to indicate that event has been received |
|
159 * @param aEvent, received event |
|
160 */ |
|
161 void EventReceived( TMceMccComEvent& aEvent ); |
|
162 |
|
163 |
|
164 public: |
|
165 |
|
166 |
|
167 /** |
|
168 * Sends data via callback mechanism to client |
|
169 * @param aIds set of ids defining ITC callback context |
|
170 * @param aContext encoded context of message |
|
171 * @param aContent content of message |
|
172 */ |
|
173 void SendToClientL( TMceIds& aIds, HBufC8* aContext, HBufC8* aContent ); |
|
174 |
|
175 /** |
|
176 * Removes all subsession |
|
177 * @param aMakeOrphan if ETrue, makes subsession orphan, |
|
178 * if session do not terminate |
|
179 */ |
|
180 void RemoveAllSubSessions( TBool aMakeOrphan = ETrue ); |
|
181 |
|
182 /** |
|
183 * Returns ETrue, if session implementation is orphan |
|
184 * @return ETrue, if orphan |
|
185 */ |
|
186 TBool IsOrphan(); |
|
187 |
|
188 /** |
|
189 * Returns reference to CS session |
|
190 * @return CS session |
|
191 */ |
|
192 CMceCsSession& ClientSession(); |
|
193 |
|
194 |
|
195 |
|
196 protected: |
|
197 |
|
198 |
|
199 CMceCsSessionImplementation ( CMceSipManager& aManager, CMceCsSession& aITCProvider ); |
|
200 void ConstructL (); |
|
201 static void ArrayCleanup(TAny* aArray); |
|
202 |
|
203 void GetFileInfoL( TMceIds& aIds, TMceFileInfo& aFileInfo ); |
|
204 |
|
205 |
|
206 private: // Owned data |
|
207 |
|
208 //sub sessions |
|
209 RPointerArray<CMceCsSubSession> iSubSessions; |
|
210 //default headers |
|
211 CMceSipDefaults* iDefaults; |
|
212 |
|
213 |
|
214 private: // NOT owned Data |
|
215 |
|
216 //SIP manager instance |
|
217 CMceSipManager& iManager; |
|
218 //ITC provider |
|
219 CMceCsSession* iITCProvider; |
|
220 |
|
221 //definitions for unit testing |
|
222 MCESRV_UT_DEFINITIONS |
|
223 |
|
224 }; |
|
225 |
|
226 |
|
227 #endif |
|
228 |
|
229 // End of File |