38
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Radio Player Utility body's stub implementation
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include <custominterfaceutility.h>
|
|
20 |
#include "RadioServerData.h"
|
|
21 |
#include "RadioPlayerUtilityBody.h"
|
|
22 |
#include "RadioSession.h"
|
|
23 |
#include "RadioStubManager.h"
|
|
24 |
|
|
25 |
#define STUB CRadioStubManager::GetRadioStubManager()->iPlayer
|
|
26 |
|
|
27 |
// ======== MEMBER FUNCTIONS ========
|
|
28 |
|
|
29 |
// -----------------------------------------------------------------------------
|
|
30 |
// CRadioPlayerUtility::CBody::NewL
|
|
31 |
// Two-phased constructor.
|
|
32 |
// -----------------------------------------------------------------------------
|
|
33 |
//
|
|
34 |
|
|
35 |
CRadioPlayerUtility::CBody* CRadioPlayerUtility::CBody::NewL(
|
|
36 |
RRadioSession& aRadioSession,
|
|
37 |
MRadioPlayerObserver& aObserver )
|
|
38 |
{
|
|
39 |
if ( STUB.iLeaveNewL.iError )
|
|
40 |
{
|
|
41 |
User::Leave( STUB.iLeaveNewL.iError );
|
|
42 |
}
|
|
43 |
CRadioPlayerUtility::CBody* s = new(ELeave) CRadioPlayerUtility::CBody( aRadioSession, aObserver);
|
|
44 |
CleanupStack::PushL(s);
|
|
45 |
s->ConstructL();
|
|
46 |
CleanupStack::Pop();
|
|
47 |
return s;
|
|
48 |
}
|
|
49 |
|
|
50 |
// -----------------------------------------------------------------------------
|
|
51 |
// CRadioPlayerUtility::ConstructL
|
|
52 |
// Two-phased constructor.
|
|
53 |
// -----------------------------------------------------------------------------
|
|
54 |
//
|
|
55 |
void CRadioPlayerUtility::CBody::ConstructL()
|
|
56 |
{
|
|
57 |
if ( STUB.iLeaveErrorForConstructL.iError )
|
|
58 |
{
|
|
59 |
User::Leave( STUB.iLeaveErrorForConstructL.iError );
|
|
60 |
}
|
|
61 |
STUB.iRadioPlayerUtilityClient = &iRadioPlayerUtilityClient;
|
|
62 |
}
|
|
63 |
|
|
64 |
// -----------------------------------------------------------------------------
|
|
65 |
// CRadioPlayerUtility::CBody::CBody
|
|
66 |
// -----------------------------------------------------------------------------
|
|
67 |
//
|
|
68 |
CRadioPlayerUtility::CBody::CBody(
|
|
69 |
RRadioSession& aRadioSession,
|
|
70 |
MRadioPlayerObserver& aObserver )
|
|
71 |
:iRadioSession( aRadioSession ),
|
|
72 |
iRadioPlayerUtilityClient( aObserver )
|
|
73 |
{
|
|
74 |
}
|
|
75 |
|
|
76 |
// -----------------------------------------------------------------------------
|
|
77 |
// Destructor.
|
|
78 |
// -----------------------------------------------------------------------------
|
|
79 |
//
|
|
80 |
CRadioPlayerUtility::CBody::~CBody()
|
|
81 |
{
|
|
82 |
}
|
|
83 |
|
|
84 |
// -----------------------------------------------------------------------------
|
|
85 |
// CRadioPlayerUtility::CBody::PlayerState
|
|
86 |
// Get the player's state.
|
|
87 |
// (other items were commented in a header).
|
|
88 |
// -----------------------------------------------------------------------------
|
|
89 |
//
|
|
90 |
//
|
|
91 |
void CRadioPlayerUtility::CBody::PlayerState(
|
|
92 |
TPlayerState& aPlayerState ) const
|
|
93 |
{
|
|
94 |
aPlayerState = STUB.iPlayerState;
|
|
95 |
}
|
|
96 |
|
|
97 |
// -----------------------------------------------------------------------------
|
|
98 |
// CRadioPlayerUtility::CBody::Close
|
|
99 |
// Stops radio playback only if no other primary clients are connected to the
|
|
100 |
// radio server.
|
|
101 |
// (other items were commented in a header).
|
|
102 |
// -----------------------------------------------------------------------------
|
|
103 |
//
|
|
104 |
void CRadioPlayerUtility::CBody::Close()
|
|
105 |
{
|
|
106 |
}
|
|
107 |
|
|
108 |
// -----------------------------------------------------------------------------
|
|
109 |
// CRadioPlayerUtility::CBody::Play
|
|
110 |
// (other items were commented in a header).
|
|
111 |
// -----------------------------------------------------------------------------
|
|
112 |
//
|
|
113 |
void CRadioPlayerUtility::CBody::Play()
|
|
114 |
{
|
|
115 |
STUB.iPlayerState = ERadioPlayerPlaying;
|
|
116 |
}
|
|
117 |
|
|
118 |
// -----------------------------------------------------------------------------
|
|
119 |
// CRadioPlayerUtility::CBody::Stop
|
|
120 |
// (other items were commented in a header).
|
|
121 |
// -----------------------------------------------------------------------------
|
|
122 |
//
|
|
123 |
void CRadioPlayerUtility::CBody::Stop()
|
|
124 |
{
|
|
125 |
STUB.iPlayerState = ERadioPlayerIdle;
|
|
126 |
}
|
|
127 |
|
|
128 |
// -----------------------------------------------------------------------------
|
|
129 |
// CRadioPlayerUtility::CBody::Mute
|
|
130 |
// (other items were commented in a header).
|
|
131 |
// -----------------------------------------------------------------------------
|
|
132 |
//
|
|
133 |
TInt CRadioPlayerUtility::CBody::Mute(
|
|
134 |
TBool aMute )
|
|
135 |
{
|
|
136 |
STUB.iMuteStatus = aMute;
|
|
137 |
return STUB.iMuteError.Error();
|
|
138 |
}
|
|
139 |
|
|
140 |
// -----------------------------------------------------------------------------
|
|
141 |
// CRadioPlayerUtility::CBody::IsMute
|
|
142 |
// (other items were commented in a header).
|
|
143 |
// -----------------------------------------------------------------------------
|
|
144 |
//
|
|
145 |
TBool CRadioPlayerUtility::CBody::IsMute()
|
|
146 |
{
|
|
147 |
return STUB.iMuteStatus;
|
|
148 |
}
|
|
149 |
|
|
150 |
// -----------------------------------------------------------------------------
|
|
151 |
// CRadioPlayerUtility::CBody::SetVolume
|
|
152 |
// (other items were commented in a header).
|
|
153 |
// -----------------------------------------------------------------------------
|
|
154 |
//
|
|
155 |
TInt CRadioPlayerUtility::CBody::SetVolume(
|
|
156 |
TInt aVolume )
|
|
157 |
{
|
|
158 |
STUB.iVolume = aVolume;
|
|
159 |
return STUB.iSetVolumeError.Error();
|
|
160 |
}
|
|
161 |
|
|
162 |
// -----------------------------------------------------------------------------
|
|
163 |
// CRadioPlayerUtility::CBody::GetVolume
|
|
164 |
// (other items were commented in a header).
|
|
165 |
// -----------------------------------------------------------------------------
|
|
166 |
//
|
|
167 |
TInt CRadioPlayerUtility::CBody::GetVolume(
|
|
168 |
TInt& aVolume ) const
|
|
169 |
{
|
|
170 |
aVolume = STUB.iVolume;
|
|
171 |
return STUB.iGetVolumeError.Error();
|
|
172 |
}
|
|
173 |
|
|
174 |
// -----------------------------------------------------------------------------
|
|
175 |
// CRadioPlayerUtility::CBody::SetVolumeRamp
|
|
176 |
// (other items were commented in a header).
|
|
177 |
// -----------------------------------------------------------------------------
|
|
178 |
//
|
|
179 |
TInt CRadioPlayerUtility::CBody::SetVolumeRamp(
|
|
180 |
const TTimeIntervalMicroSeconds& aRampInterval )
|
|
181 |
{
|
|
182 |
#ifdef _DEBUG
|
|
183 |
RDebug::Print(_L("CRadioPlayerUtility::CBody::SetVolumeRamp"));
|
|
184 |
#endif
|
|
185 |
STUB.iRampInterval = aRampInterval;
|
|
186 |
return STUB.iSetVolumeRampError.Error();
|
|
187 |
}
|
|
188 |
|
|
189 |
// -----------------------------------------------------------------------------
|
|
190 |
// CRadioPlayerUtility::CBody::GetMaxVolume
|
|
191 |
// (other items were commented in a header).
|
|
192 |
// -----------------------------------------------------------------------------
|
|
193 |
//
|
|
194 |
TInt CRadioPlayerUtility::CBody::GetMaxVolume(
|
|
195 |
TInt& aMaxVolume ) const
|
|
196 |
{
|
|
197 |
aMaxVolume = STUB.iMaxVolume;
|
|
198 |
return STUB.iGetMaxVolumeError.Error();
|
|
199 |
}
|
|
200 |
|
|
201 |
// -----------------------------------------------------------------------------
|
|
202 |
// CRadioPlayerUtility::CBody::SetBalance
|
|
203 |
// (other items were commented in a header).
|
|
204 |
// -----------------------------------------------------------------------------
|
|
205 |
//
|
|
206 |
TInt CRadioPlayerUtility::CBody::SetBalance(
|
|
207 |
TInt aLeftPercentage,
|
|
208 |
TInt aRightPercentage )
|
|
209 |
{
|
|
210 |
#ifdef _DEBUG
|
|
211 |
RDebug::Print(_L("CRadioPlayerUtility::CBody::SetBalance, aLeftPercentage = %d, aRightPercentage = %d"),
|
|
212 |
aLeftPercentage, aRightPercentage);
|
|
213 |
#endif
|
|
214 |
STUB.iLeftPercentage = aLeftPercentage;
|
|
215 |
STUB.iRightPercentage = aRightPercentage;
|
|
216 |
return STUB.iSetBalanceError.Error();
|
|
217 |
}
|
|
218 |
|
|
219 |
// -----------------------------------------------------------------------------
|
|
220 |
// CRadioPlayerUtility::CBody::GetBalance
|
|
221 |
// (other items were commented in a header).
|
|
222 |
// -----------------------------------------------------------------------------
|
|
223 |
//
|
|
224 |
TInt CRadioPlayerUtility::CBody::GetBalance(
|
|
225 |
TInt& aLeftPercentage,
|
|
226 |
TInt& aRightPercentage ) const
|
|
227 |
{
|
|
228 |
aLeftPercentage = STUB.iLeftPercentage;
|
|
229 |
aRightPercentage = STUB.iRightPercentage;
|
|
230 |
return STUB.iGetBalanceError.Error();
|
|
231 |
}
|
|
232 |
|
|
233 |
// -----------------------------------------------------------------------------
|
|
234 |
// CRadioPlayerUtility::CBody::CustomInterface
|
|
235 |
// Get a custom interface for the specified interface Id.
|
|
236 |
// (other items were commented in a header).
|
|
237 |
// -----------------------------------------------------------------------------
|
|
238 |
//
|
|
239 |
TAny* CRadioPlayerUtility::CBody::CustomInterface(
|
|
240 |
TUid aInterfaceId )
|
|
241 |
{
|
|
242 |
// TAny* ci = NULL;
|
|
243 |
// return ci;
|
|
244 |
#ifdef _DEBUG
|
|
245 |
RDebug::Print(_L("CRadioPlayerUtility::CBody::CustomInterface, aInterfaceId = %d"), aInterfaceId);
|
|
246 |
#endif
|
|
247 |
TAny* ci = NULL;
|
|
248 |
CCustomInterfaceUtility* customInterfaceUtil = NULL;
|
|
249 |
|
|
250 |
TRAPD( error, customInterfaceUtil = CCustomInterfaceUtility::NewL( iRadioSession ) );
|
|
251 |
|
|
252 |
if ( !error )
|
|
253 |
{
|
|
254 |
ci = customInterfaceUtil->CustomInterface( aInterfaceId );
|
|
255 |
if ( !ci )
|
|
256 |
{
|
|
257 |
// The custom interface utility is owned by the custom interface, implicitly.
|
|
258 |
// The custom interface utility instance is destroyed when the
|
|
259 |
// custom interface is finally destroyed!
|
|
260 |
// But if there's no valid ci, we need to take care of deleting the
|
|
261 |
// custom interface utility instance.
|
|
262 |
delete customInterfaceUtil;
|
|
263 |
}
|
|
264 |
}
|
|
265 |
return ci;
|
|
266 |
}
|
|
267 |
|
|
268 |
//End of File
|