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 // this means only one wait notifier at a time can be shown by this state, might be redesigned |
|
40 { |
30 { |
41 friend class CtUsbOtgWatcher; |
31 friend class CtUsbOtgWatcher; |
42 friend class CUsbOtgWatcher; |
32 friend class CUsbOtgWatcher; |
43 |
33 |
44 public: |
34 public: |
45 |
|
46 /** |
|
47 * Two-phased constructor. |
|
48 * @param aWatcher owner |
|
49 */ |
|
50 static CUsbStateHostHandle* NewL(CUsbOtgWatcher* aWatcher); |
|
51 |
35 |
52 /** |
36 /** |
53 * Destructor. |
37 * Destructor. |
54 */ |
38 */ |
55 virtual ~CUsbStateHostHandle(); |
39 virtual ~CUsbStateHostHandle(); |
58 * Sets id of the issue to be handled |
42 * Sets id of the issue to be handled |
59 * @param aWhat issue id |
43 * @param aWhat issue id |
60 */ |
44 */ |
61 void SetWhat(TInt aWhat); |
45 void SetWhat(TInt aWhat); |
62 |
46 |
63 // from MWaitNotifierObserver |
47 protected: |
64 /** |
|
65 * Callback when notifier is completed |
|
66 * @param aFeedback how notifier completed |
|
67 */ |
|
68 void WaitNotifierCompletedL(TInt aFeedback); |
|
69 |
|
70 // From VBus observer |
|
71 /** |
|
72 * VBus down |
|
73 */ |
|
74 virtual void VBusUpL(); |
|
75 /** |
|
76 * VBus down |
|
77 */ |
|
78 virtual void VBusDownL(); |
|
79 /** |
|
80 * VBus error happened |
|
81 */ |
|
82 virtual void VBusErrorL(); |
|
83 |
|
84 // From OTG state observer |
|
85 /** |
|
86 * Became to Idle when A |
|
87 */ |
|
88 virtual void AIdleL(); |
|
89 /** |
|
90 * Became a Host when A |
|
91 */ |
|
92 virtual void AHostL(); |
|
93 /** |
|
94 * Became a peripheral when A |
|
95 */ |
|
96 virtual void APeripheralL(); |
|
97 /** |
|
98 * VBus error happen |
|
99 */ |
|
100 virtual void AVBusErrorL(); |
|
101 |
|
102 // From bus activity observer |
|
103 /** |
|
104 * Bus is in idle |
|
105 */ |
|
106 virtual void BusIdleL(); |
|
107 /** |
|
108 * Bus active |
|
109 */ |
|
110 virtual void BusActiveL(); |
|
111 |
|
112 // From Host Event notification observer |
|
113 /** |
|
114 * Device is attached |
|
115 * @param aInfo Device event data |
|
116 */ |
|
117 void DeviceAttachedL(TDeviceEventInformation aInfo); |
|
118 /** |
|
119 * Device is detached |
|
120 * @param aInfo Device event data |
|
121 */ |
|
122 void DeviceDetachedL(TDeviceEventInformation aInfo); |
|
123 |
|
124 /** |
|
125 * Drivers successfully loaded |
|
126 * @param aInfo Device event data |
|
127 */ |
|
128 virtual void DriverLoadSuccessL(TDeviceEventInformation aInfo); |
|
129 /** |
|
130 * Drivers loaded partially |
|
131 * @param aInfo Device event data |
|
132 */ |
|
133 virtual void DriverLoadPartialSuccessL(TDeviceEventInformation aInfo); |
|
134 /** |
|
135 * Drivers loading failed |
|
136 * @param aInfo Device event data |
|
137 */ |
|
138 virtual void DriverLoadFailureL(TDeviceEventInformation aInfo); |
|
139 |
48 |
140 // From message notification observer |
49 // From message notification observer |
141 /** |
50 /** |
142 * Message received |
51 * Message received |
143 * @param aMessage message id |
52 * @param aMessage message id |
144 */ |
53 */ |
145 virtual void MessageNotificationReceivedL(TInt aMessage); |
54 virtual void MessageNotificationReceivedL(TInt aMessage); |
146 |
55 |
147 /** |
56 /** |
148 * SRP request received |
|
149 */ |
|
150 virtual void SrpReceivedL(); |
|
151 /** |
|
152 * Session request received |
57 * Session request received |
153 */ |
58 */ |
154 virtual void SessionRequestedL(); |
59 virtual void SessionRequestedL(); |
155 |
|
156 //from CUsbState |
|
157 /** |
|
158 * State id |
|
159 * @return state id |
|
160 */ |
|
161 virtual TUsbStateIds Id(); |
|
162 |
60 |
163 /** |
61 /** |
164 * This is called when switched to this state, |
62 * This is called when switched to this state, |
165 * 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 |
166 * 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. |
167 * |
65 * |
168 */ |
66 */ |
169 virtual void JustAdvancedToThisStateL(); |
67 virtual void JustAdvancedToThisStateL(); |
170 |
68 |
171 /** |
69 /** |
172 * This is called when leaving this state, |
|
173 * |
|
174 */ |
|
175 virtual void JustBeforeLeavingThisStateL(); |
|
176 |
|
177 /** |
|
178 * handles issue |
70 * handles issue |
179 */ |
71 */ |
180 virtual void DoHandleL(); |
72 virtual void DoHandleL() = 0; |
181 |
|
182 protected: |
|
183 |
73 |
184 /** |
74 /** |
185 * Default constructor |
75 * Default constructor |
186 * @param aWatcher owner |
76 * @param aWatcher owner |
187 */ |
77 */ |
188 CUsbStateHostHandle(CUsbOtgWatcher* aWatcher); |
78 CUsbStateHostHandle(CUsbOtgWatcher& aWatcher); |
189 |
79 |
190 /** |
80 /** |
191 * 2nd phase construction |
81 * 2nd phase construction |
192 */ |
82 */ |
193 void ConstructL(); |
83 void ConstructL(); |
194 |
84 |
195 protected: |
|
196 // data |
85 // data |
197 |
86 |
198 /** |
87 /** |
199 * identifies situation to be handled |
88 * identifies situation to be handled |
200 */ |
89 */ |
201 TInt iWhat; |
90 TInt iWhat; |
202 |
91 |
|
92 private: |
203 }; |
93 }; |
204 |
94 |
205 #endif // C_USBSTATEHOSTHANDLE_H |
95 #endif // C_USBSTATEHOSTHANDLE_H |