On command mapping fixed
This commit is contained in:
4
main.cpp
4
main.cpp
@@ -32,7 +32,7 @@ int main(int argc, char *argv[])
|
||||
const std::map< std::string, noolitelib::Command > commands = {
|
||||
{ "off", noolitelib::Off },
|
||||
{ "decraseBrightnes", noolitelib::DecraseBrightnes },
|
||||
{ "on", noolitelib::DecraseBrightnes },
|
||||
{ "on", noolitelib::On },
|
||||
{ "incraseBrightnes", noolitelib::IncreaseBrightnes },
|
||||
{ "switch", noolitelib::Switch },
|
||||
{ "invertBrightnes", noolitelib::InvertBrightnes },
|
||||
@@ -71,7 +71,7 @@ int main(int argc, char *argv[])
|
||||
auto channel = req.path_params.at("channel");
|
||||
|
||||
noolitelib::Noolite adapter;
|
||||
if (adapter.sendCommand(std::stoi(channel), noolitelib::Switch)) {
|
||||
if (adapter.sendCommand(std::stoi(channel), commands.at(command))) {
|
||||
res.set_content(formatResult(true, command + " " + channel), App::ContentType);
|
||||
} else {
|
||||
res.set_content(formatResult(false, "Device error"), App::ContentType);
|
||||
|
||||
Reference in New Issue
Block a user