1 | /* $Id: KeyboardImpl.h 30760 2010-07-09 13:12:04Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox COM class implementation
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2008 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 ____H_KEYBOARDIMPL
|
---|
19 | #define ____H_KEYBOARDIMPL
|
---|
20 |
|
---|
21 | #include "VirtualBoxBase.h"
|
---|
22 |
|
---|
23 | #include <VBox/pdmdrv.h>
|
---|
24 |
|
---|
25 | /** Limit of simultaneously attached devices (just USB and/or PS/2). */
|
---|
26 | enum { KEYBOARD_MAX_DEVICES = 2 };
|
---|
27 |
|
---|
28 | class Console;
|
---|
29 |
|
---|
30 | class ATL_NO_VTABLE Keyboard :
|
---|
31 | public VirtualBoxBase,
|
---|
32 | VBOX_SCRIPTABLE_IMPL(IKeyboard)
|
---|
33 | {
|
---|
34 | public:
|
---|
35 |
|
---|
36 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Keyboard, IKeyboard)
|
---|
37 |
|
---|
38 | DECLARE_NOT_AGGREGATABLE(Keyboard)
|
---|
39 |
|
---|
40 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
41 |
|
---|
42 | BEGIN_COM_MAP(Keyboard)
|
---|
43 | COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
---|
44 | COM_INTERFACE_ENTRY(IKeyboard)
|
---|
45 | COM_INTERFACE_ENTRY(IDispatch)
|
---|
46 | END_COM_MAP()
|
---|
47 |
|
---|
48 | DECLARE_EMPTY_CTOR_DTOR (Keyboard)
|
---|
49 |
|
---|
50 | HRESULT FinalConstruct();
|
---|
51 | void FinalRelease();
|
---|
52 |
|
---|
53 | // public initializer/uninitializer for internal purposes only
|
---|
54 | HRESULT init (Console *aParent);
|
---|
55 | void uninit();
|
---|
56 |
|
---|
57 | STDMETHOD(PutScancode)(LONG scancode);
|
---|
58 | STDMETHOD(PutScancodes)(ComSafeArrayIn (LONG, scancodes),
|
---|
59 | ULONG *codesStored);
|
---|
60 | STDMETHOD(PutCAD)();
|
---|
61 |
|
---|
62 | static const PDMDRVREG DrvReg;
|
---|
63 |
|
---|
64 | Console *getParent() const
|
---|
65 | {
|
---|
66 | return mParent;
|
---|
67 | }
|
---|
68 |
|
---|
69 | private:
|
---|
70 |
|
---|
71 | static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
|
---|
72 | static DECLCALLBACK(void) keyboardSetActive(PPDMIKEYBOARDCONNECTOR pInterface, bool fActive);
|
---|
73 | static DECLCALLBACK(int) drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
|
---|
74 | static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns);
|
---|
75 |
|
---|
76 | Console * const mParent;
|
---|
77 | /** Pointer to the associated keyboard driver(s). */
|
---|
78 | struct DRVMAINKEYBOARD *mpDrv[KEYBOARD_MAX_DEVICES];
|
---|
79 | /** Pointer to the device instance for the VMM Device. */
|
---|
80 | PPDMDEVINS mpVMMDev;
|
---|
81 | /** Set after the first attempt to find the VMM Device. */
|
---|
82 | bool mfVMMDevInited;
|
---|
83 | };
|
---|
84 |
|
---|
85 | #endif // !____H_KEYBOARDIMPL
|
---|
86 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|