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 #ifndef CPHONERINGINGTONECONTROLLER_H |
|
19 #define CPHONERINGINGTONECONTROLLER_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 #include <Profile.hrh> |
|
24 #include "mphoneaudioplayerobserver.h" |
|
25 #include "mphonevideoplayerobserver.h" |
|
26 #include "mphonecoveruiobserver.h" |
|
27 #include "cphoneaudioplayer.h" |
|
28 #include "mphonetimer.h" |
|
29 #include "mphonevideoplayer.h" |
|
30 #include "cphonemediatorsender.h" |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 //class MPhoneRingingToneObserver; |
|
34 class CPhoneAudioPlayer; |
|
35 class CPhoneRingingtonePlayer; |
|
36 class CPhoneTTSPlayer; |
|
37 class MPhoneDisplayProvider; |
|
38 class CPhoneRingingTone; |
|
39 class TPhoneCommandParam; |
|
40 |
|
41 // CLASS DECLARATION |
|
42 |
|
43 /** |
|
44 * It implements ringing tone functionality. |
|
45 * Note that when issuing Play-command to audio side, ALWAYS set the tone type |
|
46 * before the Play() is called. This is to ensure that correct tone is tried to |
|
47 * be played. |
|
48 * |
|
49 * @since 1.0 |
|
50 */ |
|
51 NONSHARABLE_CLASS(CPhoneRingingToneController) : |
|
52 public CBase, |
|
53 private MPhoneVideoPlayerObserver, |
|
54 private MPhoneCoverUiObserver |
|
55 { |
|
56 public: |
|
57 // States for this active object |
|
58 enum TState |
|
59 { |
|
60 EIdleState, |
|
61 EDeletingAudioPlayer, |
|
62 EDeletingVideoPlayer, |
|
63 EPlayingDefaultVideo |
|
64 }; |
|
65 |
|
66 public: |
|
67 |
|
68 /** |
|
69 * Two-phased constructor. |
|
70 * @return new instance. |
|
71 */ |
|
72 IMPORT_C static CPhoneRingingToneController* NewL(); |
|
73 |
|
74 /** |
|
75 * Destructor. |
|
76 */ |
|
77 ~CPhoneRingingToneController(); |
|
78 |
|
79 /** |
|
80 * Play ring tone |
|
81 * @param aCommandParam a command param |
|
82 */ |
|
83 IMPORT_C void PlayRingToneL( TPhoneCommandParam *aCommandParam ); |
|
84 |
|
85 /** |
|
86 * Stops playing the ringing tone. |
|
87 * Method does not do anything if ringing tone is not playing. |
|
88 */ |
|
89 IMPORT_C void StopPlaying(); |
|
90 |
|
91 /** |
|
92 * Continues video playback ( and ringing tone ) with volume 0 |
|
93 * Stream not closed ( If music player was ongoing ) |
|
94 */ |
|
95 IMPORT_C void MuteRingingToneOnAnswer(); |
|
96 |
|
97 /** |
|
98 * Continues video playback with muted audio. |
|
99 * Ringing tone is stopped. |
|
100 */ |
|
101 IMPORT_C void MuteRingingTone(); |
|
102 |
|
103 |
|
104 /** |
|
105 * Sets video player. |
|
106 * @since Series 60 v3.2 |
|
107 * @param aVideoPlayer Video player reference. |
|
108 */ |
|
109 void SetVideoPlayer( MPhoneVideoPlayer* aVideoPlayer ); |
|
110 |
|
111 /** |
|
112 * Play video ring tone. |
|
113 * @since Series 60 3.1 |
|
114 * @param aRingingTone Ringing tone to be played. |
|
115 * @param aVolume Volume used to play the ringing tone. |
|
116 * @param aRingingType Ringing type. |
|
117 */ |
|
118 void PlayVideoRingingTone( |
|
119 const CPhoneRingingTone& aRingingTone, |
|
120 TInt aVolume, |
|
121 TProfileRingingType aRingingType, |
|
122 TBool aPersonalTone = EFalse ); |
|
123 |
|
124 /** |
|
125 * Checks if extended security required. |
|
126 * @since Series 60 3.1 |
|
127 * @return ETrue if extended security is required. |
|
128 */ |
|
129 TBool ExtendedSecurity() const; |
|
130 |
|
131 |
|
132 /** |
|
133 * Command when necessary Cover UI to play video ringing tone. |
|
134 * return ETrue if Cover ui handle video ringing tone playing. |
|
135 * return EFalse if Phone must handle video ringing tone playing. |
|
136 */ |
|
137 TBool CoverUIPlayVideoRingingToneL( |
|
138 const CPhoneRingingTone& aRingingTone ); |
|
139 |
|
140 /** |
|
141 * This function is called when Mediator receives response to the sent |
|
142 * ShowMultiMediaRingingTone command. |
|
143 * @param aStatus - Standard Symbian error code indicating the |
|
144 * success of the command. |
|
145 */ |
|
146 void ShowMultimediaRingingToneResponseL( TInt aStatus ); |
|
147 |
|
148 private: // from MPhoneVideoPlayerObserver |
|
149 |
|
150 /** |
|
151 * HandleVideoPlayerError |
|
152 */ |
|
153 virtual void HandleVideoPlayerError( |
|
154 TPhoneVideoPlayerErrorEvent aEvent, |
|
155 TInt aError ); |
|
156 |
|
157 /** |
|
158 * HandleVideoPlayerInitComplete |
|
159 */ |
|
160 virtual void HandleVideoPlayerInitComplete(); |
|
161 |
|
162 /** |
|
163 * HandleVideoPlayerPlayingComplete |
|
164 */ |
|
165 virtual void HandleVideoPlayerPlayingComplete(); |
|
166 |
|
167 private: |
|
168 |
|
169 /** |
|
170 * C++ default constructor. |
|
171 */ |
|
172 CPhoneRingingToneController(); |
|
173 |
|
174 /** |
|
175 * By default Symbian OS constructor is private. |
|
176 */ |
|
177 void ConstructL(); |
|
178 |
|
179 |
|
180 /** |
|
181 * Convert ringing type from PhoneAppEnging to the ringing type in |
|
182 * MPhoneVideoPlayer. |
|
183 * @since Series 60 3.1 |
|
184 * @param aRingingType the ringing type form PhoneAppEngine. |
|
185 * @return ringing type of MPhoneVideoPlayer. |
|
186 */ |
|
187 MPhoneVideoPlayer::TPlayMode ConvertVideoRingingType( |
|
188 TProfileRingingType aRingingType ); |
|
189 |
|
190 |
|
191 /** |
|
192 * Plays default L1 or L2 video ring tone asynchronously. |
|
193 * @since Series 60 3.1 |
|
194 */ |
|
195 void PlayDefaultVideoAsync(); |
|
196 |
|
197 /** |
|
198 * Deletes video player and plays default L1 or L2 |
|
199 * tone asynchronously. |
|
200 * @since Series 60 3.1 |
|
201 */ |
|
202 void DeleteVideoPlayerAndPlayDefaultAsync(); |
|
203 |
|
204 /** |
|
205 * Mutes the ringing tone. |
|
206 */ |
|
207 void DoMuteRingingTone(); |
|
208 |
|
209 /** |
|
210 * Play audio ring tone |
|
211 */ |
|
212 void PlayAudioRingTone( |
|
213 TInt aVolume, |
|
214 TProfileRingingType aRingingType ); |
|
215 |
|
216 |
|
217 private: // Data |
|
218 |
|
219 // Audio/Video tone |
|
220 CPhoneRingingTone* iAudioVideoRingingTone; |
|
221 |
|
222 // Volume for backup tone playing. |
|
223 TInt iVolume; |
|
224 |
|
225 // Ringing type for backup tone playing. |
|
226 TProfileRingingType iRingingType; |
|
227 |
|
228 // Video ringing tone player |
|
229 MPhoneVideoPlayer* iVideoPlayer; |
|
230 |
|
231 // Pointer to Mediator Sender |
|
232 CPhoneMediatorSender* iMediatorSender; |
|
233 |
|
234 // Active Cover UI command EPhoneCoverUiShowMultimediaRingingTone |
|
235 TBool iActiveCoverUICommand; |
|
236 |
|
237 // Flag. Indicates video scaling capability of the device. |
|
238 TBool iArbitraryVideoScaling; |
|
239 |
|
240 CPhoneRingingtonePlayer* iRingingtonePlayer; |
|
241 |
|
242 CPhoneTTSPlayer* iTTSPlayer; |
|
243 |
|
244 }; |
|
245 |
|
246 #endif // CPHONERINGINGTONECONTROLLER_H |
|
247 |
|
248 // End of File |
|