|
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // e32test\device\t_fir.h |
|
15 // |
|
16 // |
|
17 |
|
18 //#include <es_sock.h> |
|
19 #include <e32test.h> |
|
20 #include <e32cons.h> |
|
21 #include <d32comm.h> |
|
22 #include <d32fir.h> |
|
23 |
|
24 #ifndef __T_FIR__ |
|
25 #define __T_FIR__ |
|
26 |
|
27 #define PDD_NAME _L("difiba") |
|
28 #define LDD_NAME _L("efir") |
|
29 |
|
30 |
|
31 class CActiveWriter; |
|
32 class CActiveReader; |
|
33 class CActiveConsole : public CActive |
|
34 //----------------------------------- |
|
35 { |
|
36 public: |
|
37 // Construction |
|
38 CActiveConsole(CConsoleBase* aConsole); |
|
39 static CActiveConsole* NewLC(CConsoleBase* aConsole); |
|
40 void ConstructL(); |
|
41 |
|
42 // Destruction |
|
43 ~CActiveConsole(); |
|
44 |
|
45 // Issue request |
|
46 void RequestCharacter(); |
|
47 |
|
48 // Cancel request. |
|
49 // Defined as pure virtual by CActive; |
|
50 // implementation provided by this class. |
|
51 void DoCancel(); |
|
52 |
|
53 // Service completed request. |
|
54 // Defined as pure virtual by CActive; |
|
55 // implementation provided by this class, |
|
56 void RunL(); |
|
57 |
|
58 void ProcessKeyPressL(TChar aChar); |
|
59 |
|
60 void GetFirRegs(); |
|
61 void GetDmaReaderRegs(); |
|
62 void GetDmaWriterRegs(); |
|
63 void GetReadBufInfo(); |
|
64 void GetWriteBufInfo(); |
|
65 void GetChunkInfo(); |
|
66 void GetMiscInfo(); |
|
67 void SetUpBuffers(); |
|
68 void Options1(); |
|
69 void Options2(); |
|
70 void Options3(); |
|
71 public: |
|
72 // Data members defined by this class |
|
73 CConsoleBase* iConsole; // A console for reading from |
|
74 CActiveWriter* iWriter; // Client wrapper for CObexClient |
|
75 CActiveReader* iReader; // Client wrapper for CObexServer |
|
76 RDevFir iPort; |
|
77 TBool iInit1; |
|
78 TBool iInit2; |
|
79 TBool iInit3; |
|
80 TBps iBaudRate; |
|
81 }; |
|
82 |
|
83 |
|
84 class CActiveWriter : public CActive |
|
85 //----------------------------------------------------------- |
|
86 { |
|
87 public: |
|
88 // Construction |
|
89 CActiveWriter(CConsoleBase* aConsole,RDevFir* aPort); |
|
90 static CActiveWriter* NewL(CConsoleBase* aConsole,RDevFir* aPort); |
|
91 void ConstructL(); |
|
92 |
|
93 ~CActiveWriter(); |
|
94 |
|
95 void Start(); |
|
96 void Stop(); |
|
97 private: |
|
98 void RunL (); |
|
99 void DoCancel (); |
|
100 |
|
101 |
|
102 private: |
|
103 CConsoleBase* iConsole; |
|
104 RDevFir* iPort; |
|
105 TInt iLength; |
|
106 }; |
|
107 |
|
108 |
|
109 class CActiveReader : public CActive |
|
110 //----------------------------------------------------------- |
|
111 { |
|
112 public: |
|
113 // Construction |
|
114 CActiveReader(CConsoleBase* aConsole,RDevFir* aPort); |
|
115 static CActiveReader* NewL(CConsoleBase* aConsole,RDevFir* aPort); |
|
116 void ConstructL(); |
|
117 |
|
118 virtual ~CActiveReader(); |
|
119 |
|
120 void Start(); |
|
121 void Stop(); |
|
122 private: |
|
123 void RunL (); |
|
124 void DoCancel (); |
|
125 |
|
126 void ResetReadBuffer(); |
|
127 TBool CompareBuffers(TInt aLen); |
|
128 |
|
129 private: |
|
130 CConsoleBase* iConsole; |
|
131 RDevFir* iPort; |
|
132 |
|
133 }; |
|
134 |
|
135 #endif // __T_FIR__ |