xref: /openbmc/entity-manager/src/entity_manager/perform_scan.hpp (revision f7252577794639be8f22da52ec09c621de44dcda)
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     nlohmann::json& _missingConfigurations;
39     std::vector<nlohmann::json> _configurations;
40     std::function<void()> _callback;
41     bool _passed = false;
42     MapperGetSubTreeResponse dbusProbeObjects;
43     std::vector<std::string> passedProbes;
44 
45     boost::asio::io_context& io;
46 };
47 
48 } // namespace scan
49