|
1 /* |
|
2 * Copyright (c) 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: |
|
15 * |
|
16 */ |
|
17 #include <peninputserverhandler.h> |
|
18 |
|
19 EXPORT_C CPenInputServerHandler* CPenInputServerHandler::NewL() |
|
20 { |
|
21 CPenInputServerHandler* self = new (ELeave) CPenInputServerHandler(); |
|
22 CleanupStack::PushL( self ); |
|
23 self->ConstructL(); |
|
24 CleanupStack::Pop(self); |
|
25 return self; |
|
26 } |
|
27 |
|
28 CPenInputServerHandler::CPenInputServerHandler() |
|
29 :iPenInputSvrConnected(EFalse) |
|
30 { |
|
31 } |
|
32 |
|
33 void CPenInputServerHandler::ConstructL() |
|
34 { |
|
35 } |
|
36 |
|
37 EXPORT_C CPenInputServerHandler::~CPenInputServerHandler() |
|
38 { |
|
39 if (iPenInputSvrConnected) |
|
40 { |
|
41 DisconnectServer(); |
|
42 } |
|
43 } |
|
44 |
|
45 EXPORT_C TInt CPenInputServerHandler::ConnectServer() |
|
46 { |
|
47 if (!iPenInputSvrConnected) |
|
48 { |
|
49 if (iPenInputServer.Connect() != KErrNone) |
|
50 { |
|
51 return KErrCouldNotConnect; |
|
52 } |
|
53 |
|
54 iPenInputSvrConnected = ETrue; |
|
55 iPenInputServer.SetForeground(EFalse); |
|
56 } |
|
57 |
|
58 return KErrNone; |
|
59 } |
|
60 |
|
61 EXPORT_C void CPenInputServerHandler::SetUiLayout(TInt aLayoutId) |
|
62 { |
|
63 if (iPenInputSvrConnected) |
|
64 { |
|
65 TUid layoutId; |
|
66 layoutId.iUid = aLayoutId; |
|
67 iPenInputServer.SetUiLayoutId(layoutId); |
|
68 iPenInputServer.ActivateLayout(ETrue); |
|
69 } |
|
70 } |
|
71 |
|
72 EXPORT_C void CPenInputServerHandler::DisconnectServer() |
|
73 { |
|
74 if (iPenInputSvrConnected) |
|
75 { |
|
76 iPenInputServer.ActivateLayout(EFalse); |
|
77 iPenInputServer.Close(); |
|
78 |
|
79 iPenInputSvrConnected = EFalse; |
|
80 } |
|
81 } |
|
82 |
|
83 EXPORT_C void CPenInputServerHandler::ActivateUiLayout(TBool aActivate) |
|
84 { |
|
85 if (iPenInputSvrConnected) |
|
86 { |
|
87 iPenInputServer.ActivateLayout(aActivate); |
|
88 } |
|
89 } |
|
90 |
|
91 EXPORT_C void CPenInputServerHandler::SendCommandToServer(TInt aCmdId) |
|
92 { |
|
93 if (iPenInputSvrConnected) |
|
94 { |
|
95 iPenInputServer.HandleCommand(aCmdId); |
|
96 } |
|
97 } |
|
98 |
|
99 EXPORT_C void CPenInputServerHandler::SendCommandToServer(TInt aCmdId, TInt aParam) |
|
100 { |
|
101 if (iPenInputSvrConnected) |
|
102 { |
|
103 TPckgC<TInt> msgdata(aParam); |
|
104 iPenInputServer.HandleCommand(aCmdId, msgdata); |
|
105 } |
|
106 } |
|
107 |
|
108 EXPORT_C void CPenInputServerHandler::SendCommandToServer(TInt aCmdId, const TDesC& aParam) |
|
109 { |
|
110 if (iPenInputSvrConnected) |
|
111 { |
|
112 TPtrC ptr(aParam); |
|
113 TPckgC<TPtrC> msgdata(aParam); |
|
114 iPenInputServer.HandleCommand(aCmdId, msgdata); |
|
115 } |
|
116 } |
|
117 |
|
118 EXPORT_C void CPenInputServerHandler::SendNewKeyToServer(TInt aCmdId, const TItutKey& aKeyInfo) |
|
119 { |
|
120 if (iPenInputSvrConnected) |
|
121 { |
|
122 TPckgC<TItutKey> msgdata(aKeyInfo); |
|
123 iPenInputServer.HandleCommand(aCmdId, msgdata); |
|
124 } |
|
125 } |
|
126 |
|
127 EXPORT_C void CPenInputServerHandler::SetIcfText(const TFepInputContextFieldData& aData) |
|
128 { |
|
129 if (iPenInputSvrConnected) |
|
130 { |
|
131 TPckgC<TFepInputContextFieldData> msgdata(aData); |
|
132 iPenInputServer.HandleCommand(EItutExtCmdSetIcfData, msgdata); |
|
133 } |
|
134 } |
|
135 |
|
136 EXPORT_C void CPenInputServerHandler::SendPromptTextToServer(TInt aCmdId, |
|
137 const TFepPromptText& aPromptText) |
|
138 { |
|
139 if (iPenInputSvrConnected) |
|
140 { |
|
141 TPckgC<TFepPromptText> msgdata(aPromptText); |
|
142 iPenInputServer.HandleCommand(aCmdId, msgdata); |
|
143 } |
|
144 } |
|
145 |
|
146 // End Of File |