radioapp/radioenginewrapper/inc/radioenginewrapper_p.h
changeset 16 f54ebcfc1b80
parent 14 63aabac4416d
child 19 afea38384506
equal deleted inserted replaced
14:63aabac4416d 16:f54ebcfc1b80
    19 #define RADIOENGINEWRAPPER_P_H
    19 #define RADIOENGINEWRAPPER_P_H
    20 
    20 
    21 // System includes
    21 // System includes
    22 #include <e32std.h>
    22 #include <e32std.h>
    23 #include <QScopedPointer>
    23 #include <QScopedPointer>
       
    24 #include <QList>
    24 
    25 
    25 // User includes
    26 // User includes
    26 #include "radioenginewrapper.h"
    27 #include "radioenginewrapper.h"
    27 #include "mradioenginehandlerobserver.h"
    28 #include "mradioenginehandlerobserver.h"
    28 
    29 
    29 // Forward declarations
    30 // Forward declarations
    30 class CRadioEngineHandler;
    31 class CRadioEngineHandler;
    31 class RadioControlEventListener;
    32 class RadioControlEventListener;
    32 class RadioRdsListener;
    33 class RadioRdsListener;
    33 class RadioSettings;
    34 class RadioSettings;
    34 class RadioFrequencyScanningHandler;
       
    35 class RadioStationHandlerIf;
    35 class RadioStationHandlerIf;
    36 class RadioEngineWrapperObserver;
    36 class RadioEngineWrapperObserver;
    37 
    37 
       
    38 typedef QList<RadioEngineWrapperObserver*> ObserverList;
       
    39 
    38 // Constants
    40 // Constants
       
    41 
       
    42 #define RUN_NOTIFY_LOOP( list, func ) \
       
    43         foreach( RadioEngineWrapperObserver* observer, list ) { \
       
    44             observer->func; \
       
    45         }
    39 
    46 
    40 // Class declaration
    47 // Class declaration
    41 class RadioEngineWrapperPrivate : public MRadioEngineHandlerObserver
    48 class RadioEngineWrapperPrivate : public MRadioEngineHandlerObserver
    42 {
    49 {
    43     Q_DECLARE_PUBLIC( RadioEngineWrapper )
    50     Q_DECLARE_PUBLIC( RadioEngineWrapper )
    46     friend class RadioFrequencyScanningHandler;
    53     friend class RadioFrequencyScanningHandler;
    47 
    54 
    48 public:
    55 public:
    49 
    56 
    50     RadioEngineWrapperPrivate( RadioEngineWrapper* wrapper,
    57     RadioEngineWrapperPrivate( RadioEngineWrapper* wrapper,
    51                                RadioStationHandlerIf& stationHandler,
    58                                RadioStationHandlerIf& stationHandler );
    52                                RadioEngineWrapperObserver& observer );
       
    53 
    59 
    54     virtual ~RadioEngineWrapperPrivate();
    60     virtual ~RadioEngineWrapperPrivate();
    55 
    61 
    56     /**
    62     /**
    57      * Initialization and startup
    63      * Initialization and startup
    71     CRadioEngineHandler& RadioEnginehandler();
    77     CRadioEngineHandler& RadioEnginehandler();
    72 
    78 
    73     /**
    79     /**
    74      * Functions called from slots to tune to given frequency or preset
    80      * Functions called from slots to tune to given frequency or preset
    75      */
    81      */
    76     void tuneFrequency( uint frequency, const int sender );
    82     void tuneFrequency( uint frequency, const int reason );
    77     void tuneWithDelay( uint frequency, const int sender );
    83     void tuneWithDelay( uint frequency, const int reason );
    78 
    84 
    79     RadioEngineWrapperObserver& observer();
    85     ObserverList& observers();
    80 
    86 
    81     void startSeeking( Seeking::Direction direction );
    87     void startSeeking( Seeking::Direction direction, const int reason = TuneReason::Unspecified );
    82 
    88 
    83 private:
    89 private:
    84 
    90 
    85 // from base class MRadioEngineObserver
    91 // from base class MRadioEngineObserver
    86 
    92 
   108     void HandleRepositoryValueChangeL( const TUid& aUid, TUint32 aKey, TInt aValue, TInt aError );
   114     void HandleRepositoryValueChangeL( const TUid& aUid, TUint32 aKey, TInt aValue, TInt aError );
   109     void HandleRepositoryValueChangeL( const TUid& /*aUid*/, TUint32 /*aKey*/, const TReal& /*aValue*/, TInt /*aError*/ ) {}
   115     void HandleRepositoryValueChangeL( const TUid& /*aUid*/, TUint32 /*aKey*/, const TReal& /*aValue*/, TInt /*aError*/ ) {}
   110     void HandleRepositoryValueChangeL( const TUid& /*aUid*/, TUint32 /*aKey*/, const TDesC8& /*aValue*/, TInt /*aError*/ ) {}
   116     void HandleRepositoryValueChangeL( const TUid& /*aUid*/, TUint32 /*aKey*/, const TDesC8& /*aValue*/, TInt /*aError*/ ) {}
   111     void HandleRepositoryValueChangeL( const TUid& /*aUid*/, TUint32 /*aKey*/, const TDesC16& /*aValue*/, TInt /*aError*/ ) {}
   117     void HandleRepositoryValueChangeL( const TUid& /*aUid*/, TUint32 /*aKey*/, const TDesC16& /*aValue*/, TInt /*aError*/ ) {}
   112 
   118 
   113 // New functions
       
   114 
       
   115     /**
       
   116      * Called by RadioFrequencyScanningHandler when the scanning has finished
       
   117      */
       
   118     void frequencyScannerFinished();
       
   119 
       
   120 private: // data
   119 private: // data
   121 
   120 
   122     /**
   121     /**
   123      * Pointer to the public class
   122      * Pointer to the public class
   124      * Not own.
   123      * Not own.
   132     RadioStationHandlerIf&                          mStationHandler;
   131     RadioStationHandlerIf&                          mStationHandler;
   133 
   132 
   134     /**
   133     /**
   135      * Reference to the wrapper observer
   134      * Reference to the wrapper observer
   136      */
   135      */
   137     RadioEngineWrapperObserver&                     mObserver;
   136     ObserverList                                    mObservers;
   138 
   137 
   139     /**
   138     /**
   140      * Radio settings handler
   139      * Radio settings handler
   141      * Own.
   140      * Own.
   142      */
   141      */
   159      * Own.
   158      * Own.
   160      */
   159      */
   161     QScopedPointer<RadioRdsListener>                mRdsListener;
   160     QScopedPointer<RadioRdsListener>                mRdsListener;
   162 
   161 
   163     /**
   162     /**
   164      * Preset scanning handler
   163      * Reason for the tune event. Can be FrequencyStrip, Carousel or station scanner
   165      * Own.
       
   166      */
   164      */
   167     QScopedPointer<RadioFrequencyScanningHandler>   mFrequencyScanningHandler;
   165     int                                             mTuneReason;
   168 
       
   169     /**
       
   170      * Id of the sender of the last tune command. RadioFrequencyStrip or someone else
       
   171      */
       
   172     int                                             mCommandSender;
       
   173 
   166 
   174     /**
   167     /**
   175      * Flag to indicate whether or not audio should be routed to loudspeaker
   168      * Flag to indicate whether or not audio should be routed to loudspeaker
   176      */
   169      */
   177     bool                                            mUseLoudspeaker;
   170     bool                                            mUseLoudspeaker;
   178 
   171 
   179     /**
       
   180      * Flag to indicate whether or not the engine is seeking
       
   181      */
       
   182     bool                                            mIsSeeking;
       
   183 
       
   184 };
   172 };
   185 
   173 
   186 #endif // RADIOENGINEWRAPPER_P_H
   174 #endif // RADIOENGINEWRAPPER_P_H