|
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 #ifndef _RADIOENGINEHANDLER_H_ |
|
19 #define _RADIOENGINEHANDLER_H_ |
|
20 |
|
21 // System includes |
|
22 #include <QScopedPointer> |
|
23 |
|
24 // User includes |
|
25 #include "radio_global.h" |
|
26 #include "mradioengineinitializer.h" |
|
27 |
|
28 // Forward declarations |
|
29 class CRadioEngine; |
|
30 class MRadioRdsDataObserver; |
|
31 class MRadioEngineHandlerObserver; |
|
32 class MRadioApplicationSettings; |
|
33 |
|
34 // Class declaration |
|
35 class RadioEngineHandler : public MRadioEngineInitializer |
|
36 { |
|
37 public: |
|
38 |
|
39 RadioEngineHandler( MRadioEngineHandlerObserver& observer ); |
|
40 |
|
41 ~RadioEngineHandler(); |
|
42 |
|
43 /*! |
|
44 * Attempts to construct the radio engine |
|
45 */ |
|
46 bool constructEngine(); |
|
47 |
|
48 /*! |
|
49 * Sets the rds data observer |
|
50 */ |
|
51 void setRdsObserver( MRadioRdsDataObserver* observer ); |
|
52 |
|
53 /*! |
|
54 * Starts or stops receiving RDS data |
|
55 */ |
|
56 void setRdsEnabled( bool rdsEnabled ); |
|
57 |
|
58 /*! |
|
59 * Returns the radio status |
|
60 * @return ETrue = radio is on, EFalse = radio is off |
|
61 */ |
|
62 bool isRadioOn(); |
|
63 |
|
64 /*! |
|
65 * Sets the manual seek status |
|
66 */ |
|
67 void setManualSeekMode( bool manualSeek ); |
|
68 |
|
69 /*! |
|
70 * Returns the manual seek status |
|
71 */ |
|
72 bool isInManualSeekMode() const; |
|
73 |
|
74 /*! |
|
75 * Tune to the specified frequency |
|
76 * @param aFrequency - frequency to lock onto. |
|
77 */ |
|
78 void setFrequency( uint frequency ); |
|
79 |
|
80 /*! |
|
81 * Sets the audio mute state |
|
82 * @param aMuted - flag to determine whether mute should be turned on or off |
|
83 */ |
|
84 void setMute( const bool muted, const bool updateSettings = true ); |
|
85 |
|
86 /*! |
|
87 * Gets the audio mute state |
|
88 * @return ETrue or EFalse to indicate whether mute is currently on. |
|
89 */ |
|
90 bool isMuted() const; |
|
91 |
|
92 /*! |
|
93 * Sets the volume level of the FM radio |
|
94 * @param aVolume - the volume to be used. |
|
95 */ |
|
96 void setVolume( int newVolume ); |
|
97 |
|
98 /*! |
|
99 * Gets the volumelevel. |
|
100 * @return the current volume |
|
101 */ |
|
102 int volume() const; |
|
103 |
|
104 /*! |
|
105 * Gets the max volumelevel. |
|
106 * @return the max volume |
|
107 */ |
|
108 int maxVolume() const; |
|
109 |
|
110 /*! |
|
111 * Increases the volume by one increment |
|
112 */ |
|
113 void increaseVolume(); |
|
114 |
|
115 /*! |
|
116 * Decreases the volume by one increment |
|
117 */ |
|
118 void decreaseVolume(); |
|
119 |
|
120 /*! |
|
121 * Checks if the antenna is attached |
|
122 * @return ETrue or EFalse to indicate whether antenna is currently attached. |
|
123 */ |
|
124 bool isAntennaAttached() const; |
|
125 |
|
126 /*! |
|
127 * Retrieves the current frequency. |
|
128 * @return the frequency in hertz |
|
129 */ |
|
130 uint currentFrequency() const; |
|
131 |
|
132 /*! |
|
133 * Returns the minimum allowed frequency in the current region |
|
134 */ |
|
135 uint minFrequency() const; |
|
136 |
|
137 /*! |
|
138 * Returns the maximum allowed frequency in the current region |
|
139 */ |
|
140 uint maxFrequency() const; |
|
141 |
|
142 /*! |
|
143 * Checks if the given frequency is valid in the current region |
|
144 */ |
|
145 bool isFrequencyValid( uint frequency ) const; |
|
146 |
|
147 /*! |
|
148 * Scan up to the next available frequency. |
|
149 */ |
|
150 void seek( Seek::Direction direction ); |
|
151 |
|
152 /*! |
|
153 * Cancel previously requested scan. |
|
154 */ |
|
155 void cancelSeek(); |
|
156 |
|
157 /*! |
|
158 * Returns the engine seeking state |
|
159 */ |
|
160 Seek::State seekingState() const; |
|
161 |
|
162 /*! |
|
163 * Rreturn step size for tuning. |
|
164 * @return step size |
|
165 */ |
|
166 uint frequencyStepSize() const; |
|
167 |
|
168 /*! |
|
169 * Determine current region |
|
170 * @return fmradio region. In case of error, returns EFMRadioRegionNone. |
|
171 */ |
|
172 RadioRegion::Region region() const; |
|
173 |
|
174 /*! |
|
175 * Sets whether or not audio should be routed to loudspeaker |
|
176 * @param aLoudspeaker ETrue if loudspeaker should be used, EFalse if not |
|
177 */ |
|
178 void setAudioRouteToLoudspeaker( bool loudspeaker ); |
|
179 |
|
180 /*! |
|
181 * Checks if audio is routed to loudspeaker |
|
182 * @return ETrue if loudspeaker is used, EFalse if headset is used |
|
183 */ |
|
184 bool isAudioRoutedToLoudspeaker() const; |
|
185 |
|
186 /*! |
|
187 * Returns a reference to the application settings |
|
188 */ |
|
189 MRadioApplicationSettings& applicationSettings() const; |
|
190 |
|
191 private: |
|
192 |
|
193 // from base class MRadioEngineInitializer |
|
194 |
|
195 CRadioAudioRouter* InitAudioRouterL(); |
|
196 CRadioSystemEventCollector* InitSystemEventCollectorL(); |
|
197 CRadioSettings* InitSettingsL(); |
|
198 |
|
199 private: // data |
|
200 |
|
201 /*! |
|
202 * Radio engine holder |
|
203 * Own. |
|
204 */ |
|
205 QScopedPointer<CRadioEngine> mEngine; |
|
206 |
|
207 /*! |
|
208 * Radio handler observer |
|
209 * Not own. |
|
210 */ |
|
211 MRadioEngineHandlerObserver& mObserver; |
|
212 |
|
213 /*! |
|
214 * Selected radio region |
|
215 */ |
|
216 RadioRegion::Region mRegion; |
|
217 |
|
218 }; |
|
219 |
|
220 #endif //_RADIOENGINEHANDLER_H_ |