|
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 #include <sipprofile.h> |
|
20 #include "mceoutsession.h" |
|
21 #include "mcemediastream.h" |
|
22 #include "mcemanager.h" |
|
23 |
|
24 |
|
25 // ============================ MEMBER FUNCTIONS =============================== |
|
26 |
|
27 |
|
28 // ----------------------------------------------------------------------------- |
|
29 // CMceOutSession::NewL |
|
30 // ----------------------------------------------------------------------------- |
|
31 // |
|
32 EXPORT_C CMceOutSession* CMceOutSession::NewL( |
|
33 CMceManager& aManager, |
|
34 CSIPProfile& /*aProfile*/, |
|
35 const TDesC8& aRecipient, |
|
36 HBufC8* aOriginator ) |
|
37 { |
|
38 CMceOutSession* self = new (ELeave) CMceOutSession( &aManager, 0 ); |
|
39 CleanupStack::PushL( self ); |
|
40 self->ConstructL( aRecipient, aOriginator ); |
|
41 CleanupStack::Pop( self ); |
|
42 return self; |
|
43 } |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // CMceOutSession::NewL |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 EXPORT_C CMceOutSession* CMceOutSession::NewL( CMceEvent& /*aEvent*/ ) |
|
50 { |
|
51 return NULL; |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CMceOutSession::NewL |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 EXPORT_C CMceOutSession* CMceOutSession::NewL( CMceRefer& /*aRefer*/ ) |
|
59 { |
|
60 return NULL; |
|
61 } |
|
62 |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // CMceOutSession::~CMceOutSession |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 EXPORT_C CMceOutSession::~CMceOutSession() |
|
69 { |
|
70 } |
|
71 |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // CMceOutSession::EstablishL |
|
75 // ----------------------------------------------------------------------------- |
|
76 // |
|
77 EXPORT_C void CMceOutSession::EstablishL( |
|
78 TUint32 aTimeout, |
|
79 CDesC8Array* aHeaders, |
|
80 HBufC8* aContentType, |
|
81 HBufC8* aContent, |
|
82 CDesC8Array* aContentHeaders ) |
|
83 { |
|
84 User::LeaveIfError( State() == EIdle ? KErrNone : KErrNotReady ); |
|
85 User::LeaveIfError( |
|
86 ( aContentType && aContent ) || |
|
87 !( aContentType || aContent || aContentHeaders ) ? |
|
88 KErrNone : KErrArgument ); |
|
89 |
|
90 if ( iFailWithCode != KErrNone ) |
|
91 { |
|
92 TInt failCode = iFailWithCode; |
|
93 iFailWithCode = KErrNone; |
|
94 User::Leave( failCode ); |
|
95 } |
|
96 |
|
97 iTimeout = aTimeout; |
|
98 |
|
99 //start establishing the session |
|
100 |
|
101 delete iHeaders; |
|
102 iHeaders = aHeaders; |
|
103 delete aContentType; |
|
104 delete aContent; |
|
105 delete aContentHeaders; |
|
106 |
|
107 iState = CMceSession::EOffering; |
|
108 |
|
109 |
|
110 |
|
111 } |
|
112 |
|
113 |
|
114 // ----------------------------------------------------------------------------- |
|
115 // CMceOutSession::AddStreamL |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 EXPORT_C void CMceOutSession::AddStreamL( CMceMediaStream* aMediaStream ) |
|
119 { |
|
120 if ( iManager ) |
|
121 { |
|
122 //initialize stream (to get supported codecs) |
|
123 aMediaStream->InitializeL( iManager ); |
|
124 } |
|
125 else |
|
126 { |
|
127 //internalizing => no initialize yet |
|
128 } |
|
129 |
|
130 CMceSession::AddStreamL( aMediaStream ); |
|
131 } |
|
132 |
|
133 |
|
134 // ----------------------------------------------------------------------------- |
|
135 // CMceOutSession::CancelL |
|
136 // ----------------------------------------------------------------------------- |
|
137 // |
|
138 EXPORT_C void CMceOutSession::CancelL() |
|
139 { |
|
140 User::LeaveIfError( State() != EIdle ? KErrNone : KErrNotReady ); |
|
141 |
|
142 iState = CMceSession::ECancelling; |
|
143 |
|
144 } |
|
145 |
|
146 |
|
147 // ----------------------------------------------------------------------------- |
|
148 // CMceOutSession::CMceOutSession |
|
149 // ----------------------------------------------------------------------------- |
|
150 // |
|
151 CMceOutSession::CMceOutSession( CMceManager* aManager, TUint32 aProfileId ) |
|
152 : CMceSession( aManager, aProfileId ) |
|
153 { |
|
154 //NOP |
|
155 } |
|
156 |
|
157 // ----------------------------------------------------------------------------- |
|
158 // CMceOutSession::ConstructL |
|
159 // ----------------------------------------------------------------------------- |
|
160 // |
|
161 void CMceOutSession::ConstructL( const TDesC8& aRecipient, HBufC8* aOriginator ) |
|
162 { |
|
163 |
|
164 delete iRecipient; |
|
165 iRecipient = NULL; |
|
166 iRecipient = aRecipient.AllocL(); |
|
167 |
|
168 delete iOriginator; |
|
169 iOriginator = NULL; |
|
170 if ( aOriginator ) |
|
171 { |
|
172 iOriginator = aOriginator->AllocL(); |
|
173 delete aOriginator; |
|
174 } |
|
175 |
|
176 CMceSession::ConstructL(); |
|
177 |
|
178 |
|
179 } |