fmradio/fmradioengine/src/fmradioregion.cpp
changeset 0 f3d95d9c00ab
equal deleted inserted replaced
-1:000000000000 0:f3d95d9c00ab
       
     1 /*
       
     2 * Copyright (c) 2004-2007 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: provides information about FM region
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <barsread.h>
       
    21 #include "fmradioregion.h"
       
    22 
       
    23 // ================= MEMBER FUNCTIONS =======================
       
    24 
       
    25 // C++ default constructor can NOT contain any code, that
       
    26 // might leave.
       
    27 //
       
    28 CFMRadioRegion::CFMRadioRegion()
       
    29     {
       
    30     }
       
    31 
       
    32 // EPOC default constructor can leave.
       
    33 void CFMRadioRegion::ConstructL(TResourceReader& aRr)
       
    34     {
       
    35 	iId = static_cast<TFMRadioRegionSetting>(aRr.ReadUint16());
       
    36 	iStepSize = static_cast<TUint16>( aRr.ReadUint16() );
       
    37 	iMinFreq = aRr.ReadUint32();
       
    38 	iMaxFreq = aRr.ReadUint32();
       
    39 	iDecimalCount = aRr.ReadInt16();
       
    40 
       
    41 	TInt countryCodeCount = aRr.ReadInt16();
       
    42 	for(TInt i = 0 ; i < countryCodeCount ; i++)
       
    43 		{
       
    44 		TPtrC code;
       
    45 		code.Set(aRr.ReadTPtrC());
       
    46 		User::LeaveIfError(iCountryCodes.Append(code.AllocL()));
       
    47 		}
       
    48 
       
    49 	iName = aRr.ReadHBufC16L();
       
    50 	iSettingName = aRr.ReadHBufC16L();
       
    51     }
       
    52 
       
    53 // Two-phased constructor.
       
    54 CFMRadioRegion* CFMRadioRegion::NewL(TResourceReader& aRr)
       
    55     {
       
    56     CFMRadioRegion* self = new (ELeave) CFMRadioRegion;
       
    57     
       
    58     CleanupStack::PushL(self);
       
    59     self->ConstructL(aRr);
       
    60     CleanupStack::Pop();
       
    61 
       
    62     return self;
       
    63     }
       
    64 
       
    65     
       
    66 // Destructor
       
    67 CFMRadioRegion::~CFMRadioRegion()
       
    68     {
       
    69     iCountryCodes.ResetAndDestroy();
       
    70 	iCountryCodes.Close();
       
    71 	delete iName;
       
    72 	delete iSettingName;
       
    73     }
       
    74 
       
    75 // ---------------------------------------------------------
       
    76 // CFMRadioRegion::Id
       
    77 // Get the id of region
       
    78 // ---------------------------------------------------------
       
    79 //
       
    80 TFMRadioRegionSetting CFMRadioRegion::Id() const
       
    81 	{
       
    82 	return iId;
       
    83 	}
       
    84 
       
    85 // ---------------------------------------------------------
       
    86 // CFMRadioRegion::StepSize
       
    87 // Get the step interval of region
       
    88 // ---------------------------------------------------------
       
    89 //
       
    90 TUint32 CFMRadioRegion::StepSize() const
       
    91 	{
       
    92 	return iStepSize;
       
    93 	}
       
    94 
       
    95 // ---------------------------------------------------------
       
    96 // CFMRadioRegion::MinFreq
       
    97 // ---------------------------------------------------------
       
    98 //
       
    99 TUint32 CFMRadioRegion::MinFrequency() const
       
   100 	{
       
   101 	return iMinFreq;
       
   102 	}
       
   103 
       
   104 // ---------------------------------------------------------
       
   105 // CFMRadioRegion::MaxFreq
       
   106 // ---------------------------------------------------------
       
   107 //
       
   108 TUint32 CFMRadioRegion::MaxFrequency() const
       
   109 	{
       
   110 	return iMaxFreq;
       
   111 	}
       
   112 	
       
   113 // ---------------------------------------------------------
       
   114 // CFMRadioRegion::DecimalCount
       
   115 // ---------------------------------------------------------
       
   116 //
       
   117 TInt CFMRadioRegion::DecimalCount() const
       
   118 	{
       
   119 	return iDecimalCount;
       
   120 	}
       
   121 
       
   122 // ---------------------------------------------------------
       
   123 // CFMRadioRegion::CountryCode
       
   124 // Get the country code of region
       
   125 // ---------------------------------------------------------
       
   126 //
       
   127 const RFMRadioCountryCodeArray& CFMRadioRegion::CountryCodes()
       
   128 	{
       
   129 	return iCountryCodes;
       
   130 	}
       
   131 
       
   132 // ---------------------------------------------------------
       
   133 // CFMRadioRegion::Name
       
   134 // Get the name of region
       
   135 // ---------------------------------------------------------
       
   136 //
       
   137 const TDesC16& CFMRadioRegion::Name() const
       
   138 	{
       
   139 	return *iName;
       
   140 	}
       
   141 
       
   142 // ---------------------------------------------------------
       
   143 // CFMRadioRegion::SettingItemName
       
   144 // Get the name of region
       
   145 // ---------------------------------------------------------
       
   146 //
       
   147 const TDesC16& CFMRadioRegion::SettingItemName() const
       
   148 	{
       
   149 	return *iSettingName;
       
   150 	}
       
   151 
       
   152 //  End of File