20 |
20 |
21 // User includes |
21 // User includes |
22 #include "mradioenginesettings.h" |
22 #include "mradioenginesettings.h" |
23 #include "mradiosettingssetter.h" |
23 #include "mradiosettingssetter.h" |
24 #include "cradioregion.h" |
24 #include "cradioregion.h" |
25 #include "mradiorepositoryentityobserver.h" |
|
26 #include "cradiosettingsbase.h" |
|
27 |
25 |
28 // Forward declarations |
26 // Forward declarations |
29 class MRadioSettingsObserver; |
27 class MRadioSettingsObserver; |
|
28 class CRepository; |
|
29 class CRadioSettingsImp; |
|
30 |
|
31 // Constants |
|
32 |
|
33 /** |
|
34 * Maximum size of the network country code. |
|
35 * From CTelephony::TNetworkInfoV1 in etel3rdparty.h |
|
36 */ |
|
37 enum { KNetworkCountryCodeSize = 4 }; |
|
38 |
|
39 /** |
|
40 * Maximum size of the network identity. |
|
41 * From CTelephony::TNetworkInfoV1 in etel3rdparty.h |
|
42 */ |
|
43 enum { KNetworkIdentitySize = 8 }; |
30 |
44 |
31 /** |
45 /** |
32 * Concrete implementation of radio settings. |
46 * Concrete implementation of radio settings. |
33 */ |
47 */ |
34 NONSHARABLE_CLASS( CRadioEngineSettings ) : public CRadioSettingsBase |
48 NONSHARABLE_CLASS( CRadioEngineSettings ) : public CBase |
35 , public MRadioSettingsSetter |
49 , public MRadioSettingsSetter |
36 , public MRadioRepositoryEntityObserver |
|
37 { |
50 { |
38 |
51 |
39 public: |
52 public: |
40 |
53 |
41 static CRadioEngineSettings* NewL( CRadioRepositoryManager& aRepositoryManager, CCoeEnv& aCoeEnv ); |
54 static CRadioEngineSettings* NewL( CRadioSettingsImp& aRadioSettingsImp ); |
42 |
55 |
43 ~CRadioEngineSettings(); |
56 ~CRadioEngineSettings(); |
44 |
57 |
45 /** |
58 /** |
46 * Determines if region is allowed. |
59 * Determines if region is allowed. |
47 */ |
60 */ |
48 TBool IsRegionAllowed( TRadioRegion aRegionId ) const; |
61 TBool IsRegionAllowed( TRadioRegion aRegionId ) const; |
49 |
62 |
50 private: |
63 private: |
51 |
64 |
52 CRadioEngineSettings( CRadioRepositoryManager& aRepositoryManager, CCoeEnv& aCoeEnv ); |
65 CRadioEngineSettings( CRadioSettingsImp& aRadioSettingsImp ); |
53 |
66 |
54 void ConstructL(); |
67 void ConstructL(); |
55 |
68 |
56 // from base class MRadioEngineSettings |
69 // from base class MRadioEngineSettings |
57 |
70 |
71 TRadioRegion RegionId() const; |
84 TRadioRegion RegionId() const; |
72 TUint32 FrequencyStepSize() const; |
85 TUint32 FrequencyStepSize() const; |
73 TUint32 MaxFrequency() const; |
86 TUint32 MaxFrequency() const; |
74 TUint32 MinFrequency() const; |
87 TUint32 MinFrequency() const; |
75 TInt DecimalCount() const; |
88 TInt DecimalCount() const; |
76 TBool RdsAfSearchEnabled() const; |
|
77 TRadioRegion DefaultRegion() const; |
89 TRadioRegion DefaultRegion() const; |
78 TPtrC NetworkId() const; |
90 TPtrC NetworkId() const; |
79 TPtrC SubscriberId() const; |
|
80 TPtrC CountryCode() const; |
91 TPtrC CountryCode() const; |
81 |
92 |
82 // from base class MRadioSettingsSetter |
93 // from base class MRadioSettingsSetter |
83 |
94 |
84 void SetObserver( MRadioSettingsObserver* aObserver ); |
95 void SetObserver( MRadioSettingsObserver* aObserver ); |
91 TInt SetSpeakerVolMuted( TBool aMuted ); |
102 TInt SetSpeakerVolMuted( TBool aMuted ); |
92 TInt SetVolMuted( TBool aMuted ); |
103 TInt SetVolMuted( TBool aMuted ); |
93 TInt SetPowerOn( TBool aPowerState ); |
104 TInt SetPowerOn( TBool aPowerState ); |
94 TInt SetTunedFrequency( TUint32 aFrequency ); |
105 TInt SetTunedFrequency( TUint32 aFrequency ); |
95 TInt SetRegionId( TInt aRegion ); |
106 TInt SetRegionId( TInt aRegion ); |
96 TInt SetRdsAfSearch( TBool aEnabled ); |
|
97 TInt SetNetworkId( const TDesC& aNetworkId ); |
107 TInt SetNetworkId( const TDesC& aNetworkId ); |
98 TInt SetSubscriberId( const TDesC& aSubscriberId ); |
|
99 TInt SetCountryCode( const TDesC& aCountryCode ); |
108 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 |
109 |
108 // New functions |
110 // New functions |
109 |
111 |
110 /** |
112 /** |
|
113 * Initializes the data holders |
|
114 */ |
|
115 void InitializeDataHolders(); |
|
116 |
|
117 /** |
|
118 * Gets a repository value and sets the default value if the key is not found |
|
119 */ |
|
120 TBool GetRepositoryValue( int aKey, TInt& aValue, TInt aDefault ); |
|
121 |
|
122 /** |
|
123 * Sets a boolean value to cenrep and data holder |
|
124 */ |
|
125 TInt SetFlagValue( int aKey, int aFlagId, TInt aValue ); |
|
126 |
|
127 /** |
111 * Initializes the regions as defined in the resource file. |
128 * Initializes the regions as defined in the resource file. |
112 */ |
129 */ |
113 void InitializeRegionsL(); |
130 void InitializeRegionsL(); |
114 |
131 |
115 /** |
132 /** |
116 * Converts Region ID to index |
133 * Converts Region ID to index |
117 * |
134 * |
118 * @param aRegionId The region ID that is wanted to convert |
135 * @param aRegionId The region ID that is wanted to convert |
119 * @return The region index, KErrNotFound if no match found |
136 * @return The region index, KErrNotFound if no match found |
131 |
148 |
132 /** |
149 /** |
133 * The observer for the setting changes. |
150 * The observer for the setting changes. |
134 * Not own. |
151 * Not own. |
135 */ |
152 */ |
136 MRadioSettingsObserver* iObserver; |
153 MRadioSettingsObserver* iObserver; |
137 |
154 |
138 /** |
155 /** |
139 * The available regions. |
156 * The available regions. |
140 */ |
157 */ |
141 RRadioRegionArray iRegions; |
158 RRadioRegionArray iRegions; |
142 |
159 |
143 /** |
160 /** |
144 * The current region. |
161 * The current region. |
145 */ |
162 */ |
146 TInt iCurrentRegionIdx; |
163 TInt iCurrentRegionIdx; |
|
164 |
|
165 CRadioSettingsImp& iRadioSettingsImp; |
|
166 |
|
167 RResourceFile iResFile; |
|
168 |
|
169 CRepository* iRepository; |
|
170 |
|
171 // Data holders for quick access |
|
172 TBitFlags iFlags; |
|
173 TBuf<KNetworkIdentitySize> iNetworkId; |
|
174 TBuf<KNetworkCountryCodeSize> iCountryCode; |
|
175 TInt iHeadsetVolume; |
|
176 TInt iSpeakerVolume; |
|
177 TUint32 iFrequency; |
|
178 TInt iDefaultMinVolume; |
|
179 TRadioRegion iDefaultRegion; |
|
180 TRadioRegion iRegionId; |
147 |
181 |
148 }; |
182 }; |
149 |
183 |
150 #endif // C_RADIOENGINESETTINGS_H |
184 #endif // C_RADIOENGINESETTINGS_H |