VirtualBox

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

Last change on this file since 21686 was 21686, checked in by vboxsync, 15 years ago

Main: back out r50147 until the locking is properly understood; will come back.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.2 KB
Line 
1/* $Id: RemoteUSBDeviceImpl.h 21686 2009-07-17 13:41:39Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox IHostUSBDevice COM interface implementation
6 * for remote (VRDP) USB devices
7 */
8
9/*
10 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
21 * Clara, CA 95054 USA or visit http://www.sun.com if you need
22 * additional information or have any questions.
23 */
24
25#ifndef ____H_REMOTEUSBDEVICEIMPL
26#define ____H_REMOTEUSBDEVICEIMPL
27
28#include "VirtualBoxBase.h"
29
30struct _VRDPUSBDEVICEDESC;
31typedef _VRDPUSBDEVICEDESC VRDPUSBDEVICEDESC;
32
33class ATL_NO_VTABLE RemoteUSBDevice :
34 public VirtualBoxBaseNEXT,
35 public VirtualBoxSupportErrorInfoImpl <RemoteUSBDevice, IHostUSBDevice>,
36 public VirtualBoxSupportTranslation <RemoteUSBDevice>,
37 VBOX_SCRIPTABLE_IMPL(IHostUSBDevice)
38{
39public:
40
41 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (OUSBDevice)
42
43 DECLARE_NOT_AGGREGATABLE (RemoteUSBDevice)
44
45 DECLARE_PROTECT_FINAL_CONSTRUCT()
46
47 BEGIN_COM_MAP (RemoteUSBDevice)
48 COM_INTERFACE_ENTRY (ISupportErrorInfo)
49 COM_INTERFACE_ENTRY (IHostUSBDevice)
50 COM_INTERFACE_ENTRY (IUSBDevice)
51 COM_INTERFACE_ENTRY2 (IDispatch, IUSBDevice)
52 END_COM_MAP()
53
54 NS_DECL_ISUPPORTS
55
56 DECLARE_EMPTY_CTOR_DTOR (RemoteUSBDevice)
57
58 HRESULT FinalConstruct();
59 void FinalRelease();
60
61 // public initializer/uninitializer for internal purposes only
62 HRESULT init(uint32_t u32ClientId, VRDPUSBDEVICEDESC *pDevDesc);
63 void uninit();
64
65 // IUSBDevice properties
66 STDMETHOD(COMGETTER(Id)) (BSTR *aId);
67 STDMETHOD(COMGETTER(VendorId)) (USHORT *aVendorId);
68 STDMETHOD(COMGETTER(ProductId)) (USHORT *aProductId);
69 STDMETHOD(COMGETTER(Revision)) (USHORT *aRevision);
70 STDMETHOD(COMGETTER(Manufacturer)) (BSTR *aManufacturer);
71 STDMETHOD(COMGETTER(Product)) (BSTR *aProduct);
72 STDMETHOD(COMGETTER(SerialNumber)) (BSTR *aSerialNumber);
73 STDMETHOD(COMGETTER(Address)) (BSTR *aAddress);
74 STDMETHOD(COMGETTER(Port)) (USHORT *aPort);
75 STDMETHOD(COMGETTER(Version)) (USHORT *aVersion);
76 STDMETHOD(COMGETTER(PortVersion)) (USHORT *aPortVersion);
77 STDMETHOD(COMGETTER(Remote)) (BOOL *aRemote);
78
79 // IHostUSBDevice properties
80 STDMETHOD(COMGETTER(State)) (USBDeviceState_T *aState);
81
82 // public methods only for internal purposes
83 bool dirty (void) const { return mData.dirty; }
84 void dirty (bool aDirty) { mData.dirty = aDirty; }
85
86 uint16_t devId (void) const { return mData.devId; }
87 uint32_t clientId (void) { return mData.clientId; }
88
89 bool captured (void) const { return mData.state == USBDeviceState_Captured; }
90 void captured (bool aCaptured)
91 {
92 if (aCaptured)
93 {
94 Assert(mData.state == USBDeviceState_Available);
95 mData.state = USBDeviceState_Captured;
96 }
97 else
98 {
99 Assert(mData.state == USBDeviceState_Captured);
100 mData.state = USBDeviceState_Available;
101 }
102 }
103
104 // for VirtualBoxSupportErrorInfoImpl
105 static const wchar_t *getComponentName() { return L"RemoteUSBDevice"; }
106
107private:
108
109 struct Data
110 {
111 Data() : vendorId (0), productId (0), revision (0), port (0), version (1),
112 portVersion (1), dirty (FALSE), devId (0), clientId (0) {}
113
114 const Guid id;
115
116 const uint16_t vendorId;
117 const uint16_t productId;
118 const uint16_t revision;
119
120 const Bstr manufacturer;
121 const Bstr product;
122 const Bstr serialNumber;
123
124 const Bstr address;
125
126 const uint16_t port;
127 const uint16_t version;
128 const uint16_t portVersion;
129
130 USBDeviceState_T state;
131 bool dirty;
132
133 const uint16_t devId;
134 const uint32_t clientId;
135 };
136
137 Data mData;
138};
139
140#endif // ____H_REMOTEUSBDEVICEIMPL
141/* 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