author | Pat Downey <patd@symbian.org> |
Wed, 23 Jun 2010 17:20:24 +0100 | |
changeset 29 | 29ba091146f4 |
parent 28 | 075425b8d9a4 |
child 37 | 451b2e1545b2 |
permissions | -rw-r--r-- |
24 | 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 |
||
26 |
// Forward declarations |
|
27 |
class MRadioSettingsObserver; |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
28 |
class CRepository; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
29 |
class CRadioSettingsImp; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
30 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
31 |
// Constants |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
32 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
33 |
/** |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
34 |
* Maximum size of the network country code. |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
35 |
* From CTelephony::TNetworkInfoV1 in etel3rdparty.h |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
36 |
*/ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
37 |
enum { KNetworkCountryCodeSize = 4 }; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
38 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
39 |
/** |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
40 |
* Maximum size of the network identity. |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
41 |
* From CTelephony::TNetworkInfoV1 in etel3rdparty.h |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
42 |
*/ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
43 |
enum { KNetworkIdentitySize = 8 }; |
24 | 44 |
|
45 |
/** |
|
46 |
* Concrete implementation of radio settings. |
|
47 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
48 |
NONSHARABLE_CLASS( CRadioEngineSettings ) : public CBase |
24 | 49 |
, public MRadioSettingsSetter |
50 |
{ |
|
51 |
||
52 |
public: |
|
53 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
54 |
static CRadioEngineSettings* NewL( CRadioSettingsImp& aRadioSettingsImp ); |
24 | 55 |
|
56 |
~CRadioEngineSettings(); |
|
57 |
||
58 |
/** |
|
59 |
* Determines if region is allowed. |
|
60 |
*/ |
|
61 |
TBool IsRegionAllowed( TRadioRegion aRegionId ) const; |
|
62 |
||
63 |
private: |
|
64 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
65 |
CRadioEngineSettings( CRadioSettingsImp& aRadioSettingsImp ); |
24 | 66 |
|
67 |
void ConstructL(); |
|
68 |
||
69 |
// from base class MRadioEngineSettings |
|
70 |
||
71 |
TInt HeadsetVolume() const; |
|
72 |
TInt SpeakerVolume() const; |
|
73 |
TInt Volume() const; |
|
74 |
TInt OutputMode() const; |
|
75 |
TInt AudioRoute() const; |
|
76 |
TBool IsHeadsetVolMuted() const; |
|
77 |
TBool IsSpeakerVolMuted() const; |
|
78 |
TBool IsVolMuted() const; |
|
79 |
TBool IsPowerOn() const; |
|
80 |
TUint32 TunedFrequency() const; |
|
81 |
TInt DefaultMinVolumeLevel() const; |
|
82 |
TInt CountRegions() const; |
|
83 |
CRadioRegion& Region( TInt aIndex ) const; |
|
84 |
TRadioRegion RegionId() const; |
|
85 |
TUint32 FrequencyStepSize() const; |
|
86 |
TUint32 MaxFrequency() const; |
|
87 |
TUint32 MinFrequency() const; |
|
88 |
TInt DecimalCount() const; |
|
89 |
TRadioRegion DefaultRegion() const; |
|
90 |
TPtrC NetworkId() const; |
|
91 |
TPtrC CountryCode() const; |
|
92 |
||
93 |
// from base class MRadioSettingsSetter |
|
94 |
||
95 |
void SetObserver( MRadioSettingsObserver* aObserver ); |
|
96 |
TInt SetHeadsetVolume( TInt aVolume ); |
|
97 |
TInt SetSpeakerVolume( TInt aVolume ); |
|
98 |
TInt SetVolume( TInt aVolume ); |
|
99 |
TInt SetOutputMode( TInt aOutputMode ); |
|
100 |
TInt SetAudioRoute( TInt aAudioRoute ); |
|
101 |
TInt SetHeadsetVolMuted( TBool aMuted ); |
|
102 |
TInt SetSpeakerVolMuted( TBool aMuted ); |
|
103 |
TInt SetVolMuted( TBool aMuted ); |
|
104 |
TInt SetPowerOn( TBool aPowerState ); |
|
105 |
TInt SetTunedFrequency( TUint32 aFrequency ); |
|
106 |
TInt SetRegionId( TInt aRegion ); |
|
107 |
TInt SetNetworkId( const TDesC& aNetworkId ); |
|
108 |
TInt SetCountryCode( const TDesC& aCountryCode ); |
|
109 |
||
110 |
// New functions |
|
111 |
||
112 |
/** |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
113 |
* Initializes the data holders |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
114 |
*/ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
115 |
void InitializeDataHolders(); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
116 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
117 |
/** |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
118 |
* Gets a repository value and sets the default value if the key is not found |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
119 |
*/ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
120 |
TBool GetRepositoryValue( int aKey, TInt& aValue, TInt aDefault ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
121 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
122 |
/** |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
123 |
* Sets a boolean value to cenrep and data holder |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
124 |
*/ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
125 |
TInt SetFlagValue( int aKey, int aFlagId, TInt aValue ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
126 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
127 |
/** |
24 | 128 |
* Initializes the regions as defined in the resource file. |
129 |
*/ |
|
130 |
void InitializeRegionsL(); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
131 |
|
24 | 132 |
/** |
133 |
* Converts Region ID to index |
|
134 |
* |
|
135 |
* @param aRegionId The region ID that is wanted to convert |
|
136 |
* @return The region index, KErrNotFound if no match found |
|
137 |
*/ |
|
138 |
TInt RegionIndexForId( TInt aRegionId ) const; |
|
139 |
||
140 |
/** |
|
141 |
* Updates the current region index |
|
142 |
* |
|
143 |
* @param aRegionId The new region ID |
|
144 |
*/ |
|
145 |
void UpdateCurrentRegionIdx( TInt aRegionId ); |
|
146 |
||
147 |
private: // data |
|
148 |
||
149 |
/** |
|
150 |
* The observer for the setting changes. |
|
151 |
* Not own. |
|
152 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
153 |
MRadioSettingsObserver* iObserver; |
24 | 154 |
|
155 |
/** |
|
156 |
* The available regions. |
|
157 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
158 |
RRadioRegionArray iRegions; |
24 | 159 |
|
160 |
/** |
|
161 |
* The current region. |
|
162 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
163 |
TInt iCurrentRegionIdx; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
164 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
165 |
CRadioSettingsImp& iRadioSettingsImp; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
166 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
167 |
RResourceFile iResFile; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
168 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
169 |
CRepository* iRepository; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
170 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
171 |
// Data holders for quick access |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
172 |
TBitFlags iFlags; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
173 |
TBuf<KNetworkIdentitySize> iNetworkId; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
174 |
TBuf<KNetworkCountryCodeSize> iCountryCode; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
175 |
TInt iHeadsetVolume; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
176 |
TInt iSpeakerVolume; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
177 |
TUint32 iFrequency; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
178 |
TInt iDefaultMinVolume; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
179 |
TRadioRegion iDefaultRegion; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
180 |
TRadioRegion iRegionId; |
24 | 181 |
|
182 |
}; |
|
183 |
||
184 |
#endif // C_RADIOENGINESETTINGS_H |