using System;
using NvAPIWrapper.Native.GPU;
using NvAPIWrapper.Native.GPU.Structures;
namespace NvAPIWrapper.GPU
{
///
/// Holds information regarding a GPU cooler entry
///
public class GPUCooler
{
internal GPUCooler(int coolerId, PrivateCoolerSettingsV1.CoolerSetting coolerSetting, int currentRPM = -1)
{
CoolerId = coolerId;
CurrentLevel = (int) coolerSetting.CurrentLevel;
DefaultMinimumLevel = (int) coolerSetting.DefaultMinimumLevel;
DefaultMaximumLevel = (int) coolerSetting.DefaultMaximumLevel;
CurrentMinimumLevel = (int) coolerSetting.CurrentMinimumLevel;
CurrentMaximumLevel = (int) coolerSetting.CurrentMaximumLevel;
CoolerType = coolerSetting.CoolerType;
CoolerController = coolerSetting.CoolerController;
DefaultPolicy = coolerSetting.DefaultPolicy;
CurrentPolicy = coolerSetting.CurrentPolicy;
Target = coolerSetting.Target;
ControlMode = coolerSetting.ControlMode;
CurrentFanSpeedInRPM = currentRPM;
}
// ReSharper disable once TooManyDependencies
internal GPUCooler(
PrivateFanCoolersInfoV1.FanCoolersInfoEntry infoEntry,
PrivateFanCoolersStatusV1.FanCoolersStatusEntry statusEntry,
PrivateFanCoolersControlV1.FanCoolersControlEntry controlEntry)
{
if (infoEntry.CoolerId != statusEntry.CoolerId || statusEntry.CoolerId != controlEntry.CoolerId)
{
throw new ArgumentException("Passed arguments are meant to be for different coolers.");
}
CoolerId = (int) statusEntry.CoolerId;
CurrentLevel = (int) statusEntry.CurrentLevel;
DefaultMinimumLevel = (int) statusEntry.CurrentMinimumLevel;
DefaultMaximumLevel = (int) statusEntry.CurrentMaximumLevel;
CurrentMinimumLevel = (int) statusEntry.CurrentMinimumLevel;
CurrentMaximumLevel = (int) statusEntry.CurrentMaximumLevel;
CoolerType = CoolerType.Fan;
CoolerController = CoolerController.Internal;
DefaultPolicy = CoolerPolicy.None;
CurrentPolicy = controlEntry.ControlMode == FanCoolersControlMode.Manual
? CoolerPolicy.Manual
: CoolerPolicy.None;
Target = CoolerTarget.All;
ControlMode = CoolerControlMode.Variable;
CurrentFanSpeedInRPM = (int) statusEntry.CurrentRPM;
}
///
/// Gets the cooler control mode
///
public CoolerControlMode ControlMode { get; }
///
/// Gets the cooler controller
///
public CoolerController CoolerController { get; }
///
/// Gets the cooler identification number or index
///
public int CoolerId { get; }
///
/// Gets the cooler type
///
public CoolerType CoolerType { get; }
///
/// Gets the GPU fan speed in revolutions per minute
///
public int CurrentFanSpeedInRPM { get; }
///
/// Gets the cooler current level in percentage
///
public int CurrentLevel { get; }
///
/// Gets the cooler current maximum level in percentage
///
public int CurrentMaximumLevel { get; }
///
/// Gets the cooler current minimum level in percentage
///
public int CurrentMinimumLevel { get; }
///
/// Gets the cooler current policy
///
public CoolerPolicy CurrentPolicy { get; }
///
/// Gets the cooler default maximum level in percentage
///
public int DefaultMaximumLevel { get; }
///
/// Gets the cooler default minimum level in percentage
///
public int DefaultMinimumLevel { get; }
///
/// Gets the cooler default policy
///
public CoolerPolicy DefaultPolicy { get; }
///
/// Gets the cooler target
///
public CoolerTarget Target { get; }
///
public override string ToString()
{
return $"[{CoolerId} @ {CoolerController}] {Target}: {CurrentLevel}%";
}
}
}