15 // @internalComponent |
15 // @internalComponent |
16 // |
16 // |
17 // |
17 // |
18 |
18 |
19 #include "softwareconnecttimer.h" |
19 #include "softwareconnecttimer.h" |
20 #include "OstTraceDefinitions.h" |
|
21 #ifdef OST_TRACE_COMPILER_IN_USE |
|
22 #include "SoftwareConnectTimerTraces.h" |
|
23 #endif |
|
24 |
20 |
25 namespace NUnitTesting_USBDI |
21 namespace NUnitTesting_USBDI |
26 { |
22 { |
27 |
23 |
28 const TInt KOneSecond(1000000); |
24 const TInt KOneSecond(1000000); |
29 |
25 |
30 CSoftwareConnectTimer* CSoftwareConnectTimer::NewL(RUsbTestDevice& aTestDevice) |
26 CSoftwareConnectTimer* CSoftwareConnectTimer::NewL(RUsbTestDevice& aTestDevice) |
31 { |
27 { |
32 OstTraceFunctionEntry1( CSOFTWARECONNECTTIMER_NEWL_ENTRY, ( TUint )&( aTestDevice ) ); |
|
33 CSoftwareConnectTimer* self = new (ELeave) CSoftwareConnectTimer(aTestDevice); |
28 CSoftwareConnectTimer* self = new (ELeave) CSoftwareConnectTimer(aTestDevice); |
34 CleanupStack::PushL(self); |
29 CleanupStack::PushL(self); |
35 self->ConstructL(); |
30 self->ConstructL(); |
36 CleanupStack::Pop(self); |
31 CleanupStack::Pop(self); |
37 OstTraceFunctionExit1( CSOFTWARECONNECTTIMER_NEWL_EXIT, ( TUint )( self ) ); |
|
38 return self; |
32 return self; |
39 } |
33 } |
40 |
34 |
41 |
35 |
42 CSoftwareConnectTimer::CSoftwareConnectTimer(RUsbTestDevice& aTestDevice) |
36 CSoftwareConnectTimer::CSoftwareConnectTimer(RUsbTestDevice& aTestDevice) |
43 : CTimer(EPriorityStandard), |
37 : CTimer(EPriorityStandard), |
44 iTestDevice(aTestDevice), |
38 iTestDevice(aTestDevice), |
45 iConnectType(EUnknown) |
39 iConnectType(EUnknown) |
46 { |
40 { |
47 OstTraceFunctionEntryExt( CSOFTWARECONNECTTIMER_CSOFTWARECONNECTTIMER_ENTRY, this ); |
|
48 CActiveScheduler::Add(this); |
41 CActiveScheduler::Add(this); |
49 OstTraceFunctionExit1( CSOFTWARECONNECTTIMER_CSOFTWARECONNECTTIMER_EXIT, this ); |
|
50 } |
42 } |
51 |
43 |
52 |
44 |
53 CSoftwareConnectTimer::~CSoftwareConnectTimer() |
45 CSoftwareConnectTimer::~CSoftwareConnectTimer() |
54 { |
46 { |
55 OstTraceFunctionEntry1( CSOFTWARECONNECTTIMER_CSOFTWARECONNECTTIMER_ENTRY_DUP01, this ); |
47 LOG_FUNC |
56 OstTraceFunctionExit1( CSOFTWARECONNECTTIMER_CSOFTWARECONNECTTIMER_EXIT_DUP01, this ); |
|
57 } |
48 } |
58 |
49 |
59 |
50 |
60 void CSoftwareConnectTimer::SoftwareConnect(TInt aInterval) |
51 void CSoftwareConnectTimer::SoftwareConnect(TInt aInterval) |
61 { |
52 { |
62 OstTraceFunctionEntryExt( CSOFTWARECONNECTTIMER_SOFTWARECONNECT_ENTRY, this ); |
53 LOG_FUNC |
63 iConnectType = EConnect; |
54 iConnectType = EConnect; |
64 After(aInterval*KOneSecond); |
55 After(aInterval*KOneSecond); |
65 OstTraceFunctionExit1( CSOFTWARECONNECTTIMER_SOFTWARECONNECT_EXIT, this ); |
|
66 } |
56 } |
67 |
57 |
68 |
58 |
69 void CSoftwareConnectTimer::SoftwareDisconnect(TInt aInterval) |
59 void CSoftwareConnectTimer::SoftwareDisconnect(TInt aInterval) |
70 { |
60 { |
71 OstTraceFunctionEntryExt( CSOFTWARECONNECTTIMER_SOFTWAREDISCONNECT_ENTRY, this ); |
61 LOG_FUNC |
72 iConnectType = EDisconnect; |
62 iConnectType = EDisconnect; |
73 After(aInterval*KOneSecond); |
63 After(aInterval*KOneSecond); |
74 OstTraceFunctionExit1( CSOFTWARECONNECTTIMER_SOFTWAREDISCONNECT_EXIT, this ); |
|
75 } |
64 } |
76 |
65 |
77 |
66 |
78 void CSoftwareConnectTimer::SoftwareReConnect(TInt aInterval) |
67 void CSoftwareConnectTimer::SoftwareReConnect(TInt aInterval) |
79 { |
68 { |
80 OstTraceFunctionEntryExt( CSOFTWARECONNECTTIMER_SOFTWARERECONNECT_ENTRY, this ); |
69 LOG_FUNC |
81 iTestDevice.SoftwareDisconnect(); |
70 iTestDevice.SoftwareDisconnect(); |
82 SoftwareConnect(aInterval); |
71 SoftwareConnect(aInterval); |
83 OstTraceFunctionExit1( CSOFTWARECONNECTTIMER_SOFTWARERECONNECT_EXIT, this ); |
|
84 } |
72 } |
85 |
73 |
86 |
74 |
87 void CSoftwareConnectTimer::RunL() |
75 void CSoftwareConnectTimer::RunL() |
88 { |
76 { |
89 OstTraceFunctionEntry1( CSOFTWARECONNECTTIMER_RUNL_ENTRY, this ); |
77 LOG_FUNC |
90 TInt completionCode(iStatus.Int()); |
78 TInt completionCode(iStatus.Int()); |
91 |
79 |
92 if(completionCode != KErrNone) |
80 if(completionCode != KErrNone) |
93 { |
81 { |
94 OstTrace1(TRACE_NORMAL, CSOFTWARECONNECTTIMER_RUNL, "<Error %d> software connect/disconnect timer error",completionCode); |
82 RDebug::Printf("<Error %d> software connect/disconnect timer error",completionCode); |
95 iTestDevice.ReportError(completionCode); |
83 iTestDevice.ReportError(completionCode); |
96 } |
84 } |
97 else |
85 else |
98 { |
86 { |
99 switch(iConnectType) |
87 switch(iConnectType) |