|
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: |
|
15 * Declaration of class CKeyPublisher. |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 #ifndef __KEYPUBLISHER_H__ |
|
21 #define __KEYPUBLISHER_H__ |
|
22 |
|
23 // INCLUDE |
|
24 #include <w32adll.h> |
|
25 #include <e32property.h> |
|
26 #include <remconcoreapi.h> |
|
27 #include "KeyPublisherSoundServerSession.h" |
|
28 |
|
29 class RKeyPublisherSoundServerSession; |
|
30 /** |
|
31 * CKeyPublisher |
|
32 * Used by the Window server. This class implements the Raw Key event |
|
33 * handling feature. and publishes to P&S . |
|
34 * |
|
35 * @lib KeyPublisherPlugin.dll |
|
36 * @since 3.0 |
|
37 */ |
|
38 NONSHARABLE_CLASS(CKeyPublisher) : public CWindowAnim |
|
39 { |
|
40 public: // Constructor and Destructor |
|
41 /** |
|
42 * Constructor. |
|
43 */ |
|
44 CKeyPublisher(); |
|
45 |
|
46 /** |
|
47 * Destructor. |
|
48 */ |
|
49 virtual ~CKeyPublisher(); |
|
50 |
|
51 public: // New Functions |
|
52 /** |
|
53 * HandleTimerEvent |
|
54 * When Timer is expired, this function is called from callback function. |
|
55 * @since 3.0 |
|
56 * @param None |
|
57 * @return None |
|
58 */ |
|
59 void HandleTimerEvent(); |
|
60 |
|
61 public: // Base Class Functions - CAnim |
|
62 |
|
63 /** @see CAnim::CommandReplyL(TInt aOpcode, TAny *aArgs) */ |
|
64 TInt CommandReplyL(TInt aOpcode, TAny *aArgs); |
|
65 |
|
66 /** @see CAnim::Command(TInt aOpcode, TAny *aArgs) */ |
|
67 void Command(TInt aOpcode, TAny *aArgs); |
|
68 |
|
69 /** @see CAnim::Animate(TDateTime *aDateTime) */ |
|
70 void Animate(TDateTime *aDateTime); |
|
71 |
|
72 public: // Base Class Functions - CWindowAnim |
|
73 |
|
74 /** @see CWindowAnim::ConstructL(TAny *aArgs, TBool aHasFocus) */ |
|
75 void ConstructL(TAny *aArgs, TBool aHasFocus); |
|
76 |
|
77 /** @see CWindowAnim::Redraw() */ |
|
78 void Redraw(); |
|
79 |
|
80 /** @see CWindowAnim::FocusChanged(TBool aState) */ |
|
81 void FocusChanged(TBool aState); |
|
82 |
|
83 public: // Base Class Functions - MEventHandler |
|
84 |
|
85 /** @see MEventHandler::OfferRawEvent(const TRawEvent &aRawEvent) */ |
|
86 TBool OfferRawEvent(const TRawEvent &aRawEvent); |
|
87 |
|
88 private: |
|
89 |
|
90 /** |
|
91 * IsBlockedKeyCode () : Compares the scancode with the list of |
|
92 * blocked keys and returns ETrue if key is blocked, else EFalse |
|
93 */ |
|
94 TBool IsBlockedKeyCode(TInt aScanCode); |
|
95 |
|
96 /** |
|
97 * TimerCallback () : this is the callback function called from timer. |
|
98 */ |
|
99 static TInt TimerCallback(TAny* aThis); |
|
100 |
|
101 /** |
|
102 * GetEnumVal() : Function returns the appropriate CoreApi enumarated |
|
103 * value for the given ScanCode and Event |
|
104 */ |
|
105 TInt GetEnumVal(TInt aScanCode, TRemConCoreApiButtonAction aEvent); |
|
106 |
|
107 /** |
|
108 * PublishEvent() : Publish the Event to P&S, |
|
109 */ |
|
110 void PublishEvent(TInt aScanCode, TRemConCoreApiButtonAction aEvent); |
|
111 |
|
112 private: // Data |
|
113 // For posting event to P&S |
|
114 RProperty iProperty; |
|
115 |
|
116 // For getting timer ticks/events |
|
117 CPeriodic* iTimer; |
|
118 |
|
119 // To store the scan code when key is pressed. This is used when key |
|
120 // is released. |
|
121 TInt iPrevScanCode; |
|
122 |
|
123 // To keep track whether timer is already started or not. |
|
124 TBool iTimerStarted; |
|
125 |
|
126 // To know whether Pressed event sent or not. |
|
127 TBool iPressEventSent; |
|
128 |
|
129 // To know whether Released event sent or not- blocking simultaneous key press |
|
130 TBool iReleaseEventSent; |
|
131 |
|
132 // How many times Timer expired. |
|
133 TInt iTimerCount; |
|
134 |
|
135 // For sending sound event |
|
136 RKeyPublisherSoundServerSession iSoundSession; |
|
137 |
|
138 // To know whether it is connected to sound server or not |
|
139 TBool iConnected; |
|
140 }; |
|
141 |
|
142 |
|
143 #endif // __KEYPUBLISHER_H__ |
|
144 |
|
145 // End of File |