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: Engine component for FMRadio Active Idle plugin. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __FMRADIOACTIVEIDLEENGINE_H__ |
|
20 #define __FMRADIOACTIVEIDLEENGINE_H__ |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <fmradiointernalpskeys.h> |
|
24 |
|
25 #include "fmradiopropertyobserver.h" |
|
26 |
|
27 class MFMRadioActiveIdleEngineNotifyHandler; |
|
28 |
|
29 |
|
30 /** |
|
31 * Engine component for FMRadio Active Idle plugin. |
|
32 * |
|
33 * This class is responsible for listening to relevant P&S keys and notifying the UI code whenever the listened keys change. |
|
34 * The actual listening is done by multiple CFMRadioPropertyObserver objects. |
|
35 * |
|
36 * @lib fmradioactiveidleengine200.lib |
|
37 * |
|
38 */ |
|
39 NONSHARABLE_CLASS(CFMRadioActiveIdleEngine) : public CBase, public MFMRadioPropertyChangeObserver |
|
40 { |
|
41 public: |
|
42 |
|
43 /** |
|
44 * Static constructor. |
|
45 * @param aObserver The observer to be notified of the changes in the keys. |
|
46 * @return The newly created CFMRadioActiveIdleEngine object. |
|
47 */ |
|
48 IMPORT_C static CFMRadioActiveIdleEngine* NewL( MFMRadioActiveIdleEngineNotifyHandler& aObserver ); |
|
49 |
|
50 /** |
|
51 * Destructor. |
|
52 */ |
|
53 IMPORT_C ~CFMRadioActiveIdleEngine(); |
|
54 |
|
55 /** |
|
56 * Activates subscription to P&S keys if not already active. |
|
57 * Must be called after CFMRadioActiveIdleEngine::NewL, or after Cancel. |
|
58 */ |
|
59 IMPORT_C void ActivateL(); |
|
60 |
|
61 /** |
|
62 * Stops subscribing to P&S keys. |
|
63 */ |
|
64 IMPORT_C void Cancel(); |
|
65 |
|
66 /** |
|
67 * Returns the current volume level of the radio. |
|
68 * @return The current volume level of the radio. |
|
69 */ |
|
70 IMPORT_C TInt RadioVolume() const; |
|
71 |
|
72 /** |
|
73 * Sets the radio volume. |
|
74 * @param aVolume The radio volume to set. |
|
75 */ |
|
76 IMPORT_C void AdjustRadioVolume( TFMRadioPSAdjustVolume aVolume ) const; |
|
77 |
|
78 /** |
|
79 * Returns the current tuning state. |
|
80 * @return The current tuning state. |
|
81 */ |
|
82 IMPORT_C TFMRadioPSTuningState TuningState() const; |
|
83 |
|
84 /** |
|
85 * Returns the current frequency. |
|
86 * @return The current frequency. |
|
87 */ |
|
88 IMPORT_C TInt Frequency() const; |
|
89 |
|
90 /** |
|
91 * Returns the current channel ID. |
|
92 * @return The current channel ID. |
|
93 */ |
|
94 IMPORT_C TInt Channel() const; |
|
95 |
|
96 /** |
|
97 * Returns the current channel name. |
|
98 * @return The current channel name. |
|
99 */ |
|
100 IMPORT_C const TDesC& ChannelName() const; |
|
101 |
|
102 /** |
|
103 * Returns the current mute state. |
|
104 * @return The current mute state. |
|
105 */ |
|
106 IMPORT_C TFMRadioPSRadioMuteState MuteState() const; |
|
107 |
|
108 /** |
|
109 * Sets the mute state. |
|
110 * @param aMuteState The mute state to set. |
|
111 */ |
|
112 IMPORT_C void SetMuteState( TFMRadioPSRadioMuteState aMuteState ) const; |
|
113 |
|
114 /** |
|
115 * Returns the antenna's current connectivity status. |
|
116 * @return The antenna's current connectivity status. |
|
117 */ |
|
118 IMPORT_C TFMRadioPSHeadsetStatus AntennaStatus() const; |
|
119 |
|
120 /** |
|
121 * Returns the current frequency decimal count. |
|
122 * @return The current frequency decimal count. |
|
123 */ |
|
124 IMPORT_C TFMRadioPSFrequencyDecimalCount FrequencyDecimalCount() const; |
|
125 |
|
126 /** |
|
127 * Returns FM Radio application's running state. |
|
128 * @return Application's running state. |
|
129 */ |
|
130 IMPORT_C TFMRadioPSApplicationRunningState ApplicationRunningState() const; |
|
131 |
|
132 /** |
|
133 * Returns the radio's power state. |
|
134 * @return The power state. |
|
135 */ |
|
136 IMPORT_C TFMRadioPSRadioPowerState PowerState() const; |
|
137 |
|
138 /** |
|
139 * Returns the RDS Program Service information. |
|
140 * @return RDS Program Service. |
|
141 */ |
|
142 IMPORT_C const TDesC& RDSProgramService() const; |
|
143 |
|
144 protected: |
|
145 |
|
146 // from base class MFMRadioPropertyChangeObserver |
|
147 void HandlePropertyChangeL( const TUid& aCategory, TUint aKey, TInt aValue ); |
|
148 void HandlePropertyChangeL( const TUid& aCategory, TUint aKey, const TDesC8& aValue ); |
|
149 void HandlePropertyChangeL( const TUid& aCategory, TUint aKey, const TDesC& aValue ); |
|
150 void HandlePropertyChangeErrorL( const TUid& aCategory, TUint aKey, TInt aError ); |
|
151 |
|
152 private: |
|
153 |
|
154 /** |
|
155 * Constructor. |
|
156 * @param aObserver The observer to be notified of the changes in the keys. |
|
157 */ |
|
158 CFMRadioActiveIdleEngine( MFMRadioActiveIdleEngineNotifyHandler& aObserver ); |
|
159 |
|
160 /** |
|
161 * Second-phase constructor. |
|
162 */ |
|
163 void ConstructL(); |
|
164 |
|
165 protected: |
|
166 |
|
167 /** The observer to be notified of the changes in the listened keys. */ |
|
168 MFMRadioActiveIdleEngineNotifyHandler& iObserver; |
|
169 /** Array of status observers. */ |
|
170 RPointerArray<CFMRadioPropertyObserver> iPropertyObserverArray; |
|
171 |
|
172 private: |
|
173 |
|
174 }; |
|
175 |
|
176 #endif //__FMRADIOACTIVEIDLEENGINE_H__ |
|