CopperSpice API
1.9.2
|
Provides an interface to the systems analog radio device. More...
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 band) const |
bool | isMuted () const |
bool | isSearching () const |
bool | isStereo () const |
QRadioData * | radioData () 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 *object) |
virtual bool | isAvailable () const |
bool | isMetaDataAvailable () const |
QVariant | metaData (const QString &key) const |
int | notifyInterval () const |
virtual QMediaService * | service () const |
void | setNotifyInterval (int milliSeconds) |
virtual void | unbind (QObject *object) |
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< QString > | dynamicPropertyNames () const |
virtual bool | event (QEvent *event) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
template<typename T > | |
T | findChild (const QString &childName=QString ()) const |
template<class T > | |
QList< T > | findChildren (const QRegularExpression ®Exp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
template<class T > | |
QList< T > | findChildren (const QString &childName=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 QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const |
QObject * | parent () const |
template<class T = QVariant> | |
T | 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) |
QThread * | thread () 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) |
static bool | disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t) |
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 QMetaObject & | staticMetaObject () |
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) |
Related Functions inherited from QObject | |
T | qobject_cast (QObject *object) |
QObjectList | |
The QRadioTuner class provides an interface to the system's analog radio device.
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().
enum QRadioTuner::Band |
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 |
enum QRadioTuner::Error |
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. |
enum QRadioTuner::State |
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. |
|
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.
|
signal |
This signal is emitted when the antennaConnected property changes to connectionStatus.
|
overridevirtual |
Returns the availability of the radio tuner.
Reimplemented from QMediaObject::availability()
Band QRadioTuner::band | ( | ) | const |
Returns the value of the property.
|
signal |
Signals a radio tuner band has changed.
|
slot |
Stops scanning for a signal.
QRadioTuner::Error QRadioTuner::error | ( | ) | const |
Returns the error state of a radio tuner.
|
signal |
Signals that an error occurred.
QString QRadioTuner::errorString | ( | ) | const |
Returns a description of a radio tuner error state.
int QRadioTuner::frequency | ( | ) | const |
Returns the value of the property.
|
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 |
Returns the value of the property.
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 |
Returns the value of the property.
bool QRadioTuner::isSearching | ( | ) | const |
Returns the value of the property.
bool QRadioTuner::isStereo | ( | ) | const |
Returns the value of the property.
|
signal |
Signals that the muted state of a radio tuner audio output has changed.
QRadioData * QRadioTuner::radioData | ( | ) | const |
Returns the value of the property.
|
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).
|
slot |
Starts a backwards scan for a signal starting from the current frequency.
|
slot |
Starts a forward scan for a signal, starting from the current frequency.
|
signal |
Signals that the searching state of a radio tuner has changed.
|
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.
|
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.
|
slot |
Sets the muted property to muted which indicates if the radio tuner audio output should be muted.
void QRadioTuner::setStereoMode | ( | QRadioTuner::StereoMode | mode | ) |
Sets the value of the property to mode.
|
slot |
Sets the volume property to volume which indicates the radio tuner level as a percentage.
int QRadioTuner::signalStrength | ( | ) | const |
Returns the value of the property.
|
signal |
Signals the signalStrength received by a radio tuner has changed.
|
slot |
Activate the radio device.
State QRadioTuner::state | ( | ) | const |
Returns the value of the property.
|
signal |
This signal is emitted when the state changes to state.
|
signal |
Signals that a station was found in frequency with stationId Program Identification code.
StereoMode QRadioTuner::stereoMode | ( | ) | const |
Returns the value of the property.
|
signal |
Signals that the stereo state of a radio tuner has changed.
|
slot |
Deactivate the radio device.
int QRadioTuner::volume | ( | ) | const |
Returns the value of the property.
|
signal |
Signals that the volume of a radio tuner audio output has changed.
|
A property indicating whether there is an antenna connected.
Properties | Class Methods |
---|---|
read | isAntennaConnected |
notify | antennaConnectedChanged |
|
A property indicating the current frequency band a radio tuner is tuned to.
Properties | Class Methods |
---|---|
read | band |
write | setBand |
notify | bandChanged |
|
The property indicating the current frequency in Hertz a radio tuner is tuned to.
Properties | Class Methods |
---|---|
read | frequency |
write | setFrequency |
notify | frequencyChanged |
|
A property indicating if the radio tuner audio output is muted.
Properties | Class Methods |
---|---|
read | isMuted |
write | setMuted |
notify | mutedChanged |
|
The instance of QRadioData is already bound to this instance of QRadioTuner.
Properties | Class Methods |
---|---|
read | radioData |
constant | true |
|
A property indicating the radio tuner is currently scanning for a signal.
Properties | Class Methods |
---|---|
read | isSearching |
notify | searchingChanged |
|
A property indicating the strength of the current radio signal as a percentage.
Properties | Class Methods |
---|---|
read | signalStrength |
notify | signalStrengthChanged |
|
Return the current radio tuner state.
Properties | Class Methods |
---|---|
read | state |
notify | stateChanged |
|
This property indicates whether a radio tuner is receiving a stereo signal.
Properties | Class Methods |
---|---|
read | isStereo |
notify | stereoStatusChanged |
|
This property indicates the stereo mode of a radio tuner.
Properties | Class Methods |
---|---|
read | stereoMode |
write | setStereoMode |
|
The property indicates the volume of a radio tuner audio output as a percentage.
Properties | Class Methods |
---|---|
read | volume |
write | setVolume |
notify | volumeChanged |