fmradio/fmradioengine/inc/fmradiordsreceiverbase.h
branchRCL_3
changeset 20 93c594350b9a
parent 0 f3d95d9c00ab
equal deleted inserted replaced
19:cce62ebc198e 20:93c594350b9a
       
     1 /*
       
     2 * Copyright (c) 2006-2006 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:  The RDS receiver base class for FM Radio
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CFMRADIORDSRECEIVERBASE_H
       
    20 #define CFMRADIORDSRECEIVERBASE_H
       
    21 
       
    22 #include <RadioRdsUtility.h>
       
    23 
       
    24 #include "fmradiordsobserver.h"
       
    25 
       
    26 class TRadioSettings;
       
    27 class CRadioUtility;
       
    28 class CFMRadioPubSub;
       
    29 
       
    30 NONSHARABLE_CLASS( CFMRadioRdsReceiverBase ) : public CBase, public MRadioRdsObserver
       
    31     {
       
    32 public:
       
    33 
       
    34     enum TFMRadioProgrammeSeviceType
       
    35         {
       
    36         EFMRadioPSNameStaticAssumed = 0,// Default, determination is ongoing
       
    37         EFMRadioPSNameStatic,           // PS name is static
       
    38         EFMRadioPSNameDynamic           // PS name is dynamic
       
    39         };
       
    40     
       
    41     /**
       
    42      * The destructor
       
    43      */
       
    44     virtual ~CFMRadioRdsReceiverBase();
       
    45 
       
    46     /**
       
    47      * Initializes the RDS receiver
       
    48      *
       
    49      * @param aRadioUtility A reference to the radio utility
       
    50      * @param aPubSub       Pointer to Publish&Subscribe object
       
    51      */
       
    52     virtual void InitL( CRadioUtility& aRadioUtility, CFMRadioPubSub* aPubSub ) = 0;
       
    53 
       
    54     /**
       
    55      * Adds an observer wich will be notified of the new RDS data
       
    56      * If observer already exists, it is not added
       
    57      *
       
    58      * @param aObserver pointer of the observer instance.
       
    59      */
       
    60     IMPORT_C void AddObserver(MFMRadioRdsObserver* aObserver);
       
    61 
       
    62     /**
       
    63      * Removes the rds observer.
       
    64      */
       
    65     IMPORT_C void RemoveObserver(MFMRadioRdsObserver* aObserver);
       
    66 
       
    67     /**
       
    68      * Getter for automatic switching state of alternate frequencies
       
    69      *
       
    70      * @return ETrue if automatic switching is enabled
       
    71      */
       
    72     IMPORT_C TBool AutomaticSwitchingEnabled() const;
       
    73 
       
    74     /**
       
    75      * Getter for the programme service name
       
    76      *
       
    77      * @return Programme service name
       
    78      */
       
    79     IMPORT_C const TDesC& ProgrammeService() const;
       
    80 
       
    81     /**
       
    82      * Returns the nature of the PS name
       
    83      *
       
    84      * @return The type of PS name
       
    85      */
       
    86     IMPORT_C TFMRadioProgrammeSeviceType ProgrammeServiceNameType() const;
       
    87     
       
    88     /**
       
    89      * Getter for the RDS signal availability
       
    90      *
       
    91      * @return ETrue if RDS signal is available, otherwise EFalse
       
    92      */
       
    93     IMPORT_C TBool SignalAvailable() const;
       
    94 
       
    95     /**
       
    96      * Getter for the RDS Text+ station URL
       
    97      * @return The cached web URL of the station
       
    98      */
       
    99     IMPORT_C const TDesC& RtPlusProgramUrl() const;
       
   100     
       
   101     /**
       
   102      * Getter for the RDS Text+ artist name
       
   103      * @return The cached artist name
       
   104      */
       
   105     IMPORT_C const TDesC& RtPlusArtist() const;
       
   106     
       
   107     /**
       
   108      * Getter for the RDS Text+ album name
       
   109      * @return The cached album name
       
   110      */
       
   111     IMPORT_C const TDesC& RtPlusAlbum() const;
       
   112     
       
   113     /**
       
   114      * Getter for the RDS Text+ song name
       
   115      * @return The cached song name
       
   116      */
       
   117     IMPORT_C const TDesC& RtPlusSong() const;
       
   118     
       
   119     /**
       
   120      * Setter for automatic switching of alternate frequencies
       
   121      * If this method is overridden, the base implementation should be called
       
   122      *
       
   123      * @param aEnable ETrue, if automatic swithing is to be enabled
       
   124      */
       
   125     virtual void SetAutomaticSwitchingL( TBool aEnable );
       
   126     
       
   127     /**
       
   128      * Clears the RDS information
       
   129      */
       
   130     void ClearRdsInformation();
       
   131     
       
   132     /**
       
   133      * Starts receiving the RDS information
       
   134      */
       
   135     virtual void StartReceiver() = 0;
       
   136     
       
   137     /**
       
   138      * Stops receiving the RDS information
       
   139      */
       
   140     virtual void StopReceiver() = 0;
       
   141     
       
   142 protected:
       
   143 
       
   144     /**
       
   145      * The default constructor
       
   146      *
       
   147      * @param aSettings The radio settings
       
   148      */
       
   149     CFMRadioRdsReceiverBase( TRadioSettings& aSettings );
       
   150 
       
   151     /**
       
   152      * Second phase constructor
       
   153      */
       
   154     void BaseConstructL();
       
   155 
       
   156     /**
       
   157      * Static callback for the RDS PS name timer
       
   158      *
       
   159      * @param   aSelf   Pointer to self.
       
   160      * @return  KErrNone
       
   161      */
       
   162     static TInt StaticPsNameTimerCallback( TAny* aSelf );
       
   163     
       
   164     /**
       
   165      * Handles the received RT+ data and passes it to observers
       
   166      * @param aRtPlusClass The RT+ class
       
   167      * @param aRtPlusData The received data
       
   168      */
       
   169     void HandleRdsDataRTplusL( TRdsRTplusClass aRtPlusClass, TRdsRadioText& aRtPlusData );
       
   170     
       
   171 // from base class MRadioRdsObserver
       
   172     void MrroStationSeekByPTYComplete( TInt aError, TInt aFrequency );
       
   173     void MrroStationSeekByTAComplete( TInt aError, TInt aFrequency );
       
   174     void MrroStationSeekByTPComplete( TInt aError, TInt aFrequency );
       
   175     void MrroGetFreqByPTYComplete( TInt aError, RArray<TInt>& aFreqList );
       
   176     void MrroGetFreqByTAComplete( TInt aError, RArray<TInt>& aFreqList );
       
   177     void MrroGetPSByPTYComplete( TInt aError, RArray<TRdsPSName>& aPsList );
       
   178     void MrroGetPSByTAComplete( TInt aError, RArray<TRdsPSName>& aPsList );
       
   179     void MrroRdsDataPI( TInt aPi );
       
   180     void MrroRdsDataPTY( TRdsProgrammeType aPty );
       
   181     void MrroRdsDataPS( TRdsPSName& aPs );
       
   182     void MrroRdsDataRT( TRdsRadioText& aRt );
       
   183     void MrroRdsDataCT( TDateTime& aCt );
       
   184     void MrroRdsDataTA( TBool aTaOn );
       
   185     void MrroRdsDataRTplus( TRdsRTplusClass aRtPlusClass, TRdsRadioText& aRtPlusData );
       
   186     void MrroRdsSearchBeginAF();
       
   187     void MrroRdsSearchEndAF( TInt aError, TInt aFrequency );
       
   188     void MrroRdsStationChangeTA( TInt aFrequency );
       
   189     void MrroRdsEventAutomaticSwitchingChange( TBool aAuto );
       
   190     void MrroRdsEventAutomaticTrafficAnnouncement( TBool aAuto );
       
   191     void MrroRdsEventSignalChange( TBool aSignal );
       
   192     
       
   193 protected: // data
       
   194     /** The radio settings */
       
   195 	TRadioSettings& iSettings;
       
   196 
       
   197     /** Publish&Subscribe object. Can be NULL. Not owned. */
       
   198     CFMRadioPubSub* iPubSub;
       
   199     
       
   200 private: // data
       
   201     
       
   202     /** Array of RDS observers. */
       
   203     RPointerArray<MFMRadioRdsObserver> iObservers;
       
   204     
       
   205     /** The programme service name cache */
       
   206     HBufC* iPsName;
       
   207     
       
   208     /** The radio text data cache */
       
   209     HBufC* iRadioText;
       
   210     
       
   211     /** The cached web URL of the station */
       
   212     RBuf iProgramWebUrl;
       
   213     
       
   214     /** The cached artist name */
       
   215     RBuf iArtistName;
       
   216     
       
   217     /** The cached song name */
       
   218     RBuf iSongName;
       
   219     
       
   220     /** The cached album name */
       
   221     RBuf iAlbumName;
       
   222     
       
   223     /** ETrue if the RDS signal is available */
       
   224     TBool iSignalAvailable;
       
   225 
       
   226     /** ETrue if AF is enabled */
       
   227     TBool iAfEnabled;
       
   228     
       
   229     /** Timer to track the PS name changes */
       
   230     CPeriodic* iPsNameTimer;
       
   231 
       
   232     /** The type of the PS name */
       
   233     TFMRadioProgrammeSeviceType iPsNameType;
       
   234     };
       
   235 
       
   236 #endif // CFMRADIORDSRECEIVERBASE_H