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