1 #include <../attn/attn_monitor.hpp>
2 
3 namespace attn
4 {
5 
6 /**
7  * @brief Attention handler application main()
8  */
9 int attnDaemon(bool i_breakpoints)
10 {
11     int rc = 0; // assume success
12 
13     gpiod_line* line; // gpio line to monitor
14 
15     boost::asio::io_service io; // async io monitoring service
16 
17     // GPIO line configuration (falling edge, active low)
18     struct gpiod_line_request_config config
19     {
20         "attention", GPIOD_LINE_REQUEST_EVENT_FALLING_EDGE, 0
21     };
22 
23     // get handle to attention GPIO line
24     line = gpiod_line_get("gpiochip0", 74);
25 
26     if (nullptr == line)
27     {
28         rc = 1; // error
29     }
30     else
31     {
32         // Creating a vector of one gpio to monitor
33         std::vector<std::unique_ptr<attn::AttnMonitor>> gpios;
34         gpios.push_back(std::make_unique<attn::AttnMonitor>(line, config, io,
35                                                             i_breakpoints));
36 
37         io.run(); // start GPIO monitor
38     }
39 
40     return rc;
41 }
42 
43 } // namespace attn
44