diff options
author | Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com> | 2017-02-01 18:02:38 +0530 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-03-27 13:27:01 -0500 |
commit | d27e71e23cbe02dad145419c46c064d212420836 (patch) | |
tree | cc8743ab9bc4f69b0d0a7908e7a74c2a06feb351 /softoff/softoff.cpp | |
parent | 072482986dfa60a905392c2dc49031ad7296bf2a (diff) | |
download | phosphor-host-ipmid-d27e71e23cbe02dad145419c46c064d212420836.tar.gz phosphor-host-ipmid-d27e71e23cbe02dad145419c46c064d212420836.zip |
Add routines to start and stop the sd_event timer
Change-Id: I738be7b70554125e544aa59fe1770e909d3dffb1
Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
Diffstat (limited to 'softoff/softoff.cpp')
-rw-r--r-- | softoff/softoff.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/softoff/softoff.cpp b/softoff/softoff.cpp index 11298ab..49b6f26 100644 --- a/softoff/softoff.cpp +++ b/softoff/softoff.cpp @@ -13,7 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include <chrono> +#include <phosphor-logging/log.hpp> #include "softoff.hpp" +#include "config.h" namespace phosphor { namespace ipmi @@ -22,6 +25,7 @@ namespace ipmi /** @brief Send the SMS_ATN to host if value is set */ void SoftPowerOff::sendSMSAttn() { + using namespace std::chrono; auto method = bus.new_method_call(HOST_IPMI_BUS, HOST_IPMI_OBJ, HOST_IPMI_INTF, @@ -31,6 +35,14 @@ void SoftPowerOff::sendSMSAttn() // BT returns '0' on success and bus_error on failure. bus.call_noreply(method); + // Start the timer + auto time = duration_cast<microseconds>( + seconds(IPMI_SMS_ATN_ACK_TIMEOUT_SECS)); + auto r = timer.startTimer(time); + if (r < 0) + { + throw std::runtime_error("Error starting timer"); + } return; } |