|
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 RADIOENGINEWRAPPER_P_H |
|
19 #define RADIOENGINEWRAPPER_P_H |
|
20 |
|
21 // System includes |
|
22 #include <e32std.h> |
|
23 #include <qscopedpointer> |
|
24 |
|
25 // User includes |
|
26 #include "radioenginewrapper.h" |
|
27 #include "mradioenginehandlerobserver.h" |
|
28 |
|
29 // Forward declarations |
|
30 class CRadioEngineHandler; |
|
31 class RadioControlEventListener; |
|
32 class RadioRdsListener; |
|
33 class RadioSettings; |
|
34 class RadioFrequencyScanningHandler; |
|
35 class RadioStationHandlerIf; |
|
36 class RadioEngineWrapperObserver; |
|
37 |
|
38 // Constants |
|
39 |
|
40 // Class declaration |
|
41 class RadioEngineWrapperPrivate : public MRadioEngineHandlerObserver |
|
42 { |
|
43 Q_DECLARE_PUBLIC( RadioEngineWrapper ) |
|
44 Q_DISABLE_COPY( RadioEngineWrapperPrivate ) |
|
45 |
|
46 friend class RadioFrequencyScanningHandler; |
|
47 |
|
48 public: |
|
49 |
|
50 RadioEngineWrapperPrivate( RadioEngineWrapper* wrapper, |
|
51 RadioStationHandlerIf& stationHandler, |
|
52 RadioEngineWrapperObserver& observer ); |
|
53 |
|
54 virtual ~RadioEngineWrapperPrivate(); |
|
55 |
|
56 /** |
|
57 * Initialization and startup |
|
58 */ |
|
59 void init(); |
|
60 bool isEngineConstructed(); |
|
61 |
|
62 /** |
|
63 * Returns the radio settings |
|
64 */ |
|
65 RadioSettings& settings(); |
|
66 |
|
67 /** |
|
68 * Getter for CRadioEngineHandler instance. |
|
69 * Returns reference to the CRadioEngineHandler |
|
70 */ |
|
71 CRadioEngineHandler& RadioEnginehandler(); |
|
72 |
|
73 /** |
|
74 * Functions called from slots to tune to given frequency or preset |
|
75 */ |
|
76 void tuneFrequency( uint frequency, const int sender ); |
|
77 void tuneWithDelay( uint frequency, const int sender ); |
|
78 |
|
79 RadioEngineWrapperObserver& observer(); |
|
80 |
|
81 void startSeeking( Seeking::Direction direction ); |
|
82 |
|
83 private: |
|
84 |
|
85 // from base class MRadioEngineObserver |
|
86 |
|
87 void PowerEventL( TBool aPowerState, TInt aError ); |
|
88 void FrequencyEventL( TUint32 aFrequency, RadioEngine::TRadioFrequencyEventReason aReason, TInt aError ); |
|
89 void VolumeEventL( TInt aVolume, TInt aError ); |
|
90 void MuteEventL( TBool aMuteState, TInt aError ); |
|
91 void AudioModeEventL( TInt aAudioMode, TInt aError ); |
|
92 void AntennaEventL( TBool aAntennaAttached, TInt aError ); |
|
93 void AudioRoutingEventL( TInt aAudioDestination, TInt aError ); |
|
94 void SeekingEventL( TInt aSeekingState, TInt aError ); |
|
95 void RegionEventL( TInt aRegion, TInt aError ); |
|
96 void FmTransmitterEventL( TBool /*aActive*/ ) {} |
|
97 |
|
98 // from base class MRadioAudioRoutingObserver |
|
99 |
|
100 void AudioRouteChangedL( RadioEngine::TRadioAudioRoute aRoute ); |
|
101 |
|
102 // from base class MRadioSystemEventObserver |
|
103 |
|
104 void HandleSystemEventL( TRadioSystemEventType aEventType ); |
|
105 |
|
106 // from base class MRadioRepositoryEntityObserver |
|
107 |
|
108 void HandleRepositoryValueChangeL( const TUid& aUid, TUint32 aKey, TInt aValue, TInt aError ); |
|
109 void HandleRepositoryValueChangeL( const TUid& /*aUid*/, TUint32 /*aKey*/, const TReal& /*aValue*/, TInt /*aError*/ ) {} |
|
110 void HandleRepositoryValueChangeL( const TUid& /*aUid*/, TUint32 /*aKey*/, const TDesC8& /*aValue*/, TInt /*aError*/ ) {} |
|
111 void HandleRepositoryValueChangeL( const TUid& /*aUid*/, TUint32 /*aKey*/, const TDesC16& /*aValue*/, TInt /*aError*/ ) {} |
|
112 |
|
113 // New functions |
|
114 |
|
115 /** |
|
116 * Called by RadioFrequencyScanningHandler when the scanning has finished |
|
117 */ |
|
118 void frequencyScannerFinished(); |
|
119 |
|
120 private: // data |
|
121 |
|
122 /** |
|
123 * Pointer to the public class |
|
124 * Not own. |
|
125 */ |
|
126 RadioEngineWrapper* q_ptr; |
|
127 |
|
128 /** |
|
129 * Map of radio stations read from the radio engine |
|
130 * Own. |
|
131 */ |
|
132 RadioStationHandlerIf& mStationHandler; |
|
133 |
|
134 /** |
|
135 * Reference to the wrapper observer |
|
136 */ |
|
137 RadioEngineWrapperObserver& mObserver; |
|
138 |
|
139 /** |
|
140 * Radio settings handler |
|
141 * Own. |
|
142 */ |
|
143 QScopedPointer<RadioSettings> mSettings; |
|
144 |
|
145 /** |
|
146 * Radio engine handler. |
|
147 * Own. |
|
148 */ |
|
149 QScopedPointer<CRadioEngineHandler> mEngineHandler; |
|
150 |
|
151 /** |
|
152 * RemCon listener. |
|
153 * Own. |
|
154 */ |
|
155 QScopedPointer<RadioControlEventListener> mControlEventListener; |
|
156 |
|
157 /** |
|
158 * Rds listener |
|
159 * Own. |
|
160 */ |
|
161 QScopedPointer<RadioRdsListener> mRdsListener; |
|
162 |
|
163 /** |
|
164 * Preset scanning handler |
|
165 * Own. |
|
166 */ |
|
167 QScopedPointer<RadioFrequencyScanningHandler> mFrequencyScanningHandler; |
|
168 |
|
169 /** |
|
170 * Id of the sender of the last tune command. RadioFrequencyStrip or someone else |
|
171 */ |
|
172 int mCommandSender; |
|
173 |
|
174 /** |
|
175 * Flag to indicate whether or not audio should be routed to loudspeaker |
|
176 */ |
|
177 bool mUseLoudspeaker; |
|
178 |
|
179 /** |
|
180 * Flag to indicate whether or not the engine is seeking |
|
181 */ |
|
182 bool mIsSeeking; |
|
183 |
|
184 }; |
|
185 |
|
186 #endif // RADIOENGINEWRAPPER_P_H |