|
1 // Copyright (c) 2008-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 #include "ctestcontrolchannel.h" |
|
17 #include <e32debug.h> |
|
18 |
|
19 |
|
20 CTestControlChannel* CTestControlChannel::NewL() |
|
21 { |
|
22 CTestControlChannel* self = new (ELeave) CTestControlChannel (); |
|
23 CleanupStack::PushL ( self ); |
|
24 self->ConstructL ( ); |
|
25 CleanupStack::Pop (); // self |
|
26 return self; |
|
27 } |
|
28 |
|
29 CTestControlChannel::~CTestControlChannel () |
|
30 { |
|
31 |
|
32 } |
|
33 |
|
34 void CTestControlChannel::Recv ( TControlMessage& /*aMessage*/, TRequestStatus& /*aStatus*/ ) |
|
35 { |
|
36 rControlAO = CPnPRControlChannelAO::NewL(*this); |
|
37 rControlAO->Recvdata(); |
|
38 } |
|
39 |
|
40 void CTestControlChannel::Send ( TControlMessage& /*aMessage*/, TRequestStatus& /*aStatus*/ ) |
|
41 { |
|
42 rControlAO = CPnPRControlChannelAO::NewL(*this); |
|
43 rControlAO-> Senddata(); |
|
44 } |
|
45 |
|
46 |
|
47 void CTestControlChannel::CancelRecv () |
|
48 { |
|
49 |
|
50 } |
|
51 |
|
52 void CTestControlChannel::CancelSend () |
|
53 { |
|
54 |
|
55 } |
|
56 |
|
57 |
|
58 CTestControlChannel::CTestControlChannel ( ) |
|
59 { |
|
60 //Nothing |
|
61 } |
|
62 |
|
63 void CTestControlChannel::ConstructL () |
|
64 { |
|
65 //Nothing |
|
66 } |
|
67 |
|
68 void CTestControlChannel::TimeOut(CPnPRControlChannelAO& aControlChannelAO) |
|
69 { |
|
70 CPnPRControlChannelAO* controlChannelAO = &aControlChannelAO; |
|
71 delete controlChannelAO; |
|
72 } |
|
73 |
|
74 CPnPRControlChannelAO* CPnPRControlChannelAO::NewL(MControlChannelAOObsever& aObserver) |
|
75 { |
|
76 CPnPRControlChannelAO* self = new (ELeave) CPnPRControlChannelAO (aObserver); |
|
77 CleanupStack::PushL ( self ); |
|
78 self->ConstructL ( ); |
|
79 CleanupStack::Pop (); |
|
80 return self; |
|
81 } |
|
82 |
|
83 CPnPRControlChannelAO::CPnPRControlChannelAO(MControlChannelAOObsever& aObserver) |
|
84 :CActive(EPriorityStandard), iObserver(aObserver) |
|
85 { |
|
86 CActiveScheduler::Add(this); |
|
87 } |
|
88 |
|
89 void CPnPRControlChannelAO::ConstructL() |
|
90 { |
|
91 iTimer.CreateLocal(); |
|
92 } |
|
93 |
|
94 void CPnPRControlChannelAO::Recvdata() |
|
95 { |
|
96 After(500000); |
|
97 } |
|
98 |
|
99 void CPnPRControlChannelAO::Senddata() |
|
100 { |
|
101 After(500000); |
|
102 } |
|
103 CPnPRControlChannelAO::~CPnPRControlChannelAO() |
|
104 { |
|
105 Cancel(); |
|
106 iTimer.Close(); |
|
107 } |
|
108 |
|
109 void CPnPRControlChannelAO::After(TTimeIntervalMicroSeconds32 anInterval) |
|
110 { |
|
111 iTimer.After(iStatus,anInterval); |
|
112 SetActive(); |
|
113 } |
|
114 |
|
115 void CPnPRControlChannelAO::DoCancel() |
|
116 { |
|
117 iTimer.Cancel(); |
|
118 } |
|
119 |
|
120 void CPnPRControlChannelAO::RunL() |
|
121 { |
|
122 iObserver.TimeOut(*this); |
|
123 } |
|
124 |