targets.hpp (0a8de64574891f9e0e6339b6e064e4599dffcb21) targets.hpp (1e6324fa4fc233c3f2913b3d5278aa06e45ff42f)
1#pragma once
2
3#include <experimental/filesystem>
4#include "fan_speed.hpp"
5
6/** @class Targets
7 * @brief Target type traits.
8 *

--- 40 unchanged lines hidden (view full) ---

49 static constexpr bool deferSignals = true;
50
51 auto& bus = *std::get<sdbusplus::bus::bus*>(info);
52 auto& obj = std::get<Object>(info);
53 auto& objPath = std::get<std::string>(info);
54
55 // Check if target sysfs file exists
56 auto targetPath = hwmonRoot + '/' + instance;
1#pragma once
2
3#include <experimental/filesystem>
4#include "fan_speed.hpp"
5
6/** @class Targets
7 * @brief Target type traits.
8 *

--- 40 unchanged lines hidden (view full) ---

49 static constexpr bool deferSignals = true;
50
51 auto& bus = *std::get<sdbusplus::bus::bus*>(info);
52 auto& obj = std::get<Object>(info);
53 auto& objPath = std::get<std::string>(info);
54
55 // Check if target sysfs file exists
56 auto targetPath = hwmonRoot + '/' + instance;
57 auto sysfsFullPath = make_sysfs_path(targetPath,
58 sensor.first,
59 sensor.second,
60 hwmon::entry::target);
57 auto sysfsFullPath = sysfs::make_sysfs_path(targetPath,
58 sensor.first,
59 sensor.second,
60 hwmon::entry::target);
61 if (fs::exists(sysfsFullPath))
62 {
63 target = std::make_shared<T>(hwmonRoot,
64 instance,
65 sensor.second,
66 bus,
67 objPath.c_str(),
68 deferSignals);
69 auto type = Targets<T>::type;
70 obj[type] = target;
71 }
72
73 return target;
74}
61 if (fs::exists(sysfsFullPath))
62 {
63 target = std::make_shared<T>(hwmonRoot,
64 instance,
65 sensor.second,
66 bus,
67 objPath.c_str(),
68 deferSignals);
69 auto type = Targets<T>::type;
70 obj[type] = target;
71 }
72
73 return target;
74}