VirtualBox

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

Last change on this file since 31472 was 30739, checked in by vboxsync, 14 years ago

Main: remove VirtualBoxSupportTranslation template, add translation support to generic base class, clean up COM headers more, remove SupportErrorInfo.cpp|h

  • 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 30739 2010-07-08 12:27:42Z 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 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 _VRDPUSBDEVICEDESC;
27typedef _VRDPUSBDEVICEDESC VRDPUSBDEVICEDESC;
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 (ISupportErrorInfo)
43 COM_INTERFACE_ENTRY (IHostUSBDevice)
44 COM_INTERFACE_ENTRY (IUSBDevice)
45 COM_INTERFACE_ENTRY2 (IDispatch, IUSBDevice)
46 END_COM_MAP()
47
48 DECLARE_EMPTY_CTOR_DTOR (RemoteUSBDevice)
49
50 HRESULT FinalConstruct();
51 void FinalRelease();
52
53 // public initializer/uninitializer for internal purposes only
54 HRESULT init(uint32_t u32ClientId, VRDPUSBDEVICEDESC *pDevDesc);
55 void uninit();
56
57 // IUSBDevice properties
58 STDMETHOD(COMGETTER(Id)) (BSTR *aId);
59 STDMETHOD(COMGETTER(VendorId)) (USHORT *aVendorId);
60 STDMETHOD(COMGETTER(ProductId)) (USHORT *aProductId);
61 STDMETHOD(COMGETTER(Revision)) (USHORT *aRevision);
62 STDMETHOD(COMGETTER(Manufacturer)) (BSTR *aManufacturer);
63 STDMETHOD(COMGETTER(Product)) (BSTR *aProduct);
64 STDMETHOD(COMGETTER(SerialNumber)) (BSTR *aSerialNumber);
65 STDMETHOD(COMGETTER(Address)) (BSTR *aAddress);
66 STDMETHOD(COMGETTER(Port)) (USHORT *aPort);
67 STDMETHOD(COMGETTER(Version)) (USHORT *aVersion);
68 STDMETHOD(COMGETTER(PortVersion)) (USHORT *aPortVersion);
69 STDMETHOD(COMGETTER(Remote)) (BOOL *aRemote);
70
71 // IHostUSBDevice properties
72 STDMETHOD(COMGETTER(State)) (USBDeviceState_T *aState);
73
74 // public methods only for internal purposes
75 bool dirty (void) const { return mData.dirty; }
76 void dirty (bool aDirty) { mData.dirty = aDirty; }
77
78 uint16_t devId (void) const { return mData.devId; }
79 uint32_t clientId (void) { return mData.clientId; }
80
81 bool captured (void) const { return mData.state == USBDeviceState_Captured; }
82 void captured (bool aCaptured)
83 {
84 if (aCaptured)
85 {
86 Assert(mData.state == USBDeviceState_Available);
87 mData.state = USBDeviceState_Captured;
88 }
89 else
90 {
91 Assert(mData.state == USBDeviceState_Captured);
92 mData.state = USBDeviceState_Available;
93 }
94 }
95
96private:
97
98 struct Data
99 {
100 Data() : vendorId (0), productId (0), revision (0), port (0), version (1),
101 portVersion (1), dirty (FALSE), devId (0), clientId (0) {}
102
103 const Guid id;
104
105 const uint16_t vendorId;
106 const uint16_t productId;
107 const uint16_t revision;
108
109 const Bstr manufacturer;
110 const Bstr product;
111 const Bstr serialNumber;
112
113 const Bstr address;
114
115 const uint16_t port;
116 const uint16_t version;
117 const uint16_t portVersion;
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