|
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: The base class for volume control of AVRCP Controller. |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef BTRCCVOLUMELEVELCONTROLLERBASE_H |
|
20 #define BTRCCVOLUMELEVELCONTROLLERBASE_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <remconcoreapicontrollerobserver.h> |
|
25 #include <bttypes.h> // BT protocol wide types |
|
26 #include <e32property.h> |
|
27 #include "btrccActive.h" |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CRemConInterfaceSelector; |
|
31 class CRemConCoreApiController; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 NONSHARABLE_CLASS(MBTRCCVolumeControllerObserver) |
|
36 { |
|
37 public: |
|
38 virtual void VolumeControlError(TInt aError) = 0; |
|
39 }; |
|
40 |
|
41 /*! |
|
42 error code return by controller |
|
43 */ |
|
44 enum TBTRccControllerError |
|
45 { |
|
46 EVolumeAdjustmentFailed = 0, /*!< Adjust remote volume failed */ |
|
47 ERegisterNotificationsFailed /*!< Register volume change notifications failed */ |
|
48 }; |
|
49 /** |
|
50 * A listener for incoming handsfree attachments/detachments. |
|
51 */ |
|
52 NONSHARABLE_CLASS(CBTRCCVolumeLevelControllerBase) : public CBase, public MBTRCCActiveObserver |
|
53 { |
|
54 public: // Constructors and destructor |
|
55 |
|
56 /** |
|
57 * Destructor. |
|
58 */ |
|
59 virtual ~CBTRCCVolumeLevelControllerBase(); |
|
60 |
|
61 protected: |
|
62 /** |
|
63 * C++ default constructor. |
|
64 */ |
|
65 CBTRCCVolumeLevelControllerBase(MBTRCCVolumeControllerObserver &aObserver); |
|
66 |
|
67 /** |
|
68 * Symbian 2nd phase constructor. |
|
69 */ |
|
70 void ConstructL(); |
|
71 |
|
72 public: |
|
73 enum TVolControlState |
|
74 { |
|
75 ESubscribePhoneVolume, |
|
76 ESetPhoneVolume |
|
77 }; |
|
78 |
|
79 public: // From CBTRCCActiveObserver |
|
80 virtual void RequestCompletedL(CBTRCCActive& aActive, TInt aErr); |
|
81 |
|
82 virtual void CancelRequest(TInt aServiceId); |
|
83 |
|
84 public: // New methods |
|
85 |
|
86 void Start(); // Starts monitoring for volume level changes. |
|
87 |
|
88 void Stop(); // Stop monitoring for volume level changes. |
|
89 |
|
90 void Reset(); // Reset the volume level. |
|
91 |
|
92 TInt GetLocalMaxVolume(); |
|
93 |
|
94 TInt GetCurrentLocalVolume(); |
|
95 |
|
96 void AccessoryChangedVolume(TInt aVolumeInPhoneScale); |
|
97 |
|
98 virtual void DoStart(TInt aInitialVolume) = 0; // Starts monitoring for volume level changes. |
|
99 |
|
100 virtual void DoStop() = 0; // Stop monitoring for volume level changes. |
|
101 |
|
102 virtual void DoReset() = 0; // Reset the volume level. |
|
103 |
|
104 virtual void VolumeControlError(TInt aError); |
|
105 |
|
106 virtual void RegisterVolumeChangeNotification(); |
|
107 |
|
108 private: |
|
109 void SetPhoneVolume(); |
|
110 |
|
111 private: // New methods |
|
112 |
|
113 /** |
|
114 * To be implemented by the specialization class. |
|
115 */ |
|
116 virtual void AdjustRemoteVolume(TInt aVolume) = 0; |
|
117 |
|
118 protected: |
|
119 virtual TInt GetPhoneVolume(TInt &aVol); |
|
120 |
|
121 private: // Data |
|
122 RProperty iVolLevelProperty; // owned |
|
123 RProperty iVolKeyEventProperty; // owned |
|
124 |
|
125 // This active object listens to the PS key changes. |
|
126 // Specialization classes may add more active objects if they need. |
|
127 // Hence the ID in the CBTRCCActive. |
|
128 CBTRCCActive *iBtrccActive; |
|
129 |
|
130 MBTRCCVolumeControllerObserver &iObserver; |
|
131 |
|
132 TInt iLocalMaxVolume; |
|
133 TInt iPhoneVolume; |
|
134 TInt iRemoteVolume; |
|
135 |
|
136 TVolControlState iState; |
|
137 }; |
|
138 |
|
139 #endif // BTRCCVOLUMELEVELCONTROLLERBASE_H |
|
140 |
|
141 // End of File |