|
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: Implements the class CSPAudioHandler |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <e32base.h> |
|
19 #include "tmstelephonycenrep.h" |
|
20 |
|
21 #ifdef _USE_TELEPHONY_CENREP_ |
|
22 #include <telmicmutestatuspskeys.h> |
|
23 #include <telincallvolcntrlcrkeys.h> |
|
24 #else |
|
25 const TUid KCRUidInCallVolume = {0x102828B1}; |
|
26 const TUint32 KTelIncallEarVolume = 0x00000001; |
|
27 const TUint32 KTelIncallLoudspeakerVolume = 0x00000002; |
|
28 #endif |
|
29 |
|
30 #include "cspaudiohandler.h" |
|
31 #include "cspcenreplistener.h" |
|
32 #include "tmsutility.h" |
|
33 |
|
34 using namespace TMS; |
|
35 // --------------------------------------------------------------------------- |
|
36 // CSPAudioHandler::NewL. |
|
37 // --------------------------------------------------------------------------- |
|
38 // |
|
39 CSPAudioHandler* CSPAudioHandler::NewL(TMSServer* aServer) |
|
40 { |
|
41 TRACE_PRN_FN_ENT; |
|
42 CSPAudioHandler* self = new (ELeave) CSPAudioHandler(aServer); |
|
43 CleanupStack::PushL(self); |
|
44 self->ConstructL(); |
|
45 CleanupStack::Pop(self); |
|
46 TRACE_PRN_FN_EXT; |
|
47 return self; |
|
48 } |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // Destructs the object by canceling first ongoing monitoring. |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 CSPAudioHandler::~CSPAudioHandler() |
|
55 { |
|
56 TRACE_PRN_FN_ENT; |
|
57 delete iIncallLoudspeakerVolumeListener; |
|
58 delete iIncallEarVolumeListener; |
|
59 TRACE_PRN_FN_EXT; |
|
60 } |
|
61 |
|
62 // --------------------------------------------------------------------------- |
|
63 // CSPAudioHandler::SetLoudSpeakerVol |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 void CSPAudioHandler::SetLoudSpeakerVol(TInt vol) |
|
67 { |
|
68 if (iIncallLoudspeakerVolumeListener) |
|
69 { |
|
70 iIncallLoudspeakerVolumeListener->Set(vol); |
|
71 } |
|
72 } |
|
73 |
|
74 // --------------------------------------------------------------------------- |
|
75 // CSPAudioHandler::SetEarPieceVol |
|
76 // --------------------------------------------------------------------------- |
|
77 // |
|
78 void CSPAudioHandler::SetEarPieceVol(TInt vol) |
|
79 { |
|
80 if (iIncallEarVolumeListener) |
|
81 { |
|
82 iIncallEarVolumeListener->Set(vol); |
|
83 } |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------------------------- |
|
87 // From MCSPCenRepObserver |
|
88 // CSPAudioHandler::HandleNotifyCenRepL |
|
89 // --------------------------------------------------------------------------- |
|
90 // |
|
91 void CSPAudioHandler::HandleNotifyCenRepL(const TUid /*aUid*/, |
|
92 const TUint32 aKey, TInt aVal) |
|
93 { |
|
94 TRACE_PRN_FN_ENT; |
|
95 if (aKey == KTelIncallLoudspeakerVolume) |
|
96 { |
|
97 iTMSSer->SetLevel(NULL,FALSE, aVal); |
|
98 } |
|
99 else if (aKey == KTelIncallEarVolume) |
|
100 { |
|
101 iTMSSer->SetLevel(NULL,FALSE, aVal); |
|
102 } |
|
103 TRACE_PRN_FN_EXT; |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 // Constructs the monitor. |
|
108 // --------------------------------------------------------------------------- |
|
109 // |
|
110 CSPAudioHandler::CSPAudioHandler(TMSServer* aServer) : |
|
111 iTMSSer(aServer) |
|
112 { |
|
113 TRACE_PRN_FN_ENT; |
|
114 iCallCount = 0; // Active calls count |
|
115 TRACE_PRN_FN_EXT; |
|
116 } |
|
117 |
|
118 // --------------------------------------------------------------------------- |
|
119 // Second phase construction. |
|
120 // --------------------------------------------------------------------------- |
|
121 // |
|
122 void CSPAudioHandler::ConstructL() |
|
123 { |
|
124 TRACE_PRN_FN_ENT; |
|
125 |
|
126 iIncallLoudspeakerVolumeListener = CSPCenRepListener::NewL( |
|
127 KCRUidInCallVolume, KTelIncallLoudspeakerVolume, this); |
|
128 |
|
129 iIncallEarVolumeListener = CSPCenRepListener::NewL(KCRUidInCallVolume, |
|
130 KTelIncallEarVolume, this); |
|
131 |
|
132 // Initialize audio volumes |
|
133 TInt volEar; |
|
134 TInt volLoud; |
|
135 |
|
136 TInt volGetRes = iIncallEarVolumeListener->Get(volEar); |
|
137 volGetRes = iIncallLoudspeakerVolumeListener->Get(volLoud); |
|
138 |
|
139 TRACE_PRN_FN_EXT; |
|
140 } |
|
141 |
|
142 // End of file |