diff --git a/src/classes/Keyboard.cpp b/src/classes/Keyboard.cpp index 59821f6..6926f13 100644 --- a/src/classes/Keyboard.cpp +++ b/src/classes/Keyboard.cpp @@ -364,13 +364,6 @@ bool Keyboard::parseKeyGroup(std::string key, KeyGroup &keyGroup) { else if (key == "numeric") keyGroup = KeyGroup::numeric; else if (key == "functions") keyGroup = KeyGroup::functions; else if (key == "keys") keyGroup = KeyGroup::keys; - else if (key == "raw0") keyGroup = KeyGroup::raw0; - else if (key == "raw1") keyGroup = KeyGroup::raw1; - else if (key == "raw2") keyGroup = KeyGroup::raw2; - else if (key == "raw3") keyGroup = KeyGroup::raw3; - else if (key == "raw4") keyGroup = KeyGroup::raw4; - else if (key == "raw5") keyGroup = KeyGroup::raw5; - else if (key == "raw6") keyGroup = KeyGroup::raw6; else return false; return true; } @@ -671,298 +664,5 @@ bool Keyboard::setGroupKeys(KeyGroup keyGroup, KeyColors colors) { } setKeys(keyValues, keyValuesCount); break; - case KeyGroup::raw0: - for (int i = 0; i < 6; i++) { - getKeyAddress((Key)i, keyValues[i].key); - keyValues[i].colors = colors; - keyValuesCount++; - } - getKeyAddress(Key::mute, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - setKeys(keyValues, keyValuesCount); - break; - case KeyGroup::raw1: - getKeyAddress(Key::esc, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - for (int i = 11; i < 23; i++) { - getKeyAddress((Key)i, keyValues[i - 11 + 1].key); - keyValues[i - 11 + 1].colors = colors; - keyValuesCount++; - } - getKeyAddress(Key::print_screen, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::scroll_lock, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::pause_break, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - for (int i = 7; i < 11; i++) { - getKeyAddress((Key)i, keyValues[i - 7 + 16].key); - keyValues[i - 7 + 16].colors = colors; - keyValuesCount++; - } - setKeys(keyValues, keyValuesCount); - break; - case KeyGroup::raw2: - getKeyAddress(Key::degree, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - for (int i = 63; i < 73; i++) { - getKeyAddress((Key)i, keyValues[i - 63 + 1].key); - keyValues[i - 63 + 1].colors = colors; - keyValuesCount++; - } - getKeyAddress(Key::apostrophe, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::tidle, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::backspace, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::insert, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::home, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::page_up, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::num_lock, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::num_slash, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::num_asterisk, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::num_minus, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - setKeys(keyValues, keyValuesCount); - break; - case KeyGroup::raw3: - getKeyAddress(Key::tab, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::q, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::w, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::e, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::r, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::t, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::z, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::u, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::i, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::o, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::p, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::open_bracket, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::close_bracket, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::del, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::end, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::page_down, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::num_7, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::num_8, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::num_9, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - setKeys(keyValues, keyValuesCount); - break; - case KeyGroup::raw4: - getKeyAddress(Key::caps_lock, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::a, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::s, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::d, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::f, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::g, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::h, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::j, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::k, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::l, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::eaigu, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::agrave, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::dollar, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::enter, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::num_4, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::num_5, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::num_6, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::num_plus, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - setKeys(keyValues, keyValuesCount); - break; - case KeyGroup::raw5: - getKeyAddress(Key::shift_left, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::backslash, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::y, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::x, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::c, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::v, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::b, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::n, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::m, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::comma, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::dot, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::minus, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::shift_right, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::arrow_top, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::num_1, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::num_2, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::num_3, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - setKeys(keyValues, keyValuesCount); - break; - case KeyGroup::raw6: - getKeyAddress(Key::ctrl_left, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::win_left, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::alt_left, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::space, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::alt_right, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::win_right, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::menu, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::ctrl_right, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::arrow_left, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::arrow_bottom, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::arrow_right, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::num_0, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::num_dot, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - getKeyAddress(Key::num_enter, keyValues[keyValuesCount].key); - keyValues[keyValuesCount].colors = colors; - keyValuesCount++; - setKeys(keyValues, keyValuesCount); - break; } } diff --git a/src/classes/Keyboard.h b/src/classes/Keyboard.h index c9f2d6d..5bd2e97 100644 --- a/src/classes/Keyboard.h +++ b/src/classes/Keyboard.h @@ -26,7 +26,7 @@ class Keyboard { unknown, egrave, eaigu, agrave, dollar, apostrophe, degree, backslash, // Need best names comma, dot, minus, open_bracket, close_bracket, tidle }; - enum class KeyGroup { logo, indicators, multimedia, fkeys, modifiers, arrows, numeric, functions, keys, raw0, raw1, raw2, raw3, raw4, raw5, raw6 }; + enum class KeyGroup { logo, indicators, multimedia, fkeys, modifiers, arrows, numeric, functions, keys}; struct KeyColors { char red; char green; char blue; }; struct KeyAddress { KeyAddressGroup addressGroup; char id; }; diff --git a/src/main.cpp b/src/main.cpp index 1d539b7..3ae3ee0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -35,7 +35,6 @@ void usage() { cout<<"effect values :\t\trainbow, color\n"; cout<<"key values :\t\tabc... 123... and other\n"; cout<<"group values :\t\tlogo, indicators, fkeys, modifiers, multimedia, arrows, numeric, functions, keys\n"; - //cout<<"\t\t\traw0, raw1, raw2, raw3, raw4, raw5, raw6\n"; // need map with keyboard layout cout<<"\n"; cout<<"sample :\n"; cout<<"g810-led -k logo ff0000\n"; @@ -49,6 +48,7 @@ int commit() { g810.attach(); g810.commit(); g810.detach(); + return 0; } @@ -60,8 +60,12 @@ int setStartupEffect(string effect) { g810.setPowerOnEffect(powerOnEffect); g810.commit(); g810.detach(); + //free(g810); + //free(powerOnEffect); return 0; } + delete[] g810; + //delete powerOnEffect; return 1; }