|
1 /* |
|
2 * Copyright (c) 2007 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: Provides means for confirmation query and availability |
|
15 indications. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef C_MUSINDICATORAPI_H |
|
22 #define C_MUSINDICATORAPI_H |
|
23 |
|
24 |
|
25 #include "musindicatorobserver.h" |
|
26 #include "musunittesting.h" |
|
27 #include "mussoundplayerobserver.h" |
|
28 #include <e32base.h> |
|
29 #include <e32property.h> |
|
30 |
|
31 |
|
32 class CMusIndicatorDsa; |
|
33 class CAknGlobalMsgQuery; |
|
34 class CMusSoundPlayer; |
|
35 |
|
36 |
|
37 /** |
|
38 * MusIndicatorApi provides means to show notes and indicate availability |
|
39 * of videosharing to user. |
|
40 * |
|
41 * @code |
|
42 * // Shows roaming activation query |
|
43 * if ( MusIndicatorApi::ConfirmationQueryL( |
|
44 * MusIndicatorApi::EVsRoamingActivationQuery ) ) |
|
45 * { |
|
46 * // respond to user response "yes" |
|
47 * } |
|
48 * else |
|
49 * { |
|
50 * // respond to user response "no" |
|
51 * } |
|
52 * @endcode |
|
53 * |
|
54 * @lib musindicator.lib |
|
55 */ |
|
56 class CMusIndicatorApi : public CActive, MMusSoundPlayerObserver |
|
57 { |
|
58 |
|
59 public: |
|
60 |
|
61 /** Different notes */ |
|
62 enum TVsPopupQuery |
|
63 { |
|
64 EVsRoamingActivationQuery /** |
|
65 * Displays a query prompting for |
|
66 * activation of VS when roaming. |
|
67 */ |
|
68 }; |
|
69 |
|
70 /** |
|
71 * Two-phased constructor. |
|
72 * |
|
73 * @param aObserver Reference to observer interface. |
|
74 * return Pointer to newly created instance of CMusIndicatorApi. |
|
75 */ |
|
76 IMPORT_C static CMusIndicatorApi* NewL( |
|
77 MMusIndicatorObserver& aObserver ); |
|
78 |
|
79 /** |
|
80 * Two-phased constructor. |
|
81 * |
|
82 * @param aObserver Reference to observer interface. |
|
83 * return Pointer to newly created instance of CMusIndicatorApi. |
|
84 */ |
|
85 IMPORT_C static CMusIndicatorApi* NewLC( |
|
86 MMusIndicatorObserver& aObserver ); |
|
87 |
|
88 |
|
89 /** |
|
90 * Two-phased constructor. |
|
91 * |
|
92 * return Pointer to newly created instance of CMusIndicatorApi. |
|
93 */ |
|
94 IMPORT_C static CMusIndicatorApi* NewL(); |
|
95 |
|
96 /** |
|
97 * Destructor. |
|
98 */ |
|
99 ~CMusIndicatorApi(); |
|
100 |
|
101 /** |
|
102 * Shows a global query to user. |
|
103 * |
|
104 * @param aQuery Identifies displayed query. |
|
105 * @return Boolean value indicating if user accepted the query. |
|
106 */ |
|
107 IMPORT_C static TBool ConfirmationQueryL( TVsPopupQuery aQuery ); |
|
108 |
|
109 /** |
|
110 * Indicates availability of video sharing. |
|
111 */ |
|
112 IMPORT_C void IndicateAvailabilityL(); |
|
113 |
|
114 protected: |
|
115 |
|
116 // from base class CActive. |
|
117 |
|
118 /** |
|
119 * From CActive. |
|
120 * Handles completion of an outstanding asynchronous request. |
|
121 */ |
|
122 virtual void RunL(); |
|
123 |
|
124 /** |
|
125 * From CActive. |
|
126 * Cancels an outstanding asynchronous request. |
|
127 */ |
|
128 virtual void DoCancel(); |
|
129 |
|
130 /** |
|
131 * From CActive. |
|
132 * Handles a leave occurring in the request completion event handler RunL. |
|
133 * |
|
134 * @param aError Error code of occured leave. |
|
135 */ |
|
136 virtual TInt RunError( TInt aError ); |
|
137 |
|
138 // from base class MMusSoundPlayerObserver. |
|
139 |
|
140 /** |
|
141 * From MMusSoundPlayerObserver. |
|
142 * Notifies of sound playing complete. |
|
143 * |
|
144 * @param aError Errorcode associated with playback. |
|
145 */ |
|
146 virtual void PlaySoundComplete( TInt aError ); |
|
147 |
|
148 private: |
|
149 |
|
150 CMusIndicatorApi( MMusIndicatorObserver* aObserver ); |
|
151 |
|
152 void ConstructL(); |
|
153 |
|
154 /** |
|
155 * Indicating availability of VS. |
|
156 * |
|
157 * @param aShown ETrue set indicator on and EFalse to Indicator off. |
|
158 */ |
|
159 void Indicator( TBool aShown ); |
|
160 |
|
161 /** |
|
162 * Plays indication tone. |
|
163 */ |
|
164 void PlayToneL(); |
|
165 |
|
166 /** |
|
167 * Returns text from a resource file for a specified note/query. |
|
168 * |
|
169 * @param aQuery Identifies displayed query. |
|
170 * @return Text associated with specified query. Ownership is transferred. |
|
171 */ |
|
172 static HBufC* NoteTextLC( TVsPopupQuery aQuery ); |
|
173 |
|
174 /** |
|
175 * Asynchronous query. Result returned via observer interface. |
|
176 */ |
|
177 void ShowLiveSharingQueryL( TBool aPlayTone ); |
|
178 |
|
179 static TInt LiveSharingQueryTimeout( TAny* aThis ); |
|
180 |
|
181 void StartLiveSharingL(); |
|
182 void ToggleIndicatorL(); |
|
183 TBool IsSubscriber() const; |
|
184 |
|
185 |
|
186 private: // data |
|
187 |
|
188 /** |
|
189 * Pointer to indicator window |
|
190 * Own. |
|
191 */ |
|
192 CMusIndicatorDsa* iIndicatorWindow; |
|
193 |
|
194 /** |
|
195 * Pointer to global msg query. |
|
196 * Own. |
|
197 */ |
|
198 CAknGlobalMsgQuery* iQuery; |
|
199 |
|
200 /** |
|
201 * Sound player. |
|
202 * Own. |
|
203 */ |
|
204 CMusSoundPlayer* iSoundPlayer; |
|
205 |
|
206 /** |
|
207 * Reference to observer interface. |
|
208 * Own. |
|
209 */ |
|
210 MMusIndicatorObserver* iObserver; |
|
211 |
|
212 CPeriodic* iLiveSharingQueryTimeout; |
|
213 |
|
214 RProperty iProperty; |
|
215 |
|
216 MUS_UNITTEST( UT_CMusIndicatorApi ) |
|
217 |
|
218 }; |
|
219 |
|
220 #endif // C_MUSINDICATORAPI_H |