// C++/WinRT v2.0.250303.1 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once #ifndef WINRT_Windows_Devices_Pwm_H #define WINRT_Windows_Devices_Pwm_H #include "winrt/base.h" static_assert(winrt::check_version(CPPWINRT_VERSION, "2.0.250303.1"), "Mismatched C++/WinRT headers."); #define CPPWINRT_VERSION "2.0.250303.1" #include "winrt/Windows.Devices.h" #include "winrt/impl/Windows.Devices.Pwm.Provider.2.h" #include "winrt/impl/Windows.Foundation.2.h" #include "winrt/impl/Windows.Foundation.Collections.2.h" #include "winrt/impl/Windows.Devices.Pwm.2.h" namespace winrt::impl { template auto consume_Windows_Devices_Pwm_IPwmController::PinCount() const { int32_t value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_PinCount(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_PinCount(&value)); } return value; } template auto consume_Windows_Devices_Pwm_IPwmController::ActualFrequency() const { double value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_ActualFrequency(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_ActualFrequency(&value)); } return value; } template auto consume_Windows_Devices_Pwm_IPwmController::SetDesiredFrequency(double desiredFrequency) const { double result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->SetDesiredFrequency(desiredFrequency, &result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->SetDesiredFrequency(desiredFrequency, &result)); } return result; } template auto consume_Windows_Devices_Pwm_IPwmController::MinFrequency() const { double value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_MinFrequency(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_MinFrequency(&value)); } return value; } template auto consume_Windows_Devices_Pwm_IPwmController::MaxFrequency() const { double value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_MaxFrequency(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_MaxFrequency(&value)); } return value; } template auto consume_Windows_Devices_Pwm_IPwmController::OpenPin(int32_t pinNumber) const { void* pin{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->OpenPin(pinNumber, &pin)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->OpenPin(pinNumber, &pin)); } return winrt::Windows::Devices::Pwm::PwmPin{ pin, take_ownership_from_abi }; } template auto consume_Windows_Devices_Pwm_IPwmControllerStatics::GetControllersAsync(winrt::Windows::Devices::Pwm::Provider::IPwmProvider const& provider) const { void* operation{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetControllersAsync(*(void**)(&provider), &operation)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetControllersAsync(*(void**)(&provider), &operation)); } return winrt::Windows::Foundation::IAsyncOperation>{ operation, take_ownership_from_abi }; } template auto consume_Windows_Devices_Pwm_IPwmControllerStatics2::GetDefaultAsync() const { void* operation{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetDefaultAsync(&operation)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetDefaultAsync(&operation)); } return winrt::Windows::Foundation::IAsyncOperation{ operation, take_ownership_from_abi }; } template auto consume_Windows_Devices_Pwm_IPwmControllerStatics3::GetDeviceSelector() const { void* result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetDeviceSelector(&result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetDeviceSelector(&result)); } return hstring{ result, take_ownership_from_abi }; } template auto consume_Windows_Devices_Pwm_IPwmControllerStatics3::GetDeviceSelector(param::hstring const& friendlyName) const { void* result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetDeviceSelectorFromFriendlyName(*(void**)(&friendlyName), &result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetDeviceSelectorFromFriendlyName(*(void**)(&friendlyName), &result)); } return hstring{ result, take_ownership_from_abi }; } template auto consume_Windows_Devices_Pwm_IPwmControllerStatics3::FromIdAsync(param::hstring const& deviceId) const { void* operation{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->FromIdAsync(*(void**)(&deviceId), &operation)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->FromIdAsync(*(void**)(&deviceId), &operation)); } return winrt::Windows::Foundation::IAsyncOperation{ operation, take_ownership_from_abi }; } template auto consume_Windows_Devices_Pwm_IPwmPin::Controller() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Controller(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Controller(&value)); } return winrt::Windows::Devices::Pwm::PwmController{ value, take_ownership_from_abi }; } template auto consume_Windows_Devices_Pwm_IPwmPin::GetActiveDutyCyclePercentage() const { double result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetActiveDutyCyclePercentage(&result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetActiveDutyCyclePercentage(&result)); } return result; } template auto consume_Windows_Devices_Pwm_IPwmPin::SetActiveDutyCyclePercentage(double dutyCyclePercentage) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->SetActiveDutyCyclePercentage(dutyCyclePercentage)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->SetActiveDutyCyclePercentage(dutyCyclePercentage)); } } template auto consume_Windows_Devices_Pwm_IPwmPin::Polarity() const { winrt::Windows::Devices::Pwm::PwmPulsePolarity value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Polarity(reinterpret_cast(&value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Polarity(reinterpret_cast(&value))); } return value; } template auto consume_Windows_Devices_Pwm_IPwmPin::Polarity(winrt::Windows::Devices::Pwm::PwmPulsePolarity const& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->put_Polarity(static_cast(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->put_Polarity(static_cast(value))); } } template auto consume_Windows_Devices_Pwm_IPwmPin::Start() const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->Start()); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->Start()); } } template auto consume_Windows_Devices_Pwm_IPwmPin::Stop() const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->Stop()); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->Stop()); } } template auto consume_Windows_Devices_Pwm_IPwmPin::IsStarted() const { bool value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_IsStarted(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_IsStarted(&value)); } return value; } #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_PinCount(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().PinCount()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_ActualFrequency(double* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().ActualFrequency()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall SetDesiredFrequency(double desiredFrequency, double* result) noexcept final try { typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().SetDesiredFrequency(desiredFrequency)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_MinFrequency(double* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().MinFrequency()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_MaxFrequency(double* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().MaxFrequency()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall OpenPin(int32_t pinNumber, void** pin) noexcept final try { clear_abi(pin); typename D::abi_guard guard(this->shim()); *pin = detach_from(this->shim().OpenPin(pinNumber)); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall GetControllersAsync(void* provider, void** operation) noexcept final try { clear_abi(operation); typename D::abi_guard guard(this->shim()); *operation = detach_from>>(this->shim().GetControllersAsync(*reinterpret_cast(&provider))); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall GetDefaultAsync(void** operation) noexcept final try { clear_abi(operation); typename D::abi_guard guard(this->shim()); *operation = detach_from>(this->shim().GetDefaultAsync()); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { 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(); } int32_t __stdcall GetDeviceSelectorFromFriendlyName(void* friendlyName, void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().GetDeviceSelector(*reinterpret_cast(&friendlyName))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall FromIdAsync(void* deviceId, void** operation) noexcept final try { clear_abi(operation); typename D::abi_guard guard(this->shim()); *operation = detach_from>(this->shim().FromIdAsync(*reinterpret_cast(&deviceId))); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_Controller(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Controller()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetActiveDutyCyclePercentage(double* result) noexcept final try { typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().GetActiveDutyCyclePercentage()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall SetActiveDutyCyclePercentage(double dutyCyclePercentage) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().SetActiveDutyCyclePercentage(dutyCyclePercentage); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Polarity(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Polarity()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_Polarity(int32_t value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Polarity(*reinterpret_cast(&value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall Start() noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Start(); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall Stop() noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Stop(); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_IsStarted(bool* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().IsStarted()); return 0; } catch (...) { return to_hresult(); } }; #endif } WINRT_EXPORT namespace winrt::Windows::Devices::Pwm { inline auto PwmController::GetControllersAsync(winrt::Windows::Devices::Pwm::Provider::IPwmProvider const& provider) { return impl::call_factory([&](IPwmControllerStatics const& f) { return f.GetControllersAsync(provider); }); } inline auto PwmController::GetDefaultAsync() { return impl::call_factory_cast(*)(IPwmControllerStatics2 const&), PwmController, IPwmControllerStatics2>([](IPwmControllerStatics2 const& f) { return f.GetDefaultAsync(); }); } inline auto PwmController::GetDeviceSelector() { return impl::call_factory_cast([](IPwmControllerStatics3 const& f) { return f.GetDeviceSelector(); }); } inline auto PwmController::GetDeviceSelector(param::hstring const& friendlyName) { return impl::call_factory([&](IPwmControllerStatics3 const& f) { return f.GetDeviceSelector(friendlyName); }); } inline auto PwmController::FromIdAsync(param::hstring const& deviceId) { return impl::call_factory([&](IPwmControllerStatics3 const& f) { return f.FromIdAsync(deviceId); }); } } 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 {}; #endif #ifdef __cpp_lib_format #endif } #endif