mmserv/radioutility/radio_utility/src/RadioUtilityBody.h
changeset 0 71ca22bcf22a
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:  Implementation header of the Radio Utility API
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_RADIOUTILITYBODY_H
       
    21 #define C_RADIOUTILITYBODY_H
       
    22 
       
    23 #include <RadioUtility.h>
       
    24 #include "RadioServerData.h"
       
    25 #include "RadioSession.h"
       
    26 
       
    27 class CRadioFmTunerUtility;
       
    28 class MRadioFmTunerObserver;
       
    29 class CRadioPlayerUtility;
       
    30 class MRadioPlayerObserver;
       
    31 class CRadioRdsUtility;
       
    32 class MRadioRdsObserver;
       
    33 
       
    34 /**
       
    35  *  This class encapsulates the implementation body of the CRadioUtility interface.
       
    36  *
       
    37  *  @lib radio_utility.lib
       
    38  *  @since S60 3.2
       
    39  */
       
    40 class CRadioUtility::CBody : public CBase,
       
    41                              public MRadioObserver
       
    42     {
       
    43 
       
    44 public:
       
    45 
       
    46     static CBody* NewL( TBool aPrimaryClient );
       
    47 
       
    48     ~CBody();
       
    49 
       
    50     /**
       
    51      * Returns a reference to FM Tuner Utility class for controlling the tuner settings.
       
    52      *
       
    53      * @since S60 3.2
       
    54      * @param aObserver The observer object for receiving async completion callbacks
       
    55      */
       
    56     CRadioFmTunerUtility& RadioFmTunerUtilityL( MRadioFmTunerObserver& aObserver );
       
    57 
       
    58     /**
       
    59      * Returns a reference to Radio Player Utility class for controlling the radio playback.
       
    60      *
       
    61      * @since S60 3.2
       
    62      * @param aObserver The observer object for receiving async completion callbacks
       
    63      */
       
    64     CRadioPlayerUtility& RadioPlayerUtilityL( MRadioPlayerObserver& aObserver );
       
    65 
       
    66     /**
       
    67      * Returns a reference to Radio RDS Utility class for accessing the Radio Data System (RDS).
       
    68      *
       
    69      * @since S60 3.2
       
    70      * @param aObserver The observer object for receiving async completion callbacks
       
    71      */
       
    72     CRadioRdsUtility& RadioRdsUtilityL( MRadioRdsObserver& aObserver );
       
    73 
       
    74 private:
       
    75 
       
    76 // from base class MRadioObserver
       
    77 
       
    78     // Tuner Events
       
    79 
       
    80     /**
       
    81      * From MRadioObserver
       
    82      * Completion message for RequestTunerControl request.
       
    83      *
       
    84      * @since S60 3.2
       
    85      * @param aError KErrNone if successful, otherwise one of the system/RadioServer errors.
       
    86      */
       
    87     void RequestTunerControlComplete( TRadioServerError aError );
       
    88 
       
    89     /**
       
    90      * From MRadioObserver
       
    91      * Completion message for SetFrequencyRange request.
       
    92      *
       
    93      * @since S60 3.2
       
    94      * @param aError KErrNone if successful, otherwise one of the system/RadioServer errors.
       
    95      */
       
    96     void SetFrequencyRangeComplete( TRadioServerError aError );
       
    97 
       
    98     /**
       
    99      * From MRadioObserver
       
   100      * Completion message for SetFrequency request.
       
   101      *
       
   102      * @since S60 3.2
       
   103      * @param aError KErrNone if successful, otherwise one of the system/RadioServer errors.
       
   104      */
       
   105     void SetFrequencyComplete( TRadioServerError aError );
       
   106 
       
   107     /**
       
   108      * From MRadioObserver
       
   109      * Completion message for StationSeek request.
       
   110      *
       
   111      * @since Series 60 3.0
       
   112      * @param aError KErrNone if successful, otherwise one of the system/RadioServer errors.
       
   113      * @param aFrequency Valid only if aError is KErrNone. Contains the new frequency in Hz.
       
   114      */
       
   115     void StationSeekComplete( TRadioServerError aError, TInt aFrequency );
       
   116 
       
   117     /**
       
   118      * From MRadioObserver
       
   119      * Antenna status has changed.
       
   120      *
       
   121      * @since Series 60 3.0
       
   122      * @param aAttached ETrue if antenna is attached.
       
   123      */
       
   124     void RadioEventAntennaStatusChange( TBool aAttached );
       
   125 
       
   126     /**
       
   127      * From MRadioObserver
       
   128      * Event notification indicating FM transmitter status change. Radio receiver
       
   129      * is turned off when FM transmitter is active.
       
   130      *
       
   131      * @since S60 3.2
       
   132      * @param aActive ETrue if FM transmitter is active; EFalse otherwise.
       
   133      */
       
   134     void RadioEventTransmitterStatusChange( TBool aActive );
       
   135 
       
   136     /**
       
   137      * From MRadioObserver
       
   138      * Event notification indicating offline mode change.
       
   139      *
       
   140      * @since S60 3.0
       
   141      * @param aOfflineMode ETrue if device is in offline mode.
       
   142      */
       
   143     void RadioEventOfflineModeChange( TBool aOfflineMode );
       
   144 
       
   145     /**
       
   146      * From MRadioObserver
       
   147      * Event notification indicating frequency range change. This may be caused by
       
   148      * other applications.
       
   149      *
       
   150      * @since S60 3.2
       
   151      * @param aNewRange New frequency range.
       
   152      */
       
   153     void RadioEventFrequencyRangeChanged( TRsFrequencyRange aNewRange );
       
   154 
       
   155     /**
       
   156      * From MRadioObserver
       
   157      * Event notification indicating frequency(Hz) change. This may be caused by
       
   158      * other applications or RDS if AF/TA is enabled.
       
   159      *
       
   160      * @since S60 3.2
       
   161      * @param aFrequency New frequency where tuner is currently tuned.
       
   162      */
       
   163     void RadioEventFrequencyChange( TInt aFrequency );
       
   164 
       
   165      /**
       
   166      * From MRadioObserver
       
   167      * Event notification indicating forced mono status change.
       
   168      *
       
   169      * @since S60 3.2
       
   170      * @param aForcedMono ETrue if forced mode is enabled; EFalse otherwise.
       
   171      */
       
   172     void RadioEventForcedMonoChanged( TBool aForcedMono );
       
   173 
       
   174     /**
       
   175      * From MRadioObserver
       
   176      * Event notification indicating squelch (muting the frequencies without broadcast)
       
   177      * status change.
       
   178      *
       
   179      * @since S60 3.2
       
   180      * @param aSquelch ETrue if squelch is enabled; EFalse otherwise.
       
   181      */
       
   182     void RadioEventSquelchChanged( TBool aSquelch );
       
   183 
       
   184     // Player events
       
   185 
       
   186     /**
       
   187      * From MRadioObserver
       
   188      * Event notification indicating radio player state change. This may be caused by
       
   189      * other applications.
       
   190      *
       
   191      * @since S60 3.0
       
   192      * @param aRadioOn ETrue if radio is playing, otherwise radio is off.
       
   193      * @param aError Valid only if aRadioOn is EFalse. Contains the reason why radio is off.
       
   194      */
       
   195     void RadioEventStateChange( TBool aRadioOn, TInt aError );
       
   196 
       
   197     /**
       
   198      * From MRadioObserver
       
   199      * Event notification indicating volume change.
       
   200      *
       
   201      * @since S60 3.2
       
   202      * @param aVolume New volume.
       
   203      */
       
   204     void RadioEventVolumeChange( TInt aVolume );
       
   205 
       
   206 
       
   207     /**
       
   208      * From MRadioObserver
       
   209      * Event notification indicating mute setting change.
       
   210      *
       
   211      * @since S60 3.2
       
   212      * @param aMute ETrue indicates audio is muted.
       
   213      */
       
   214     void RadioEventMuteChange( TBool aMute );
       
   215 
       
   216 
       
   217     /**
       
   218      * From MRadioObserver
       
   219      * Event notification indicating balance setting change.
       
   220      *
       
   221      * @since S60 3.2
       
   222      * @param aLeftPercentage Left speaker volume percentage. This value ranges from 0 to 100.
       
   223      * @param aRightPercentage Right speaker volume percentage. This value ranges from 0 to 100.
       
   224      */
       
   225     void RadioEventBalanceChange( TInt aLeftPercentage, TInt aRightPercentage );
       
   226 
       
   227     // RDS Events
       
   228 
       
   229     /**
       
   230      * From MRadioObserver
       
   231      * Completion message for StationSeekByPTY request.
       
   232      *
       
   233      * @since S60 3.2
       
   234      * @param aError KErrNone if successful, otherwise one of the system/RadioServer errors.
       
   235      * @param aFrequency The frequency(Hz) of the radio station that was found.
       
   236      */
       
   237     void StationSeekByPTYComplete( TInt aError, TInt aFrequency );
       
   238 
       
   239     /**
       
   240      * From MRadioObserver
       
   241      * Completion message for StationSeekByTA request.
       
   242      *
       
   243      * @since S60 3.2
       
   244      * @param aError KErrNone if successful, otherwise one of the system/RadioServer errors.
       
   245      * @param aFrequency The frequency(Hz) of the radio station that was found.
       
   246      */
       
   247     void StationSeekByTAComplete( TInt aError, TInt aFrequency );
       
   248 
       
   249     /**
       
   250      * From MRadioObserver
       
   251      * Completion message for StationSeekByTP request.
       
   252      *
       
   253      * @since S60 3.2
       
   254      * @param aError KErrNone if successful, otherwise one of the system/RadioServer errors.
       
   255      * @param aFrequency The frequency(Hz) of the radio station that was found.
       
   256      */
       
   257     void StationSeekByTPComplete( TInt aError, TInt aFrequency );
       
   258 
       
   259     /**
       
   260      * From MRadioObserver
       
   261      * Completion message for GetFreqByPTY request.
       
   262      *
       
   263      * @since S60 3.2
       
   264      * @param aError KErrNone if successful, otherwise one of the system/RadioServer errors.
       
   265      * @param aFreqList Array of frequencies (Hz), valid only if aError is KErrNone.
       
   266      */
       
   267     void GetFreqByPTYComplete( TInt aError, RArray<TInt>& aFreqList );
       
   268 
       
   269     /**
       
   270      * From MRadioObserver
       
   271      * Completion message for GetFreqByTA request.
       
   272      *
       
   273      * @since S60 3.2
       
   274      * @param aError KErrNone if successful, otherwise one of the system/RadioServer errors.
       
   275      * @param aFreqList Array of frequencies (Hz), valid only if aError is KErrNone.
       
   276      */
       
   277     void GetFreqByTAComplete( TInt aError, RArray<TInt>& aFreqList );
       
   278 
       
   279     /**
       
   280      * From MRadioObserver
       
   281      * Completion message for StatGetPSByPTY request.
       
   282      *
       
   283      * @since S60 3.2
       
   284      * @param aError KErrNone if successful, otherwise one of the system/RadioServer errors.
       
   285      * @param aPsList Array of programme service names, valid only if aError is KErrNone.
       
   286      */
       
   287     void GetPSByPTYComplete( TInt aError, RArray<TRsRdsPSName>& aPsList );
       
   288 
       
   289     /**
       
   290      * From MRadioObserver
       
   291      * Completion message for GetPSByTA request.
       
   292      *
       
   293      * @since S60 3.2
       
   294      * @param aError KErrNone if successful, otherwise one of the system/RadioServer errors.
       
   295      * @param aPsList Array of programme service names, valid only if aError is KErrNone.
       
   296      */
       
   297     void GetPSByTAComplete( TInt aError, RArray<TRsRdsPSName>& aPsList );
       
   298 
       
   299     /**
       
   300      * From MRadioObserver
       
   301      * Event notification indicating new Programme Identification(PI) is available.
       
   302      *
       
   303      * @since S60 3.2
       
   304      * @param aPi Programme identification
       
   305      */
       
   306     void RadioEventRdsDataPI( TInt aPi );
       
   307 
       
   308     /**
       
   309      * From MRadioObserver
       
   310      * Event notification indicating new Programme Type(PTY) is available.
       
   311      *
       
   312      * @since S60 3.2
       
   313      * @param aPty Programme type
       
   314      */
       
   315     void RadioEventRdsDataPTY( TRsRdsProgrammeType aPty );
       
   316 
       
   317     /**
       
   318      * From MRadioObserver
       
   319      * Event notification indicating new Programme Service(PS) is available.
       
   320      *
       
   321      * @since S60 3.2
       
   322      * @param aPs Programme service
       
   323      */
       
   324     void RadioEventRdsDataPS( TRsRdsPSName& aPs );
       
   325 
       
   326     /**
       
   327      * From MRadioObserver
       
   328      * Event notification indicating new Radio Text(RT) is available.
       
   329      *
       
   330      * @since S60 3.2
       
   331      * @param aRt Radio text
       
   332      */
       
   333     void RadioEventRdsDataRT( TRsRdsRadioText& aRt );
       
   334 
       
   335     /**
       
   336      * From MRadioObserver
       
   337      * Event notification indicating new Clock Time(CT) is available.
       
   338      *
       
   339      * @since S60 3.2
       
   340      * @param aCt Clock time
       
   341      */
       
   342     void RadioEventRdsDataCT( TDateTime& aCt );
       
   343 
       
   344     /**
       
   345      * From MRadioObserver
       
   346      * Event notification indicating Traffice Announcement(TA) status change.
       
   347      *
       
   348      * @since S60 3.2
       
   349      * @param aTaOn ETrue indicates that Traffic Announcement is on.
       
   350      */
       
   351     void RadioEventRdsDataTA( TBool aTaOn );
       
   352 
       
   353     /**
       
   354      * From MRadioObserver
       
   355      * Event notification indicating new Radio Text+(RT+) is available.
       
   356      *
       
   357      * @since S60 3.2
       
   358      * @param aRtPlusClass Radio text plus class
       
   359      * @param aRtPlusData Radio text plus data
       
   360      */
       
   361     void RadioEventRdsDataRTplus( TRsRdsRTplusClass aRtPlusClass, TRsRdsRadioText& aRtPlusData );
       
   362 
       
   363     /**
       
   364      * From MRadioObserver
       
   365      * Event notification indicating the beginning of Alternate Frequency(AF) search.
       
   366      *
       
   367      * @since S60 3.2
       
   368      */
       
   369     void RadioEventRdsSearchBeginAF();
       
   370 
       
   371     /**
       
   372      * From MRadioObserver
       
   373      * Event notification indicating the end of Alternate Frequency(AF) search.
       
   374      *
       
   375      * @since S60 3.2
       
   376      * @param aError KErrNone if successful, otherwise one of the system/RadioServer errors.
       
   377      * @param aFrequency The frequency(Hz) of the radio station that was found.
       
   378      */
       
   379     void RadioEventRdsSearchEndAF( TRadioServerError aError, TInt aFrequency );
       
   380 
       
   381     /**
       
   382      * From MRadioObserver
       
   383      * Event notification indicating station change to another frequency(Hz) that is
       
   384      * broadcasting Traffic Announcement(TA).
       
   385      *
       
   386      * @since S60 3.2
       
   387      * @param aFrequency The frequency(Hz) of the radio station that was found.
       
   388      */
       
   389     void RadioEventRdsStationChangeTA( TInt aFrequency );
       
   390 
       
   391     /**
       
   392      * From MRadioObserver
       
   393      * Event notification indicating automatic switching (AF) setting change.
       
   394      *
       
   395      * @since S60 3.2
       
   396      * @param aAuto ETrue indicates that automatic switching is on.
       
   397      */
       
   398     void RadioEventRdsAutomaticSwitchingChange( TBool aAuto );
       
   399 
       
   400     /**
       
   401      * From MRadioObserver
       
   402      * Event notification indicating automatic traffic announcement setting change.
       
   403      *
       
   404      * @since S60 3.2
       
   405      * @param aAuto ETrue indicates that automatic traffic announcement is on.
       
   406      */
       
   407     void RadioEventRdsAutomaticTrafficAnnouncement( TBool aAuto );
       
   408 
       
   409     /**
       
   410      * From MRadioObserver
       
   411      * Event notification indicating RDS signal status change (i.e. signal is lost/restored).
       
   412      *
       
   413      * @since S60 3.2
       
   414      * @param aSignal ETrue indicates that RDS signal is available in the tuned frequency.
       
   415      */
       
   416     void RadioEventRdsSignalChange( TBool aSignal );
       
   417 
       
   418 private:
       
   419 
       
   420     void ConstructL( TBool aPrimaryClient );
       
   421 
       
   422     CBody();
       
   423 
       
   424 private:
       
   425 
       
   426     // The radio server session
       
   427     RRadioSession*          iRadioSession;   // own
       
   428 
       
   429     // FM Tuner Utility
       
   430     CRadioFmTunerUtility*   iFmTunerUtility; // own
       
   431     // Radio Player Utility
       
   432     CRadioPlayerUtility*    iPlayerUtility;  // own
       
   433     // Radio RDS Utility
       
   434     CRadioRdsUtility*       iRdsUtility;     // own
       
   435 
       
   436     MRadioFmTunerObserver*  iTunerObserver;     // not own
       
   437     MRadioPlayerObserver*   iPlayerObserver;    // not own
       
   438     MRadioRdsObserver*      iRdsObserver;       // not own
       
   439 
       
   440 };
       
   441 
       
   442 #endif  // C_RADIOUTILITYBODY_H
       
   443 
       
   444 // End of File
       
   445 
       
   446