|
1 /* |
|
2 * Copyright (c) 2005-2007 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 file for CFMRadioPubSub |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CFMRADIOPUBSUB_H |
|
20 #define CFMRADIOPUBSUB_H |
|
21 |
|
22 #include <fmradiointernalpskeys.h> |
|
23 |
|
24 #include "fmradiopropertyobserver.h" |
|
25 |
|
26 class MFMRadioControlEventObserver; |
|
27 |
|
28 /** |
|
29 * Publish&Subscribe interface of FMRadioEngine |
|
30 */ |
|
31 class CFMRadioPubSub : |
|
32 public CBase, |
|
33 public MFMRadioPropertyChangeObserver |
|
34 { |
|
35 |
|
36 public: // Methods |
|
37 |
|
38 /** |
|
39 * Static constructor. |
|
40 */ |
|
41 static CFMRadioPubSub* NewL(); |
|
42 |
|
43 /** |
|
44 * Destructor. |
|
45 */ |
|
46 virtual ~CFMRadioPubSub(); |
|
47 |
|
48 /** |
|
49 * Publishes active channel number to P&S. |
|
50 * |
|
51 * @param aChannelId The channel ID to publish. |
|
52 */ |
|
53 void PublishChannelL( TInt aChannelId ) const; |
|
54 |
|
55 /** |
|
56 * Publishes active frequency to P&S. |
|
57 * |
|
58 * @param aFreq The frequency to publish. |
|
59 */ |
|
60 IMPORT_C void PublishFrequencyL( TUint32 aFreq ) const; |
|
61 |
|
62 /** |
|
63 * Publishes radio power state to P&S. |
|
64 * |
|
65 * @param aPowerOn The radio power state to publish. |
|
66 */ |
|
67 IMPORT_C void PublishStateL( TBool aPowerOn ) const; |
|
68 |
|
69 /** |
|
70 * Publishes current volume level to P&S. |
|
71 * |
|
72 * @param aVol The current volume level to publish. |
|
73 */ |
|
74 void PublishVolumeL( TInt aVol ) const; |
|
75 |
|
76 /** |
|
77 * Publishes changed channel number to P&S. |
|
78 * |
|
79 * @param aChannelId The channel ID to publish. |
|
80 */ |
|
81 void PublishChannelDataChangedL(TInt aChannelId) const; |
|
82 |
|
83 /** |
|
84 * Publishes the tuning state to P&S. |
|
85 * @param aTuningState The tuning state to publish. |
|
86 */ |
|
87 void PublishTuningStateL( TFMRadioPSTuningState aTuningState ) const; |
|
88 |
|
89 /** |
|
90 * Publishes radio mute state to P&S. |
|
91 * |
|
92 * @param aMuted The radio mute state to publish. |
|
93 */ |
|
94 void PublishRadioMuteStateL( TBool aMuted ) const; |
|
95 |
|
96 /** |
|
97 * Publishes application running state to P&S. |
|
98 * |
|
99 * @param aRunningState The application running state. |
|
100 */ |
|
101 IMPORT_C void PublishApplicationRunningStateL( |
|
102 TFMRadioPSApplicationRunningState aRunningState ) const; |
|
103 |
|
104 /** |
|
105 * Publishes the antenna status to P&S. |
|
106 * |
|
107 * @param aAntennaStatus The antenna's status. |
|
108 */ |
|
109 void PublishAntennaStatusL( TFMRadioPSHeadsetStatus aAntennaStatus ) const; |
|
110 |
|
111 /** |
|
112 * Publishes the frequency decimal count to P&S. |
|
113 * @param aDecimalCount The decimal count. |
|
114 */ |
|
115 void PublishFrequencyDecimalCountL( |
|
116 TFMRadioPSFrequencyDecimalCount aDecimalCount ) const; |
|
117 |
|
118 /** |
|
119 * Publishes speaker status. Before state is set for first time it is in |
|
120 * <code>EFMRadioPSLoudspeakerUninitialized</code> state. |
|
121 * |
|
122 * @param aLoudspeakerStatus Status of the speaker |
|
123 */ |
|
124 void PublishLoudspeakerStatusL( TFMRadioPSLoudspeakerStatus aLoudspeakerStatus ) const; |
|
125 |
|
126 /** |
|
127 * Publishes RDS Program Service information. |
|
128 * |
|
129 * @param aProgramService Service text |
|
130 */ |
|
131 IMPORT_C void PublishRDSProgramServiceL( const TDesC& aProgramService ) const; |
|
132 IMPORT_C void PublishRDSRadioTextL( const TDesC& aRadioText ) const; |
|
133 IMPORT_C void PublishChannelNameL( const TDesC& aName ) const; |
|
134 |
|
135 IMPORT_C void PublishPresetCountL( TInt aVal ) const; |
|
136 |
|
137 // from base class MFMRadioPropertyChangeObserver |
|
138 void HandlePropertyChangeL( const TUid& aCategory, const TUint aKey, const TInt aValue ); |
|
139 void HandlePropertyChangeL( const TUid& aCategory, const TUint aKey, const TDesC8& aValue ); |
|
140 void HandlePropertyChangeL( const TUid& aCategory, const TUint aKey, const TDesC& aValue ); |
|
141 void HandlePropertyChangeErrorL( const TUid& aCategory, const TUint aKey, TInt aError ); |
|
142 |
|
143 /** |
|
144 * Sets the UI side control event observer. |
|
145 * @param aControlEventObserver the observer for control events |
|
146 */ |
|
147 IMPORT_C void SetControlEventObserver( MFMRadioControlEventObserver* aControlEventObserver ); |
|
148 |
|
149 private: //Methods |
|
150 |
|
151 /** |
|
152 * C++ default constructor. |
|
153 */ |
|
154 CFMRadioPubSub(); |
|
155 |
|
156 /** |
|
157 * By default Symbian 2nd phase constructor is private. |
|
158 */ |
|
159 void ConstructL(); |
|
160 |
|
161 /** |
|
162 * Defines a property. |
|
163 * |
|
164 * @param aKey The key of the property. |
|
165 * @param aAttr Attributes of the property. |
|
166 * @param aDataProperty ETrue if the property is a data property, EFalse |
|
167 * if it is a control property |
|
168 */ |
|
169 void DefinePropertyL( |
|
170 TUint aKey, |
|
171 TInt aAttr, |
|
172 TBool aDataProperty ) const; |
|
173 |
|
174 /** |
|
175 * Deletes a property. |
|
176 * |
|
177 * @param aKey The key of the property. |
|
178 */ |
|
179 void DeleteProperty( TUint aKey ) const; |
|
180 |
|
181 /** |
|
182 * Gets the integer value stored in a property. |
|
183 * |
|
184 * @param aKey The key of the property. |
|
185 * @return The value contained in the property. |
|
186 */ |
|
187 TInt PropertyValueIntL( TUint aKey ) const; |
|
188 |
|
189 /** |
|
190 * Sets the value in an integer property. |
|
191 * |
|
192 * @param aKey The key of the property. |
|
193 * @param aValue The value to set. |
|
194 */ |
|
195 void SetPropertyValueL( TUint aKey, TInt aValue ) const; |
|
196 |
|
197 /** |
|
198 * Sets the value in a text property. |
|
199 * |
|
200 * @param aKey The key of the property. |
|
201 * @param aValue The value to set. |
|
202 */ |
|
203 void SetPropertyValueL( TUint aKey, const TDesC& aValue ) const; |
|
204 |
|
205 private: // Data |
|
206 |
|
207 /** |
|
208 * Pointer to observer in UI side, can be NULL. Not owned. |
|
209 */ |
|
210 MFMRadioControlEventObserver* iObserver; |
|
211 |
|
212 /** |
|
213 * An array of handlers to P&S interface. |
|
214 */ |
|
215 RPointerArray<CFMRadioPropertyObserver> iPropertyArray; |
|
216 |
|
217 }; |
|
218 |
|
219 #endif // CFMRADIOPUBSUB_H |