|
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: Implements concrete state |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_USBSTATEHOSTHANDLE_H |
|
20 #define C_USBSTATEHOSTHANDLE_H |
|
21 |
|
22 #include "cusbotgwatcher.h" |
|
23 #include "cusbstate.h" |
|
24 |
|
25 #ifndef STIF |
|
26 #include "cusbnotifmanager.h" |
|
27 #include "cusbtimer.h" |
|
28 #else |
|
29 #include "mockcusbnotifmanager.h" |
|
30 #include "mockcusbtimer.h" |
|
31 #endif |
|
32 |
|
33 /** |
|
34 * This class implements behaviour when some problem needs vbus drop, and mostly, user action. |
|
35 * |
|
36 */ |
|
37 NONSHARABLE_CLASS( CUsbStateHostHandle ) : public CUsbState, |
|
38 MWaitNotifierObserver, |
|
39 MUsbTimerObserver |
|
40 // this means only one wait notifier at a time can be shown by this state, might be redesigned |
|
41 { |
|
42 friend class CtUsbOtgWatcher; |
|
43 friend class CUsbOtgWatcher; |
|
44 |
|
45 public: |
|
46 |
|
47 /** |
|
48 * Two-phased constructor. |
|
49 * @param aWatcher owner |
|
50 */ |
|
51 static CUsbStateHostHandle* NewL(CUsbOtgWatcher* aWatcher); |
|
52 |
|
53 /** |
|
54 * Destructor. |
|
55 */ |
|
56 virtual ~CUsbStateHostHandle(); |
|
57 |
|
58 /** |
|
59 * Sets id of the issue to be handled |
|
60 * @param aWhat issue id |
|
61 */ |
|
62 void SetWhat(TInt aWhat); |
|
63 |
|
64 // from MWaitNotifierObserver |
|
65 /** |
|
66 * Callback when notifier is completed |
|
67 * @param aFeedback how notifier completed |
|
68 */ |
|
69 void WaitNotifierCompletedL(TInt aFeedback); |
|
70 |
|
71 // From MUsbTimerObserver |
|
72 /** |
|
73 * Call back when timer expired |
|
74 * @param aTimerId timer id |
|
75 */ |
|
76 void TimerElapsedL(TUsbTimerId aTimerId); |
|
77 |
|
78 private: |
|
79 |
|
80 // From VBus observer |
|
81 /** |
|
82 * VBus down |
|
83 */ |
|
84 void VBusDownL(); |
|
85 |
|
86 // From OTG state observer |
|
87 /** |
|
88 * Became to Idle when A |
|
89 */ |
|
90 void AIdleL(); |
|
91 /** |
|
92 * Became a Host when A |
|
93 */ |
|
94 void AHostL(); |
|
95 /** |
|
96 * Became a peripheral when A |
|
97 */ |
|
98 void APeripheralL(); |
|
99 /** |
|
100 * VBus error happen |
|
101 */ |
|
102 void AVBusErrorL(); |
|
103 /** |
|
104 * Became to Idle when B |
|
105 */ |
|
106 void BIdleL(); |
|
107 /** |
|
108 * Became a peripheral when B |
|
109 */ |
|
110 void BPeripheralL(); |
|
111 /** |
|
112 * Became a Host when B |
|
113 */ |
|
114 void BHostL(); |
|
115 |
|
116 // From bus activity observer |
|
117 /** |
|
118 * Bus is in idle |
|
119 */ |
|
120 void BusIdleL(); |
|
121 /** |
|
122 * Bus active |
|
123 */ |
|
124 void BusActiveL(); |
|
125 |
|
126 // From Host Event notification observer |
|
127 /** |
|
128 * Device is attached |
|
129 * @param aInfo Device event data |
|
130 */ |
|
131 void DeviceAttachedL(TDeviceEventInformation aInfo); |
|
132 /** |
|
133 * Device is detached |
|
134 * @param aInfo Device event data |
|
135 */ |
|
136 void DeviceDetachedL(TDeviceEventInformation aInfo); |
|
137 |
|
138 /** |
|
139 * Drivers successfully loaded |
|
140 * @param aInfo Device event data |
|
141 */ |
|
142 virtual void DriverLoadSuccessL(TDeviceEventInformation aInfo); |
|
143 /** |
|
144 * Drivers loaded partially |
|
145 * @param aInfo Device event data |
|
146 */ |
|
147 virtual void DriverLoadPartialSuccessL(TDeviceEventInformation aInfo); |
|
148 /** |
|
149 * Drivers loading failed |
|
150 * @param aInfo Device event data |
|
151 */ |
|
152 virtual void DriverLoadFailureL(TDeviceEventInformation aInfo); |
|
153 |
|
154 // From message notification observer |
|
155 /** |
|
156 * Message received |
|
157 * @param aMessage message id |
|
158 */ |
|
159 void MessageNotificationReceivedL(TInt aMessage); |
|
160 /** |
|
161 * Connected to hub in wrong level |
|
162 */ |
|
163 void BadHubPositionL(); |
|
164 /** |
|
165 * VBus error happened |
|
166 */ |
|
167 void VBusErrorL(); |
|
168 /** |
|
169 * SRP request received |
|
170 */ |
|
171 void SrpReceivedL(); |
|
172 /** |
|
173 * Session request received |
|
174 */ |
|
175 void SessionRequestedL(); |
|
176 |
|
177 /** |
|
178 * Default constructor |
|
179 * @param aWatcher owner |
|
180 */ |
|
181 CUsbStateHostHandle(CUsbOtgWatcher* aWatcher); |
|
182 |
|
183 /** |
|
184 * 2nd phase construction |
|
185 */ |
|
186 void ConstructL(); |
|
187 |
|
188 //from CUsbState |
|
189 /** |
|
190 * State id |
|
191 * @return state id |
|
192 */ |
|
193 TUsbStateIds Id(); |
|
194 |
|
195 /** |
|
196 * This is called when switched to this state, |
|
197 * because If all conditions for transition to another state exist, nothing will |
|
198 * trigger it and transition will not happen. This forces the transition in such cases. |
|
199 * |
|
200 */ |
|
201 void JustAdvancedToThisStateL(); |
|
202 |
|
203 /** |
|
204 * This is called when leaving this state, |
|
205 * |
|
206 */ |
|
207 void JustBeforeLeavingThisStateL(); |
|
208 |
|
209 /** |
|
210 * handles issue |
|
211 */ |
|
212 void DoHandleL(); |
|
213 |
|
214 private: |
|
215 // data |
|
216 |
|
217 /** |
|
218 * identifies situation to be handled |
|
219 */ |
|
220 TInt iWhat; |
|
221 |
|
222 /** |
|
223 * too much power timer |
|
224 * own |
|
225 */ |
|
226 CUsbTimer* iTooMuchPowerTimer; |
|
227 }; |
|
228 |
|
229 #endif // C_USBSTATEHOSTHANDLE_H |