1 | /* $Id: USBControllerImpl.h 26171 2010-02-02 20:37:36Z 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(USBStandard)) (USHORT *aUSBStandard);
|
---|
73 | STDMETHOD(COMGETTER(DeviceFilters)) (ComSafeArrayOut (IUSBDeviceFilter *, aDevicesFilters));
|
---|
74 |
|
---|
75 | // IUSBController methods
|
---|
76 | STDMETHOD(CreateDeviceFilter) (IN_BSTR aName, IUSBDeviceFilter **aFilter);
|
---|
77 | STDMETHOD(InsertDeviceFilter) (ULONG aPosition, IUSBDeviceFilter *aFilter);
|
---|
78 | STDMETHOD(RemoveDeviceFilter) (ULONG aPosition, IUSBDeviceFilter **aFilter);
|
---|
79 |
|
---|
80 | // public methods only for internal purposes
|
---|
81 |
|
---|
82 | HRESULT loadSettings(const settings::USBController &data);
|
---|
83 | HRESULT saveSettings(settings::USBController &data);
|
---|
84 |
|
---|
85 | void rollback();
|
---|
86 | void commit();
|
---|
87 | void copyFrom (USBController *aThat);
|
---|
88 |
|
---|
89 | #ifdef VBOX_WITH_USB
|
---|
90 | HRESULT onDeviceFilterChange (USBDeviceFilter *aFilter,
|
---|
91 | BOOL aActiveChanged = FALSE);
|
---|
92 |
|
---|
93 | bool hasMatchingFilter (const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs);
|
---|
94 | bool hasMatchingFilter (IUSBDevice *aUSBDevice, ULONG *aMaskedIfs);
|
---|
95 |
|
---|
96 | HRESULT notifyProxy (bool aInsertFilters);
|
---|
97 | #endif /* VBOX_WITH_USB */
|
---|
98 |
|
---|
99 | // public methods for internal purposes only
|
---|
100 | // (ensure there is a caller and a read lock before calling them!)
|
---|
101 | Machine* getMachine();
|
---|
102 |
|
---|
103 | // for VirtualBoxSupportErrorInfoImpl
|
---|
104 | static const wchar_t *getComponentName() { return L"USBController"; }
|
---|
105 |
|
---|
106 | private:
|
---|
107 |
|
---|
108 | void printList();
|
---|
109 |
|
---|
110 | struct Data;
|
---|
111 | Data *m;
|
---|
112 | };
|
---|
113 |
|
---|
114 | #endif //!____H_USBCONTROLLERIMPL
|
---|
115 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|