qtmobility/plugins/multimedia/symbian/radio/s60radiotunercontrol_31.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 #include <tuner.h>
       
    49 
       
    50 class S60RadioTunerService;
       
    51 
       
    52 QTM_USE_NAMESPACE
       
    53 
       
    54 class S60RadioTunerControl 
       
    55     : public QRadioTunerControl
       
    56     , public MMMTunerObserver
       
    57     , public MMMTunerStereoObserver
       
    58     , public MMMSignalStrengthObserver
       
    59     , public MMMTunerChangeObserver
       
    60     , public MMMTunerAudioPlayerObserver
       
    61 {
       
    62     Q_OBJECT
       
    63 public:
       
    64     S60RadioTunerControl(QObject *parent = 0);
       
    65     ~S60RadioTunerControl();
       
    66     
       
    67     QRadioTuner::State state() const;
       
    68 
       
    69     QRadioTuner::Band band() const;
       
    70     void setBand(QRadioTuner::Band b);
       
    71     bool isBandSupported(QRadioTuner::Band b) const;
       
    72 
       
    73     int frequency() const;
       
    74     int frequencyStep(QRadioTuner::Band b) const;
       
    75     QPair<int,int> frequencyRange(QRadioTuner::Band b) const;
       
    76     void setFrequency(int frequency);
       
    77 
       
    78     bool isStereo() const;
       
    79     QRadioTuner::StereoMode stereoMode() const;
       
    80     void setStereoMode(QRadioTuner::StereoMode mode);
       
    81 
       
    82     int signalStrength() const;
       
    83    
       
    84     int volume() const;
       
    85     void setVolume(int volume);
       
    86 
       
    87     bool isMuted() const;
       
    88     void setMuted(bool muted);
       
    89 
       
    90     bool isSearching() const;
       
    91     void searchForward();
       
    92     void searchBackward();
       
    93     void cancelSearch();
       
    94 
       
    95     bool isValid() const;
       
    96 
       
    97     bool isAvailable() const;
       
    98     QtMedia::AvailabilityError availabilityError() const;
       
    99     
       
   100     void start();
       
   101     void stop();
       
   102 
       
   103     QRadioTuner::Error error() const;
       
   104     QString errorString() const;
       
   105     
       
   106     //MMMTunerObserver
       
   107     void MToTuneComplete(TInt aError);
       
   108     
       
   109     //MMMTunerChangeObserver
       
   110     void MTcoFrequencyChanged(const TFrequency& aOldFrequency, const TFrequency& aNewFrequency);
       
   111     void MTcoStateChanged(const TUint32& aOldState, const TUint32& aNewState);
       
   112     void MTcoAntennaDetached();
       
   113     void MTcoAntennaAttached();
       
   114     void FlightModeChanged(TBool aFlightMode);
       
   115     
       
   116     //MMMTunerStereoObserver
       
   117     void MTsoStereoReceptionChanged(TBool aStereo);
       
   118     void MTsoForcedMonoChanged(TBool aForcedMono);
       
   119     
       
   120     //MMMSignalStrengthObserver
       
   121     void MssoSignalStrengthChanged(TInt aNewSignalStrength);
       
   122     
       
   123     //MMMTunerAudioPlayerObserver
       
   124     void MTapoInitializeComplete(TInt aError);
       
   125     void MTapoPlayEvent(TEventType aEvent, TInt aError, TAny* aAdditionalInfo);
       
   126 
       
   127 private slots:
       
   128 
       
   129 
       
   130 private:
       
   131     bool initRadio();
       
   132     CMMTunerUtility::TTunerBand getNativeBand(QRadioTuner::Band b) const;
       
   133 
       
   134     mutable int m_error;
       
   135     CMMTunerUtility *m_tunerUtility;
       
   136     CMMTunerAudioPlayerUtility *m_audioPlayerUtility;
       
   137     
       
   138     bool m_audioInitializationComplete;
       
   139     bool m_muted;
       
   140     bool m_isStereo;
       
   141     bool m_available;
       
   142     int  m_step;
       
   143     int  m_vol;
       
   144     mutable int  m_signal;
       
   145     bool m_scanning;
       
   146     bool forward;
       
   147     QRadioTuner::Band m_currentBand;
       
   148     qint64 m_currentFreq;
       
   149     
       
   150     QRadioTuner::Error m_radioError;
       
   151     QRadioTuner::StereoMode m_stereoMode;
       
   152     QString m_errorString;
       
   153     //caps meaning what the tuner can do.
       
   154     TTunerCapabilities m_currentTunerCapabilities;
       
   155     long m_tunerState; 
       
   156     QRadioTuner::State m_apiTunerState;
       
   157     
       
   158 };
       
   159 
       
   160 #endif
       
   161