|
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 RadioEngineWrapperObserver& observer ) : |
|
28 d_ptr( new RadioEngineWrapperPrivate( this, stationHandler, observer ) ) |
|
29 { |
|
30 Q_D( RadioEngineWrapper ); |
|
31 d->init(); |
|
32 } |
|
33 |
|
34 /*! |
|
35 * Destructor |
|
36 */ |
|
37 RadioEngineWrapper::~RadioEngineWrapper() |
|
38 { |
|
39 delete d_ptr; |
|
40 } |
|
41 |
|
42 /*! |
|
43 * Checks if the radio engine has been constructed properly |
|
44 */ |
|
45 bool RadioEngineWrapper::isEngineConstructed() |
|
46 { |
|
47 Q_D( RadioEngineWrapper ); |
|
48 return d->isEngineConstructed(); |
|
49 } |
|
50 |
|
51 /*! |
|
52 * Returns the settings handler owned by the engine |
|
53 */ |
|
54 RadioSettings& RadioEngineWrapper::settings() |
|
55 { |
|
56 Q_D( RadioEngineWrapper ); |
|
57 return d->settings(); |
|
58 } |
|
59 |
|
60 /*! |
|
61 * Returns the selected radio region |
|
62 */ |
|
63 RadioRegion::Region RadioEngineWrapper::region() const |
|
64 { |
|
65 Q_D( const RadioEngineWrapper ); |
|
66 return d->mRegionId; |
|
67 } |
|
68 |
|
69 /*! |
|
70 * Returns the minimum frequency |
|
71 */ |
|
72 uint RadioEngineWrapper::minFrequency() const |
|
73 { |
|
74 Q_D( const RadioEngineWrapper ); |
|
75 return d->mMinFrequency; |
|
76 } |
|
77 |
|
78 /*! |
|
79 * Returns the maximum frequency |
|
80 */ |
|
81 uint RadioEngineWrapper::maxFrequency() const |
|
82 { |
|
83 Q_D( const RadioEngineWrapper ); |
|
84 return d->mMaxFrequency; |
|
85 } |
|
86 |
|
87 /*! |
|
88 * Returns the frequency step size from the selected region |
|
89 */ |
|
90 uint RadioEngineWrapper::frequencyStepSize() const |
|
91 { |
|
92 Q_D( const RadioEngineWrapper ); |
|
93 return d->mFrequencyStepSize; |
|
94 } |
|
95 |
|
96 /*! |
|
97 * Returns the frequency step size from the selected region |
|
98 */ |
|
99 bool RadioEngineWrapper::isFrequencyValid( uint frequency ) |
|
100 { |
|
101 Q_UNUSED( frequency ); |
|
102 return true; |
|
103 } |
|
104 |
|
105 /*! |
|
106 * Checks if the radio engine is on |
|
107 */ |
|
108 bool RadioEngineWrapper::isRadioOn() const |
|
109 { |
|
110 return true; |
|
111 } |
|
112 |
|
113 /*! |
|
114 * Checks if the scan is on |
|
115 */ |
|
116 bool RadioEngineWrapper::isScanning() const |
|
117 { |
|
118 return false; |
|
119 } |
|
120 |
|
121 /*! |
|
122 * Returns the currently tuned frequency |
|
123 */ |
|
124 uint RadioEngineWrapper::currentFrequency() const |
|
125 { |
|
126 Q_D( const RadioEngineWrapper ); |
|
127 return d->mFrequency; |
|
128 } |
|
129 |
|
130 /*! |
|
131 * Returns the mute status |
|
132 */ |
|
133 bool RadioEngineWrapper::isMuted() const |
|
134 { |
|
135 return false; |
|
136 } |
|
137 |
|
138 /*! |
|
139 * Returns the headset connection status |
|
140 */ |
|
141 bool RadioEngineWrapper::isAntennaAttached() const |
|
142 { |
|
143 Q_D( const RadioEngineWrapper ); |
|
144 return d->mAntennaAttached; |
|
145 } |
|
146 |
|
147 /*! |
|
148 * Returns the "use loudspeaker" status |
|
149 */ |
|
150 bool RadioEngineWrapper::isUsingLoudspeaker() const |
|
151 { |
|
152 Q_D( const RadioEngineWrapper ); |
|
153 return d->mUseLoudspeaker; |
|
154 } |
|
155 |
|
156 /*! |
|
157 * Tunes to the given frequency |
|
158 */ |
|
159 void RadioEngineWrapper::tuneFrequency( uint frequency, const int sender ) |
|
160 { |
|
161 Q_D( RadioEngineWrapper ); |
|
162 d->tuneFrequency( frequency, sender ); |
|
163 } |
|
164 |
|
165 /*! |
|
166 * Tunes to the given frequency after a delay |
|
167 */ |
|
168 void RadioEngineWrapper::tuneWithDelay( uint frequency, const int sender ) |
|
169 { |
|
170 Q_D( RadioEngineWrapper ); |
|
171 d->tuneWithDelay( frequency, sender ); |
|
172 } |
|
173 |
|
174 /*! |
|
175 * volume update command for the engine |
|
176 */ |
|
177 void RadioEngineWrapper::setVolume( int volume ) |
|
178 { |
|
179 Q_D( RadioEngineWrapper ); |
|
180 d->setVolume( volume ); |
|
181 } |
|
182 |
|
183 /*! |
|
184 * |
|
185 */ |
|
186 void RadioEngineWrapper::toggleMute() |
|
187 { |
|
188 } |
|
189 |
|
190 /*! |
|
191 * |
|
192 */ |
|
193 void RadioEngineWrapper::toggleAudioRoute() |
|
194 { |
|
195 Q_D( RadioEngineWrapper ); |
|
196 d->mUseLoudspeaker = !d->mUseLoudspeaker; |
|
197 d->mObserver.audioRouteChanged( d->mUseLoudspeaker ); |
|
198 } |
|
199 |
|
200 /*! |
|
201 * |
|
202 */ |
|
203 void RadioEngineWrapper::startSeeking( Seeking::Direction direction ) |
|
204 { |
|
205 Q_D( RadioEngineWrapper ); |
|
206 d->startSeeking( direction ); |
|
207 } |
|
208 |
|
209 /*! |
|
210 * |
|
211 */ |
|
212 void RadioEngineWrapper::scanFrequencyBand() |
|
213 { |
|
214 } |
|
215 |
|
216 /*! |
|
217 * |
|
218 */ |
|
219 void RadioEngineWrapper::cancelScanFrequencyBand() |
|
220 { |
|
221 Q_D( RadioEngineWrapper ); |
|
222 d->frequencyScannerFinished(); |
|
223 } |