[48406] | 1 | /* $Id: EmulatedUSBImpl.h 96407 2022-08-22 17:43:14Z vboxsync $ */
|
---|
| 2 | /** @file
|
---|
| 3 | * Emulated USB devices manager.
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[96407] | 7 | * Copyright (C) 2013-2022 Oracle and/or its affiliates.
|
---|
[48406] | 8 | *
|
---|
[96407] | 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
|
---|
[48406] | 26 | */
|
---|
| 27 |
|
---|
[76562] | 28 | #ifndef MAIN_INCLUDED_EmulatedUSBImpl_h
|
---|
| 29 | #define MAIN_INCLUDED_EmulatedUSBImpl_h
|
---|
[76487] | 30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 31 | # pragma once
|
---|
| 32 | #endif
|
---|
[48406] | 33 |
|
---|
| 34 | #include "EmulatedUSBWrap.h"
|
---|
| 35 |
|
---|
[94368] | 36 | #include <VBox/vrdpusb.h>
|
---|
| 37 |
|
---|
[48406] | 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 |
|
---|
[90828] | 48 | DECLARE_COMMON_CLASS_METHODS(EmulatedUSB)
|
---|
[48406] | 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 |
|
---|
[48631] | 57 | /* Public method for internal use. */
|
---|
[50580] | 58 | static DECLCALLBACK(int) i_eusbCallback(void *pv, const char *pszId, uint32_t iEvent,
|
---|
| 59 | const void *pvData, uint32_t cbData);
|
---|
[48631] | 60 |
|
---|
[94368] | 61 | PEMULATEDUSBIF i_getEmulatedUsbIf();
|
---|
| 62 |
|
---|
[50580] | 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);
|
---|
[49120] | 68 |
|
---|
[48406] | 69 | private:
|
---|
| 70 |
|
---|
[48631] | 71 | static DECLCALLBACK(int) eusbCallbackEMT(EmulatedUSB *pThis, char *pszId, uint32_t iEvent,
|
---|
| 72 | void *pvData, uint32_t cbData);
|
---|
| 73 |
|
---|
[94368] | 74 | static DECLCALLBACK(int) i_QueryEmulatedUsbDataById(void *pvUser, const char *pszId, void **ppvEmUsbCb, void **ppvEmUsbCbData, void **ppvObject);
|
---|
| 75 |
|
---|
[48631] | 76 | HRESULT webcamPathFromId(com::Utf8Str *pPath, const char *pszId);
|
---|
| 77 |
|
---|
[48406] | 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()
|
---|
[48955] | 90 | {
|
---|
| 91 | }
|
---|
[48406] | 92 |
|
---|
| 93 | ComObjPtr<Console> pConsole;
|
---|
| 94 | WebcamsMap webcams;
|
---|
| 95 | };
|
---|
| 96 |
|
---|
| 97 | Data m;
|
---|
[94368] | 98 | EMULATEDUSBIF mEmUsbIf;
|
---|
[48406] | 99 | };
|
---|
| 100 |
|
---|
[76562] | 101 | #endif /* !MAIN_INCLUDED_EmulatedUSBImpl_h */
|
---|
[48406] | 102 |
|
---|
| 103 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|