--- /dev/null
+#[doc(hidden)]
+#[cfg(feature = "deprecated")]
+#[repr(transparent)]
+pub struct IBackgroundEnergyManagerStatics(::windows::core::IUnknown);
+#[cfg(feature = "deprecated")]
+unsafe impl ::windows::core::Interface for IBackgroundEnergyManagerStatics {
+ type Vtable = IBackgroundEnergyManagerStatics_Vtbl;
+}
+#[cfg(feature = "deprecated")]
+impl ::core::clone::Clone for IBackgroundEnergyManagerStatics {
+ fn clone(&self) -> Self {
+ Self(self.0.clone())
+ }
+}
+#[cfg(feature = "deprecated")]
+unsafe impl ::windows::core::ComInterface for IBackgroundEnergyManagerStatics {
+ const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb3161d95_1180_4376_96e1_4095568147ce);
+}
+#[cfg(feature = "deprecated")]
+#[repr(C)]
+#[doc(hidden)]
+pub struct IBackgroundEnergyManagerStatics_Vtbl {
+ pub base__: ::windows::core::IInspectable_Vtbl,
+ #[cfg(feature = "deprecated")]
+ pub LowUsageLevel: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, result__: *mut u32) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "deprecated"))]
+ LowUsageLevel: usize,
+ #[cfg(feature = "deprecated")]
+ pub NearMaxAcceptableUsageLevel: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, result__: *mut u32) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "deprecated"))]
+ NearMaxAcceptableUsageLevel: usize,
+ #[cfg(feature = "deprecated")]
+ pub MaxAcceptableUsageLevel: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, result__: *mut u32) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "deprecated"))]
+ MaxAcceptableUsageLevel: usize,
+ #[cfg(feature = "deprecated")]
+ pub ExcessiveUsageLevel: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, result__: *mut u32) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "deprecated"))]
+ ExcessiveUsageLevel: usize,
+ #[cfg(feature = "deprecated")]
+ pub NearTerminationUsageLevel: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, result__: *mut u32) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "deprecated"))]
+ NearTerminationUsageLevel: usize,
+ #[cfg(feature = "deprecated")]
+ pub TerminationUsageLevel: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, result__: *mut u32) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "deprecated"))]
+ TerminationUsageLevel: usize,
+ #[cfg(feature = "deprecated")]
+ pub RecentEnergyUsage: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, result__: *mut u32) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "deprecated"))]
+ RecentEnergyUsage: usize,
+ #[cfg(feature = "deprecated")]
+ pub RecentEnergyUsageLevel: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, result__: *mut u32) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "deprecated"))]
+ RecentEnergyUsageLevel: usize,
+ #[cfg(all(feature = "Foundation", feature = "deprecated"))]
+ pub RecentEnergyUsageIncreased: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, handler: *mut ::core::ffi::c_void, result__: *mut super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT,
+ #[cfg(not(all(feature = "Foundation", feature = "deprecated")))]
+ RecentEnergyUsageIncreased: usize,
+ #[cfg(all(feature = "Foundation", feature = "deprecated"))]
+ pub RemoveRecentEnergyUsageIncreased: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, token: super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT,
+ #[cfg(not(all(feature = "Foundation", feature = "deprecated")))]
+ RemoveRecentEnergyUsageIncreased: usize,
+ #[cfg(all(feature = "Foundation", feature = "deprecated"))]
+ pub RecentEnergyUsageReturnedToLow: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, handler: *mut ::core::ffi::c_void, result__: *mut super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT,
+ #[cfg(not(all(feature = "Foundation", feature = "deprecated")))]
+ RecentEnergyUsageReturnedToLow: usize,
+ #[cfg(all(feature = "Foundation", feature = "deprecated"))]
+ pub RemoveRecentEnergyUsageReturnedToLow: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, token: super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT,
+ #[cfg(not(all(feature = "Foundation", feature = "deprecated")))]
+ RemoveRecentEnergyUsageReturnedToLow: usize,
+}
+#[doc(hidden)]
+#[cfg(feature = "deprecated")]
+#[repr(transparent)]
+pub struct IForegroundEnergyManagerStatics(::windows::core::IUnknown);
+#[cfg(feature = "deprecated")]
+unsafe impl ::windows::core::Interface for IForegroundEnergyManagerStatics {
+ type Vtable = IForegroundEnergyManagerStatics_Vtbl;
+}
+#[cfg(feature = "deprecated")]
+impl ::core::clone::Clone for IForegroundEnergyManagerStatics {
+ fn clone(&self) -> Self {
+ Self(self.0.clone())
+ }
+}
+#[cfg(feature = "deprecated")]
+unsafe impl ::windows::core::ComInterface for IForegroundEnergyManagerStatics {
+ const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9ff86872_e677_4814_9a20_5337ca732b98);
+}
+#[cfg(feature = "deprecated")]
+#[repr(C)]
+#[doc(hidden)]
+pub struct IForegroundEnergyManagerStatics_Vtbl {
+ pub base__: ::windows::core::IInspectable_Vtbl,
+ #[cfg(feature = "deprecated")]
+ pub LowUsageLevel: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, result__: *mut u32) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "deprecated"))]
+ LowUsageLevel: usize,
+ #[cfg(feature = "deprecated")]
+ pub NearMaxAcceptableUsageLevel: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, result__: *mut u32) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "deprecated"))]
+ NearMaxAcceptableUsageLevel: usize,
+ #[cfg(feature = "deprecated")]
+ pub MaxAcceptableUsageLevel: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, result__: *mut u32) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "deprecated"))]
+ MaxAcceptableUsageLevel: usize,
+ #[cfg(feature = "deprecated")]
+ pub ExcessiveUsageLevel: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, result__: *mut u32) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "deprecated"))]
+ ExcessiveUsageLevel: usize,
+ #[cfg(feature = "deprecated")]
+ pub RecentEnergyUsage: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, result__: *mut u32) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "deprecated"))]
+ RecentEnergyUsage: usize,
+ #[cfg(feature = "deprecated")]
+ pub RecentEnergyUsageLevel: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, result__: *mut u32) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "deprecated"))]
+ RecentEnergyUsageLevel: usize,
+ #[cfg(all(feature = "Foundation", feature = "deprecated"))]
+ pub RecentEnergyUsageIncreased: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, handler: *mut ::core::ffi::c_void, result__: *mut super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT,
+ #[cfg(not(all(feature = "Foundation", feature = "deprecated")))]
+ RecentEnergyUsageIncreased: usize,
+ #[cfg(all(feature = "Foundation", feature = "deprecated"))]
+ pub RemoveRecentEnergyUsageIncreased: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, token: super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT,
+ #[cfg(not(all(feature = "Foundation", feature = "deprecated")))]
+ RemoveRecentEnergyUsageIncreased: usize,
+ #[cfg(all(feature = "Foundation", feature = "deprecated"))]
+ pub RecentEnergyUsageReturnedToLow: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, handler: *mut ::core::ffi::c_void, result__: *mut super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT,
+ #[cfg(not(all(feature = "Foundation", feature = "deprecated")))]
+ RecentEnergyUsageReturnedToLow: usize,
+ #[cfg(all(feature = "Foundation", feature = "deprecated"))]
+ pub RemoveRecentEnergyUsageReturnedToLow: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, token: super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT,
+ #[cfg(not(all(feature = "Foundation", feature = "deprecated")))]
+ RemoveRecentEnergyUsageReturnedToLow: usize,
+}
+#[doc(hidden)]
+#[repr(transparent)]
+pub struct IPowerManagerStatics(::windows::core::IUnknown);
+unsafe impl ::windows::core::Interface for IPowerManagerStatics {
+ type Vtable = IPowerManagerStatics_Vtbl;
+}
+impl ::core::clone::Clone for IPowerManagerStatics {
+ fn clone(&self) -> Self {
+ Self(self.0.clone())
+ }
+}
+unsafe impl ::windows::core::ComInterface for IPowerManagerStatics {
+ const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1394825d_62ce_4364_98d5_aa28c7fbd15b);
+}
+#[repr(C)]
+#[doc(hidden)]
+pub struct IPowerManagerStatics_Vtbl {
+ pub base__: ::windows::core::IInspectable_Vtbl,
+ pub EnergySaverStatus: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, result__: *mut EnergySaverStatus) -> ::windows::core::HRESULT,
+ #[cfg(feature = "Foundation")]
+ pub EnergySaverStatusChanged: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, handler: *mut ::core::ffi::c_void, result__: *mut super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "Foundation"))]
+ EnergySaverStatusChanged: usize,
+ #[cfg(feature = "Foundation")]
+ pub RemoveEnergySaverStatusChanged: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, token: super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "Foundation"))]
+ RemoveEnergySaverStatusChanged: usize,
+ pub BatteryStatus: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, result__: *mut BatteryStatus) -> ::windows::core::HRESULT,
+ #[cfg(feature = "Foundation")]
+ pub BatteryStatusChanged: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, handler: *mut ::core::ffi::c_void, result__: *mut super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "Foundation"))]
+ BatteryStatusChanged: usize,
+ #[cfg(feature = "Foundation")]
+ pub RemoveBatteryStatusChanged: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, token: super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "Foundation"))]
+ RemoveBatteryStatusChanged: usize,
+ pub PowerSupplyStatus: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, result__: *mut PowerSupplyStatus) -> ::windows::core::HRESULT,
+ #[cfg(feature = "Foundation")]
+ pub PowerSupplyStatusChanged: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, handler: *mut ::core::ffi::c_void, result__: *mut super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "Foundation"))]
+ PowerSupplyStatusChanged: usize,
+ #[cfg(feature = "Foundation")]
+ pub RemovePowerSupplyStatusChanged: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, token: super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "Foundation"))]
+ RemovePowerSupplyStatusChanged: usize,
+ pub RemainingChargePercent: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, result__: *mut i32) -> ::windows::core::HRESULT,
+ #[cfg(feature = "Foundation")]
+ pub RemainingChargePercentChanged: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, handler: *mut ::core::ffi::c_void, result__: *mut super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "Foundation"))]
+ RemainingChargePercentChanged: usize,
+ #[cfg(feature = "Foundation")]
+ pub RemoveRemainingChargePercentChanged: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, token: super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "Foundation"))]
+ RemoveRemainingChargePercentChanged: usize,
+ #[cfg(feature = "Foundation")]
+ pub RemainingDischargeTime: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, result__: *mut super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "Foundation"))]
+ RemainingDischargeTime: usize,
+ #[cfg(feature = "Foundation")]
+ pub RemainingDischargeTimeChanged: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, handler: *mut ::core::ffi::c_void, result__: *mut super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "Foundation"))]
+ RemainingDischargeTimeChanged: usize,
+ #[cfg(feature = "Foundation")]
+ pub RemoveRemainingDischargeTimeChanged: unsafe extern "system" fn(this: *mut ::core::ffi::c_void, token: super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT,
+ #[cfg(not(feature = "Foundation"))]
+ RemoveRemainingDischargeTimeChanged: usize,
+}
+#[doc = "*Required features: `\"System_Power\"`, `\"deprecated\"`*"]
+#[cfg(feature = "deprecated")]
+pub struct BackgroundEnergyManager;
+#[cfg(feature = "deprecated")]
+impl BackgroundEnergyManager {
+ #[doc = "*Required features: `\"deprecated\"`*"]
+ #[cfg(feature = "deprecated")]
+ pub fn LowUsageLevel() -> ::windows::core::Result<u32> {
+ Self::IBackgroundEnergyManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<u32>();
+ (::windows::core::Interface::vtable(this).LowUsageLevel)(::windows::core::Interface::as_raw(this), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"deprecated\"`*"]
+ #[cfg(feature = "deprecated")]
+ pub fn NearMaxAcceptableUsageLevel() -> ::windows::core::Result<u32> {
+ Self::IBackgroundEnergyManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<u32>();
+ (::windows::core::Interface::vtable(this).NearMaxAcceptableUsageLevel)(::windows::core::Interface::as_raw(this), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"deprecated\"`*"]
+ #[cfg(feature = "deprecated")]
+ pub fn MaxAcceptableUsageLevel() -> ::windows::core::Result<u32> {
+ Self::IBackgroundEnergyManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<u32>();
+ (::windows::core::Interface::vtable(this).MaxAcceptableUsageLevel)(::windows::core::Interface::as_raw(this), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"deprecated\"`*"]
+ #[cfg(feature = "deprecated")]
+ pub fn ExcessiveUsageLevel() -> ::windows::core::Result<u32> {
+ Self::IBackgroundEnergyManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<u32>();
+ (::windows::core::Interface::vtable(this).ExcessiveUsageLevel)(::windows::core::Interface::as_raw(this), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"deprecated\"`*"]
+ #[cfg(feature = "deprecated")]
+ pub fn NearTerminationUsageLevel() -> ::windows::core::Result<u32> {
+ Self::IBackgroundEnergyManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<u32>();
+ (::windows::core::Interface::vtable(this).NearTerminationUsageLevel)(::windows::core::Interface::as_raw(this), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"deprecated\"`*"]
+ #[cfg(feature = "deprecated")]
+ pub fn TerminationUsageLevel() -> ::windows::core::Result<u32> {
+ Self::IBackgroundEnergyManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<u32>();
+ (::windows::core::Interface::vtable(this).TerminationUsageLevel)(::windows::core::Interface::as_raw(this), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"deprecated\"`*"]
+ #[cfg(feature = "deprecated")]
+ pub fn RecentEnergyUsage() -> ::windows::core::Result<u32> {
+ Self::IBackgroundEnergyManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<u32>();
+ (::windows::core::Interface::vtable(this).RecentEnergyUsage)(::windows::core::Interface::as_raw(this), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"deprecated\"`*"]
+ #[cfg(feature = "deprecated")]
+ pub fn RecentEnergyUsageLevel() -> ::windows::core::Result<u32> {
+ Self::IBackgroundEnergyManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<u32>();
+ (::windows::core::Interface::vtable(this).RecentEnergyUsageLevel)(::windows::core::Interface::as_raw(this), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"Foundation\"`, `\"deprecated\"`*"]
+ #[cfg(all(feature = "Foundation", feature = "deprecated"))]
+ pub fn RecentEnergyUsageIncreased(handler: &super::super::Foundation::EventHandler<::windows::core::IInspectable>) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> {
+ Self::IBackgroundEnergyManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<super::super::Foundation::EventRegistrationToken>();
+ (::windows::core::Interface::vtable(this).RecentEnergyUsageIncreased)(::windows::core::Interface::as_raw(this), ::core::mem::transmute_copy(handler), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"Foundation\"`, `\"deprecated\"`*"]
+ #[cfg(all(feature = "Foundation", feature = "deprecated"))]
+ pub fn RemoveRecentEnergyUsageIncreased(token: super::super::Foundation::EventRegistrationToken) -> ::windows::core::Result<()> {
+ Self::IBackgroundEnergyManagerStatics(|this| unsafe { (::windows::core::Interface::vtable(this).RemoveRecentEnergyUsageIncreased)(::windows::core::Interface::as_raw(this), token).ok() })
+ }
+ #[doc = "*Required features: `\"Foundation\"`, `\"deprecated\"`*"]
+ #[cfg(all(feature = "Foundation", feature = "deprecated"))]
+ pub fn RecentEnergyUsageReturnedToLow(handler: &super::super::Foundation::EventHandler<::windows::core::IInspectable>) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> {
+ Self::IBackgroundEnergyManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<super::super::Foundation::EventRegistrationToken>();
+ (::windows::core::Interface::vtable(this).RecentEnergyUsageReturnedToLow)(::windows::core::Interface::as_raw(this), ::core::mem::transmute_copy(handler), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"Foundation\"`, `\"deprecated\"`*"]
+ #[cfg(all(feature = "Foundation", feature = "deprecated"))]
+ pub fn RemoveRecentEnergyUsageReturnedToLow(token: super::super::Foundation::EventRegistrationToken) -> ::windows::core::Result<()> {
+ Self::IBackgroundEnergyManagerStatics(|this| unsafe { (::windows::core::Interface::vtable(this).RemoveRecentEnergyUsageReturnedToLow)(::windows::core::Interface::as_raw(this), token).ok() })
+ }
+ #[doc(hidden)]
+ #[cfg(feature = "deprecated")]
+ pub fn IBackgroundEnergyManagerStatics<R, F: FnOnce(&IBackgroundEnergyManagerStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> {
+ static SHARED: ::windows::imp::FactoryCache<BackgroundEnergyManager, IBackgroundEnergyManagerStatics> = ::windows::imp::FactoryCache::new();
+ SHARED.call(callback)
+ }
+}
+#[cfg(feature = "deprecated")]
+impl ::windows::core::RuntimeName for BackgroundEnergyManager {
+ const NAME: &'static str = "Windows.System.Power.BackgroundEnergyManager";
+}
+#[doc = "*Required features: `\"System_Power\"`, `\"deprecated\"`*"]
+#[cfg(feature = "deprecated")]
+pub struct ForegroundEnergyManager;
+#[cfg(feature = "deprecated")]
+impl ForegroundEnergyManager {
+ #[doc = "*Required features: `\"deprecated\"`*"]
+ #[cfg(feature = "deprecated")]
+ pub fn LowUsageLevel() -> ::windows::core::Result<u32> {
+ Self::IForegroundEnergyManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<u32>();
+ (::windows::core::Interface::vtable(this).LowUsageLevel)(::windows::core::Interface::as_raw(this), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"deprecated\"`*"]
+ #[cfg(feature = "deprecated")]
+ pub fn NearMaxAcceptableUsageLevel() -> ::windows::core::Result<u32> {
+ Self::IForegroundEnergyManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<u32>();
+ (::windows::core::Interface::vtable(this).NearMaxAcceptableUsageLevel)(::windows::core::Interface::as_raw(this), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"deprecated\"`*"]
+ #[cfg(feature = "deprecated")]
+ pub fn MaxAcceptableUsageLevel() -> ::windows::core::Result<u32> {
+ Self::IForegroundEnergyManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<u32>();
+ (::windows::core::Interface::vtable(this).MaxAcceptableUsageLevel)(::windows::core::Interface::as_raw(this), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"deprecated\"`*"]
+ #[cfg(feature = "deprecated")]
+ pub fn ExcessiveUsageLevel() -> ::windows::core::Result<u32> {
+ Self::IForegroundEnergyManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<u32>();
+ (::windows::core::Interface::vtable(this).ExcessiveUsageLevel)(::windows::core::Interface::as_raw(this), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"deprecated\"`*"]
+ #[cfg(feature = "deprecated")]
+ pub fn RecentEnergyUsage() -> ::windows::core::Result<u32> {
+ Self::IForegroundEnergyManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<u32>();
+ (::windows::core::Interface::vtable(this).RecentEnergyUsage)(::windows::core::Interface::as_raw(this), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"deprecated\"`*"]
+ #[cfg(feature = "deprecated")]
+ pub fn RecentEnergyUsageLevel() -> ::windows::core::Result<u32> {
+ Self::IForegroundEnergyManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<u32>();
+ (::windows::core::Interface::vtable(this).RecentEnergyUsageLevel)(::windows::core::Interface::as_raw(this), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"Foundation\"`, `\"deprecated\"`*"]
+ #[cfg(all(feature = "Foundation", feature = "deprecated"))]
+ pub fn RecentEnergyUsageIncreased(handler: &super::super::Foundation::EventHandler<::windows::core::IInspectable>) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> {
+ Self::IForegroundEnergyManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<super::super::Foundation::EventRegistrationToken>();
+ (::windows::core::Interface::vtable(this).RecentEnergyUsageIncreased)(::windows::core::Interface::as_raw(this), ::core::mem::transmute_copy(handler), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"Foundation\"`, `\"deprecated\"`*"]
+ #[cfg(all(feature = "Foundation", feature = "deprecated"))]
+ pub fn RemoveRecentEnergyUsageIncreased(token: super::super::Foundation::EventRegistrationToken) -> ::windows::core::Result<()> {
+ Self::IForegroundEnergyManagerStatics(|this| unsafe { (::windows::core::Interface::vtable(this).RemoveRecentEnergyUsageIncreased)(::windows::core::Interface::as_raw(this), token).ok() })
+ }
+ #[doc = "*Required features: `\"Foundation\"`, `\"deprecated\"`*"]
+ #[cfg(all(feature = "Foundation", feature = "deprecated"))]
+ pub fn RecentEnergyUsageReturnedToLow(handler: &super::super::Foundation::EventHandler<::windows::core::IInspectable>) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> {
+ Self::IForegroundEnergyManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<super::super::Foundation::EventRegistrationToken>();
+ (::windows::core::Interface::vtable(this).RecentEnergyUsageReturnedToLow)(::windows::core::Interface::as_raw(this), ::core::mem::transmute_copy(handler), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"Foundation\"`, `\"deprecated\"`*"]
+ #[cfg(all(feature = "Foundation", feature = "deprecated"))]
+ pub fn RemoveRecentEnergyUsageReturnedToLow(token: super::super::Foundation::EventRegistrationToken) -> ::windows::core::Result<()> {
+ Self::IForegroundEnergyManagerStatics(|this| unsafe { (::windows::core::Interface::vtable(this).RemoveRecentEnergyUsageReturnedToLow)(::windows::core::Interface::as_raw(this), token).ok() })
+ }
+ #[doc(hidden)]
+ #[cfg(feature = "deprecated")]
+ pub fn IForegroundEnergyManagerStatics<R, F: FnOnce(&IForegroundEnergyManagerStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> {
+ static SHARED: ::windows::imp::FactoryCache<ForegroundEnergyManager, IForegroundEnergyManagerStatics> = ::windows::imp::FactoryCache::new();
+ SHARED.call(callback)
+ }
+}
+#[cfg(feature = "deprecated")]
+impl ::windows::core::RuntimeName for ForegroundEnergyManager {
+ const NAME: &'static str = "Windows.System.Power.ForegroundEnergyManager";
+}
+#[doc = "*Required features: `\"System_Power\"`*"]
+pub struct PowerManager;
+impl PowerManager {
+ pub fn EnergySaverStatus() -> ::windows::core::Result<EnergySaverStatus> {
+ Self::IPowerManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<EnergySaverStatus>();
+ (::windows::core::Interface::vtable(this).EnergySaverStatus)(::windows::core::Interface::as_raw(this), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"Foundation\"`*"]
+ #[cfg(feature = "Foundation")]
+ pub fn EnergySaverStatusChanged(handler: &super::super::Foundation::EventHandler<::windows::core::IInspectable>) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> {
+ Self::IPowerManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<super::super::Foundation::EventRegistrationToken>();
+ (::windows::core::Interface::vtable(this).EnergySaverStatusChanged)(::windows::core::Interface::as_raw(this), ::core::mem::transmute_copy(handler), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"Foundation\"`*"]
+ #[cfg(feature = "Foundation")]
+ pub fn RemoveEnergySaverStatusChanged(token: super::super::Foundation::EventRegistrationToken) -> ::windows::core::Result<()> {
+ Self::IPowerManagerStatics(|this| unsafe { (::windows::core::Interface::vtable(this).RemoveEnergySaverStatusChanged)(::windows::core::Interface::as_raw(this), token).ok() })
+ }
+ pub fn BatteryStatus() -> ::windows::core::Result<BatteryStatus> {
+ Self::IPowerManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<BatteryStatus>();
+ (::windows::core::Interface::vtable(this).BatteryStatus)(::windows::core::Interface::as_raw(this), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"Foundation\"`*"]
+ #[cfg(feature = "Foundation")]
+ pub fn BatteryStatusChanged(handler: &super::super::Foundation::EventHandler<::windows::core::IInspectable>) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> {
+ Self::IPowerManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<super::super::Foundation::EventRegistrationToken>();
+ (::windows::core::Interface::vtable(this).BatteryStatusChanged)(::windows::core::Interface::as_raw(this), ::core::mem::transmute_copy(handler), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"Foundation\"`*"]
+ #[cfg(feature = "Foundation")]
+ pub fn RemoveBatteryStatusChanged(token: super::super::Foundation::EventRegistrationToken) -> ::windows::core::Result<()> {
+ Self::IPowerManagerStatics(|this| unsafe { (::windows::core::Interface::vtable(this).RemoveBatteryStatusChanged)(::windows::core::Interface::as_raw(this), token).ok() })
+ }
+ pub fn PowerSupplyStatus() -> ::windows::core::Result<PowerSupplyStatus> {
+ Self::IPowerManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<PowerSupplyStatus>();
+ (::windows::core::Interface::vtable(this).PowerSupplyStatus)(::windows::core::Interface::as_raw(this), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"Foundation\"`*"]
+ #[cfg(feature = "Foundation")]
+ pub fn PowerSupplyStatusChanged(handler: &super::super::Foundation::EventHandler<::windows::core::IInspectable>) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> {
+ Self::IPowerManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<super::super::Foundation::EventRegistrationToken>();
+ (::windows::core::Interface::vtable(this).PowerSupplyStatusChanged)(::windows::core::Interface::as_raw(this), ::core::mem::transmute_copy(handler), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"Foundation\"`*"]
+ #[cfg(feature = "Foundation")]
+ pub fn RemovePowerSupplyStatusChanged(token: super::super::Foundation::EventRegistrationToken) -> ::windows::core::Result<()> {
+ Self::IPowerManagerStatics(|this| unsafe { (::windows::core::Interface::vtable(this).RemovePowerSupplyStatusChanged)(::windows::core::Interface::as_raw(this), token).ok() })
+ }
+ pub fn RemainingChargePercent() -> ::windows::core::Result<i32> {
+ Self::IPowerManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<i32>();
+ (::windows::core::Interface::vtable(this).RemainingChargePercent)(::windows::core::Interface::as_raw(this), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"Foundation\"`*"]
+ #[cfg(feature = "Foundation")]
+ pub fn RemainingChargePercentChanged(handler: &super::super::Foundation::EventHandler<::windows::core::IInspectable>) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> {
+ Self::IPowerManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<super::super::Foundation::EventRegistrationToken>();
+ (::windows::core::Interface::vtable(this).RemainingChargePercentChanged)(::windows::core::Interface::as_raw(this), ::core::mem::transmute_copy(handler), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"Foundation\"`*"]
+ #[cfg(feature = "Foundation")]
+ pub fn RemoveRemainingChargePercentChanged(token: super::super::Foundation::EventRegistrationToken) -> ::windows::core::Result<()> {
+ Self::IPowerManagerStatics(|this| unsafe { (::windows::core::Interface::vtable(this).RemoveRemainingChargePercentChanged)(::windows::core::Interface::as_raw(this), token).ok() })
+ }
+ #[doc = "*Required features: `\"Foundation\"`*"]
+ #[cfg(feature = "Foundation")]
+ pub fn RemainingDischargeTime() -> ::windows::core::Result<super::super::Foundation::TimeSpan> {
+ Self::IPowerManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<super::super::Foundation::TimeSpan>();
+ (::windows::core::Interface::vtable(this).RemainingDischargeTime)(::windows::core::Interface::as_raw(this), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"Foundation\"`*"]
+ #[cfg(feature = "Foundation")]
+ pub fn RemainingDischargeTimeChanged(handler: &super::super::Foundation::EventHandler<::windows::core::IInspectable>) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> {
+ Self::IPowerManagerStatics(|this| unsafe {
+ let mut result__ = ::windows::core::zeroed::<super::super::Foundation::EventRegistrationToken>();
+ (::windows::core::Interface::vtable(this).RemainingDischargeTimeChanged)(::windows::core::Interface::as_raw(this), ::core::mem::transmute_copy(handler), &mut result__).from_abi(result__)
+ })
+ }
+ #[doc = "*Required features: `\"Foundation\"`*"]
+ #[cfg(feature = "Foundation")]
+ pub fn RemoveRemainingDischargeTimeChanged(token: super::super::Foundation::EventRegistrationToken) -> ::windows::core::Result<()> {
+ Self::IPowerManagerStatics(|this| unsafe { (::windows::core::Interface::vtable(this).RemoveRemainingDischargeTimeChanged)(::windows::core::Interface::as_raw(this), token).ok() })
+ }
+ #[doc(hidden)]
+ pub fn IPowerManagerStatics<R, F: FnOnce(&IPowerManagerStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> {
+ static SHARED: ::windows::imp::FactoryCache<PowerManager, IPowerManagerStatics> = ::windows::imp::FactoryCache::new();
+ SHARED.call(callback)
+ }
+}
+impl ::windows::core::RuntimeName for PowerManager {
+ const NAME: &'static str = "Windows.System.Power.PowerManager";
+}
+#[doc = "*Required features: `\"System_Power\"`*"]
+#[repr(transparent)]
+#[derive(::core::cmp::PartialEq, ::core::cmp::Eq)]
+pub struct BatteryStatus(pub i32);
+impl BatteryStatus {
+ pub const NotPresent: Self = Self(0i32);
+ pub const Discharging: Self = Self(1i32);
+ pub const Idle: Self = Self(2i32);
+ pub const Charging: Self = Self(3i32);
+}
+impl ::core::marker::Copy for BatteryStatus {}
+impl ::core::clone::Clone for BatteryStatus {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+impl ::core::default::Default for BatteryStatus {
+ fn default() -> Self {
+ Self(0)
+ }
+}
+impl ::windows::core::TypeKind for BatteryStatus {
+ type TypeKind = ::windows::core::CopyType;
+}
+impl ::core::fmt::Debug for BatteryStatus {
+ fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
+ f.debug_tuple("BatteryStatus").field(&self.0).finish()
+ }
+}
+impl ::windows::core::RuntimeType for BatteryStatus {
+ const SIGNATURE: ::windows::imp::ConstBuffer = ::windows::imp::ConstBuffer::from_slice(b"enum(Windows.System.Power.BatteryStatus;i4)");
+}
+#[doc = "*Required features: `\"System_Power\"`*"]
+#[repr(transparent)]
+#[derive(::core::cmp::PartialEq, ::core::cmp::Eq)]
+pub struct EnergySaverStatus(pub i32);
+impl EnergySaverStatus {
+ pub const Disabled: Self = Self(0i32);
+ pub const Off: Self = Self(1i32);
+ pub const On: Self = Self(2i32);
+}
+impl ::core::marker::Copy for EnergySaverStatus {}
+impl ::core::clone::Clone for EnergySaverStatus {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+impl ::core::default::Default for EnergySaverStatus {
+ fn default() -> Self {
+ Self(0)
+ }
+}
+impl ::windows::core::TypeKind for EnergySaverStatus {
+ type TypeKind = ::windows::core::CopyType;
+}
+impl ::core::fmt::Debug for EnergySaverStatus {
+ fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
+ f.debug_tuple("EnergySaverStatus").field(&self.0).finish()
+ }
+}
+impl ::windows::core::RuntimeType for EnergySaverStatus {
+ const SIGNATURE: ::windows::imp::ConstBuffer = ::windows::imp::ConstBuffer::from_slice(b"enum(Windows.System.Power.EnergySaverStatus;i4)");
+}
+#[doc = "*Required features: `\"System_Power\"`*"]
+#[repr(transparent)]
+#[derive(::core::cmp::PartialEq, ::core::cmp::Eq)]
+pub struct PowerSupplyStatus(pub i32);
+impl PowerSupplyStatus {
+ pub const NotPresent: Self = Self(0i32);
+ pub const Inadequate: Self = Self(1i32);
+ pub const Adequate: Self = Self(2i32);
+}
+impl ::core::marker::Copy for PowerSupplyStatus {}
+impl ::core::clone::Clone for PowerSupplyStatus {
+ fn clone(&self) -> Self {
+ *self
+ }
+}
+impl ::core::default::Default for PowerSupplyStatus {
+ fn default() -> Self {
+ Self(0)
+ }
+}
+impl ::windows::core::TypeKind for PowerSupplyStatus {
+ type TypeKind = ::windows::core::CopyType;
+}
+impl ::core::fmt::Debug for PowerSupplyStatus {
+ fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
+ f.debug_tuple("PowerSupplyStatus").field(&self.0).finish()
+ }
+}
+impl ::windows::core::RuntimeType for PowerSupplyStatus {
+ const SIGNATURE: ::windows::imp::ConstBuffer = ::windows::imp::ConstBuffer::from_slice(b"enum(Windows.System.Power.PowerSupplyStatus;i4)");
+}
+#[cfg(feature = "implement")]
+::core::include!("impl.rs");