radioapp/radioenginewrapper/inc/radioenginewrapper_win32_p.h
changeset 23 a2b50a479edf
parent 19 afea38384506
child 24 6df133bd92e1
equal deleted inserted replaced
19:afea38384506 23:a2b50a479edf
     1 /*
       
     2 * Copyright (c) 2009 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:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef RADIOENGINEWRAPPER_P_H
       
    19 #define RADIOENGINEWRAPPER_P_H
       
    20 
       
    21 // System includes
       
    22 #include <QObject>
       
    23 #include <QScopedPointer>
       
    24 
       
    25 // User includes
       
    26 #include "radioenginewrapper.h"
       
    27 
       
    28 // Forward declarations
       
    29 class RadioControlEventListener;
       
    30 class RadioRdsListener;
       
    31 class RadioSettings;
       
    32 class RadioSettingsIf;
       
    33 class RadioFrequencyScanningHandler;
       
    34 class RadioStationHandlerIf;
       
    35 class RadioEngineWrapperObserver;
       
    36 class T_RadioDataParser;
       
    37 class QSettings;
       
    38 class QTimer;
       
    39 
       
    40 typedef QList<RadioEngineWrapperObserver*> ObserverList;
       
    41 
       
    42 #define RUN_NOTIFY_LOOP( list, func ) \
       
    43         foreach( RadioEngineWrapperObserver* observer, list ) { \
       
    44             observer->func; \
       
    45         }
       
    46 
       
    47 // Class declaration
       
    48 class WRAPPER_DLL_EXPORT RadioEngineWrapperPrivate : public QObject
       
    49 {
       
    50     Q_OBJECT
       
    51     Q_DECLARE_PUBLIC( RadioEngineWrapper )
       
    52     Q_DISABLE_COPY( RadioEngineWrapperPrivate )
       
    53 
       
    54     friend class RadioFrequencyScanningHandler;
       
    55 
       
    56 public:
       
    57 
       
    58     RadioEngineWrapperPrivate( RadioEngineWrapper* wrapper,
       
    59                                RadioStationHandlerIf& stationHandler );
       
    60 
       
    61     ~RadioEngineWrapperPrivate();
       
    62 
       
    63     static RadioEngineWrapperPrivate* instance();
       
    64 
       
    65     /**
       
    66      * Initialization and startup
       
    67      */
       
    68     void init();
       
    69     bool isEngineConstructed();
       
    70 
       
    71     /**
       
    72      * Returns the radio settings
       
    73      */
       
    74     RadioSettingsIf& settings();
       
    75 
       
    76     /**
       
    77      * Functions called from slots to tune to given frequency or preset
       
    78      */
       
    79     void tuneFrequency( uint frequency, const int reason );
       
    80     void tuneWithDelay( uint frequency, const int reason );
       
    81 
       
    82     ObserverList& observers();
       
    83 
       
    84     void startSeeking( Seeking::Direction direction, const int reason );
       
    85     void cancelSeeking();
       
    86 
       
    87     void toggleAudioRoute();
       
    88 
       
    89 // Functions used by the win32 test window
       
    90 
       
    91     QString dataParsingError() const;
       
    92 
       
    93     void setHeadsetStatus( bool connected );
       
    94 
       
    95     void setVolume( int volume );
       
    96 
       
    97     void addSong( const QString& artist, const QString& title );
       
    98 
       
    99     void clearSong();
       
   100 
       
   101     bool isOffline() const;
       
   102     void setOffline( bool offline );
       
   103 
       
   104 private slots:
       
   105 
       
   106     void frequencyEvent();
       
   107     void addSongTags();
       
   108 
       
   109 private:
       
   110 
       
   111 // New functions
       
   112 
       
   113     void parseData();
       
   114 
       
   115 private: // data
       
   116 
       
   117     /**
       
   118      * Pointer to the public class
       
   119      * Not own.
       
   120      */
       
   121     RadioEngineWrapper*                             q_ptr;
       
   122 
       
   123     /**
       
   124      * Map of radio stations read from the radio engine
       
   125      * Own.
       
   126      */
       
   127     RadioStationHandlerIf&                          mStationHandler;
       
   128 
       
   129     /**
       
   130      * Reference to the wrapper observer
       
   131      */
       
   132     ObserverList                                    mObservers;
       
   133 
       
   134     /**
       
   135      * Radio settings handler
       
   136      * Own.
       
   137      */
       
   138     QScopedPointer<RadioSettings>                   mSettings;
       
   139 
       
   140     QTimer*                                         mTuneTimer;
       
   141 
       
   142     /**
       
   143      * Preset scanning handler
       
   144      * Own.
       
   145      */
       
   146 //    QScopedPointer<RadioFrequencyScanningHandler>   mFrequencyScanningHandler;
       
   147 
       
   148 //    QScopedPointer<T_RadioDataParser>               mDataParser;
       
   149 
       
   150     QString                                         mParsingError;
       
   151 
       
   152     /**
       
   153      * Reason for the tune event. RadioFrequencyStrip or someone else
       
   154      */
       
   155     int                                             mTuneReason;
       
   156 
       
   157     /**
       
   158      * Flag to indicate whether or not audio should be routed to loudspeaker
       
   159      */
       
   160     bool                                            mUseLoudspeaker;
       
   161 
       
   162     QScopedPointer<QSettings>                       mEngineSettings;
       
   163 
       
   164     bool                                            mAntennaAttached;
       
   165 
       
   166     uint                                            mFrequency;
       
   167     uint                                            mNextFrequency;
       
   168 
       
   169     int                                             mVolume;
       
   170 
       
   171     int                                             mMaxVolume;
       
   172     int                                             mFrequencyStepSize;
       
   173     RadioRegion::Region                             mRegionId;
       
   174     uint                                            mMinFrequency;
       
   175     uint                                            mMaxFrequency;
       
   176 
       
   177     QString                                         mArtist;
       
   178     QString                                         mTitle;
       
   179 
       
   180 };
       
   181 
       
   182 #endif // RADIOENGINEWRAPPER_P_H