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