RemoteUSBDeviceImpl.cpp revision 26d2a42f095ded346df2e41cc4837cb426b4753a
/* $Id$ */
/** @file
*
* VirtualBox IHostUSBDevice COM interface implementation
* for remote (VRDP) USB devices
*/
/*
* Copyright (C) 2006-2008 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.
*/
#include "RemoteUSBDeviceImpl.h"
#include "Logging.h"
// constructor / destructor
/////////////////////////////////////////////////////////////////////////////
{
return S_OK;
}
void RemoteUSBDevice::FinalRelease()
{
uninit();
}
// public initializer/uninitializer for internal purposes only
/////////////////////////////////////////////////////////////////////////////
/** @todo (sunlover) REMOTE_USB Device states. */
/**
* Initializes the remote USB device object.
*/
{
/* Enclose the state transition NotReady->InInit->Ready */
AutoInitSpan autoInitSpan (this);
unconst (mData.manufacturer) = pDevDesc->oManufacturer? (char *)pDevDesc + pDevDesc->oManufacturer: "";
unconst (mData.serialNumber) = pDevDesc->oSerialNumber? (char *)pDevDesc + pDevDesc->oSerialNumber: "";
char id[64];
RTStrPrintf(id, sizeof (id), REMOTE_USB_BACKEND_PREFIX_S "0x%08X&0x%08X", pDevDesc->id, u32ClientId);
/* Confirm a successful initialization */
return S_OK;
}
/**
* Uninitializes the instance and sets the ready flag to FALSE.
* Called either from FinalRelease() or by the parent when it gets destroyed.
*/
void RemoteUSBDevice::uninit()
{
LogFlowThisFunc (("\n"));
/* Enclose the state transition Ready->InUninit->NotReady */
AutoUninitSpan autoUninitSpan (this);
if (autoUninitSpan.uninitDone())
return;
}
// IUSBDevice properties
/////////////////////////////////////////////////////////////////////////////
{
if (!aId)
return E_INVALIDARG;
AutoCaller autoCaller (this);
/* this is const, no need to lock */
return S_OK;
}
{
if (!aVendorId)
return E_INVALIDARG;
AutoCaller autoCaller (this);
/* this is const, no need to lock */
return S_OK;
}
{
if (!aProductId)
return E_INVALIDARG;
AutoCaller autoCaller (this);
/* this is const, no need to lock */
return S_OK;
}
{
if (!aRevision)
return E_INVALIDARG;
AutoCaller autoCaller (this);
/* this is const, no need to lock */
return S_OK;
}
{
if (!aManufacturer)
return E_INVALIDARG;
AutoCaller autoCaller (this);
/* this is const, no need to lock */
return S_OK;
}
{
if (!aProduct)
return E_INVALIDARG;
AutoCaller autoCaller (this);
/* this is const, no need to lock */
return S_OK;
}
{
if (!aSerialNumber)
return E_INVALIDARG;
AutoCaller autoCaller (this);
/* this is const, no need to lock */
return S_OK;
}
{
if (!aAddress)
return E_INVALIDARG;
AutoCaller autoCaller (this);
/* this is const, no need to lock */
return S_OK;
}
{
if (!aPort)
return E_INVALIDARG;
AutoCaller autoCaller (this);
/* this is const, no need to lock */
return S_OK;
}
{
if (!aVersion)
return E_INVALIDARG;
AutoCaller autoCaller (this);
/* this is const, no need to lock */
return S_OK;
}
{
if (!aPortVersion)
return E_INVALIDARG;
AutoCaller autoCaller (this);
/* this is const, no need to lock */
return S_OK;
}
{
if (!aRemote)
return E_INVALIDARG;
AutoCaller autoCaller (this);
/* RemoteUSBDevice is always remote. */
/* this is const, no need to lock */
return S_OK;
}
// IHostUSBDevice properties
/////////////////////////////////////////////////////////////////////////////
{
if (!aState)
return E_POINTER;
AutoCaller autoCaller (this);
AutoReadLock alock (this);
return S_OK;
}
// public methods only for internal purposes
////////////////////////////////////////////////////////////////////////////////