Move getSensorConnection to header file

Move getSensorConnection to header file, so that the same
can be used by ipmi-providers Set Sensor override command

Change-Id: Ic6c313eb2bc07710c175b7908647a800f5fe45a0
Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
diff --git a/src/sensorcommands.cpp b/src/sensorcommands.cpp
index a4fe05a..aea03ab 100644
--- a/src/sensorcommands.cpp
+++ b/src/sensorcommands.cpp
@@ -50,7 +50,7 @@
 static uint32_t sdrLastAdd = noTimestamp;
 static uint32_t sdrLastRemove = noTimestamp;
 
-static SensorSubTree sensorTree;
+SensorSubTree sensorTree;
 static boost::container::flat_map<std::string, ManagedObjectType> SensorCache;
 
 // Specify the comparison required to sort and find char* map objects
@@ -112,37 +112,6 @@
     }
 }
 
-static ipmi_ret_t getSensorConnection(uint8_t sensnum, std::string &connection,
-                                      std::string &path)
-{
-    if (sensorTree.empty() && !getSensorSubtree(sensorTree))
-    {
-        return IPMI_CC_RESPONSE_ERROR;
-    }
-
-    if (sensorTree.size() < (sensnum + 1))
-    {
-        return IPMI_CC_INVALID_FIELD_REQUEST;
-    }
-
-    uint8_t sensorIndex = sensnum;
-    for (const auto &sensor : sensorTree)
-    {
-        if (sensorIndex-- == 0)
-        {
-            if (!sensor.second.size())
-            {
-                return IPMI_CC_RESPONSE_ERROR;
-            }
-            connection = sensor.second.begin()->first;
-            path = sensor.first;
-            break;
-        }
-    }
-
-    return 0;
-}
-
 static bool getSensorMap(std::string sensorConnection, std::string sensorPath,
                          SensorMap &sensorMap)
 {