HostUSBDeviceImpl.h revision 60e0f5a98bb6781dfe5c134512c314f525501e48
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * VirtualBox IHostUSBDevice COM interface implementation
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Copyright (C) 2006 InnoTek Systemberatung GmbH
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * available from http://www.virtualbox.org. This file is free software;
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * you can redistribute it and/or modify it under the terms of the GNU
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * General Public License as published by the Free Software Foundation,
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * distribution. VirtualBox OSE is distributed in the hope that it will
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * be useful, but WITHOUT ANY WARRANTY of any kind.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * If you received this file as part of a commercial VirtualBox
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * distribution, then only the terms of your commercial VirtualBox
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * license agreement apply instead of the previous paragraph.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/* #include "USBProxyService.h" circular on Host/HostUSBDevice, the includer
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * must include this. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Object class used to hold Host USB Device properties.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync public VirtualBoxSupportErrorInfoImpl <HostUSBDevice, IHostUSBDevice>,
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync public VirtualBoxSupportTranslation <HostUSBDevice>,
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (HostUSBDevice)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync // public initializer/uninitializer for internal purposes only
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync HRESULT init(PUSBDEVICE aUsb, USBProxyService *aUSBProxyService);
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync // IUSBDevice properties
f6dde23cd488aee26203b38ec67220270f5c4273vboxsync STDMETHOD(COMGETTER(ProductId))(USHORT *aProductId);
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync STDMETHOD(COMGETTER(Manufacturer))(BSTR *aManufacturer);
ee5869bb73f07de9c139dc6a608836a7b5767933vboxsync STDMETHOD(COMGETTER(SerialNumber))(BSTR *aSerialNumber);
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync // IHostUSBDevice properties
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync STDMETHOD(COMGETTER(State))(USBDeviceState_T *aState);
482a222498aae619afda0255a7edf4ebda97268cvboxsync // public methods only for internal purposes
a96ed55e8e1b248965a3d29d6e4c3116979e887bvboxsync /* @note Must be called from under the object read lock. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /* @note Must be called from under the object read lock. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /** Same as state() except you don't need to lock any thing. */
a96ed55e8e1b248965a3d29d6e4c3116979e887bvboxsync /* @note Must be called from under the object read lock. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync USBDeviceState_T pendingState() const { return mPendingState; }
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /** Same as pendingState() except you don't need to lock any thing. */
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync /* @note Must be called from under the object read lock. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync ComObjPtr <SessionMachine, ComWeakRef> &machine() { return mMachine; }
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/// @todo remove
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /* @note Must be called from under the object read lock. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /* @note Must be called from under the object read lock. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync bool isStatePending() const { return mIsStatePending; }
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /** Same as isStatePending() except you don't need to lock any thing. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync /* @note Must be called from under the object read lock. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/// @todo remove
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/// @todo remove
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync static int compare (PCUSBDEVICE pDev1, PCUSBDEVICE pDev2);
6f25e64d3d98b4f23e7ef0faaa225cb980d6abe8vboxsync // for VirtualBoxSupportErrorInfoImpl
f6dde23cd488aee26203b38ec67220270f5c4273vboxsync static const wchar_t *getComponentName() { return L"HostUSBDevice"; }
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/// @todo remove
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync /** Pointer to the USB Proxy Service instance. */
611af5c9fc04865215e86b6e4906c9dfdfb6a381vboxsync /** Pointer to the USB Device structure owned by this device.
f9cac318205d74ee5b35dabcf2bd39118f6293d7vboxsync * Only used for host devices. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncCOM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN (HostUSBDevice)
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync STDMETHOD(FindById) (INPTR GUIDPARAM aId, IHostUSBDevice **aDevice)
return E_INVALIDARG;
if (!aDevice)
return E_POINTER;
++ it;
if (!found)
if (!aAddress)
return E_INVALIDARG;
if (!aDevice)
return E_POINTER;
++ it;
if (!found)
aAddress);