Skip to content

Commit

Permalink
added power saving plan and custom guid support
Browse files Browse the repository at this point in the history
  • Loading branch information
F0903 committed Sep 12, 2024
1 parent f71d581 commit f9721c5
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions autopower_proxy/src/config/power_scheme.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
use serde::{Deserialize, Serialize};
use windows::Win32::System::SystemServices::{GUID_MIN_POWER_SAVINGS, GUID_TYPICAL_POWER_SAVINGS};
use windows::core::GUID;
use windows::Win32::System::SystemServices::{
GUID_MAX_POWER_SAVINGS, GUID_MIN_POWER_SAVINGS, GUID_TYPICAL_POWER_SAVINGS,
};

#[derive(Serialize, Deserialize, Debug, Clone, Copy)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum PowerScheme {
HighPerformance,
Balanced,
PowerSavings,
Custom(String),
}

impl PowerScheme {
pub const fn to_guid(&self) -> windows::core::GUID {
pub fn to_guid(&self) -> GUID {
match self {
Self::HighPerformance => GUID_MIN_POWER_SAVINGS,
Self::Balanced => GUID_TYPICAL_POWER_SAVINGS,
Self::PowerSavings => GUID_MAX_POWER_SAVINGS,
Self::Custom(val) => GUID::from(val.as_str()),
}
}
}

0 comments on commit f9721c5

Please sign in to comment.