VirtualBox

source: vbox/trunk/src/VBox/Main/include/SerialPortImpl.h@ 4271

Last change on this file since 4271 was 4271, checked in by vboxsync, 18 years ago

hrmpf

File size: 3.8 KB
Line 
1/** @file
2 *
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2007 innotek GmbH
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.215389.xyz. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ____H_SERIALPORTIMPL
19#define ____H_SERIALPORTIMPL
20
21#include "VirtualBoxBase.h"
22
23#include <VBox/cfgldr.h>
24
25class Machine;
26
27class ATL_NO_VTABLE SerialPort :
28 public VirtualBoxBaseNEXT,
29 public VirtualBoxSupportErrorInfoImpl <SerialPort, ISerialPort>,
30 public VirtualBoxSupportTranslation <SerialPort>,
31 public ISerialPort
32{
33public:
34
35 struct Data
36 {
37 Data()
38 : mSlot (0)
39 , mEnabled (FALSE)
40 , mHostMode (SerialHostMode_Disconnected)
41 , mIRQ (4)
42 , mIOBase (0x3f8)
43 , mServer (FALSE)
44 {}
45
46 bool operator== (const Data &that) const
47 {
48 return this == &that ||
49 (mSlot == that.mSlot &&
50 mEnabled == that.mEnabled &&
51 mHostMode == that.mHostMode &&
52 mIRQ == that.mIRQ &&
53 mIOBase == that.mIOBase);
54 }
55
56 ULONG mSlot;
57 BOOL mEnabled;
58 ULONG mHostMode;
59 ULONG mIRQ;
60 ULONG mIOBase;
61 Bstr mPath;
62 BOOL mServer;
63 };
64
65 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (SerialPort)
66
67 DECLARE_NOT_AGGREGATABLE(SerialPort)
68
69 DECLARE_PROTECT_FINAL_CONSTRUCT()
70
71 BEGIN_COM_MAP(SerialPort)
72 COM_INTERFACE_ENTRY(ISupportErrorInfo)
73 COM_INTERFACE_ENTRY(ISerialPort)
74 END_COM_MAP()
75
76 NS_DECL_ISUPPORTS
77
78 DECLARE_EMPTY_CTOR_DTOR (SerialPort)
79
80 HRESULT FinalConstruct();
81 void FinalRelease();
82
83 // public initializer/uninitializer for internal purposes only
84 HRESULT init (Machine *aParent, ULONG aSlot);
85 HRESULT init (Machine *aParent, SerialPort *aThat);
86 HRESULT initCopy (Machine *parent, SerialPort *aThat);
87 void uninit();
88
89 // ISerialPort properties
90 STDMETHOD(COMGETTER(Slot)) (ULONG *aSlot);
91 STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled);
92 STDMETHOD(COMSETTER(Enabled)) (BOOL aEnabled);
93 STDMETHOD(COMGETTER(HostMode)) (SerialHostMode_T *aHostMode);
94 STDMETHOD(COMSETTER(HostMode)) (SerialHostMode_T aHostMode);
95 STDMETHOD(COMGETTER(IRQ)) (ULONG *aIRQ);
96 STDMETHOD(COMSETTER(IRQ)) (ULONG aIRQ);
97 STDMETHOD(COMGETTER(IOBase) ) (ULONG *aIOBase);
98 STDMETHOD(COMSETTER(IOBase)) (ULONG aIOBase);
99 STDMETHOD(COMGETTER(Path)) (BSTR *aPath);
100 STDMETHOD(COMSETTER(Path)) (INPTR BSTR aPath);
101 STDMETHOD(COMGETTER(Server)) (BOOL *aServer);
102 STDMETHOD(COMSETTER(Server)) (BOOL aServer);
103
104 // public methods only for internal purposes
105 bool isModified() { AutoLock alock (this); return mData.isBackedUp(); }
106 bool isReallyModified() { AutoLock alock (this); return mData.hasActualChanges(); }
107 bool rollback();
108 void commit();
109 void copyFrom (SerialPort *aThat);
110
111 // public methods for internal purposes only
112 // (ensure there is a caller and a read lock before calling them!)
113
114 HRESULT loadSettings (CFGNODE aMachine, ULONG aSlot);
115 HRESULT saveSettings (CFGNODE aMachine);
116
117 // for VirtualBoxSupportErrorInfoImpl
118 static const wchar_t *getComponentName() { return L"SerialPort"; }
119
120private:
121
122 const ComObjPtr <Machine, ComWeakRef> mParent;
123 const ComObjPtr <SerialPort> mPeer;
124
125 Backupable <Data> mData;
126};
127
128#endif // ____H_FLOPPYDRIVEIMPL
Note: See TracBrowser for help on using the repository browser.

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