Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QRadioTuner Class Reference

The QRadioTuner class provides an interface to the systems analog radio device. More...

 #include <QRadioTuner>

Inherits QMediaObject.

Public Types

enum Band { AM, FM, SW, LW, FM2 }
enum Error { NoError, ResourceError, OpenError, OutOfRangeError }
enum State { ActiveState, StoppedState }
enum StereoMode { Auto, ForceStereo, ForceMono }

Properties

Public Functions

QRadioTuner ( QObject * parent = 0, QMediaServiceProvider * provider = QMediaServiceProvider::defaultServiceProvider() )
~QRadioTuner ()
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 isBandSupported ( Band band ) const
bool isMuted () const
bool isSearching () const
bool isStereo () const
void setStereoMode ( QRadioTuner::StereoMode mode )
int signalStrength () const
State state () const
StereoMode stereoMode () const
int volume () const

Reimplemented Public Functions

virtual QtMultimediaKit::AvailabilityError availabilityError () const
virtual bool isAvailable () const

Public Slots

void cancelSearch ()
void searchBackward ()
void searchForward ()
void setBand ( Band band )
void setFrequency ( int frequency )
void setMuted ( bool muted )
void setVolume ( int volume )
void start ()
void stop ()
  • 1 public slot inherited from QObject

Signals

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 strength )
void stateChanged ( QRadioTuner::State state )
void stereoStatusChanged ( bool stereo )
void volumeChanged ( int volume )

Additional Inherited Members

  • 1 public variable inherited from QObject
  • 4 static public members inherited from QObject
  • 2 protected functions inherited from QMediaObject
  • 7 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

The QRadioTuner class provides an interface to the systems analog radio device.

You can control the systems analog radio device using this interface, for example:

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

Member Type Documentation

enum QRadioTuner::Band

Enumerates radio frequency bands.

ConstantValueDescription
QRadioTuner::AM0520 to 1610 kHz, 9 or 10kHz channel spacing, extended 1610 to 1710 kHz
QRadioTuner::FM187.5 to 108.0 MHz, except Japan 76-90 MHz
QRadioTuner::SW21.711 to 30.0 MHz, divided into 15 bands. 5kHz channel spacing
QRadioTuner::LW3148.5 to 283.5 kHz, 9kHz channel spacing (Europe, Africa, Asia)
QRadioTuner::FM24range not defined, used when area supports more than one FM range.

enum QRadioTuner::Error

Enumerates radio tuner error conditions.

ConstantValueDescription
QRadioTuner::NoError0No errors have occurred.
QRadioTuner::ResourceError1There is no radio service available.
QRadioTuner::OpenError2Unable to open radio device.
QRadioTuner::OutOfRangeError3An attempt to set a frequency or band that is not supported by radio device.

enum QRadioTuner::State

Enumerates radio tuner states.

ConstantValueDescription
QRadioTuner::ActiveState0The tuner is started and active.
QRadioTuner::StoppedState1The tuner device is stopped.

enum QRadioTuner::StereoMode

Enumerates radio tuner policy for receiving stereo signals.

ConstantValueDescription
QRadioTuner::Auto2Uses the stereo mode matching the station.
QRadioTuner::ForceStereo0Provide stereo mode, converting if required.
QRadioTuner::ForceMono1Provide mono mode, converting if required.

Property Documentation

band : Band

This property holds the frequency band a radio tuner is tuned to.

Access functions:

Band band () const
void setBand ( Band band )

Notifier signal:

void bandChanged ( QRadioTuner::Band band )

See also QRadioTuner::Band.

frequency : int

This property holds the frequency in Hertz a radio tuner is tuned to.

Access functions:

int frequency () const
void setFrequency ( int frequency )

Notifier signal:

void frequencyChanged ( int frequency )

muted : bool

This property holds whether a radio tuner's audio output is muted.

Access functions:

bool isMuted () const
void setMuted ( bool muted )

Notifier signal:

void mutedChanged ( bool muted )

searching : const bool

This property holds whether a radio tuner is currently scanning for a signal.

Access functions:

bool isSearching () const

Notifier signal:

void searchingChanged ( bool searching )

See also searchForward(), searchBackward(), and cancelSearch().

signalStrength : const int

This property holds the strength of the current radio signal as a percentage.

Access functions:

int signalStrength () const

Notifier signal:

void signalStrengthChanged ( int strength )

state : const State

Return the current radio tuner state.

Access functions:

State state () const

Notifier signal:

void stateChanged ( QRadioTuner::State state )

See also QRadioTuner::State.

stereo : const bool

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

Access functions:

bool isStereo () const

Notifier signal:

void stereoStatusChanged ( bool stereo )

stereoMode : StereoMode

This property holds the stereo mode of a radio tuner.

Access functions:

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

volume : int

This property holds the volume of a radio tuner's audio output as a percentage.

Access functions:

int volume () const
void setVolume ( int volume )

Notifier signal:

void volumeChanged ( int volume )

Member Function Documentation

QRadioTuner::QRadioTuner ( QObject * parent = 0, QMediaServiceProvider * provider = QMediaServiceProvider::defaultServiceProvider() )

Constructs a radio tuner based on a media service allocated by a media service provider.

The parent is passed to QMediaObject.

QRadioTuner::~QRadioTuner ()

Destroys a radio tuner.

QtMultimediaKit::AvailabilityError QRadioTuner::availabilityError () const [virtual]

Reimplemented from QMediaObject::availabilityError().

Returns the availability error state.

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

Signals a radio tuner's band has changed.

void QRadioTuner::cancelSearch () [slot]

Stops scanning for a signal.

See also searchForward(), searchBackward(), and searching.

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's error state.

See also error().

void QRadioTuner::frequencyChanged ( int frequency ) [signal]

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

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

Returns a frequency band's minimum and maximum frequency.

int QRadioTuner::frequencyStep ( Band band ) const

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

bool QRadioTuner::isAvailable () const [virtual]

Reimplemented from QMediaObject::isAvailable().

Returns true if the radio tuner service is ready to use.

bool QRadioTuner::isBandSupported ( 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.

void QRadioTuner::mutedChanged ( bool muted ) [signal]

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

void QRadioTuner::searchBackward () [slot]

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

See also searchForward(), cancelSearch(), and searching.

void QRadioTuner::searchForward () [slot]

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

See also searchBackward(), cancelSearch(), and searching.

void QRadioTuner::searchingChanged ( bool searching ) [signal]

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

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.

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

This signal is emitted when the state changes to state.

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.

void QRadioTuner::volumeChanged ( int volume ) [signal]

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

X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.

[0]; s.parentNode.insertBefore(ga, s); })();
Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 64
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt qtmobility-1.1
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web