|
1 /* |
|
2 * Copyright (c) 2005 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: volume handling |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef BTMCVOLUME_H |
|
20 #define BTMCVOLUME_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <e32property.h> |
|
25 #include "btmcactive.h" |
|
26 |
|
27 class CBtmcPhoneStatus; |
|
28 |
|
29 /** |
|
30 * CBtmcVolume listens network status events (from RMobilePhone). |
|
31 */ |
|
32 NONSHARABLE_CLASS(CBtmcVolume) : public CBase, public MBtmcActiveObserver |
|
33 { |
|
34 public: |
|
35 /** |
|
36 * Two-phased constructor. |
|
37 */ |
|
38 static CBtmcVolume* NewL(CBtmcPhoneStatus& aParent); |
|
39 |
|
40 /** |
|
41 * Destructor. |
|
42 */ |
|
43 ~CBtmcVolume(); |
|
44 |
|
45 void SetSpeakerVolumeL(TInt aHfVol); |
|
46 |
|
47 void SetMicrophoneVolumeL(TInt aHfVol); |
|
48 |
|
49 TInt GetVolume(); |
|
50 |
|
51 void ActivateRemoteVolumeControl(); |
|
52 |
|
53 void DeActivateRemoteVolumeControl(); |
|
54 |
|
55 private: // From MBtmcActiveObserver |
|
56 |
|
57 void RequestCompletedL(CBtmcActive& aActive, TInt aErr); |
|
58 |
|
59 void CancelRequest(TInt aServiceId); |
|
60 |
|
61 private: |
|
62 |
|
63 /** |
|
64 * C++ default constructor. |
|
65 */ |
|
66 CBtmcVolume(CBtmcPhoneStatus& aParent); |
|
67 |
|
68 /** |
|
69 * C++ default constructor. |
|
70 */ |
|
71 void ConstructL(); |
|
72 |
|
73 void DoSetSpeakerVolL( TInt aPrevPhVol ); |
|
74 |
|
75 /** |
|
76 * Converts volume level (0..15 to 0..10). |
|
77 * @param aVolume Volume level |
|
78 * @return TInt |
|
79 */ |
|
80 TInt HfToPhoneVolScale(TInt aHfVol); |
|
81 |
|
82 /** |
|
83 * Converts volume level (0..10 to 0..15). |
|
84 * @param aVolume Volume level |
|
85 * @return TInt |
|
86 */ |
|
87 TInt PhoneToHfVolScale(TInt aPhoneVol); |
|
88 |
|
89 TInt GetNewPhoneVol(); |
|
90 |
|
91 private: |
|
92 enum TVolSyncAction |
|
93 { |
|
94 ESpeakerVolSubscribe, |
|
95 ESpeakerVolSet, |
|
96 }; |
|
97 |
|
98 private: |
|
99 CBtmcPhoneStatus& iParent; |
|
100 |
|
101 CBtmcActive* iActive; // owned |
|
102 |
|
103 RProperty iVolLevelProperty; // owned |
|
104 RProperty iVolKeyEventProperty; // owned |
|
105 |
|
106 // current volume level of speaker |
|
107 TInt iPhnSpkrVol; // phone speaker volume |
|
108 TInt iAccSpkrVol; // Acc speaker volume in phone side scale |
|
109 TInt iMaxSpkrVol; // Maximum volume level of the phone |
|
110 TInt iStep; |
|
111 TVolSyncAction iAction; |
|
112 |
|
113 TBool iVolCtrlActivated; |
|
114 }; |
|
115 |
|
116 |
|
117 #endif // BTMCVOLUME_H |
|
118 |
|
119 // End of File |
|
120 |