mmserv/radioutility/fmpresetutility/src/RadioFmPresetChannel.cpp
changeset 0 71ca22bcf22a
equal deleted inserted replaced
-1:000000000000 0:71ca22bcf22a
       
     1 /*
       
     2 * Copyright (c) 2005 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:   Contains implementation of the TPresetChannel class, which holds 
       
    15 *                       the FmRadioUtility settings.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 //  INCLUDES
       
    21 #include <s32mem.h>
       
    22 #include <RadioFmPresetUtility.h>
       
    23 #include "RadioFmPresetUtilityBody.h"
       
    24 #include <RadioPresetUtility.h>
       
    25 #include "RadioFmPresetChannel.h"
       
    26 #include "debug.h"
       
    27 
       
    28 
       
    29 // ============================ MEMBER FUNCTIONS ===============================
       
    30 
       
    31 // ----------------------------------------------------
       
    32 // TPresetChannel::TPresetChannel
       
    33 // Default class constructor.
       
    34 // Returns: None
       
    35 // ----------------------------------------------------
       
    36 //
       
    37 TPresetChannel::TPresetChannel():
       
    38 	iPresetChannelFrequency( KDefaultRadioFrequency ),
       
    39 	iPresetChannelPTY(0),
       
    40 	iPresetChannelPI(0)
       
    41     {
       
    42     }
       
    43 
       
    44 // ----------------------------------------------------
       
    45 // TPresetChannel::GetChannelFrequency
       
    46 // retrieve current frequency
       
    47 // Returns: iPresetChannelFrequency: the preset channel frequency
       
    48 // ----------------------------------------------------
       
    49 //
       
    50 TInt TPresetChannel::GetChannelFrequency() const
       
    51     {
       
    52     return iPresetChannelFrequency;
       
    53     }
       
    54 
       
    55 // ----------------------------------------------------
       
    56 // TPresetChannel::GetChannelName
       
    57 // set the current preset
       
    58 // Returns: iPresetChannelName: preset channel name
       
    59 // ----------------------------------------------------
       
    60 //
       
    61 TFmPresetName TPresetChannel::GetChannelName() const
       
    62     {
       
    63     return iPresetChannelName;
       
    64     }
       
    65 
       
    66 // ----------------------------------------------------
       
    67 // TPresetChannel::SetChannelName
       
    68 // set the current preset
       
    69 // Returns: None
       
    70 // ----------------------------------------------------
       
    71 //
       
    72 void TPresetChannel::SetChannelName(
       
    73     const TFmPresetName& aStationName )  //new channel name to be set
       
    74     {
       
    75     iPresetChannelName = aStationName;
       
    76     }
       
    77 
       
    78 // ----------------------------------------------------
       
    79 // TPresetChannel::SetChannelName
       
    80 // set the current preset
       
    81 // Returns: None
       
    82 // ----------------------------------------------------
       
    83 //
       
    84 void TPresetChannel::SetChannelUrl(
       
    85     const TFmPresetUrl& aStationUrl )  //new channel name to be set
       
    86     {
       
    87     iPresetChannelUrl = aStationUrl;
       
    88     }
       
    89 
       
    90 // ----------------------------------------------------
       
    91 // TPresetChannel::GetChannelUrl
       
    92 // Get the current preset's Url
       
    93 // Returns: iPresetChannelUrl: preset channel Url
       
    94 // ----------------------------------------------------
       
    95 //
       
    96 TFmPresetUrl TPresetChannel::ChannelUrl() const
       
    97     {
       
    98     return iPresetChannelUrl;
       
    99     }
       
   100 
       
   101 // ----------------------------------------------------
       
   102 // TPresetChannel::SetChannelPty
       
   103 // Set the current preset's PTY
       
   104 // Returns: none
       
   105 // ----------------------------------------------------
       
   106 //
       
   107 void TPresetChannel::SetChannelPty(const TUint aPTY)
       
   108     {
       
   109     iPresetChannelPTY = aPTY;
       
   110     }
       
   111 
       
   112 // ----------------------------------------------------
       
   113 // TPresetChannel::GetChannelPty
       
   114 // Get the current preset's PTY
       
   115 // Returns: iPresetChannelPTY: preset channel PTY
       
   116 // ----------------------------------------------------
       
   117 //
       
   118 TUint TPresetChannel::ChannelPty() const
       
   119     {
       
   120     return iPresetChannelPTY;
       
   121     }
       
   122 
       
   123 // ----------------------------------------------------
       
   124 // TPresetChannel::SetChannelPI
       
   125 // Set the current preset's PI-code
       
   126 // Returns: none
       
   127 // ----------------------------------------------------
       
   128 //
       
   129 void TPresetChannel::SetChannelPI(const TUint aPI)
       
   130     {
       
   131     iPresetChannelPI = aPI;
       
   132     }
       
   133 
       
   134 // ----------------------------------------------------
       
   135 // TPresetChannel::GetChannelPI
       
   136 // Get the current preset's PI-code
       
   137 // Returns: iPresetChannelPI: preset channel PI
       
   138 // ----------------------------------------------------
       
   139 //
       
   140 TUint TPresetChannel::ChannelPI() const
       
   141     {
       
   142     return iPresetChannelPI;
       
   143     }
       
   144 
       
   145 // ----------------------------------------------------
       
   146 // ----------------------------------------------------
       
   147 // TPresetChannel::SetChannelFavouriteInfo
       
   148 // Set the current preset's favourite status bit
       
   149 // Returns: none
       
   150 // ----------------------------------------------------
       
   151 //
       
   152 void TPresetChannel::SetChannelFavouriteInfo(const TBool aFavourite)
       
   153     {
       
   154     iPresetChannelMisc.Assign( MiscInfo::Favourite, aFavourite );
       
   155     }
       
   156 
       
   157 // ----------------------------------------------------
       
   158 // TPresetChannel::GetChannelFavouriteInfo
       
   159 // Get the current preset's favourite status bit
       
   160 // Returns: iPresetChannelMisc: favourite status bit
       
   161 // ----------------------------------------------------
       
   162 //
       
   163 TBool TPresetChannel::ChannelFavouriteInfo() const
       
   164     {
       
   165     TBool ret = EFalse;
       
   166     if (iPresetChannelMisc[ MiscInfo::Favourite ])
       
   167         {
       
   168         ret = ETrue;
       
   169         }
       
   170     return ret;
       
   171     }
       
   172 
       
   173 // ----------------------------------------------------
       
   174 // TPresetChannel::SetChannelUserRenameInfo
       
   175 // Set the current preset's user rename status bit
       
   176 // Returns: none
       
   177 // ----------------------------------------------------
       
   178 //
       
   179 void TPresetChannel::SetChannelUserRenameInfo(const TBool aUserRename)
       
   180     {
       
   181     iPresetChannelMisc.Assign( MiscInfo::UserRename, aUserRename );
       
   182     }
       
   183 
       
   184 // ----------------------------------------------------
       
   185 // TPresetChannel::GetChannelUserRenameInfo
       
   186 // Get the current preset's user rename status bit
       
   187 // Returns: iPresetChannelMisc: user rename status bit
       
   188 // ----------------------------------------------------
       
   189 //
       
   190 TBool TPresetChannel::ChannelUserRenameInfo() const
       
   191     {
       
   192     TBool ret = EFalse;
       
   193     if (iPresetChannelMisc[ MiscInfo::UserRename ])
       
   194         {
       
   195         ret = ETrue;
       
   196         }
       
   197     return ret;
       
   198     }
       
   199 
       
   200 // ----------------------------------------------------
       
   201 // TPresetChannel::SaveChannelFrequency
       
   202 // Set the current preset frequency
       
   203 // Returns: None
       
   204 // ----------------------------------------------------
       
   205 //
       
   206 void TPresetChannel::SaveChannelFrequency(
       
   207     const TInt aFrequency )  //new preset channel frequency
       
   208     {
       
   209     iPresetChannelFrequency = aFrequency;
       
   210     }
       
   211 
       
   212 // ----------------------------------------------------
       
   213 // TPresetChannel::ExternalizeL
       
   214 // Externalize data from buffer to stream
       
   215 // Returns: None
       
   216 // ----------------------------------------------------
       
   217 //
       
   218 void TPresetChannel::ExternalizeL(
       
   219     RWriteStream & aStream ) const  // a reference to a RDesWriteStream
       
   220     {
       
   221 	aStream.WriteUint32L(iPresetChannelPTY);
       
   222 	aStream.WriteUint32L(iPresetChannelPI);
       
   223 	aStream.WriteUint32L(iPresetChannelMisc.Value());
       
   224     }
       
   225 
       
   226 // ----------------------------------------------------
       
   227 // TPresetChannel::InternalizeL
       
   228 // Returns: None
       
   229 // Interalize the stream
       
   230 // ----------------------------------------------------
       
   231 //
       
   232 void TPresetChannel::InternalizeL(
       
   233     RReadStream & aStream )  // a reference to a RDesReadStream
       
   234     {
       
   235     iPresetChannelPTY = aStream.ReadInt32L();
       
   236     iPresetChannelPI = aStream.ReadInt32L();
       
   237     iPresetChannelMisc = aStream.ReadInt32L();    
       
   238     }
       
   239 
       
   240 //  End of File