send PLDM event msg when state sensor changes
Add the D-Bus to event handler interface to listen all of the state
sensor PDRs and pldm should be able to send up a PLDM event msg when a
D-Bus property changes. the PlatformEventMessage command format is
defined in Table 15 in DSP0248 v1.2.0.
Tested: test with JSON
https://gist.github.com/lxwinspur/6a40abea7330c25e4d49826e890c4be9
The sendEventMsg method is successfully called and the corresponding
message is successfully sent when the D-Bus property value of the sensor
status changes.
print requestMsg Data: 80 02 0a 01 00 00 01 00 01 00 00 00(when calling
sendEventMsg method)
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I9b6d5c1403bfcaa00dbbf478f7d797cc4a40f20d
diff --git a/test/libpldmresponder_platform_test.cpp b/test/libpldmresponder_platform_test.cpp
index 61a823f..28dd1e0 100644
--- a/test/libpldmresponder_platform_test.cpp
+++ b/test/libpldmresponder_platform_test.cpp
@@ -40,7 +40,7 @@
auto pdrRepo = pldm_pdr_init();
Handler handler(&mockedUtils, "./pdr_jsons/state_effecter/good",
- "./event_jsons/good", pdrRepo, nullptr, nullptr);
+ "./event_jsons/good", pdrRepo, nullptr, nullptr, nullptr);
Repo repo(pdrRepo);
ASSERT_EQ(repo.empty(), false);
auto response = handler.getPDR(req, requestPayloadLength);
@@ -77,7 +77,7 @@
auto pdrRepo = pldm_pdr_init();
Handler handler(&mockedUtils, "./pdr_jsons/state_effecter/good",
- "./event_jsons/good", pdrRepo, nullptr, nullptr);
+ "./event_jsons/good", pdrRepo, nullptr, nullptr, nullptr);
Repo repo(pdrRepo);
ASSERT_EQ(repo.empty(), false);
auto response = handler.getPDR(req, requestPayloadLength);
@@ -108,7 +108,7 @@
auto pdrRepo = pldm_pdr_init();
Handler handler(&mockedUtils, "./pdr_jsons/state_effecter/good",
- "./event_jsons/good", pdrRepo, nullptr, nullptr);
+ "./event_jsons/good", pdrRepo, nullptr, nullptr, nullptr);
Repo repo(pdrRepo);
ASSERT_EQ(repo.empty(), false);
auto response = handler.getPDR(req, requestPayloadLength);
@@ -137,7 +137,7 @@
auto pdrRepo = pldm_pdr_init();
Handler handler(&mockedUtils, "./pdr_jsons/state_effecter/good",
- "./event_jsons/good", pdrRepo, nullptr, nullptr);
+ "./event_jsons/good", pdrRepo, nullptr, nullptr, nullptr);
Repo repo(pdrRepo);
ASSERT_EQ(repo.empty(), false);
auto response = handler.getPDR(req, requestPayloadLength);
@@ -168,7 +168,7 @@
auto pdrRepo = pldm_pdr_init();
Handler handler(&mockedUtils, "./pdr_jsons/state_effecter/good",
- "./event_jsons/good", pdrRepo, nullptr, nullptr);
+ "./event_jsons/good", pdrRepo, nullptr, nullptr, nullptr);
Repo repo(pdrRepo);
ASSERT_EQ(repo.empty(), false);
auto response = handler.getPDR(req, requestPayloadLength);
@@ -230,7 +230,7 @@
auto outPDRRepo = pldm_pdr_init();
Repo outRepo(outPDRRepo);
Handler handler(&mockedUtils, "./pdr_jsons/state_effecter/good",
- "./event_jsons/good", inPDRRepo, nullptr, nullptr);
+ "./event_jsons/good", inPDRRepo, nullptr, nullptr, nullptr);
handler.getPDR(req, requestPayloadLength);
Repo inRepo(inPDRRepo);
getRepoByType(inRepo, outRepo, PLDM_STATE_EFFECTER_PDR);
@@ -276,7 +276,7 @@
auto outPDRRepo = pldm_pdr_init();
Repo outRepo(outPDRRepo);
Handler handler(&mockedUtils, "./pdr_jsons/state_effecter/good",
- "./event_jsons/good", inPDRRepo, nullptr, nullptr);
+ "./event_jsons/good", inPDRRepo, nullptr, nullptr, nullptr);
handler.getPDR(req, requestPayloadLength);
Repo inRepo(inPDRRepo);
getRepoByType(inRepo, outRepo, PLDM_STATE_EFFECTER_PDR);
@@ -321,7 +321,7 @@
auto numericEffecterPdrRepo = pldm_pdr_init();
Repo numericEffecterPDRs(numericEffecterPdrRepo);
Handler handler(&mockedUtils, "./pdr_jsons/state_effecter/good", "",
- inPDRRepo, nullptr, nullptr);
+ inPDRRepo, nullptr, nullptr, nullptr);
Repo inRepo(inPDRRepo);
getRepoByType(inRepo, numericEffecterPDRs, PLDM_NUMERIC_EFFECTER_PDR);
@@ -363,7 +363,7 @@
auto numericEffecterPdrRepo = pldm_pdr_init();
Repo numericEffecterPDRs(numericEffecterPdrRepo);
Handler handler(&mockedUtils, "./pdr_jsons/state_effecter/good", "",
- inPDRRepo, nullptr, nullptr);
+ inPDRRepo, nullptr, nullptr, nullptr);
Repo inRepo(inPDRRepo);
getRepoByType(inRepo, numericEffecterPDRs, PLDM_NUMERIC_EFFECTER_PDR);
@@ -540,7 +540,7 @@
auto outPDRRepo = pldm_pdr_init();
Repo outRepo(outPDRRepo);
MockdBusHandler mockedUtils;
- Handler handler(&mockedUtils, "", "", inPDRRepo, nullptr, nullptr);
+ Handler handler(&mockedUtils, "", "", inPDRRepo, nullptr, nullptr, nullptr);
Repo inRepo(inPDRRepo);
getRepoByType(inRepo, outRepo, PLDM_TERMINUS_LOCATOR_PDR);
@@ -584,7 +584,7 @@
auto outPDRRepo = pldm_pdr_init();
Repo outRepo(outPDRRepo);
Handler handler(&mockedUtils, "./pdr_jsons/state_sensor/good", "",
- inPDRRepo, nullptr, nullptr);
+ inPDRRepo, nullptr, nullptr, nullptr);
Repo inRepo(inPDRRepo);
getRepoByType(inRepo, outRepo, PLDM_STATE_SENSOR_PDR);
pdr_utils::PdrEntry e;
@@ -630,7 +630,7 @@
auto outPDRRepo = pldm_pdr_init();
Repo outRepo(outPDRRepo);
Handler handler(&mockedUtils, "./pdr_jsons/state_sensor/good", "",
- inPDRRepo, nullptr, nullptr);
+ inPDRRepo, nullptr, nullptr, nullptr);
Repo inRepo(inPDRRepo);
getRepoByType(inRepo, outRepo, PLDM_STATE_SENSOR_PDR);
pdr_utils::PdrEntry e;