|
1 /* |
|
2 * Copyright (c) 2005-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: This class implements legacy volume control of AVRCP Controller. |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef BTRCCLEGACYVOLUMELEVELCONTROLLER_H |
|
20 #define BTRCCLEGACYVOLUMELEVELCONTROLLER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <remconcoreapicontrollerobserver.h> |
|
25 #include <bttypes.h> // BT protocol wide types |
|
26 #include "btrccVolumeLevelControllerBase.h" |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CRemConInterfaceSelector; |
|
30 class CRemConCoreApiController; |
|
31 class CBTRCCActive; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 |
|
36 NONSHARABLE_CLASS(CBTRCCLegacyVolumeLevelController) : |
|
37 public CBTRCCVolumeLevelControllerBase, |
|
38 public MRemConCoreApiControllerObserver |
|
39 { |
|
40 public: // Constructors and destructor |
|
41 |
|
42 /** |
|
43 * Two-phased constructor. |
|
44 * |
|
45 */ |
|
46 static CBTRCCLegacyVolumeLevelController* NewL(CRemConInterfaceSelector& aInterfaceSelector, MBTRCCVolumeControllerObserver& aObserver); |
|
47 |
|
48 /** |
|
49 * Destructor. |
|
50 */ |
|
51 virtual ~CBTRCCLegacyVolumeLevelController(); |
|
52 |
|
53 private: |
|
54 enum TState |
|
55 { |
|
56 EStateWaitingForVolumeLevelChanges, |
|
57 EStateDelay, |
|
58 EStateVolumeUpTiming, |
|
59 EStateVolumeUp, |
|
60 EStateVolumeDownTiming, |
|
61 EStateVolumeDown, |
|
62 }; |
|
63 |
|
64 /** |
|
65 * C++ default constructor. |
|
66 */ |
|
67 CBTRCCLegacyVolumeLevelController(MBTRCCVolumeControllerObserver& aObserver); |
|
68 |
|
69 /** |
|
70 * Symbian 2nd phase constructor. |
|
71 */ |
|
72 void ConstructL(CRemConInterfaceSelector& aInterfaceSelector); |
|
73 |
|
74 /** |
|
75 * Decides the next operation for volume controlling |
|
76 */ |
|
77 void DoRemoteControl(); |
|
78 |
|
79 /** |
|
80 * Starts a timer. The timeout value is specified by aInterval |
|
81 */ |
|
82 void StartTimer(TInt aInterval); |
|
83 |
|
84 /** |
|
85 * Send a volume up or down command decided by aDirection. |
|
86 */ |
|
87 void SendVolumeCommand(TInt aDirection); |
|
88 |
|
89 public: // From CBTRCCVolumeLevelControllerBase |
|
90 void DoStart(TInt aInitialVolume); // Starts monitoring for volume level changes. |
|
91 void DoStop(); // Stop monitoring for volume level changes. |
|
92 void DoReset(); // Reset the volume level. |
|
93 |
|
94 public: // From MBTRCCActiveObserver |
|
95 void RequestCompletedL(CBTRCCActive& aActive, TInt aErr); |
|
96 void CancelRequest(TInt aServiceId); |
|
97 |
|
98 private: // From CBTRCCVolumeLevelControllerBase |
|
99 void AdjustRemoteVolume(TInt aVolume); |
|
100 TInt GetPhoneVolume(TInt &aVol); |
|
101 |
|
102 private: // From MRemConCoreApiControllerObserver |
|
103 TInt MrccacoResponse(); |
|
104 |
|
105 private: // Data |
|
106 CRemConCoreApiController* iRemConVolController; // changes the accessory's volume level. |
|
107 |
|
108 TUint iNumRemotes; |
|
109 TState iState; |
|
110 |
|
111 TInt iPhoneVolume; // target volume level |
|
112 TInt iCurrentPhoneVolume; // current volume level of phone |
|
113 TInt iCurrentRemoteVolume; // current volume level of remote |
|
114 TInt iLocalMaxVolume; // maximum volume level of phone |
|
115 |
|
116 // Active object for various timers and volume control operation. |
|
117 CBTRCCActive *iBtrccLegacyVolumeActive; |
|
118 |
|
119 // Not owned |
|
120 CRemConInterfaceSelector *iInterfaceSelector; |
|
121 |
|
122 RTimer iCtrlRTimer; |
|
123 }; |
|
124 |
|
125 #endif // BTRCCLEGACYVOLUMELEVELCONTROLLER_H |
|
126 |
|
127 // End of File |