14 * Description: Telephony Multimedia Service |
14 * Description: Telephony Multimedia Service |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include <AudioPreference.h> |
18 #include <AudioPreference.h> |
|
19 #include "tmsutility.h" |
19 #include "tmscsuplink.h" |
20 #include "tmscsuplink.h" |
20 #include "tmscsdevsoundobserver.h" |
21 #include "tmscsdevsoundobserver.h" |
21 |
22 |
22 using namespace TMS; |
23 using namespace TMS; |
23 |
24 |
24 // Mute value |
25 // ----------------------------------------------------------------------------- |
25 const gint KSetMuteToDevSound = 0; |
26 // Constructor |
|
27 // ----------------------------------------------------------------------------- |
|
28 // |
|
29 TMSCSUplink::TMSCSUplink(TMSCSDevSoundObserver& observer) : |
|
30 TMSCSDevSound(observer) |
|
31 { |
|
32 } |
26 |
33 |
27 // ----------------------------------------------------------------------------- |
34 // ----------------------------------------------------------------------------- |
28 // Static constructor. |
35 // Second phase constructor |
29 // ----------------------------------------------------------------------------- |
36 // ----------------------------------------------------------------------------- |
30 // |
37 // |
31 TMSCSUplink* TMSCSUplink::NewL(TMSCSPDevSoundObserver& aObserver) |
38 void TMSCSUplink::ConstructL(const gint retrytime) |
32 { |
39 { |
33 TMSCSUplink* self = new (ELeave) TMSCSUplink(aObserver); |
40 TMSCSDevSound::ConstructL(TMS_STREAM_UPLINK, retrytime); |
|
41 } |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // Static constructor |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 TMSCSUplink* TMSCSUplink::NewL(TMSCSDevSoundObserver& observer, |
|
48 const gint retrytime) |
|
49 { |
|
50 TMSCSUplink* self = new (ELeave) TMSCSUplink(observer); |
34 CleanupStack::PushL(self); |
51 CleanupStack::PushL(self); |
35 self->ConstructL(); |
52 self->ConstructL(retrytime); |
36 CleanupStack::Pop(self); |
53 CleanupStack::Pop(self); |
37 return self; |
54 return self; |
38 } |
55 } |
39 |
56 |
40 // ----------------------------------------------------------------------------- |
57 // ----------------------------------------------------------------------------- |
47 |
64 |
48 // ----------------------------------------------------------------------------- |
65 // ----------------------------------------------------------------------------- |
49 // Gives mic mute state |
66 // Gives mic mute state |
50 // ----------------------------------------------------------------------------- |
67 // ----------------------------------------------------------------------------- |
51 // |
68 // |
52 TBool TMSCSUplink::IsMuted() |
69 gboolean TMSCSUplink::IsMuted() |
53 { |
70 { |
54 TBool isMuted = EFalse; |
71 gint gain(0); |
55 gint gain = 0; |
72 |
56 if (iDevSound) |
73 if (iDevSound) |
57 { |
74 { |
58 gain = iDevSound->Gain(); |
75 gain = iDevSound->Gain(); |
59 } |
76 } |
60 if (!gain) |
77 return ((!gain)? TRUE : FALSE); |
61 { |
|
62 // Mute is on |
|
63 isMuted = ETrue; |
|
64 } |
|
65 // CSPLOGSTRING( CSPINT, "TMSCSUplink::IsMuted" ); |
|
66 return isMuted; |
|
67 } |
78 } |
68 |
79 |
69 // ----------------------------------------------------------------------------- |
80 // ----------------------------------------------------------------------------- |
70 // Set mic muted. |
81 // Sets mic gain |
71 // ----------------------------------------------------------------------------- |
82 // ----------------------------------------------------------------------------- |
72 // |
83 // |
73 void TMSCSUplink::SetMuted() |
84 void TMSCSUplink::SetGain(gint gain) |
74 { |
85 { |
75 if (iDevSound) |
86 if (iDevSound) |
76 { |
87 { |
77 iDevSound->SetGain(KSetMuteToDevSound); |
88 iDevSound->SetGain(gain); |
78 } |
89 } |
79 } |
90 } |
80 |
91 |
81 // ----------------------------------------------------------------------------- |
92 // ----------------------------------------------------------------------------- |
82 // Set mic unmuted |
93 // Returns mic gain |
83 // ----------------------------------------------------------------------------- |
|
84 // |
|
85 void TMSCSUplink::SetUnmuted() |
|
86 { |
|
87 if (iDevSound) |
|
88 { |
|
89 iDevSound->SetGain(iDevSound->MaxGain()); |
|
90 } |
|
91 } |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // Sets gain |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 void TMSCSUplink::SetGain(gint aGain) |
|
98 { |
|
99 if (iDevSound) |
|
100 { |
|
101 iDevSound->SetGain(aGain); |
|
102 } |
|
103 } |
|
104 |
|
105 // ----------------------------------------------------------------------------- |
|
106 // Gives volume |
|
107 // ----------------------------------------------------------------------------- |
94 // ----------------------------------------------------------------------------- |
108 // |
95 // |
109 gint TMSCSUplink::Gain() |
96 gint TMSCSUplink::Gain() |
110 { |
97 { |
111 gint gain = 0; |
98 gint gain = 0; |
130 return gain; |
117 return gain; |
131 } |
118 } |
132 |
119 |
133 // ----------------------------------------------------------------------------- |
120 // ----------------------------------------------------------------------------- |
134 // From class MDevSoundObserver |
121 // From class MDevSoundObserver |
135 // Activation was successfull. |
122 // Uplink stream has been activated successfully. |
136 // ----------------------------------------------------------------------------- |
123 // ----------------------------------------------------------------------------- |
137 // |
124 // |
138 void TMSCSUplink::BufferToBeEmptied(CMMFBuffer* /*aBuffer*/) |
125 void TMSCSUplink::BufferToBeEmptied(CMMFBuffer* /*aBuffer*/) |
139 { |
126 { |
140 // CSPLOGSTRING( CSPINT, "TMSCSUplink::BufferToBeEmptied" ); |
127 TRACE_PRN_N(_L("TMSCSUplink::BufferToBeEmptied")); |
141 |
128 |
142 // We dont react to devsound messages unless we are activating. |
129 // We dont react to devsound messages unless we are activating. |
143 if (IsActivationOngoing()) |
130 if (iActivationOngoing) |
144 { |
131 { |
145 iActive = ETrue; |
132 iActive = ETrue; |
146 iActivationOngoing = EFalse; |
133 iActivationOngoing = EFalse; |
147 iObserver.UplinkActivatedSuccessfully(); |
134 iObserver.UplinkActivationCompleted(KErrNone); |
148 } |
135 } |
149 } |
136 } |
150 |
137 |
151 // ----------------------------------------------------------------------------- |
138 // ----------------------------------------------------------------------------- |
152 // From class MDevSoundObserver |
139 // From class MDevSoundObserver |
153 // Activation feiled |
140 // Uplink stream activation failed |
154 // ----------------------------------------------------------------------------- |
141 // ----------------------------------------------------------------------------- |
155 // |
142 // |
156 void TMSCSUplink::RecordError(TInt aError) |
143 void TMSCSUplink::RecordError(TInt aError) |
157 { |
144 { |
158 // CSPLOGSTRING( CSPINT, "TMSCSUplink::RecordError" ); |
145 TRACE_PRN_N1(_L("TMSCSUplink::RecordError[%d]"), aError); |
159 |
146 |
160 // We dont react to devsound messages unless we are activating. |
147 // We dont react to devsound messages unless we are activating. |
161 if (IsActivationOngoing()) |
148 if (iActivationOngoing && aError == KErrAccessDenied) |
162 { |
149 { |
163 if (aError == KErrAccessDenied) |
150 if (iStartRetryTime != 0) |
164 { |
151 { |
|
152 StartTimer(); |
|
153 } |
|
154 else |
|
155 { |
|
156 CancelTimer(); |
165 iActivationOngoing = EFalse; |
157 iActivationOngoing = EFalse; |
166 iObserver.UplinkActivationFailed(); |
158 iObserver.UplinkActivationCompleted(aError); |
167 } |
159 } |
168 } |
160 } |
169 } |
161 } |
170 |
162 |
171 // ----------------------------------------------------------------------------- |
163 // ----------------------------------------------------------------------------- |
172 // From class TMSCSPDevSound |
164 // From class TMSCSDevSound |
173 // Tries to activate mic stream. Stream becomes active when BufferToBeFilled |
165 // Activates Uplink stream. |
174 // gets called. |
|
175 // ----------------------------------------------------------------------------- |
166 // ----------------------------------------------------------------------------- |
176 // |
167 // |
177 void TMSCSUplink::DoActivateL() |
168 void TMSCSUplink::DoActivateL() |
178 { |
169 { |
179 if (iDevSound) |
170 if (iDevSound) |
180 { |
171 { |
181 iDevSound->RecordInitL(); |
172 iDevSound->RecordInitL(); |
182 } |
173 } |
183 } |
174 } |
184 |
175 |
185 // ----------------------------------------------------------------------------- |
|
186 // Constructor |
|
187 // ----------------------------------------------------------------------------- |
|
188 // |
|
189 TMSCSUplink::TMSCSUplink(TMSCSPDevSoundObserver& aObserver) : |
|
190 TMSCSPDevSound(aObserver) |
|
191 { |
|
192 } |
|
193 |
|
194 // ----------------------------------------------------------------------------- |
|
195 // Second phase constructor |
|
196 // ----------------------------------------------------------------------------- |
|
197 // |
|
198 void TMSCSUplink::ConstructL() |
|
199 { |
|
200 TMSCSPDevSound::ConstructL(EMMFStateRecording, KAudioPrefCSCallUplink, |
|
201 KAudioPriorityCSCallUplink); |
|
202 } |
|
203 |
|
204 // End of File |
176 // End of File |