From 30b011246bf85759cd9d2676ba3ec77a41ab026f Mon Sep 17 00:00:00 2001 From: Richard Marian Thomaiyar Date: Wed, 3 Apr 2019 15:46:03 +0530 Subject: Add convert current channel number function Support for convert current channel number based on ipmi::Context is added. Tested: Verified by updating the channel number manually and function returns correctly. For correct value another gerrit patch is needed which will advertise proper channel from which the command originated. Change-Id: Id17d87b6a945b0264c8f14348a50bc2c087d187e Signed-off-by: Richard Marian Thomaiyar --- user_channel/channel_layer.hpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/user_channel/channel_layer.hpp b/user_channel/channel_layer.hpp index 5c82fba..b86d6bf 100644 --- a/user_channel/channel_layer.hpp +++ b/user_channel/channel_layer.hpp @@ -16,6 +16,8 @@ #pragma once #include +#include +#include #include namespace ipmi @@ -258,6 +260,24 @@ ipmi_ret_t getChannelInfo(const uint8_t chNum, ChannelInfo& chInfo); ipmi_ret_t getChannelAccessData(const uint8_t chNum, ChannelAccess& chAccessData); +/** @brief provides function to convert current channel number (0xE) + * + * @param[in] chNum - channel number as requested in commands. + * @param[in] ipmi::context - ipmi context ptr, which has more details + * + * @return same channel number or proper channel number for current channel + * number (0xE). + */ +inline uint8_t convertCurrentChannelNum(const uint8_t chNum, + ipmi::Context::ptr ctx) +{ + if (chNum == currentChNum) + { + return ctx->channel; + } + return chNum; +} + /** @brief provides function to convert current channel number (0xE) * * @param[in] chNum - channel number as requested in commands. -- cgit v1.2.1