CopperSpice API  1.7.2
QRadioTuner Class Reference

Provides an interface to the systems analog radio device. More...

Inheritance diagram for QRadioTuner:
QMediaObject QObject

Public Types

enum  Band
 
enum  Error
 
enum  SearchMode
 
enum  State
 
enum  StereoMode
 

Public Signals

void antennaConnectedChanged (bool connectionStatus)
 
void bandChanged (QRadioTuner::Band band)
 
void error (QRadioTuner::Error error)
 
void frequencyChanged (int frequency)
 
void mutedChanged (bool muted)
 
void searchingChanged (bool searching)
 
void signalStrengthChanged (int signalStrength)
 
void stateChanged (QRadioTuner::State state)
 
void stationFound (int frequency, QString stationId)
 
void stereoStatusChanged (bool stereo)
 
void volumeChanged (int volume)
 
- Public Signals inherited from QMediaObject
void availabilityChanged (bool available)
 
void availabilityChanged (QMultimedia::AvailabilityStatus availability)
 
void metaDataAvailableChanged (bool available)
 
void metaDataChanged ()
 
void metaDataChanged (const QString &key, const QVariant &value)
 
void notifyIntervalChanged (int milliSeconds)
 
- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
 
void objectNameChanged (const QString &objectName)
 

Public Slots

void cancelSearch ()
 
void searchAllStations (QRadioTuner::SearchMode searchMode=QRadioTuner::SearchFast)
 
void searchBackward ()
 
void searchForward ()
 
void setBand (Band band)
 
void setFrequency (int frequency)
 
void setMuted (bool muted)
 
void setVolume (int volume)
 
void start ()
 
void stop ()
 
- Public Slots inherited from QObject
void deleteLater ()
 

Public Methods

 QRadioTuner (QObject *parent=nullptr)
 
 ~QRadioTuner ()
 
QMultimedia::AvailabilityStatus availability () const override
 
Band band () const
 
Error error () const
 
QString errorString () const
 
int frequency () const
 
QPair< int, int > frequencyRange (Band band) const
 
int frequencyStep (Band band) const
 
bool isAntennaConnected () const
 
bool isBandSupported (Band b) const
 
bool isMuted () const
 
bool isSearching () const
 
bool isStereo () const
 
QRadioDataradioData () const
 
void setStereoMode (QRadioTuner::StereoMode mode)
 
int signalStrength () const
 
State state () const
 
StereoMode stereoMode () const
 
int volume () const
 
- Public Methods inherited from QMediaObject
 ~QMediaObject ()
 
QStringList availableMetaData () const
 
virtual bool bind (QObject *)
 
virtual bool isAvailable () const
 
bool isMetaDataAvailable () const
 
QVariant metaData (const QString &key) const
 
int notifyInterval () const
 
virtual QMediaServiceservice () const
 
void setNotifyInterval (int milliSeconds)
 
virtual void unbind (QObject *)
 
- Public Methods inherited from QObject
 QObject (QObject *parent=nullptr)
 
 ~QObject ()
 
bool blockSignals (bool block)
 
const QList< QObject * > & children () const
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QStringdynamicPropertyNames () const
 
virtual bool event (QEvent *event)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
template<typename T >
findChild (const QString &childName=QString ()) const
 
template<class T >
QList< T > findChildren (const QRegularExpression &regExp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<class T >
QList< T > findChildren (const QString &objName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
bool inherits (const QString &className) const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const
 
bool isWindowType () const
 
void killTimer (int id)
 
const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const
 
QObject * parent () const
 
template<class T = QVariant>
property (const QString &name) const
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const QString &name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
QThreadthread () const
 

Properties

 antennaConnected
 Whether there is an antenna connected. More...
 
 band
 Frequency band. More...
 
 frequency
 Frequency in Hertz. More...
 
 muted
 Radio muted status. More...
 
 radioData
 Instance of QRadioData. More...
 
 searching
 Radio tuner is currently scanning for a signal. More...
 
 signalStrength
 Strength of the current radio signal. More...
 
 state
 State of the radio tuner. More...
 
 stereo
 Whether a radio tuner is receiving a stereo signal. More...
 
 stereoMode
 Stereo mode of a radio tuner. More...
 
 volume
 Volume of a radio tuner audio output. More...
 
- Properties inherited from QMediaObject
 notifyInterval
 
- Properties inherited from QObject
 objectName
 

Additional Inherited Members

- Static Public Methods inherited from QObject
static bool connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ())
 
static bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...))
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod)
 
static QMetaObjectstaticMetaObject ()
 
static QString tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())
 
- Protected Methods inherited from QMediaObject
 QMediaObject (QObject *parent, QMediaService *service)
 
template<typename T >
void addPropertyWatch (const QString &name)
 
void removePropertyWatch (const QString &name)
 
- Protected Methods inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signalMethod) const
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signalMethod) const
 
bool isSignalConnected (const QMetaMethod &signalMethod) const
 
int receivers (const QString &signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

The QRadioTuner class provides an interface to the system's analog radio device.

radio = new QRadioTuner;
connect(radio, SIGNAL(frequencyChanged(int)), this, SLOT(freqChanged(int)));
if (radio->isBandSupported(QRadioTuner::FM)) {
radio->setBand(QRadioTuner::FM);
radio->setFrequency(yourRadioStationFrequency);
radio->setVolume(100);
radio->start();
}

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().

See also
QRadioData, Radio Overview

Member Enumeration Documentation

Enumerates radio frequency bands.

Constant Value Description
QRadioTuner::AM 0 520 to 1610 kHz, 9 or 10kHz channel spacing, extended 1610 to 1710 kHz
QRadioTuner::FM 1 87.5 to 108.0 MHz, except Japan 76-90 MHz
QRadioTuner::SW 2 1.711 to 30.0 MHz, divided into 15 bands. 5kHz channel spacing
QRadioTuner::LW 3 148.5 to 283.5 kHz, 9kHz channel spacing (Europe, Africa, Asia)
QRadioTuner::FM2 4 range not defined, used when area supports more than one FM range

Enumerates radio tuner error conditions.

Constant Value Description
QRadioTuner::NoError 0 No errors have occurred.
QRadioTuner::ResourceError 1 There is no radio service available.
QRadioTuner::OpenError 2 Unable to open radio device.
QRadioTuner::OutOfRangeError 3 An attempt to set a frequency or band that is not supported by radio device.

Enumerates how the radio tuner should search for stations.

Constant Value Description
QRadioTuner::SearchFast 0 Use only signal strength when searching.
QRadioTuner::SearchGetStationId 1 After finding a strong signal, wait for the RDS station id (PI) before continuing.

Enumerates radio tuner states.

Constant Value Description
QRadioTuner::ActiveState 0 The tuner is started and active.
QRadioTuner::StoppedState 1 The tuner device is stopped.

Enumerates radio tuner policy for receiving stereo signals.

Constant Value Description
QRadioTuner::ForceStereo 0 Provide stereo mode, converting if required.
QRadioTuner::ForceMono 1 Provide mono mode, converting if required.
QRadioTuner::Auto 2 Uses the stereo mode matching the station.

Constructor & Destructor Documentation

QRadioTuner::QRadioTuner ( QObject parent = nullptr)
explicit

Constructs a radio tuner based on a media service allocated by the default media service provider. The parent is passed to QMediaObject.

QRadioTuner::~QRadioTuner ( )

Destroys a radio tuner.

Method Documentation

void QRadioTuner::antennaConnectedChanged ( bool  connectionStatus)
signal

This signal is emitted when the antennaConnected property changes to connectionStatus.

QMultimedia::AvailabilityStatus QRadioTuner::availability ( ) const
overridevirtual

Returns the availability of the radio tuner.

Reimplemented from QMediaObject.

Band QRadioTuner::band ( ) const

Documentation pending.

void QRadioTuner::bandChanged ( QRadioTuner::Band  band)
signal

Signals a radio tuner band has changed.

void QRadioTuner::cancelSearch ( )
slot

Stops scanning for a signal.

See also
searchForward(), searchBackward(), searching
QRadioTuner::Error QRadioTuner::error ( ) const

Returns the error state of a radio tuner.

See also
errorString()
void QRadioTuner::error ( QRadioTuner::Error  error)
signal

Signals that an error occurred.

QString QRadioTuner::errorString ( ) const

Returns a description of a radio tuner error state.

See also
error()
int QRadioTuner::frequency ( ) const

Documentation pending.

void QRadioTuner::frequencyChanged ( int  frequency)
signal

Signals that the frequency a radio tuner is tuned to has changed.

QPair< int, int > QRadioTuner::frequencyRange ( QRadioTuner::Band  band) const

Returns the minimum and maximum frequency for the specified band.

int QRadioTuner::frequencyStep ( QRadioTuner::Band  band) const

Returns the number of Hertz to increment the frequency by when stepping through frequencies within a given band.

bool QRadioTuner::isAntennaConnected ( ) const

Documentation pending.

bool QRadioTuner::isBandSupported ( QRadioTuner::Band  band) const

Identifies if a frequency band is supported by a radio tuner. Returns true if the band is supported, and false if it is not.

bool QRadioTuner::isMuted ( ) const

Documentation pending.

bool QRadioTuner::isSearching ( ) const

Documentation pending.

bool QRadioTuner::isStereo ( ) const

Documentation pending.

void QRadioTuner::mutedChanged ( bool  muted)
signal

Signals that the muted state of a radio tuner audio output has changed.

QRadioData * QRadioTuner::radioData ( ) const

Documentation pending.

void QRadioTuner::searchAllStations ( QRadioTuner::SearchMode  searchMode = QRadioTuner::SearchFast)
slot

Search all stations in current band. If searchMode is set to SearchGetStationId, searching waits for station id (PI) on each frequency.

Emits the stationFound signal for every found station. After searching is completed, QRadioTuner::searchingChanged(bool) is emitted (false).

See also
searchForward(), searchBackward(), searching
void QRadioTuner::searchBackward ( )
slot

Starts a backwards scan for a signal starting from the current frequency.

See also
searchForward(), cancelSearch(), searching
void QRadioTuner::searchForward ( )
slot

Starts a forward scan for a signal, starting from the current frequency.

See also
searchBackward(), cancelSearch(), searching
void QRadioTuner::searchingChanged ( bool  searching)
signal

Signals that the searching state of a radio tuner has changed.

void QRadioTuner::setBand ( QRadioTuner::Band  band)
slot

Sets the radio tuner to the specified band. Changing the band will set the frequency to the new minimum frequency associated with the band.

void QRadioTuner::setFrequency ( int  frequency)
slot

Sets a radio tuner frequency. If the tuner is set to a frequency outside the current band, then the band will be changed to one occupied by the new frequency.

void QRadioTuner::setMuted ( bool  muted)
slot

Sets the muted property to muted which indicates if the radio tuner audio output should be muted.

void QRadioTuner::setStereoMode ( QRadioTuner::StereoMode  mode)

Documentation pending.

void QRadioTuner::setVolume ( int  volume)
slot

Sets the volume property to volume which indicates the radio tuner level as a percentage.

int QRadioTuner::signalStrength ( ) const

Documentation pending.

void QRadioTuner::signalStrengthChanged ( int  strength)
signal

Signals that the strength of the signal received by a radio tuner has changed.

void QRadioTuner::start ( )
slot

Activate the radio device.

State QRadioTuner::state ( ) const

Documentation pending.

void QRadioTuner::stateChanged ( QRadioTuner::State  state)
signal

This signal is emitted when the state changes to state.

void QRadioTuner::stationFound ( int  frequency,
QString  stationId 
)
signal

Signals that a station was found in frequency with stationId Program Identification code.

StereoMode QRadioTuner::stereoMode ( ) const

Documentation pending.

void QRadioTuner::stereoStatusChanged ( bool  stereo)
signal

Signals that the stereo state of a radio tuner has changed.

void QRadioTuner::stop ( )
slot

Deactivate the radio device.

int QRadioTuner::volume ( ) const

Documentation pending.

void QRadioTuner::volumeChanged ( int  volume)
signal

Signals that the volume of a radio tuner audio output has changed.

Property Documentation

QRadioTuner::antennaConnected

A property indicating whether there is an antenna connected.

PropertiesClass Methods
read isAntennaConnected
notify antennaConnectedChanged
QRadioTuner::band

A property indicating the current frequency band a radio tuner is tuned to.

See also
QRadioTuner::Band
PropertiesClass Methods
read band
write setBand
notify bandChanged
QRadioTuner::frequency

The property indicating the current frequency in Hertz a radio tuner is tuned to.

PropertiesClass Methods
read frequency
write setFrequency
notify frequencyChanged
QRadioTuner::muted

A property indicating if the radio tuner audio output is muted.

PropertiesClass Methods
read isMuted
write setMuted
notify mutedChanged
QRadioTuner::radioData

The instance of QRadioData is already bound to this instance of QRadioTuner.

PropertiesClass Methods
read radioData
constant true
QRadioTuner::searching

A property indicating the radio tuner is currently scanning for a signal.

See also
searchForward(), searchBackward(), cancelSearch()
PropertiesClass Methods
read isSearching
notify searchingChanged
QRadioTuner::signalStrength

A property indicating the strength of the current radio signal as a percentage.

PropertiesClass Methods
read signalStrength
notify signalStrengthChanged
QRadioTuner::state

Return the current radio tuner state.

See also
QRadioTuner::State
PropertiesClass Methods
read state
notify stateChanged
QRadioTuner::stereo

This property indicates whether a radio tuner is receiving a stereo signal.

PropertiesClass Methods
read isStereo
notify stereoStatusChanged
QRadioTuner::stereoMode

This property indicates the stereo mode of a radio tuner.

PropertiesClass Methods
read stereoMode
write setStereoMode
QRadioTuner::volume

The property indicates the volume of a radio tuner audio output as a percentage.

PropertiesClass Methods
read volume
write setVolume
notify volumeChanged