--- a/radioapp/radioenginewrapper/src/radioenginewrapper_p.cpp Fri Jun 11 16:24:13 2010 +0100
+++ b/radioapp/radioenginewrapper/src/radioenginewrapper_p.cpp Thu Jul 22 16:33:45 2010 +0100
@@ -23,12 +23,10 @@
#include "radiosettings_p.h"
#include "radiologger.h"
#include "radio_global.h"
-#include "cradioenginehandler.h"
+#include "radioenginehandler.h"
#include "radiostationhandlerif.h"
-#include "cradiopubsub.h"
#include "radiocontroleventlistener.h"
#include "radiordslistener.h"
-#include "cradiorepositorymanager.h"
#include "radioenginewrapperobserver.h"
// Constants
@@ -40,10 +38,10 @@
RadioStationHandlerIf& stationHandler ) :
q_ptr( wrapper ),
mStationHandler( stationHandler ),
- mEngineHandler( new CRadioEngineHandler( *this ) ),
+ mEngineHandler( new RadioEngineHandler( *this ) ),
mControlEventListener( new RadioControlEventListener( *this ) ),
mRdsListener ( new RadioRdsListener( mStationHandler, *this ) ),
- mTuneReason( 0 ),
+ mTuneReason( TuneReason::Unspecified ),
mUseLoudspeaker( false )
{
}
@@ -61,37 +59,23 @@
/*!
* Initializes the private implementation
*/
-void RadioEngineWrapperPrivate::init()
+bool RadioEngineWrapperPrivate::init()
{
- TRAPD( err, mEngineHandler->ConstructL() );
- if ( err != KErrNone ) {
- LOG_FORMAT( "RadioEngineWrapperPrivate::init, EngineHandler construct failed: %d", err );
+ if ( !mEngineHandler->constructEngine() ) {
+ LOG( "RadioEngineWrapperPrivate::init, EngineHandler construct failed" );
mEngineHandler.reset();
- return;
- //TODO: Error handling?
+ return false;
}
- mEngineHandler->SetRdsObserver( mRdsListener.data() );
- mEngineHandler->PubSub().SetControlEventObserver( mControlEventListener.data() );
+ mEngineHandler->setRdsObserver( mRdsListener.data() );
mControlEventListener->init();
- // Start observing profile changes
- mEngineHandler->Repository().AddEntityL( KCRUidProfileEngine,
- KProEngActiveProfile,
- CRadioRepositoryManager::ERadioEntityInt );
-
- mUseLoudspeaker = mEngineHandler->IsAudioRoutedToLoudspeaker();
+ mUseLoudspeaker = mEngineHandler->isAudioRoutedToLoudspeaker();
if ( !mUseLoudspeaker ) {
RUN_NOTIFY_LOOP( mObservers, audioRouteChanged( false ) );
}
-}
-/*!
- * Starts up the radio engine
- */
-bool RadioEngineWrapperPrivate::isEngineConstructed()
-{
- return mEngineHandler != 0;
+ return true;
}
/*!
@@ -101,7 +85,7 @@
{
if ( !mSettings ) {
mSettings.reset( new RadioSettings() );
- mSettings->d_func()->init( &mEngineHandler->ApplicationSettings() );
+ mSettings->d_func()->init( &mEngineHandler->applicationSettings() );
}
return *mSettings;
}
@@ -109,7 +93,7 @@
/*!
* Returns the enginehandler owned by the engine
*/
-CRadioEngineHandler& RadioEngineWrapperPrivate::RadioEnginehandler()
+RadioEngineHandler& RadioEngineWrapperPrivate::radioEnginehandler()
{
return *mEngineHandler;
}
@@ -117,22 +101,11 @@
/*!
* Tunes to the given frequency
*/
-void RadioEngineWrapperPrivate::tuneFrequency( uint frequency, const int reason )
+void RadioEngineWrapperPrivate::setFrequency( uint frequency, const int reason )
{
- if ( mEngineHandler->TunedFrequency() != frequency ) {
+ if ( mEngineHandler->currentFrequency() != frequency ) {
mTuneReason = reason;
- mEngineHandler->Tune( frequency );
- }
-}
-
-/*!
- * Tunes to the given frequency after a delay
- */
-void RadioEngineWrapperPrivate::tuneWithDelay( uint frequency, const int reason )
-{
- if ( mEngineHandler->TunedFrequency() != frequency ) {
- mTuneReason = reason;
- mEngineHandler->TuneWithDelay( frequency );
+ mEngineHandler->setFrequency( frequency );
}
}
@@ -147,10 +120,10 @@
/*!
*
*/
-void RadioEngineWrapperPrivate::startSeeking( Seeking::Direction direction, const int reason )
+void RadioEngineWrapperPrivate::startSeeking( Seek::Direction direction, const int reason )
{
mTuneReason = reason;
- mEngineHandler->Seek( direction );
+ mEngineHandler->seek( direction );
}
/*!
@@ -170,11 +143,13 @@
TInt aError )
{
Q_UNUSED( aReason );
- LOG_FORMAT( "RadioEngineWrapperPrivate::FrequencyEventL - Frequency: %d, Reason: %d, Error: %d", aFrequency, aReason, aError );
+ LOG_FORMAT( "RadioEngineWrapperPrivate::FrequencyEventL - Freq: %d, TuneReason: %d, Err: %d", aFrequency, mTuneReason, aError );
if ( !aError ) {
const uint frequency = static_cast<uint>( aFrequency );
RUN_NOTIFY_LOOP( mObservers, tunedToFrequency( frequency, mTuneReason ) );
+ } else {
+ RUN_NOTIFY_LOOP( mObservers, tunedToFrequency( mEngineHandler->minFrequency(), TuneReason::StationScanNoStationsFound ) ); // no frequencies found
}
}
@@ -225,10 +200,9 @@
/*!
* \reimp
*/
-void RadioEngineWrapperPrivate::SeekingEventL( TInt aSeekingState, TInt aError )
+void RadioEngineWrapperPrivate::SeekingEventL( TInt DEBUGVAR( aSeekingState ), TInt DEBUGVAR( aError ) )
{
- Q_UNUSED( aSeekingState );
- Q_UNUSED( aError );
+ LOG_FORMAT( "RadioEngineWrapperPrivate::SeekingEventL, aSeekingState: %d, Error: %d", aSeekingState, aError );
}
/*!
@@ -268,13 +242,3 @@
// ERadioAudioResourcesAvailable, ///< Audio resources have become available
// ERadioAudioAutoResumeForbidden ///< Audio auto resuming is forbidden
}
-
-/*!
- * \reimp
- */
-void RadioEngineWrapperPrivate::HandleRepositoryValueChangeL( const TUid& aUid, TUint32 aKey, TInt aValue, TInt aError )
-{
- if ( aUid == KCRUidProfileEngine && aKey == KProEngActiveProfile && !aError && aValue == KOfflineProfileId ) {
- LOG( "RadioEngineWrapperPrivate::HandleRepositoryValueChangeL: Offline profile activated" );
- }
-}