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