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