|
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: Header class of CTRadioUtility. |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef __CTRADIOUTILITY_H |
|
20 #define __CTRADIOUTILITY_H |
|
21 |
|
22 //#include <e32base.h> |
|
23 //#include <e32cons.h> |
|
24 //#include "RadioSession.h" |
|
25 #include <RadioUtility.h> |
|
26 #include <RadioPlayerUtility.h> |
|
27 #include <RadioFmTunerUtility.h> |
|
28 #include <RadioRdsUtility.h> |
|
29 |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class CTRadioUtilityConsole; |
|
33 class CRadioUtility; |
|
34 |
|
35 GLREF_C void Panic(TInt aPanic); |
|
36 |
|
37 class CTRadioUtility : public CBase, |
|
38 MRadioPlayerObserver, |
|
39 MRadioFmTunerObserver, |
|
40 MRadioRdsObserver |
|
41 { |
|
42 public: |
|
43 |
|
44 /** |
|
45 * NewL method for creating new instances of this class. |
|
46 * @param aParent - a pointer to the BTTestHarness |
|
47 * @return - a pointer to the newly created CBTTestHarnessConsole |
|
48 **/ |
|
49 static CTRadioUtility* NewL(); |
|
50 /** |
|
51 * NewLC method for creating new instances of this class. |
|
52 * @param aParent - a pointer to the BTTestHarness |
|
53 * @return - a pointer to the newly created CBTTestHarnessConsole |
|
54 **/ |
|
55 static CTRadioUtility* NewLC(); |
|
56 /** |
|
57 * Destructor |
|
58 **/ |
|
59 ~CTRadioUtility(); |
|
60 |
|
61 // |
|
62 //Player Utility Methods to Test... |
|
63 // |
|
64 void Play(); |
|
65 void PlayerState(); |
|
66 void ClosePlayer(); |
|
67 void StopPlayer(); |
|
68 void Mute(); |
|
69 void IsMute(); |
|
70 void SetVolume(); |
|
71 void GetVolume(); |
|
72 void SetVolumeRamp(); |
|
73 void GetMaxVolume(); |
|
74 void SetBalance(); |
|
75 void GetBalance(); |
|
76 |
|
77 // |
|
78 //Tuner Utility Methods to Test... |
|
79 // |
|
80 void RequestTunerControl(); |
|
81 void CloseTuner(); |
|
82 void GetTunerCapabilities(); |
|
83 void EnableTunerInOfflineMode(); |
|
84 void SetFrequencyRange(); |
|
85 void CancelSetFrequencyRange(); |
|
86 void GetFrequencyRange(); |
|
87 void SetFrequency(); |
|
88 void CancelSetFrequency(); |
|
89 void GetFrequency(); |
|
90 void StationSeek(); |
|
91 void CancelStationSeek(); |
|
92 void GetSignalStrength(); |
|
93 void GetMaxSignalStrength(); |
|
94 void GetStereoMode(); |
|
95 void ForceMonoReception(); |
|
96 void GetForceMonoReception(); |
|
97 void SetSquelch(); |
|
98 void GetSquelch(); |
|
99 |
|
100 // |
|
101 //Rds Utility Methods to Test... |
|
102 // |
|
103 |
|
104 void Close(); |
|
105 void GetRdsCapabilities(); |
|
106 void GetRdsSignalStatus(); |
|
107 void NotifyRdsDataChange(); |
|
108 void CancelNotifyRdsDataChange(); |
|
109 void SetAutomaticSwitching(); |
|
110 void GetAutomaticSwitching(); |
|
111 void CancelAFSearch(); |
|
112 void SetAutomaticTrafficAnnouncement(); |
|
113 void GetAutomaticTrafficAnnouncement(); |
|
114 void StationSeekByPTY(); |
|
115 void StationSeekByTA(); |
|
116 void StationSeekByTP(); |
|
117 void CancelRdsStationSeek(); |
|
118 void GetFreqByPTY(); |
|
119 void CancelGetFreqByPTY(); |
|
120 void GetFreqByTA(); |
|
121 void CancelGetFreqByTA(); |
|
122 void GetPSByPTY(); |
|
123 void CancelGetPSByPTY(); |
|
124 void GetPSByTA(); |
|
125 void CancelGetPSByTA(); |
|
126 void GetProgrammeIdentification(); |
|
127 void GetProgrammeType(); |
|
128 void GetProgrammeService(); |
|
129 void GetRadioText(); |
|
130 void GetRadioTextPlus(); |
|
131 void GetClockTime(); |
|
132 void GetTrafficAnnouncementStatus(); |
|
133 void GetTrafficProgrammeStatus(); |
|
134 |
|
135 // |
|
136 // MRadioPlayerObserver Methods |
|
137 // |
|
138 |
|
139 void MrpoStateChange( TPlayerState aState, TInt aError ); |
|
140 void MrpoVolumeChange( TInt aVolume ); |
|
141 void MrpoMuteChange( TBool aMute ); |
|
142 void MrpoBalanceChange( TInt aLeftPercentage, TInt aRightPercentage ); |
|
143 |
|
144 // |
|
145 // MRadioFmTunerObserver Methods |
|
146 // |
|
147 |
|
148 void MrftoRequestTunerControlComplete( TInt aError ); |
|
149 void MrftoSetFrequencyRangeComplete( TInt aError ); |
|
150 void MrftoSetFrequencyComplete( TInt aError ); |
|
151 void MrftoStationSeekComplete( TInt aError, TInt aFrequency ); |
|
152 void MrftoFmTransmitterStatusChange( TBool aActive ); |
|
153 void MrftoAntennaStatusChange( TBool aAttached ); |
|
154 void MrftoOfflineModeStatusChange( TBool aOfflineMode ); |
|
155 void MrftoFrequencyRangeChange( TFmRadioFrequencyRange aNewRange ); |
|
156 void MrftoFrequencyChange( TInt aNewFrequency ); |
|
157 void MrftoForcedMonoChange( TBool aForcedMono ); |
|
158 void MrftoSquelchChange( TBool aSquelch ); |
|
159 |
|
160 // |
|
161 // MRadioRdsTunerObserver Methods |
|
162 // |
|
163 void MrroStationSeekByPTYComplete( TInt aError, TInt aFrequency ); |
|
164 void MrroStationSeekByTAComplete( TInt aError, TInt aFrequency ); |
|
165 void MrroStationSeekByTPComplete( TInt aError, TInt aFrequency ); |
|
166 void MrroGetFreqByPTYComplete( TInt aError, RArray<TInt>& aFreqList ); |
|
167 void MrroGetFreqByTAComplete( TInt aError, RArray<TInt>& aFreqList ); |
|
168 void MrroGetPSByPTYComplete( TInt aError, RArray<TRdsPSName>& aPsList ); |
|
169 void MrroGetPSByTAComplete( TInt aError, RArray<TRdsPSName>& aPsList ); |
|
170 void MrroRdsDataPI( TInt aPi ); |
|
171 void MrroRdsDataPTY( TRdsProgrammeType aPty ); |
|
172 void MrroRdsDataPS( TRdsPSName& aPs ); |
|
173 void MrroRdsDataRT( TRdsRadioText& aRt ); |
|
174 void MrroRdsDataRTplus( TRdsRTplusClass aRtPlusClass, TRdsRadioText& aRtPlusData ); |
|
175 void MrroRdsDataCT( TDateTime& aCt ); |
|
176 void MrroRdsDataTA( TBool aTaOn ); |
|
177 void MrroRdsSearchBeginAF(); |
|
178 void MrroRdsSearchEndAF( TInt aError, TInt aFrequency ); |
|
179 void MrroRdsStationChangeTA( TInt aFrequency ); |
|
180 void MrroRdsEventAutomaticSwitchingChange( TBool aAuto ); |
|
181 void MrroRdsEventAutomaticTrafficAnnouncement( TBool aAuto ); |
|
182 void MrroRdsEventSignalChange( TBool aSignal ); |
|
183 |
|
184 |
|
185 /** |
|
186 * Callback that is used to indicate that a new hci command has been received |
|
187 * from the chip. |
|
188 * @param aString - The content of the hci frame that was received. |
|
189 **/ |
|
190 //void HandleRadioEngineCallBack(TFMRadioNotifyEvent aEventCode, TInt aErrorCode); |
|
191 /** |
|
192 * Start listening for client keypresses. |
|
193 **/ |
|
194 void StartTestingL(); |
|
195 void StopTesting(); |
|
196 /** |
|
197 * Simple helper method to retrieve a pointer to the console method |
|
198 * @return a pointer to the console |
|
199 **/ |
|
200 CConsoleBase* ConsoleWin(); |
|
201 |
|
202 private: |
|
203 /** |
|
204 * 2nd phase constructor |
|
205 **/ |
|
206 void ConstructL(); |
|
207 /** |
|
208 * c++ default constructor |
|
209 **/ |
|
210 CTRadioUtility(); |
|
211 void HandleNotifyL( const TUid aUid, const TDesC& aKey, const TDesC& aValue ); |
|
212 public: |
|
213 CConsoleBase* iConsole; //pointer to the console window |
|
214 private: |
|
215 CRadioUtility* iRadioUtility; |
|
216 CTRadioUtilityConsole* iReadConsole; |
|
217 CRadioFmTunerUtility* iFmTunerUtility; |
|
218 CRadioPlayerUtility* iPlayerUtility; |
|
219 CRadioRdsUtility* iRdsUtility; |
|
220 TFmRadioFrequencyRange iRange; |
|
221 }; |
|
222 |
|
223 class CTRadioUtilityConsole : public CActive |
|
224 { |
|
225 public: |
|
226 /** |
|
227 * NewL method for creating new instances of this class. |
|
228 * @param aParent - a pointer to the BTTestHarness |
|
229 * @return - a pointer to the newly created CBTTestHarnessConsole |
|
230 **/ |
|
231 static CTRadioUtilityConsole* NewL(CTRadioUtility* aParent); |
|
232 /** |
|
233 * NewLC method for creating new instances of this class. |
|
234 * @param aParent - a pointer to the BTTestHarness |
|
235 * @return - a pointer to the newly created CBTTestHarnessConsole |
|
236 **/ |
|
237 static CTRadioUtilityConsole* NewLC(CTRadioUtility* aParent); |
|
238 /** |
|
239 * Destructor |
|
240 **/ |
|
241 ~CTRadioUtilityConsole(); |
|
242 /** |
|
243 * Display the console options, and wait for another key press. |
|
244 **/ |
|
245 void IssueRequestL(); |
|
246 /** |
|
247 * This method is called whenever a key is pressed in the console window. |
|
248 **/ |
|
249 void RunL(); |
|
250 /** |
|
251 * Cancel any outstanding test requests. |
|
252 **/ |
|
253 void DoCancel(); |
|
254 protected: |
|
255 CTRadioUtilityConsole(CTRadioUtility* aParent); |
|
256 private: |
|
257 /** |
|
258 * 2nd phase constructor |
|
259 **/ |
|
260 void ConstructL(); |
|
261 /** |
|
262 * Outstanding request has been completed, start waiting for another request. |
|
263 **/ |
|
264 void ReadConsoleL(); |
|
265 CRadioUtility* GetRadioEngine(); |
|
266 private: |
|
267 CTRadioUtility* iParent; |
|
268 CConsoleBase* iConsole; |
|
269 }; |
|
270 |
|
271 #endif // __CTRADIOUTILITY_H |