|
1 /* |
|
2 * Copyright (c) 2005-2006 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 volume control of AVRCP Controller. |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef BTRCCABSOLUTEVOLUMELEVELCONTROLLER_H |
|
21 #define BTRCCABSOLUTEVOLUMELEVELCONTROLLER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <bttypes.h> // BT protocol wide types |
|
26 #include "btrccVolumeLevelControllerBase.h" |
|
27 #include "absolutevolumeapicontrollerobserver.h" |
|
28 #include "absolutevolumeapicontroller.h" |
|
29 #include "absolutevolumeapitargetobserver.h" |
|
30 //#include <remconinterfaceselector.h> |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CRemConInterfaceSelector; |
|
34 class CRemConCoreApiController; |
|
35 class CBTRCCActive; |
|
36 |
|
37 // CLASS DECLARATION |
|
38 |
|
39 /** |
|
40 * A listener for incoming handsfree attachments/detachments. |
|
41 */ |
|
42 NONSHARABLE_CLASS(CBTRCCAbsoluteVolumeLevelController) : |
|
43 public CBTRCCVolumeLevelControllerBase, |
|
44 public MRemConAbsoluteVolumeControllerObserver |
|
45 { |
|
46 public: // Constructors and destructor |
|
47 |
|
48 /** |
|
49 * Two-phased constructor. |
|
50 * |
|
51 */ |
|
52 static CBTRCCAbsoluteVolumeLevelController* NewL(CRemConInterfaceSelector& aInterfaceSelector, MBTRCCVolumeControllerObserver& aObserver); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 virtual ~CBTRCCAbsoluteVolumeLevelController(); |
|
58 |
|
59 |
|
60 private: |
|
61 |
|
62 /** |
|
63 * C++ default constructor. |
|
64 */ |
|
65 CBTRCCAbsoluteVolumeLevelController(MBTRCCVolumeControllerObserver& aObserver); |
|
66 |
|
67 /** |
|
68 * Symbian 2nd phase constructor. |
|
69 */ |
|
70 void ConstructL(CRemConInterfaceSelector& aInterfaceSelector); |
|
71 |
|
72 public: // From MBTRCCActiveObserver |
|
73 |
|
74 void RequestCompletedL(CBTRCCActive& aActive, TInt aErr); |
|
75 |
|
76 void CancelRequest(TInt aServiceId); |
|
77 |
|
78 public: // From CBTRCCVolumeLevelControllerBase |
|
79 |
|
80 void DoStart(TInt aInitialVolume); // Set the initial volume. |
|
81 |
|
82 void DoStop(); // Stop monitoring for volume level changes. |
|
83 |
|
84 void DoReset(); // Reset the volume level. |
|
85 |
|
86 private: // From CBTRCCVolumeLevelControllerBase |
|
87 |
|
88 void AdjustRemoteVolume(TInt aVolume); |
|
89 |
|
90 TInt GetPhoneVolume(TInt &aVol); |
|
91 |
|
92 public: // New methods |
|
93 |
|
94 |
|
95 private: // From MRemConAbsoluteVolumeControllerObserver |
|
96 |
|
97 void MrcavcoCurrentVolume(TUint32 aVolume, TUint32 aMaxVolume, TInt aError); |
|
98 |
|
99 void MrcavcoSetAbsoluteVolumeResponse(TUint32 aVolume, TUint32 aMaxVolume, TInt aError); |
|
100 |
|
101 void MrcavcoAbsoluteVolumeNotificationError(); |
|
102 |
|
103 private: |
|
104 void AccessoryChangedVolume(TUint32 aVolume, TUint32 aMaxVolume, TInt aError); |
|
105 TBool ValidVolumeParams(TUint32 aVolume, TUint32 aMaxVolume); |
|
106 |
|
107 void RegisterVolumeChangeNotification(); |
|
108 |
|
109 private: // Data |
|
110 |
|
111 CRemConAbsoluteVolumeController* iRemConAbsoluteVolumeController; // changes the accessory's volume level. |
|
112 |
|
113 // This active object listens to the absolute volume API. |
|
114 CBTRCCActive *iBtrccAbsoluteVolumeActive; |
|
115 |
|
116 // Not owned |
|
117 CRemConInterfaceSelector *iInterfaceSelector; |
|
118 |
|
119 TInt iLocalMaxVolume; // maximum volume level of phone |
|
120 |
|
121 TUint iNumRemotes; // not used, but needed for the remote controlling API. |
|
122 |
|
123 TInt iRetryCounter; |
|
124 }; |
|
125 |
|
126 #endif // BTRCCABSOLUTEVOLUMELEVELCONTROLLER_H |
|
127 |
|
128 // End of File |