1 | /* $Id: RemoteUSBDeviceImpl.h 69498 2017-10-28 15:07:25Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | *
|
---|
5 | * VirtualBox IHostUSBDevice COM interface implementation
|
---|
6 | * for remote (VRDP) USB devices
|
---|
7 | */
|
---|
8 |
|
---|
9 | /*
|
---|
10 | * Copyright (C) 2006-2016 Oracle Corporation
|
---|
11 | *
|
---|
12 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
13 | * available from http://www.virtualbox.org. This file is free software;
|
---|
14 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
15 | * General Public License (GPL) as published by the Free Software
|
---|
16 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
17 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
18 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
19 | */
|
---|
20 |
|
---|
21 | #ifndef ____H_REMOTEUSBDEVICEIMPL
|
---|
22 | #define ____H_REMOTEUSBDEVICEIMPL
|
---|
23 |
|
---|
24 | #include "HostUSBDeviceWrap.h"
|
---|
25 |
|
---|
26 | struct _VRDEUSBDEVICEDESC;
|
---|
27 | typedef _VRDEUSBDEVICEDESC VRDEUSBDEVICEDESC;
|
---|
28 |
|
---|
29 | class ATL_NO_VTABLE RemoteUSBDevice :
|
---|
30 | public HostUSBDeviceWrap
|
---|
31 | {
|
---|
32 | public:
|
---|
33 |
|
---|
34 | DECLARE_EMPTY_CTOR_DTOR(RemoteUSBDevice)
|
---|
35 |
|
---|
36 | HRESULT FinalConstruct();
|
---|
37 | void FinalRelease();
|
---|
38 |
|
---|
39 | // public initializer/uninitializer for internal purposes only
|
---|
40 | HRESULT init(uint32_t u32ClientId, VRDEUSBDEVICEDESC *pDevDesc, bool fDescExt);
|
---|
41 | void uninit();
|
---|
42 |
|
---|
43 | // public methods only for internal purposes
|
---|
44 | bool dirty(void) const { return mData.dirty; }
|
---|
45 | void dirty(bool aDirty) { mData.dirty = aDirty; }
|
---|
46 |
|
---|
47 | uint16_t devId(void) const { return mData.devId; }
|
---|
48 | uint32_t clientId(void) { return mData.clientId; }
|
---|
49 |
|
---|
50 | bool captured(void) const { return mData.state == USBDeviceState_Captured; }
|
---|
51 | void captured(bool aCaptured)
|
---|
52 | {
|
---|
53 | if (aCaptured)
|
---|
54 | {
|
---|
55 | Assert(mData.state == USBDeviceState_Available);
|
---|
56 | mData.state = USBDeviceState_Captured;
|
---|
57 | }
|
---|
58 | else
|
---|
59 | {
|
---|
60 | Assert(mData.state == USBDeviceState_Captured);
|
---|
61 | mData.state = USBDeviceState_Available;
|
---|
62 | }
|
---|
63 | }
|
---|
64 |
|
---|
65 | private:
|
---|
66 |
|
---|
67 | // wrapped IUSBDevice properties
|
---|
68 | HRESULT getId(com::Guid &aId);
|
---|
69 | HRESULT getVendorId(USHORT *aVendorId);
|
---|
70 | HRESULT getProductId(USHORT *aProductId);
|
---|
71 | HRESULT getRevision(USHORT *aRevision);
|
---|
72 | HRESULT getManufacturer(com::Utf8Str &aManufacturer);
|
---|
73 | HRESULT getProduct(com::Utf8Str &aProduct);
|
---|
74 | HRESULT getSerialNumber(com::Utf8Str &aSerialNumber);
|
---|
75 | HRESULT getAddress(com::Utf8Str &aAddress);
|
---|
76 | HRESULT getPort(USHORT *aPort);
|
---|
77 | HRESULT getVersion(USHORT *aVersion);
|
---|
78 | HRESULT getPortVersion(USHORT *aPortVersion);
|
---|
79 | HRESULT getSpeed(USBConnectionSpeed_T *aSpeed);
|
---|
80 | HRESULT getRemote(BOOL *aRemote);
|
---|
81 | HRESULT getBackend(com::Utf8Str &aBackend);
|
---|
82 | HRESULT getDeviceInfo(std::vector<com::Utf8Str> &aInfo);
|
---|
83 |
|
---|
84 | // wrapped IHostUSBDevice properties
|
---|
85 | HRESULT getState(USBDeviceState_T *aState);
|
---|
86 |
|
---|
87 |
|
---|
88 | struct Data
|
---|
89 | {
|
---|
90 | Data() : vendorId(0), productId(0), revision(0), port(0), version(1),
|
---|
91 | portVersion(1), speed(USBConnectionSpeed_Null), dirty(FALSE),
|
---|
92 | devId(0), clientId(0) {}
|
---|
93 |
|
---|
94 | const Guid id;
|
---|
95 |
|
---|
96 | const uint16_t vendorId;
|
---|
97 | const uint16_t productId;
|
---|
98 | const uint16_t revision;
|
---|
99 |
|
---|
100 | const Utf8Str manufacturer;
|
---|
101 | const Utf8Str product;
|
---|
102 | const Utf8Str serialNumber;
|
---|
103 |
|
---|
104 | const Utf8Str address;
|
---|
105 | const Utf8Str backend;
|
---|
106 |
|
---|
107 | const uint16_t port;
|
---|
108 | const uint16_t version;
|
---|
109 | const uint16_t portVersion;
|
---|
110 | const USBConnectionSpeed_T speed;
|
---|
111 |
|
---|
112 | USBDeviceState_T state;
|
---|
113 | bool dirty;
|
---|
114 |
|
---|
115 | const uint16_t devId;
|
---|
116 | const uint32_t clientId;
|
---|
117 | };
|
---|
118 |
|
---|
119 | Data mData;
|
---|
120 | };
|
---|
121 |
|
---|
122 | #endif // ____H_REMOTEUSBDEVICEIMPL
|
---|
123 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|