texasinstruments: Add Qt6 support

qt6-qmake
Simon Stürz 2025-08-08 16:56:22 +02:00
parent 952d21c0ee
commit da460f1e8e
6 changed files with 55 additions and 33 deletions

View File

@ -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 <hardware/bluetoothlowenergy/bluetoothlowenergymanager.h>
#include <plugintimer.h>
#include <QBluetoothDeviceInfo>

View File

@ -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 <QObject>
#include "integrations/integrationplugin.h"
#include <integrations/integrationplugin.h>
class SensorTag;
@ -56,9 +56,9 @@ public:
void executeAction(ThingActionInfo *info) override;
private:
QHash<Thing*, SensorTag*> m_sensorTags;
QHash<Thing *, SensorTag *> m_sensorTags;
PluginTimer *m_reconnectTimer = nullptr;
};
#endif // INTEGRATIONPLUGINTEXASINSTRUMENTS_H

View File

@ -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 <QByteArray>
#include <QDataStream>
#include <QDateTime>
#include <QTextStream>
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<quint8>(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<quint8>(temperatureData.at(2));
rawTemperature <<= 8;
rawTemperature |= static_cast<quint8>(temperatureData.at(1));
rawTemperature <<= 8;
rawTemperature |= static_cast<quint8>(temperatureData.at(0));
// quint32 rawTemperature = static_cast<quint8>(temperatureData.at(2));
// rawTemperature <<= 8;
// rawTemperature |= static_cast<quint8>(temperatureData.at(1));
// rawTemperature <<= 8;
// rawTemperature |= static_cast<quint8>(temperatureData.at(0));
QByteArray pressureData(data.right(3));
quint32 rawPressure = static_cast<quint8>(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;
}

View File

@ -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 <QFile>
#include <QObject>
#include "integrations/thing.h"
#include "extern-plugininfo.h"
#include <integrations/thing.h>
#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

View File

@ -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 <math.h>
#include <QTimer>
#include <QVector3D>
@ -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

View File

@ -1,8 +1,6 @@
include(../plugins.pri)
QT += bluetooth
TARGET = $$qtLibraryTarget(nymea_integrationplugintexasinstruments)
QT *= bluetooth
HEADERS += \
integrationplugintexasinstruments.h \