added user input via keys

This commit is contained in:
2020-08-06 22:45:05 +02:00
parent c13182b77f
commit a92a9c2a2a
4 changed files with 83 additions and 34 deletions

View File

@ -54,6 +54,7 @@ void reHDD::app_logic(void)
FD_SET(fdWhipe[0], &selectSet);
thread thDevices(ThreadScannDevices); //start thread that scanns for drives
thread thUserInput(ThreadUserInput); //start thread that reads user input
while(1) {
@ -76,6 +77,7 @@ void reHDD::app_logic(void)
}
} //endless loop
thDevices.join();
thUserInput.join();
}
void reHDD::ThreadScannDevices() {
@ -92,6 +94,42 @@ void reHDD::ThreadScannDevices() {
}
}
void reHDD::ThreadUserInput() {
while(true) {
// cout << TUI::readUserInput() << endl;
switch (TUI::readUserInput())
{
case TUI::UserInput::DownKey:
/* code */
//cout << "Down" << endl;
break;
case TUI::UserInput::UpKey:
//cout << "Up" << endl;
break;
case TUI::UserInput::Undefined:
//cout << "Undefined" << endl;
break;
case TUI::UserInput::Abort:
//cout << "Abort" << endl;
break;
case TUI::UserInput::Delete:
//cout << "Delete" << endl;
break;
case TUI::UserInput::Shred:
//cout << "Shred" << endl;
break;
case TUI::UserInput::Enter:
//cout << "Enter" << endl;
break;
case TUI::UserInput::ESC:
//cout << "ESC" << endl;
break;
default:
break;
}
}
}
void reHDD::filterNewDrives(vector <Drive>* pvecOldDrives, vector <Drive>* pvecNewDrives) {
@ -116,11 +154,9 @@ void reHDD::filterNewDrives(vector <Drive>* pvecOldDrives, vector <Drive>* pvecN
}
pvecOldDrives->clear();
for (long unsigned int i=0; i<pvecNewDrives->size(); i++) {
pvecOldDrives->push_back((*pvecNewDrives)[i]);
}
}
/**