VirtualBox

source: vbox/trunk/src/VBox/Main/include/EmulatedUSBImpl.h

Last change on this file was 98103, checked in by vboxsync, 16 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1/* $Id: EmulatedUSBImpl.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * Emulated USB devices manager.
4 */
5
6/*
7 * Copyright (C) 2013-2023 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
38class Console;
39class EUSBWEBCAM;
40
41typedef std::map<Utf8Str, EUSBWEBCAM *> WebcamsMap;
42
43class ATL_NO_VTABLE EmulatedUSB :
44 public EmulatedUSBWrap
45{
46public:
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
69private:
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: */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use