1 | /* $Id: USBDeviceImpl.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Header file for the OUSBDevice (IUSBDevice) class, VBoxC.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef MAIN_INCLUDED_USBDeviceImpl_h
|
---|
29 | #define MAIN_INCLUDED_USBDeviceImpl_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include "USBDeviceWrap.h"
|
---|
35 |
|
---|
36 | /**
|
---|
37 | * Object class used for maintaining devices attached to a USB controller.
|
---|
38 | * Generally this contains much less information.
|
---|
39 | */
|
---|
40 | class ATL_NO_VTABLE OUSBDevice :
|
---|
41 | public USBDeviceWrap
|
---|
42 | {
|
---|
43 | public:
|
---|
44 |
|
---|
45 | DECLARE_COMMON_CLASS_METHODS(OUSBDevice)
|
---|
46 |
|
---|
47 | HRESULT FinalConstruct();
|
---|
48 | void FinalRelease();
|
---|
49 |
|
---|
50 | // public initializer/uninitializer for internal purposes only
|
---|
51 | HRESULT init(IUSBDevice *a_pUSBDevice);
|
---|
52 | void uninit();
|
---|
53 |
|
---|
54 | // public methods only for internal purposes
|
---|
55 | const Guid &i_id() const { return mData.id; }
|
---|
56 |
|
---|
57 | private:
|
---|
58 |
|
---|
59 | // Wrapped IUSBDevice properties
|
---|
60 | HRESULT getId(com::Guid &aId);
|
---|
61 | HRESULT getVendorId(USHORT *aVendorId);
|
---|
62 | HRESULT getProductId(USHORT *aProductId);
|
---|
63 | HRESULT getRevision(USHORT *aRevision);
|
---|
64 | HRESULT getManufacturer(com::Utf8Str &aManufacturer);
|
---|
65 | HRESULT getProduct(com::Utf8Str &aProduct);
|
---|
66 | HRESULT getSerialNumber(com::Utf8Str &aSerialNumber);
|
---|
67 | HRESULT getAddress(com::Utf8Str &aAddress);
|
---|
68 | HRESULT getPort(USHORT *aPort);
|
---|
69 | HRESULT getPortPath(com::Utf8Str &aPortPath);
|
---|
70 | HRESULT getVersion(USHORT *aVersion);
|
---|
71 | HRESULT getSpeed(USBConnectionSpeed_T *aSpeed);
|
---|
72 | HRESULT getRemote(BOOL *aRemote);
|
---|
73 | HRESULT getBackend(com::Utf8Str &aBackend);
|
---|
74 | HRESULT getDeviceInfo(std::vector<com::Utf8Str> &aInfo);
|
---|
75 |
|
---|
76 | struct Data
|
---|
77 | {
|
---|
78 | Data() : vendorId(0), productId(0), revision(0), port(0),
|
---|
79 | version(1), speed(USBConnectionSpeed_Null),
|
---|
80 | remote(FALSE) {}
|
---|
81 |
|
---|
82 | /** The UUID of this device. */
|
---|
83 | const Guid id;
|
---|
84 |
|
---|
85 | /** The vendor id of this USB device. */
|
---|
86 | const USHORT vendorId;
|
---|
87 | /** The product id of this USB device. */
|
---|
88 | const USHORT productId;
|
---|
89 | /** The product revision number of this USB device.
|
---|
90 | * (high byte = integer; low byte = decimal) */
|
---|
91 | const USHORT revision;
|
---|
92 | /** The Manufacturer string. (Quite possibly NULL.) */
|
---|
93 | const com::Utf8Str manufacturer;
|
---|
94 | /** The Product string. (Quite possibly NULL.) */
|
---|
95 | const com::Utf8Str product;
|
---|
96 | /** The SerialNumber string. (Quite possibly NULL.) */
|
---|
97 | const com::Utf8Str serialNumber;
|
---|
98 | /** The host specific address of the device. */
|
---|
99 | const com::Utf8Str address;
|
---|
100 | /** The device specific backend. */
|
---|
101 | const com::Utf8Str backend;
|
---|
102 | /** The host port number. */
|
---|
103 | const USHORT port;
|
---|
104 | /** The host port path. */
|
---|
105 | const com::Utf8Str portPath;
|
---|
106 | /** The major USB version number of the device. */
|
---|
107 | const USHORT version;
|
---|
108 | /** The speed at which the device is communicating. */
|
---|
109 | const USBConnectionSpeed_T speed;
|
---|
110 | /** Remote (VRDP) or local device. */
|
---|
111 | const BOOL remote;
|
---|
112 | };
|
---|
113 |
|
---|
114 | Data mData;
|
---|
115 | };
|
---|
116 |
|
---|
117 | #endif /* !MAIN_INCLUDED_USBDeviceImpl_h */
|
---|
118 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|