NVMeSensor: Centralise configuration type

The objectType populated in the Sensor instance was different to the
configuration name used by NVMeSensorMain, which lead to sensors not
being removed with their EntityManager configuration went away.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ifa3c8f41fa8367d8fae62fe0d9b63a2b1675b53f
diff --git a/include/NVMeSensor.hpp b/include/NVMeSensor.hpp
index 6727693..48ffc25 100644
--- a/include/NVMeSensor.hpp
+++ b/include/NVMeSensor.hpp
@@ -6,6 +6,9 @@
 class NVMeSensor : public Sensor
 {
   public:
+    static constexpr const char* CONFIG_TYPE =
+        "xyz.openbmc_project.Configuration.NVME1000";
+
     NVMeSensor(sdbusplus::asio::object_server& objectServer,
                boost::asio::io_service& io,
                std::shared_ptr<sdbusplus::asio::connection>& conn,
diff --git a/src/NVMeSensor.cpp b/src/NVMeSensor.cpp
index 5f66eb3..cdaa28b 100644
--- a/src/NVMeSensor.cpp
+++ b/src/NVMeSensor.cpp
@@ -29,8 +29,8 @@
                        const std::string& sensorConfiguration,
                        const int busNumber) :
     Sensor(escapeName(sensorName), std::move(thresholdsIn), sensorConfiguration,
-           "xyz.openbmc_project.Configuration.NVMe", false, false, maxReading,
-           minReading, conn, PowerState::on),
+           NVMeSensor::CONFIG_TYPE, false, false, maxReading, minReading, conn,
+           PowerState::on),
     bus(busNumber), objServer(objectServer)
 {
     sensorInterface = objectServer.add_interface(
diff --git a/src/NVMeSensorMain.cpp b/src/NVMeSensorMain.cpp
index e8fc21a..165cf2b 100644
--- a/src/NVMeSensorMain.cpp
+++ b/src/NVMeSensorMain.cpp
@@ -23,9 +23,6 @@
 #include <optional>
 #include <regex>
 
-static constexpr const char* sensorType =
-    "xyz.openbmc_project.Configuration.NVME1000";
-
 static NVMEMap nvmeDeviceMap;
 
 static constexpr bool debug = false;
@@ -135,7 +132,7 @@
     for (const auto& [interfacePath, sensorData] : sensorConfigurations)
     {
         // find base configuration
-        auto sensorBase = sensorData.find(sensorType);
+        auto sensorBase = sensorData.find(NVMeSensor::CONFIG_TYPE);
         if (sensorBase != sensorData.end())
         {
             const SensorBaseConfigMap& sensorConfig = sensorBase->second;
@@ -184,7 +181,7 @@
             handleSensorConfigurations(io, objectServer, dbusConnection,
                                        sensorConfigurations);
         }));
-    getter->getConfiguration(std::vector<std::string>{sensorType});
+    getter->getConfiguration(std::vector<std::string>{NVMeSensor::CONFIG_TYPE});
 }
 
 int main()
@@ -226,7 +223,7 @@
         static_cast<sdbusplus::bus::bus&>(*systemBus),
         "type='signal',member='PropertiesChanged',path_namespace='" +
             std::string(inventoryPath) + "',arg0namespace='" +
-            std::string(sensorType) + "'",
+            std::string(NVMeSensor::CONFIG_TYPE) + "'",
         eventHandler);
 
     setupManufacturingModeMatch(*systemBus);