Switch ConsumerControlReport and SystemControlReport to use ActiveKeycodes and ActiveKeycode respectively, to match Keyboard.

pull/944/head
Jesse Vincent 4 years ago
parent 7a12be25bc
commit 51d48245ad
No known key found for this signature in database
GPG Key ID: CC228463465E40BC

@ -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