Fix tray visibility and message reception issues
Some checks failed
build / build-win64 (push) Waiting to run
build / build-macos (push) Waiting to run
build / build-pip (push) Failing after 16s

- Disable sound initialization to prevent hanging
- Add missing import re in utils.py
- Fix settings loading for QSettings
- Update file paths to use PROJECT_ROOT
- Revert to working API paths and listener from commit efdc63e
This commit is contained in:
kdusek
2025-12-07 22:39:07 +01:00
parent 7b695d7b7f
commit 5138303016
4060 changed files with 579123 additions and 23 deletions

View File

@@ -0,0 +1,6 @@
# Automatically generated configuration for PyQt6.QtBluetooth.
sip-version = "6.14.0"
sip-abi-version = "13.8"
module-tags = ["Qt_6_10_0", "Linux"]
module-disabled-features = []

View File

@@ -0,0 +1,71 @@
// QtBluetoothmod.sip generated by MetaSIP
//
// This file is part of the QtBluetooth Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%Module(name=PyQt6.QtBluetooth, keyword_arguments="Optional", use_limited_api=True)
%Import QtCore/QtCoremod.sip
%Copying
Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
This file is part of PyQt6.
This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and appearing in
the file LICENSE included in the packaging of this file. Please review the
following information to ensure the GNU General Public License version 3.0
requirements will be met: http://www.gnu.org/copyleft/gpl.html.
If you do not wish to use this file under the terms of the GPL version 3.0
then you may purchase a commercial license. For more information contact
info@riverbankcomputing.com.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%End
%DefaultSupertype PyQt6.sip.simplewrapper
%Include qbluetooth.sip
%Include qbluetoothaddress.sip
%Include qbluetoothdevicediscoveryagent.sip
%Include qbluetoothdeviceinfo.sip
%Include qbluetoothhostinfo.sip
%Include qbluetoothlocaldevice.sip
%Include qbluetoothserver.sip
%Include qbluetoothservicediscoveryagent.sip
%Include qbluetoothserviceinfo.sip
%Include qbluetoothsocket.sip
%Include qbluetoothuuid.sip
%Include qlowenergyadvertisingdata.sip
%Include qlowenergyadvertisingparameters.sip
%Include qlowenergycharacteristic.sip
%Include qlowenergycharacteristicdata.sip
%Include qlowenergyconnectionparameters.sip
%Include qlowenergycontroller.sip
%Include qlowenergydescriptor.sip
%Include qlowenergydescriptordata.sip
%Include qlowenergyservice.sip
%Include qlowenergyservicedata.sip
%Include qpybluetooth_quint128.sip
%Include qpybluetooth_qlist.sip
%Include qpybluetooth_qmultihash.sip

View File

@@ -0,0 +1,55 @@
// qbluetooth.sip generated by MetaSIP
//
// This file is part of the QtBluetooth Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
namespace QBluetooth
{
%TypeHeaderCode
#include <qbluetooth.h>
%End
enum class Security /BaseType=Flag/
{
NoSecurity,
Authorization,
Authentication,
Encryption,
Secure,
};
typedef QFlags<QBluetooth::Security> SecurityFlags;
enum class AttAccessConstraint /BaseType=Flag/
{
AttAuthorizationRequired,
AttAuthenticationRequired,
AttEncryptionRequired,
};
typedef QFlags<QBluetooth::AttAccessConstraint> AttAccessConstraints;
};
%End
%If (Qt_6_2_0 -)
typedef quint16 QLowEnergyHandle;
%End

View File

@@ -0,0 +1,59 @@
// qbluetoothaddress.sip generated by MetaSIP
//
// This file is part of the QtBluetooth Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QBluetoothAddress
{
%TypeHeaderCode
#include <qbluetoothaddress.h>
%End
public:
QBluetoothAddress();
explicit QBluetoothAddress(quint64 address);
explicit QBluetoothAddress(const QString &address);
QBluetoothAddress(const QBluetoothAddress &other);
~QBluetoothAddress();
bool isNull() const;
void clear();
quint64 toUInt64() const;
QString toString() const;
%If (Qt_6_6_0 -)
Py_hash_t __hash__() const;
%MethodCode
sipRes = qHash(*sipCpp);
%End
%End
};
%End
%If (Qt_6_2_0 -)
bool operator<(const QBluetoothAddress &a, const QBluetoothAddress &b);
%End
%If (Qt_6_2_0 -)
bool operator==(const QBluetoothAddress &a, const QBluetoothAddress &b);
%End
%If (Qt_6_2_0 -)
bool operator!=(const QBluetoothAddress &a, const QBluetoothAddress &b);
%End

View File

@@ -0,0 +1,81 @@
// qbluetoothdevicediscoveryagent.sip generated by MetaSIP
//
// This file is part of the QtBluetooth Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QBluetoothDeviceDiscoveryAgent : public QObject
{
%TypeHeaderCode
#include <qbluetoothdevicediscoveryagent.h>
%End
public:
enum Error
{
NoError,
InputOutputError,
PoweredOffError,
InvalidBluetoothAdapterError,
UnsupportedPlatformError,
UnsupportedDiscoveryMethod,
LocationServiceTurnedOffError,
%If (Qt_6_4_0 -)
MissingPermissionsError,
%End
UnknownError,
};
explicit QBluetoothDeviceDiscoveryAgent(QObject *parent /TransferThis/ = 0);
QBluetoothDeviceDiscoveryAgent(const QBluetoothAddress &deviceAdapter, QObject *parent /TransferThis/ = 0);
virtual ~QBluetoothDeviceDiscoveryAgent();
bool isActive() const;
QBluetoothDeviceDiscoveryAgent::Error error() const;
QString errorString() const;
QList<QBluetoothDeviceInfo> discoveredDevices() const;
public slots:
void start();
void start(QBluetoothDeviceDiscoveryAgent::DiscoveryMethods method);
void stop();
signals:
void deviceDiscovered(const QBluetoothDeviceInfo &info);
void finished();
void errorOccurred(QBluetoothDeviceDiscoveryAgent::Error error);
void canceled();
void deviceUpdated(const QBluetoothDeviceInfo &info, QBluetoothDeviceInfo::Fields updatedFields);
public:
enum DiscoveryMethod /BaseType=Flag/
{
NoMethod,
ClassicMethod,
LowEnergyMethod,
};
typedef QFlags<QBluetoothDeviceDiscoveryAgent::DiscoveryMethod> DiscoveryMethods;
void setLowEnergyDiscoveryTimeout(int msTimeout);
int lowEnergyDiscoveryTimeout() const;
static QBluetoothDeviceDiscoveryAgent::DiscoveryMethods supportedDiscoveryMethods();
};
%End

View File

@@ -0,0 +1,245 @@
// qbluetoothdeviceinfo.sip generated by MetaSIP
//
// This file is part of the QtBluetooth Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QBluetoothDeviceInfo
{
%TypeHeaderCode
#include <qbluetoothdeviceinfo.h>
%End
public:
enum MajorDeviceClass
{
MiscellaneousDevice,
ComputerDevice,
PhoneDevice,
NetworkDevice,
AudioVideoDevice,
PeripheralDevice,
ImagingDevice,
WearableDevice,
ToyDevice,
HealthDevice,
UncategorizedDevice,
};
enum MinorMiscellaneousClass
{
UncategorizedMiscellaneous,
};
enum MinorComputerClass
{
UncategorizedComputer,
DesktopComputer,
ServerComputer,
LaptopComputer,
HandheldClamShellComputer,
HandheldComputer,
WearableComputer,
};
enum MinorPhoneClass
{
UncategorizedPhone,
CellularPhone,
CordlessPhone,
SmartPhone,
WiredModemOrVoiceGatewayPhone,
CommonIsdnAccessPhone,
};
enum MinorNetworkClass
{
NetworkFullService,
NetworkLoadFactorOne,
NetworkLoadFactorTwo,
NetworkLoadFactorThree,
NetworkLoadFactorFour,
NetworkLoadFactorFive,
NetworkLoadFactorSix,
NetworkNoService,
};
enum MinorAudioVideoClass
{
UncategorizedAudioVideoDevice,
WearableHeadsetDevice,
HandsFreeDevice,
Microphone,
Loudspeaker,
Headphones,
PortableAudioDevice,
CarAudio,
SetTopBox,
HiFiAudioDevice,
Vcr,
VideoCamera,
Camcorder,
VideoMonitor,
VideoDisplayAndLoudspeaker,
VideoConferencing,
GamingDevice,
};
enum MinorPeripheralClass
{
UncategorizedPeripheral,
KeyboardPeripheral,
PointingDevicePeripheral,
KeyboardWithPointingDevicePeripheral,
JoystickPeripheral,
GamepadPeripheral,
RemoteControlPeripheral,
SensingDevicePeripheral,
DigitizerTabletPeripheral,
CardReaderPeripheral,
};
enum MinorImagingClass
{
UncategorizedImagingDevice,
ImageDisplay,
ImageCamera,
ImageScanner,
ImagePrinter,
};
enum MinorWearableClass
{
UncategorizedWearableDevice,
WearableWristWatch,
WearablePager,
WearableJacket,
WearableHelmet,
WearableGlasses,
};
enum MinorToyClass
{
UncategorizedToy,
ToyRobot,
ToyVehicle,
ToyDoll,
ToyController,
ToyGame,
};
enum MinorHealthClass
{
UncategorizedHealthDevice,
HealthBloodPressureMonitor,
HealthThermometer,
HealthWeightScale,
HealthGlucoseMeter,
HealthPulseOximeter,
HealthDataDisplay,
HealthStepCounter,
};
enum ServiceClass /BaseType=Flag/
{
NoService,
PositioningService,
NetworkingService,
RenderingService,
CapturingService,
ObjectTransferService,
AudioService,
TelephonyService,
InformationService,
AllServices,
};
typedef QFlags<QBluetoothDeviceInfo::ServiceClass> ServiceClasses;
QBluetoothDeviceInfo();
QBluetoothDeviceInfo(const QBluetoothAddress &address, const QString &name, quint32 classOfDevice);
QBluetoothDeviceInfo(const QBluetoothUuid &uuid, const QString &name, quint32 classOfDevice);
QBluetoothDeviceInfo(const QBluetoothDeviceInfo &other);
~QBluetoothDeviceInfo();
bool isValid() const;
bool isCached() const;
void setCached(bool cached);
QBluetoothAddress address() const;
QString name() const;
QBluetoothDeviceInfo::ServiceClasses serviceClasses() const;
QBluetoothDeviceInfo::MajorDeviceClass majorDeviceClass() const;
quint8 minorDeviceClass() const;
qint16 rssi() const;
void setRssi(qint16 signal);
void setServiceUuids(const QList<QBluetoothUuid> &uuids);
QList<QBluetoothUuid> serviceUuids() const;
enum CoreConfiguration /BaseType=Flag/
{
UnknownCoreConfiguration,
LowEnergyCoreConfiguration,
BaseRateCoreConfiguration,
BaseRateAndLowEnergyCoreConfiguration,
};
typedef QFlags<QBluetoothDeviceInfo::CoreConfiguration> CoreConfigurations;
void setCoreConfigurations(QBluetoothDeviceInfo::CoreConfigurations coreConfigs);
QBluetoothDeviceInfo::CoreConfigurations coreConfigurations() const;
void setDeviceUuid(const QBluetoothUuid &uuid);
QBluetoothUuid deviceUuid() const;
enum class Field /BaseType=Flag/
{
None,
RSSI,
ManufacturerData,
%If (Qt_6_3_0 -)
ServiceData,
%End
All,
};
typedef QFlags<QBluetoothDeviceInfo::Field> Fields;
QList<unsigned short> manufacturerIds() const;
QMultiHash<quint16, QByteArray> manufacturerData() const;
QByteArray manufacturerData(quint16 manufacturerId) const;
bool setManufacturerData(quint16 manufacturerId, const QByteArray &data);
void setName(const QString &name);
%If (Qt_6_3_0 -)
QList<QBluetoothUuid> serviceIds() const;
%End
%If (Qt_6_3_0 -)
QMultiHash<QBluetoothUuid, QByteArray> serviceData() const;
%End
%If (Qt_6_3_0 -)
QByteArray serviceData(const QBluetoothUuid &serviceId) const;
%End
%If (Qt_6_3_0 -)
bool setServiceData(const QBluetoothUuid &serviceId, const QByteArray &data);
%End
};
%End
%If (Qt_6_2_0 -)
bool operator==(const QBluetoothDeviceInfo &a, const QBluetoothDeviceInfo &b);
%End
%If (Qt_6_2_0 -)
bool operator!=(const QBluetoothDeviceInfo &a, const QBluetoothDeviceInfo &b);
%End

View File

@@ -0,0 +1,47 @@
// qbluetoothhostinfo.sip generated by MetaSIP
//
// This file is part of the QtBluetooth Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QBluetoothHostInfo
{
%TypeHeaderCode
#include <qbluetoothhostinfo.h>
%End
public:
QBluetoothHostInfo();
QBluetoothHostInfo(const QBluetoothHostInfo &other);
~QBluetoothHostInfo();
QBluetoothAddress address() const;
void setAddress(const QBluetoothAddress &address);
QString name() const;
void setName(const QString &name);
};
%End
%If (Qt_6_2_0 -)
bool operator==(const QBluetoothHostInfo &a, const QBluetoothHostInfo &b);
%End
%If (Qt_6_2_0 -)
bool operator!=(const QBluetoothHostInfo &a, const QBluetoothHostInfo &b);
%End

View File

@@ -0,0 +1,79 @@
// qbluetoothlocaldevice.sip generated by MetaSIP
//
// This file is part of the QtBluetooth Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QBluetoothLocalDevice : public QObject
{
%TypeHeaderCode
#include <qbluetoothlocaldevice.h>
%End
public:
enum Pairing
{
Unpaired,
Paired,
AuthorizedPaired,
};
enum HostMode
{
HostPoweredOff,
HostConnectable,
HostDiscoverable,
HostDiscoverableLimitedInquiry,
};
enum Error
{
NoError,
PairingError,
%If (Qt_6_4_0 -)
MissingPermissionsError,
%End
UnknownError,
};
explicit QBluetoothLocalDevice(QObject *parent /TransferThis/ = 0);
QBluetoothLocalDevice(const QBluetoothAddress &address, QObject *parent /TransferThis/ = 0);
virtual ~QBluetoothLocalDevice();
bool isValid() const;
void requestPairing(const QBluetoothAddress &address, QBluetoothLocalDevice::Pairing pairing);
QBluetoothLocalDevice::Pairing pairingStatus(const QBluetoothAddress &address) const;
void setHostMode(QBluetoothLocalDevice::HostMode mode);
QBluetoothLocalDevice::HostMode hostMode() const;
void powerOn();
QString name() const;
QBluetoothAddress address() const;
static QList<QBluetoothHostInfo> allDevices();
QList<QBluetoothAddress> connectedDevices() const;
signals:
void hostModeStateChanged(QBluetoothLocalDevice::HostMode state);
void pairingFinished(const QBluetoothAddress &address, QBluetoothLocalDevice::Pairing pairing);
void errorOccurred(QBluetoothLocalDevice::Error error);
void deviceConnected(const QBluetoothAddress &address);
void deviceDisconnected(const QBluetoothAddress &address);
};
%End

View File

@@ -0,0 +1,101 @@
// qbluetoothserver.sip generated by MetaSIP
//
// This file is part of the QtBluetooth Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QBluetoothServer : public QObject
{
%TypeHeaderCode
#include <qbluetoothserver.h>
%End
%ConvertToSubClassCode
static struct class_graph {
const char *name;
sipTypeDef **type;
int yes, no;
} graph[] = {
{sipName_QBluetoothDeviceDiscoveryAgent, &sipType_QBluetoothDeviceDiscoveryAgent, -1, 1},
{sipName_QBluetoothLocalDevice, &sipType_QBluetoothLocalDevice, -1, 2},
{sipName_QBluetoothServer, &sipType_QBluetoothServer, -1, 3},
{sipName_QBluetoothServiceDiscoveryAgent, &sipType_QBluetoothServiceDiscoveryAgent, -1, 4},
{sipName_QBluetoothSocket, &sipType_QBluetoothSocket, -1, 5},
{sipName_QLowEnergyController, &sipType_QLowEnergyController, -1, 6},
{sipName_QLowEnergyService, &sipType_QLowEnergyService, -1, -1},
};
int i = 0;
sipType = NULL;
do
{
struct class_graph *cg = &graph[i];
if (cg->name != NULL && sipCpp->inherits(cg->name))
{
sipType = *cg->type;
i = cg->yes;
}
else
i = cg->no;
}
while (i >= 0);
%End
public:
enum Error
{
NoError,
UnknownError,
PoweredOffError,
InputOutputError,
ServiceAlreadyRegisteredError,
UnsupportedProtocolError,
%If (Qt_6_4_0 -)
MissingPermissionsError,
%End
};
QBluetoothServer(QBluetoothServiceInfo::Protocol serverType, QObject *parent /TransferThis/ = 0);
virtual ~QBluetoothServer();
void close() /ReleaseGIL/;
bool listen(const QBluetoothAddress &address = QBluetoothAddress(), quint16 port = 0) /ReleaseGIL/;
QBluetoothServiceInfo listen(const QBluetoothUuid &uuid, const QString &serviceName = QString()) /ReleaseGIL/;
bool isListening() const;
void setMaxPendingConnections(int numConnections);
int maxPendingConnections() const;
bool hasPendingConnections() const;
QBluetoothSocket *nextPendingConnection() /Factory/;
QBluetoothAddress serverAddress() const;
quint16 serverPort() const;
void setSecurityFlags(QBluetooth::SecurityFlags security);
QBluetooth::SecurityFlags securityFlags() const;
QBluetoothServiceInfo::Protocol serverType() const;
QBluetoothServer::Error error() const;
signals:
void newConnection();
void errorOccurred(QBluetoothServer::Error error);
};
%End

View File

@@ -0,0 +1,75 @@
// qbluetoothservicediscoveryagent.sip generated by MetaSIP
//
// This file is part of the QtBluetooth Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QBluetoothServiceDiscoveryAgent : public QObject
{
%TypeHeaderCode
#include <qbluetoothservicediscoveryagent.h>
%End
public:
enum Error
{
NoError,
InputOutputError,
PoweredOffError,
InvalidBluetoothAdapterError,
%If (Qt_6_4_0 -)
MissingPermissionsError,
%End
UnknownError,
};
enum DiscoveryMode
{
MinimalDiscovery,
FullDiscovery,
};
explicit QBluetoothServiceDiscoveryAgent(QObject *parent /TransferThis/ = 0);
QBluetoothServiceDiscoveryAgent(const QBluetoothAddress &deviceAdapter, QObject *parent /TransferThis/ = 0);
virtual ~QBluetoothServiceDiscoveryAgent();
bool isActive() const;
QBluetoothServiceDiscoveryAgent::Error error() const;
QString errorString() const;
QList<QBluetoothServiceInfo> discoveredServices() const;
void setUuidFilter(const QList<QBluetoothUuid> &uuids);
void setUuidFilter(const QBluetoothUuid &uuid);
QList<QBluetoothUuid> uuidFilter() const;
bool setRemoteAddress(const QBluetoothAddress &address);
QBluetoothAddress remoteAddress() const;
public slots:
void start(QBluetoothServiceDiscoveryAgent::DiscoveryMode mode = QBluetoothServiceDiscoveryAgent::MinimalDiscovery);
void stop();
void clear();
signals:
void serviceDiscovered(const QBluetoothServiceInfo &info);
void finished();
void canceled();
void errorOccurred(QBluetoothServiceDiscoveryAgent::Error error);
};
%End

View File

@@ -0,0 +1,95 @@
// qbluetoothserviceinfo.sip generated by MetaSIP
//
// This file is part of the QtBluetooth Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QBluetoothServiceInfo
{
%TypeHeaderCode
#include <qbluetoothserviceinfo.h>
%End
public:
enum AttributeId
{
ServiceRecordHandle,
ServiceClassIds,
ServiceRecordState,
ServiceId,
ProtocolDescriptorList,
BrowseGroupList,
LanguageBaseAttributeIdList,
ServiceInfoTimeToLive,
ServiceAvailability,
BluetoothProfileDescriptorList,
DocumentationUrl,
ClientExecutableUrl,
IconUrl,
AdditionalProtocolDescriptorList,
PrimaryLanguageBase,
ServiceName,
ServiceDescription,
ServiceProvider,
};
enum Protocol
{
UnknownProtocol,
L2capProtocol,
RfcommProtocol,
};
QBluetoothServiceInfo();
QBluetoothServiceInfo(const QBluetoothServiceInfo &other);
~QBluetoothServiceInfo();
bool isValid() const;
bool isComplete() const;
void setDevice(const QBluetoothDeviceInfo &info);
QBluetoothDeviceInfo device() const;
QVariant attribute(quint16 attributeId) const;
QList<unsigned short> attributes() const;
bool contains(quint16 attributeId) const;
void removeAttribute(quint16 attributeId);
QBluetoothServiceInfo::Protocol socketProtocol() const;
int protocolServiceMultiplexer() const;
int serverChannel() const;
QBluetoothServiceInfo::Sequence protocolDescriptor(QBluetoothUuid::ProtocolUuid protocol) const;
bool isRegistered() const;
bool registerService(const QBluetoothAddress &localAdapter = QBluetoothAddress());
bool unregisterService();
void setAttribute(quint16 attributeId, const QBluetoothUuid &value);
void setAttribute(quint16 attributeId, const QBluetoothServiceInfo::Sequence &value);
void setAttribute(quint16 attributeId, const QVariant &value);
void setServiceName(const QString &name);
QString serviceName() const;
void setServiceDescription(const QString &description);
QString serviceDescription() const;
void setServiceProvider(const QString &provider);
QString serviceProvider() const;
void setServiceAvailability(quint8 availability);
quint8 serviceAvailability() const;
void setServiceUuid(const QBluetoothUuid &uuid);
QBluetoothUuid serviceUuid() const;
QList<QBluetoothUuid> serviceClassUuids() const;
};
%End

View File

@@ -0,0 +1,140 @@
// qbluetoothsocket.sip generated by MetaSIP
//
// This file is part of the QtBluetooth Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QBluetoothSocket : public QIODevice
{
%TypeHeaderCode
#include <qbluetoothsocket.h>
%End
public:
enum class SocketState
{
UnconnectedState,
ServiceLookupState,
ConnectingState,
ConnectedState,
BoundState,
ClosingState,
ListeningState,
};
enum class SocketError
{
NoSocketError,
UnknownSocketError,
RemoteHostClosedError,
HostNotFoundError,
ServiceNotFoundError,
NetworkError,
UnsupportedProtocolError,
OperationError,
%If (Qt_6_4_0 -)
MissingPermissionsError,
%End
};
QBluetoothSocket(QBluetoothServiceInfo::Protocol socketType, QObject *parent /TransferThis/ = 0);
explicit QBluetoothSocket(QObject *parent /TransferThis/ = 0);
virtual ~QBluetoothSocket();
void abort();
virtual void close() /ReleaseGIL/;
virtual bool isSequential() const;
virtual qint64 bytesAvailable() const;
virtual qint64 bytesToWrite() const;
virtual bool canReadLine() const;
void connectToService(const QBluetoothAddress &address, QBluetoothUuid::ServiceClassUuid uuid, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite) /ReleaseGIL/;
void connectToService(const QBluetoothAddress &address, quint16 port, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite) /ReleaseGIL/;
void connectToService(const QBluetoothAddress &address, const QBluetoothUuid &uuid, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite) /ReleaseGIL/;
void connectToService(const QBluetoothServiceInfo &service, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite) /ReleaseGIL/;
void disconnectFromService() /ReleaseGIL/;
QString localName() const;
QBluetoothAddress localAddress() const;
quint16 localPort() const;
QString peerName() const;
QBluetoothAddress peerAddress() const;
quint16 peerPort() const;
bool setSocketDescriptor(int socketDescriptor, QBluetoothServiceInfo::Protocol socketType, QBluetoothSocket::SocketState state = QBluetoothSocket::SocketState::ConnectedState, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite);
int socketDescriptor() const;
QBluetoothServiceInfo::Protocol socketType() const;
QBluetoothSocket::SocketState state() const;
QBluetoothSocket::SocketError error() const;
QString errorString() const;
signals:
void connected();
void disconnected();
void errorOccurred(QBluetoothSocket::SocketError error);
void stateChanged(QBluetoothSocket::SocketState state);
protected:
virtual SIP_PYOBJECT readData(qint64 maxlen) /TypeHint="bytes",ReleaseGIL/ [qint64 (char *data, qint64 maxSize)];
%MethodCode
// Return the data read or None if there was an error.
if (a0 < 0)
{
PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative");
sipIsErr = 1;
}
else
{
char *s = new char[a0];
qint64 len;
Py_BEGIN_ALLOW_THREADS
#if defined(SIP_PROTECTED_IS_PUBLIC)
len = sipSelfWasArg ? sipCpp->QBluetoothSocket::readData(s, a0) : sipCpp->readData(s, a0);
#else
len = sipCpp->sipProtectVirt_readData(sipSelfWasArg, s, a0);
#endif
Py_END_ALLOW_THREADS
if (len < 0)
{
Py_INCREF(Py_None);
sipRes = Py_None;
}
else
{
sipRes = PyBytes_FromStringAndSize(s, len);
if (!sipRes)
sipIsErr = 1;
}
delete[] s;
}
%End
virtual qint64 writeData(const char *data /Array/, qint64 maxSize /ArraySize/) /ReleaseGIL/;
void setSocketState(QBluetoothSocket::SocketState state);
void setSocketError(QBluetoothSocket::SocketError error);
void doDeviceDiscovery(const QBluetoothServiceInfo &service, QIODeviceBase::OpenMode openMode);
public:
void setPreferredSecurityFlags(QBluetooth::SecurityFlags flags);
QBluetooth::SecurityFlags preferredSecurityFlags() const;
};
%End

View File

@@ -0,0 +1,361 @@
// qbluetoothuuid.sip generated by MetaSIP
//
// This file is part of the QtBluetooth Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QBluetoothUuid : public QUuid
{
%TypeHeaderCode
#include <qbluetoothuuid.h>
%End
public:
enum class ProtocolUuid
{
Sdp,
Udp,
Rfcomm,
Tcp,
TcsBin,
TcsAt,
Att,
Obex,
Ip,
Ftp,
Http,
Wsp,
Bnep,
Upnp,
Hidp,
HardcopyControlChannel,
HardcopyDataChannel,
HardcopyNotification,
Avctp,
Avdtp,
Cmtp,
UdiCPlain,
McapControlChannel,
McapDataChannel,
L2cap,
};
enum class ServiceClassUuid
{
ServiceDiscoveryServer,
BrowseGroupDescriptor,
PublicBrowseGroup,
SerialPort,
LANAccessUsingPPP,
DialupNetworking,
IrMCSync,
ObexObjectPush,
OBEXFileTransfer,
IrMCSyncCommand,
Headset,
AudioSource,
AudioSink,
AV_RemoteControlTarget,
AdvancedAudioDistribution,
AV_RemoteControl,
AV_RemoteControlController,
HeadsetAG,
PANU,
NAP,
GN,
DirectPrinting,
ReferencePrinting,
BasicImage,
ImagingResponder,
ImagingAutomaticArchive,
ImagingReferenceObjects,
Handsfree,
HandsfreeAudioGateway,
DirectPrintingReferenceObjectsService,
ReflectedUI,
BasicPrinting,
PrintingStatus,
HumanInterfaceDeviceService,
HardcopyCableReplacement,
HCRPrint,
HCRScan,
SIMAccess,
PhonebookAccessPCE,
PhonebookAccessPSE,
PhonebookAccess,
HeadsetHS,
MessageAccessServer,
MessageNotificationServer,
MessageAccessProfile,
GNSS,
GNSSServer,
Display3D,
Glasses3D,
Synchronization3D,
MPSProfile,
MPSService,
PnPInformation,
GenericNetworking,
GenericFileTransfer,
GenericAudio,
GenericTelephony,
VideoSource,
VideoSink,
VideoDistribution,
HDP,
HDPSource,
HDPSink,
GenericAccess,
GenericAttribute,
ImmediateAlert,
LinkLoss,
TxPower,
CurrentTimeService,
ReferenceTimeUpdateService,
NextDSTChangeService,
Glucose,
HealthThermometer,
DeviceInformation,
HeartRate,
PhoneAlertStatusService,
BatteryService,
BloodPressure,
AlertNotificationService,
HumanInterfaceDevice,
ScanParameters,
RunningSpeedAndCadence,
CyclingSpeedAndCadence,
CyclingPower,
LocationAndNavigation,
EnvironmentalSensing,
BodyComposition,
UserData,
WeightScale,
BondManagement,
ContinuousGlucoseMonitoring,
};
enum class CharacteristicType
{
DeviceName,
Appearance,
PeripheralPrivacyFlag,
ReconnectionAddress,
PeripheralPreferredConnectionParameters,
ServiceChanged,
AlertLevel,
TxPowerLevel,
DateTime,
DayOfWeek,
DayDateTime,
ExactTime256,
DSTOffset,
TimeZone,
LocalTimeInformation,
TimeWithDST,
TimeAccuracy,
TimeSource,
ReferenceTimeInformation,
TimeUpdateControlPoint,
TimeUpdateState,
GlucoseMeasurement,
BatteryLevel,
TemperatureMeasurement,
TemperatureType,
IntermediateTemperature,
MeasurementInterval,
BootKeyboardInputReport,
SystemID,
ModelNumberString,
SerialNumberString,
FirmwareRevisionString,
HardwareRevisionString,
SoftwareRevisionString,
ManufacturerNameString,
IEEE1107320601RegulatoryCertificationDataList,
CurrentTime,
MagneticDeclination,
ScanRefresh,
BootKeyboardOutputReport,
BootMouseInputReport,
GlucoseMeasurementContext,
BloodPressureMeasurement,
IntermediateCuffPressure,
HeartRateMeasurement,
BodySensorLocation,
HeartRateControlPoint,
AlertStatus,
RingerControlPoint,
RingerSetting,
AlertCategoryIDBitMask,
AlertCategoryID,
AlertNotificationControlPoint,
UnreadAlertStatus,
NewAlert,
SupportedNewAlertCategory,
SupportedUnreadAlertCategory,
BloodPressureFeature,
HIDInformation,
ReportMap,
HIDControlPoint,
Report,
ProtocolMode,
ScanIntervalWindow,
PnPID,
GlucoseFeature,
RecordAccessControlPoint,
RSCMeasurement,
RSCFeature,
SCControlPoint,
CSCMeasurement,
CSCFeature,
SensorLocation,
CyclingPowerMeasurement,
CyclingPowerVector,
CyclingPowerFeature,
CyclingPowerControlPoint,
LocationAndSpeed,
Navigation,
PositionQuality,
LNFeature,
LNControlPoint,
Elevation,
Pressure,
Temperature,
Humidity,
TrueWindSpeed,
TrueWindDirection,
ApparentWindSpeed,
ApparentWindDirection,
GustFactor,
PollenConcentration,
UVIndex,
Irradiance,
Rainfall,
WindChill,
HeatIndex,
DewPoint,
DescriptorValueChanged,
AerobicHeartRateLowerLimit,
AerobicThreshold,
Age,
AnaerobicHeartRateLowerLimit,
AnaerobicHeartRateUpperLimit,
AnaerobicThreshold,
AerobicHeartRateUpperLimit,
DateOfBirth,
DateOfThresholdAssessment,
EmailAddress,
FatBurnHeartRateLowerLimit,
FatBurnHeartRateUpperLimit,
FirstName,
FiveZoneHeartRateLimits,
Gender,
HeartRateMax,
Height,
HipCircumference,
LastName,
MaximumRecommendedHeartRate,
RestingHeartRate,
SportTypeForAerobicAnaerobicThresholds,
ThreeZoneHeartRateLimits,
TwoZoneHeartRateLimits,
VO2Max,
WaistCircumference,
Weight,
DatabaseChangeIncrement,
UserIndex,
BodyCompositionFeature,
BodyCompositionMeasurement,
WeightMeasurement,
WeightScaleFeature,
UserControlPoint,
MagneticFluxDensity2D,
MagneticFluxDensity3D,
Language,
BarometricPressureTrend,
};
enum class DescriptorType
{
UnknownDescriptorType,
CharacteristicExtendedProperties,
CharacteristicUserDescription,
ClientCharacteristicConfiguration,
ServerCharacteristicConfiguration,
CharacteristicPresentationFormat,
CharacteristicAggregateFormat,
ValidRange,
ExternalReportReference,
ReportReference,
EnvironmentalSensingConfiguration,
EnvironmentalSensingMeasurement,
EnvironmentalSensingTriggerSetting,
};
QBluetoothUuid();
QBluetoothUuid(QBluetoothUuid::ProtocolUuid uuid);
QBluetoothUuid(QBluetoothUuid::ServiceClassUuid uuid);
QBluetoothUuid(QBluetoothUuid::CharacteristicType uuid);
QBluetoothUuid(QBluetoothUuid::DescriptorType uuid);
explicit QBluetoothUuid(quint32 uuid);
%If (Qt_6_6_0 -)
QBluetoothUuid(quint128 uuid, QSysInfo::Endian order = QSysInfo::BigEndian);
%End
%If (- Qt_6_6_0)
explicit QBluetoothUuid(quint128 uuid);
%End
explicit QBluetoothUuid(const QString &uuid);
QBluetoothUuid(const QBluetoothUuid &uuid);
QBluetoothUuid(const QUuid &uuid);
~QBluetoothUuid();
int minimumSize() const;
quint16 toUInt16(bool *ok = 0) const;
quint32 toUInt32(bool *ok = 0) const;
quint128 toUInt128() const;
static QString serviceClassToString(QBluetoothUuid::ServiceClassUuid uuid);
static QString protocolToString(QBluetoothUuid::ProtocolUuid uuid);
static QString characteristicToString(QBluetoothUuid::CharacteristicType uuid);
static QString descriptorToString(QBluetoothUuid::DescriptorType uuid);
%If (Qt_6_7_0 -)
// This is reimplemented because the == and != operators prevent the
// super-class's implementation from being inherited.
Py_hash_t __hash__() const;
%MethodCode
sipRes = qHash(*sipCpp);
%End
%End
};
%End
%If (Qt_6_2_0 -)
QDataStream &operator<<(QDataStream &s, const QBluetoothUuid &uuid) /ReleaseGIL/;
%End
%If (Qt_6_2_0 -)
QDataStream &operator>>(QDataStream &s, QBluetoothUuid &uuid /Constrained/) /ReleaseGIL/;
%End
%If (Qt_6_2_0 -)
bool operator==(const QBluetoothUuid &a, const QBluetoothUuid &b);
%End
%If (Qt_6_2_0 -)
bool operator!=(const QBluetoothUuid &a, const QBluetoothUuid &b);
%End

View File

@@ -0,0 +1,66 @@
// qlowenergyadvertisingdata.sip generated by MetaSIP
//
// This file is part of the QtBluetooth Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QLowEnergyAdvertisingData
{
%TypeHeaderCode
#include <qlowenergyadvertisingdata.h>
%End
public:
QLowEnergyAdvertisingData();
QLowEnergyAdvertisingData(const QLowEnergyAdvertisingData &other);
~QLowEnergyAdvertisingData();
void setLocalName(const QString &name);
QString localName() const;
static quint16 invalidManufacturerId();
void setManufacturerData(quint16 id, const QByteArray &data);
quint16 manufacturerId() const;
QByteArray manufacturerData() const;
void setIncludePowerLevel(bool doInclude);
bool includePowerLevel() const;
enum Discoverability
{
DiscoverabilityNone,
DiscoverabilityLimited,
DiscoverabilityGeneral,
};
void setDiscoverability(QLowEnergyAdvertisingData::Discoverability mode);
QLowEnergyAdvertisingData::Discoverability discoverability() const;
void setServices(const QList<QBluetoothUuid> &services);
QList<QBluetoothUuid> services() const;
void setRawData(const QByteArray &data);
QByteArray rawData() const;
void swap(QLowEnergyAdvertisingData &other);
};
%End
%If (Qt_6_2_0 -)
bool operator==(const QLowEnergyAdvertisingData &data1, const QLowEnergyAdvertisingData &data2);
%End
%If (Qt_6_2_0 -)
bool operator!=(const QLowEnergyAdvertisingData &data1, const QLowEnergyAdvertisingData &data2);
%End

View File

@@ -0,0 +1,88 @@
// qlowenergyadvertisingparameters.sip generated by MetaSIP
//
// This file is part of the QtBluetooth Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QLowEnergyAdvertisingParameters
{
%TypeHeaderCode
#include <qlowenergyadvertisingparameters.h>
%End
public:
QLowEnergyAdvertisingParameters();
QLowEnergyAdvertisingParameters(const QLowEnergyAdvertisingParameters &other);
~QLowEnergyAdvertisingParameters();
enum Mode
{
AdvInd,
AdvScanInd,
AdvNonConnInd,
};
void setMode(QLowEnergyAdvertisingParameters::Mode mode);
QLowEnergyAdvertisingParameters::Mode mode() const;
class AddressInfo
{
%TypeHeaderCode
#include <qlowenergyadvertisingparameters.h>
%End
public:
AddressInfo(const QBluetoothAddress &addr, QLowEnergyController::RemoteAddressType t);
AddressInfo();
QBluetoothAddress address;
QLowEnergyController::RemoteAddressType type;
};
enum FilterPolicy
{
IgnoreWhiteList,
UseWhiteListForScanning,
UseWhiteListForConnecting,
UseWhiteListForScanningAndConnecting,
};
void setWhiteList(const QList<QLowEnergyAdvertisingParameters::AddressInfo> &whiteList, QLowEnergyAdvertisingParameters::FilterPolicy policy);
QList<QLowEnergyAdvertisingParameters::AddressInfo> whiteList() const;
QLowEnergyAdvertisingParameters::FilterPolicy filterPolicy() const;
void setInterval(quint16 minimum, quint16 maximum);
int minimumInterval() const;
int maximumInterval() const;
void swap(QLowEnergyAdvertisingParameters &other);
};
%End
%If (Qt_6_2_0 -)
bool operator==(const QLowEnergyAdvertisingParameters &p1, const QLowEnergyAdvertisingParameters &p2);
%End
%If (Qt_6_2_0 -)
bool operator!=(const QLowEnergyAdvertisingParameters &p1, const QLowEnergyAdvertisingParameters &p2);
%End
%If (Qt_6_2_0 -)
bool operator==(const QLowEnergyAdvertisingParameters::AddressInfo &ai1, const QLowEnergyAdvertisingParameters::AddressInfo &ai2);
%End
%If (Qt_6_2_0 -)
bool operator!=(const QLowEnergyAdvertisingParameters::AddressInfo &a, const QLowEnergyAdvertisingParameters::AddressInfo &b);
%End

View File

@@ -0,0 +1,68 @@
// qlowenergycharacteristic.sip generated by MetaSIP
//
// This file is part of the QtBluetooth Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QLowEnergyCharacteristic
{
%TypeHeaderCode
#include <qlowenergycharacteristic.h>
%End
public:
enum PropertyType /BaseType=Flag/
{
Unknown,
Broadcasting,
Read,
WriteNoResponse,
Write,
Notify,
Indicate,
WriteSigned,
ExtendedProperty,
};
typedef QFlags<QLowEnergyCharacteristic::PropertyType> PropertyTypes;
QLowEnergyCharacteristic();
QLowEnergyCharacteristic(const QLowEnergyCharacteristic &other);
~QLowEnergyCharacteristic();
QString name() const;
QBluetoothUuid uuid() const;
QByteArray value() const;
QLowEnergyCharacteristic::PropertyTypes properties() const;
QLowEnergyDescriptor descriptor(const QBluetoothUuid &uuid) const;
QList<QLowEnergyDescriptor> descriptors() const;
bool isValid() const;
QLowEnergyDescriptor clientCharacteristicConfiguration() const;
static const QByteArray CCCDDisable;
static const QByteArray CCCDEnableNotification;
static const QByteArray CCCDEnableIndication;
};
%End
%If (Qt_6_2_0 -)
bool operator==(const QLowEnergyCharacteristic &a, const QLowEnergyCharacteristic &b);
%End
%If (Qt_6_2_0 -)
bool operator!=(const QLowEnergyCharacteristic &a, const QLowEnergyCharacteristic &b);
%End

View File

@@ -0,0 +1,61 @@
// qlowenergycharacteristicdata.sip generated by MetaSIP
//
// This file is part of the QtBluetooth Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QLowEnergyCharacteristicData
{
%TypeHeaderCode
#include <qlowenergycharacteristicdata.h>
%End
public:
QLowEnergyCharacteristicData();
QLowEnergyCharacteristicData(const QLowEnergyCharacteristicData &other);
~QLowEnergyCharacteristicData();
QBluetoothUuid uuid() const;
void setUuid(const QBluetoothUuid &uuid);
QByteArray value() const;
void setValue(const QByteArray &value);
QLowEnergyCharacteristic::PropertyTypes properties() const;
void setProperties(QLowEnergyCharacteristic::PropertyTypes properties);
QList<QLowEnergyDescriptorData> descriptors() const;
void setDescriptors(const QList<QLowEnergyDescriptorData> &descriptors);
void addDescriptor(const QLowEnergyDescriptorData &descriptor);
void setReadConstraints(QBluetooth::AttAccessConstraints constraints);
QBluetooth::AttAccessConstraints readConstraints() const;
void setWriteConstraints(QBluetooth::AttAccessConstraints constraints);
QBluetooth::AttAccessConstraints writeConstraints() const;
void setValueLength(int minimum, int maximum);
int minimumValueLength() const;
int maximumValueLength() const;
bool isValid() const;
void swap(QLowEnergyCharacteristicData &other);
};
%End
%If (Qt_6_2_0 -)
bool operator==(const QLowEnergyCharacteristicData &cd1, const QLowEnergyCharacteristicData &cd2);
%End
%If (Qt_6_2_0 -)
bool operator!=(const QLowEnergyCharacteristicData &cd1, const QLowEnergyCharacteristicData &cd2);
%End

View File

@@ -0,0 +1,51 @@
// qlowenergyconnectionparameters.sip generated by MetaSIP
//
// This file is part of the QtBluetooth Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QLowEnergyConnectionParameters
{
%TypeHeaderCode
#include <qlowenergyconnectionparameters.h>
%End
public:
QLowEnergyConnectionParameters();
QLowEnergyConnectionParameters(const QLowEnergyConnectionParameters &other);
~QLowEnergyConnectionParameters();
void setIntervalRange(double minimum, double maximum);
double minimumInterval() const;
double maximumInterval() const;
void setLatency(int latency);
int latency() const;
void setSupervisionTimeout(int timeout);
int supervisionTimeout() const;
void swap(QLowEnergyConnectionParameters &other);
};
%End
%If (Qt_6_2_0 -)
bool operator==(const QLowEnergyConnectionParameters &p1, const QLowEnergyConnectionParameters &p2);
%End
%If (Qt_6_2_0 -)
bool operator!=(const QLowEnergyConnectionParameters &p1, const QLowEnergyConnectionParameters &p2);
%End

View File

@@ -0,0 +1,125 @@
// qlowenergycontroller.sip generated by MetaSIP
//
// This file is part of the QtBluetooth Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QLowEnergyController : public QObject
{
%TypeHeaderCode
#include <qlowenergycontroller.h>
%End
public:
enum Error
{
NoError,
UnknownError,
UnknownRemoteDeviceError,
NetworkError,
InvalidBluetoothAdapterError,
ConnectionError,
AdvertisingError,
RemoteHostClosedError,
AuthorizationError,
%If (Qt_6_4_0 -)
MissingPermissionsError,
%End
%If (Qt_6_5_0 -)
RssiReadError,
%End
};
enum ControllerState
{
UnconnectedState,
ConnectingState,
ConnectedState,
DiscoveringState,
DiscoveredState,
ClosingState,
AdvertisingState,
};
enum RemoteAddressType
{
PublicAddress,
RandomAddress,
};
virtual ~QLowEnergyController();
QBluetoothAddress localAddress() const;
QBluetoothAddress remoteAddress() const;
QLowEnergyController::ControllerState state() const;
QLowEnergyController::RemoteAddressType remoteAddressType() const;
void setRemoteAddressType(QLowEnergyController::RemoteAddressType type);
void connectToDevice();
void disconnectFromDevice();
void discoverServices();
QList<QBluetoothUuid> services() const;
QLowEnergyService *createServiceObject(const QBluetoothUuid &service, QObject *parent /TransferThis/ = 0) /Factory/;
QLowEnergyController::Error error() const;
QString errorString() const;
QString remoteName() const;
int mtu() const;
signals:
void connected();
void disconnected();
void stateChanged(QLowEnergyController::ControllerState state);
void errorOccurred(QLowEnergyController::Error newError);
void serviceDiscovered(const QBluetoothUuid &newService);
void discoveryFinished();
void connectionUpdated(const QLowEnergyConnectionParameters &parameters);
void mtuChanged(int mtu);
public:
enum Role
{
CentralRole,
PeripheralRole,
};
static QLowEnergyController *createCentral(const QBluetoothDeviceInfo &remoteDevice, QObject *parent /TransferThis/ = 0) /Factory/;
static QLowEnergyController *createCentral(const QBluetoothDeviceInfo &remoteDevice, const QBluetoothAddress &localDevice, QObject *parent /TransferThis/ = 0) /Factory/;
static QLowEnergyController *createPeripheral(const QBluetoothAddress &localDevice, QObject *parent /TransferThis/ = 0) /Factory/;
static QLowEnergyController *createPeripheral(QObject *parent /TransferThis/ = 0) /Factory/;
void startAdvertising(const QLowEnergyAdvertisingParameters &parameters, const QLowEnergyAdvertisingData &advertisingData, const QLowEnergyAdvertisingData &scanResponseData = QLowEnergyAdvertisingData());
void stopAdvertising();
QLowEnergyService *addService(const QLowEnergyServiceData &service, QObject *parent /TransferThis/ = 0) /Factory/;
void requestConnectionUpdate(const QLowEnergyConnectionParameters &parameters);
QLowEnergyController::Role role() const;
QBluetoothUuid remoteDeviceUuid() const;
%If (Qt_6_5_0 -)
void readRssi();
%End
signals:
%If (Qt_6_5_0 -)
void rssiRead(qint16 rssi);
%End
private:
QLowEnergyController(const QBluetoothDeviceInfo &remoteDevice, const QBluetoothAddress &localDevice, QObject *parent = 0);
QLowEnergyController(const QBluetoothAddress &localDevice, QObject *parent = 0);
};
%End

View File

@@ -0,0 +1,48 @@
// qlowenergydescriptor.sip generated by MetaSIP
//
// This file is part of the QtBluetooth Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QLowEnergyDescriptor
{
%TypeHeaderCode
#include <qlowenergydescriptor.h>
%End
public:
QLowEnergyDescriptor();
QLowEnergyDescriptor(const QLowEnergyDescriptor &other);
~QLowEnergyDescriptor();
bool isValid() const;
QByteArray value() const;
QBluetoothUuid uuid() const;
QString name() const;
QBluetoothUuid::DescriptorType type() const;
};
%End
%If (Qt_6_2_0 -)
bool operator==(const QLowEnergyDescriptor &a, const QLowEnergyDescriptor &b);
%End
%If (Qt_6_2_0 -)
bool operator!=(const QLowEnergyDescriptor &a, const QLowEnergyDescriptor &b);
%End

View File

@@ -0,0 +1,56 @@
// qlowenergydescriptordata.sip generated by MetaSIP
//
// This file is part of the QtBluetooth Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QLowEnergyDescriptorData
{
%TypeHeaderCode
#include <qlowenergydescriptordata.h>
%End
public:
QLowEnergyDescriptorData();
QLowEnergyDescriptorData(const QBluetoothUuid &uuid, const QByteArray &value);
QLowEnergyDescriptorData(const QLowEnergyDescriptorData &other);
~QLowEnergyDescriptorData();
QByteArray value() const;
void setValue(const QByteArray &value);
QBluetoothUuid uuid() const;
void setUuid(const QBluetoothUuid &uuid);
bool isValid() const;
void setReadPermissions(bool readable, QBluetooth::AttAccessConstraints constraints = QBluetooth::AttAccessConstraints());
bool isReadable() const;
QBluetooth::AttAccessConstraints readConstraints() const;
void setWritePermissions(bool writable, QBluetooth::AttAccessConstraints constraints = QBluetooth::AttAccessConstraints());
bool isWritable() const;
QBluetooth::AttAccessConstraints writeConstraints() const;
void swap(QLowEnergyDescriptorData &other);
};
%End
%If (Qt_6_2_0 -)
bool operator==(const QLowEnergyDescriptorData &d1, const QLowEnergyDescriptorData &d12);
%End
%If (Qt_6_2_0 -)
bool operator!=(const QLowEnergyDescriptorData &d1, const QLowEnergyDescriptorData &d2);
%End

View File

@@ -0,0 +1,107 @@
// qlowenergyservice.sip generated by MetaSIP
//
// This file is part of the QtBluetooth Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QLowEnergyService : public QObject /NoDefaultCtors/
{
%TypeHeaderCode
#include <qlowenergyservice.h>
%End
public:
enum DiscoveryMode
{
FullDiscovery,
SkipValueDiscovery,
};
enum ServiceType /BaseType=Flag/
{
PrimaryService,
IncludedService,
};
typedef QFlags<QLowEnergyService::ServiceType> ServiceTypes;
enum ServiceError
{
NoError,
OperationError,
CharacteristicWriteError,
DescriptorWriteError,
CharacteristicReadError,
DescriptorReadError,
UnknownError,
};
enum ServiceState
{
InvalidService,
DiscoveryRequired,
ServiceDiscovered,
LocalService,
RemoteService,
RemoteServiceDiscovering,
RemoteServiceDiscovered,
DiscoveringService,
};
enum WriteMode
{
WriteWithResponse,
WriteWithoutResponse,
WriteSigned,
};
virtual ~QLowEnergyService();
QList<QBluetoothUuid> includedServices() const;
QLowEnergyService::ServiceTypes type() const;
QLowEnergyService::ServiceState state() const;
QLowEnergyCharacteristic characteristic(const QBluetoothUuid &uuid) const;
QList<QLowEnergyCharacteristic> characteristics() const;
QBluetoothUuid serviceUuid() const;
QString serviceName() const;
void discoverDetails(QLowEnergyService::DiscoveryMode mode = QLowEnergyService::FullDiscovery);
QLowEnergyService::ServiceError error() const;
bool contains(const QLowEnergyCharacteristic &characteristic) const;
bool contains(const QLowEnergyDescriptor &descriptor) const;
void writeCharacteristic(const QLowEnergyCharacteristic &characteristic, const QByteArray &newValue, QLowEnergyService::WriteMode mode = QLowEnergyService::WriteWithResponse);
void writeDescriptor(const QLowEnergyDescriptor &descriptor, const QByteArray &newValue);
signals:
void stateChanged(QLowEnergyService::ServiceState newState);
void characteristicChanged(const QLowEnergyCharacteristic &info, const QByteArray &value);
void characteristicWritten(const QLowEnergyCharacteristic &info, const QByteArray &value);
void descriptorWritten(const QLowEnergyDescriptor &info, const QByteArray &value);
void errorOccurred(QLowEnergyService::ServiceError error);
public:
void readCharacteristic(const QLowEnergyCharacteristic &characteristic);
void readDescriptor(const QLowEnergyDescriptor &descriptor);
signals:
void characteristicRead(const QLowEnergyCharacteristic &info, const QByteArray &value);
void descriptorRead(const QLowEnergyDescriptor &info, const QByteArray &value);
};
%End

View File

@@ -0,0 +1,62 @@
// qlowenergyservicedata.sip generated by MetaSIP
//
// This file is part of the QtBluetooth Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
class QLowEnergyServiceData
{
%TypeHeaderCode
#include <qlowenergyservicedata.h>
%End
public:
QLowEnergyServiceData();
QLowEnergyServiceData(const QLowEnergyServiceData &other);
~QLowEnergyServiceData();
enum ServiceType
{
ServiceTypePrimary,
ServiceTypeSecondary,
};
QLowEnergyServiceData::ServiceType type() const;
void setType(QLowEnergyServiceData::ServiceType type);
QBluetoothUuid uuid() const;
void setUuid(const QBluetoothUuid &uuid);
QList<QLowEnergyService *> includedServices() const;
void setIncludedServices(const QList<QLowEnergyService *> &services);
void addIncludedService(QLowEnergyService *service);
QList<QLowEnergyCharacteristicData> characteristics() const;
void setCharacteristics(const QList<QLowEnergyCharacteristicData> &characteristics);
void addCharacteristic(const QLowEnergyCharacteristicData &characteristic);
bool isValid() const;
void swap(QLowEnergyServiceData &other);
};
%End
%If (Qt_6_2_0 -)
bool operator==(const QLowEnergyServiceData &sd1, const QLowEnergyServiceData &sd2);
%End
%If (Qt_6_2_0 -)
bool operator!=(const QLowEnergyServiceData &sd1, const QLowEnergyServiceData &sd2);
%End

View File

@@ -0,0 +1,133 @@
// This is the SIP interface definition for the QList based mapped types
// specific to the QtBluetooth module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
// QBluetoothServiceInfo::Sequence is actually a sub-class of QList<QVariant>.
// Note that QBluetoothServiceInfo::Alternative is identical and they are both
// syntactic sugar. By ignoring methods using the latter then everything works
// as expected.
%MappedType QBluetoothServiceInfo::Sequence
/TypeHintIn="Iterable[QVariant]", TypeHintOut="List[QVariant]",
TypeHintValue="[]"/
{
%TypeHeaderCode
#include <qbluetoothserviceinfo.h>
%End
%ConvertFromTypeCode
PyObject *l = PyList_New(sipCpp->size());
if (!l)
return 0;
for (int i = 0; i < sipCpp->size(); ++i)
{
QVariant *t = new QVariant(sipCpp->at(i));
PyObject *tobj = sipConvertFromNewType(t, sipType_QVariant,
sipTransferObj);
if (!tobj)
{
delete t;
Py_DECREF(l);
return 0;
}
PyList_SetItem(l, i, tobj);
}
return l;
%End
%ConvertToTypeCode
PyObject *iter = PyObject_GetIter(sipPy);
if (!sipIsErr)
{
PyErr_Clear();
Py_XDECREF(iter);
return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy));
}
if (!iter)
{
*sipIsErr = 1;
return 0;
}
QBluetoothServiceInfo::Sequence *ql = new QBluetoothServiceInfo::Sequence;
for (Py_ssize_t i = 0; ; ++i)
{
PyErr_Clear();
PyObject *itm = PyIter_Next(iter);
if (!itm)
{
if (PyErr_Occurred())
{
delete ql;
Py_DECREF(iter);
*sipIsErr = 1;
return 0;
}
break;
}
int state;
QVariant *t = reinterpret_cast<QVariant *>(
sipForceConvertToType(itm, sipType_QVariant, sipTransferObj,
SIP_NOT_NONE, &state, sipIsErr));
if (*sipIsErr)
{
PyErr_Format(PyExc_TypeError,
"index %zd has type '%s' but '_TYPE_' is expected", i,
sipPyTypeName(Py_TYPE(itm)));
Py_DECREF(itm);
delete ql;
Py_DECREF(iter);
return 0;
}
ql->append(*t);
sipReleaseType(t, sipType_QVariant, state);
Py_DECREF(itm);
}
Py_DECREF(iter);
*sipCppPtr = ql;
return sipGetState(sipTransferObj);
%End
};
%End

View File

@@ -0,0 +1,183 @@
// This is the SIP interface definition for the QNultiHash based mapped types.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
template<quint16, _TYPE_>
%MappedType QMultiHash<quint16, _TYPE_>
/TypeHint="Dict[int, _TYPE_]", TypeHintValue="{}"/
{
%TypeHeaderCode
#include <QMultiHash>
%End
%ConvertFromTypeCode
PyObject *d = PyDict_New();
if (!d)
return 0;
QMultiHash<quint16, _TYPE_>::const_iterator it = sipCpp->constBegin();
QMultiHash<quint16, _TYPE_>::const_iterator end = sipCpp->constEnd();
while (it != end)
{
PyObject *kobj = PyLong_FromLong(it.key());
if (!kobj)
{
Py_DECREF(d);
return 0;
}
QList<_TYPE_> values = sipCpp->values(it.key());
PyObject *py_values = PyList_New(values.size());
if (!py_values)
{
Py_DECREF(kobj);
Py_DECREF(d);
return 0;
}
int rc = PyDict_SetItem(d, kobj, py_values);
Py_DECREF(py_values);
Py_DECREF(kobj);
if (rc < 0)
{
Py_DECREF(d);
return 0;
}
for (int i = 0; i < values.size(); ++i)
{
_TYPE_ *v = new _TYPE_(values.at(i));
PyObject *vobj = sipConvertFromNewType(v, sipType__TYPE_,
sipTransferObj);
if (!vobj)
{
delete v;
Py_DECREF(d);
return 0;
}
PyList_SetItem(py_values, i, vobj);
}
++it;
}
return d;
%End
};
%End
%If (Qt_6_3_0 -)
template<_TYPE1_, _TYPE2_>
%MappedType QMultiHash<_TYPE1_, _TYPE2_>
/TypeHint="Dict[_TYPE1_, _TYPE2_]", TypeHintValue="{}"/
{
%TypeHeaderCode
#include <QMultiHash>
%End
%ConvertFromTypeCode
PyObject *d = PyDict_New();
if (!d)
return 0;
QMultiHash<_TYPE1_, _TYPE2_>::const_iterator it = sipCpp->constBegin();
QMultiHash<_TYPE1_, _TYPE2_>::const_iterator end = sipCpp->constEnd();
while (it != end)
{
_TYPE1_ *k = new _TYPE1_(it.key());
PyObject *kobj = sipConvertFromNewType(k, sipType__TYPE1_,
sipTransferObj);
if (!kobj)
{
delete k;
Py_DECREF(d);
return 0;
}
QList<_TYPE2_> values = sipCpp->values(it.key());
PyObject *py_values = PyList_New(values.size());
if (!py_values)
{
Py_DECREF(kobj);
Py_DECREF(d);
return 0;
}
int rc = PyDict_SetItem(d, kobj, py_values);
Py_DECREF(py_values);
Py_DECREF(kobj);
if (rc < 0)
{
Py_DECREF(d);
return 0;
}
for (int i = 0; i < values.size(); ++i)
{
_TYPE2_ *v = new _TYPE2_(values.at(i));
PyObject *vobj = sipConvertFromNewType(v, sipType__TYPE2_,
sipTransferObj);
if (!vobj)
{
delete v;
Py_DECREF(d);
return 0;
}
PyList_SetItem(py_values, i, vobj);
}
++it;
}
return d;
%End
};
%End

View File

@@ -0,0 +1,131 @@
// This is the SIP interface definition for the quint128 mapped type.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
%MappedType quint128 /TypeHint="Tuple[int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int]"/
{
%TypeHeaderCode
#include <qbluetoothuuid.h>
%End
%ConvertFromTypeCode
PyObject *t = PyTuple_New(16);
if (!t)
return 0;
#if defined(QT_SUPPORTS_INT128)
// This was added in Qt v6.6.0.
quint128 value = *sipCpp;
#endif
for (Py_ssize_t i = 0; i < 16; ++i)
{
// Convert to a Python long to make sure it doesn't get interpreted as
// a signed value.
#if defined(QT_SUPPORTS_INT128)
PyObject *pobj = PyLong_FromUnsignedLong(value & 255);
value >>= 8;
#else
PyObject *pobj = PyLong_FromUnsignedLong(sipCpp->data[i]);
#endif
if (!pobj)
{
Py_DECREF(t);
return 0;
}
PyTuple_SetItem(t, i, pobj);
}
return t;
%End
%ConvertToTypeCode
if (!sipIsErr)
return (PySequence_Check(sipPy) && !PyUnicode_Check(sipPy));
Py_ssize_t len = PySequence_Size(sipPy);
if (len != 16)
{
// A negative length should only be an internal error so let the
// original exception stand.
if (len >= 0)
PyErr_Format(PyExc_TypeError,
"sequence has %zd elements but 16 elements are expected",
len);
*sipIsErr = 1;
return 0;
}
quint128 *qv = new quint128;
for (Py_ssize_t i = 15; i >= 0; --i)
{
PyObject *itm = PySequence_GetItem(sipPy, i);
if (!itm)
{
delete qv;
*sipIsErr = 1;
return 0;
}
PyErr_Clear();
unsigned long val = PyLong_AsUnsignedLongMask(itm);
if (PyErr_Occurred())
{
PyErr_Format(PyExc_TypeError,
"element %zd has type '%s' but 'int' is expected", i,
sipPyTypeName(Py_TYPE(itm)));
Py_DECREF(itm);
delete qv;
*sipIsErr = 1;
return 0;
}
#if defined(QT_SUPPORTS_INT128)
// This was added in Qt v6.6.0.
(*qv) <<= 8;
(*qv) |= (val & 255);
#else
qv->data[i] = val;
#endif
Py_DECREF(itm);
}
*sipCppPtr = qv;
return sipGetState(sipTransferObj);
%End
};
%End