VirtualBox

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

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

Automated rebranding to Oracle copyright/license strings via filemuncher

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