diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2020-06-24 09:38:55 +0200 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2020-06-25 10:06:14 +0200 |
commit | fba18bb44a02a58794d3be8e49bddcffbd614f94 (patch) | |
tree | ee6eed2bf3491e46022c502005356ea22d6271ad /src | |
parent | 73c52b16bd087862e403abebb718862c2662345c (diff) |
Use QList instead of QVector
Task-number: QTBUG-84469
Change-Id: I2b51afeae462d051a3d62dc34ab8c6a63276853c
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src')
36 files changed, 168 insertions, 162 deletions
diff --git a/src/bluetooth/android/devicediscoverybroadcastreceiver.cpp b/src/bluetooth/android/devicediscoverybroadcastreceiver.cpp index c145d249..974b4bcd 100644 --- a/src/bluetooth/android/devicediscoverybroadcastreceiver.cpp +++ b/src/bluetooth/android/devicediscoverybroadcastreceiver.cpp @@ -515,7 +515,7 @@ QBluetoothDeviceInfo DeviceDiscoveryBroadcastReceiver::retrieveDeviceInfo(JNIEnv const char *scanRecordBuffer = reinterpret_cast<const char *>(elems); const int scanRecordLength = env->GetArrayLength(scanRecord); - QVector<QBluetoothUuid> serviceUuids; + QList<QBluetoothUuid> serviceUuids; int i = 0; // Spec 4.2, Vol 3, Part C, Chapter 11 diff --git a/src/bluetooth/bluez/hcimanager.cpp b/src/bluetooth/bluez/hcimanager.cpp index 427d922f..4f2e6163 100644 --- a/src/bluetooth/bluez/hcimanager.cpp +++ b/src/bluetooth/bluez/hcimanager.cpp @@ -284,10 +284,10 @@ QBluetoothAddress HciManager::addressForConnectionHandle(quint16 handle) const return QBluetoothAddress(); } -QVector<quint16> HciManager::activeLowEnergyConnections() const +QList<quint16> HciManager::activeLowEnergyConnections() const { if (!isValid()) - return QVector<quint16>(); + return QList<quint16>(); hci_conn_info *info; hci_conn_list_req *infoList; @@ -297,7 +297,7 @@ QVector<quint16> HciManager::activeLowEnergyConnections() const malloc(sizeof(hci_conn_list_req) + maxNoOfConnections * sizeof(hci_conn_info)); if (!infoList) - return QVector<quint16>(); + return QList<quint16>(); QScopedPointer<hci_conn_list_req, QScopedPointerPodDeleter> p(infoList); p->conn_num = maxNoOfConnections; @@ -306,10 +306,10 @@ QVector<quint16> HciManager::activeLowEnergyConnections() const if (ioctl(hciSocket, HCIGETCONNLIST, (void *) infoList) < 0) { qCWarning(QT_BT_BLUEZ) << "Cannot retrieve connection list"; - return QVector<quint16>(); + return QList<quint16>(); } - QVector<quint16> activeLowEnergyHandles; + QList<quint16> activeLowEnergyHandles; for (int i = 0; i < infoList->conn_num; i++) { switch (info[i].type) { case SCO_LINK: diff --git a/src/bluetooth/bluez/hcimanager_p.h b/src/bluetooth/bluez/hcimanager_p.h index 15b8791e..f51d74b0 100644 --- a/src/bluetooth/bluez/hcimanager_p.h +++ b/src/bluetooth/bluez/hcimanager_p.h @@ -51,11 +51,11 @@ // We mean it. // -#include <QObject> +#include <QtCore/QObject> +#include <QtCore/QList> #include <QtCore/QSet> #include <QtCore/QSocketNotifier> #include <QtBluetooth/QBluetoothAddress> -#include <QVector> #include "bluez/bluez_data_p.h" QT_BEGIN_NAMESPACE @@ -84,7 +84,7 @@ public: QBluetoothAddress addressForConnectionHandle(quint16 handle) const; // active connections - QVector<quint16> activeLowEnergyConnections() const; + QList<quint16> activeLowEnergyConnections() const; bool sendConnectionUpdateCommand(quint16 handle, const QLowEnergyConnectionParameters ¶ms); bool sendConnectionParameterUpdateRequest(quint16 handle, diff --git a/src/bluetooth/bluez/remotedevicemanager.cpp b/src/bluetooth/bluez/remotedevicemanager.cpp index 5d17d571..0137b5ef 100644 --- a/src/bluetooth/bluez/remotedevicemanager.cpp +++ b/src/bluetooth/bluez/remotedevicemanager.cpp @@ -68,8 +68,7 @@ RemoteDeviceManager::RemoteDeviceManager( } } -bool RemoteDeviceManager::scheduleJob( - JobType job, const QVector<QBluetoothAddress> &remoteDevices) +bool RemoteDeviceManager::scheduleJob(JobType job, const QList<QBluetoothAddress> &remoteDevices) { if (adapterPath.isEmpty()) return false; diff --git a/src/bluetooth/bluez/remotedevicemanager_p.h b/src/bluetooth/bluez/remotedevicemanager_p.h index d177d74e..01e110e0 100644 --- a/src/bluetooth/bluez/remotedevicemanager_p.h +++ b/src/bluetooth/bluez/remotedevicemanager_p.h @@ -53,9 +53,9 @@ #include <deque> +#include <QList> #include <QMutex> #include <QObject> -#include <QVector> #include <QtBluetooth/qbluetoothaddress.h> @@ -76,7 +76,7 @@ public: explicit RemoteDeviceManager(const QBluetoothAddress& localAddress, QObject *parent = nullptr); bool isJobInProgress() const { return jobInProgress; } - bool scheduleJob(JobType job, const QVector<QBluetoothAddress>& remoteDevices); + bool scheduleJob(JobType job, const QList<QBluetoothAddress> &remoteDevices); signals: void finished(); diff --git a/src/bluetooth/darwin/btsdpinquiry_p.h b/src/bluetooth/darwin/btsdpinquiry_p.h index 6cce5703..7b492cb4 100644 --- a/src/bluetooth/darwin/btsdpinquiry_p.h +++ b/src/bluetooth/darwin/btsdpinquiry_p.h @@ -56,7 +56,6 @@ #include <QtCore/qglobal.h> #include <QtCore/qlist.h> -#include <QtCore/qvector.h> #include <Foundation/Foundation.h> @@ -75,7 +74,7 @@ class SDPInquiryDelegate; void extract_service_record(IOBluetoothSDPServiceRecord *record, QBluetoothServiceInfo &serviceInfo); QVariant extract_attribute_value(IOBluetoothSDPDataElement *dataElement); -QVector<QBluetoothUuid> extract_services_uuids(IOBluetoothDevice *device); +QList<QBluetoothUuid> extract_services_uuids(IOBluetoothDevice *device); } // namespace DarwinBluetooth diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp index 5338a665..648ddac2 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp @@ -372,7 +372,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::processDiscoveredDevices( } if (discoveredDevices[i].manufacturerData() != info.manufacturerData()) { qCDebug(QT_BT_ANDROID) << "Updating manufacturer data for" << info.address(); - const QVector<quint16> keys = info.manufacturerIds(); + const QList<quint16> keys = info.manufacturerIds(); for (auto key: keys) discoveredDevices[i].setManufacturerData(key, info.manufacturerData(key)); updatedFields.setFlag(QBluetoothDeviceInfo::Field::ManufacturerData); diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp index 7053df82..d650a49a 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp @@ -376,7 +376,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::_q_deviceFound(const QString &addres QBluetoothDeviceInfo device(btAddress, btName, btClass); if (dict.value(QStringLiteral("RSSI")).isValid()) device.setRssi(dict.value(QStringLiteral("RSSI")).toInt()); - QVector<QBluetoothUuid> uuids; + QList<QBluetoothUuid> uuids; const QStringList uuidStrings = dict.value(QLatin1String("UUIDs")).toStringList(); for (const QString &u : uuidStrings) @@ -427,7 +427,7 @@ static QBluetoothDeviceInfo createDeviceInfoFromBluez5Device(const QVariantMap& QBluetoothDeviceInfo deviceInfo(btAddress, btName, btClass); deviceInfo.setRssi(qvariant_cast<short>(properties[QStringLiteral("RSSI")])); - QVector<QBluetoothUuid> uuids; + QList<QBluetoothUuid> uuids; bool foundLikelyLowEnergyUuid = false; const QStringList foundUuids = qvariant_cast<QStringList>(properties[QStringLiteral("UUIDs")]); for (const auto &u: foundUuids) { diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp index c7501bfd..05ab3e53 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp @@ -62,7 +62,7 @@ struct LeDeviceEntry { QBluetoothAddress deviceAddress; }; -Q_GLOBAL_STATIC(QVector<LeDeviceEntry>, cachedLeDeviceEntries) +Q_GLOBAL_STATIC(QList<LeDeviceEntry>, cachedLeDeviceEntries) Q_GLOBAL_STATIC(QMutex, cachedLeDeviceEntriesGuard) static QString devicePropertyString( @@ -185,8 +185,7 @@ static void closeClassicSearch(HBLUETOOTH_DEVICE_FIND hSearch) ::BluetoothFindDeviceClose(hSearch); } -static QVector<QBluetoothDeviceInfo> enumerateLeDevices( - DWORD *systemErrorCode) +static QList<QBluetoothDeviceInfo> enumerateLeDevices(DWORD *systemErrorCode) { // GUID_BLUETOOTHLE_DEVICE_INTERFACE const QUuid deviceInterfaceGuid("781aee18-7733-4ce4-add0-91f41c67b592"); @@ -198,13 +197,13 @@ static QVector<QBluetoothDeviceInfo> enumerateLeDevices( if (hDeviceInfo == INVALID_HANDLE_VALUE) { *systemErrorCode = int(::GetLastError()); - return QVector<QBluetoothDeviceInfo>(); + return QList<QBluetoothDeviceInfo>(); } - QVector<QBluetoothDeviceInfo> foundDevices; + QList<QBluetoothDeviceInfo> foundDevices; DWORD index = 0; - QVector<LeDeviceEntry> cachedEntries; + QList<LeDeviceEntry> cachedEntries; for (;;) { SP_DEVICE_INTERFACE_DATA deviceInterfaceData = {}; @@ -280,7 +279,7 @@ static QVector<QBluetoothDeviceInfo> enumerateLeDevices( } struct DiscoveryResult { - QVector<QBluetoothDeviceInfo> devices; + QList<QBluetoothDeviceInfo> devices; DWORD systemErrorCode; HBLUETOOTH_DEVICE_FIND hSearch; // Used only for classic devices }; diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp index edc02a28..87b18e5d 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp @@ -167,7 +167,7 @@ private: #if QT_CONFIG(winrt_btle_no_pairing) QMutex m_foundDevicesMutex; struct LEAdvertisingInfo { - QVector<QBluetoothUuid> services; + QList<QBluetoothUuid> services; qint16 rssi = 0; }; @@ -342,7 +342,7 @@ void QWinRTBluetoothDeviceDiscoveryWorker::setupLEDeviceWatcher() quint32 size; hr = guids->get_Size(&size); Q_ASSERT_SUCCEEDED(hr); - QVector<QBluetoothUuid> serviceUuids; + QList<QBluetoothUuid> serviceUuids; for (quint32 i = 0; i < size; ++i) { GUID guid; hr = guids->GetAt(i, &guid); @@ -356,7 +356,7 @@ void QWinRTBluetoothDeviceDiscoveryWorker::setupLEDeviceWatcher() if (size == 0) return S_OK; const LEAdvertisingInfo adInfo = m_foundLEDevicesMap.value(address); - QVector<QBluetoothUuid> foundServices = adInfo.services; + QList<QBluetoothUuid> foundServices = adInfo.services; if (adInfo.rssi != rssi) { m_foundLEDevicesMap[address].rssi = rssi; changedFields.setFlag(QBluetoothDeviceInfo::Field::RSSI); @@ -561,7 +561,7 @@ HRESULT QWinRTBluetoothDeviceDiscoveryWorker::onPairedClassicBluetoothDeviceFoun uint serviceCount; hr = deviceServices->get_Size(&serviceCount); Q_ASSERT_SUCCEEDED(hr); - QVector<QBluetoothUuid> uuids; + QList<QBluetoothUuid> uuids; for (uint i = 0; i < serviceCount; ++i) { ComPtr<Rfcomm::IRfcommDeviceService> service; hr = deviceServices->GetAt(i, &service); @@ -700,7 +700,7 @@ HRESULT QWinRTBluetoothDeviceDiscoveryWorker::onBluetoothLEDeviceFound(ComPtr<IB uint serviceCount; hr = deviceServices->get_Size(&serviceCount); Q_ASSERT_SUCCEEDED(hr); - QVector<QBluetoothUuid> uuids; + QList<QBluetoothUuid> uuids; for (uint i = 0; i < serviceCount; ++i) { ComPtr<GenericAttributeProfile::IGattDeviceService> service; hr = deviceServices->GetAt(i, &service); @@ -766,7 +766,7 @@ HRESULT QWinRTBluetoothDeviceDiscoveryWorker::onBluetoothLEDeviceFound(ComPtr<IB boolean isPaired; hr = pairing->get_IsPaired(&isPaired); Q_ASSERT_SUCCEEDED(hr); - QVector<QBluetoothUuid> uuids; + QList<QBluetoothUuid> uuids; const LEAdvertisingInfo adInfo = m_foundLEDevicesMap.value(address); const qint16 rssi = adInfo.rssi; @@ -886,7 +886,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::registerDevice(const QBluetoothDevic qCDebug(QT_BT_WINRT) << "Updating device" << iter->name() << iter->address(); // merge service uuids #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - QVector<QBluetoothUuid> uuids = iter->serviceUuids(); + QList<QBluetoothUuid> uuids = iter->serviceUuids(); #else QList<QBluetoothUuid> uuids = iter->serviceUuids(); #endif diff --git a/src/bluetooth/qbluetoothdeviceinfo.cpp b/src/bluetooth/qbluetoothdeviceinfo.cpp index 2cff0f97..c31508ad 100644 --- a/src/bluetooth/qbluetoothdeviceinfo.cpp +++ b/src/bluetooth/qbluetoothdeviceinfo.cpp @@ -527,7 +527,7 @@ quint8 QBluetoothDeviceInfo::minorDeviceClass() const Sets the list of service UUIDs to \a uuids. \since 5.13 */ -void QBluetoothDeviceInfo::setServiceUuids(const QVector<QBluetoothUuid> &uuids) +void QBluetoothDeviceInfo::setServiceUuids(const QList<QBluetoothUuid> &uuids) { Q_D(QBluetoothDeviceInfo); d->serviceUuids = uuids; @@ -541,7 +541,7 @@ void QBluetoothDeviceInfo::setServiceUuids(const QVector<QBluetoothUuid> &uuids) \sa serviceUuids() \since 6.0 */ -QVector<QBluetoothUuid> QBluetoothDeviceInfo::serviceUuids() const +QList<QBluetoothUuid> QBluetoothDeviceInfo::serviceUuids() const { Q_D(const QBluetoothDeviceInfo); return d->serviceUuids; @@ -554,7 +554,7 @@ QVector<QBluetoothUuid> QBluetoothDeviceInfo::serviceUuids() const \since 5.12 */ -QVector<quint16> QBluetoothDeviceInfo::manufacturerIds() const +QList<quint16> QBluetoothDeviceInfo::manufacturerIds() const { Q_D(const QBluetoothDeviceInfo); return d->manufacturerData.keys().toVector(); diff --git a/src/bluetooth/qbluetoothdeviceinfo.h b/src/bluetooth/qbluetoothdeviceinfo.h index 48710bfe..e3ef7400 100644 --- a/src/bluetooth/qbluetoothdeviceinfo.h +++ b/src/bluetooth/qbluetoothdeviceinfo.h @@ -42,10 +42,10 @@ #include <QtBluetooth/qtbluetoothglobal.h> -#include <QtCore/qstring.h> -#include <QtCore/qmetatype.h> #include <QtCore/qbytearray.h> -#include <QtCore/qvector.h> +#include <QtCore/qlist.h> +#include <QtCore/qmetatype.h> +#include <QtCore/qstring.h> QT_BEGIN_NAMESPACE @@ -237,10 +237,10 @@ public: qint16 rssi() const; void setRssi(qint16 signal); - QVector<QBluetoothUuid> serviceUuids() const; - void setServiceUuids(const QVector<QBluetoothUuid> &uuids); + QList<QBluetoothUuid> serviceUuids() const; + void setServiceUuids(const QList<QBluetoothUuid> &uuids); - QVector<quint16> manufacturerIds() const; + QList<quint16> manufacturerIds() const; QByteArray manufacturerData(quint16 manufacturerId) const; bool setManufacturerData(quint16 manufacturerId, const QByteArray &data); QMultiHash<quint16, QByteArray> manufacturerData() const; diff --git a/src/bluetooth/qbluetoothdeviceinfo_p.h b/src/bluetooth/qbluetoothdeviceinfo_p.h index c0f81877..25c70960 100644 --- a/src/bluetooth/qbluetoothdeviceinfo_p.h +++ b/src/bluetooth/qbluetoothdeviceinfo_p.h @@ -76,7 +76,7 @@ public: QBluetoothDeviceInfo::ServiceClasses serviceClasses = QBluetoothDeviceInfo::NoService; - QVector<QBluetoothUuid> serviceUuids; + QList<QBluetoothUuid> serviceUuids; QMultiHash<quint16, QByteArray> manufacturerData; QBluetoothDeviceInfo::CoreConfigurations deviceCoreConfiguration = QBluetoothDeviceInfo::UnknownCoreConfiguration; diff --git a/src/bluetooth/qbluetoothserver_p.h b/src/bluetooth/qbluetoothserver_p.h index a82114ba..ea90173a 100644 --- a/src/bluetooth/qbluetoothserver_p.h +++ b/src/bluetooth/qbluetoothserver_p.h @@ -82,7 +82,7 @@ class ServerAcceptanceThread; #include "darwin/btdelegates_p.h" #include "darwin/btraii_p.h" -#include <QtCore/qvector.h> +#include <QtCore/QList> #endif // QT_OSX_BLUETOOTH @@ -140,7 +140,8 @@ public: EventRegistrationToken connectionToken {-1}; mutable QMutex pendingConnectionsMutex; - QVector<Microsoft::WRL::ComPtr<ABI::Windows::Networking::Sockets::IStreamSocket>> pendingConnections; + QList<Microsoft::WRL::ComPtr<ABI::Windows::Networking::Sockets::IStreamSocket>> + pendingConnections; Microsoft::WRL::ComPtr<ABI::Windows::Networking::Sockets::IStreamSocketListener> socketListener; HRESULT handleClientConnection(ABI::Windows::Networking::Sockets::IStreamSocketListener *listener, @@ -195,7 +196,7 @@ private: static void unregisterServer(QBluetoothServerPrivate *server); using PendingConnection = DarwinBluetooth::StrongReference; - QVector<PendingConnection> pendingConnections; + QList<PendingConnection> pendingConnections; #endif // QT_OSX_BLUETOOTH }; diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp index 3ab0d580..4244e1e4 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp @@ -355,7 +355,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::populateDiscoveredServices(const QB //find SPP and custom uuid bool haveSppClass = false; - QVector<int> customUuids; + QList<int> customUuids; for (int i = 0; i < uuids.count(); i++) { const QBluetoothUuid uuid = uuids.at(i); diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_win.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_win.cpp index c34443aa..51b281bb 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_win.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent_win.cpp @@ -294,7 +294,7 @@ static FindServiceResult findFirstService(const QBluetoothAddress &address) } const QString addressAsString = QStringLiteral("(%1)").arg(address.toString()); - QVector<WCHAR> addressAsWChar(addressAsString.size() + 1); + QList<WCHAR> addressAsWChar(addressAsString.size() + 1); addressAsString.toWCharArray(addressAsWChar.data()); GUID protocol = L2CAP_PROTOCOL_UUID; //Search for L2CAP and RFCOMM services diff --git a/src/bluetooth/qbluetoothserviceinfo_p.h b/src/bluetooth/qbluetoothserviceinfo_p.h index a51204c6..8dcc1701 100644 --- a/src/bluetooth/qbluetoothserviceinfo_p.h +++ b/src/bluetooth/qbluetoothserviceinfo_p.h @@ -132,8 +132,8 @@ private: SOCKADDR_BTH sockaddr = {}; CSADDR_INFO addrinfo = {}; WSAQUERYSET regInfo = {}; - QVector<WCHAR> serviceName; - QVector<WCHAR> serviceDescription; + QList<WCHAR> serviceName; + QList<WCHAR> serviceDescription; #endif #if QT_OSX_BLUETOOTH diff --git a/src/bluetooth/qbluetoothsocket_macos_p.h b/src/bluetooth/qbluetoothsocket_macos_p.h index 93cfbe4c..cdc3f55a 100644 --- a/src/bluetooth/qbluetoothsocket_macos_p.h +++ b/src/bluetooth/qbluetoothsocket_macos_p.h @@ -66,12 +66,12 @@ #include <QtCore/qbytearray.h> #include "qprivatelinearbuffer_p.h" -#include <QtCore/qscopedpointer.h> -#include <QtCore/qiodevice.h> #include <QtCore/qglobal.h> -#include <QtCore/qobject.h> -#include <QtCore/qstring.h> -#include <QtCore/qvector.h> +#include <QtCore/QIODevice> +#include <QtCore/QList> +#include <QtCore/QObject> +#include <QtCore/QScopedPointer> +#include <QtCore/QString> QT_BEGIN_NAMESPACE @@ -135,7 +135,7 @@ private: void readChannelData(void *data, std::size_t size) override; void writeComplete() override; - QVector<char> writeChunk; + QList<char> writeChunk; using L2CAPChannel = DarwinBluetooth::ScopedPointer; L2CAPChannel l2capChannel; diff --git a/src/bluetooth/qbluetoothsocket_winrt.cpp b/src/bluetooth/qbluetoothsocket_winrt.cpp index c14ed04c..9e5d9c75 100644 --- a/src/bluetooth/qbluetoothsocket_winrt.cpp +++ b/src/bluetooth/qbluetoothsocket_winrt.cpp @@ -171,14 +171,14 @@ public: } signals: - void newDataReceived(const QVector<QByteArray> &data); + void newDataReceived(const QList<QByteArray> &data); void socketErrorOccured(QBluetoothSocket::SocketError error); public slots: Q_INVOKABLE void notifyAboutNewData() { QMutexLocker locker(&m_mutex); - const QVector<QByteArray> newData = std::move(m_pendingData); + const QList<QByteArray> newData = std::move(m_pendingData); m_pendingData.clear(); emit newDataReceived(newData); } @@ -317,7 +317,7 @@ public: private: ComPtr<IStreamSocket> m_socket; - QVector<QByteArray> m_pendingData; + QList<QByteArray> m_pendingData; bool m_shuttingDown = false; // Protects pendingData/pendingDatagrams which are accessed from native callbacks @@ -765,12 +765,12 @@ bool QBluetoothSocketPrivateWinRT::canReadLine() const return buffer.canReadLine(); } -void QBluetoothSocketPrivateWinRT::handleNewData(const QVector<QByteArray> &data) +void QBluetoothSocketPrivateWinRT::handleNewData(const QList<QByteArray> &data) { // Defer putting the data into the list until the next event loop iteration // (where the readyRead signal is emitted as well) QMetaObject::invokeMethod(this, "addToPendingData", Qt::QueuedConnection, - Q_ARG(QVector<QByteArray>, data)); + Q_ARG(QList<QByteArray>, data)); } void QBluetoothSocketPrivateWinRT::handleError(QBluetoothSocket::SocketError error) @@ -796,7 +796,7 @@ void QBluetoothSocketPrivateWinRT::handleError(QBluetoothSocket::SocketError err } } -void QBluetoothSocketPrivateWinRT::addToPendingData(const QVector<QByteArray> &data) +void QBluetoothSocketPrivateWinRT::addToPendingData(const QList<QByteArray> &data) { Q_Q(QBluetoothSocket); QMutexLocker locker(&m_readMutex); diff --git a/src/bluetooth/qbluetoothsocket_winrt_p.h b/src/bluetooth/qbluetoothsocket_winrt_p.h index de8b7d67..45819053 100644 --- a/src/bluetooth/qbluetoothsocket_winrt_p.h +++ b/src/bluetooth/qbluetoothsocket_winrt_p.h @@ -129,12 +129,12 @@ public: QMutex m_readMutex; // Protected by m_readMutex. Written in addToPendingData (native callback) - QVector<QByteArray> m_pendingData; + QList<QByteArray> m_pendingData; - Q_INVOKABLE void addToPendingData(const QVector<QByteArray> &data); + Q_INVOKABLE void addToPendingData(const QList<QByteArray> &data); private slots: - void handleNewData(const QVector<QByteArray> &data); + void handleNewData(const QList<QByteArray> &data); void handleError(QBluetoothSocket::SocketError error); private: diff --git a/src/bluetooth/qbluetoothtransferreply_bluez.cpp b/src/bluetooth/qbluetoothtransferreply_bluez.cpp index c5e6a4cb..bc1f035f 100644 --- a/src/bluetooth/qbluetoothtransferreply_bluez.cpp +++ b/src/bluetooth/qbluetoothtransferreply_bluez.cpp @@ -52,8 +52,8 @@ #include "qbluetoothtransferreply.h" #include <QtCore/QAtomicInt> +#include <QtCore/QList> #include <QtCore/QLoggingCategory> -#include <QtCore/QVector> #include <QFuture> #include <QFutureWatcher> #include <QtConcurrentRun> @@ -174,7 +174,7 @@ bool QBluetoothTransferReplyBluez::start() bool QBluetoothTransferReplyBluez::copyToTempFile(QIODevice *to, QIODevice *from) { - QVector<char> block(4096); + QList<char> block(4096); int size; while ((size = from->read(block.data(), block.size())) > 0) { diff --git a/src/bluetooth/qleadvertiser_bluez.cpp b/src/bluetooth/qleadvertiser_bluez.cpp index 47daed25..b8b29bf4 100644 --- a/src/bluetooth/qleadvertiser_bluez.cpp +++ b/src/bluetooth/qleadvertiser_bluez.cpp @@ -245,7 +245,8 @@ template<> quint8 servicesType<quint128>(bool dataComplete) return dataComplete ? 0x7 : 0x6; } -template<typename T> static void addServicesData(AdvData &data, const QVector<T> &services) +template<typename T> +static void addServicesData(AdvData &data, const QList<T> &services) { if (services.isEmpty()) return; @@ -270,9 +271,9 @@ template<typename T> static void addServicesData(AdvData &data, const QVector<T> void QLeAdvertiserBluez::setServicesData(const QLowEnergyAdvertisingData &src, AdvData &dest) { - QVector<quint16> services16; - QVector<quint32> services32; - QVector<quint128> services128; + QList<quint16> services16; + QList<quint32> services32; + QList<quint128> services128; const QList<QBluetoothUuid> services = src.services(); for (const QBluetoothUuid &service : services) { bool ok; diff --git a/src/bluetooth/qleadvertiser_p.h b/src/bluetooth/qleadvertiser_p.h index 9b8ffbb5..9471c8e2 100644 --- a/src/bluetooth/qleadvertiser_p.h +++ b/src/bluetooth/qleadvertiser_p.h @@ -58,8 +58,8 @@ #include "bluez/bluez_data_p.h" #endif +#include <QtCore/qlist.h> #include <QtCore/qobject.h> -#include <QtCore/qvector.h> QT_BEGIN_NAMESPACE @@ -142,7 +142,7 @@ private: OpCodeCommandField ocf; QByteArray data; }; - QVector<Command> m_pendingCommands; + QList<Command> m_pendingCommands; quint8 m_powerLevel; bool m_sendPowerLevel; diff --git a/src/bluetooth/qlowenergycontroller_android_p.h b/src/bluetooth/qlowenergycontroller_android_p.h index f05c63ca..5a126930 100644 --- a/src/bluetooth/qlowenergycontroller_android_p.h +++ b/src/bluetooth/qlowenergycontroller_android_p.h @@ -54,7 +54,6 @@ #include <qglobal.h> #include <QtCore/QQueue> -#include <QtCore/QVector> #include <QtBluetooth/qbluetooth.h> #include <QtBluetooth/qlowenergycharacteristic.h> #include "qlowenergycontroller.h" diff --git a/src/bluetooth/qlowenergycontroller_bluez.cpp b/src/bluetooth/qlowenergycontroller_bluez.cpp index 13d70ef3..06d5e7ff 100644 --- a/src/bluetooth/qlowenergycontroller_bluez.cpp +++ b/src/bluetooth/qlowenergycontroller_bluez.cpp @@ -551,7 +551,7 @@ void QLowEnergyControllerPrivateBluez::connectToDevice() return; } - QVector<quint16> activeHandles = hciManager->activeLowEnergyConnections(); + QList<quint16> activeHandles = hciManager->activeLowEnergyConnections(); if (!activeHandles.isEmpty()) { qCWarning(QT_BT_BLUEZ) << "Cannot connect due to pending active LE connections"; @@ -561,7 +561,7 @@ void QLowEnergyControllerPrivateBluez::connectToDevice() this, &QLowEnergyControllerPrivateBluez::activeConnectionTerminationDone); } - QVector<QBluetoothAddress> connectedAddresses; + QList<QBluetoothAddress> connectedAddresses; for (const auto handle: activeHandles) { const QBluetoothAddress addr = hciManager->addressForConnectionHandle(handle); if (!addr.isNull()) @@ -584,7 +584,7 @@ void QLowEnergyControllerPrivateBluez::activeConnectionTerminationDone() qCDebug(QT_BT_BLUEZ) << "RemoteDeviceManager finished attempting" << "to close external connections"; - QVector<quint16> activeHandles = hciManager->activeLowEnergyConnections(); + QList<quint16> activeHandles = hciManager->activeLowEnergyConnections(); if (!activeHandles.isEmpty()) { qCWarning(QT_BT_BLUEZ) << "Cannot close pending external BTLE connections. Aborting connect attempt"; setError(QLowEnergyController::ConnectionError); @@ -2303,7 +2303,7 @@ void QLowEnergyControllerPrivateBluez::handleFindInformationRequest(const QByteA if (!checkHandlePair(packet.at(0), startingHandle, endingHandle)) return; - QVector<Attribute> results = getAttributes(startingHandle, endingHandle); + QList<Attribute> results = getAttributes(startingHandle, endingHandle); if (results.isEmpty()) { sendErrorResponse(packet.at(0), startingHandle, ATT_ERROR_ATTRIBUTE_NOT_FOUND); return; @@ -2343,7 +2343,7 @@ void QLowEnergyControllerPrivateBluez::handleFindByTypeValueRequest(const QByteA return attr.type == QBluetoothUuid(type) && attr.value == value && checkReadPermissions(attr) == 0; }; - const QVector<Attribute> results = getAttributes(startingHandle, endingHandle, predicate); + const QList<Attribute> results = getAttributes(startingHandle, endingHandle, predicate); if (results.isEmpty()) { sendErrorResponse(packet.at(0), startingHandle, ATT_ERROR_ATTRIBUTE_NOT_FOUND); return; @@ -2385,8 +2385,9 @@ void QLowEnergyControllerPrivateBluez::handleReadByTypeRequest(const QByteArray return; // Get all attributes with matching type. - QVector<Attribute> results = getAttributes(startingHandle, endingHandle, - [type](const Attribute &attr) { return attr.type == type; }); + QList<Attribute> results = + getAttributes(startingHandle, endingHandle, + [type](const Attribute &attr) { return attr.type == type; }); ensureUniformValueSizes(results); if (results.isEmpty()) { @@ -2483,7 +2484,7 @@ void QLowEnergyControllerPrivateBluez::handleReadMultipleRequest(const QByteArra if (!checkPacketSize(packet, 5, mtuSize)) return; - QVector<QLowEnergyHandle> handles((packet.count() - 1) / sizeof(QLowEnergyHandle)); + QList<QLowEnergyHandle> handles((packet.count() - 1) / sizeof(QLowEnergyHandle)); auto *packetPtr = reinterpret_cast<const QLowEnergyHandle *>(packet.constData() + 1); for (int i = 0; i < handles.count(); ++i, ++packetPtr) handles[i] = bt_get_le16(packetPtr); @@ -2495,7 +2496,7 @@ void QLowEnergyControllerPrivateBluez::handleReadMultipleRequest(const QByteArra sendErrorResponse(packet.at(0), *it, ATT_ERROR_INVALID_HANDLE); return; } - const QVector<Attribute> results = getAttributes(handles.first(), handles.last()); + const QList<Attribute> results = getAttributes(handles.first(), handles.last()); QByteArray response(1, ATT_OP_READ_MULTIPLE_RESPONSE); for (const Attribute &attr : results) { const int error = checkReadPermissions(attr); @@ -2546,8 +2547,9 @@ void QLowEnergyControllerPrivateBluez::handleReadByGroupTypeRequest(const QByteA return; } - QVector<Attribute> results = getAttributes(startingHandle, endingHandle, - [type](const Attribute &attr) { return attr.type == type; }); + QList<Attribute> results = + getAttributes(startingHandle, endingHandle, + [type](const Attribute &attr) { return attr.type == type; }); if (results.isEmpty()) { sendErrorResponse(packet.at(0), startingHandle, ATT_ERROR_ATTRIBUTE_NOT_FOUND); return; @@ -2648,7 +2650,7 @@ void QLowEnergyControllerPrivateBluez::writeCharacteristicForPeripheral( for (auto it = clientConfigData.begin(); it != clientConfigData.end(); ++it) { if (isConnected && it.key() == remoteDevice.toUInt64()) continue; - QVector<ClientConfigurationData> &configDataList = it.value(); + QList<ClientConfigurationData> &configDataList = it.value(); for (ClientConfigurationData &configData : configDataList) { if (configData.charValueHandle != valueHandle) continue; @@ -2922,10 +2924,10 @@ void QLowEnergyControllerPrivateBluez::handleExecuteWriteRequest(const QByteArra qCDebug(QT_BT_BLUEZ) << "client sends execute write request; flag is" << (cancel ? "cancel" : "flush"); - QVector<WriteRequest> requests = openPrepareWriteRequests; + QList<WriteRequest> requests = openPrepareWriteRequests; openPrepareWriteRequests.clear(); - QVector<QLowEnergyCharacteristic> characteristics; - QVector<QLowEnergyDescriptor> descriptors; + QList<QLowEnergyCharacteristic> characteristics; + QList<QLowEnergyDescriptor> descriptors; if (!cancel) { for (const WriteRequest &request : qAsConst(requests)) { Attribute &attribute = localAttributes[request.handle]; @@ -2977,7 +2979,8 @@ void QLowEnergyControllerPrivateBluez::sendErrorResponse(quint8 request, quint16 } void QLowEnergyControllerPrivateBluez::sendListResponse(const QByteArray &packetStart, int elemSize, - const QVector<Attribute> &attributes, const ElemWriter &elemWriter) + const QList<Attribute> &attributes, + const ElemWriter &elemWriter) { const int offset = packetStart.count(); const int elemCount = qMin(attributes.count(), (mtuSize - offset) / elemSize); @@ -3163,9 +3166,10 @@ bool QLowEnergyControllerPrivateBluez::isBonded() const != QBluetoothLocalDevice::Unpaired; } -QVector<QLowEnergyControllerPrivateBluez::TempClientConfigurationData> QLowEnergyControllerPrivateBluez::gatherClientConfigData() +QList<QLowEnergyControllerPrivateBluez::TempClientConfigurationData> +QLowEnergyControllerPrivateBluez::gatherClientConfigData() { - QVector<TempClientConfigurationData> data; + QList<TempClientConfigurationData> data; for (const auto &service : qAsConst(localServices)) { for (auto charIt = service->characteristicList.begin(); charIt != service->characteristicList.end(); ++charIt) { @@ -3190,8 +3194,8 @@ void QLowEnergyControllerPrivateBluez::storeClientConfigurations() clientConfigData.remove(remoteDevice.toUInt64()); return; } - QVector<ClientConfigurationData> clientConfigs; - const QVector<TempClientConfigurationData> &tempConfigList = gatherClientConfigData(); + QList<ClientConfigurationData> clientConfigs; + const QList<TempClientConfigurationData> &tempConfigList = gatherClientConfigData(); for (const auto &tempConfigData : tempConfigList) { Q_ASSERT(tempConfigData.descData->value.count() == 2); const quint16 value = bt_get_le16(tempConfigData.descData->value.constData()); @@ -3205,10 +3209,11 @@ void QLowEnergyControllerPrivateBluez::storeClientConfigurations() void QLowEnergyControllerPrivateBluez::restoreClientConfigurations() { - const QVector<TempClientConfigurationData> &tempConfigList = gatherClientConfigData(); - const QVector<ClientConfigurationData> &restoredClientConfigs = isBonded() - ? clientConfigData.value(remoteDevice.toUInt64()) : QVector<ClientConfigurationData>(); - QVector<QLowEnergyHandle> notifications; + const QList<TempClientConfigurationData> &tempConfigList = gatherClientConfigData(); + const QList<ClientConfigurationData> &restoredClientConfigs = isBonded() + ? clientConfigData.value(remoteDevice.toUInt64()) + : QList<ClientConfigurationData>(); + QList<QLowEnergyHandle> notifications; for (const auto &tempConfigData : tempConfigList) { bool wasRestored = false; for (const auto &restoredData : restoredClientConfigs) { @@ -3430,8 +3435,8 @@ void QLowEnergyControllerPrivateBluez::addToGenericAttributeList(const QLowEnerg localAttributes[serviceAttribute.handle] = serviceAttribute; } -void QLowEnergyControllerPrivateBluez::ensureUniformAttributes(QVector<Attribute> &attributes, - const std::function<int (const Attribute &)> &getSize) +void QLowEnergyControllerPrivateBluez::ensureUniformAttributes( + QList<Attribute> &attributes, const std::function<int(const Attribute &)> &getSize) { if (attributes.isEmpty()) return; @@ -3443,22 +3448,24 @@ void QLowEnergyControllerPrivateBluez::ensureUniformAttributes(QVector<Attribute } -void QLowEnergyControllerPrivateBluez::ensureUniformUuidSizes(QVector<Attribute> &attributes) +void QLowEnergyControllerPrivateBluez::ensureUniformUuidSizes(QList<Attribute> &attributes) { ensureUniformAttributes(attributes, [](const Attribute &attr) { return getUuidSize(attr.type); }); } -void QLowEnergyControllerPrivateBluez::ensureUniformValueSizes(QVector<Attribute> &attributes) +void QLowEnergyControllerPrivateBluez::ensureUniformValueSizes(QList<Attribute> &attributes) { ensureUniformAttributes(attributes, [](const Attribute &attr) { return attr.value.count(); }); } -QVector<QLowEnergyControllerPrivateBluez::Attribute> QLowEnergyControllerPrivateBluez::getAttributes(QLowEnergyHandle startHandle, - QLowEnergyHandle endHandle, const AttributePredicate &attributePredicate) +QList<QLowEnergyControllerPrivateBluez::Attribute> +QLowEnergyControllerPrivateBluez::getAttributes(QLowEnergyHandle startHandle, + QLowEnergyHandle endHandle, + const AttributePredicate &attributePredicate) { - QVector<Attribute> results; + QList<Attribute> results; if (startHandle > lastLocalHandle) return results; if (lastLocalHandle == 0) // We have no services at all. @@ -3513,7 +3520,7 @@ int QLowEnergyControllerPrivateBluez::checkReadPermissions(const Attribute &attr return checkPermissions(attr, QLowEnergyCharacteristic::Read); } -int QLowEnergyControllerPrivateBluez::checkReadPermissions(QVector<Attribute> &attributes) +int QLowEnergyControllerPrivateBluez::checkReadPermissions(QList<Attribute> &attributes) { if (attributes.isEmpty()) return 0; diff --git a/src/bluetooth/qlowenergycontroller_bluez_p.h b/src/bluetooth/qlowenergycontroller_bluez_p.h index 65517cba..02cfcd59 100644 --- a/src/bluetooth/qlowenergycontroller_bluez_p.h +++ b/src/bluetooth/qlowenergycontroller_bluez_p.h @@ -52,8 +52,8 @@ // #include <qglobal.h> +#include <QtCore/QList> #include <QtCore/QQueue> -#include <QtCore/QVector> #include <QtBluetooth/qbluetooth.h> #include <QtBluetooth/qlowenergycharacteristic.h> #include "qlowenergycontroller.h" @@ -130,7 +130,7 @@ public: int minLength; int maxLength; }; - QVector<Attribute> localAttributes; + QList<Attribute> localAttributes; private: quint16 connectionHandle = 0; @@ -153,10 +153,10 @@ private: quint16 valueOffset; QByteArray value; }; - QVector<WriteRequest> openPrepareWriteRequests; + QList<WriteRequest> openPrepareWriteRequests; // Invariant: !scheduledIndications.isEmpty => indicationInFlight == true - QVector<QLowEnergyHandle> scheduledIndications; + QList<QLowEnergyHandle> scheduledIndications; bool indicationInFlight = false; struct TempClientConfigurationData { @@ -179,7 +179,7 @@ private: quint16 configValue; bool charValueWasUpdated = false; }; - QHash<quint64, QVector<ClientConfigurationData>> clientConfigData; + QHash<quint64, QList<ClientConfigurationData>> clientConfigData; struct SigningData { SigningData() = default; @@ -225,7 +225,7 @@ private: void closeServerSocket(); bool isBonded() const; - QVector<TempClientConfigurationData> gatherClientConfigData(); + QList<TempClientConfigurationData> gatherClientConfigData(); void storeClientConfigurations(); void restoreClientConfigurations(); @@ -289,24 +289,26 @@ private: using ElemWriter = std::function<void(const Attribute &, char *&)>; void sendListResponse(const QByteArray &packetStart, int elemSize, - const QVector<Attribute> &attributes, const ElemWriter &elemWriter); + const QList<Attribute> &attributes, const ElemWriter &elemWriter); void sendNotification(QLowEnergyHandle handle); void sendIndication(QLowEnergyHandle handle); void sendNotificationOrIndication(quint8 opCode, QLowEnergyHandle handle); void sendNextIndication(); - void ensureUniformAttributes(QVector<Attribute> &attributes, const std::function<int(const Attribute &)> &getSize); - void ensureUniformUuidSizes(QVector<Attribute> &attributes); - void ensureUniformValueSizes(QVector<Attribute> &attributes); + void ensureUniformAttributes(QList<Attribute> &attributes, + const std::function<int(const Attribute &)> &getSize); + void ensureUniformUuidSizes(QList<Attribute> &attributes); + void ensureUniformValueSizes(QList<Attribute> &attributes); using AttributePredicate = std::function<bool(const Attribute &)>; - QVector<Attribute> getAttributes(QLowEnergyHandle startHandle, QLowEnergyHandle endHandle, + QList<Attribute> getAttributes( + QLowEnergyHandle startHandle, QLowEnergyHandle endHandle, const AttributePredicate &attributePredicate = [](const Attribute &) { return true; }); int checkPermissions(const Attribute &attr, QLowEnergyCharacteristic::PropertyType type); int checkReadPermissions(const Attribute &attr); - int checkReadPermissions(QVector<Attribute> &attributes); + int checkReadPermissions(QList<Attribute> &attributes); bool verifyMac(const QByteArray &message, const quint128 &csrk, quint32 signCounter, quint64 expectedMac); diff --git a/src/bluetooth/qlowenergycontroller_bluezdbus.cpp b/src/bluetooth/qlowenergycontroller_bluezdbus.cpp index d69fb6cd..91d04dc6 100644 --- a/src/bluetooth/qlowenergycontroller_bluezdbus.cpp +++ b/src/bluetooth/qlowenergycontroller_bluezdbus.cpp @@ -115,7 +115,7 @@ void QLowEnergyControllerPrivateBluezDBus::devicePropertiesChanged( if (changedProperties.contains(QStringLiteral("UUIDs"))) { const QStringList newUuidStringList = changedProperties.value(QStringLiteral("UUIDs")).toStringList(); - QVector<QBluetoothUuid> newUuidList; + QList<QBluetoothUuid> newUuidList; for (const QString &uuidString : newUuidStringList) newUuidList.append(QBluetoothUuid(uuidString)); diff --git a/src/bluetooth/qlowenergycontroller_bluezdbus_p.h b/src/bluetooth/qlowenergycontroller_bluezdbus_p.h index 3215b08d..419d4b34 100644 --- a/src/bluetooth/qlowenergycontroller_bluezdbus_p.h +++ b/src/bluetooth/qlowenergycontroller_bluezdbus_p.h @@ -149,13 +149,13 @@ private: { QSharedPointer<OrgBluezGattCharacteristic1Interface> characteristic; QSharedPointer<OrgFreedesktopDBusPropertiesInterface> charMonitor; - QVector<QSharedPointer<OrgBluezGattDescriptor1Interface>> descriptors; + QList<QSharedPointer<OrgBluezGattDescriptor1Interface>> descriptors; }; struct GattService { QString servicePath; - QVector<GattCharacteristic> characteristics; + QList<GattCharacteristic> characteristics; bool hasBatteryService = false; QSharedPointer<OrgBluezBattery1Interface> batteryInterface; @@ -183,7 +183,7 @@ private: QSharedPointer<QLowEnergyServicePrivate> service; }; - QVector<GattJob> jobs; + QList<GattJob> jobs; bool jobPending = false; void prepareNextJob(); diff --git a/src/bluetooth/qlowenergycontroller_dummy_p.h b/src/bluetooth/qlowenergycontroller_dummy_p.h index 54a49b53..8acfa6df 100644 --- a/src/bluetooth/qlowenergycontroller_dummy_p.h +++ b/src/bluetooth/qlowenergycontroller_dummy_p.h @@ -53,7 +53,6 @@ #include <qglobal.h> #include <QtCore/QQueue> -#include <QtCore/QVector> #include <QtBluetooth/qbluetooth.h> #include <QtBluetooth/qlowenergycharacteristic.h> #include "qlowenergycontroller.h" diff --git a/src/bluetooth/qlowenergycontroller_win.cpp b/src/bluetooth/qlowenergycontroller_win.cpp index 5631b8cd..5ee1d5ad 100644 --- a/src/bluetooth/qlowenergycontroller_win.cpp +++ b/src/bluetooth/qlowenergycontroller_win.cpp @@ -59,7 +59,7 @@ Q_DECLARE_LOGGING_CATEGORY(QT_BT_WINDOWS) Q_GLOBAL_STATIC(QLibrary, bluetoothapis) -Q_GLOBAL_STATIC(QVector<QLowEnergyControllerPrivateWin32 *>, qControllers) +Q_GLOBAL_STATIC(QList<QLowEnergyControllerPrivateWin32 *>, qControllers) static QMutex controllersGuard(QMutex::NonRecursive); const QEvent::Type CharacteristicValueEventType = static_cast<QEvent::Type>(QEvent::User + 1); @@ -244,15 +244,14 @@ static void closeSystemDevice(HANDLE hDevice) ::CloseHandle(hDevice); } -static QVector<BTH_LE_GATT_SERVICE> enumeratePrimaryGattServices( - HANDLE hDevice, int *systemErrorCode) +static QList<BTH_LE_GATT_SERVICE> enumeratePrimaryGattServices(HANDLE hDevice, int *systemErrorCode) { if (!gattFunctionsResolved) { *systemErrorCode = ERROR_NOT_SUPPORTED; - return QVector<BTH_LE_GATT_SERVICE>(); + return QList<BTH_LE_GATT_SERVICE>(); } - QVector<BTH_LE_GATT_SERVICE> foundServices; + QList<BTH_LE_GATT_SERVICE> foundServices; USHORT servicesCount = 0; for (;;) { const HRESULT hr = ::BluetoothGATTGetServices( @@ -271,21 +270,22 @@ static QVector<BTH_LE_GATT_SERVICE> enumeratePrimaryGattServices( foundServices.resize(servicesCount); } else { *systemErrorCode = error; - return QVector<BTH_LE_GATT_SERVICE>(); + return QList<BTH_LE_GATT_SERVICE>(); } } } } -static QVector<BTH_LE_GATT_CHARACTERISTIC> enumerateGattCharacteristics( - HANDLE hService, PBTH_LE_GATT_SERVICE gattService, int *systemErrorCode) +static QList<BTH_LE_GATT_CHARACTERISTIC> +enumerateGattCharacteristics(HANDLE hService, PBTH_LE_GATT_SERVICE gattService, + int *systemErrorCode) { if (!gattFunctionsResolved) { *systemErrorCode = ERROR_NOT_SUPPORTED; - return QVector<BTH_LE_GATT_CHARACTERISTIC>(); + return QList<BTH_LE_GATT_CHARACTERISTIC>(); } - QVector<BTH_LE_GATT_CHARACTERISTIC> foundCharacteristics; + QList<BTH_LE_GATT_CHARACTERISTIC> foundCharacteristics; USHORT characteristicsCount = 0; for (;;) { const HRESULT hr = ::BluetoothGATTGetCharacteristics( @@ -305,7 +305,7 @@ static QVector<BTH_LE_GATT_CHARACTERISTIC> enumerateGattCharacteristics( foundCharacteristics.resize(characteristicsCount); } else { *systemErrorCode = error; - return QVector<BTH_LE_GATT_CHARACTERISTIC>(); + return QList<BTH_LE_GATT_CHARACTERISTIC>(); } } } @@ -381,15 +381,16 @@ static void setGattCharacteristicValue( *systemErrorCode = WIN32_FROM_HRESULT(hr); } -static QVector<BTH_LE_GATT_DESCRIPTOR> enumerateGattDescriptors( - HANDLE hService, PBTH_LE_GATT_CHARACTERISTIC gattCharacteristic, int *systemErrorCode) +static QList<BTH_LE_GATT_DESCRIPTOR> +enumerateGattDescriptors(HANDLE hService, PBTH_LE_GATT_CHARACTERISTIC gattCharacteristic, + int *systemErrorCode) { if (!gattFunctionsResolved) { *systemErrorCode = ERROR_NOT_SUPPORTED; - return QVector<BTH_LE_GATT_DESCRIPTOR>(); + return QList<BTH_LE_GATT_DESCRIPTOR>(); } - QVector<BTH_LE_GATT_DESCRIPTOR> foundDescriptors; + QList<BTH_LE_GATT_DESCRIPTOR> foundDescriptors; USHORT descriptorsCount = 0; for (;;) { const HRESULT hr = ::BluetoothGATTGetDescriptors( @@ -409,7 +410,7 @@ static QVector<BTH_LE_GATT_DESCRIPTOR> enumerateGattDescriptors( foundDescriptors.resize(descriptorsCount); } else { *systemErrorCode = error; - return QVector<BTH_LE_GATT_DESCRIPTOR>(); + return QList<BTH_LE_GATT_DESCRIPTOR>(); } } } @@ -788,7 +789,7 @@ void QLowEnergyControllerPrivateWin32::discoverServices() return; } - const QVector<BTH_LE_GATT_SERVICE> foundServices = + const QList<BTH_LE_GATT_SERVICE> foundServices = enumeratePrimaryGattServices(hDevice, &systemErrorCode); closeSystemDevice(hDevice); @@ -862,7 +863,7 @@ void QLowEnergyControllerPrivateWin32::discoverServiceDetails( // We assume that the service does not have any characteristics with descriptors. servicePrivate->endHandle = servicePrivate->startHandle; - const QVector<BTH_LE_GATT_CHARACTERISTIC> foundCharacteristics = + const QList<BTH_LE_GATT_CHARACTERISTIC> foundCharacteristics = enumerateGattCharacteristics(servicePrivate->hService, nullptr, &systemErrorCode); if (systemErrorCode != NO_ERROR) { @@ -922,9 +923,9 @@ void QLowEnergyControllerPrivateWin32::discoverServiceDetails( servicePrivate->endHandle, QLowEnergyHandle(gattCharacteristic.AttributeHandle + 1)); - const QVector<BTH_LE_GATT_DESCRIPTOR> foundDescriptors = enumerateGattDescriptors( - servicePrivate->hService, const_cast<PBTH_LE_GATT_CHARACTERISTIC>( - &gattCharacteristic), &systemErrorCode); + const QList<BTH_LE_GATT_DESCRIPTOR> foundDescriptors = enumerateGattDescriptors( + servicePrivate->hService, + const_cast<PBTH_LE_GATT_CHARACTERISTIC>(&gattCharacteristic), &systemErrorCode); if (systemErrorCode != NO_ERROR) { if (systemErrorCode != ERROR_NOT_FOUND) { diff --git a/src/bluetooth/qlowenergycontroller_win_p.h b/src/bluetooth/qlowenergycontroller_win_p.h index f8e3b10a..1a3213d9 100644 --- a/src/bluetooth/qlowenergycontroller_win_p.h +++ b/src/bluetooth/qlowenergycontroller_win_p.h @@ -52,8 +52,8 @@ // #include <qglobal.h> +#include <QtCore/QList> #include <QtCore/QQueue> -#include <QtCore/QVector> #include <QtBluetooth/qbluetooth.h> #include <QtBluetooth/qlowenergycharacteristic.h> #include "qlowenergycontroller.h" @@ -117,7 +117,7 @@ public: signals: void jobFinished(const ThreadWorkerJob &job); private: - QVector<ThreadWorkerJob> m_jobs; + QList<ThreadWorkerJob> m_jobs; }; class QLowEnergyServiceData; diff --git a/src/bluetooth/qlowenergycontroller_winrt.cpp b/src/bluetooth/qlowenergycontroller_winrt.cpp index db2ed191..6625a1d2 100644 --- a/src/bluetooth/qlowenergycontroller_winrt.cpp +++ b/src/bluetooth/qlowenergycontroller_winrt.cpp @@ -105,7 +105,7 @@ public: public slots: void obtainCharList() { - QVector<QBluetoothUuid> indicateChars; + QList<QBluetoothUuid> indicateChars; quint16 startHandle = 0; quint16 endHandle = 0; qCDebug(QT_BT_WINRT) << __FUNCTION__; @@ -228,10 +228,10 @@ public: QHash<QLowEnergyHandle, QLowEnergyServicePrivate::CharData> mCharacteristicList; signals: - void charListObtained(const QBluetoothUuid &service, QHash<QLowEnergyHandle, - QLowEnergyServicePrivate::CharData> charList, - QVector<QBluetoothUuid> indicateChars, - QLowEnergyHandle startHandle, QLowEnergyHandle endHandle); + void charListObtained(const QBluetoothUuid &service, + QHash<QLowEnergyHandle, QLowEnergyServicePrivate::CharData> charList, + QList<QBluetoothUuid> indicateChars, QLowEnergyHandle startHandle, + QLowEnergyHandle endHandle); }; QLowEnergyControllerPrivateWinRT::QLowEnergyControllerPrivateWinRT() @@ -638,7 +638,7 @@ void QLowEnergyControllerPrivateWinRT::discoverServiceDetails(const QBluetoothUu connect(thread, &QThread::finished, worker, &QObject::deleteLater); connect(worker, &QWinRTLowEnergyServiceHandler::charListObtained, [this, thread](const QBluetoothUuid &service, QHash<QLowEnergyHandle, QLowEnergyServicePrivate::CharData> charList - , QVector<QBluetoothUuid> indicateChars + , QList<QBluetoothUuid> indicateChars , QLowEnergyHandle startHandle, QLowEnergyHandle endHandle) { if (!serviceList.contains(service)) { qCWarning(QT_BT_WINRT) << "Discovery done of unknown service:" diff --git a/src/bluetooth/qlowenergycontroller_winrt_new.cpp b/src/bluetooth/qlowenergycontroller_winrt_new.cpp index d8ea9c93..93806d0a 100644 --- a/src/bluetooth/qlowenergycontroller_winrt_new.cpp +++ b/src/bluetooth/qlowenergycontroller_winrt_new.cpp @@ -399,13 +399,13 @@ public: uint mCharacteristicsCountToBeDiscovered; quint16 mStartHandle = 0; quint16 mEndHandle = 0; - QVector<QBluetoothUuid> mIndicateChars; + QList<QBluetoothUuid> mIndicateChars; signals: - void charListObtained(const QBluetoothUuid &service, QHash<QLowEnergyHandle, - QLowEnergyServicePrivate::CharData> charList, - QVector<QBluetoothUuid> indicateChars, - QLowEnergyHandle startHandle, QLowEnergyHandle endHandle); + void charListObtained(const QBluetoothUuid &service, + QHash<QLowEnergyHandle, QLowEnergyServicePrivate::CharData> charList, + QList<QBluetoothUuid> indicateChars, QLowEnergyHandle startHandle, + QLowEnergyHandle endHandle); void errorOccured(const QString &error); }; @@ -917,7 +917,7 @@ void QLowEnergyControllerPrivateWinRTNew::discoverServiceDetails(const QBluetoot this, &QLowEnergyControllerPrivateWinRTNew::handleServiceHandlerError); connect(worker, &QWinRTLowEnergyServiceHandlerNew::charListObtained, [this, reactOnDiscoveryError, thread](const QBluetoothUuid &service, QHash<QLowEnergyHandle, - QLowEnergyServicePrivate::CharData> charList, QVector<QBluetoothUuid> indicateChars, + QLowEnergyServicePrivate::CharData> charList, QList<QBluetoothUuid> indicateChars, QLowEnergyHandle startHandle, QLowEnergyHandle endHandle) { if (!serviceList.contains(service)) { qCWarning(QT_BT_WINRT) << "Discovery done of unknown service:" diff --git a/src/bluetooth/qlowenergycontroller_winrt_new_p.h b/src/bluetooth/qlowenergycontroller_winrt_new_p.h index c31408be..51464df3 100644 --- a/src/bluetooth/qlowenergycontroller_winrt_new_p.h +++ b/src/bluetooth/qlowenergycontroller_winrt_new_p.h @@ -52,8 +52,8 @@ // #include <qglobal.h> +#include <QtCore/QList> #include <QtCore/QQueue> -#include <QtCore/QVector> #include <QtBluetooth/qbluetooth.h> #include <QtBluetooth/qlowenergycharacteristic.h> #include <QtBluetooth/qlowenergyservicedata.h> @@ -156,7 +156,7 @@ private: Microsoft::WRL::ComPtr<ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::IGattCharacteristic> characteristic; EventRegistrationToken token; }; - QVector<ValueChangedEntry> mValueChangedTokens; + QList<ValueChangedEntry> mValueChangedTokens; Microsoft::WRL::ComPtr<ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::IGattDeviceService> getNativeService(const QBluetoothUuid &serviceUuid); Microsoft::WRL::ComPtr<ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::IGattCharacteristic> getNativeCharacteristic(const QBluetoothUuid &serviceUuid, const QBluetoothUuid &charUuid); diff --git a/src/bluetooth/qlowenergycontroller_winrt_p.h b/src/bluetooth/qlowenergycontroller_winrt_p.h index fedc52d9..2650b597 100644 --- a/src/bluetooth/qlowenergycontroller_winrt_p.h +++ b/src/bluetooth/qlowenergycontroller_winrt_p.h @@ -52,8 +52,8 @@ // #include <qglobal.h> +#include <QtCore/QList> #include <QtCore/QQueue> -#include <QtCore/QVector> #include <QtBluetooth/qbluetooth.h> #include <QtBluetooth/qlowenergycharacteristic.h> #include <QtBluetooth/qlowenergyservicedata.h> @@ -135,7 +135,7 @@ private: Microsoft::WRL::ComPtr<ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::IGattCharacteristic> characteristic; EventRegistrationToken token; }; - QVector<ValueChangedEntry> mValueChangedTokens; + QList<ValueChangedEntry> mValueChangedTokens; Microsoft::WRL::ComPtr<ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::IGattDeviceService> getNativeService(const QBluetoothUuid &serviceUuid); Microsoft::WRL::ComPtr<ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::IGattCharacteristic> getNativeCharacteristic(const QBluetoothUuid &serviceUuid, const QBluetoothUuid &charUuid); diff --git a/src/nfc/qndefmessage.h b/src/nfc/qndefmessage.h index c4878aeb..ef051afd 100644 --- a/src/nfc/qndefmessage.h +++ b/src/nfc/qndefmessage.h @@ -40,7 +40,6 @@ #ifndef QNDEFMESSAGE_H #define QNDEFMESSAGE_H -#include <QtCore/QVector> #include <QtCore/QSet> #include <QtCore/QList> #include <QtCore/QMetaType> |