equal
deleted
inserted
replaced
21 #include "radioenginewrapper_p.h" |
21 #include "radioenginewrapper_p.h" |
22 #include "radiosettings.h" |
22 #include "radiosettings.h" |
23 #include "radiosettings_p.h" |
23 #include "radiosettings_p.h" |
24 #include "radiologger.h" |
24 #include "radiologger.h" |
25 #include "radio_global.h" |
25 #include "radio_global.h" |
26 #include "cradioenginehandler.h" |
26 #include "radioenginehandler.h" |
27 #include "radiostationhandlerif.h" |
27 #include "radiostationhandlerif.h" |
28 #include "radiocontroleventlistener.h" |
28 #include "radiocontroleventlistener.h" |
29 #include "radiordslistener.h" |
29 #include "radiordslistener.h" |
30 #include "radioenginewrapperobserver.h" |
30 #include "radioenginewrapperobserver.h" |
31 |
31 |
36 */ |
36 */ |
37 RadioEngineWrapperPrivate::RadioEngineWrapperPrivate( RadioEngineWrapper* wrapper, |
37 RadioEngineWrapperPrivate::RadioEngineWrapperPrivate( RadioEngineWrapper* wrapper, |
38 RadioStationHandlerIf& stationHandler ) : |
38 RadioStationHandlerIf& stationHandler ) : |
39 q_ptr( wrapper ), |
39 q_ptr( wrapper ), |
40 mStationHandler( stationHandler ), |
40 mStationHandler( stationHandler ), |
41 mEngineHandler( new CRadioEngineHandler( *this ) ), |
41 mEngineHandler( new RadioEngineHandler( *this ) ), |
42 mControlEventListener( new RadioControlEventListener( *this ) ), |
42 mControlEventListener( new RadioControlEventListener( *this ) ), |
43 mRdsListener ( new RadioRdsListener( mStationHandler, *this ) ), |
43 mRdsListener ( new RadioRdsListener( mStationHandler, *this ) ), |
44 mTuneReason( TuneReason::Unspecified ), |
44 mTuneReason( TuneReason::Unspecified ), |
45 mUseLoudspeaker( false ) |
45 mUseLoudspeaker( false ) |
46 { |
46 { |
59 /*! |
59 /*! |
60 * Initializes the private implementation |
60 * Initializes the private implementation |
61 */ |
61 */ |
62 bool RadioEngineWrapperPrivate::init() |
62 bool RadioEngineWrapperPrivate::init() |
63 { |
63 { |
64 TRAPD( err, mEngineHandler->ConstructL() ); |
64 if ( !mEngineHandler->constructEngine() ) { |
65 if ( err != KErrNone ) { |
65 LOG( "RadioEngineWrapperPrivate::init, EngineHandler construct failed" ); |
66 LOG_FORMAT( "RadioEngineWrapperPrivate::init, EngineHandler construct failed: %d", err ); |
|
67 mEngineHandler.reset(); |
66 mEngineHandler.reset(); |
68 return false; |
67 return false; |
69 } |
68 } |
70 |
69 |
71 mEngineHandler->SetRdsObserver( mRdsListener.data() ); |
70 mEngineHandler->setRdsObserver( mRdsListener.data() ); |
72 mControlEventListener->init(); |
71 mControlEventListener->init(); |
73 |
72 |
74 mUseLoudspeaker = mEngineHandler->IsAudioRoutedToLoudspeaker(); |
73 mUseLoudspeaker = mEngineHandler->isAudioRoutedToLoudspeaker(); |
75 if ( !mUseLoudspeaker ) { |
74 if ( !mUseLoudspeaker ) { |
76 RUN_NOTIFY_LOOP( mObservers, audioRouteChanged( false ) ); |
75 RUN_NOTIFY_LOOP( mObservers, audioRouteChanged( false ) ); |
77 } |
76 } |
78 |
77 |
79 return true; |
78 return true; |
84 */ |
83 */ |
85 RadioSettingsIf& RadioEngineWrapperPrivate::settings() |
84 RadioSettingsIf& RadioEngineWrapperPrivate::settings() |
86 { |
85 { |
87 if ( !mSettings ) { |
86 if ( !mSettings ) { |
88 mSettings.reset( new RadioSettings() ); |
87 mSettings.reset( new RadioSettings() ); |
89 mSettings->d_func()->init( &mEngineHandler->ApplicationSettings() ); |
88 mSettings->d_func()->init( &mEngineHandler->applicationSettings() ); |
90 } |
89 } |
91 return *mSettings; |
90 return *mSettings; |
92 } |
91 } |
93 |
92 |
94 /*! |
93 /*! |
95 * Returns the enginehandler owned by the engine |
94 * Returns the enginehandler owned by the engine |
96 */ |
95 */ |
97 CRadioEngineHandler& RadioEngineWrapperPrivate::RadioEnginehandler() |
96 RadioEngineHandler& RadioEngineWrapperPrivate::radioEnginehandler() |
98 { |
97 { |
99 return *mEngineHandler; |
98 return *mEngineHandler; |
100 } |
99 } |
101 |
100 |
102 /*! |
101 /*! |
103 * Tunes to the given frequency |
102 * Tunes to the given frequency |
104 */ |
103 */ |
105 void RadioEngineWrapperPrivate::setFrequency( uint frequency, const int reason ) |
104 void RadioEngineWrapperPrivate::setFrequency( uint frequency, const int reason ) |
106 { |
105 { |
107 if ( mEngineHandler->CurrentFrequency() != frequency ) { |
106 if ( mEngineHandler->currentFrequency() != frequency ) { |
108 mTuneReason = reason; |
107 mTuneReason = reason; |
109 mEngineHandler->SetFrequency( frequency ); |
108 mEngineHandler->setFrequency( frequency ); |
110 } |
109 } |
111 } |
110 } |
112 |
111 |
113 /*! |
112 /*! |
114 * |
113 * |
122 * |
121 * |
123 */ |
122 */ |
124 void RadioEngineWrapperPrivate::startSeeking( Seek::Direction direction, const int reason ) |
123 void RadioEngineWrapperPrivate::startSeeking( Seek::Direction direction, const int reason ) |
125 { |
124 { |
126 mTuneReason = reason; |
125 mTuneReason = reason; |
127 mEngineHandler->Seek( direction ); |
126 mEngineHandler->seek( direction ); |
128 } |
127 } |
129 |
128 |
130 /*! |
129 /*! |
131 * \reimp |
130 * \reimp |
132 */ |
131 */ |
148 |
147 |
149 if ( !aError ) { |
148 if ( !aError ) { |
150 const uint frequency = static_cast<uint>( aFrequency ); |
149 const uint frequency = static_cast<uint>( aFrequency ); |
151 RUN_NOTIFY_LOOP( mObservers, tunedToFrequency( frequency, mTuneReason ) ); |
150 RUN_NOTIFY_LOOP( mObservers, tunedToFrequency( frequency, mTuneReason ) ); |
152 } else { |
151 } else { |
153 RUN_NOTIFY_LOOP( mObservers, tunedToFrequency( mEngineHandler->MinFrequency(), TuneReason::StationScanNoStationsFound ) ); // no frequencies found |
152 RUN_NOTIFY_LOOP( mObservers, tunedToFrequency( mEngineHandler->minFrequency(), TuneReason::StationScanNoStationsFound ) ); // no frequencies found |
154 } |
153 } |
155 } |
154 } |
156 |
155 |
157 /*! |
156 /*! |
158 * \reimp |
157 * \reimp |
199 } |
198 } |
200 |
199 |
201 /*! |
200 /*! |
202 * \reimp |
201 * \reimp |
203 */ |
202 */ |
204 void RadioEngineWrapperPrivate::SeekingEventL( TInt aSeekingState, TInt aError ) |
203 void RadioEngineWrapperPrivate::SeekingEventL( TInt DEBUGVAR( aSeekingState ), TInt DEBUGVAR( aError ) ) |
205 { |
204 { |
206 Q_UNUSED( aSeekingState ); |
205 LOG_FORMAT( "RadioEngineWrapperPrivate::SeekingEventL, aSeekingState: %d, Error: %d", aSeekingState, aError ); |
207 Q_UNUSED( aError ); |
|
208 } |
206 } |
209 |
207 |
210 /*! |
208 /*! |
211 * \reimp |
209 * \reimp |
212 */ |
210 */ |