1 | /* $Id: SerialPortImpl.h 28800 2010-04-27 08:22:32Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | *
|
---|
5 | * VirtualBox COM class implementation
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2006-2007 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 ____H_SERIALPORTIMPL
|
---|
21 | #define ____H_SERIALPORTIMPL
|
---|
22 |
|
---|
23 | #include "VirtualBoxBase.h"
|
---|
24 |
|
---|
25 | class GuestOSType;
|
---|
26 |
|
---|
27 | namespace settings
|
---|
28 | {
|
---|
29 | struct SerialPort;
|
---|
30 | }
|
---|
31 |
|
---|
32 | class ATL_NO_VTABLE SerialPort :
|
---|
33 | public VirtualBoxBase,
|
---|
34 | public VirtualBoxSupportErrorInfoImpl<SerialPort, ISerialPort>,
|
---|
35 | public VirtualBoxSupportTranslation<SerialPort>,
|
---|
36 | VBOX_SCRIPTABLE_IMPL(ISerialPort)
|
---|
37 | {
|
---|
38 | public:
|
---|
39 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (SerialPort)
|
---|
40 |
|
---|
41 | DECLARE_NOT_AGGREGATABLE(SerialPort)
|
---|
42 |
|
---|
43 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
44 |
|
---|
45 | BEGIN_COM_MAP(SerialPort)
|
---|
46 | COM_INTERFACE_ENTRY (ISupportErrorInfo)
|
---|
47 | COM_INTERFACE_ENTRY (ISerialPort)
|
---|
48 | COM_INTERFACE_ENTRY2 (IDispatch, ISerialPort)
|
---|
49 | END_COM_MAP()
|
---|
50 |
|
---|
51 | DECLARE_EMPTY_CTOR_DTOR (SerialPort)
|
---|
52 |
|
---|
53 | HRESULT FinalConstruct();
|
---|
54 | void FinalRelease();
|
---|
55 |
|
---|
56 | // public initializer/uninitializer for internal purposes only
|
---|
57 | HRESULT init (Machine *aParent, ULONG aSlot);
|
---|
58 | HRESULT init (Machine *aParent, SerialPort *aThat);
|
---|
59 | HRESULT initCopy (Machine *parent, SerialPort *aThat);
|
---|
60 | void uninit();
|
---|
61 |
|
---|
62 | // ISerialPort properties
|
---|
63 | STDMETHOD(COMGETTER(Slot)) (ULONG *aSlot);
|
---|
64 | STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled);
|
---|
65 | STDMETHOD(COMSETTER(Enabled)) (BOOL aEnabled);
|
---|
66 | STDMETHOD(COMGETTER(HostMode)) (PortMode_T *aHostMode);
|
---|
67 | STDMETHOD(COMSETTER(HostMode)) (PortMode_T aHostMode);
|
---|
68 | STDMETHOD(COMGETTER(IRQ)) (ULONG *aIRQ);
|
---|
69 | STDMETHOD(COMSETTER(IRQ)) (ULONG aIRQ);
|
---|
70 | STDMETHOD(COMGETTER(IOBase) ) (ULONG *aIOBase);
|
---|
71 | STDMETHOD(COMSETTER(IOBase)) (ULONG aIOBase);
|
---|
72 | STDMETHOD(COMGETTER(Path)) (BSTR *aPath);
|
---|
73 | STDMETHOD(COMSETTER(Path)) (IN_BSTR aPath);
|
---|
74 | STDMETHOD(COMGETTER(Server)) (BOOL *aServer);
|
---|
75 | STDMETHOD(COMSETTER(Server)) (BOOL aServer);
|
---|
76 |
|
---|
77 | // public methods only for internal purposes
|
---|
78 |
|
---|
79 | HRESULT loadSettings(const settings::SerialPort &data);
|
---|
80 | HRESULT saveSettings(settings::SerialPort &data);
|
---|
81 |
|
---|
82 | bool isModified();
|
---|
83 | void rollback();
|
---|
84 | void commit();
|
---|
85 | void copyFrom(SerialPort *aThat);
|
---|
86 |
|
---|
87 | void applyDefaults (GuestOSType *aOsType);
|
---|
88 |
|
---|
89 | // public methods for internal purposes only
|
---|
90 | // (ensure there is a caller and a read lock before calling them!)
|
---|
91 |
|
---|
92 | // for VirtualBoxSupportErrorInfoImpl
|
---|
93 | static const wchar_t *getComponentName() { return L"SerialPort"; }
|
---|
94 |
|
---|
95 | private:
|
---|
96 | HRESULT checkSetPath(const Utf8Str &str);
|
---|
97 |
|
---|
98 | struct Data;
|
---|
99 | Data *m;
|
---|
100 | };
|
---|
101 |
|
---|
102 | #endif // ____H_FLOPPYDRIVEIMPL
|
---|
103 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|