sensors/zones: place in namespace and cleanup
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I527dbc8477a232945f696227a7b0b2adbee45175
diff --git a/dbus/dbusactiveread.cpp b/dbus/dbusactiveread.cpp
index 406b391..21f6c4d 100644
--- a/dbus/dbusactiveread.cpp
+++ b/dbus/dbusactiveread.cpp
@@ -22,6 +22,9 @@
#include <cmath>
#include <iostream>
+namespace pid_control
+{
+
ReadReturn DbusActiveRead::read(void)
{
struct SensorProperties settings;
@@ -39,3 +42,5 @@
return r;
}
+
+} // namespace pid_control
diff --git a/dbus/dbusactiveread.hpp b/dbus/dbusactiveread.hpp
index 37ff9bc..adf091d 100644
--- a/dbus/dbusactiveread.hpp
+++ b/dbus/dbusactiveread.hpp
@@ -8,6 +8,9 @@
#include <memory>
#include <string>
+namespace pid_control
+{
+
/*
* This ReadInterface will actively reach out over dbus upon calling read to
* get the value from whomever owns the associated dbus path.
@@ -29,3 +32,5 @@
const std::string _service; // the sensor service.
DbusHelperInterface* _helper;
};
+
+} // namespace pid_control
diff --git a/dbus/dbusconfiguration.cpp b/dbus/dbusconfiguration.cpp
index c1279a4..c3c72bd 100644
--- a/dbus/dbusconfiguration.cpp
+++ b/dbus/dbusconfiguration.cpp
@@ -32,6 +32,9 @@
#include <unordered_map>
#include <variant>
+namespace pid_control
+{
+
static constexpr bool DEBUG = false; // enable to print found configuration
extern std::map<std::string, struct conf::SensorConfig> sensorConfig;
@@ -957,4 +960,6 @@
}
return true;
}
+
} // namespace dbus_configuration
+} // namespace pid_control
diff --git a/dbus/dbusconfiguration.hpp b/dbus/dbusconfiguration.hpp
index a9b12a9..f9c3bcf 100644
--- a/dbus/dbusconfiguration.hpp
+++ b/dbus/dbusconfiguration.hpp
@@ -19,7 +19,10 @@
#include <sdbusplus/bus.hpp>
+namespace pid_control
+{
namespace dbus_configuration
{
bool init(sdbusplus::bus::bus& bus, boost::asio::steady_timer& timer);
} // namespace dbus_configuration
+} // namespace pid_control
diff --git a/dbus/dbuspassive.cpp b/dbus/dbuspassive.cpp
index 5cd8ca4..815ed49 100644
--- a/dbus/dbuspassive.cpp
+++ b/dbus/dbuspassive.cpp
@@ -27,6 +27,9 @@
#include <string>
#include <variant>
+namespace pid_control
+{
+
std::unique_ptr<ReadInterface> DbusPassive::createDbusPassive(
sdbusplus::bus::bus& bus, const std::string& type, const std::string& id,
DbusHelperInterface* helper, const conf::SensorConfig* info,
@@ -220,3 +223,5 @@
return handleSensorValue(sdbpMsg, obj);
}
+
+} // namespace pid_control
diff --git a/dbus/dbuspassive.hpp b/dbus/dbuspassive.hpp
index 16cf856..74db80b 100644
--- a/dbus/dbuspassive.hpp
+++ b/dbus/dbuspassive.hpp
@@ -20,6 +20,9 @@
#include <tuple>
#include <vector>
+namespace pid_control
+{
+
int dbusHandleSignal(sd_bus_message* msg, void* data, sd_bus_error* err);
/*
@@ -80,3 +83,5 @@
};
int handleSensorValue(sdbusplus::message::message& msg, DbusPassive* owner);
+
+} // namespace pid_control
diff --git a/dbus/dbuspassiveredundancy.cpp b/dbus/dbuspassiveredundancy.cpp
index 11533f2..2ca8fde 100644
--- a/dbus/dbuspassiveredundancy.cpp
+++ b/dbus/dbuspassiveredundancy.cpp
@@ -24,6 +24,9 @@
#include <unordered_map>
#include <variant>
+namespace pid_control
+{
+
namespace properties
{
@@ -175,4 +178,6 @@
const std::set<std::string>& DbusPassiveRedundancy::getFailed()
{
return failed;
-}
\ No newline at end of file
+}
+
+} // namespace pid_control
diff --git a/dbus/dbuspassiveredundancy.hpp b/dbus/dbuspassiveredundancy.hpp
index 1c5c975..790c758 100644
--- a/dbus/dbuspassiveredundancy.hpp
+++ b/dbus/dbuspassiveredundancy.hpp
@@ -21,6 +21,8 @@
#include <set>
+namespace pid_control
+{
/*
* DbusPassiveRedundancy monitors the fan redundancy interface via dbus match
* for changes. When the "Status" property changes to Failed, all sensors in
@@ -42,3 +44,5 @@
std::set<std::string> failed;
sdbusplus::bus::bus& passiveBus;
};
+
+} // namespace pid_control
diff --git a/dbus/dbuswrite.cpp b/dbus/dbuswrite.cpp
index 2cff7ea..0b02872 100644
--- a/dbus/dbuswrite.cpp
+++ b/dbus/dbuswrite.cpp
@@ -24,6 +24,9 @@
#include <string>
#include <variant>
+namespace pid_control
+{
+
constexpr const char* pwmInterface = "xyz.openbmc_project.Control.FanPwm";
using namespace phosphor::logging;
@@ -128,3 +131,5 @@
oldValue = static_cast<int64_t>(value);
return;
}
+
+} // namespace pid_control
diff --git a/dbus/dbuswrite.hpp b/dbus/dbuswrite.hpp
index b8a6035..5cc2d49 100644
--- a/dbus/dbuswrite.hpp
+++ b/dbus/dbuswrite.hpp
@@ -24,6 +24,9 @@
#include <memory>
#include <string>
+namespace pid_control
+{
+
class DbusWritePercent : public WriteInterface
{
public:
@@ -65,3 +68,5 @@
std::string connectionName;
int64_t oldValue = -1;
};
+
+} // namespace pid_control
diff --git a/dbus/util.cpp b/dbus/util.cpp
index 93efc6d..a464458 100644
--- a/dbus/util.cpp
+++ b/dbus/util.cpp
@@ -11,6 +11,9 @@
using Value = std::variant<int64_t, double, std::string, bool>;
using PropertyMap = std::map<Property, Value>;
+namespace pid_control
+{
+
using namespace phosphor::logging;
/* TODO(venture): Basically all phosphor apps need this, maybe it should be a
@@ -194,3 +197,5 @@
}
value /= (max - min);
}
+
+} // namespace pid_control