AeThex-Engine-Core/engine/modules/aethex_cloud/aethex_telemetry.h

55 lines
1.6 KiB
C++

/**************************************************************************/
/* aethex_telemetry.h */
/**************************************************************************/
/* AeThex Engine */
/* https://aethex.dev */
/**************************************************************************/
#ifndef AETHEX_TELEMETRY_H
#define AETHEX_TELEMETRY_H
#include "core/object/ref_counted.h"
#include "core/templates/vector.h"
class AethexCloud;
class AethexTelemetry : public RefCounted {
GDCLASS(AethexTelemetry, RefCounted);
private:
AethexCloud *cloud = nullptr;
bool enabled = true;
Vector<Dictionary> event_buffer;
int buffer_size = 100;
double flush_interval = 30.0;
double time_since_flush = 0.0;
protected:
static void _bind_methods();
public:
void set_cloud(AethexCloud *p_cloud);
// Enable/disable
void set_enabled(bool p_enabled);
bool is_enabled() const;
// Track events
void track_event(const String &p_event_name, const Dictionary &p_properties = Dictionary());
void track_screen(const String &p_screen_name);
void track_error(const String &p_error, const String &p_stack_trace = "");
// Crash reporting
void report_crash(const String &p_message, const String &p_stack_trace, const Dictionary &p_context = Dictionary());
// Flush
void flush();
// Process (call periodically)
void process(double p_delta);
AethexTelemetry();
~AethexTelemetry();
};
#endif // AETHEX_TELEMETRY_H