author | hgs |
Fri, 15 Oct 2010 16:26:27 +0300 | |
changeset 57 | 21be958eb3ce |
parent 54 | a8ba0c289b44 |
permissions | -rw-r--r-- |
24 | 1 |
/* |
2 |
* Copyright (c) 2009 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: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
// User includes |
|
19 |
#include "radioenginewrapper.h" |
|
20 |
#include "radioenginewrapper_win32_p.h" |
|
21 |
#include "radioenginewrapperobserver.h" |
|
22 |
||
23 |
/*! |
|
24 |
* Constructor |
|
25 |
*/ |
|
26 |
RadioEngineWrapper::RadioEngineWrapper( RadioStationHandlerIf& stationHandler ) : |
|
27 |
d_ptr( new RadioEngineWrapperPrivate( this, stationHandler ) ) |
|
28 |
{ |
|
29 |
} |
|
30 |
||
31 |
/*! |
|
32 |
* Destructor |
|
33 |
*/ |
|
34 |
RadioEngineWrapper::~RadioEngineWrapper() |
|
35 |
{ |
|
36 |
} |
|
37 |
||
38 |
/*! |
|
39 |
* |
|
40 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
41 |
bool RadioEngineWrapper::init() |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
42 |
{ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
43 |
Q_D( RadioEngineWrapper ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
44 |
return d->init(); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
45 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
46 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
47 |
/*! |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
48 |
* |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
49 |
*/ |
24 | 50 |
void RadioEngineWrapper::addObserver( RadioEngineWrapperObserver* observer ) |
51 |
{ |
|
52 |
Q_D( RadioEngineWrapper ); |
|
53 |
d->mObservers.append( observer ); |
|
54 |
} |
|
55 |
||
56 |
/*! |
|
57 |
* |
|
58 |
*/ |
|
59 |
void RadioEngineWrapper::removeObserver( RadioEngineWrapperObserver* observer ) |
|
60 |
{ |
|
61 |
Q_D( RadioEngineWrapper ); |
|
62 |
d->mObservers.removeAll( observer ); |
|
63 |
} |
|
64 |
||
65 |
/*! |
|
66 |
* Returns the settings handler owned by the engine |
|
67 |
*/ |
|
68 |
RadioSettingsIf& RadioEngineWrapper::settings() |
|
69 |
{ |
|
70 |
Q_D( RadioEngineWrapper ); |
|
71 |
return d->settings(); |
|
72 |
} |
|
73 |
||
74 |
/*! |
|
75 |
* Returns the selected radio region |
|
76 |
*/ |
|
77 |
RadioRegion::Region RadioEngineWrapper::region() const |
|
78 |
{ |
|
79 |
Q_D( const RadioEngineWrapper ); |
|
80 |
return d->mRegionId; |
|
81 |
} |
|
82 |
||
83 |
/*! |
|
84 |
* Returns the minimum frequency |
|
85 |
*/ |
|
86 |
uint RadioEngineWrapper::minFrequency() const |
|
87 |
{ |
|
88 |
Q_D( const RadioEngineWrapper ); |
|
89 |
return d->mMinFrequency; |
|
90 |
} |
|
91 |
||
92 |
/*! |
|
93 |
* Returns the maximum frequency |
|
94 |
*/ |
|
95 |
uint RadioEngineWrapper::maxFrequency() const |
|
96 |
{ |
|
97 |
Q_D( const RadioEngineWrapper ); |
|
98 |
return d->mMaxFrequency; |
|
99 |
} |
|
100 |
||
101 |
/*! |
|
102 |
* Returns the frequency step size from the selected region |
|
103 |
*/ |
|
104 |
uint RadioEngineWrapper::frequencyStepSize() const |
|
105 |
{ |
|
106 |
Q_D( const RadioEngineWrapper ); |
|
107 |
return d->mFrequencyStepSize; |
|
108 |
} |
|
109 |
||
110 |
/*! |
|
111 |
* Returns the frequency step size from the selected region |
|
112 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
113 |
bool RadioEngineWrapper::isFrequencyValid( uint frequency ) const |
24 | 114 |
{ |
115 |
Q_UNUSED( frequency ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
116 |
return frequency >= minFrequency() && frequency <= maxFrequency() && frequency % frequencyStepSize() == 0; |
24 | 117 |
} |
118 |
||
119 |
/*! |
|
120 |
* Checks if the radio engine is on |
|
121 |
*/ |
|
122 |
bool RadioEngineWrapper::isRadioOn() const |
|
123 |
{ |
|
124 |
return true; |
|
125 |
} |
|
126 |
||
127 |
/*! |
|
128 |
* Returns the currently tuned frequency |
|
129 |
*/ |
|
130 |
uint RadioEngineWrapper::currentFrequency() const |
|
131 |
{ |
|
132 |
Q_D( const RadioEngineWrapper ); |
|
133 |
return d->mFrequency; |
|
134 |
} |
|
135 |
||
136 |
/*! |
|
137 |
* Returns the mute status |
|
138 |
*/ |
|
139 |
bool RadioEngineWrapper::isMuted() const |
|
140 |
{ |
|
141 |
return false; |
|
142 |
} |
|
143 |
||
144 |
/*! |
|
145 |
* Returns the antenna connection status |
|
146 |
*/ |
|
147 |
bool RadioEngineWrapper::isAntennaAttached() const |
|
148 |
{ |
|
149 |
Q_D( const RadioEngineWrapper ); |
|
150 |
return d->mAntennaAttached; |
|
151 |
} |
|
152 |
||
153 |
/*! |
|
154 |
* Returns the "use loudspeaker" status |
|
155 |
*/ |
|
156 |
bool RadioEngineWrapper::isUsingLoudspeaker() const |
|
157 |
{ |
|
158 |
Q_D( const RadioEngineWrapper ); |
|
159 |
return d->mUseLoudspeaker; |
|
160 |
} |
|
161 |
||
162 |
/*! |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
163 |
* Sets or unsets the engine to manual seek mode |
24 | 164 |
*/ |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
165 |
void RadioEngineWrapper::setManualSeekMode( bool manualSeek ) |
24 | 166 |
{ |
167 |
Q_D( RadioEngineWrapper ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
168 |
d->mManualSeekMode = manualSeek; |
54 | 169 |
|
34 | 170 |
if ( !manualSeek ) { |
54 | 171 |
RUN_NOTIFY_LOOP( d->observers(), tunedToFrequency( currentFrequency(), TuneReason::ManualSeekTune ) ); |
34 | 172 |
} |
173 |
} |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
174 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
175 |
/*! |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
176 |
* Checks if the engine is in manual seek mode |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
177 |
*/ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
178 |
bool RadioEngineWrapper::isInManualSeekMode() const |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
179 |
{ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
180 |
Q_D( const RadioEngineWrapper ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
181 |
return d->mManualSeekMode; |
24 | 182 |
} |
183 |
||
184 |
/*! |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
185 |
* |
24 | 186 |
*/ |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
187 |
void RadioEngineWrapper::setRdsEnabled( bool rdsEnabled ) |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
188 |
{ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
189 |
Q_UNUSED( rdsEnabled ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
190 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
191 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
192 |
/*! |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
193 |
* Tunes to the given frequency |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
194 |
*/ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
195 |
void RadioEngineWrapper::setFrequency( uint frequency, const int reason ) |
24 | 196 |
{ |
197 |
Q_D( RadioEngineWrapper ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
198 |
d->setFrequency( frequency, reason ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
199 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
200 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
201 |
/*! |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
202 |
* |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
203 |
*/ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
204 |
void RadioEngineWrapper::increaseVolume() |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
205 |
{ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
206 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
207 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
208 |
/*! |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
209 |
* |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
210 |
*/ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
211 |
void RadioEngineWrapper::decreaseVolume() |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
212 |
{ |
24 | 213 |
} |
214 |
||
215 |
/*! |
|
216 |
* volume update command for the engine |
|
217 |
*/ |
|
218 |
void RadioEngineWrapper::setVolume( int volume ) |
|
219 |
{ |
|
220 |
Q_D( RadioEngineWrapper ); |
|
221 |
d->setVolume( volume ); |
|
222 |
} |
|
223 |
||
224 |
/*! |
|
225 |
* |
|
226 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
227 |
void RadioEngineWrapper::setMute( bool muted, bool updateSettings ) |
24 | 228 |
{ |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
229 |
Q_UNUSED( muted ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
230 |
Q_UNUSED( updateSettings ); |
24 | 231 |
} |
232 |
||
233 |
/*! |
|
234 |
* |
|
235 |
*/ |
|
236 |
void RadioEngineWrapper::toggleAudioRoute() |
|
237 |
{ |
|
238 |
Q_D( RadioEngineWrapper ); |
|
239 |
d->toggleAudioRoute(); |
|
240 |
} |
|
241 |
||
242 |
/*! |
|
243 |
* |
|
244 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
245 |
void RadioEngineWrapper::startSeeking( Seek::Direction direction, const int reason ) |
24 | 246 |
{ |
247 |
Q_D( RadioEngineWrapper ); |
|
248 |
d->startSeeking( direction, reason ); |
|
249 |
} |
|
250 |
||
251 |
/*! |
|
252 |
* |
|
253 |
*/ |
|
254 |
void RadioEngineWrapper::cancelSeeking() |
|
255 |
{ |
|
256 |
Q_D( RadioEngineWrapper ); |
|
257 |
d->cancelSeeking(); |
|
258 |
} |