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

macOS implementation of DisplayPowerInterface. More...

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

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

Public Member Functions

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

Detailed Description

macOS implementation of DisplayPowerInterface.

Constructor & Destructor Documentation

◆ MacDisplayPower()

display_device::MacDisplayPower::MacDisplayPower ( std::shared_ptr< MacApiLayerInterface > m_api)
explicit

Default constructor for the class.

Parameters
m_apiA pointer to the macOS API layer. Will throw on nullptr.

Member Function Documentation

◆ keepDisplayAwake()

std::unique_ptr< DisplayPowerGuardInterface > display_device::MacDisplayPower::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::MacDisplayPower::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: