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