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 // System includes |
|
19 #include <barsread.h> |
|
20 |
|
21 // User includes |
|
22 #include "cradioregion.h" |
|
23 #include "cradioenginelogger.h" |
|
24 |
|
25 // Used to convert kilohertz values to hertz values |
|
26 const TInt KRadioThousand = 1000; |
|
27 |
|
28 // ================= MEMBER FUNCTIONS ======================= |
|
29 |
|
30 // --------------------------------------------------------------------------- |
|
31 // |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 CRadioRegion::CRadioRegion() |
|
35 { |
|
36 LEVEL3( LOG_METHOD_AUTO ); |
|
37 } |
|
38 |
|
39 // --------------------------------------------------------------------------- |
|
40 // |
|
41 // --------------------------------------------------------------------------- |
|
42 // |
|
43 void CRadioRegion::ConstructL( TResourceReader& aRr ) |
|
44 { |
|
45 LEVEL3( LOG_METHOD_AUTO ); |
|
46 iId = static_cast<TRadioRegion>( aRr.ReadUint16()); |
|
47 iStepSize = aRr.ReadUint32() * KRadioThousand; |
|
48 iMinFreq = aRr.ReadUint32() * KRadioThousand; |
|
49 iMaxFreq = aRr.ReadUint32() * KRadioThousand; |
|
50 iDecimalCount = aRr.ReadInt16(); |
|
51 |
|
52 TInt countryCodeCount = aRr.ReadInt16(); |
|
53 for ( TInt i = 0; i < countryCodeCount; ++i ) |
|
54 { |
|
55 TPtrC code; |
|
56 code.Set( aRr.ReadTPtrC()); |
|
57 User::LeaveIfError( iCountryCodes.Append( code.AllocL())); |
|
58 } |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 CRadioRegion* CRadioRegion::NewL( TResourceReader& aRr ) |
|
66 { |
|
67 LEVEL3( LOG_METHOD_AUTO ); |
|
68 CRadioRegion* self = new ( ELeave ) CRadioRegion; |
|
69 |
|
70 CleanupStack::PushL( self ); |
|
71 self->ConstructL( aRr ); |
|
72 CleanupStack::Pop(); |
|
73 |
|
74 return self; |
|
75 } |
|
76 |
|
77 |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 // --------------------------------------------------------------------------- |
|
81 // |
|
82 CRadioRegion::~CRadioRegion() |
|
83 { |
|
84 LEVEL3( LOG_METHOD_AUTO ); |
|
85 iCountryCodes.ResetAndDestroy(); |
|
86 iCountryCodes.Close(); |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------- |
|
90 // Get the id of region |
|
91 // --------------------------------------------------------- |
|
92 // |
|
93 EXPORT_C TRadioRegion CRadioRegion::Id() const |
|
94 { |
|
95 LEVEL3( LOG_METHOD_AUTO ); |
|
96 return iId; |
|
97 } |
|
98 |
|
99 // --------------------------------------------------------- |
|
100 // Get the step interval of region |
|
101 // --------------------------------------------------------- |
|
102 // |
|
103 EXPORT_C TUint32 CRadioRegion::StepSize() const |
|
104 { |
|
105 LEVEL3( LOG_METHOD_AUTO ); |
|
106 return iStepSize; |
|
107 } |
|
108 |
|
109 // --------------------------------------------------------- |
|
110 // |
|
111 // --------------------------------------------------------- |
|
112 // |
|
113 EXPORT_C TUint32 CRadioRegion::MinFrequency() const |
|
114 { |
|
115 LEVEL3( LOG_METHOD_AUTO ); |
|
116 return iMinFreq; |
|
117 } |
|
118 |
|
119 // --------------------------------------------------------- |
|
120 // |
|
121 // --------------------------------------------------------- |
|
122 // |
|
123 EXPORT_C TUint32 CRadioRegion::MaxFrequency() const |
|
124 { |
|
125 LEVEL3( LOG_METHOD_AUTO ); |
|
126 return iMaxFreq; |
|
127 } |
|
128 |
|
129 // --------------------------------------------------------- |
|
130 // |
|
131 // --------------------------------------------------------- |
|
132 // |
|
133 EXPORT_C TInt CRadioRegion::DecimalCount() const |
|
134 { |
|
135 LEVEL3( LOG_METHOD_AUTO ); |
|
136 return iDecimalCount; |
|
137 } |
|
138 |
|
139 // --------------------------------------------------------- |
|
140 // Get the country code of region |
|
141 // --------------------------------------------------------- |
|
142 // |
|
143 EXPORT_C const RRadioCountryCodeArray& CRadioRegion::CountryCodes() |
|
144 { |
|
145 LEVEL3( LOG_METHOD_AUTO ); |
|
146 return iCountryCodes; |
|
147 } |
|