blob: 38ddb4445c92da628204e52540cf4338ea4f0e73 [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
Sampa Misraaa8ae722019-12-12 03:20:40 -06005#include <iostream>
Deepak Kodihalli4de4d002019-11-11 02:41:43 -06006
7using namespace sdbusplus::xyz::openbmc_project::Common::Error;
Deepak Kodihalli4de4d002019-11-11 02:41:43 -06008
9namespace pldm
10{
11namespace dbus_api
12{
13
14uint8_t Requester::getInstanceId(uint8_t eid)
15{
16 if (ids.find(eid) == ids.end())
17 {
18 InstanceId id;
19 ids.emplace(eid, InstanceId());
20 }
21
22 uint8_t id{};
23 try
24 {
25 id = ids[eid].next();
26 }
27 catch (const std::runtime_error& e)
28 {
Sampa Misraaa8ae722019-12-12 03:20:40 -060029 throw TooManyResources();
Deepak Kodihalli4de4d002019-11-11 02:41:43 -060030 }
31
32 return id;
33}
34
35} // namespace dbus_api
36} // namespace pldm