0
|
1 |
#ifndef __USB_DEVICE_WATCHER_H__
|
|
2 |
#define __USB_DEVICE_WATCHER_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 UsbDeviceWatcher.h
|
|
24 |
*/
|
|
25 |
|
|
26 |
#include <e32base.h>
|
|
27 |
|
|
28 |
// Forward declarations
|
|
29 |
|
|
30 |
class RUsbHubDriver;
|
|
31 |
|
|
32 |
namespace NUnitTesting_USBDI
|
|
33 |
{
|
|
34 |
|
|
35 |
// Forward declarations
|
|
36 |
|
|
37 |
class CUsbHostDevice;
|
|
38 |
|
|
39 |
/**
|
|
40 |
*/
|
|
41 |
class MUsbDeviceObserver
|
|
42 |
{
|
|
43 |
public:
|
|
44 |
/**
|
|
45 |
Called when a USB device has been connected to the host
|
|
46 |
@param aError an error code relating to USB device attachment from the Hub driver
|
|
47 |
*/
|
|
48 |
virtual void UsbDeviceAttachedL(TInt aError) = 0;
|
|
49 |
};
|
|
50 |
|
|
51 |
/**
|
|
52 |
This class represents a watcher for USB devices inserted into the host
|
|
53 |
*/
|
|
54 |
class CUsbDeviceWatcher : public CActive
|
|
55 |
{
|
|
56 |
public:
|
|
57 |
/**
|
|
58 |
Symbian factory construction
|
|
59 |
@return a pointer to an instance of a Usb device watcher
|
|
60 |
*/
|
|
61 |
static CUsbDeviceWatcher* NewL(RUsbHubDriver& aUsbHubDriver,MUsbDeviceObserver& aUsbDeviceObserver);
|
|
62 |
|
|
63 |
/**
|
|
64 |
Destructor
|
|
65 |
*/
|
|
66 |
~CUsbDeviceWatcher();
|
|
67 |
|
|
68 |
/**
|
|
69 |
*/
|
|
70 |
void StartWatchingL(CUsbHostDevice* aUsbDevice);
|
|
71 |
|
|
72 |
private:
|
|
73 |
/**
|
|
74 |
Cancel watching for new USB devices
|
|
75 |
*/
|
|
76 |
void DoCancel();
|
|
77 |
|
|
78 |
/**
|
|
79 |
|
|
80 |
*/
|
|
81 |
void RunL();
|
|
82 |
|
|
83 |
/**
|
|
84 |
@return KErrNone
|
|
85 |
*/
|
|
86 |
TInt RunError(TInt aError);
|
|
87 |
|
|
88 |
private:
|
|
89 |
/**
|
|
90 |
Constructor
|
|
91 |
@param aUsbHubDriver the Host USB Hub driver
|
|
92 |
*/
|
|
93 |
CUsbDeviceWatcher(RUsbHubDriver& aUsbHubDriver,MUsbDeviceObserver& aUsbDeviceObserver);
|
|
94 |
|
|
95 |
/**
|
|
96 |
2nd phase constructor
|
|
97 |
*/
|
|
98 |
void ConstructL();
|
|
99 |
|
|
100 |
private:
|
|
101 |
/**
|
|
102 |
The Usb hub driver (uses-a)
|
|
103 |
*/
|
|
104 |
RUsbHubDriver& iUsbHubDriver;
|
|
105 |
|
|
106 |
/**
|
|
107 |
The usb device resource (uses-a)
|
|
108 |
*/
|
|
109 |
CUsbHostDevice* iUsbHostDevice;
|
|
110 |
|
|
111 |
/**
|
|
112 |
The observer for USB device connection
|
|
113 |
*/
|
|
114 |
MUsbDeviceObserver& iUsbDeviceObserver;
|
|
115 |
};
|
|
116 |
|
|
117 |
|
|
118 |
}
|
|
119 |
|
|
120 |
|
|
121 |
#endif |