Implement API to stop a payload instance

Change-Id: I8cf7a85f651e5a4377f8e64cbb32932f452a234e
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
diff --git a/sol/sol_manager.cpp b/sol/sol_manager.cpp
index ed47398..ce0e5a4 100644
--- a/sol/sol_manager.cpp
+++ b/sol/sol_manager.cpp
@@ -112,4 +112,25 @@
     payloadMap.emplace(payloadInstance, std::move(context));
 }
 
+void Manager::stopPayloadInstance(uint8_t payloadInstance)
+{
+    auto iter = payloadMap.find(payloadInstance);
+    if (iter == payloadMap.end())
+    {
+        throw std::runtime_error("SOL Payload instance not found ");
+    }
+
+    payloadMap.erase(iter);
+
+    std::get<eventloop::EventLoop&>(singletonPool).stopSOLPayloadInstance(
+            payloadInstance);
+
+    if (payloadMap.empty())
+    {
+        // Remove the host console decriptor from the sd_event_loop
+        std::get<eventloop::EventLoop&>(singletonPool).stopHostConsole();
+        consoleFD.reset();
+    }
+}
+
 } // namespace sol