FemaLocalSoftware/sensorgroups_r.h

34 lines
771 B
C
Raw Normal View History

2024-12-16 08:38:04 +00:00
#ifndef SENSORGROUPS_R_H
#define SENSORGROUPS_R_H
2025-01-07 22:13:48 +00:00
#include <QJsonArray>
2024-12-16 08:38:04 +00:00
#include <QJsonDocument>
#include <QJsonObject>
2025-01-07 22:13:48 +00:00
#include <QString>
2024-12-16 08:38:04 +00:00
#include <QStringList>
2025-01-07 22:13:48 +00:00
class GetSensorsGroupsR
{
2024-12-16 08:38:04 +00:00
public:
GetSensorsGroupsR() = default;
2025-01-07 22:13:48 +00:00
void parseResponse(const QJsonObject &responseObj)
{
2024-12-16 08:38:04 +00:00
if (responseObj.contains("groups") && responseObj["groups"].isArray()) {
QJsonArray groupsArray = responseObj["groups"].toArray();
2025-01-07 22:13:48 +00:00
for (const QJsonValue &value : groupsArray) {
2024-12-16 08:38:04 +00:00
if (value.isString()) {
groups.append(value.toString());
}
}
}
}
2025-01-07 22:13:48 +00:00
const QStringList &getGroups() const { return groups; }
2024-12-16 08:38:04 +00:00
private:
QStringList groups;
};
#endif // SENSORGROUPS_R_H