1 | /* $Id: USBControllerImpl.h 30764 2010-07-09 14:12:12Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | *
|
---|
5 | * VBox USBController COM Class declaration.
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2006-2007 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 | COM_INTERFACE_ENTRY (ISupportErrorInfo)
|
---|
46 | COM_INTERFACE_ENTRY (IUSBController)
|
---|
47 | COM_INTERFACE_ENTRY2 (IDispatch, IUSBController)
|
---|
48 | END_COM_MAP()
|
---|
49 |
|
---|
50 | DECLARE_EMPTY_CTOR_DTOR (USBController)
|
---|
51 |
|
---|
52 | HRESULT FinalConstruct();
|
---|
53 | void FinalRelease();
|
---|
54 |
|
---|
55 | // public initializer/uninitializer for internal purposes only
|
---|
56 | HRESULT init (Machine *aParent);
|
---|
57 | HRESULT init (Machine *aParent, USBController *aThat);
|
---|
58 | HRESULT initCopy (Machine *aParent, USBController *aThat);
|
---|
59 | void uninit();
|
---|
60 |
|
---|
61 | // IUSBController properties
|
---|
62 | STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled);
|
---|
63 | STDMETHOD(COMSETTER(Enabled)) (BOOL aEnabled);
|
---|
64 | STDMETHOD(COMGETTER(EnabledEhci)) (BOOL *aEnabled);
|
---|
65 | STDMETHOD(COMSETTER(EnabledEhci)) (BOOL aEnabled);
|
---|
66 | STDMETHOD(COMGETTER(ProxyAvailable)) (BOOL *aEnabled);
|
---|
67 | STDMETHOD(COMGETTER(USBStandard)) (USHORT *aUSBStandard);
|
---|
68 | STDMETHOD(COMGETTER(DeviceFilters)) (ComSafeArrayOut (IUSBDeviceFilter *, aDevicesFilters));
|
---|
69 |
|
---|
70 | // IUSBController methods
|
---|
71 | STDMETHOD(CreateDeviceFilter) (IN_BSTR aName, IUSBDeviceFilter **aFilter);
|
---|
72 | STDMETHOD(InsertDeviceFilter) (ULONG aPosition, IUSBDeviceFilter *aFilter);
|
---|
73 | STDMETHOD(RemoveDeviceFilter) (ULONG aPosition, IUSBDeviceFilter **aFilter);
|
---|
74 |
|
---|
75 | // public methods only for internal purposes
|
---|
76 |
|
---|
77 | HRESULT loadSettings(const settings::USBController &data);
|
---|
78 | HRESULT saveSettings(settings::USBController &data);
|
---|
79 |
|
---|
80 | void rollback();
|
---|
81 | void commit();
|
---|
82 | void copyFrom (USBController *aThat);
|
---|
83 |
|
---|
84 | #ifdef VBOX_WITH_USB
|
---|
85 | HRESULT onDeviceFilterChange (USBDeviceFilter *aFilter,
|
---|
86 | BOOL aActiveChanged = FALSE);
|
---|
87 |
|
---|
88 | bool hasMatchingFilter (const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs);
|
---|
89 | bool hasMatchingFilter (IUSBDevice *aUSBDevice, ULONG *aMaskedIfs);
|
---|
90 |
|
---|
91 | HRESULT notifyProxy (bool aInsertFilters);
|
---|
92 | #endif /* VBOX_WITH_USB */
|
---|
93 |
|
---|
94 | // public methods for internal purposes only
|
---|
95 | // (ensure there is a caller and a read lock before calling them!)
|
---|
96 | Machine* getMachine();
|
---|
97 |
|
---|
98 | private:
|
---|
99 |
|
---|
100 | void printList();
|
---|
101 |
|
---|
102 | struct Data;
|
---|
103 | Data *m;
|
---|
104 | };
|
---|
105 |
|
---|
106 | #endif //!____H_USBCONTROLLERIMPL
|
---|
107 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|