1 | /* $Id: USBDeviceImpl.h 21823 2009-07-27 18:46:11Z 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 VirtualBoxBase,
|
---|
36 | public VirtualBoxSupportErrorInfoImpl<OUSBDevice, IUSBDevice>,
|
---|
37 | public VirtualBoxSupportTranslation<OUSBDevice>,
|
---|
38 | VBOX_SCRIPTABLE_IMPL(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 | COM_INTERFACE_ENTRY2 (IDispatch, IUSBDevice)
|
---|
52 | END_COM_MAP()
|
---|
53 |
|
---|
54 | NS_DECL_ISUPPORTS
|
---|
55 |
|
---|
56 | DECLARE_EMPTY_CTOR_DTOR (OUSBDevice)
|
---|
57 |
|
---|
58 | HRESULT FinalConstruct();
|
---|
59 | void FinalRelease();
|
---|
60 |
|
---|
61 | // public initializer/uninitializer for internal purposes only
|
---|
62 | HRESULT init (IUSBDevice *a_pUSBDevice);
|
---|
63 | void uninit();
|
---|
64 |
|
---|
65 | // IUSBDevice properties
|
---|
66 | STDMETHOD(COMGETTER(Id))(BSTR *aId);
|
---|
67 | STDMETHOD(COMGETTER(VendorId))(USHORT *aVendorId);
|
---|
68 | STDMETHOD(COMGETTER(ProductId))(USHORT *aProductId);
|
---|
69 | STDMETHOD(COMGETTER(Revision))(USHORT *aRevision);
|
---|
70 | STDMETHOD(COMGETTER(Manufacturer))(BSTR *aManufacturer);
|
---|
71 | STDMETHOD(COMGETTER(Product))(BSTR *aProduct);
|
---|
72 | STDMETHOD(COMGETTER(SerialNumber))(BSTR *aSerialNumber);
|
---|
73 | STDMETHOD(COMGETTER(Address))(BSTR *aAddress);
|
---|
74 | STDMETHOD(COMGETTER(Port))(USHORT *aPort);
|
---|
75 | STDMETHOD(COMGETTER(Version))(USHORT *aVersion);
|
---|
76 | STDMETHOD(COMGETTER(PortVersion))(USHORT *aPortVersion);
|
---|
77 | STDMETHOD(COMGETTER(Remote))(BOOL *aRemote);
|
---|
78 |
|
---|
79 | // public methods only for internal purposes
|
---|
80 | const Guid &id() const { return mData.id; }
|
---|
81 |
|
---|
82 | // for VirtualBoxSupportErrorInfoImpl
|
---|
83 | static const wchar_t *getComponentName() { return L"USBDevice"; }
|
---|
84 |
|
---|
85 | private:
|
---|
86 |
|
---|
87 | struct Data
|
---|
88 | {
|
---|
89 | Data() : vendorId (0), productId (0), revision (0), port (0),
|
---|
90 | version (1), portVersion (1), remote (FALSE) {}
|
---|
91 |
|
---|
92 | /** The UUID of this device. */
|
---|
93 | const Guid id;
|
---|
94 |
|
---|
95 | /** The vendor id of this USB device. */
|
---|
96 | const USHORT vendorId;
|
---|
97 | /** The product id of this USB device. */
|
---|
98 | const USHORT productId;
|
---|
99 | /** The product revision number of this USB device.
|
---|
100 | * (high byte = integer; low byte = decimal) */
|
---|
101 | const USHORT revision;
|
---|
102 | /** The Manufacturer string. (Quite possibly NULL.) */
|
---|
103 | const Bstr manufacturer;
|
---|
104 | /** The Product string. (Quite possibly NULL.) */
|
---|
105 | const Bstr product;
|
---|
106 | /** The SerialNumber string. (Quite possibly NULL.) */
|
---|
107 | const Bstr serialNumber;
|
---|
108 | /** The host specific address of the device. */
|
---|
109 | const Bstr address;
|
---|
110 | /** The host port number. */
|
---|
111 | const USHORT port;
|
---|
112 | /** The major USB version number of the device. */
|
---|
113 | const USHORT version;
|
---|
114 | /** The major USB version number of the port the device is attached to. */
|
---|
115 | const USHORT portVersion;
|
---|
116 | /** Remote (VRDP) or local device. */
|
---|
117 | const BOOL remote;
|
---|
118 | };
|
---|
119 |
|
---|
120 | Data mData;
|
---|
121 | };
|
---|
122 |
|
---|
123 | #endif // ____H_USBDEVICEIMPL
|
---|
124 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|