radioapp/radioenginewrapper/inc/radioenginewrapper_win32_p.h
changeset 16 f54ebcfc1b80
parent 14 63aabac4416d
child 19 afea38384506
equal deleted inserted replaced
14:63aabac4416d 16:f54ebcfc1b80
    34 class RadioEngineWrapperObserver;
    34 class RadioEngineWrapperObserver;
    35 class T_RadioDataParser;
    35 class T_RadioDataParser;
    36 class QSettings;
    36 class QSettings;
    37 class QTimer;
    37 class QTimer;
    38 
    38 
       
    39 typedef QList<RadioEngineWrapperObserver*> ObserverList;
       
    40 
       
    41 #define RUN_NOTIFY_LOOP( list, func ) \
       
    42         foreach( RadioEngineWrapperObserver* observer, list ) { \
       
    43             observer->func; \
       
    44         }
       
    45 
    39 // Class declaration
    46 // Class declaration
    40 class WRAPPER_DLL_EXPORT RadioEngineWrapperPrivate : public QObject
    47 class WRAPPER_DLL_EXPORT RadioEngineWrapperPrivate : public QObject
    41 {
    48 {
    42     Q_OBJECT
    49     Q_OBJECT
    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     ~RadioEngineWrapperPrivate();
    60     ~RadioEngineWrapperPrivate();
    55 
    61 
    56     static RadioEngineWrapperPrivate* instance();
    62     static RadioEngineWrapperPrivate* instance();
    57 
    63 
    67     RadioSettings& settings();
    73     RadioSettings& settings();
    68 
    74 
    69     /**
    75     /**
    70      * Functions called from slots to tune to given frequency or preset
    76      * Functions called from slots to tune to given frequency or preset
    71      */
    77      */
    72     void tuneFrequency( uint frequency, const int sender );
    78     void tuneFrequency( uint frequency, const int reason );
    73     void tuneWithDelay( uint frequency, const int sender );
    79     void tuneWithDelay( uint frequency, const int reason );
    74 
    80 
    75     RadioEngineWrapperObserver& observer();
    81     ObserverList& observers();
    76 
    82 
    77     void startSeeking( Seeking::Direction direction );
    83     void startSeeking( Seeking::Direction direction, const int reason );
       
    84     void cancelSeeking();
       
    85 
       
    86     void toggleAudioRoute();
    78 
    87 
    79 // Functions used by the win32 test window
    88 // Functions used by the win32 test window
    80 
    89 
    81     QString dataParsingError() const;
    90     QString dataParsingError() const;
    82 
    91 
    98 
   107 
    99 private:
   108 private:
   100 
   109 
   101 // New functions
   110 // New functions
   102 
   111 
   103     /**
       
   104      * Called by RadioFrequencyScanningHandler when the scanning has finished
       
   105      */
       
   106     void frequencyScannerFinished();
       
   107 
       
   108     void parseData();
   112     void parseData();
   109 
   113 
   110 private: // data
   114 private: // data
   111 
   115 
   112     /**
   116     /**
   122     RadioStationHandlerIf&                          mStationHandler;
   126     RadioStationHandlerIf&                          mStationHandler;
   123 
   127 
   124     /**
   128     /**
   125      * Reference to the wrapper observer
   129      * Reference to the wrapper observer
   126      */
   130      */
   127     RadioEngineWrapperObserver&                     mObserver;
   131     ObserverList                                    mObservers;
   128 
   132 
   129     /**
   133     /**
   130      * Radio settings handler
   134      * Radio settings handler
   131      * Own.
   135      * Own.
   132      */
   136      */
   143 //    QScopedPointer<T_RadioDataParser>               mDataParser;
   147 //    QScopedPointer<T_RadioDataParser>               mDataParser;
   144 
   148 
   145     QString                                         mParsingError;
   149     QString                                         mParsingError;
   146 
   150 
   147     /**
   151     /**
   148      * Id of the sender of the last tune command. RadioFrequencyStrip or someone else
   152      * Reason for the tune event. RadioFrequencyStrip or someone else
   149      */
   153      */
   150     int                                             mCommandSender;
   154     int                                             mTuneReason;
   151 
   155 
   152     /**
   156     /**
   153      * Flag to indicate whether or not audio should be routed to loudspeaker
   157      * Flag to indicate whether or not audio should be routed to loudspeaker
   154      */
   158      */
   155     bool                                            mUseLoudspeaker;
   159     bool                                            mUseLoudspeaker;
   156 
       
   157     /**
       
   158      * Flag to indicate whether or not the engine is seeking
       
   159      */
       
   160     bool                                            mIsSeeking;
       
   161 
   160 
   162     QScopedPointer<QSettings>                       mEngineSettings;
   161     QScopedPointer<QSettings>                       mEngineSettings;
   163 
   162 
   164     bool                                            mAntennaAttached;
   163     bool                                            mAntennaAttached;
   165 
   164