blob: 54d0e67157c506d24fd2e3633c4671ed3b3035ef [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 Meis26fbbd52025-03-26 14:55:06 +010029 std::list<nlohmann::json>& configurations,
Christopher Meis26fbbd52025-03-26 14:55:06 +010030 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();
Christopher Meiscf6a75b2025-06-03 07:53:50 +020037 EntityManager& _em;
Christopher Meis26fbbd52025-03-26 14:55:06 +010038 nlohmann::json& _missingConfigurations;
39 std::list<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;
44};
45
46} // namespace scan