|
1 /* |
|
2 * Copyright (c) 2006-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 the License "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 |
|
18 |
|
19 #ifndef __TPINPLUGINDLG_H__ |
|
20 #define __TPINPLUGINDLG_H__ |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <pinplugindialogdefs.h> |
|
24 |
|
25 const TUint KTPinPluginDlgNotiferUid = 0x200032E7; |
|
26 |
|
27 #ifdef _T_PINPLUGINDLG_TEXTSHELL |
|
28 |
|
29 #include <twintnotifier.h> |
|
30 |
|
31 /** Method at ordinal 1 to get a list of notifiers from this dll. */ |
|
32 IMPORT_C CArrayPtr<MNotifierBase2>* NotifierArray(); |
|
33 |
|
34 #else |
|
35 |
|
36 #include <eiknotapi.h> |
|
37 #include <ecom/ImplementationProxy.h> |
|
38 #define MNotifierBase2 MEikSrvNotifierBase2 |
|
39 |
|
40 IMPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount); |
|
41 CArrayPtr<MNotifierBase2>* NotifierArray(); |
|
42 |
|
43 #endif |
|
44 |
|
45 /** |
|
46 It reads the Input datas from t_pinplugindlg_in.dat and constructs |
|
47 TInputDetails to use in CTestPinPluginDlgNotifier. |
|
48 */ |
|
49 class TInputDetails |
|
50 { |
|
51 public: |
|
52 /** |
|
53 Constructs the object while the request is Train/ReTrain. |
|
54 */ |
|
55 TInputDetails(TPinPluginDialogOperation aOp, TInt aIndex, TInt aNewPinLength, TPinPluginDialogResult aCommandOutput); |
|
56 /** |
|
57 Constructs the object while the request is Identify. |
|
58 */ |
|
59 TInputDetails(TPinPluginDialogOperation aOp, TPinValue& aPinValue, TPinPluginDialogResult aCommandOutput); |
|
60 /** Returns the current process Dialog Notification Operation */ |
|
61 TPinPluginDialogNotification Operation() const { return iOp; } |
|
62 /** Returns the current process Pin Value Selected/Entered. */ |
|
63 const TPinValue& PinValue() const { return iPinValue; } |
|
64 /** Returns the current process selected index. */ |
|
65 TInt Index() const { return iIndex; } |
|
66 /** Returns the current process New pin Length given. */ |
|
67 TInt NewPinLength() const { return iNewPinLength; } |
|
68 /** Returns the current process Dialog output. */ |
|
69 TPinPluginDialogResult CommandOutput() const { return iCommandOutput; } |
|
70 private: |
|
71 TPinPluginDialogNotification iOp; |
|
72 TPinValue iPinValue; |
|
73 TInt iIndex; |
|
74 TInt iNewPinLength; |
|
75 TPinPluginDialogResult iCommandOutput; |
|
76 TPinPluginInfoMessage iExpectedMsg; |
|
77 }; |
|
78 |
|
79 /** |
|
80 This is a test implementation of the pinplugin dialog notifier. This version |
|
81 responds to dialogs with data read from c:\t_pinplugindlg_in.dat. This contains |
|
82 the expected input for the dialog. It keeps a number of dialog displayed |
|
83 and pin selected for the Train/ReTrain or pin given in Identify Dialog and |
|
84 displayed info message in c:\t_pinplugindlg_out.dat. |
|
85 */ |
|
86 class CTestPinPluginDlgNotifier : public CBase, public MNotifierBase2 |
|
87 { |
|
88 public: |
|
89 static CTestPinPluginDlgNotifier* NewL(); |
|
90 |
|
91 private: |
|
92 void ConstructL(); |
|
93 CTestPinPluginDlgNotifier(); |
|
94 |
|
95 /** |
|
96 Read the Number of Dialog displayed already from t_pinplugindlg_out.dat. |
|
97 */ |
|
98 TInt ReadDialogCountL(); |
|
99 /** |
|
100 Read the PinValue Selected/Entered in the last dialog request from |
|
101 t_pinplugindlg_out.dat. |
|
102 */ |
|
103 TPinValue ReadPinValueL(); |
|
104 /** |
|
105 Write the dialog count to the output file t_pinplugindlg_out.dat. |
|
106 |
|
107 @param aCount The Count of the Current Dialog. |
|
108 */ |
|
109 void WriteDialogCountL(TInt aCount); |
|
110 /** |
|
111 Write the PinValue to the output file t_pinplugindlg_out.dat. |
|
112 |
|
113 @param aPinValue The pinvalue to be write. |
|
114 */ |
|
115 void WritePinL(const TPinValue& aPinValue); |
|
116 /** |
|
117 Write the info message to the output file t_pinplugindlg_out.dat. |
|
118 |
|
119 @param aMessage The message to be write. |
|
120 */ |
|
121 void WriteMsgL(const TPinPluginInfoMessage& aMessage); |
|
122 |
|
123 /** |
|
124 Read an input specification. |
|
125 |
|
126 @param aOperation Consturct the InputDetails for the aOperation. |
|
127 */ |
|
128 TInputDetails* ReadInputDetailsL(TUint aOperation); |
|
129 |
|
130 /** |
|
131 Construct the output Details from aDetail and complete the RMessagePtr2 |
|
132 with the details. |
|
133 |
|
134 @param aDetail The input Details read from .dat file for this dialog |
|
135 @param aBuffer Data that can be passed from the client-side. |
|
136 @param aReplySlot Identifies which message argument to use for the reply. |
|
137 @param aMessage Encapsulates a client request. |
|
138 */ |
|
139 void DoSelectPinL(const TInputDetails& aDetail, const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); |
|
140 void DoIdentifyPinL(const TInputDetails& aDetail, const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); |
|
141 void DoInfoPinL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); |
|
142 public: // from MEikSrvNotifierBase2 |
|
143 void DoStartL( const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage ); |
|
144 |
|
145 private: // from MEikSrvNotifierBase2 |
|
146 void Release(); |
|
147 TNotifierInfo RegisterL(); |
|
148 TNotifierInfo Info() const; |
|
149 |
|
150 virtual void StartL( const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage ); |
|
151 virtual TPtrC8 StartL( const TDesC8& aBuffer ); |
|
152 |
|
153 void Cancel(); |
|
154 TPtrC8 UpdateL( const TDesC8& aBuffer ); |
|
155 |
|
156 private: |
|
157 RFs iFs; |
|
158 TNotifierInfo iInfo; |
|
159 }; |
|
160 |
|
161 #endif // __TPINPLUGINDLG_H__ |