VirtualBox

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

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

Main: remove SupportErrorInfo template magic

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