1 #include <logging.hpp>
2 #include <sdbusplus/bus.hpp>
3 
4 #include <sstream>
5 
6 namespace attn
7 {
8 
9 /** @brief Start host diagnostic mode systemd unit */
10 void tiHandler()
11 {
12     // trace message
13     std::stringstream ss;
14     ss << "start host diagnostic mode service" << std::endl;
15     log<level::INFO>(ss.str().c_str());
16 
17     // Use the systemd service manager object interface to call the start unit
18     // method with the obmc-host-diagnostic-mode target.
19     auto bus    = sdbusplus::bus::new_system();
20     auto method = bus.new_method_call(
21         "org.freedesktop.systemd1", "/org/freedesktop/systemd1",
22         "org.freedesktop.systemd1.Manager", "StartUnit");
23 
24     method.append("obmc-host-diagnostic-mode@0.target"); // unit to activate
25     method.append("replace"); // mode = replace conflicting queued jobs
26     bus.call_noreply(method); // start the service
27 
28     return;
29 }
30 
31 } // namespace attn
32