xref: /openbmc/entity-manager/src/entity_manager/perform_scan.hpp (revision 7cab244e6e80ba1c9f542df294f03a862b10b456)
1 #pragma once
2 
3 #include "../utils.hpp"
4 #include "entity_manager.hpp"
5 
6 #include <systemd/sd-journal.h>
7 
8 #include <boost/container/flat_map.hpp>
9 #include <nlohmann/json.hpp>
10 #include <sdbusplus/asio/object_server.hpp>
11 
12 #include <functional>
13 #include <list>
14 #include <vector>
15 
16 namespace scan
17 {
18 struct DBusDeviceDescriptor
19 {
20     DBusInterface interface;
21     std::string path;
22 };
23 
24 using FoundDevices = std::vector<DBusDeviceDescriptor>;
25 
26 struct PerformScan : std::enable_shared_from_this<PerformScan>
27 {
28     PerformScan(EntityManager& em, nlohmann::json& missingConfigurations,
29                 std::vector<nlohmann::json>& configurations,
30                 boost::asio::io_context& io, std::function<void()>&& callback);
31 
32     void updateSystemConfiguration(const nlohmann::json& recordRef,
33                                    const std::string& probeName,
34                                    FoundDevices& foundDevices);
35     void run();
36     virtual ~PerformScan();
37     EntityManager& _em;
38     MapperGetSubTreeResponse dbusProbeObjects;
39     std::vector<std::string> passedProbes;
40 
41   private:
42     nlohmann::json& _missingConfigurations;
43     std::vector<nlohmann::json> _configurations;
44     std::function<void()> _callback;
45     bool _passed = false;
46 
47     boost::asio::io_context& io;
48 };
49 
50 } // namespace scan
51