diff options
Diffstat (limited to 'src/web_service/telemetry_json.h')
| -rw-r--r-- | src/web_service/telemetry_json.h | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/src/web_service/telemetry_json.h b/src/web_service/telemetry_json.h index 0fe6f9a3e..93371414a 100644 --- a/src/web_service/telemetry_json.h +++ b/src/web_service/telemetry_json.h | |||
| @@ -4,11 +4,9 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | 7 | #include <chrono> |
| 8 | #include <string> | 8 | #include <string> |
| 9 | #include <json.hpp> | ||
| 10 | #include "common/telemetry.h" | 9 | #include "common/telemetry.h" |
| 11 | #include "common/web_result.h" | ||
| 12 | 10 | ||
| 13 | namespace WebService { | 11 | namespace WebService { |
| 14 | 12 | ||
| @@ -18,8 +16,8 @@ namespace WebService { | |||
| 18 | */ | 16 | */ |
| 19 | class TelemetryJson : public Telemetry::VisitorInterface { | 17 | class TelemetryJson : public Telemetry::VisitorInterface { |
| 20 | public: | 18 | public: |
| 21 | TelemetryJson(const std::string& host, const std::string& username, const std::string& token); | 19 | TelemetryJson(std::string host, std::string username, std::string token); |
| 22 | ~TelemetryJson(); | 20 | ~TelemetryJson() override; |
| 23 | 21 | ||
| 24 | void Visit(const Telemetry::Field<bool>& field) override; | 22 | void Visit(const Telemetry::Field<bool>& field) override; |
| 25 | void Visit(const Telemetry::Field<double>& field) override; | 23 | void Visit(const Telemetry::Field<double>& field) override; |
| @@ -39,20 +37,8 @@ public: | |||
| 39 | void Complete() override; | 37 | void Complete() override; |
| 40 | 38 | ||
| 41 | private: | 39 | private: |
| 42 | nlohmann::json& TopSection() { | 40 | struct Impl; |
| 43 | return sections[static_cast<u8>(Telemetry::FieldType::None)]; | 41 | std::unique_ptr<Impl> impl; |
| 44 | } | ||
| 45 | |||
| 46 | template <class T> | ||
| 47 | void Serialize(Telemetry::FieldType type, const std::string& name, T value); | ||
| 48 | |||
| 49 | void SerializeSection(Telemetry::FieldType type, const std::string& name); | ||
| 50 | |||
| 51 | nlohmann::json output; | ||
| 52 | std::array<nlohmann::json, 7> sections; | ||
| 53 | std::string host; | ||
| 54 | std::string username; | ||
| 55 | std::string token; | ||
| 56 | }; | 42 | }; |
| 57 | 43 | ||
| 58 | } // namespace WebService | 44 | } // namespace WebService |