1
0
mirror of https://github.com/MatMoul/g810-led.git synced 2024-12-23 09:16:11 +00:00

Expose SupportedKeyboards var in LedKeyboard class

This commit is contained in:
MatMoul 2017-05-07 04:02:34 +02:00
parent 2e5519260f
commit ac8ce20fff
3 changed files with 14 additions and 25 deletions

View File

@ -21,15 +21,6 @@ LedKeyboard::~LedKeyboard() {
} }
bool LedKeyboard::overrideKeyboard(uint16_t vendorID, uint16_t productID, KeyboardModel model) {
if(model==KeyboardModel::unknown) return false;
SupportedKeyboards = {
{ vendorID, productID, (u_int16_t)model }
};
return true;
}
vector<LedKeyboard::DeviceInfo> LedKeyboard::listKeyboards() { vector<LedKeyboard::DeviceInfo> LedKeyboard::listKeyboards() {
vector<LedKeyboard::DeviceInfo> deviceList; vector<LedKeyboard::DeviceInfo> deviceList;

View File

@ -16,17 +16,6 @@ class LedKeyboard {
private: private:
std::vector<std::vector<uint16_t>> SupportedKeyboards = {
{ 0x46d, 0xc336, (u_int16_t)KeyboardModel::g213 },
{ 0x46d, 0xc330, (u_int16_t)KeyboardModel::g410 },
{ 0x46d, 0xc333, (u_int16_t)KeyboardModel::g610 },
{ 0x46d, 0xc338, (u_int16_t)KeyboardModel::g610 },
{ 0x46d, 0xc331, (u_int16_t)KeyboardModel::g810 },
{ 0x46d, 0xc337, (u_int16_t)KeyboardModel::g810 },
{ 0x46d, 0xc32b, (u_int16_t)KeyboardModel::g910 },
{ 0x46d, 0xc335, (u_int16_t)KeyboardModel::g910 }
};
enum class KeyAddressGroup : uint8_t { enum class KeyAddressGroup : uint8_t {
logo = 0x00, logo = 0x00,
indicators, indicators,
@ -38,6 +27,17 @@ class LedKeyboard {
public: public:
std::vector<std::vector<uint16_t>> SupportedKeyboards = {
{ 0x46d, 0xc336, (u_int16_t)KeyboardModel::g213 },
{ 0x46d, 0xc330, (u_int16_t)KeyboardModel::g410 },
{ 0x46d, 0xc333, (u_int16_t)KeyboardModel::g610 },
{ 0x46d, 0xc338, (u_int16_t)KeyboardModel::g610 },
{ 0x46d, 0xc331, (u_int16_t)KeyboardModel::g810 },
{ 0x46d, 0xc337, (u_int16_t)KeyboardModel::g810 },
{ 0x46d, 0xc32b, (u_int16_t)KeyboardModel::g910 },
{ 0x46d, 0xc335, (u_int16_t)KeyboardModel::g910 }
};
enum class KeyboardModel : uint8_t { enum class KeyboardModel : uint8_t {
unknown = 0x00, unknown = 0x00,
g213, g213,
@ -134,8 +134,6 @@ class LedKeyboard {
~LedKeyboard(); ~LedKeyboard();
bool overrideKeyboard(uint16_t vendorID, uint16_t productID, KeyboardModel model);
std::vector<DeviceInfo> listKeyboards(); std::vector<DeviceInfo> listKeyboards();
bool isOpen(); bool isOpen();

View File

@ -283,13 +283,13 @@ int main(int argc, char **argv) {
if (! utils::parseUInt8(argv[argIndex + 1], kbdProtocol)) return 1; if (! utils::parseUInt8(argv[argIndex + 1], kbdProtocol)) return 1;
switch(kbdProtocol) { switch(kbdProtocol) {
case 1: case 1:
kbd.overrideKeyboard(vendorID, productID, LedKeyboard::KeyboardModel::g810); kbd.SupportedKeyboards = { { vendorID, productID, (u_int16_t)LedKeyboard::KeyboardModel::g810 } };
break; break;
case 2: case 2:
kbd.overrideKeyboard(vendorID, productID, LedKeyboard::KeyboardModel::g910); kbd.SupportedKeyboards = { { vendorID, productID, (u_int16_t)LedKeyboard::KeyboardModel::g910 } };
break; break;
case 3: case 3:
kbd.overrideKeyboard(vendorID, productID, LedKeyboard::KeyboardModel::g213); kbd.SupportedKeyboards = { { vendorID, productID, (u_int16_t)LedKeyboard::KeyboardModel::g213 } };
break; break;
default: default:
break; break;