Christopher Meis | 26fbbd5 | 2025-03-26 14:55:06 +0100 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Christopher Meis | fc9e7fd | 2025-04-03 13:13:35 +0200 | [diff] [blame] | 3 | #include "../utils.hpp" |
Christopher Meis | cf6a75b | 2025-06-03 07:53:50 +0200 | [diff] [blame] | 4 | #include "entity_manager.hpp" |
Christopher Meis | 26fbbd5 | 2025-03-26 14:55:06 +0100 | [diff] [blame] | 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 | { |
Christopher Meis | cf6a75b | 2025-06-03 07:53:50 +0200 | [diff] [blame] | 28 | PerformScan(EntityManager& em, nlohmann::json& missingConfigurations, |
Christopher Meis | 26fbbd5 | 2025-03-26 14:55:06 +0100 | [diff] [blame] | 29 | std::list<nlohmann::json>& configurations, |
Christopher Meis | 26fbbd5 | 2025-03-26 14:55:06 +0100 | [diff] [blame] | 30 | 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 Meis | cf6a75b | 2025-06-03 07:53:50 +0200 | [diff] [blame] | 37 | EntityManager& _em; |
Christopher Meis | 26fbbd5 | 2025-03-26 14:55:06 +0100 | [diff] [blame] | 38 | nlohmann::json& _missingConfigurations; |
| 39 | std::list<nlohmann::json> _configurations; |
Christopher Meis | 26fbbd5 | 2025-03-26 14:55:06 +0100 | [diff] [blame] | 40 | std::function<void()> _callback; |
| 41 | bool _passed = false; |
| 42 | MapperGetSubTreeResponse dbusProbeObjects; |
| 43 | std::vector<std::string> passedProbes; |
| 44 | }; |
| 45 | |
| 46 | } // namespace scan |