HasExternalPower Property
The HasExternalPower property gets or sets whether the device currently has external power. This property is used only for devices that can be self-powered.
This property is read/write.
Syntax
HRESULT put_HasExternalPower(
[in] VARIANT_BOOL fvarHasExternalPower
);
HRESULT get_HasExternalPower(
[out, retval] VARIANT_BOOL *pfvarHasExternalPower
);
Property Value
The new value for the device.
Error Codes
HasExternalPower returns S_OK if the operation succeeds or E_POINTER if the *pHasExternalPower parameter is not a valid pointer.
Remarks
The HasExternalPower property is used only for devices that can be self-powered and is used to determine the value of the D0 bit that is returned from a GET_STATUS request sent that is to the device, as described in section 9.4.5 of the USB 2.0 specification.
The following C++ code example how to set and get the HasExternalPower property.
HRESULT CLoopBackDevice::UpdateHasExternalPower(ISoftUSBDevice *piDevice)
{
HRESULT hr = S_OK;
VARIANT_BOOL fHasExternalPower = FALSE;
VARIANT_BOOL fNewHasExternalPower = FALSE;
//Get the current HasExternalPower state
hr = piDevice->get_HasExternalPower (&fHasExternalPower);
if(FAILED(hr))
goto Exit;
//Update HasExternalPower if required
if (fNewHasExternalPower != fHasExternalPower)
{
hr = piDevice->put_HasExternalPower (fNewHasExternalPower);
if(FAILED(hr))
goto Exit;
}
Exit:
return hr;
}
Requirements
Header |
SoftUSBif.h |
See Also
Send comments about this topic to Microsoft
Build date: 9/21/2010