|
1 /* |
|
2 * Copyright (c) 2007-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: Declarations for class CSPAudioHandler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CSPAUDIOHANDLER_H |
|
20 #define CSPAUDIOHANDLER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <sounddevice.h> |
|
24 |
|
25 #include "mcsppubsubobserver.h" |
|
26 #include "mcspcenrepobserver.h" |
|
27 |
|
28 |
|
29 class CSPPubSubListener; |
|
30 class CSPCenRepListener; |
|
31 class CSPAudioStreams; |
|
32 |
|
33 /** |
|
34 * Handles call adding from calls not done by the plugin. |
|
35 * |
|
36 */ |
|
37 class CSPAudioHandler: public CBase, |
|
38 public MCSPPubSubObserver, |
|
39 public MCSPCenRepObserver, |
|
40 public MDevSoundObserver |
|
41 { |
|
42 |
|
43 public: //Constructors and descructor |
|
44 |
|
45 /** |
|
46 * Two-phased constructing for the monitor. |
|
47 * |
|
48 * @param aObserver the observer for getting notification |
|
49 * @param aLine the line to monitor |
|
50 * @param aLineId line identifier |
|
51 */ |
|
52 static CSPAudioHandler* NewL( ); |
|
53 |
|
54 /** |
|
55 * C++ default destructor. |
|
56 */ |
|
57 virtual ~CSPAudioHandler( ); |
|
58 |
|
59 /** |
|
60 * Start audio streams. |
|
61 */ |
|
62 void Start(); |
|
63 |
|
64 /** |
|
65 * Stop audio streams. |
|
66 */ |
|
67 void Stop(); |
|
68 |
|
69 /** |
|
70 * From base class MCSPPubSubObserver. |
|
71 * Handler for changed event. |
|
72 * @param aUid uid of setting |
|
73 * @param aKey id of setting |
|
74 * @param aStatus status of completed AO operation |
|
75 */ |
|
76 virtual void HandleNotifyPSL( const TUid aUid, const TInt& aKey, |
|
77 const TRequestStatus& aStatus ); |
|
78 |
|
79 /** |
|
80 * From base class MCSPCenRepObserver. |
|
81 * Handler for changed event. |
|
82 * @param aUid uid of setting |
|
83 * @param aVal value |
|
84 */ |
|
85 virtual void CSPAudioHandler::HandleNotifyCenRepL( |
|
86 const TUid aUid, |
|
87 const TUint32 aKey, |
|
88 TInt aVal ); |
|
89 |
|
90 protected: //From DevSound |
|
91 |
|
92 /** |
|
93 * Handles DevDound initialization completion event. |
|
94 * @param aError. KErrNone if successful. Other values are possible |
|
95 * indicating a problem initializing CMMFDevSound object. |
|
96 */ |
|
97 void InitializeComplete( TInt aError ); |
|
98 |
|
99 /** |
|
100 * Handles CMMFDevSound object's data request event. |
|
101 * @param aBuffer. Buffer to be filled |
|
102 */ |
|
103 void BufferToBeFilled( CMMFBuffer* aBuffer ); |
|
104 |
|
105 /** |
|
106 * Handles play completion or cancel event. |
|
107 * @param aError. The status of playback |
|
108 */ |
|
109 void PlayError( TInt aError ); |
|
110 |
|
111 /** |
|
112 * Not Supported |
|
113 */ |
|
114 void ToneFinished( TInt aError ); |
|
115 |
|
116 /** |
|
117 * Not supported. |
|
118 */ |
|
119 void BufferToBeEmptied( CMMFBuffer* aBuffer ); |
|
120 |
|
121 /** |
|
122 * Not supported. |
|
123 */ |
|
124 void RecordError( TInt aError ); |
|
125 |
|
126 /** |
|
127 * Not supported. |
|
128 */ |
|
129 void ConvertError( TInt aError ); |
|
130 |
|
131 /** |
|
132 * Not supported. |
|
133 */ |
|
134 void DeviceMessage( TUid aMessageType, const TDesC8& aMsg ); |
|
135 |
|
136 protected: // From CActive |
|
137 /** |
|
138 * From CActive |
|
139 * RunL |
|
140 */ |
|
141 void RunL(); |
|
142 |
|
143 /** |
|
144 * From CActive |
|
145 * Catches errors if RunL leaves |
|
146 * @param aError error code |
|
147 * @return error code |
|
148 */ |
|
149 TInt RunError( TInt aError ); |
|
150 |
|
151 /** |
|
152 * From CActive |
|
153 * Cancels the monitor |
|
154 */ |
|
155 void DoCancel(); |
|
156 |
|
157 private: |
|
158 /** |
|
159 * C++ default constructor |
|
160 * @param aObserver the observer for status change (incoming call) |
|
161 * @param aLine the line associated with the call |
|
162 * @param aLineId line identifier |
|
163 */ |
|
164 CSPAudioHandler( ); |
|
165 |
|
166 /** |
|
167 * Constructs the monitor in the second phase. |
|
168 */ |
|
169 void ConstructL(); |
|
170 |
|
171 private: // data |
|
172 |
|
173 /** |
|
174 * Mute listening from Publish&Subscribe. |
|
175 */ |
|
176 CSPPubSubListener* iMuteListener; |
|
177 |
|
178 /** |
|
179 * Incall loudspeaker listening from Central Repository. |
|
180 */ |
|
181 CSPCenRepListener* iIncallLoudspeakerVolumeListener; |
|
182 |
|
183 /** |
|
184 * Incall ear volume listening from Central Repository. |
|
185 */ |
|
186 CSPCenRepListener* iIncallEarVolumeListener; |
|
187 |
|
188 /** |
|
189 * Audio streams handler. |
|
190 */ |
|
191 CSPAudioStreams* iAudioStreams; |
|
192 |
|
193 /** |
|
194 * Call count |
|
195 */ |
|
196 TInt iCallCount; |
|
197 }; |
|
198 |
|
199 #endif // CSPAUDIOHANDLER_H |