1 /* |
|
2 * Copyright (c) 2008-2008 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_USBSTATEHOSTAINITIATEBASE_H |
|
20 #define C_USBSTATEHOSTAINITIATEBASE_H |
|
21 |
|
22 #include "cusbotgwatcher.h" |
|
23 #include "cusbstatehostabase.h" |
|
24 #include "cusbpersonalityswitch.h" |
|
25 #ifndef STIF |
|
26 #include "cusbtimer.h" |
|
27 #else |
|
28 #include "mockcusbtimer.h" |
|
29 #endif |
|
30 |
|
31 /** |
|
32 * This class implements besic behaviour when Id pin on, and vbus just turned down or just turned on, |
|
33 * specific concrete case/state is implemented in subclass |
|
34 */ |
|
35 NONSHARABLE_CLASS( CUsbStateHostAInitiateBase ) : public CUsbStateHostABase, |
|
36 MUsbTimerObserver, MUsbPersonalitySwitchObserver |
|
37 |
|
38 { |
|
39 friend class CTestUsbOtgWatcher; |
|
40 |
|
41 public: |
|
42 |
|
43 /** |
|
44 * Destructor. |
|
45 */ |
|
46 virtual ~CUsbStateHostAInitiateBase(); |
|
47 |
|
48 // From MUsbTimerObserver |
|
49 /** |
|
50 * timer expired call back |
|
51 * @param aTimerId timer id |
|
52 */ |
|
53 void TimerElapsedL(TUsbTimerId aTimerId); |
|
54 |
|
55 void UsbPersonalitySwitchStateChangedL(MUsbPersonalitySwitchObserver::TState aState, TInt aData); |
|
56 |
|
57 protected: |
|
58 |
|
59 /** |
|
60 * Default construction |
|
61 * @param aWatcher owner |
|
62 */ |
|
63 CUsbStateHostAInitiateBase(CUsbOtgWatcher* aWatcher); |
|
64 |
|
65 /** |
|
66 * 2nd phase construction |
|
67 */ |
|
68 void ConstructL(); |
|
69 |
|
70 //from CUsbState |
|
71 |
|
72 /** |
|
73 * This is called when switched to this state, |
|
74 * because If all conditions for transition to another state exist, nothing will |
|
75 * trigger it and transition will not happen. This forces the transition in such cases. |
|
76 * |
|
77 */ |
|
78 virtual void JustBeforeLeavingThisStateL(); |
|
79 |
|
80 // From VBus observer |
|
81 /** |
|
82 * VBus down |
|
83 */ |
|
84 virtual void VBusDownL(); |
|
85 /** |
|
86 * VBus UP |
|
87 */ |
|
88 virtual void VBusUpL(); |
|
89 |
|
90 /** |
|
91 * AHost |
|
92 */ |
|
93 virtual void AHostL(); |
|
94 |
|
95 /** |
|
96 * APeripheral |
|
97 */ |
|
98 virtual void APeripheralL(); |
|
99 |
|
100 // From Host Event notification observer |
|
101 /** |
|
102 * Device is attached |
|
103 * @param Device event data |
|
104 */ |
|
105 virtual void DeviceAttachedL(TDeviceEventInformation); |
|
106 /** |
|
107 * Device is detached |
|
108 * @param Device event data |
|
109 */ |
|
110 virtual void DriverLoadSuccessL(TDeviceEventInformation); |
|
111 /** |
|
112 * Drivers loaded partially |
|
113 * @param Device event data |
|
114 */ |
|
115 virtual void DriverLoadPartialSuccessL(TDeviceEventInformation); |
|
116 /** |
|
117 * Drivers loading failed |
|
118 * @param Device event data |
|
119 */ |
|
120 virtual void DriverLoadFailureL(TDeviceEventInformation); |
|
121 |
|
122 // From message notification observer |
|
123 /** |
|
124 * SRP request received |
|
125 */ |
|
126 virtual void SrpReceivedL(); |
|
127 |
|
128 protected: |
|
129 // data |
|
130 |
|
131 /* |
|
132 * attachment timer |
|
133 * own |
|
134 */ |
|
135 CUsbTimer* iAttachmentTimer; |
|
136 |
|
137 CUsbPersonalitySwitch* iUsbPersonalitySwitch; |
|
138 }; |
|
139 |
|
140 #endif // C_USBSTATEHOSTAINITIATEBASE_H |
|