57 // |
56 // |
58 EXPORT_C RFs& RadioEngineUtils::FsSession() |
57 EXPORT_C RFs& RadioEngineUtils::FsSession() |
59 { |
58 { |
60 return CRadioEngineTls::Instance().FsSession(); |
59 return CRadioEngineTls::Instance().FsSession(); |
61 } |
60 } |
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // Utility method for frequency formatting. |
|
65 // Frequency is assumed to be in kilohertz format. |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 EXPORT_C HBufC* RadioEngineUtils::ReadFrequencyStringLC( TUint32 aFreq, |
|
69 TInt aDecimalCount, |
|
70 TInt aResourceId ) |
|
71 { |
|
72 TBuf<KDefaultRealWidth> freqText; |
|
73 freqText.AppendNum( static_cast<TReal>( aFreq ) / 1000.0f, TRealFormat( KDefaultRealWidth, aDecimalCount ) ); // Converts kilohertz to megahertz. |
|
74 |
|
75 // Converts the numbers to the proper display mode. |
|
76 |
|
77 HBufC* channelFreq = NULL; |
|
78 |
|
79 if ( aResourceId == KErrNotFound ) // No resource string. |
|
80 { |
|
81 channelFreq = freqText.AllocLC(); |
|
82 } |
|
83 else |
|
84 { |
|
85 channelFreq = StringLoader::LoadLC( aResourceId, freqText ); |
|
86 } |
|
87 |
|
88 return channelFreq; |
|
89 } |
|
90 |
|
91 // --------------------------------------------------------------------------- |
|
92 // |
|
93 // --------------------------------------------------------------------------- |
|
94 // |
|
95 EXPORT_C void RadioEngineUtils::FormatFrequencyString( TDes& aDest, |
|
96 TUint32 aFreq, |
|
97 TInt aDecimalCount, |
|
98 TDesC& aFormat ) |
|
99 { |
|
100 TBuf<KDefaultRealWidth> freqText; |
|
101 freqText.AppendNum( static_cast<TReal>( aFreq ) / 1000.0f, TRealFormat( KDefaultRealWidth, aDecimalCount ) ); // Converts kilohertz to megahertz. |
|
102 |
|
103 // Converts the numbers to the proper display mode. |
|
104 |
|
105 if ( aFormat.Length() <= 0 || freqText.Length() > aDest.MaxLength() ) // No format. |
|
106 { |
|
107 aDest.Copy( freqText.Left( aDest.Length() ) ); |
|
108 } |
|
109 else |
|
110 { |
|
111 StringLoader::Format( aDest, aFormat, KErrNotFound, freqText ); |
|
112 } |
|
113 } |
|
114 |
|