libdisplaydevice master
C++ library to modify display devices.
display_device::WinDisplayPower Class Reference

Windows implementation of DisplayPowerInterface. More...

#include <src/windows/include/display_device/windows/display_power.h>

Inheritance diagram for display_device::WinDisplayPower:
[legend]
Collaboration diagram for display_device::WinDisplayPower:
[legend]

Public Member Functions

std::unique_ptr< DisplayPowerGuardInterfacekeepDisplayAwake (const std::string &reason) override
 Keep displays awake until the returned guard is destroyed.
 
bool wakeDisplay (const std::string &display_name, std::chrono::milliseconds timeout) override
 Ask the platform to wake a display before detection or capture.
 
 WinDisplayPower (std::shared_ptr< WinApiLayerInterface > w_api)
 Default constructor for the class.
 
- Public Member Functions inherited from display_device::DisplayPowerInterface
virtual ~DisplayPowerInterface ()=default
 Default virtual destructor.
 

Detailed Description

Windows implementation of DisplayPowerInterface.

Constructor & Destructor Documentation

◆ WinDisplayPower()

display_device::WinDisplayPower::WinDisplayPower ( std::shared_ptr< WinApiLayerInterface > w_api)
explicit

Default constructor for the class.

Parameters
w_apiA pointer to the Windows API layer. Will throw on nullptr.

Member Function Documentation

◆ keepDisplayAwake()

std::unique_ptr< DisplayPowerGuardInterface > display_device::WinDisplayPower::keepDisplayAwake ( const std::string & reason)
nodiscardoverridevirtual

Keep displays awake until the returned guard is destroyed.

Parameters
reasonShort human-readable reason for the platform power assertion.
Returns
A guard that owns the assertion, or nullptr if the assertion could not be created.

Implements display_device::DisplayPowerInterface.

◆ wakeDisplay()

bool display_device::WinDisplayPower::wakeDisplay ( const std::string & display_name,
std::chrono::milliseconds timeout )
nodiscardoverridevirtual

Ask the platform to wake a display before detection or capture.

A successful result means the platform accepted the wake request and any platform-specific detection that this implementation can perform has passed. Some platforms cannot verify that the requested capture selector is awake, so callers should still retry their own capture-target enumeration after this method succeeds.

Parameters
display_namePlatform capture selector returned by SettingsManagerInterface::getDisplayName.
timeoutMaximum time to wait before the caller retries capture-target detection.
Returns
True if the wake request succeeded and platform-specific detection passed, false otherwise.

Implements display_device::DisplayPowerInterface.


The documentation for this class was generated from the following files: