plugins/multimedia/v4l/radio/v4lradiocontrol.h
changeset 0 876b1a06bc25
equal deleted inserted replaced
-1:000000000000 0:876b1a06bc25
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2010 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 V4LRADIOCONTROL_H
       
    43 #define V4LRADIOCONTROL_H
       
    44 
       
    45 #include <QtCore/qobject.h>
       
    46 #include <QtCore/qtimer.h>
       
    47 #include <QtCore/qdatetime.h>
       
    48 
       
    49 #include <qradiotunercontrol.h>
       
    50 
       
    51 #include <linux/types.h>
       
    52 #include <sys/time.h>
       
    53 #include <sys/ioctl.h>
       
    54 #include <linux/videodev2.h>
       
    55 
       
    56 QT_USE_NAMESPACE
       
    57 
       
    58 class V4LRadioService;
       
    59 
       
    60 class V4LRadioControl : public QRadioTunerControl
       
    61 {
       
    62     Q_OBJECT
       
    63 public:
       
    64     V4LRadioControl(QObject *parent = 0);
       
    65     ~V4LRadioControl();
       
    66 
       
    67     bool isAvailable() const;
       
    68     QtMultimediaKit::AvailabilityError availabilityError() const;
       
    69 
       
    70     QRadioTuner::State state() const;
       
    71 
       
    72     QRadioTuner::Band band() const;
       
    73     void setBand(QRadioTuner::Band b);
       
    74     bool isBandSupported(QRadioTuner::Band b) const;
       
    75 
       
    76     int frequency() const;
       
    77     int frequencyStep(QRadioTuner::Band b) const;
       
    78     QPair<int,int> frequencyRange(QRadioTuner::Band b) const;
       
    79     void setFrequency(int frequency);
       
    80 
       
    81     bool isStereo() const;
       
    82     QRadioTuner::StereoMode stereoMode() const;
       
    83     void setStereoMode(QRadioTuner::StereoMode mode);
       
    84 
       
    85     int signalStrength() const;
       
    86 
       
    87     int volume() const;
       
    88     void setVolume(int volume);
       
    89 
       
    90     bool isMuted() const;
       
    91     void setMuted(bool muted);
       
    92 
       
    93     bool isSearching() const;
       
    94     void cancelSearch();
       
    95 
       
    96     void searchForward();
       
    97     void searchBackward();
       
    98 
       
    99     void start();
       
   100     void stop();
       
   101 
       
   102     QRadioTuner::Error error() const;
       
   103     QString errorString() const;
       
   104 
       
   105 private slots:
       
   106     void search();
       
   107 
       
   108 private:
       
   109     bool initRadio();
       
   110     void setVol(int v);
       
   111     int  getVol();
       
   112 
       
   113     int fd;
       
   114 
       
   115     bool m_error;
       
   116     bool muted;
       
   117     bool stereo;
       
   118     bool low;
       
   119     bool available;
       
   120     int  tuners;
       
   121     int  step;
       
   122     int  vol;
       
   123     int  sig;
       
   124     bool scanning;
       
   125     bool forward;
       
   126     QTimer* timer;
       
   127     QRadioTuner::Band   currentBand;
       
   128     qint64 freqMin;
       
   129     qint64 freqMax;
       
   130     qint64 currentFreq;
       
   131     QTime  playTime;
       
   132 };
       
   133 
       
   134 #endif