1 | /* $Id: EmulatedUSBImpl.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Emulated USB devices manager.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2013-2024 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef MAIN_INCLUDED_EmulatedUSBImpl_h
|
---|
29 | #define MAIN_INCLUDED_EmulatedUSBImpl_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include "EmulatedUSBWrap.h"
|
---|
35 |
|
---|
36 | #include <VBox/vrdpusb.h>
|
---|
37 |
|
---|
38 | class Console;
|
---|
39 | class EUSBWEBCAM;
|
---|
40 |
|
---|
41 | typedef std::map<Utf8Str, EUSBWEBCAM *> WebcamsMap;
|
---|
42 |
|
---|
43 | class ATL_NO_VTABLE EmulatedUSB :
|
---|
44 | public EmulatedUSBWrap
|
---|
45 | {
|
---|
46 | public:
|
---|
47 |
|
---|
48 | DECLARE_COMMON_CLASS_METHODS(EmulatedUSB)
|
---|
49 |
|
---|
50 | HRESULT FinalConstruct();
|
---|
51 | void FinalRelease();
|
---|
52 |
|
---|
53 | /* Public initializer/uninitializer for internal purposes only. */
|
---|
54 | HRESULT init(ComObjPtr<Console> pConsole);
|
---|
55 | void uninit();
|
---|
56 |
|
---|
57 | /* Public method for internal use. */
|
---|
58 | static DECLCALLBACK(int) i_eusbCallback(void *pv, const char *pszId, uint32_t iEvent,
|
---|
59 | const void *pvData, uint32_t cbData);
|
---|
60 |
|
---|
61 | PEMULATEDUSBIF i_getEmulatedUsbIf();
|
---|
62 |
|
---|
63 | HRESULT i_webcamAttachInternal(const com::Utf8Str &aPath,
|
---|
64 | const com::Utf8Str &aSettings,
|
---|
65 | const char *pszDriver,
|
---|
66 | void *pvObject);
|
---|
67 | HRESULT i_webcamDetachInternal(const com::Utf8Str &aPath);
|
---|
68 |
|
---|
69 | private:
|
---|
70 |
|
---|
71 | static DECLCALLBACK(int) eusbCallbackEMT(EmulatedUSB *pThis, char *pszId, uint32_t iEvent,
|
---|
72 | void *pvData, uint32_t cbData);
|
---|
73 |
|
---|
74 | static DECLCALLBACK(int) i_QueryEmulatedUsbDataById(void *pvUser, const char *pszId, void **ppvEmUsbCb, void **ppvEmUsbCbData, void **ppvObject);
|
---|
75 |
|
---|
76 | HRESULT webcamPathFromId(com::Utf8Str *pPath, const char *pszId);
|
---|
77 |
|
---|
78 | // wrapped IEmulatedUSB properties
|
---|
79 | virtual HRESULT getWebcams(std::vector<com::Utf8Str> &aWebcams);
|
---|
80 |
|
---|
81 | // wrapped IEmulatedUSB methods
|
---|
82 | virtual HRESULT webcamAttach(const com::Utf8Str &aPath,
|
---|
83 | const com::Utf8Str &aSettings);
|
---|
84 | virtual HRESULT webcamDetach(const com::Utf8Str &aPath);
|
---|
85 |
|
---|
86 | /* Data. */
|
---|
87 | struct Data
|
---|
88 | {
|
---|
89 | Data()
|
---|
90 | {
|
---|
91 | }
|
---|
92 |
|
---|
93 | ComObjPtr<Console> pConsole;
|
---|
94 | WebcamsMap webcams;
|
---|
95 | };
|
---|
96 |
|
---|
97 | Data m;
|
---|
98 | EMULATEDUSBIF mEmUsbIf;
|
---|
99 | };
|
---|
100 |
|
---|
101 | #endif /* !MAIN_INCLUDED_EmulatedUSBImpl_h */
|
---|
102 |
|
---|
103 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|