18 |
18 |
19 #include <CustomInterfaceUtility.h> |
19 #include <CustomInterfaceUtility.h> |
20 #include "RadioServerData.h" |
20 #include "RadioServerData.h" |
21 #include "RadioPlayerUtilityBody.h" |
21 #include "RadioPlayerUtilityBody.h" |
22 #include "RadioSession.h" |
22 #include "RadioSession.h" |
23 #include "trace.h" |
|
24 |
23 |
25 // ======== MEMBER FUNCTIONS ======== |
24 // ======== MEMBER FUNCTIONS ======== |
26 |
25 |
27 // ----------------------------------------------------------------------------- |
26 // ----------------------------------------------------------------------------- |
28 // CRadioPlayerUtility::CBody::NewL |
27 // CRadioPlayerUtility::CBody::NewL |
32 |
31 |
33 CRadioPlayerUtility::CBody* CRadioPlayerUtility::CBody::NewL( |
32 CRadioPlayerUtility::CBody* CRadioPlayerUtility::CBody::NewL( |
34 RRadioSession& aRadioSession, |
33 RRadioSession& aRadioSession, |
35 MRadioPlayerObserver& aObserver ) |
34 MRadioPlayerObserver& aObserver ) |
36 { |
35 { |
37 FUNC_LOG; |
36 CRadioPlayerUtility::CBody* s = new(ELeave) CRadioPlayerUtility::CBody(); |
38 CRadioPlayerUtility::CBody* s = new(ELeave) CRadioPlayerUtility::CBody( aRadioSession, aObserver ); |
37 s->iRadioPlayerUtilityClient = &aObserver; |
|
38 s->iRadioSession = &aRadioSession; |
39 CleanupStack::PushL(s); |
39 CleanupStack::PushL(s); |
40 s->ConstructL(); |
40 s->ConstructL(); |
41 CleanupStack::Pop(); |
41 CleanupStack::Pop(); |
42 return s; |
42 return s; |
43 } |
43 } |
47 // Two-phased constructor. |
47 // Two-phased constructor. |
48 // ----------------------------------------------------------------------------- |
48 // ----------------------------------------------------------------------------- |
49 // |
49 // |
50 void CRadioPlayerUtility::CBody::ConstructL() |
50 void CRadioPlayerUtility::CBody::ConstructL() |
51 { |
51 { |
52 FUNC_LOG; |
|
53 } |
52 } |
54 |
53 |
55 // ----------------------------------------------------------------------------- |
54 // ----------------------------------------------------------------------------- |
56 // CRadioPlayerUtility::CBody::CBody |
55 // CRadioPlayerUtility::CBody::CBody |
57 // ----------------------------------------------------------------------------- |
56 // ----------------------------------------------------------------------------- |
58 // |
57 // |
59 CRadioPlayerUtility::CBody::CBody( |
58 CRadioPlayerUtility::CBody::CBody() |
60 RRadioSession& aRadioSession, |
59 { |
61 MRadioPlayerObserver& aObserver ) |
|
62 :iRadioSession(aRadioSession), |
|
63 iRadioPlayerUtilityClient(aObserver) |
|
64 { |
|
65 FUNC_LOG; |
|
66 } |
60 } |
67 |
61 |
68 // ----------------------------------------------------------------------------- |
62 // ----------------------------------------------------------------------------- |
69 // Destructor. |
63 // Destructor. |
70 // ----------------------------------------------------------------------------- |
64 // ----------------------------------------------------------------------------- |
71 // |
65 // |
72 CRadioPlayerUtility::CBody::~CBody() |
66 CRadioPlayerUtility::CBody::~CBody() |
73 { |
67 { |
74 FUNC_LOG; |
|
75 } |
68 } |
76 |
69 |
77 // ----------------------------------------------------------------------------- |
70 // ----------------------------------------------------------------------------- |
78 // CRadioPlayerUtility::CBody::PlayerState |
71 // CRadioPlayerUtility::CBody::PlayerState |
79 // Get the player's state. |
72 // Get the player's state. |
104 // (other items were commented in a header). |
96 // (other items were commented in a header). |
105 // ----------------------------------------------------------------------------- |
97 // ----------------------------------------------------------------------------- |
106 // |
98 // |
107 void CRadioPlayerUtility::CBody::Close() |
99 void CRadioPlayerUtility::CBody::Close() |
108 { |
100 { |
109 FUNC_LOG; |
101 iRadioSession->Stop( ETrue ); |
110 iRadioSession.Stop( ETrue ); |
|
111 } |
102 } |
112 |
103 |
113 // ----------------------------------------------------------------------------- |
104 // ----------------------------------------------------------------------------- |
114 // CRadioPlayerUtility::CBody::Play |
105 // CRadioPlayerUtility::CBody::Play |
115 // (other items were commented in a header). |
106 // (other items were commented in a header). |
116 // ----------------------------------------------------------------------------- |
107 // ----------------------------------------------------------------------------- |
117 // |
108 // |
118 void CRadioPlayerUtility::CBody::Play() |
109 void CRadioPlayerUtility::CBody::Play() |
119 { |
110 { |
120 FUNC_LOG; |
111 iRadioSession->Play(); |
121 iRadioSession.Play(); |
|
122 } |
112 } |
123 |
113 |
124 // ----------------------------------------------------------------------------- |
114 // ----------------------------------------------------------------------------- |
125 // CRadioPlayerUtility::CBody::Stop |
115 // CRadioPlayerUtility::CBody::Stop |
126 // (other items were commented in a header). |
116 // (other items were commented in a header). |
127 // ----------------------------------------------------------------------------- |
117 // ----------------------------------------------------------------------------- |
128 // |
118 // |
129 void CRadioPlayerUtility::CBody::Stop() |
119 void CRadioPlayerUtility::CBody::Stop() |
130 { |
120 { |
131 FUNC_LOG; |
121 iRadioSession->Stop(); |
132 iRadioSession.Stop(); |
|
133 } |
122 } |
134 |
123 |
135 // ----------------------------------------------------------------------------- |
124 // ----------------------------------------------------------------------------- |
136 // CRadioPlayerUtility::CBody::Mute |
125 // CRadioPlayerUtility::CBody::Mute |
137 // (other items were commented in a header). |
126 // (other items were commented in a header). |
138 // ----------------------------------------------------------------------------- |
127 // ----------------------------------------------------------------------------- |
139 // |
128 // |
140 TInt CRadioPlayerUtility::CBody::Mute( |
129 TInt CRadioPlayerUtility::CBody::Mute( |
141 TBool aMute ) |
130 TBool aMute ) |
142 { |
131 { |
143 FUNC_LOG; |
132 return iRadioSession->Mute( aMute ); |
144 return iRadioSession.Mute( aMute ); |
|
145 } |
133 } |
146 |
134 |
147 // ----------------------------------------------------------------------------- |
135 // ----------------------------------------------------------------------------- |
148 // CRadioPlayerUtility::CBody::IsMute |
136 // CRadioPlayerUtility::CBody::IsMute |
149 // (other items were commented in a header). |
137 // (other items were commented in a header). |
150 // ----------------------------------------------------------------------------- |
138 // ----------------------------------------------------------------------------- |
151 // |
139 // |
152 TBool CRadioPlayerUtility::CBody::IsMute() |
140 TBool CRadioPlayerUtility::CBody::IsMute() |
153 { |
141 { |
154 FUNC_LOG; |
|
155 TBool Mute = EFalse; |
142 TBool Mute = EFalse; |
156 iRadioSession.GetMuteStatus( Mute ); |
143 iRadioSession->GetMuteStatus( Mute ); |
157 return Mute; |
144 return Mute; |
158 } |
145 } |
159 |
146 |
160 // ----------------------------------------------------------------------------- |
147 // ----------------------------------------------------------------------------- |
161 // CRadioPlayerUtility::CBody::SetVolume |
148 // CRadioPlayerUtility::CBody::SetVolume |
163 // ----------------------------------------------------------------------------- |
150 // ----------------------------------------------------------------------------- |
164 // |
151 // |
165 TInt CRadioPlayerUtility::CBody::SetVolume( |
152 TInt CRadioPlayerUtility::CBody::SetVolume( |
166 TInt aVolume ) |
153 TInt aVolume ) |
167 { |
154 { |
168 FUNC_LOG; |
155 return iRadioSession->SetVolume( aVolume ); |
169 return iRadioSession.SetVolume( aVolume ); |
|
170 } |
156 } |
171 |
157 |
172 // ----------------------------------------------------------------------------- |
158 // ----------------------------------------------------------------------------- |
173 // CRadioPlayerUtility::CBody::GetVolume |
159 // CRadioPlayerUtility::CBody::GetVolume |
174 // (other items were commented in a header). |
160 // (other items were commented in a header). |
175 // ----------------------------------------------------------------------------- |
161 // ----------------------------------------------------------------------------- |
176 // |
162 // |
177 TInt CRadioPlayerUtility::CBody::GetVolume( |
163 TInt CRadioPlayerUtility::CBody::GetVolume( |
178 TInt& aVolume ) const |
164 TInt& aVolume ) const |
179 { |
165 { |
180 FUNC_LOG; |
166 return iRadioSession->GetVolume( aVolume ); |
181 return iRadioSession.GetVolume( aVolume ); |
|
182 } |
167 } |
183 |
168 |
184 // ----------------------------------------------------------------------------- |
169 // ----------------------------------------------------------------------------- |
185 // CRadioPlayerUtility::CBody::SetVolumeRamp |
170 // CRadioPlayerUtility::CBody::SetVolumeRamp |
186 // (other items were commented in a header). |
171 // (other items were commented in a header). |
187 // ----------------------------------------------------------------------------- |
172 // ----------------------------------------------------------------------------- |
188 // |
173 // |
189 TInt CRadioPlayerUtility::CBody::SetVolumeRamp( |
174 TInt CRadioPlayerUtility::CBody::SetVolumeRamp( |
190 const TTimeIntervalMicroSeconds& aRampInterval ) |
175 const TTimeIntervalMicroSeconds& aRampInterval ) |
191 { |
176 { |
192 FUNC_LOG; |
177 #ifdef _DEBUG |
193 return iRadioSession.SetVolumeRamp( aRampInterval ); |
178 RDebug::Print(_L("CRadioPlayerUtility::CBody::SetVolumeRamp")); |
|
179 #endif |
|
180 return iRadioSession->SetVolumeRamp( aRampInterval ); |
194 } |
181 } |
195 |
182 |
196 // ----------------------------------------------------------------------------- |
183 // ----------------------------------------------------------------------------- |
197 // CRadioPlayerUtility::CBody::GetMaxVolume |
184 // CRadioPlayerUtility::CBody::GetMaxVolume |
198 // (other items were commented in a header). |
185 // (other items were commented in a header). |
199 // ----------------------------------------------------------------------------- |
186 // ----------------------------------------------------------------------------- |
200 // |
187 // |
201 TInt CRadioPlayerUtility::CBody::GetMaxVolume( |
188 TInt CRadioPlayerUtility::CBody::GetMaxVolume( |
202 TInt& aMaxVolume ) const |
189 TInt& aMaxVolume ) const |
203 { |
190 { |
204 FUNC_LOG; |
191 return iRadioSession->GetMaxVolume( aMaxVolume ); |
205 return iRadioSession.GetMaxVolume( aMaxVolume ); |
|
206 } |
192 } |
207 |
193 |
208 // ----------------------------------------------------------------------------- |
194 // ----------------------------------------------------------------------------- |
209 // CRadioPlayerUtility::CBody::SetBalance |
195 // CRadioPlayerUtility::CBody::SetBalance |
210 // (other items were commented in a header). |
196 // (other items were commented in a header). |
212 // |
198 // |
213 TInt CRadioPlayerUtility::CBody::SetBalance( |
199 TInt CRadioPlayerUtility::CBody::SetBalance( |
214 TInt aLeftPercentage, |
200 TInt aLeftPercentage, |
215 TInt aRightPercentage ) |
201 TInt aRightPercentage ) |
216 { |
202 { |
217 FUNC_LOG; |
203 #ifdef _DEBUG |
218 INFO_2("aLeftPercentage = %d, aRightPercentage = %d", aLeftPercentage, aRightPercentage); |
204 RDebug::Print(_L("CRadioPlayerUtility::CBody::SetBalance, aLeftPercentage = %d, aRightPercentage = %d"), |
219 return iRadioSession.SetBalance( aLeftPercentage, aRightPercentage ); |
205 aLeftPercentage, aRightPercentage); |
|
206 #endif |
|
207 return iRadioSession->SetBalance( aLeftPercentage, aRightPercentage ); |
220 } |
208 } |
221 |
209 |
222 // ----------------------------------------------------------------------------- |
210 // ----------------------------------------------------------------------------- |
223 // CRadioPlayerUtility::CBody::GetBalance |
211 // CRadioPlayerUtility::CBody::GetBalance |
224 // (other items were commented in a header). |
212 // (other items were commented in a header). |
226 // |
214 // |
227 TInt CRadioPlayerUtility::CBody::GetBalance( |
215 TInt CRadioPlayerUtility::CBody::GetBalance( |
228 TInt& aLeftPercentage, |
216 TInt& aLeftPercentage, |
229 TInt& aRightPercentage ) const |
217 TInt& aRightPercentage ) const |
230 { |
218 { |
231 FUNC_LOG; |
219 return iRadioSession->GetBalance( aLeftPercentage, aRightPercentage ); |
232 return iRadioSession.GetBalance( aLeftPercentage, aRightPercentage ); |
|
233 } |
220 } |
234 |
221 |
235 // ----------------------------------------------------------------------------- |
222 // ----------------------------------------------------------------------------- |
236 // CRadioPlayerUtility::CBody::CustomInterface |
223 // CRadioPlayerUtility::CBody::CustomInterface |
237 // Get a custom interface for the specified interface Id. |
224 // Get a custom interface for the specified interface Id. |
239 // ----------------------------------------------------------------------------- |
226 // ----------------------------------------------------------------------------- |
240 // |
227 // |
241 TAny* CRadioPlayerUtility::CBody::CustomInterface( |
228 TAny* CRadioPlayerUtility::CBody::CustomInterface( |
242 TUid aInterfaceId ) |
229 TUid aInterfaceId ) |
243 { |
230 { |
244 FUNC_LOG; |
231 #ifdef _DEBUG |
245 INFO_1("aInterfaceId = %d", aInterfaceId); |
232 RDebug::Print(_L("CRadioPlayerUtility::CBody::CustomInterface, aInterfaceId = %d"), aInterfaceId); |
|
233 #endif |
246 TAny* ci = NULL; |
234 TAny* ci = NULL; |
247 CCustomInterfaceUtility* customInterfaceUtil = NULL; |
235 CCustomInterfaceUtility* customInterfaceUtil = NULL; |
248 |
236 |
249 TRAPD( error, customInterfaceUtil = CCustomInterfaceUtility::NewL( iRadioSession ) ); |
237 TRAPD( error, customInterfaceUtil = CCustomInterfaceUtility::NewL( *iRadioSession ) ); |
250 |
238 |
251 if ( !error ) |
239 if ( !error ) |
252 { |
240 { |
253 ci = customInterfaceUtil->CustomInterface( aInterfaceId ); |
241 ci = customInterfaceUtil->CustomInterface( aInterfaceId ); |
254 if ( !ci ) |
242 if ( !ci ) |