VirtualBox

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

Last change on this file since 53517 was 53297, checked in by vboxsync, 10 years ago

Main: Added API to report actual USB device speed.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 KB
Line 
1/* $Id: RemoteUSBDeviceImpl.h 53297 2014-11-10 21:57:22Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox IHostUSBDevice COM interface implementation
6 * for remote (VRDP) USB devices
7 */
8
9/*
10 * Copyright (C) 2006-2011 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 "VirtualBoxBase.h"
25
26struct _VRDEUSBDEVICEDESC;
27typedef _VRDEUSBDEVICEDESC VRDEUSBDEVICEDESC;
28
29class ATL_NO_VTABLE RemoteUSBDevice :
30 public VirtualBoxBase,
31 VBOX_SCRIPTABLE_IMPL(IHostUSBDevice)
32{
33public:
34
35 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(RemoteUSBDevice, IHostUSBDevice)
36
37 DECLARE_NOT_AGGREGATABLE (RemoteUSBDevice)
38
39 DECLARE_PROTECT_FINAL_CONSTRUCT()
40
41 BEGIN_COM_MAP (RemoteUSBDevice)
42 COM_INTERFACE_ENTRY (IHostUSBDevice)
43 VBOX_DEFAULT_INTERFACE_ENTRIES (IUSBDevice)
44 END_COM_MAP()
45
46 DECLARE_EMPTY_CTOR_DTOR (RemoteUSBDevice)
47
48 HRESULT FinalConstruct();
49 void FinalRelease();
50
51 // public initializer/uninitializer for internal purposes only
52 HRESULT init(uint32_t u32ClientId, VRDEUSBDEVICEDESC *pDevDesc, bool fDescExt);
53 void uninit();
54
55 // IUSBDevice properties
56 STDMETHOD(COMGETTER(Id)) (BSTR *aId);
57 STDMETHOD(COMGETTER(VendorId)) (USHORT *aVendorId);
58 STDMETHOD(COMGETTER(ProductId)) (USHORT *aProductId);
59 STDMETHOD(COMGETTER(Revision)) (USHORT *aRevision);
60 STDMETHOD(COMGETTER(Manufacturer)) (BSTR *aManufacturer);
61 STDMETHOD(COMGETTER(Product)) (BSTR *aProduct);
62 STDMETHOD(COMGETTER(SerialNumber)) (BSTR *aSerialNumber);
63 STDMETHOD(COMGETTER(Address)) (BSTR *aAddress);
64 STDMETHOD(COMGETTER(Port)) (USHORT *aPort);
65 STDMETHOD(COMGETTER(Version)) (USHORT *aVersion);
66 STDMETHOD(COMGETTER(PortVersion)) (USHORT *aPortVersion);
67 STDMETHOD(COMGETTER(Speed)) (USBConnectionSpeed_T *aSpeed);
68 STDMETHOD(COMGETTER(Remote)) (BOOL *aRemote);
69
70 // IHostUSBDevice properties
71 STDMETHOD(COMGETTER(State)) (USBDeviceState_T *aState);
72
73 // public methods only for internal purposes
74 bool dirty (void) const { return mData.dirty; }
75 void dirty (bool aDirty) { mData.dirty = aDirty; }
76
77 uint16_t devId (void) const { return mData.devId; }
78 uint32_t clientId (void) { return mData.clientId; }
79
80 bool captured (void) const { return mData.state == USBDeviceState_Captured; }
81 void captured (bool aCaptured)
82 {
83 if (aCaptured)
84 {
85 Assert(mData.state == USBDeviceState_Available);
86 mData.state = USBDeviceState_Captured;
87 }
88 else
89 {
90 Assert(mData.state == USBDeviceState_Captured);
91 mData.state = USBDeviceState_Available;
92 }
93 }
94
95private:
96
97 struct Data
98 {
99 Data() : vendorId (0), productId (0), revision (0), port (0), version (1),
100 portVersion (1), speed (USBConnectionSpeed_Null), dirty (FALSE), devId (0), clientId (0) {}
101
102 const Guid id;
103
104 const uint16_t vendorId;
105 const uint16_t productId;
106 const uint16_t revision;
107
108 const Bstr manufacturer;
109 const Bstr product;
110 const Bstr serialNumber;
111
112 const Bstr address;
113
114 const uint16_t port;
115 const uint16_t version;
116 const uint16_t portVersion;
117 const USBConnectionSpeed_T speed;
118
119 USBDeviceState_T state;
120 bool dirty;
121
122 const uint16_t devId;
123 const uint32_t clientId;
124 };
125
126 Data mData;
127};
128
129#endif // ____H_REMOTEUSBDEVICEIMPL
130/* 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