// C++/WinRT v2.0.250303.1 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once #ifndef WINRT_Windows_Devices_SerialCommunication_H #define WINRT_Windows_Devices_SerialCommunication_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.Foundation.2.h" #include "winrt/impl/Windows.Storage.Streams.2.h" #include "winrt/impl/Windows.Devices.SerialCommunication.2.h" namespace winrt::impl { template auto consume_Windows_Devices_SerialCommunication_IErrorReceivedEventArgs::Error() const { winrt::Windows::Devices::SerialCommunication::SerialError 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_Error(reinterpret_cast(&value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Error(reinterpret_cast(&value))); } return value; } template auto consume_Windows_Devices_SerialCommunication_IPinChangedEventArgs::PinChange() const { winrt::Windows::Devices::SerialCommunication::SerialPinChange 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_PinChange(reinterpret_cast(&value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_PinChange(reinterpret_cast(&value))); } return value; } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::BaudRate() const { uint32_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_BaudRate(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_BaudRate(&value)); } return value; } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::BaudRate(uint32_t 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_BaudRate(value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->put_BaudRate(value)); } } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::BreakSignalState() 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_BreakSignalState(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_BreakSignalState(&value)); } return value; } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::BreakSignalState(bool 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_BreakSignalState(value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->put_BreakSignalState(value)); } } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::BytesReceived() const { uint32_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_BytesReceived(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_BytesReceived(&value)); } return value; } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::CarrierDetectState() 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_CarrierDetectState(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_CarrierDetectState(&value)); } return value; } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::ClearToSendState() 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_ClearToSendState(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_ClearToSendState(&value)); } return value; } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::DataBits() const { uint16_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_DataBits(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_DataBits(&value)); } return value; } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::DataBits(uint16_t 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_DataBits(value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->put_DataBits(value)); } } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::DataSetReadyState() 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_DataSetReadyState(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_DataSetReadyState(&value)); } return value; } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::Handshake() const { winrt::Windows::Devices::SerialCommunication::SerialHandshake 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_Handshake(reinterpret_cast(&value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Handshake(reinterpret_cast(&value))); } return value; } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::Handshake(winrt::Windows::Devices::SerialCommunication::SerialHandshake 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_Handshake(static_cast(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->put_Handshake(static_cast(value))); } } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::IsDataTerminalReadyEnabled() 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_IsDataTerminalReadyEnabled(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_IsDataTerminalReadyEnabled(&value)); } return value; } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::IsDataTerminalReadyEnabled(bool 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_IsDataTerminalReadyEnabled(value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->put_IsDataTerminalReadyEnabled(value)); } } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::IsRequestToSendEnabled() 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_IsRequestToSendEnabled(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_IsRequestToSendEnabled(&value)); } return value; } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::IsRequestToSendEnabled(bool 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_IsRequestToSendEnabled(value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->put_IsRequestToSendEnabled(value)); } } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::Parity() const { winrt::Windows::Devices::SerialCommunication::SerialParity 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_Parity(reinterpret_cast(&value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Parity(reinterpret_cast(&value))); } return value; } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::Parity(winrt::Windows::Devices::SerialCommunication::SerialParity 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_Parity(static_cast(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->put_Parity(static_cast(value))); } } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::PortName() 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_PortName(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_PortName(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::ReadTimeout() const { winrt::Windows::Foundation::TimeSpan 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_ReadTimeout(put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_ReadTimeout(put_abi(value))); } return value; } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::ReadTimeout(winrt::Windows::Foundation::TimeSpan 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_ReadTimeout(impl::bind_in(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->put_ReadTimeout(impl::bind_in(value))); } } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::StopBits() const { winrt::Windows::Devices::SerialCommunication::SerialStopBitCount 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_StopBits(reinterpret_cast(&value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_StopBits(reinterpret_cast(&value))); } return value; } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::StopBits(winrt::Windows::Devices::SerialCommunication::SerialStopBitCount 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_StopBits(static_cast(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->put_StopBits(static_cast(value))); } } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::UsbVendorId() const { uint16_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_UsbVendorId(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_UsbVendorId(&value)); } return value; } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::UsbProductId() const { uint16_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_UsbProductId(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_UsbProductId(&value)); } return value; } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::WriteTimeout() const { winrt::Windows::Foundation::TimeSpan 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_WriteTimeout(put_abi(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_WriteTimeout(put_abi(value))); } return value; } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::WriteTimeout(winrt::Windows::Foundation::TimeSpan 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_WriteTimeout(impl::bind_in(value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->put_WriteTimeout(impl::bind_in(value))); } } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::InputStream() 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_InputStream(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_InputStream(&value)); } return winrt::Windows::Storage::Streams::IInputStream{ value, take_ownership_from_abi }; } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::OutputStream() 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_OutputStream(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_OutputStream(&value)); } return winrt::Windows::Storage::Streams::IOutputStream{ value, take_ownership_from_abi }; } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::ErrorReceived(winrt::Windows::Foundation::TypedEventHandler const& reportHandler) const { winrt::event_token token{}; 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->add_ErrorReceived(*(void**)(&reportHandler), put_abi(token))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->add_ErrorReceived(*(void**)(&reportHandler), put_abi(token))); } return token; } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::ErrorReceived(auto_revoke_t, winrt::Windows::Foundation::TypedEventHandler const& reportHandler) const { return impl::make_event_revoker(this, ErrorReceived(reportHandler)); } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::ErrorReceived(winrt::event_token const& token) const noexcept { 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; _winrt_abi_type->remove_ErrorReceived(impl::bind_in(token)); } else { auto const _winrt_abi_type = *(abi_t**)this; _winrt_abi_type->remove_ErrorReceived(impl::bind_in(token)); } } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::PinChanged(winrt::Windows::Foundation::TypedEventHandler const& reportHandler) const { winrt::event_token token{}; 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->add_PinChanged(*(void**)(&reportHandler), put_abi(token))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->add_PinChanged(*(void**)(&reportHandler), put_abi(token))); } return token; } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::PinChanged(auto_revoke_t, winrt::Windows::Foundation::TypedEventHandler const& reportHandler) const { return impl::make_event_revoker(this, PinChanged(reportHandler)); } template auto consume_Windows_Devices_SerialCommunication_ISerialDevice::PinChanged(winrt::event_token const& token) const noexcept { 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; _winrt_abi_type->remove_PinChanged(impl::bind_in(token)); } else { auto const _winrt_abi_type = *(abi_t**)this; _winrt_abi_type->remove_PinChanged(impl::bind_in(token)); } } template auto consume_Windows_Devices_SerialCommunication_ISerialDeviceStatics::GetDeviceSelector() 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->GetDeviceSelector(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetDeviceSelector(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Devices_SerialCommunication_ISerialDeviceStatics::GetDeviceSelector(param::hstring const& portName) 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->GetDeviceSelectorFromPortName(*(void**)(&portName), &result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetDeviceSelectorFromPortName(*(void**)(&portName), &result)); } return hstring{ result, take_ownership_from_abi }; } template auto consume_Windows_Devices_SerialCommunication_ISerialDeviceStatics::GetDeviceSelectorFromUsbVidPid(uint16_t vendorId, uint16_t productId) 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->GetDeviceSelectorFromUsbVidPid(vendorId, productId, &result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetDeviceSelectorFromUsbVidPid(vendorId, productId, &result)); } return hstring{ result, take_ownership_from_abi }; } template auto consume_Windows_Devices_SerialCommunication_ISerialDeviceStatics::FromIdAsync(param::hstring const& deviceId) 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->FromIdAsync(*(void**)(&deviceId), &result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->FromIdAsync(*(void**)(&deviceId), &result)); } return winrt::Windows::Foundation::IAsyncOperation{ result, take_ownership_from_abi }; } #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_Error(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Error()); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_PinChange(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().PinChange()); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_BaudRate(uint32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().BaudRate()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_BaudRate(uint32_t value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().BaudRate(value); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_BreakSignalState(bool* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().BreakSignalState()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_BreakSignalState(bool value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().BreakSignalState(value); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_BytesReceived(uint32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().BytesReceived()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_CarrierDetectState(bool* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().CarrierDetectState()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_ClearToSendState(bool* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().ClearToSendState()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_DataBits(uint16_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().DataBits()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_DataBits(uint16_t value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().DataBits(value); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_DataSetReadyState(bool* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().DataSetReadyState()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Handshake(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Handshake()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_Handshake(int32_t value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Handshake(*reinterpret_cast(&value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_IsDataTerminalReadyEnabled(bool* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().IsDataTerminalReadyEnabled()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_IsDataTerminalReadyEnabled(bool value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().IsDataTerminalReadyEnabled(value); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_IsRequestToSendEnabled(bool* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().IsRequestToSendEnabled()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_IsRequestToSendEnabled(bool value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().IsRequestToSendEnabled(value); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Parity(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Parity()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_Parity(int32_t value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Parity(*reinterpret_cast(&value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_PortName(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().PortName()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_ReadTimeout(int64_t* value) noexcept final try { zero_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().ReadTimeout()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_ReadTimeout(int64_t value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().ReadTimeout(*reinterpret_cast(&value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_StopBits(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().StopBits()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_StopBits(int32_t value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().StopBits(*reinterpret_cast(&value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_UsbVendorId(uint16_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().UsbVendorId()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_UsbProductId(uint16_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().UsbProductId()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_WriteTimeout(int64_t* value) noexcept final try { zero_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().WriteTimeout()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_WriteTimeout(int64_t value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().WriteTimeout(*reinterpret_cast(&value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_InputStream(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().InputStream()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_OutputStream(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().OutputStream()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall add_ErrorReceived(void* reportHandler, winrt::event_token* token) noexcept final try { zero_abi(token); typename D::abi_guard guard(this->shim()); *token = detach_from(this->shim().ErrorReceived(*reinterpret_cast const*>(&reportHandler))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall remove_ErrorReceived(winrt::event_token token) noexcept final { typename D::abi_guard guard(this->shim()); this->shim().ErrorReceived(*reinterpret_cast(&token)); return 0; } int32_t __stdcall add_PinChanged(void* reportHandler, winrt::event_token* token) noexcept final try { zero_abi(token); typename D::abi_guard guard(this->shim()); *token = detach_from(this->shim().PinChanged(*reinterpret_cast const*>(&reportHandler))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall remove_PinChanged(winrt::event_token token) noexcept final { typename D::abi_guard guard(this->shim()); this->shim().PinChanged(*reinterpret_cast(&token)); return 0; } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall GetDeviceSelector(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GetDeviceSelector()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetDeviceSelectorFromPortName(void* portName, void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().GetDeviceSelector(*reinterpret_cast(&portName))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetDeviceSelectorFromUsbVidPid(uint16_t vendorId, uint16_t productId, void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().GetDeviceSelectorFromUsbVidPid(vendorId, productId)); 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(); } }; #endif } WINRT_EXPORT namespace winrt::Windows::Devices::SerialCommunication { inline auto SerialDevice::GetDeviceSelector() { return impl::call_factory_cast([](ISerialDeviceStatics const& f) { return f.GetDeviceSelector(); }); } inline auto SerialDevice::GetDeviceSelector(param::hstring const& portName) { return impl::call_factory([&](ISerialDeviceStatics const& f) { return f.GetDeviceSelector(portName); }); } inline auto SerialDevice::GetDeviceSelectorFromUsbVidPid(uint16_t vendorId, uint16_t productId) { return impl::call_factory([&](ISerialDeviceStatics const& f) { return f.GetDeviceSelectorFromUsbVidPid(vendorId, productId); }); } inline auto SerialDevice::FromIdAsync(param::hstring const& deviceId) { return impl::call_factory([&](ISerialDeviceStatics 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