From fbddbc020c26cddd271b1a40ca2bef87594f27f1 Mon Sep 17 00:00:00 2001 From: "Denis V. Dedkov" Date: Wed, 29 May 2024 17:18:14 +0200 Subject: [PATCH] On command mapping fixed --- main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 7acfd8a..6546846 100644 --- a/main.cpp +++ b/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);