author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 11 Jun 2010 13:38:32 +0300 | |
changeset 28 | 075425b8d9a4 |
parent 24 | 6df133bd92e1 |
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 |
#ifndef _CRADIOENGINEHANDLER_H_ |
|
19 |
#define _CRADIOENGINEHANDLER_H_ |
|
20 |
||
21 |
// System includes |
|
22 |
#include <e32base.h> |
|
23 |
||
24 |
#include <mw/ProfileEngineSDKCRKeys.h> |
|
25 |
||
26 |
// User includes |
|
27 |
#include "radio_global.h" |
|
28 |
#include "mradioengineinitializer.h" |
|
29 |
||
30 |
// Forward declarations |
|
31 |
class CRadioEngine; |
|
32 |
class MRadioScanObserver; |
|
33 |
class MRadioRdsDataObserver; |
|
34 |
class CRadioRepositoryManager; |
|
35 |
class MRadioEngineHandlerObserver; |
|
36 |
class MRadioApplicationSettings; |
|
37 |
||
38 |
// Class declaration |
|
39 |
class CRadioEngineHandler : public CBase |
|
40 |
, public MRadioEngineInitializer |
|
41 |
{ |
|
42 |
public: |
|
43 |
||
44 |
CRadioEngineHandler( MRadioEngineHandlerObserver& aObserver ); |
|
45 |
||
46 |
~CRadioEngineHandler(); |
|
47 |
||
48 |
void ConstructL(); |
|
49 |
||
50 |
/** |
|
51 |
* Sets the rds data observer |
|
52 |
*/ |
|
53 |
void SetRdsObserver( MRadioRdsDataObserver* aObserver ); |
|
54 |
||
55 |
/** |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
56 |
* Starts or stops receiving RDS data |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
57 |
*/ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
58 |
void SetRdsEnabled( TBool aRdsEnabled ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
59 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
60 |
/** |
24 | 61 |
* Returns the radio status |
62 |
* @return ETrue = radio is on, EFalse = radio is off |
|
63 |
*/ |
|
64 |
TBool IsRadioOn(); |
|
65 |
||
66 |
/** |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
67 |
* Sets the manual seek status |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
68 |
*/ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
69 |
void SetManualSeekMode( TBool aManualSeek ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
70 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
71 |
/** |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
72 |
* Returns the manual seek status |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
73 |
*/ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
74 |
TBool IsInManualSeekMode() const; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
75 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
76 |
/** |
24 | 77 |
* Tune to the specified frequency |
78 |
* @param aFrequency - frequency to lock onto. |
|
79 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
80 |
void SetFrequency( TUint aFrequency ); |
24 | 81 |
|
82 |
/** |
|
83 |
* Sets the audio mute state |
|
84 |
* @param aMuted - flag to determine whether mute should be turned on or off |
|
85 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
86 |
void SetMuted( const TBool aMuted, const TBool aUpdateSettings = ETrue ); |
24 | 87 |
|
88 |
/** |
|
89 |
* Gets the audio mute state |
|
90 |
* @return ETrue or EFalse to indicate whether mute is currently on. |
|
91 |
*/ |
|
92 |
TBool IsMuted() const; |
|
93 |
||
94 |
/** |
|
95 |
* Sets the volume level of the FM radio |
|
96 |
* @param aVolume - the volume to be used. |
|
97 |
*/ |
|
98 |
void SetVolume( TInt aVolume ); |
|
99 |
||
100 |
/** |
|
101 |
* Gets the volumelevel. |
|
102 |
* @return the current volume |
|
103 |
*/ |
|
104 |
TInt Volume() const; |
|
105 |
||
106 |
/** |
|
107 |
* Gets the max volumelevel. |
|
108 |
* @return the max volume |
|
109 |
*/ |
|
110 |
TInt MaxVolume() const; |
|
111 |
||
112 |
/** |
|
113 |
* Increases the volume by one increment |
|
114 |
*/ |
|
115 |
void IncreaseVolume(); |
|
116 |
||
117 |
/** |
|
118 |
* Decreases the volume by one increment |
|
119 |
*/ |
|
120 |
void DecreaseVolume(); |
|
121 |
||
122 |
/** |
|
123 |
* Checks if the antenna is attached |
|
124 |
* @return ETrue or EFalse to indicate whether antenna is currently attached. |
|
125 |
*/ |
|
126 |
TBool IsAntennaAttached() const; |
|
127 |
||
128 |
/** |
|
129 |
* Retrieves the current frequency. |
|
130 |
* @return the frequency in hertz |
|
131 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
132 |
TUint CurrentFrequency() const; |
24 | 133 |
|
134 |
/** |
|
135 |
* Returns the minimum allowed frequency in the current region |
|
136 |
*/ |
|
137 |
TUint MinFrequency() const; |
|
138 |
||
139 |
/** |
|
140 |
* Returns the maximum allowed frequency in the current region |
|
141 |
*/ |
|
142 |
TUint MaxFrequency() const; |
|
143 |
||
144 |
/** |
|
145 |
* Checks if the given frequency is valid in the current region |
|
146 |
*/ |
|
147 |
TBool IsFrequencyValid( TUint aFrequency ) const; |
|
148 |
||
149 |
/** |
|
150 |
* Scan up to the next available frequency. |
|
151 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
152 |
void Seek( Seek::Direction direction ); |
24 | 153 |
|
154 |
/** |
|
155 |
* Cancel previously requested scan. |
|
156 |
*/ |
|
157 |
void CancelSeek(); |
|
158 |
||
159 |
/** |
|
160 |
* Returns the engine seeking state |
|
161 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
162 |
Seek::State SeekingState() const; |
24 | 163 |
|
164 |
/** |
|
165 |
* Rreturn step size for tuning. |
|
166 |
* @return step size |
|
167 |
*/ |
|
168 |
TUint32 FrequencyStepSize() const; |
|
169 |
||
170 |
/** |
|
171 |
* Determine current region |
|
172 |
* @return fmradio region. In case of error, returns EFMRadioRegionNone. |
|
173 |
*/ |
|
174 |
RadioRegion::Region Region() const; |
|
175 |
||
176 |
/** |
|
177 |
* Sets whether or not audio should be routed to loudspeaker |
|
178 |
* @param aLoudspeaker ETrue if loudspeaker should be used, EFalse if not |
|
179 |
*/ |
|
180 |
void SetAudioRouteToLoudspeaker( TBool aLoudspeaker ); |
|
181 |
||
182 |
/** |
|
183 |
* Checks if audio is routed to loudspeaker |
|
184 |
* @return ETrue if loudspeaker is used, EFalse if headset is used |
|
185 |
*/ |
|
186 |
TBool IsAudioRoutedToLoudspeaker() const; |
|
187 |
||
188 |
/** |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
189 |
* Returns a reference to the application settings |
24 | 190 |
*/ |
191 |
MRadioApplicationSettings& ApplicationSettings() const; |
|
192 |
||
193 |
private: |
|
194 |
||
195 |
// from base class MRadioEngineInitializer |
|
196 |
||
197 |
CRadioAudioRouter* InitAudioRouterL(); |
|
198 |
CRadioSystemEventCollector* InitSystemEventCollectorL(); |
|
199 |
CRadioSettings* InitSettingsL(); |
|
200 |
||
201 |
private: // data |
|
202 |
||
203 |
/** |
|
204 |
* Radio engine holder |
|
205 |
* Own. |
|
206 |
*/ |
|
207 |
CRadioEngine* iEngine; |
|
208 |
||
209 |
/** |
|
210 |
* Radio handler observer |
|
211 |
* Not own. |
|
212 |
*/ |
|
213 |
MRadioEngineHandlerObserver& iObserver; |
|
214 |
||
215 |
/** |
|
216 |
* Frequency used by delayed tuning |
|
217 |
*/ |
|
218 |
TUint iFrequency; |
|
219 |
||
220 |
/** |
|
221 |
* Selected radio region |
|
222 |
*/ |
|
223 |
RadioRegion::Region iRegion; |
|
224 |
||
225 |
}; |
|
226 |
||
227 |
#endif //_CRADIOENGINEHANDLER_H_ |