From 5194d09ec37a0f8020e556bc7cd2fdc40a8b2928 Mon Sep 17 00:00:00 2001 From: Ale Martinez Date: Wed, 3 Jun 2020 13:47:46 -0300 Subject: [PATCH] BT40Device - Fix Ignoring the CSC service for device xxx message The "Ignoring the CSC service for device..." was intended to notify when power sensor is present the CSC service is ignored since it is redundant and may cause problems, but it is misleading when there is no CSC or Power service. Reported in #3471 --- src/Train/BT40Device.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Train/BT40Device.cpp b/src/Train/BT40Device.cpp index e14d8f668..657506b5c 100644 --- a/src/Train/BT40Device.cpp +++ b/src/Train/BT40Device.cpp @@ -170,16 +170,18 @@ BT40Device::serviceScanDone() } } - if (csc_service && has_csc && !has_power) { + if (csc_service && has_csc) { + if (!has_power) { - // Only connect to CSC service if the same device doesn't provide a power service - // since the power service also provides the same readings. - qDebug() << "Connecting to the CSC service for device" << m_currentDevice.name() << " " << m_currentDevice.deviceUuid(); - csc_service->discoverDetails(); + // Only connect to CSC service if the same device doesn't provide a power service + // since the power service also provides the same readings. + qDebug() << "Connecting to the CSC service for device" << m_currentDevice.name() << " " << m_currentDevice.deviceUuid(); + csc_service->discoverDetails(); - } else { + } else { - qDebug() << "Ignoring the CSC service for device" << m_currentDevice.name() << " " << m_currentDevice.deviceUuid(); + qDebug() << "Ignoring the CSC service for device" << m_currentDevice.name() << " " << m_currentDevice.deviceUuid(); + } } }