summaryrefslogtreecommitdiffstats
path: root/src/multimedia/radio
diff options
context:
space:
mode:
authorMichael Goddard <michael.goddard@nokia.com>2012-01-04 16:05:55 +1000
committerQt by Nokia <qt-info@nokia.com>2012-01-05 01:13:44 +0100
commit502d3c8eb353f45f988e371aa6d7938d5ec9d51e (patch)
treef8f2108e825bc13755aad7ae6cef6f9c044ffba7 /src/multimedia/radio
parent6ee1977d60b131ae00919e1f37796c1efc4906f7 (diff)
Restructure the source code a little.
Change-Id: I995b0fb33bdda7f01bf6266c1c50a1b17eba6760 Reviewed-by: Jonas Rabbe <jonas.rabbe@nokia.com>
Diffstat (limited to 'src/multimedia/radio')
-rw-r--r--src/multimedia/radio/qradiodata.cpp355
-rw-r--r--src/multimedia/radio/qradiodata.h136
-rw-r--r--src/multimedia/radio/qradiotuner.cpp661
-rw-r--r--src/multimedia/radio/qradiotuner.h165
-rw-r--r--src/multimedia/radio/radio.pri9
5 files changed, 1326 insertions, 0 deletions
diff --git a/src/multimedia/radio/qradiodata.cpp b/src/multimedia/radio/qradiodata.cpp
new file mode 100644
index 000000000..bb9032fdd
--- /dev/null
+++ b/src/multimedia/radio/qradiodata.cpp
@@ -0,0 +1,355 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qradiodata.h"
+#include "qmediaservice.h"
+#include "qmediaobject_p.h"
+#include "qradiodatacontrol.h"
+
+#include <QPair>
+
+
+QT_BEGIN_NAMESPACE
+
+
+namespace
+{
+ class QRadioDataPrivateRegisterMetaTypes
+ {
+ public:
+ QRadioDataPrivateRegisterMetaTypes()
+ {
+ qRegisterMetaType<QRadioData::Error>();
+ qRegisterMetaType<QRadioData::ProgramType>();
+ }
+ } _registerMetaTypes;
+}
+
+/*!
+ \class QRadioData
+ \brief The QRadioData class provides interfaces to the RDS functionality of the system radio.
+
+ \inmodule QtMultimedia
+ \ingroup multimedia
+ \since 5.0
+
+ The radio data object will emit signals for any changes in radio data. You can enable or disable
+ alternative frequency with setAlternativeFrequenciesEnabled().
+
+*/
+
+
+class QRadioDataPrivate : public QMediaObjectPrivate
+{
+public:
+ QRadioDataPrivate():provider(0), control(0) {}
+ QMediaServiceProvider *provider;
+ QRadioDataControl* control;
+};
+
+/*!
+ Constructs a radio data based on a media service allocated by a media service \a provider.
+
+ The \a parent is passed to QMediaObject.
+ \since 5.0
+*/
+
+QRadioData::QRadioData(QObject *parent, QMediaServiceProvider* provider):
+ QMediaObject(*new QRadioDataPrivate, parent, provider->requestService(Q_MEDIASERVICE_RADIO))
+{
+ Q_D(QRadioData);
+
+ d->provider = provider;
+
+ if (d->service != 0) {
+ d->control = qobject_cast<QRadioDataControl*>(d->service->requestControl(QRadioDataControl_iid));
+ if (d->control != 0) {
+ connect(d->control, SIGNAL(stationIdChanged(QString)), SIGNAL(stationIdChanged(QString)));
+ connect(d->control, SIGNAL(programTypeChanged(QRadioData::ProgramType)),
+ SIGNAL(programTypeChanged(QRadioData::ProgramType)));
+ connect(d->control, SIGNAL(programTypeNameChanged(QString)), SIGNAL(programTypeNameChanged(QString)));
+ connect(d->control, SIGNAL(stationNameChanged(QString)), SIGNAL(stationNameChanged(QString)));
+ connect(d->control, SIGNAL(radioTextChanged(QString)), SIGNAL(radioTextChanged(QString)));
+ connect(d->control, SIGNAL(alternativeFrequenciesEnabledChanged(bool)), SIGNAL(alternativeFrequenciesEnabledChanged(bool)));
+ connect(d->control, SIGNAL(error(QRadioData::Error)), SIGNAL(error(QRadioData::Error)));
+ }
+ }
+}
+
+/*!
+ Destroys a radio data.
+*/
+
+QRadioData::~QRadioData()
+{
+ Q_D(QRadioData);
+
+ if (d->service && d->control)
+ d->service->releaseControl(d->control);
+
+ d->provider->releaseService(d->service);
+}
+
+/*!
+ Returns true if the radio data service is ready to use.
+ \since 5.0
+*/
+bool QRadioData::isAvailable() const
+{
+ Q_D(const QRadioData);
+
+ if (d->control != 0)
+ return d_func()->control->isAvailable();
+ else
+ return false;
+}
+
+/*!
+ Returns the availability error state.
+ \since 5.0
+*/
+QtMultimedia::AvailabilityError QRadioData::availabilityError() const
+{
+ Q_D(const QRadioData);
+
+ if (d->control != 0)
+ return d_func()->control->availabilityError();
+ else
+ return QtMultimedia::ServiceMissingError;
+}
+
+/*!
+ \property QRadioData::stationId
+ \brief Current Program Identification
+
+ \since 5.0
+*/
+
+QString QRadioData::stationId() const
+{
+ Q_D(const QRadioData);
+
+ if (d->control != 0)
+ return d->control->stationId();
+ return QString();
+}
+
+/*!
+ \property QRadioData::programType
+ \brief Current Program Type
+
+ \since 5.0
+*/
+
+QRadioData::ProgramType QRadioData::programType() const
+{
+ Q_D(const QRadioData);
+
+ if (d->control != 0)
+ return d->control->programType();
+
+ return QRadioData::Undefined;
+}
+
+/*!
+ \property QRadioData::programTypeName
+ \brief Current Program Type Name
+
+ \since 5.0
+*/
+
+QString QRadioData::programTypeName() const
+{
+ Q_D(const QRadioData);
+
+ if (d->control != 0)
+ return d->control->programTypeName();
+ return QString();
+}
+
+/*!
+ \property QRadioData::stationName
+ \brief Current Program Service
+
+ \since 5.0
+*/
+
+QString QRadioData::stationName() const
+{
+ Q_D(const QRadioData);
+
+ if (d->control != 0)
+ return d->control->stationName();
+ return QString();
+}
+
+/*!
+ \property QRadioData::radioText
+ \brief Current Radio Text
+
+ \since 5.0
+*/
+
+QString QRadioData::radioText() const
+{
+ Q_D(const QRadioData);
+
+ if (d->control != 0)
+ return d->control->radioText();
+ return QString();
+}
+
+/*!
+ \property QRadioData::alternativeFrequenciesEnabled
+ \brief Is Alternative Frequency currently enabled
+
+ \since 5.0
+*/
+
+bool QRadioData::isAlternativeFrequenciesEnabled() const
+{
+ Q_D(const QRadioData);
+
+ if (d->control != 0)
+ return d->control->isAlternativeFrequenciesEnabled();
+ return false;
+}
+
+void QRadioData::setAlternativeFrequenciesEnabled( bool enabled )
+{
+ Q_D(const QRadioData);
+
+ if (d->control != 0)
+ return d->control->setAlternativeFrequenciesEnabled(enabled);
+}
+
+/*!
+ Returns the error state of a radio data.
+
+ \since 5.0
+ \sa errorString()
+*/
+
+QRadioData::Error QRadioData::error() const
+{
+ Q_D(const QRadioData);
+
+ if (d->control != 0)
+ return d->control->error();
+ return QRadioData::ResourceError;
+}
+
+/*!
+ Returns a description of a radio data's error state.
+
+ \since 5.0
+ \sa error()
+*/
+QString QRadioData::errorString() const
+{
+ Q_D(const QRadioData);
+
+ if (d->control != 0)
+ return d->control->errorString();
+ return QString();
+}
+
+/*!
+ \fn void QRadioData::stationIdChanged(QString stationId)
+
+ Signals that the Program Identification code has changed to \a stationId
+ \since 5.0
+*/
+
+/*!
+ \fn void QRadioData::programTypeChanged(QRadioData::ProgramType programType)
+
+ Signals that the Program Type code has changed to \a programType
+ \since 5.0
+*/
+
+/*!
+ \fn void QRadioData::programTypeNameChanged(QString programTypeName)
+
+ Signals that the Program Type Name has changed to \a programTypeName
+ \since 5.0
+*/
+
+/*!
+ \fn void QRadioData::stationNameChanged(int stationName)
+
+ Signals that the Program Service has changed to \a stationName
+ \since 5.0
+*/
+
+/*!
+ \fn void QRadioData::alternativeFrequenciesEnabledChanged(bool enabled)
+
+ Signals that the AF has been enabled or disabled
+ \since 5.0
+*/
+
+/*!
+ \fn void QRadioData::error(QRadioData::Error error)
+
+ Signals that an \a error occurred.
+ \since 5.0
+*/
+
+/*!
+ \enum QRadioData::Error
+
+ Enumerates radio data error conditions.
+
+ \value NoError No errors have occurred.
+ \value ResourceError There is no radio service available.
+ \value OpenError Unable to open radio device.
+ \value OutOfRangeError An attempt to set a frequency or band that is not supported by radio device.
+*/
+
+/*! \fn void QRadioData::stateChanged(QRadioData::State state)
+ This signal is emitted when the state changes to \a state.
+ \since 5.0
+ */
+
+#include "moc_qradiodata.cpp"
+QT_END_NAMESPACE
+
diff --git a/src/multimedia/radio/qradiodata.h b/src/multimedia/radio/qradiodata.h
new file mode 100644
index 000000000..71ae222b8
--- /dev/null
+++ b/src/multimedia/radio/qradiodata.h
@@ -0,0 +1,136 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QRADIODATA_H
+#define QRADIODATA_H
+
+#include <QtCore/qobject.h>
+
+#include "qmediaobject.h"
+#include "qmediaserviceprovider.h"
+#include <qmediaenumdebug.h>
+
+#include <QPair>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Multimedia)
+
+
+class QRadioDataPrivate;
+class Q_MULTIMEDIA_EXPORT QRadioData : public QMediaObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString stationId READ stationId NOTIFY stationIdChanged)
+ Q_PROPERTY(ProgramType programType READ programType NOTIFY programTypeChanged)
+ Q_PROPERTY(QString programTypeName READ programTypeName NOTIFY programTypeNameChanged)
+ Q_PROPERTY(QString stationName READ stationName NOTIFY stationNameChanged)
+ Q_PROPERTY(QString radioText READ radioText NOTIFY radioTextChanged)
+ Q_PROPERTY(bool alternativeFrequenciesEnabled READ isAlternativeFrequenciesEnabled
+ WRITE setAlternativeFrequenciesEnabled NOTIFY alternativeFrequenciesEnabledChanged)
+ Q_ENUMS(Error)
+ Q_ENUMS(ProgramType)
+
+public:
+ enum Error { NoError, ResourceError, OpenError, OutOfRangeError };
+
+ enum ProgramType { Undefined = 0, News, CurrentAffairs, Information,
+ Sport, Education, Drama, Culture, Science, Varied,
+ PopMusic, RockMusic, EasyListening, LightClassical,
+ SeriousClassical, OtherMusic, Weather, Finance,
+ ChildrensProgrammes, SocialAffairs, Religion,
+ PhoneIn, Travel, Leisure, JazzMusic, CountryMusic,
+ NationalMusic, OldiesMusic, FolkMusic, Documentary,
+ AlarmTest, Alarm, Talk, ClassicRock, AdultHits,
+ SoftRock, Top40, Soft, Nostalgia, Classical,
+ RhythmAndBlues, SoftRhythmAndBlues, Language,
+ ReligiousMusic, ReligiousTalk, Personality, Public,
+ College
+ };
+
+ QRadioData(QObject *parent = 0, QMediaServiceProvider *provider = QMediaServiceProvider::defaultServiceProvider());
+ ~QRadioData();
+
+ bool isAvailable() const;
+ QtMultimedia::AvailabilityError availabilityError() const;
+
+ QString stationId() const;
+ ProgramType programType() const;
+ QString programTypeName() const;
+ QString stationName() const;
+ QString radioText() const;
+ bool isAlternativeFrequenciesEnabled() const;
+
+ Error error() const;
+ QString errorString() const;
+
+public Q_SLOTS:
+ void setAlternativeFrequenciesEnabled(bool enabled);
+
+Q_SIGNALS:
+ void stationIdChanged(QString stationId);
+ void programTypeChanged(QRadioData::ProgramType programType);
+ void programTypeNameChanged(QString programTypeName);
+ void stationNameChanged(QString stationName);
+ void radioTextChanged(QString radioText);
+ void alternativeFrequenciesEnabledChanged(bool enabled);
+
+ void error(QRadioData::Error error);
+
+private:
+
+ Q_DISABLE_COPY(QRadioData)
+ Q_DECLARE_PRIVATE(QRadioData)
+};
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QRadioData::Error)
+Q_DECLARE_METATYPE(QRadioData::ProgramType)
+
+Q_MEDIA_ENUM_DEBUG(QRadioData, Error)
+Q_MEDIA_ENUM_DEBUG(QRadioData, ProgramType)
+
+QT_END_HEADER
+
+#endif // QRADIOPLAYER_H
diff --git a/src/multimedia/radio/qradiotuner.cpp b/src/multimedia/radio/qradiotuner.cpp
new file mode 100644
index 000000000..66b0c7048
--- /dev/null
+++ b/src/multimedia/radio/qradiotuner.cpp
@@ -0,0 +1,661 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qradiotuner.h"
+#include "qmediaservice.h"
+#include "qmediaobject_p.h"
+#include "qradiotunercontrol.h"
+
+#include <QPair>
+
+
+QT_BEGIN_NAMESPACE
+
+
+namespace
+{
+ class QRadioTunerPrivateRegisterMetaTypes
+ {
+ public:
+ QRadioTunerPrivateRegisterMetaTypes()
+ {
+ qRegisterMetaType<QRadioTuner::Band>();
+ qRegisterMetaType<QRadioTuner::Error>();
+ qRegisterMetaType<QRadioTuner::SearchMode>();
+ qRegisterMetaType<QRadioTuner::State>();
+ qRegisterMetaType<QRadioTuner::StereoMode>();
+ }
+ } _registerMetaTypes;
+}
+
+
+/*!
+ \class QRadioTuner
+ \brief The QRadioTuner class provides an interface to the systems analog radio device.
+
+ \inmodule QtMultimedia
+ \ingroup multimedia
+ \since 1.0
+
+ You can control the systems analog radio device using this interface, for example:
+
+ \snippet doc/src/snippets/multimedia-snippets/media.cpp Radio tuner
+
+ The radio object will emit signals for any changes in state such as:
+ bandChanged(), frequencyChanged(), stereoStatusChanged(), searchingChanged(),
+ signalStrengthChanged(), volumeChanged(), mutedChanged().
+
+ You can change between the frequency bands using setBand() however it is recommended
+ that you check to make sure the band is available first using isBandSupported().
+
+*/
+
+
+class QRadioTunerPrivate : public QMediaObjectPrivate
+{
+public:
+ QRadioTunerPrivate():provider(0), control(0) {}
+ QMediaServiceProvider *provider;
+ QRadioTunerControl* control;
+};
+
+
+
+/*!
+ Constructs a radio tuner based on a media service allocated by a media service \a provider.
+
+ The \a parent is passed to QMediaObject.
+ \since 1.0
+*/
+
+QRadioTuner::QRadioTuner(QObject *parent, QMediaServiceProvider* provider):
+ QMediaObject(*new QRadioTunerPrivate, parent, provider->requestService(Q_MEDIASERVICE_RADIO))
+{
+ Q_D(QRadioTuner);
+
+ d->provider = provider;
+
+ if (d->service != 0) {
+ d->control = qobject_cast<QRadioTunerControl*>(d->service->requestControl(QRadioTunerControl_iid));
+ if (d->control != 0) {
+ connect(d->control, SIGNAL(stateChanged(QRadioTuner::State)), SIGNAL(stateChanged(QRadioTuner::State)));
+ connect(d->control, SIGNAL(bandChanged(QRadioTuner::Band)), SIGNAL(bandChanged(QRadioTuner::Band)));
+ connect(d->control, SIGNAL(frequencyChanged(int)), SIGNAL(frequencyChanged(int)));
+ connect(d->control, SIGNAL(stereoStatusChanged(bool)), SIGNAL(stereoStatusChanged(bool)));
+ connect(d->control, SIGNAL(searchingChanged(bool)), SIGNAL(searchingChanged(bool)));
+ connect(d->control, SIGNAL(signalStrengthChanged(int)), SIGNAL(signalStrengthChanged(int)));
+ connect(d->control, SIGNAL(volumeChanged(int)), SIGNAL(volumeChanged(int)));
+ connect(d->control, SIGNAL(mutedChanged(bool)), SIGNAL(mutedChanged(bool)));
+ connect(d->control, SIGNAL(stationFound(int,QString)), SIGNAL(stationFound(int,QString)));
+ connect(d->control, SIGNAL(error(QRadioTuner::Error)), SIGNAL(error(QRadioTuner::Error)));
+ }
+ }
+}
+
+/*!
+ Destroys a radio tuner.
+*/
+
+QRadioTuner::~QRadioTuner()
+{
+ Q_D(QRadioTuner);
+
+ if (d->service && d->control)
+ d->service->releaseControl(d->control);
+
+ d->provider->releaseService(d->service);
+}
+
+/*!
+ Returns true if the radio tuner service is ready to use.
+ \since 1.0
+*/
+bool QRadioTuner::isAvailable() const
+{
+ if (d_func()->control != NULL)
+ return d_func()->control->isAvailable();
+ else
+ return false;
+}
+
+/*!
+ Returns the availability error state.
+ \since 1.0
+*/
+QtMultimedia::AvailabilityError QRadioTuner::availabilityError() const
+{
+ if (d_func()->control != NULL)
+ return d_func()->control->availabilityError();
+ else
+ return QtMultimedia::ServiceMissingError;
+}
+
+/*!
+ \property QRadioTuner::state
+ Return the current radio tuner state.
+
+ \since 1.0
+ \sa QRadioTuner::State
+*/
+
+QRadioTuner::State QRadioTuner::state() const
+{
+ return d_func()->control ?
+ d_func()->control->state() : QRadioTuner::StoppedState;
+}
+
+/*!
+ \property QRadioTuner::band
+ \brief the frequency band a radio tuner is tuned to.
+
+ \since 1.0
+ \sa QRadioTuner::Band
+*/
+
+QRadioTuner::Band QRadioTuner::band() const
+{
+ Q_D(const QRadioTuner);
+
+ if (d->control != 0)
+ return d->control->band();
+
+ return QRadioTuner::FM;
+}
+
+/*!
+ \property QRadioTuner::frequency
+ \brief the frequency in Hertz a radio tuner is tuned to.
+ \since 1.0
+*/
+
+int QRadioTuner::frequency() const
+{
+ Q_D(const QRadioTuner);
+
+ if (d->control != 0)
+ return d->control->frequency();
+
+ return 0;
+}
+
+/*!
+ Returns the number of Hertz to increment the frequency by when stepping through frequencies
+ within a given \a band.
+ \since 1.0
+*/
+
+int QRadioTuner::frequencyStep(QRadioTuner::Band band) const
+{
+ Q_D(const QRadioTuner);
+
+ if(d->control != 0)
+ return d->control->frequencyStep(band);
+
+ return 0;
+}
+
+/*!
+ Returns a frequency \a band's minimum and maximum frequency.
+ \since 1.0
+*/
+
+QPair<int,int> QRadioTuner::frequencyRange(QRadioTuner::Band band) const
+{
+ Q_D(const QRadioTuner);
+
+ if(d->control != 0)
+ return d->control->frequencyRange(band);
+
+ return qMakePair<int,int>(0,0);
+}
+
+/*!
+ \property QRadioTuner::stereo
+ \brief whether a radio tuner is receiving a stereo signal.
+ \since 1.0
+*/
+
+bool QRadioTuner::isStereo() const
+{
+ Q_D(const QRadioTuner);
+
+ if (d->control != 0)
+ return d->control->isStereo();
+
+ return false;
+}
+
+
+/*!
+ \property QRadioTuner::stereoMode
+ \brief the stereo mode of a radio tuner.
+ \since 1.0
+*/
+
+QRadioTuner::StereoMode QRadioTuner::stereoMode() const
+{
+ Q_D(const QRadioTuner);
+
+ if (d->control != 0)
+ return d->control->stereoMode();
+
+ return QRadioTuner::Auto;
+}
+
+void QRadioTuner::setStereoMode(QRadioTuner::StereoMode mode)
+{
+ Q_D(QRadioTuner);
+
+ if (d->control != 0)
+ return d->control->setStereoMode(mode);
+}
+
+/*!
+ Identifies if a frequency \a band is supported by a radio tuner.
+
+ Returns true if the band is supported, and false if it is not.
+ \since 1.0
+*/
+
+bool QRadioTuner::isBandSupported(QRadioTuner::Band band) const
+{
+ Q_D(const QRadioTuner);
+
+ if (d->control != 0)
+ return d->control->isBandSupported(band);
+
+ return false;
+}
+
+/*!
+ Activate the radio device.
+ \since 1.0
+*/
+
+void QRadioTuner::start()
+{
+ Q_D(const QRadioTuner);
+
+ if (d->control != 0)
+ d->control->start();
+}
+
+/*!
+ Deactivate the radio device.
+ \since 1.0
+*/
+
+void QRadioTuner::stop()
+{
+ Q_D(const QRadioTuner);
+
+ if (d->control != 0)
+ d->control->stop();
+}
+
+/*!
+ \property QRadioTuner::signalStrength
+ \brief the strength of the current radio signal as a percentage.
+ \since 1.0
+*/
+
+int QRadioTuner::signalStrength() const
+{
+ Q_D(const QRadioTuner);
+
+ if (d->control != 0)
+ return d->control->signalStrength();
+
+ return 0;
+}
+
+/*!
+ \property QRadioTuner::volume
+ \brief the volume of a radio tuner's audio output as a percentage.
+ \since 1.0
+*/
+
+
+int QRadioTuner::volume() const
+{
+ Q_D(const QRadioTuner);
+
+ if (d->control != 0)
+ return d->control->volume();
+
+ return 0;
+}
+
+/*!
+ \property QRadioTuner::muted
+ \brief whether a radio tuner's audio output is muted.
+ \since 1.0
+*/
+
+bool QRadioTuner::isMuted() const
+{
+ Q_D(const QRadioTuner);
+
+ if (d->control != 0)
+ return d->control->isMuted();
+
+ return false;
+}
+
+/*!
+ Sets a radio tuner's frequency \a band.
+
+ Changing the band will reset the \l frequency to the new band's minimum frequency.
+ \since 1.0
+*/
+
+void QRadioTuner::setBand(QRadioTuner::Band band)
+{
+ Q_D(QRadioTuner);
+
+ if (d->control != 0)
+ d->control->setBand(band);
+}
+
+/*!
+ Sets a radio tuner's \a frequency.
+
+ If the tuner is set to a frequency outside the current \l band, the band will be changed to
+ one occupied by the new frequency.
+ \since 1.0
+*/
+
+void QRadioTuner::setFrequency(int frequency)
+{
+ Q_D(QRadioTuner);
+
+ if (d->control != 0)
+ d->control->setFrequency(frequency);
+}
+
+void QRadioTuner::setVolume(int volume)
+{
+ Q_D(QRadioTuner);
+
+ if (d->control != 0)
+ d->control->setVolume(volume);
+}
+
+void QRadioTuner::setMuted(bool muted)
+{
+ Q_D(QRadioTuner);
+
+ if (d->control != 0)
+ d->control->setMuted(muted);
+}
+
+/*!
+ \property QRadioTuner::searching
+ \brief whether a radio tuner is currently scanning for a signal.
+
+ \sa searchForward(), searchBackward(), cancelSearch()
+ \since 1.0
+*/
+
+bool QRadioTuner::isSearching() const
+{
+ Q_D(const QRadioTuner);
+
+ if (d->control != 0)
+ return d->control->isSearching();
+
+ return false;
+}
+
+/*!
+ Starts a forward scan for a signal, starting from the current \l frequency.
+
+ \since 1.0
+ \sa searchBackward(), cancelSearch(), searching
+*/
+
+void QRadioTuner::searchForward()
+{
+ Q_D(QRadioTuner);
+
+ if (d->control != 0)
+ d->control->searchForward();
+}
+
+/*!
+ Starts a backwards scan for a signal, starting from the current \l frequency.
+
+ \since 1.0
+ \sa searchForward(), cancelSearch(), searching
+*/
+
+void QRadioTuner::searchBackward()
+{
+ Q_D(QRadioTuner);
+
+ if (d->control != 0)
+ d->control->searchBackward();
+}
+
+/*!
+ Search all stations in current band
+
+ Emits QRadioTuner::stationFound(int, QString) for every found station.
+ After searching is completed, QRadioTuner::searchingChanged(bool) is
+ emitted (false). If \a searchMode is set to SearchGetStationId, searching
+ waits for station id (PI) on each frequency.
+
+ \since 5.0
+ \sa searchForward(), searchBackward(), searching
+*/
+
+void QRadioTuner::searchAllStations(QRadioTuner::SearchMode searchMode)
+{
+ Q_D(const QRadioTuner);
+
+ if (d->control != 0)
+ d->control->searchAllStations(searchMode);
+}
+
+/*!
+ Stops scanning for a signal.
+
+ \since 1.0
+ \sa searchForward(), searchBackward(), searching
+*/
+
+void QRadioTuner::cancelSearch()
+{
+ Q_D(QRadioTuner);
+
+ if (d->control != 0)
+ d->control->cancelSearch();
+}
+
+/*!
+ Returns the error state of a radio tuner.
+
+ \since 1.0
+ \sa errorString()
+*/
+
+QRadioTuner::Error QRadioTuner::error() const
+{
+ Q_D(const QRadioTuner);
+
+ if (d->control != 0)
+ return d->control->error();
+
+ return QRadioTuner::ResourceError;
+}
+
+/*!
+ Returns a description of a radio tuner's error state.
+
+ \since 1.0
+ \sa error()
+*/
+
+QString QRadioTuner::errorString() const
+{
+ Q_D(const QRadioTuner);
+
+ if (d->control != 0)
+ return d->control->errorString();
+
+ return QString();
+}
+
+/*!
+ \fn void QRadioTuner::bandChanged(QRadioTuner::Band band)
+
+ Signals a radio tuner's \a band has changed.
+ \since 1.0
+*/
+
+/*!
+ \fn void QRadioTuner::frequencyChanged(int frequency)
+
+ Signals that the \a frequency a radio tuner is tuned to has changed.
+ \since 1.0
+*/
+
+/*!
+ \fn void QRadioTuner::mutedChanged(bool muted)
+
+ Signals that the \a muted state of a radio tuner's audio output has changed.
+ \since 1.0
+*/
+
+/*!
+ \fn void QRadioTuner::volumeChanged(int volume)
+
+ Signals that the \a volume of a radio tuner's audio output has changed.
+ \since 1.0
+*/
+
+/*!
+ \fn void QRadioTuner::searchingChanged(bool searching)
+
+ Signals that the \a searching state of a radio tuner has changed.
+ \since 1.0
+*/
+
+/*!
+ \fn void QRadioTuner::stereoStatusChanged(bool stereo)
+
+ Signals that the \a stereo state of a radio tuner has changed.
+ \since 1.0
+*/
+
+/*!
+ \fn void QRadioTuner::signalStrengthChanged(int strength)
+
+ Signals that the \a strength of the signal received by a radio tuner has changed.
+ \since 1.0
+*/
+
+/*!
+ \fn void QRadioTuner::stationFound(int frequency, QString stationId)
+
+ Signals that a station was found in \a frequency with \a stationId Program
+ Identification code.
+ \since 5.0
+*/
+
+/*!
+ \fn void QRadioTuner::error(QRadioTuner::Error error)
+
+ Signals that an \a error occurred.
+ \since 1.0
+*/
+
+/*!
+ \enum QRadioTuner::State
+
+ Enumerates radio tuner states.
+
+ \value ActiveState The tuner is started and active.
+ \value StoppedState The tuner device is stopped.
+*/
+
+
+/*!
+ \enum QRadioTuner::Band
+
+ Enumerates radio frequency bands.
+
+ \value AM 520 to 1610 kHz, 9 or 10kHz channel spacing, extended 1610 to 1710 kHz
+ \value FM 87.5 to 108.0 MHz, except Japan 76-90 MHz
+ \value SW 1.711 to 30.0 MHz, divided into 15 bands. 5kHz channel spacing
+ \value LW 148.5 to 283.5 kHz, 9kHz channel spacing (Europe, Africa, Asia)
+ \value FM2 range not defined, used when area supports more than one FM range.
+*/
+
+/*!
+ \enum QRadioTuner::Error
+
+ Enumerates radio tuner error conditions.
+
+ \value NoError No errors have occurred.
+ \value ResourceError There is no radio service available.
+ \value OpenError Unable to open radio device.
+ \value OutOfRangeError An attempt to set a frequency or band that is not supported by radio device.
+*/
+
+/*!
+ \enum QRadioTuner::StereoMode
+
+ Enumerates radio tuner policy for receiving stereo signals.
+
+ \value Auto Uses the stereo mode matching the station.
+ \value ForceStereo Provide stereo mode, converting if required.
+ \value ForceMono Provide mono mode, converting if required.
+*/
+
+/*! \fn void QRadioTuner::stateChanged(QRadioTuner::State state)
+ This signal is emitted when the state changes to \a state.
+ \since 1.0
+ */
+
+#include "moc_qradiotuner.cpp"
+QT_END_NAMESPACE
+
diff --git a/src/multimedia/radio/qradiotuner.h b/src/multimedia/radio/qradiotuner.h
new file mode 100644
index 000000000..21497f45c
--- /dev/null
+++ b/src/multimedia/radio/qradiotuner.h
@@ -0,0 +1,165 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QRADIOTUNER_H
+#define QRADIOTUNER_H
+
+#include <QtCore/qobject.h>
+
+#include "qmediaobject.h"
+#include "qmediaserviceprovider.h"
+#include <qmediaenumdebug.h>
+
+#include <QPair>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Multimedia)
+
+
+class QRadioTunerPrivate;
+class Q_MULTIMEDIA_EXPORT QRadioTuner : public QMediaObject
+{
+ Q_OBJECT
+ Q_PROPERTY(State state READ state NOTIFY stateChanged)
+ Q_PROPERTY(Band band READ band WRITE setBand NOTIFY bandChanged)
+ Q_PROPERTY(int frequency READ frequency WRITE setFrequency NOTIFY frequencyChanged)
+ Q_PROPERTY(bool stereo READ isStereo NOTIFY stereoStatusChanged)
+ Q_PROPERTY(StereoMode stereoMode READ stereoMode WRITE setStereoMode)
+ Q_PROPERTY(int signalStrength READ signalStrength NOTIFY signalStrengthChanged)
+ Q_PROPERTY(int volume READ volume WRITE setVolume NOTIFY volumeChanged)
+ Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged)
+ Q_PROPERTY(bool searching READ isSearching NOTIFY searchingChanged)
+ Q_ENUMS(State)
+ Q_ENUMS(Band)
+ Q_ENUMS(Error)
+ Q_ENUMS(StereoMode)
+ Q_ENUMS(SearchMode)
+
+public:
+ enum State { ActiveState, StoppedState };
+ enum Band { AM, FM, SW, LW, FM2 };
+ enum Error { NoError, ResourceError, OpenError, OutOfRangeError };
+ enum StereoMode { ForceStereo, ForceMono, Auto };
+ enum SearchMode { SearchFast, SearchGetStationId };
+
+ QRadioTuner(QObject *parent = 0, QMediaServiceProvider *provider = QMediaServiceProvider::defaultServiceProvider());
+ ~QRadioTuner();
+
+ bool isAvailable() const;
+ QtMultimedia::AvailabilityError availabilityError() const;
+
+ State state() const;
+
+ Band band() const;
+
+ bool isBandSupported(Band b) const;
+
+ int frequency() const;
+ int frequencyStep(Band band) const;
+ QPair<int,int> frequencyRange(Band band) const;
+
+ bool isStereo() const;
+ void setStereoMode(QRadioTuner::StereoMode mode);
+ StereoMode stereoMode() const;
+
+ int signalStrength() const;
+
+ int volume() const;
+ bool isMuted() const;
+
+ bool isSearching() const;
+
+ Error error() const;
+ QString errorString() const;
+
+public Q_SLOTS:
+ void searchForward();
+ void searchBackward();
+ void searchAllStations(QRadioTuner::SearchMode searchMode = QRadioTuner::SearchFast);
+ void cancelSearch();
+
+ void setBand(Band band);
+ void setFrequency(int frequency);
+
+ void setVolume(int volume);
+ void setMuted(bool muted);
+
+ void start();
+ void stop();
+
+Q_SIGNALS:
+ void stateChanged(QRadioTuner::State state);
+ void bandChanged(QRadioTuner::Band band);
+ void frequencyChanged(int frequency);
+ void stereoStatusChanged(bool stereo);
+ void searchingChanged(bool searching);
+ void signalStrengthChanged(int signalStrength);
+ void volumeChanged(int volume);
+ void mutedChanged(bool muted);
+ void stationFound(int frequency, QString stationId);
+
+ void error(QRadioTuner::Error error);
+
+private:
+ Q_DISABLE_COPY(QRadioTuner)
+ Q_DECLARE_PRIVATE(QRadioTuner)
+};
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QRadioTuner::State)
+Q_DECLARE_METATYPE(QRadioTuner::Band)
+Q_DECLARE_METATYPE(QRadioTuner::Error)
+Q_DECLARE_METATYPE(QRadioTuner::StereoMode)
+Q_DECLARE_METATYPE(QRadioTuner::SearchMode)
+
+Q_MEDIA_ENUM_DEBUG(QRadioTuner, State)
+Q_MEDIA_ENUM_DEBUG(QRadioTuner, Band)
+Q_MEDIA_ENUM_DEBUG(QRadioTuner, Error)
+Q_MEDIA_ENUM_DEBUG(QRadioTuner, StereoMode)
+Q_MEDIA_ENUM_DEBUG(QRadioTuner, SearchMode)
+
+QT_END_HEADER
+
+#endif // QRADIOPLAYER_H
diff --git a/src/multimedia/radio/radio.pri b/src/multimedia/radio/radio.pri
new file mode 100644
index 000000000..41e43faa2
--- /dev/null
+++ b/src/multimedia/radio/radio.pri
@@ -0,0 +1,9 @@
+INCLUDEPATH += radio
+
+PUBLIC_HEADERS += \
+ radio/qradiodata.h \
+ radio/qradiotuner.h
+
+SOURCES += \
+ radio/qradiodata.cpp \
+ radio/qradiotuner.cpp