diff --git a/texasinstruments/integrationplugintexasinstruments.cpp b/texasinstruments/integrationplugintexasinstruments.cpp index e4501661..7b4e8d94 100644 --- a/texasinstruments/integrationplugintexasinstruments.cpp +++ b/texasinstruments/integrationplugintexasinstruments.cpp @@ -1,6 +1,6 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Copyright 2013 - 2020, nymea GmbH +* Copyright 2013 - 2025, nymea GmbH * Contact: contact@nymea.io * * This file is part of nymea. @@ -32,8 +32,8 @@ #include "plugininfo.h" #include "sensortag.h" -#include "hardware/bluetoothlowenergy/bluetoothlowenergymanager.h" -#include "plugintimer.h" +#include +#include #include diff --git a/texasinstruments/integrationplugintexasinstruments.h b/texasinstruments/integrationplugintexasinstruments.h index 446addad..c650c66a 100644 --- a/texasinstruments/integrationplugintexasinstruments.h +++ b/texasinstruments/integrationplugintexasinstruments.h @@ -1,6 +1,6 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Copyright 2013 - 2020, nymea GmbH +* Copyright 2013 - 2025, nymea GmbH * Contact: contact@nymea.io * * This file is part of nymea. @@ -33,7 +33,7 @@ #include -#include "integrations/integrationplugin.h" +#include class SensorTag; @@ -56,9 +56,9 @@ public: void executeAction(ThingActionInfo *info) override; private: - QHash m_sensorTags; - + QHash m_sensorTags; PluginTimer *m_reconnectTimer = nullptr; + }; #endif // INTEGRATIONPLUGINTEXASINSTRUMENTS_H diff --git a/texasinstruments/sensordataprocessor.cpp b/texasinstruments/sensordataprocessor.cpp index b983f78b..d982e1f9 100644 --- a/texasinstruments/sensordataprocessor.cpp +++ b/texasinstruments/sensordataprocessor.cpp @@ -1,6 +1,6 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Copyright 2013 - 2020, nymea GmbH +* Copyright 2013 - 2025, nymea GmbH * Contact: contact@nymea.io * * This file is part of nymea. @@ -36,6 +36,7 @@ #include #include #include +#include SensorDataProcessor::SensorDataProcessor(Thing *thing, QObject *parent) : QObject(parent), @@ -107,7 +108,7 @@ bool SensorDataProcessor::testBitUint8(quint8 value, int bitPosition) void SensorDataProcessor::processTemperatureData(const QByteArray &data) { - Q_ASSERT(data.count() == 4); + Q_ASSERT(data.length() == 4); quint16 rawObjectTemperature = 0; quint16 rawAmbientTemperature = 0; @@ -141,7 +142,7 @@ void SensorDataProcessor::processTemperatureData(const QByteArray &data) void SensorDataProcessor::processKeyData(const QByteArray &data) { - Q_ASSERT(data.count() == 1); + Q_ASSERT(data.length() == 1); quint8 flags = static_cast(data.at(0)); setLeftButtonPressed(testBitUint8(flags, 0)); setRightButtonPressed(testBitUint8(flags, 1)); @@ -150,7 +151,7 @@ void SensorDataProcessor::processKeyData(const QByteArray &data) void SensorDataProcessor::processHumidityData(const QByteArray &data) { - Q_ASSERT(data.count() == 4); + Q_ASSERT(data.length() == 4); quint16 rawHumidityTemperature = 0; quint16 rawHumidity = 0; @@ -171,14 +172,14 @@ void SensorDataProcessor::processHumidityData(const QByteArray &data) void SensorDataProcessor::processPressureData(const QByteArray &data) { - Q_ASSERT(data.count() == 6); + Q_ASSERT(data.length() == 6); QByteArray temperatureData(data.left(3)); - quint32 rawTemperature = static_cast(temperatureData.at(2)); - rawTemperature <<= 8; - rawTemperature |= static_cast(temperatureData.at(1)); - rawTemperature <<= 8; - rawTemperature |= static_cast(temperatureData.at(0)); + // quint32 rawTemperature = static_cast(temperatureData.at(2)); + // rawTemperature <<= 8; + // rawTemperature |= static_cast(temperatureData.at(1)); + // rawTemperature <<= 8; + // rawTemperature |= static_cast(temperatureData.at(0)); QByteArray pressureData(data.right(3)); quint32 rawPressure = static_cast(pressureData.at(2)); @@ -199,7 +200,7 @@ void SensorDataProcessor::processPressureData(const QByteArray &data) void SensorDataProcessor::processOpticalData(const QByteArray &data) { - Q_ASSERT(data.count() == 2); + Q_ASSERT(data.length() == 2); quint16 rawOptical = 0; QByteArray payload(data); @@ -329,9 +330,8 @@ void SensorDataProcessor::logSensorValue(double originalValue, double filteredVa if (!m_filterDebug || !m_logFile) return; - QString logLine = QString("%1 %2 %3\n").arg(QDateTime::currentDateTime().toTime_t()).arg(originalValue).arg(filteredValue); + QString logLine = QString("%1 %2 %3\n").arg(QDateTime::currentDateTime().toSecsSinceEpoch()).arg(originalValue).arg(filteredValue); QTextStream logStream(m_logFile); - logStream.setCodec("UTF-8"); logStream << logLine; } diff --git a/texasinstruments/sensordataprocessor.h b/texasinstruments/sensordataprocessor.h index 3ee59780..fb615556 100644 --- a/texasinstruments/sensordataprocessor.h +++ b/texasinstruments/sensordataprocessor.h @@ -1,6 +1,6 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Copyright 2013 - 2020, nymea GmbH +* Copyright 2013 - 2025, nymea GmbH * Contact: contact@nymea.io * * This file is part of nymea. @@ -34,9 +34,9 @@ #include #include -#include "integrations/thing.h" -#include "extern-plugininfo.h" +#include +#include "extern-plugininfo.h" #include "sensorfilter.h" class SensorDataProcessor : public QObject @@ -91,11 +91,6 @@ private: void logSensorValue(double originalValue, double filteredValue); - -signals: - -private slots: - }; #endif // SENSORDATAPROCESSOR_H diff --git a/texasinstruments/sensortag.cpp b/texasinstruments/sensortag.cpp index 21386db1..bd38cab4 100644 --- a/texasinstruments/sensortag.cpp +++ b/texasinstruments/sensortag.cpp @@ -1,6 +1,6 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Copyright 2013 - 2020, nymea GmbH +* Copyright 2013 - 2025, nymea GmbH * Contact: contact@nymea.io * * This file is part of nymea. @@ -30,7 +30,8 @@ #include "sensortag.h" #include "extern-plugininfo.h" -#include "math.h" + +#include #include #include @@ -588,7 +589,11 @@ void SensorTag::onTemperatureServiceStateChanged(const QLowEnergyService::Servic } // Enable notifications +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QLowEnergyDescriptor notificationDescriptor = m_temperatureDataCharacteristic.descriptor(QBluetoothUuid::DescriptorType::ClientCharacteristicConfiguration); +#else QLowEnergyDescriptor notificationDescriptor = m_temperatureDataCharacteristic.descriptor(QBluetoothUuid::ClientCharacteristicConfiguration); +#endif m_temperatureService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100")); @@ -645,7 +650,11 @@ void SensorTag::onHumidityServiceStateChanged(const QLowEnergyService::ServiceSt } // Enable notifications +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QLowEnergyDescriptor notificationDescriptor = m_humidityDataCharacteristic.descriptor(QBluetoothUuid::DescriptorType::ClientCharacteristicConfiguration); +#else QLowEnergyDescriptor notificationDescriptor = m_humidityDataCharacteristic.descriptor(QBluetoothUuid::ClientCharacteristicConfiguration); +#endif m_humidityService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100")); // Config characteristic @@ -701,7 +710,11 @@ void SensorTag::onPressureServiceStateChanged(const QLowEnergyService::ServiceSt } // Enable notifications +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QLowEnergyDescriptor notificationDescriptor = m_pressureDataCharacteristic.descriptor(QBluetoothUuid::DescriptorType::ClientCharacteristicConfiguration); +#else QLowEnergyDescriptor notificationDescriptor = m_pressureDataCharacteristic.descriptor(QBluetoothUuid::ClientCharacteristicConfiguration); +#endif m_pressureService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100")); // Config characteristic @@ -757,7 +770,11 @@ void SensorTag::onOpticalServiceStateChanged(const QLowEnergyService::ServiceSta } // Enable notifications +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QLowEnergyDescriptor notificationDescriptor = m_opticalDataCharacteristic.descriptor(QBluetoothUuid::DescriptorType::ClientCharacteristicConfiguration); +#else QLowEnergyDescriptor notificationDescriptor = m_opticalDataCharacteristic.descriptor(QBluetoothUuid::ClientCharacteristicConfiguration); +#endif m_opticalService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100")); // Config characteristic @@ -810,7 +827,11 @@ void SensorTag::onKeyServiceStateChanged(const QLowEnergyService::ServiceState & } // Enable notifications +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QLowEnergyDescriptor notificationDescriptor = m_keyDataCharacteristic.descriptor(QBluetoothUuid::DescriptorType::ClientCharacteristicConfiguration); +#else QLowEnergyDescriptor notificationDescriptor = m_keyDataCharacteristic.descriptor(QBluetoothUuid::ClientCharacteristicConfiguration); +#endif m_keyService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100")); } @@ -844,7 +865,11 @@ void SensorTag::onMovementServiceStateChanged(const QLowEnergyService::ServiceSt } // Enable notifications +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QLowEnergyDescriptor notificationDescriptor = m_movementDataCharacteristic.descriptor(QBluetoothUuid::DescriptorType::ClientCharacteristicConfiguration); +#else QLowEnergyDescriptor notificationDescriptor = m_movementDataCharacteristic.descriptor(QBluetoothUuid::ClientCharacteristicConfiguration); +#endif m_movementService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100")); // Config characteristic @@ -899,7 +924,11 @@ void SensorTag::onIoServiceStateChanged(const QLowEnergyService::ServiceState &s } // Enable notifications +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QLowEnergyDescriptor notificationDescriptor = m_ioDataCharacteristic.descriptor(QBluetoothUuid::DescriptorType::ClientCharacteristicConfiguration); +#else QLowEnergyDescriptor notificationDescriptor = m_ioDataCharacteristic.descriptor(QBluetoothUuid::ClientCharacteristicConfiguration); +#endif m_ioService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100")); // Config characteristic diff --git a/texasinstruments/texasinstruments.pro b/texasinstruments/texasinstruments.pro index ccc5b59c..88132716 100644 --- a/texasinstruments/texasinstruments.pro +++ b/texasinstruments/texasinstruments.pro @@ -1,8 +1,6 @@ include(../plugins.pri) -QT += bluetooth - -TARGET = $$qtLibraryTarget(nymea_integrationplugintexasinstruments) +QT *= bluetooth HEADERS += \ integrationplugintexasinstruments.h \