|
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: Declaration of class CHidRemconBearerObserver |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_HIDREMCONBEAREROBSERVER_H |
|
20 #define C_HIDREMCONBEAREROBSERVER_H |
|
21 |
|
22 #include <e32svr.h> |
|
23 #include <e32property.h> |
|
24 |
|
25 /** |
|
26 * Observer key types |
|
27 */ |
|
28 enum TObserverKeyType |
|
29 { |
|
30 EMediaKeys = 0, |
|
31 EAccessoryVolumeKeys, |
|
32 EMuteKey, |
|
33 EHookKeys |
|
34 }; |
|
35 |
|
36 /** |
|
37 * Call Back Receiver |
|
38 * On receiving event from the P & S, CHidRemconBearerObserver calls |
|
39 * this function |
|
40 * |
|
41 */ |
|
42 class MCallBackReceiver |
|
43 { |
|
44 public: |
|
45 /** |
|
46 * Called when event has arrived from P&S. |
|
47 * |
|
48 * @param aEnumValue Enum value representing the key and action |
|
49 * @param aKeyType will indicate whether it is Volume key or Media key |
|
50 */ |
|
51 virtual void ReceivedKeyEvent( TInt aEnumValue, TInt aKeyType ) = 0; |
|
52 }; |
|
53 |
|
54 /** |
|
55 * Hid remcon bearer observer |
|
56 * This class inplements the Active Object. There will be two instance |
|
57 * of this ,one for handling Volume keys and other for Media Keys |
|
58 * |
|
59 */ |
|
60 class CHidRemconBearerObserver : public CActive |
|
61 { |
|
62 public: |
|
63 // Constructors and destructor |
|
64 |
|
65 /** |
|
66 * Two-phased constructor. |
|
67 * @param aCallback reference of the class which implements |
|
68 * MCallBackReceiver for handling call back |
|
69 * functions |
|
70 * @param aKeyType Indiacates whether it is side volume key or |
|
71 * media key |
|
72 * @return remconbearer observer |
|
73 */ |
|
74 static CHidRemconBearerObserver* NewL( MCallBackReceiver& aCallback, |
|
75 TInt aKeyType ); |
|
76 /** |
|
77 * Destructor. |
|
78 */ |
|
79 virtual ~CHidRemconBearerObserver(); |
|
80 |
|
81 public: |
|
82 /** |
|
83 * Start remconbearer observer key events |
|
84 * |
|
85 * @return Error code |
|
86 */ |
|
87 TInt Start(); |
|
88 |
|
89 /** |
|
90 * Stop remconbearer observer key events |
|
91 * |
|
92 */ |
|
93 void Stop(); |
|
94 |
|
95 private: |
|
96 /** |
|
97 * Two-phased constructor. |
|
98 * @param aCallback reference of the class which implements |
|
99 * MCallBackReceiver for handling call back |
|
100 * functions |
|
101 */ |
|
102 CHidRemconBearerObserver( MCallBackReceiver& aCallback ); |
|
103 |
|
104 /** |
|
105 * Two-phased constructor. |
|
106 * @param aKeyType Indiacates whether it is side volume key or |
|
107 * media key |
|
108 */ |
|
109 void ConstructL( TInt aKeyType ); |
|
110 |
|
111 private: |
|
112 // From Base class CActive |
|
113 |
|
114 /** |
|
115 * From CActive |
|
116 * Handles an active object's request completion event. |
|
117 * |
|
118 */ |
|
119 void RunL(); |
|
120 |
|
121 /** |
|
122 * From CActive |
|
123 * Canceling outstanding request |
|
124 * |
|
125 */ |
|
126 void DoCancel(); |
|
127 |
|
128 private: |
|
129 // Data |
|
130 /** |
|
131 * RProperty for key subscribing key values |
|
132 */ |
|
133 RProperty iProperty; |
|
134 |
|
135 /** |
|
136 * Callback to request handler |
|
137 */ |
|
138 MCallBackReceiver& iCallback; |
|
139 |
|
140 /** |
|
141 * Key type |
|
142 */ |
|
143 TInt iKeyType; // Vol key or media Key |
|
144 }; |
|
145 |
|
146 #endif // HIDREMCONBEAREROBSERVER_H |
|
147 // End of file |