diff options
author | Juha Vuolle <juha.vuolle@qt.io> | 2023-04-03 09:21:38 +0300 |
---|---|---|
committer | Juha Vuolle <juha.vuolle@qt.io> | 2023-04-03 11:59:34 +0300 |
commit | 913fb687a2f59003e81a42785b02450ffd3788cd (patch) | |
tree | a11396a94e4fdb1e8e2d7f9fa0c1fced6ecf8650 | |
parent | 5894037fd5897d60103f3a6a9d27784f3747f437 (diff) | |
download | qtconnectivity-913fb687a2f59003e81a42785b02450ffd3788cd.tar.gz |
Remove redundant checks on Darwin LE controller
Checks are already done at base or the public class
Pick-to: 6.5
Change-Id: Idf5ae08cb34fa1293de8f270c8980799866a8b08
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
-rw-r--r-- | src/bluetooth/qlowenergycontroller_darwin.mm | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/src/bluetooth/qlowenergycontroller_darwin.mm b/src/bluetooth/qlowenergycontroller_darwin.mm index 3f7fb215..ccac9d30 100644 --- a/src/bluetooth/qlowenergycontroller_darwin.mm +++ b/src/bluetooth/qlowenergycontroller_darwin.mm @@ -277,10 +277,10 @@ void QLowEnergyControllerPrivateDarwin::requestConnectionUpdate(const QLowEnergy void QLowEnergyControllerPrivateDarwin::addToGenericAttributeList(const QLowEnergyServiceData &service, QLowEnergyHandle startHandle) { + // Darwin LE controller implements the addServiceHelper() for adding services, and thus + // the base class' addServiceHelper(), which calls this function, is not used Q_UNUSED(service); Q_UNUSED(startHandle); - // TODO: check why I don't need this (apparently it is used in addServiceHelper - // of the base class). } int QLowEnergyControllerPrivateDarwin::mtu() const @@ -319,27 +319,11 @@ void QLowEnergyControllerPrivateDarwin::readRssi() QLowEnergyService * QLowEnergyControllerPrivateDarwin::addServiceHelper(const QLowEnergyServiceData &service) { - // Three checks below should be removed, they are done in the q_ptr's class. if (!isValid()) { qCWarning(QT_BT_DARWIN) << "invalid peripheral"; return nullptr; } - if (role != QLowEnergyController::PeripheralRole) { - qCWarning(QT_BT_DARWIN) << "not in peripheral role"; - return nullptr; - } - - if (state != QLowEnergyController::UnconnectedState) { - qCWarning(QT_BT_DARWIN) << "invalid state"; - return nullptr; - } - - if (!service.isValid()) { - qCWarning(QT_BT_DARWIN) << "invalid service"; - return nullptr; - } - for (auto includedService : service.includedServices()) includedService->d_ptr->type |= QLowEnergyService::IncludedService; @@ -1000,19 +984,9 @@ void QLowEnergyControllerPrivateDarwin::startAdvertising(const QLowEnergyAdverti const QLowEnergyAdvertisingData &advertisingData, const QLowEnergyAdvertisingData &scanResponseData) { - if (role != QLowEnergyController::PeripheralRole) { - qCWarning(QT_BT_DARWIN) << "controller is not a peripheral, cannot start advertising"; - return; - } - if (!lazyInit()) // Error was emit already. return; - if (state != QLowEnergyController::UnconnectedState) { - qCWarning(QT_BT_DARWIN) << "invalid state" << state; - return; - } - auto leQueue(DarwinBluetooth::qt_LE_queue()); Q_ASSERT_X(leQueue, Q_FUNC_INFO, "invalid LE queue (nullptr)"); |