|
1 /* |
|
2 * Copyright (c) 2005-2007 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 file contains classes of Peninput server client side. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef R_RPENINPUTSERVER_OBSERVER_H |
|
20 #define R_RPENINPUTSERVER_OBSERVER_H |
|
21 |
|
22 #include <peninputsrveventhandler.h> |
|
23 |
|
24 class RPeninputServerImpl; |
|
25 /** |
|
26 * Peninput server observer |
|
27 * |
|
28 * |
|
29 * @lib peninputclient.lib |
|
30 * @since S60 v4.0 |
|
31 */ |
|
32 NONSHARABLE_CLASS(CPeninputServerObserver) : public CActive, |
|
33 public MPeninputServerEventHandler |
|
34 { |
|
35 public: |
|
36 static CPeninputServerObserver* NewL(RPeninputServerImpl* aPeninputServer, |
|
37 TThreadId aSrvThreadId); |
|
38 /** |
|
39 * Constructor |
|
40 * |
|
41 * @since S60 v4.0 |
|
42 * @param aPeninputServer The server to be observered |
|
43 * @param aHandler A server event handler |
|
44 */ |
|
45 CPeninputServerObserver(RPeninputServerImpl* aPeninputServer, |
|
46 TThreadId aSrvThreadId); |
|
47 |
|
48 /** |
|
49 * Destructor |
|
50 * |
|
51 * @since S60 v4.0 |
|
52 */ |
|
53 ~CPeninputServerObserver(); |
|
54 |
|
55 /** |
|
56 * Set UI activation handler |
|
57 * |
|
58 * @since S60 v4.0 |
|
59 * @param aHandler A server event handler |
|
60 */ |
|
61 void AddUiActivationHandler(MPeninputServerEventHandler* aHandler); |
|
62 |
|
63 /** |
|
64 * Add server event handler |
|
65 * |
|
66 * @since S60 v4.0 |
|
67 * @param aHandler A server event handler |
|
68 */ |
|
69 void AddEventHandler(MPeninputServerEventHandler* aHandler); |
|
70 void SetActive() |
|
71 { |
|
72 CActive::SetActive(); |
|
73 } |
|
74 TRequestStatus& RequestStatus() |
|
75 { |
|
76 return iStatus; |
|
77 } |
|
78 void ReConstructL(TThreadId aId); |
|
79 protected: |
|
80 void ConstructL(); |
|
81 //From base class CActive |
|
82 |
|
83 /** |
|
84 * From CActive |
|
85 * Cancels all notification requests |
|
86 * |
|
87 * @since S60 v4.0 |
|
88 */ |
|
89 void DoCancel(); |
|
90 |
|
91 /** |
|
92 * From CActive |
|
93 * Receives messages and carries out requested operations |
|
94 * |
|
95 * @since S60 v4.0 |
|
96 */ |
|
97 void RunL(); |
|
98 |
|
99 /** |
|
100 * From CActive |
|
101 * Handles error if RunL() leaves |
|
102 * |
|
103 * @since S60 v4.0 |
|
104 */ |
|
105 TInt RunError(TInt aError); |
|
106 private: |
|
107 virtual TBool HandleServerEventL(TInt aEventId); |
|
108 |
|
109 public: |
|
110 /** |
|
111 * server event handler |
|
112 * Not own |
|
113 */ |
|
114 MPeninputServerEventHandler* iHandler; |
|
115 |
|
116 /** |
|
117 * UI activation event handler |
|
118 * Not own |
|
119 */ |
|
120 MPeninputServerEventHandler* iUiActivationHandler; |
|
121 |
|
122 private: |
|
123 /** |
|
124 * Reference to connected RPeninputServerImpl session |
|
125 * Not own |
|
126 */ |
|
127 RPeninputServerImpl* iPeninputServer; |
|
128 |
|
129 /** |
|
130 * Server thread id |
|
131 */ |
|
132 TThreadId iSrvThreadId; |
|
133 |
|
134 /** |
|
135 * Server status flag |
|
136 */ |
|
137 TBool iServerExit; |
|
138 }; |
|
139 |
|
140 |
|
141 //class CPenUiNotificationHandler |
|
142 NONSHARABLE_CLASS(CPenUiNotificationHandler): public CBase,public MPeninputServerEventHandler |
|
143 { |
|
144 public: |
|
145 static CPenUiNotificationHandler* NewL(MPenUiActivationHandler* aHandler, |
|
146 RPeninputServerImpl* aClient, |
|
147 TInt aType); |
|
148 TBool HandleServerEventL(TInt aEventId); |
|
149 MPenUiActivationHandler* Handler() |
|
150 { |
|
151 return iHandler; |
|
152 } |
|
153 TInt RegisteredType() |
|
154 { |
|
155 return iType; |
|
156 } |
|
157 private: |
|
158 CPenUiNotificationHandler(MPenUiActivationHandler* aHandler, |
|
159 RPeninputServerImpl* aClient,TInt aType); |
|
160 void ConstructL(); |
|
161 private: |
|
162 MPenUiActivationHandler* iHandler; |
|
163 RPeninputServerImpl* iClient; //not owned |
|
164 TInt iType; |
|
165 }; |
|
166 |
|
167 #endif //R_RPENINPUTSERVER_OBSERVER_H |