|
1 /* |
|
2 * Copyright (c) 2004 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 // INCLUDES |
|
20 #include "createAudioCodecDialog.h" |
|
21 #include "CMCETestUIEngineAudioStream.h" |
|
22 #include "CMCETestUIEngineCodec.h" |
|
23 #include <MCEAudioCodec.h> |
|
24 #include <MCEAMRCodec.h> |
|
25 #include <MCEAudioStream.h> |
|
26 #include "mcetestuiengineconstants.h" |
|
27 #include <AknPopupFieldText.h> |
|
28 |
|
29 // CONSTANTS |
|
30 const TInt KBufLength = 100; |
|
31 |
|
32 // ============================ MEMBER FUNCTIONS ============================== |
|
33 |
|
34 // ---------------------------------------------------------------------------- |
|
35 // CCreateAudioCodecDialog::CCreateAudioCodecDialog( ) |
|
36 // . |
|
37 // ---------------------------------------------------------------------------- |
|
38 // |
|
39 CCreateAudioCodecDialog::CCreateAudioCodecDialog( |
|
40 CMCETestUIEngineAudioStream& aStream, TInt aIndex ) : |
|
41 iStream(aStream),iCodecIndex( aIndex ) |
|
42 { |
|
43 |
|
44 // No implementation required |
|
45 } |
|
46 |
|
47 // ---------------------------------------------------------------------------- |
|
48 // CCreateAudioCodecDialog::PreLayoutDynInitL() |
|
49 // . |
|
50 // ---------------------------------------------------------------------------- |
|
51 // |
|
52 void CCreateAudioCodecDialog::PreLayoutDynInitL() |
|
53 { |
|
54 const RPointerArray<CMCETestUIEngineCodec>& codecs = |
|
55 iStream.CodecsL(); |
|
56 |
|
57 CMceAudioCodec& audioCodec = static_cast<CMceAudioCodec&>(codecs[iCodecIndex]->Codec()); |
|
58 TBool aEnableVAD = audioCodec.VAD(); |
|
59 CAknPopupFieldText* popupFieldText = |
|
60 static_cast <CAknPopupFieldText*> (Control(EAudioCodecEnableVAD)); |
|
61 if(aEnableVAD) |
|
62 { |
|
63 popupFieldText->SetCurrentValueIndex(1); |
|
64 } |
|
65 else |
|
66 { |
|
67 popupFieldText->SetCurrentValueIndex(0); |
|
68 } |
|
69 |
|
70 // Set defaultBuf packet size |
|
71 CEikNumberEditor* bitrate = static_cast<CEikNumberEditor*>( |
|
72 Control( EAudioCodecDialogBitRate ) ); |
|
73 bitrate->SetNumber(codecs[iCodecIndex]->Codec().Bitrate()); |
|
74 |
|
75 CEikNumberEditor* allowedBitrate = static_cast<CEikNumberEditor*>( |
|
76 Control( EAudioCodecDialogAllowedBitRate ) ); |
|
77 allowedBitrate->SetNumber( codecs[iCodecIndex]->Codec().AllowedBitrates() ); |
|
78 |
|
79 CEikNumberEditor* ptime = static_cast<CEikNumberEditor*>( |
|
80 Control( EAudioCodecDialogPTime ) ); |
|
81 ptime->SetNumber( codecs[iCodecIndex]->Codec().PTime() ); |
|
82 |
|
83 CEikNumberEditor* maxptime = static_cast<CEikNumberEditor*>( |
|
84 Control( EAudioCodecDialogMaxPTime ) ); |
|
85 maxptime->SetNumber( codecs[iCodecIndex]->Codec().MaxPTime() ); |
|
86 |
|
87 CEikNumberEditor* codecmode = static_cast<CEikNumberEditor*>( |
|
88 Control( EAudioCodecDialogCodecMode ) ); |
|
89 codecmode->SetNumber( codecs[iCodecIndex]->Codec().CodecMode() ); |
|
90 |
|
91 CEikNumberEditor* ptype = static_cast<CEikNumberEditor*>( |
|
92 Control( EAudioCodecDialogPayLoadType ) ); |
|
93 ptype->SetNumber( codecs[iCodecIndex]->Codec().PayloadType() ); |
|
94 |
|
95 |
|
96 CEikNumberEditor* keepalivetimer = static_cast<CEikNumberEditor*>( |
|
97 Control( EAudioCodecKeepalivetimer ) ); |
|
98 keepalivetimer->SetNumber( 0 ); |
|
99 |
|
100 CEikNumberEditor* keepalivePt = static_cast<CEikNumberEditor*>( |
|
101 Control( EAudioCodecKeepalivePt ) ); |
|
102 keepalivePt->SetNumber( 0 ); |
|
103 |
|
104 |
|
105 CAknForm::PreLayoutDynInitL(); |
|
106 } |
|
107 |
|
108 // ---------------------------------------------------------------------------- |
|
109 // CCreateAudioCodecDialog::OkToExitL( TInt ) |
|
110 // . |
|
111 // ---------------------------------------------------------------------------- |
|
112 // |
|
113 |
|
114 TBool CCreateAudioCodecDialog::OkToExitL( TInt aKey ) |
|
115 { |
|
116 if ( aKey == EEikCmdCanceled ) |
|
117 { |
|
118 // Cancel pressed. Just exit. |
|
119 return ETrue; |
|
120 } |
|
121 const RPointerArray<CMCETestUIEngineCodec>& codecs = |
|
122 iStream.CodecsL(); |
|
123 |
|
124 CMceAudioCodec& audioCodec = static_cast<CMceAudioCodec&>(codecs[iCodecIndex]->Codec()); |
|
125 |
|
126 CAknPopupFieldText* popupFieldText = |
|
127 static_cast <CAknPopupFieldText*> (Control(EAudioCodecEnableVAD)); |
|
128 if(popupFieldText->CurrentValueIndex()) |
|
129 { |
|
130 audioCodec.EnableVAD(ETrue); |
|
131 } |
|
132 else |
|
133 { |
|
134 audioCodec.EnableVAD(EFalse); |
|
135 } |
|
136 |
|
137 CEikNumberEditor* bitrate = static_cast<CEikNumberEditor*>( |
|
138 Control( EAudioCodecDialogBitRate ) ); |
|
139 audioCodec.SetBitrate( bitrate->Number() ); |
|
140 |
|
141 CEikNumberEditor* ptime = static_cast<CEikNumberEditor*>( |
|
142 Control( EAudioCodecDialogPTime ) ); |
|
143 audioCodec.SetPTime( ptime->Number()); |
|
144 |
|
145 CEikNumberEditor* maxptime = static_cast<CEikNumberEditor*>( |
|
146 Control( EAudioCodecDialogMaxPTime ) ); |
|
147 audioCodec.SetMaxPTime( maxptime->Number()); |
|
148 |
|
149 CEikNumberEditor* ptype = static_cast<CEikNumberEditor*>( |
|
150 Control( EAudioCodecDialogPayLoadType ) ); |
|
151 audioCodec.SetPayloadType( ptype->Number()) ; |
|
152 |
|
153 |
|
154 CEikNumberEditor* codecmode = static_cast<CEikNumberEditor*>( |
|
155 Control( EAudioCodecDialogCodecMode ) ); |
|
156 audioCodec.SetCodecMode( codecmode->Number()); |
|
157 |
|
158 |
|
159 CEikNumberEditor* keepalive = static_cast<CEikNumberEditor*>( |
|
160 Control( EAudioCodecKeepalivetimer ) ); |
|
161 |
|
162 if( keepalive->Number() != 0 ) |
|
163 { |
|
164 audioCodec.SetKeepAliveTimerL( keepalive->Number()); |
|
165 } |
|
166 |
|
167 CEikNumberEditor* keepalivePt = static_cast<CEikNumberEditor*>( |
|
168 Control( EAudioCodecKeepalivePt ) ); |
|
169 |
|
170 if( keepalivePt->Number() != 0 ) |
|
171 { |
|
172 audioCodec.SetKeepAlivePayloadTypeL( keepalivePt->Number()); |
|
173 } |
|
174 |
|
175 TBuf8<KMceMaxSdpNameLength> sdpname = audioCodec.SdpName(); |
|
176 |
|
177 if( sdpname == KMceCodecAMR || sdpname == KSDPNameiLBC ) |
|
178 { |
|
179 CMceAmrCodec& amrCodec = ( CMceAmrCodec& ) audioCodec; |
|
180 CEikNumberEditor* allowedBitrate = static_cast<CEikNumberEditor*>( |
|
181 Control( EAudioCodecDialogAllowedBitRate ) ); |
|
182 amrCodec.SetAllowedBitrates( allowedBitrate->Number()); |
|
183 } |
|
184 return ETrue; |
|
185 } |
|
186 |
|
187 // ---------------------------------------------------------------------------- |
|
188 // CCreatePoCSessionDialog::~CCreatePoCSessionDialog() |
|
189 // . |
|
190 // ---------------------------------------------------------------------------- |
|
191 // |
|
192 CCreateAudioCodecDialog::~CCreateAudioCodecDialog() |
|
193 { |
|
194 return; |
|
195 } |
|
196 |
|
197 // ============================ MEMBER FUNCTIONS ============================== |
|
198 |
|
199 // ---------------------------------------------------------------------------- |
|
200 // CAddCodecDialog::CAddCodecDialog( ) |
|
201 // . |
|
202 // ---------------------------------------------------------------------------- |
|
203 // |
|
204 CAddCodecDialog::CAddCodecDialog( |
|
205 TInt& aCodecIndex ) : |
|
206 iCodecIndex( aCodecIndex ) |
|
207 { |
|
208 |
|
209 // No implementation required |
|
210 } |
|
211 |
|
212 // ---------------------------------------------------------------------------- |
|
213 // CAddCodecDialog::PreLayoutDynInitL() |
|
214 // . |
|
215 // ---------------------------------------------------------------------------- |
|
216 // |
|
217 void CAddCodecDialog::PreLayoutDynInitL() |
|
218 { |
|
219 CAknPopupFieldText* popupFieldText = |
|
220 static_cast <CAknPopupFieldText*> (Control(EMceAddCodec)); |
|
221 CAknForm::PreLayoutDynInitL(); |
|
222 } |
|
223 |
|
224 // ---------------------------------------------------------------------------- |
|
225 // CAddCodecDialog::OkToExitL( TInt ) |
|
226 // . |
|
227 // ---------------------------------------------------------------------------- |
|
228 // |
|
229 TBool CAddCodecDialog::OkToExitL( TInt aKey ) |
|
230 { |
|
231 if ( aKey == EEikCmdCanceled ) |
|
232 { |
|
233 // Cancel pressed. Just exit. |
|
234 return ETrue; |
|
235 } |
|
236 CAknPopupFieldText* popupFieldText = |
|
237 static_cast <CAknPopupFieldText*> (Control(EMceAddCodec)); |
|
238 |
|
239 iCodecIndex = popupFieldText->CurrentValueIndex(); |
|
240 return ETrue; |
|
241 } |
|
242 |
|
243 // ---------------------------------------------------------------------------- |
|
244 // CAddCodecDialog::~CAddCodecDialog() |
|
245 // . |
|
246 // ---------------------------------------------------------------------------- |
|
247 // |
|
248 CAddCodecDialog::~CAddCodecDialog() |
|
249 { |
|
250 return; |
|
251 } |
|
252 |
|
253 // End of File |