diff options
Diffstat (limited to 'src/plugins/symbian/mmf/radio')
7 files changed, 0 insertions, 1923 deletions
diff --git a/src/plugins/symbian/mmf/radio/radio.pri b/src/plugins/symbian/mmf/radio/radio.pri deleted file mode 100644 index a4703d126..000000000 --- a/src/plugins/symbian/mmf/radio/radio.pri +++ /dev/null @@ -1,24 +0,0 @@ -INCLUDEPATH += $$PWD - -contains(tunerlib_s60_enabled, yes) { - - LIBS += -ltunerutility - DEFINES += TUNERLIBUSED - INCLUDEPATH += $${EPOCROOT}epoc32/include/mmf/common - - HEADERS += $$PWD/s60radiotunercontrol_31.h - SOURCES += $$PWD/s60radiotunercontrol_31.cpp -} - -contains(radioutility_s60_enabled, yes) { - LIBS += -lradio_utility - DEFINES += RADIOUTILITYLIBUSED - - HEADERS += $$PWD/s60radiotunercontrol_since32.h - SOURCES += $$PWD/s60radiotunercontrol_since32.cpp -} - -contains(tunerlib_s60_enabled, yes)|contains(radioutility_s60_enabled, yes) { - HEADERS += $$PWD/s60radiotunerservice.h - SOURCES += $$PWD/s60radiotunerservice.cpp -} diff --git a/src/plugins/symbian/mmf/radio/s60radiotunercontrol_31.cpp b/src/plugins/symbian/mmf/radio/s60radiotunercontrol_31.cpp deleted file mode 100644 index 70cfada80..000000000 --- a/src/plugins/symbian/mmf/radio/s60radiotunercontrol_31.cpp +++ /dev/null @@ -1,603 +0,0 @@ -/**************************************************************************** -** -** 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 Mobility Components. -** -** $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 "DebugMacros.h" - -#include "s60radiotunercontrol_31.h" -#include "s60radiotunerservice.h" - -#include <QtCore/qdebug.h> -#include <QFile> - -// from AudioPreference.h -const TInt KAudioPriorityFMRadio = 79; -const TUint KAudioPrefRadioAudioEvent = 0x03000001; - -S60RadioTunerControl::S60RadioTunerControl(QObject *parent) - : QRadioTunerControl(parent) - , m_error(0) - , m_tunerState(0) - , m_apiTunerState(QRadioTuner::StoppedState) - , m_audioInitializationComplete(false) - , m_radioError(QRadioTuner::NoError) - , m_muted(false) - , m_isStereo(true) - , m_stereoMode(QRadioTuner::Auto) - , m_signal(0) - , m_currentBand(QRadioTuner::FM) - , m_currentFreq(87500000) - , m_scanning(false) - , m_vol(50) -{ - DP0("S60RadioTunerControl::S60RadioTunerControl +++"); - - initRadio(); - - DP0("S60RadioTunerControl::S60RadioTunerControl ---"); -} - -S60RadioTunerControl::~S60RadioTunerControl() -{ - DP0("S60RadioTunerControl::~S60RadioTunerControl +++"); - - if (m_tunerUtility) { - m_tunerUtility->Close(); - m_tunerUtility->CancelNotifyChange(); - m_tunerUtility->CancelNotifySignalStrength(); - m_tunerUtility->CancelNotifyStereoChange(); - delete m_tunerUtility; - } - if (m_audioPlayerUtility) { - m_audioPlayerUtility = NULL; - } - - DP0("S60RadioTunerControl::~S60RadioTunerControl ---"); -} - -bool S60RadioTunerControl::initRadio() -{ - DP0("S60RadioTunerControl::initRadio +++"); - - m_available = false; - - TRAPD(tunerError, m_tunerUtility = CMMTunerUtility::NewL(*this, CMMTunerUtility::ETunerBandFm, 1, - CMMTunerUtility::ETunerAccessPriorityNormal)); - if (tunerError != KErrNone) { - m_radioError = QRadioTuner::OpenError; - return m_available; - } - - TRAPD(playerError, m_audioPlayerUtility = m_tunerUtility->TunerPlayerUtilityL(*this)); - if (playerError != KErrNone) { - m_radioError = QRadioTuner::OpenError; - return m_available; - } - - TRAPD(initializeError, m_audioPlayerUtility->InitializeL(KAudioPriorityFMRadio, - TMdaPriorityPreference(KAudioPrefRadioAudioEvent))); - if (initializeError != KErrNone) { - m_radioError = QRadioTuner::OpenError; - return m_available; - } - - m_tunerUtility->NotifyChange(*this); - m_tunerUtility->NotifyStereoChange(*this); - m_tunerUtility->NotifySignalStrength(*this); - - TFrequency freq(m_currentFreq); - m_tunerUtility->Tune(freq); - - m_available = true; - - DP0("S60RadioTunerControl::initRadio ---"); - - return m_available; -} - -void S60RadioTunerControl::start() -{ - DP0("S60RadioTunerControl::start +++"); - - if (!m_audioInitializationComplete) { - TFrequency freq(m_currentFreq); - m_tunerUtility->Tune(freq); - } else { - m_audioPlayerUtility->Play(); - } - - m_apiTunerState = QRadioTuner::ActiveState; - emit stateChanged(m_apiTunerState); - - DP0("S60RadioTunerControl::start ---"); -} - -void S60RadioTunerControl::stop() -{ - DP0("S60RadioTunerControl::stop +++"); - - if (m_audioPlayerUtility) { - m_audioPlayerUtility->Stop(); - m_apiTunerState = QRadioTuner::StoppedState; - emit stateChanged(m_apiTunerState); - } - - DP0("S60RadioTunerControl::stop ---"); -} - -QRadioTuner::State S60RadioTunerControl::state() const -{ - DP0("S60RadioTunerControl::state"); - - return m_apiTunerState; -} - -QRadioTuner::Band S60RadioTunerControl::band() const -{ - DP0("S60RadioTunerControl::band"); - - return m_currentBand; -} - -bool S60RadioTunerControl::isBandSupported(QRadioTuner::Band b) const -{ - DP0("S60RadioTunerControl::isBandSupported"); - - if(b == QRadioTuner::FM) - return true; - else if(b == QRadioTuner::LW) - return false; - else if(b == QRadioTuner::AM) - return true; - else if(b == QRadioTuner::SW) - return false; - else - return false; -} - -void S60RadioTunerControl::setBand(QRadioTuner::Band b) -{ - DP0("S60RadioTunerControl::setBand +++"); - - QRadioTuner::Band tempBand = b; - if (tempBand != m_currentBand) { - m_currentBand = b; - emit bandChanged(m_currentBand); - } - - DP0("S60RadioTunerControl::setBand ---"); -} - -int S60RadioTunerControl::frequency() const -{ - DP0("S60RadioTunerControl::frequency"); - - return m_currentFreq; -} - -void S60RadioTunerControl::setFrequency(int frequency) -{ - DP0("S60RadioTunerControl::setFrequency +++"); - - m_currentFreq = frequency; - TFrequency freq(m_currentFreq); - m_tunerUtility->Tune(freq); - - DP0("S60RadioTunerControl::setFrequency ---"); -} - -int S60RadioTunerControl::frequencyStep(QRadioTuner::Band b) const -{ - DP0("S60RadioTunerControl::frequencyStep +++"); - - int step = 0; - - if(b == QRadioTuner::FM) - step = 100000; // 100kHz steps - else if(b == QRadioTuner::LW) - step = 1000; // 1kHz steps - else if(b == QRadioTuner::AM) - step = 1000; // 1kHz steps - else if(b == QRadioTuner::SW) - step = 500; // 500Hz steps - - DP1("S60RadioTunerControl::frequencyStep, Step:", step); - DP0("S60RadioTunerControl::frequencyStep ---"); - - return step; -} - -QPair<int,int> S60RadioTunerControl::frequencyRange(QRadioTuner::Band band) const -{ - DP0("S60RadioTunerControl::frequencyRange +++"); - - TFrequency bottomFreq; - TFrequency topFreq; - int bandError = KErrNone; - - if (m_tunerUtility){ - bandError = m_tunerUtility->GetFrequencyBandRange(bottomFreq, topFreq); - if (!bandError) { - return qMakePair<int,int>(bottomFreq.iFrequency, topFreq.iFrequency); - } - } - - DP0("S60RadioTunerControl::frequencyRange ---"); - - return qMakePair<int,int>(0,0); -} - -CMMTunerUtility::TTunerBand S60RadioTunerControl::getNativeBand(QRadioTuner::Band b) const -{ - DP0("S60RadioTunerControl::getNativeBand"); - - // api match to native s60 bands - if (b == QRadioTuner::AM) - return CMMTunerUtility::ETunerBandAm; - else if (b == QRadioTuner::FM) - return CMMTunerUtility::ETunerBandFm; - else if (b == QRadioTuner::LW) - return CMMTunerUtility::ETunerBandLw; - else - return CMMTunerUtility::ETunerNoBand; -} - -bool S60RadioTunerControl::isStereo() const -{ - DP0("S60RadioTunerControl::isStereo"); - - return m_isStereo; -} - -QRadioTuner::StereoMode S60RadioTunerControl::stereoMode() const -{ - DP0("S60RadioTunerControl::stereoMode"); - - return m_stereoMode; -} - -void S60RadioTunerControl::setStereoMode(QRadioTuner::StereoMode mode) -{ - DP0("S60RadioTunerControl::setStereoMode +++"); - - m_stereoMode = mode; - if (m_tunerUtility) { - if (QRadioTuner::ForceMono == mode) - m_tunerUtility->ForceMonoReception(true); - else - m_tunerUtility->ForceMonoReception(false); - } - - DP0("S60RadioTunerControl::setStereoMode ---"); -} - -int S60RadioTunerControl::signalStrength() const -{ - DP0("S60RadioTunerControl::signalStrength +++"); - - // return value is a percentage value - if (m_tunerUtility) { - TInt maxSignalStrength; - TInt currentSignalStrength; - m_error = m_tunerUtility->GetMaxSignalStrength(maxSignalStrength); - if (m_error == KErrNone) { - m_error = m_tunerUtility->GetSignalStrength(currentSignalStrength); - if (m_error == KErrNone) { - if (maxSignalStrength == 0 || currentSignalStrength == 0) { - return 0; - } - m_signal = ((TInt64)currentSignalStrength) * 100 / maxSignalStrength; - } - } - } - - DP1("S60RadioTunerControl::signalStrength, m_signal:", m_signal); - DP0("S60RadioTunerControl::signalStrength ---"); - - return m_signal; -} - -int S60RadioTunerControl::volume() const -{ - DP0("S60RadioTunerControl::volume"); - - return m_vol; -} - -void S60RadioTunerControl::setVolume(int volume) -{ - DP0("S60RadioTunerControl::setVolume +++"); - DP1("S60RadioTunerControl::setVolume: ", volume); - - if (m_audioPlayerUtility) { - m_vol = volume; - TInt error = m_audioPlayerUtility->SetVolume(volume/10); - emit volumeChanged(m_vol); - } - - DP0("S60RadioTunerControl::setVolume ---"); -} - -bool S60RadioTunerControl::isMuted() const -{ - DP0("S60RadioTunerControl::isMuted"); - - return m_muted; -} - -void S60RadioTunerControl::setMuted(bool muted) -{ - DP0("S60RadioTunerControl::setMuted +++"); - - DP1("S60RadioTunerControl::setMuted:", muted); - - if (m_audioPlayerUtility && m_audioInitializationComplete) { - m_muted = muted; - m_audioPlayerUtility->Mute(m_muted); - emit mutedChanged(m_muted); - } - - DP0("S60RadioTunerControl::setMuted ---"); -} - -bool S60RadioTunerControl::isSearching() const -{ - DP0("S60RadioTunerControl::isSearching"); - - if (m_tunerUtility) { - TUint32 tempState; - m_tunerUtility->GetState(tempState); - if (tempState == CMMTunerUtility::ETunerStateRetuning || m_scanning) { - return true; - } else - return false; - } - return true; -} - -void S60RadioTunerControl::cancelSearch() -{ - DP0("S60RadioTunerControl::cancelSearch +++"); - - m_tunerUtility->CancelRetune(); - m_scanning = false; - emit searchingChanged(false); - - DP0("S60RadioTunerControl::cancelSearch ---"); -} - -void S60RadioTunerControl::searchForward() -{ - DP0("S60RadioTunerControl::searchForward +++"); - - m_scanning = true; - setVolume(m_vol); - m_tunerUtility->StationSeek(CMMTunerUtility::ESearchDirectionUp); - emit searchingChanged(true); - - DP0("S60RadioTunerControl::searchForward ---"); -} - -void S60RadioTunerControl::searchBackward() -{ - DP0("S60RadioTunerControl::searchBackward +++"); - - m_scanning = true; - setVolume(m_vol); - m_tunerUtility->StationSeek(CMMTunerUtility::ESearchDirectionDown); - emit searchingChanged(true); - - DP0("S60RadioTunerControl::searchBackward ---"); -} - -bool S60RadioTunerControl::isValid() const -{ - DP0("S60RadioTunerControl::isValid"); - - return m_available; -} - -bool S60RadioTunerControl::isAvailable() const -{ - DP0("S60RadioTunerControl::isAvailable"); - - return m_available; -} - -QtMultimediaKit::AvailabilityError S60RadioTunerControl::availabilityError() const -{ - DP0("S60RadioTunerControl::availabilityError"); - - if (m_available) - return QtMultimediaKit::NoError; - else - return QtMultimediaKit::ResourceError; -} - -QRadioTuner::Error S60RadioTunerControl::error() const -{ - DP1("QtMultimediaKit::NoError", m_radioError); - - return m_radioError; -} - -QString S60RadioTunerControl::errorString() const -{ - DP1("S60RadioTunerControl::errorString", m_errorString); - - return m_errorString; -} - -void S60RadioTunerControl::MToTuneComplete(TInt aError) -{ - DP0("S60RadioTunerControl::MToTuneComplete +++"); - DP1("S60RadioTunerControl::MToTuneComplete, aError:",aError); - - if (aError == KErrNone) { - m_scanning = false; - m_audioPlayerUtility->Play(); - if (!m_audioInitializationComplete) { - TRAPD(initializeError, m_audioPlayerUtility->InitializeL(KAudioPriorityFMRadio, - TMdaPriorityPreference(KAudioPrefRadioAudioEvent))); - if (initializeError != KErrNone) { - m_radioError = QRadioTuner::OpenError; - } - } - } - - DP0("S60RadioTunerControl::MToTuneComplete ---"); -} - -void S60RadioTunerControl::MTcoFrequencyChanged(const TFrequency& aOldFrequency, const TFrequency& aNewFrequency) -{ - DP0("S60RadioTunerControl::MTcoFrequencyChanged +++"); - - m_currentFreq = aNewFrequency.iFrequency; - m_scanning = false; - emit frequencyChanged(m_currentFreq); - - DP0("S60RadioTunerControl::MTcoFrequencyChanged ---"); -} - -void S60RadioTunerControl::MTcoStateChanged(const TUint32& aOldState, const TUint32& aNewState) -{ - DP0("S60RadioTunerControl::MTcoStateChanged +++"); - - if (aNewState == CMMTunerUtility::ETunerStateActive) { - m_apiTunerState = QRadioTuner::ActiveState; - } - if (aNewState == CMMTunerUtility::ETunerStatePlaying) { - m_apiTunerState = QRadioTuner::ActiveState; - } - if (aOldState != aNewState){ - emit stateChanged(m_apiTunerState); - } - - DP0("S60RadioTunerControl::MTcoStateChanged ---"); -} - -void S60RadioTunerControl::MTcoAntennaDetached() -{ - DP0("S60RadioTunerControl::MTcoAntennaDetached +++"); - - DP0("S60RadioTunerControl::MTcoAntennaDetached ---"); - - // no actions -} - -void S60RadioTunerControl::MTcoAntennaAttached() -{ - DP0("S60RadioTunerControl::MTcoAntennaAttached +++"); - - DP0("S60RadioTunerControl::MTcoAntennaAttached ---"); - - // no actions -} - -void S60RadioTunerControl::FlightModeChanged(TBool aFlightMode) -{ - DP0("S60RadioTunerControl::FlightModeChanged +++"); - - DP0("S60RadioTunerControl::FlightModeChanged ---"); - - // no actions -} - -void S60RadioTunerControl::MTsoStereoReceptionChanged(TBool aStereo) -{ - DP0("S60RadioTunerControl::MTsoStereoReceptionChanged +++"); - DP1("S60RadioTunerControl::MTsoStereoReceptionChanged, aStereo:", aStereo); - m_isStereo = aStereo; - emit stereoStatusChanged(aStereo); - - DP0("S60RadioTunerControl::MTsoStereoReceptionChanged ---"); -} - -void S60RadioTunerControl::MTsoForcedMonoChanged(TBool aForcedMono) -{ - DP0("S60RadioTunerControl::MTsoForcedMonoChanged +++"); - DP1("S60RadioTunerControl::MTsoForcedMonoChanged, aForcedMono:", aForcedMono); - - if (aForcedMono) { - m_stereoMode = QRadioTuner::ForceMono; - } - - DP0("S60RadioTunerControl::MTsoForcedMonoChanged ---"); -} - -void S60RadioTunerControl::MssoSignalStrengthChanged(TInt aNewSignalStrength) -{ - DP0("S60RadioTunerControl::MssoSignalStrengthChanged +++"); - DP1("S60RadioTunerControl::MssoSignalStrengthChanged, aNewSignalStrength:", aNewSignalStrength); - - m_signal = aNewSignalStrength; - emit signalStrengthChanged(m_signal); - - DP0("S60RadioTunerControl::MssoSignalStrengthChanged ---"); -} - -void S60RadioTunerControl::MTapoInitializeComplete(TInt aError) -{ - DP0("S60RadioTunerControl::MTapoInitializeComplete +++"); - DP1("S60RadioTunerControl::MTapoInitializeComplete, aError:", aError); - if (aError == KErrNone) { - m_audioInitializationComplete = true; - m_available = true; - m_audioPlayerUtility->Play(); - m_apiTunerState = QRadioTuner::ActiveState; - emit stateChanged(m_apiTunerState); - } else if (aError != KErrNone) { - m_radioError = QRadioTuner::OpenError; - } - - DP0("S60RadioTunerControl::MTapoInitializeComplete ---"); -} - -void S60RadioTunerControl::MTapoPlayEvent(TEventType aEvent, TInt aError, TAny* aAdditionalInfo) -{ - DP0("S60RadioTunerControl::MTapoPlayEvent +++"); - - DP0("S60RadioTunerControl::MTapoPlayEvent ---"); - - // no actions -} - - - diff --git a/src/plugins/symbian/mmf/radio/s60radiotunercontrol_31.h b/src/plugins/symbian/mmf/radio/s60radiotunercontrol_31.h deleted file mode 100644 index 4a1a61f11..000000000 --- a/src/plugins/symbian/mmf/radio/s60radiotunercontrol_31.h +++ /dev/null @@ -1,161 +0,0 @@ -/**************************************************************************** -** -** 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 Mobility Components. -** -** $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 S60RADIOTUNERCONTROL_H -#define S60RADIOTUNERCONTROL_H - -#include <QtCore/qobject.h> -#include <qradiotunercontrol.h> -#include <qradiotuner.h> -#include <tuner.h> - -class S60RadioTunerService; - -QT_USE_NAMESPACE - -class S60RadioTunerControl - : public QRadioTunerControl - , public MMMTunerObserver - , public MMMTunerStereoObserver - , public MMMSignalStrengthObserver - , public MMMTunerChangeObserver - , public MMMTunerAudioPlayerObserver -{ - Q_OBJECT -public: - S60RadioTunerControl(QObject *parent = 0); - ~S60RadioTunerControl(); - - QRadioTuner::State state() const; - - QRadioTuner::Band band() const; - void setBand(QRadioTuner::Band b); - bool isBandSupported(QRadioTuner::Band b) const; - - int frequency() const; - int frequencyStep(QRadioTuner::Band b) const; - QPair<int,int> frequencyRange(QRadioTuner::Band b) const; - void setFrequency(int frequency); - - bool isStereo() const; - QRadioTuner::StereoMode stereoMode() const; - void setStereoMode(QRadioTuner::StereoMode mode); - - int signalStrength() const; - - int volume() const; - void setVolume(int volume); - - bool isMuted() const; - void setMuted(bool muted); - - bool isSearching() const; - void searchForward(); - void searchBackward(); - void cancelSearch(); - - bool isValid() const; - - bool isAvailable() const; - QtMultimediaKit::AvailabilityError availabilityError() const; - - void start(); - void stop(); - - QRadioTuner::Error error() const; - QString errorString() const; - - //MMMTunerObserver - void MToTuneComplete(TInt aError); - - //MMMTunerChangeObserver - void MTcoFrequencyChanged(const TFrequency& aOldFrequency, const TFrequency& aNewFrequency); - void MTcoStateChanged(const TUint32& aOldState, const TUint32& aNewState); - void MTcoAntennaDetached(); - void MTcoAntennaAttached(); - void FlightModeChanged(TBool aFlightMode); - - //MMMTunerStereoObserver - void MTsoStereoReceptionChanged(TBool aStereo); - void MTsoForcedMonoChanged(TBool aForcedMono); - - //MMMSignalStrengthObserver - void MssoSignalStrengthChanged(TInt aNewSignalStrength); - - //MMMTunerAudioPlayerObserver - void MTapoInitializeComplete(TInt aError); - void MTapoPlayEvent(TEventType aEvent, TInt aError, TAny* aAdditionalInfo); - -private slots: - - -private: - bool initRadio(); - CMMTunerUtility::TTunerBand getNativeBand(QRadioTuner::Band b) const; - - mutable int m_error; - CMMTunerUtility *m_tunerUtility; - CMMTunerAudioPlayerUtility *m_audioPlayerUtility; - - bool m_audioInitializationComplete; - bool m_muted; - bool m_isStereo; - bool m_available; - int m_step; - int m_vol; - mutable int m_signal; - bool m_scanning; - bool forward; - QRadioTuner::Band m_currentBand; - qint64 m_currentFreq; - - QRadioTuner::Error m_radioError; - QRadioTuner::StereoMode m_stereoMode; - QString m_errorString; - //caps meaning what the tuner can do. - TTunerCapabilities m_currentTunerCapabilities; - long m_tunerState; - QRadioTuner::State m_apiTunerState; - -}; - -#endif - diff --git a/src/plugins/symbian/mmf/radio/s60radiotunercontrol_since32.cpp b/src/plugins/symbian/mmf/radio/s60radiotunercontrol_since32.cpp deleted file mode 100644 index c17e24a45..000000000 --- a/src/plugins/symbian/mmf/radio/s60radiotunercontrol_since32.cpp +++ /dev/null @@ -1,685 +0,0 @@ -/**************************************************************************** -** -** 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 Mobility Components. -** -** $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 "DebugMacros.h" - -#include "s60radiotunercontrol_since32.h" -#include "s60radiotunerservice.h" - -#include <QtCore/qdebug.h> -#include <RadioFmTunerUtility.h> - -S60RadioTunerControl::S60RadioTunerControl(QObject *parent) - : QRadioTunerControl(parent) - , m_error(0) - , m_radioUtility(NULL) - , m_fmTunerUtility(NULL) - , m_playerUtility(NULL) - , m_maxVolume(100) - , m_audioInitializationComplete(false) - , m_muted(false) - , m_isStereo(true) - , m_vol(50) - , m_signal(0) - , m_scanning(false) - , m_currentBand(QRadioTuner::FM) - , m_currentFreq(87500000) - , m_radioError(QRadioTuner::NoError) - , m_stereoMode(QRadioTuner::Auto) - , m_apiTunerState(QRadioTuner::StoppedState) - , m_previousSignal(0) - , m_volChangeRequired(false) - , m_signalStrengthTimer(new QTimer(this)) -{ - DP0("S60RadioTunerControl::S60RadioTunerControl +++"); - bool retValue = initRadio(); - if (!retValue) { - m_errorString = QString(tr("Initialize Error.")); - emit error(QRadioTuner::ResourceError); - } else { - connect(m_signalStrengthTimer, SIGNAL(timeout()), this, SLOT(changeSignalStrength())); - } - DP0("S60RadioTunerControl::S60RadioTunerControl ---"); -} - -S60RadioTunerControl::~S60RadioTunerControl() -{ - DP0("S60RadioTunerControl::~S60RadioTunerControl +++"); - - if (m_fmTunerUtility) { - m_fmTunerUtility->Close(); - } - - if (m_playerUtility) { - m_playerUtility->Close(); - } - - delete m_radioUtility; - - DP0("S60RadioTunerControl::~S60RadioTunerControl ---"); -} - -QRadioTuner::State S60RadioTunerControl::state() const -{ - DP0("S60RadioTunerControl::state"); - - return m_apiTunerState; -} - -QRadioTuner::Band S60RadioTunerControl::band() const -{ - DP0("S60RadioTunerControl::band"); - - return m_currentBand; -} - -bool S60RadioTunerControl::isBandSupported(QRadioTuner::Band b) const -{ - DP0("S60RadioTunerControl::isBandSupported"); - if (b == QRadioTuner::FM) - return true; - else if (b == QRadioTuner::LW) - return false; - else if (b == QRadioTuner::AM) - return false; - else if (b == QRadioTuner::SW) - return false; - else if (b == QRadioTuner::FM2) - return false; - else - return false; -} - -void S60RadioTunerControl::changeSignalStrength() - { - - int currentSignal = signalStrength(); - if (currentSignal != m_previousSignal) - { - m_previousSignal = currentSignal; - emit signalStrengthChanged(currentSignal); - } - } -void S60RadioTunerControl::setBand(QRadioTuner::Band b) -{ - DP0("S60RadioTunerControl::setBand +++"); - QRadioTuner::Band tempBand = b; - if (tempBand != m_currentBand ) { - if (isBandSupported(tempBand)){ - m_currentBand = b; - emit bandChanged(m_currentBand); - } - else { - switch(tempBand) - { - case QRadioTuner::FM : - m_errorString = QString(tr("Band FM not Supported")); - break; - case QRadioTuner::AM : - m_errorString = QString(tr("Band AM not Supported")); - break; - case QRadioTuner::SW : - m_errorString = QString(tr("Band SW not Supported")); - break; - case QRadioTuner::LW : - m_errorString = QString(tr("Band LW not Supported")); - break; - case QRadioTuner::FM2 : - m_errorString = QString(tr("Band FM2 not Supported")); - break; - default : - m_errorString = QString("Band %1 not Supported").arg(tempBand); - break; - } - emit error(QRadioTuner::OutOfRangeError); - } - } - - DP0("S60RadioTunerControl::setBand ---"); -} - -int S60RadioTunerControl::frequency() const -{ - DP0("S60RadioTunerControl::frequency"); - - return m_currentFreq; -} - -void S60RadioTunerControl::setFrequency(int frequency) -{ - DP0("S60RadioTunerControl::setFrequency +++"); - DP1("S60RadioTunerControl::setFrequency, frequency:", frequency); - - m_currentFreq = frequency; - m_fmTunerUtility->SetFrequency(m_currentFreq); - - DP0("S60RadioTunerControl::setFrequency ---"); -} -int S60RadioTunerControl::frequencyStep(QRadioTuner::Band b) const -{ - DP0("S60RadioTunerControl::frequencyStep +++"); - - int step = 0; - if (b == QRadioTuner::FM) - step = 100000; // 100kHz steps - else if(b == QRadioTuner::LW) - step = 1000; // 1kHz steps - else if (b == QRadioTuner::AM) - step = 1000; // 1kHz steps - else if(b == QRadioTuner::SW) - step = 500; // 500Hz steps - DP1("S60RadioTunerControl::frequencyStep, Step:", step); - DP0("S60RadioTunerControl::frequencyStep ---"); - - return step; -} - -QPair<int,int> S60RadioTunerControl::frequencyRange(QRadioTuner::Band band) const -{ - DP0("S60RadioTunerControl::frequencyRange +++"); - - int bottomFreq; - int topFreq; - - int bandError = KErrNone; - TFmRadioFrequencyRange range; - - if (m_fmTunerUtility) { - bandError = m_fmTunerUtility->GetFrequencyRange(range, bottomFreq, topFreq); - } - if (!bandError) { - return qMakePair<int,int>(bottomFreq, topFreq); - } - - DP0("S60RadioTunerControl::frequencyRange ---"); - - return qMakePair<int,int>(0,0); -} - -bool S60RadioTunerControl::isStereo() const -{ - DP0("S60RadioTunerControl::isStereo"); - - return m_isStereo; -} - -QRadioTuner::StereoMode S60RadioTunerControl::stereoMode() const -{ - DP0("S60RadioTunerControl::stereoMode"); - - return m_stereoMode; -} - -void S60RadioTunerControl::setStereoMode(QRadioTuner::StereoMode mode) -{ - DP0("S60RadioTunerControl::setStereoMode +++"); - - if (m_fmTunerUtility) { - if (QRadioTuner::ForceMono == mode) { - m_fmTunerUtility->ForceMonoReception(true); - m_stereoMode = QRadioTuner::ForceMono; - m_isStereo = false; - } else { - m_fmTunerUtility->ForceMonoReception(false); - m_isStereo = true; - m_stereoMode = QRadioTuner::ForceStereo; - } - } - - DP0("S60RadioTunerControl::setStereoMode ---"); -} - -int S60RadioTunerControl::signalStrength() const -{ - DP0("S60RadioTunerControl::signalStrength +++"); - - // return value is a percentage value - if (m_fmTunerUtility) { - TInt maxSignalStrength; - TInt currentSignalStrength; - m_error = m_fmTunerUtility->GetMaxSignalStrength(maxSignalStrength); - - if (m_error == KErrNone) { - m_error = m_fmTunerUtility->GetSignalStrength(currentSignalStrength); - if (m_error == KErrNone) { - if (currentSignalStrength == 0 || maxSignalStrength == 0) { - return currentSignalStrength; - } - m_signal = ((TInt64)currentSignalStrength) * 100 / maxSignalStrength; - } - } - } - - DP1("S60RadioTunerControl::signalStrength, m_signal:", m_signal); - DP0("S60RadioTunerControl::signalStrength ---"); - - return m_signal; -} - -int S60RadioTunerControl::volume() const -{ - DP0("S60RadioTunerControl::volume"); - - return m_vol; -} - -void S60RadioTunerControl::setVolume(int volume) -{ - DP0("S60RadioTunerControl::setVolume +++"); - DP1("S60RadioTunerControl::setVolume, Volume:", volume); - - int boundVolume = qBound(0, volume, 100); - - if (m_vol == boundVolume ) - return; - - if (!m_muted && m_playerUtility) { - m_vol = boundVolume; - // Don't set volume until State is in Active State. - if (state() == QRadioTuner::ActiveState ) { - m_playerUtility->SetVolume(m_vol*m_volMultiplier); - - } else { - m_volChangeRequired = TRUE; - emit volumeChanged(boundVolume); - } - } - DP0("S60RadioTunerControl::setVolume ---"); -} - -bool S60RadioTunerControl::isMuted() const -{ - DP0("S60RadioTunerControl::isMuted"); - - return m_muted; -} - -void S60RadioTunerControl::setMuted(bool muted) -{ - DP0("S60RadioTunerControl::setMuted +++"); - DP1("S60RadioTunerControl::setMuted, Muted:", muted); - if (m_playerUtility) { - m_muted = muted; - m_playerUtility->Mute(m_muted); - } - DP0("S60RadioTunerControl::setMuted ---"); -} - -bool S60RadioTunerControl::isSearching() const -{ - DP0("S60RadioTunerControl::isSearching"); - - return m_scanning; -} - -void S60RadioTunerControl::cancelSearch() -{ - DP0("S60RadioTunerControl::cancelSearch +++"); - - m_fmTunerUtility->CancelStationSeek(); - m_scanning = false; - emit searchingChanged(false); - - DP0("S60RadioTunerControl::cancelSearch ---"); -} - -void S60RadioTunerControl::searchForward() -{ - DP0("S60RadioTunerControl::searchForward +++"); - m_fmTunerUtility->StationSeek(true); - m_scanning = true; - emit searchingChanged(m_scanning); - DP0("S60RadioTunerControl::searchForward ---"); -} - -void S60RadioTunerControl::searchBackward() -{ - DP0("S60RadioTunerControl::searchBackward +++"); - m_fmTunerUtility->StationSeek(false); - m_scanning = true; - emit searchingChanged(m_scanning); - DP0("S60RadioTunerControl::searchBackward ---"); -} - -bool S60RadioTunerControl::isValid() const -{ - DP0("S60RadioTunerControl::isValid"); - - return m_available; -} - -bool S60RadioTunerControl::initRadio() -{ - DP0("S60RadioTunerControl::initRadio +++"); - m_available = false; - // create an instance of Radio Utility factory and indicate - // FM Radio is a primary client - TRAPD(utilityError, - m_radioUtility = CRadioUtility::NewL(ETrue); - // Get a tuner utility - m_fmTunerUtility = &m_radioUtility->RadioFmTunerUtilityL(*this); - // we want to listen radio in offline mode too - m_fmTunerUtility->EnableTunerInOfflineMode(ETrue); - // Get a player utility - m_playerUtility = &m_radioUtility->RadioPlayerUtilityL(*this); - ); - if (utilityError != KErrNone) { - m_radioError = QRadioTuner::ResourceError; - return m_available; - } - - m_tunerControl = false; - - m_available = true; - DP1("S60RadioTunerControl::initRadio, m_available:", m_available); - DP0("S60RadioTunerControl::initRadio ---"); - return m_available; -} - -bool S60RadioTunerControl::isAvailable() const -{ - DP0("S60RadioTunerControl::isAvailable"); - - return m_available; -} - -QtMultimediaKit::AvailabilityError S60RadioTunerControl::availabilityError() const -{ - DP0("S60RadioTunerControl::availabilityError"); - if (m_available) - return QtMultimediaKit::NoError; - else - return QtMultimediaKit::ResourceError; -} - -void S60RadioTunerControl::start() -{ - DP0("S60RadioTunerControl::start +++"); - if (!m_tunerControl) { - m_fmTunerUtility->RequestTunerControl(); - } else { - m_playerUtility->Play(); - } - m_signalStrengthTimer->start(3000); - - DP0("S60RadioTunerControl::start ---"); -} - -void S60RadioTunerControl::stop() -{ - DP0("S60RadioTunerControl::stop +++"); - if (m_playerUtility) { - m_playerUtility->Stop(); - } - m_signalStrengthTimer->stop(); - DP0("S60RadioTunerControl::stop ---"); -} - -QRadioTuner::Error S60RadioTunerControl::error() const -{ - DP1("S60RadioTunerControl::error", m_radioError); - - return m_radioError; -} -QString S60RadioTunerControl::errorString() const -{ - DP1("S60RadioTunerControl::errorString", m_errorString); - - return m_errorString; -} - -void S60RadioTunerControl::MrpoStateChange(TPlayerState aState, TInt aError) -{ - DP0("S60RadioTunerControl::MrpoStateChange +++"); - if (aError == KErrNone){ - m_radioError = QRadioTuner::NoError; - if (aState == ERadioPlayerIdle) { - m_apiTunerState = QRadioTuner::StoppedState; - } else if (aState == ERadioPlayerPlaying) { - m_apiTunerState = QRadioTuner::ActiveState; - //Apply pending volume changes. - if(m_volChangeRequired){ - setVolume(m_vol); - } - } - } else { - m_apiTunerState = QRadioTuner::StoppedState; - } - emit stateChanged(m_apiTunerState); - DP0("S60RadioTunerControl::MrpoStateChange ---"); -} - -void S60RadioTunerControl::MrpoVolumeChange(TInt aVolume) -{ - DP0("S60RadioTunerControl::MrpoVolumeChange +++"); - DP1("S60RadioTunerControl::MrpoVolumeChange, aVolume:", aVolume); - m_vol = (aVolume/m_volMultiplier); - if (!m_volChangeRequired) { - emit volumeChanged(m_vol); - - } else { - m_volChangeRequired = false; - } - DP0("S60RadioTunerControl::MrpoVolumeChange ---"); -} - -void S60RadioTunerControl::MrpoMuteChange(TBool aMute) -{ - DP0("S60RadioTunerControl::MrpoMuteChange +++"); - DP1("S60RadioTunerControl::MrpoMuteChange, aMute:", aMute); - m_muted = aMute; - emit mutedChanged(m_muted); - DP0("S60RadioTunerControl::MrpoMuteChange ---"); -} - -void S60RadioTunerControl::MrpoBalanceChange(TInt aLeftPercentage, TInt aRightPercentage) -{ - DP0("S60RadioTunerControl::MrpoBalanceChange +++"); - - DP0("S60RadioTunerControl::MrpoBalanceChange ---"); - - // no actions -} - -void S60RadioTunerControl::MrftoRequestTunerControlComplete(TInt aError) -{ - DP0("S60RadioTunerControl::MrftoRequestTunerControlComplete +++"); - DP1("S60RadioTunerControl::MrftoRequestTunerControlComplete, aError:", aError); - if (aError == KErrNone) { - m_playerUtility->GetMaxVolume(m_maxVolume); - m_volMultiplier = float(m_maxVolume)/float(100); - m_radioError = QRadioTuner::NoError; - m_tunerControl = true; - m_available = true; - m_fmTunerUtility->SetFrequency(m_currentFreq); - m_playerUtility->Play(); - int signal = signalStrength(); - if (m_signal != signal) { - emit signalStrengthChanged(signal); - m_signal = signal; - } - - } else if (aError == KFmRadioErrAntennaNotConnected) { - m_radioError = QRadioTuner::OpenError; - m_errorString = QString(tr("Antenna Not Connected")); - emit error(m_radioError); - } else if (aError == KErrAlreadyExists){ - m_radioError = QRadioTuner::ResourceError; - m_errorString = QString(tr("Resource Error.")); - emit error(m_radioError); - } else if (aError == KFmRadioErrFrequencyOutOfBandRange) { - m_radioError = QRadioTuner::OutOfRangeError; - m_errorString = QString(tr("Frequency out of band range")); - emit error(m_radioError); - }else{ - m_radioError = QRadioTuner::OpenError; - m_errorString = QString(tr("Unknown Error.")); - emit error(m_radioError); - } - - DP0("S60RadioTunerControl::MrftoRequestTunerControlComplete ---"); -} - -void S60RadioTunerControl::MrftoSetFrequencyRangeComplete(TInt aError) -{ - DP0("S60RadioTunerControl::MrftoSetFrequencyRangeComplete +++"); - DP1("S60RadioTunerControl::MrftoSetFrequencyRangeComplete, aError:", aError); - if (aError == KFmRadioErrFrequencyOutOfBandRange || KFmRadioErrFrequencyNotValid) { - m_radioError = QRadioTuner::OutOfRangeError; - m_errorString = QString(tr("Frequency Out of Band Range or Frequency Not Valid")); - emit error(m_radioError); - } else if (aError == KFmRadioErrHardwareFaulty || KFmRadioErrOfflineMode) { - m_radioError = QRadioTuner::OpenError; - m_errorString = QString(tr("Hardware failure or RadioInOfflineMode")); - emit error(m_radioError); - } - DP0("S60RadioTunerControl::MrftoSetFrequencyRangeComplete ---"); -} - -void S60RadioTunerControl::MrftoSetFrequencyComplete(TInt aError) -{ - DP0("S60RadioTunerControl::MrftoSetFrequencyComplete +++"); - DP1("S60RadioTunerControl::MrftoSetFrequencyComplete, aError", aError); - if (aError == KErrNone) { - m_radioError = QRadioTuner::NoError; - } else if (aError == KFmRadioErrFrequencyOutOfBandRange || KFmRadioErrFrequencyNotValid) { - m_radioError = QRadioTuner::OutOfRangeError; - m_errorString = QString(tr("Frequency Out of range or not Valid.")); - emit error(m_radioError); - } else if (aError == KFmRadioErrHardwareFaulty || KFmRadioErrOfflineMode) { - m_radioError = QRadioTuner::OpenError; - m_errorString = QString("Hardware failure or Radio In Offline Mode"); - emit error(m_radioError); - } - DP0("S60RadioTunerControl::MrftoSetFrequencyComplete ---"); -} - -void S60RadioTunerControl::MrftoStationSeekComplete(TInt aError, TInt aFrequency) -{ - DP0("S60RadioTunerControl::MrftoStationSeekComplete +++"); - DP3("S60RadioTunerControl::MrftoStationSeekComplete, aError:", aError, " Frequency:", aFrequency); - m_scanning = false; - if (aError == KErrNone) { - m_radioError = QRadioTuner::NoError; - m_currentFreq = aFrequency; - emit searchingChanged(m_scanning); - } else { - m_radioError = QRadioTuner::OpenError; - emit searchingChanged(m_scanning); - m_errorString = QString("Scanning Error"); - emit error(m_radioError); - } - DP0("S60RadioTunerControl::MrftoStationSeekComplete ---"); -} - -void S60RadioTunerControl::MrftoFmTransmitterStatusChange(TBool aActive) -{ - DP0("S60RadioTunerControl::MrftoFmTransmitterStatusChange +++"); - - DP0("S60RadioTunerControl::MrftoFmTransmitterStatusChange ---"); - - //no actions -} - -void S60RadioTunerControl::MrftoAntennaStatusChange(TBool aAttached) -{ - DP0("S60RadioTunerControl::MrftoAntennaStatusChange +++"); - DP1("S60RadioTunerControl::MrftoAntennaStatusChange, aAttached:", aAttached); - if (aAttached && m_tunerControl) { - m_playerUtility->Play(); - } - DP0("S60RadioTunerControl::MrftoAntennaStatusChange ---"); -} - -void S60RadioTunerControl::MrftoOfflineModeStatusChange(TBool /*aOfflineMode*/) -{ - DP0("S60RadioTunerControl::MrftoOfflineModeStatusChange +++"); - - DP0("S60RadioTunerControl::MrftoOfflineModeStatusChange ---"); - - -} - -void S60RadioTunerControl::MrftoFrequencyRangeChange(TFmRadioFrequencyRange aBand /*, TInt aMinFreq, TInt aMaxFreq*/) -{ - DP0("S60RadioTunerControl::MrftoFrequencyRangeChange +++"); - if (aBand == EFmRangeEuroAmerica) { - setBand(QRadioTuner::FM); - } - DP0("S60RadioTunerControl::MrftoFrequencyRangeChange ---"); -} - -void S60RadioTunerControl::MrftoFrequencyChange(TInt aNewFrequency) -{ - DP0("S60RadioTunerControl::MrftoFrequencyChange +++"); - DP1("S60RadioTunerControl::MrftoFrequencyChange, aNewFrequency:", aNewFrequency); - m_currentFreq = aNewFrequency; - emit frequencyChanged(m_currentFreq); - - int signal = signalStrength(); - if (m_signal != signal) { - emit signalStrengthChanged(signal); - m_signal = signal; - } - DP0("S60RadioTunerControl::MrftoFrequencyChange ---"); -} - -void S60RadioTunerControl::MrftoForcedMonoChange(TBool aForcedMono) -{ - DP0("S60RadioTunerControl::MrftoForcedMonoChange +++"); - DP1("S60RadioTunerControl::MrftoForcedMonoChange, aForcedMono:", aForcedMono); - if (aForcedMono) { - m_stereoMode = QRadioTuner::ForceMono; - } else { - m_stereoMode = QRadioTuner::ForceStereo; - } - emit stereoStatusChanged(!aForcedMono); - DP0("S60RadioTunerControl::MrftoForcedMonoChange ---"); -} - -void S60RadioTunerControl::MrftoSquelchChange(TBool aSquelch) -{ - DP0("S60RadioTunerControl::MrftoSquelchChange"); - - DP1("S60RadioTunerControl::MrftoSquelchChange, aSquelch:", aSquelch); - - // no actions -} diff --git a/src/plugins/symbian/mmf/radio/s60radiotunercontrol_since32.h b/src/plugins/symbian/mmf/radio/s60radiotunercontrol_since32.h deleted file mode 100644 index 7081e5718..000000000 --- a/src/plugins/symbian/mmf/radio/s60radiotunercontrol_since32.h +++ /dev/null @@ -1,296 +0,0 @@ -/**************************************************************************** -** -** 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 Mobility Components. -** -** $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 S60RADIOTUNERCONTROL_H -#define S60RADIOTUNERCONTROL_H - -#include <QtCore/qobject.h> -#include <QtCore/qtimer.h> -#include <qradiotunercontrol.h> -#include <qradiotuner.h> - -#include <RadioUtility.h> -#include <RadioFmTunerUtility.h> -#include <RadioPlayerUtility.h> - -class S60RadioTunerService; -class CFMRadioEngineCallObserver; - -QT_USE_NAMESPACE - -class S60RadioTunerControl - : public QRadioTunerControl - , public MRadioPlayerObserver - , public MRadioFmTunerObserver -{ - Q_OBJECT -public: - S60RadioTunerControl(QObject *parent = 0); - ~S60RadioTunerControl(); - - QRadioTuner::State state() const; - - QRadioTuner::Band band() const; - void setBand(QRadioTuner::Band b); - bool isBandSupported(QRadioTuner::Band b) const; - - int frequency() const; - int frequencyStep(QRadioTuner::Band b) const; - QPair<int,int> frequencyRange(QRadioTuner::Band b) const; - void setFrequency(int frequency); - - bool isStereo() const; - QRadioTuner::StereoMode stereoMode() const; - void setStereoMode(QRadioTuner::StereoMode mode); - - int signalStrength() const; - - int volume() const; - void setVolume(int volume); - - bool isMuted() const; - void setMuted(bool muted); - - bool isSearching() const; - void searchForward(); - void searchBackward(); - void cancelSearch(); - - bool isValid() const; - - bool isAvailable() const; - QtMultimediaKit::AvailabilityError availabilityError() const; - - void start(); - void stop(); - - QRadioTuner::Error error() const; - QString errorString() const; - - /** - * From MRadioPlayerObserver. - * Called when Radio state changed. - * - * @since S60 3.2 - * @param aState Radio player state - * @param aError A standard system error code, only used when aState is ERadioPlayerIdle - */ - void MrpoStateChange(TPlayerState aState, TInt aError); - - /** - * From MRadioPlayerObserver. - * Called when volume changes. This may be caused by other applications. - * - * @since S60 3.2 - * @param aVolume Current volume. - */ - void MrpoVolumeChange(TInt aVolume); - - /** - * From MRadioPlayerObserver. - * Called when mute setting changes. This may be caused by other applications. - * - * @since S60 3.2 - * @param aMute ETrue indicates audio is muted. - */ - void MrpoMuteChange(TBool aMute); - - /** - * From MRadioPlayerObserver. - * Called when mute setting changes. This may be caused by other applications. - * - * Called when balance setting changes. This may be caused by other applications. - * - * @since S60 3.2 - * Left speaker volume percentage. This can be any value from zero to 100. - * Zero value means left speaker is muted. - * @param aRightPercentage - * Right speaker volume percentage. This can be any value from zero to 100. - * Zero value means right speaker is muted. - */ - void MrpoBalanceChange(TInt aLeftPercentage, TInt aRightPercentage); - - - /** - * From MRadioFmTunerObserver. - * Called when Request for tuner control completes. - * - * @since S60 3.2 - * @param aError A standard system error code or FM tuner error (TFmRadioTunerError). - */ - void MrftoRequestTunerControlComplete(TInt aError); - - /** - * From MRadioFmTunerObserver. - * Set frequency range complete event. This event is asynchronous and is received after - * a call to CRadioFmTunerUtility::SetFrequencyRange. - * - * @since S60 3.2 - * @param aError A standard system error code or FM tuner error (TFmRadioTunerError). - */ - void MrftoSetFrequencyRangeComplete(TInt aError); - - /** - * From MRadioFmTunerObserver. - * Set frequency complete event. This event is asynchronous and is received after a call to - * CRadioFmTunerUtility::SetFrequency. - * - * @since S60 3.2 - * @param aError A standard system error code or FM tuner error (TFmRadioTunerError). - */ - void MrftoSetFrequencyComplete(TInt aError); - - /** - * From MRadioFmTunerObserver. - * Station seek complete event. This event is asynchronous and is received after a call to - * CRadioFmTunerUtility::StationSeek. - * - * @since S60 3.2 - * @param aError A standard system error code or FM tuner error (TFmRadioTunerError). - * @param aFrequency The frequency(Hz) of the radio station that was found. - */ - void MrftoStationSeekComplete(TInt aError, TInt aFrequency); - - /** - * From MRadioFmTunerObserver. - * Called when FM Transmitter status changes (if one is present in the device). Tuner receiver - * is forced to be turned off due to hardware conflicts when FM transmitter is activated. - * - * @since S60 3.2 - * @param aActive ETrue if FM transmitter is active; EFalse otherwise. - */ - void MrftoFmTransmitterStatusChange(TBool aActive); - - /** - * From MRadioFmTunerObserver. - * Called when antenna status changes. - * - * @since S60 3.2 - * @param aAttached ETrue if antenna is attached; EFalse otherwise. - */ - void MrftoAntennaStatusChange(TBool aAttached); - - /** - * From MRadioFmTunerObserver. - * Called when offline mode status changes. - * @since S60 3.2 - * - ** @param aAttached ETrue if offline mode is enabled; EFalse otherwise. - */ - void MrftoOfflineModeStatusChange(TBool aOfflineMode); - - /** - * From MRadioFmTunerObserver. - * Called when the frequency range changes. This may be caused by other applications. - * - * @since S60 3.2 - * @param aNewRange New frequency range. - */ - void MrftoFrequencyRangeChange(TFmRadioFrequencyRange aBand /*, TInt aMinFreq, TInt aMaxFreq*/); - - /** - * From MRadioFmTunerObserver. - * Called when the tuned frequency changes. This may be caused by other - * applications or RDS if AF/TA is enabled. - * - * @since S60 3.2 - * @param aNewFrequency The new tuned frequency(Hz). - */ - void MrftoFrequencyChange(TInt aNewFrequency); - - /** - * From MRadioFmTunerObserver. - * Called when the forced mono status change. This may be caused by other applications. - * - * @since S60 3.2 - * @param aForcedMono ETrue if forced mono mode is enabled; EFalse otherwise. - */ - void MrftoForcedMonoChange(TBool aForcedMono); - - /** - * From MRadioFmTunerObserver. - * Called when the squelch (muting the frequencies without broadcast) status change. - * This may be caused by other applications. - * - * @since S60 3.2 - * @param aSquelch ETrue if squelch is enabled; EFalse otherwise. - */ - void MrftoSquelchChange(TBool aSquelch); - -private: - bool initRadio(); - - mutable int m_error; - - CRadioUtility* m_radioUtility; - CRadioFmTunerUtility* m_fmTunerUtility; - CRadioPlayerUtility* m_playerUtility; - TInt m_maxVolume; - TReal m_volMultiplier; - - bool m_tunerControl; - bool m_audioInitializationComplete; - bool m_muted; - bool m_isStereo; - bool m_available; - int m_vol; - bool m_volChangeRequired; - mutable int m_signal; - int m_previousSignal; - bool m_scanning; - QRadioTuner::Band m_currentBand; - qint64 m_currentFreq; - - QRadioTuner::Error m_radioError; - QRadioTuner::StereoMode m_stereoMode; - QString m_errorString; - QRadioTuner::State m_apiTunerState; - QTimer *m_signalStrengthTimer; - -Q_SIGNALS: - void error(QRadioTuner::Error) const; - -protected slots: - void changeSignalStrength(); -}; - -#endif - diff --git a/src/plugins/symbian/mmf/radio/s60radiotunerservice.cpp b/src/plugins/symbian/mmf/radio/s60radiotunerservice.cpp deleted file mode 100644 index a5cfde958..000000000 --- a/src/plugins/symbian/mmf/radio/s60radiotunerservice.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** 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 Mobility Components. -** -** $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 "DebugMacros.h" - -#include "s60radiotunerservice.h" - - -S60RadioTunerService::S60RadioTunerService(QObject *parent) - : QMediaService(parent) -{ - DP0("S60RadioTunerService::S60RadioTunerService +++"); - - m_playerControl = new S60RadioTunerControl(this); - - DP0("S60RadioTunerService::S60RadioTunerService ---"); -} - -S60RadioTunerService::~S60RadioTunerService() -{ - DP0("S60RadioTunerService::~S60RadioTunerService +++"); - - delete m_playerControl; - - DP0("S60RadioTunerService::~S60RadioTunerService ---"); -} - -QMediaControl *S60RadioTunerService::requestControl(const char* name) -{ - DP0("S60RadioTunerService::requestControl"); - - if (qstrcmp(name, QRadioTunerControl_iid) == 0) - return m_playerControl; - - return 0; -} - -void S60RadioTunerService::releaseControl(QMediaControl *control) -{ - DP0("S60RadioTunerService::releaseControl +++"); - - Q_UNUSED(control); - - DP0("S60RadioTunerService::releaseControl ---"); -} diff --git a/src/plugins/symbian/mmf/radio/s60radiotunerservice.h b/src/plugins/symbian/mmf/radio/s60radiotunerservice.h deleted file mode 100644 index bdc3e8274..000000000 --- a/src/plugins/symbian/mmf/radio/s60radiotunerservice.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** 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 Mobility Components. -** -** $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 S60RADIOTUNERSERVICE_H -#define S60RADIOTUNERSERVICE_H - -#include <QtCore/qobject.h> - -#include <qmediaservice.h> - -#ifdef TUNERLIBUSED -#include "s60radiotunercontrol_31.h" -#else -#include "s60radiotunercontrol_since32.h" -#endif - -QT_USE_NAMESPACE - -class S60RadioTunerService : public QMediaService -{ - Q_OBJECT -public: - S60RadioTunerService(QObject *parent = 0); - ~S60RadioTunerService(); - - QMediaControl *requestControl(const char* name); - void releaseControl(QMediaControl *control); - -private: - S60RadioTunerControl *m_playerControl; -}; - -#endif |