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