xref: /openbmc/entity-manager/src/entity_manager/perform_probe.hpp (revision dbf95b2c54c5a40d1ea44d650eb6aab2a4c34ba5)
1 #pragma once
2 
3 #include "perform_scan.hpp"
4 
5 #include <flat_map>
6 #include <memory>
7 #include <string>
8 #include <vector>
9 
10 namespace probe
11 {
12 
13 // underscore T for collison with dbus c api
14 enum class probe_type_codes
15 {
16     FALSE_T,
17     TRUE_T,
18     AND,
19     OR,
20     FOUND,
21     MATCH_ONE
22 };
23 
24 using FoundProbeTypeT = std::optional<probe_type_codes>;
25 
26 FoundProbeTypeT findProbeType(const std::string& probe);
27 
28 // this class finds the needed dbus fields and on destruction runs the probe
29 struct PerformProbe
30 {
31     PerformProbe(nlohmann::json& recordRef,
32                  const std::vector<std::string>& probeCommand,
33                  std::string probeName,
34                  std::shared_ptr<scan::PerformScan>& scanPtr);
35     virtual ~PerformProbe();
36 
37   private:
38     nlohmann::json& recordRef;
39     std::vector<std::string> _probeCommand;
40     std::string probeName;
41     std::shared_ptr<scan::PerformScan> scan;
42 };
43 
44 } // namespace probe
45