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