|
1 /* |
|
2 * Copyright (c) 2006 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: Common timer class for UsbMscPersonality |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32base.h> |
|
20 #include "CUsbMscPersonalityTimer.h" |
|
21 #include "CUsbActiveMscHandlerMdrv.h" |
|
22 #include "debug.h" |
|
23 |
|
24 CUsbMscPersonalityTimer::CUsbMscPersonalityTimer(TCallBack aCallBack, |
|
25 TTimeIntervalMicroSeconds32 aTime) |
|
26 : CActive( EPriorityStandard ), |
|
27 iCallBack(aCallBack), |
|
28 iTime(aTime) |
|
29 { |
|
30 FLOG(_L("[USBWATCHER]\tCUsbMscPersonalityTimer::CUsbMscPersonalityTimer")); |
|
31 iTimer.CreateLocal(); |
|
32 CActiveScheduler::Add(this); |
|
33 } |
|
34 |
|
35 CUsbMscPersonalityTimer::~CUsbMscPersonalityTimer() |
|
36 { |
|
37 FLOG(_L("[USBWATCHER]\tCUsbMscPersonalityTimer::~CUsbMscPersonalityTimer")); |
|
38 Cancel(); |
|
39 iTimer.Close(); |
|
40 } |
|
41 |
|
42 void CUsbMscPersonalityTimer::Start() |
|
43 { |
|
44 FLOG(_L("[USBWATCHER]\tCUsbMscPersonalityTimer::Start")); |
|
45 iTimer.After(iStatus, iTime); |
|
46 SetActive(); |
|
47 } |
|
48 |
|
49 void CUsbMscPersonalityTimer::RunL() |
|
50 { |
|
51 FLOG(_L("[USBWATCHER]\tCUsbMscPersonalityTimer::RunL")); |
|
52 |
|
53 if (iStatus == KErrNone) |
|
54 { |
|
55 iCallBack.CallBack(); |
|
56 } |
|
57 } |
|
58 |
|
59 void CUsbMscPersonalityTimer::DoCancel() |
|
60 { |
|
61 FLOG(_L("[USBWATCHER]\tCUsbMscPersonalityTimer::DoCancel")); |
|
62 iTimer.Cancel(); |
|
63 } |
|
64 |
|
65 TInt CUsbMscPersonalityTimer::RunError(TInt /*aError*/) |
|
66 { |
|
67 FLOG(_L("[USBWATCHER]\tCUsbMscPersonalityTimer::RunError")); |
|
68 return KErrNone; |
|
69 } |
|
70 |
|
71 // End of file |