qlowenergycontroller.sip 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. // qlowenergycontroller.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtBluetooth Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  8. //
  9. // This file may be used under the terms of the GNU General Public License
  10. // version 3.0 as published by the Free Software Foundation and appearing in
  11. // the file LICENSE included in the packaging of this file. Please review the
  12. // following information to ensure the GNU General Public License version 3.0
  13. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  14. //
  15. // If you do not wish to use this file under the terms of the GPL version 3.0
  16. // then you may purchase a commercial license. For more information contact
  17. // info@riverbankcomputing.com.
  18. //
  19. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  20. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21. %If (Qt_6_2_0 -)
  22. class QLowEnergyController : public QObject
  23. {
  24. %TypeHeaderCode
  25. #include <qlowenergycontroller.h>
  26. %End
  27. public:
  28. enum Error
  29. {
  30. NoError,
  31. UnknownError,
  32. UnknownRemoteDeviceError,
  33. NetworkError,
  34. InvalidBluetoothAdapterError,
  35. ConnectionError,
  36. AdvertisingError,
  37. RemoteHostClosedError,
  38. AuthorizationError,
  39. %If (Qt_6_4_0 -)
  40. MissingPermissionsError,
  41. %End
  42. %If (Qt_6_5_0 -)
  43. RssiReadError,
  44. %End
  45. };
  46. enum ControllerState
  47. {
  48. UnconnectedState,
  49. ConnectingState,
  50. ConnectedState,
  51. DiscoveringState,
  52. DiscoveredState,
  53. ClosingState,
  54. AdvertisingState,
  55. };
  56. enum RemoteAddressType
  57. {
  58. PublicAddress,
  59. RandomAddress,
  60. };
  61. virtual ~QLowEnergyController();
  62. QBluetoothAddress localAddress() const;
  63. QBluetoothAddress remoteAddress() const;
  64. QLowEnergyController::ControllerState state() const;
  65. QLowEnergyController::RemoteAddressType remoteAddressType() const;
  66. void setRemoteAddressType(QLowEnergyController::RemoteAddressType type);
  67. void connectToDevice();
  68. void disconnectFromDevice();
  69. void discoverServices();
  70. QList<QBluetoothUuid> services() const;
  71. QLowEnergyService *createServiceObject(const QBluetoothUuid &service, QObject *parent /TransferThis/ = 0) /Factory/;
  72. QLowEnergyController::Error error() const;
  73. QString errorString() const;
  74. QString remoteName() const;
  75. int mtu() const;
  76. signals:
  77. void connected();
  78. void disconnected();
  79. void stateChanged(QLowEnergyController::ControllerState state);
  80. void errorOccurred(QLowEnergyController::Error newError);
  81. void serviceDiscovered(const QBluetoothUuid &newService);
  82. void discoveryFinished();
  83. void connectionUpdated(const QLowEnergyConnectionParameters &parameters);
  84. void mtuChanged(int mtu);
  85. public:
  86. enum Role
  87. {
  88. CentralRole,
  89. PeripheralRole,
  90. };
  91. static QLowEnergyController *createCentral(const QBluetoothDeviceInfo &remoteDevice, QObject *parent /TransferThis/ = 0) /Factory/;
  92. static QLowEnergyController *createCentral(const QBluetoothDeviceInfo &remoteDevice, const QBluetoothAddress &localDevice, QObject *parent /TransferThis/ = 0) /Factory/;
  93. static QLowEnergyController *createPeripheral(const QBluetoothAddress &localDevice, QObject *parent /TransferThis/ = 0) /Factory/;
  94. static QLowEnergyController *createPeripheral(QObject *parent /TransferThis/ = 0) /Factory/;
  95. void startAdvertising(const QLowEnergyAdvertisingParameters &parameters, const QLowEnergyAdvertisingData &advertisingData, const QLowEnergyAdvertisingData &scanResponseData = QLowEnergyAdvertisingData());
  96. void stopAdvertising();
  97. QLowEnergyService *addService(const QLowEnergyServiceData &service, QObject *parent /TransferThis/ = 0) /Factory/;
  98. void requestConnectionUpdate(const QLowEnergyConnectionParameters &parameters);
  99. QLowEnergyController::Role role() const;
  100. QBluetoothUuid remoteDeviceUuid() const;
  101. %If (Qt_6_5_0 -)
  102. void readRssi();
  103. %End
  104. signals:
  105. %If (Qt_6_5_0 -)
  106. void rssiRead(qint16 rssi);
  107. %End
  108. private:
  109. QLowEnergyController(const QBluetoothDeviceInfo &remoteDevice, const QBluetoothAddress &localDevice, QObject *parent = 0);
  110. QLowEnergyController(const QBluetoothAddress &localDevice, QObject *parent = 0);
  111. };
  112. %End