VirtualBox

source: vbox/trunk/src/VBox/Frontends/VBoxBFE/HostUSBDeviceImpl.h@ 2491

Last change on this file since 2491 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1/** @file
2 *
3 * VBox frontends: Basic Frontend (BFE):
4 * Declaration of HostUSBDevice
5 */
6
7/*
8 * Copyright (C) 2006 InnoTek Systemberatung GmbH
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License as published by the Free Software Foundation,
14 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
15 * distribution. VirtualBox OSE is distributed in the hope that it will
16 * be useful, but WITHOUT ANY WARRANTY of any kind.
17 *
18 * If you received this file as part of a commercial VirtualBox
19 * distribution, then only the terms of your commercial VirtualBox
20 * license agreement apply instead of the previous paragraph.
21 */
22
23#ifndef ____H_HOSTUSBDEVICEIMPL
24#define ____H_HOSTUSBDEVICEIMPL
25
26#ifndef VBOXBFE_WITH_USB
27# error "misconfiguration VBOXBFE_WITH_USB isn't defined and HostUSBDeviceImpl.h was included."
28#endif
29#include <string>
30
31#include "VirtualBoxBase.h"
32// #include "USBDeviceFilterImpl.h"
33/* #include "USBProxyService.h" circular on Host/HostUSBDevice, the includer must include this. */
34// #include "Collection.h"
35
36#include <VBox/usb.h>
37#include <iprt/uuid.h>
38
39class USBProxyService;
40
41/**
42 * The state of a given USB device in the host and in the guest.
43 * Originally part of the COM interface.
44 */
45typedef enum {
46 /** Not supported by the VirtualBox server, not available to
47 guests. */
48 USBDeviceState_USBDeviceNotSupported,
49 /** Being used by the host computer exclusively, not available
50 to guests. */
51 USBDeviceState_USBDeviceUnavailable,
52 /** Being used by the host computer, potentially available to
53 guests. */
54 USBDeviceState_USBDeviceBusy,
55 /** Not used by the host computer, available to guests. The
56 host computer can also start using the device at any time. */
57 USBDeviceState_USBDeviceAvailable,
58 /** Held by the VirtualBox server (ignored by the host computer),
59 available to guests. */
60 USBDeviceState_USBDeviceHeld,
61 /** Captured by one of the guest computers, not available to
62 anybody else. */
63 USBDeviceState_USBDeviceCaptured
64} USBDeviceState_T;
65
66/**
67 * Object class used for the Host USBDevices property.
68 */
69class HostUSBDevice : public VirtualBoxBase
70{
71public:
72
73 HostUSBDevice();
74 virtual ~HostUSBDevice();
75
76 // public initializer/uninitializer for internal purposes only
77 HRESULT init(PUSBDEVICE aUsb, USBProxyService *aUSBProxyService);
78
79 // IUSBDevice properties
80 STDMETHOD(COMGETTER(Id))(RTUUID &aId);
81 STDMETHOD(COMGETTER(VendorId))(USHORT *aVendorId);
82 STDMETHOD(COMGETTER(ProductId))(USHORT *aProductId);
83 STDMETHOD(COMGETTER(Revision))(USHORT *aRevision);
84 STDMETHOD(COMGETTER(Manufacturer))(std::string *aManufacturer);
85 STDMETHOD(COMGETTER(Product))(std::string *aProduct);
86 STDMETHOD(COMGETTER(SerialNumber))(std::string *aSerialNumber);
87 STDMETHOD(COMGETTER(Address))(std::string *aAddress);
88 STDMETHOD(COMGETTER(Port))(USHORT *aPort);
89 STDMETHOD(COMGETTER(Remote))(BOOL *aRemote);
90
91 // IHostUSBDevice properties
92 STDMETHOD(COMGETTER(State))(USBDeviceState_T *aState);
93
94 // public methods only for internal purposes
95
96 const RTUUID &id() { return mId; }
97 USBDeviceState_T state() { return mState; }
98 bool isIgnored() { return mIgnored; }
99
100 void setIgnored();
101 void setCaptured ();
102 bool isCaptured()
103 { return mState == USBDeviceState_USBDeviceCaptured; }
104 int setHostDriven();
105 int reset();
106
107 void setHostState (USBDeviceState_T aState);
108
109 int compare (PCUSBDEVICE pDev2);
110 static int compare (PCUSBDEVICE pDev1, PCUSBDEVICE pDev2);
111
112 bool updateState (PCUSBDEVICE aDev);
113
114 // for VirtualBoxSupportErrorInfoImpl
115 static const wchar_t *getComponentName() { return L"HostUSBDevice"; }
116
117private:
118
119 RTUUID mId;
120 USBDeviceState_T mState;
121 bool mIgnored;
122 /** Pointer to the USB Proxy Service instance. */
123 USBProxyService *mUSBProxyService;
124
125 /** Pointer to the USB Device structure owned by this device.
126 * Only used for host devices. */
127 PUSBDEVICE m_pUsb;
128};
129
130#endif // ____H_HOSTUSBDEVICEIMPL
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