VirtualBox

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

Last change on this file since 94368 was 94368, checked in by vboxsync, 3 years ago

Main,UsbWebcam: Drop passing pointers through CFGM in favor of using VMM2USERMETHODS::pfnQueryGenericObject, bugref:10053

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
Line 
1/* $Id: EmulatedUSBImpl.h 94368 2022-03-25 07:26:37Z vboxsync $ */
2/** @file
3 * Emulated USB devices manager.
4 */
5
6/*
7 * Copyright (C) 2013-2022 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef MAIN_INCLUDED_EmulatedUSBImpl_h
19#define MAIN_INCLUDED_EmulatedUSBImpl_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include "EmulatedUSBWrap.h"
25
26#include <VBox/vrdpusb.h>
27
28class Console;
29class EUSBWEBCAM;
30
31typedef std::map<Utf8Str, EUSBWEBCAM *> WebcamsMap;
32
33class ATL_NO_VTABLE EmulatedUSB :
34 public EmulatedUSBWrap
35{
36public:
37
38 DECLARE_COMMON_CLASS_METHODS(EmulatedUSB)
39
40 HRESULT FinalConstruct();
41 void FinalRelease();
42
43 /* Public initializer/uninitializer for internal purposes only. */
44 HRESULT init(ComObjPtr<Console> pConsole);
45 void uninit();
46
47 /* Public method for internal use. */
48 static DECLCALLBACK(int) i_eusbCallback(void *pv, const char *pszId, uint32_t iEvent,
49 const void *pvData, uint32_t cbData);
50
51 PEMULATEDUSBIF i_getEmulatedUsbIf();
52
53 HRESULT i_webcamAttachInternal(const com::Utf8Str &aPath,
54 const com::Utf8Str &aSettings,
55 const char *pszDriver,
56 void *pvObject);
57 HRESULT i_webcamDetachInternal(const com::Utf8Str &aPath);
58
59private:
60
61 static DECLCALLBACK(int) eusbCallbackEMT(EmulatedUSB *pThis, char *pszId, uint32_t iEvent,
62 void *pvData, uint32_t cbData);
63
64 static DECLCALLBACK(int) i_QueryEmulatedUsbDataById(void *pvUser, const char *pszId, void **ppvEmUsbCb, void **ppvEmUsbCbData, void **ppvObject);
65
66 HRESULT webcamPathFromId(com::Utf8Str *pPath, const char *pszId);
67
68 // wrapped IEmulatedUSB properties
69 virtual HRESULT getWebcams(std::vector<com::Utf8Str> &aWebcams);
70
71 // wrapped IEmulatedUSB methods
72 virtual HRESULT webcamAttach(const com::Utf8Str &aPath,
73 const com::Utf8Str &aSettings);
74 virtual HRESULT webcamDetach(const com::Utf8Str &aPath);
75
76 /* Data. */
77 struct Data
78 {
79 Data()
80 {
81 }
82
83 ComObjPtr<Console> pConsole;
84 WebcamsMap webcams;
85 };
86
87 Data m;
88 EMULATEDUSBIF mEmUsbIf;
89};
90
91#endif /* !MAIN_INCLUDED_EmulatedUSBImpl_h */
92
93/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette