| 1 | /**************************************************************************** | 
| 2 | ** | 
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | 
| 4 | ** Contact: https://www.qt.io/licensing/ | 
| 5 | ** | 
| 6 | ** This file is part of the Qt Toolkit. | 
| 7 | ** | 
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | 
| 9 | ** Commercial License Usage | 
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | 
| 11 | ** accordance with the commercial license agreement provided with the | 
| 12 | ** Software or, alternatively, in accordance with the terms contained in | 
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | 
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | 
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | 
| 16 | ** | 
| 17 | ** GNU Lesser General Public License Usage | 
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | 
| 19 | ** General Public License version 3 as published by the Free Software | 
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | 
| 21 | ** packaging of this file. Please review the following information to | 
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | 
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | 
| 24 | ** | 
| 25 | ** GNU General Public License Usage | 
| 26 | ** Alternatively, this file may be used under the terms of the GNU | 
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | 
| 28 | ** Public license version 3 or any later version approved by the KDE Free | 
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | 
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | 
| 31 | ** included in the packaging of this file. Please review the following | 
| 32 | ** information to ensure the GNU General Public License requirements will | 
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | 
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | 
| 35 | ** | 
| 36 | ** $QT_END_LICENSE$ | 
| 37 | ** | 
| 38 | ****************************************************************************/ | 
| 39 |  | 
| 40 | #include <qtmultimediaglobal.h> | 
| 41 | #include "qradiotunercontrol.h" | 
| 42 | #include "qmediacontrol_p.h" | 
| 43 |  | 
| 44 | QT_BEGIN_NAMESPACE | 
| 45 |  | 
| 46 |  | 
| 47 | /*! | 
| 48 |     \class QRadioTunerControl | 
| 49 |     \obsolete | 
| 50 |     \inmodule QtMultimedia | 
| 51 |  | 
| 52 |     \ingroup multimedia_control | 
| 53 |  | 
| 54 |  | 
| 55 |     \brief The QRadioTunerControl class provides access to the radio tuning | 
| 56 |     functionality of a QMediaService. | 
| 57 |  | 
| 58 |     If a QMediaService can tune an analog radio device it will implement | 
| 59 |     QRadioTunerControl.  This control provides a means to tune a radio device | 
| 60 |     to a specific \l {setFrequency()}{frequency} as well as search \l | 
| 61 |     {searchForward()}{forwards} and \l {searchBackward()}{backwards} for a | 
| 62 |     signal. | 
| 63 |  | 
| 64 |     The functionality provided by this control is exposed to application code | 
| 65 |     through the QRadioTuner class. | 
| 66 |  | 
| 67 |     The interface name of QRadioTunerControl is \c org.qt-project.qt.radiotunercontrol/5.0 as | 
| 68 |     defined in QRadioTunerControl_iid. | 
| 69 |  | 
| 70 |     \sa QMediaService::requestControl(), QRadioTuner | 
| 71 | */ | 
| 72 |  | 
| 73 | /*! | 
| 74 |     \macro QRadioTunerControl_iid | 
| 75 |  | 
| 76 |     \c org.qt-project.qt.radiotunercontrol/5.0 | 
| 77 |  | 
| 78 |     Defines the interface name of the QRadioTunerControl class. | 
| 79 |  | 
| 80 |     \relates QRadioTunerControl | 
| 81 | */ | 
| 82 |  | 
| 83 | /*! | 
| 84 |     Constructs a radio tuner control with the given \a parent. | 
| 85 | */ | 
| 86 |  | 
| 87 | QRadioTunerControl::QRadioTunerControl(QObject *parent): | 
| 88 |     QMediaControl(*new QMediaControlPrivate, parent) | 
| 89 | { | 
| 90 | } | 
| 91 |  | 
| 92 | /*! | 
| 93 |     Destroys a radio tuner control. | 
| 94 | */ | 
| 95 |  | 
| 96 | QRadioTunerControl::~QRadioTunerControl() | 
| 97 | { | 
| 98 | } | 
| 99 |  | 
| 100 | /*! | 
| 101 |     \fn QRadioTuner::State QRadioTunerControl::state() const | 
| 102 |  | 
| 103 |     Returns the current radio tuner state. | 
| 104 | */ | 
| 105 |  | 
| 106 | /*! | 
| 107 |     \fn QRadioTuner::Band QRadioTunerControl::band() const | 
| 108 |  | 
| 109 |     Returns the frequency band a radio tuner is tuned to. | 
| 110 | */ | 
| 111 |  | 
| 112 | /*! | 
| 113 |     \fn void QRadioTunerControl::bandChanged(QRadioTuner::Band band) | 
| 114 |  | 
| 115 |     Signals that the frequency \a band a radio tuner is tuned to has changed. | 
| 116 | */ | 
| 117 |  | 
| 118 | /*! | 
| 119 |     \fn void QRadioTunerControl::setBand(QRadioTuner::Band band) | 
| 120 |  | 
| 121 |     Sets the frequecy \a band a radio tuner is tuned to. | 
| 122 |  | 
| 123 |     Changing the frequency band will reset the frequency to the minimum frequency of the new band. | 
| 124 | */ | 
| 125 |  | 
| 126 | /*! | 
| 127 |     \fn bool QRadioTunerControl::isBandSupported(QRadioTuner::Band band) const | 
| 128 |  | 
| 129 |     Identifies if a frequency \a band is supported. | 
| 130 |  | 
| 131 |     Returns true if the band is supported, and false if it is not. | 
| 132 | */ | 
| 133 |  | 
| 134 | /*! | 
| 135 |     \fn int QRadioTunerControl::frequency() const | 
| 136 |  | 
| 137 |     Returns the frequency a radio tuner is tuned to. | 
| 138 | */ | 
| 139 |  | 
| 140 | /*! | 
| 141 |     \fn int QRadioTunerControl::frequencyStep(QRadioTuner::Band band) const | 
| 142 |  | 
| 143 |     Returns the number of Hertz to increment the frequency by when stepping through frequencies | 
| 144 |     within a given \a band. | 
| 145 | */ | 
| 146 |  | 
| 147 | /*! | 
| 148 |     \fn QPair<int,int> QRadioTunerControl::frequencyRange(QRadioTuner::Band band) const | 
| 149 |  | 
| 150 |     Returns a frequency \a band's minimum and maximum frequency. | 
| 151 | */ | 
| 152 |  | 
| 153 | /*! | 
| 154 |     \fn void QRadioTunerControl::setFrequency(int frequency) | 
| 155 |  | 
| 156 |     Sets the \a frequency a radio tuner is tuned to. | 
| 157 | */ | 
| 158 |  | 
| 159 | /*! | 
| 160 |     \fn bool QRadioTunerControl::isStereo() const | 
| 161 |  | 
| 162 |     Identifies if a radio tuner is receiving a stereo signal. | 
| 163 |  | 
| 164 |     Returns true if the tuner is receiving a stereo signal, and false if it is not. | 
| 165 | */ | 
| 166 |  | 
| 167 | /*! | 
| 168 |     \fn QRadioTuner::StereoMode QRadioTunerControl::stereoMode() const | 
| 169 |  | 
| 170 |     Returns a radio tuner's stereo mode. | 
| 171 |  | 
| 172 |     \sa QRadioTuner::StereoMode | 
| 173 | */ | 
| 174 |  | 
| 175 | /*! | 
| 176 |     \fn void QRadioTunerControl::setStereoMode(QRadioTuner::StereoMode mode) | 
| 177 |  | 
| 178 |     Sets a radio tuner's stereo \a mode. | 
| 179 |  | 
| 180 |     \sa QRadioTuner::StereoMode | 
| 181 | */ | 
| 182 |  | 
| 183 | /*! | 
| 184 |     \fn int QRadioTunerControl::signalStrength() const | 
| 185 |  | 
| 186 |     Return a radio tuner's current signal strength as a percentage. | 
| 187 | */ | 
| 188 |  | 
| 189 | /*! | 
| 190 |     \fn int QRadioTunerControl::volume() const | 
| 191 |  | 
| 192 |     Returns the volume of a radio tuner's audio output as a percentage. | 
| 193 | */ | 
| 194 |  | 
| 195 | /*! | 
| 196 |     \fn void QRadioTunerControl::setVolume(int volume) | 
| 197 |  | 
| 198 |     Sets the percentage \a volume of a radio tuner's audio output. | 
| 199 | */ | 
| 200 |  | 
| 201 | /*! | 
| 202 |     \fn bool QRadioTunerControl::isMuted() const | 
| 203 |  | 
| 204 |     Identifies if a radio tuner's audio output is muted. | 
| 205 |  | 
| 206 |     Returns true if the audio is muted, and false if it is not. | 
| 207 | */ | 
| 208 |  | 
| 209 | /*! | 
| 210 |     \fn void QRadioTunerControl::setMuted(bool muted) | 
| 211 |  | 
| 212 |     Sets the \a muted state of a radio tuner's audio output. | 
| 213 | */ | 
| 214 |  | 
| 215 | /*! | 
| 216 |     \fn bool QRadioTunerControl::isSearching() const | 
| 217 |  | 
| 218 |     Identifies if a radio tuner is currently scanning for signal. | 
| 219 |  | 
| 220 |     Returns true if the tuner is scanning, and false if it is not. | 
| 221 | */ | 
| 222 |  | 
| 223 | /*! | 
| 224 |     \fn bool QRadioTunerControl::isAntennaConnected() const | 
| 225 |  | 
| 226 |     Identifies if there is an antenna connected to the device. | 
| 227 |  | 
| 228 |     Returns true if there is a connected antenna, and false otherwise. | 
| 229 | */ | 
| 230 |  | 
| 231 | /*! | 
| 232 |     \fn  void QRadioTunerControl::searchForward() | 
| 233 |  | 
| 234 |     Starts a forward scan for a signal, starting from the current \l frequency(). | 
| 235 | */ | 
| 236 |  | 
| 237 | /*! | 
| 238 |     \fn void QRadioTunerControl::searchBackward() | 
| 239 |  | 
| 240 |     Starts a backwards scan for a signal, starting from the current \l frequency(). | 
| 241 | */ | 
| 242 |  | 
| 243 | /*! | 
| 244 |     \fn  void QRadioTunerControl::searchAllStations(QRadioTuner::SearchMode searchMode) | 
| 245 |  | 
| 246 |     Starts a scan through the whole frequency band searching all stations with a | 
| 247 |     specific \a searchMode. | 
| 248 | */ | 
| 249 |  | 
| 250 | /*! | 
| 251 |     \fn void QRadioTunerControl::cancelSearch() | 
| 252 |  | 
| 253 |     Stops scanning for a signal. | 
| 254 | */ | 
| 255 |  | 
| 256 | /*! | 
| 257 |     \fn void QRadioTunerControl::start() | 
| 258 |  | 
| 259 |     Activate the radio device. | 
| 260 | */ | 
| 261 |  | 
| 262 | /*! | 
| 263 |     \fn QRadioTunerControl::stop() | 
| 264 |  | 
| 265 |     Deactivate the radio device. | 
| 266 | */ | 
| 267 |  | 
| 268 | /*! | 
| 269 |     \fn QRadioTuner::Error QRadioTunerControl::error() const | 
| 270 |  | 
| 271 |     Returns the error state of a radio tuner. | 
| 272 | */ | 
| 273 |  | 
| 274 | /*! | 
| 275 |     \fn QString QRadioTunerControl::errorString() const | 
| 276 |  | 
| 277 |     Returns a string describing a radio tuner's error state. | 
| 278 | */ | 
| 279 |  | 
| 280 | /*! | 
| 281 |     \fn void QRadioTunerControl::stateChanged(QRadioTuner::State state) | 
| 282 |  | 
| 283 |     Signals that the \a state of a radio tuner has changed. | 
| 284 | */ | 
| 285 |  | 
| 286 |  | 
| 287 | /*! | 
| 288 |     \fn void QRadioTunerControl::frequencyChanged(int frequency) | 
| 289 |  | 
| 290 |     Signals that the \a frequency a radio tuner is tuned to has changed. | 
| 291 | */ | 
| 292 |  | 
| 293 | /*! | 
| 294 |     \fn void QRadioTunerControl::stereoStatusChanged(bool stereo) | 
| 295 |  | 
| 296 |     Signals that the \a stereo state of a radio tuner has changed. | 
| 297 | */ | 
| 298 |  | 
| 299 | /*! | 
| 300 |     \fn void QRadioTunerControl::searchingChanged(bool searching) | 
| 301 |  | 
| 302 |     Signals that the \a searching state of a radio tuner has changed. | 
| 303 | */ | 
| 304 |  | 
| 305 | /*! | 
| 306 |     \fn void QRadioTunerControl::signalStrengthChanged(int strength) | 
| 307 |  | 
| 308 |     Signals that the percentage \a strength of the signal received by a radio tuner has changed. | 
| 309 | */ | 
| 310 |  | 
| 311 | /*! | 
| 312 |     \fn void QRadioTunerControl::volumeChanged(int volume) | 
| 313 |  | 
| 314 |     Signals that the percentage \a volume of radio tuner's audio output has changed. | 
| 315 | */ | 
| 316 |  | 
| 317 | /*! | 
| 318 |     \fn void QRadioTunerControl::mutedChanged(bool muted) | 
| 319 |  | 
| 320 |     Signals that the \a muted state of a radio tuner's audio output has changed. | 
| 321 | */ | 
| 322 |  | 
| 323 | /*! | 
| 324 |     \fn void QRadioTunerControl::error(QRadioTuner::Error error) | 
| 325 |  | 
| 326 |     Signals that an \a error has occurred. | 
| 327 | */ | 
| 328 |  | 
| 329 | /*! | 
| 330 |     \fn void QRadioTunerControl::stationFound(int frequency, QString stationId) | 
| 331 |  | 
| 332 |     Signals that new station with \a frequency and \a stationId was found when scanning | 
| 333 | */ | 
| 334 |  | 
| 335 | /*! | 
| 336 |     \fn void QRadioTunerControl::antennaConnectedChanged(bool connectionStatus) | 
| 337 |  | 
| 338 |     Signals that the antenna has either been connected or disconnected as | 
| 339 |     reflected with the \a connectionStatus. | 
| 340 | */ | 
| 341 |  | 
| 342 | QT_END_NAMESPACE | 
| 343 |  | 
| 344 | #include "moc_qradiotunercontrol.cpp" | 
| 345 |  |