s/PIDZone/DbusPidZone/g
Renamed PIDZone to DbusPidZone because this object builds in via
inheritance a Dbus implementation of the Mode control interface.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Ifc6c11db4952de5909f0e556c41ec25eee217408
diff --git a/main.cpp b/main.cpp
index 5a94efb..55a6d2e 100644
--- a/main.cpp
+++ b/main.cpp
@@ -81,7 +81,7 @@
void restartControlLoops()
{
static SensorManager mgmr;
- static std::unordered_map<int64_t, std::unique_ptr<PIDZone>> zones;
+ static std::unordered_map<int64_t, std::unique_ptr<DbusPidZone>> zones;
static std::list<boost::asio::steady_timer> timers;
timers.clear();
diff --git a/pid/builder.cpp b/pid/builder.cpp
index b76d134..a5f0ef1 100644
--- a/pid/builder.cpp
+++ b/pid/builder.cpp
@@ -39,12 +39,12 @@
return std::string(objectPath) + std::to_string(zone);
}
-std::unordered_map<int64_t, std::unique_ptr<PIDZone>>
+std::unordered_map<int64_t, std::unique_ptr<DbusPidZone>>
buildZones(const std::map<int64_t, conf::PIDConf>& zonePids,
std::map<int64_t, struct conf::ZoneConfig>& zoneConfigs,
SensorManager& mgr, sdbusplus::bus::bus& modeControlBus)
{
- std::unordered_map<int64_t, std::unique_ptr<PIDZone>> zones;
+ std::unordered_map<int64_t, std::unique_ptr<DbusPidZone>> zones;
for (const auto& zi : zonePids)
{
@@ -66,7 +66,7 @@
const conf::PIDConf& pidConfig = zi.second;
- auto zone = std::make_unique<PIDZone>(
+ auto zone = std::make_unique<DbusPidZone>(
zoneId, zoneConf->second.minThermalOutput,
zoneConf->second.failsafePercent, mgr, modeControlBus,
getControlPath(zi.first).c_str(), deferSignals);
diff --git a/pid/builder.hpp b/pid/builder.hpp
index 0ee3420..4db7447 100644
--- a/pid/builder.hpp
+++ b/pid/builder.hpp
@@ -11,7 +11,7 @@
namespace pid_control
{
-std::unordered_map<int64_t, std::unique_ptr<PIDZone>>
+std::unordered_map<int64_t, std::unique_ptr<DbusPidZone>>
buildZones(const std::map<int64_t, conf::PIDConf>& zonePids,
std::map<int64_t, struct conf::ZoneConfig>& zoneConfigs,
SensorManager& mgr, sdbusplus::bus::bus& modeControlBus);
diff --git a/pid/pidloop.cpp b/pid/pidloop.cpp
index f046c9d..fe6c9b7 100644
--- a/pid/pidloop.cpp
+++ b/pid/pidloop.cpp
@@ -31,7 +31,7 @@
namespace pid_control
{
-static void processThermals(PIDZone* zone)
+static void processThermals(DbusPidZone* zone)
{
// Get the latest margins.
zone->updateSensors();
@@ -44,8 +44,8 @@
zone->determineMaxSetPointRequest();
}
-void pidControlLoop(PIDZone* zone, boost::asio::steady_timer& timer, bool first,
- int ms100cnt)
+void pidControlLoop(DbusPidZone* zone, boost::asio::steady_timer& timer,
+ bool first, int ms100cnt)
{
if (first)
{
diff --git a/pid/pidloop.hpp b/pid/pidloop.hpp
index cf4b7ce..c8365e3 100644
--- a/pid/pidloop.hpp
+++ b/pid/pidloop.hpp
@@ -12,12 +12,12 @@
* This function calls itself indefinitely in an async loop to calculate
* fan outputs based on thermal inputs.
*
- * @param[in] zone - ptr to the PIDZone for this loop.
+ * @param[in] zone - ptr to the DbusPidZone for this loop.
* @param[in] timer - boost timer used for async callback.
* @param[in] first - boolean to denote if initialization needs to be run.
* @param[in] ms100cnt - loop timer counter.
*/
-void pidControlLoop(PIDZone* zone, boost::asio::steady_timer& timer,
+void pidControlLoop(DbusPidZone* zone, boost::asio::steady_timer& timer,
bool first = true, int ms100cnt = 0);
} // namespace pid_control
diff --git a/pid/zone.cpp b/pid/zone.cpp
index 9484658..ca0f67f 100644
--- a/pid/zone.cpp
+++ b/pid/zone.cpp
@@ -38,88 +38,88 @@
using tstamp = std::chrono::high_resolution_clock::time_point;
using namespace std::literals::chrono_literals;
-double PIDZone::getMaxSetPointRequest(void) const
+double DbusPidZone::getMaxSetPointRequest(void) const
{
return _maximumSetPoint;
}
-bool PIDZone::getManualMode(void) const
+bool DbusPidZone::getManualMode(void) const
{
return _manualMode;
}
-void PIDZone::setManualMode(bool mode)
+void DbusPidZone::setManualMode(bool mode)
{
_manualMode = mode;
}
-bool PIDZone::getFailSafeMode(void) const
+bool DbusPidZone::getFailSafeMode(void) const
{
// If any keys are present at least one sensor is in fail safe mode.
return !_failSafeSensors.empty();
}
-int64_t PIDZone::getZoneID(void) const
+int64_t DbusPidZone::getZoneID(void) const
{
return _zoneId;
}
-void PIDZone::addSetPoint(double setpoint)
+void DbusPidZone::addSetPoint(double setpoint)
{
_SetPoints.push_back(setpoint);
}
-void PIDZone::addRPMCeiling(double ceiling)
+void DbusPidZone::addRPMCeiling(double ceiling)
{
_RPMCeilings.push_back(ceiling);
}
-void PIDZone::clearRPMCeilings(void)
+void DbusPidZone::clearRPMCeilings(void)
{
_RPMCeilings.clear();
}
-void PIDZone::clearSetPoints(void)
+void DbusPidZone::clearSetPoints(void)
{
_SetPoints.clear();
}
-double PIDZone::getFailSafePercent(void) const
+double DbusPidZone::getFailSafePercent(void) const
{
return _failSafePercent;
}
-double PIDZone::getMinThermalSetpoint(void) const
+double DbusPidZone::getMinThermalSetpoint(void) const
{
return _minThermalOutputSetPt;
}
-void PIDZone::addFanPID(std::unique_ptr<Controller> pid)
+void DbusPidZone::addFanPID(std::unique_ptr<Controller> pid)
{
_fans.push_back(std::move(pid));
}
-void PIDZone::addThermalPID(std::unique_ptr<Controller> pid)
+void DbusPidZone::addThermalPID(std::unique_ptr<Controller> pid)
{
_thermals.push_back(std::move(pid));
}
-double PIDZone::getCachedValue(const std::string& name)
+double DbusPidZone::getCachedValue(const std::string& name)
{
return _cachedValuesByName.at(name);
}
-void PIDZone::addFanInput(const std::string& fan)
+void DbusPidZone::addFanInput(const std::string& fan)
{
_fanInputs.push_back(fan);
}
-void PIDZone::addThermalInput(const std::string& therm)
+void DbusPidZone::addThermalInput(const std::string& therm)
{
_thermalInputs.push_back(therm);
}
-void PIDZone::determineMaxSetPointRequest(void)
+void DbusPidZone::determineMaxSetPointRequest(void)
{
double max = 0;
std::vector<double>::iterator result;
@@ -174,7 +174,7 @@
return;
}
-void PIDZone::initializeLog(void)
+void DbusPidZone::initializeLog(void)
{
/* Print header for log file:
* epoch_ms,setpt,fan1,fan2,fanN,sensor1,sensor2,sensorN,failsafe
@@ -196,7 +196,7 @@
return;
}
-std::ofstream& PIDZone::getLogHandle(void)
+std::ofstream& DbusPidZone::getLogHandle(void)
{
return _log;
}
@@ -214,7 +214,7 @@
* We want the PID loop to run with values cached, so this will get all the
* fan tachs for the loop.
*/
-void PIDZone::updateFanTelemetry(void)
+void DbusPidZone::updateFanTelemetry(void)
{
/* TODO(venture): Should I just make _log point to /dev/null when logging
* is disabled? I think it's a waste to try and log things even if the
@@ -282,7 +282,7 @@
return;
}
-void PIDZone::updateSensors(void)
+void DbusPidZone::updateSensors(void)
{
using namespace std::chrono;
/* margin and temp are stored as temp */
@@ -323,7 +323,7 @@
return;
}
-void PIDZone::initializeCache(void)
+void DbusPidZone::initializeCache(void)
{
for (const auto& f : _fanInputs)
{
@@ -342,7 +342,7 @@
}
}
-void PIDZone::dumpCache(void)
+void DbusPidZone::dumpCache(void)
{
std::cerr << "Cache values now: \n";
for (const auto& k : _cachedValuesByName)
@@ -351,7 +351,7 @@
}
}
-void PIDZone::processFans(void)
+void DbusPidZone::processFans(void)
{
for (auto& p : _fans)
{
@@ -359,7 +359,7 @@
}
}
-void PIDZone::processThermals(void)
+void DbusPidZone::processThermals(void)
{
for (auto& p : _thermals)
{
@@ -367,19 +367,19 @@
}
}
-Sensor* PIDZone::getSensor(const std::string& name)
+Sensor* DbusPidZone::getSensor(const std::string& name)
{
return _mgr.getSensor(name);
}
-bool PIDZone::manual(bool value)
+bool DbusPidZone::manual(bool value)
{
std::cerr << "manual: " << value << std::endl;
setManualMode(value);
return ModeObject::manual(value);
}
-bool PIDZone::failSafe() const
+bool DbusPidZone::failSafe() const
{
return getFailSafeMode();
}
diff --git a/pid/zone.hpp b/pid/zone.hpp
index dd90fc5..254ea42 100644
--- a/pid/zone.hpp
+++ b/pid/zone.hpp
@@ -28,16 +28,16 @@
{
/*
- * The PIDZone inherits from the Mode object so that it can listen for control
- * mode changes. It primarily holds all PID loops and holds the sensor value
- * cache that's used per iteration of the PID loops.
+ * The DbusPidZone inherits from the Mode object so that it can listen for
+ * control mode changes. It primarily holds all PID loops and holds the sensor
+ * value cache that's used per iteration of the PID loops.
*/
-class PIDZone : public ZoneInterface, public ModeObject
+class DbusPidZone : public ZoneInterface, public ModeObject
{
public:
- PIDZone(int64_t zone, double minThermalOutput, double failSafePercent,
- const SensorManager& mgr, sdbusplus::bus::bus& bus,
- const char* objPath, bool defer) :
+ DbusPidZone(int64_t zone, double minThermalOutput, double failSafePercent,
+ const SensorManager& mgr, sdbusplus::bus::bus& bus,
+ const char* objPath, bool defer) :
ModeObject(bus, objPath, defer),
_zoneId(zone), _maximumSetPoint(),
_minThermalOutputSetPt(minThermalOutput),
diff --git a/test/controller_mock.hpp b/test/controller_mock.hpp
index f1c9d56..63353a1 100644
--- a/test/controller_mock.hpp
+++ b/test/controller_mock.hpp
@@ -12,7 +12,7 @@
public:
virtual ~ControllerMock() = default;
- ControllerMock(const std::string& id, PIDZone* owner) :
+ ControllerMock(const std::string& id, DbusPidZone* owner) :
PIDController(id, owner)
{}
diff --git a/test/pid_zone_unittest.cpp b/test/pid_zone_unittest.cpp
index d7ae9ec..97b7f10 100644
--- a/test/pid_zone_unittest.cpp
+++ b/test/pid_zone_unittest.cpp
@@ -56,8 +56,8 @@
SetupDbusObject(&sdbus_mock_mode, defer, objPath, modeInterface, properties,
&d);
- PIDZone p(zone, minThermalOutput, failSafePercent, m, bus_mock_mode,
- objPath, defer);
+ DbusPidZone p(zone, minThermalOutput, failSafePercent, m, bus_mock_mode,
+ objPath, defer);
// Success.
}
@@ -86,9 +86,9 @@
SetupDbusObject(&sdbus_mock_mode, defer, objPath, modeInterface,
properties, &property_index);
- zone =
- std::make_unique<PIDZone>(zoneId, minThermalOutput, failSafePercent,
- mgr, bus_mock_mode, objPath, defer);
+ zone = std::make_unique<DbusPidZone>(zoneId, minThermalOutput,
+ failSafePercent, mgr,
+ bus_mock_mode, objPath, defer);
}
// unused
@@ -105,7 +105,7 @@
const char* objPath = "/path/";
SensorManager mgr;
- std::unique_ptr<PIDZone> zone;
+ std::unique_ptr<DbusPidZone> zone;
};
TEST_F(PidZoneTest, GetZoneId_ReturnsExpected)