VirtualBox

source: vbox/trunk/src/VBox/Main/VirtualBoxCallbackImpl.cpp@ 26270

Last change on this file since 26270 was 25901, checked in by vboxsync, 15 years ago

CPU hotplug: Merge 4th patch. Implements the Main API and a VBoxManage interface to turn CPU hotplug on/off and to add/remove CPUs while the VM is running

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.4 KB
Line 
1/** @file
2 *
3 * VBox Client callback COM Class implementation
4 */
5
6/*
7 * Copyright (C) 2009 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22#include "VirtualBoxCallbackImpl.h"
23#include "Logging.h"
24
25HRESULT CallbackWrapper::FinalConstruct()
26{
27 return S_OK;
28}
29
30void CallbackWrapper::FinalRelease()
31{
32}
33
34// public initializers/uninitializers only for internal purposes
35HRESULT CallbackWrapper::init()
36{
37 return S_OK;
38}
39
40void CallbackWrapper::uninit(bool aFinalRelease)
41{
42}
43
44// ILocalOwner methods
45/////////////////////////////////////////////////////////////////////////////
46
47STDMETHODIMP CallbackWrapper::SetLocalObject(IUnknown *aCallback)
48{
49 if (aCallback == NULL)
50 {
51 mVBoxCallback.setNull();
52 mConsoleCallback.setNull();
53 return S_OK;
54 }
55
56 if (!VALID_PTR (aCallback))
57 return E_POINTER;
58
59 mVBoxCallback = aCallback;
60 mConsoleCallback = aCallback;
61
62 // or some other error code?
63 AssertReturn(!!mVBoxCallback || !!mConsoleCallback, E_FAIL);
64
65 return S_OK;
66}
67
68// IVirtualBoxCallback methods
69/////////////////////////////////////////////////////////////////////////////
70STDMETHODIMP CallbackWrapper::OnMachineStateChange(IN_BSTR machineId, MachineState_T state)
71{
72 if (mVBoxCallback.isNull())
73 return S_OK;
74
75 return mVBoxCallback->OnMachineStateChange(machineId, state);
76}
77
78STDMETHODIMP CallbackWrapper::OnMachineDataChange(IN_BSTR machineId)
79{
80 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
81
82 if (mVBoxCallback.isNull())
83 return S_OK;
84
85 return mVBoxCallback->OnMachineDataChange(machineId);
86}
87
88
89STDMETHODIMP CallbackWrapper::OnExtraDataCanChange(IN_BSTR machineId, IN_BSTR key, IN_BSTR value,
90 BSTR *error, BOOL *changeAllowed)
91{
92 if (mVBoxCallback.isNull())
93 return S_OK;
94
95 return mVBoxCallback->OnExtraDataCanChange(machineId, key, value, error, changeAllowed);
96}
97
98STDMETHODIMP CallbackWrapper::OnExtraDataChange(IN_BSTR machineId, IN_BSTR key, IN_BSTR value)
99{
100 if (mVBoxCallback.isNull())
101 return S_OK;
102
103 return mVBoxCallback->OnExtraDataChange(machineId, key, value);
104}
105
106STDMETHODIMP CallbackWrapper::OnMediumRegistered(IN_BSTR mediaId, DeviceType_T mediaType,
107 BOOL registered)
108{
109 if (mVBoxCallback.isNull())
110 return S_OK;
111
112 return mVBoxCallback->OnMediumRegistered(mediaId, mediaType, registered);
113}
114
115
116STDMETHODIMP CallbackWrapper::OnMachineRegistered(IN_BSTR aMachineId, BOOL registered)
117{
118 if (mVBoxCallback.isNull())
119 return S_OK;
120
121 return mVBoxCallback->OnMachineRegistered(aMachineId, registered);
122}
123
124STDMETHODIMP CallbackWrapper::OnSessionStateChange(IN_BSTR aMachineId, SessionState_T state)
125{
126 if (mVBoxCallback.isNull())
127 return S_OK;
128
129 return mVBoxCallback->OnSessionStateChange(aMachineId, state);
130}
131
132STDMETHODIMP CallbackWrapper::OnSnapshotTaken(IN_BSTR aMachineId, IN_BSTR aSnapshotId)
133{
134 if (mVBoxCallback.isNull())
135 return S_OK;
136
137 return mVBoxCallback->OnSnapshotTaken(aMachineId, aSnapshotId);
138}
139
140STDMETHODIMP CallbackWrapper::OnSnapshotDiscarded(IN_BSTR aMachineId, IN_BSTR aSnapshotId)
141{
142 if (mVBoxCallback.isNull())
143 return S_OK;
144
145 return mVBoxCallback->OnSnapshotDiscarded(aMachineId, aSnapshotId);
146}
147
148STDMETHODIMP CallbackWrapper::OnSnapshotChange(IN_BSTR aMachineId, IN_BSTR aSnapshotId)
149{
150 if (mVBoxCallback.isNull())
151 return S_OK;
152
153 return mVBoxCallback->OnSnapshotChange(aMachineId, aSnapshotId);
154}
155
156STDMETHODIMP CallbackWrapper::OnGuestPropertyChange(IN_BSTR aMachineId, IN_BSTR key, IN_BSTR value, IN_BSTR flags)
157{
158 if (mVBoxCallback.isNull())
159 return S_OK;
160
161 return mVBoxCallback->OnGuestPropertyChange(aMachineId, key, value, flags);
162}
163
164
165// IConsoleCallback methods
166/////////////////////////////////////////////////////////////////////////////
167STDMETHODIMP CallbackWrapper::OnMousePointerShapeChange(BOOL visible, BOOL alpha, ULONG xHot, ULONG yHot,
168 ULONG width, ULONG height, BYTE *shape)
169{
170 if (mConsoleCallback.isNull())
171 return S_OK;
172
173 return mConsoleCallback->OnMousePointerShapeChange(visible, alpha, xHot, yHot, width, height, shape);
174}
175
176
177STDMETHODIMP CallbackWrapper::OnMouseCapabilityChange(BOOL supportsAbsolute, BOOL needsHostCursor)
178{
179 if (mConsoleCallback.isNull())
180 return S_OK;
181
182 return mConsoleCallback->OnMouseCapabilityChange(supportsAbsolute, needsHostCursor);
183}
184
185STDMETHODIMP CallbackWrapper::OnKeyboardLedsChange(BOOL fNumLock, BOOL fCapsLock, BOOL fScrollLock)
186{
187 if (mConsoleCallback.isNull())
188 return S_OK;
189
190 return mConsoleCallback->OnKeyboardLedsChange(fNumLock, fCapsLock, fScrollLock);
191}
192
193STDMETHODIMP CallbackWrapper::OnStateChange(MachineState_T machineState)
194{
195 if (mConsoleCallback.isNull())
196 return S_OK;
197
198 return mConsoleCallback->OnStateChange(machineState);
199}
200
201STDMETHODIMP CallbackWrapper::OnAdditionsStateChange()
202{
203 if (mConsoleCallback.isNull())
204 return S_OK;
205
206 return mConsoleCallback->OnAdditionsStateChange();
207}
208
209STDMETHODIMP CallbackWrapper::OnNetworkAdapterChange(INetworkAdapter *aNetworkAdapter)
210{
211 if (mConsoleCallback.isNull())
212 return S_OK;
213
214 return mConsoleCallback->OnNetworkAdapterChange(aNetworkAdapter);
215}
216
217STDMETHODIMP CallbackWrapper::OnSerialPortChange(ISerialPort *aSerialPort)
218{
219 if (mConsoleCallback.isNull())
220 return S_OK;
221
222 return mConsoleCallback->OnSerialPortChange(aSerialPort);
223}
224
225STDMETHODIMP CallbackWrapper::OnParallelPortChange(IParallelPort *aParallelPort)
226{
227 if (mConsoleCallback.isNull())
228 return S_OK;
229
230 return mConsoleCallback->OnParallelPortChange(aParallelPort);
231}
232
233STDMETHODIMP CallbackWrapper::OnRemoteDisplayInfoChange()
234{
235 if (mConsoleCallback.isNull())
236 return S_OK;
237
238 return mConsoleCallback->OnRemoteDisplayInfoChange();
239}
240
241STDMETHODIMP CallbackWrapper::OnVRDPServerChange()
242{
243 if (mConsoleCallback.isNull())
244 return S_OK;
245
246 return mConsoleCallback->OnVRDPServerChange();
247}
248
249STDMETHODIMP CallbackWrapper::OnUSBControllerChange()
250{
251 if (mConsoleCallback.isNull())
252 return S_OK;
253
254 return mConsoleCallback->OnUSBControllerChange();
255}
256
257STDMETHODIMP CallbackWrapper::OnUSBDeviceStateChange(IUSBDevice *aDevice,
258 BOOL aAttached,
259 IVirtualBoxErrorInfo *aError)
260{
261 if (mConsoleCallback.isNull())
262 return S_OK;
263
264 return mConsoleCallback->OnUSBDeviceStateChange(aDevice, aAttached, aError);
265}
266
267STDMETHODIMP CallbackWrapper::OnSharedFolderChange(Scope_T aScope)
268{
269 if (mConsoleCallback.isNull())
270 return S_OK;
271
272 return mConsoleCallback->OnSharedFolderChange(aScope);
273}
274
275STDMETHODIMP CallbackWrapper::OnStorageControllerChange()
276{
277 if (mConsoleCallback.isNull())
278 return S_OK;
279
280 return mConsoleCallback->OnStorageControllerChange();
281}
282
283STDMETHODIMP CallbackWrapper::OnMediumChange(IMediumAttachment *aMediumAttachment)
284{
285 if (mConsoleCallback.isNull())
286 return S_OK;
287
288 return mConsoleCallback->OnMediumChange(aMediumAttachment);
289}
290
291STDMETHODIMP CallbackWrapper::OnCPUChange(ULONG aCPU, BOOL aRemove)
292{
293 if (mConsoleCallback.isNull())
294 return S_OK;
295
296 return mConsoleCallback->OnCPUChange(aCPU, aRemove);
297}
298
299STDMETHODIMP CallbackWrapper::OnRuntimeError(BOOL fFatal, IN_BSTR id, IN_BSTR message)
300{
301 if (mConsoleCallback.isNull())
302 return S_OK;
303
304 return mConsoleCallback->OnRuntimeError(fFatal, id, message);
305}
306
307STDMETHODIMP CallbackWrapper::OnCanShowWindow(BOOL *canShow)
308{
309 if (mConsoleCallback.isNull())
310 return S_OK;
311
312 return mConsoleCallback->OnCanShowWindow(canShow);
313}
314
315STDMETHODIMP CallbackWrapper::OnShowWindow(ULONG64 *winId)
316{
317 if (mConsoleCallback.isNull())
318 return S_OK;
319
320 return mConsoleCallback->OnShowWindow(winId);
321}
Note: See TracBrowser for help on using the repository browser.

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