|
1 /* |
|
2 * Copyright (c) 2007 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: Plugin interface implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "nspinterface.h" |
|
19 #include "nspcontroller.h" |
|
20 #include "nspsession.h" |
|
21 #include "nspmediastreamcontainer.h" |
|
22 |
|
23 // ======== MEMBER FUNCTIONS ======== |
|
24 // --------------------------------------------------------------------------- |
|
25 // CNSPInterface::CNSPInterface |
|
26 // --------------------------------------------------------------------------- |
|
27 // |
|
28 CNSPInterface::CNSPInterface() |
|
29 { |
|
30 } |
|
31 |
|
32 |
|
33 // --------------------------------------------------------------------------- |
|
34 // CNSPInterface::ConstructL |
|
35 // --------------------------------------------------------------------------- |
|
36 // |
|
37 void CNSPInterface::ConstructL() |
|
38 { |
|
39 iController = CNSPController::NewL(); |
|
40 } |
|
41 |
|
42 |
|
43 // --------------------------------------------------------------------------- |
|
44 // CNSPInterface::NewL |
|
45 // --------------------------------------------------------------------------- |
|
46 // |
|
47 CNSPInterface* CNSPInterface::NewL() |
|
48 { |
|
49 CNSPInterface* self = new( ELeave ) CNSPInterface; |
|
50 CleanupStack::PushL( self ); |
|
51 self->ConstructL(); |
|
52 CleanupStack::Pop( self ); |
|
53 return self; |
|
54 } |
|
55 |
|
56 |
|
57 // --------------------------------------------------------------------------- |
|
58 // CNSPInterface::~CNSPInterface |
|
59 // --------------------------------------------------------------------------- |
|
60 // |
|
61 CNSPInterface::~CNSPInterface() |
|
62 { |
|
63 delete iController; |
|
64 } |
|
65 |
|
66 |
|
67 // --------------------------------------------------------------------------- |
|
68 // CNSPInterface::NewSessionL |
|
69 // --------------------------------------------------------------------------- |
|
70 // |
|
71 TUint CNSPInterface::NewSessionL( MNSPSessionObserver& aSessionObserver, |
|
72 TUint32 aIapId, const TDesC8& aDomain, TUint aProtocol ) |
|
73 { |
|
74 return iController->NewSessionL( aSessionObserver, aIapId, |
|
75 aDomain, aProtocol ); |
|
76 } |
|
77 |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // CNSPInterface::CloseSessionL |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 void CNSPInterface::CloseSessionL( TUint aSessionId ) |
|
84 { |
|
85 iController->ClosingSessionL( aSessionId ); |
|
86 } |
|
87 |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // CNSPInterface::SetSessionParam |
|
91 // --------------------------------------------------------------------------- |
|
92 // |
|
93 TInt CNSPInterface::SetSessionParam( TUint aSessionId, |
|
94 TNSPSessionParamKey aParamKey, TUint aParamValue ) |
|
95 { |
|
96 TInt status = KErrNone; |
|
97 CNSPSession* session = NULL; |
|
98 |
|
99 TRAPD( err, session = &iController->FindSessionObjectL( aSessionId ) ); |
|
100 |
|
101 if ( KErrNone == err ) |
|
102 { |
|
103 status = session->SetSessionParam( aParamKey, aParamValue ); |
|
104 } |
|
105 else |
|
106 { |
|
107 status = err; |
|
108 } |
|
109 |
|
110 return status; |
|
111 } |
|
112 |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // CNSPInterface::GetSessionParam |
|
116 // --------------------------------------------------------------------------- |
|
117 // |
|
118 TInt CNSPInterface::GetSessionParam( TUint aSessionId, |
|
119 TNSPSessionParamKey aParamKey ) |
|
120 { |
|
121 TInt value = KErrNone; |
|
122 CNSPSession* session = NULL; |
|
123 |
|
124 TRAPD( err, session = &iController->FindSessionObjectL( aSessionId ) ); |
|
125 |
|
126 if ( KErrNone == err ) |
|
127 { |
|
128 value = session->GetSessionParam( aParamKey ); |
|
129 } |
|
130 else |
|
131 { |
|
132 value = err; |
|
133 } |
|
134 |
|
135 return value; |
|
136 } |
|
137 |
|
138 |
|
139 // --------------------------------------------------------------------------- |
|
140 // CNSPInterface::CreateOfferL |
|
141 // --------------------------------------------------------------------------- |
|
142 // |
|
143 TNatReturnStatus CNSPInterface::CreateOfferL( TUint aSessionId, |
|
144 CSdpDocument*& aDocument ) |
|
145 { |
|
146 CNSPSession& session = iController->FindSessionObjectL( aSessionId ); |
|
147 return session.CreateOfferL( aDocument ); |
|
148 } |
|
149 |
|
150 |
|
151 // --------------------------------------------------------------------------- |
|
152 // CNSPInterface::ResolveL |
|
153 // --------------------------------------------------------------------------- |
|
154 // |
|
155 TNatReturnStatus CNSPInterface::ResolveL( TUint aSessionId, |
|
156 CSdpDocument*& aOffer, CSdpDocument*& aAnswer ) |
|
157 { |
|
158 CNSPSession& session = iController->FindSessionObjectL( aSessionId ); |
|
159 return session.ResolveL( aOffer, aAnswer ); |
|
160 } |
|
161 |
|
162 |
|
163 // --------------------------------------------------------------------------- |
|
164 // CNSPInterface::DecodeAnswerL |
|
165 // --------------------------------------------------------------------------- |
|
166 // |
|
167 TNatReturnStatus CNSPInterface::DecodeAnswerL( TUint aSessionId, |
|
168 CSdpDocument*& aAnswer ) |
|
169 { |
|
170 CNSPSession& session = iController->FindSessionObjectL( aSessionId ); |
|
171 return session.DecodeAnswerL( aAnswer ); |
|
172 } |
|
173 |
|
174 |
|
175 // --------------------------------------------------------------------------- |
|
176 // CNSPInterface::UpdateL |
|
177 // --------------------------------------------------------------------------- |
|
178 // |
|
179 void CNSPInterface::UpdateL( TUint aSessionId, |
|
180 CSdpDocument*& aOffer ) |
|
181 { |
|
182 CNSPSession& session = iController->FindSessionObjectL( aSessionId ); |
|
183 session.UpdateL( aOffer ); |
|
184 } |
|
185 |
|
186 |
|
187 // --------------------------------------------------------------------------- |
|
188 // CNSPInterface::RestartL |
|
189 // --------------------------------------------------------------------------- |
|
190 // |
|
191 TNatReturnStatus CNSPInterface::RestartL( TUint /*aSessionId*/ ) |
|
192 { |
|
193 return KNatReady; |
|
194 } |
|
195 |
|
196 |
|
197 // end of file |