|
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: Implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "cusbstatehostaidle.h" |
|
20 #include "cusbnotifmanager.h" |
|
21 |
|
22 #ifndef STIF |
|
23 #include "cusbtimer.h" |
|
24 #else |
|
25 #include "mockcusbtimer.h" |
|
26 #endif |
|
27 #include "definitions.h" |
|
28 |
|
29 #include "errors.h" |
|
30 #include "debug.h" |
|
31 #include "panic.h" |
|
32 |
|
33 // --------------------------------------------------------------------------- |
|
34 // |
|
35 // --------------------------------------------------------------------------- |
|
36 // |
|
37 CUsbStateHostAIdle::CUsbStateHostAIdle(CUsbOtgWatcher* aWatcher) : |
|
38 CUsbStateHostAInitiateBase(aWatcher) |
|
39 { |
|
40 } |
|
41 |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 // --------------------------------------------------------------------------- |
|
45 // |
|
46 void CUsbStateHostAIdle::ConstructL() |
|
47 { |
|
48 FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAIdle::ConstructL" ) ); |
|
49 |
|
50 CUsbStateHostAInitiateBase::ConstructL(); |
|
51 } |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 |
|
57 CUsbStateHostAIdle* CUsbStateHostAIdle::NewL(CUsbOtgWatcher* aWatcher) |
|
58 { |
|
59 FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAIdle::NewL" ) ); |
|
60 |
|
61 CUsbStateHostAIdle* self = new (ELeave) CUsbStateHostAIdle(aWatcher); |
|
62 CleanupStack::PushL(self); |
|
63 self->ConstructL(); |
|
64 CleanupStack::Pop(self); |
|
65 return self; |
|
66 } |
|
67 |
|
68 // --------------------------------------------------------------------------- |
|
69 // |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 CUsbStateHostAIdle::~CUsbStateHostAIdle() |
|
73 { |
|
74 FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAIdle::~CUsbStateHostAIdle" ) ); |
|
75 } |
|
76 |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 // --------------------------------------------------------------------------- |
|
80 // |
|
81 TUsbStateIds CUsbStateHostAIdle::Id() |
|
82 { |
|
83 FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAIdle::Id" ) ); |
|
84 |
|
85 return EUsbStateHostAIdle; |
|
86 } |
|
87 |
|
88 // --------------------------------------------------------------------------- |
|
89 // |
|
90 // --------------------------------------------------------------------------- |
|
91 // |
|
92 void CUsbStateHostAIdle::JustAdvancedToThisStateL() |
|
93 { |
|
94 FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAIdle::JustAdvancedToThisStateL" ) ); |
|
95 |
|
96 iWatcher->PrintStateToLog(); |
|
97 |
|
98 iWatcher->NotifManager()->ShowIndicatorL(EFalse); |
|
99 |
|
100 // do BusDrop, if Up |
|
101 if (CUsbVBusObserver::EVBusUp == iWatcher->VBusObserver()->VBus()) |
|
102 { |
|
103 TInt err = iWatcher->Usb().BusDrop(); |
|
104 if (err != KErrNone) |
|
105 { |
|
106 err = iWatcher->Usb().BusClearError(); |
|
107 if (KErrNone != err) |
|
108 { |
|
109 iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection); |
|
110 } |
|
111 } |
|
112 } |
|
113 } |