HostPower.cpp revision b78a2ee0977fced6695499928b445995ecacfbc0
/** @file
*
* VirtualBox interface to host's power notification service
*/
/*
* Copyright (C) 2006-2007 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include "HostPower.h"
#include "Logging.h"
{
}
{
}
{
switch (aEvent)
{
case HostPowerEvent_Suspend:
{
LogFunc (("SUSPEND\n"));
/* pause running VMs */
{
/* get the remote console */
/* the VM could have been powered down and closed or whatever */
continue;
/* note that Pause() will simply return a failure if the VM is
* in an inappropriate state */
continue;
/* save the control to un-pause the VM later */
}
break;
}
case HostPowerEvent_Resume:
{
LogFunc (("RESUME\n"));
/* go through VMs we paused on Suspend */
{
/* note that Resume() will simply return a failure if the VM is
* in an inappropriate state (it will also fail if the VM has
* been somehow closed by this time already so that the
* console reference we have is dead) */
continue;
++ resumed;
}
break;
}
{
LogFunc (("BATTERY LOW\n"));
/* save running VMs */
{
/* get the remote console */
/* the VM could have been powered down and closed or whatever */
continue;
/* note that SaveState() will simply return a failure if the VM
* is in an inappropriate state */
continue;
/* Wait until the operation has been completed. */
++ saved;
}
break;
}
}
}
/* vi: set tabstop=4 shiftwidth=4 expandtab: */