1 | /* $Id: EmulatedUSBImpl.h 93115 2022-01-01 11:31:46Z 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 | class Console;
|
---|
27 | class EUSBWEBCAM;
|
---|
28 |
|
---|
29 | typedef std::map<Utf8Str, EUSBWEBCAM *> WebcamsMap;
|
---|
30 |
|
---|
31 | class ATL_NO_VTABLE EmulatedUSB :
|
---|
32 | public EmulatedUSBWrap
|
---|
33 | {
|
---|
34 | public:
|
---|
35 |
|
---|
36 | DECLARE_COMMON_CLASS_METHODS(EmulatedUSB)
|
---|
37 |
|
---|
38 | HRESULT FinalConstruct();
|
---|
39 | void FinalRelease();
|
---|
40 |
|
---|
41 | /* Public initializer/uninitializer for internal purposes only. */
|
---|
42 | HRESULT init(ComObjPtr<Console> pConsole);
|
---|
43 | void uninit();
|
---|
44 |
|
---|
45 | /* Public method for internal use. */
|
---|
46 | static DECLCALLBACK(int) i_eusbCallback(void *pv, const char *pszId, uint32_t iEvent,
|
---|
47 | const void *pvData, uint32_t cbData);
|
---|
48 |
|
---|
49 | HRESULT i_webcamAttachInternal(const com::Utf8Str &aPath,
|
---|
50 | const com::Utf8Str &aSettings,
|
---|
51 | const char *pszDriver,
|
---|
52 | void *pvObject);
|
---|
53 | HRESULT i_webcamDetachInternal(const com::Utf8Str &aPath);
|
---|
54 |
|
---|
55 | private:
|
---|
56 |
|
---|
57 | static DECLCALLBACK(int) eusbCallbackEMT(EmulatedUSB *pThis, char *pszId, uint32_t iEvent,
|
---|
58 | void *pvData, uint32_t cbData);
|
---|
59 |
|
---|
60 | HRESULT webcamPathFromId(com::Utf8Str *pPath, const char *pszId);
|
---|
61 |
|
---|
62 | // wrapped IEmulatedUSB properties
|
---|
63 | virtual HRESULT getWebcams(std::vector<com::Utf8Str> &aWebcams);
|
---|
64 |
|
---|
65 | // wrapped IEmulatedUSB methods
|
---|
66 | virtual HRESULT webcamAttach(const com::Utf8Str &aPath,
|
---|
67 | const com::Utf8Str &aSettings);
|
---|
68 | virtual HRESULT webcamDetach(const com::Utf8Str &aPath);
|
---|
69 |
|
---|
70 | /* Data. */
|
---|
71 | struct Data
|
---|
72 | {
|
---|
73 | Data()
|
---|
74 | {
|
---|
75 | }
|
---|
76 |
|
---|
77 | ComObjPtr<Console> pConsole;
|
---|
78 | WebcamsMap webcams;
|
---|
79 | };
|
---|
80 |
|
---|
81 | Data m;
|
---|
82 | };
|
---|
83 |
|
---|
84 | #endif /* !MAIN_INCLUDED_EmulatedUSBImpl_h */
|
---|
85 |
|
---|
86 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|