diff options
author | Sami Nurmenniemi <ext-sami.nurmenniemi@nokia.com> | 2011-10-11 09:06:12 +0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-21 03:40:14 +0200 |
commit | 6aea1a22eeebfe040a330d746de9e9d2cc99b130 (patch) | |
tree | 62cc58c369f866cfaaeb78f2284a94994b9b8180 /src/multimedia | |
parent | cbb21e30d5cd18d17d60a049087f98a82c2862b9 (diff) |
Added RDS functionality to the QRadioTuner/QDeclarativeRadio
Change-Id: I865e3caba82977002cf1f01f1d64ee0a42de77c6
Reviewed-by: Jonas Rabbe <jonas.rabbe@nokia.com>
Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
Diffstat (limited to 'src/multimedia')
-rw-r--r-- | src/multimedia/multimedia.pro | 4 | ||||
-rw-r--r-- | src/multimedia/qradiodata.cpp | 341 | ||||
-rw-r--r-- | src/multimedia/qradiodata.h | 136 | ||||
-rw-r--r-- | src/multimedia/qradiodatacontrol.cpp | 216 | ||||
-rw-r--r-- | src/multimedia/qradiodatacontrol.h | 97 | ||||
-rw-r--r-- | src/multimedia/qradiotuner.cpp | 29 | ||||
-rw-r--r-- | src/multimedia/qradiotuner.h | 7 | ||||
-rw-r--r-- | src/multimedia/qradiotunercontrol.cpp | 14 | ||||
-rw-r--r-- | src/multimedia/qradiotunercontrol.h | 2 |
9 files changed, 846 insertions, 0 deletions
diff --git a/src/multimedia/multimedia.pro b/src/multimedia/multimedia.pro index b955e71a0..f1c11b998 100644 --- a/src/multimedia/multimedia.pro +++ b/src/multimedia/multimedia.pro @@ -55,7 +55,9 @@ PUBLIC_HEADERS += \ qmetadatawritercontrol.h \ qmediastreamscontrol.h \ qradiotuner.h \ + qradiodata.h \ qradiotunercontrol.h \ + qradiodatacontrol.h \ qtmedianamespace.h \ qaudioencodercontrol.h \ qvideoencodercontrol.h \ @@ -95,7 +97,9 @@ SOURCES += qmediacontrol.cpp \ qmetadatawritercontrol.cpp \ qmediastreamscontrol.cpp \ qradiotuner.cpp \ + qradiodata.cpp \ qradiotunercontrol.cpp \ + qradiodatacontrol.cpp \ qaudioencodercontrol.cpp \ qvideoencodercontrol.cpp \ qimageencodercontrol.cpp \ diff --git a/src/multimedia/qradiodata.cpp b/src/multimedia/qradiodata.cpp new file mode 100644 index 000000000..1840db291 --- /dev/null +++ b/src/multimedia/qradiodata.cpp @@ -0,0 +1,341 @@ +/**************************************************************************** +** +** 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 + +/*! + \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/qradiodata.h b/src/multimedia/qradiodata.h new file mode 100644 index 000000000..71ae222b8 --- /dev/null +++ b/src/multimedia/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/qradiodatacontrol.cpp b/src/multimedia/qradiodatacontrol.cpp new file mode 100644 index 000000000..28b9a9973 --- /dev/null +++ b/src/multimedia/qradiodatacontrol.cpp @@ -0,0 +1,216 @@ +/**************************************************************************** +** +** 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 <qtmultimediadefs.h> +#include "qradiodatacontrol.h" +#include "qmediacontrol_p.h" + +QT_BEGIN_NAMESPACE + + +/*! + \class QRadioDataControl + \inmodule QtMultimedia + \ingroup multimedia-serv + \since 5.0 + + + \brief The QRadioDataControl class provides access to the RDS functionality of the + radio in the QMediaService. + + The functionality provided by this control is exposed to application code + through the QRadioData class. + + The interface name of QRadioDataControl is \c com.nokia.Qt.QRadioDataControl/5.0 as + defined in QRadioDataControl_iid. + + \sa QMediaService::requestControl(), QRadioData +*/ + +/*! + \macro QRadioDataControl_iid + + \c com.nokia.Qt.QRadioDataControl/5.0 + + Defines the interface name of the QRadioDataControl class. + + \relates QRadioDataControl +*/ + +/*! + Constructs a radio data control with the given \a parent. +*/ + +QRadioDataControl::QRadioDataControl(QObject *parent): + QMediaControl(*new QMediaControlPrivate, parent) +{ +} + +/*! + Destroys a radio data control. +*/ + +QRadioDataControl::~QRadioDataControl() +{ +} + +/*! + \fn bool QRadioDataControl::isAvailable() const + + Returns true if the radio service is ready to use. + \since 5.0 +*/ + +/*! + \fn QtMultimedia::AvailabilityError QRadioDataControl::availabilityError() const + + Returns the error state of the radio service. + \since 5.0 +*/ + +/*! + \fn QRadioData::Error QRadioDataControl::error() const + + Returns the error state of a radio data. + \since 5.0 +*/ + +/*! + \fn QString QRadioDataControl::errorString() const + + Returns a string describing a radio data's error state. + \since 5.0 +*/ + +/*! + \fn void QRadioDataControl::error(QRadioData::Error error) + + Signals that an \a error has occurred. + \since 5.0 +*/ + +/*! + \fn int QRadioDataControl::stationId() + + Returns the current Program Identification + \since 5.0 +*/ + +/*! + \fn QRadioData::ProgramType QRadioDataControl::programType() + + Returns the current Program Type + \since 5.0 +*/ + +/*! + \fn QString QRadioDataControl::programTypeName() + + Returns the current Program Type Name + \since 5.0 +*/ + +/*! + \fn QString QRadioDataControl::stationName() + + Returns the current Program Service + \since 5.0 +*/ + +/*! + \fn QString QRadioDataControl::radioText() + + Returns the current Radio Text + \since 5.0 +*/ + +/*! + \fn void QRadioDataControl::setAlternativeFrequenciesEnabled(bool enabled) + + Sets the Alternative Frequency to \a enabled + \since 5.0 +*/ + +/*! + \fn bool QRadioDataControl::isAlternativeFrequenciesEnabled() + + Returns true if Alternative Frequency is currently enabled + \since 5.0 +*/ + +/*! + \fn void QRadioDataControl::stationIdChanged(QString stationId) + + Signals that the Program Identification \a stationId has changed + \since 5.0 +*/ + +/*! + \fn void QRadioDataControl::programTypeChanged(QRadioData::ProgramType programType) + + Signals that the Program Type \a programType has changed + \since 5.0 +*/ + +/*! + \fn void QRadioDataControl::programTypeNameChanged(QString programTypeName) + + Signals that the Program Type Name \a programTypeName has changed + \since 5.0 +*/ + +/*! + \fn void QRadioDataControl::stationNameChanged(QString stationName) + + Signals that the Program Service \a stationName has changed + \since 5.0 +*/ + +/*! + \fn void QRadioDataControl::radioTextChanged(QString radioText) + + Signals that the Radio Text \a radioText has changed + \since 5.0 +*/ + +#include "moc_qradiodatacontrol.cpp" +QT_END_NAMESPACE + diff --git a/src/multimedia/qradiodatacontrol.h b/src/multimedia/qradiodatacontrol.h new file mode 100644 index 000000000..487236c4a --- /dev/null +++ b/src/multimedia/qradiodatacontrol.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** 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 QRADIODATACONTROL_H +#define QRADIODATACONTROL_H + +#include "qmediacontrol.h" +#include "qradiodata.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Multimedia) + + +class Q_MULTIMEDIA_EXPORT QRadioDataControl : public QMediaControl +{ + Q_OBJECT + +public: + ~QRadioDataControl(); + + virtual bool isAvailable() const = 0; + virtual QtMultimedia::AvailabilityError availabilityError() const = 0; + + virtual QString stationId() const = 0; + virtual QRadioData::ProgramType programType() const = 0; + virtual QString programTypeName() const = 0; + virtual QString stationName() const = 0; + virtual QString radioText() const = 0; + virtual void setAlternativeFrequenciesEnabled(bool enabled) = 0; + virtual bool isAlternativeFrequenciesEnabled() const = 0; + + virtual QRadioData::Error error() const = 0; + virtual QString errorString() const = 0; + +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 err); + +protected: + QRadioDataControl(QObject *parent = 0); +}; + +#define QRadioDataControl_iid "com.nokia.Qt.QRadioDataControl/5.0" +Q_MEDIA_DECLARE_CONTROL(QRadioDataControl, QRadioDataControl_iid) + +QT_END_NAMESPACE + +QT_END_HEADER + + +#endif // QRADIODATACONTROL_H diff --git a/src/multimedia/qradiotuner.cpp b/src/multimedia/qradiotuner.cpp index 25f76b83a..3673d34bd 100644 --- a/src/multimedia/qradiotuner.cpp +++ b/src/multimedia/qradiotuner.cpp @@ -106,6 +106,7 @@ QRadioTuner::QRadioTuner(QObject *parent, QMediaServiceProvider* provider): 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))); } } @@ -457,6 +458,26 @@ void QRadioTuner::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 @@ -555,6 +576,14 @@ QString QRadioTuner::errorString() const */ /*! + \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. diff --git a/src/multimedia/qradiotuner.h b/src/multimedia/qradiotuner.h index 78852638c..21497f45c 100644 --- a/src/multimedia/qradiotuner.h +++ b/src/multimedia/qradiotuner.h @@ -74,12 +74,14 @@ class Q_MULTIMEDIA_EXPORT QRadioTuner : public QMediaObject 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(); @@ -114,6 +116,7 @@ public: public Q_SLOTS: void searchForward(); void searchBackward(); + void searchAllStations(QRadioTuner::SearchMode searchMode = QRadioTuner::SearchFast); void cancelSearch(); void setBand(Band band); @@ -134,6 +137,8 @@ Q_SIGNALS: void signalStrengthChanged(int signalStrength); void volumeChanged(int volume); void mutedChanged(bool muted); + void stationFound(int frequency, QString stationId); + void error(QRadioTuner::Error error); private: @@ -147,11 +152,13 @@ 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 diff --git a/src/multimedia/qradiotunercontrol.cpp b/src/multimedia/qradiotunercontrol.cpp index 97ffd2396..6e2b488a3 100644 --- a/src/multimedia/qradiotunercontrol.cpp +++ b/src/multimedia/qradiotunercontrol.cpp @@ -268,6 +268,13 @@ QRadioTunerControl::~QRadioTunerControl() */ /*! + \fn void QRadioTunerControl::searchAllStations() + + Starts a scan through the whole frequency band searching all stations + \since 5.0 +*/ + +/*! \fn void QRadioTunerControl::cancelSearch() Stops scanning for a signal. @@ -359,6 +366,13 @@ QRadioTunerControl::~QRadioTunerControl() \since 1.0 */ +/*! + \fn void QRadioTunerControl::stationFound(int frequency) + + Signals that new station with \a frequency was found when scanning + \since 5.0 +*/ + #include "moc_qradiotunercontrol.cpp" QT_END_NAMESPACE diff --git a/src/multimedia/qradiotunercontrol.h b/src/multimedia/qradiotunercontrol.h index 04812be48..b0ea54250 100644 --- a/src/multimedia/qradiotunercontrol.h +++ b/src/multimedia/qradiotunercontrol.h @@ -89,6 +89,7 @@ public: virtual void searchForward() = 0; virtual void searchBackward() = 0; + virtual void searchAllStations(QRadioTuner::SearchMode searchMode = QRadioTuner::SearchFast) = 0; virtual void cancelSearch() = 0; virtual void start() = 0; @@ -107,6 +108,7 @@ Q_SIGNALS: void volumeChanged(int volume); void mutedChanged(bool muted); void error(QRadioTuner::Error err); + void stationFound(int frequency, QString stationId); protected: QRadioTunerControl(QObject *parent = 0); |