|
1 // Copyright (c) 2001-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 "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 // |
|
15 |
|
16 #ifndef __SERIAL_H__ |
|
17 #define __SERIAL_H__ |
|
18 |
|
19 #include <e32std.h> |
|
20 #include <c32comm.h> |
|
21 #include "common.h" |
|
22 /** |
|
23 * Serial Listener Active Object - receive commands on the serial port |
|
24 */ |
|
25 class CTestMgr; |
|
26 |
|
27 class CSerialListener : public CActive |
|
28 { |
|
29 public: |
|
30 static CSerialListener* NewL(RComm* aCommPort, CTestMgr* aController); |
|
31 ~CSerialListener(); |
|
32 void |
|
33 Recv(); |
|
34 TBuffer* GetData(); |
|
35 private: |
|
36 void ConstructL(); |
|
37 CSerialListener(RComm* aCommPort, CTestMgr* aController); |
|
38 |
|
39 void RunL(); |
|
40 void DoCancel(); |
|
41 //attributes |
|
42 RComm* iCommPort; // Handle to the comm port |
|
43 CTestMgr* iController; // Link to the controller |
|
44 TBuffer iDataBuffer; //The received data buffer |
|
45 TBuffer iLastBuffer; // The last data received |
|
46 }; |
|
47 |
|
48 inline TBuffer* |
|
49 CSerialListener::GetData() |
|
50 { |
|
51 return &iLastBuffer; |
|
52 } |
|
53 |
|
54 /** |
|
55 * Serial Sender Active Object - send commands on the serial port |
|
56 */ |
|
57 class CSerialSender : public CActive |
|
58 { |
|
59 public: |
|
60 static CSerialSender* NewL(RComm* aCommPort, CTestMgr* aController); |
|
61 ~CSerialSender(); |
|
62 void |
|
63 Send(TBuffer& aBuff); |
|
64 private: |
|
65 void ConstructL(); |
|
66 CSerialSender(RComm* aCommPort, CTestMgr* aController); |
|
67 |
|
68 void RunL(); |
|
69 void DoCancel(); |
|
70 //attributes |
|
71 RComm* iCommPort; // Handle to the comm port |
|
72 CTestMgr* iController; // Link to the controller |
|
73 TBuffer iDataBuffer; // The data to send |
|
74 }; |
|
75 |
|
76 #endif //__SERIAL_H__ |