1 /* |
1 /* |
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
22 |
22 |
23 #include "msmmterminator.h" |
23 #include "msmmterminator.h" |
24 #include "eventqueue.h" |
24 #include "eventqueue.h" |
25 |
25 |
26 #include <usb/usblogger.h> |
26 #include <usb/usblogger.h> |
|
27 #include "OstTraceDefinitions.h" |
|
28 #ifdef OST_TRACE_COMPILER_IN_USE |
|
29 #include "msmmterminatorTraces.h" |
|
30 #endif |
27 |
31 |
28 #ifdef __FLOG_ACTIVE |
|
29 _LIT8(KLogComponent, "UsbHostMsmmServer"); |
|
30 #endif |
|
31 |
32 |
32 const TInt KShutdownDelay = 2000000; // approx 2 seconds |
33 const TInt KShutdownDelay = 2000000; // approx 2 seconds |
33 const TInt KMsmmTerminatorPriority = CActive::EPriorityStandard; |
34 const TInt KMsmmTerminatorPriority = CActive::EPriorityStandard; |
34 |
35 |
35 CMsmmTerminator* CMsmmTerminator::NewL(const CDeviceEventQueue& anEventQueue) |
36 CMsmmTerminator* CMsmmTerminator::NewL(const CDeviceEventQueue& anEventQueue) |
36 { |
37 { |
37 LOG_STATIC_FUNC_ENTRY |
38 OstTraceFunctionEntry0( CMSMMTERMINATOR_NEWL_ENTRY ); |
|
39 |
38 CMsmmTerminator* self = new (ELeave) CMsmmTerminator(anEventQueue); |
40 CMsmmTerminator* self = new (ELeave) CMsmmTerminator(anEventQueue); |
39 CleanupStack::PushL(self); |
41 CleanupStack::PushL(self); |
40 self->ConstructL(); |
42 self->ConstructL(); |
41 CleanupStack::Pop(self); |
43 CleanupStack::Pop(self); |
|
44 OstTraceFunctionExit0( CMSMMTERMINATOR_NEWL_EXIT ); |
42 return self; |
45 return self; |
43 } |
46 } |
44 |
47 |
45 void CMsmmTerminator::Start() |
48 void CMsmmTerminator::Start() |
46 { |
49 { |
47 LOG_FUNC |
50 OstTraceFunctionEntry0( CMSMMTERMINATOR_START_ENTRY ); |
|
51 |
48 After(KShutdownDelay); |
52 After(KShutdownDelay); |
|
53 OstTraceFunctionExit0( CMSMMTERMINATOR_START_EXIT ); |
49 } |
54 } |
50 |
55 |
51 void CMsmmTerminator::RunL() |
56 void CMsmmTerminator::RunL() |
52 { |
57 { |
53 LOG_FUNC |
58 OstTraceFunctionEntry0( CMSMMTERMINATOR_RUNL_ENTRY ); |
|
59 |
54 if (iEventQueue.Count()) |
60 if (iEventQueue.Count()) |
55 { |
61 { |
56 // There are some events still in the event queue to |
62 // There are some events still in the event queue to |
57 // wait to be handled. Restart the shutdown timer. |
63 // wait to be handled. Restart the shutdown timer. |
58 Start(); |
64 Start(); |
59 } |
65 } |
60 else |
66 else |
61 { |
67 { |
62 CActiveScheduler::Stop(); |
68 CActiveScheduler::Stop(); |
63 } |
69 } |
|
70 OstTraceFunctionExit0( CMSMMTERMINATOR_RUNL_EXIT ); |
64 } |
71 } |
65 |
72 |
66 CMsmmTerminator::CMsmmTerminator(const CDeviceEventQueue& anEventQueue): |
73 CMsmmTerminator::CMsmmTerminator(const CDeviceEventQueue& anEventQueue): |
67 CTimer(KMsmmTerminatorPriority), |
74 CTimer(KMsmmTerminatorPriority), |
68 iEventQueue(anEventQueue) |
75 iEventQueue(anEventQueue) |
69 { |
76 { |
70 LOG_FUNC |
77 OstTraceFunctionEntry0( CMSMMTERMINATOR_CMSMMTERMINATOR_CONS_ENTRY ); |
|
78 |
71 CActiveScheduler::Add(this); |
79 CActiveScheduler::Add(this); |
|
80 OstTraceFunctionExit0( CMSMMTERMINATOR_CMSMMTERMINATOR_CONS_EXIT ); |
72 } |
81 } |
73 |
82 |
74 void CMsmmTerminator::ConstructL() |
83 void CMsmmTerminator::ConstructL() |
75 { |
84 { |
76 LOG_FUNC |
85 OstTraceFunctionEntry0( CMSMMTERMINATOR_CONSTRUCTL_ENTRY ); |
|
86 |
77 CTimer::ConstructL(); |
87 CTimer::ConstructL(); |
|
88 OstTraceFunctionExit0( CMSMMTERMINATOR_CONSTRUCTL_EXIT ); |
78 } |
89 } |
79 |
90 |
80 // End of file |
91 // End of file |