blob: ec0fc5341985f7261b051973d521f7624af04c11 [file] [log] [blame]
Deepak Kodihalli4de4d002019-11-11 02:41:43 -06001#include "dbus_impl_requester.hpp"
2
3#include "xyz/openbmc_project/Common/error.hpp"
4
5#include <phosphor-logging/elog-errors.hpp>
6
7using namespace sdbusplus::xyz::openbmc_project::Common::Error;
8using namespace phosphor::logging;
9
10namespace pldm
11{
12namespace dbus_api
13{
14
15uint8_t Requester::getInstanceId(uint8_t eid)
16{
17 if (ids.find(eid) == ids.end())
18 {
19 InstanceId id;
20 ids.emplace(eid, InstanceId());
21 }
22
23 uint8_t id{};
24 try
25 {
26 id = ids[eid].next();
27 }
28 catch (const std::runtime_error& e)
29 {
30 elog<TooManyResources>();
31 }
32
33 return id;
34}
35
36} // namespace dbus_api
37} // namespace pldm