/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt for Python.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/

//workaround to access protected functions
#define protected public

// default includes
#include <shiboken.h>
#ifndef QT_NO_VERSION_TAGGING
#  define QT_NO_VERSION_TAGGING
#endif
#include <QDebug>
#include <pysidesignal.h>
#include <pysideproperty.h>
#include <pyside.h>
#include <pysideqenum.h>
#include <feature_select.h>
QT_WARNING_DISABLE_DEPRECATED

#include <typeinfo>
#include <signalmanager.h>
#include <pysidemetafunction.h>
#include <algorithm>
#include <set>
#include <iterator>

// module include
#include "pyside6_qtbluetooth_python.h"

// main header
#include "qbluetoothsocket_wrapper.h"

// inner classes

#include <cctype>
#include <cstring>



template <class T>
static const char *typeNameOf(const T &t)
{
    const char *typeName =  typeid(t).name();
    auto size = std::strlen(typeName);
#if defined(Q_CC_MSVC) // MSVC: "class QPaintDevice * __ptr64"
    if (auto lastStar = strchr(typeName, '*')) {
        // MSVC: "class QPaintDevice * __ptr64"
        while (*--lastStar == ' ') {
        }
        size = lastStar - typeName + 1;
    }
#else // g++, Clang: "QPaintDevice *" -> "P12QPaintDevice"
    if (size > 2 && typeName[0] == 'P' && std::isdigit(typeName[1])) {
        ++typeName;
        --size;
    }
#endif
    char *result = new char[size + 1];
    result[size] = '\0';
    memcpy(result, typeName, size);
    return result;
}

// Native ---------------------------------------------------------

void QBluetoothSocketWrapper::resetPyMethodCache()
{
    std::fill_n(m_PyMethodCache, sizeof(m_PyMethodCache) / sizeof(m_PyMethodCache[0]), false);
}

QBluetoothSocketWrapper::QBluetoothSocketWrapper(QBluetoothServiceInfo::Protocol socketType, QObject * parent) : QBluetoothSocket(socketType, parent)
{
    resetPyMethodCache();
    // ... middle
}

QBluetoothSocketWrapper::QBluetoothSocketWrapper(QObject * parent) : QBluetoothSocket(parent)
{
    resetPyMethodCache();
    // ... middle
}

bool QBluetoothSocketWrapper::atEnd() const
{
    if (m_PyMethodCache[0])
        return this->::QIODevice::atEnd();
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return false;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "atEnd";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[0] = true;
        return this->::QIODevice::atEnd();
    }

    Shiboken::AutoDecRef pyArgs(PyTuple_New(0));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return false;
    }
    // Check return type
    Shiboken::Conversions::PythonToCppConversion pythonToCpp =
        Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2,
            "Invalid return value in function %s, expected %s, got %s.",
            "QBluetoothSocket.atEnd",
            "bool",
            Py_TYPE(pyResult)->tp_name);
        return false;
    }
    bool cppResult;
    pythonToCpp(pyResult, &cppResult);
    return cppResult;
}

qint64 QBluetoothSocketWrapper::bytesAvailable() const
{
    if (m_PyMethodCache[1])
        return this->::QBluetoothSocket::bytesAvailable();
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return 0;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "bytesAvailable";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[1] = true;
        return this->::QBluetoothSocket::bytesAvailable();
    }

    Shiboken::AutoDecRef pyArgs(PyTuple_New(0));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return 0;
    }
    // Check return type
    Shiboken::Conversions::PythonToCppConversion pythonToCpp =
        Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<qint64>(), pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2,
            "Invalid return value in function %s, expected %s, got %s.",
            "QBluetoothSocket.bytesAvailable",
            "qint64",
            Py_TYPE(pyResult)->tp_name);
        return 0;
    }
    qint64 cppResult;
    pythonToCpp(pyResult, &cppResult);
    return cppResult;
}

qint64 QBluetoothSocketWrapper::bytesToWrite() const
{
    if (m_PyMethodCache[2])
        return this->::QBluetoothSocket::bytesToWrite();
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return 0;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "bytesToWrite";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[2] = true;
        return this->::QBluetoothSocket::bytesToWrite();
    }

    Shiboken::AutoDecRef pyArgs(PyTuple_New(0));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return 0;
    }
    // Check return type
    Shiboken::Conversions::PythonToCppConversion pythonToCpp =
        Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<qint64>(), pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2,
            "Invalid return value in function %s, expected %s, got %s.",
            "QBluetoothSocket.bytesToWrite",
            "qint64",
            Py_TYPE(pyResult)->tp_name);
        return 0;
    }
    qint64 cppResult;
    pythonToCpp(pyResult, &cppResult);
    return cppResult;
}

bool QBluetoothSocketWrapper::canReadLine() const
{
    if (m_PyMethodCache[3])
        return this->::QBluetoothSocket::canReadLine();
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return false;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "canReadLine";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[3] = true;
        return this->::QBluetoothSocket::canReadLine();
    }

    Shiboken::AutoDecRef pyArgs(PyTuple_New(0));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return false;
    }
    // Check return type
    Shiboken::Conversions::PythonToCppConversion pythonToCpp =
        Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2,
            "Invalid return value in function %s, expected %s, got %s.",
            "QBluetoothSocket.canReadLine",
            "bool",
            Py_TYPE(pyResult)->tp_name);
        return false;
    }
    bool cppResult;
    pythonToCpp(pyResult, &cppResult);
    return cppResult;
}

void QBluetoothSocketWrapper::childEvent(QChildEvent * event)
{
    if (m_PyMethodCache[4]) {
        return this->::QObject::childEvent(event);
    }
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "childEvent";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[4] = true;
        return this->::QObject::childEvent(event);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(N)",
        Shiboken::Conversions::pointerToPython(SbkPySide6_QtCoreTypes[SBK_QCHILDEVENT_IDX], event)
    ));
    bool invalidateArg1 = PyTuple_GET_ITEM(pyArgs, 0)->ob_refcnt == 1;

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (invalidateArg1)
        Shiboken::Object::invalidate(PyTuple_GET_ITEM(pyArgs, 0));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return;
    }
}

void QBluetoothSocketWrapper::close()
{
    if (m_PyMethodCache[5]) {
        return this->::QBluetoothSocket::close();
    }
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "close";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[5] = true;
        return this->::QBluetoothSocket::close();
    }

    Shiboken::AutoDecRef pyArgs(PyTuple_New(0));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return;
    }
}

void QBluetoothSocketWrapper::connectNotify(const QMetaMethod & signal)
{
    if (m_PyMethodCache[6]) {
        return this->::QObject::connectNotify(signal);
    }
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "connectNotify";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[6] = true;
        return this->::QObject::connectNotify(signal);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(N)",
        Shiboken::Conversions::copyToPython(SbkPySide6_QtCoreTypes[SBK_QMETAMETHOD_IDX], &signal)
    ));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return;
    }
}

void QBluetoothSocketWrapper::customEvent(QEvent * event)
{
    if (m_PyMethodCache[7]) {
        return this->::QObject::customEvent(event);
    }
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "customEvent";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[7] = true;
        return this->::QObject::customEvent(event);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(N)",
        Shiboken::Conversions::pointerToPython(SbkPySide6_QtCoreTypes[SBK_QEVENT_IDX], event)
    ));
    bool invalidateArg1 = PyTuple_GET_ITEM(pyArgs, 0)->ob_refcnt == 1;

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (invalidateArg1)
        Shiboken::Object::invalidate(PyTuple_GET_ITEM(pyArgs, 0));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return;
    }
}

void QBluetoothSocketWrapper::disconnectNotify(const QMetaMethod & signal)
{
    if (m_PyMethodCache[8]) {
        return this->::QObject::disconnectNotify(signal);
    }
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "disconnectNotify";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[8] = true;
        return this->::QObject::disconnectNotify(signal);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(N)",
        Shiboken::Conversions::copyToPython(SbkPySide6_QtCoreTypes[SBK_QMETAMETHOD_IDX], &signal)
    ));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return;
    }
}

bool QBluetoothSocketWrapper::event(QEvent * event)
{
    if (m_PyMethodCache[9])
        return this->::QObject::event(event);
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return false;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "event";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[9] = true;
        return this->::QObject::event(event);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(N)",
        Shiboken::Conversions::pointerToPython(SbkPySide6_QtCoreTypes[SBK_QEVENT_IDX], event)
    ));
    bool invalidateArg1 = PyTuple_GET_ITEM(pyArgs, 0)->ob_refcnt == 1;

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (invalidateArg1)
        Shiboken::Object::invalidate(PyTuple_GET_ITEM(pyArgs, 0));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return false;
    }
    // Check return type
    Shiboken::Conversions::PythonToCppConversion pythonToCpp =
        Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2,
            "Invalid return value in function %s, expected %s, got %s.",
            "QBluetoothSocket.event",
            "bool",
            Py_TYPE(pyResult)->tp_name);
        return false;
    }
    bool cppResult;
    pythonToCpp(pyResult, &cppResult);
    return cppResult;
}

bool QBluetoothSocketWrapper::eventFilter(QObject * watched, QEvent * event)
{
    if (m_PyMethodCache[10])
        return this->::QObject::eventFilter(watched, event);
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return false;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "eventFilter";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[10] = true;
        return this->::QObject::eventFilter(watched, event);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(NN)",
        Shiboken::Conversions::pointerToPython(SbkPySide6_QtCoreTypes[SBK_QOBJECT_IDX], watched),
        Shiboken::Conversions::pointerToPython(SbkPySide6_QtCoreTypes[SBK_QEVENT_IDX], event)
    ));
    bool invalidateArg2 = PyTuple_GET_ITEM(pyArgs, 1)->ob_refcnt == 1;

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (invalidateArg2)
        Shiboken::Object::invalidate(PyTuple_GET_ITEM(pyArgs, 1));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return false;
    }
    // Check return type
    Shiboken::Conversions::PythonToCppConversion pythonToCpp =
        Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2,
            "Invalid return value in function %s, expected %s, got %s.",
            "QBluetoothSocket.eventFilter",
            "bool",
            Py_TYPE(pyResult)->tp_name);
        return false;
    }
    bool cppResult;
    pythonToCpp(pyResult, &cppResult);
    return cppResult;
}

bool QBluetoothSocketWrapper::isSequential() const
{
    if (m_PyMethodCache[11])
        return this->::QBluetoothSocket::isSequential();
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return false;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "isSequential";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[11] = true;
        return this->::QBluetoothSocket::isSequential();
    }

    Shiboken::AutoDecRef pyArgs(PyTuple_New(0));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return false;
    }
    // Check return type
    Shiboken::Conversions::PythonToCppConversion pythonToCpp =
        Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2,
            "Invalid return value in function %s, expected %s, got %s.",
            "QBluetoothSocket.isSequential",
            "bool",
            Py_TYPE(pyResult)->tp_name);
        return false;
    }
    bool cppResult;
    pythonToCpp(pyResult, &cppResult);
    return cppResult;
}

bool QBluetoothSocketWrapper::open(QFlags<QIODeviceBase::OpenModeFlag> mode)
{
    if (m_PyMethodCache[13])
        return this->::QIODevice::open(mode);
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return false;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "open";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[13] = true;
        return this->::QIODevice::open(mode);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(N)",
        Shiboken::Conversions::copyToPython(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtCoreTypes[SBK_QFLAGS_QIODEVICEBASE_OPENMODEFLAG_IDX]))->converter, &mode)
    ));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return false;
    }
    // Check return type
    Shiboken::Conversions::PythonToCppConversion pythonToCpp =
        Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2,
            "Invalid return value in function %s, expected %s, got %s.",
            "QBluetoothSocket.open",
            "bool",
            Py_TYPE(pyResult)->tp_name);
        return false;
    }
    bool cppResult;
    pythonToCpp(pyResult, &cppResult);
    return cppResult;
}

qint64 QBluetoothSocketWrapper::pos() const
{
    if (m_PyMethodCache[14])
        return this->::QIODevice::pos();
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return 0;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "pos";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[14] = true;
        return this->::QIODevice::pos();
    }

    Shiboken::AutoDecRef pyArgs(PyTuple_New(0));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return 0;
    }
    // Check return type
    Shiboken::Conversions::PythonToCppConversion pythonToCpp =
        Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<qint64>(), pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2,
            "Invalid return value in function %s, expected %s, got %s.",
            "QBluetoothSocket.pos",
            "qint64",
            Py_TYPE(pyResult)->tp_name);
        return 0;
    }
    qint64 cppResult;
    pythonToCpp(pyResult, &cppResult);
    return cppResult;
}

qint64 QBluetoothSocketWrapper::readData(char * data, qint64 maxSize)
{
    if (m_PyMethodCache[15]) {
        return this->::QBluetoothSocket::readData(data, maxSize);
    }
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return 0;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "readData";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[15] = true;
        return this->::QBluetoothSocket::readData(data, maxSize);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(L)",
        maxSize
    ));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return 0;
    }

    // Begin code injection
    // ========================================================================
    // START of custom code block [file: ../glue/qtcore.cpp (return-readData)]
    qint64 cppResult = 0;
    if (PyBytes_Check(pyResult.object())) {
        cppResult = PyBytes_GET_SIZE(pyResult.object());
        memcpy(data, PyBytes_AS_STRING(pyResult.object()), cppResult);
    } else if (Shiboken::String::check(pyResult.object())) {
        cppResult = Shiboken::String::len(pyResult.object());
        memcpy(data, Shiboken::String::toCString(pyResult.object()), cppResult);
    }
    // END of custom code block [file: ../glue/qtcore.cpp (return-readData)]
    // ========================================================================
    // End of code injection

    return cppResult;
}

qint64 QBluetoothSocketWrapper::readLineData(char * data, qint64 maxlen)
{
    if (m_PyMethodCache[16]) {
        return this->::QIODevice::readLineData(data, maxlen);
    }
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return 0;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "readLineData";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[16] = true;
        return this->::QIODevice::readLineData(data, maxlen);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(L)",
        maxlen
    ));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return 0;
    }

    // Begin code injection
    // ========================================================================
    // START of custom code block [file: ../glue/qtcore.cpp (return-readData)]
    qint64 cppResult = 0;
    if (PyBytes_Check(pyResult.object())) {
        cppResult = PyBytes_GET_SIZE(pyResult.object());
        memcpy(data, PyBytes_AS_STRING(pyResult.object()), cppResult);
    } else if (Shiboken::String::check(pyResult.object())) {
        cppResult = Shiboken::String::len(pyResult.object());
        memcpy(data, Shiboken::String::toCString(pyResult.object()), cppResult);
    }
    // END of custom code block [file: ../glue/qtcore.cpp (return-readData)]
    // ========================================================================
    // End of code injection

    return cppResult;
}

bool QBluetoothSocketWrapper::reset()
{
    if (m_PyMethodCache[17])
        return this->::QIODevice::reset();
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return false;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "reset";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[17] = true;
        return this->::QIODevice::reset();
    }

    Shiboken::AutoDecRef pyArgs(PyTuple_New(0));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return false;
    }
    // Check return type
    Shiboken::Conversions::PythonToCppConversion pythonToCpp =
        Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2,
            "Invalid return value in function %s, expected %s, got %s.",
            "QBluetoothSocket.reset",
            "bool",
            Py_TYPE(pyResult)->tp_name);
        return false;
    }
    bool cppResult;
    pythonToCpp(pyResult, &cppResult);
    return cppResult;
}

bool QBluetoothSocketWrapper::seek(qint64 pos)
{
    if (m_PyMethodCache[18])
        return this->::QIODevice::seek(pos);
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return false;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "seek";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[18] = true;
        return this->::QIODevice::seek(pos);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(L)",
        pos
    ));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return false;
    }
    // Check return type
    Shiboken::Conversions::PythonToCppConversion pythonToCpp =
        Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2,
            "Invalid return value in function %s, expected %s, got %s.",
            "QBluetoothSocket.seek",
            "bool",
            Py_TYPE(pyResult)->tp_name);
        return false;
    }
    bool cppResult;
    pythonToCpp(pyResult, &cppResult);
    return cppResult;
}

qint64 QBluetoothSocketWrapper::size() const
{
    if (m_PyMethodCache[19])
        return this->::QIODevice::size();
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return 0;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "size";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[19] = true;
        return this->::QIODevice::size();
    }

    Shiboken::AutoDecRef pyArgs(PyTuple_New(0));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return 0;
    }
    // Check return type
    Shiboken::Conversions::PythonToCppConversion pythonToCpp =
        Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<qint64>(), pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2,
            "Invalid return value in function %s, expected %s, got %s.",
            "QBluetoothSocket.size",
            "qint64",
            Py_TYPE(pyResult)->tp_name);
        return 0;
    }
    qint64 cppResult;
    pythonToCpp(pyResult, &cppResult);
    return cppResult;
}

qint64 QBluetoothSocketWrapper::skipData(qint64 maxSize)
{
    if (m_PyMethodCache[20])
        return this->::QIODevice::skipData(maxSize);
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return 0;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "skipData";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[20] = true;
        return this->::QIODevice::skipData(maxSize);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(L)",
        maxSize
    ));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return 0;
    }
    // Check return type
    Shiboken::Conversions::PythonToCppConversion pythonToCpp =
        Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<qint64>(), pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2,
            "Invalid return value in function %s, expected %s, got %s.",
            "QBluetoothSocket.skipData",
            "qint64",
            Py_TYPE(pyResult)->tp_name);
        return 0;
    }
    qint64 cppResult;
    pythonToCpp(pyResult, &cppResult);
    return cppResult;
}

void QBluetoothSocketWrapper::timerEvent(QTimerEvent * event)
{
    if (m_PyMethodCache[21]) {
        return this->::QObject::timerEvent(event);
    }
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "timerEvent";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[21] = true;
        return this->::QObject::timerEvent(event);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(N)",
        Shiboken::Conversions::pointerToPython(SbkPySide6_QtCoreTypes[SBK_QTIMEREVENT_IDX], event)
    ));
    bool invalidateArg1 = PyTuple_GET_ITEM(pyArgs, 0)->ob_refcnt == 1;

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (invalidateArg1)
        Shiboken::Object::invalidate(PyTuple_GET_ITEM(pyArgs, 0));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return;
    }
}

bool QBluetoothSocketWrapper::waitForBytesWritten(int msecs)
{
    if (m_PyMethodCache[22])
        return this->::QIODevice::waitForBytesWritten(msecs);
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return false;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "waitForBytesWritten";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[22] = true;
        return this->::QIODevice::waitForBytesWritten(msecs);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(i)",
        msecs
    ));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return false;
    }
    // Check return type
    Shiboken::Conversions::PythonToCppConversion pythonToCpp =
        Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2,
            "Invalid return value in function %s, expected %s, got %s.",
            "QBluetoothSocket.waitForBytesWritten",
            "bool",
            Py_TYPE(pyResult)->tp_name);
        return false;
    }
    bool cppResult;
    pythonToCpp(pyResult, &cppResult);
    return cppResult;
}

bool QBluetoothSocketWrapper::waitForReadyRead(int msecs)
{
    if (m_PyMethodCache[23])
        return this->::QIODevice::waitForReadyRead(msecs);
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return false;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "waitForReadyRead";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[23] = true;
        return this->::QIODevice::waitForReadyRead(msecs);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(i)",
        msecs
    ));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return false;
    }
    // Check return type
    Shiboken::Conversions::PythonToCppConversion pythonToCpp =
        Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2,
            "Invalid return value in function %s, expected %s, got %s.",
            "QBluetoothSocket.waitForReadyRead",
            "bool",
            Py_TYPE(pyResult)->tp_name);
        return false;
    }
    bool cppResult;
    pythonToCpp(pyResult, &cppResult);
    return cppResult;
}

qint64 QBluetoothSocketWrapper::writeData(const char * data, qint64 maxSize)
{
    if (m_PyMethodCache[24])
        return this->::QBluetoothSocket::writeData(data, maxSize);
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return 0;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "writeData";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[24] = true;
        return this->::QBluetoothSocket::writeData(data, maxSize);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(NL)",
        Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<const char *>(), data),
        maxSize
    ));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return 0;
    }
    // Check return type
    Shiboken::Conversions::PythonToCppConversion pythonToCpp =
        Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<qint64>(), pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2,
            "Invalid return value in function %s, expected %s, got %s.",
            "QBluetoothSocket.writeData",
            "qint64",
            Py_TYPE(pyResult)->tp_name);
        return 0;
    }
    qint64 cppResult;
    pythonToCpp(pyResult, &cppResult);
    return cppResult;
}

const QMetaObject *QBluetoothSocketWrapper::metaObject() const
{
    if (QObject::d_ptr->metaObject)
        return QObject::d_ptr->dynamicMetaObject();
    SbkObject *pySelf = Shiboken::BindingManager::instance().retrieveWrapper(this);
    if (pySelf == nullptr)
        return QBluetoothSocket::metaObject();
    return PySide::SignalManager::retrieveMetaObject(reinterpret_cast<PyObject *>(pySelf));
}

int QBluetoothSocketWrapper::qt_metacall(QMetaObject::Call call, int id, void **args)
{
    int result = QBluetoothSocket::qt_metacall(call, id, args);
    return result < 0 ? result : PySide::SignalManager::qt_metacall(this, call, id, args);
}

void *QBluetoothSocketWrapper::qt_metacast(const char *_clname)
{
    if (!_clname)
        return {};
    SbkObject *pySelf = Shiboken::BindingManager::instance().retrieveWrapper(this);
    if (pySelf && PySide::inherits(Py_TYPE(pySelf), _clname))
        return static_cast<void *>(const_cast< QBluetoothSocketWrapper *>(this));
    return QBluetoothSocket::qt_metacast(_clname);
}

QBluetoothSocketWrapper::~QBluetoothSocketWrapper()
{
    SbkObject *wrapper = Shiboken::BindingManager::instance().retrieveWrapper(this);
    Shiboken::Object::destroy(wrapper, this);
}

// Target ---------------------------------------------------------

extern "C" {
static int
Sbk_QBluetoothSocket_Init(PyObject *self, PyObject *args, PyObject *kwds)
{
    const QMetaObject *metaObject;
    SbkObject *sbkSelf = reinterpret_cast<SbkObject *>(self);
    PySide::Feature::Select(self);
    if (Shiboken::Object::isUserType(self) && !Shiboken::ObjectType::canCallConstructor(self->ob_type, Shiboken::SbkType< ::QBluetoothSocket >()))
        return -1;

    ::QBluetoothSocketWrapper *cptr{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.__init__";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp[2];
    SBK_UNUSED(pythonToCpp)
    const Py_ssize_t numArgs = PyTuple_GET_SIZE(args);
    SBK_UNUSED(numArgs)
    PyObject *pyArgs[] = {0, 0};

    // invalid argument lengths


    if (!PyArg_ParseTuple(args, "|OO:QBluetoothSocket", &(pyArgs[0]), &(pyArgs[1])))
        return -1;


    // Overloaded function decisor
    // 0: QBluetoothSocket::QBluetoothSocket(QBluetoothServiceInfo::Protocol,QObject*)
    // 1: QBluetoothSocket::QBluetoothSocket(QObject*)
    if (numArgs == 0) {
        overloadId = 1; // QBluetoothSocket(QObject*)
    } else if (numArgs >= 1
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppPointerConversion(SbkPySide6_QtCoreTypes[SBK_QOBJECT_IDX], (pyArgs[0])))) {
        overloadId = 1; // QBluetoothSocket(QObject*)
    } else if (numArgs >= 1
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppConversion(PepType_SETP(reinterpret_cast<SbkEnumType *>(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSERVICEINFO_PROTOCOL_IDX]))->converter, (pyArgs[0])))) {
        if (numArgs == 1) {
            overloadId = 0; // QBluetoothSocket(QBluetoothServiceInfo::Protocol,QObject*)
        } else if (numArgs >= 2
            && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppPointerConversion(SbkPySide6_QtCoreTypes[SBK_QOBJECT_IDX], (pyArgs[1])))) {
            overloadId = 0; // QBluetoothSocket(QBluetoothServiceInfo::Protocol,QObject*)
        }
    }

    // Function signature not found.
    if (overloadId == -1) goto Sbk_QBluetoothSocket_Init_TypeError;

    // Call function/method
    switch (overloadId) {
        case 0: // QBluetoothSocket(QBluetoothServiceInfo::Protocol socketType, QObject * parent)
        {
            if (kwds && PyDict_Size(kwds) > 0) {
                PyObject *value{};
                Shiboken::AutoDecRef kwds_dup(PyDict_Copy(kwds));
                static PyObject *const key_parent = Shiboken::String::createStaticString("parent");
                if (PyDict_Contains(kwds, key_parent)) {
                    value = PyDict_GetItem(kwds, key_parent);
                    if (value && pyArgs[1]) {
                        errInfo.reset(key_parent);
                        Py_INCREF(errInfo.object());
                        goto Sbk_QBluetoothSocket_Init_TypeError;
                    }
                    if (value) {
                        pyArgs[1] = value;
                        if (!(pythonToCpp[1] = Shiboken::Conversions::pythonToCppPointerConversion(SbkPySide6_QtCoreTypes[SBK_QOBJECT_IDX], (pyArgs[1]))))
                            goto Sbk_QBluetoothSocket_Init_TypeError;
                    }
                    PyDict_DelItem(kwds_dup, key_parent);
                }
                if (PyDict_Size(kwds_dup) > 0) {
                    errInfo.reset(kwds_dup.release());
                    // fall through to handle extra keyword signals and properties
                }
            }
            ::QBluetoothServiceInfo::Protocol cppArg0{QBluetoothServiceInfo::UnknownProtocol};
            pythonToCpp[0](pyArgs[0], &cppArg0);
            if (!Shiboken::Object::isValid(pyArgs[1]))
                return -1;
            ::QObject *cppArg1 = nullptr;
            if (pythonToCpp[1])
                pythonToCpp[1](pyArgs[1], &cppArg1);

            if (!PyErr_Occurred()) {
                // QBluetoothSocket(QBluetoothServiceInfo::Protocol,QObject*)
                void *addr = PySide::nextQObjectMemoryAddr();
                if (addr) {
                    cptr = new (addr) ::QBluetoothSocketWrapper(cppArg0, cppArg1);
                    PySide::setNextQObjectMemoryAddr(0);
                } else {
                    cptr = new ::QBluetoothSocketWrapper(cppArg0, cppArg1);
                }

                Shiboken::Object::setParent(pyArgs[1], self);
            }
            break;
        }
        case 1: // QBluetoothSocket(QObject * parent)
        {
            if (kwds && PyDict_Size(kwds) > 0) {
                PyObject *value{};
                Shiboken::AutoDecRef kwds_dup(PyDict_Copy(kwds));
                static PyObject *const key_parent = Shiboken::String::createStaticString("parent");
                if (PyDict_Contains(kwds, key_parent)) {
                    value = PyDict_GetItem(kwds, key_parent);
                    if (value && pyArgs[0]) {
                        errInfo.reset(key_parent);
                        Py_INCREF(errInfo.object());
                        goto Sbk_QBluetoothSocket_Init_TypeError;
                    }
                    if (value) {
                        pyArgs[0] = value;
                        if (!(pythonToCpp[0] = Shiboken::Conversions::pythonToCppPointerConversion(SbkPySide6_QtCoreTypes[SBK_QOBJECT_IDX], (pyArgs[0]))))
                            goto Sbk_QBluetoothSocket_Init_TypeError;
                    }
                    PyDict_DelItem(kwds_dup, key_parent);
                }
                if (PyDict_Size(kwds_dup) > 0) {
                    errInfo.reset(kwds_dup.release());
                    // fall through to handle extra keyword signals and properties
                }
            }
            if (!Shiboken::Object::isValid(pyArgs[0]))
                return -1;
            ::QObject *cppArg0 = nullptr;
            if (pythonToCpp[0])
                pythonToCpp[0](pyArgs[0], &cppArg0);

            if (!PyErr_Occurred()) {
                // QBluetoothSocket(QObject*)
                void *addr = PySide::nextQObjectMemoryAddr();
                if (addr) {
                    cptr = new (addr) ::QBluetoothSocketWrapper(cppArg0);
                    PySide::setNextQObjectMemoryAddr(0);
                } else {
                    cptr = new ::QBluetoothSocketWrapper(cppArg0);
                }

                Shiboken::Object::setParent(pyArgs[0], self);
            }
            break;
        }
    }

    if (PyErr_Occurred() || !Shiboken::Object::setCppPointer(sbkSelf, Shiboken::SbkType< ::QBluetoothSocket >(), cptr)) {
        delete cptr;
        return -1;
    }
    if (!cptr) goto Sbk_QBluetoothSocket_Init_TypeError;

    Shiboken::Object::setValidCpp(sbkSelf, true);
    Shiboken::Object::setHasCppWrapper(sbkSelf, true);
    if (Shiboken::BindingManager::instance().hasWrapper(cptr)) {
        Shiboken::BindingManager::instance().releaseWrapper(Shiboken::BindingManager::instance().retrieveWrapper(cptr));
    }
    Shiboken::BindingManager::instance().registerWrapper(sbkSelf, cptr);

    // QObject setup
    PySide::Signal::updateSourceObject(self);
    metaObject = cptr->metaObject(); // <- init python qt properties
    if (!errInfo.isNull() && PyDict_Check(errInfo.object())) {
        if (!PySide::fillQtProperties(self, metaObject, errInfo))
            goto Sbk_QBluetoothSocket_Init_TypeError;
    };


    return 1;

    Sbk_QBluetoothSocket_Init_TypeError:
        Shiboken::setErrorAboutWrongArguments(args, fullName, errInfo);
        return -1;
}

static PyObject *Sbk_QBluetoothSocketFunc_abort(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.abort";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // abort()
            cppSelf->abort();
        }
    }

    if (PyErr_Occurred()) {
        return {};
    }
    Py_RETURN_NONE;
}

static PyObject *Sbk_QBluetoothSocketFunc_bytesAvailable(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.bytesAvailable";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // bytesAvailable()const
            qint64 cppResult = Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(self))
                ? const_cast<const ::QBluetoothSocket *>(cppSelf)->::QBluetoothSocket::bytesAvailable()
                : const_cast<const ::QBluetoothSocket *>(cppSelf)->bytesAvailable();
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<qint64>(), &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QBluetoothSocketFunc_bytesToWrite(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.bytesToWrite";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // bytesToWrite()const
            qint64 cppResult = Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(self))
                ? const_cast<const ::QBluetoothSocket *>(cppSelf)->::QBluetoothSocket::bytesToWrite()
                : const_cast<const ::QBluetoothSocket *>(cppSelf)->bytesToWrite();
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<qint64>(), &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QBluetoothSocketFunc_canReadLine(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.canReadLine";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // canReadLine()const
            bool cppResult = Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(self))
                ? const_cast<const ::QBluetoothSocket *>(cppSelf)->::QBluetoothSocket::canReadLine()
                : const_cast<const ::QBluetoothSocket *>(cppSelf)->canReadLine();
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QBluetoothSocketFunc_close(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.close";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // close()
            Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(self))
                ? cppSelf->::QBluetoothSocket::close()
                : cppSelf->close();
        }
    }

    if (PyErr_Occurred()) {
        return {};
    }
    Py_RETURN_NONE;
}

static PyObject *Sbk_QBluetoothSocketFunc_connectToService(PyObject *self, PyObject *args, PyObject *kwds)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.connectToService";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp[3];
    SBK_UNUSED(pythonToCpp)
    const Py_ssize_t numArgs = PyTuple_GET_SIZE(args);
    SBK_UNUSED(numArgs)
    PyObject *pyArgs[] = {0, 0, 0};

    // invalid argument lengths
    if (numArgs > 3) {
        static PyObject *const too_many = Shiboken::String::createStaticString(">");
        errInfo.reset(too_many);
        Py_INCREF(errInfo.object());
        goto Sbk_QBluetoothSocketFunc_connectToService_TypeError;
    } else if (numArgs < 1) {
        static PyObject *const too_few = Shiboken::String::createStaticString("<");
        errInfo.reset(too_few);
        Py_INCREF(errInfo.object());
        goto Sbk_QBluetoothSocketFunc_connectToService_TypeError;
    }

    if (!PyArg_ParseTuple(args, "|OOO:connectToService", &(pyArgs[0]), &(pyArgs[1]), &(pyArgs[2])))
        return {};


    // Overloaded function decisor
    // 0: QBluetoothSocket::connectToService(QBluetoothAddress,QBluetoothUuid::ServiceClassUuid,QFlags<QIODeviceBase::OpenModeFlag>)
    // 1: QBluetoothSocket::connectToService(QBluetoothAddress,QBluetoothUuid,QFlags<QIODeviceBase::OpenModeFlag>)
    // 2: QBluetoothSocket::connectToService(QBluetoothAddress,quint16,QFlags<QIODeviceBase::OpenModeFlag>)
    // 3: QBluetoothSocket::connectToService(QBluetoothServiceInfo,QFlags<QIODeviceBase::OpenModeFlag>)
    if (numArgs >= 1
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppReferenceConversion(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSERVICEINFO_IDX], (pyArgs[0])))) {
        if (numArgs == 1) {
            overloadId = 3; // connectToService(QBluetoothServiceInfo,QFlags<QIODeviceBase::OpenModeFlag>)
        } else if (numArgs >= 2
            && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppConversion(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtCoreTypes[SBK_QFLAGS_QIODEVICEBASE_OPENMODEFLAG_IDX]))->converter, (pyArgs[1])))) {
            overloadId = 3; // connectToService(QBluetoothServiceInfo,QFlags<QIODeviceBase::OpenModeFlag>)
        }
    } else if (numArgs >= 1
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppReferenceConversion(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHADDRESS_IDX], (pyArgs[0])))) {
        if (numArgs >= 2
            && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppConversion(PepType_SETP(reinterpret_cast<SbkEnumType *>(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHUUID_SERVICECLASSUUID_IDX]))->converter, (pyArgs[1])))) {
            if (numArgs == 2) {
                overloadId = 0; // connectToService(QBluetoothAddress,QBluetoothUuid::ServiceClassUuid,QFlags<QIODeviceBase::OpenModeFlag>)
            } else if (numArgs >= 3
                && (pythonToCpp[2] = Shiboken::Conversions::pythonToCppConversion(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtCoreTypes[SBK_QFLAGS_QIODEVICEBASE_OPENMODEFLAG_IDX]))->converter, (pyArgs[2])))) {
                overloadId = 0; // connectToService(QBluetoothAddress,QBluetoothUuid::ServiceClassUuid,QFlags<QIODeviceBase::OpenModeFlag>)
            }
        } else if (numArgs >= 2
            && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppReferenceConversion(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHUUID_IDX], (pyArgs[1])))) {
            if (numArgs == 2) {
                overloadId = 1; // connectToService(QBluetoothAddress,QBluetoothUuid,QFlags<QIODeviceBase::OpenModeFlag>)
            } else if (numArgs >= 3
                && (pythonToCpp[2] = Shiboken::Conversions::pythonToCppConversion(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtCoreTypes[SBK_QFLAGS_QIODEVICEBASE_OPENMODEFLAG_IDX]))->converter, (pyArgs[2])))) {
                overloadId = 1; // connectToService(QBluetoothAddress,QBluetoothUuid,QFlags<QIODeviceBase::OpenModeFlag>)
            }
        } else if (numArgs >= 2
            && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<quint16>(), (pyArgs[1])))) {
            if (numArgs == 2) {
                overloadId = 2; // connectToService(QBluetoothAddress,quint16,QFlags<QIODeviceBase::OpenModeFlag>)
            } else if (numArgs >= 3
                && (pythonToCpp[2] = Shiboken::Conversions::pythonToCppConversion(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtCoreTypes[SBK_QFLAGS_QIODEVICEBASE_OPENMODEFLAG_IDX]))->converter, (pyArgs[2])))) {
                overloadId = 2; // connectToService(QBluetoothAddress,quint16,QFlags<QIODeviceBase::OpenModeFlag>)
            }
        }
    }

    // Function signature not found.
    if (overloadId == -1) goto Sbk_QBluetoothSocketFunc_connectToService_TypeError;

    // Call function/method
    switch (overloadId) {
        case 0: // connectToService(const QBluetoothAddress & address, QBluetoothUuid::ServiceClassUuid uuid, QFlags<QIODeviceBase::OpenModeFlag> mode)
        {
            if (kwds && PyDict_Size(kwds) > 0) {
                PyObject *value{};
                Shiboken::AutoDecRef kwds_dup(PyDict_Copy(kwds));
                static PyObject *const key_mode = Shiboken::String::createStaticString("mode");
                if (PyDict_Contains(kwds, key_mode)) {
                    value = PyDict_GetItem(kwds, key_mode);
                    if (value && pyArgs[2]) {
                        errInfo.reset(key_mode);
                        Py_INCREF(errInfo.object());
                        goto Sbk_QBluetoothSocketFunc_connectToService_TypeError;
                    }
                    if (value) {
                        pyArgs[2] = value;
                        if (!(pythonToCpp[2] = Shiboken::Conversions::pythonToCppConversion(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtCoreTypes[SBK_QFLAGS_QIODEVICEBASE_OPENMODEFLAG_IDX]))->converter, (pyArgs[2]))))
                            goto Sbk_QBluetoothSocketFunc_connectToService_TypeError;
                    }
                    PyDict_DelItem(kwds_dup, key_mode);
                }
                if (PyDict_Size(kwds_dup) > 0) {
                    errInfo.reset(kwds_dup.release());
                    goto Sbk_QBluetoothSocketFunc_connectToService_TypeError;
                }
            }
            if (!Shiboken::Object::isValid(pyArgs[0]))
                return {};
            ::QBluetoothAddress cppArg0_local;
            ::QBluetoothAddress *cppArg0 = &cppArg0_local;
            if (pythonToCpp[0].isValue())
                pythonToCpp[0](pyArgs[0], &cppArg0_local);
            else
                pythonToCpp[0](pyArgs[0], &cppArg0);

            ::QBluetoothUuid::ServiceClassUuid cppArg1 = static_cast< ::QBluetoothUuid::ServiceClassUuid>(0);
            pythonToCpp[1](pyArgs[1], &cppArg1);
            ::QFlags<QIODeviceBase::OpenModeFlag> cppArg2(QIODeviceBase::OpenModeFlag::ReadWrite);
            if (pythonToCpp[2])
                pythonToCpp[2](pyArgs[2], &cppArg2);

            if (!PyErr_Occurred()) {
                // connectToService(QBluetoothAddress,QBluetoothUuid::ServiceClassUuid,QFlags<QIODeviceBase::OpenModeFlag>)
                cppSelf->connectToService(*cppArg0, cppArg1, cppArg2);
            }
            break;
        }
        case 1: // connectToService(const QBluetoothAddress & address, const QBluetoothUuid & uuid, QFlags<QIODeviceBase::OpenModeFlag> openMode)
        {
            if (kwds && PyDict_Size(kwds) > 0) {
                PyObject *value{};
                Shiboken::AutoDecRef kwds_dup(PyDict_Copy(kwds));
                static PyObject *const key_openMode = Shiboken::String::createStaticString("openMode");
                if (PyDict_Contains(kwds, key_openMode)) {
                    value = PyDict_GetItem(kwds, key_openMode);
                    if (value && pyArgs[2]) {
                        errInfo.reset(key_openMode);
                        Py_INCREF(errInfo.object());
                        goto Sbk_QBluetoothSocketFunc_connectToService_TypeError;
                    }
                    if (value) {
                        pyArgs[2] = value;
                        if (!(pythonToCpp[2] = Shiboken::Conversions::pythonToCppConversion(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtCoreTypes[SBK_QFLAGS_QIODEVICEBASE_OPENMODEFLAG_IDX]))->converter, (pyArgs[2]))))
                            goto Sbk_QBluetoothSocketFunc_connectToService_TypeError;
                    }
                    PyDict_DelItem(kwds_dup, key_openMode);
                }
                if (PyDict_Size(kwds_dup) > 0) {
                    errInfo.reset(kwds_dup.release());
                    goto Sbk_QBluetoothSocketFunc_connectToService_TypeError;
                }
            }
            if (!Shiboken::Object::isValid(pyArgs[0]))
                return {};
            ::QBluetoothAddress cppArg0_local;
            ::QBluetoothAddress *cppArg0 = &cppArg0_local;
            if (pythonToCpp[0].isValue())
                pythonToCpp[0](pyArgs[0], &cppArg0_local);
            else
                pythonToCpp[0](pyArgs[0], &cppArg0);

            if (!Shiboken::Object::isValid(pyArgs[1]))
                return {};
            ::QBluetoothUuid cppArg1_local;
            ::QBluetoothUuid *cppArg1 = &cppArg1_local;
            if (pythonToCpp[1].isValue())
                pythonToCpp[1](pyArgs[1], &cppArg1_local);
            else
                pythonToCpp[1](pyArgs[1], &cppArg1);

            ::QFlags<QIODeviceBase::OpenModeFlag> cppArg2(QIODeviceBase::OpenModeFlag::ReadWrite);
            if (pythonToCpp[2])
                pythonToCpp[2](pyArgs[2], &cppArg2);

            if (!PyErr_Occurred()) {
                // connectToService(QBluetoothAddress,QBluetoothUuid,QFlags<QIODeviceBase::OpenModeFlag>)
                cppSelf->connectToService(*cppArg0, *cppArg1, cppArg2);
            }
            break;
        }
        case 2: // connectToService(const QBluetoothAddress & address, quint16 port, QFlags<QIODeviceBase::OpenModeFlag> openMode)
        {
            if (kwds && PyDict_Size(kwds) > 0) {
                PyObject *value{};
                Shiboken::AutoDecRef kwds_dup(PyDict_Copy(kwds));
                static PyObject *const key_openMode = Shiboken::String::createStaticString("openMode");
                if (PyDict_Contains(kwds, key_openMode)) {
                    value = PyDict_GetItem(kwds, key_openMode);
                    if (value && pyArgs[2]) {
                        errInfo.reset(key_openMode);
                        Py_INCREF(errInfo.object());
                        goto Sbk_QBluetoothSocketFunc_connectToService_TypeError;
                    }
                    if (value) {
                        pyArgs[2] = value;
                        if (!(pythonToCpp[2] = Shiboken::Conversions::pythonToCppConversion(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtCoreTypes[SBK_QFLAGS_QIODEVICEBASE_OPENMODEFLAG_IDX]))->converter, (pyArgs[2]))))
                            goto Sbk_QBluetoothSocketFunc_connectToService_TypeError;
                    }
                    PyDict_DelItem(kwds_dup, key_openMode);
                }
                if (PyDict_Size(kwds_dup) > 0) {
                    errInfo.reset(kwds_dup.release());
                    goto Sbk_QBluetoothSocketFunc_connectToService_TypeError;
                }
            }
            if (!Shiboken::Object::isValid(pyArgs[0]))
                return {};
            ::QBluetoothAddress cppArg0_local;
            ::QBluetoothAddress *cppArg0 = &cppArg0_local;
            if (pythonToCpp[0].isValue())
                pythonToCpp[0](pyArgs[0], &cppArg0_local);
            else
                pythonToCpp[0](pyArgs[0], &cppArg0);

            quint16 cppArg1;
            pythonToCpp[1](pyArgs[1], &cppArg1);
            ::QFlags<QIODeviceBase::OpenModeFlag> cppArg2(QIODeviceBase::OpenModeFlag::ReadWrite);
            if (pythonToCpp[2])
                pythonToCpp[2](pyArgs[2], &cppArg2);

            if (!PyErr_Occurred()) {
                // connectToService(QBluetoothAddress,quint16,QFlags<QIODeviceBase::OpenModeFlag>)
                cppSelf->connectToService(*cppArg0, cppArg1, cppArg2);
            }
            break;
        }
        case 3: // connectToService(const QBluetoothServiceInfo & service, QFlags<QIODeviceBase::OpenModeFlag> openMode)
        {
            if (kwds && PyDict_Size(kwds) > 0) {
                PyObject *value{};
                Shiboken::AutoDecRef kwds_dup(PyDict_Copy(kwds));
                static PyObject *const key_openMode = Shiboken::String::createStaticString("openMode");
                if (PyDict_Contains(kwds, key_openMode)) {
                    value = PyDict_GetItem(kwds, key_openMode);
                    if (value && pyArgs[1]) {
                        errInfo.reset(key_openMode);
                        Py_INCREF(errInfo.object());
                        goto Sbk_QBluetoothSocketFunc_connectToService_TypeError;
                    }
                    if (value) {
                        pyArgs[1] = value;
                        if (!(pythonToCpp[1] = Shiboken::Conversions::pythonToCppConversion(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtCoreTypes[SBK_QFLAGS_QIODEVICEBASE_OPENMODEFLAG_IDX]))->converter, (pyArgs[1]))))
                            goto Sbk_QBluetoothSocketFunc_connectToService_TypeError;
                    }
                    PyDict_DelItem(kwds_dup, key_openMode);
                }
                if (PyDict_Size(kwds_dup) > 0) {
                    errInfo.reset(kwds_dup.release());
                    goto Sbk_QBluetoothSocketFunc_connectToService_TypeError;
                }
            }
            if (!Shiboken::Object::isValid(pyArgs[0]))
                return {};
            ::QBluetoothServiceInfo cppArg0_local;
            ::QBluetoothServiceInfo *cppArg0 = &cppArg0_local;
            if (pythonToCpp[0].isValue())
                pythonToCpp[0](pyArgs[0], &cppArg0_local);
            else
                pythonToCpp[0](pyArgs[0], &cppArg0);

            ::QFlags<QIODeviceBase::OpenModeFlag> cppArg1(QIODeviceBase::OpenModeFlag::ReadWrite);
            if (pythonToCpp[1])
                pythonToCpp[1](pyArgs[1], &cppArg1);

            if (!PyErr_Occurred()) {
                // connectToService(QBluetoothServiceInfo,QFlags<QIODeviceBase::OpenModeFlag>)
                cppSelf->connectToService(*cppArg0, cppArg1);
            }
            break;
        }
    }

    if (PyErr_Occurred()) {
        return {};
    }
    Py_RETURN_NONE;

    Sbk_QBluetoothSocketFunc_connectToService_TypeError:
        Shiboken::setErrorAboutWrongArguments(args, fullName, errInfo);
        return {};
}

static PyObject *Sbk_QBluetoothSocketFunc_disconnectFromService(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.disconnectFromService";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // disconnectFromService()
            cppSelf->disconnectFromService();
        }
    }

    if (PyErr_Occurred()) {
        return {};
    }
    Py_RETURN_NONE;
}

static PyObject *Sbk_QBluetoothSocketFunc_doDeviceDiscovery(PyObject *self, PyObject *args)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.doDeviceDiscovery";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp[2];
    SBK_UNUSED(pythonToCpp)
    const Py_ssize_t numArgs = PyTuple_GET_SIZE(args);
    SBK_UNUSED(numArgs)
    PyObject *pyArgs[] = {0, 0};

    // invalid argument lengths


    if (!PyArg_UnpackTuple(args, "doDeviceDiscovery", 2, 2, &(pyArgs[0]), &(pyArgs[1])))
        return {};


    // Overloaded function decisor
    // 0: QBluetoothSocket::doDeviceDiscovery(QBluetoothServiceInfo,QFlags<QIODeviceBase::OpenModeFlag>)
    if (numArgs == 2
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppReferenceConversion(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSERVICEINFO_IDX], (pyArgs[0])))
        && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppConversion(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtCoreTypes[SBK_QFLAGS_QIODEVICEBASE_OPENMODEFLAG_IDX]))->converter, (pyArgs[1])))) {
        overloadId = 0; // doDeviceDiscovery(QBluetoothServiceInfo,QFlags<QIODeviceBase::OpenModeFlag>)
    }

    // Function signature not found.
    if (overloadId == -1) goto Sbk_QBluetoothSocketFunc_doDeviceDiscovery_TypeError;

    // Call function/method
    {
        if (!Shiboken::Object::isValid(pyArgs[0]))
            return {};
        ::QBluetoothServiceInfo cppArg0_local;
        ::QBluetoothServiceInfo *cppArg0 = &cppArg0_local;
        if (pythonToCpp[0].isValue())
            pythonToCpp[0](pyArgs[0], &cppArg0_local);
        else
            pythonToCpp[0](pyArgs[0], &cppArg0);

        ::QFlags<QIODeviceBase::OpenModeFlag> cppArg1 = QFlags<QIODeviceBase::OpenModeFlag>(0);
        pythonToCpp[1](pyArgs[1], &cppArg1);

        if (!PyErr_Occurred()) {
            // doDeviceDiscovery(QBluetoothServiceInfo,QFlags<QIODeviceBase::OpenModeFlag>)
            cppSelf->doDeviceDiscovery(*cppArg0, cppArg1);
        }
    }

    if (PyErr_Occurred()) {
        return {};
    }
    Py_RETURN_NONE;

    Sbk_QBluetoothSocketFunc_doDeviceDiscovery_TypeError:
        Shiboken::setErrorAboutWrongArguments(args, fullName, errInfo);
        return {};
}

static PyObject *Sbk_QBluetoothSocketFunc_error(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.error";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // error()const
            QBluetoothSocket::SocketError cppResult = const_cast<const ::QBluetoothSocket *>(cppSelf)->error();
            pyResult = Shiboken::Conversions::copyToPython(PepType_SETP(reinterpret_cast<SbkEnumType *>(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETERROR_IDX]))->converter, &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QBluetoothSocketFunc_errorString(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.errorString";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // errorString()const
            QString cppResult = const_cast<const ::QBluetoothSocket *>(cppSelf)->errorString();
            pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtCoreTypeConverters[SBK_QSTRING_IDX], &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QBluetoothSocketFunc_isSequential(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.isSequential";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // isSequential()const
            bool cppResult = Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(self))
                ? const_cast<const ::QBluetoothSocket *>(cppSelf)->::QBluetoothSocket::isSequential()
                : const_cast<const ::QBluetoothSocket *>(cppSelf)->isSequential();
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QBluetoothSocketFunc_localAddress(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.localAddress";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // localAddress()const
            QBluetoothAddress cppResult = const_cast<const ::QBluetoothSocket *>(cppSelf)->localAddress();
            pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHADDRESS_IDX], &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QBluetoothSocketFunc_localName(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.localName";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // localName()const
            QString cppResult = const_cast<const ::QBluetoothSocket *>(cppSelf)->localName();
            pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtCoreTypeConverters[SBK_QSTRING_IDX], &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QBluetoothSocketFunc_localPort(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.localPort";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // localPort()const
            quint16 cppResult = const_cast<const ::QBluetoothSocket *>(cppSelf)->localPort();
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<quint16>(), &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QBluetoothSocketFunc_peerAddress(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.peerAddress";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // peerAddress()const
            QBluetoothAddress cppResult = const_cast<const ::QBluetoothSocket *>(cppSelf)->peerAddress();
            pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHADDRESS_IDX], &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QBluetoothSocketFunc_peerName(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.peerName";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // peerName()const
            QString cppResult = const_cast<const ::QBluetoothSocket *>(cppSelf)->peerName();
            pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtCoreTypeConverters[SBK_QSTRING_IDX], &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QBluetoothSocketFunc_peerPort(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.peerPort";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // peerPort()const
            quint16 cppResult = const_cast<const ::QBluetoothSocket *>(cppSelf)->peerPort();
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<quint16>(), &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QBluetoothSocketFunc_preferredSecurityFlags(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.preferredSecurityFlags";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // preferredSecurityFlags()const
            QFlags<QBluetooth::Security> cppResult = const_cast<const ::QBluetoothSocket *>(cppSelf)->preferredSecurityFlags();
            pyResult = Shiboken::Conversions::copyToPython(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtBluetoothTypes[SBK_QFLAGS_QBLUETOOTH_SECURITY_IDX]))->converter, &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QBluetoothSocketFunc_readData(PyObject *self, PyObject *pyArg)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.readData";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp;
    SBK_UNUSED(pythonToCpp)

    // Overloaded function decisor
    // 0: QIODevice::readData(char*,qint64)->PyObject
    if ((pythonToCpp = Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<qint64>(), (pyArg)))) {
        overloadId = 0; // readData(char*,qint64)
    }

    // Function signature not found.
    if (overloadId == -1) goto Sbk_QBluetoothSocketFunc_readData_TypeError;

    // Call function/method
    {
        qint64 cppArg0;
        pythonToCpp(pyArg, &cppArg0);

        if (!PyErr_Occurred()) {
            // readData(char*,qint64)
            // Begin code injection
            // ========================================================================
            // START of custom code block [file: ../glue/qtcore.cpp (qiodevice-readData)]
            QByteArray ba(1 + qsizetype(cppArg0), char(0));
            Py_BEGIN_ALLOW_THREADS
            (Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(self)) ? cppSelf->::QBluetoothSocket::readData(ba.data(), qint64(cppArg0)) : cppSelf->readData(ba.data(), qint64(cppArg0)));
            Py_END_ALLOW_THREADS
            pyResult = Shiboken::String::fromCString(ba.constData());
            // END of custom code block [file: ../glue/qtcore.cpp (qiodevice-readData)]
            // ========================================================================
            // End of code injection

        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;

    Sbk_QBluetoothSocketFunc_readData_TypeError:
        Shiboken::setErrorAboutWrongArguments(pyArg, fullName, errInfo);
        return {};
}

static PyObject *Sbk_QBluetoothSocketFunc_setPreferredSecurityFlags(PyObject *self, PyObject *pyArg)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.setPreferredSecurityFlags";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp;
    SBK_UNUSED(pythonToCpp)

    // Overloaded function decisor
    // 0: QBluetoothSocket::setPreferredSecurityFlags(QFlags<QBluetooth::Security>)
    if ((pythonToCpp = Shiboken::Conversions::pythonToCppConversion(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtBluetoothTypes[SBK_QFLAGS_QBLUETOOTH_SECURITY_IDX]))->converter, (pyArg)))) {
        overloadId = 0; // setPreferredSecurityFlags(QFlags<QBluetooth::Security>)
    }

    // Function signature not found.
    if (overloadId == -1) goto Sbk_QBluetoothSocketFunc_setPreferredSecurityFlags_TypeError;

    // Call function/method
    {
        ::QFlags<QBluetooth::Security> cppArg0 = QFlags<QBluetooth::Security>(0);
        pythonToCpp(pyArg, &cppArg0);

        if (!PyErr_Occurred()) {
            // setPreferredSecurityFlags(QFlags<QBluetooth::Security>)
            cppSelf->setPreferredSecurityFlags(cppArg0);
        }
    }

    if (PyErr_Occurred()) {
        return {};
    }
    Py_RETURN_NONE;

    Sbk_QBluetoothSocketFunc_setPreferredSecurityFlags_TypeError:
        Shiboken::setErrorAboutWrongArguments(pyArg, fullName, errInfo);
        return {};
}

static PyObject *Sbk_QBluetoothSocketFunc_setSocketDescriptor(PyObject *self, PyObject *args, PyObject *kwds)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.setSocketDescriptor";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp[4];
    SBK_UNUSED(pythonToCpp)
    const Py_ssize_t numArgs = PyTuple_GET_SIZE(args);
    SBK_UNUSED(numArgs)
    PyObject *pyArgs[] = {0, 0, 0, 0};

    // invalid argument lengths
    if (numArgs > 4) {
        static PyObject *const too_many = Shiboken::String::createStaticString(">");
        errInfo.reset(too_many);
        Py_INCREF(errInfo.object());
        goto Sbk_QBluetoothSocketFunc_setSocketDescriptor_TypeError;
    } else if (numArgs < 2) {
        static PyObject *const too_few = Shiboken::String::createStaticString("<");
        errInfo.reset(too_few);
        Py_INCREF(errInfo.object());
        goto Sbk_QBluetoothSocketFunc_setSocketDescriptor_TypeError;
    }

    if (!PyArg_ParseTuple(args, "|OOOO:setSocketDescriptor", &(pyArgs[0]), &(pyArgs[1]), &(pyArgs[2]), &(pyArgs[3])))
        return {};


    // Overloaded function decisor
    // 0: QBluetoothSocket::setSocketDescriptor(int,QBluetoothServiceInfo::Protocol,QBluetoothSocket::SocketState,QFlags<QIODeviceBase::OpenModeFlag>)->bool
    if (numArgs >= 2
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<int>(), (pyArgs[0])))
        && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppConversion(PepType_SETP(reinterpret_cast<SbkEnumType *>(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSERVICEINFO_PROTOCOL_IDX]))->converter, (pyArgs[1])))) {
        if (numArgs == 2) {
            overloadId = 0; // setSocketDescriptor(int,QBluetoothServiceInfo::Protocol,QBluetoothSocket::SocketState,QFlags<QIODeviceBase::OpenModeFlag>)
        } else if (numArgs >= 3
            && (pythonToCpp[2] = Shiboken::Conversions::pythonToCppConversion(PepType_SETP(reinterpret_cast<SbkEnumType *>(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETSTATE_IDX]))->converter, (pyArgs[2])))) {
            if (numArgs == 3) {
                overloadId = 0; // setSocketDescriptor(int,QBluetoothServiceInfo::Protocol,QBluetoothSocket::SocketState,QFlags<QIODeviceBase::OpenModeFlag>)
            } else if (numArgs >= 4
                && (pythonToCpp[3] = Shiboken::Conversions::pythonToCppConversion(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtCoreTypes[SBK_QFLAGS_QIODEVICEBASE_OPENMODEFLAG_IDX]))->converter, (pyArgs[3])))) {
                overloadId = 0; // setSocketDescriptor(int,QBluetoothServiceInfo::Protocol,QBluetoothSocket::SocketState,QFlags<QIODeviceBase::OpenModeFlag>)
            }
        }
    }

    // Function signature not found.
    if (overloadId == -1) goto Sbk_QBluetoothSocketFunc_setSocketDescriptor_TypeError;

    // Call function/method
    {
        if (kwds && PyDict_Size(kwds) > 0) {
            PyObject *value{};
            Shiboken::AutoDecRef kwds_dup(PyDict_Copy(kwds));
            static PyObject *const key_socketState = Shiboken::String::createStaticString("socketState");
            if (PyDict_Contains(kwds, key_socketState)) {
                value = PyDict_GetItem(kwds, key_socketState);
                if (value && pyArgs[2]) {
                    errInfo.reset(key_socketState);
                    Py_INCREF(errInfo.object());
                    goto Sbk_QBluetoothSocketFunc_setSocketDescriptor_TypeError;
                }
                if (value) {
                    pyArgs[2] = value;
                    if (!(pythonToCpp[2] = Shiboken::Conversions::pythonToCppConversion(PepType_SETP(reinterpret_cast<SbkEnumType *>(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETSTATE_IDX]))->converter, (pyArgs[2]))))
                        goto Sbk_QBluetoothSocketFunc_setSocketDescriptor_TypeError;
                }
                PyDict_DelItem(kwds_dup, key_socketState);
            }
            static PyObject *const key_openMode = Shiboken::String::createStaticString("openMode");
            if (PyDict_Contains(kwds, key_openMode)) {
                value = PyDict_GetItem(kwds, key_openMode);
                if (value && pyArgs[3]) {
                    errInfo.reset(key_openMode);
                    Py_INCREF(errInfo.object());
                    goto Sbk_QBluetoothSocketFunc_setSocketDescriptor_TypeError;
                }
                if (value) {
                    pyArgs[3] = value;
                    if (!(pythonToCpp[3] = Shiboken::Conversions::pythonToCppConversion(PepType_PFTP(reinterpret_cast<PySideQFlagsType *>(SbkPySide6_QtCoreTypes[SBK_QFLAGS_QIODEVICEBASE_OPENMODEFLAG_IDX]))->converter, (pyArgs[3]))))
                        goto Sbk_QBluetoothSocketFunc_setSocketDescriptor_TypeError;
                }
                PyDict_DelItem(kwds_dup, key_openMode);
            }
            if (PyDict_Size(kwds_dup) > 0) {
                errInfo.reset(kwds_dup.release());
                goto Sbk_QBluetoothSocketFunc_setSocketDescriptor_TypeError;
            }
        }
        int cppArg0;
        pythonToCpp[0](pyArgs[0], &cppArg0);
        ::QBluetoothServiceInfo::Protocol cppArg1{QBluetoothServiceInfo::UnknownProtocol};
        pythonToCpp[1](pyArgs[1], &cppArg1);
        ::QBluetoothSocket::SocketState cppArg2(QBluetoothSocket::SocketState::ConnectedState);
        if (pythonToCpp[2])
            pythonToCpp[2](pyArgs[2], &cppArg2);
        ::QFlags<QIODeviceBase::OpenModeFlag> cppArg3(QIODeviceBase::OpenModeFlag::ReadWrite);
        if (pythonToCpp[3])
            pythonToCpp[3](pyArgs[3], &cppArg3);

        if (!PyErr_Occurred()) {
            // setSocketDescriptor(int,QBluetoothServiceInfo::Protocol,QBluetoothSocket::SocketState,QFlags<QIODeviceBase::OpenModeFlag>)
            bool cppResult = cppSelf->setSocketDescriptor(cppArg0, cppArg1, cppArg2, cppArg3);
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;

    Sbk_QBluetoothSocketFunc_setSocketDescriptor_TypeError:
        Shiboken::setErrorAboutWrongArguments(args, fullName, errInfo);
        return {};
}

static PyObject *Sbk_QBluetoothSocketFunc_setSocketError(PyObject *self, PyObject *pyArg)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.setSocketError";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp;
    SBK_UNUSED(pythonToCpp)

    // Overloaded function decisor
    // 0: QBluetoothSocket::setSocketError(QBluetoothSocket::SocketError)
    if ((pythonToCpp = Shiboken::Conversions::pythonToCppConversion(PepType_SETP(reinterpret_cast<SbkEnumType *>(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETERROR_IDX]))->converter, (pyArg)))) {
        overloadId = 0; // setSocketError(QBluetoothSocket::SocketError)
    }

    // Function signature not found.
    if (overloadId == -1) goto Sbk_QBluetoothSocketFunc_setSocketError_TypeError;

    // Call function/method
    {
        ::QBluetoothSocket::SocketError cppArg0{QBluetoothSocket::SocketError::NoSocketError};
        pythonToCpp(pyArg, &cppArg0);

        if (!PyErr_Occurred()) {
            // setSocketError(QBluetoothSocket::SocketError)
            cppSelf->setSocketError(cppArg0);
        }
    }

    if (PyErr_Occurred()) {
        return {};
    }
    Py_RETURN_NONE;

    Sbk_QBluetoothSocketFunc_setSocketError_TypeError:
        Shiboken::setErrorAboutWrongArguments(pyArg, fullName, errInfo);
        return {};
}

static PyObject *Sbk_QBluetoothSocketFunc_setSocketState(PyObject *self, PyObject *pyArg)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.setSocketState";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp;
    SBK_UNUSED(pythonToCpp)

    // Overloaded function decisor
    // 0: QBluetoothSocket::setSocketState(QBluetoothSocket::SocketState)
    if ((pythonToCpp = Shiboken::Conversions::pythonToCppConversion(PepType_SETP(reinterpret_cast<SbkEnumType *>(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETSTATE_IDX]))->converter, (pyArg)))) {
        overloadId = 0; // setSocketState(QBluetoothSocket::SocketState)
    }

    // Function signature not found.
    if (overloadId == -1) goto Sbk_QBluetoothSocketFunc_setSocketState_TypeError;

    // Call function/method
    {
        ::QBluetoothSocket::SocketState cppArg0{QBluetoothSocket::SocketState::UnconnectedState};
        pythonToCpp(pyArg, &cppArg0);

        if (!PyErr_Occurred()) {
            // setSocketState(QBluetoothSocket::SocketState)
            cppSelf->setSocketState(cppArg0);
        }
    }

    if (PyErr_Occurred()) {
        return {};
    }
    Py_RETURN_NONE;

    Sbk_QBluetoothSocketFunc_setSocketState_TypeError:
        Shiboken::setErrorAboutWrongArguments(pyArg, fullName, errInfo);
        return {};
}

static PyObject *Sbk_QBluetoothSocketFunc_socketDescriptor(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.socketDescriptor";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // socketDescriptor()const
            int cppResult = const_cast<const ::QBluetoothSocket *>(cppSelf)->socketDescriptor();
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<int>(), &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QBluetoothSocketFunc_socketType(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.socketType";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // socketType()const
            QBluetoothServiceInfo::Protocol cppResult = const_cast<const ::QBluetoothSocket *>(cppSelf)->socketType();
            pyResult = Shiboken::Conversions::copyToPython(PepType_SETP(reinterpret_cast<SbkEnumType *>(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSERVICEINFO_PROTOCOL_IDX]))->converter, &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QBluetoothSocketFunc_state(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.state";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // state()const
            QBluetoothSocket::SocketState cppResult = const_cast<const ::QBluetoothSocket *>(cppSelf)->state();
            pyResult = Shiboken::Conversions::copyToPython(PepType_SETP(reinterpret_cast<SbkEnumType *>(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETSTATE_IDX]))->converter, &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QBluetoothSocketFunc_writeData(PyObject *self, PyObject *args)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtBluetooth.QBluetoothSocket.writeData";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp[2];
    SBK_UNUSED(pythonToCpp)
    const Py_ssize_t numArgs = PyTuple_GET_SIZE(args);
    SBK_UNUSED(numArgs)
    PyObject *pyArgs[] = {0, 0};

    // invalid argument lengths


    if (!PyArg_UnpackTuple(args, "writeData", 2, 2, &(pyArgs[0]), &(pyArgs[1])))
        return {};


    // Overloaded function decisor
    // 0: QIODevice::writeData(const char*,qint64)->qint64
    if (numArgs == 2
        && Shiboken::String::check(pyArgs[0]) && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<const char *>(), (pyArgs[0])))
        && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<qint64>(), (pyArgs[1])))) {
        overloadId = 0; // writeData(const char*,qint64)
    }

    // Function signature not found.
    if (overloadId == -1) goto Sbk_QBluetoothSocketFunc_writeData_TypeError;

    // Call function/method
    {
        const char* cppArg0;
        pythonToCpp[0](pyArgs[0], &cppArg0);
        qint64 cppArg1;
        pythonToCpp[1](pyArgs[1], &cppArg1);

        if (!PyErr_Occurred()) {
            // writeData(const char*,qint64)
            qint64 cppResult = Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(self))
                ? cppSelf->::QBluetoothSocket::writeData(cppArg0, cppArg1)
                : cppSelf->writeData(cppArg0, cppArg1);
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<qint64>(), &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;

    Sbk_QBluetoothSocketFunc_writeData_TypeError:
        Shiboken::setErrorAboutWrongArguments(args, fullName, errInfo);
        return {};
}


static const char *Sbk_QBluetoothSocket_PropertyStrings[] = {
    nullptr // Sentinel
};

static PyMethodDef Sbk_QBluetoothSocket_methods[] = {
    {"abort", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_abort), METH_NOARGS},
    {"bytesAvailable", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_bytesAvailable), METH_NOARGS},
    {"bytesToWrite", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_bytesToWrite), METH_NOARGS},
    {"canReadLine", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_canReadLine), METH_NOARGS},
    {"close", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_close), METH_NOARGS},
    {"connectToService", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_connectToService), METH_VARARGS|METH_KEYWORDS},
    {"disconnectFromService", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_disconnectFromService), METH_NOARGS},
    {"doDeviceDiscovery", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_doDeviceDiscovery), METH_VARARGS},
    {"error", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_error), METH_NOARGS},
    {"errorString", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_errorString), METH_NOARGS},
    {"isSequential", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_isSequential), METH_NOARGS},
    {"localAddress", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_localAddress), METH_NOARGS},
    {"localName", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_localName), METH_NOARGS},
    {"localPort", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_localPort), METH_NOARGS},
    {"peerAddress", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_peerAddress), METH_NOARGS},
    {"peerName", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_peerName), METH_NOARGS},
    {"peerPort", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_peerPort), METH_NOARGS},
    {"preferredSecurityFlags", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_preferredSecurityFlags), METH_NOARGS},
    {"readData", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_readData), METH_O},
    {"setPreferredSecurityFlags", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_setPreferredSecurityFlags), METH_O},
    {"setSocketDescriptor", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_setSocketDescriptor), METH_VARARGS|METH_KEYWORDS},
    {"setSocketError", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_setSocketError), METH_O},
    {"setSocketState", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_setSocketState), METH_O},
    {"socketDescriptor", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_socketDescriptor), METH_NOARGS},
    {"socketType", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_socketType), METH_NOARGS},
    {"state", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_state), METH_NOARGS},
    {"writeData", reinterpret_cast<PyCFunction>(Sbk_QBluetoothSocketFunc_writeData), METH_VARARGS},

    {nullptr, nullptr} // Sentinel
};

static int Sbk_QBluetoothSocket_setattro(PyObject *self, PyObject *name, PyObject *value)
{
    PySide::Feature::Select(self);
    if (value && PyCallable_Check(value)) {
        auto plain_inst = reinterpret_cast< ::QBluetoothSocket *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX], reinterpret_cast<SbkObject *>(self)));
        auto inst = dynamic_cast<QBluetoothSocketWrapper *>(plain_inst);
        if (inst)
            inst->resetPyMethodCache();
    }
    Shiboken::AutoDecRef pp(reinterpret_cast<PyObject *>(PySide::Property::getObject(self, name)));
    if (!pp.isNull())
        return PySide::Property::setValue(reinterpret_cast<PySideProperty *>(pp.object()), self, value);
    return PyObject_GenericSetAttr(self, name, value);
}

} // extern "C"

static int Sbk_QBluetoothSocket_traverse(PyObject *self, visitproc visit, void *arg)
{
    return SbkObject_TypeF()->tp_traverse(self, visit, arg);
}
static int Sbk_QBluetoothSocket_clear(PyObject *self)
{
    return reinterpret_cast<PyTypeObject *>(SbkObject_TypeF())->tp_clear(self);
}
static void * Sbk_QBluetoothSocketSpecialCastFunction(void *obj, PyTypeObject *desiredType)
{
    auto me = reinterpret_cast< ::QBluetoothSocket *>(obj);
    if (desiredType == SbkPySide6_QtCoreTypes[SBK_QIODEVICE_IDX])
        return static_cast< ::QIODevice *>(me);
    else if (desiredType == SbkPySide6_QtCoreTypes[SBK_QOBJECT_IDX])
        return static_cast< ::QObject *>(me);
    else if (desiredType == SbkPySide6_QtCoreTypes[SBK_QIODEVICEBASE_IDX])
        return static_cast< ::QIODeviceBase *>(me);
    return me;
}


// Class Definition -----------------------------------------------
extern "C" {
static PyTypeObject *_Sbk_QBluetoothSocket_Type = nullptr;
static PyTypeObject *Sbk_QBluetoothSocket_TypeF(void)
{
    return _Sbk_QBluetoothSocket_Type;
}

static PyType_Slot Sbk_QBluetoothSocket_slots[] = {
    {Py_tp_base,        nullptr}, // inserted by introduceWrapperType
    {Py_tp_dealloc,     reinterpret_cast<void *>(&SbkDeallocWrapper)},
    {Py_tp_repr,        nullptr},
    {Py_tp_hash,        nullptr},
    {Py_tp_call,        nullptr},
    {Py_tp_str,         nullptr},
    {Py_tp_getattro,    nullptr},
    {Py_tp_setattro,    reinterpret_cast<void *>(Sbk_QBluetoothSocket_setattro)},
    {Py_tp_traverse,    reinterpret_cast<void *>(Sbk_QBluetoothSocket_traverse)},
    {Py_tp_clear,       reinterpret_cast<void *>(Sbk_QBluetoothSocket_clear)},
    {Py_tp_richcompare, nullptr},
    {Py_tp_iter,        nullptr},
    {Py_tp_iternext,    nullptr},
    {Py_tp_methods,     reinterpret_cast<void *>(Sbk_QBluetoothSocket_methods)},
    {Py_tp_getset,      nullptr},
    {Py_tp_init,        reinterpret_cast<void *>(Sbk_QBluetoothSocket_Init)},
    {Py_tp_new,         reinterpret_cast<void *>(SbkObjectTpNew)},
    {0, nullptr}
};
static PyType_Spec Sbk_QBluetoothSocket_spec = {
    "2:PySide6.QtBluetooth.QBluetoothSocket",
    sizeof(SbkObject),
    0,
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
    Sbk_QBluetoothSocket_slots
};

} //extern "C"

static void *Sbk_QBluetoothSocket_typeDiscovery(void *cptr, PyTypeObject *instanceType)
{
    if (instanceType == Shiboken::SbkType< ::QObject >())
        return dynamic_cast< ::QBluetoothSocket *>(reinterpret_cast< ::QObject *>(cptr));
    return {};
}


// Type conversion functions.

// Python to C++ enum conversion.
static void QBluetoothSocket_SocketState_PythonToCpp_QBluetoothSocket_SocketState(PyObject *pyIn, void *cppOut)
{
    *reinterpret_cast<::QBluetoothSocket::SocketState *>(cppOut) =
        static_cast<::QBluetoothSocket::SocketState>(Shiboken::Enum::getValue(pyIn));

}
static PythonToCppFunc is_QBluetoothSocket_SocketState_PythonToCpp_QBluetoothSocket_SocketState_Convertible(PyObject *pyIn)
{
    if (PyObject_TypeCheck(pyIn, SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETSTATE_IDX]))
        return QBluetoothSocket_SocketState_PythonToCpp_QBluetoothSocket_SocketState;
    return {};
}
static PyObject *QBluetoothSocket_SocketState_CppToPython_QBluetoothSocket_SocketState(const void *cppIn)
{
    const int castCppIn = int(*reinterpret_cast<const ::QBluetoothSocket::SocketState *>(cppIn));
    return Shiboken::Enum::newItem(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETSTATE_IDX], castCppIn);

}

static void QBluetoothSocket_SocketError_PythonToCpp_QBluetoothSocket_SocketError(PyObject *pyIn, void *cppOut)
{
    *reinterpret_cast<::QBluetoothSocket::SocketError *>(cppOut) =
        static_cast<::QBluetoothSocket::SocketError>(Shiboken::Enum::getValue(pyIn));

}
static PythonToCppFunc is_QBluetoothSocket_SocketError_PythonToCpp_QBluetoothSocket_SocketError_Convertible(PyObject *pyIn)
{
    if (PyObject_TypeCheck(pyIn, SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETERROR_IDX]))
        return QBluetoothSocket_SocketError_PythonToCpp_QBluetoothSocket_SocketError;
    return {};
}
static PyObject *QBluetoothSocket_SocketError_CppToPython_QBluetoothSocket_SocketError(const void *cppIn)
{
    const int castCppIn = int(*reinterpret_cast<const ::QBluetoothSocket::SocketError *>(cppIn));
    return Shiboken::Enum::newItem(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETERROR_IDX], castCppIn);

}

// Python to C++ pointer conversion - returns the C++ object of the Python wrapper (keeps object identity).
static void QBluetoothSocket_PythonToCpp_QBluetoothSocket_PTR(PyObject *pyIn, void *cppOut)
{
    Shiboken::Conversions::pythonToCppPointer(Sbk_QBluetoothSocket_TypeF(), pyIn, cppOut);
}
static PythonToCppFunc is_QBluetoothSocket_PythonToCpp_QBluetoothSocket_PTR_Convertible(PyObject *pyIn)
{
    if (pyIn == Py_None)
        return Shiboken::Conversions::nonePythonToCppNullPtr;
    if (PyObject_TypeCheck(pyIn, reinterpret_cast<PyTypeObject *>(Sbk_QBluetoothSocket_TypeF())))
        return QBluetoothSocket_PythonToCpp_QBluetoothSocket_PTR;
    return {};
}

// C++ to Python pointer conversion - tries to find the Python wrapper for the C++ object (keeps object identity).
static PyObject *QBluetoothSocket_PTR_CppToPython_QBluetoothSocket(const void *cppIn)
{
    return PySide::getWrapperForQObject(reinterpret_cast<::QBluetoothSocket *>(const_cast<void *>(cppIn)), Sbk_QBluetoothSocket_TypeF());

}

// The signatures string for the functions.
// Multiple signatures have their index "n:" in front.
static const char *QBluetoothSocket_SignatureStrings[] = {
    "1:PySide6.QtBluetooth.QBluetoothSocket(self,socketType:PySide6.QtBluetooth.QBluetoothServiceInfo.Protocol,parent:PySide6.QtCore.QObject=nullptr)",
    "0:PySide6.QtBluetooth.QBluetoothSocket(self,parent:PySide6.QtCore.QObject=nullptr)",
    "PySide6.QtBluetooth.QBluetoothSocket.abort(self)",
    "PySide6.QtBluetooth.QBluetoothSocket.bytesAvailable(self)->qint64",
    "PySide6.QtBluetooth.QBluetoothSocket.bytesToWrite(self)->qint64",
    "PySide6.QtBluetooth.QBluetoothSocket.canReadLine(self)->bool",
    "PySide6.QtBluetooth.QBluetoothSocket.close(self)",
    "3:PySide6.QtBluetooth.QBluetoothSocket.connectToService(self,address:PySide6.QtBluetooth.QBluetoothAddress,uuid:PySide6.QtBluetooth.QBluetoothUuid.ServiceClassUuid,mode:PySide6.QtCore.QIODeviceBase.OpenMode=QIODeviceBase.OpenModeFlag.ReadWrite)",
    "2:PySide6.QtBluetooth.QBluetoothSocket.connectToService(self,address:PySide6.QtBluetooth.QBluetoothAddress,uuid:typing.Union[PySide6.QtBluetooth.QBluetoothUuid, PySide6.QtBluetooth.QBluetoothUuid.CharacteristicType, PySide6.QtBluetooth.QBluetoothUuid.DescriptorType, PySide6.QtBluetooth.QBluetoothUuid.ProtocolUuid, PySide6.QtBluetooth.QBluetoothUuid.ServiceClassUuid, PySide6.QtCore.QUuid],openMode:PySide6.QtCore.QIODeviceBase.OpenMode=QIODeviceBase.OpenModeFlag.ReadWrite)",
    "1:PySide6.QtBluetooth.QBluetoothSocket.connectToService(self,address:PySide6.QtBluetooth.QBluetoothAddress,port:quint16,openMode:PySide6.QtCore.QIODeviceBase.OpenMode=QIODeviceBase.OpenModeFlag.ReadWrite)",
    "0:PySide6.QtBluetooth.QBluetoothSocket.connectToService(self,service:PySide6.QtBluetooth.QBluetoothServiceInfo,openMode:PySide6.QtCore.QIODeviceBase.OpenMode=QIODeviceBase.OpenModeFlag.ReadWrite)",
    "PySide6.QtBluetooth.QBluetoothSocket.disconnectFromService(self)",
    "PySide6.QtBluetooth.QBluetoothSocket.doDeviceDiscovery(self,service:PySide6.QtBluetooth.QBluetoothServiceInfo,openMode:PySide6.QtCore.QIODeviceBase.OpenMode)",
    "PySide6.QtBluetooth.QBluetoothSocket.error(self)->PySide6.QtBluetooth.QBluetoothSocket.SocketError",
    "PySide6.QtBluetooth.QBluetoothSocket.errorString(self)->QString",
    "PySide6.QtBluetooth.QBluetoothSocket.isSequential(self)->bool",
    "PySide6.QtBluetooth.QBluetoothSocket.localAddress(self)->PySide6.QtBluetooth.QBluetoothAddress",
    "PySide6.QtBluetooth.QBluetoothSocket.localName(self)->QString",
    "PySide6.QtBluetooth.QBluetoothSocket.localPort(self)->quint16",
    "PySide6.QtBluetooth.QBluetoothSocket.peerAddress(self)->PySide6.QtBluetooth.QBluetoothAddress",
    "PySide6.QtBluetooth.QBluetoothSocket.peerName(self)->QString",
    "PySide6.QtBluetooth.QBluetoothSocket.peerPort(self)->quint16",
    "PySide6.QtBluetooth.QBluetoothSocket.preferredSecurityFlags(self)->PySide6.QtBluetooth.QBluetooth.SecurityFlags",
    "PySide6.QtBluetooth.QBluetoothSocket.readData(self,data:char*,maxSize:qint64)->PyObject",
    "PySide6.QtBluetooth.QBluetoothSocket.setPreferredSecurityFlags(self,flags:PySide6.QtBluetooth.QBluetooth.SecurityFlags)",
    "PySide6.QtBluetooth.QBluetoothSocket.setSocketDescriptor(self,socketDescriptor:int,socketType:PySide6.QtBluetooth.QBluetoothServiceInfo.Protocol,socketState:PySide6.QtBluetooth.QBluetoothSocket.SocketState=QBluetoothSocket.SocketState.ConnectedState,openMode:PySide6.QtCore.QIODeviceBase.OpenMode=QIODeviceBase.OpenModeFlag.ReadWrite)->bool",
    "PySide6.QtBluetooth.QBluetoothSocket.setSocketError(self,error:PySide6.QtBluetooth.QBluetoothSocket.SocketError)",
    "PySide6.QtBluetooth.QBluetoothSocket.setSocketState(self,state:PySide6.QtBluetooth.QBluetoothSocket.SocketState)",
    "PySide6.QtBluetooth.QBluetoothSocket.socketDescriptor(self)->int",
    "PySide6.QtBluetooth.QBluetoothSocket.socketType(self)->PySide6.QtBluetooth.QBluetoothServiceInfo.Protocol",
    "PySide6.QtBluetooth.QBluetoothSocket.state(self)->PySide6.QtBluetooth.QBluetoothSocket.SocketState",
    "PySide6.QtBluetooth.QBluetoothSocket.writeData(self,data:char*,maxSize:qint64)->qint64",
    nullptr}; // Sentinel

void init_QBluetoothSocket(PyObject *module)
{
    _Sbk_QBluetoothSocket_Type = Shiboken::ObjectType::introduceWrapperType(
        module,
        "QBluetoothSocket",
        "QBluetoothSocket*",
        &Sbk_QBluetoothSocket_spec,
        &Shiboken::callCppDestructor< ::QBluetoothSocket >,
        SbkPySide6_QtCoreTypes[SBK_QIODEVICE_IDX],
        0,
        0);
    auto *pyType = Sbk_QBluetoothSocket_TypeF(); // references _Sbk_QBluetoothSocket_Type
    InitSignatureStrings(pyType, QBluetoothSocket_SignatureStrings);
    SbkObjectType_SetPropertyStrings(reinterpret_cast<PyTypeObject *>(_Sbk_QBluetoothSocket_Type), Sbk_QBluetoothSocket_PropertyStrings);
    SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_IDX]
        = Sbk_QBluetoothSocket_TypeF();

    // Register Converter
    SbkConverter *converter = Shiboken::Conversions::createConverter(Sbk_QBluetoothSocket_TypeF(),
        QBluetoothSocket_PythonToCpp_QBluetoothSocket_PTR,
        is_QBluetoothSocket_PythonToCpp_QBluetoothSocket_PTR_Convertible,
        QBluetoothSocket_PTR_CppToPython_QBluetoothSocket);

    Shiboken::Conversions::registerConverterName(converter, "QBluetoothSocket");
    Shiboken::Conversions::registerConverterName(converter, "QBluetoothSocket*");
    Shiboken::Conversions::registerConverterName(converter, "QBluetoothSocket&");
    Shiboken::Conversions::registerConverterName(converter, typeid(::QBluetoothSocket).name());
    Shiboken::Conversions::registerConverterName(converter, typeid(::QBluetoothSocketWrapper).name());


    MultipleInheritanceInitFunction func = Shiboken::ObjectType::getMultipleInheritanceFunction(SbkPySide6_QtCoreTypes[SBK_QIODEVICE_IDX]);
    Shiboken::ObjectType::setMultipleInheritanceFunction(Sbk_QBluetoothSocket_TypeF(), func);
    Shiboken::ObjectType::setCastFunction(Sbk_QBluetoothSocket_TypeF(), &Sbk_QBluetoothSocketSpecialCastFunction);
    Shiboken::ObjectType::setTypeDiscoveryFunctionV2(Sbk_QBluetoothSocket_TypeF(), &Sbk_QBluetoothSocket_typeDiscovery);

    // Initialization of enums.

    // Initialization of enum 'SocketState'.
    SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETSTATE_IDX] = Shiboken::Enum::createScopedEnum(Sbk_QBluetoothSocket_TypeF(),
        "SocketState",
        "2:PySide6.QtBluetooth.QBluetoothSocket.SocketState",
        "QBluetoothSocket::SocketState");
    if (!SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETSTATE_IDX])
        return;

    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETSTATE_IDX],
        SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETSTATE_IDX], "UnconnectedState", (long) QBluetoothSocket::SocketState::UnconnectedState))
        return;
    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETSTATE_IDX],
        SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETSTATE_IDX], "ServiceLookupState", (long) QBluetoothSocket::SocketState::ServiceLookupState))
        return;
    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETSTATE_IDX],
        SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETSTATE_IDX], "ConnectingState", (long) QBluetoothSocket::SocketState::ConnectingState))
        return;
    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETSTATE_IDX],
        SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETSTATE_IDX], "ConnectedState", (long) QBluetoothSocket::SocketState::ConnectedState))
        return;
    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETSTATE_IDX],
        SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETSTATE_IDX], "BoundState", (long) QBluetoothSocket::SocketState::BoundState))
        return;
    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETSTATE_IDX],
        SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETSTATE_IDX], "ClosingState", (long) QBluetoothSocket::SocketState::ClosingState))
        return;
    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETSTATE_IDX],
        SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETSTATE_IDX], "ListeningState", (long) QBluetoothSocket::SocketState::ListeningState))
        return;
    // Register converter for enum 'QBluetoothSocket::SocketState'.
    {
        SbkConverter *converter = Shiboken::Conversions::createConverter(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETSTATE_IDX],
            QBluetoothSocket_SocketState_CppToPython_QBluetoothSocket_SocketState);
        Shiboken::Conversions::addPythonToCppValueConversion(converter,
            QBluetoothSocket_SocketState_PythonToCpp_QBluetoothSocket_SocketState,
            is_QBluetoothSocket_SocketState_PythonToCpp_QBluetoothSocket_SocketState_Convertible);
        Shiboken::Enum::setTypeConverter(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETSTATE_IDX], converter, false);
        Shiboken::Conversions::registerConverterName(converter, "QBluetoothSocket::SocketState");
        Shiboken::Conversions::registerConverterName(converter, "SocketState");
    }
    // End of 'SocketState' enum.

    // Initialization of enum 'SocketError'.
    SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETERROR_IDX] = Shiboken::Enum::createScopedEnum(Sbk_QBluetoothSocket_TypeF(),
        "SocketError",
        "2:PySide6.QtBluetooth.QBluetoothSocket.SocketError",
        "QBluetoothSocket::SocketError");
    if (!SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETERROR_IDX])
        return;

    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETERROR_IDX],
        SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETERROR_IDX], "NoSocketError", (long) QBluetoothSocket::SocketError::NoSocketError))
        return;
    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETERROR_IDX],
        SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETERROR_IDX], "UnknownSocketError", (long) QBluetoothSocket::SocketError::UnknownSocketError))
        return;
    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETERROR_IDX],
        SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETERROR_IDX], "RemoteHostClosedError", (long) QBluetoothSocket::SocketError::RemoteHostClosedError))
        return;
    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETERROR_IDX],
        SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETERROR_IDX], "HostNotFoundError", (long) QBluetoothSocket::SocketError::HostNotFoundError))
        return;
    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETERROR_IDX],
        SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETERROR_IDX], "ServiceNotFoundError", (long) QBluetoothSocket::SocketError::ServiceNotFoundError))
        return;
    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETERROR_IDX],
        SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETERROR_IDX], "NetworkError", (long) QBluetoothSocket::SocketError::NetworkError))
        return;
    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETERROR_IDX],
        SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETERROR_IDX], "UnsupportedProtocolError", (long) QBluetoothSocket::SocketError::UnsupportedProtocolError))
        return;
    if (!Shiboken::Enum::createScopedEnumItem(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETERROR_IDX],
        SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETERROR_IDX], "OperationError", (long) QBluetoothSocket::SocketError::OperationError))
        return;
    // Register converter for enum 'QBluetoothSocket::SocketError'.
    {
        SbkConverter *converter = Shiboken::Conversions::createConverter(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETERROR_IDX],
            QBluetoothSocket_SocketError_CppToPython_QBluetoothSocket_SocketError);
        Shiboken::Conversions::addPythonToCppValueConversion(converter,
            QBluetoothSocket_SocketError_PythonToCpp_QBluetoothSocket_SocketError,
            is_QBluetoothSocket_SocketError_PythonToCpp_QBluetoothSocket_SocketError_Convertible);
        Shiboken::Enum::setTypeConverter(SbkPySide6_QtBluetoothTypes[SBK_QBLUETOOTHSOCKET_SOCKETERROR_IDX], converter, false);
        Shiboken::Conversions::registerConverterName(converter, "QBluetoothSocket::SocketError");
        Shiboken::Conversions::registerConverterName(converter, "SocketError");
    }
    // End of 'SocketError' enum.

    PySide::Signal::registerSignals(Sbk_QBluetoothSocket_TypeF(), &::QBluetoothSocket::staticMetaObject);
    qRegisterMetaType< ::QBluetoothSocket::SocketState >("QBluetoothSocket::SocketState");
    qRegisterMetaType< ::QBluetoothSocket::SocketError >("QBluetoothSocket::SocketError");
    Shiboken::ObjectType::setSubTypeInitHook(Sbk_QBluetoothSocket_TypeF(), &PySide::initQObjectSubType);
    PySide::initDynamicMetaObject(Sbk_QBluetoothSocket_TypeF(), &::QBluetoothSocket::staticMetaObject, sizeof(QBluetoothSocketWrapper));
}
