// WARNING: Please don't edit this file. It was generated by C++/WinRT v2.0.240405.15 #pragma once #ifndef WINRT_Windows_Devices_Power_H #define WINRT_Windows_Devices_Power_H #include "winrt/base.h" static_assert(winrt::check_version(CPPWINRT_VERSION, "2.0.240405.15"), "Mismatched C++/WinRT headers."); #define CPPWINRT_VERSION "2.0.240405.15" #include "winrt/Windows.Devices.h" #include "winrt/impl/Windows.Foundation.2.h" #include "winrt/impl/Windows.Foundation.Collections.2.h" #include "winrt/impl/Windows.System.Power.2.h" #include "winrt/impl/Windows.Devices.Power.2.h" namespace winrt::impl { template auto consume_Windows_Devices_Power_IBattery::DeviceId() const { void* value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Power::IBattery)->get_DeviceId(&value)); return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Devices_Power_IBattery::GetReport() const { void* result{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Power::IBattery)->GetReport(&result)); return winrt::Windows::Devices::Power::BatteryReport{ result, take_ownership_from_abi }; } template auto consume_Windows_Devices_Power_IBattery::ReportUpdated(winrt::Windows::Foundation::TypedEventHandler const& handler) const { winrt::event_token token{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Power::IBattery)->add_ReportUpdated(*(void**)(&handler), put_abi(token))); return token; } template auto consume_Windows_Devices_Power_IBattery::ReportUpdated(auto_revoke_t, winrt::Windows::Foundation::TypedEventHandler const& handler) const { return impl::make_event_revoker(this, ReportUpdated(handler)); } template auto consume_Windows_Devices_Power_IBattery::ReportUpdated(winrt::event_token const& token) const noexcept { WINRT_IMPL_SHIM(winrt::Windows::Devices::Power::IBattery)->remove_ReportUpdated(impl::bind_in(token)); } template auto consume_Windows_Devices_Power_IBatteryReport::ChargeRateInMilliwatts() const { void* value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Power::IBatteryReport)->get_ChargeRateInMilliwatts(&value)); return winrt::Windows::Foundation::IReference{ value, take_ownership_from_abi }; } template auto consume_Windows_Devices_Power_IBatteryReport::DesignCapacityInMilliwattHours() const { void* value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Power::IBatteryReport)->get_DesignCapacityInMilliwattHours(&value)); return winrt::Windows::Foundation::IReference{ value, take_ownership_from_abi }; } template auto consume_Windows_Devices_Power_IBatteryReport::FullChargeCapacityInMilliwattHours() const { void* value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Power::IBatteryReport)->get_FullChargeCapacityInMilliwattHours(&value)); return winrt::Windows::Foundation::IReference{ value, take_ownership_from_abi }; } template auto consume_Windows_Devices_Power_IBatteryReport::RemainingCapacityInMilliwattHours() const { void* value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Power::IBatteryReport)->get_RemainingCapacityInMilliwattHours(&value)); return winrt::Windows::Foundation::IReference{ value, take_ownership_from_abi }; } template auto consume_Windows_Devices_Power_IBatteryReport::Status() const { winrt::Windows::System::Power::BatteryStatus value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Power::IBatteryReport)->get_Status(reinterpret_cast(&value))); return value; } template auto consume_Windows_Devices_Power_IBatteryStatics::AggregateBattery() const { void* result{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Power::IBatteryStatics)->get_AggregateBattery(&result)); return winrt::Windows::Devices::Power::Battery{ result, take_ownership_from_abi }; } template auto consume_Windows_Devices_Power_IBatteryStatics::FromIdAsync(param::hstring const& deviceId) const { void* result{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Power::IBatteryStatics)->FromIdAsync(*(void**)(&deviceId), &result)); return winrt::Windows::Foundation::IAsyncOperation{ result, take_ownership_from_abi }; } template auto consume_Windows_Devices_Power_IBatteryStatics::GetDeviceSelector() const { void* result{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Power::IBatteryStatics)->GetDeviceSelector(&result)); return hstring{ result, take_ownership_from_abi }; } template auto consume_Windows_Devices_Power_IPowerGridData::Severity() const { double value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Power::IPowerGridData)->get_Severity(&value)); return value; } template auto consume_Windows_Devices_Power_IPowerGridData::IsLowUserExperienceImpact() const { bool value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Power::IPowerGridData)->get_IsLowUserExperienceImpact(&value)); return value; } template auto consume_Windows_Devices_Power_IPowerGridForecast::StartTime() const { winrt::Windows::Foundation::DateTime value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Power::IPowerGridForecast)->get_StartTime(put_abi(value))); return value; } template auto consume_Windows_Devices_Power_IPowerGridForecast::BlockDuration() const { winrt::Windows::Foundation::TimeSpan value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Power::IPowerGridForecast)->get_BlockDuration(put_abi(value))); return value; } template auto consume_Windows_Devices_Power_IPowerGridForecast::Forecast() const { void* value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Power::IPowerGridForecast)->get_Forecast(&value)); return winrt::Windows::Foundation::Collections::IVectorView{ value, take_ownership_from_abi }; } template auto consume_Windows_Devices_Power_IPowerGridForecastStatics::GetForecast() const { void* result{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Power::IPowerGridForecastStatics)->GetForecast(&result)); return winrt::Windows::Devices::Power::PowerGridForecast{ result, take_ownership_from_abi }; } template auto consume_Windows_Devices_Power_IPowerGridForecastStatics::ForecastUpdated(winrt::Windows::Foundation::EventHandler const& handler) const { winrt::event_token token{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Power::IPowerGridForecastStatics)->add_ForecastUpdated(*(void**)(&handler), put_abi(token))); return token; } template auto consume_Windows_Devices_Power_IPowerGridForecastStatics::ForecastUpdated(auto_revoke_t, winrt::Windows::Foundation::EventHandler const& handler) const { return impl::make_event_revoker(this, ForecastUpdated(handler)); } template auto consume_Windows_Devices_Power_IPowerGridForecastStatics::ForecastUpdated(winrt::event_token const& token) const noexcept { WINRT_IMPL_SHIM(winrt::Windows::Devices::Power::IPowerGridForecastStatics)->remove_ForecastUpdated(impl::bind_in(token)); } #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_DeviceId(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().DeviceId()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetReport(void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().GetReport()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall add_ReportUpdated(void* handler, winrt::event_token* token) noexcept final try { zero_abi(token); typename D::abi_guard guard(this->shim()); *token = detach_from(this->shim().ReportUpdated(*reinterpret_cast const*>(&handler))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall remove_ReportUpdated(winrt::event_token token) noexcept final { typename D::abi_guard guard(this->shim()); this->shim().ReportUpdated(*reinterpret_cast(&token)); return 0; } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_ChargeRateInMilliwatts(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from>(this->shim().ChargeRateInMilliwatts()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_DesignCapacityInMilliwattHours(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from>(this->shim().DesignCapacityInMilliwattHours()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_FullChargeCapacityInMilliwattHours(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from>(this->shim().FullChargeCapacityInMilliwattHours()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_RemainingCapacityInMilliwattHours(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from>(this->shim().RemainingCapacityInMilliwattHours()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Status(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Status()); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_AggregateBattery(void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().AggregateBattery()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall FromIdAsync(void* deviceId, void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from>(this->shim().FromIdAsync(*reinterpret_cast(&deviceId))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetDeviceSelector(void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().GetDeviceSelector()); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_Severity(double* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Severity()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_IsLowUserExperienceImpact(bool* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().IsLowUserExperienceImpact()); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_StartTime(int64_t* value) noexcept final try { zero_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().StartTime()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_BlockDuration(int64_t* value) noexcept final try { zero_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().BlockDuration()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Forecast(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from>(this->shim().Forecast()); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall GetForecast(void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().GetForecast()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall add_ForecastUpdated(void* handler, winrt::event_token* token) noexcept final try { zero_abi(token); typename D::abi_guard guard(this->shim()); *token = detach_from(this->shim().ForecastUpdated(*reinterpret_cast const*>(&handler))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall remove_ForecastUpdated(winrt::event_token token) noexcept final { typename D::abi_guard guard(this->shim()); this->shim().ForecastUpdated(*reinterpret_cast(&token)); return 0; } }; #endif } WINRT_EXPORT namespace winrt::Windows::Devices::Power { inline auto Battery::AggregateBattery() { return impl::call_factory_cast([](IBatteryStatics const& f) { return f.AggregateBattery(); }); } inline auto Battery::FromIdAsync(param::hstring const& deviceId) { return impl::call_factory([&](IBatteryStatics const& f) { return f.FromIdAsync(deviceId); }); } inline auto Battery::GetDeviceSelector() { return impl::call_factory_cast([](IBatteryStatics const& f) { return f.GetDeviceSelector(); }); } inline auto PowerGridForecast::GetForecast() { return impl::call_factory_cast([](IPowerGridForecastStatics const& f) { return f.GetForecast(); }); } inline auto PowerGridForecast::ForecastUpdated(winrt::Windows::Foundation::EventHandler const& handler) { return impl::call_factory([&](IPowerGridForecastStatics const& f) { return f.ForecastUpdated(handler); }); } inline auto PowerGridForecast::ForecastUpdated(auto_revoke_t, winrt::Windows::Foundation::EventHandler const& handler) { auto f = get_activation_factory(); return PowerGridForecast::ForecastUpdated_revoker{ f, f.ForecastUpdated(handler) }; } inline auto PowerGridForecast::ForecastUpdated(winrt::event_token const& token) { impl::call_factory([&](IPowerGridForecastStatics const& f) { return f.ForecastUpdated(token); }); } } namespace std { #ifndef WINRT_LEAN_AND_MEAN template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; #endif #ifdef __cpp_lib_format #endif } #endif