45int main(
int argc,
char* argv[]) {
48 legacy::in::WebApp webApp(
"werema");
52 webApp.get(
"/jalousien/:id", []
APPLICATION(req, res) {
53 VLOG(1) <<
"Param: " << req->param(
"id");
54 VLOG(1) <<
"Qurey: " << req->query(
"action");
56 std::string arguments =
"aircontrol -t " + jalousien[req->param(
"id")] +
"_" + actions[req->query(
"action")];
58 int ret = system(arguments.c_str());
59 ret = (ret >> 8) & 0xFF;
61
62
63
64
68 res->status(200).send(
"OK: " + arguments);
71 res->status(404).send(
"ERROR not found: " + arguments);
77 res->status(404).send(
"No Jalousie specified");
81 [instanceName = webApp.getConfig().getInstanceName()](
const legacy::in::WebApp::SocketAddress& socketAddress,
82 const core::socket::State& state) {
84 case core::socket::State::OK:
85 VLOG(1) << instanceName <<
": listening on '" << socketAddress.toString() <<
"'";
87 case core::socket::State::DISABLED:
88 VLOG(1) << instanceName <<
": disabled";
90 case core::socket::State::ERROR:
91 LOG(ERROR) << instanceName <<
": " << socketAddress.toString() <<
": " << state.what();
93 case core::socket::State::FATAL:
94 LOG(FATAL) << instanceName <<
": " << socketAddress.toString() <<
": " << state.what();