1 | /* $Id: USBDeviceImpl.h 17553 2009-03-09 09:34:22Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | * Header file for the OUSBDevice (IUSBDevice) class, VBoxC.
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2009 Sun Microsystems, Inc.
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | *
|
---|
18 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
19 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
20 | * additional information or have any questions.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifndef ____H_USBDEVICEIMPL
|
---|
24 | #define ____H_USBDEVICEIMPL
|
---|
25 |
|
---|
26 | #include "VirtualBoxBase.h"
|
---|
27 | #include "Logging.h"
|
---|
28 |
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * Object class used for maintaining devices attached to a USB controller.
|
---|
32 | * Generally this contains much less information.
|
---|
33 | */
|
---|
34 | class ATL_NO_VTABLE OUSBDevice :
|
---|
35 | public VirtualBoxBaseNEXT,
|
---|
36 | public VirtualBoxSupportErrorInfoImpl<OUSBDevice, IUSBDevice>,
|
---|
37 | public VirtualBoxSupportTranslation<OUSBDevice>,
|
---|
38 | public IUSBDevice
|
---|
39 | {
|
---|
40 | public:
|
---|
41 |
|
---|
42 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (OUSBDevice)
|
---|
43 |
|
---|
44 | DECLARE_NOT_AGGREGATABLE(OUSBDevice)
|
---|
45 |
|
---|
46 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
47 |
|
---|
48 | BEGIN_COM_MAP(OUSBDevice)
|
---|
49 | COM_INTERFACE_ENTRY (ISupportErrorInfo)
|
---|
50 | COM_INTERFACE_ENTRY (IUSBDevice)
|
---|
51 | END_COM_MAP()
|
---|
52 |
|
---|
53 | NS_DECL_ISUPPORTS
|
---|
54 |
|
---|
55 | DECLARE_EMPTY_CTOR_DTOR (OUSBDevice)
|
---|
56 |
|
---|
57 | HRESULT FinalConstruct();
|
---|
58 | void FinalRelease();
|
---|
59 |
|
---|
60 | // public initializer/uninitializer for internal purposes only
|
---|
61 | HRESULT init (IUSBDevice *a_pUSBDevice);
|
---|
62 | void uninit();
|
---|
63 |
|
---|
64 | // IUSBDevice properties
|
---|
65 | STDMETHOD(COMGETTER(Id))(OUT_GUID aId);
|
---|
66 | STDMETHOD(COMGETTER(VendorId))(USHORT *aVendorId);
|
---|
67 | STDMETHOD(COMGETTER(ProductId))(USHORT *aProductId);
|
---|
68 | STDMETHOD(COMGETTER(Revision))(USHORT *aRevision);
|
---|
69 | STDMETHOD(COMGETTER(Manufacturer))(BSTR *aManufacturer);
|
---|
70 | STDMETHOD(COMGETTER(Product))(BSTR *aProduct);
|
---|
71 | STDMETHOD(COMGETTER(SerialNumber))(BSTR *aSerialNumber);
|
---|
72 | STDMETHOD(COMGETTER(Address))(BSTR *aAddress);
|
---|
73 | STDMETHOD(COMGETTER(Port))(USHORT *aPort);
|
---|
74 | STDMETHOD(COMGETTER(Version))(USHORT *aVersion);
|
---|
75 | STDMETHOD(COMGETTER(PortVersion))(USHORT *aPortVersion);
|
---|
76 | STDMETHOD(COMGETTER(Remote))(BOOL *aRemote);
|
---|
77 |
|
---|
78 | // public methods only for internal purposes
|
---|
79 | const Guid &id() const { return mData.id; }
|
---|
80 |
|
---|
81 | // for VirtualBoxSupportErrorInfoImpl
|
---|
82 | static const wchar_t *getComponentName() { return L"USBDevice"; }
|
---|
83 |
|
---|
84 | private:
|
---|
85 |
|
---|
86 | struct Data
|
---|
87 | {
|
---|
88 | Data() : vendorId (0), productId (0), revision (0), port (0),
|
---|
89 | version (1), portVersion (1), remote (FALSE) {}
|
---|
90 |
|
---|
91 | /** The UUID of this device. */
|
---|
92 | const Guid id;
|
---|
93 |
|
---|
94 | /** The vendor id of this USB device. */
|
---|
95 | const USHORT vendorId;
|
---|
96 | /** The product id of this USB device. */
|
---|
97 | const USHORT productId;
|
---|
98 | /** The product revision number of this USB device.
|
---|
99 | * (high byte = integer; low byte = decimal) */
|
---|
100 | const USHORT revision;
|
---|
101 | /** The Manufacturer string. (Quite possibly NULL.) */
|
---|
102 | const Bstr manufacturer;
|
---|
103 | /** The Product string. (Quite possibly NULL.) */
|
---|
104 | const Bstr product;
|
---|
105 | /** The SerialNumber string. (Quite possibly NULL.) */
|
---|
106 | const Bstr serialNumber;
|
---|
107 | /** The host specific address of the device. */
|
---|
108 | const Bstr address;
|
---|
109 | /** The host port number. */
|
---|
110 | const USHORT port;
|
---|
111 | /** The major USB version number of the device. */
|
---|
112 | const USHORT version;
|
---|
113 | /** The major USB version number of the port the device is attached to. */
|
---|
114 | const USHORT portVersion;
|
---|
115 | /** Remote (VRDP) or local device. */
|
---|
116 | const BOOL remote;
|
---|
117 | };
|
---|
118 |
|
---|
119 | Data mData;
|
---|
120 | };
|
---|
121 |
|
---|
122 | #endif // ____H_USBDEVICEIMPL
|
---|
123 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|