diff options
Diffstat (limited to 'src/plugins/symbian/openmaxal/radiotuner')
10 files changed, 0 insertions, 1801 deletions
diff --git a/src/plugins/symbian/openmaxal/radiotuner/qxaradiocontrol.cpp b/src/plugins/symbian/openmaxal/radiotuner/qxaradiocontrol.cpp deleted file mode 100644 index 240fe3d3a..000000000 --- a/src/plugins/symbian/openmaxal/radiotuner/qxaradiocontrol.cpp +++ /dev/null @@ -1,202 +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 "qxaradiocontrol.h" -#include "qxaradiosession.h" -#include "xaradiosessionimpl.h" - -QXARadioControl::QXARadioControl(QXARadioSession *session, QObject *parent) -:QRadioTunerControl(parent), m_session(session) -{ - - connect(m_session, SIGNAL(stateChanged(QRadioTuner::State)), this, SIGNAL(stateChanged(QRadioTuner::State))); - - connect(m_session, SIGNAL(bandChanged(QRadioTuner::Band)), this, SIGNAL(bandChanged(QRadioTuner::Band))); - - connect(m_session, SIGNAL(frequencyChanged(int)), this, SIGNAL(frequencyChanged(int))); - - connect(m_session, SIGNAL(stereoStatusChanged(bool)), this, SIGNAL(stereoStatusChanged(bool))); - - connect(m_session, SIGNAL(searchingChanged(bool)), this, SIGNAL(searchingChanged(bool))); - - connect(m_session, SIGNAL(signalStrengthChanged(int)), this, SIGNAL(signalStrengthChanged(int))); - - connect(m_session, SIGNAL(volumeChanged(int)), this, SIGNAL(volumeChanged(int))); - - connect(m_session, SIGNAL(mutedChanged(bool)), this, SIGNAL(mutedChanged(bool))); - -// connect(m_session, SIGNAL(error(int,QString)), this,SIGNAL(error(int,QString))); -} - -QXARadioControl::~QXARadioControl() -{ - -} - -QtMultimediaKit::AvailabilityError QXARadioControl::availabilityError() const -{ - return m_session->availabilityError(); -} - -bool QXARadioControl::isAvailable() const -{ - return m_session->isAvailable(); -} - -QRadioTuner::State QXARadioControl::state() const -{ - return m_session->state(); -} - -QRadioTuner::Band QXARadioControl::band() const -{ - return m_session->band(); -} - -void QXARadioControl::setBand(QRadioTuner::Band band) -{ - m_session->setBand(band); -} - -bool QXARadioControl::isBandSupported(QRadioTuner::Band band) const -{ - return m_session->isBandSupported(band); -} - -int QXARadioControl::frequency() const -{ - return m_session->frequency(); -} - -int QXARadioControl::frequencyStep(QRadioTuner::Band band) const -{ - return m_session->frequencyStep(band); -} - -QPair<int,int> QXARadioControl::frequencyRange(QRadioTuner::Band band) const -{ - return m_session->frequencyRange(band); -} - -void QXARadioControl::setFrequency(int freq) -{ - m_session->setFrequency(freq); -} - -bool QXARadioControl::isStereo() const -{ - return m_session->isStereo(); -} - -QRadioTuner::StereoMode QXARadioControl::stereoMode() const -{ - return m_session->stereoMode(); -} - -void QXARadioControl::setStereoMode(QRadioTuner::StereoMode stereoMode) -{ - m_session->setStereoMode(stereoMode); -} - -int QXARadioControl::signalStrength() const -{ - return m_session->signalStrength(); -} - -int QXARadioControl::volume() const -{ - return m_session->volume(); -} - -void QXARadioControl::setVolume(int volume) -{ - m_session->setVolume(volume); -} - -bool QXARadioControl::isMuted() const -{ - return m_session->isMuted(); -} - -void QXARadioControl::setMuted(bool muted) -{ - m_session->setMuted(muted); -} - -bool QXARadioControl::isSearching() const -{ - return m_session->isSearching(); -} - -void QXARadioControl::searchForward() -{ - m_session->searchForward(); -} - -void QXARadioControl::searchBackward() -{ - m_session->searchBackward(); -} - -void QXARadioControl::cancelSearch() -{ - m_session->cancelSearch(); -} - -void QXARadioControl::start() -{ - m_session->start(); -} - -void QXARadioControl::stop() -{ - m_session->stop(); -} - -QRadioTuner::Error QXARadioControl::error() const -{ - return m_session->error(); -} - -QString QXARadioControl::errorString() const -{ - return m_session->errorString(); -} diff --git a/src/plugins/symbian/openmaxal/radiotuner/qxaradiocontrol.h b/src/plugins/symbian/openmaxal/radiotuner/qxaradiocontrol.h deleted file mode 100644 index d183959e6..000000000 --- a/src/plugins/symbian/openmaxal/radiotuner/qxaradiocontrol.h +++ /dev/null @@ -1,95 +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 QXARADIOCONTROL_H -#define QXARADIOCONTROL_H - -#include <QObject> -#include <QRadioTunerControl> - -QT_USE_NAMESPACE - -class QXARadioSession; - -class QXARadioControl : public QRadioTunerControl -{ - Q_OBJECT - -public: - QXARadioControl(QXARadioSession *session, QObject *parent = 0); - virtual ~QXARadioControl(); - QRadioTuner::State state() const; - - QRadioTuner::Band band() const; - void setBand(QRadioTuner::Band band); - bool isBandSupported(QRadioTuner::Band band) const; - int frequency() const; - int frequencyStep(QRadioTuner::Band band) const; - QPair<int,int> frequencyRange(QRadioTuner::Band band) const; - void setFrequency(int freq); - bool isStereo() const; - QRadioTuner::StereoMode stereoMode() const; - void setStereoMode(QRadioTuner::StereoMode stereoMode); - 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; - -private: - QXARadioSession *m_session; - -protected: - QXARadioControl(QObject* parent = 0); -}; - -#endif /* QXARADIOCONTROL_H */ diff --git a/src/plugins/symbian/openmaxal/radiotuner/qxaradiomediaservice.cpp b/src/plugins/symbian/openmaxal/radiotuner/qxaradiomediaservice.cpp deleted file mode 100644 index bbed4c8ee..000000000 --- a/src/plugins/symbian/openmaxal/radiotuner/qxaradiomediaservice.cpp +++ /dev/null @@ -1,72 +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 <QString> - -#include "qxaradiomediaservice.h" -#include "qxaradiosession.h" -#include "qxaradiocontrol.h" -#include <qradiotunercontrol.h> - -QXARadioMediaService::QXARadioMediaService(QObject *parent) - : QMediaService(parent) -{ - m_session = new QXARadioSession(this); - m_control = new QXARadioControl(m_session, this); -} - -QXARadioMediaService::~QXARadioMediaService() -{ -} - -QMediaControl* QXARadioMediaService::requestControl(const char *name) -{ - - if (qstrcmp(name, QRadioTunerControl_iid) == 0) { - return m_control; - } - return 0; -} - -void QXARadioMediaService::releaseControl(QMediaControl *control) -{ - Q_UNUSED(control) -} diff --git a/src/plugins/symbian/openmaxal/radiotuner/qxaradiomediaservice.h b/src/plugins/symbian/openmaxal/radiotuner/qxaradiomediaservice.h deleted file mode 100644 index ffd7e9fe3..000000000 --- a/src/plugins/symbian/openmaxal/radiotuner/qxaradiomediaservice.h +++ /dev/null @@ -1,66 +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 QXARADIOMEDIASERVICE_H -#define QXARADIOMEDIASERVICE_H - -#include <QtCore/qobject.h> -#include <qmediaservice.h> - -QT_USE_NAMESPACE - -class QXARadioSession; -class QXARadioControl; - -class QXARadioMediaService : public QMediaService -{ - Q_OBJECT -public: - QXARadioMediaService(QObject *parent = 0); - ~QXARadioMediaService(); - QMediaControl *requestControl(const char *name); - void releaseControl( QMediaControl *control); -private: - QXARadioSession *m_session; - QXARadioControl *m_control; -}; - -#endif /*QXARADIOMEDIASERVICE_H*/ diff --git a/src/plugins/symbian/openmaxal/radiotuner/qxaradiosession.cpp b/src/plugins/symbian/openmaxal/radiotuner/qxaradiosession.cpp deleted file mode 100644 index 20ab0f2d4..000000000 --- a/src/plugins/symbian/openmaxal/radiotuner/qxaradiosession.cpp +++ /dev/null @@ -1,323 +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 <qradiotuner.h> -#include "qxaradiosession.h" -#include "xaradiosessionimpl.h" -#include "qxacommon.h" - -QXARadioSession::QXARadioSession(QObject *parent) -:QObject(parent) -{ - QT_TRACE_FUNCTION_ENTRY; - m_impl = new XARadioSessionImpl(*this); - if (!m_impl) { - QT_TRACE1("RadioSession::RadioSession(): ERROR creating RadioSessionImpl..."); - return; - } - if (m_impl->PostConstruct() != QRadioTuner::NoError) { - QT_TRACE1("RadioSession::RadioSession(): ERROR from RadioSessionImpl::PostContstruct..."); - delete m_impl; - m_impl = NULL; - } - QT_TRACE_FUNCTION_EXIT; -} - -QXARadioSession::~QXARadioSession() -{ - delete m_impl; -} - -QRadioTuner::State QXARadioSession::state() const -{ - QRadioTuner::State state = QRadioTuner::StoppedState; - if (m_impl) - state = m_impl->State(); - return state; - } -QtMultimediaKit::AvailabilityError QXARadioSession::availabilityError() const -{ - QtMultimediaKit::AvailabilityError error = QtMultimediaKit::NoError; - if (m_impl) - error = m_impl->AvailabilityError(); - return error; -} - -QRadioTuner::Band QXARadioSession::band() const -{ - QRadioTuner::Band band = QRadioTuner::FM; - if (m_impl) - band = m_impl->Band(); - return band; -} - -void QXARadioSession::setBand(QRadioTuner::Band band) -{ - if (m_impl) - m_impl->SetBand(band); -} - -bool QXARadioSession::isBandSupported(QRadioTuner::Band band) const -{ - if (m_impl) - return m_impl->IsBandSupported(band); - return false; -} - -bool QXARadioSession::isAvailable() const -{ - if (m_impl) - return m_impl->IsAvailable(); - return false; -} - -int QXARadioSession::frequency() const -{ - TInt frequency = 0; - if (m_impl) - frequency = m_impl->GetFrequency(); - return (int)frequency; -} - -int QXARadioSession::frequencyStep(QRadioTuner::Band band) const -{ - TInt freqStep = 0; - if (m_impl) - freqStep = m_impl->FrequencyStep(band); - return (int)freqStep; -} - -QPair<int, int> QXARadioSession::frequencyRange(QRadioTuner::Band /*band*/) const -{ - QPair<int, int> freqRange; - freqRange.first = 0; - freqRange.second =0; - - if (m_impl) { - TInt freqRangeType = m_impl->GetFrequencyRange(); - m_impl->GetFrequencyRangeProperties(freqRangeType, freqRange.first, freqRange.second); - } - - return freqRange; -} - -void QXARadioSession::setFrequency(int frequency) -{ - if (m_impl) - m_impl->SetFrequency(frequency); -} - -bool QXARadioSession::isStereo() const -{ - bool isStereo = false; - if (m_impl) - isStereo = m_impl->IsStereo(); - return isStereo; -} - -QRadioTuner::StereoMode QXARadioSession::stereoMode() const -{ - QRadioTuner::StereoMode mode(QRadioTuner::Auto); - if (m_impl) - mode = m_impl->StereoMode(); - return mode; -} - -void QXARadioSession::setStereoMode(QRadioTuner::StereoMode mode) -{ - if (m_impl) - m_impl->SetStereoMode(mode); -} - -int QXARadioSession::signalStrength() const -{ - TInt signalStrength = 0; - if (m_impl) - signalStrength = m_impl->GetSignalStrength(); - return (int)signalStrength; -} - -int QXARadioSession::volume() const -{ - TInt volume = 0; - if (m_impl) - volume = m_impl->GetVolume(); - return volume; -} - -int QXARadioSession::setVolume(int volume) -{ - TInt newVolume = 0; - if (m_impl) { - m_impl->SetVolume(volume); - newVolume = m_impl->GetVolume(); - } - return newVolume; -} - -bool QXARadioSession::isMuted() const -{ - bool isMuted = false; - if (m_impl) - isMuted = m_impl->IsMuted(); - return isMuted; -} - -void QXARadioSession::setMuted(bool muted) -{ - if (m_impl) - m_impl->SetMuted(muted); -} - -bool QXARadioSession::isSearching() const -{ - bool isSearching = false; - if (m_impl) - isSearching = m_impl->IsSearching(); - return isSearching; -} - -void QXARadioSession::searchForward() -{ - if (m_impl) - m_impl->Seek(true); -} - -void QXARadioSession::searchBackward() -{ - if (m_impl) - m_impl->Seek(false); -} - -void QXARadioSession::cancelSearch() -{ - if (m_impl) - m_impl->StopSeeking(); -} - -void QXARadioSession::start() -{ - if (m_impl) - m_impl->Start(); -} - -void QXARadioSession::stop() -{ - if (m_impl) - m_impl->Stop(); -} - -QRadioTuner::Error QXARadioSession::error() const -{ - QRadioTuner::Error err(QRadioTuner::NoError); - if (m_impl) - err = m_impl->Error(); - return err; -} - -QString QXARadioSession::errorString() const -{ - QString str = NULL; - switch (iError) { - case QRadioTuner::ResourceError: - str = "Resource Error"; - break; - case QRadioTuner::OpenError: - str = "Open Error"; - break; - case QRadioTuner::OutOfRangeError: - str = "Out of Range Error"; - break; - default: - break; - } - - return str; -} - -// Callbacks, which will emit signals to client: -void QXARadioSession::CBStateChanged(QRadioTuner::State state) -{ - emit stateChanged(state); -} - -void QXARadioSession::CBBandChanged(QRadioTuner::Band band) -{ - emit bandChanged(band); -} - -void QXARadioSession::CBFrequencyChanged(TInt newFrequency) -{ - emit frequencyChanged(newFrequency); -} - -void QXARadioSession::CBStereoStatusChanged(bool isStereo) -{ - emit stereoStatusChanged(isStereo); -} - -void QXARadioSession::CBSignalStrengthChanged(int signalStrength) -{ - emit signalStrengthChanged(signalStrength); -} - -void QXARadioSession::CBVolumeChanged(int volume) -{ - emit volumeChanged(volume); -} - -void QXARadioSession::CBMutedChanged(bool isMuted) -{ - emit mutedChanged(isMuted); -} - -void QXARadioSession::CBSearchingChanged(bool isSearching) -{ - emit searchingChanged(isSearching); -} - -void QXARadioSession::CBError(QRadioTuner::Error err) -{ - iError = err; - emit error((int)err, errorString()); -} - - diff --git a/src/plugins/symbian/openmaxal/radiotuner/qxaradiosession.h b/src/plugins/symbian/openmaxal/radiotuner/qxaradiosession.h deleted file mode 100644 index 18278ba58..000000000 --- a/src/plugins/symbian/openmaxal/radiotuner/qxaradiosession.h +++ /dev/null @@ -1,118 +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 QXARADIOSESSION_H -#define QXARADIOSESSION_H - -#include <QObject> -#include <QUrl> -#include <qradiotuner.h> -#include "xaradiosessionimplobserver.h" - -QT_USE_NAMESPACE - -class XARadioSessionImpl; - -class QXARadioSession : public QObject, public XARadioSessionImplObserver -{ -Q_OBJECT - -public: - QXARadioSession(QObject *parent); - virtual ~QXARadioSession(); - - QRadioTuner::State state() const; - QRadioTuner::Band band() const; - void setBand(QRadioTuner::Band band); - bool isBandSupported(QRadioTuner::Band band) 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; - int setVolume(int volume); - bool isMuted() const; - void setMuted(bool muted); - bool isSearching() const; - void searchForward(); - void searchBackward(); - void cancelSearch(); - void start(); - void stop(); - bool isAvailable() const; - QtMultimediaKit::AvailabilityError availabilityError() const; - QRadioTuner::Error error() const; - QString errorString() const; - - /* Callbacks from XARadioSessionImplObserver begin */ - void CBBandChanged(QRadioTuner::Band band); - void CBStateChanged(QRadioTuner::State state); - void CBFrequencyChanged(TInt newFrequency); - void CBStereoStatusChanged(bool isStereo); - void CBSignalStrengthChanged(int signalStrength); - void CBVolumeChanged(int volume); - void CBMutedChanged(bool isMuted); - void CBSearchingChanged(bool isSearching); - void CBError(QRadioTuner::Error err); - /* Callbacks from XARadioSessionImplObserver end */ - -signals: - void stateChanged(QRadioTuner::State state); - void bandChanged(QRadioTuner::Band band); - void frequencyChanged(int frequency); - void stereoStatusChanged(bool stereo); - void searchingChanged(bool stereo); - void signalStrengthChanged(int signalStrength); - void volumeChanged(int volume); - void mutedChanged(bool muted); - void error(int err, QString str); - -private: - /* Own */ - QRadioTuner::Error iError; - XARadioSessionImpl* m_impl; -}; - -#endif /*QXARADIOSESSION_H*/ diff --git a/src/plugins/symbian/openmaxal/radiotuner/radiotuner.pri b/src/plugins/symbian/openmaxal/radiotuner/radiotuner.pri deleted file mode 100644 index bf83d05fc..000000000 --- a/src/plugins/symbian/openmaxal/radiotuner/radiotuner.pri +++ /dev/null @@ -1,18 +0,0 @@ -INCLUDEPATH += $$PWD - -# Input -HEADERS += \ - $$PWD/qxaradiomediaservice.h \ - $$PWD/qxaradiosession.h \ - $$PWD/qxaradiocontrol.h \ - $$PWD/xaradiosessionimpl.h \ - $$PWD/xaradiosessionimplobserver.h - -SOURCES += \ - $$PWD/qxaradiomediaservice.cpp \ - $$PWD/qxaradiosession.cpp \ - $$PWD/qxaradiocontrol.cpp \ - $$PWD/xaradiosessionimpl.cpp - -LIBS += \ - -lbafl diff --git a/src/plugins/symbian/openmaxal/radiotuner/xaradiosessionimpl.cpp b/src/plugins/symbian/openmaxal/radiotuner/xaradiosessionimpl.cpp deleted file mode 100644 index da627eb54..000000000 --- a/src/plugins/symbian/openmaxal/radiotuner/xaradiosessionimpl.cpp +++ /dev/null @@ -1,715 +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 "xaradiosessionimpl.h" -#include "xaradiosessionimplobserver.h" -#include <xaradioitfext.h> -#include "xacommon.h" - -#define MAX_NUMBER_INTERFACES 20 -#define FM_STEP 100000; // Hz (.1 MHz) - -/* - * function declarations. - * */ -void EngineObjectCallback(XAObjectItf caller, const void */*pContext*/, - XAuint32 event, XAresult result, XAuint32 /*param*/, - void */*pInterface*/); - -void RadioCallback(XARadioItf caller, void* pContext, XAuint32 event, XAuint32 eventIntData, XAboolean eventBooleanData); -void NokiaVolumeExtItfCallback(XANokiaVolumeExtItf caller, void* pContext, XAuint32 event, XAboolean eventBooleanData); -void NokiaLinearVolumeItfCallback(XANokiaLinearVolumeItf caller, void* pContext, XAuint32 event, XAboolean eventBooleanData); -void PlayItfCallbackForRadio(XAPlayItf caller, void* pContext, XAuint32 event); - -XARadioSessionImpl::XARadioSessionImpl(XARadioSessionImplObserver& parent) -:iParent(parent), -iRadio(NULL), -iEngine(NULL), -iPlayer(NULL), -iSearching(EFalse), -iRadioAvailable(EFalse), -iState(QRadioTuner::StoppedState) -{ - iAvailabilityError = QtMultimediaKit::NoError; -} - -XARadioSessionImpl::~XARadioSessionImpl() -{ - if (iRadio) { - TRACE_LOG((_L("XARadioSessionImpl::~XARadioSessionImpl(): Deleting Radio Device..."))); - (*iRadio)->Destroy(iRadio); - iRadio = NULL; - TRACE_LOG((_L("XARadioSessionImpl::~XARadioSessionImpl(): Deleted Radio Device"))); - } - if (iPlayer) { - TRACE_LOG((_L("XARadioSessionImpl::~XARadioSessionImpl(): Deleting player..."))); - (*iPlayer)->Destroy(iPlayer); - iPlayer = NULL; - TRACE_LOG((_L("XARadioSessionImpl::~XARadioSessionImpl(): Deleted iPlayer"))); - } - if ( iEngine ) { - TRACE_LOG((_L("XARadioSessionImpl::~XARadioSessionImpl(): Deleting engine..."))); - (*iEngine)->Destroy(iEngine); - iEngine = NULL; - TRACE_LOG((_L("XARadioSessionImpl::~XARadioSessionImpl(): Deleted engine"))); - } -} - -QRadioTuner::Error XARadioSessionImpl::PostConstruct() -{ - XAresult res = CreateEngine(); - if (res != KErrNone) - return QRadioTuner::ResourceError; - else - return QRadioTuner::NoError; -} - -TInt XARadioSessionImpl::CreateEngine() -{ - TRACE_FUNCTION_ENTRY; - XAboolean required[MAX_NUMBER_INTERFACES]; - XAInterfaceID iidArray[MAX_NUMBER_INTERFACES]; - XAuint32 noOfInterfaces = 0; - int i; - XAresult res; - - XAEngineOption EngineOption[] = - { - { - (XAuint32) XA_ENGINEOPTION_THREADSAFE, - (XAuint32) XA_BOOLEAN_TRUE - } - }; - - /* Create XA engine */ - if (!iEngine) { - TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Creating Engine..."))); - res = xaCreateEngine(&iEngine, 1, EngineOption, 0, NULL, NULL); - RET_ERR_IF_ERR(CheckErr(res)); - res = (*iEngine)->RegisterCallback(iEngine, EngineObjectCallback, NULL); - RET_ERR_IF_ERR(CheckErr(res)); - - TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Realizing..."))); - res = (*iEngine)->Realize(iEngine, XA_BOOLEAN_FALSE); - RET_ERR_IF_ERR(CheckErr(res)); - - // Create Engine Interface: - TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Creating Engine Interface"))); - RET_ERR_IF_ERR(CheckErr((*iEngine)->GetInterface(iEngine, XA_IID_ENGINE, (void*)&iEngineItf))); - - // Create Radio Device and interface(s): - if (!iRadio) { - TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Creating Radio Device"))); - res = (*iEngineItf)->CreateRadioDevice(iEngineItf,&iRadio, 0, NULL, NULL); - RET_ERR_IF_ERR(CheckErr(res)); - - TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Realize Radio Device"))); - res = (*iRadio)->Realize(iRadio, XA_BOOLEAN_FALSE); - RET_ERR_IF_ERR(CheckErr(res)); - - // Get Radio interface: - TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Get Radio Interface"))); - res = (*iRadio)->GetInterface(iRadio, XA_IID_RADIO, (void*)&iRadioItf); - RET_ERR_IF_ERR(CheckErr(res)); - iRadioAvailable = ETrue; - // Register Radio Callback: - TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Create Radio Callback:"))); - res = (*iRadioItf)->RegisterRadioCallback(iRadioItf, RadioCallback, (void*)this); - RET_ERR_IF_ERR(CheckErr(res)); - } - XADataSource audioSource; - XADataLocator_IODevice locatorIODevice; - XADataSink audioSink; - XADataLocator_OutputMix locator_outputmix; - - /* Init arrays required[] and iidArray[] */ - for (i = 0; i < MAX_NUMBER_INTERFACES; i++) { - required[i] = XA_BOOLEAN_FALSE; - iidArray[i] = XA_IID_NULL; - } - - iidArray[0] = XA_IID_NOKIAVOLUMEEXT; - iidArray[1] = XA_IID_NOKIALINEARVOLUME; - noOfInterfaces = 2; - - locatorIODevice.locatorType = XA_DATALOCATOR_IODEVICE; - locatorIODevice.deviceType = XA_IODEVICE_RADIO; - locatorIODevice.deviceID = 0; /* ignored */ - locatorIODevice.device = iRadio; - audioSource.pLocator = (void*) &locatorIODevice; - audioSource.pFormat = NULL; - - /* Setup the data sink structure */ - locator_outputmix.locatorType = XA_DEFAULTDEVICEID_AUDIOOUTPUT; - locator_outputmix.outputMix = NULL; - audioSink.pLocator = (void*) &locator_outputmix; - audioSink.pFormat = NULL; - - TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Create Media Player:"))); - res = (*iEngineItf)->CreateMediaPlayer(iEngineItf, &iPlayer, &audioSource, NULL, &audioSink, NULL, NULL, NULL, noOfInterfaces, iidArray, required); - RET_ERR_IF_ERR(CheckErr(res)); - - TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Realize Media Player:"))); - res = (*iPlayer)->Realize(iPlayer, XA_BOOLEAN_FALSE); - RET_ERR_IF_ERR(CheckErr(res)); - TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Get Play Interface from player:"))); - res = (*iPlayer)->GetInterface(iPlayer, XA_IID_PLAY, (void*) &iPlayItf); - RET_ERR_IF_ERR(CheckErr(res)); - TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Create PlayItf Callback:"))); - res = (*iPlayItf)->RegisterCallback(iPlayItf, PlayItfCallbackForRadio, (void*)this); - RET_ERR_IF_ERR(CheckErr(res)); - - // Get Volume Interfaces specific for Nokia impl: - TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Get NokiaVolumeExt Interface"))); - res = (*iPlayer)->GetInterface(iPlayer, XA_IID_NOKIAVOLUMEEXT, (void*)&iNokiaVolumeExtItf); - RET_ERR_IF_ERR(CheckErr(res)); - - TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Get NokiaLinearVolume Interface"))); - res = (*iPlayer)->GetInterface(iPlayer, XA_IID_NOKIALINEARVOLUME, (void*)&iNokiaLinearVolumeItf); - RET_ERR_IF_ERR(CheckErr(res)); - - // Register Volume Callbacks: - TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Create NokiaVolumeExtItf Callback:"))); - res = (*iNokiaVolumeExtItf)->RegisterVolumeCallback(iNokiaVolumeExtItf, NokiaVolumeExtItfCallback, (void*)this); - RET_ERR_IF_ERR(CheckErr(res)); - res = (*iNokiaVolumeExtItf)->SetCallbackEventsMask(iNokiaVolumeExtItf,(XA_NOKIAVOLUMEEXT_EVENT_MUTE_CHANGED)); - RET_ERR_IF_ERR(CheckErr(res)); - TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Create NokiaLinearVolumeItf Callback:"))); - res = (*iNokiaLinearVolumeItf)->RegisterVolumeCallback(iNokiaLinearVolumeItf, NokiaLinearVolumeItfCallback, (void*)this); - RET_ERR_IF_ERR(CheckErr(res)); - res = (*iNokiaLinearVolumeItf)->SetCallbackEventsMask(iNokiaLinearVolumeItf,(XA_NOKIALINEARVOLUME_EVENT_VOLUME_CHANGED)); - RET_ERR_IF_ERR(CheckErr(res)); - } - - TRACE_FUNCTION_EXIT; - return EFalse; -} - -QRadioTuner::State XARadioSessionImpl::State() const -{ - TRACE_FUNCTION_ENTRY_EXIT; - return iState; -} - -QtMultimediaKit::AvailabilityError XARadioSessionImpl::AvailabilityError() const -{ - TRACE_FUNCTION_ENTRY_EXIT; - return iAvailabilityError; -} - - bool XARadioSessionImpl::IsAvailable() const -{ - TRACE_FUNCTION_ENTRY_EXIT; - return iRadioAvailable; -} - -QRadioTuner::Band XARadioSessionImpl::Band() const -{ - TRACE_FUNCTION_ENTRY_EXIT; - return iBand; -} - -void XARadioSessionImpl::SetBand(QRadioTuner::Band band) -{ - if (band != QRadioTuner::FM) - iParent.CBError(QRadioTuner::OpenError); - else - iBand = band; -} - -bool XARadioSessionImpl::IsBandSupported(QRadioTuner::Band band) const -{ - if (band == QRadioTuner::FM) - return ETrue; - else - return EFalse; -} - -// Returns the number of Hertz to increment the frequency by when stepping through frequencies within a given band. -TInt XARadioSessionImpl::FrequencyStep(QRadioTuner::Band /*band*/) const -{ - TInt freqStep = FM_STEP; - return (int)freqStep; -} - -bool XARadioSessionImpl::IsStereo() //const -{ - bool isStereo = EFalse; - QRadioTuner::StereoMode mode = StereoMode(); - if (mode == QRadioTuner::ForceStereo || mode == QRadioTuner::Auto) - isStereo = ETrue; - return isStereo; -} - -bool XARadioSessionImpl::IsMuted() const -{ - TRACE_FUNCTION_ENTRY; - XAboolean isMuted = EFalse; - (*iNokiaVolumeExtItf)->GetMute(iNokiaVolumeExtItf, &isMuted ); - TRACE_LOG((_L("XARadioSessionImpl::IsMuted: isMuted = %d"), isMuted)); - - TRACE_FUNCTION_EXIT; - return isMuted; -} - -bool XARadioSessionImpl::IsSearching() const -{ - //iSearching is set when seek (QT:searchForward-backward) - // iSearching is cleared when SearchingStatusChanged is called or StopSeeking is called - return iSearching; -} - -TInt XARadioSessionImpl::GetFrequency() -{ - TRACE_FUNCTION_ENTRY; - - XAuint32 freq = 0; - XAresult res = (*iRadioItf)->GetFrequency(iRadioItf, &freq ); - RET_ERR_IF_ERR(CheckErr(res)); - TRACE_LOG((_L("XARadioSessionImpl::GetFrequency: Frequency = %d"), freq)); - - TRACE_FUNCTION_EXIT; - return (int)freq; -} - -TInt XARadioSessionImpl::GetFrequencyRange() -{ - TRACE_FUNCTION_ENTRY; - XAuint8 range = 0; - - XAresult res = (*iRadioItf)->GetFreqRange(iRadioItf, &range); - RET_ERR_IF_ERR(CheckErr(res)); - TRACE_LOG((_L("XARadioSessionImpl::GetFrequencyRange: Frequency Range = %d"), range)); - - TRACE_FUNCTION_EXIT; - return (int)range; -} - -TInt XARadioSessionImpl::GetFrequencyRangeProperties(TInt range, TInt &minFreq, TInt &maxFreq) -{ - TRACE_FUNCTION_ENTRY; - XAuint32 freqInterval = 0; - XAresult res = (*iRadioItf)->GetFreqRangeProperties(iRadioItf, (XAuint8)range, (XAuint32*)&minFreq,(XAuint32*)&maxFreq, (XAuint32*)&freqInterval); - RET_ERR_IF_ERR(CheckErr(res)); - TRACE_LOG((_L("XARadioSessionImpl::GetFrequencyRangeProperties: minFreq = %d, maxFreq = %d"), minFreq, maxFreq)); - - TRACE_FUNCTION_EXIT; - return res; -} - -TInt XARadioSessionImpl::SetFrequency(TInt aFreq) -{ - TRACE_FUNCTION_ENTRY; - - TRACE_LOG((_L("XARadioSessionImpl::SetFrequency: Setting Frequency to: %d"), aFreq)); - XAresult res = (*iRadioItf)->SetFrequency(iRadioItf, aFreq ); - RET_ERR_IF_ERR(CheckErr(res)); - - TRACE_FUNCTION_EXIT; - return res; -} - -QRadioTuner::StereoMode XARadioSessionImpl::StereoMode() -{ - TRACE_FUNCTION_ENTRY; - QRadioTuner::StereoMode qtStereoMode; - XAuint32 symStereoMode; - (*iRadioItf)->GetStereoMode(iRadioItf, &symStereoMode); - - if (symStereoMode == XA_STEREOMODE_MONO) - qtStereoMode = QRadioTuner::ForceMono; - else if (symStereoMode == XA_STEREOMODE_STEREO) - qtStereoMode = QRadioTuner::ForceStereo; - else - qtStereoMode = QRadioTuner::Auto; - - TRACE_FUNCTION_EXIT; - return qtStereoMode; -} - -TInt XARadioSessionImpl::SetStereoMode(QRadioTuner::StereoMode qtStereoMode) -{ - TRACE_FUNCTION_ENTRY; - XAuint32 symStereoMode; - - if (qtStereoMode == QRadioTuner::ForceMono) - symStereoMode = XA_STEREOMODE_MONO; - else if (qtStereoMode == QRadioTuner::ForceStereo) - symStereoMode = XA_STEREOMODE_STEREO; - else - symStereoMode = XA_STEREOMODE_AUTO; - - XAresult res = (*iRadioItf)->SetStereoMode(iRadioItf, (symStereoMode)); - TRACE_FUNCTION_EXIT; - return res; -} - -TInt XARadioSessionImpl::GetSignalStrength() -{ - TRACE_FUNCTION_ENTRY; - XAuint32 signalStrength = 0; - - (*iRadioItf)->GetSignalStrength(iRadioItf, &signalStrength ); - TRACE_LOG((_L("XARadioSessionImpl::GetSignalStrength: Signal Strength = %d"), signalStrength)); - TRACE_FUNCTION_EXIT; - return (int)signalStrength; -} - -TInt XARadioSessionImpl::GetVolume() -{ - TRACE_FUNCTION_ENTRY; - XAuint32 vol; - if (iPlayer && iNokiaLinearVolumeItf) { - (*iNokiaLinearVolumeItf)->GetVolumeLevel(iNokiaLinearVolumeItf, &vol ); - TRACE_LOG((_L("XARadioSessionImpl::GetVolume: Volume = %d"), vol)); - } - TRACE_FUNCTION_EXIT; - return (TInt)vol; -} - -TInt XARadioSessionImpl::SetVolume(TInt aVolume) -{ - TRACE_FUNCTION_ENTRY; - XAuint32 newVolume = 0; - TRACE_LOG((_L("XARadioSessionImpl::SetVolume: Setting volume to: %d"), aVolume)); - if (iPlayer && iNokiaLinearVolumeItf) { - newVolume = aVolume; - XAresult res = (*iNokiaLinearVolumeItf)->SetVolumeLevel(iNokiaLinearVolumeItf, &newVolume); - } - TRACE_FUNCTION_EXIT; - return (TInt)newVolume; -} - -TInt XARadioSessionImpl::SetMuted(TBool aMuted) -{ - TRACE_FUNCTION_ENTRY; - XAresult res = (*iNokiaVolumeExtItf)->SetMute(iNokiaVolumeExtItf, aMuted); - TRACE_FUNCTION_EXIT; - return res; -} - -TInt XARadioSessionImpl::Seek(TBool aDirection) -{ - TRACE_FUNCTION_ENTRY; - iSearching = true; - XAresult res = (*iRadioItf)->Seek(iRadioItf, aDirection ); - TRACE_FUNCTION_EXIT; - return res; -} - -TInt XARadioSessionImpl::StopSeeking() -{ - TRACE_FUNCTION_ENTRY; - XAresult res = (*iRadioItf)->StopSeeking(iRadioItf); - iSearching = EFalse; - TRACE_FUNCTION_EXIT; - return res; -} - -void XARadioSessionImpl::Start() -{ - TRACE_FUNCTION_ENTRY; - if (iPlayItf) { - XAresult res = (*iPlayItf)->SetPlayState(iPlayItf, XA_PLAYSTATE_PLAYING); - // add error handling if res != 0 (call errorCB) - } - TRACE_FUNCTION_EXIT; -} - -void XARadioSessionImpl::Stop() -{ - TRACE_FUNCTION_ENTRY; - if (iPlayItf) { - XAresult res = (*iPlayItf)->SetPlayState(iPlayItf, XA_PLAYSTATE_STOPPED); - // add error handling if res != 0 (call errorCB) - } - TRACE_FUNCTION_EXIT; -} - -QRadioTuner::Error XARadioSessionImpl::Error() -{ - TRACE_FUNCTION_ENTRY_EXIT; - return QRadioTuner::NoError; -} - -//TInt XARadioSessionImpl::ErrorString(); -// { -// TRACE_FUNCTION_ENTRY; - -// TRACE_FUNCTION_EXIT; -// } - -void XARadioSessionImpl::StateChanged(QRadioTuner::State state) -{ - TRACE_FUNCTION_ENTRY; - iState = state; - iParent.CBStateChanged(state); - TRACE_FUNCTION_EXIT; -} - -void XARadioSessionImpl::FrequencyChanged(XAuint32 freq) -{ - TRACE_FUNCTION_ENTRY; - iParent.CBFrequencyChanged(freq); - TRACE_FUNCTION_EXIT; -} - -void XARadioSessionImpl::SearchingChanged(TBool isSearching) -{ - TRACE_FUNCTION_ENTRY; - iSearching = EFalse; - iParent.CBSearchingChanged(isSearching); - TRACE_FUNCTION_EXIT; -} - -void XARadioSessionImpl::StereoStatusChanged(TBool stereoStatus) -{ - TRACE_FUNCTION_ENTRY; - iParent.CBStereoStatusChanged(stereoStatus); - TRACE_FUNCTION_EXIT; -} - -void XARadioSessionImpl::SignalStrengthChanged(TBool stereoStatus) -{ - TRACE_FUNCTION_ENTRY; - iParent.CBSignalStrengthChanged(stereoStatus); - TRACE_FUNCTION_EXIT; -} - -void XARadioSessionImpl::VolumeChanged() -{ - TRACE_FUNCTION_ENTRY; - int vol = 0; - iParent.CBVolumeChanged(vol); - TRACE_FUNCTION_EXIT; -} - -void XARadioSessionImpl::MutedChanged(TBool mute) -{ - TRACE_FUNCTION_ENTRY; - iParent.CBMutedChanged(mute); - TRACE_FUNCTION_EXIT; -} - -void EngineObjectCallback(XAObjectItf /*caller*/, - const void */*pContext*/, -#ifdef PLUGIN_SYMBIAN_TRACE_ENABLED - XAuint32 event, -#else - XAuint32 /*event*/, -#endif /*PLUGIN_SYMBIAN_TRACE_ENABLED*/ - XAresult /*result*/, - XAuint32 /*param*/, - void */*pInterface*/) -{ -#ifdef PLUGIN_SYMBIAN_TRACE_ENABLED - TRACE_LOG((_L("Engine object event: 0x%x\n"), (int)event)); -#endif /*PLUGIN_SYMBIAN_TRACE_ENABLED*/ -} - -void RadioCallback(XARadioItf /*caller*/, - void* pContext, - XAuint32 event, - XAuint32 eventIntData, - XAboolean eventBooleanData) -{ - XAuint32 freq; - XAboolean stereoStatus(XA_BOOLEAN_FALSE); - - switch (event) { - case XA_RADIO_EVENT_ANTENNA_STATUS_CHANGED: - TRACE_LOG((_L("RadioCallback: XA_RADIO_EVENT_ANTENNA_STATUS_CHANGED"))); - // Qt API has no callback defined for this event. - break; - case XA_RADIO_EVENT_FREQUENCY_CHANGED: - freq = eventIntData; - TRACE_LOG((_L("RadioCallback: XA_RADIO_EVENT_FREQUENCY_CHANGED to: %d"), freq)); - if (pContext) - ((XARadioSessionImpl*)pContext)->FrequencyChanged(freq); - break; - case XA_RADIO_EVENT_FREQUENCY_RANGE_CHANGED: - TRACE_LOG((_L("RadioCallback: XA_RADIO_EVENT_FREQUENCY_RANGE_CHANGED"))); - // Qt API has no callback defined for this event. - break; - case XA_RADIO_EVENT_PRESET_CHANGED: - TRACE_LOG((_L("RadioCallback: XA_RADIO_EVENT_PRESET_CHANGED"))); - // Qt API has no callback defined for this event. - break; - case XA_RADIO_EVENT_SEEK_COMPLETED: - TRACE_LOG((_L("RadioCallback: XA_RADIO_EVENT_SEEK_COMPLETED"))); - if (pContext) - ((XARadioSessionImpl*)pContext)->SearchingChanged(false); - break; - case XA_RADIO_EVENT_STEREO_STATUS_CHANGED: - stereoStatus = eventBooleanData; - TRACE_LOG((_L("RadioCallback: XA_RADIO_EVENT_STEREO_STATUS_CHANGED: %d"), stereoStatus)); - if (pContext) - ((XARadioSessionImpl*)pContext)->StereoStatusChanged(stereoStatus); - break; - case XA_RADIO_EVENT_SIGNAL_STRENGTH_CHANGED: - TRACE_LOG((_L("RadioCallback: XA_RADIO_EVENT_SIGNAL_STRENGTH_CHANGED"))); - if (pContext) - ((XARadioSessionImpl*)pContext)->SignalStrengthChanged(stereoStatus); - break; - default: - TRACE_LOG((_L("RadioCallback: default"))); - break; - } -} - -void NokiaVolumeExtItfCallback(XANokiaVolumeExtItf /*caller*/, - void* pContext, - XAuint32 event, - XAboolean eventBooleanData) -{ - XAboolean mute; - switch (event) { - case XA_NOKIAVOLUMEEXT_EVENT_MUTE_CHANGED: - mute = eventBooleanData; - TRACE_LOG((_L("NokiaVolumeExtItfCallback: XA_NOKIAVOLUMEEXT_EVENT_MUTE_CHANGED to: %d"), mute)); - if (pContext) - ((XARadioSessionImpl*)pContext)->MutedChanged(mute); - break; - default: - TRACE_LOG((_L("NokiaVolumeExtItfCallback: default"))); - break; - } -} - -void NokiaLinearVolumeItfCallback(XANokiaLinearVolumeItf /*caller*/, - void* pContext, - XAuint32 event, - XAboolean /*eventBooleanData*/) -{ - switch (event) { - case XA_NOKIALINEARVOLUME_EVENT_VOLUME_CHANGED: - if (pContext) - ((XARadioSessionImpl*)pContext)->VolumeChanged(); - break; - default: - TRACE_LOG((_L("NokiaLinearVolumeItfCallback: default"))); - break; - } -} - -void PlayItfCallbackForRadio(XAPlayItf /*caller*/, - void* pContext, - XAuint32 event) -{ - switch (event) { - case XA_PLAYEVENT_HEADMOVING: - if (pContext) - ((XARadioSessionImpl*)pContext)->StateChanged(QRadioTuner::ActiveState); - break; - case XA_PLAYEVENT_HEADSTALLED: - if (pContext) - ((XARadioSessionImpl*)pContext)->StateChanged(QRadioTuner::StoppedState); - break; - default: - TRACE_LOG((_L("NokiaLinearVolumeItfCallback: default"))); - break; - } -} - -TInt XARadioSessionImpl::CheckErr(XAresult res) -{ - TInt status(KErrGeneral); - switch(res) { - case XA_RESULT_SUCCESS: - //TRACE_LOG((_L("XA_RESULT_SUCCESS"))); - status = KErrNone; - break; - case XA_RESULT_PRECONDITIONS_VIOLATED: - TRACE_LOG((_L("XA_RESULT_PRECONDITIONS_VIOLATED"))); - break; - case XA_RESULT_PARAMETER_INVALID: - TRACE_LOG((_L("XA_RESULT_PARAMETER_INVALID"))); - break; - case XA_RESULT_MEMORY_FAILURE: - TRACE_LOG((_L("XA_RESULT_MEMORY_FAILURE"))); - iAvailabilityError = QtMultimediaKit::ResourceError; - break; - case XA_RESULT_RESOURCE_ERROR: - TRACE_LOG((_L("XA_RESULT_RESOURCE_ERROR"))); - iAvailabilityError = QtMultimediaKit::ResourceError; - break; - case XA_RESULT_RESOURCE_LOST: - TRACE_LOG((_L("XA_RESULT_RESOURCE_LOST"))); - iAvailabilityError = QtMultimediaKit::ResourceError; - break; - case XA_RESULT_IO_ERROR: - TRACE_LOG((_L("XA_RESULT_IO_ERROR"))); - break; - case XA_RESULT_BUFFER_INSUFFICIENT: - TRACE_LOG((_L("XA_RESULT_BUFFER_INSUFFICIENT"))); - break; - case XA_RESULT_CONTENT_CORRUPTED: - TRACE_LOG((_L("XA_RESULT_CONTENT_CORRUPTED"))); - break; - case XA_RESULT_CONTENT_UNSUPPORTED: - TRACE_LOG((_L("XA_RESULT_CONTENT_UNSUPPORTED"))); - break; - case XA_RESULT_CONTENT_NOT_FOUND: - TRACE_LOG((_L("XA_RESULT_CONTENT_NOT_FOUND"))); - break; - case XA_RESULT_PERMISSION_DENIED: - TRACE_LOG((_L("XA_RESULT_PERMISSION_DENIED"))); - break; - case XA_RESULT_FEATURE_UNSUPPORTED: - TRACE_LOG((_L("XA_RESULT_FEATURE_UNSUPPORTED"))); - break; - case XA_RESULT_INTERNAL_ERROR: - TRACE_LOG((_L("XA_RESULT_INTERNAL_ERROR"))); - break; - case XA_RESULT_UNKNOWN_ERROR: - TRACE_LOG((_L("XA_RESULT_UNKNOWN_ERROR"))); - break; - case XA_RESULT_OPERATION_ABORTED: - TRACE_LOG((_L("XA_RESULT_OPERATION_ABORTED"))); - break; - case XA_RESULT_CONTROL_LOST: - TRACE_LOG((_L("XA_RESULT_CONTROL_LOST"))); - break; - default: - TRACE_LOG((_L("Unknown Error!!!"))); - } - return status; -} diff --git a/src/plugins/symbian/openmaxal/radiotuner/xaradiosessionimpl.h b/src/plugins/symbian/openmaxal/radiotuner/xaradiosessionimpl.h deleted file mode 100644 index a5789ba53..000000000 --- a/src/plugins/symbian/openmaxal/radiotuner/xaradiosessionimpl.h +++ /dev/null @@ -1,128 +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 XARADIOSESSIONIMPL_H -#define XARADIOSESSIONIMPL_H - -#include <OpenMAXAL.h> -#include <xanokialinearvolumeitf.h> -#include <xanokiavolumeextitf.h> -#include <qradiotuner.h> -#include <qtmedianamespace.h> - -QT_USE_NAMESPACE - -class XARadioSessionImplObserver; - -class XARadioSessionImpl -{ -public: - XARadioSessionImpl(XARadioSessionImplObserver& parent); - ~XARadioSessionImpl(); - QRadioTuner::Error PostConstruct(); - QRadioTuner::Band Band() const; - QRadioTuner::State State() const; - QtMultimediaKit::AvailabilityError AvailabilityError() const; - bool IsAvailable() const; - void SetBand(QRadioTuner::Band band); - bool IsBandSupported(QRadioTuner::Band band) const; - TInt FrequencyStep(QRadioTuner::Band band) const; - bool IsStereo(); //const; - bool IsMuted() const; - bool IsSearching() const; - TInt GetFrequency(); - TInt GetFrequencyRange(); - TInt GetFrequencyRangeProperties(TInt range, TInt &minFreq, TInt &maxFreq); - TInt SetFrequency(TInt aFreq); - QRadioTuner::StereoMode StereoMode(); - TInt SetStereoMode(QRadioTuner::StereoMode stereoMode); - TInt GetSignalStrength(); - TInt GetVolume(); - TInt SetVolume(TInt aVolume); - TInt SetMuted(TBool aMuted); - TInt Seek(TBool aDirection); - TInt StopSeeking(); - void Start(); - void Stop(); - QRadioTuner::Error Error(); -//TInt ErrorString(); - void StateChanged(QRadioTuner::State state); - void FrequencyChanged(XAuint32 freq); - void SearchingChanged(TBool isSearching); - void StereoStatusChanged(TBool stereoStatus); - void SignalStrengthChanged(TBool stereoStatus); - void VolumeChanged(); - void MutedChanged(TBool mute); - -private: - TInt CreateEngine(); - TInt CheckErr(XAresult res); - - -private: - XARadioSessionImplObserver& iParent; - XAObjectItf iRadio; - XAObjectItf iEngine; - XAObjectItf iPlayer; - XAEngineItf iEngineItf; - XARecordItf iRecordItf; - XAPlayItf iPlayItf; - XARadioItf iRadioItf; - XARDSItf iRdsItf; - XANokiaVolumeExtItf iNokiaVolumeExtItf; // used for mute functionality - XANokiaLinearVolumeItf iNokiaLinearVolumeItf; // used for volume functionality - - /* Audio Source */ - XADataSource iDataSource; - - /*Audio Sink*/ - XADataSink iAudioSink; - XADataLocator_OutputMix iLocator_outputmix; - - TBool iAutoFlag; - TBool iSearching; - TBool iRadioAvailable; - QtMultimediaKit::AvailabilityError iAvailabilityError; - QRadioTuner::Band iBand; - QRadioTuner::State iState; -}; - -#endif /* XARADIOSESSIONIMPL_H */ diff --git a/src/plugins/symbian/openmaxal/radiotuner/xaradiosessionimplobserver.h b/src/plugins/symbian/openmaxal/radiotuner/xaradiosessionimplobserver.h deleted file mode 100644 index c8edcf3bb..000000000 --- a/src/plugins/symbian/openmaxal/radiotuner/xaradiosessionimplobserver.h +++ /dev/null @@ -1,64 +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 XARADIOSESSIONIMPLOBSERVER_H -#define XARADIOSESSIONIMPLOBSERVER_H - -#include <e32base.h> -#include <qradiotuner.h> - -QT_USE_NAMESPACE - -class XARadioSessionImplObserver -{ -public: - virtual void CBStateChanged(QRadioTuner::State state) = 0; - virtual void CBBandChanged(QRadioTuner::Band band) = 0; - virtual void CBFrequencyChanged(TInt newFrequency) = 0; - virtual void CBStereoStatusChanged(bool isStereo) = 0; - virtual void CBSignalStrengthChanged(int signalStrength) = 0; - virtual void CBVolumeChanged(int volume) = 0; - virtual void CBMutedChanged(bool isMuted) = 0; - virtual void CBSearchingChanged(bool isSearching) = 0; - virtual void CBError(QRadioTuner::Error err) = 0; -}; - -#endif /*XARADIOSESSIONIMPLOBSERVER_H*/ |