// WARNING: Please don't edit this file. It was generated by C++/WinRT v2.0.240405.15 #pragma once #ifndef WINRT_Windows_Devices_Spi_H #define WINRT_Windows_Devices_Spi_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.Devices.Spi.Provider.2.h" #include "winrt/impl/Windows.Foundation.2.h" #include "winrt/impl/Windows.Foundation.Collections.2.h" #include "winrt/impl/Windows.Devices.Spi.2.h" namespace winrt::impl { template auto consume_Windows_Devices_Spi_ISpiBusInfo::ChipSelectLineCount() const { int32_t value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiBusInfo)->get_ChipSelectLineCount(&value)); return value; } template auto consume_Windows_Devices_Spi_ISpiBusInfo::MinClockFrequency() const { int32_t value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiBusInfo)->get_MinClockFrequency(&value)); return value; } template auto consume_Windows_Devices_Spi_ISpiBusInfo::MaxClockFrequency() const { int32_t value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiBusInfo)->get_MaxClockFrequency(&value)); return value; } template auto consume_Windows_Devices_Spi_ISpiBusInfo::SupportedDataBitLengths() const { void* value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiBusInfo)->get_SupportedDataBitLengths(&value)); return winrt::Windows::Foundation::Collections::IVectorView{ value, take_ownership_from_abi }; } template auto consume_Windows_Devices_Spi_ISpiConnectionSettings::ChipSelectLine() const { int32_t value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiConnectionSettings)->get_ChipSelectLine(&value)); return value; } template auto consume_Windows_Devices_Spi_ISpiConnectionSettings::ChipSelectLine(int32_t value) const { check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiConnectionSettings)->put_ChipSelectLine(value)); } template auto consume_Windows_Devices_Spi_ISpiConnectionSettings::Mode() const { winrt::Windows::Devices::Spi::SpiMode value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiConnectionSettings)->get_Mode(reinterpret_cast(&value))); return value; } template auto consume_Windows_Devices_Spi_ISpiConnectionSettings::Mode(winrt::Windows::Devices::Spi::SpiMode const& value) const { check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiConnectionSettings)->put_Mode(static_cast(value))); } template auto consume_Windows_Devices_Spi_ISpiConnectionSettings::DataBitLength() const { int32_t value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiConnectionSettings)->get_DataBitLength(&value)); return value; } template auto consume_Windows_Devices_Spi_ISpiConnectionSettings::DataBitLength(int32_t value) const { check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiConnectionSettings)->put_DataBitLength(value)); } template auto consume_Windows_Devices_Spi_ISpiConnectionSettings::ClockFrequency() const { int32_t value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiConnectionSettings)->get_ClockFrequency(&value)); return value; } template auto consume_Windows_Devices_Spi_ISpiConnectionSettings::ClockFrequency(int32_t value) const { check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiConnectionSettings)->put_ClockFrequency(value)); } template auto consume_Windows_Devices_Spi_ISpiConnectionSettings::SharingMode() const { winrt::Windows::Devices::Spi::SpiSharingMode value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiConnectionSettings)->get_SharingMode(reinterpret_cast(&value))); return value; } template auto consume_Windows_Devices_Spi_ISpiConnectionSettings::SharingMode(winrt::Windows::Devices::Spi::SpiSharingMode const& value) const { check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiConnectionSettings)->put_SharingMode(static_cast(value))); } template auto consume_Windows_Devices_Spi_ISpiConnectionSettingsFactory::Create(int32_t chipSelectLine) const { void* value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiConnectionSettingsFactory)->Create(chipSelectLine, &value)); return winrt::Windows::Devices::Spi::SpiConnectionSettings{ value, take_ownership_from_abi }; } template auto consume_Windows_Devices_Spi_ISpiController::GetDevice(winrt::Windows::Devices::Spi::SpiConnectionSettings const& settings) const { void* device{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiController)->GetDevice(*(void**)(&settings), &device)); return winrt::Windows::Devices::Spi::SpiDevice{ device, take_ownership_from_abi }; } template auto consume_Windows_Devices_Spi_ISpiControllerStatics::GetDefaultAsync() const { void* operation{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiControllerStatics)->GetDefaultAsync(&operation)); return winrt::Windows::Foundation::IAsyncOperation{ operation, take_ownership_from_abi }; } template auto consume_Windows_Devices_Spi_ISpiControllerStatics::GetControllersAsync(winrt::Windows::Devices::Spi::Provider::ISpiProvider const& provider) const { void* operation{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiControllerStatics)->GetControllersAsync(*(void**)(&provider), &operation)); return winrt::Windows::Foundation::IAsyncOperation>{ operation, take_ownership_from_abi }; } template auto consume_Windows_Devices_Spi_ISpiDevice::DeviceId() const { void* value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiDevice)->get_DeviceId(&value)); return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Devices_Spi_ISpiDevice::ConnectionSettings() const { void* value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiDevice)->get_ConnectionSettings(&value)); return winrt::Windows::Devices::Spi::SpiConnectionSettings{ value, take_ownership_from_abi }; } template auto consume_Windows_Devices_Spi_ISpiDevice::Write(array_view buffer) const { check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiDevice)->Write(buffer.size(), get_abi(buffer))); } template auto consume_Windows_Devices_Spi_ISpiDevice::Read(array_view buffer) const { check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiDevice)->Read(buffer.size(), put_abi(buffer))); } template auto consume_Windows_Devices_Spi_ISpiDevice::TransferSequential(array_view writeBuffer, array_view readBuffer) const { check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiDevice)->TransferSequential(writeBuffer.size(), get_abi(writeBuffer), readBuffer.size(), put_abi(readBuffer))); } template auto consume_Windows_Devices_Spi_ISpiDevice::TransferFullDuplex(array_view writeBuffer, array_view readBuffer) const { check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiDevice)->TransferFullDuplex(writeBuffer.size(), get_abi(writeBuffer), readBuffer.size(), put_abi(readBuffer))); } template auto consume_Windows_Devices_Spi_ISpiDeviceStatics::GetDeviceSelector() const { void* value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiDeviceStatics)->GetDeviceSelector(&value)); return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Devices_Spi_ISpiDeviceStatics::GetDeviceSelector(param::hstring const& friendlyName) const { void* value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiDeviceStatics)->GetDeviceSelectorFromFriendlyName(*(void**)(&friendlyName), &value)); return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Devices_Spi_ISpiDeviceStatics::GetBusInfo(param::hstring const& busId) const { void* busInfo{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiDeviceStatics)->GetBusInfo(*(void**)(&busId), &busInfo)); return winrt::Windows::Devices::Spi::SpiBusInfo{ busInfo, take_ownership_from_abi }; } template auto consume_Windows_Devices_Spi_ISpiDeviceStatics::FromIdAsync(param::hstring const& busId, winrt::Windows::Devices::Spi::SpiConnectionSettings const& settings) const { void* operation{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Devices::Spi::ISpiDeviceStatics)->FromIdAsync(*(void**)(&busId), *(void**)(&settings), &operation)); return winrt::Windows::Foundation::IAsyncOperation{ operation, take_ownership_from_abi }; } #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_ChipSelectLineCount(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().ChipSelectLineCount()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_MinClockFrequency(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().MinClockFrequency()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_MaxClockFrequency(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().MaxClockFrequency()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_SupportedDataBitLengths(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from>(this->shim().SupportedDataBitLengths()); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_ChipSelectLine(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().ChipSelectLine()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_ChipSelectLine(int32_t value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().ChipSelectLine(value); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Mode(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Mode()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_Mode(int32_t value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Mode(*reinterpret_cast(&value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_DataBitLength(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().DataBitLength()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_DataBitLength(int32_t value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().DataBitLength(value); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_ClockFrequency(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().ClockFrequency()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_ClockFrequency(int32_t value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().ClockFrequency(value); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_SharingMode(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().SharingMode()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_SharingMode(int32_t value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().SharingMode(*reinterpret_cast(&value)); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall Create(int32_t chipSelectLine, void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Create(chipSelectLine)); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall GetDevice(void* settings, void** device) noexcept final try { clear_abi(device); typename D::abi_guard guard(this->shim()); *device = detach_from(this->shim().GetDevice(*reinterpret_cast(&settings))); 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(); } 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 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 get_ConnectionSettings(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().ConnectionSettings()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall Write(uint32_t __bufferSize, uint8_t* buffer) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Write(array_view(reinterpret_cast(buffer), reinterpret_cast(buffer) + __bufferSize)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall Read(uint32_t __bufferSize, uint8_t* buffer) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Read(array_view(reinterpret_cast(buffer), reinterpret_cast(buffer) + __bufferSize)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall TransferSequential(uint32_t __writeBufferSize, uint8_t* writeBuffer, uint32_t __readBufferSize, uint8_t* readBuffer) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().TransferSequential(array_view(reinterpret_cast(writeBuffer), reinterpret_cast(writeBuffer) + __writeBufferSize), array_view(reinterpret_cast(readBuffer), reinterpret_cast(readBuffer) + __readBufferSize)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall TransferFullDuplex(uint32_t __writeBufferSize, uint8_t* writeBuffer, uint32_t __readBufferSize, uint8_t* readBuffer) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().TransferFullDuplex(array_view(reinterpret_cast(writeBuffer), reinterpret_cast(writeBuffer) + __writeBufferSize), array_view(reinterpret_cast(readBuffer), reinterpret_cast(readBuffer) + __readBufferSize)); return 0; } catch (...) { return to_hresult(); } }; #endif 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 GetDeviceSelectorFromFriendlyName(void* friendlyName, void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GetDeviceSelector(*reinterpret_cast(&friendlyName))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetBusInfo(void* busId, void** busInfo) noexcept final try { clear_abi(busInfo); typename D::abi_guard guard(this->shim()); *busInfo = detach_from(this->shim().GetBusInfo(*reinterpret_cast(&busId))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall FromIdAsync(void* busId, void* settings, void** operation) noexcept final try { clear_abi(operation); typename D::abi_guard guard(this->shim()); *operation = detach_from>(this->shim().FromIdAsync(*reinterpret_cast(&busId), *reinterpret_cast(&settings))); return 0; } catch (...) { return to_hresult(); } }; } WINRT_EXPORT namespace winrt::Windows::Devices::Spi { inline SpiConnectionSettings::SpiConnectionSettings(int32_t chipSelectLine) : SpiConnectionSettings(impl::call_factory([&](ISpiConnectionSettingsFactory const& f) { return f.Create(chipSelectLine); })) { } inline auto SpiController::GetDefaultAsync() { return impl::call_factory_cast(*)(ISpiControllerStatics const&), SpiController, ISpiControllerStatics>([](ISpiControllerStatics const& f) { return f.GetDefaultAsync(); }); } inline auto SpiController::GetControllersAsync(winrt::Windows::Devices::Spi::Provider::ISpiProvider const& provider) { return impl::call_factory([&](ISpiControllerStatics const& f) { return f.GetControllersAsync(provider); }); } inline auto SpiDevice::GetDeviceSelector() { return impl::call_factory_cast([](ISpiDeviceStatics const& f) { return f.GetDeviceSelector(); }); } inline auto SpiDevice::GetDeviceSelector(param::hstring const& friendlyName) { return impl::call_factory([&](ISpiDeviceStatics const& f) { return f.GetDeviceSelector(friendlyName); }); } inline auto SpiDevice::GetBusInfo(param::hstring const& busId) { return impl::call_factory([&](ISpiDeviceStatics const& f) { return f.GetBusInfo(busId); }); } inline auto SpiDevice::FromIdAsync(param::hstring const& busId, winrt::Windows::Devices::Spi::SpiConnectionSettings const& settings) { return impl::call_factory([&](ISpiDeviceStatics const& f) { return f.FromIdAsync(busId, settings); }); } } 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 {}; template<> struct hash : winrt::impl::hash_base {}; #endif #ifdef __cpp_lib_format #endif } #endif