VirtualBox

source: vbox/trunk/src/VBox/Main/include/RemoteUSBDeviceImpl.h@ 98102

Last change on this file since 98102 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 KB
Line 
1/* $Id: RemoteUSBDeviceImpl.h 96407 2022-08-22 17:43:14Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox IHostUSBDevice COM interface implementation
6 * for remote (VRDP) USB devices
7 */
8
9/*
10 * Copyright (C) 2006-2022 Oracle and/or its affiliates.
11 *
12 * This file is part of VirtualBox base platform packages, as
13 * available from https://www.virtualbox.org.
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation, in version 3 of the
18 * License.
19 *
20 * This program is distributed in the hope that it will be useful, but
21 * WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see <https://www.gnu.org/licenses>.
27 *
28 * SPDX-License-Identifier: GPL-3.0-only
29 */
30
31#ifndef MAIN_INCLUDED_RemoteUSBDeviceImpl_h
32#define MAIN_INCLUDED_RemoteUSBDeviceImpl_h
33#ifndef RT_WITHOUT_PRAGMA_ONCE
34# pragma once
35#endif
36
37#include "HostUSBDeviceWrap.h"
38
39struct _VRDEUSBDEVICEDESC;
40typedef _VRDEUSBDEVICEDESC VRDEUSBDEVICEDESC;
41
42class ATL_NO_VTABLE RemoteUSBDevice :
43 public HostUSBDeviceWrap
44{
45public:
46
47 DECLARE_COMMON_CLASS_METHODS(RemoteUSBDevice)
48
49 HRESULT FinalConstruct();
50 void FinalRelease();
51
52 // public initializer/uninitializer for internal purposes only
53 HRESULT init(uint32_t u32ClientId, VRDEUSBDEVICEDESC *pDevDesc, bool fDescExt);
54 void uninit();
55
56 // public methods only for internal purposes
57 bool dirty(void) const { return mData.dirty; }
58 void dirty(bool aDirty) { mData.dirty = aDirty; }
59
60 uint16_t devId(void) const { return mData.devId; }
61 uint32_t clientId(void) { return mData.clientId; }
62
63 bool captured(void) const { return mData.state == USBDeviceState_Captured; }
64 void captured(bool aCaptured)
65 {
66 if (aCaptured)
67 {
68 Assert(mData.state == USBDeviceState_Available);
69 mData.state = USBDeviceState_Captured;
70 }
71 else
72 {
73 Assert(mData.state == USBDeviceState_Captured);
74 mData.state = USBDeviceState_Available;
75 }
76 }
77
78private:
79
80 // wrapped IUSBDevice properties
81 HRESULT getId(com::Guid &aId);
82 HRESULT getVendorId(USHORT *aVendorId);
83 HRESULT getProductId(USHORT *aProductId);
84 HRESULT getRevision(USHORT *aRevision);
85 HRESULT getManufacturer(com::Utf8Str &aManufacturer);
86 HRESULT getProduct(com::Utf8Str &aProduct);
87 HRESULT getSerialNumber(com::Utf8Str &aSerialNumber);
88 HRESULT getAddress(com::Utf8Str &aAddress);
89 HRESULT getPort(USHORT *aPort);
90 HRESULT getVersion(USHORT *aVersion);
91 HRESULT getPortPath(com::Utf8Str &aAddress);
92 HRESULT getSpeed(USBConnectionSpeed_T *aSpeed);
93 HRESULT getRemote(BOOL *aRemote);
94 HRESULT getBackend(com::Utf8Str &aBackend);
95 HRESULT getDeviceInfo(std::vector<com::Utf8Str> &aInfo);
96
97 // wrapped IHostUSBDevice properties
98 HRESULT getState(USBDeviceState_T *aState);
99
100
101 struct Data
102 {
103 Data() : vendorId(0), productId(0), revision(0), port(0), version(1),
104 speed(USBConnectionSpeed_Null), dirty(FALSE),
105 devId(0), clientId(0) {}
106
107 const Guid id;
108
109 const uint16_t vendorId;
110 const uint16_t productId;
111 const uint16_t revision;
112
113 const Utf8Str manufacturer;
114 const Utf8Str product;
115 const Utf8Str serialNumber;
116
117 const Utf8Str address;
118 const Utf8Str backend;
119
120 const uint16_t port;
121 const Utf8Str portPath;
122 const uint16_t version;
123 const USBConnectionSpeed_T speed;
124
125 USBDeviceState_T state;
126 bool dirty;
127
128 const uint16_t devId;
129 const uint32_t clientId;
130 };
131
132 Data mData;
133};
134
135#endif /* !MAIN_INCLUDED_RemoteUSBDeviceImpl_h */
136/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette