#ifndef SENSORSERVICE_H #define SENSORSERVICE_H #include "utils.h" #include "HttpClient.h" #include "getsensors_r.h" #include "getsensors_p.h" #include "SensorGroups_r.h" #include #include #include #include #include #include class SensorService : public QObject { Q_OBJECT public: explicit SensorService(HttpClient* client, QObject *parent = nullptr) : QObject(parent), httpClient(client) {} QList getSensors(const QString& group) { GetSensorsP requestParams; requestParams.setGroup(group); QByteArray requestData = requestParams.createRequestJson(); QJsonObject responseJson = httpClient->post(utils::API_URL + "/data/getDeviceSensors", QJsonDocument::fromJson(requestData).object()); GetSensorsR response; response.parseResponse(responseJson); return response.getSensors(); } QStringList getSensorGroups() { QJsonObject emptyJson; QJsonObject responseJson = httpClient->post(utils::API_URL + "/data/getDeviceSensorGroups"); GetSensorsGroupsR response; response.parseResponse(responseJson); return response.getGroups(); } private: HttpClient* httpClient; }; #endif // SENSORSERVICE_H