blob: b482d7bd7c9890326007db8a9f053aa760354ad9 [file] [log] [blame]
Christopher Meis26fbbd52025-03-26 14:55:06 +01001#pragma once
2
Christopher Meisfc9e7fd2025-04-03 13:13:35 +02003#include "../utils.hpp"
Christopher Meiscf6a75b2025-06-03 07:53:50 +02004#include "entity_manager.hpp"
Christopher Meis26fbbd52025-03-26 14:55:06 +01005
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
16namespace scan
17{
18struct DBusDeviceDescriptor
19{
20 DBusInterface interface;
21 std::string path;
22};
23
24using FoundDevices = std::vector<DBusDeviceDescriptor>;
25
26struct PerformScan : std::enable_shared_from_this<PerformScan>
27{
Christopher Meiscf6a75b2025-06-03 07:53:50 +020028 PerformScan(EntityManager& em, nlohmann::json& missingConfigurations,
Christopher Meisf7252572025-06-11 13:22:05 +020029 std::vector<nlohmann::json>& configurations,
Alexander Hansena555acf2025-06-27 11:59:10 +020030 boost::asio::io_context& io, std::function<void()>&& callback);
Christopher Meis26fbbd52025-03-26 14:55:06 +010031
32 void updateSystemConfiguration(const nlohmann::json& recordRef,
33 const std::string& probeName,
34 FoundDevices& foundDevices);
35 void run();
36 virtual ~PerformScan();
Christopher Meiscf6a75b2025-06-03 07:53:50 +020037 EntityManager& _em;
Christopher Meis26fbbd52025-03-26 14:55:06 +010038 nlohmann::json& _missingConfigurations;
Christopher Meisf7252572025-06-11 13:22:05 +020039 std::vector<nlohmann::json> _configurations;
Christopher Meis26fbbd52025-03-26 14:55:06 +010040 std::function<void()> _callback;
41 bool _passed = false;
42 MapperGetSubTreeResponse dbusProbeObjects;
43 std::vector<std::string> passedProbes;
Alexander Hansena555acf2025-06-27 11:59:10 +020044
45 boost::asio::io_context& io;
Christopher Meis26fbbd52025-03-26 14:55:06 +010046};
47
48} // namespace scan