// C++/WinRT v3.0.260818.1

// SPDX-License-Identifier: MIT OR Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) Microsoft Corporation
//
// Generated using .winmd files from https://github.com/microsoft/windows-rs
//

#pragma once
#ifndef WINRT_Windows_Devices_Spi_Provider_H
#define WINRT_Windows_Devices_Spi_Provider_H
#ifndef WINRT_IMPORT_MODULE

#ifndef WINRT_IMPL_BUILD_MODULE
#include "winrt/base.h"
static_assert(winrt::check_version(CPPWINRT_VERSION, "3.0.260818.1"), "Mismatched C++/WinRT headers.");
#define CPPWINRT_VERSION "3.0.260818.1"
#include "winrt/Windows.Devices.Spi.h"
#include "winrt/impl/Windows.Foundation.2.h"
#include "winrt/impl/Windows.Foundation.Collections.2.h"
#include "winrt/impl/Windows.Devices.Spi.Provider.2.h"
#endif // WINRT_IMPL_BUILD_MODULE
WINRT_EXPORT namespace winrt::impl
{
    template <typename D> auto consume_Windows_Devices_Spi_Provider_IProviderSpiConnectionSettings<D>::ChipSelectLine() const
    {
        std::int32_t value{};
        consume_general<winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettings, D>(static_cast<D const*>(this), &abi_t<winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettings>::get_ChipSelectLine, &value);
        return value;
    }
    template <typename D> auto consume_Windows_Devices_Spi_Provider_IProviderSpiConnectionSettings<D>::ChipSelectLine(std::int32_t value) const
    {
        consume_general<winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettings, D>(static_cast<D const*>(this), &abi_t<winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettings>::put_ChipSelectLine, value);
    }
    template <typename D> auto consume_Windows_Devices_Spi_Provider_IProviderSpiConnectionSettings<D>::Mode() const
    {
        winrt::Windows::Devices::Spi::Provider::ProviderSpiMode value{};
        consume_general<winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettings, D>(static_cast<D const*>(this), &abi_t<winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettings>::get_Mode, reinterpret_cast<std::int32_t*>(&value));
        return value;
    }
    template <typename D> auto consume_Windows_Devices_Spi_Provider_IProviderSpiConnectionSettings<D>::Mode(winrt::Windows::Devices::Spi::Provider::ProviderSpiMode const& value) const
    {
        consume_general<winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettings, D>(static_cast<D const*>(this), &abi_t<winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettings>::put_Mode, static_cast<std::int32_t>(value));
    }
    template <typename D> auto consume_Windows_Devices_Spi_Provider_IProviderSpiConnectionSettings<D>::DataBitLength() const
    {
        std::int32_t value{};
        consume_general<winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettings, D>(static_cast<D const*>(this), &abi_t<winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettings>::get_DataBitLength, &value);
        return value;
    }
    template <typename D> auto consume_Windows_Devices_Spi_Provider_IProviderSpiConnectionSettings<D>::DataBitLength(std::int32_t value) const
    {
        consume_general<winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettings, D>(static_cast<D const*>(this), &abi_t<winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettings>::put_DataBitLength, value);
    }
    template <typename D> auto consume_Windows_Devices_Spi_Provider_IProviderSpiConnectionSettings<D>::ClockFrequency() const
    {
        std::int32_t value{};
        consume_general<winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettings, D>(static_cast<D const*>(this), &abi_t<winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettings>::get_ClockFrequency, &value);
        return value;
    }
    template <typename D> auto consume_Windows_Devices_Spi_Provider_IProviderSpiConnectionSettings<D>::ClockFrequency(std::int32_t value) const
    {
        consume_general<winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettings, D>(static_cast<D const*>(this), &abi_t<winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettings>::put_ClockFrequency, value);
    }
    template <typename D> auto consume_Windows_Devices_Spi_Provider_IProviderSpiConnectionSettings<D>::SharingMode() const
    {
        winrt::Windows::Devices::Spi::Provider::ProviderSpiSharingMode value{};
        consume_general<winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettings, D>(static_cast<D const*>(this), &abi_t<winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettings>::get_SharingMode, reinterpret_cast<std::int32_t*>(&value));
        return value;
    }
    template <typename D> auto consume_Windows_Devices_Spi_Provider_IProviderSpiConnectionSettings<D>::SharingMode(winrt::Windows::Devices::Spi::Provider::ProviderSpiSharingMode const& value) const
    {
        consume_general<winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettings, D>(static_cast<D const*>(this), &abi_t<winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettings>::put_SharingMode, static_cast<std::int32_t>(value));
    }
    template <typename D> auto consume_Windows_Devices_Spi_Provider_IProviderSpiConnectionSettingsFactory<D>::Create(std::int32_t chipSelectLine) const
    {
        void* value{};
        consume_general<winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettingsFactory, D>(static_cast<D const*>(this), &abi_t<winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettingsFactory>::Create, chipSelectLine, &value);
        return winrt::Windows::Devices::Spi::Provider::ProviderSpiConnectionSettings{ value, take_ownership_from_abi };
    }
    template <typename D> auto consume_Windows_Devices_Spi_Provider_ISpiControllerProvider<D>::GetDeviceProvider(winrt::Windows::Devices::Spi::Provider::ProviderSpiConnectionSettings const& settings) const
    {
        void* result{};
        consume_general<winrt::Windows::Devices::Spi::Provider::ISpiControllerProvider, D>(static_cast<D const*>(this), &abi_t<winrt::Windows::Devices::Spi::Provider::ISpiControllerProvider>::GetDeviceProvider, *(void**)(&settings), &result);
        return winrt::Windows::Devices::Spi::Provider::ISpiDeviceProvider{ result, take_ownership_from_abi };
    }
    template <typename D> auto consume_Windows_Devices_Spi_Provider_ISpiDeviceProvider<D>::DeviceId() const
    {
        void* value{};
        consume_general<winrt::Windows::Devices::Spi::Provider::ISpiDeviceProvider, D>(static_cast<D const*>(this), &abi_t<winrt::Windows::Devices::Spi::Provider::ISpiDeviceProvider>::get_DeviceId, &value);
        return hstring{ value, take_ownership_from_abi };
    }
    template <typename D> auto consume_Windows_Devices_Spi_Provider_ISpiDeviceProvider<D>::ConnectionSettings() const
    {
        void* value{};
        consume_general<winrt::Windows::Devices::Spi::Provider::ISpiDeviceProvider, D>(static_cast<D const*>(this), &abi_t<winrt::Windows::Devices::Spi::Provider::ISpiDeviceProvider>::get_ConnectionSettings, &value);
        return winrt::Windows::Devices::Spi::Provider::ProviderSpiConnectionSettings{ value, take_ownership_from_abi };
    }
    template <typename D> auto consume_Windows_Devices_Spi_Provider_ISpiDeviceProvider<D>::Write(array_view<std::uint8_t const> buffer) const
    {
        consume_general<winrt::Windows::Devices::Spi::Provider::ISpiDeviceProvider, D>(static_cast<D const*>(this), &abi_t<winrt::Windows::Devices::Spi::Provider::ISpiDeviceProvider>::Write, buffer.size(), get_abi(buffer));
    }
    template <typename D> auto consume_Windows_Devices_Spi_Provider_ISpiDeviceProvider<D>::Read(array_view<std::uint8_t> buffer) const
    {
        consume_general<winrt::Windows::Devices::Spi::Provider::ISpiDeviceProvider, D>(static_cast<D const*>(this), &abi_t<winrt::Windows::Devices::Spi::Provider::ISpiDeviceProvider>::Read, buffer.size(), put_abi(buffer));
    }
    template <typename D> auto consume_Windows_Devices_Spi_Provider_ISpiDeviceProvider<D>::TransferSequential(array_view<std::uint8_t const> writeBuffer, array_view<std::uint8_t> readBuffer) const
    {
        consume_general<winrt::Windows::Devices::Spi::Provider::ISpiDeviceProvider, D>(static_cast<D const*>(this), &abi_t<winrt::Windows::Devices::Spi::Provider::ISpiDeviceProvider>::TransferSequential, writeBuffer.size(), get_abi(writeBuffer), readBuffer.size(), put_abi(readBuffer));
    }
    template <typename D> auto consume_Windows_Devices_Spi_Provider_ISpiDeviceProvider<D>::TransferFullDuplex(array_view<std::uint8_t const> writeBuffer, array_view<std::uint8_t> readBuffer) const
    {
        consume_general<winrt::Windows::Devices::Spi::Provider::ISpiDeviceProvider, D>(static_cast<D const*>(this), &abi_t<winrt::Windows::Devices::Spi::Provider::ISpiDeviceProvider>::TransferFullDuplex, writeBuffer.size(), get_abi(writeBuffer), readBuffer.size(), put_abi(readBuffer));
    }
    template <typename D> auto consume_Windows_Devices_Spi_Provider_ISpiProvider<D>::GetControllersAsync() const
    {
        void* result{};
        consume_general<winrt::Windows::Devices::Spi::Provider::ISpiProvider, D>(static_cast<D const*>(this), &abi_t<winrt::Windows::Devices::Spi::Provider::ISpiProvider>::GetControllersAsync, &result);
        return winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Foundation::Collections::IVectorView<winrt::Windows::Devices::Spi::Provider::ISpiControllerProvider>>{ result, take_ownership_from_abi };
    }
#ifndef WINRT_LEAN_AND_MEAN
    template <typename D>
    struct produce<D, winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettings> : produce_base<D, winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettings>
    {
        std::int32_t __stdcall get_ChipSelectLine(std::int32_t* value) noexcept final try
        {
            typename D::abi_guard guard(this->shim());
            *value = detach_from<std::int32_t>(this->shim().ChipSelectLine());
            return 0;
        }
        catch (...) { return to_hresult(); }
        std::int32_t __stdcall put_ChipSelectLine(std::int32_t value) noexcept final try
        {
            typename D::abi_guard guard(this->shim());
            this->shim().ChipSelectLine(value);
            return 0;
        }
        catch (...) { return to_hresult(); }
        std::int32_t __stdcall get_Mode(std::int32_t* value) noexcept final try
        {
            typename D::abi_guard guard(this->shim());
            *value = detach_from<winrt::Windows::Devices::Spi::Provider::ProviderSpiMode>(this->shim().Mode());
            return 0;
        }
        catch (...) { return to_hresult(); }
        std::int32_t __stdcall put_Mode(std::int32_t value) noexcept final try
        {
            typename D::abi_guard guard(this->shim());
            this->shim().Mode(*reinterpret_cast<winrt::Windows::Devices::Spi::Provider::ProviderSpiMode const*>(&value));
            return 0;
        }
        catch (...) { return to_hresult(); }
        std::int32_t __stdcall get_DataBitLength(std::int32_t* value) noexcept final try
        {
            typename D::abi_guard guard(this->shim());
            *value = detach_from<std::int32_t>(this->shim().DataBitLength());
            return 0;
        }
        catch (...) { return to_hresult(); }
        std::int32_t __stdcall put_DataBitLength(std::int32_t value) noexcept final try
        {
            typename D::abi_guard guard(this->shim());
            this->shim().DataBitLength(value);
            return 0;
        }
        catch (...) { return to_hresult(); }
        std::int32_t __stdcall get_ClockFrequency(std::int32_t* value) noexcept final try
        {
            typename D::abi_guard guard(this->shim());
            *value = detach_from<std::int32_t>(this->shim().ClockFrequency());
            return 0;
        }
        catch (...) { return to_hresult(); }
        std::int32_t __stdcall put_ClockFrequency(std::int32_t value) noexcept final try
        {
            typename D::abi_guard guard(this->shim());
            this->shim().ClockFrequency(value);
            return 0;
        }
        catch (...) { return to_hresult(); }
        std::int32_t __stdcall get_SharingMode(std::int32_t* value) noexcept final try
        {
            typename D::abi_guard guard(this->shim());
            *value = detach_from<winrt::Windows::Devices::Spi::Provider::ProviderSpiSharingMode>(this->shim().SharingMode());
            return 0;
        }
        catch (...) { return to_hresult(); }
        std::int32_t __stdcall put_SharingMode(std::int32_t value) noexcept final try
        {
            typename D::abi_guard guard(this->shim());
            this->shim().SharingMode(*reinterpret_cast<winrt::Windows::Devices::Spi::Provider::ProviderSpiSharingMode const*>(&value));
            return 0;
        }
        catch (...) { return to_hresult(); }
    };
#endif // WINRT_LEAN_AND_MEAN
#ifndef WINRT_LEAN_AND_MEAN
    template <typename D>
    struct produce<D, winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettingsFactory> : produce_base<D, winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettingsFactory>
    {
        std::int32_t __stdcall Create(std::int32_t chipSelectLine, void** value) noexcept final try
        {
            clear_abi(value);
            typename D::abi_guard guard(this->shim());
            *value = detach_from<winrt::Windows::Devices::Spi::Provider::ProviderSpiConnectionSettings>(this->shim().Create(chipSelectLine));
            return 0;
        }
        catch (...) { return to_hresult(); }
    };
#endif // WINRT_LEAN_AND_MEAN
    template <typename D>
    struct produce<D, winrt::Windows::Devices::Spi::Provider::ISpiControllerProvider> : produce_base<D, winrt::Windows::Devices::Spi::Provider::ISpiControllerProvider>
    {
        std::int32_t __stdcall GetDeviceProvider(void* settings, void** result) noexcept final try
        {
            clear_abi(result);
            typename D::abi_guard guard(this->shim());
            *result = detach_from<winrt::Windows::Devices::Spi::Provider::ISpiDeviceProvider>(this->shim().GetDeviceProvider(*reinterpret_cast<winrt::Windows::Devices::Spi::Provider::ProviderSpiConnectionSettings const*>(&settings)));
            return 0;
        }
        catch (...) { return to_hresult(); }
    };
    template <typename D>
    struct produce<D, winrt::Windows::Devices::Spi::Provider::ISpiDeviceProvider> : produce_base<D, winrt::Windows::Devices::Spi::Provider::ISpiDeviceProvider>
    {
        std::int32_t __stdcall get_DeviceId(void** value) noexcept final try
        {
            clear_abi(value);
            typename D::abi_guard guard(this->shim());
            *value = detach_from<hstring>(this->shim().DeviceId());
            return 0;
        }
        catch (...) { return to_hresult(); }
        std::int32_t __stdcall get_ConnectionSettings(void** value) noexcept final try
        {
            clear_abi(value);
            typename D::abi_guard guard(this->shim());
            *value = detach_from<winrt::Windows::Devices::Spi::Provider::ProviderSpiConnectionSettings>(this->shim().ConnectionSettings());
            return 0;
        }
        catch (...) { return to_hresult(); }
        std::int32_t __stdcall Write(std::uint32_t __bufferSize, std::uint8_t* buffer) noexcept final try
        {
            typename D::abi_guard guard(this->shim());
            this->shim().Write(array_view<std::uint8_t const>(reinterpret_cast<std::uint8_t const *>(buffer), reinterpret_cast<std::uint8_t const *>(buffer) + __bufferSize));
            return 0;
        }
        catch (...) { return to_hresult(); }
        std::int32_t __stdcall Read(std::uint32_t __bufferSize, std::uint8_t* buffer) noexcept final try
        {
            typename D::abi_guard guard(this->shim());
            this->shim().Read(array_view<std::uint8_t>(reinterpret_cast<std::uint8_t*>(buffer), reinterpret_cast<std::uint8_t*>(buffer) + __bufferSize));
            return 0;
        }
        catch (...) { return to_hresult(); }
        std::int32_t __stdcall TransferSequential(std::uint32_t __writeBufferSize, std::uint8_t* writeBuffer, std::uint32_t __readBufferSize, std::uint8_t* readBuffer) noexcept final try
        {
            typename D::abi_guard guard(this->shim());
            this->shim().TransferSequential(array_view<std::uint8_t const>(reinterpret_cast<std::uint8_t const *>(writeBuffer), reinterpret_cast<std::uint8_t const *>(writeBuffer) + __writeBufferSize), array_view<std::uint8_t>(reinterpret_cast<std::uint8_t*>(readBuffer), reinterpret_cast<std::uint8_t*>(readBuffer) + __readBufferSize));
            return 0;
        }
        catch (...) { return to_hresult(); }
        std::int32_t __stdcall TransferFullDuplex(std::uint32_t __writeBufferSize, std::uint8_t* writeBuffer, std::uint32_t __readBufferSize, std::uint8_t* readBuffer) noexcept final try
        {
            typename D::abi_guard guard(this->shim());
            this->shim().TransferFullDuplex(array_view<std::uint8_t const>(reinterpret_cast<std::uint8_t const *>(writeBuffer), reinterpret_cast<std::uint8_t const *>(writeBuffer) + __writeBufferSize), array_view<std::uint8_t>(reinterpret_cast<std::uint8_t*>(readBuffer), reinterpret_cast<std::uint8_t*>(readBuffer) + __readBufferSize));
            return 0;
        }
        catch (...) { return to_hresult(); }
    };
    template <typename D>
    struct produce<D, winrt::Windows::Devices::Spi::Provider::ISpiProvider> : produce_base<D, winrt::Windows::Devices::Spi::Provider::ISpiProvider>
    {
        std::int32_t __stdcall GetControllersAsync(void** result) noexcept final try
        {
            clear_abi(result);
            typename D::abi_guard guard(this->shim());
            *result = detach_from<winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Foundation::Collections::IVectorView<winrt::Windows::Devices::Spi::Provider::ISpiControllerProvider>>>(this->shim().GetControllersAsync());
            return 0;
        }
        catch (...) { return to_hresult(); }
    };
}
WINRT_EXPORT namespace winrt::Windows::Devices::Spi::Provider
{
    inline ProviderSpiConnectionSettings::ProviderSpiConnectionSettings(std::int32_t chipSelectLine) :
        ProviderSpiConnectionSettings(impl::call_factory<ProviderSpiConnectionSettings, IProviderSpiConnectionSettingsFactory>([&](IProviderSpiConnectionSettingsFactory const& f) { return f.Create(chipSelectLine); }))
    {
    }
}
namespace std
{
#ifndef WINRT_LEAN_AND_MEAN
    template<> struct hash<winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettings> : winrt::impl::hash_base {};
    template<> struct hash<winrt::Windows::Devices::Spi::Provider::IProviderSpiConnectionSettingsFactory> : winrt::impl::hash_base {};
    template<> struct hash<winrt::Windows::Devices::Spi::Provider::ISpiControllerProvider> : winrt::impl::hash_base {};
    template<> struct hash<winrt::Windows::Devices::Spi::Provider::ISpiDeviceProvider> : winrt::impl::hash_base {};
    template<> struct hash<winrt::Windows::Devices::Spi::Provider::ISpiProvider> : winrt::impl::hash_base {};
    template<> struct hash<winrt::Windows::Devices::Spi::Provider::ProviderSpiConnectionSettings> : winrt::impl::hash_base {};
#endif // WINRT_LEAN_AND_MEAN
#ifdef __cpp_lib_format
#endif // __cpp_lib_format
}
#endif
#endif // WINRT_IMPORT_MODULE
