|
1 /* |
|
2 * Copyright (c) 2006 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: Formatter class for decoding of RTP payload format for named |
|
15 * telephone events and tones. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #ifndef CDTMFPAYLOADDECODER_H |
|
23 #define CDTMFPAYLOADDECODER_H |
|
24 |
|
25 // INCLUDES |
|
26 #include <e32base.h> |
|
27 #include "dtmfpayloadformatdefs.h" |
|
28 #include "dtmfeventpayloadinfo.h" |
|
29 #include "dtmftonepayloadinfo.h" |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class CMMFBuffer; |
|
33 class CMMFDataBuffer; |
|
34 |
|
35 |
|
36 // CLASS DECLARATION |
|
37 /** |
|
38 * Provides functionality to decode Tone and Event Payload according |
|
39 * to RFC 2833. Functionality for decoding redundant event Payload |
|
40 * is also served ( RFC 2198 ). |
|
41 * |
|
42 * @lib mmccdtmfplformat.dll |
|
43 * @since Series 60 3.2 |
|
44 */ |
|
45 class CDTMFPayloadDecoder : public CBase |
|
46 { |
|
47 public: // Constructors and destructor |
|
48 |
|
49 /** |
|
50 * Two-phased constructor. |
|
51 */ |
|
52 static CDTMFPayloadDecoder* NewL(); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 virtual ~CDTMFPayloadDecoder(); |
|
58 |
|
59 public: // New functions |
|
60 |
|
61 /** |
|
62 * Decodes DTMF string from Payload Format for Named Events. |
|
63 * |
|
64 * @since Series 60 3.2 |
|
65 * @param aSourceBuffer Databuffer containing payload |
|
66 * @param aEventInfos Array where to place decoded information |
|
67 * @return System wide error code |
|
68 */ |
|
69 TInt DecodeEventPayload( CMMFBuffer* aSourceBuffer, |
|
70 RArray< TDTMFEventPayloadInfo >& aEventInfos ); |
|
71 |
|
72 /** |
|
73 * Decodes DTMF from Tone Payload Format packet. |
|
74 * |
|
75 * @since Series 60 3.2 |
|
76 * @param aSourceBuffer Databuffer containing payload |
|
77 * @param aToneInfos Array where to place decoded information |
|
78 * @return System wide error code |
|
79 */ |
|
80 TInt DecodeTonePayload( CMMFBuffer* aSourceBuffer, |
|
81 RArray<TDTMFTonePayloadInfo>& aToneInfos ); |
|
82 |
|
83 /** |
|
84 * Returns type of the payload format. |
|
85 * |
|
86 * @since Series 60 3.2 |
|
87 * @return Type of the payload |
|
88 */ |
|
89 TDTMFPayloadFormat PayloadFormat( ) const; |
|
90 |
|
91 /** |
|
92 * Set payload format used. |
|
93 * |
|
94 * @since Series 60 3.2 |
|
95 * @param aPayloadFormat Payload format to set. |
|
96 * @return System wide error code |
|
97 */ |
|
98 TInt SetPayloadFormat( TDTMFPayloadFormat aPayloadFormat ); |
|
99 |
|
100 /** |
|
101 * Sets the time stamp of a RTP packet containing payload which is |
|
102 * decoded next. |
|
103 * |
|
104 * @since Series 60 3.2 |
|
105 * @param aTimeStamp Time stamp |
|
106 */ |
|
107 void SetCurTimeStamp( const TTimeIntervalMicroSeconds32& aTimeStamp ); |
|
108 |
|
109 private: |
|
110 |
|
111 /** |
|
112 * C++ default constructor. |
|
113 */ |
|
114 CDTMFPayloadDecoder(); |
|
115 |
|
116 /** |
|
117 * Decodes DTMF from Payload Format for Named Events with |
|
118 * redundant events. |
|
119 * |
|
120 * @since Series 60 3.2 |
|
121 * @param aSourceBuffer Databuffer containing payload |
|
122 * @param aEventInfos Array where to place decoded information |
|
123 * @return System wide error code |
|
124 */ |
|
125 TInt DecodeRedundantEventPayload( CMMFBuffer* aSourceBuffer, |
|
126 RArray<TDTMFEventPayloadInfo>& aEventInfos ); |
|
127 |
|
128 /** |
|
129 * Converts integer presentation used in a payload format to the |
|
130 * character. |
|
131 * |
|
132 * @since Series 60 3.2 |
|
133 * @param aEvent Integer presentation of the event |
|
134 * @param aChar Result character |
|
135 * @return System wide error code |
|
136 */ |
|
137 TInt ConvertToChar( TUint aEvent, TChar& aChar ) const; |
|
138 |
|
139 private: // Data |
|
140 |
|
141 /** |
|
142 * Payload format used for decoding |
|
143 */ |
|
144 TDTMFPayloadFormat iPayloadFormat; |
|
145 |
|
146 /** |
|
147 * Time stamp of the RTP packet under decoding |
|
148 */ |
|
149 TTimeIntervalMicroSeconds32 iCurTimeStamp; |
|
150 |
|
151 /** |
|
152 * Array used to recognise redundant events already played out |
|
153 */ |
|
154 RArray<TDTMFEventPayloadInfo> iEventArray; |
|
155 |
|
156 /** |
|
157 * Used as a temporarily container for the |
|
158 * payload info under decoding |
|
159 */ |
|
160 TDTMFEventPayloadInfo iDecodedEventInfo; |
|
161 |
|
162 /** |
|
163 * Used as a temporarily container for the |
|
164 * payload info under decoding |
|
165 */ |
|
166 TDTMFTonePayloadInfo iDecodedToneInfo; |
|
167 |
|
168 private: |
|
169 #ifdef TEST_EUNIT |
|
170 friend class UT_CDTMFPayloadDecoder; |
|
171 #endif |
|
172 |
|
173 }; |
|
174 |
|
175 #endif // CDTMFPAYLOADDECODER_H |
|
176 |
|
177 // End of File |