nvme_manager: Read WCTEMP to set threshold dynamically

Signed-off-by: George Hung <george.hung@quantatw.com>
Change-Id: Ib240ed69fbf7d4b135dea91839153b333183347d
diff --git a/nvme_manager.cpp b/nvme_manager.cpp
index 9f4aa17..e73d849 100644
--- a/nvme_manager.cpp
+++ b/nvme_manager.cpp
@@ -259,7 +259,8 @@
     nvmeData.statusFlags = intToHex(rsp_data_command_0[1]);
     nvmeData.smartWarnings = intToHex(rsp_data_command_0[2]);
     nvmeData.driveLifeUsed = intToHex(rsp_data_command_0[4]);
-    nvmeData.sensorValue = (int8_t)rsp_data_command_0[3];
+    nvmeData.sensorValue = static_cast<int8_t>(rsp_data_command_0[3]);
+    nvmeData.wcTemp = static_cast<int8_t>(rsp_data_command_0[5]);
 
     tx_data = COMMAND_CODE_8;
 
@@ -537,6 +538,11 @@
 
         setNvmeInventoryProperties(true, nvmeData, inventoryPath);
         nvmeSSD->setSensorValueToDbus(nvmeData.sensorValue);
+        if (nvmeData.wcTemp != 0)
+        {
+            config.criticalHigh = nvmeData.wcTemp;
+            config.warningHigh = nvmeData.wcTemp;
+        }
         nvmeSSD->setSensorThreshold(config.criticalHigh, config.criticalLow,
                                     config.maxValue, config.minValue,
                                     config.warningHigh, config.warningLow);