radioengine/settings/src/cradioregion.cpp
branchGCC_SURGE
changeset 37 451b2e1545b2
parent 33 11b6825f0862
child 38 f8c3d4e6102c
equal deleted inserted replaced
26:6bcf277166c1 37:451b2e1545b2
    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 =  aRr.ReadUint32() * 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();
    48 
    51 
    49     TInt countryCodeCount = aRr.ReadInt16();
    52     TInt countryCodeCount = aRr.ReadInt16();
    51         {
    54         {
    52         TPtrC code;
    55         TPtrC code;
    53         code.Set( aRr.ReadTPtrC());
    56         code.Set( aRr.ReadTPtrC());
    54         User::LeaveIfError( iCountryCodes.Append( code.AllocL()));
    57         User::LeaveIfError( iCountryCodes.Append( code.AllocL()));
    55         }
    58         }
    56 
       
    57     iName = aRr.ReadHBufC16L();
       
    58     iSettingName = aRr.ReadHBufC16L();
       
    59     }
    59     }
    60 
    60 
    61 // ---------------------------------------------------------------------------
    61 // ---------------------------------------------------------------------------
    62 //
    62 //
    63 // ---------------------------------------------------------------------------
    63 // ---------------------------------------------------------------------------
    64 //
    64 //
    65 CRadioRegion* CRadioRegion::NewL( TResourceReader& aRr )
    65 CRadioRegion* CRadioRegion::NewL( TResourceReader& aRr )
    66     {
    66     {
       
    67     LEVEL3( LOG_METHOD_AUTO );
    67     CRadioRegion* self = new ( ELeave ) CRadioRegion;
    68     CRadioRegion* self = new ( ELeave ) CRadioRegion;
    68 
    69 
    69     CleanupStack::PushL( self );
    70     CleanupStack::PushL( self );
    70     self->ConstructL( aRr );
    71     self->ConstructL( aRr );
    71     CleanupStack::Pop();
    72     CleanupStack::Pop();
    78 //
    79 //
    79 // ---------------------------------------------------------------------------
    80 // ---------------------------------------------------------------------------
    80 //
    81 //
    81 CRadioRegion::~CRadioRegion()
    82 CRadioRegion::~CRadioRegion()
    82     {
    83     {
       
    84     LEVEL3( LOG_METHOD_AUTO );
    83     iCountryCodes.ResetAndDestroy();
    85     iCountryCodes.ResetAndDestroy();
    84     iCountryCodes.Close();
    86     iCountryCodes.Close();
    85     delete iName;
       
    86     delete iSettingName;
       
    87     }
    87     }
    88 
    88 
    89 // ---------------------------------------------------------
    89 // ---------------------------------------------------------
    90 // Get the id of region
    90 // Get the id of region
    91 // ---------------------------------------------------------
    91 // ---------------------------------------------------------
    92 //
    92 //
    93 EXPORT_C TRadioRegion CRadioRegion::Id() const
    93 EXPORT_C TRadioRegion CRadioRegion::Id() const
    94     {
    94     {
       
    95     LEVEL3( LOG_METHOD_AUTO );
    95     return iId;
    96     return iId;
    96     }
    97     }
    97 
    98 
    98 // ---------------------------------------------------------
    99 // ---------------------------------------------------------
    99 // Get the step interval of region
   100 // Get the step interval of region
   100 // ---------------------------------------------------------
   101 // ---------------------------------------------------------
   101 //
   102 //
   102 EXPORT_C TUint32 CRadioRegion::StepSize() const
   103 EXPORT_C TUint32 CRadioRegion::StepSize() const
   103     {
   104     {
       
   105     LEVEL3( LOG_METHOD_AUTO );
   104     return iStepSize;
   106     return iStepSize;
   105     }
   107     }
   106 
   108 
   107 // ---------------------------------------------------------
   109 // ---------------------------------------------------------
   108 //
   110 //
   109 // ---------------------------------------------------------
   111 // ---------------------------------------------------------
   110 //
   112 //
   111 EXPORT_C TUint32 CRadioRegion::MinFrequency() const
   113 EXPORT_C TUint32 CRadioRegion::MinFrequency() const
   112     {
   114     {
       
   115     LEVEL3( LOG_METHOD_AUTO );
   113     return iMinFreq;
   116     return iMinFreq;
   114     }
   117     }
   115 
   118 
   116 // ---------------------------------------------------------
   119 // ---------------------------------------------------------
   117 //
   120 //
   118 // ---------------------------------------------------------
   121 // ---------------------------------------------------------
   119 //
   122 //
   120 EXPORT_C TUint32 CRadioRegion::MaxFrequency() const
   123 EXPORT_C TUint32 CRadioRegion::MaxFrequency() const
   121     {
   124     {
       
   125     LEVEL3( LOG_METHOD_AUTO );
   122     return iMaxFreq;
   126     return iMaxFreq;
   123     }
   127     }
   124 
   128 
   125 // ---------------------------------------------------------
   129 // ---------------------------------------------------------
   126 //
   130 //
   127 // ---------------------------------------------------------
   131 // ---------------------------------------------------------
   128 //
   132 //
   129 EXPORT_C TInt CRadioRegion::DecimalCount() const
   133 EXPORT_C TInt CRadioRegion::DecimalCount() const
   130     {
   134     {
       
   135     LEVEL3( LOG_METHOD_AUTO );
   131     return iDecimalCount;
   136     return iDecimalCount;
   132     }
   137     }
   133 
   138 
   134 // ---------------------------------------------------------
   139 // ---------------------------------------------------------
   135 // Get the country code of region
   140 // Get the country code of region
   136 // ---------------------------------------------------------
   141 // ---------------------------------------------------------
   137 //
   142 //
   138 EXPORT_C const RRadioCountryCodeArray& CRadioRegion::CountryCodes()
   143 EXPORT_C const RRadioCountryCodeArray& CRadioRegion::CountryCodes()
   139     {
   144     {
       
   145     LEVEL3( LOG_METHOD_AUTO );
   140     return iCountryCodes;
   146     return iCountryCodes;
   141     }
   147     }
   142 
       
   143 // ---------------------------------------------------------
       
   144 // Get the name of region
       
   145 // ---------------------------------------------------------
       
   146 //
       
   147 EXPORT_C const TDesC16& CRadioRegion::Name() const
       
   148     {
       
   149     return *iName;
       
   150     }
       
   151 
       
   152 // ---------------------------------------------------------
       
   153 // Get the name of region
       
   154 // ---------------------------------------------------------
       
   155 //
       
   156 EXPORT_C const TDesC16& CRadioRegion::SettingItemName() const
       
   157     {
       
   158     return *iSettingName;
       
   159     }