diff --git a/testing/AbsoluteMouseReport.cpp b/testing/AbsoluteMouseReport.cpp index 749dcf37..0c1303af 100644 --- a/testing/AbsoluteMouseReport.cpp +++ b/testing/AbsoluteMouseReport.cpp @@ -16,6 +16,9 @@ #include "testing/AbsoluteMouseReport.h" +#include "Kaleidoscope.h" +#include "testing/fix-macros.h" + #include #include "MouseButtons.h" @@ -27,6 +30,11 @@ AbsoluteMouseReport::AbsoluteMouseReport(const void* data) { const ReportData& report_data = *static_cast(data); memcpy(&report_data_, &report_data, sizeof(report_data_)); + timestamp_ = Runtime.millisAtCycleStart(); +} + +uint32_t AbsoluteMouseReport::Timestamp() const { + return timestamp_; } std::vector AbsoluteMouseReport::Buttons() const { diff --git a/testing/AbsoluteMouseReport.h b/testing/AbsoluteMouseReport.h index 6b73c00f..71666ad8 100644 --- a/testing/AbsoluteMouseReport.h +++ b/testing/AbsoluteMouseReport.h @@ -33,12 +33,14 @@ class AbsoluteMouseReport { AbsoluteMouseReport(const void* data); + uint32_t Timestamp() const; std::vector Buttons() const; uint16_t XAxis() const; uint16_t YAxis() const; int8_t Wheel() const; private: + uint32_t timestamp_; ReportData report_data_; }; diff --git a/testing/ConsumerControlReport.cpp b/testing/ConsumerControlReport.cpp index 70abb990..ca2e0220 100644 --- a/testing/ConsumerControlReport.cpp +++ b/testing/ConsumerControlReport.cpp @@ -16,6 +16,9 @@ #include "testing/ConsumerControlReport.h" +#include "Kaleidoscope.h" +#include "testing/fix-macros.h" + #include namespace kaleidoscope { @@ -25,6 +28,11 @@ ConsumerControlReport::ConsumerControlReport(const void *data) { const ReportData& report_data = *static_cast(data); memcpy(&report_data_, &report_data, sizeof(report_data_)); + timestamp_ = Runtime.millisAtCycleStart(); +} + +uint32_t ConsumerControlReport::Timestamp() const { + return timestamp_; } std::vector ConsumerControlReport::ActiveKeycodes() const { diff --git a/testing/ConsumerControlReport.h b/testing/ConsumerControlReport.h index f0243739..61857f72 100644 --- a/testing/ConsumerControlReport.h +++ b/testing/ConsumerControlReport.h @@ -33,9 +33,11 @@ class ConsumerControlReport { ConsumerControlReport(const void *data); + uint32_t Timestamp() const; std::vector ActiveKeycodes() const; private: + uint32_t timestamp_; ReportData report_data_; }; diff --git a/testing/KeyboardReport.cpp b/testing/KeyboardReport.cpp index 31e87de3..873dd648 100644 --- a/testing/KeyboardReport.cpp +++ b/testing/KeyboardReport.cpp @@ -16,6 +16,9 @@ #include "testing/KeyboardReport.h" +#include "Kaleidoscope.h" +#include "testing/fix-macros.h" + #include namespace kaleidoscope { @@ -25,6 +28,11 @@ KeyboardReport::KeyboardReport(const void* data) { const ReportData& report_data = *static_cast(data); memcpy(&report_data_, &report_data, sizeof(report_data_)); + timestamp_ = Runtime.millisAtCycleStart(); +} + +uint32_t KeyboardReport::Timestamp() const { + return timestamp_; } std::vector KeyboardReport::ActiveKeycodes() const { diff --git a/testing/KeyboardReport.h b/testing/KeyboardReport.h index 3654d6c4..29c41c70 100644 --- a/testing/KeyboardReport.h +++ b/testing/KeyboardReport.h @@ -33,11 +33,13 @@ class KeyboardReport { KeyboardReport(const void* data); + uint32_t Timestamp() const; std::vector ActiveKeycodes() const; std::vector ActiveModifierKeycodes() const; std::vector ActiveNonModifierKeycodes() const; private: + uint32_t timestamp_; ReportData report_data_; }; diff --git a/testing/SystemControlReport.cpp b/testing/SystemControlReport.cpp index 9385ad79..0f0a7d9b 100644 --- a/testing/SystemControlReport.cpp +++ b/testing/SystemControlReport.cpp @@ -16,6 +16,9 @@ #include "testing/SystemControlReport.h" +#include "Kaleidoscope.h" +#include "testing/fix-macros.h" + #include namespace kaleidoscope { @@ -28,6 +31,11 @@ SystemControlReport::SystemControlReport(const void* data) { if (report_data_.key != 0) { this->push_back(report_data_.key); } + timestamp_ = Runtime.millisAtCycleStart(); +} + +uint32_t SystemControlReport::Timestamp() const { + return timestamp_; } uint8_t SystemControlReport::ActiveKeycode() const { diff --git a/testing/SystemControlReport.h b/testing/SystemControlReport.h index 56a79a9e..44719abb 100644 --- a/testing/SystemControlReport.h +++ b/testing/SystemControlReport.h @@ -33,9 +33,11 @@ class SystemControlReport : public std::vector { SystemControlReport(const void* data); + uint32_t Timestamp() const; uint8_t ActiveKeycode() const; private: + uint32_t timestamp_; ReportData report_data_; };