mmserv/radioutility/radio_utility/src/RadioRdsUtilityBody.cpp
changeset 0 71ca22bcf22a
child 16 43d09473c595
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 RDS Utility body implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "RadioRdsUtilityBody.h"
       
    20 #include "RadioServerData.h"
       
    21 #include "RadioSession.h"
       
    22 
       
    23 // ======== MEMBER FUNCTIONS ========
       
    24 
       
    25 // -----------------------------------------------------------------------------
       
    26 // CRadioRdsUtility::CBody::NewL
       
    27 // Two-phased constructor.
       
    28 // -----------------------------------------------------------------------------
       
    29 //
       
    30 CRadioRdsUtility::CBody* CRadioRdsUtility::CBody::NewL(
       
    31     RRadioSession& aRadioSession,
       
    32     MRadioRdsObserver& aObserver )
       
    33     {
       
    34     CRadioRdsUtility::CBody* s = new(ELeave) CRadioRdsUtility::CBody();
       
    35     s->iRadioRdsUtilityClient = &aObserver;
       
    36     s->iRadioSession = &aRadioSession;
       
    37     CleanupStack::PushL(s);
       
    38     s->ConstructL();
       
    39     CleanupStack::Pop();
       
    40     return s;
       
    41     }
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // CRadioRdsUtility::CBody::ConstructL
       
    45 // Two-phased constructor.
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 void CRadioRdsUtility::CBody::ConstructL()
       
    49     {
       
    50     }
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CRadioRdsUtility::CBody::CBody
       
    54 // -----------------------------------------------------------------------------
       
    55 //
       
    56 CRadioRdsUtility::CBody::CBody()
       
    57     {
       
    58     }
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // Destructor.
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 CRadioRdsUtility::CBody::~CBody()
       
    65     {
       
    66     }
       
    67 
       
    68 // -----------------------------------------------------------------------------
       
    69 // CRadioRdsUtility::CBody::Close
       
    70 // Cancel all requested RDS notifications if any were requested.
       
    71 // (other items were commented in a header).
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 void CRadioRdsUtility::CBody::Close()
       
    75     {
       
    76     if ( iRdsDataReq.iRdsFunctions || iRdsDataReq.iAdditionalFunctions1 ||
       
    77          iRdsDataReq.iAdditionalFunctions2 )
       
    78         {
       
    79         iRadioSession->CancelNotifyRdsDataChange();
       
    80         }
       
    81     }
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // CRadioRdsUtility::CBody::GetCapabilities
       
    85 // (other items were commented in a header).
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 TInt CRadioRdsUtility::CBody::GetCapabilities(
       
    89     TRdsCapabilities& aCaps ) const
       
    90     {
       
    91     TRsRdsCapabilities Caps;
       
    92     TInt error = iRadioSession->GetRdsCapabilities(Caps);
       
    93     if ( !error )
       
    94         {
       
    95         aCaps.iRdsFunctions = Caps.iRdsFunctions;
       
    96         aCaps.iAdditionalFunctions1 = Caps.iAdditionalFunctions1;
       
    97         aCaps.iAdditionalFunctions2 = Caps.iAdditionalFunctions2;
       
    98         }
       
    99     return error;
       
   100     }
       
   101 
       
   102 // -----------------------------------------------------------------------------
       
   103 // CRadioRdsUtility::CBody::GetRdsSignalStatus
       
   104 // (other items were commented in a header).
       
   105 // -----------------------------------------------------------------------------
       
   106 //
       
   107 TInt CRadioRdsUtility::CBody::GetRdsSignalStatus(
       
   108     TBool& aRdsSignal ) const
       
   109     {
       
   110     return iRadioSession->GetRdsSignalStatus( aRdsSignal );
       
   111     }
       
   112 
       
   113 // -----------------------------------------------------------------------------
       
   114 // CRadioRdsUtility::CBody::NotifyRdsDataChange
       
   115 // (other items were commented in a header).
       
   116 // -----------------------------------------------------------------------------
       
   117 //
       
   118 TInt CRadioRdsUtility::CBody::NotifyRdsDataChange(
       
   119     TRdsData aRdsData )
       
   120     {
       
   121     iRdsDataReq.iRdsFunctions = aRdsData.iRdsFunctions;
       
   122     iRdsDataReq.iAdditionalFunctions1 = aRdsData.iAdditionalFunctions1;
       
   123     iRdsDataReq.iAdditionalFunctions2 = aRdsData.iAdditionalFunctions2;
       
   124     return iRadioSession->NotifyRdsDataChange( iRdsDataReq );
       
   125     }
       
   126 
       
   127 // -----------------------------------------------------------------------------
       
   128 // CRadioRdsUtility::CBody::CancelNotifyRdsDataChange
       
   129 // (other items were commented in a header).
       
   130 // -----------------------------------------------------------------------------
       
   131 //
       
   132 void CRadioRdsUtility::CBody::CancelNotifyRdsDataChange()
       
   133     {
       
   134     iRadioSession->CancelNotifyRdsDataChange();
       
   135     }
       
   136 
       
   137 // -----------------------------------------------------------------------------
       
   138 // CRadioRdsUtility::CBody::SetAutomaticSwitching
       
   139 // (other items were commented in a header).
       
   140 // -----------------------------------------------------------------------------
       
   141 //
       
   142 TInt CRadioRdsUtility::CBody::SetAutomaticSwitching(
       
   143     TBool aAuto )
       
   144     {
       
   145     return iRadioSession->SetAutomaticSwitching( aAuto );
       
   146     }
       
   147 
       
   148 // -----------------------------------------------------------------------------
       
   149 // CRadioRdsUtility::CBody::GetAutomaticSwitching
       
   150 // (other items were commented in a header).
       
   151 // -----------------------------------------------------------------------------
       
   152 //
       
   153 TInt CRadioRdsUtility::CBody::GetAutomaticSwitching(
       
   154     TBool& aAuto )
       
   155     {
       
   156     return iRadioSession->GetAutomaticSwitching( aAuto );
       
   157     }
       
   158 
       
   159 // -----------------------------------------------------------------------------
       
   160 // CRadioRdsUtility::CBody::CancelAFSearch
       
   161 // (other items were commented in a header).
       
   162 // -----------------------------------------------------------------------------
       
   163 //
       
   164 void CRadioRdsUtility::CBody::CancelAFSearch()
       
   165     {
       
   166     iRadioSession->CancelAFSearch();
       
   167     }
       
   168 
       
   169 // -----------------------------------------------------------------------------
       
   170 // CRadioRdsUtility::CBody::SetAutomaticTrafficAnnouncement
       
   171 // (other items were commented in a header).
       
   172 // -----------------------------------------------------------------------------
       
   173 //
       
   174 TInt CRadioRdsUtility::CBody::SetAutomaticTrafficAnnouncement(
       
   175     TBool aAuto )
       
   176     {
       
   177     return iRadioSession->SetAutomaticTrafficAnnouncement( aAuto );
       
   178     }
       
   179 
       
   180 // -----------------------------------------------------------------------------
       
   181 // CRadioRdsUtility::CBody::GetAutomaticTrafficAnnouncement
       
   182 // (other items were commented in a header).
       
   183 // -----------------------------------------------------------------------------
       
   184 //
       
   185 TInt CRadioRdsUtility::CBody::GetAutomaticTrafficAnnouncement(
       
   186     TBool& aAuto )
       
   187     {
       
   188     return iRadioSession->GetAutomaticTrafficAnnouncement( aAuto );
       
   189     }
       
   190 
       
   191 // -----------------------------------------------------------------------------
       
   192 // CRadioRdsUtility::CBody::StationSeekByPTY
       
   193 // (other items were commented in a header).
       
   194 // -----------------------------------------------------------------------------
       
   195 //
       
   196 void CRadioRdsUtility::CBody::StationSeekByPTY(
       
   197     TRdsProgrammeType aPty,
       
   198     TBool aUpwards )
       
   199     {
       
   200     iRadioSession->StationSeekByPTY( aPty, aUpwards );
       
   201     }
       
   202 
       
   203 // -----------------------------------------------------------------------------
       
   204 // CRadioRdsUtility::CBody::StationSeekByTA
       
   205 // (other items were commented in a header).
       
   206 // -----------------------------------------------------------------------------
       
   207 //
       
   208 void CRadioRdsUtility::CBody::StationSeekByTA(
       
   209     TBool aSeekUp )
       
   210     {
       
   211     iRadioSession->StationSeekByTA( aSeekUp );
       
   212     }
       
   213 
       
   214 // -----------------------------------------------------------------------------
       
   215 // CRadioRdsUtility::CBody::StationSeekByTP
       
   216 // (other items were commented in a header).
       
   217 // -----------------------------------------------------------------------------
       
   218 //
       
   219 void CRadioRdsUtility::CBody::StationSeekByTP(
       
   220     TBool aSeekUp )
       
   221     {
       
   222     iRadioSession->StationSeekByTP( aSeekUp );
       
   223     }
       
   224 
       
   225 // -----------------------------------------------------------------------------
       
   226 // CRadioRdsUtility::CBody::CancelRdsStationSeek
       
   227 // (other items were commented in a header).
       
   228 // -----------------------------------------------------------------------------
       
   229 //
       
   230 void CRadioRdsUtility::CBody::CancelRdsStationSeek()
       
   231     {
       
   232     iRadioSession->CancelRdsStationSeek();
       
   233     }
       
   234 
       
   235 // -----------------------------------------------------------------------------
       
   236 // CRadioRdsUtility::CBody::GetFreqByPTY
       
   237 // (other items were commented in a header).
       
   238 // -----------------------------------------------------------------------------
       
   239 //
       
   240 void CRadioRdsUtility::CBody::GetFreqByPTY(
       
   241     TRdsProgrammeType aPty )
       
   242     {
       
   243     iRadioSession->GetFreqByPTY( aPty );
       
   244     }
       
   245 
       
   246 // -----------------------------------------------------------------------------
       
   247 // CRadioRdsUtility::CBody::CancelGetFreqByPTY
       
   248 // (other items were commented in a header).
       
   249 // -----------------------------------------------------------------------------
       
   250 //
       
   251 void CRadioRdsUtility::CBody::CancelGetFreqByPTY()
       
   252     {
       
   253     iRadioSession->CancelGetFreqByPTY();
       
   254     }
       
   255 
       
   256 // -----------------------------------------------------------------------------
       
   257 // CRadioRdsUtility::CBody::GetFreqByTA
       
   258 // (other items were commented in a header).
       
   259 // -----------------------------------------------------------------------------
       
   260 //
       
   261 void CRadioRdsUtility::CBody::GetFreqByTA()
       
   262     {
       
   263     iRadioSession->GetFreqByTA();
       
   264     }
       
   265 
       
   266 // -----------------------------------------------------------------------------
       
   267 // CRadioRdsUtility::CBody::CancelGetFreqByTA
       
   268 // (other items were commented in a header).
       
   269 // -----------------------------------------------------------------------------
       
   270 //
       
   271 void CRadioRdsUtility::CBody::CancelGetFreqByTA()
       
   272     {
       
   273     iRadioSession->CancelGetFreqByTA();
       
   274     }
       
   275 
       
   276 // -----------------------------------------------------------------------------
       
   277 // CRadioRdsUtility::CBody::GetPSByPTY
       
   278 // (other items were commented in a header).
       
   279 // -----------------------------------------------------------------------------
       
   280 //
       
   281 void CRadioRdsUtility::CBody::GetPSByPTY(
       
   282     TRdsProgrammeType aPty )
       
   283     {
       
   284     iRadioSession->GetPSByPTY( aPty );
       
   285     }
       
   286 
       
   287 // -----------------------------------------------------------------------------
       
   288 // CRadioRdsUtility::CBody::CancelGetPSByPTY
       
   289 // (other items were commented in a header).
       
   290 // -----------------------------------------------------------------------------
       
   291 //
       
   292 void CRadioRdsUtility::CBody::CancelGetPSByPTY()
       
   293     {
       
   294     iRadioSession->CancelGetPSByPTY();
       
   295     }
       
   296 
       
   297 // -----------------------------------------------------------------------------
       
   298 // CRadioRdsUtility::CBody::GetPSByTA
       
   299 // (other items were commented in a header).
       
   300 // -----------------------------------------------------------------------------
       
   301 //
       
   302 void CRadioRdsUtility::CBody::GetPSByTA()
       
   303     {
       
   304     iRadioSession->GetPSByTA();
       
   305     }
       
   306 
       
   307 // -----------------------------------------------------------------------------
       
   308 // CRadioRdsUtility::CBody::CancelGetPSByTA
       
   309 // (other items were commented in a header).
       
   310 // -----------------------------------------------------------------------------
       
   311 //
       
   312 void CRadioRdsUtility::CBody::CancelGetPSByTA()
       
   313     {
       
   314     iRadioSession->CancelGetPSByTA();
       
   315     }
       
   316 
       
   317 // -----------------------------------------------------------------------------
       
   318 // CRadioRdsUtility::CBody::GetProgrammeIdentification
       
   319 // (other items were commented in a header).
       
   320 // -----------------------------------------------------------------------------
       
   321 //
       
   322 TInt CRadioRdsUtility::CBody::GetProgrammeIdentification(
       
   323     TInt& aPi )
       
   324     {
       
   325     return iRadioSession->GetProgrammeIdentification( aPi );
       
   326     }
       
   327 
       
   328 // -----------------------------------------------------------------------------
       
   329 // CRadioRdsUtility::CBody::GetProgrammeType
       
   330 // (other items were commented in a header).
       
   331 // -----------------------------------------------------------------------------
       
   332 //
       
   333 TInt CRadioRdsUtility::CBody::GetProgrammeType(
       
   334     TRdsProgrammeType& aPty )
       
   335     {
       
   336     return iRadioSession->GetProgrammeType( aPty );
       
   337     }
       
   338 
       
   339 // -----------------------------------------------------------------------------
       
   340 // CRadioRdsUtility::CBody::GetProgrammeService
       
   341 // (other items were commented in a header).
       
   342 // -----------------------------------------------------------------------------
       
   343 //
       
   344 TInt CRadioRdsUtility::CBody::GetProgrammeService(
       
   345     TRdsPSName& aPs )
       
   346     {
       
   347     TRsRdsPSName ps;
       
   348     TInt error = iRadioSession->GetProgrammeService( ps );
       
   349 
       
   350     if ( aPs.Length() )
       
   351         {
       
   352         aPs.Copy( ps );
       
   353         }
       
   354 
       
   355     return error;
       
   356     }
       
   357 
       
   358 // -----------------------------------------------------------------------------
       
   359 // CRadioRdsUtility::CBody::GetRadioText
       
   360 // (other items were commented in a header).
       
   361 // -----------------------------------------------------------------------------
       
   362 //
       
   363 TInt CRadioRdsUtility::CBody::GetRadioText(
       
   364     TRdsRadioText& aRt )
       
   365     {
       
   366     TRsRdsRadioText rt;
       
   367     TInt error = iRadioSession->GetRadioText( rt );
       
   368 
       
   369     if ( rt.Length() )
       
   370        {
       
   371        aRt.Copy( rt );
       
   372        }
       
   373 
       
   374     return error;
       
   375     }
       
   376 
       
   377 // -----------------------------------------------------------------------------
       
   378 // CRadioRdsUtility::CBody::GetRadioTextPlus
       
   379 // (other items were commented in a header).
       
   380 // -----------------------------------------------------------------------------
       
   381 //
       
   382 TInt CRadioRdsUtility::CBody::GetRadioTextPlus(
       
   383     TRdsRTplusClass aRtPlusClass,
       
   384     TRdsRadioText& aRtPlusData )
       
   385     {
       
   386     aRtPlusClass = aRtPlusClass; // for compiler warning
       
   387     TRsRdsRadioText rt;
       
   388     TRsRdsRTplusClass rtPlusClass = ERsRTplusItemDummy;
       
   389     TInt error = iRadioSession->GetRadioTextPlus( rtPlusClass, rt );
       
   390 
       
   391     if ( rt.Length() )
       
   392         {
       
   393         aRtPlusData.Copy( rt );
       
   394         aRtPlusClass = (TRdsRTplusClass)rtPlusClass;
       
   395         }
       
   396 
       
   397     return error;
       
   398     }
       
   399 
       
   400 // -----------------------------------------------------------------------------
       
   401 // CRadioRdsUtility::CBody::GetClockTime
       
   402 // (other items were commented in a header).
       
   403 // -----------------------------------------------------------------------------
       
   404 //
       
   405 TInt CRadioRdsUtility::CBody::GetClockTime(
       
   406     TDateTime& aCt )
       
   407     {
       
   408     return iRadioSession->GetClockTime( aCt );
       
   409     }
       
   410 
       
   411 // -----------------------------------------------------------------------------
       
   412 // CRadioRdsUtility::CBody::GetTrafficAnnouncementStatus
       
   413 // (other items were commented in a header).
       
   414 // -----------------------------------------------------------------------------
       
   415 //
       
   416 TInt CRadioRdsUtility::CBody::GetTrafficAnnouncementStatus(
       
   417     TBool& aTaStatus )
       
   418     {
       
   419     return iRadioSession->GetTrafficAnnouncementStatus( aTaStatus );
       
   420     }
       
   421 
       
   422 // -----------------------------------------------------------------------------
       
   423 // CRadioRdsUtility::CBody::GetTrafficProgrammeStatus
       
   424 // (other items were commented in a header).
       
   425 // -----------------------------------------------------------------------------
       
   426 //
       
   427 TInt CRadioRdsUtility::CBody::GetTrafficProgrammeStatus(
       
   428     TBool& aTpStatus )
       
   429     {
       
   430     return iRadioSession->GetTrafficProgrammeStatus( aTpStatus );
       
   431     }
       
   432 
       
   433 
       
   434 //End of File