blob: 46455b38a0cb1d30782ce248fb558582b1d7c71d [file] [log] [blame]
#include <../attn/attn_monitor.hpp>
namespace attn
{
/**
* @brief Attention handler application main()
*/
int attnDaemon(Config* i_config)
{
int rc = 0; // assume success
gpiod_line* line; // gpio line to monitor
boost::asio::io_service io; // async io monitoring service
// GPIO line configuration (falling edge, active low)
struct gpiod_line_request_config config
{
"attention", GPIOD_LINE_REQUEST_EVENT_FALLING_EDGE, 0
};
// get handle to attention GPIO line
line = gpiod_line_get("gpiochip0", 74);
if (nullptr == line)
{
rc = 1; // error
}
else
{
// Creating a vector of one gpio to monitor
std::vector<std::unique_ptr<attn::AttnMonitor>> gpios;
gpios.push_back(
std::make_unique<attn::AttnMonitor>(line, config, io, i_config));
io.run(); // start GPIO monitor
}
return rc;
}
} // namespace attn