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 C_RADIOENGINESETTINGS_H |
|
19 #define C_RADIOENGINESETTINGS_H |
|
20 |
|
21 // User includes |
|
22 #include "mradioenginesettings.h" |
|
23 #include "mradiosettingssetter.h" |
|
24 #include "cradioregion.h" |
|
25 #include "mradiorepositoryentityobserver.h" |
|
26 #include "cradiosettingsbase.h" |
|
27 |
|
28 // Forward declarations |
|
29 class MRadioSettingsObserver; |
|
30 |
|
31 /** |
|
32 * Concrete implementation of radio settings. |
|
33 */ |
|
34 NONSHARABLE_CLASS( CRadioEngineSettings ) : public CRadioSettingsBase |
|
35 , public MRadioSettingsSetter |
|
36 , public MRadioRepositoryEntityObserver |
|
37 { |
|
38 |
|
39 public: |
|
40 |
|
41 static CRadioEngineSettings* NewL( CRadioRepositoryManager& aRepositoryManager, CCoeEnv& aCoeEnv ); |
|
42 |
|
43 ~CRadioEngineSettings(); |
|
44 |
|
45 /** |
|
46 * Determines if region is allowed. |
|
47 */ |
|
48 TBool IsRegionAllowed( TRadioRegion aRegionId ) const; |
|
49 |
|
50 private: |
|
51 |
|
52 CRadioEngineSettings( CRadioRepositoryManager& aRepositoryManager, CCoeEnv& aCoeEnv ); |
|
53 |
|
54 void ConstructL(); |
|
55 |
|
56 // from base class MRadioEngineSettings |
|
57 |
|
58 TInt HeadsetVolume() const; |
|
59 TInt SpeakerVolume() const; |
|
60 TInt Volume() const; |
|
61 TInt OutputMode() const; |
|
62 TInt AudioRoute() const; |
|
63 TBool IsHeadsetVolMuted() const; |
|
64 TBool IsSpeakerVolMuted() const; |
|
65 TBool IsVolMuted() const; |
|
66 TBool IsPowerOn() const; |
|
67 TUint32 TunedFrequency() const; |
|
68 TInt DefaultMinVolumeLevel() const; |
|
69 TInt CountRegions() const; |
|
70 CRadioRegion& Region( TInt aIndex ) const; |
|
71 TRadioRegion RegionId() const; |
|
72 TUint32 FrequencyStepSize() const; |
|
73 TUint32 MaxFrequency() const; |
|
74 TUint32 MinFrequency() const; |
|
75 TInt DecimalCount() const; |
|
76 TBool RdsAfSearchEnabled() const; |
|
77 TRadioRegion DefaultRegion() const; |
|
78 TPtrC NetworkId() const; |
|
79 TPtrC SubscriberId() const; |
|
80 TPtrC CountryCode() const; |
|
81 |
|
82 // from base class MRadioSettingsSetter |
|
83 |
|
84 void SetObserver( MRadioSettingsObserver* aObserver ); |
|
85 TInt SetHeadsetVolume( TInt aVolume ); |
|
86 TInt SetSpeakerVolume( TInt aVolume ); |
|
87 TInt SetVolume( TInt aVolume ); |
|
88 TInt SetOutputMode( TInt aOutputMode ); |
|
89 TInt SetAudioRoute( TInt aAudioRoute ); |
|
90 TInt SetHeadsetVolMuted( TBool aMuted ); |
|
91 TInt SetSpeakerVolMuted( TBool aMuted ); |
|
92 TInt SetVolMuted( TBool aMuted ); |
|
93 TInt SetPowerOn( TBool aPowerState ); |
|
94 TInt SetTunedFrequency( TUint32 aFrequency ); |
|
95 TInt SetRegionId( TInt aRegion ); |
|
96 TInt SetRdsAfSearch( TBool aEnabled ); |
|
97 TInt SetNetworkId( const TDesC& aNetworkId ); |
|
98 TInt SetSubscriberId( const TDesC& aSubscriberId ); |
|
99 TInt SetCountryCode( const TDesC& aCountryCode ); |
|
100 |
|
101 // from base class MRadioRepositoryEntityObserver |
|
102 |
|
103 void HandleRepositoryValueChangeL( const TUid& aUid, TUint32 aKey, TInt aValue, TInt aError ); |
|
104 void HandleRepositoryValueChangeL( const TUid& /*aUid*/, TUint32 /*aKey*/, const TReal& /*aValue*/, TInt /*aError*/ ) {} |
|
105 void HandleRepositoryValueChangeL( const TUid& /*aUid*/, TUint32 /*aKey*/, const TDesC8& /*aValue*/, TInt /*aError*/ ) {} |
|
106 void HandleRepositoryValueChangeL( const TUid& /*aUid*/, TUint32 /*aKey*/, const TDesC16& /*aValue*/, TInt /*aError*/ ) {} |
|
107 |
|
108 // New functions |
|
109 |
|
110 /** |
|
111 * Initializes the regions as defined in the resource file. |
|
112 */ |
|
113 void InitializeRegionsL(); |
|
114 |
|
115 /** |
|
116 * Converts Region ID to index |
|
117 * |
|
118 * @param aRegionId The region ID that is wanted to convert |
|
119 * @return The region index, KErrNotFound if no match found |
|
120 */ |
|
121 TInt RegionIndexForId( TInt aRegionId ) const; |
|
122 |
|
123 /** |
|
124 * Updates the current region index |
|
125 * |
|
126 * @param aRegionId The new region ID |
|
127 */ |
|
128 void UpdateCurrentRegionIdx( TInt aRegionId ); |
|
129 |
|
130 private: // data |
|
131 |
|
132 /** |
|
133 * The observer for the setting changes. |
|
134 * Not own. |
|
135 */ |
|
136 MRadioSettingsObserver* iObserver; |
|
137 |
|
138 /** |
|
139 * The available regions. |
|
140 */ |
|
141 RRadioRegionArray iRegions; |
|
142 |
|
143 /** |
|
144 * The current region. |
|
145 */ |
|
146 TInt iCurrentRegionIdx; |
|
147 |
|
148 }; |
|
149 |
|
150 #endif // C_RADIOENGINESETTINGS_H |
|