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