Add timestamps to simulator HID report classes

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
pull/929/head
Michael Richters 4 years ago committed by Jesse Vincent
parent 326e823b70
commit 0473094d4e
No known key found for this signature in database
GPG Key ID: CC228463465E40BC

@ -16,6 +16,9 @@
#include "testing/AbsoluteMouseReport.h"
#include "Kaleidoscope.h"
#include "testing/fix-macros.h"
#include <cstring>
#include "MouseButtons.h"
@ -27,6 +30,11 @@ AbsoluteMouseReport::AbsoluteMouseReport(const void* data) {
const ReportData& report_data =
*static_cast<const ReportData*>(data);
memcpy(&report_data_, &report_data, sizeof(report_data_));
timestamp_ = Runtime.millisAtCycleStart();
}
uint32_t AbsoluteMouseReport::Timestamp() const {
return timestamp_;
}
std::vector<uint8_t> AbsoluteMouseReport::Buttons() const {

@ -33,12 +33,14 @@ class AbsoluteMouseReport {
AbsoluteMouseReport(const void* data);
uint32_t Timestamp() const;
std::vector<uint8_t> Buttons() const;
uint16_t XAxis() const;
uint16_t YAxis() const;
int8_t Wheel() const;
private:
uint32_t timestamp_;
ReportData report_data_;
};

@ -16,6 +16,9 @@
#include "testing/ConsumerControlReport.h"
#include "Kaleidoscope.h"
#include "testing/fix-macros.h"
#include <cstring>
namespace kaleidoscope {
@ -25,6 +28,11 @@ ConsumerControlReport::ConsumerControlReport(const void *data) {
const ReportData& report_data =
*static_cast<const ReportData*>(data);
memcpy(&report_data_, &report_data, sizeof(report_data_));
timestamp_ = Runtime.millisAtCycleStart();
}
uint32_t ConsumerControlReport::Timestamp() const {
return timestamp_;
}
std::vector<uint16_t> ConsumerControlReport::ActiveKeycodes() const {

@ -33,9 +33,11 @@ class ConsumerControlReport {
ConsumerControlReport(const void *data);
uint32_t Timestamp() const;
std::vector<uint16_t> ActiveKeycodes() const;
private:
uint32_t timestamp_;
ReportData report_data_;
};

@ -16,6 +16,9 @@
#include "testing/KeyboardReport.h"
#include "Kaleidoscope.h"
#include "testing/fix-macros.h"
#include <cstring>
namespace kaleidoscope {
@ -25,6 +28,11 @@ KeyboardReport::KeyboardReport(const void* data) {
const ReportData& report_data =
*static_cast<const ReportData*>(data);
memcpy(&report_data_, &report_data, sizeof(report_data_));
timestamp_ = Runtime.millisAtCycleStart();
}
uint32_t KeyboardReport::Timestamp() const {
return timestamp_;
}
std::vector<uint8_t> KeyboardReport::ActiveKeycodes() const {

@ -33,11 +33,13 @@ class KeyboardReport {
KeyboardReport(const void* data);
uint32_t Timestamp() const;
std::vector<uint8_t> ActiveKeycodes() const;
std::vector<uint8_t> ActiveModifierKeycodes() const;
std::vector<uint8_t> ActiveNonModifierKeycodes() const;
private:
uint32_t timestamp_;
ReportData report_data_;
};

@ -16,6 +16,9 @@
#include "testing/SystemControlReport.h"
#include "Kaleidoscope.h"
#include "testing/fix-macros.h"
#include <cstring>
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 {

@ -33,9 +33,11 @@ class SystemControlReport : public std::vector<uint8_t> {
SystemControlReport(const void* data);
uint32_t Timestamp() const;
uint8_t ActiveKeycode() const;
private:
uint32_t timestamp_;
ReportData report_data_;
};

Loading…
Cancel
Save