mmserv/radioutility/radio_utility/src/RadioFmTunerUtilityBody.cpp
changeset 0 71ca22bcf22a
child 19 095bea5f582e
equal deleted inserted replaced
-1:000000000000 0:71ca22bcf22a
       
     1 /*
       
     2 * Copyright (c) 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:  Radio FM Tuner Utility implementation body.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "RadioFmTunerUtilityBody.h"
       
    20 #include "RadioUtilityBody.h"
       
    21 
       
    22 // -----------------------------------------------------------------------------
       
    23 // CRadioFmTunerUtility::CBody::NewL
       
    24 // Two-phased constructor.
       
    25 // -----------------------------------------------------------------------------
       
    26 //
       
    27 CRadioFmTunerUtility::CBody* CRadioFmTunerUtility::CBody::NewL(
       
    28     RRadioSession& aRadioSession,
       
    29     MRadioFmTunerObserver& aObserver )
       
    30     {
       
    31     CRadioFmTunerUtility::CBody* s = new(ELeave) CRadioFmTunerUtility::CBody();
       
    32     s->iRadioFmTunerUtilityClient = &aObserver;
       
    33     s->iRadioSession = &aRadioSession;
       
    34     CleanupStack::PushL(s);
       
    35     s->ConstructL();
       
    36     CleanupStack::Pop();
       
    37     return s;
       
    38     }
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // CRadioFmTunerUtility::ConstructL
       
    42 // Two-phased constructor.
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 void CRadioFmTunerUtility::CBody::ConstructL()
       
    46     {
       
    47     }
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // CRadioFmTunerUtility::CBody::CBody
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 CRadioFmTunerUtility::CBody::CBody()
       
    54     {
       
    55     }
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 // CRadioFmTunerUtility::CBody::~CBody
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 CRadioFmTunerUtility::CBody::~CBody()
       
    62     {
       
    63     }
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // CRadioFmTunerUtility::CBody::RequestTunerControl
       
    67 // (other items were commented in a header).
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 void CRadioFmTunerUtility::CBody::RequestTunerControl()
       
    71     {
       
    72     iRadioSession->RequestTunerControl( ERsTunerFm );
       
    73     }
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // CRadioFmTunerUtility::CBody::Close
       
    77 // (other items were commented in a header).
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 void CRadioFmTunerUtility::CBody::Close()
       
    81     {
       
    82     // Consider releasing tuner control here.
       
    83     }
       
    84 
       
    85 // -----------------------------------------------------------------------------
       
    86 // CRadioFmTunerUtility::CBody::GetCapabilities
       
    87 // (other items were commented in a header).
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 TInt CRadioFmTunerUtility::CBody::GetCapabilities(
       
    91     TFmTunerCapabilities& aCaps ) const
       
    92     {
       
    93     TRsTunerCapabilities caps;
       
    94     TInt error = iRadioSession->GetTunerCapabilities( caps );
       
    95 
       
    96     if ( !error )
       
    97         {
       
    98         aCaps.iTunerBands = caps.iFrequencyRange;
       
    99         aCaps.iTunerFunctions = caps.iCapabilities;
       
   100         aCaps.iAdditionalFunctions1 = caps.iAdditionalFunctions1;
       
   101         aCaps.iAdditionalFunctions2 = caps.iAdditionalFunctions2;
       
   102 
       
   103         }
       
   104     return error;
       
   105     }
       
   106 
       
   107 // -----------------------------------------------------------------------------
       
   108 // CRadioFmTunerUtility::CBody::EnableTunerInOfflineMode
       
   109 // (other items were commented in a header).
       
   110 // -----------------------------------------------------------------------------
       
   111 //
       
   112 TInt CRadioFmTunerUtility::CBody::EnableTunerInOfflineMode(
       
   113     TBool aEnable )
       
   114     {
       
   115     return iRadioSession->EnableTunerInOfflineMode( aEnable );
       
   116     }
       
   117 
       
   118 // -----------------------------------------------------------------------------
       
   119 // CRadioFmTunerUtility::CBody::GetFrequencyRange
       
   120 // (other items were commented in a header).
       
   121 // -----------------------------------------------------------------------------
       
   122 //
       
   123 TInt CRadioFmTunerUtility::CBody::GetFrequencyRange(
       
   124     TFmRadioFrequencyRange& aRange,
       
   125     TInt& aMinFreq,
       
   126     TInt& aMaxFreq ) const
       
   127     {
       
   128 
       
   129     TRsFrequencyRange range;
       
   130     TInt error = iRadioSession->GetFrequencyRange( range, aMinFreq, aMaxFreq );
       
   131     if ( !error )
       
   132         {
       
   133     switch ( range )
       
   134         {
       
   135         case ERsRangeFmEuroAmerica:
       
   136             aRange = EFmRangeEuroAmerica;
       
   137             break;
       
   138         case ERsRangeFmJapan:
       
   139             aRange = EFmRangeJapan;
       
   140             break;
       
   141         default:
       
   142             break;
       
   143             }
       
   144         }
       
   145 #ifdef _DEBUG
       
   146     RDebug::Print(_L("CRadioFmTunerUtility::CBody::GetFrequencyRange, aRange = %d, aMinFreq = %d, aMaxFreq = %d"),
       
   147         aRange, aMinFreq, aMaxFreq);
       
   148 #endif
       
   149     return error;
       
   150     }
       
   151 
       
   152 
       
   153 // -----------------------------------------------------------------------------
       
   154 // CRadioFmTunerUtility::CBody::SetFrequencyRange
       
   155 // (other items were commented in a header).
       
   156 // -----------------------------------------------------------------------------
       
   157 //
       
   158 void CRadioFmTunerUtility::CBody::SetFrequencyRange(
       
   159     TFmRadioFrequencyRange aRange )
       
   160     {
       
   161 #ifdef _DEBUG
       
   162     RDebug::Print(_L("CRadioFmTunerUtility::CBody::SetFrequencyRange, aRange = %d"), aRange);
       
   163 #endif
       
   164     TRsFrequencyRange range = ERsRangeFmEuroAmerica;    //default
       
   165     switch (aRange)
       
   166         {
       
   167         case EFmRangeEuroAmerica:
       
   168             range = ERsRangeFmEuroAmerica;
       
   169             break;
       
   170         case EFmRangeJapan:
       
   171             range = ERsRangeFmJapan;
       
   172             break;
       
   173         default:
       
   174             break;
       
   175         }
       
   176     iRadioSession->SetFrequencyRange( range );
       
   177     }
       
   178 
       
   179 
       
   180 // -----------------------------------------------------------------------------
       
   181 // CRadioFmTunerUtility::CBody::CancelSetFrequencyRange
       
   182 // (other items were commented in a header).
       
   183 // -----------------------------------------------------------------------------
       
   184 //
       
   185 void CRadioFmTunerUtility::CBody::CancelSetFrequencyRange()
       
   186     {
       
   187     iRadioSession->CancelSetFrequencyRange();
       
   188     }
       
   189 
       
   190 // -----------------------------------------------------------------------------
       
   191 // CRadioFmTunerUtility::CBody::SetFrequency
       
   192 // (other items were commented in a header).
       
   193 // -----------------------------------------------------------------------------
       
   194 //
       
   195 void CRadioFmTunerUtility::CBody::SetFrequency(
       
   196     TInt aFrequency )
       
   197     {
       
   198 #ifdef _DEBUG
       
   199     RDebug::Print(_L("CRadioFmTunerUtility::CBody::SetFrequency, aFrequency = %d"), aFrequency);
       
   200 #endif
       
   201     iRadioSession->SetFrequency(aFrequency);
       
   202     }
       
   203 
       
   204 // -----------------------------------------------------------------------------
       
   205 // CRadioFmTunerUtility::CBody::CancelSetFrequencyRange
       
   206 // Body of CancelSetFrequencyRange
       
   207 // (other items were commented in a header).
       
   208 // -----------------------------------------------------------------------------
       
   209 //
       
   210 void CRadioFmTunerUtility::CBody::CancelSetFrequency()
       
   211     {
       
   212     iRadioSession->CancelSetFrequency();
       
   213     }
       
   214 
       
   215 // -----------------------------------------------------------------------------
       
   216 // CRadioFmTunerUtility::CBody::GetFrequency
       
   217 // (other items were commented in a header).
       
   218 // -----------------------------------------------------------------------------
       
   219 //
       
   220 TInt CRadioFmTunerUtility::CBody::GetFrequency(
       
   221     TInt& aFrequency ) const
       
   222     {
       
   223     return iRadioSession->GetFrequency(aFrequency);
       
   224     }
       
   225 
       
   226 // -----------------------------------------------------------------------------
       
   227 // CRadioFmTunerUtility::CBody::StationSeek
       
   228 // (other items were commented in a header).
       
   229 // -----------------------------------------------------------------------------
       
   230 //
       
   231 void CRadioFmTunerUtility::CBody::StationSeek(
       
   232     TBool aUpwards )
       
   233     {
       
   234 #ifdef _DEBUG
       
   235     RDebug::Print(_L("CRadioFmTunerUtility::CBody::StationSeek, aUpwards = %d"), aUpwards);
       
   236 #endif
       
   237     iRadioSession->StationSeek(aUpwards);
       
   238     }
       
   239 
       
   240 // -----------------------------------------------------------------------------
       
   241 // CRadioFmTunerUtility::CBody::CancelStationSeek
       
   242 // (other items were commented in a header).
       
   243 // -----------------------------------------------------------------------------
       
   244 //
       
   245 void CRadioFmTunerUtility::CBody::CancelStationSeek()
       
   246     {
       
   247     iRadioSession->CancelStationSeek();
       
   248     }
       
   249 
       
   250 // -----------------------------------------------------------------------------
       
   251 // CRadioFmTunerUtility::CBody::GetSignalStrength
       
   252 // (other items were commented in a header).
       
   253 // -----------------------------------------------------------------------------
       
   254 //
       
   255 TInt CRadioFmTunerUtility::CBody::GetSignalStrength(
       
   256     TInt& aSignalStrength ) const
       
   257     {
       
   258     return iRadioSession->GetSignalStrength(aSignalStrength);
       
   259     }
       
   260 
       
   261 // -----------------------------------------------------------------------------
       
   262 // CRadioFmTunerUtility::GetMaxSignalStrength
       
   263 // (other items were commented in a header).
       
   264 // -----------------------------------------------------------------------------
       
   265 //
       
   266 TInt CRadioFmTunerUtility::CBody::GetMaxSignalStrength(
       
   267     TInt& aMaxSignalStrength ) const
       
   268     {
       
   269     return iRadioSession->GetMaxSignalStrength(aMaxSignalStrength);
       
   270     }
       
   271 
       
   272 // -----------------------------------------------------------------------------
       
   273 // CRadioFmTunerUtility::CBody::GetStereoMode
       
   274 // (other items were commented in a header).
       
   275 // -----------------------------------------------------------------------------
       
   276 //
       
   277 TInt CRadioFmTunerUtility::CBody::GetStereoMode(
       
   278     TBool& aStereo ) const
       
   279     {
       
   280     return iRadioSession->GetStereoMode(aStereo);
       
   281     }
       
   282 
       
   283 // -----------------------------------------------------------------------------
       
   284 // CRadioFmTunerUtility::CBody::ForceMonoReception
       
   285 // (other items were commented in a header).
       
   286 // -----------------------------------------------------------------------------
       
   287 //
       
   288 TInt CRadioFmTunerUtility::CBody::ForceMonoReception(
       
   289     TBool aForcedMono)
       
   290     {
       
   291     return iRadioSession->ForceMonoReception(aForcedMono);
       
   292     }
       
   293 
       
   294 // -----------------------------------------------------------------------------
       
   295 // CRadioFmTunerUtility::CBody::GetForcedMonoReception
       
   296 // (other items were commented in a header).
       
   297 // -----------------------------------------------------------------------------
       
   298 //
       
   299 TInt CRadioFmTunerUtility::CBody::GetForcedMonoReception(
       
   300     TBool& aForcedMono ) const
       
   301     {
       
   302     return iRadioSession->GetForceMonoReception(aForcedMono);
       
   303     }
       
   304 
       
   305 // -----------------------------------------------------------------------------
       
   306 // CRadioFmTunerUtility::CBody::SetSquelch
       
   307 // (other items were commented in a header).
       
   308 // -----------------------------------------------------------------------------
       
   309 //
       
   310 TInt CRadioFmTunerUtility::CBody::SetSquelch(
       
   311     TBool aSquelch )
       
   312     {
       
   313     return iRadioSession->SetSquelch(aSquelch);
       
   314     }
       
   315 
       
   316 // -----------------------------------------------------------------------------
       
   317 // CRadioFmTunerUtility::CBody::GetSquelch
       
   318 // (other items were commented in a header).
       
   319 // -----------------------------------------------------------------------------
       
   320 //
       
   321 TInt CRadioFmTunerUtility::CBody::GetSquelch(
       
   322     TBool& aSquelch ) const
       
   323     {
       
   324     return iRadioSession->GetSquelch(aSquelch);
       
   325     }
       
   326 
       
   327 // End of File
       
   328 
       
   329 
       
   330 
       
   331 
       
   332