|
RADLib
RADical C++ application framework
|
RADPower reads power supply, thermal zone, and CPU governor information from Linux sysfs, and exposes guarded suspend/reboot/shutdown actions.
RADPower::PowerManager is the entry point and is constructed with an optional PowerPaths. Its read-only helpers return simple snapshots: powerSupplies() yields PowerSupplyInfo (name, type, charge status, and capacityPercent), thermalZones() yields ThermalZoneInfo with a temperatureC reading, and cpuGovernors() yields CpuGovernorInfo listing the current governor and the available governors per CPU directory. setCpuGovernor() writes a governor for one CPU directory and reports failures through an optional error string.
PowerManager::requestAction() is guarded. Given a PowerAction (Suspend, Reboot, or Shutdown), it returns a PowerActionPlan describing the shell command that would be run. It only mutates host state when execute is explicitly set to true; the returned plan reports executed and any error. This lets callers preview or confirm a dangerous action before committing to it.
Tests and products can use PowerPaths to target fixture trees, containers, or board-specific sysfs mount points.
Core features:
PowerActionPlan preview of the exact command before execution.PowerPaths for fixtures and board-specific roots.Example: