|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 @internalComponent |
|
23 @released |
|
24 */ |
|
25 |
|
26 #ifndef __CUSBOTGWATCHER_H__ |
|
27 #define __CUSBOTGWATCHER_H__ |
|
28 |
|
29 #include <e32def.h> |
|
30 #include <d32otgdi.h> |
|
31 #include <e32property.h> //Publish & Subscribe header |
|
32 |
|
33 class MUsbOtgObserver; |
|
34 class RUsbOtgDriver; |
|
35 class CUsbOtg; |
|
36 |
|
37 /** |
|
38 * The CUsbOtgIdPinWatcher class |
|
39 * |
|
40 * Talks directly to the USB OTG Logical Device Driver (LDD) and |
|
41 * watches ID-Pin changes. |
|
42 * Publishes TInt property as ID-Pin status |
|
43 */ |
|
44 class CUsbOtgBaseWatcher : public CActive |
|
45 { |
|
46 public: |
|
47 CUsbOtgBaseWatcher(RUsbOtgDriver& aLdd); |
|
48 virtual ~CUsbOtgBaseWatcher(); |
|
49 |
|
50 // From CActive |
|
51 virtual void RunL() = 0; |
|
52 virtual void DoCancel() = 0; |
|
53 |
|
54 virtual void Start(); |
|
55 |
|
56 protected: |
|
57 virtual void Post() = 0; |
|
58 |
|
59 protected: |
|
60 RUsbOtgDriver& iLdd; |
|
61 }; |
|
62 |
|
63 /** |
|
64 * The CUsbOtgIdPinWatcher class |
|
65 * |
|
66 * Talks directly to the USB OTG Logical Device Driver (LDD) and |
|
67 * watches ID-Pin changes. |
|
68 * Publishes TInt property as ID-Pin status |
|
69 */ |
|
70 NONSHARABLE_CLASS(CUsbOtgIdPinWatcher) : public CUsbOtgBaseWatcher |
|
71 { |
|
72 public: |
|
73 static CUsbOtgIdPinWatcher* NewL(RUsbOtgDriver& aLdd); |
|
74 virtual ~CUsbOtgIdPinWatcher(); |
|
75 |
|
76 // From CActive |
|
77 virtual void RunL(); |
|
78 virtual void DoCancel(); |
|
79 |
|
80 protected: |
|
81 CUsbOtgIdPinWatcher(RUsbOtgDriver& aLdd); |
|
82 void ConstructL(); |
|
83 virtual void Post(); |
|
84 |
|
85 private: |
|
86 RUsbOtgDriver::TOtgIdPin iOtgIdPin; |
|
87 }; |
|
88 |
|
89 /** |
|
90 * The CUsbOtgVBusWatcher class |
|
91 * |
|
92 * Talks directly to the USB OTG Logical Device Driver (LDD) and |
|
93 * watches ID-Pin changes. |
|
94 * Publishes TInt property as ID-Pin status |
|
95 */ |
|
96 NONSHARABLE_CLASS(CUsbOtgVbusWatcher) : public CUsbOtgBaseWatcher |
|
97 { |
|
98 public: |
|
99 static CUsbOtgVbusWatcher* NewL(RUsbOtgDriver& aLdd); |
|
100 virtual ~CUsbOtgVbusWatcher(); |
|
101 |
|
102 // From CActive |
|
103 virtual void RunL(); |
|
104 virtual void DoCancel(); |
|
105 |
|
106 protected: |
|
107 CUsbOtgVbusWatcher(RUsbOtgDriver& aLdd); |
|
108 void ConstructL(); |
|
109 virtual void Post(); |
|
110 |
|
111 private: |
|
112 RUsbOtgDriver::TOtgVbus iOtgVbus; |
|
113 }; |
|
114 |
|
115 /** |
|
116 * The CUsbOtgVBusWatcher class |
|
117 * |
|
118 * Talks directly to the USB OTG Logical Device Driver (LDD) and |
|
119 * watches ID-Pin changes. |
|
120 * Publishes TInt property as ID-Pin status |
|
121 */ |
|
122 NONSHARABLE_CLASS(CUsbOtgStateWatcher) : public CUsbOtgBaseWatcher |
|
123 { |
|
124 public: |
|
125 static CUsbOtgStateWatcher* NewL(RUsbOtgDriver& aLdd); |
|
126 virtual ~CUsbOtgStateWatcher(); |
|
127 |
|
128 // From CActive |
|
129 virtual void RunL(); |
|
130 virtual void DoCancel(); |
|
131 |
|
132 protected: |
|
133 CUsbOtgStateWatcher(RUsbOtgDriver& aLdd); |
|
134 void ConstructL(); |
|
135 virtual void Post(); |
|
136 |
|
137 private: |
|
138 RUsbOtgDriver::TOtgState iOtgState; |
|
139 }; |
|
140 |
|
141 /** |
|
142 * The CUsbOtgEventWatcher class |
|
143 * |
|
144 * Talks directly to the USB OTG Logical Device Driver (LDD) and |
|
145 * watches ID-Pin changes. |
|
146 * Publishes TInt property as ID-Pin status |
|
147 */ |
|
148 NONSHARABLE_CLASS(CUsbOtgEventWatcher) : public CUsbOtgBaseWatcher |
|
149 { |
|
150 public: |
|
151 static CUsbOtgEventWatcher* NewL(CUsbOtg& aOwner, RUsbOtgDriver& aLdd, |
|
152 RUsbOtgDriver::TOtgEvent& aOtgEvent); |
|
153 virtual ~CUsbOtgEventWatcher(); |
|
154 |
|
155 // From CActive |
|
156 virtual void RunL(); |
|
157 virtual void DoCancel(); |
|
158 |
|
159 protected: |
|
160 CUsbOtgEventWatcher(CUsbOtg& aOwner, RUsbOtgDriver& aLdd, RUsbOtgDriver::TOtgEvent& aOtgEvent); |
|
161 void ConstructL(); |
|
162 virtual void Post(); |
|
163 |
|
164 private: |
|
165 void LogEventText(RUsbOtgDriver::TOtgEvent /*aState*/); |
|
166 |
|
167 private: |
|
168 CUsbOtg& iOwner; |
|
169 RUsbOtgDriver::TOtgEvent& iOtgEvent; |
|
170 }; |
|
171 |
|
172 /** |
|
173 * The CUsbOtgConnectionIdleWatcher class |
|
174 * |
|
175 * Talks directly to the USB OTG Logical Device Driver (LDD) and |
|
176 * watches Connection Idle changes. |
|
177 * Publishes TInt property as Connection Idle status |
|
178 */ |
|
179 NONSHARABLE_CLASS(CUsbOtgConnectionIdleWatcher) : public CUsbOtgBaseWatcher |
|
180 { |
|
181 public: |
|
182 static CUsbOtgConnectionIdleWatcher* NewL(RUsbOtgDriver& aLdd); |
|
183 virtual ~CUsbOtgConnectionIdleWatcher(); |
|
184 |
|
185 // From CActive |
|
186 virtual void RunL(); |
|
187 virtual void DoCancel(); |
|
188 |
|
189 protected: |
|
190 CUsbOtgConnectionIdleWatcher(RUsbOtgDriver& aLdd); |
|
191 void ConstructL(); |
|
192 virtual void Post(); |
|
193 |
|
194 private: |
|
195 RUsbOtgDriver::TOtgConnection iConnectionIdle; |
|
196 }; |
|
197 |
|
198 |
|
199 /** |
|
200 * The CUsbOtgWatcher class |
|
201 * |
|
202 * Talks directly to the USB OTG Logical Device Driver (LDD) and |
|
203 * watches any messages/errors which occur |
|
204 */ |
|
205 NONSHARABLE_CLASS(CUsbOtgWatcher) : public CActive |
|
206 { |
|
207 public: |
|
208 static CUsbOtgWatcher* NewL(MUsbOtgObserver& aOwner, RUsbOtgDriver& aLdd, TUint& aOtgMessage); |
|
209 virtual ~CUsbOtgWatcher(); |
|
210 |
|
211 // From CActive |
|
212 virtual void RunL(); |
|
213 virtual void DoCancel(); |
|
214 |
|
215 virtual void Start(); |
|
216 |
|
217 protected: |
|
218 CUsbOtgWatcher(MUsbOtgObserver& aOwner, RUsbOtgDriver& aLdd, TUint& aOtgMessage); |
|
219 void Post(); |
|
220 |
|
221 private: |
|
222 MUsbOtgObserver& iOwner; |
|
223 RUsbOtgDriver& iLdd; |
|
224 TUint& iOtgMessage; |
|
225 }; |
|
226 |
|
227 NONSHARABLE_CLASS(CRequestSessionWatcher) : public CActive |
|
228 { |
|
229 public: |
|
230 static CRequestSessionWatcher* NewL(MUsbOtgObserver& aOwner); |
|
231 ~CRequestSessionWatcher(); |
|
232 |
|
233 private: |
|
234 CRequestSessionWatcher(MUsbOtgObserver& aOwner); |
|
235 void ConstructL(); |
|
236 |
|
237 // From CActive |
|
238 virtual void RunL(); |
|
239 virtual void DoCancel(); |
|
240 |
|
241 private: |
|
242 RProperty iProp; |
|
243 MUsbOtgObserver& iOwner; |
|
244 }; |
|
245 |
|
246 #endif |
|
247 |