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