VirtualBox

source: vbox/trunk/src/VBox/Main/include/USBProxyService.h@ 60067

最後變更 在這個檔案從60067是 60067,由 vboxsync 提交於 9 年 前

Main: Add API to IHost for adding and removing USB device sources in addition to the default host one (only USB/IP backend supported so far which will be used in the future for automatic USB testing). Add support for it in VBoxManage

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 3.5 KB
 
1/* $Id: USBProxyService.h 60067 2016-03-16 19:17:22Z vboxsync $ */
2/** @file
3 * VirtualBox USB Proxy Service (base) class.
4 */
5
6/*
7 * Copyright (C) 2005-2012 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.alldomusa.eu.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18
19#ifndef ____H_USBPROXYSERVICE
20#define ____H_USBPROXYSERVICE
21
22#include <VBox/usb.h>
23#include <VBox/usbfilter.h>
24
25#include "VirtualBoxBase.h"
26#include "VirtualBoxImpl.h"
27#include "HostUSBDeviceImpl.h"
28#include "USBProxyBackend.h"
29class Host;
30
31/**
32 * Base class for the USB Proxy service.
33 */
34class USBProxyService
35 : public VirtualBoxTranslatable
36{
37public:
38 USBProxyService(Host *aHost);
39 virtual HRESULT init(void);
40 virtual ~USBProxyService();
41
42 /**
43 * Override of the default locking class to be used for validating lock
44 * order with the standard member lock handle.
45 */
46 virtual VBoxLockingClass getLockingClass() const
47 {
48 // the USB proxy service uses the Host object lock, so return the
49 // same locking class as the host
50 return LOCKCLASS_HOSTOBJECT;
51 }
52
53 void uninit(void);
54
55 bool isActive(void);
56 int getLastError(void);
57
58 RWLockHandle *lockHandle() const;
59
60 /** @name Interface for the USBController and the Host object.
61 * @{ */
62 void *insertFilter(PCUSBFILTER aFilter);
63 void removeFilter(void *aId);
64 /** @} */
65
66 /** @name Host Interfaces
67 * @{ */
68 HRESULT getDeviceCollection(std::vector<ComPtr<IHostUSBDevice> > &aUSBDevices);
69 HRESULT addUSBDeviceSource(const com::Utf8Str &aBackend, const com::Utf8Str &aId, const com::Utf8Str &aAddress,
70 const std::vector<com::Utf8Str> &aPropertyNames, const std::vector<com::Utf8Str> &aPropertyValues);
71 HRESULT removeUSBDeviceSource(const com::Utf8Str &aId);
72 /** @} */
73
74 /** @name SessionMachine Interfaces
75 * @{ */
76 HRESULT captureDeviceForVM(SessionMachine *aMachine, IN_GUID aId, const com::Utf8Str &aCaptureFilename);
77 HRESULT detachDeviceFromVM(SessionMachine *aMachine, IN_GUID aId, bool aDone);
78 HRESULT autoCaptureDevicesForVM(SessionMachine *aMachine);
79 HRESULT detachAllDevicesFromVM(SessionMachine *aMachine, bool aDone, bool aAbnormal);
80 /** @} */
81
82 typedef std::list< ComObjPtr<HostUSBDeviceFilter> > USBDeviceFilterList;
83
84 void i_updateDeviceList(USBProxyBackend *pUsbProxyBackend, PUSBDEVICE pDevices);
85 void i_getUSBFilters(USBDeviceFilterList *pGlobalFilters);
86
87protected:
88 ComObjPtr<HostUSBDevice> findDeviceById(IN_GUID aId);
89
90 static HRESULT setError(HRESULT aResultCode, const char *aText, ...);
91
92 USBProxyBackend *findUsbProxyBackendById(const com::Utf8Str &strId);
93
94private:
95
96 /** Pointer to the Host object. */
97 Host *mHost;
98 /** List of smart HostUSBDevice pointers. */
99 typedef std::list<ComObjPtr<HostUSBDevice> > HostUSBDeviceList;
100 /** List of the known USB devices. */
101 HostUSBDeviceList mDevices;
102 /** List of USBProxyBackend pointers. */
103 typedef std::list<USBProxyBackend *> USBProxyBackendList;
104 /** List of active USB backends. */
105 USBProxyBackendList mBackends;
106 int mLastError;
107};
108
109#endif /* !____H_USBPROXYSERVICE */
110/* vi: set tabstop=4 shiftwidth=4 expandtab: */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette