IMDSPDevice::GetPowerSource method (mswmdm.h)
The GetPowerSource method reports whether the device is capable of running on batteries, external power, or both, and on which type of power source it is currently running. If the device is running on batteries, this method also reports the percentage of total power remaining in the batteries.
Syntax
HRESULT GetPowerSource(
[out] DWORD *pdwPowerSource,
[out] DWORD *pdwPercentRemaining
);
Parameters
[out] pdwPowerSource
Pointer to a DWORD that receives a value indicating the current power source for the device. The value is one of the following flags.
Flag | Description |
---|---|
WMDM_POWER_CAP_BATTERY | The media device can run on batteries. |
WMDM_POWER_CAP_EXTERNAL | The media device can run on external power. |
WMDM_POWER_IS_BATTERY | The media device is currently running on batteries. |
WMDM_POWER_IS_EXTERNAL | The media device is currently running on external power. |
WMDM_POWER_PERCENT_AVAILABLE | The percentage of power remaining was returned in pdwPercentRemaining. |
[out] pdwPercentRemaining
If the device is running on batteries, pdwPercentRemaining specifies a pointer to a DWORD containing the percentage of total battery power remaining.
Return value
The method returns an HRESULT. All the interface methods in Windows Media Device Manager can return any of the following classes of error codes:
- Standard COM error codes
- Windows error codes converted to HRESULT values
- Windows Media Device Manager error codes
Remarks
Only physical devices report power source capabilities and current power source. Software implementations of devices report no power capabilities or current power source.
This method is optional. For more information, see Mandatory and Optional Interfaces.
Requirements
Requirement | Value |
---|---|
Target Platform | Windows |
Header | mswmdm.h |
Library | Mssachlp.lib |