// WARNING: Please don't edit this file. It was generated by Python/WinRT v3.1.0

#include "py.Windows.Devices.Bluetooth.Background.h"

namespace py::cpp::Windows::Devices::Bluetooth::Background
{
    // ----- BluetoothLEAdvertisementPublisherTriggerDetails class --------------------

    static PyObject* _new_BluetoothLEAdvertisementPublisherTriggerDetails(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Devices::Bluetooth::Background::BluetoothLEAdvertisementPublisherTriggerDetails>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Devices::Bluetooth::Background::BluetoothLEAdvertisementPublisherTriggerDetails>::type_name);
        return nullptr;
    }

    static void _dealloc_BluetoothLEAdvertisementPublisherTriggerDetails(py::wrapper::Windows::Devices::Bluetooth::Background::BluetoothLEAdvertisementPublisherTriggerDetails* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* BluetoothLEAdvertisementPublisherTriggerDetails_get_Error(py::wrapper::Windows::Devices::Bluetooth::Background::BluetoothLEAdvertisementPublisherTriggerDetails* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.BluetoothLEAdvertisementPublisherTriggerDetails", L"Error");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.Error();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* BluetoothLEAdvertisementPublisherTriggerDetails_get_Status(py::wrapper::Windows::Devices::Bluetooth::Background::BluetoothLEAdvertisementPublisherTriggerDetails* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.BluetoothLEAdvertisementPublisherTriggerDetails", L"Status");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.Status();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* BluetoothLEAdvertisementPublisherTriggerDetails_get_SelectedTransmitPowerLevelInDBm(py::wrapper::Windows::Devices::Bluetooth::Background::BluetoothLEAdvertisementPublisherTriggerDetails* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.BluetoothLEAdvertisementPublisherTriggerDetails", L"SelectedTransmitPowerLevelInDBm");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.SelectedTransmitPowerLevelInDBm();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_BluetoothLEAdvertisementPublisherTriggerDetails(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Devices::Bluetooth::Background::BluetoothLEAdvertisementPublisherTriggerDetails>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_BluetoothLEAdvertisementPublisherTriggerDetails(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::Devices::Bluetooth::Background::BluetoothLEAdvertisementPublisherTriggerDetails>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_BluetoothLEAdvertisementPublisherTriggerDetails[] = {
        { "_assign_array_", _assign_array_BluetoothLEAdvertisementPublisherTriggerDetails, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_BluetoothLEAdvertisementPublisherTriggerDetails), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_BluetoothLEAdvertisementPublisherTriggerDetails[] = {
        { "error", reinterpret_cast<getter>(BluetoothLEAdvertisementPublisherTriggerDetails_get_Error), nullptr, nullptr, nullptr },
        { "status", reinterpret_cast<getter>(BluetoothLEAdvertisementPublisherTriggerDetails_get_Status), nullptr, nullptr, nullptr },
        { "selected_transmit_power_level_in_dbm", reinterpret_cast<getter>(BluetoothLEAdvertisementPublisherTriggerDetails_get_SelectedTransmitPowerLevelInDBm), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_BluetoothLEAdvertisementPublisherTriggerDetails[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_BluetoothLEAdvertisementPublisherTriggerDetails) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_BluetoothLEAdvertisementPublisherTriggerDetails) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_BluetoothLEAdvertisementPublisherTriggerDetails) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_BluetoothLEAdvertisementPublisherTriggerDetails) },
        { }};

    static PyType_Spec type_spec_BluetoothLEAdvertisementPublisherTriggerDetails = {
        "winrt._winrt_windows_devices_bluetooth_background.BluetoothLEAdvertisementPublisherTriggerDetails",
        sizeof(py::wrapper::Windows::Devices::Bluetooth::Background::BluetoothLEAdvertisementPublisherTriggerDetails),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_BluetoothLEAdvertisementPublisherTriggerDetails};

    // ----- BluetoothLEAdvertisementWatcherTriggerDetails class --------------------

    static PyObject* _new_BluetoothLEAdvertisementWatcherTriggerDetails(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Devices::Bluetooth::Background::BluetoothLEAdvertisementWatcherTriggerDetails>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Devices::Bluetooth::Background::BluetoothLEAdvertisementWatcherTriggerDetails>::type_name);
        return nullptr;
    }

    static void _dealloc_BluetoothLEAdvertisementWatcherTriggerDetails(py::wrapper::Windows::Devices::Bluetooth::Background::BluetoothLEAdvertisementWatcherTriggerDetails* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* BluetoothLEAdvertisementWatcherTriggerDetails_get_Advertisements(py::wrapper::Windows::Devices::Bluetooth::Background::BluetoothLEAdvertisementWatcherTriggerDetails* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.BluetoothLEAdvertisementWatcherTriggerDetails", L"Advertisements");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.Advertisements();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* BluetoothLEAdvertisementWatcherTriggerDetails_get_Error(py::wrapper::Windows::Devices::Bluetooth::Background::BluetoothLEAdvertisementWatcherTriggerDetails* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.BluetoothLEAdvertisementWatcherTriggerDetails", L"Error");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.Error();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* BluetoothLEAdvertisementWatcherTriggerDetails_get_SignalStrengthFilter(py::wrapper::Windows::Devices::Bluetooth::Background::BluetoothLEAdvertisementWatcherTriggerDetails* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.BluetoothLEAdvertisementWatcherTriggerDetails", L"SignalStrengthFilter");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.SignalStrengthFilter();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_BluetoothLEAdvertisementWatcherTriggerDetails(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Devices::Bluetooth::Background::BluetoothLEAdvertisementWatcherTriggerDetails>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_BluetoothLEAdvertisementWatcherTriggerDetails(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::Devices::Bluetooth::Background::BluetoothLEAdvertisementWatcherTriggerDetails>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_BluetoothLEAdvertisementWatcherTriggerDetails[] = {
        { "_assign_array_", _assign_array_BluetoothLEAdvertisementWatcherTriggerDetails, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_BluetoothLEAdvertisementWatcherTriggerDetails), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_BluetoothLEAdvertisementWatcherTriggerDetails[] = {
        { "advertisements", reinterpret_cast<getter>(BluetoothLEAdvertisementWatcherTriggerDetails_get_Advertisements), nullptr, nullptr, nullptr },
        { "error", reinterpret_cast<getter>(BluetoothLEAdvertisementWatcherTriggerDetails_get_Error), nullptr, nullptr, nullptr },
        { "signal_strength_filter", reinterpret_cast<getter>(BluetoothLEAdvertisementWatcherTriggerDetails_get_SignalStrengthFilter), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_BluetoothLEAdvertisementWatcherTriggerDetails[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_BluetoothLEAdvertisementWatcherTriggerDetails) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_BluetoothLEAdvertisementWatcherTriggerDetails) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_BluetoothLEAdvertisementWatcherTriggerDetails) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_BluetoothLEAdvertisementWatcherTriggerDetails) },
        { }};

    static PyType_Spec type_spec_BluetoothLEAdvertisementWatcherTriggerDetails = {
        "winrt._winrt_windows_devices_bluetooth_background.BluetoothLEAdvertisementWatcherTriggerDetails",
        sizeof(py::wrapper::Windows::Devices::Bluetooth::Background::BluetoothLEAdvertisementWatcherTriggerDetails),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_BluetoothLEAdvertisementWatcherTriggerDetails};

    // ----- GattCharacteristicNotificationTriggerDetails class --------------------

    static PyObject* _new_GattCharacteristicNotificationTriggerDetails(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Devices::Bluetooth::Background::GattCharacteristicNotificationTriggerDetails>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Devices::Bluetooth::Background::GattCharacteristicNotificationTriggerDetails>::type_name);
        return nullptr;
    }

    static void _dealloc_GattCharacteristicNotificationTriggerDetails(py::wrapper::Windows::Devices::Bluetooth::Background::GattCharacteristicNotificationTriggerDetails* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* GattCharacteristicNotificationTriggerDetails_get_Characteristic(py::wrapper::Windows::Devices::Bluetooth::Background::GattCharacteristicNotificationTriggerDetails* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.GattCharacteristicNotificationTriggerDetails", L"Characteristic");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.Characteristic();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* GattCharacteristicNotificationTriggerDetails_get_Value(py::wrapper::Windows::Devices::Bluetooth::Background::GattCharacteristicNotificationTriggerDetails* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.GattCharacteristicNotificationTriggerDetails", L"Value");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.Value();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* GattCharacteristicNotificationTriggerDetails_get_Error(py::wrapper::Windows::Devices::Bluetooth::Background::GattCharacteristicNotificationTriggerDetails* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.GattCharacteristicNotificationTriggerDetails", L"Error");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.Error();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* GattCharacteristicNotificationTriggerDetails_get_EventTriggeringMode(py::wrapper::Windows::Devices::Bluetooth::Background::GattCharacteristicNotificationTriggerDetails* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.GattCharacteristicNotificationTriggerDetails", L"EventTriggeringMode");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.EventTriggeringMode();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* GattCharacteristicNotificationTriggerDetails_get_ValueChangedEvents(py::wrapper::Windows::Devices::Bluetooth::Background::GattCharacteristicNotificationTriggerDetails* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.GattCharacteristicNotificationTriggerDetails", L"ValueChangedEvents");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.ValueChangedEvents();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_GattCharacteristicNotificationTriggerDetails(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Devices::Bluetooth::Background::GattCharacteristicNotificationTriggerDetails>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_GattCharacteristicNotificationTriggerDetails(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::Devices::Bluetooth::Background::GattCharacteristicNotificationTriggerDetails>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_GattCharacteristicNotificationTriggerDetails[] = {
        { "_assign_array_", _assign_array_GattCharacteristicNotificationTriggerDetails, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_GattCharacteristicNotificationTriggerDetails), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_GattCharacteristicNotificationTriggerDetails[] = {
        { "characteristic", reinterpret_cast<getter>(GattCharacteristicNotificationTriggerDetails_get_Characteristic), nullptr, nullptr, nullptr },
        { "value", reinterpret_cast<getter>(GattCharacteristicNotificationTriggerDetails_get_Value), nullptr, nullptr, nullptr },
        { "error", reinterpret_cast<getter>(GattCharacteristicNotificationTriggerDetails_get_Error), nullptr, nullptr, nullptr },
        { "event_triggering_mode", reinterpret_cast<getter>(GattCharacteristicNotificationTriggerDetails_get_EventTriggeringMode), nullptr, nullptr, nullptr },
        { "value_changed_events", reinterpret_cast<getter>(GattCharacteristicNotificationTriggerDetails_get_ValueChangedEvents), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_GattCharacteristicNotificationTriggerDetails[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_GattCharacteristicNotificationTriggerDetails) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_GattCharacteristicNotificationTriggerDetails) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_GattCharacteristicNotificationTriggerDetails) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_GattCharacteristicNotificationTriggerDetails) },
        { }};

    static PyType_Spec type_spec_GattCharacteristicNotificationTriggerDetails = {
        "winrt._winrt_windows_devices_bluetooth_background.GattCharacteristicNotificationTriggerDetails",
        sizeof(py::wrapper::Windows::Devices::Bluetooth::Background::GattCharacteristicNotificationTriggerDetails),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_GattCharacteristicNotificationTriggerDetails};

    // ----- GattServiceProviderConnection class --------------------

    static PyObject* _new_GattServiceProviderConnection(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Devices::Bluetooth::Background::GattServiceProviderConnection>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Devices::Bluetooth::Background::GattServiceProviderConnection>::type_name);
        return nullptr;
    }

    static void _dealloc_GattServiceProviderConnection(py::wrapper::Windows::Devices::Bluetooth::Background::GattServiceProviderConnection* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* GattServiceProviderConnection_Start(py::wrapper::Windows::Devices::Bluetooth::Background::GattServiceProviderConnection* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 0)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Bluetooth.Background.GattServiceProviderConnection", L"Start", 0);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

                {
                    auto _gil = release_gil();
                    self->obj.Start();
                }

                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* GattServiceProviderConnection_UpdateAdvertisingParameters(py::wrapper::Windows::Devices::Bluetooth::Background::GattServiceProviderConnection* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 1)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Bluetooth.Background.GattServiceProviderConnection", L"UpdateAdvertisingParameters", 1);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters>(args, 0);

                {
                    auto _gil = release_gil();
                    self->obj.UpdateAdvertisingParameters(param0);
                }

                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* GattServiceProviderConnection_get_Service(py::wrapper::Windows::Devices::Bluetooth::Background::GattServiceProviderConnection* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.GattServiceProviderConnection", L"Service");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.Service();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* GattServiceProviderConnection_get_TriggerId(py::wrapper::Windows::Devices::Bluetooth::Background::GattServiceProviderConnection* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.GattServiceProviderConnection", L"TriggerId");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.TriggerId();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* GattServiceProviderConnection_get_AllServices(PyObject* /*unused*/, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.GattServiceProviderConnection", L"AllServices");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return winrt::Windows::Devices::Bluetooth::Background::GattServiceProviderConnection::AllServices();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_GattServiceProviderConnection(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Devices::Bluetooth::Background::GattServiceProviderConnection>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_GattServiceProviderConnection(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::Devices::Bluetooth::Background::GattServiceProviderConnection>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_GattServiceProviderConnection[] = {
        { "start", reinterpret_cast<PyCFunction>(GattServiceProviderConnection_Start), METH_VARARGS, nullptr },
        { "update_advertising_parameters", reinterpret_cast<PyCFunction>(GattServiceProviderConnection_UpdateAdvertisingParameters), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_GattServiceProviderConnection, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_GattServiceProviderConnection), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_GattServiceProviderConnection[] = {
        { "service", reinterpret_cast<getter>(GattServiceProviderConnection_get_Service), nullptr, nullptr, nullptr },
        { "trigger_id", reinterpret_cast<getter>(GattServiceProviderConnection_get_TriggerId), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_GattServiceProviderConnection[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_GattServiceProviderConnection) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_GattServiceProviderConnection) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_GattServiceProviderConnection) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_GattServiceProviderConnection) },
        { }};

    static PyType_Spec type_spec_GattServiceProviderConnection = {
        "winrt._winrt_windows_devices_bluetooth_background.GattServiceProviderConnection",
        sizeof(py::wrapper::Windows::Devices::Bluetooth::Background::GattServiceProviderConnection),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_GattServiceProviderConnection};

    static PyGetSetDef getset_GattServiceProviderConnection_Static[] = {
        { "all_services", reinterpret_cast<getter>(GattServiceProviderConnection_get_AllServices), nullptr, nullptr, nullptr },
        { }};

    static PyMethodDef methods_GattServiceProviderConnection_Static[] = {
        { }};

    static PyType_Slot type_slots_GattServiceProviderConnection_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_GattServiceProviderConnection_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_GattServiceProviderConnection_Static) },
        { }
    };

    static PyType_Spec type_spec_GattServiceProviderConnection_Static = {
        "winrt._winrt_windows_devices_bluetooth_background.GattServiceProviderConnection_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_GattServiceProviderConnection_Static};

    // ----- GattServiceProviderTriggerDetails class --------------------

    static PyObject* _new_GattServiceProviderTriggerDetails(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Devices::Bluetooth::Background::GattServiceProviderTriggerDetails>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Devices::Bluetooth::Background::GattServiceProviderTriggerDetails>::type_name);
        return nullptr;
    }

    static void _dealloc_GattServiceProviderTriggerDetails(py::wrapper::Windows::Devices::Bluetooth::Background::GattServiceProviderTriggerDetails* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* GattServiceProviderTriggerDetails_get_Connection(py::wrapper::Windows::Devices::Bluetooth::Background::GattServiceProviderTriggerDetails* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.GattServiceProviderTriggerDetails", L"Connection");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.Connection();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_GattServiceProviderTriggerDetails(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Devices::Bluetooth::Background::GattServiceProviderTriggerDetails>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_GattServiceProviderTriggerDetails(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::Devices::Bluetooth::Background::GattServiceProviderTriggerDetails>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_GattServiceProviderTriggerDetails[] = {
        { "_assign_array_", _assign_array_GattServiceProviderTriggerDetails, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_GattServiceProviderTriggerDetails), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_GattServiceProviderTriggerDetails[] = {
        { "connection", reinterpret_cast<getter>(GattServiceProviderTriggerDetails_get_Connection), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_GattServiceProviderTriggerDetails[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_GattServiceProviderTriggerDetails) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_GattServiceProviderTriggerDetails) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_GattServiceProviderTriggerDetails) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_GattServiceProviderTriggerDetails) },
        { }};

    static PyType_Spec type_spec_GattServiceProviderTriggerDetails = {
        "winrt._winrt_windows_devices_bluetooth_background.GattServiceProviderTriggerDetails",
        sizeof(py::wrapper::Windows::Devices::Bluetooth::Background::GattServiceProviderTriggerDetails),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_GattServiceProviderTriggerDetails};

    // ----- RfcommConnectionTriggerDetails class --------------------

    static PyObject* _new_RfcommConnectionTriggerDetails(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Devices::Bluetooth::Background::RfcommConnectionTriggerDetails>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Devices::Bluetooth::Background::RfcommConnectionTriggerDetails>::type_name);
        return nullptr;
    }

    static void _dealloc_RfcommConnectionTriggerDetails(py::wrapper::Windows::Devices::Bluetooth::Background::RfcommConnectionTriggerDetails* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* RfcommConnectionTriggerDetails_get_Incoming(py::wrapper::Windows::Devices::Bluetooth::Background::RfcommConnectionTriggerDetails* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.RfcommConnectionTriggerDetails", L"Incoming");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.Incoming();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* RfcommConnectionTriggerDetails_get_RemoteDevice(py::wrapper::Windows::Devices::Bluetooth::Background::RfcommConnectionTriggerDetails* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.RfcommConnectionTriggerDetails", L"RemoteDevice");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.RemoteDevice();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* RfcommConnectionTriggerDetails_get_Socket(py::wrapper::Windows::Devices::Bluetooth::Background::RfcommConnectionTriggerDetails* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.RfcommConnectionTriggerDetails", L"Socket");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.Socket();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_RfcommConnectionTriggerDetails(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Devices::Bluetooth::Background::RfcommConnectionTriggerDetails>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_RfcommConnectionTriggerDetails(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::Devices::Bluetooth::Background::RfcommConnectionTriggerDetails>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_RfcommConnectionTriggerDetails[] = {
        { "_assign_array_", _assign_array_RfcommConnectionTriggerDetails, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_RfcommConnectionTriggerDetails), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_RfcommConnectionTriggerDetails[] = {
        { "incoming", reinterpret_cast<getter>(RfcommConnectionTriggerDetails_get_Incoming), nullptr, nullptr, nullptr },
        { "remote_device", reinterpret_cast<getter>(RfcommConnectionTriggerDetails_get_RemoteDevice), nullptr, nullptr, nullptr },
        { "socket", reinterpret_cast<getter>(RfcommConnectionTriggerDetails_get_Socket), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_RfcommConnectionTriggerDetails[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_RfcommConnectionTriggerDetails) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_RfcommConnectionTriggerDetails) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_RfcommConnectionTriggerDetails) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_RfcommConnectionTriggerDetails) },
        { }};

    static PyType_Spec type_spec_RfcommConnectionTriggerDetails = {
        "winrt._winrt_windows_devices_bluetooth_background.RfcommConnectionTriggerDetails",
        sizeof(py::wrapper::Windows::Devices::Bluetooth::Background::RfcommConnectionTriggerDetails),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_RfcommConnectionTriggerDetails};

    // ----- RfcommInboundConnectionInformation class --------------------

    static PyObject* _new_RfcommInboundConnectionInformation(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Devices::Bluetooth::Background::RfcommInboundConnectionInformation>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Devices::Bluetooth::Background::RfcommInboundConnectionInformation>::type_name);
        return nullptr;
    }

    static void _dealloc_RfcommInboundConnectionInformation(py::wrapper::Windows::Devices::Bluetooth::Background::RfcommInboundConnectionInformation* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* RfcommInboundConnectionInformation_get_ServiceCapabilities(py::wrapper::Windows::Devices::Bluetooth::Background::RfcommInboundConnectionInformation* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.RfcommInboundConnectionInformation", L"ServiceCapabilities");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.ServiceCapabilities();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int RfcommInboundConnectionInformation_put_ServiceCapabilities(py::wrapper::Windows::Devices::Bluetooth::Background::RfcommInboundConnectionInformation* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!arg)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.RfcommInboundConnectionInformation", L"ServiceCapabilities");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return -1;
            }

            auto param0 = py::convert_to<winrt::Windows::Devices::Bluetooth::BluetoothServiceCapabilities>(arg);

            {
                auto _gil = release_gil();
                self->obj.ServiceCapabilities(param0);
            }

            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* RfcommInboundConnectionInformation_get_SdpRecord(py::wrapper::Windows::Devices::Bluetooth::Background::RfcommInboundConnectionInformation* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.RfcommInboundConnectionInformation", L"SdpRecord");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.SdpRecord();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int RfcommInboundConnectionInformation_put_SdpRecord(py::wrapper::Windows::Devices::Bluetooth::Background::RfcommInboundConnectionInformation* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!arg)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.RfcommInboundConnectionInformation", L"SdpRecord");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return -1;
            }

            auto param0 = py::convert_to<winrt::Windows::Storage::Streams::IBuffer>(arg);

            {
                auto _gil = release_gil();
                self->obj.SdpRecord(param0);
            }

            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* RfcommInboundConnectionInformation_get_LocalServiceId(py::wrapper::Windows::Devices::Bluetooth::Background::RfcommInboundConnectionInformation* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.RfcommInboundConnectionInformation", L"LocalServiceId");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.LocalServiceId();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int RfcommInboundConnectionInformation_put_LocalServiceId(py::wrapper::Windows::Devices::Bluetooth::Background::RfcommInboundConnectionInformation* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!arg)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.RfcommInboundConnectionInformation", L"LocalServiceId");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return -1;
            }

            auto param0 = py::convert_to<winrt::Windows::Devices::Bluetooth::Rfcomm::RfcommServiceId>(arg);

            {
                auto _gil = release_gil();
                self->obj.LocalServiceId(param0);
            }

            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* _assign_array_RfcommInboundConnectionInformation(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Devices::Bluetooth::Background::RfcommInboundConnectionInformation>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_RfcommInboundConnectionInformation(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::Devices::Bluetooth::Background::RfcommInboundConnectionInformation>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_RfcommInboundConnectionInformation[] = {
        { "_assign_array_", _assign_array_RfcommInboundConnectionInformation, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_RfcommInboundConnectionInformation), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_RfcommInboundConnectionInformation[] = {
        { "service_capabilities", reinterpret_cast<getter>(RfcommInboundConnectionInformation_get_ServiceCapabilities), reinterpret_cast<setter>(RfcommInboundConnectionInformation_put_ServiceCapabilities), nullptr, nullptr },
        { "sdp_record", reinterpret_cast<getter>(RfcommInboundConnectionInformation_get_SdpRecord), reinterpret_cast<setter>(RfcommInboundConnectionInformation_put_SdpRecord), nullptr, nullptr },
        { "local_service_id", reinterpret_cast<getter>(RfcommInboundConnectionInformation_get_LocalServiceId), reinterpret_cast<setter>(RfcommInboundConnectionInformation_put_LocalServiceId), nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_RfcommInboundConnectionInformation[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_RfcommInboundConnectionInformation) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_RfcommInboundConnectionInformation) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_RfcommInboundConnectionInformation) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_RfcommInboundConnectionInformation) },
        { }};

    static PyType_Spec type_spec_RfcommInboundConnectionInformation = {
        "winrt._winrt_windows_devices_bluetooth_background.RfcommInboundConnectionInformation",
        sizeof(py::wrapper::Windows::Devices::Bluetooth::Background::RfcommInboundConnectionInformation),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_RfcommInboundConnectionInformation};

    // ----- RfcommOutboundConnectionInformation class --------------------

    static PyObject* _new_RfcommOutboundConnectionInformation(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::Devices::Bluetooth::Background::RfcommOutboundConnectionInformation>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::Devices::Bluetooth::Background::RfcommOutboundConnectionInformation>::type_name);
        return nullptr;
    }

    static void _dealloc_RfcommOutboundConnectionInformation(py::wrapper::Windows::Devices::Bluetooth::Background::RfcommOutboundConnectionInformation* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* RfcommOutboundConnectionInformation_get_RemoteServiceId(py::wrapper::Windows::Devices::Bluetooth::Background::RfcommOutboundConnectionInformation* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.RfcommOutboundConnectionInformation", L"RemoteServiceId");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.RemoteServiceId();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int RfcommOutboundConnectionInformation_put_RemoteServiceId(py::wrapper::Windows::Devices::Bluetooth::Background::RfcommOutboundConnectionInformation* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!arg)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Bluetooth.Background.RfcommOutboundConnectionInformation", L"RemoteServiceId");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return -1;
            }

            auto param0 = py::convert_to<winrt::Windows::Devices::Bluetooth::Rfcomm::RfcommServiceId>(arg);

            {
                auto _gil = release_gil();
                self->obj.RemoteServiceId(param0);
            }

            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* _assign_array_RfcommOutboundConnectionInformation(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Devices::Bluetooth::Background::RfcommOutboundConnectionInformation>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_RfcommOutboundConnectionInformation(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::Devices::Bluetooth::Background::RfcommOutboundConnectionInformation>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_RfcommOutboundConnectionInformation[] = {
        { "_assign_array_", _assign_array_RfcommOutboundConnectionInformation, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_RfcommOutboundConnectionInformation), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_RfcommOutboundConnectionInformation[] = {
        { "remote_service_id", reinterpret_cast<getter>(RfcommOutboundConnectionInformation_get_RemoteServiceId), reinterpret_cast<setter>(RfcommOutboundConnectionInformation_put_RemoteServiceId), nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_RfcommOutboundConnectionInformation[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_RfcommOutboundConnectionInformation) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_RfcommOutboundConnectionInformation) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_RfcommOutboundConnectionInformation) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_RfcommOutboundConnectionInformation) },
        { }};

    static PyType_Spec type_spec_RfcommOutboundConnectionInformation = {
        "winrt._winrt_windows_devices_bluetooth_background.RfcommOutboundConnectionInformation",
        sizeof(py::wrapper::Windows::Devices::Bluetooth::Background::RfcommOutboundConnectionInformation),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_RfcommOutboundConnectionInformation};

    // ----- Windows.Devices.Bluetooth.Background Initialization --------------------

    PyDoc_STRVAR(module_doc, "Windows.Devices.Bluetooth.Background");

    static PyModuleDef module_def = {
        PyModuleDef_HEAD_INIT,
        "_winrt_windows_devices_bluetooth_background",
        module_doc,
        0,
        nullptr,
        nullptr,
        nullptr,
        nullptr,
        nullptr};
} // py::cpp::Windows::Devices::Bluetooth::Background

PyMODINIT_FUNC PyInit__winrt_windows_devices_bluetooth_background(void) noexcept
{
    using namespace py::cpp::Windows::Devices::Bluetooth::Background;

    if (py::import_winrt_runtime() == -1)
    {
        return nullptr;
    }

    py::pyobj_handle module{PyModule_Create(&module_def)};

    if (!module)
    {
        return nullptr;
    }

    auto inspectable_meta_type = py::get_inspectable_meta_type();
    if (!inspectable_meta_type)
    {
        return nullptr;
    }

    auto object_type = py::get_object_type();
    if (!object_type)
    {
        return nullptr;
    }

    py::pyobj_handle object_bases{PyTuple_Pack(1, object_type)};

    if (!object_bases)
    {
        return nullptr;
    }

    py::pytype_handle BluetoothLEAdvertisementPublisherTriggerDetails_type{py::register_python_type(module.get(), &type_spec_BluetoothLEAdvertisementPublisherTriggerDetails, object_bases.get(), inspectable_meta_type)};
    if (!BluetoothLEAdvertisementPublisherTriggerDetails_type)
    {
        return nullptr;
    }

    py::pytype_handle BluetoothLEAdvertisementWatcherTriggerDetails_type{py::register_python_type(module.get(), &type_spec_BluetoothLEAdvertisementWatcherTriggerDetails, object_bases.get(), inspectable_meta_type)};
    if (!BluetoothLEAdvertisementWatcherTriggerDetails_type)
    {
        return nullptr;
    }

    py::pytype_handle GattCharacteristicNotificationTriggerDetails_type{py::register_python_type(module.get(), &type_spec_GattCharacteristicNotificationTriggerDetails, object_bases.get(), inspectable_meta_type)};
    if (!GattCharacteristicNotificationTriggerDetails_type)
    {
        return nullptr;
    }

    py::pyobj_handle GattServiceProviderConnection_Static_bases{PyTuple_Pack(1, reinterpret_cast<PyObject*>(inspectable_meta_type))};
    if (!GattServiceProviderConnection_Static_bases)
    {
        return nullptr;
    }

    py::pyobj_handle type_GattServiceProviderConnection_Static{PyType_FromSpecWithBases(&type_spec_GattServiceProviderConnection_Static, GattServiceProviderConnection_Static_bases.get())};
    if (!type_GattServiceProviderConnection_Static)
    {
        return nullptr;
    }

    py::pytype_handle GattServiceProviderConnection_type{py::register_python_type(module.get(), &type_spec_GattServiceProviderConnection, object_bases.get(), reinterpret_cast<PyTypeObject*>(type_GattServiceProviderConnection_Static.get()))};
    if (!GattServiceProviderConnection_type)
    {
        return nullptr;
    }

    py::pytype_handle GattServiceProviderTriggerDetails_type{py::register_python_type(module.get(), &type_spec_GattServiceProviderTriggerDetails, object_bases.get(), inspectable_meta_type)};
    if (!GattServiceProviderTriggerDetails_type)
    {
        return nullptr;
    }

    py::pytype_handle RfcommConnectionTriggerDetails_type{py::register_python_type(module.get(), &type_spec_RfcommConnectionTriggerDetails, object_bases.get(), inspectable_meta_type)};
    if (!RfcommConnectionTriggerDetails_type)
    {
        return nullptr;
    }

    py::pytype_handle RfcommInboundConnectionInformation_type{py::register_python_type(module.get(), &type_spec_RfcommInboundConnectionInformation, object_bases.get(), inspectable_meta_type)};
    if (!RfcommInboundConnectionInformation_type)
    {
        return nullptr;
    }

    py::pytype_handle RfcommOutboundConnectionInformation_type{py::register_python_type(module.get(), &type_spec_RfcommOutboundConnectionInformation, object_bases.get(), inspectable_meta_type)};
    if (!RfcommOutboundConnectionInformation_type)
    {
        return nullptr;
    }


    return module.detach();
}
