|
1 /* |
|
2 * Copyright (c) 2007-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 #ifndef __FDFTEST_H__ |
|
19 #define __FDFTEST_H__ |
|
20 |
|
21 #include "testbase.h" |
|
22 #include "usbhoststack.h" |
|
23 #include <d32otgdi.h> |
|
24 #include <d32otgdi_errors.h> |
|
25 |
|
26 class RUsbOtgDriver; |
|
27 |
|
28 //-------------------------------- |
|
29 |
|
30 NONSHARABLE_CLASS(MNotifyDeviceEventObserver) |
|
31 { |
|
32 public: |
|
33 virtual void MndeoDeviceEvent() = 0; |
|
34 }; |
|
35 |
|
36 NONSHARABLE_CLASS(CActiveNotifyDeviceEvent) : public CActive |
|
37 { |
|
38 public: |
|
39 static CActiveNotifyDeviceEvent* NewL(RUsbHostStack& aUsbHostStack, |
|
40 MNotifyDeviceEventObserver& aObserver, |
|
41 TDeviceEventInformation& aDeviceEventInformation); |
|
42 ~CActiveNotifyDeviceEvent(); |
|
43 |
|
44 public: |
|
45 void Post(); |
|
46 |
|
47 private: |
|
48 CActiveNotifyDeviceEvent(RUsbHostStack& aUsbHostStack, |
|
49 MNotifyDeviceEventObserver& aObserver, |
|
50 TDeviceEventInformation& aDeviceEventInformation); |
|
51 |
|
52 private: // from CActive |
|
53 void RunL(); |
|
54 void DoCancel(); |
|
55 |
|
56 private: // unowned |
|
57 RUsbHostStack& iUsbHostStack; |
|
58 MNotifyDeviceEventObserver& iObserver; |
|
59 TDeviceEventInformation& iDeviceEventInformation; |
|
60 }; |
|
61 |
|
62 //-------------------------------- |
|
63 |
|
64 NONSHARABLE_CLASS(MNotifyDevmonEventObserver) |
|
65 { |
|
66 public: |
|
67 virtual void MndeoDevmonEvent() = 0; |
|
68 }; |
|
69 |
|
70 NONSHARABLE_CLASS(CActiveNotifyDevmonEvent) : public CActive |
|
71 { |
|
72 public: |
|
73 static CActiveNotifyDevmonEvent* NewL(RUsbHostStack& aUsbHostStack, |
|
74 MNotifyDevmonEventObserver& aObserver, |
|
75 TInt& aError); |
|
76 ~CActiveNotifyDevmonEvent(); |
|
77 |
|
78 public: |
|
79 void Post(); |
|
80 |
|
81 private: |
|
82 CActiveNotifyDevmonEvent(RUsbHostStack& aUsbHostStack, |
|
83 MNotifyDevmonEventObserver& aObserver, |
|
84 TInt& aError); |
|
85 |
|
86 private: // from CActive |
|
87 void RunL(); |
|
88 void DoCancel(); |
|
89 |
|
90 private: // unowned |
|
91 RUsbHostStack& iUsbHostStack; |
|
92 MNotifyDevmonEventObserver& iObserver; |
|
93 TInt& iEvent; |
|
94 }; |
|
95 |
|
96 //-------------------------------- |
|
97 |
|
98 /** |
|
99 Test for Function Driver Framework. |
|
100 Acts very approximately as USBMAN in the USB Host architecture. |
|
101 */ |
|
102 class CFdfTest : public CTestBase, |
|
103 public MNotifyDeviceEventObserver, |
|
104 public MNotifyDevmonEventObserver |
|
105 { |
|
106 public: |
|
107 static CTestBase* NewL(MTestManager& aManager); |
|
108 ~CFdfTest(); |
|
109 |
|
110 private: |
|
111 CFdfTest(MTestManager& aManager); |
|
112 void ConstructL(); |
|
113 |
|
114 private: // from CTestBase |
|
115 void ProcessKeyL(TKeyCode aKeyCode); |
|
116 void DisplayTestSpecificMenu(); |
|
117 |
|
118 private: // from MNotifyDeviceEventObserver |
|
119 void MndeoDeviceEvent(); |
|
120 |
|
121 private: // from MNotifyDevmonEventObserver |
|
122 void MndeoDevmonEvent(); |
|
123 |
|
124 private: // owned |
|
125 // The handle we use when we're pretending to be USBMAN. |
|
126 RUsbHostStack iUsbHostStack; |
|
127 |
|
128 //needed because it starts usbdi |
|
129 RUsbOtgDriver iOtgDriver; |
|
130 TInt iBusRequested; |
|
131 CActiveNotifyDeviceEvent* iNotifyDeviceEvent; |
|
132 TDeviceEventInformation iDeviceEventInformation; |
|
133 |
|
134 CActiveNotifyDevmonEvent* iNotifyDevmonEvent; |
|
135 TInt iDevmonEvent; |
|
136 }; |
|
137 |
|
138 #endif // __FDFTEST_H__ |