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