author | vnuitven <> |
Mon, 06 Sep 2010 18:50:40 +0530 | |
branch | rcs |
changeset 50 | 1d8943dd8be6 |
parent 49 | 64c62431ac08 |
permissions | -rw-r--r-- |
49 | 1 |
/* |
50
1d8943dd8be6
changed copy right year to 2010 for all newly added files
vnuitven <>
parents:
49
diff
changeset
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
49 | 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 |
#ifndef CMCEMESSAGESTREAM_H |
|
21 |
#define CMCEMESSAGESTREAM_H |
|
22 |
||
23 |
// INCLUDES |
|
24 |
#include <e32std.h> |
|
25 |
#include <mcemediastream.h> |
|
26 |
||
27 |
// CONSTANTS |
|
28 |
const TMceMediaType KMceMessage = 3; |
|
29 |
||
30 |
// FORWARD DECLARATIONS |
|
31 |
class CMceMessageCodec; |
|
32 |
||
33 |
// CLASS DECLARATION |
|
34 |
||
35 |
/** |
|
36 |
* Class for representing a message stream. |
|
37 |
* |
|
38 |
* It defines the used messgae codecs for the stream. |
|
39 |
* In order to be complete structure, at least one codec is required. |
|
40 |
* |
|
41 |
* @lib mceclient.lib |
|
42 |
*/ |
|
43 |
class CMceMessageStream: public CMceMediaStream |
|
44 |
{ |
|
45 |
||
46 |
public: |
|
47 |
enum TConnSetup |
|
48 |
{ |
|
49 |
EActive=0, |
|
50 |
EActpass, |
|
51 |
EPassive |
|
52 |
}; |
|
53 |
enum TMsrpConnectionUsage |
|
54 |
{ |
|
55 |
ENew = 0, |
|
56 |
EExisting |
|
57 |
}; |
|
58 |
||
59 |
public: // Constructors and destructor |
|
60 |
||
61 |
/** |
|
62 |
* Two-phased constructor. |
|
63 |
*/ |
|
64 |
IMPORT_C static CMceMessageStream* NewL(); |
|
65 |
||
66 |
/** |
|
67 |
* Two-phased constructor. |
|
68 |
*/ |
|
69 |
IMPORT_C static CMceMessageStream* NewLC(); |
|
70 |
||
71 |
/** |
|
72 |
* Destructor. |
|
73 |
*/ |
|
74 |
IMPORT_C ~CMceMessageStream(); |
|
75 |
||
76 |
public: // Functions |
|
77 |
||
78 |
/** |
|
79 |
* The MCE extracts the host addr and the port for both local and remote ends |
|
80 |
* from the MSRP path attribute if passed parameter is set to TRUE |
|
81 |
* otherwise it uses SDP c and m lines. |
|
82 |
* @param usePathAttr MCE sets the host addr and port depende upon the valus of this bool parameter |
|
83 |
* The default value is ETrue |
|
84 |
*/ |
|
85 |
IMPORT_C void DoExtractHostAddrAndPortFromMsrpPathAttr(TBool usePathAttr = ETrue); |
|
86 |
||
87 |
||
88 |
||
89 |
/** |
|
90 |
* Returns the available codecs to the session. |
|
91 |
* For CMEOutSession, array contains all codecs supported by |
|
92 |
* terminal in default. For CMEInSession, array contains codecs |
|
93 |
* that were offered by remote terminal, and supported by local terminal. |
|
94 |
* Codecs are in preference order in the array. |
|
95 |
* Codec in the first element of the array has highest preference. |
|
96 |
* @return codecs available for the session. |
|
97 |
*/ |
|
98 |
IMPORT_C const RPointerArray<CMceMessageCodec>& Codecs(); |
|
99 |
/** |
|
100 |
* Adds codec to the stream. |
|
101 |
* @param aCodec codec added to the stream; ownership is transferred |
|
102 |
*/ |
|
103 |
IMPORT_C void AddCodecL( CMceMessageCodec* aCodec ); |
|
104 |
/** |
|
105 |
* Removes codec from the stream |
|
106 |
* @param aCodec codec removed from stream |
|
107 |
*/ |
|
108 |
IMPORT_C void RemoveCodecL( CMceMessageCodec& aCodec ); |
|
109 |
||
110 |
/** |
|
111 |
* Replaces codecs of the stream. Codecs should be in preference order in |
|
112 |
* the passed array. |
|
113 |
* @param aCodecs array of codecs which will replace existing codecs; |
|
114 |
* ownership is transferred |
|
115 |
*/ |
|
116 |
IMPORT_C void ReplaceCodecsL( RPointerArray<CMceMessageCodec>* aCodecs ); |
|
117 |
||
118 |
/* Returns true if Msrp Path attribute is used for either setting or getting |
|
119 |
* the host address and port number for both local and remote end points |
|
120 |
* @return Either ETRUE or EFALSE |
|
121 |
*/ |
|
122 |
IMPORT_C TBool IsMsrpPathAttrPreferredForHostAddrAndPort(); |
|
123 |
||
124 |
/* |
|
125 |
* Used to set up the connection negostiaiton .The value of this decides who initiates the |
|
126 |
* Msrp TCP connection establishment. |
|
127 |
* refer http://tools.ietf.org/html/draft-ietf-simple-msrp-acm-02 on how to set this API. |
|
128 |
* @param TConnSetup. |
|
129 |
*/ |
|
130 |
IMPORT_C void ConnectionSetUpL(TConnSetup aSetup); |
|
131 |
||
132 |
/* |
|
133 |
* Returns the conneciton setup value. |
|
134 |
* @return TConnSetup. Retunrs the value configured using the API ConnectionSetUp |
|
135 |
*/ |
|
136 |
IMPORT_C TConnSetup GetConnectionSetup(); |
|
137 |
||
138 |
||
139 |
public: // serialization |
|
140 |
||
141 |
||
142 |
/** |
|
143 |
* Re-establishment of the MSRP TCP based connection as per RFC 4145 |
|
144 |
* It creates the SDP media level line (a=connection) |
|
145 |
* @param aReUse The default value for this is 'EFalse' |
|
146 |
*/ |
|
147 |
//IMPORT_C void ReuseMsrpConnectionL(TMsrpConnectionUsage aUsage = CMceMessageStream::ENew); |
|
148 |
IMPORT_C void ReuseMsrpConnectionL(TBool aReUse = EFalse); |
|
149 |
||
150 |
||
151 |
||
152 |
/** |
|
153 |
* Internalizes |
|
154 |
* @param aReadStream read stream |
|
155 |
* @param aTarget to which read to |
|
156 |
*/ |
|
157 |
void InternalizeL( MMceComSerializationContext& aSerCtx ); |
|
158 |
||
159 |
/** |
|
160 |
* Externalizes |
|
161 |
* @param aWriteStream write stream |
|
162 |
*/ |
|
163 |
void ExternalizeL( MMceComSerializationContext& aSerCtx ); |
|
164 |
||
165 |
||
166 |
public: //from CMceMediaStream |
|
167 |
||
168 |
/** |
|
169 |
* Initializes |
|
170 |
* @param aParent the parent |
|
171 |
*/ |
|
172 |
void InitializeL( CMceSession& aParent ); |
|
173 |
||
174 |
/** |
|
175 |
* Initializes |
|
176 |
* @param aManager the manager. Ownership is NOT transferred |
|
177 |
* @param aSession the Session. |
|
178 |
*/ |
|
179 |
void InitializeL( CMceManager* aManager, CMceSession& aSession ); |
|
180 |
||
181 |
/** |
|
182 |
* Traversal event handler |
|
183 |
* @param aEvent the event |
|
184 |
* @return status, if event was consumed or not or object needs update |
|
185 |
*/ |
|
186 |
TInt EventReceivedL( TMceEvent& aEvent ); |
|
187 |
||
188 |
/** |
|
189 |
* Called file source wants to synchronized with stream |
|
190 |
* @param aFile the file source |
|
191 |
*/ |
|
192 |
void SynchronizeWithFileL( CMceFileSource& aFile ); |
|
193 |
||
194 |
/** |
|
195 |
* Searches for codec matching with input codec instance or sdp name |
|
196 |
* @param aCodec the search term |
|
197 |
* @return matching codec or NULL if not found |
|
198 |
*/ |
|
199 |
CMceCodec* FindCodec( CMceCodec& aCodec ); |
|
200 |
||
201 |
public: //internal |
|
202 |
||
203 |
/** |
|
204 |
* Arranges codec priority order based on codecs preference values. |
|
205 |
* @param aDiscardUnusedCodecs ETrue if all disabled codecs should |
|
206 |
* be removed from the stream |
|
207 |
*/ |
|
208 |
void ReorderCodecsByPreferenceL( TBool aDiscardUnusedCodecs ); |
|
209 |
||
210 |
/** |
|
211 |
* Removes codec |
|
212 |
* @param aCodec |
|
213 |
* @param aBinderOriginated |
|
214 |
*/ |
|
215 |
void RemoveCodecL( CMceMessageCodec& aCodec, TBool aBinderOriginated ); |
|
216 |
||
217 |
/** |
|
218 |
* Return codecs of stream. |
|
219 |
* @return list of codecs in the stream. |
|
220 |
*/ |
|
221 |
const RPointerArray<CMceCodec>& BaseCodecs(); |
|
222 |
||
223 |
private: |
|
224 |
/** |
|
225 |
* C++ default constructor. |
|
226 |
*/ |
|
227 |
CMceMessageStream(); |
|
228 |
||
229 |
/** |
|
230 |
* Second-phase constructor. |
|
231 |
*/ |
|
232 |
void ConstructL(); |
|
233 |
||
234 |
//for testing |
|
235 |
||
236 |
MCE_UNIT_TEST_DEFS |
|
237 |
||
238 |
private: // Owned data |
|
239 |
||
240 |
/** |
|
241 |
* codecs |
|
242 |
*/ |
|
243 |
RPointerArray<CMceMessageCodec> iCodecs; |
|
244 |
}; |
|
245 |
||
246 |
#endif // CMCEMESSAGESTREAM_H |