radioengine/settings/src/cradioregion.cpp
changeset 28 075425b8d9a4
parent 13 46974bebc798
child 33 11b6825f0862
equal deleted inserted replaced
24:6df133bd92e1 28:075425b8d9a4
    18 // System includes
    18 // System includes
    19 #include <barsread.h>
    19 #include <barsread.h>
    20 
    20 
    21 // User includes
    21 // User includes
    22 #include "cradioregion.h"
    22 #include "cradioregion.h"
       
    23 #include "cradioenginelogger.h"
    23 
    24 
    24 // Used to convert kilohertz values to hertz values
    25 // Used to convert kilohertz values to hertz values
    25 const TInt KRadioThousand = 1000;
    26 const TInt KRadioThousand = 1000;
    26 
    27 
    27 // ================= MEMBER FUNCTIONS =======================
    28 // ================= MEMBER FUNCTIONS =======================
    30 //
    31 //
    31 // ---------------------------------------------------------------------------
    32 // ---------------------------------------------------------------------------
    32 //
    33 //
    33 CRadioRegion::CRadioRegion()
    34 CRadioRegion::CRadioRegion()
    34     {
    35     {
       
    36     LEVEL3( LOG_METHOD_AUTO );
    35     }
    37     }
    36 
    38 
    37 // ---------------------------------------------------------------------------
    39 // ---------------------------------------------------------------------------
    38 //
    40 //
    39 // ---------------------------------------------------------------------------
    41 // ---------------------------------------------------------------------------
    40 //
    42 //
    41 void CRadioRegion::ConstructL( TResourceReader& aRr )
    43 void CRadioRegion::ConstructL( TResourceReader& aRr )
    42     {
    44     {
       
    45     LEVEL3( LOG_METHOD_AUTO );
    43     iId = static_cast<TRadioRegion>( aRr.ReadUint16());
    46     iId = static_cast<TRadioRegion>( aRr.ReadUint16());
    44     iStepSize = static_cast<TUint16>( aRr.ReadUint16() ) * KRadioThousand;
    47     iStepSize = static_cast<TUint16>( aRr.ReadUint16() ) * KRadioThousand;
    45     iMinFreq = aRr.ReadUint32() * KRadioThousand;
    48     iMinFreq = aRr.ReadUint32() * KRadioThousand;
    46     iMaxFreq = aRr.ReadUint32() * KRadioThousand;
    49     iMaxFreq = aRr.ReadUint32() * KRadioThousand;
    47     iDecimalCount = aRr.ReadInt16();
    50     iDecimalCount = aRr.ReadInt16();
    62 //
    65 //
    63 // ---------------------------------------------------------------------------
    66 // ---------------------------------------------------------------------------
    64 //
    67 //
    65 CRadioRegion* CRadioRegion::NewL( TResourceReader& aRr )
    68 CRadioRegion* CRadioRegion::NewL( TResourceReader& aRr )
    66     {
    69     {
       
    70     LEVEL3( LOG_METHOD_AUTO );
    67     CRadioRegion* self = new ( ELeave ) CRadioRegion;
    71     CRadioRegion* self = new ( ELeave ) CRadioRegion;
    68 
    72 
    69     CleanupStack::PushL( self );
    73     CleanupStack::PushL( self );
    70     self->ConstructL( aRr );
    74     self->ConstructL( aRr );
    71     CleanupStack::Pop();
    75     CleanupStack::Pop();
    78 //
    82 //
    79 // ---------------------------------------------------------------------------
    83 // ---------------------------------------------------------------------------
    80 //
    84 //
    81 CRadioRegion::~CRadioRegion()
    85 CRadioRegion::~CRadioRegion()
    82     {
    86     {
       
    87     LEVEL3( LOG_METHOD_AUTO );
    83     iCountryCodes.ResetAndDestroy();
    88     iCountryCodes.ResetAndDestroy();
    84     iCountryCodes.Close();
    89     iCountryCodes.Close();
    85     delete iName;
    90     delete iName;
    86     delete iSettingName;
    91     delete iSettingName;
    87     }
    92     }
    90 // Get the id of region
    95 // Get the id of region
    91 // ---------------------------------------------------------
    96 // ---------------------------------------------------------
    92 //
    97 //
    93 EXPORT_C TRadioRegion CRadioRegion::Id() const
    98 EXPORT_C TRadioRegion CRadioRegion::Id() const
    94     {
    99     {
       
   100     LEVEL3( LOG_METHOD_AUTO );
    95     return iId;
   101     return iId;
    96     }
   102     }
    97 
   103 
    98 // ---------------------------------------------------------
   104 // ---------------------------------------------------------
    99 // Get the step interval of region
   105 // Get the step interval of region
   100 // ---------------------------------------------------------
   106 // ---------------------------------------------------------
   101 //
   107 //
   102 EXPORT_C TUint32 CRadioRegion::StepSize() const
   108 EXPORT_C TUint32 CRadioRegion::StepSize() const
   103     {
   109     {
       
   110     LEVEL3( LOG_METHOD_AUTO );
   104     return iStepSize;
   111     return iStepSize;
   105     }
   112     }
   106 
   113 
   107 // ---------------------------------------------------------
   114 // ---------------------------------------------------------
   108 //
   115 //
   109 // ---------------------------------------------------------
   116 // ---------------------------------------------------------
   110 //
   117 //
   111 EXPORT_C TUint32 CRadioRegion::MinFrequency() const
   118 EXPORT_C TUint32 CRadioRegion::MinFrequency() const
   112     {
   119     {
       
   120     LEVEL3( LOG_METHOD_AUTO );
   113     return iMinFreq;
   121     return iMinFreq;
   114     }
   122     }
   115 
   123 
   116 // ---------------------------------------------------------
   124 // ---------------------------------------------------------
   117 //
   125 //
   118 // ---------------------------------------------------------
   126 // ---------------------------------------------------------
   119 //
   127 //
   120 EXPORT_C TUint32 CRadioRegion::MaxFrequency() const
   128 EXPORT_C TUint32 CRadioRegion::MaxFrequency() const
   121     {
   129     {
       
   130     LEVEL3( LOG_METHOD_AUTO );
   122     return iMaxFreq;
   131     return iMaxFreq;
   123     }
   132     }
   124 
   133 
   125 // ---------------------------------------------------------
   134 // ---------------------------------------------------------
   126 //
   135 //
   127 // ---------------------------------------------------------
   136 // ---------------------------------------------------------
   128 //
   137 //
   129 EXPORT_C TInt CRadioRegion::DecimalCount() const
   138 EXPORT_C TInt CRadioRegion::DecimalCount() const
   130     {
   139     {
       
   140     LEVEL3( LOG_METHOD_AUTO );
   131     return iDecimalCount;
   141     return iDecimalCount;
   132     }
   142     }
   133 
   143 
   134 // ---------------------------------------------------------
   144 // ---------------------------------------------------------
   135 // Get the country code of region
   145 // Get the country code of region
   136 // ---------------------------------------------------------
   146 // ---------------------------------------------------------
   137 //
   147 //
   138 EXPORT_C const RRadioCountryCodeArray& CRadioRegion::CountryCodes()
   148 EXPORT_C const RRadioCountryCodeArray& CRadioRegion::CountryCodes()
   139     {
   149     {
       
   150     LEVEL3( LOG_METHOD_AUTO );
   140     return iCountryCodes;
   151     return iCountryCodes;
   141     }
   152     }
   142 
   153 
   143 // ---------------------------------------------------------
   154 // ---------------------------------------------------------
   144 // Get the name of region
   155 // Get the name of region
   145 // ---------------------------------------------------------
   156 // ---------------------------------------------------------
   146 //
   157 //
   147 EXPORT_C const TDesC16& CRadioRegion::Name() const
   158 EXPORT_C const TDesC16& CRadioRegion::Name() const
   148     {
   159     {
       
   160     LEVEL3( LOG_METHOD_AUTO );
   149     return *iName;
   161     return *iName;
   150     }
   162     }
   151 
   163 
   152 // ---------------------------------------------------------
   164 // ---------------------------------------------------------
   153 // Get the name of region
   165 // Get the name of region
   154 // ---------------------------------------------------------
   166 // ---------------------------------------------------------
   155 //
   167 //
   156 EXPORT_C const TDesC16& CRadioRegion::SettingItemName() const
   168 EXPORT_C const TDesC16& CRadioRegion::SettingItemName() const
   157     {
   169     {
       
   170     LEVEL3( LOG_METHOD_AUTO );
   158     return *iSettingName;
   171     return *iSettingName;
   159     }
   172     }