|
1 /* |
|
2 * Copyright (c) 2002-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: Encapsulates DTMF settings. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #ifndef __MCC_CODEC_DTMF_H__ |
|
23 #define __MCC_CODEC_DTMF_H__ |
|
24 |
|
25 #include <badesca.h> |
|
26 |
|
27 // INCLUDES |
|
28 #include "mmcccodecinformation.h" |
|
29 |
|
30 // CONSTANTS |
|
31 const TInt KDTMFPTime( 50 ); |
|
32 |
|
33 // DTMF possible events number |
|
34 const TUint KDtmfNumber0( 0 ); |
|
35 const TUint KDtmfNumber1( 1 ); |
|
36 const TUint KDtmfNumber2( 2 ); |
|
37 const TUint KDtmfNumber3( 3 ); |
|
38 const TUint KDtmfNumber4( 4 ); |
|
39 const TUint KDtmfNumber5( 5 ); |
|
40 const TUint KDtmfNumber6( 6 ); |
|
41 const TUint KDtmfNumber7( 7 ); |
|
42 const TUint KDtmfNumber8( 8 ); |
|
43 const TUint KDtmfNumber9( 9 ); |
|
44 const TUint KDtmfNumber10( 10 ); |
|
45 const TUint KDtmfNumber11( 11 ); |
|
46 const TUint KDtmfNumber12( 12 ); |
|
47 const TUint KDtmfNumber13( 13 ); |
|
48 const TUint KDtmfNumber14( 14 ); |
|
49 const TUint KDtmfNumber15( 15 ); |
|
50 |
|
51 |
|
52 const TUint KMccAllowedDtmfNumber0 = 0x0001; |
|
53 const TUint KMccAllowedDtmfNumber1 = 0x0002; |
|
54 const TUint KMccAllowedDtmfNumber2 = 0x0004; |
|
55 const TUint KMccAllowedDtmfNumber3 = 0x0008; |
|
56 const TUint KMccAllowedDtmfNumber4 = 0x0010; |
|
57 const TUint KMccAllowedDtmfNumber5 = 0x0020; |
|
58 const TUint KMccAllowedDtmfNumber6 = 0x0040; |
|
59 const TUint KMccAllowedDtmfNumber7 = 0x0080; |
|
60 const TUint KMccAllowedDtmfNumber8 = 0x0100; |
|
61 const TUint KMccAllowedDtmfNumber9 = 0x0200; |
|
62 const TUint KMccAllowedDtmfNumber10 = 0x0400; |
|
63 const TUint KMccAllowedDtmfNumber11 = 0x0800; |
|
64 const TUint KMccAllowedDtmfNumber12 = 0x1000; |
|
65 const TUint KMccAllowedDtmfNumber13 = 0x2000; |
|
66 const TUint KMccAllowedDtmfNumber14 = 0x4000; |
|
67 const TUint KMccAllowedDtmfNumber15 = 0x8000; |
|
68 const TUint KMccAllowedDtmfNumberALL = 0xFFFF; |
|
69 |
|
70 |
|
71 // MACROS |
|
72 |
|
73 // DATA TYPES |
|
74 |
|
75 // FUNCTION PROTOTYPES |
|
76 |
|
77 // FORWARD DECLARATIONS |
|
78 |
|
79 // CLASS DECLARATION |
|
80 |
|
81 /** |
|
82 * Container class for the codec information. |
|
83 * |
|
84 * @lib MCCInterface.dll |
|
85 * @since Series 60 3.0 |
|
86 */ |
|
87 NONSHARABLE_CLASS( CMccCodecDTMF ) : public CMccCodecInformation |
|
88 { |
|
89 public: // Constructors and destructor |
|
90 |
|
91 /** |
|
92 * Two-phased constructor. |
|
93 */ |
|
94 static CMccCodecDTMF* NewL(); |
|
95 |
|
96 /** |
|
97 * Destructor. |
|
98 */ |
|
99 virtual ~CMccCodecDTMF(); |
|
100 |
|
101 public: // From CMccCodecInformation |
|
102 |
|
103 /** |
|
104 * From CMccCodecInformation |
|
105 */ |
|
106 TBool RequireSignalling( const CMccCodecInformation& aCandidate ) const; |
|
107 |
|
108 /** |
|
109 * From CMccCodecInformation |
|
110 */ |
|
111 CMccCodecInformation* CloneDefaultsL(); |
|
112 |
|
113 /** |
|
114 * From CMccCodecInformation |
|
115 */ |
|
116 CMccCodecInformation* CloneDetailedL(); |
|
117 |
|
118 /** |
|
119 * From CMccCodecInformation. Enable / Disable Voice Activity Detection. |
|
120 * @since Series 60 3.0 |
|
121 * @param aEnableVAD Boolean indicating whether to enable Voice Activity Detection |
|
122 * @return KErrNotSupported if codec doesn't support VAD; otherwise KErrNone. |
|
123 */ |
|
124 TInt EnableVAD( TBool aEnableVAD ); |
|
125 |
|
126 /** |
|
127 * From CMccCodecInformation. Sets bitrate used with codec. |
|
128 * @since Series 60 3.0 |
|
129 * @param aBitrate New bitrate value |
|
130 * @return KErrNotSupported if codec doesn't support bitrate value issued; otherwise KErrNone. |
|
131 */ |
|
132 TInt SetBitrate( TUint aBitrate ); |
|
133 |
|
134 /** |
|
135 * From CMccCodecInformation. Sets the sampling frequency. |
|
136 * @since Series 60 3.0 |
|
137 * @param aSamplingFreq Sampling frequency to be used |
|
138 * @return KErrNotSupported if codec doesn't support sampling frequency issued; otherwise KErrNone. |
|
139 */ |
|
140 TInt SetSamplingFreq( TUint32 aSamplingFreq ); |
|
141 |
|
142 /** |
|
143 * From CMccCodecInformation. Sets the packet rate. |
|
144 * @since Series 60 3.0 |
|
145 * @param aPacketrate New packetrate |
|
146 * @return KErrNotSupported if codec doesn't support packetrate value issued; otherwise KErrNone. |
|
147 */ |
|
148 TInt SetPTime( TUint aPTime ); |
|
149 |
|
150 /** |
|
151 * From CMccCodecInformation. Sets the packet rate. |
|
152 * @since Series 60 3.0 |
|
153 * @param aPacketrate New packetrate |
|
154 * @return KErrNotSupported if codec doesn't support packetrate value issued; otherwise KErrNone. |
|
155 */ |
|
156 TInt SetMaxPTime( TUint aMaxPTime ); |
|
157 |
|
158 /** |
|
159 * From CMccCodecInformation. Sets the sdp name. |
|
160 * @since Series 60 3.0 |
|
161 * @param aRtpId - [input] RTP session ID |
|
162 * @return One of the standard system-wide error codes. |
|
163 */ |
|
164 TInt SetSdpName( const TDesC8& aSdpName ); |
|
165 |
|
166 /** |
|
167 * From CMccCodecInformation. Sets the payload type. |
|
168 * @since Series 60 3.0 |
|
169 * @param aRtpId - [input] RTP session ID |
|
170 * @return One of the standard system-wide error codes. |
|
171 */ |
|
172 TInt SetPayloadType( TUint8 aPayloadType ); |
|
173 |
|
174 /** |
|
175 * From CMccCodecInformation. Sets the codec mode. |
|
176 * @since Series 60 3.0 |
|
177 * @param aMode Codec mode ( e.g. ULAW/ALAW, Bandwidth efficient / octet aligned ) |
|
178 * @return KErrNotSupported if codec doesnt' support codec mode value issued; otherwise KErrNone. |
|
179 */ |
|
180 TInt SetCodecMode( TCodecMode aCodecMode ); |
|
181 |
|
182 /** |
|
183 * Sets the allowed bitrates for the codec. |
|
184 * @param aBitrateMask bitrate mask. |
|
185 * @return KErrNotSupported if codec doesnt' support the bitrate mask |
|
186 * value issued; otherwise KErrNone. |
|
187 */ |
|
188 TInt SetAllowedBitrates( TUint aBitrateMask ); |
|
189 |
|
190 /** |
|
191 * From CMccCodecInformation. |
|
192 * Parses the fmtp attributes, and updates the internal values |
|
193 * except the iFmtpAttr attribute |
|
194 * @param aFmtp Fmtp attribute |
|
195 * @return True if any param was updated |
|
196 */ |
|
197 TBool ParseFmtpAttrL( const TDesC8& aFmtp ); |
|
198 |
|
199 /** |
|
200 * From CMccCodecInformation. Gets the codec fmtp parameters. |
|
201 * @return Fmtp parameters of the codec |
|
202 */ |
|
203 TDesC8& GetFmtpL(); |
|
204 |
|
205 /** |
|
206 * From CMccCodecInformation. |
|
207 */ |
|
208 void CreateFmtpAttrListL(); |
|
209 |
|
210 |
|
211 private: |
|
212 |
|
213 /** |
|
214 * C++ default constructor. |
|
215 */ |
|
216 CMccCodecDTMF(); |
|
217 |
|
218 /** |
|
219 * By default Symbian 2nd phase constructor is private. |
|
220 */ |
|
221 void ConstructL(); |
|
222 |
|
223 private: |
|
224 |
|
225 |
|
226 /* |
|
227 * store tokens sperated by aSeparator to array. |
|
228 * |
|
229 * @param aValue, a sting contains comma seperated numbers |
|
230 * @param aSeparator, a char |
|
231 * @return tokens array, ownership is transferred |
|
232 */ |
|
233 CPtrC8Array* TokenizeL( const TDesC8& aValue, |
|
234 const TChar& aSeparator ); |
|
235 |
|
236 /* |
|
237 * add one token, which is taken from aValue |
|
238 * from aTokenStartPos to aTokenEndPos, to token array |
|
239 * e.g string value is 0-15,60,70. tokens are 0-15, 60 and 70 |
|
240 * |
|
241 * @param aTokenArray |
|
242 * @param aValue, |
|
243 * @param aTokenStartPos, |
|
244 * @param aTokenEndPos |
|
245 * @return None, leave in case of errors |
|
246 */ |
|
247 void AddTokenL ( CPtrC8Array& aTokenArray, |
|
248 const TDesC8& aValue, |
|
249 TInt aTokenStartPos, |
|
250 TInt aTokenEndPos ); |
|
251 |
|
252 /* |
|
253 * parse the tokens arrays, and get DTMF tone numbers |
|
254 * |
|
255 * @param aTokenArray, a list of numbers |
|
256 * @return ETrue, if Tone numbers are updated. |
|
257 */ |
|
258 TBool EncodeTokensL( MDesC8Array& aTokenArray ); |
|
259 |
|
260 /* |
|
261 * parse one token, and get DTMF tone numbers |
|
262 * |
|
263 * @param aValue, a number or two decimal number |
|
264 * @return ETrue, if Tone numbers are updated. |
|
265 */ |
|
266 TBool ParseTokenL( const TDesC8& aValue ); |
|
267 |
|
268 /* |
|
269 * parse one tone number from one token, and get DTMF tone numbers |
|
270 * e.g one token 60 |
|
271 * |
|
272 * @param aValue, token value |
|
273 * @return ETrue, if Tone numbers are updated. |
|
274 */ |
|
275 TBool ParseToneNumberL( const TDesC8& aValue ); |
|
276 |
|
277 /* |
|
278 * parse tone numbers from one token, and get DTMF tone numbers |
|
279 * e.g one token is 0-15 |
|
280 * |
|
281 * @param aValueLeft, value from left side of hyphen '-' |
|
282 * @param aValueRight, value from Right side of hyphen '-' |
|
283 |
|
284 * @return ETrue, if Tone numbers are updated. |
|
285 */ |
|
286 TBool ParseToneNumbersL( const TDesC8& aValueLeft, const TDesC8& aValueRight ); |
|
287 |
|
288 /** |
|
289 * add tone digit numbers to from left number to right number. |
|
290 * eg. 0-15. aLeftNumber = 0, 15 = aRightNumber |
|
291 * leave if error happens. |
|
292 * @param aLeftNumber |
|
293 * @param aRightNumber |
|
294 * @return ETrue if tone numbers are added |
|
295 */ |
|
296 TBool AddToneNumbersL( TUint aLeftNumber, TUint aRightNumber ); |
|
297 |
|
298 void GetAllowedToneNumbersArrayL( RArray<TUint>& aToneNumbers ); |
|
299 |
|
300 void CreateFmtpAttrListL( const RArray<TUint>& aToneNumbers ); |
|
301 |
|
302 TBool AddAllowedBit( TUint aBit ); |
|
303 |
|
304 void FindContinuusIntegers( const RArray<TUint>& aToneNumbers, |
|
305 TUint& aPosition ); |
|
306 |
|
307 private: |
|
308 #ifdef TEST_EUNIT |
|
309 friend class UT_CMccCodecDTMF; |
|
310 #endif |
|
311 |
|
312 }; |
|
313 |
|
314 #endif // __MCC_CODEC_DTMF_H__ |
|
315 |
|
316 // End of File |