1 /* |
1 /* |
2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
8 * |
8 * |
9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: VOIP Audio Services CMsgQueueHandler class implementation. |
14 * Description: VOIP Audio Services CMsgQueueHandler class implementation. |
15 * |
15 * |
16 */ |
16 */ |
17 |
|
18 |
17 |
19 #include <voipaudiocommon.h> |
18 #include <voipaudiocommon.h> |
20 #include <voipuplinkstream.h> |
19 #include <voipuplinkstream.h> |
21 #include <voipdownlinkstream.h> |
20 #include <voipdownlinkstream.h> |
22 #include <voipdtmftoneplayer.h> |
21 #include <voipdtmftoneplayer.h> |
24 #include "debugtracemacros.h" |
23 #include "debugtracemacros.h" |
25 #include "VoIPSharedData.h" |
24 #include "VoIPSharedData.h" |
26 #include "VoIPDataBufferImpl.h" |
25 #include "VoIPDataBufferImpl.h" |
27 #include "VoIPQueueHandler.h" |
26 #include "VoIPQueueHandler.h" |
28 |
27 |
29 |
|
30 // ---------------------------------------------------------------------------- |
28 // ---------------------------------------------------------------------------- |
31 // CQueueHandler::NewL |
29 // CQueueHandler::NewL |
32 // Symbian constructor |
30 // Symbian constructor |
33 // ---------------------------------------------------------------------------- |
31 // ---------------------------------------------------------------------------- |
34 // |
32 // |
35 CQueueHandler* CQueueHandler::NewL(MQueueHandlerObserver* aObserver, |
33 CQueueHandler* CQueueHandler::NewL(MQueueHandlerObserver* aObserver, |
36 RMsgQueue<TVoIPMsgBuf>* aMsgQueue, |
34 RMsgQueue<TVoIPMsgBuf>* aMsgQueue, TInt aBufferLen) |
37 TInt aBufferLen) |
|
38 { |
35 { |
39 CQueueHandler* self = new (ELeave) CQueueHandler(aMsgQueue); |
36 CQueueHandler* self = new (ELeave) CQueueHandler(aMsgQueue); |
40 CleanupStack::PushL(self); |
37 CleanupStack::PushL(self); |
41 self->ConstructL(aObserver, aBufferLen); |
38 self->ConstructL(aObserver, aBufferLen); |
42 CleanupStack::Pop(self); |
39 CleanupStack::Pop(self); |
47 // CQueueHandler::ConstructL |
44 // CQueueHandler::ConstructL |
48 // Second phase constructor. |
45 // Second phase constructor. |
49 // ---------------------------------------------------------------------------- |
46 // ---------------------------------------------------------------------------- |
50 // |
47 // |
51 void CQueueHandler::ConstructL(MQueueHandlerObserver* aObserver, |
48 void CQueueHandler::ConstructL(MQueueHandlerObserver* aObserver, |
52 TInt aBufferLen) |
49 TInt aBufferLen) |
53 { |
50 { |
54 iObserver = aObserver; |
51 iObserver = aObserver; |
55 |
52 |
56 // aBufferLen == 0 for MsgCom queue |
53 // aBufferLen == 0 for MsgCom queue |
57 if (aBufferLen > 0) |
54 if (aBufferLen > 0) |
77 // Constructor. |
74 // Constructor. |
78 // ---------------------------------------------------------------------------- |
75 // ---------------------------------------------------------------------------- |
79 // |
76 // |
80 CQueueHandler::CQueueHandler(RMsgQueue<TVoIPMsgBuf>* aMsgQueue) : |
77 CQueueHandler::CQueueHandler(RMsgQueue<TVoIPMsgBuf>* aMsgQueue) : |
81 CActive(CActive::EPriorityStandard), |
78 CActive(CActive::EPriorityStandard), |
82 // CActive(CActive::EPriorityHigh), |
|
83 iMsgQueue(aMsgQueue), |
79 iMsgQueue(aMsgQueue), |
84 iChunkDataPtr(0,0,0) |
80 iChunkDataPtr(0, 0, 0) |
85 { |
81 { |
86 CActiveScheduler::Add(this); |
82 CActiveScheduler::Add(this); |
87 } |
83 } |
88 |
84 |
89 // ---------------------------------------------------------------------------- |
85 // ---------------------------------------------------------------------------- |
129 switch (msgBuf.iRequest) |
126 switch (msgBuf.iRequest) |
130 { |
127 { |
131 case ECmdDownlinkInitComplete: |
128 case ECmdDownlinkInitComplete: |
132 { |
129 { |
133 iObserver->Event(MVoIPDownlinkObserver::KOpenComplete, |
130 iObserver->Event(MVoIPDownlinkObserver::KOpenComplete, |
134 msgBuf.iStatus); |
131 msgBuf.iStatus); |
135 break; |
132 break; |
136 } |
133 } |
137 case ECmdUplinkInitComplete: |
134 case ECmdUplinkInitComplete: |
138 { |
135 { |
139 iObserver->Event(MVoIPUplinkObserver::KOpenComplete, |
136 iObserver->Event(MVoIPUplinkObserver::KOpenComplete, |
140 msgBuf.iStatus); |
137 msgBuf.iStatus); |
141 break; |
138 break; |
142 } |
139 } |
143 case ECmdFillBuffer: |
140 case ECmdFillBuffer: |
144 { |
141 { |
145 DoFillBuffer(msgBuf.iInt, msgBuf.iStatus); |
142 DoFillBuffer(msgBuf.iInt, msgBuf.iStatus); |
152 } |
149 } |
153 case ECmdDownlinkThreadClosed: |
150 case ECmdDownlinkThreadClosed: |
154 { |
151 { |
155 iChunk.Close(); |
152 iChunk.Close(); |
156 iObserver->Event(MVoIPDownlinkObserver::KDownlinkClosed, |
153 iObserver->Event(MVoIPDownlinkObserver::KDownlinkClosed, |
157 msgBuf.iStatus); |
154 msgBuf.iStatus); |
158 break; |
155 break; |
159 } |
156 } |
160 case ECmdUplinkThreadClosed: |
157 case ECmdUplinkThreadClosed: |
161 { |
158 { |
162 iChunk.Close(); |
159 iChunk.Close(); |
163 iObserver->Event(MVoIPUplinkObserver::KUplinkClosed, |
160 iObserver->Event(MVoIPUplinkObserver::KUplinkClosed, |
164 msgBuf.iStatus); |
161 msgBuf.iStatus); |
165 break; |
162 break; |
166 } |
163 } |
167 case ECmdRingToneOpenComplete: |
164 case ECmdRingToneOpenComplete: |
168 { |
165 { |
169 iObserver->Event(MRingToneObserver::KOpenComplete, |
166 iObserver->Event(MRingToneObserver::KOpenComplete, |
170 msgBuf.iStatus); |
167 msgBuf.iStatus); |
171 break; |
168 break; |
172 } |
169 } |
173 case ECmdRingTonePlayComplete: |
170 case ECmdRingTonePlayComplete: |
174 { |
171 { |
175 iObserver->Event(MRingToneObserver::KPlaybackComplete, |
172 iObserver->Event(MRingToneObserver::KPlaybackComplete, |
176 msgBuf.iStatus); |
173 msgBuf.iStatus); |
177 break; |
174 break; |
178 } |
175 } |
179 case ECmdDnLinkError: |
176 case ECmdDnLinkError: |
180 case ECmdDnLinkJBError: |
177 case ECmdDnLinkJBError: |
181 { |
178 { |
182 iObserver->Event(MVoIPDownlinkObserver::KDownlinkError, |
179 iObserver->Event(MVoIPDownlinkObserver::KDownlinkError, |
183 msgBuf.iStatus); |
180 msgBuf.iStatus); |
184 break; |
181 break; |
185 } |
182 } |
186 case ECmdUpLinkError: |
183 case ECmdUpLinkError: |
187 { |
184 { |
188 iObserver->Event(MVoIPUplinkObserver::KUplinkError, |
185 iObserver->Event(MVoIPUplinkObserver::KUplinkError, |
189 msgBuf.iStatus); |
186 msgBuf.iStatus); |
190 break; |
187 break; |
191 } |
188 } |
192 case ECmdDTMFOpenDnlinkComplete: |
189 case ECmdDTMFOpenDnlinkComplete: |
193 { |
190 { |
194 iObserver->Event(MDTMFToneObserver::KOpenCompleteDNL, |
191 iObserver->Event(MDTMFToneObserver::KOpenCompleteDNL, |
195 msgBuf.iStatus); |
192 msgBuf.iStatus); |
196 break; |
193 break; |
197 } |
194 } |
198 case ECmdDTMFOpenUplinkComplete: |
195 case ECmdDTMFOpenUplinkComplete: |
199 { |
196 { |
200 iObserver->Event(MDTMFToneObserver::KOpenCompleteUPL, |
197 iObserver->Event(MDTMFToneObserver::KOpenCompleteUPL, |
201 msgBuf.iStatus); |
198 msgBuf.iStatus); |
202 break; |
199 break; |
203 } |
200 } |
204 case ECmdDTMFTonePlayFinished: |
201 case ECmdDTMFTonePlayFinished: |
205 { |
202 { |
206 TRACE_PRN_N1(_L("VoIP->TonePlayFinished [%d]"), msgBuf.iStatus); |
203 TRACE_PRN_N1(_L("VoIP->TonePlayFinished [%d]"), msgBuf.iStatus); |