|
1 #ifndef __USB_HOST_DEVICE_H__ |
|
2 #define __USB_HOST_DEVICE_H__ |
|
3 |
|
4 /* |
|
5 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
6 * All rights reserved. |
|
7 * This component and the accompanying materials are made available |
|
8 * under the terms of the License "Eclipse Public License v1.0" |
|
9 * which accompanies this distribution, and is available |
|
10 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
11 * |
|
12 * Initial Contributors: |
|
13 * Nokia Corporation - initial contribution. |
|
14 * |
|
15 * Contributors: |
|
16 * |
|
17 * Description: |
|
18 * |
|
19 * |
|
20 */ |
|
21 |
|
22 /** |
|
23 @file UsbHostDevice.h |
|
24 */ |
|
25 |
|
26 #include <e32usbdi_hubdriver.h> |
|
27 |
|
28 namespace NUnitTesting_USBDI |
|
29 { |
|
30 |
|
31 /** |
|
32 */ |
|
33 class MUsbDeviceRemovalObserver |
|
34 { |
|
35 public: |
|
36 /** |
|
37 */ |
|
38 virtual void UsbDeviceRemovedL(TInt aError) = 0; |
|
39 }; |
|
40 |
|
41 /** |
|
42 This class represents Hosts representation of a USB device |
|
43 */ |
|
44 class CUsbHostDevice : public CActive |
|
45 { |
|
46 /** |
|
47 */ |
|
48 friend class CUsbDeviceWatcher; |
|
49 |
|
50 public: |
|
51 /** |
|
52 Constructor, 1st phase building a host representation of a usb device |
|
53 */ |
|
54 CUsbHostDevice(RUsbHubDriver& aUsbHubDriver); |
|
55 |
|
56 /** |
|
57 Destructor |
|
58 */ |
|
59 ~CUsbHostDevice(); |
|
60 |
|
61 /** |
|
62 Monitors for this device being removed from the host |
|
63 @param aUsbDeviceRemovalObserver an observer of device removal |
|
64 */ |
|
65 void MonitorRemovalL(MUsbDeviceRemovalObserver* aUsbDeviceRemovalObserver); |
|
66 |
|
67 private: // From CActive |
|
68 /** |
|
69 */ |
|
70 void DoCancel(); |
|
71 |
|
72 /** |
|
73 */ |
|
74 void RunL(); |
|
75 |
|
76 /** |
|
77 */ |
|
78 TInt RunError(TInt aError); |
|
79 |
|
80 private: |
|
81 /** |
|
82 2nd phase constructor called by CUsbDeviceWatcher |
|
83 */ |
|
84 void ConstructL(); |
|
85 |
|
86 private: |
|
87 /* |
|
88 The host USB device resource |
|
89 */ |
|
90 RUsbDevice iUsbDevice; |
|
91 |
|
92 /** |
|
93 */ |
|
94 MUsbDeviceRemovalObserver* iRemovalObserver; |
|
95 }; |
|
96 |
|
97 } |
|
98 |
|
99 #endif |