// Copyright 2017 Citra Emulator Project // Licensed under GPLv2 or any later version // Refer to the license.txt file included. #pragma once #include #include #include #include #include "common/announce_multiplayer_room.h" #include "common/telemetry.h" namespace WebService { /** * Implementation of VisitorInterface that serialized telemetry into JSON, and submits it to the * Citra web service */ class TelemetryJson : public Telemetry::VisitorInterface { public: TelemetryJson(std::string host, std::string username, std::string token); ~TelemetryJson() override; void Visit(const Telemetry::Field& field) override; void Visit(const Telemetry::Field& field) override; void Visit(const Telemetry::Field& field) override; void Visit(const Telemetry::Field& field) override; void Visit(const Telemetry::Field& field) override; void Visit(const Telemetry::Field& field) override; void Visit(const Telemetry::Field& field) override; void Visit(const Telemetry::Field& field) override; void Visit(const Telemetry::Field& field) override; void Visit(const Telemetry::Field& field) override; void Visit(const Telemetry::Field& field) override; void Visit(const Telemetry::Field& field) override; void Visit(const Telemetry::Field& field) override; void Visit(const Telemetry::Field& field) override; void Complete() override; private: nlohmann::json& TopSection() { return sections[static_cast(Telemetry::FieldType::None)]; } template void Serialize(Telemetry::FieldType type, const std::string& name, T value); void SerializeSection(Telemetry::FieldType type, const std::string& name); nlohmann::json output; std::array sections; std::string host; std::string username; std::string token; }; } // namespace WebService