1 /* |
1 /* |
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008-2009 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". |
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implements concrete state |
|
15 * |
8 * |
16 */ |
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implements concrete state |
|
15 * |
|
16 */ |
17 |
17 |
18 |
18 #ifndef C_USBSTATEHOSTDELAYHANDLE_H |
19 #ifndef C_USBSTATEHOSTDALAYHANDLE_H |
|
20 #define C_USBSTATEHOSTDELAYHANDLE_H |
19 #define C_USBSTATEHOSTDELAYHANDLE_H |
21 |
20 |
22 #include "cusbotgwatcher.h" |
|
23 #include "cusbstatehosthandle.h" |
21 #include "cusbstatehosthandle.h" |
24 |
22 |
25 #ifndef STIF |
23 class CUsbOtgWatcher; |
26 #include "cusbnotifmanager.h" |
|
27 #include "cusbtimer.h" |
|
28 #else |
|
29 #include "mockcusbnotifmanager.h" |
|
30 #include "mockcusbtimer.h" |
|
31 #endif |
|
32 |
24 |
33 /** |
25 /** |
34 * This class implements behaviour when some problem needs vbus drop in a while, and mostly, user action. |
26 * problem handling, vbus not dropping |
35 * |
27 * |
36 */ |
28 */ |
37 NONSHARABLE_CLASS( CUsbStateHostDelayHandle ) : public CUsbStateHostHandle, |
29 NONSHARABLE_CLASS( CUsbStateHostDelayHandle ) : public CUsbStateHostHandle |
38 // MWaitNotifierObserver, |
|
39 MUsbTimerObserver |
|
40 // this means only one wait notifier at a time can be shown by this state, might be redesigned |
|
41 { |
30 { |
42 friend class CtUsbOtgWatcher; |
31 friend class CtUsbOtgWatcher; |
43 friend class CUsbOtgWatcher; |
32 friend class CUsbOtgWatcher; |
44 |
33 |
45 public: |
34 public: |
46 |
35 |
47 /** |
36 /** |
48 * Two-phased constructor. |
|
49 * @param aWatcher owner |
|
50 */ |
|
51 static CUsbStateHostDelayHandle* NewL(CUsbOtgWatcher* aWatcher); |
|
52 |
|
53 /** |
|
54 * Destructor. |
37 * Destructor. |
55 */ |
38 */ |
56 virtual ~CUsbStateHostDelayHandle(); |
39 virtual ~CUsbStateHostDelayHandle(); |
57 |
40 |
58 // From MUsbTimerObserver |
41 protected: |
59 /** |
|
60 * Call back when timer expired |
|
61 * @param aTimerId timer id |
|
62 */ |
|
63 void TimerElapsedL(TUsbTimerId aTimerId); |
|
64 |
42 |
65 // From VBus observer |
43 // From VBus observer |
66 /** |
44 /** |
67 * VBus down |
45 * VBus up |
68 */ |
46 */ |
69 void VBusUpL(); |
47 virtual void VBusUpL(); |
70 /** |
|
71 * VBus down |
|
72 */ |
|
73 void VBusDownL(); |
|
74 /** |
|
75 * VBus error happened |
|
76 */ |
|
77 void VBusErrorL(); |
|
78 |
|
79 // From OTG state observer |
|
80 /** |
|
81 * VBus error happen |
|
82 */ |
|
83 void AVBusErrorL(); |
|
84 |
48 |
85 // From Host Event notification observer |
49 // From Host Event notification observer |
86 /** |
50 /** |
87 * Device is attached |
51 * Device is attached |
88 * @param aInfo Device event data |
52 * @param aInfo Device event data |
89 */ |
53 */ |
90 void DeviceAttachedL(TDeviceEventInformation aInfo); |
54 virtual void DeviceAttachedL(TDeviceEventInformation aInfo); |
91 /** |
|
92 * Device is detached |
|
93 * @param aInfo Device event data |
|
94 */ |
|
95 void DeviceDetachedL(TDeviceEventInformation aInfo); |
|
96 /** |
|
97 * Connected to hub in wrong level |
|
98 */ |
|
99 void BadHubPositionL(); |
|
100 |
|
101 /** |
|
102 * SRP request received |
|
103 */ |
|
104 void SrpReceivedL(); |
|
105 |
|
106 //from CUsbState |
|
107 /** |
|
108 * State id |
|
109 * @return state id |
|
110 */ |
|
111 TUsbStateIds Id(); |
|
112 |
|
113 /** |
|
114 * This is called when switched to this state, |
|
115 * because If all conditions for transition to another state exist, nothing will |
|
116 * trigger it and transition will not happen. This forces the transition in such cases. |
|
117 * |
|
118 */ |
|
119 void JustAdvancedToThisStateL(); |
|
120 |
|
121 /** |
|
122 * This is called when leaving this state, |
|
123 * |
|
124 */ |
|
125 void JustBeforeLeavingThisStateL(); |
|
126 |
|
127 /** |
|
128 * handles issue |
|
129 */ |
|
130 void DoHandleL(); |
|
131 |
|
132 |
|
133 private: |
|
134 |
55 |
135 /** |
56 /** |
136 * Default constructor |
57 * Default constructor |
137 * @param aWatcher owner |
58 * @param aWatcher owner |
138 */ |
59 */ |
139 CUsbStateHostDelayHandle(CUsbOtgWatcher* aWatcher); |
60 CUsbStateHostDelayHandle(CUsbOtgWatcher& aWatcher); |
140 |
61 |
141 /** |
62 /** |
142 * 2nd phase construction |
63 * 2nd phase construction |
143 */ |
64 */ |
144 void ConstructL(); |
65 void ConstructL(); |
145 |
66 |
146 |
|
147 private: |
|
148 // data |
67 // data |
149 |
68 |
150 /** |
69 private: |
151 * too much power timer |
|
152 * own |
|
153 */ |
|
154 CUsbTimer* iTooMuchPowerTimer; |
|
155 |
|
156 /** |
|
157 * drivers not found |
|
158 * own |
|
159 */ |
|
160 CUsbTimer* iDriversNotFoundTimer; |
|
161 }; |
70 }; |
162 |
71 |
163 #endif // C_USBSTATEHOSTHANDLE_H |
72 #endif // C_USBSTATEHOSTDELAYHANDLE_H |