|
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: This file defines class CFSMailSoundHandler. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __FSMAILSOUNDHANDLER_H |
|
21 #define __FSMAILSOUNDHANDLER_H |
|
22 |
|
23 #include <e32std.h> |
|
24 |
|
25 #include <mdaaudiosampleplayer.h> |
|
26 |
|
27 // <cmail> |
|
28 //#include <oem/MProfileEngine.h> |
|
29 //#include <oem/MProfileChangeObserver.h> |
|
30 #include <MProfileEngine.h> |
|
31 #include <MProfileChangeObserver.h> |
|
32 // </cmail> |
|
33 |
|
34 |
|
35 #include "fsnotificationhandlerbase.h" |
|
36 #include "fsnotificationhandlertimerobserver.h" |
|
37 |
|
38 class CProfileChangeNotifyHandler; |
|
39 class CHWRMVibra; |
|
40 class CFSNotificationHandlerTimer; |
|
41 |
|
42 |
|
43 /** |
|
44 * Class to handle email sound playing. |
|
45 * A handler for observing inputs into email framework, playing a sound |
|
46 * if a message addition is performed on a Inbox folder. |
|
47 * |
|
48 * @code |
|
49 * ?good_class_usage_example(s) |
|
50 * @endcode |
|
51 * |
|
52 * @lib ?library |
|
53 * @since S60 ?S60_version *** for example, S60 v3.0 |
|
54 */ |
|
55 class CFSMailSoundHandler : public CFSNotificationHandlerBase, |
|
56 public MFSNotificationHandlerTimerObserver, |
|
57 public MMdaAudioPlayerCallback, |
|
58 public MProfileChangeObserver |
|
59 { |
|
60 public: |
|
61 |
|
62 /** |
|
63 * Two-phased constructor. |
|
64 * @param aMailClient Object to access email framework |
|
65 * @param aOwner Owner and manager of this handler. NULL if not |
|
66 * specified. |
|
67 */ |
|
68 static CFSMailSoundHandler* NewL( MFSNotificationHandlerMgr& aOwner ); |
|
69 virtual ~CFSMailSoundHandler(); |
|
70 |
|
71 void RefreshData(); |
|
72 |
|
73 // From base class MFSNotificationHandlerTimerObserver |
|
74 virtual void TimerCallBackL( TInt aError ); |
|
75 |
|
76 // from base class CFSNotificationHandlerBase |
|
77 virtual void HandleEventL( |
|
78 TFSMailEvent aEvent, |
|
79 TFSMailMsgId aMailbox, |
|
80 TAny* aParam1, |
|
81 TAny* aParam2, |
|
82 TAny* aParam3 ); |
|
83 |
|
84 protected: |
|
85 |
|
86 // from base class MProfileChangeObserver |
|
87 virtual void HandleActiveProfileEventL( TProfileEvent aPE, TInt id ); |
|
88 |
|
89 // from base class MMdaAudioPlayerCallback |
|
90 virtual void MapcInitComplete( |
|
91 TInt aError, |
|
92 const TTimeIntervalMicroSeconds& /*aInterval*/ ); |
|
93 virtual void MapcPlayComplete( TInt aError ); |
|
94 |
|
95 private: |
|
96 |
|
97 /** |
|
98 * Constructor. |
|
99 * |
|
100 * @since S60 ?S60_version |
|
101 * @param aOwner Owner and manager of this handler. |
|
102 */ |
|
103 CFSMailSoundHandler( MFSNotificationHandlerMgr& aOwner ); |
|
104 void ConstructL(); |
|
105 |
|
106 void Init(); |
|
107 void Close(); |
|
108 void Sound(); |
|
109 void Resume(); |
|
110 TInt SetAudioPlayerL( bool def ); |
|
111 /** |
|
112 * Fetches the sound and volume for received messagetype |
|
113 * @since Series60 2.1 |
|
114 * @param aProfile Current profile. |
|
115 * @param aSound The variable to store the soundfile information |
|
116 * @param aVolume The variable to store the volume |
|
117 * @return KErrNone when no problems found |
|
118 */ |
|
119 TInt GetSoundFileAndVolumeL( |
|
120 const MProfile& aProfile, |
|
121 TFileName& aSound, |
|
122 TInt& aVolume ) const; |
|
123 TInt ToneVolume( const MProfile& aProfile ) const; |
|
124 |
|
125 // from base class CFSNotificationHandlerBase |
|
126 virtual void TurnNotificationOn(); |
|
127 virtual void TurnNotificationOff(); |
|
128 |
|
129 private: // data |
|
130 |
|
131 enum TTasks |
|
132 { |
|
133 EInit = 1, |
|
134 ESound, |
|
135 EWait, |
|
136 EDefault, |
|
137 EPending, |
|
138 EReset |
|
139 }; |
|
140 |
|
141 TInt iVolume; |
|
142 TTasks iNextState; |
|
143 TTasks iPending; |
|
144 TTasks iReset; |
|
145 CMdaAudioPlayerUtility* iAudioPlayer; |
|
146 MProfileEngine* iProfileEngine; |
|
147 CProfileChangeNotifyHandler* iHandler; |
|
148 CHWRMVibra* iVibra; |
|
149 |
|
150 /** |
|
151 * Timer service. |
|
152 * Own. |
|
153 */ |
|
154 CFSNotificationHandlerTimer* iTimer; |
|
155 }; |
|
156 |
|
157 |
|
158 #endif __FSMAILSOUNDHANDLER_H |