|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "radiocontroleventlistener.h" |
|
19 #include "radioenginewrapper_p.h" |
|
20 #include "radioenginewrapperobserver.h" |
|
21 #include "radioenginehandler.h" |
|
22 #include "radiologger.h" |
|
23 #include "cradioremcontarget.h" |
|
24 /*! |
|
25 * |
|
26 */ |
|
27 RadioControlEventListener::RadioControlEventListener( RadioEngineWrapperPrivate& engine ) : |
|
28 mEngine( engine ) |
|
29 { |
|
30 } |
|
31 |
|
32 /*! |
|
33 * |
|
34 */ |
|
35 RadioControlEventListener::~RadioControlEventListener() |
|
36 { |
|
37 } |
|
38 |
|
39 /*! |
|
40 * |
|
41 */ |
|
42 void RadioControlEventListener::init() |
|
43 { |
|
44 CRadioRemConTarget* target = NULL; |
|
45 TRAPD( err, target = CRadioRemConTarget::NewL() ); |
|
46 LOG_ASSERT( !err, LOG_FORMAT( "RadioControlEventListener::init Failed with err, %d", err ) ); |
|
47 |
|
48 if ( !err ) { |
|
49 mRemCon.reset( target ); |
|
50 mRemCon->SetControlEventObserver( this ); |
|
51 } |
|
52 } |
|
53 |
|
54 /*! |
|
55 * |
|
56 */ |
|
57 void RadioControlEventListener::StepToChannelL( RadioEngine::TRadioTuneDirection DEBUGVAR( aDirection ) ) |
|
58 { |
|
59 LOG_FORMAT( "RadioControlEventListener::StepToChannelL: direction: %d", aDirection ); |
|
60 } |
|
61 |
|
62 /*! |
|
63 * |
|
64 */ |
|
65 void RadioControlEventListener::SetChannelL( TInt DEBUGVAR( aChannelId ) ) |
|
66 { |
|
67 LOG_FORMAT( "RadioControlEventListener::SetChannelL: Channel: %d", aChannelId ); |
|
68 } |
|
69 |
|
70 /*! |
|
71 * |
|
72 */ |
|
73 void RadioControlEventListener::SeekL( RadioEngine::TRadioTuneDirection aDirection ) |
|
74 { |
|
75 LOG_FORMAT( "RadioControlEventListener::SeekL: Direction: %d", aDirection ); |
|
76 mEngine.startSeeking( aDirection == RadioEngine::ERadioDown ? Seek::Down : Seek::Up ); |
|
77 } |
|
78 |
|
79 /*! |
|
80 * |
|
81 */ |
|
82 void RadioControlEventListener::StepToFrequencyL( RadioEngine::TRadioTuneDirection DEBUGVAR( aDirection ) ) |
|
83 { |
|
84 LOG_FORMAT( "RadioControlEventListener::StepToFrequencyL: Direction: %d", aDirection ); |
|
85 } |
|
86 |
|
87 /*! |
|
88 * |
|
89 */ |
|
90 void RadioControlEventListener::SetFrequencyL( TUint32 DEBUGVAR( aFreq ) ) |
|
91 { |
|
92 LOG_FORMAT( "RadioControlEventListener::SetFrequencyL: Frequency: %d", aFreq ); |
|
93 } |
|
94 |
|
95 /*! |
|
96 * |
|
97 */ |
|
98 void RadioControlEventListener::AdjustVolumeL( RadioEngine::TRadioVolumeSetDirection DEBUGVAR( aDirection ) ) |
|
99 { |
|
100 LOG_FORMAT( "RadioControlEventListener::AdjustVolumeL: Direction: %d", aDirection ); |
|
101 } |
|
102 |
|
103 /*! |
|
104 * |
|
105 */ |
|
106 void RadioControlEventListener::MuteL( TBool aMute ) |
|
107 { |
|
108 LOG_FORMAT( "RadioControlEventListener::MuteL: Mute: %d", aMute ); |
|
109 mEngine.radioEnginehandler().setMute( aMute ); |
|
110 } |
|
111 |
|
112 /*! |
|
113 * |
|
114 */ |
|
115 void RadioControlEventListener::PlayL( TBool aDownPressed ) |
|
116 { |
|
117 if ( aDownPressed ) { |
|
118 mEngine.radioEnginehandler().setMute( false ); |
|
119 } |
|
120 } |
|
121 |
|
122 /*! |
|
123 * |
|
124 */ |
|
125 void RadioControlEventListener::PauseL( TBool aDownPressed ) |
|
126 { |
|
127 if ( aDownPressed ) { |
|
128 mEngine.radioEnginehandler().setMute( true ); |
|
129 } |
|
130 } |
|
131 |
|
132 /*! |
|
133 * |
|
134 */ |
|
135 void RadioControlEventListener::PausePlayL( TBool aDownPressed ) |
|
136 { |
|
137 if ( aDownPressed ) { |
|
138 const bool muted = !mEngine.radioEnginehandler().isMuted(); |
|
139 mEngine.radioEnginehandler().setMute( muted ); |
|
140 } |
|
141 } |
|
142 |
|
143 /*! |
|
144 * |
|
145 */ |
|
146 void RadioControlEventListener::StopL( TBool aDownPressed ) |
|
147 { |
|
148 if ( aDownPressed ) { |
|
149 mEngine.radioEnginehandler().setMute( true ); |
|
150 } |
|
151 } |
|
152 |
|
153 /*! |
|
154 * |
|
155 */ |
|
156 void RadioControlEventListener::ForwardL( TBool aDownPressed ) |
|
157 { |
|
158 if ( aDownPressed ) { |
|
159 RUN_NOTIFY_LOOP( mEngine.observers(), skipNext() ); |
|
160 } |
|
161 } |
|
162 |
|
163 /*! |
|
164 * |
|
165 */ |
|
166 void RadioControlEventListener::FastForwardL( TBool aDownPressed ) |
|
167 { |
|
168 if ( aDownPressed ) { |
|
169 mEngine.startSeeking( Seek::Up ); |
|
170 } |
|
171 } |
|
172 |
|
173 /*! |
|
174 * |
|
175 */ |
|
176 void RadioControlEventListener::BackwardL( TBool aDownPressed ) |
|
177 { |
|
178 if ( aDownPressed ) { |
|
179 RUN_NOTIFY_LOOP( mEngine.observers(), skipPrevious() ); |
|
180 } |
|
181 } |
|
182 |
|
183 /*! |
|
184 * |
|
185 */ |
|
186 void RadioControlEventListener::RewindL( TBool aDownPressed ) |
|
187 { |
|
188 if ( aDownPressed ) { |
|
189 mEngine.startSeeking( Seek::Down ); |
|
190 } |
|
191 } |
|
192 |
|
193 /*! |
|
194 * |
|
195 */ |
|
196 void RadioControlEventListener::ChannelUpL( TBool DEBUGVAR( aDownPressed ) ) |
|
197 { |
|
198 LOG_FORMAT( "RadioControlEventListener::ChannelUpL: Down: %d", aDownPressed ); |
|
199 } |
|
200 |
|
201 /*! |
|
202 * |
|
203 */ |
|
204 void RadioControlEventListener::ChannelDownL( TBool DEBUGVAR( aDownPressed ) ) |
|
205 { |
|
206 LOG_FORMAT( "RadioControlEventListener::ChannelDownL: Down: %d", aDownPressed ); |
|
207 } |
|
208 |
|
209 /*! |
|
210 * |
|
211 */ |
|
212 void RadioControlEventListener::VolumeUpL( TBool aDownPressed ) |
|
213 { |
|
214 if ( aDownPressed ) { |
|
215 RUN_NOTIFY_LOOP( mEngine.observers(), increaseVolume() ); |
|
216 } |
|
217 } |
|
218 |
|
219 /*! |
|
220 * |
|
221 */ |
|
222 void RadioControlEventListener::VolumeDownL( TBool aDownPressed ) |
|
223 { |
|
224 if ( aDownPressed ) { |
|
225 RUN_NOTIFY_LOOP( mEngine.observers(), decreaseVolume() ); |
|
226 } |
|
227 } |
|
228 |
|
229 /*! |
|
230 * |
|
231 */ |
|
232 void RadioControlEventListener::ChangeViewL( TUid DEBUGVAR( aViewId ), TBool DEBUGVAR( aForceChange ) ) |
|
233 { |
|
234 LOG_FORMAT( "RadioControlEventListener::ChangeViewL: View: %d, Force: %d", aViewId, aForceChange ); |
|
235 } |
|
236 |
|
237 /*! |
|
238 * |
|
239 */ |
|
240 void RadioControlEventListener::SetAudioRouteL( RadioEngine::TRadioAudioRoute DEBUGVAR( aRoute ) ) |
|
241 { |
|
242 LOG_FORMAT( "RadioControlEventListener::SetAudioOutputDestinationL: Destinatio: %d", aRoute ); |
|
243 } |
|
244 |
|
245 /*! |
|
246 * |
|
247 */ |
|
248 void RadioControlEventListener::AnswerEndCallL() |
|
249 { |
|
250 RUN_NOTIFY_LOOP( mEngine.observers(), skipNext() ); |
|
251 } |