1 | /* $Id: USBControllerImpl.h 26968 2010-03-02 19:51:39Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | *
|
---|
5 | * VBox USBController COM Class declaration.
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
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 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
20 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
21 | * additional information or have any questions.
|
---|
22 | */
|
---|
23 |
|
---|
24 | #ifndef ____H_USBCONTROLLERIMPL
|
---|
25 | #define ____H_USBCONTROLLERIMPL
|
---|
26 |
|
---|
27 | #include "VirtualBoxBase.h"
|
---|
28 |
|
---|
29 | class HostUSBDevice;
|
---|
30 | class USBDeviceFilter;
|
---|
31 |
|
---|
32 | namespace settings
|
---|
33 | {
|
---|
34 | struct USBController;
|
---|
35 | }
|
---|
36 |
|
---|
37 | class ATL_NO_VTABLE USBController :
|
---|
38 | public VirtualBoxBase,
|
---|
39 | public VirtualBoxSupportErrorInfoImpl<USBController, IUSBController>,
|
---|
40 | public VirtualBoxSupportTranslation<USBController>,
|
---|
41 | VBOX_SCRIPTABLE_IMPL(IUSBController)
|
---|
42 | {
|
---|
43 | public:
|
---|
44 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (USBController)
|
---|
45 |
|
---|
46 | DECLARE_NOT_AGGREGATABLE (USBController)
|
---|
47 |
|
---|
48 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
49 |
|
---|
50 | BEGIN_COM_MAP(USBController)
|
---|
51 | COM_INTERFACE_ENTRY (ISupportErrorInfo)
|
---|
52 | COM_INTERFACE_ENTRY (IUSBController)
|
---|
53 | COM_INTERFACE_ENTRY2 (IDispatch, IUSBController)
|
---|
54 | END_COM_MAP()
|
---|
55 |
|
---|
56 | DECLARE_EMPTY_CTOR_DTOR (USBController)
|
---|
57 |
|
---|
58 | HRESULT FinalConstruct();
|
---|
59 | void FinalRelease();
|
---|
60 |
|
---|
61 | // public initializer/uninitializer for internal purposes only
|
---|
62 | HRESULT init (Machine *aParent);
|
---|
63 | HRESULT init (Machine *aParent, USBController *aThat);
|
---|
64 | HRESULT initCopy (Machine *aParent, USBController *aThat);
|
---|
65 | void uninit();
|
---|
66 |
|
---|
67 | // IUSBController properties
|
---|
68 | STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled);
|
---|
69 | STDMETHOD(COMSETTER(Enabled)) (BOOL aEnabled);
|
---|
70 | STDMETHOD(COMGETTER(EnabledEhci)) (BOOL *aEnabled);
|
---|
71 | STDMETHOD(COMSETTER(EnabledEhci)) (BOOL aEnabled);
|
---|
72 | STDMETHOD(COMGETTER(ProxyAvailable)) (BOOL *aEnabled);
|
---|
73 | STDMETHOD(COMGETTER(USBStandard)) (USHORT *aUSBStandard);
|
---|
74 | STDMETHOD(COMGETTER(DeviceFilters)) (ComSafeArrayOut (IUSBDeviceFilter *, aDevicesFilters));
|
---|
75 |
|
---|
76 | // IUSBController methods
|
---|
77 | STDMETHOD(CreateDeviceFilter) (IN_BSTR aName, IUSBDeviceFilter **aFilter);
|
---|
78 | STDMETHOD(InsertDeviceFilter) (ULONG aPosition, IUSBDeviceFilter *aFilter);
|
---|
79 | STDMETHOD(RemoveDeviceFilter) (ULONG aPosition, IUSBDeviceFilter **aFilter);
|
---|
80 |
|
---|
81 | // public methods only for internal purposes
|
---|
82 |
|
---|
83 | HRESULT loadSettings(const settings::USBController &data);
|
---|
84 | HRESULT saveSettings(settings::USBController &data);
|
---|
85 |
|
---|
86 | void rollback();
|
---|
87 | void commit();
|
---|
88 | void copyFrom (USBController *aThat);
|
---|
89 |
|
---|
90 | #ifdef VBOX_WITH_USB
|
---|
91 | HRESULT onDeviceFilterChange (USBDeviceFilter *aFilter,
|
---|
92 | BOOL aActiveChanged = FALSE);
|
---|
93 |
|
---|
94 | bool hasMatchingFilter (const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs);
|
---|
95 | bool hasMatchingFilter (IUSBDevice *aUSBDevice, ULONG *aMaskedIfs);
|
---|
96 |
|
---|
97 | HRESULT notifyProxy (bool aInsertFilters);
|
---|
98 | #endif /* VBOX_WITH_USB */
|
---|
99 |
|
---|
100 | // public methods for internal purposes only
|
---|
101 | // (ensure there is a caller and a read lock before calling them!)
|
---|
102 | Machine* getMachine();
|
---|
103 |
|
---|
104 | // for VirtualBoxSupportErrorInfoImpl
|
---|
105 | static const wchar_t *getComponentName() { return L"USBController"; }
|
---|
106 |
|
---|
107 | private:
|
---|
108 |
|
---|
109 | void printList();
|
---|
110 |
|
---|
111 | struct Data;
|
---|
112 | Data *m;
|
---|
113 | };
|
---|
114 |
|
---|
115 | #endif //!____H_USBCONTROLLERIMPL
|
---|
116 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|