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: |
17 |
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implements concrete state |
|
15 * |
|
16 */ |
18 |
17 |
19 #ifndef C_USBSTATEHOSTHANDLE_H |
18 #ifndef C_USBSTATEHOSTHANDLE_H |
20 #define C_USBSTATEHOSTHANDLE_H |
19 #define C_USBSTATEHOSTHANDLE_H |
21 |
20 |
22 #include "cusbotgwatcher.h" |
21 #include "cusbstatehostabase.h" |
23 #include "cusbstate.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, and mostly, user action. |
26 * problem handling base class |
35 * |
27 * |
36 */ |
28 */ |
37 NONSHARABLE_CLASS( CUsbStateHostHandle ) : public CUsbState, |
29 NONSHARABLE_CLASS( CUsbStateHostHandle ) : public CUsbStateHostABase |
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 |
|
47 /** |
|
48 * Two-phased constructor. |
|
49 * @param aWatcher owner |
|
50 */ |
|
51 static CUsbStateHostHandle* NewL(CUsbOtgWatcher* aWatcher); |
|
52 |
35 |
53 /** |
36 /** |
54 * Destructor. |
37 * Destructor. |
55 */ |
38 */ |
56 virtual ~CUsbStateHostHandle(); |
39 virtual ~CUsbStateHostHandle(); |
59 * Sets id of the issue to be handled |
42 * Sets id of the issue to be handled |
60 * @param aWhat issue id |
43 * @param aWhat issue id |
61 */ |
44 */ |
62 void SetWhat(TInt aWhat); |
45 void SetWhat(TInt aWhat); |
63 |
46 |
64 // from MWaitNotifierObserver |
47 protected: |
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 |
48 |
154 // From message notification observer |
49 // From message notification observer |
155 /** |
50 /** |
156 * Message received |
51 * Message received |
157 * @param aMessage message id |
52 * @param aMessage message id |
158 */ |
53 */ |
159 void MessageNotificationReceivedL(TInt aMessage); |
54 virtual void MessageNotificationReceivedL(TInt aMessage); |
160 /** |
55 |
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 /** |
56 /** |
173 * Session request received |
57 * Session request received |
174 */ |
58 */ |
175 void SessionRequestedL(); |
59 virtual 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 |
60 |
195 /** |
61 /** |
196 * This is called when switched to this state, |
62 * This is called when switched to this state, |
197 * because If all conditions for transition to another state exist, nothing will |
63 * 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. |
64 * trigger it and transition will not happen. This forces the transition in such cases. |
199 * |
65 * |
200 */ |
66 */ |
201 void JustAdvancedToThisStateL(); |
67 virtual void JustAdvancedToThisStateL(); |
202 |
|
203 /** |
|
204 * This is called when leaving this state, |
|
205 * |
|
206 */ |
|
207 void JustBeforeLeavingThisStateL(); |
|
208 |
68 |
209 /** |
69 /** |
210 * handles issue |
70 * handles issue |
211 */ |
71 */ |
212 void DoHandleL(); |
72 virtual void DoHandleL() = 0; |
213 |
73 |
214 private: |
74 /** |
|
75 * Default constructor |
|
76 * @param aWatcher owner |
|
77 */ |
|
78 CUsbStateHostHandle(CUsbOtgWatcher& aWatcher); |
|
79 |
|
80 /** |
|
81 * 2nd phase construction |
|
82 */ |
|
83 void ConstructL(); |
|
84 |
215 // data |
85 // data |
216 |
86 |
217 /** |
87 /** |
218 * identifies situation to be handled |
88 * identifies situation to be handled |
219 */ |
89 */ |
220 TInt iWhat; |
90 TInt iWhat; |
221 |
91 |
222 /** |
92 private: |
223 * too much power timer |
|
224 * own |
|
225 */ |
|
226 CUsbTimer* iTooMuchPowerTimer; |
|
227 |
|
228 /** |
|
229 * drivers not found |
|
230 * own |
|
231 */ |
|
232 CUsbTimer* iDriversNotFoundTimer; |
|
233 }; |
93 }; |
234 |
94 |
235 #endif // C_USBSTATEHOSTHANDLE_H |
95 #endif // C_USBSTATEHOSTHANDLE_H |