22 |
22 |
23 #include <testframework.h> |
23 #include <testframework.h> |
24 |
24 |
25 /** |
25 /** |
26 * |
26 * |
27 * Console reader mixin class. |
|
28 * Any main program or class using a CServerConsole |
|
29 * should implement this class. |
|
30 * |
|
31 * @xxxx |
|
32 * |
|
33 */ |
|
34 class MConsoleReader |
|
35 { |
|
36 public: |
|
37 /** |
|
38 * |
|
39 * Processes a received keystroke. |
|
40 * |
|
41 * @param "TKeyCode aKeystroke" |
|
42 * The received keystroke. |
|
43 * |
|
44 * @xxxx |
|
45 * |
|
46 */ |
|
47 virtual void InputReceived(TKeyCode aKeystroke) = 0; |
|
48 /** |
|
49 * |
|
50 * Handles console reader errors. |
|
51 * |
|
52 * @param "TInt aError" |
|
53 * The error code. |
|
54 * |
|
55 * @xxxx |
|
56 * |
|
57 */ |
|
58 virtual void Error(TInt aError) = 0; |
|
59 }; |
|
60 |
|
61 /** |
|
62 * |
|
63 * Keystroke reader for CServerConsole. |
|
64 * |
|
65 * |
|
66 * @xxxx |
|
67 * |
|
68 */ |
|
69 class CConsoleReader : public CActive |
|
70 { |
|
71 public: |
|
72 static CConsoleReader* NewL(CConsoleBase& aConsole); |
|
73 ~CConsoleReader(); |
|
74 void DoRead(MConsoleReader& aClient); |
|
75 void DoRead();//keeping same client as before |
|
76 void RunL(); |
|
77 |
|
78 protected: |
|
79 void DoCancel(); |
|
80 |
|
81 private: |
|
82 CConsoleReader(CConsoleBase& aConsole); |
|
83 |
|
84 private: |
|
85 MConsoleReader* iClient; |
|
86 CConsoleBase& iConsole; |
|
87 TKeyCode iKeyStroke; |
|
88 }; |
|
89 |
|
90 /** |
|
91 * |
|
92 * Active console for test input. |
27 * Active console for test input. |
93 * To be used where manual control of testing is required |
28 * To be used where manual control of testing is required |
94 * |
29 * |
95 * @xxxx |
30 * @xxxx |
96 * |
31 * |
97 */ |
32 */ |
98 class CServerConsole : public CActive |
33 class CServerConsole : public CBase |
99 { |
34 { |
100 public: |
35 public: |
101 static CServerConsole* NewL(const TDesC& aName); |
36 static CServerConsole* NewL(const TDesC& aName); |
102 ~CServerConsole(); |
37 ~CServerConsole(); |
103 |
38 |
104 void SetInstructionsL(const TDesC& aInstructions); |
39 void SetInstructionsL(const TDesC& aInstructions); |
105 void Read(MConsoleReader& aReader); |
|
106 void ReadCancel(); |
|
107 |
|
108 void RunL(); |
|
109 void DoCancel(); |
|
110 TInt RunError(TInt aError); |
|
111 |
40 |
112 // accessor |
41 // accessor |
113 CConsoleBase* Console() const; |
42 CConsoleBase* Console() const; |
114 |
43 |
115 private: |
44 private: |