texasinstruments: Add Qt6 support
This commit is contained in:
parent
952d21c0ee
commit
da460f1e8e
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2020, nymea GmbH
|
* Copyright 2013 - 2025, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
@ -32,8 +32,8 @@
|
|||||||
#include "plugininfo.h"
|
#include "plugininfo.h"
|
||||||
#include "sensortag.h"
|
#include "sensortag.h"
|
||||||
|
|
||||||
#include "hardware/bluetoothlowenergy/bluetoothlowenergymanager.h"
|
#include <hardware/bluetoothlowenergy/bluetoothlowenergymanager.h>
|
||||||
#include "plugintimer.h"
|
#include <plugintimer.h>
|
||||||
|
|
||||||
#include <QBluetoothDeviceInfo>
|
#include <QBluetoothDeviceInfo>
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2020, nymea GmbH
|
* Copyright 2013 - 2025, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
#include "integrations/integrationplugin.h"
|
#include <integrations/integrationplugin.h>
|
||||||
|
|
||||||
class SensorTag;
|
class SensorTag;
|
||||||
|
|
||||||
@ -56,9 +56,9 @@ public:
|
|||||||
void executeAction(ThingActionInfo *info) override;
|
void executeAction(ThingActionInfo *info) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QHash<Thing*, SensorTag*> m_sensorTags;
|
QHash<Thing *, SensorTag *> m_sensorTags;
|
||||||
|
|
||||||
PluginTimer *m_reconnectTimer = nullptr;
|
PluginTimer *m_reconnectTimer = nullptr;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INTEGRATIONPLUGINTEXASINSTRUMENTS_H
|
#endif // INTEGRATIONPLUGINTEXASINSTRUMENTS_H
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2020, nymea GmbH
|
* Copyright 2013 - 2025, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
@ -36,6 +36,7 @@
|
|||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include <QTextStream>
|
||||||
|
|
||||||
SensorDataProcessor::SensorDataProcessor(Thing *thing, QObject *parent) :
|
SensorDataProcessor::SensorDataProcessor(Thing *thing, QObject *parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
@ -107,7 +108,7 @@ bool SensorDataProcessor::testBitUint8(quint8 value, int bitPosition)
|
|||||||
|
|
||||||
void SensorDataProcessor::processTemperatureData(const QByteArray &data)
|
void SensorDataProcessor::processTemperatureData(const QByteArray &data)
|
||||||
{
|
{
|
||||||
Q_ASSERT(data.count() == 4);
|
Q_ASSERT(data.length() == 4);
|
||||||
|
|
||||||
quint16 rawObjectTemperature = 0;
|
quint16 rawObjectTemperature = 0;
|
||||||
quint16 rawAmbientTemperature = 0;
|
quint16 rawAmbientTemperature = 0;
|
||||||
@ -141,7 +142,7 @@ void SensorDataProcessor::processTemperatureData(const QByteArray &data)
|
|||||||
|
|
||||||
void SensorDataProcessor::processKeyData(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));
|
quint8 flags = static_cast<quint8>(data.at(0));
|
||||||
setLeftButtonPressed(testBitUint8(flags, 0));
|
setLeftButtonPressed(testBitUint8(flags, 0));
|
||||||
setRightButtonPressed(testBitUint8(flags, 1));
|
setRightButtonPressed(testBitUint8(flags, 1));
|
||||||
@ -150,7 +151,7 @@ void SensorDataProcessor::processKeyData(const QByteArray &data)
|
|||||||
|
|
||||||
void SensorDataProcessor::processHumidityData(const QByteArray &data)
|
void SensorDataProcessor::processHumidityData(const QByteArray &data)
|
||||||
{
|
{
|
||||||
Q_ASSERT(data.count() == 4);
|
Q_ASSERT(data.length() == 4);
|
||||||
quint16 rawHumidityTemperature = 0;
|
quint16 rawHumidityTemperature = 0;
|
||||||
quint16 rawHumidity = 0;
|
quint16 rawHumidity = 0;
|
||||||
|
|
||||||
@ -171,14 +172,14 @@ void SensorDataProcessor::processHumidityData(const QByteArray &data)
|
|||||||
|
|
||||||
void SensorDataProcessor::processPressureData(const QByteArray &data)
|
void SensorDataProcessor::processPressureData(const QByteArray &data)
|
||||||
{
|
{
|
||||||
Q_ASSERT(data.count() == 6);
|
Q_ASSERT(data.length() == 6);
|
||||||
|
|
||||||
QByteArray temperatureData(data.left(3));
|
QByteArray temperatureData(data.left(3));
|
||||||
quint32 rawTemperature = static_cast<quint8>(temperatureData.at(2));
|
// quint32 rawTemperature = static_cast<quint8>(temperatureData.at(2));
|
||||||
rawTemperature <<= 8;
|
// rawTemperature <<= 8;
|
||||||
rawTemperature |= static_cast<quint8>(temperatureData.at(1));
|
// rawTemperature |= static_cast<quint8>(temperatureData.at(1));
|
||||||
rawTemperature <<= 8;
|
// rawTemperature <<= 8;
|
||||||
rawTemperature |= static_cast<quint8>(temperatureData.at(0));
|
// rawTemperature |= static_cast<quint8>(temperatureData.at(0));
|
||||||
|
|
||||||
QByteArray pressureData(data.right(3));
|
QByteArray pressureData(data.right(3));
|
||||||
quint32 rawPressure = static_cast<quint8>(pressureData.at(2));
|
quint32 rawPressure = static_cast<quint8>(pressureData.at(2));
|
||||||
@ -199,7 +200,7 @@ void SensorDataProcessor::processPressureData(const QByteArray &data)
|
|||||||
|
|
||||||
void SensorDataProcessor::processOpticalData(const QByteArray &data)
|
void SensorDataProcessor::processOpticalData(const QByteArray &data)
|
||||||
{
|
{
|
||||||
Q_ASSERT(data.count() == 2);
|
Q_ASSERT(data.length() == 2);
|
||||||
|
|
||||||
quint16 rawOptical = 0;
|
quint16 rawOptical = 0;
|
||||||
QByteArray payload(data);
|
QByteArray payload(data);
|
||||||
@ -329,9 +330,8 @@ void SensorDataProcessor::logSensorValue(double originalValue, double filteredVa
|
|||||||
if (!m_filterDebug || !m_logFile)
|
if (!m_filterDebug || !m_logFile)
|
||||||
return;
|
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);
|
QTextStream logStream(m_logFile);
|
||||||
logStream.setCodec("UTF-8");
|
|
||||||
logStream << logLine;
|
logStream << logLine;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2020, nymea GmbH
|
* Copyright 2013 - 2025, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
@ -34,9 +34,9 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
#include "integrations/thing.h"
|
#include <integrations/thing.h>
|
||||||
#include "extern-plugininfo.h"
|
|
||||||
|
|
||||||
|
#include "extern-plugininfo.h"
|
||||||
#include "sensorfilter.h"
|
#include "sensorfilter.h"
|
||||||
|
|
||||||
class SensorDataProcessor : public QObject
|
class SensorDataProcessor : public QObject
|
||||||
@ -91,11 +91,6 @@ private:
|
|||||||
|
|
||||||
void logSensorValue(double originalValue, double filteredValue);
|
void logSensorValue(double originalValue, double filteredValue);
|
||||||
|
|
||||||
|
|
||||||
signals:
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SENSORDATAPROCESSOR_H
|
#endif // SENSORDATAPROCESSOR_H
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2020, nymea GmbH
|
* Copyright 2013 - 2025, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
@ -30,7 +30,8 @@
|
|||||||
|
|
||||||
#include "sensortag.h"
|
#include "sensortag.h"
|
||||||
#include "extern-plugininfo.h"
|
#include "extern-plugininfo.h"
|
||||||
#include "math.h"
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QVector3D>
|
#include <QVector3D>
|
||||||
@ -588,7 +589,11 @@ void SensorTag::onTemperatureServiceStateChanged(const QLowEnergyService::Servic
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enable notifications
|
// 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);
|
QLowEnergyDescriptor notificationDescriptor = m_temperatureDataCharacteristic.descriptor(QBluetoothUuid::ClientCharacteristicConfiguration);
|
||||||
|
#endif
|
||||||
m_temperatureService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100"));
|
m_temperatureService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100"));
|
||||||
|
|
||||||
|
|
||||||
@ -645,7 +650,11 @@ void SensorTag::onHumidityServiceStateChanged(const QLowEnergyService::ServiceSt
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enable notifications
|
// 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);
|
QLowEnergyDescriptor notificationDescriptor = m_humidityDataCharacteristic.descriptor(QBluetoothUuid::ClientCharacteristicConfiguration);
|
||||||
|
#endif
|
||||||
m_humidityService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100"));
|
m_humidityService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100"));
|
||||||
|
|
||||||
// Config characteristic
|
// Config characteristic
|
||||||
@ -701,7 +710,11 @@ void SensorTag::onPressureServiceStateChanged(const QLowEnergyService::ServiceSt
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enable notifications
|
// 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);
|
QLowEnergyDescriptor notificationDescriptor = m_pressureDataCharacteristic.descriptor(QBluetoothUuid::ClientCharacteristicConfiguration);
|
||||||
|
#endif
|
||||||
m_pressureService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100"));
|
m_pressureService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100"));
|
||||||
|
|
||||||
// Config characteristic
|
// Config characteristic
|
||||||
@ -757,7 +770,11 @@ void SensorTag::onOpticalServiceStateChanged(const QLowEnergyService::ServiceSta
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enable notifications
|
// 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);
|
QLowEnergyDescriptor notificationDescriptor = m_opticalDataCharacteristic.descriptor(QBluetoothUuid::ClientCharacteristicConfiguration);
|
||||||
|
#endif
|
||||||
m_opticalService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100"));
|
m_opticalService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100"));
|
||||||
|
|
||||||
// Config characteristic
|
// Config characteristic
|
||||||
@ -810,7 +827,11 @@ void SensorTag::onKeyServiceStateChanged(const QLowEnergyService::ServiceState &
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enable notifications
|
// 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);
|
QLowEnergyDescriptor notificationDescriptor = m_keyDataCharacteristic.descriptor(QBluetoothUuid::ClientCharacteristicConfiguration);
|
||||||
|
#endif
|
||||||
m_keyService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100"));
|
m_keyService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -844,7 +865,11 @@ void SensorTag::onMovementServiceStateChanged(const QLowEnergyService::ServiceSt
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enable notifications
|
// 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);
|
QLowEnergyDescriptor notificationDescriptor = m_movementDataCharacteristic.descriptor(QBluetoothUuid::ClientCharacteristicConfiguration);
|
||||||
|
#endif
|
||||||
m_movementService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100"));
|
m_movementService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100"));
|
||||||
|
|
||||||
// Config characteristic
|
// Config characteristic
|
||||||
@ -899,7 +924,11 @@ void SensorTag::onIoServiceStateChanged(const QLowEnergyService::ServiceState &s
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enable notifications
|
// 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);
|
QLowEnergyDescriptor notificationDescriptor = m_ioDataCharacteristic.descriptor(QBluetoothUuid::ClientCharacteristicConfiguration);
|
||||||
|
#endif
|
||||||
m_ioService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100"));
|
m_ioService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100"));
|
||||||
|
|
||||||
// Config characteristic
|
// Config characteristic
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
include(../plugins.pri)
|
include(../plugins.pri)
|
||||||
|
|
||||||
QT += bluetooth
|
QT *= bluetooth
|
||||||
|
|
||||||
TARGET = $$qtLibraryTarget(nymea_integrationplugintexasinstruments)
|
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
integrationplugintexasinstruments.h \
|
integrationplugintexasinstruments.h \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user