1 | /* $Id: USBControllerImpl.h 42551 2012-08-02 16:44:39Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | *
|
---|
5 | * VBox USBController COM Class declaration.
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2005-2012 Oracle Corporation
|
---|
10 | *
|
---|
11 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
12 | * available from http://www.virtualbox.org. This file is free software;
|
---|
13 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
14 | * General Public License (GPL) as published by the Free Software
|
---|
15 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
16 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
17 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
18 | */
|
---|
19 |
|
---|
20 | #ifndef ____H_USBCONTROLLERIMPL
|
---|
21 | #define ____H_USBCONTROLLERIMPL
|
---|
22 |
|
---|
23 | #include "VirtualBoxBase.h"
|
---|
24 |
|
---|
25 | class HostUSBDevice;
|
---|
26 | class USBDeviceFilter;
|
---|
27 |
|
---|
28 | namespace settings
|
---|
29 | {
|
---|
30 | struct USBController;
|
---|
31 | }
|
---|
32 |
|
---|
33 | class ATL_NO_VTABLE USBController :
|
---|
34 | public VirtualBoxBase,
|
---|
35 | VBOX_SCRIPTABLE_IMPL(IUSBController)
|
---|
36 | {
|
---|
37 | public:
|
---|
38 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(USBController, IUSBController)
|
---|
39 |
|
---|
40 | DECLARE_NOT_AGGREGATABLE(USBController)
|
---|
41 |
|
---|
42 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
43 |
|
---|
44 | BEGIN_COM_MAP(USBController)
|
---|
45 | VBOX_DEFAULT_INTERFACE_ENTRIES(IUSBController)
|
---|
46 | END_COM_MAP()
|
---|
47 |
|
---|
48 | DECLARE_EMPTY_CTOR_DTOR(USBController)
|
---|
49 |
|
---|
50 | HRESULT FinalConstruct();
|
---|
51 | void FinalRelease();
|
---|
52 |
|
---|
53 | // public initializer/uninitializer for internal purposes only
|
---|
54 | HRESULT init(Machine *aParent);
|
---|
55 | HRESULT init(Machine *aParent, USBController *aThat);
|
---|
56 | HRESULT initCopy(Machine *aParent, USBController *aThat);
|
---|
57 | void uninit();
|
---|
58 |
|
---|
59 | // IUSBController properties
|
---|
60 | STDMETHOD(COMGETTER(Enabled))(BOOL *aEnabled);
|
---|
61 | STDMETHOD(COMSETTER(Enabled))(BOOL aEnabled);
|
---|
62 | STDMETHOD(COMGETTER(EnabledEHCI))(BOOL *aEnabled);
|
---|
63 | STDMETHOD(COMSETTER(EnabledEHCI))(BOOL aEnabled);
|
---|
64 | STDMETHOD(COMGETTER(ProxyAvailable))(BOOL *aEnabled);
|
---|
65 | STDMETHOD(COMGETTER(USBStandard))(USHORT *aUSBStandard);
|
---|
66 | STDMETHOD(COMGETTER(DeviceFilters))(ComSafeArrayOut(IUSBDeviceFilter *, aDevicesFilters));
|
---|
67 |
|
---|
68 | // IUSBController methods
|
---|
69 | STDMETHOD(CreateDeviceFilter)(IN_BSTR aName, IUSBDeviceFilter **aFilter);
|
---|
70 | STDMETHOD(InsertDeviceFilter)(ULONG aPosition, IUSBDeviceFilter *aFilter);
|
---|
71 | STDMETHOD(RemoveDeviceFilter)(ULONG aPosition, IUSBDeviceFilter **aFilter);
|
---|
72 |
|
---|
73 | // public methods only for internal purposes
|
---|
74 |
|
---|
75 | HRESULT loadSettings(const settings::USBController &data);
|
---|
76 | HRESULT saveSettings(settings::USBController &data);
|
---|
77 |
|
---|
78 | void rollback();
|
---|
79 | void commit();
|
---|
80 | void copyFrom(USBController *aThat);
|
---|
81 |
|
---|
82 | #ifdef VBOX_WITH_USB
|
---|
83 | HRESULT onDeviceFilterChange(USBDeviceFilter *aFilter,
|
---|
84 | BOOL aActiveChanged = FALSE);
|
---|
85 |
|
---|
86 | bool hasMatchingFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs);
|
---|
87 | bool hasMatchingFilter(IUSBDevice *aUSBDevice, ULONG *aMaskedIfs);
|
---|
88 |
|
---|
89 | HRESULT notifyProxy(bool aInsertFilters);
|
---|
90 | #endif /* VBOX_WITH_USB */
|
---|
91 |
|
---|
92 | // public methods for internal purposes only
|
---|
93 | // (ensure there is a caller and a read lock before calling them!)
|
---|
94 | Machine* getMachine();
|
---|
95 |
|
---|
96 | private:
|
---|
97 |
|
---|
98 | void printList();
|
---|
99 |
|
---|
100 | struct Data;
|
---|
101 | Data *m;
|
---|
102 | };
|
---|
103 |
|
---|
104 | #endif //!____H_USBCONTROLLERIMPL
|
---|
105 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|