Merge pull request #944 from keyboardio/standardize-key-report-names

Switch ConsumerControlReport and SystemControlReport to use ActiveKey…
pull/953/head
Gergely Nagy 4 years ago committed by GitHub
commit 518989ba57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -27,7 +27,7 @@ ConsumerControlReport::ConsumerControlReport(const void *data) {
memcpy(&report_data_, &report_data, sizeof(report_data_)); memcpy(&report_data_, &report_data, sizeof(report_data_));
} }
std::vector<uint16_t> ConsumerControlReport::Keys() const { std::vector<uint16_t> ConsumerControlReport::ActiveKeycodes() const {
std::vector<uint16_t> keys; std::vector<uint16_t> keys;
if (report_data_.key1) keys.push_back(report_data_.key1); if (report_data_.key1) keys.push_back(report_data_.key1);
if (report_data_.key2) keys.push_back(report_data_.key2); if (report_data_.key2) keys.push_back(report_data_.key2);

@ -33,7 +33,7 @@ class ConsumerControlReport {
ConsumerControlReport(const void *data); ConsumerControlReport(const void *data);
std::vector<uint16_t> Keys() const; std::vector<uint16_t> ActiveKeycodes() const;
private: private:
ReportData report_data_; ReportData report_data_;

@ -30,7 +30,7 @@ SystemControlReport::SystemControlReport(const void* data) {
} }
} }
uint8_t SystemControlReport::Key() const { uint8_t SystemControlReport::ActiveKeycode() const {
return report_data_.key; return report_data_.key;
} }

@ -33,7 +33,7 @@ class SystemControlReport : public std::vector<uint8_t> {
SystemControlReport(const void* data); SystemControlReport(const void* data);
uint8_t Key() const; uint8_t ActiveKeycode() const;
private: private:
ReportData report_data_; ReportData report_data_;

@ -32,7 +32,7 @@ TEST_F(KeyboardReports, HIDUsageTablev12KeycodesAdded) {
ASSERT_EQ(state->HIDReports()->ConsumerControl().size(), 1); ASSERT_EQ(state->HIDReports()->ConsumerControl().size(), 1);
EXPECT_THAT( EXPECT_THAT(
state->HIDReports()->ConsumerControl(0).Keys(), state->HIDReports()->ConsumerControl(0).ActiveKeycodes(),
Contains(Consumer_VoiceCommand)); Contains(Consumer_VoiceCommand));
sim_.Release(1, 1); // VoiceCommand sim_.Release(1, 1); // VoiceCommand
@ -40,7 +40,7 @@ TEST_F(KeyboardReports, HIDUsageTablev12KeycodesAdded) {
ASSERT_EQ(state->HIDReports()->ConsumerControl().size(), 1); ASSERT_EQ(state->HIDReports()->ConsumerControl().size(), 1);
EXPECT_THAT( EXPECT_THAT(
state->HIDReports()->ConsumerControl(0).Keys(), state->HIDReports()->ConsumerControl(0).ActiveKeycodes(),
IsEmpty()); IsEmpty());
state = RunCycle(); state = RunCycle();

Loading…
Cancel
Save