qtmobility/plugins/multimedia/symbian/radio/s60radiotunercontrol_since32.h
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 5 453da2cfceef
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the Qt Mobility Components.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #ifndef S60RADIOTUNERCONTROL_H
       
    43 #define S60RADIOTUNERCONTROL_H
       
    44 
       
    45 #include <QtCore/qobject.h>
       
    46 #include <QRadioTunerControl>
       
    47 #include <QRadioTuner>
       
    48 
       
    49 #include <radioutility.h>
       
    50 #include <radiofmtunerutility.h>
       
    51 #include <radioplayerutility.h>
       
    52 
       
    53 class S60RadioTunerService;
       
    54 class CFMRadioEngineCallObserver;
       
    55 
       
    56 QTM_USE_NAMESPACE
       
    57 
       
    58 class S60RadioTunerControl 
       
    59     : public QRadioTunerControl
       
    60     , public MRadioPlayerObserver
       
    61     , public MRadioFmTunerObserver
       
    62 {
       
    63     Q_OBJECT
       
    64 public:
       
    65     S60RadioTunerControl(QObject *parent = 0);
       
    66     ~S60RadioTunerControl();
       
    67     
       
    68     QRadioTuner::State state() const;
       
    69 
       
    70     QRadioTuner::Band band() const;
       
    71     void setBand(QRadioTuner::Band b);
       
    72     bool isBandSupported(QRadioTuner::Band b) const;
       
    73 
       
    74     int frequency() const;
       
    75     int frequencyStep(QRadioTuner::Band b) const;
       
    76     QPair<int,int> frequencyRange(QRadioTuner::Band b) const;
       
    77     void setFrequency(int frequency);
       
    78 
       
    79     bool isStereo() const;
       
    80     QRadioTuner::StereoMode stereoMode() const;
       
    81     void setStereoMode(QRadioTuner::StereoMode mode);
       
    82 
       
    83     int signalStrength() const;
       
    84    
       
    85     int volume() const;
       
    86     void setVolume(int volume);
       
    87 
       
    88     bool isMuted() const;
       
    89     void setMuted(bool muted);
       
    90 
       
    91     bool isSearching() const;
       
    92     void searchForward();
       
    93     void searchBackward();
       
    94     void cancelSearch();
       
    95 
       
    96     bool isValid() const;
       
    97 
       
    98     bool isAvailable() const;
       
    99     QtMedia::AvailabilityError availabilityError() const;
       
   100     
       
   101     void start();
       
   102     void stop();
       
   103 
       
   104     QRadioTuner::Error error() const;
       
   105     QString errorString() const;
       
   106     
       
   107     /**
       
   108 	 * From MRadioPlayerObserver.
       
   109 	 * Called when Radio state changed.
       
   110 	 *
       
   111 	 * @since S60 3.2
       
   112 	 * @param aState Radio player state
       
   113 	 * @param aError A standard system error code, only used when aState is ERadioPlayerIdle
       
   114 	 */
       
   115 	void MrpoStateChange(TPlayerState aState, TInt aError);
       
   116 
       
   117 	/**
       
   118 	 * From MRadioPlayerObserver.
       
   119 	 * Called when volume changes. This may be caused by other applications.
       
   120 	 *
       
   121 	 * @since S60 3.2
       
   122 	 * @param aVolume Current volume.
       
   123 	 */
       
   124 	void MrpoVolumeChange(TInt aVolume);
       
   125 
       
   126 	/**
       
   127 	 * From MRadioPlayerObserver.
       
   128 	 * Called when mute setting changes. This may be caused by other applications.
       
   129 	 *
       
   130 	 * @since S60 3.2
       
   131 	 * @param aMute ETrue indicates audio is muted.
       
   132 	 */
       
   133 	void MrpoMuteChange(TBool aMute);
       
   134 
       
   135 	/**
       
   136 	 * From MRadioPlayerObserver.
       
   137 	 * Called when mute setting changes. This may be caused by other applications.
       
   138 	 *
       
   139 	 * Called when balance setting changes. This may be caused by other applications.
       
   140 	 *
       
   141 	 * @since S60 3.2
       
   142 	 *        Left speaker volume percentage. This can be any value from zero to 100.
       
   143 	 *        Zero value means left speaker is muted.
       
   144 	 * @param aRightPercentage
       
   145 	 *        Right speaker volume percentage. This can be any value from zero to 100.
       
   146 	 *        Zero value means right speaker is muted.
       
   147 	 */
       
   148 	void MrpoBalanceChange(TInt aLeftPercentage, TInt aRightPercentage);
       
   149 
       
   150 	
       
   151 	/**
       
   152 	 * From MRadioFmTunerObserver.
       
   153 	 * Called when Request for tuner control completes.
       
   154 	 *
       
   155 	 * @since S60 3.2
       
   156 	 * @param aError A standard system error code or FM tuner error (TFmRadioTunerError).
       
   157 	 */
       
   158 	void MrftoRequestTunerControlComplete(TInt aError);
       
   159 
       
   160 	/**
       
   161 	 * From MRadioFmTunerObserver.
       
   162 	 * Set frequency range complete event. This event is asynchronous and is received after
       
   163 	 * a call to CRadioFmTunerUtility::SetFrequencyRange.
       
   164 	 *
       
   165 	 * @since S60 3.2
       
   166 	 * @param aError A standard system error code or FM tuner error (TFmRadioTunerError).
       
   167 	 */
       
   168 	void MrftoSetFrequencyRangeComplete(TInt aError);
       
   169 
       
   170 	/**
       
   171 	 * From MRadioFmTunerObserver.
       
   172 	 * Set frequency complete event. This event is asynchronous and is received after a call to
       
   173 	 * CRadioFmTunerUtility::SetFrequency.
       
   174 	 *
       
   175 	 * @since S60 3.2
       
   176 	 * @param aError A standard system error code or FM tuner error (TFmRadioTunerError).
       
   177 	 */
       
   178 	void MrftoSetFrequencyComplete(TInt aError);
       
   179 
       
   180 	/**
       
   181 	 * From MRadioFmTunerObserver.
       
   182 	 * Station seek complete event. This event is asynchronous and is received after a call to
       
   183 	 * CRadioFmTunerUtility::StationSeek.
       
   184 	 *
       
   185 	 * @since S60 3.2
       
   186 	 * @param aError A standard system error code or FM tuner error (TFmRadioTunerError).
       
   187 	 * @param aFrequency The frequency(Hz) of the radio station that was found.
       
   188 	 */
       
   189 	void MrftoStationSeekComplete(TInt aError, TInt aFrequency);
       
   190 
       
   191 	/**
       
   192 	 * From MRadioFmTunerObserver.
       
   193 	 * Called when FM Transmitter status changes (if one is present in the device). Tuner receiver
       
   194 	 * is forced to be turned off due to hardware conflicts when FM transmitter is activated.
       
   195 	 *
       
   196 	 * @since S60 3.2
       
   197 	 * @param aActive ETrue if FM transmitter is active; EFalse otherwise.
       
   198 	 */
       
   199 	void MrftoFmTransmitterStatusChange(TBool aActive);
       
   200 
       
   201 	/**
       
   202 	 * From MRadioFmTunerObserver.
       
   203 	 * Called when antenna status changes.
       
   204 	 *
       
   205 	 * @since S60 3.2
       
   206 	 * @param aAttached ETrue if antenna is attached; EFalse otherwise.
       
   207 	 */
       
   208 	void MrftoAntennaStatusChange(TBool aAttached);
       
   209 
       
   210 	/**
       
   211 	 * From MRadioFmTunerObserver.
       
   212 	 * Called when offline mode status changes.
       
   213 	 * @since S60 3.2
       
   214 	 *
       
   215 	 ** @param aAttached ETrue if offline mode is enabled; EFalse otherwise.
       
   216 	 */
       
   217 	void MrftoOfflineModeStatusChange(TBool aOfflineMode);
       
   218 
       
   219 	/**
       
   220 	 * From MRadioFmTunerObserver.
       
   221 	 * Called when the frequency range changes. This may be caused by other applications.
       
   222 	 *
       
   223 	 * @since S60 3.2
       
   224 	 * @param aNewRange New frequency range.
       
   225 	 */
       
   226 	void MrftoFrequencyRangeChange(TFmRadioFrequencyRange aBand /*, TInt aMinFreq, TInt aMaxFreq*/);
       
   227 
       
   228 	/**
       
   229 	 * From MRadioFmTunerObserver.
       
   230 	 * Called when the tuned frequency changes. This may be caused by other
       
   231 	 * applications or RDS if AF/TA is enabled.
       
   232 	 *
       
   233 	 * @since S60 3.2
       
   234 	 * @param aNewFrequency The new tuned frequency(Hz).
       
   235 	 */
       
   236 	void MrftoFrequencyChange(TInt aNewFrequency);
       
   237 
       
   238 	/**
       
   239 	 * From MRadioFmTunerObserver.
       
   240 	 * Called when the forced mono status change. This may be caused by other applications.
       
   241 	 *
       
   242 	 * @since S60 3.2
       
   243 	 * @param aForcedMono ETrue if forced mono mode is enabled; EFalse otherwise.
       
   244 	 */
       
   245 	void MrftoForcedMonoChange(TBool aForcedMono);
       
   246 
       
   247 	/**
       
   248 	 * From MRadioFmTunerObserver.
       
   249 	 * Called when the squelch (muting the frequencies without broadcast) status change.
       
   250 	 * This may be caused by other applications.
       
   251 	 *
       
   252 	 * @since S60 3.2
       
   253 	 * @param aSquelch ETrue if squelch is enabled; EFalse otherwise.
       
   254 	 */
       
   255 	void MrftoSquelchChange(TBool aSquelch);
       
   256 
       
   257 private:
       
   258     bool initRadio();
       
   259 
       
   260     mutable int m_error;
       
   261 
       
   262     CRadioUtility* m_radioUtility;   
       
   263     CRadioFmTunerUtility* m_fmTunerUtility;
       
   264     CRadioPlayerUtility* m_playerUtility;
       
   265     TInt m_maxVolume;
       
   266 
       
   267 	bool m_tunerControl;
       
   268     bool m_audioInitializationComplete;
       
   269     bool m_muted;
       
   270     bool m_isStereo;
       
   271     bool m_available;
       
   272     int  m_vol;
       
   273     mutable int m_signal;
       
   274     bool m_scanning;
       
   275     QRadioTuner::Band m_currentBand;
       
   276     qint64 m_currentFreq;
       
   277     
       
   278     QRadioTuner::Error m_radioError;
       
   279     QRadioTuner::StereoMode m_stereoMode;
       
   280     QString m_errorString;
       
   281     // caps meaning what the tuner can do.
       
   282     // TTunerCapabilities m_currentTunerCapabilities;
       
   283     QRadioTuner::State m_apiTunerState;
       
   284 };
       
   285 
       
   286 #endif
       
   287